aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/mainwindow.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:30:36 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:30:36 -0400
commit3565aad630864ecdbe53fdaa501ea708555b3c7c (patch)
treec743e4ad0bad39ebdb2f514c7cc52d34a257ebbe /SQLiteStudio3/guiSQLiteStudio/mainwindow.h
parent1fdc150116cad39aae5c5da407c3312b47a59e3a (diff)
New upstream version 3.4.4+dfsg.upstream/3.4.4+dfsg
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/mainwindow.h')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/mainwindow.h49
1 files changed, 37 insertions, 12 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/mainwindow.h b/SQLiteStudio3/guiSQLiteStudio/mainwindow.h
index cedbc20..01457b0 100644
--- a/SQLiteStudio3/guiSQLiteStudio/mainwindow.h
+++ b/SQLiteStudio3/guiSQLiteStudio/mainwindow.h
@@ -5,7 +5,6 @@
#include "db/db.h"
#include "ui_mainwindow.h"
#include "mdiwindow.h"
-#include "services/updatemanager.h"
#include "guiSQLiteStudio_global.h"
#include <QMainWindow>
#include <QHash>
@@ -30,8 +29,10 @@ class Committable;
class WidgetCover;
class QProgressBar;
class QLabel;
+class QTimer;
class ThemeTuner;
class SqliteExtensionEditor;
+class CodeSnippetEditor;
#ifdef Q_OS_MACX
#define PREV_TASK_KEY_SEQ Qt::CTRL + Qt::ALT + Qt::Key_Left
@@ -42,20 +43,26 @@ class SqliteExtensionEditor;
#endif
CFG_KEY_LIST(MainWindow, QObject::tr("Main window"),
- CFG_KEY_ENTRY(OPEN_SQL_EDITOR, Qt::ALT + Qt::Key_E, QObject::tr("Open SQL editor"))
- CFG_KEY_ENTRY(PREV_TASK, PREV_TASK_KEY_SEQ, QObject::tr("Previous window"))
- CFG_KEY_ENTRY(NEXT_TASK, NEXT_TASK_KEY_SEQ, QObject::tr("Next window"))
- CFG_KEY_ENTRY(HIDE_STATUS_FIELD, Qt::Key_Escape, QObject::tr("Hide status area"))
- CFG_KEY_ENTRY(OPEN_CONFIG, Qt::Key_F2, QObject::tr("Open configuration dialog"))
- CFG_KEY_ENTRY(OPEN_DEBUG_CONSOLE, Qt::Key_F12, QObject::tr("Open Debug Console"))
- CFG_KEY_ENTRY(OPEN_CSS_CONSOLE, Qt::Key_F11, QObject::tr("Open CSS Console"))
- CFG_KEY_ENTRY(QUIT, Qt::CTRL + Qt::Key_Q, QObject::tr("Quit the application"))
+ CFG_KEY_ENTRY(OPEN_SQL_EDITOR, Qt::ALT + Qt::Key_E, QObject::tr("Open SQL editor"))
+ CFG_KEY_ENTRY(OPEN_DDL_HISTORY, Qt::CTRL + Qt::Key_H, QObject::tr("Open DDL history window"))
+ CFG_KEY_ENTRY(OPEN_SNIPPETS_EDITOR, Qt::CTRL + Qt::SHIFT + Qt::Key_P, QObject::tr("Open snippets editor window"))
+ CFG_KEY_ENTRY(OPEN_FUNCTION_EDITOR, Qt::CTRL + Qt::SHIFT + Qt::Key_F, QObject::tr("Open function editor window"))
+ CFG_KEY_ENTRY(OPEN_COLLATION_EDITOR, Qt::CTRL + Qt::SHIFT + Qt::Key_C, QObject::tr("Open collation editor window"))
+ CFG_KEY_ENTRY(OPEN_EXTENSION_MANAGER, Qt::CTRL + Qt::SHIFT + Qt::Key_E, QObject::tr("Open extension manager window"))
+ CFG_KEY_ENTRY(PREV_TASK, PREV_TASK_KEY_SEQ, QObject::tr("Previous window"))
+ CFG_KEY_ENTRY(NEXT_TASK, NEXT_TASK_KEY_SEQ, QObject::tr("Next window"))
+ CFG_KEY_ENTRY(HIDE_STATUS_FIELD, Qt::Key_Escape, QObject::tr("Hide status area"))
+ CFG_KEY_ENTRY(USER_MANUAL, Qt::Key_F1, QObject::tr("Open user manual"))
+ CFG_KEY_ENTRY(OPEN_CONFIG, Qt::Key_F10, QObject::tr("Open configuration dialog"))
+ CFG_KEY_ENTRY(OPEN_DEBUG_CONSOLE, Qt::Key_F12, QObject::tr("Open Debug Console"))
+ CFG_KEY_ENTRY(OPEN_CSS_CONSOLE, Qt::Key_F11, QObject::tr("Open CSS Console"))
+ CFG_KEY_ENTRY(ABOUT, Qt::SHIFT + Qt::Key_F1, QObject::tr("Open the About dialog"))
+ CFG_KEY_ENTRY(QUIT, Qt::CTRL + Qt::Key_Q, QObject::tr("Quit the application"))
)
class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
{
- Q_OBJECT
- Q_ENUMS(Action)
+ Q_OBJECT
public:
enum Action
@@ -70,6 +77,7 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
HIDE_STATUS_FIELD,
OPEN_CONFIG,
OPEN_DDL_HISTORY,
+ OPEN_SNIPPETS_EDITOR,
OPEN_FUNCTION_EDITOR,
OPEN_COLLATION_EDITOR,
OPEN_EXTENSION_MANAGER,
@@ -77,6 +85,8 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
IMPORT,
CLOSE_WINDOW,
CLOSE_ALL_WINDOWS,
+ CLOSE_ALL_WINDOWS_LEFT,
+ CLOSE_ALL_WINDOWS_RIGHT,
CLOSE_OTHER_WINDOWS,
RESTORE_WINDOW,
RENAME_WINDOW,
@@ -94,6 +104,7 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
CHECK_FOR_UPDATES,
QUIT
};
+ Q_ENUM(Action)
enum ToolBar
{
@@ -109,7 +120,7 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
DbTree* getDbTree() const;
StatusField* getStatusField() const;
void restoreSession();
- void setStyle(const QString& styleName);
+ bool setStyle(const QString& styleName);
FormManager* getFormManager() const;
bool eventFilter(QObject* obj, QEvent* e);
void pushClosedWindowSessionValue(const QVariant& value);
@@ -136,18 +147,22 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
~MainWindow();
void init();
+ void observeSessionChanges();
void createActions();
void setupDefShortcuts();
void initMenuBar();
void saveSession(MdiWindow* currWindow);
+ void saveSession(bool hide);
void restoreWindowSessions(const QList<QVariant>& windowSessions);
MdiWindow *restoreWindowSession(const QVariant& windowSessions);
void closeNonSessionWindows();
DdlHistoryWindow* openDdlHistory();
FunctionsEditor* openFunctionEditor();
+ CodeSnippetEditor* openCodeSnippetEditor();
CollationsEditor* openCollationEditor();
SqliteExtensionEditor* openExtensionManager();
void fixFonts();
+ void fixToolbars();
template <class T>
T* openMdiWindow();
@@ -157,6 +172,7 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
static MainWindow* instance;
static constexpr int closedWindowsStackSize = 20;
static_char* openUpdatesUrl = "open_updates://";
+ static constexpr int saveSessionDelayMs = 500;
Ui::MainWindow *ui = nullptr;
DbTree* dbTree = nullptr;
@@ -175,6 +191,7 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
#endif
WidgetCover* widgetCover = nullptr;
bool manualUpdatesChecking = false;
+ QTimer* saveSessionTimer = nullptr;
public slots:
EditorWindow* openSqlEditor();
@@ -198,11 +215,14 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
void openConfig();
void openDdlHistorySlot();
void openFunctionEditorSlot();
+ void openCodeSnippetsEditorSlot();
void openCollationEditorSlot();
void openExtensionManagerSlot();
void exportAnything();
void importAnything();
void closeAllWindows();
+ void closeAllLeftWindows();
+ void closeAllRightWindows();
void closeAllWindowsButSelected();
void closeSelectedWindow();
void restoreLastClosedWindow();
@@ -221,6 +241,11 @@ class GUI_API_EXPORT MainWindow : public QMainWindow, public ExtActionContainer
void quit();
void updateMultipleSessionsSetting();
void updateMultipleSessionsSetting(const QVariant& newValue);
+ void saveSession();
+ void scheduleSessionSave();
+
+ signals:
+ void sessionValueChanged();
};
template <class T>