ui: Added history of last active symbols to UI and menu (issue 151)

* holding down back or forward button shows list of current back-forward stack
* added narrow button between back and forward to show the list
* added History menu
* moved back and forward actions to History menu
* show chronological list of recently active symbols in History menu

bug id = 151

fortune cookie message = Dein Geschäft wird gut laufen und expandieren.
This commit is contained in:
Eberhard Graether
2017-05-09 17:14:43 +02:00
parent bb8c2ae5a9
commit f4caacacf2
30 changed files with 668 additions and 65 deletions
+10
View File
@@ -104,6 +104,16 @@ void QtMainView::updateRecentProjectMenu()
m_updateRecentProjectMenuFunctor();
}
void QtMainView::updateHistoryMenu(const std::vector<SearchMatch>& history)
{
m_onQtThread(
[=]()
{
m_window->updateHistoryMenu(history);
}
);
}
void QtMainView::handleMessage(MessageForceEnterLicense* message)
{
m_forceLicenseScreenFunctor(message->licenseExpired);
+1
View File
@@ -49,6 +49,7 @@ public:
virtual void setTitle(const std::string& title);
virtual void activateWindow();
virtual void updateRecentProjectMenu();
virtual void updateHistoryMenu(const std::vector<SearchMatch>& history);
private:
void handleMessage(MessageForceEnterLicense* message);
+36 -29
View File
@@ -1,17 +1,13 @@
#include "qt/view/QtUndoRedoView.h"
#include "utility/ResourcePaths.h"
#include "qt/utility/utilityQt.h"
#include "qt/view/QtMainView.h"
#include "qt/view/QtViewWidgetWrapper.h"
#include "utility/ResourcePaths.h"
QtUndoRedoView::QtUndoRedoView(ViewLayout* viewLayout)
: UndoRedoView(viewLayout)
, m_refreshFunctor(std::bind(&QtUndoRedoView::doRefreshView, this))
, m_setRedoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetRedoButtonEnabled, this, std::placeholders::_1))
, m_setUndoButtonEnabledFunctor(std::bind(&QtUndoRedoView::doSetUndoButtonEnabled, this, std::placeholders::_1))
{
m_widget = new QtUndoRedo();
setStyleSheet();
@@ -32,36 +28,47 @@ void QtUndoRedoView::initView()
void QtUndoRedoView::refreshView()
{
m_refreshFunctor();
}
void QtUndoRedoView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("undoredo_view/undoredo_view.css"))).c_str());
}
void QtUndoRedoView::doRefreshView()
{
setStyleSheet();
m_widget->refreshStyle();
}
void QtUndoRedoView::doSetRedoButtonEnabled(bool enabled)
{
m_widget->setRedoButtonEnabled(enabled);
}
void QtUndoRedoView::doSetUndoButtonEnabled(bool enabled)
{
m_widget->setUndoButtonEnabled(enabled);
m_onQtThread(
[=]()
{
setStyleSheet();
m_widget->refreshStyle();
}
);
}
void QtUndoRedoView::setRedoButtonEnabled(bool enabled)
{
m_setRedoButtonEnabledFunctor(enabled);
m_onQtThread(
[=]()
{
m_widget->setRedoButtonEnabled(enabled);
}
);
}
void QtUndoRedoView::setUndoButtonEnabled(bool enabled)
{
m_setUndoButtonEnabledFunctor(enabled);
m_onQtThread(
[=]()
{
m_widget->setUndoButtonEnabled(enabled);
}
);
}
void QtUndoRedoView::updateHistory(const std::vector<SearchMatch>& searchMatches, size_t currentIndex)
{
m_onQtThread(
[=]()
{
m_widget->updateHistory(searchMatches, currentIndex);
}
);
}
void QtUndoRedoView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(
ResourcePaths::getGuiPath().concat(FilePath("undoredo_view/undoredo_view.css"))).c_str());
}
+6 -10
View File
@@ -23,18 +23,14 @@ public:
virtual void setRedoButtonEnabled(bool enabled);
virtual void setUndoButtonEnabled(bool enabled);
virtual void updateHistory(const std::vector<SearchMatch>& searchMatches, size_t currentIndex);
private:
void doRefreshView();
void doSetRedoButtonEnabled(bool enabled);
void doSetUndoButtonEnabled(bool enabled);
QtThreadedFunctor<void> m_refreshFunctor;
QtThreadedFunctor<bool> m_setRedoButtonEnabledFunctor;
QtThreadedFunctor<bool> m_setUndoButtonEnabledFunctor;
void setStyleSheet();
QtThreadedLambdaFunctor m_onQtThread;
QtUndoRedo* m_widget;
};
#endif // !QT_UNDO_REDO_VIEW_H
#endif // QT_UNDO_REDO_VIEW_H