fix: contextmenu getInstance added
This commit is contained in:
@@ -58,14 +58,14 @@ void QtUndoRedo::redo()
|
|||||||
void QtUndoRedo::setUndoButtonEnabled(bool enabled)
|
void QtUndoRedo::setUndoButtonEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
m_undoButton->setEnabled(enabled);
|
m_undoButton->setEnabled(enabled);
|
||||||
QtContextMenu::enableUndo(enabled);
|
QtContextMenu::getInstance()->enableUndo(enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtUndoRedo::setRedoButtonEnabled(bool enabled)
|
void QtUndoRedo::setRedoButtonEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
m_redoButton->setEnabled(enabled);
|
m_redoButton->setEnabled(enabled);
|
||||||
QtContextMenu::enableRedo(enabled);
|
QtContextMenu::getInstance()->enableRedo(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtUndoRedo::refreshStyle()
|
void QtUndoRedo::refreshStyle()
|
||||||
|
|||||||
@@ -23,30 +23,7 @@ QtContextMenu::QtContextMenu(QContextMenuEvent* event, QWidget* origin)
|
|||||||
: m_menu(origin)
|
: m_menu(origin)
|
||||||
, m_point(event->globalPos())
|
, m_point(event->globalPos())
|
||||||
{
|
{
|
||||||
if (!s_instance)
|
getInstance();
|
||||||
{
|
|
||||||
s_instance = new QtContextMenu();
|
|
||||||
|
|
||||||
s_undoAction = new QAction(tr("Back"), s_instance);
|
|
||||||
s_undoAction->setStatusTip(tr("Go back to last active symbol"));
|
|
||||||
s_undoAction->setToolTip(tr("Go back to last active symbol"));
|
|
||||||
connect(s_undoAction, SIGNAL(triggered()), s_instance, SLOT(undoActionTriggered()));
|
|
||||||
|
|
||||||
s_redoAction = new QAction(tr("Forward"), s_instance);
|
|
||||||
s_redoAction->setStatusTip(tr("Go forward to next active symbol"));
|
|
||||||
s_redoAction->setToolTip(tr("Go forward to next active symbol"));
|
|
||||||
connect(s_redoAction, SIGNAL(triggered()), s_instance, SLOT(redoActionTriggered()));
|
|
||||||
|
|
||||||
s_copyFullPathAction = new QAction(tr("Copy Full Path"), s_instance);
|
|
||||||
s_copyFullPathAction->setStatusTip(tr("Copies the path of this file to the clipboard"));
|
|
||||||
s_copyFullPathAction->setToolTip(tr("Copies the path of this file to the clipboard"));
|
|
||||||
connect(s_copyFullPathAction, SIGNAL(triggered()), s_instance, SLOT(copyFullPathActionTriggered()));
|
|
||||||
|
|
||||||
s_openContainingFolderAction = new QAction(tr("Open Containing Folder"), s_instance);
|
|
||||||
s_openContainingFolderAction->setStatusTip(tr("Opens the folder that contains this file"));
|
|
||||||
s_openContainingFolderAction->setToolTip(tr("Opens the folder that contains this file"));
|
|
||||||
connect(s_openContainingFolderAction, SIGNAL(triggered()), s_instance, SLOT(openContainingFolderActionTriggered()));
|
|
||||||
}
|
|
||||||
|
|
||||||
addUndoActions();
|
addUndoActions();
|
||||||
}
|
}
|
||||||
@@ -80,6 +57,36 @@ void QtContextMenu::addFileActions(FilePath filePath)
|
|||||||
addAction(s_openContainingFolderAction);
|
addAction(s_openContainingFolderAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtContextMenu* QtContextMenu::getInstance()
|
||||||
|
{
|
||||||
|
if (!s_instance)
|
||||||
|
{
|
||||||
|
s_instance = new QtContextMenu();
|
||||||
|
|
||||||
|
s_undoAction = new QAction(tr("Back"), s_instance);
|
||||||
|
s_undoAction->setStatusTip(tr("Go back to last active symbol"));
|
||||||
|
s_undoAction->setToolTip(tr("Go back to last active symbol"));
|
||||||
|
connect(s_undoAction, SIGNAL(triggered()), s_instance, SLOT(undoActionTriggered()));
|
||||||
|
|
||||||
|
s_redoAction = new QAction(tr("Forward"), s_instance);
|
||||||
|
s_redoAction->setStatusTip(tr("Go forward to next active symbol"));
|
||||||
|
s_redoAction->setToolTip(tr("Go forward to next active symbol"));
|
||||||
|
connect(s_redoAction, SIGNAL(triggered()), s_instance, SLOT(redoActionTriggered()));
|
||||||
|
|
||||||
|
s_copyFullPathAction = new QAction(tr("Copy Full Path"), s_instance);
|
||||||
|
s_copyFullPathAction->setStatusTip(tr("Copies the path of this file to the clipboard"));
|
||||||
|
s_copyFullPathAction->setToolTip(tr("Copies the path of this file to the clipboard"));
|
||||||
|
connect(s_copyFullPathAction, SIGNAL(triggered()), s_instance, SLOT(copyFullPathActionTriggered()));
|
||||||
|
|
||||||
|
s_openContainingFolderAction = new QAction(tr("Open Containing Folder"), s_instance);
|
||||||
|
s_openContainingFolderAction->setStatusTip(tr("Opens the folder that contains this file"));
|
||||||
|
s_openContainingFolderAction->setToolTip(tr("Opens the folder that contains this file"));
|
||||||
|
connect(s_openContainingFolderAction, SIGNAL(triggered()), s_instance, SLOT(openContainingFolderActionTriggered()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
void QtContextMenu::addSeparator()
|
void QtContextMenu::addSeparator()
|
||||||
{
|
{
|
||||||
m_menu.addSeparator();
|
m_menu.addSeparator();
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ public:
|
|||||||
void addUndoActions();
|
void addUndoActions();
|
||||||
void addFileActions(FilePath filePath);
|
void addFileActions(FilePath filePath);
|
||||||
|
|
||||||
|
static QtContextMenu* getInstance();
|
||||||
|
|
||||||
void addSeparator();
|
void addSeparator();
|
||||||
|
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
static void enableUndo(bool enabled);
|
void enableUndo(bool enabled);
|
||||||
static void enableRedo(bool enabled);
|
void enableRedo(bool enabled);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void undoActionTriggered();
|
void undoActionTriggered();
|
||||||
|
|||||||
Reference in New Issue
Block a user