1/*
2 * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#ifndef NEWPROJECTDIALOG_H
18#define NEWPROJECTDIALOG_H
19
20#include <QDialog>
21#include <QListWidget>
22#include <QTabBar>
23#include "projecttemplate.h"
24
25namespace Ui {
26class NewProjectDialog;
27}
28
29class NewProjectDialog : public QDialog
30{
31 Q_OBJECT
32
33public:
34 explicit NewProjectDialog(QWidget *parent = nullptr);
35 ~NewProjectDialog();
36 PProjectTemplate getTemplate();
37 QString getLocation();
38 QString getProjectName();
39 bool useAsDefaultProjectDir();
40 bool isCProject();
41 bool isCppProject();
42 bool makeDefaultLanguage();
43private slots:
44 void updateView();
45 void updateProjectLocation();
46 void on_lstTemplates_itemDoubleClicked(QListWidgetItem *item);
47
48 void on_lstTemplates_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
49 void on_btnBrowse_clicked();
50 void onUpdateIcons();
51
52 void on_btnOk_clicked();
53
54 void on_btnCancel_clicked();
55
56private:
57 void addTemplate(const QString& filename);
58 void readTemplateDirs();
59 void readTemplateDir(const QString& folderPath);
60 void rebuildTabs();
61
62private:
63 Ui::NewProjectDialog *ui;
64 QList<PProjectTemplate> mTemplates;
65 QTabBar* mTemplatesTabBar;
66 QMap<QString,int> mCategories;
67};
68
69#endif // NEWPROJECTDIALOG_H
70