- add project custom compile parameters option dialog
- add project directories option dialog - add project precompiled header dialog
This commit is contained in:
parent
14c83ab829
commit
c242225951
|
@ -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 \
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="settingTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbCaretColor_4">
|
||||
<widget class="QLabel" name="lbIndentLineColor">
|
||||
<property name="text">
|
||||
<string>Indent Line Color</string>
|
||||
</property>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -2,21 +2,27 @@
|
|||
#define PROJECTCOMPILEPARAMATERSWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#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
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="txtLinker">
|
||||
<widget class="QTabWidget" name="tabCommands">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -102,7 +102,7 @@
|
|||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="txtCCompiler_3"/>
|
||||
<widget class="QPlainTextEdit" name="txtLinker"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef PROJECTDIRECTORIESWIDGET_H
|
||||
#define PROJECTDIRECTORIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#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
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectDirectoriesWidget</class>
|
||||
<widget class="QWidget" name="ProjectDirectoriesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabDirs">
|
||||
<property name="documentMode">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,44 @@
|
|||
#include "projectprecompilewidget.h"
|
||||
#include "ui_projectprecompilewidget.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "../project.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef PROJECTPRECOMPILEWIDGET_H
|
||||
#define PROJECTPRECOMPILEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#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
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectPreCompileWidget</class>
|
||||
<widget class="QWidget" name="ProjectPreCompileWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>741</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpPrecompileHeader">
|
||||
<property name="title">
|
||||
<string>Use precompiled header</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtPrecompileHeader"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnBrowse">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -19,6 +19,9 @@
|
|||
#include "projectgeneralwidget.h"
|
||||
#include "projectfileswidget.h"
|
||||
#include "projectcompilerwidget.h"
|
||||
#include "projectcompileparamaterswidget.h"
|
||||
#include "projectdirectorieswidget.h"
|
||||
#include "projectprecompilewidget.h"
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QModelIndex>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue