2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-09-16 12:03:10 +08:00
|
|
|
#ifndef NEWPROJECTDIALOG_H
|
|
|
|
#define NEWPROJECTDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2021-09-16 23:51:05 +08:00
|
|
|
#include <QListWidget>
|
2021-09-16 12:03:10 +08:00
|
|
|
#include <QTabBar>
|
|
|
|
#include "projecttemplate.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class NewProjectDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NewProjectDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit NewProjectDialog(QWidget *parent = nullptr);
|
|
|
|
~NewProjectDialog();
|
2021-09-16 23:51:05 +08:00
|
|
|
PProjectTemplate getTemplate();
|
|
|
|
QString getLocation();
|
|
|
|
QString getProjectName();
|
2021-11-18 21:25:28 +08:00
|
|
|
bool useAsDefaultProjectDir();
|
2021-09-16 23:51:05 +08:00
|
|
|
bool isCProject();
|
|
|
|
bool isCppProject();
|
2021-12-03 21:36:12 +08:00
|
|
|
bool makeDefaultLanguage();
|
2021-09-16 23:51:05 +08:00
|
|
|
private slots:
|
|
|
|
void updateView();
|
|
|
|
void updateProjectLocation();
|
|
|
|
void on_lstTemplates_itemDoubleClicked(QListWidgetItem *item);
|
|
|
|
|
|
|
|
void on_lstTemplates_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
2021-10-18 22:06:33 +08:00
|
|
|
void on_btnBrowse_clicked();
|
2021-12-23 09:11:58 +08:00
|
|
|
void updateIcons();
|
2021-09-16 23:51:05 +08:00
|
|
|
|
2021-09-16 12:03:10 +08:00
|
|
|
private:
|
|
|
|
void addTemplate(const QString& filename);
|
|
|
|
void readTemplateDir();
|
2021-09-16 23:51:05 +08:00
|
|
|
void rebuildTabs();
|
2021-12-23 09:11:58 +08:00
|
|
|
|
2021-09-16 12:03:10 +08:00
|
|
|
private:
|
|
|
|
Ui::NewProjectDialog *ui;
|
|
|
|
QList<PProjectTemplate> mTemplates;
|
|
|
|
QTabBar* mTemplatesTabBar;
|
2021-09-16 23:51:05 +08:00
|
|
|
QMap<QString,int> mCategories;
|
2021-09-16 12:03:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NEWPROJECTDIALOG_H
|