From 3565aad630864ecdbe53fdaa501ea708555b3c7c Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sun, 30 Apr 2023 18:30:36 -0400 Subject: New upstream version 3.4.4+dfsg. --- .../coreSQLiteStudio/services/codesnippetmanager.h | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 SQLiteStudio3/coreSQLiteStudio/services/codesnippetmanager.h (limited to 'SQLiteStudio3/coreSQLiteStudio/services/codesnippetmanager.h') diff --git a/SQLiteStudio3/coreSQLiteStudio/services/codesnippetmanager.h b/SQLiteStudio3/coreSQLiteStudio/services/codesnippetmanager.h new file mode 100644 index 0000000..ade14bd --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/services/codesnippetmanager.h @@ -0,0 +1,42 @@ +#ifndef CODESNIPPETMANAGER_H +#define CODESNIPPETMANAGER_H + +#include "coreSQLiteStudio_global.h" +#include + +class Config; + +class API_EXPORT CodeSnippetManager : public QObject +{ + Q_OBJECT + + public: + struct API_EXPORT CodeSnippet + { + QString name; + QString code; + QString hotkey; + }; + + CodeSnippetManager(Config* config); + + void setSnippets(const QList& snippets); + const QList& getSnippets() const; + const QStringList& getNames() const; + void saveToConfig(); + QString getCodeByName(const QString& name) const; + + private: + void loadFromConfig(); + void refreshNames(); + void clearSnippets(); + void createDefaultSnippets(); + + Config* config = nullptr; + QList allSnippets; + QStringList names; +}; + +#define CODESNIPPETS SQLITESTUDIO->getCodeSnippetManager() + +#endif // CODESNIPPETMANAGER_H -- cgit v1.2.3