work save: project Template
- done: all project option dialogs
This commit is contained in:
parent
c242225951
commit
ca728a2900
|
@ -34,6 +34,7 @@ SOURCES += \
|
|||
parser/parserutils.cpp \
|
||||
parser/statementmodel.cpp \
|
||||
project.cpp \
|
||||
projecttemplate.cpp \
|
||||
qsynedit/Search.cpp \
|
||||
qsynedit/SearchBase.cpp \
|
||||
qsynedit/SearchRegex.cpp \
|
||||
|
@ -48,7 +49,10 @@ SOURCES += \
|
|||
settingsdialog/projectdirectorieswidget.cpp \
|
||||
settingsdialog/projectfileswidget.cpp \
|
||||
settingsdialog/projectgeneralwidget.cpp \
|
||||
settingsdialog/projectmakefilewidget.cpp \
|
||||
settingsdialog/projectoutputwidget.cpp \
|
||||
settingsdialog/projectprecompilewidget.cpp \
|
||||
settingsdialog/projectversioninfowidget.cpp \
|
||||
widgets/classbrowser.cpp \
|
||||
widgets/codecompletionlistview.cpp \
|
||||
widgets/codecompletionpopup.cpp \
|
||||
|
@ -91,6 +95,7 @@ SOURCES += \
|
|||
utils.cpp \
|
||||
widgets/coloredit.cpp \
|
||||
widgets/consolewidget.cpp \
|
||||
widgets/custommakefileinfodialog.cpp \
|
||||
widgets/filepropertiesdialog.cpp \
|
||||
widgets/headercompletionpopup.cpp \
|
||||
widgets/issuestable.cpp \
|
||||
|
@ -122,6 +127,7 @@ HEADERS += \
|
|||
parser/statementmodel.h \
|
||||
platform.h \
|
||||
project.h \
|
||||
projecttemplate.h \
|
||||
qsynedit/Search.h \
|
||||
qsynedit/SearchBase.h \
|
||||
qsynedit/SearchRegex.h \
|
||||
|
@ -136,7 +142,10 @@ HEADERS += \
|
|||
settingsdialog/projectdirectorieswidget.h \
|
||||
settingsdialog/projectfileswidget.h \
|
||||
settingsdialog/projectgeneralwidget.h \
|
||||
settingsdialog/projectmakefilewidget.h \
|
||||
settingsdialog/projectoutputwidget.h \
|
||||
settingsdialog/projectprecompilewidget.h \
|
||||
settingsdialog/projectversioninfowidget.h \
|
||||
widgets/classbrowser.h \
|
||||
widgets/codecompletionlistview.h \
|
||||
widgets/codecompletionpopup.h \
|
||||
|
@ -180,6 +189,7 @@ HEADERS += \
|
|||
common.h \
|
||||
widgets/coloredit.h \
|
||||
widgets/consolewidget.h \
|
||||
widgets/custommakefileinfodialog.h \
|
||||
widgets/filepropertiesdialog.h \
|
||||
widgets/headercompletionpopup.h \
|
||||
widgets/issuestable.h \
|
||||
|
@ -200,7 +210,10 @@ FORMS += \
|
|||
settingsdialog/projectdirectorieswidget.ui \
|
||||
settingsdialog/projectfileswidget.ui \
|
||||
settingsdialog/projectgeneralwidget.ui \
|
||||
settingsdialog/projectmakefilewidget.ui \
|
||||
settingsdialog/projectoutputwidget.ui \
|
||||
settingsdialog/projectprecompilewidget.ui \
|
||||
settingsdialog/projectversioninfowidget.ui \
|
||||
widgets/cpudialog.ui \
|
||||
mainwindow.ui \
|
||||
settingsdialog/compilersetdirectorieswidget.ui \
|
||||
|
@ -214,6 +227,7 @@ FORMS += \
|
|||
settingsdialog/environmentappearencewidget.ui \
|
||||
settingsdialog/executorgeneralwidget.ui \
|
||||
settingsdialog/settingsdialog.ui \
|
||||
widgets/custommakefileinfodialog.ui \
|
||||
widgets/filepropertiesdialog.ui \
|
||||
widgets/searchdialog.ui
|
||||
|
||||
|
|
|
@ -1403,12 +1403,12 @@ void Project::updateFolderNode(PFolderNode node)
|
|||
}
|
||||
}
|
||||
|
||||
QByteArray Project::toByteArray(const QString &s)
|
||||
QByteArray toByteArray(const QString &s)
|
||||
{
|
||||
return s.toLocal8Bit();
|
||||
}
|
||||
|
||||
QString Project::fromByteArray(const QByteArray &s)
|
||||
QString fromByteArray(const QByteArray &s)
|
||||
{
|
||||
return QString::fromLocal8Bit(s);
|
||||
}
|
||||
|
@ -1718,3 +1718,24 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
ProjectVersionInfo::ProjectVersionInfo()
|
||||
{
|
||||
major = 1;
|
||||
minor = 0;
|
||||
release = 0;
|
||||
build = 0;
|
||||
languageID = 0x0409; // US English
|
||||
charsetID = 0x04E4; // Windows multilingual
|
||||
companyName = "";
|
||||
fileVersion = "";
|
||||
fileDescription = "Developed using the Red Panda Dev-C++ IDE";
|
||||
internalName = "";
|
||||
legalCopyright = "";
|
||||
legalTrademarks = "";
|
||||
originalFilename = "";
|
||||
productName = "";
|
||||
productVersion = "";
|
||||
autoIncBuildNr = false;
|
||||
syncProduct = true;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ private:
|
|||
using PProjectUnit = std::shared_ptr<ProjectUnit>;
|
||||
|
||||
struct ProjectVersionInfo{
|
||||
explicit ProjectVersionInfo();
|
||||
int major;
|
||||
int minor;
|
||||
int release;
|
||||
|
@ -238,8 +239,6 @@ private:
|
|||
void open();
|
||||
void removeFolderRecurse(PFolderNode node);
|
||||
void updateFolderNode(PFolderNode node);
|
||||
QByteArray toByteArray(const QString& s);
|
||||
QString fromByteArray(const QByteArray& s);
|
||||
|
||||
private:
|
||||
QList<PProjectUnit> mUnits;
|
||||
|
@ -254,4 +253,7 @@ private:
|
|||
ProjectModel mModel;
|
||||
};
|
||||
|
||||
QByteArray toByteArray(const QString& s);
|
||||
QString fromByteArray(const QByteArray& s);
|
||||
|
||||
#endif // PROJECT_H
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
#include "projecttemplate.h"
|
||||
#include "SimpleIni.h"
|
||||
|
||||
#include <QFile>
|
||||
ProjectTemplate::ProjectTemplate(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ProjectTemplate::unitCount()
|
||||
{
|
||||
if (mFileName.isEmpty() || !QFile(mFileName).exists())
|
||||
return -1;
|
||||
SimpleIni ini;
|
||||
ini.LoadFile(toByteArray(mFileName));
|
||||
int ver = ini.GetLongValue("Template","Ver",0);
|
||||
if (ver<=0)
|
||||
return 0;
|
||||
return ini.GetLongValue("Project","UnitCount",0);
|
||||
}
|
||||
|
||||
PTemplateUnit ProjectTemplate::unit(int index)
|
||||
{
|
||||
if (mFileName.isEmpty() || !QFile(mFileName).exists())
|
||||
return PTemplateUnit();
|
||||
SimpleIni ini;
|
||||
ini.LoadFile(toByteArray(mFileName));
|
||||
int ver = ini.GetLongValue("Template","Ver",0);
|
||||
if (ver<=0)
|
||||
return PTemplateUnit();
|
||||
QString section = QString("Unit%1").arg(index);
|
||||
PTemplateUnit unit = std::make_shared<TemplateUnit>();
|
||||
unit->CText = fromByteArray(ini.GetValue(toByteArray(section), "C", ""));
|
||||
unit->CppText = fromByteArray(ini.GetValue(toByteArray(section), "Cpp", ""));
|
||||
if (unit->CppText.isEmpty())
|
||||
unit->CppText = unit->CText;
|
||||
|
||||
unit->CName = fromByteArray(ini.GetValue(toByteArray(section), "CName", ""));
|
||||
unit->CppName = fromByteArray(ini.GetValue(toByteArray(section), "CppName", ""));
|
||||
if (unit->CppName.isEmpty())
|
||||
unit->CppName = unit->CName;
|
||||
}
|
||||
|
||||
void ProjectTemplate::setUnit(int index, PTemplateUnit newUnit)
|
||||
{
|
||||
if (!newUnit)
|
||||
return;
|
||||
if (mFileName.isEmpty() || !QFile(mFileName).exists())
|
||||
return;
|
||||
SimpleIni ini;
|
||||
ini.LoadFile(toByteArray(mFileName));
|
||||
int ver = ini.GetLongValue("Template","Ver",0);
|
||||
if (ver<=0)
|
||||
return;
|
||||
QByteArray section = toByteArray(QString("Unit%1").arg(index));
|
||||
ini.SetValue(section,"C", toByteArray(newUnit->CText));
|
||||
ini.SetValue(section,"Cpp", toByteArray(newUnit->CppText));
|
||||
ini.SetValue(section,"CName", toByteArray(newUnit->CName));
|
||||
ini.SetValue(section,"CppName", toByteArray(newUnit->CppName));
|
||||
ini.SaveFile(toByteArray(mFileName));
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef PROJECTTEMPLATE_H
|
||||
#define PROJECTTEMPLATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include "project.h"
|
||||
|
||||
struct TemplateUnit {
|
||||
QString CName;
|
||||
QString CppName;
|
||||
QString CText;
|
||||
QString CppText;
|
||||
};
|
||||
|
||||
using PTemplateUnit = std::shared_ptr<TemplateUnit>;
|
||||
|
||||
class ProjectTemplate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProjectTemplate(QObject *parent = nullptr);
|
||||
int unitCount();
|
||||
PTemplateUnit unit(int index);
|
||||
void setUnit(int index, PTemplateUnit newUnit);
|
||||
|
||||
private:
|
||||
QString mFileName;
|
||||
ProjectOptions mOptions;
|
||||
QString mDesc;
|
||||
QString mCategory;
|
||||
QString mName;
|
||||
QString mIcon; // icon in project form
|
||||
int mVersion;
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // PROJECTTEMPLATE_H
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
#include "compilersetdirectorieswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProjectDirectoriesWidget;
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
#include "projectmakefilewidget.h"
|
||||
#include "ui_projectmakefilewidget.h"
|
||||
#include "compilersetdirectorieswidget.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "../project.h"
|
||||
#include "../widgets/custommakefileinfodialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
ProjectMakefileWidget::ProjectMakefileWidget(const QString &name, const QString &group, QWidget *parent) :
|
||||
SettingsWidget(name,group,parent),
|
||||
ui(new Ui::ProjectMakefileWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mIncludesDirWidget = new CompilerSetDirectoriesWidget(this);
|
||||
ui->verticalLayout->addWidget(mIncludesDirWidget);
|
||||
}
|
||||
|
||||
ProjectMakefileWidget::~ProjectMakefileWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProjectMakefileWidget::doLoad()
|
||||
{
|
||||
ui->grpCustomMakefile->setChecked(pMainWindow->project()->options().useCustomMakefile);
|
||||
ui->txtCustomMakefile->setText(pMainWindow->project()->options().customMakefile);
|
||||
mIncludesDirWidget->setDirList(pMainWindow->project()->options().makeIncludes);
|
||||
}
|
||||
|
||||
void ProjectMakefileWidget::doSave()
|
||||
{
|
||||
pMainWindow->project()->options().useCustomMakefile = ui->grpCustomMakefile->isChecked();
|
||||
pMainWindow->project()->options().customMakefile = ui->txtCustomMakefile->text();
|
||||
pMainWindow->project()->options().makeIncludes = mIncludesDirWidget->dirList();
|
||||
pMainWindow->project()->saveOptions();
|
||||
|
||||
}
|
||||
|
||||
void ProjectMakefileWidget::on_btnBrowse_triggered(QAction *arg1)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Custom makefile"),
|
||||
pMainWindow->project()->directory(),
|
||||
tr("All files (*.*)"));
|
||||
if (!fileName.isEmpty() && QFileInfo(fileName).exists()) {
|
||||
ui->txtCustomMakefile->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ProjectMakefileWidget::on_pushButton_clicked()
|
||||
{
|
||||
CustomMakefileInfoDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef PROJECTMAKEFILEWIDGET_H
|
||||
#define PROJECTMAKEFILEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProjectMakefileWidget;
|
||||
}
|
||||
|
||||
class CompilerSetDirectoriesWidget;
|
||||
class ProjectMakefileWidget : public SettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectMakefileWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||
~ProjectMakefileWidget();
|
||||
|
||||
private:
|
||||
Ui::ProjectMakefileWidget *ui;
|
||||
CompilerSetDirectoriesWidget * mIncludesDirWidget;
|
||||
|
||||
// SettingsWidget interface
|
||||
protected:
|
||||
void doLoad() override;
|
||||
void doSave() override;
|
||||
private slots:
|
||||
void on_btnBrowse_triggered(QAction *arg1);
|
||||
void on_pushButton_clicked();
|
||||
};
|
||||
|
||||
#endif // PROJECTMAKEFILEWIDGET_H
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectMakefileWidget</class>
|
||||
<widget class="QWidget" name="ProjectMakefileWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>610</width>
|
||||
<height>462</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpCustomMakefile">
|
||||
<property name="title">
|
||||
<string>Use custom make file</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="txtCustomMakefile"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="btnBrowse">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Information about using a custom make file </string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/085-tutor.png</normaloff>:/icons/images/newlook24/085-tutor.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,75 @@
|
|||
#include "projectoutputwidget.h"
|
||||
#include "ui_projectoutputwidget.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "../project.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
ProjectOutputWidget::ProjectOutputWidget(const QString &name, const QString &group, QWidget *parent) :
|
||||
SettingsWidget(name,group,parent),
|
||||
ui(new Ui::ProjectOutputWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ProjectOutputWidget::~ProjectOutputWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProjectOutputWidget::doLoad()
|
||||
{
|
||||
ui->txtOutputDir->setText(pMainWindow->project()->options().exeOutput);
|
||||
ui->txtObjOutputDir->setText(pMainWindow->project()->options().objectOutput);
|
||||
ui->grpAutosaveCompileLog->setChecked(pMainWindow->project()->options().logOutputEnabled);
|
||||
ui->txtCompileLog->setText(pMainWindow->project()->options().logOutput);
|
||||
ui->grpOverrideOutput->setChecked(pMainWindow->project()->options().overrideOutput);
|
||||
ui->txtOutputFilename->setText(pMainWindow->project()->options().overridenOutput);
|
||||
}
|
||||
|
||||
void ProjectOutputWidget::doSave()
|
||||
{
|
||||
pMainWindow->project()->options().exeOutput = ui->txtOutputDir->text();
|
||||
pMainWindow->project()->options().objectOutput = ui->txtObjOutputDir->text();
|
||||
pMainWindow->project()->options().logOutputEnabled = ui->grpAutosaveCompileLog->isChecked();
|
||||
pMainWindow->project()->options().logOutput = ui->txtCompileLog->text();
|
||||
pMainWindow->project()->options().overrideOutput = ui->grpOverrideOutput->isChecked();
|
||||
pMainWindow->project()->options().overridenOutput = ui->txtOutputFilename->text();
|
||||
pMainWindow->project()->saveOptions();
|
||||
}
|
||||
|
||||
void ProjectOutputWidget::on_btnOutputDir_triggered(QAction *)
|
||||
{
|
||||
QString dirName = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
tr("Executable output directory"),
|
||||
pMainWindow->project()->directory());
|
||||
if (!dirName.isEmpty())
|
||||
ui->txtOutputDir->setText(dirName);
|
||||
}
|
||||
|
||||
|
||||
void ProjectOutputWidget::on_btnObjOutputDir_triggered(QAction *)
|
||||
{
|
||||
QString dirName = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
tr("Object files output directory"),
|
||||
pMainWindow->project()->directory());
|
||||
if (!dirName.isEmpty())
|
||||
ui->txtObjOutputDir->setText(dirName);
|
||||
}
|
||||
|
||||
|
||||
void ProjectOutputWidget::on_btnCompileLog_triggered(QAction *)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Log file"),
|
||||
pMainWindow->project()->directory(),
|
||||
tr("All files (*.*)"));
|
||||
if (!fileName.isEmpty() ) {
|
||||
ui->txtCompileLog->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef PROJECTOUTPUTWIDGET_H
|
||||
#define PROJECTOUTPUTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProjectOutputWidget;
|
||||
}
|
||||
|
||||
class ProjectOutputWidget : public SettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectOutputWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||
~ProjectOutputWidget();
|
||||
|
||||
private:
|
||||
Ui::ProjectOutputWidget *ui;
|
||||
|
||||
// SettingsWidget interface
|
||||
protected:
|
||||
void doLoad() override;
|
||||
void doSave() override;
|
||||
private slots:
|
||||
void on_btnOutputDir_triggered(QAction *arg1);
|
||||
void on_btnObjOutputDir_triggered(QAction *arg1);
|
||||
void on_btnCompileLog_triggered(QAction *arg1);
|
||||
};
|
||||
|
||||
#endif // PROJECTOUTPUTWIDGET_H
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectOutputWidget</class>
|
||||
<widget class="QWidget" name="ProjectOutputWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>457</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>Executable output directory</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtOutputDir"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnOutputDir">
|
||||
<property name="text">
|
||||
<string>browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Object file output directory</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtObjOutputDir"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnObjOutputDir">
|
||||
<property name="text">
|
||||
<string>browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpAutosaveCompileLog">
|
||||
<property name="title">
|
||||
<string>Auto save compile log</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtCompileLog"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnCompileLog">
|
||||
<property name="text">
|
||||
<string>browse</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpOverrideOutput">
|
||||
<property name="title">
|
||||
<string>Override output filename</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtOutputFilename"/>
|
||||
</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>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -34,7 +34,7 @@ void ProjectPreCompileWidget::on_btnBrowse_triggered(QAction *arg1)
|
|||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("precompiled header"),
|
||||
tr("Precompiled header"),
|
||||
pMainWindow->project()->directory(),
|
||||
tr("header files (*.h"));
|
||||
if (!fileName.isEmpty() && QFileInfo(fileName).exists()) {
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
#include "projectversioninfowidget.h"
|
||||
#include "ui_projectversioninfowidget.h"
|
||||
#include <winnls.h>
|
||||
#include "../mainwindow.h"
|
||||
#include "../project.h"
|
||||
|
||||
static QStringList languageNames;
|
||||
static QList<int> languageIDs;
|
||||
|
||||
static BOOL CALLBACK localeEnumProc(
|
||||
_In_ LPTSTR lpLocaleString
|
||||
) {
|
||||
|
||||
QString s = QString::fromWCharArray(lpLocaleString);
|
||||
bool ok;
|
||||
int aid = s.mid(4,4).toInt(&ok,16);
|
||||
if (ok) {
|
||||
TCHAR buffer [1024];
|
||||
GetLocaleInfo(aid, LOCALE_SLANGUAGE,buffer,sizeof(buffer)/2);
|
||||
languageNames.append(QString::fromWCharArray(buffer));
|
||||
languageIDs.append(aid);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
ProjectVersionInfoWidget::ProjectVersionInfoWidget(const QString &name, const QString &group, QWidget *parent) :
|
||||
SettingsWidget(name,group,parent),
|
||||
ui(new Ui::ProjectVersionInfoWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if (languageNames.isEmpty()) {
|
||||
EnumSystemLocales(localeEnumProc, LCID_SUPPORTED);
|
||||
}
|
||||
ui->cbLanguage->addItems(languageNames);
|
||||
}
|
||||
|
||||
ProjectVersionInfoWidget::~ProjectVersionInfoWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProjectVersionInfoWidget::doLoad()
|
||||
{
|
||||
std::shared_ptr<Project> project = pMainWindow->project();
|
||||
ui->grpVersionInfo->setChecked(project->options().includeVersionInfo);
|
||||
ui->spinMajor->setValue(project->options().versionInfo.major);
|
||||
ui->spinMinor->setValue(project->options().versionInfo.minor);
|
||||
ui->spinRelease->setValue(project->options().versionInfo.release);
|
||||
ui->spinBuild->setValue(project->options().versionInfo.build);
|
||||
ui->chkAutoIncreaseBuildNumber->setChecked(project->options().versionInfo.autoIncBuildNr);
|
||||
ui->chkSyncProductWithFile->setChecked(project->options().versionInfo.syncProduct);
|
||||
for (int i=0;i<languageIDs.count();i++) {
|
||||
if (languageIDs[i] == project->options().versionInfo.languageID) {
|
||||
ui->cbLanguage->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->txtFileDescription->setText(project->options().versionInfo.fileDescription);
|
||||
ui->txtFileVersion->setText(project->options().versionInfo.fileVersion);
|
||||
ui->txtProductName->setText(project->options().versionInfo.productName);
|
||||
ui->txtProductVersion->setText(project->options().versionInfo.productVersion);
|
||||
ui->txtOriginalFilename->setText(project->options().versionInfo.originalFilename);
|
||||
ui->txtInternalFilename->setText(project->options().versionInfo.internalName);
|
||||
ui->txtCompanyName->setText(project->options().versionInfo.companyName);
|
||||
ui->txtLegalCopyright->setText(project->options().versionInfo.legalCopyright);
|
||||
ui->txtLegalTrademarks->setText(project->options().versionInfo.legalTrademarks);
|
||||
}
|
||||
|
||||
void ProjectVersionInfoWidget::doSave()
|
||||
{
|
||||
std::shared_ptr<Project> project = pMainWindow->project();
|
||||
project->options().includeVersionInfo = ui->grpVersionInfo->isChecked();
|
||||
project->options().versionInfo.major = ui->spinMajor->value();
|
||||
project->options().versionInfo.minor = ui->spinMinor->value();
|
||||
project->options().versionInfo.release = ui->spinRelease->value();
|
||||
project->options().versionInfo.build = ui->spinBuild->value();
|
||||
project->options().versionInfo.autoIncBuildNr = ui->chkAutoIncreaseBuildNumber->isChecked();
|
||||
project->options().versionInfo.syncProduct = ui->chkSyncProductWithFile->isChecked();
|
||||
if (ui->cbLanguage->currentIndex()>=0)
|
||||
project->options().versionInfo.languageID = languageIDs[ui->cbLanguage->currentIndex()];
|
||||
|
||||
project->options().versionInfo.fileDescription = ui->txtFileDescription->text();
|
||||
project->options().versionInfo.fileVersion = ui->txtFileVersion->text();
|
||||
project->options().versionInfo.productName = ui->txtProductName->text();
|
||||
project->options().versionInfo.productVersion = ui->txtProductVersion->text();
|
||||
project->options().versionInfo.originalFilename = ui->txtOriginalFilename->text();
|
||||
project->options().versionInfo.internalName = ui->txtInternalFilename->text();
|
||||
project->options().versionInfo.companyName = ui->txtCompanyName->text();
|
||||
project->options().versionInfo.legalCopyright = ui->txtLegalCopyright->text();
|
||||
project->options().versionInfo.legalTrademarks = ui->txtLegalTrademarks->text();
|
||||
project->saveOptions();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef PROJECTVERSIONINFOWIDGET_H
|
||||
#define PROJECTVERSIONINFOWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "settingswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProjectVersionInfoWidget;
|
||||
}
|
||||
|
||||
class ProjectVersionInfoWidget : public SettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectVersionInfoWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||
~ProjectVersionInfoWidget();
|
||||
|
||||
private:
|
||||
Ui::ProjectVersionInfoWidget *ui;
|
||||
|
||||
|
||||
// SettingsWidget interface
|
||||
protected:
|
||||
void doLoad() override;
|
||||
void doSave() override;
|
||||
};
|
||||
|
||||
#endif // PROJECTVERSIONINFOWIDGET_H
|
|
@ -0,0 +1,254 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectVersionInfoWidget</class>
|
||||
<widget class="QWidget" name="ProjectVersionInfoWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>906</width>
|
||||
<height>578</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpVersionInfo">
|
||||
<property name="title">
|
||||
<string>Include version info in project</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spinMinor">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="spinBuild">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Major</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Minor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Rlease</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="spinRelease">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QSpinBox" name="spinMajor">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Build</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<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 row="3" column="0" colspan="3">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbLanguage"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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 row="8" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Original filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="txtCompanyName"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="chkSyncProductWithFile">
|
||||
<property name="text">
|
||||
<string>Sync product with file version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Internal name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="txtProductName"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="txtFileDescription"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>File version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Legal trademarks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Product name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="txtLegalCopyright"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Company name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="txtInternalFilename"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="chkAutoIncreaseBuildNumber">
|
||||
<property name="text">
|
||||
<string>Auto-increase build number on compile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="txtOriginalFilename"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>File description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Product version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="txtProductVersion"/>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Legal copyright</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="txtFileVersion"/>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="txtLegalTrademarks"/>
|
||||
</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>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -22,6 +22,9 @@
|
|||
#include "projectcompileparamaterswidget.h"
|
||||
#include "projectdirectorieswidget.h"
|
||||
#include "projectprecompilewidget.h"
|
||||
#include "projectoutputwidget.h"
|
||||
#include "projectmakefilewidget.h"
|
||||
#include "projectversioninfowidget.h"
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QModelIndex>
|
||||
|
@ -178,6 +181,18 @@ PSettingsDialog SettingsDialog::projectOptionDialog()
|
|||
widget->init();
|
||||
dialog->addWidget(widget);
|
||||
|
||||
widget = new ProjectMakefileWidget(tr("Makefile"),tr("Project"));
|
||||
widget->init();
|
||||
dialog->addWidget(widget);
|
||||
|
||||
widget = new ProjectOutputWidget(tr("Output"),tr("Project"));
|
||||
widget->init();
|
||||
dialog->addWidget(widget);
|
||||
|
||||
widget = new ProjectVersionInfoWidget(tr("Version info"),tr("Project"));
|
||||
widget->init();
|
||||
dialog->addWidget(widget);
|
||||
|
||||
dialog->selectFirstWidget();
|
||||
|
||||
return dialog;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include "custommakefileinfodialog.h"
|
||||
#include "ui_custommakefileinfodialog.h"
|
||||
|
||||
CustomMakefileInfoDialog::CustomMakefileInfoDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CustomMakefileInfoDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CustomMakefileInfoDialog::~CustomMakefileInfoDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CustomMakefileInfoDialog::on_pushButton_clicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef CUSTOMMAKEFILEINFODIALOG_H
|
||||
#define CUSTOMMAKEFILEINFODIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class CustomMakefileInfoDialog;
|
||||
}
|
||||
|
||||
class CustomMakefileInfoDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomMakefileInfoDialog(QWidget *parent = nullptr);
|
||||
~CustomMakefileInfoDialog();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::CustomMakefileInfoDialog *ui;
|
||||
};
|
||||
|
||||
#endif // CUSTOMMAKEFILEINFODIALOG_H
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomMakefileInfoDialog</class>
|
||||
<widget class="QDialog" name="CustomMakefileInfoDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>849</width>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<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>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Dev-C++'s Makefile has two important targets:</p><p>- all (which builds the executable)</p><p>- clean (which cleans up object files)</p><p><br/>&quot;all&quot; depends on 2 targets: all-before and all-after. All-before</p><p>gets called before the compilation process, and all-after gets</p><p>called after the compilation process.</p><p><br/>&quot;clean&quot; depends on the target clean-custom, which gets called</p><p>before the cleaning process.<br/></p><p>You can change the Makefile's behavior by defining the targets</p><p>that &quot;all&quot; and &quot;clean&quot; depend on.</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>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue