From 048843a1d41f96e2921d24d353133dbe7ce28598 Mon Sep 17 00:00:00 2001 From: eelke Date: Thu, 15 Aug 2019 12:40:29 +0200 Subject: [PATCH] Bezig met plugin menu systeem --- pglab/QueryToolModule.cpp | 32 +++++++++++++-------------- pglab/pglab.pro | 8 +++++++ pglab/plugin_support/LMenu.cpp | 6 +++++ pglab/plugin_support/LMenu.h | 13 +++++++++++ pglab/plugin_support/LMenuBar.cpp | 6 +++++ pglab/plugin_support/LMenuBar.h | 11 +++++++++ pglab/plugin_support/LMenuItem.cpp | 6 +++++ pglab/plugin_support/LMenuItem.h | 10 +++++++++ pglab/plugin_support/LMenuSection.cpp | 6 +++++ pglab/plugin_support/LMenuSection.h | 11 +++++++++ 10 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 pglab/plugin_support/LMenu.cpp create mode 100644 pglab/plugin_support/LMenu.h create mode 100644 pglab/plugin_support/LMenuBar.cpp create mode 100644 pglab/plugin_support/LMenuBar.h create mode 100644 pglab/plugin_support/LMenuItem.cpp create mode 100644 pglab/plugin_support/LMenuItem.h create mode 100644 pglab/plugin_support/LMenuSection.cpp create mode 100644 pglab/plugin_support/LMenuSection.h diff --git a/pglab/QueryToolModule.cpp b/pglab/QueryToolModule.cpp index a18abc9..98b826d 100644 --- a/pglab/QueryToolModule.cpp +++ b/pglab/QueryToolModule.cpp @@ -30,25 +30,25 @@ void QueryToolModule::init() { auto ca = makeContextAction(tr("Save SQL"), &QueryTool::save); ca->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); -// ca->setMenuLocation(MenuPath("File/Save")); -// ca->setToolbarLocation(ToolbarLocation("main", "save")); + ca->setMenuLocation(MenuPath("File/Save")); + ca->setToolbarLocation(ToolbarLocation("main", "save")); // how we tell the system we want this to become a menu button with this as it's default action registerContextAction(ca); } -// { -// auto ca = makeContextAction(tr("Save SQL as"), &QueryTool::saveAs); -// ca->setMenuLocation(MenuPath("File/Save")); -// ca->setToolbarLocation(ToolbarLocation("main", "save")); -// // how we tell the system we want this to become a secondary action for the previous button? -// registerContextAction(ca); -// } -// { -// auto ca = makeContextAction(tr("Save copy of SQL as"), &QueryTool::saveCopyAs); -// ca->setMenuLocation(MenuPath("File/Save")); -// ca->setToolbarLocation(ToolbarLocation("main", "save")); -// // how we tell the system we want this to become a secondary action for the previous button? -// registerContextAction(ca); -// } + { + auto ca = makeContextAction(tr("Save SQL as"), &QueryTool::saveAs); + ca->setMenuLocation(MenuPath("File/Save")); + ca->setToolbarLocation(ToolbarLocation("main", "save")); + // how we tell the system we want this to become a secondary action for the previous button? + registerContextAction(ca); + } + { + auto ca = makeContextAction(tr("Save copy of SQL as"), &QueryTool::saveCopyAs); + ca->setMenuLocation(MenuPath("File/Save")); + ca->setToolbarLocation(ToolbarLocation("main", "save")); + // how we tell the system we want this to become a secondary action for the previous button? + registerContextAction(ca); + } } diff --git a/pglab/pglab.pro b/pglab/pglab.pro index 7fd7126..06a247a 100644 --- a/pglab/pglab.pro +++ b/pglab/pglab.pro @@ -30,6 +30,10 @@ SOURCES += main.cpp\ ConnectionManagerWindow.cpp \ ConnectionListModel.cpp \ BackupRestore.cpp \ + plugin_support/LMenu.cpp \ + plugin_support/LMenuBar.cpp \ + plugin_support/LMenuItem.cpp \ + plugin_support/LMenuSection.cpp \ stopwatch.cpp \ TuplesResultWidget.cpp \ BackupDialog.cpp \ @@ -104,6 +108,10 @@ HEADERS += \ CreateDatabaseDialog.h \ ConnectionManagerWindow.h \ ConnectionListModel.h \ + plugin_support/LMenu.h \ + plugin_support/LMenuBar.h \ + plugin_support/LMenuItem.h \ + plugin_support/LMenuSection.h \ stopwatch.h \ TuplesResultWidget.h \ BackupDialog.h \ diff --git a/pglab/plugin_support/LMenu.cpp b/pglab/plugin_support/LMenu.cpp new file mode 100644 index 0000000..24b138a --- /dev/null +++ b/pglab/plugin_support/LMenu.cpp @@ -0,0 +1,6 @@ +#include "LMenu.h" + +LMenu::LMenu() +{ + +} diff --git a/pglab/plugin_support/LMenu.h b/pglab/plugin_support/LMenu.h new file mode 100644 index 0000000..936df23 --- /dev/null +++ b/pglab/plugin_support/LMenu.h @@ -0,0 +1,13 @@ +#ifndef LMENU_H +#define LMENU_H + +/** Represents a menu wraps QMenu to give it more dynamic functionality + * + */ +class LMenu +{ +public: + LMenu(); +}; + +#endif // LMENU_H diff --git a/pglab/plugin_support/LMenuBar.cpp b/pglab/plugin_support/LMenuBar.cpp new file mode 100644 index 0000000..f5d9342 --- /dev/null +++ b/pglab/plugin_support/LMenuBar.cpp @@ -0,0 +1,6 @@ +#include "LMenuBar.h" + +LMenuBar::LMenuBar() +{ + +} diff --git a/pglab/plugin_support/LMenuBar.h b/pglab/plugin_support/LMenuBar.h new file mode 100644 index 0000000..6699dc9 --- /dev/null +++ b/pglab/plugin_support/LMenuBar.h @@ -0,0 +1,11 @@ +#ifndef LMENUBAR_H +#define LMENUBAR_H + +/** Represents the main menubar. Linked to a QMenuBar + */ +class LMenuBar { +public: + LMenuBar(); +}; + +#endif // LMENUBAR_H diff --git a/pglab/plugin_support/LMenuItem.cpp b/pglab/plugin_support/LMenuItem.cpp new file mode 100644 index 0000000..601b7e0 --- /dev/null +++ b/pglab/plugin_support/LMenuItem.cpp @@ -0,0 +1,6 @@ +#include "LMenuItem.h" + +LMenuItem::LMenuItem() +{ + +} diff --git a/pglab/plugin_support/LMenuItem.h b/pglab/plugin_support/LMenuItem.h new file mode 100644 index 0000000..f4f566f --- /dev/null +++ b/pglab/plugin_support/LMenuItem.h @@ -0,0 +1,10 @@ +#ifndef LMENUITEM_H +#define LMENUITEM_H + + +class LMenuItem { +public: + LMenuItem(); +}; + +#endif // LMENUITEM_H diff --git a/pglab/plugin_support/LMenuSection.cpp b/pglab/plugin_support/LMenuSection.cpp new file mode 100644 index 0000000..c5de547 --- /dev/null +++ b/pglab/plugin_support/LMenuSection.cpp @@ -0,0 +1,6 @@ +#include "LMenuSection.h" + +LMenuSection::LMenuSection() +{ + +} diff --git a/pglab/plugin_support/LMenuSection.h b/pglab/plugin_support/LMenuSection.h new file mode 100644 index 0000000..e8906b7 --- /dev/null +++ b/pglab/plugin_support/LMenuSection.h @@ -0,0 +1,11 @@ +#ifndef LMENUSECTION_H +#define LMENUSECTION_H + +/** Logical grouping within a menu + */ +class LMenuSection { +public: + LMenuSection(); +}; + +#endif // LMENUSECTION_H