ui: Refactored context menu API, added file path actions in graph and code

* Add 'copy full path' and 'show containing folder' actions to graph view, code view
* Added file path to file node tooltip

bug id = 320
This commit is contained in:
Eberhard Graether
2017-01-26 21:54:57 +01:00
parent 4fc0785002
commit 2aa8c4c22c
11 changed files with 185 additions and 94 deletions
+28 -8
View File
@@ -3,30 +3,50 @@
#include <memory>
#include <QAction>
#include <QMenu>
#include <QObject>
#include "utility/file/FilePath.h"
#include "utility/logging/logging.h"
class QtContextMenu
: public QObject
{
Q_OBJECT
public:
static QtContextMenu* getInstance();
QtContextMenu(QContextMenuEvent* event, QWidget* origin);
QtContextMenu();
void addAction(QAction* action);
void addUndoActions();
void addFileActions(FilePath filePath);
void showDefault(QContextMenuEvent* event, QWidget* origin);
void showExtended(QContextMenuEvent* event, QWidget* origin, const std::vector<QAction*>& actions);
void addSeparator();
void show();
private slots:
void undoActionTriggered();
void redoActionTriggered();
private:
static std::shared_ptr<QtContextMenu> s_instance;
void copyFullPathActionTriggered();
void openContainingFolderActionTriggered();
QAction* m_undoAction;
QAction* m_redoAction;
private:
QtContextMenu();
static QtContextMenu* s_instance;
static QAction* s_undoAction;
static QAction* s_redoAction;
static QAction* s_copyFullPathAction;
static QAction* s_openContainingFolderAction;
static FilePath s_filePath;
QMenu m_menu;
QPoint m_point;
};
#endif // QT_CONTEXT_MENU_H