* reimport settingsdialog files
This commit is contained in:
parent
e02c407e9d
commit
c7a5dda40d
|
@ -0,0 +1,36 @@
|
|||
#include "compilersetdirectorieswidget.h"
|
||||
#include "ui_compilersetdirectorieswidget.h"
|
||||
|
||||
#include <QStringListModel>
|
||||
|
||||
CompilerSetDirectoriesWidget::CompilerSetDirectoriesWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CompilerSetDirectoriesWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mModel = new CompilerSetDirectoriesWidget::ListModel();
|
||||
ui->listView->setModel(mModel);
|
||||
}
|
||||
|
||||
CompilerSetDirectoriesWidget::~CompilerSetDirectoriesWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CompilerSetDirectoriesWidget::setDirList(const QStringList &list)
|
||||
{
|
||||
mModel->setStringList(list);
|
||||
}
|
||||
|
||||
QStringList CompilerSetDirectoriesWidget::dirList() const
|
||||
{
|
||||
return mModel->stringList();
|
||||
}
|
||||
|
||||
Qt::ItemFlags CompilerSetDirectoriesWidget::ListModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (index.isValid()) {
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef COMPILERSETDIRECTORIESWIDGET_H
|
||||
#define COMPILERSETDIRECTORIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStringListModel>
|
||||
|
||||
namespace Ui {
|
||||
class CompilerSetDirectoriesWidget;
|
||||
}
|
||||
|
||||
|
||||
class CompilerSetDirectoriesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
class ListModel: public QStringListModel {
|
||||
public:
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit CompilerSetDirectoriesWidget(QWidget *parent = nullptr);
|
||||
~CompilerSetDirectoriesWidget();
|
||||
|
||||
void setDirList(const QStringList& list);
|
||||
QStringList dirList() const;
|
||||
|
||||
private:
|
||||
Ui::CompilerSetDirectoriesWidget *ui;
|
||||
ListModel* mModel;
|
||||
};
|
||||
|
||||
#endif // COMPILERSETDIRECTORIESWIDGET_H
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CompilerSetDirectoriesWidget</class>
|
||||
<widget class="QWidget" name="CompilerSetDirectoriesWidget">
|
||||
<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="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="toolTip">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/002-add.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_2">
|
||||
<property name="toolTip">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/008-close.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_3">
|
||||
<property name="toolTip">
|
||||
<string>Remove Invalid</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Invalid</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/007-bughlp.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::MoveAction</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,187 @@
|
|||
#include "compilersetoptionwidget.h"
|
||||
#include "ui_compilersetoptionwidget.h"
|
||||
#include "../settings.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "compilersetdirectorieswidget.h"
|
||||
#include <QMessageBox>
|
||||
#include "../utils.h"
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
||||
CompilerSetOptionWidget::CompilerSetOptionWidget(const QString& name, const QString& group, QWidget* parent) :
|
||||
SettingsWidget(name,group,parent),
|
||||
ui(new Ui::CompilerSetOptionWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mBinDirWidget = new CompilerSetDirectoriesWidget();
|
||||
ui->dirTabs->addTab(mBinDirWidget,QObject::tr("Binaries"));
|
||||
mLibDirWidget = new CompilerSetDirectoriesWidget();
|
||||
ui->dirTabs->addTab(mLibDirWidget,QObject::tr("Libraries"));
|
||||
mCIncludeDirWidget = new CompilerSetDirectoriesWidget();
|
||||
ui->dirTabs->addTab(mCIncludeDirWidget,QObject::tr("C Includes"));
|
||||
mCppIncludeDirWidget = new CompilerSetDirectoriesWidget();
|
||||
ui->dirTabs->addTab(mCppIncludeDirWidget,QObject::tr("C++ Includes"));
|
||||
|
||||
connect(ui->chkUseCustomCompilerParams, &QCheckBox::stateChanged,
|
||||
ui->txtCustomCompileParams, &QPlainTextEdit::setEnabled);
|
||||
connect(ui->chkUseCustomLinkParams, &QCheckBox::stateChanged,
|
||||
ui->txtCustomLinkParams, &QPlainTextEdit::setEnabled);
|
||||
}
|
||||
|
||||
CompilerSetOptionWidget::~CompilerSetOptionWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void resetOptionTabs(Settings::PCompilerSet pSet,QTabWidget* pTab)
|
||||
{
|
||||
while (pTab->count()>0) {
|
||||
QWidget* p=pTab->widget(0);
|
||||
if (p!=nullptr) {
|
||||
pTab->removeTab(0);
|
||||
p->setParent(nullptr);
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
for (PCompilerOption pOption: pSet->options()) {
|
||||
QWidget* pWidget = nullptr;
|
||||
for (int i=0;i<pTab->count();i++) {
|
||||
if (pOption->section == pTab->tabText(i)) {
|
||||
pWidget = pTab->widget(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pWidget == nullptr) {
|
||||
pWidget = new QWidget();
|
||||
pTab->addTab(pWidget,pOption->section);
|
||||
pWidget->setLayout(new QGridLayout());
|
||||
}
|
||||
QGridLayout *pLayout = (QGridLayout*)pWidget->layout();
|
||||
int row = pLayout->rowCount();
|
||||
pLayout->addWidget(new QLabel(pOption->name),row,0);
|
||||
QComboBox* pCombo = new QComboBox();
|
||||
if (pOption->choices.count()>0) {
|
||||
for (int i=0;i<pOption->choices.count();i++) {
|
||||
QString choice = pOption->choices[i];
|
||||
QStringList valueName=choice.split("=");
|
||||
if (valueName.length()<2) {
|
||||
pCombo->addItem("");
|
||||
} else {
|
||||
pCombo->addItem(valueName[0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pCombo->addItem(QObject::tr("No"));
|
||||
pCombo->addItem(QObject::tr("Yes"));
|
||||
}
|
||||
pCombo->setCurrentIndex(pOption->value);
|
||||
pLayout->addWidget(pCombo,row,1);
|
||||
}
|
||||
for (int i=0;i<pTab->count();i++) {
|
||||
QWidget* pWidget = pTab->widget(i);
|
||||
QGridLayout *pLayout = (QGridLayout*)pWidget->layout();
|
||||
int row = pLayout->rowCount();
|
||||
QSpacerItem* horizontalSpacer = new QSpacerItem(10, 100, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
pLayout->addItem(horizontalSpacer,row,0);
|
||||
}
|
||||
}
|
||||
|
||||
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
|
||||
ui->chkUseCustomCompilerParams->setChecked(pSet->useCustomCompileParams());
|
||||
ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams());
|
||||
ui->txtCustomCompileParams->setEnabled(pSet->useCustomCompileParams());
|
||||
ui->chkUseCustomLinkParams->setChecked(pSet->useCustomLinkParams());
|
||||
ui->txtCustomLinkParams->setPlainText(pSet->customLinkParams());
|
||||
ui->txtCustomLinkParams->setEnabled(pSet->useCustomLinkParams());
|
||||
ui->chkStaticLink->setChecked(pSet->staticLink());
|
||||
ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams());
|
||||
|
||||
//rest tabs in the options widget
|
||||
resetOptionTabs(pSet,ui->optionTabs);
|
||||
|
||||
ui->txtCCompiler->setText(pSet->CCompiler());
|
||||
ui->txtCppCompiler->setText(pSet->cppCompiler());
|
||||
ui->txtMake->setText(pSet->make());
|
||||
ui->txtDebugger->setText(pSet->debugger());
|
||||
ui->txtResourceCompiler->setText(pSet->resourceCompiler());
|
||||
ui->txtProfiler->setText(pSet->profiler());
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::doLoad()
|
||||
{
|
||||
ui->cbCompilerSet->clear();
|
||||
int index=pSettings->compilerSets().defaultIndex();
|
||||
for (int i=0;i<pSettings->compilerSets().list().size();i++) {
|
||||
ui->cbCompilerSet->addItem(pSettings->compilerSets().list()[i]->name());
|
||||
}
|
||||
ui->cbCompilerSet->setCurrentIndex(index);
|
||||
|
||||
//reloadCurrentCompilerSet();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::doSave()
|
||||
{
|
||||
pSettings->compilerSets().saveSets();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::on_cbCompilerSet_currentIndexChanged(int index)
|
||||
{
|
||||
if (index<0)
|
||||
return;
|
||||
pSettings->compilerSets().setDefaultIndex(index);
|
||||
reloadCurrentCompilerSet();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::reloadCurrentCompilerSet()
|
||||
{
|
||||
Settings::PCompilerSet pSet = pSettings->compilerSets().defaultSet();
|
||||
loadCompilerSetSettings(pSet, ui);
|
||||
|
||||
mBinDirWidget->setDirList(pSet->binDirs());
|
||||
mLibDirWidget->setDirList(pSet->libDirs());
|
||||
mCIncludeDirWidget->setDirList(pSet->CIncludeDirs());
|
||||
mCppIncludeDirWidget->setDirList(pSet->CppIncludeDirs());
|
||||
|
||||
connectInputs();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::on_btnFindCompilers_pressed()
|
||||
{
|
||||
if (QMessageBox::warning(this,tr("Confirm"),
|
||||
tr("Red Panda C++ will clear current compiler list and search"
|
||||
" for compilers in the following locations:\n '%1'\n'%2'\nAre you really want to continue?")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW64"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok )
|
||||
return;
|
||||
pSettings->compilerSets().clearSets();
|
||||
pSettings->compilerSets().findSets();
|
||||
doLoad();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::on_btnAddBlankCompilerSet_pressed()
|
||||
{
|
||||
QString name = QInputDialog::getText(this,tr("Compiler Set Name"),tr("Name"));
|
||||
pSettings->compilerSets().addSet();
|
||||
pSettings->compilerSets().setDefaultIndex(pSettings->compilerSets().list().size()-1);
|
||||
pSettings->compilerSets().defaultSet()->setName(name);
|
||||
doLoad();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::on_btnAddCompilerSetByFolder_pressed()
|
||||
{
|
||||
QString folder = QFileDialog::getExistingDirectory(this, tr("Compiler Set Folder"));
|
||||
pSettings->compilerSets().addSets(folder);
|
||||
doLoad();
|
||||
}
|
||||
|
||||
void CompilerSetOptionWidget::on_btnRenameCompilerSet_pressed()
|
||||
{
|
||||
QString name = QInputDialog::getText(this,tr("Compiler Set Name"),tr("New name"));
|
||||
if (!name.isEmpty())
|
||||
pSettings->compilerSets().defaultSet()->setName(name);
|
||||
doLoad();
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef COMPILERSETOPTIONWIDGET_H
|
||||
#define COMPILERSETOPTIONWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class CompilerSetOptionWidget;
|
||||
}
|
||||
|
||||
class CompilerSetDirectoriesWidget;
|
||||
class CompilerSetOptionWidget : public SettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CompilerSetOptionWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||
~CompilerSetOptionWidget();
|
||||
|
||||
private:
|
||||
Ui::CompilerSetOptionWidget *ui;
|
||||
CompilerSetDirectoriesWidget* mBinDirWidget;
|
||||
CompilerSetDirectoriesWidget* mCIncludeDirWidget;
|
||||
CompilerSetDirectoriesWidget* mCppIncludeDirWidget;
|
||||
CompilerSetDirectoriesWidget* mLibDirWidget;
|
||||
|
||||
|
||||
// SettingsWidget interface
|
||||
protected:
|
||||
void doLoad() override;
|
||||
void doSave() override;
|
||||
private:
|
||||
void reloadCurrentCompilerSet();
|
||||
|
||||
private slots:
|
||||
void on_cbCompilerSet_currentIndexChanged(int index);
|
||||
void on_btnFindCompilers_pressed();
|
||||
void on_btnAddBlankCompilerSet_pressed();
|
||||
void on_btnAddCompilerSetByFolder_pressed();
|
||||
void on_btnRenameCompilerSet_pressed();
|
||||
};
|
||||
|
||||
#endif // COMPILERSETOPTIONWIDGET_H
|
|
@ -0,0 +1,400 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CompilerSetOptionWidget</class>
|
||||
<widget class="QWidget" name="CompilerSetOptionWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>823</width>
|
||||
<height>607</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Compiler set to config</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbCompilerSet"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnFindCompilers">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/087-update.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAddBlankCompilerSet">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/050-newsrc.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAddCompilerSetByFolder">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRenameCompilerSet">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/062-redo.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRemoveCompilerSet">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/008-close.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="settingTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabGeneral">
|
||||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkUseCustomCompilerParams">
|
||||
<property name="text">
|
||||
<string>Add the following arguments when calling the compiler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="txtCustomCompileParams"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkUseCustomLinkParams">
|
||||
<property name="text">
|
||||
<string>Add the following arguments when calling the linker</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="txtCustomLinkParams"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkStaticLink">
|
||||
<property name="text">
|
||||
<string>Statically Link</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkAutoAddCharset">
|
||||
<property name="text">
|
||||
<string>Add Charset arguments when calling the compiler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabSettings">
|
||||
<attribute name="title">
|
||||
<string>Settings</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="optionTabs">
|
||||
<property name="documentMode">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabDirectories">
|
||||
<attribute name="title">
|
||||
<string>Directories</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="dirTabs">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabPrograms">
|
||||
<attribute name="title">
|
||||
<string>Programs</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Resource Compiler(windres)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtCppCompiler"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>C++ Compiler(g++)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="btnChooseCppCompiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose C++ Compiler</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="btnChooseCCompiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose C Compiler</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="txtCCompiler"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>C Compiler(gcc)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Debugger(gdb)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Profiler(gprof)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>make</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="txtMake"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="txtDebugger"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="txtResourceCompiler"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="txtProfiler"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="btnChooseMake">
|
||||
<property name="toolTip">
|
||||
<string>Choose make</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="btnChooseDebugger">
|
||||
<property name="toolTip">
|
||||
<string>Choose Debugger</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="chooseResourceCompiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose Resource Compiler</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QToolButton" name="chooseProfiler">
|
||||
<property name="toolTip">
|
||||
<string>Choose Profiler</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/053-open.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,75 @@
|
|||
#include "settingsdialog.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
#include "settingswidget.h"
|
||||
#include "compilersetoptionwidget.h"
|
||||
#include <QDebug>
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SettingsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->widgetsView->setModel(&model);
|
||||
|
||||
model.setHorizontalHeaderLabels(QStringList());
|
||||
|
||||
ui->btnApply->setEnabled(false);
|
||||
|
||||
pCompilerSetOptionWidget = new CompilerSetOptionWidget(tr("Compiler Set"),tr("Compiler"));
|
||||
pCompilerSetOptionWidget->init();
|
||||
|
||||
addWidget(pCompilerSetOptionWidget);
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
for (SettingsWidget* p:mSettingWidgets) {
|
||||
p->setParent(nullptr);
|
||||
delete p;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SettingsDialog::addWidget(SettingsWidget *pWidget)
|
||||
{
|
||||
QList<QStandardItem*> items = model.findItems(pWidget->group());
|
||||
QStandardItem* pGroupItem;
|
||||
if (items.count() == 0 ) {
|
||||
pGroupItem = new QStandardItem(pWidget->group());
|
||||
pGroupItem->setData(-1, GetWidgetIndexRole);
|
||||
model.appendRow(pGroupItem);
|
||||
} else {
|
||||
pGroupItem = items[0];
|
||||
}
|
||||
mSettingWidgets.append(pWidget);
|
||||
QStandardItem* pWidgetItem = new QStandardItem(pWidget->name());
|
||||
pWidgetItem->setData(mSettingWidgets.count()-1, GetWidgetIndexRole);
|
||||
pGroupItem->appendRow(pWidgetItem);
|
||||
connect(pWidget, &SettingsWidget::settingsChanged,
|
||||
this , &SettingsDialog::widget_settings_changed);
|
||||
}
|
||||
|
||||
|
||||
void SettingsDialog::on_widgetsView_clicked(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
int i = index.data(GetWidgetIndexRole).toInt();
|
||||
if (i>=0) {
|
||||
if (ui->scrollArea->widget()!=ui->scrollAreaWidgetContents) {
|
||||
//todo save change
|
||||
|
||||
}
|
||||
SettingsWidget* pWidget = mSettingWidgets[i];
|
||||
ui->scrollArea->setWidget(pWidget);
|
||||
ui->lblWidgetCaption->setText(QString("%1 > %2").arg(pWidget->group()).arg(pWidget->name()));
|
||||
|
||||
ui->btnApply->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::widget_settings_changed(bool value)
|
||||
{
|
||||
ui->btnApply->setEnabled(value);
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef SETTINGSDIALOG_H
|
||||
#define SETTINGSDIALOG_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDialog>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
class SettingsWidget;
|
||||
namespace Ui {
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
class CompilerSetOptionWidget;
|
||||
class PCompilerSet;
|
||||
class SettingsWidget;
|
||||
class SettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum {
|
||||
GetWidgetIndexRole = Qt::UserRole + 1
|
||||
};
|
||||
explicit SettingsDialog(QWidget *parent = nullptr);
|
||||
~SettingsDialog();
|
||||
|
||||
void addWidget(SettingsWidget* pWidget);
|
||||
private slots:
|
||||
void widget_settings_changed(bool value);
|
||||
void on_widgetsView_clicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::SettingsDialog *ui;
|
||||
QList<SettingsWidget*> mSettingWidgets;
|
||||
QStandardItemModel model;
|
||||
|
||||
CompilerSetOptionWidget* pCompilerSetOptionWidget;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
|
@ -0,0 +1,185 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SettingsDialog</class>
|
||||
<widget class="QDialog" name="SettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>977</width>
|
||||
<height>622</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeView" name="widgetsView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblWidgetCaption">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>535</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>192</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOk">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnApply">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancle">
|
||||
<property name="text">
|
||||
<string>Cancle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue