@@ -166,6 +166,11 @@ void Application::updateHistory(const std::vector<SearchMatch>& history)
|
|||||||
m_mainView->updateHistoryMenu(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)
|
void Application::createAndLoadProject(const FilePath& projectSettingsFilePath)
|
||||||
{
|
{
|
||||||
MessageStatus("Loading Project: " + projectSettingsFilePath.str(), false, true).dispatch();
|
MessageStatus("Loading Project: " + projectSettingsFilePath.str(), false, true).dispatch();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||||
|
|
||||||
|
class Bookmark;
|
||||||
class DialogView;
|
class DialogView;
|
||||||
class IDECommunicationController;
|
class IDECommunicationController;
|
||||||
class MainView;
|
class MainView;
|
||||||
@@ -54,6 +55,7 @@ public:
|
|||||||
bool isInTrial() const;
|
bool isInTrial() const;
|
||||||
|
|
||||||
void updateHistory(const std::vector<SearchMatch>& history);
|
void updateHistory(const std::vector<SearchMatch>& history);
|
||||||
|
void updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::shared_ptr<Application> s_instance;
|
static std::shared_ptr<Application> s_instance;
|
||||||
|
|||||||
@@ -361,6 +361,8 @@ void BookmarkController::handleMessage(MessageFinishedParsing* message)
|
|||||||
{
|
{
|
||||||
m_bookmarkCache.clear();
|
m_bookmarkCache.clear();
|
||||||
getView<BookmarkView>()->enableDisplayBookmarks(true);
|
getView<BookmarkView>()->enableDisplayBookmarks(true);
|
||||||
|
|
||||||
|
getView<BookmarkView>()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkController::handleMessage(MessageShowErrors* message)
|
void BookmarkController::handleMessage(MessageShowErrors* message)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "component/view/BookmarkView.h"
|
#include "component/view/BookmarkView.h"
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "component/controller/BookmarkController.h"
|
#include "component/controller/BookmarkController.h"
|
||||||
|
|
||||||
BookmarkView::BookmarkView(ViewLayout* viewLayout)
|
BookmarkView::BookmarkView(ViewLayout* viewLayout)
|
||||||
@@ -24,6 +25,19 @@ void BookmarkView::update()
|
|||||||
{
|
{
|
||||||
displayBookmarks(getController()->getBookmarks(m_filter, m_order));
|
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()
|
BookmarkController* BookmarkView::getController()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "component/view/ViewLayout.h"
|
#include "component/view/ViewLayout.h"
|
||||||
|
|
||||||
struct SearchMatch;
|
struct SearchMatch;
|
||||||
|
class Bookmark;
|
||||||
|
|
||||||
class MainView
|
class MainView
|
||||||
: public ViewLayout
|
: public ViewLayout
|
||||||
@@ -24,6 +25,7 @@ public:
|
|||||||
|
|
||||||
virtual void updateRecentProjectMenu() = 0;
|
virtual void updateRecentProjectMenu() = 0;
|
||||||
virtual void updateHistoryMenu(const std::vector<SearchMatch>& history) = 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
|
#endif // MAIN_VIEW_H
|
||||||
|
|||||||
@@ -128,6 +128,16 @@ void QtMainView::updateHistoryMenu(const std::vector<SearchMatch>& history)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtMainView::updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||||
|
{
|
||||||
|
m_onQtThread(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
m_window->updateBookmarksMenu(bookmarks);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void QtMainView::handleMessage(MessageForceEnterLicense* message)
|
void QtMainView::handleMessage(MessageForceEnterLicense* message)
|
||||||
{
|
{
|
||||||
bool expired = message->licenseExpired;
|
bool expired = message->licenseExpired;
|
||||||
|
|||||||
@@ -48,8 +48,10 @@ public:
|
|||||||
virtual void hideStartScreen();
|
virtual void hideStartScreen();
|
||||||
virtual void setTitle(const std::string& title);
|
virtual void setTitle(const std::string& title);
|
||||||
virtual void activateWindow();
|
virtual void activateWindow();
|
||||||
|
|
||||||
virtual void updateRecentProjectMenu();
|
virtual void updateRecentProjectMenu();
|
||||||
virtual void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
virtual void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
||||||
|
virtual void updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleMessage(MessageForceEnterLicense* message);
|
void handleMessage(MessageForceEnterLicense* message);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "component/view/CompositeView.h"
|
#include "component/view/CompositeView.h"
|
||||||
#include "component/view/TabbedView.h"
|
#include "component/view/TabbedView.h"
|
||||||
#include "component/view/View.h"
|
#include "component/view/View.h"
|
||||||
|
#include "data/bookmark/Bookmark.h"
|
||||||
#include "LicenseChecker.h"
|
#include "LicenseChecker.h"
|
||||||
#include "qt/utility/QtContextMenu.h"
|
#include "qt/utility/QtContextMenu.h"
|
||||||
#include "qt/utility/utilityQt.h"
|
#include "qt/utility/utilityQt.h"
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#include "settings/ApplicationSettings.h"
|
#include "settings/ApplicationSettings.h"
|
||||||
#include "utility/file/FileSystem.h"
|
#include "utility/file/FileSystem.h"
|
||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
|
#include "utility/messaging/type/MessageActivateBookmark.h"
|
||||||
#include "utility/messaging/type/MessageCodeReference.h"
|
#include "utility/messaging/type/MessageCodeReference.h"
|
||||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||||
@@ -98,6 +100,7 @@ bool MouseReleaseFilter::eventFilter(QObject* obj, QEvent* event)
|
|||||||
|
|
||||||
QtMainWindow::QtMainWindow()
|
QtMainWindow::QtMainWindow()
|
||||||
: m_historyMenu(nullptr)
|
: m_historyMenu(nullptr)
|
||||||
|
, m_bookmarksMenu(nullptr)
|
||||||
, m_showDockWidgetTitleBars(true)
|
, m_showDockWidgetTitleBars(true)
|
||||||
, m_windowStack(this)
|
, m_windowStack(this)
|
||||||
{
|
{
|
||||||
@@ -269,6 +272,12 @@ void QtMainWindow::updateHistoryMenu(const std::vector<SearchMatch>& history)
|
|||||||
setupHistoryMenu();
|
setupHistoryMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtMainWindow::updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||||
|
{
|
||||||
|
m_bookmarks = bookmarks;
|
||||||
|
setupBookmarksMenu();
|
||||||
|
}
|
||||||
|
|
||||||
void QtMainWindow::setContentEnabled(bool enabled)
|
void QtMainWindow::setContentEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
foreach (QAction *action, menuBar()->actions())
|
foreach (QAction *action, menuBar()->actions())
|
||||||
@@ -673,6 +682,16 @@ void QtMainWindow::openHistoryAction()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtMainWindow::activateBookmarkAction()
|
||||||
|
{
|
||||||
|
QAction* action = qobject_cast<QAction*>(sender());
|
||||||
|
if (action)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Bookmark> bookmark = m_bookmarks[action->data().toInt()];
|
||||||
|
MessageActivateBookmark(bookmark).dispatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QtMainWindow::setupProjectMenu()
|
void QtMainWindow::setupProjectMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu = new QMenu(tr("&Project"), this);
|
QMenu *menu = new QMenu(tr("&Project"), this);
|
||||||
@@ -805,11 +824,37 @@ void QtMainWindow::setupHistoryMenu()
|
|||||||
|
|
||||||
void QtMainWindow::setupBookmarksMenu()
|
void QtMainWindow::setupBookmarksMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu = new QMenu(tr("&Bookmarks"), this);
|
if (!m_bookmarksMenu)
|
||||||
menuBar()->addMenu(menu);
|
{
|
||||||
|
m_bookmarksMenu = new QMenu(tr("&Bookmarks"), this);
|
||||||
|
menuBar()->addMenu(m_bookmarksMenu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bookmarksMenu->clear();
|
||||||
|
}
|
||||||
|
|
||||||
menu->addAction(tr("Bookmark Active Symbol..."), this, SLOT(showBookmarkCreator()), QKeySequence(Qt::CTRL + Qt::Key_D));
|
m_bookmarksMenu->addAction(tr("Bookmark Active Symbol..."), this, SLOT(showBookmarkCreator()), QKeySequence(Qt::CTRL + Qt::Key_D));
|
||||||
menu->addAction(tr("Bookmark Manager"), this, SLOT(showBookmarkBrowser()), QKeySequence(Qt::CTRL + Qt::Key_B));
|
m_bookmarksMenu->addAction(tr("Bookmark Manager"), this, SLOT(showBookmarkBrowser()), QKeySequence(Qt::CTRL + Qt::Key_B));
|
||||||
|
|
||||||
|
m_bookmarksMenu->addSeparator();
|
||||||
|
|
||||||
|
QAction* title = new QAction(tr("Recent Bookmarks"));
|
||||||
|
title->setEnabled(false);
|
||||||
|
m_bookmarksMenu->addAction(title);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_bookmarks.size(); i++)
|
||||||
|
{
|
||||||
|
Bookmark* bookmark = m_bookmarks[i].get();
|
||||||
|
std::string name = utility::elide(bookmark->getName(), utility::ELIDE_RIGHT, 50);
|
||||||
|
|
||||||
|
QAction* action = new QAction();
|
||||||
|
action->setText(name.c_str());
|
||||||
|
action->setData(QVariant(int(i)));
|
||||||
|
|
||||||
|
connect(action, SIGNAL(triggered()), this, SLOT(activateBookmarkAction()));
|
||||||
|
m_bookmarksMenu->addAction(action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtMainWindow::setupHelpMenu()
|
void QtMainWindow::setupHelpMenu()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "data/search/SearchMatch.h"
|
#include "data/search/SearchMatch.h"
|
||||||
#include "qt/window/QtWindowStack.h"
|
#include "qt/window/QtWindowStack.h"
|
||||||
|
|
||||||
|
class Bookmark;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class View;
|
class View;
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ public:
|
|||||||
void forceEnterLicense(bool expired);
|
void forceEnterLicense(bool expired);
|
||||||
|
|
||||||
void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
||||||
|
void updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||||
|
|
||||||
void setContentEnabled(bool enabled);
|
void setContentEnabled(bool enabled);
|
||||||
|
|
||||||
@@ -133,6 +135,7 @@ private slots:
|
|||||||
void showBookmarkBrowser();
|
void showBookmarkBrowser();
|
||||||
|
|
||||||
void openHistoryAction();
|
void openHistoryAction();
|
||||||
|
void activateBookmarkAction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct DockWidget
|
struct DockWidget
|
||||||
@@ -166,6 +169,9 @@ private:
|
|||||||
QMenu* m_historyMenu;
|
QMenu* m_historyMenu;
|
||||||
std::vector<SearchMatch> m_history;
|
std::vector<SearchMatch> m_history;
|
||||||
|
|
||||||
|
QMenu* m_bookmarksMenu;
|
||||||
|
std::vector<std::shared_ptr<Bookmark>> m_bookmarks;
|
||||||
|
|
||||||
QAction** m_recentProjectAction;
|
QAction** m_recentProjectAction;
|
||||||
QAction* m_showTitleBarsAction;
|
QAction* m_showTitleBarsAction;
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public:
|
|||||||
QtProjectWizzardContentPathsClassJava(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
QtProjectWizzardContentPathsClassJava(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||||
|
|
||||||
// QtProjectWizzardContent implementation
|
// QtProjectWizzardContent implementation
|
||||||
virtual void populate(QGridLayout* layout, int& row);
|
virtual void populate(QGridLayout* layout, int& row) override;
|
||||||
virtual void load() override;
|
virtual void load() override;
|
||||||
virtual void save() override;
|
virtual void save() override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user