| 1 | #ifndef NEWTEMPLATEDIALOG_H |
| 2 | #define NEWTEMPLATEDIALOG_H |
| 3 | |
| 4 | #include <QDialog> |
| 5 | #include <QSet> |
| 6 | |
| 7 | namespace Ui { |
| 8 | class NewTemplateDialog; |
| 9 | } |
| 10 | |
| 11 | class NewTemplateDialog : public QDialog |
| 12 | { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | explicit NewTemplateDialog(QWidget *parent = nullptr); |
| 17 | ~NewTemplateDialog(); |
| 18 | QString getName() const; |
| 19 | QString getDescription() const; |
| 20 | QString getCategory() const; |
| 21 | private slots: |
| 22 | void on_btnCreate_clicked(); |
| 23 | |
| 24 | void on_btnCancel_clicked(); |
| 25 | |
| 26 | void on_txtName_textChanged(const QString &arg1); |
| 27 | |
| 28 | void on_cbCategory_currentTextChanged(const QString &arg1); |
| 29 | |
| 30 | private: |
| 31 | QStringList findCategories(); |
| 32 | void readTemplateCategory(const QString& filename, QSet<QString>& categories); |
| 33 | void readTemplateCategoriesInDir(const QString& folderPath, QSet<QString>& categories); |
| 34 | void updateCreateState(); |
| 35 | private: |
| 36 | Ui::NewTemplateDialog *ui; |
| 37 | |
| 38 | // QWidget interface |
| 39 | protected: |
| 40 | void closeEvent(QCloseEvent *event) override; |
| 41 | }; |
| 42 | |
| 43 | #endif // NEWTEMPLATEDIALOG_H |
| 44 | |