logic: Use ControllerProxy in Bookmarking UI classes instead of messaging

* changed ControllerProxy to template class
* allow passing method pointers and arguments to ControllerProxy
* replaced some messages with ControllerProxy calls
* moved logic from BookmarkView into BookmarkController
This commit is contained in:
Eberhard Graether
2017-10-03 07:59:59 +02:00
parent e604d24c40
commit a72da67d32
33 changed files with 641 additions and 840 deletions
@@ -1,33 +0,0 @@
#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, Id nodeId)
: comment(comment)
, displayName(displayName)
, categoryName(categoryName)
, nodeId(nodeId)
{
}
~MessageCreateBookmark()
{
}
static const std::string getStaticType()
{
return "MessageCreateBookmark";
}
const std::string comment;
const std::string displayName;
const std::string categoryName;
const Id nodeId;
};
#endif // MESSAGE_CREATE_BOOKMARK_H
@@ -1,23 +0,0 @@
#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
@@ -1,28 +0,0 @@
#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)
: bookmarkId(bookmarkId)
{
}
~MessageDeleteBookmark()
{
}
static const std::string getStaticType()
{
return "MessageDeleteBookmark";
}
const Id bookmarkId;
};
#endif // MESSAGE_DELETE_BOOKMARK_H
@@ -1,28 +0,0 @@
#ifndef MESSAGE_DELETE_BOOKMARK_CATEGORY_H
#define MESSAGE_DELETE_BOOKMARK_CATEGORY_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageDeleteBookmarkCategory
: public Message<MessageDeleteBookmarkCategory>
{
public:
MessageDeleteBookmarkCategory(const Id id)
: categoryId(id)
{
}
~MessageDeleteBookmarkCategory()
{
}
static const std::string getStaticType()
{
return "MessageDeleteBookmarkCategory";
}
const Id categoryId;
};
#endif // MESSAGE_DELETE_BOOKMARK_CATEGORY_H
@@ -1,24 +0,0 @@
#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
@@ -7,12 +7,7 @@ class MessageDisplayBookmarkCreator
: public Message<MessageDisplayBookmarkCreator>
{
public:
MessageDisplayBookmarkCreator()
: nodeId(0)
{
}
MessageDisplayBookmarkCreator(Id nodeId)
MessageDisplayBookmarkCreator(Id nodeId = 0)
: nodeId(nodeId)
{
}
@@ -22,7 +17,7 @@ public:
return "MessageDisplayBookmarkCreator";
}
Id nodeId;
const Id nodeId;
};
#endif // MESSAGE_DISPLAY_BOOKMARK_CREATOR_H
@@ -1,25 +0,0 @@
#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
@@ -1,48 +1,29 @@
#ifndef MESSAGE_DISPLAY_BOOKMARKS_H
#define MESSAGE_DISPLAY_BOOKMARKS_H
#include "data/bookmark/Bookmark.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)
MessageDisplayBookmarks(
Bookmark::BookmarkFilter filter = Bookmark::FILTER_UNKNOWN,
Bookmark::BookmarkOrder order = Bookmark::ORDER_NONE
)
: filter(filter)
, order(order)
{
}
MessageDisplayBookmarks()
: filter(MessageDisplayBookmarks::BookmarkFilter::ALL)
, order(MessageDisplayBookmarks::BookmarkOrder::NONE)
{
}
static const std::string getStaticType()
{
return "MessageDisplayBookmarks";
}
const BookmarkFilter filter;
const BookmarkOrder order;
const Bookmark::BookmarkFilter filter;
const Bookmark::BookmarkOrder order;
};
#endif // MESSAGE_DISPLAY_BOOKMARKS_H
@@ -1,34 +0,0 @@
#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(Id id, const std::string& comment, const std::string& displayName, const std::string& categoryName)
: bookmarkId(id)
, comment(comment)
, displayName(displayName)
, categoryName(categoryName)
{
}
~MessageEditBookmark()
{
}
static const std::string getStaticType()
{
return "MessageEditBookmark";
}
const Id bookmarkId;
const std::string comment;
const std::string displayName;
const std::string categoryName;
};
#endif // MESSAGE_EDIT_BOOKMARK_H