ui: bookmarks
can now bookmark tokens
This commit is contained in:
@@ -44,7 +44,35 @@ std::string TimePoint::toString() const
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string TimePoint::getDDMMYYYYString() const
|
||||
{
|
||||
std::stringstream stream;
|
||||
boost::posix_time::time_facet* facet = new boost::posix_time::time_facet();
|
||||
facet->format("%d-%m-%Y");
|
||||
stream.imbue(std::locale(std::locale::classic(), facet));
|
||||
stream << m_time;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
size_t TimePoint::deltaMS(const TimePoint& other) const
|
||||
{
|
||||
return (m_time - other.m_time).total_milliseconds();
|
||||
}
|
||||
|
||||
bool TimePoint::isSameDay(const TimePoint& other) const
|
||||
{
|
||||
if (m_time.date().day() == other.m_time.date().day() &&
|
||||
m_time.date().month() == other.m_time.date().month() &&
|
||||
m_time.date().year() == other.m_time.date().year())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t TimePoint::deltaDays(const TimePoint& other) const
|
||||
{
|
||||
boost::gregorian::date_duration deltaDate = m_time.date() - other.m_time.date();
|
||||
return size_t(std::abs(deltaDate.days()));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
|
||||
class TimePoint
|
||||
class TimePoint // that name sounds pretty silly, was time stamp not ok?
|
||||
{
|
||||
public:
|
||||
static TimePoint now();
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
bool isValid() const;
|
||||
|
||||
std::string toString() const;
|
||||
std::string getDDMMYYYYString() const;
|
||||
|
||||
inline bool operator==(const TimePoint& rhs){ return m_time == rhs.m_time; }
|
||||
inline bool operator!=(const TimePoint& rhs){ return m_time != rhs.m_time; }
|
||||
@@ -28,6 +29,9 @@ public:
|
||||
|
||||
size_t deltaMS(const TimePoint& other) const;
|
||||
|
||||
bool isSameDay(const TimePoint& other) const;
|
||||
size_t deltaDays(const TimePoint& other) const; // days are counted beginning at 00:00, so a tp of 1.1.2017 23:59 is 1 day ago if it's the 2.1.2017 00:01
|
||||
|
||||
private:
|
||||
boost::posix_time::ptime m_time;
|
||||
};
|
||||
|
||||
@@ -16,8 +16,15 @@ std::shared_ptr<LogManager> LogManager::createInstance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
// what is this method for? why would you want to risk returning s_instance without checking whether it is initialized???
|
||||
std::shared_ptr<LogManager> LogManager::getInstance()
|
||||
{
|
||||
// return s_instance; // original implementation
|
||||
|
||||
if (s_instance.use_count() == 0)
|
||||
{
|
||||
s_instance = std::shared_ptr<LogManager>(new LogManager());
|
||||
}
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef MESSAGE_ACTIVATE_BOOKMARK_H
|
||||
#define MESSAGE_ACTIVATE_BOOKMARK_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
|
||||
class MessageActivateBookmark
|
||||
: public Message<MessageActivateBookmark>
|
||||
{
|
||||
public:
|
||||
MessageActivateBookmark(const std::shared_ptr<Bookmark>& bookmark)
|
||||
: bookmark(bookmark)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~MessageActivateBookmark()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageActivateBookmark";
|
||||
}
|
||||
|
||||
const std::shared_ptr<Bookmark> bookmark;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_ACTIVATE_BOOKMARK_H
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef MESSAGE_CREATE_BOOKMARK_H
|
||||
#define MESSAGE_CREATE_BOOKMARK_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageCreateBookmark
|
||||
: public Message<MessageCreateBookmark>
|
||||
{
|
||||
public:
|
||||
MessageCreateBookmark(const std::string& comment, const std::string& displayName, const std::string& categoryName)
|
||||
: comment(comment)
|
||||
, displayName(displayName)
|
||||
, categoryName(categoryName)
|
||||
{
|
||||
}
|
||||
|
||||
~MessageCreateBookmark()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageCreateBookmark";
|
||||
}
|
||||
|
||||
const std::string comment;
|
||||
const std::string displayName;
|
||||
const std::string categoryName;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_CREATE_BOOKMARK_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef MESSAGE_CREATE_BOOKMARK_CATEGORY_H
|
||||
#define MESSAGE_CREATE_BOOKMARK_CATEGORY_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageCreateBookmarkCategory
|
||||
: public Message<MessageCreateBookmarkCategory>
|
||||
{
|
||||
public:
|
||||
MessageCreateBookmarkCategory(const std::string& name)
|
||||
: name(name)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageCreateBookmarkCategory";
|
||||
}
|
||||
|
||||
const std::string name;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_CREATE_BOOKMARK_CATEGORY_H
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef MESSAGE_DELETE_BOOKMARK_H
|
||||
#define MESSAGE_DELETE_BOOKMARK_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class MessageDeleteBookmark
|
||||
: public Message<MessageDeleteBookmark>
|
||||
{
|
||||
public:
|
||||
MessageDeleteBookmark(const Id bookmarkId, const bool isEdge)
|
||||
: bookmarkId(bookmarkId)
|
||||
, isEdge(isEdge)
|
||||
{
|
||||
}
|
||||
|
||||
~MessageDeleteBookmark()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDeleteBookmark";
|
||||
}
|
||||
|
||||
const Id bookmarkId;
|
||||
const bool isEdge;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DELETE_BOOKMARK_H
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef MESSAGE_DELETE_BOOKMARK_CATEGORY_WITH_BOOKMARKS_H
|
||||
#define MESSAGE_DELETE_BOOKMARK_CATEGORY_WITH_BOOKMARKS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class MessageDeleteBookmarkCategoryWithBookmarks
|
||||
: public Message<MessageDeleteBookmarkCategoryWithBookmarks>
|
||||
{
|
||||
public:
|
||||
MessageDeleteBookmarkCategoryWithBookmarks(const Id id)
|
||||
: categoryId(id)
|
||||
{
|
||||
}
|
||||
|
||||
~MessageDeleteBookmarkCategoryWithBookmarks()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDeleteBookmarkCategoryWithBookmarks";
|
||||
}
|
||||
|
||||
const Id categoryId;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DELETE_BOOKMARK_CATEGORY_WITH_BOOKMARKS_H
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef MESSAGE_DELETE_BOOKMARK_FOR_ACTIVE_TOKENS
|
||||
#define MESSAGE_DELETE_BOOKMARK_FOR_ACTIVE_TOKENS
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDeleteBookmarkForActiveTokens
|
||||
: public Message<MessageDeleteBookmarkForActiveTokens>
|
||||
{
|
||||
public:
|
||||
MessageDeleteBookmarkForActiveTokens()
|
||||
{
|
||||
}
|
||||
|
||||
~MessageDeleteBookmarkForActiveTokens()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDeleteBookmarkForActiveTokens";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DELETE_BOOKMARK_FOR_ACTIVE_TOKENS
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_DISPLAY_BOOKMARK_CREATOR_H
|
||||
#define MESSAGE_DISPLAY_BOOKMARK_CREATOR_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDisplayBookmarkCreator
|
||||
: public Message<MessageDisplayBookmarkCreator>
|
||||
{
|
||||
public:
|
||||
MessageDisplayBookmarkCreator()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDisplayBookmarkCreator";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPLAY_BOOKMARK_CREATOR_H
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef MESSAGE_DISPLAY_BOOKMARK_EDITOR_H
|
||||
#define MESSAGE_DISPLAY_BOOKMARK_EDITOR_H
|
||||
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDisplayBookmarkEditor
|
||||
: public Message<MessageDisplayBookmarkEditor>
|
||||
{
|
||||
public:
|
||||
MessageDisplayBookmarkEditor(std::shared_ptr<Bookmark> bookmark)
|
||||
: bookmark(bookmark)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDisplayBookmarkEditor";
|
||||
}
|
||||
|
||||
std::shared_ptr<Bookmark> bookmark;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPLAY_BOOKMARK_EDITOR_H
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef MESSAGE_DISPLAY_BOOKMARKS_H
|
||||
#define MESSAGE_DISPLAY_BOOKMARKS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDisplayBookmarks
|
||||
: public Message<MessageDisplayBookmarks>
|
||||
{
|
||||
public:
|
||||
enum BookmarkFilter
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
ALL,
|
||||
NODES,
|
||||
EDGES
|
||||
};
|
||||
|
||||
enum BookmarkOrder
|
||||
{
|
||||
NONE = 0,
|
||||
DATE_ASCENDING,
|
||||
DATE_DESCENDING,
|
||||
NAME_ASCENDING,
|
||||
NAME_DESCENDING
|
||||
};
|
||||
|
||||
MessageDisplayBookmarks(const BookmarkFilter& filter, const BookmarkOrder& order)
|
||||
: filter(filter)
|
||||
, order(order)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDisplayBookmarks";
|
||||
}
|
||||
|
||||
const BookmarkFilter filter;
|
||||
const BookmarkOrder order;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPLAY_BOOKMARKS_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef MESSAGE_EDIT_BOOKMARK_H
|
||||
#define MESSAGE_EDIT_BOOKMARK_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class MessageEditBookmark
|
||||
: public Message<MessageEditBookmark>
|
||||
{
|
||||
public:
|
||||
MessageEditBookmark(const Id id, const std::string& comment, const std::string& displayName, const std::string& categoryName, const bool isEdge)
|
||||
: bookmarkId(id)
|
||||
, comment(comment)
|
||||
, displayName(displayName)
|
||||
, categoryName(categoryName)
|
||||
, isEdge(isEdge)
|
||||
{
|
||||
}
|
||||
|
||||
~MessageEditBookmark()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageEditBookmark";
|
||||
}
|
||||
|
||||
const Id bookmarkId;
|
||||
const std::string comment;
|
||||
const std::string displayName;
|
||||
const std::string categoryName;
|
||||
const bool isEdge;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_EDIT_BOOKMARK_H
|
||||
@@ -9,6 +9,7 @@ class MessagePingReceived
|
||||
public:
|
||||
MessagePingReceived()
|
||||
: ideId("")
|
||||
, ideName("")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,6 +19,7 @@ public:
|
||||
}
|
||||
|
||||
std::string ideId;
|
||||
std::string ideName;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_PING_RECEIVED_H
|
||||
Reference in New Issue
Block a user