@@ -166,6 +166,11 @@ void Application::updateHistory(const std::vector<SearchMatch>& history)
|
||||
m_mainView->updateHistoryMenu(history);
|
||||
}
|
||||
|
||||
void Application::updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
{
|
||||
m_mainView->updateBookmarksMenu(bookmarks);
|
||||
}
|
||||
|
||||
void Application::createAndLoadProject(const FilePath& projectSettingsFilePath)
|
||||
{
|
||||
MessageStatus("Loading Project: " + projectSettingsFilePath.str(), false, true).dispatch();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
|
||||
class Bookmark;
|
||||
class DialogView;
|
||||
class IDECommunicationController;
|
||||
class MainView;
|
||||
@@ -54,6 +55,7 @@ public:
|
||||
bool isInTrial() const;
|
||||
|
||||
void updateHistory(const std::vector<SearchMatch>& history);
|
||||
void updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
|
||||
private:
|
||||
static std::shared_ptr<Application> s_instance;
|
||||
|
||||
@@ -361,6 +361,8 @@ void BookmarkController::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
m_bookmarkCache.clear();
|
||||
getView<BookmarkView>()->enableDisplayBookmarks(true);
|
||||
|
||||
getView<BookmarkView>()->update();
|
||||
}
|
||||
|
||||
void BookmarkController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "component/view/BookmarkView.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "component/controller/BookmarkController.h"
|
||||
|
||||
BookmarkView::BookmarkView(ViewLayout* viewLayout)
|
||||
@@ -24,6 +25,19 @@ void BookmarkView::update()
|
||||
{
|
||||
displayBookmarks(getController()->getBookmarks(m_filter, m_order));
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> bookmarks = getController()->getBookmarks(
|
||||
MessageDisplayBookmarks::BookmarkFilter::ALL,
|
||||
MessageDisplayBookmarks::BookmarkOrder::DATE_DESCENDING
|
||||
);
|
||||
|
||||
const size_t maxBookmarkMenuCount = 20;
|
||||
if (bookmarks.size() > maxBookmarkMenuCount)
|
||||
{
|
||||
bookmarks.resize(maxBookmarkMenuCount);
|
||||
}
|
||||
|
||||
Application::getInstance()->updateBookmarks(bookmarks);
|
||||
}
|
||||
|
||||
BookmarkController* BookmarkView::getController()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "component/view/ViewLayout.h"
|
||||
|
||||
struct SearchMatch;
|
||||
class Bookmark;
|
||||
|
||||
class MainView
|
||||
: public ViewLayout
|
||||
@@ -24,6 +25,7 @@ public:
|
||||
|
||||
virtual void updateRecentProjectMenu() = 0;
|
||||
virtual void updateHistoryMenu(const std::vector<SearchMatch>& history) = 0;
|
||||
virtual void updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks) = 0;
|
||||
};
|
||||
|
||||
#endif // MAIN_VIEW_H
|
||||
|
||||
Reference in New Issue
Block a user