diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index aa6530f3..2fcecd43 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -45,8 +45,10 @@ SOURCES += \ settingsdialog/formattergeneralwidget.cpp \ settingsdialog/projectcompileparamaterswidget.cpp \ settingsdialog/projectcompilerwidget.cpp \ + settingsdialog/projectdirectorieswidget.cpp \ settingsdialog/projectfileswidget.cpp \ settingsdialog/projectgeneralwidget.cpp \ + settingsdialog/projectprecompilewidget.cpp \ widgets/classbrowser.cpp \ widgets/codecompletionlistview.cpp \ widgets/codecompletionpopup.cpp \ @@ -131,8 +133,10 @@ HEADERS += \ settingsdialog/formattergeneralwidget.h \ settingsdialog/projectcompileparamaterswidget.h \ settingsdialog/projectcompilerwidget.h \ + settingsdialog/projectdirectorieswidget.h \ settingsdialog/projectfileswidget.h \ settingsdialog/projectgeneralwidget.h \ + settingsdialog/projectprecompilewidget.h \ widgets/classbrowser.h \ widgets/codecompletionlistview.h \ widgets/codecompletionpopup.h \ @@ -193,8 +197,10 @@ FORMS += \ settingsdialog/formattergeneralwidget.ui \ settingsdialog/projectcompileparamaterswidget.ui \ settingsdialog/projectcompilerwidget.ui \ + settingsdialog/projectdirectorieswidget.ui \ settingsdialog/projectfileswidget.ui \ settingsdialog/projectgeneralwidget.ui \ + settingsdialog/projectprecompilewidget.ui \ widgets/cpudialog.ui \ mainwindow.ui \ settingsdialog/compilersetdirectorieswidget.ui \ diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui index c5cf1119..01cadc4c 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui @@ -95,7 +95,7 @@ - 0 + 2 false diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui index 6304ed0c..aa26d386 100644 --- a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui @@ -101,7 +101,7 @@ - + Indent Line Color diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp index 7a1b37a1..f63fd089 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp @@ -1,8 +1,10 @@ #include "projectcompileparamaterswidget.h" #include "ui_projectcompileparamaterswidget.h" +#include "../mainwindow.h" +#include "../project.h" -ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(QWidget *parent) : - QWidget(parent), +ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &name, const QString &group, QWidget *parent) : + SettingsWidget(name,group,parent), ui(new Ui::ProjectCompileParamatersWidget) { ui->setupUi(this); @@ -12,3 +14,22 @@ ProjectCompileParamatersWidget::~ProjectCompileParamatersWidget() { delete ui; } + +void ProjectCompileParamatersWidget::doLoad() +{ + ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset); + ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink); + ui->txtCCompiler->setPlainText(pMainWindow->project()->options().compilerCmd); + ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd); + ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd); +} + +void ProjectCompileParamatersWidget::doSave() +{ + pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked(); + pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked(); + pMainWindow->project()->options().compilerCmd = ui->txtCCompiler->toPlainText(); + pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText(); + pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText(); + pMainWindow->project()->saveOptions(); +} diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.h b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.h index ae03fc92..a980fc81 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.h +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.h @@ -2,21 +2,27 @@ #define PROJECTCOMPILEPARAMATERSWIDGET_H #include +#include "settingswidget.h" namespace Ui { class ProjectCompileParamatersWidget; } -class ProjectCompileParamatersWidget : public QWidget +class ProjectCompileParamatersWidget : public SettingsWidget { Q_OBJECT public: - explicit ProjectCompileParamatersWidget(QWidget *parent = nullptr); + explicit ProjectCompileParamatersWidget(const QString& name, const QString& group, QWidget *parent = nullptr); ~ProjectCompileParamatersWidget(); private: Ui::ProjectCompileParamatersWidget *ui; + + // SettingsWidget interface +protected: + void doLoad() override; + void doSave() override; }; #endif // PROJECTCOMPILEPARAMATERSWIDGET_H diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui index 562814f1..4fc8cd54 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui @@ -36,9 +36,9 @@ - + - 0 + 2 @@ -102,7 +102,7 @@ 5 - + diff --git a/RedPandaIDE/settingsdialog/projectdirectorieswidget.cpp b/RedPandaIDE/settingsdialog/projectdirectorieswidget.cpp new file mode 100644 index 00000000..c099f63a --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectdirectorieswidget.cpp @@ -0,0 +1,41 @@ +#include "projectdirectorieswidget.h" +#include "ui_projectdirectorieswidget.h" +#include "compilersetdirectorieswidget.h" +#include "../project.h" +#include "../mainwindow.h" + +ProjectDirectoriesWidget::ProjectDirectoriesWidget(const QString &name, const QString &group, QWidget *parent) : + SettingsWidget(name,group,parent), + ui(new Ui::ProjectDirectoriesWidget) +{ + ui->setupUi(this); + + mLibDirWidget = new CompilerSetDirectoriesWidget(); + ui->tabDirs->addTab(mLibDirWidget,QObject::tr("Libraries")); + mIncludeDirWidget = new CompilerSetDirectoriesWidget(); + ui->tabDirs->addTab(mIncludeDirWidget,QObject::tr("Includes")); + mResourceDirWidget = new CompilerSetDirectoriesWidget(); + ui->tabDirs->addTab(mResourceDirWidget,QObject::tr("Resources")); +} + + +ProjectDirectoriesWidget::~ProjectDirectoriesWidget() +{ + delete ui; +} + +void ProjectDirectoriesWidget::doLoad() +{ + mLibDirWidget->setDirList(pMainWindow->project()->options().libs); + mIncludeDirWidget->setDirList(pMainWindow->project()->options().includes); + mResourceDirWidget->setDirList(pMainWindow->project()->options().resourceIncludes); + +} + +void ProjectDirectoriesWidget::doSave() +{ + pMainWindow->project()->options().libs = mLibDirWidget->dirList(); + pMainWindow->project()->options().includes = mIncludeDirWidget->dirList(); + pMainWindow->project()->options().resourceIncludes = mResourceDirWidget->dirList(); + pMainWindow->project()->saveOptions(); +} diff --git a/RedPandaIDE/settingsdialog/projectdirectorieswidget.h b/RedPandaIDE/settingsdialog/projectdirectorieswidget.h new file mode 100644 index 00000000..190bb56a --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectdirectorieswidget.h @@ -0,0 +1,33 @@ +#ifndef PROJECTDIRECTORIESWIDGET_H +#define PROJECTDIRECTORIESWIDGET_H + +#include +#include "settingswidget.h" +#include "compilersetdirectorieswidget.h" + +namespace Ui { +class ProjectDirectoriesWidget; +} + +class CompilerSetDirectoriesWidget; +class ProjectDirectoriesWidget : public SettingsWidget +{ + Q_OBJECT + +public: + explicit ProjectDirectoriesWidget(const QString& name, const QString& group, QWidget *parent = nullptr); + ~ProjectDirectoriesWidget(); + +private: + Ui::ProjectDirectoriesWidget *ui; + CompilerSetDirectoriesWidget *mLibDirWidget; + CompilerSetDirectoriesWidget *mIncludeDirWidget; + CompilerSetDirectoriesWidget *mResourceDirWidget; + + // SettingsWidget interface +protected: + void doLoad() override; + void doSave() override; +}; + +#endif // PROJECTDIRECTORIESWIDGET_H diff --git a/RedPandaIDE/settingsdialog/projectdirectorieswidget.ui b/RedPandaIDE/settingsdialog/projectdirectorieswidget.ui new file mode 100644 index 00000000..d41fe58e --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectdirectorieswidget.ui @@ -0,0 +1,28 @@ + + + ProjectDirectoriesWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + true + + + + + + + + diff --git a/RedPandaIDE/settingsdialog/projectprecompilewidget.cpp b/RedPandaIDE/settingsdialog/projectprecompilewidget.cpp new file mode 100644 index 00000000..884e598a --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectprecompilewidget.cpp @@ -0,0 +1,44 @@ +#include "projectprecompilewidget.h" +#include "ui_projectprecompilewidget.h" +#include "../mainwindow.h" +#include "../project.h" + +#include + +ProjectPreCompileWidget::ProjectPreCompileWidget(const QString &name, const QString &group, QWidget *parent) : + SettingsWidget(name,group,parent), + ui(new Ui::ProjectPreCompileWidget) +{ + ui->setupUi(this); +} + +ProjectPreCompileWidget::~ProjectPreCompileWidget() +{ + delete ui; +} + +void ProjectPreCompileWidget::doLoad() +{ + ui->grpPrecompileHeader->setChecked(pMainWindow->project()->options().usePrecompiledHeader); + ui->txtPrecompileHeader->setText(pMainWindow->project()->options().precompiledHeader); +} + +void ProjectPreCompileWidget::doSave() +{ + pMainWindow->project()->options().usePrecompiledHeader = ui->grpPrecompileHeader->isChecked(); + pMainWindow->project()->options().precompiledHeader = ui->txtPrecompileHeader->text(); + pMainWindow->project()->saveOptions(); +} + +void ProjectPreCompileWidget::on_btnBrowse_triggered(QAction *arg1) +{ + QString fileName = QFileDialog::getOpenFileName( + this, + tr("precompiled header"), + pMainWindow->project()->directory(), + tr("header files (*.h")); + if (!fileName.isEmpty() && QFileInfo(fileName).exists()) { + ui->txtPrecompileHeader->setText(fileName); + } +} + diff --git a/RedPandaIDE/settingsdialog/projectprecompilewidget.h b/RedPandaIDE/settingsdialog/projectprecompilewidget.h new file mode 100644 index 00000000..0ba1603c --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectprecompilewidget.h @@ -0,0 +1,30 @@ +#ifndef PROJECTPRECOMPILEWIDGET_H +#define PROJECTPRECOMPILEWIDGET_H + +#include +#include "settingswidget.h" + +namespace Ui { +class ProjectPreCompileWidget; +} + +class ProjectPreCompileWidget : public SettingsWidget +{ + Q_OBJECT + +public: + explicit ProjectPreCompileWidget(const QString& name, const QString& group, QWidget *parent = nullptr); + ~ProjectPreCompileWidget(); + +private: + Ui::ProjectPreCompileWidget *ui; + + // SettingsWidget interface +protected: + void doLoad() override; + void doSave() override; +private slots: + void on_btnBrowse_triggered(QAction *arg1); +}; + +#endif // PROJECTPRECOMPILEWIDGET_H diff --git a/RedPandaIDE/settingsdialog/projectprecompilewidget.ui b/RedPandaIDE/settingsdialog/projectprecompilewidget.ui new file mode 100644 index 00000000..b8700d23 --- /dev/null +++ b/RedPandaIDE/settingsdialog/projectprecompilewidget.ui @@ -0,0 +1,85 @@ + + + ProjectPreCompileWidget + + + + 0 + 0 + 741 + 300 + + + + Form + + + + + + Use precompiled header + + + true + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Browse + + + + :/icons/images/newlook24/053-open.png + + + + + + + + + + + + 0 + 0 + + + + <html><head/><body><p>For more information about gcc precompiled header, see:</p><p><a href="https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html"><span style=" text-decoration: underline; color:#007af4;">https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html</span></a></p></body></html> + + + Qt::RichText + + + Qt::AlignCenter + + + + + + + + + + + diff --git a/RedPandaIDE/settingsdialog/settingsdialog.cpp b/RedPandaIDE/settingsdialog/settingsdialog.cpp index 23c7182d..ec55e5f2 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.cpp +++ b/RedPandaIDE/settingsdialog/settingsdialog.cpp @@ -19,6 +19,9 @@ #include "projectgeneralwidget.h" #include "projectfileswidget.h" #include "projectcompilerwidget.h" +#include "projectcompileparamaterswidget.h" +#include "projectdirectorieswidget.h" +#include "projectprecompilewidget.h" #include #include #include @@ -163,6 +166,18 @@ PSettingsDialog SettingsDialog::projectOptionDialog() widget->init(); dialog->addWidget(widget); + widget = new ProjectCompileParamatersWidget(tr("Custom Compile options"),tr("Project")); + widget->init(); + dialog->addWidget(widget); + + widget = new ProjectDirectoriesWidget(tr("Directories"),tr("Project")); + widget->init(); + dialog->addWidget(widget); + + widget = new ProjectPreCompileWidget(tr("Precompiled Header"),tr("Project")); + widget->init(); + dialog->addWidget(widget); + dialog->selectFirstWidget(); return dialog;