aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
commit7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch)
treea35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h b/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h
new file mode 100644
index 0000000..0fa496e
--- /dev/null
+++ b/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.h
@@ -0,0 +1,109 @@
+#ifndef FUNCTIONSEDITOR_H
+#define FUNCTIONSEDITOR_H
+
+#include "mdichild.h"
+#include "common/extactioncontainer.h"
+#include "services/config.h"
+#include "services/functionmanager.h"
+#include <QItemSelection>
+#include <QSortFilterProxyModel>
+
+namespace Ui {
+class FunctionsEditor;
+}
+
+class FunctionsEditorModel;
+class ScriptingPlugin;
+class SyntaxHighlighterPlugin;
+class DbTreeItem;
+class QTreeWidgetItem;
+class QSyntaxHighlighter;
+class SelectableDbModel;
+
+class GUI_API_EXPORT FunctionsEditor : public MdiChild
+{
+ Q_OBJECT
+
+ public:
+ enum Action
+ {
+ COMMIT,
+ ROLLBACK,
+ ADD,
+ DELETE,
+ ARG_ADD,
+ ARG_EDIT,
+ ARG_DEL,
+ ARG_MOVE_UP,
+ ARG_MOVE_DOWN,
+ HELP
+ };
+
+ enum ToolBar
+ {
+ TOOLBAR
+ };
+
+ explicit FunctionsEditor(QWidget *parent = 0);
+ ~FunctionsEditor();
+
+ bool restoreSessionNextTime();
+ bool isUncommited() const;
+ QString getQuitUncommitedConfirmMessage() const;
+
+ protected:
+ QVariant saveSession();
+ bool restoreSession(const QVariant &sessionValue);
+ Icon* getIconNameForMdiWindow();
+ QString getTitleForMdiWindow();
+ void createActions();
+ void setupDefShortcuts();
+ QToolBar* getToolBar(int toolbar) const;
+
+ private:
+ void init();
+ int getCurrentFunctionRow() const;
+ void functionDeselected(int row);
+ void functionSelected(int row);
+ void clearEdits();
+ void selectFunction(int row);
+ void setFont(const QFont& font);
+ QModelIndex getSelectedArg() const;
+ QStringList getCurrentArgList() const;
+ QStringList getCurrentDatabases() const;
+ FunctionManager::ScriptFunction::Type getCurrentFunctionType() const;
+
+ Ui::FunctionsEditor *ui = nullptr;
+ FunctionsEditorModel* model = nullptr;
+ QSortFilterProxyModel* functionFilterModel = nullptr;
+ bool currentModified = false;
+ QHash<QString,ScriptingPlugin*> scriptingPlugins;
+ QHash<QString,SyntaxHighlighterPlugin*> highlighterPlugins;
+ SelectableDbModel* dbListModel = nullptr;
+ QString currentHighlighterLang;
+ QSyntaxHighlighter* currentMainHighlighter = nullptr;
+ QSyntaxHighlighter* currentFinalHighlighter = nullptr;
+ QSyntaxHighlighter* currentInitHighlighter = nullptr;
+ bool updatesForSelection = false;
+
+ private slots:
+ void commit();
+ void rollback();
+ void newFunction();
+ void deleteFunction();
+ void updateModified();
+ void updateState();
+ void updateCurrentFunctionState();
+ void functionSelected(const QItemSelection& selected, const QItemSelection& deselected);
+ void addFunctionArg();
+ void editFunctionArg();
+ void delFunctionArg();
+ void moveFunctionArgUp();
+ void moveFunctionArgDown();
+ void updateArgsState();
+ void applyFilter(const QString& value);
+ void help();
+ void changeFont(const QVariant& font);
+};
+
+#endif // FUNCTIONSEDITOR_H