fix: crash while delete headers created by new header dialog

This commit is contained in:
royqh1979@gmail.com 2022-02-01 16:17:28 +08:00
parent 5eb5c4d58b
commit 425b4a4e96
19 changed files with 843 additions and 543 deletions

View File

@ -6,6 +6,7 @@ Red Panda C++ Version 0.14.1
- enhancement: display localzed icon set name in the option dialog
- enhancement: new sky blue icon set, contributed by Alan-CRL
- enhancement: show caret at once, when edition finished
- enhancement: new header dialog for project
Red Panda C++ Version 0.14.0
- enhancement: custom icon set ( in the configuration folder)

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ void ProjectCompiler::createStandardMakeFile()
newMakeFile(file);
file.write("$(BIN): $(OBJ)\n");
if (!mOnlyCheckSyntax) {
if (mProject->options().useGPP) {
if (mProject->options().isCpp) {
writeln(file,"\t$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)");
} else
writeln(file,"\t$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)");
@ -80,7 +80,7 @@ void ProjectCompiler::createDynamicMakeFile()
newMakeFile(file);
writeln(file,"$(BIN): $(LINKOBJ)");
if (!mOnlyCheckSyntax) {
if (mProject->options().useGPP) {
if (mProject->options().isCpp) {
file.write("\t$(CPP) -mdll $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC)");
} else {
file.write("\t$(CC) -mdll $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC)");

View File

@ -55,6 +55,13 @@ Editor* EditorList::newEditor(const QString& filename, const QByteArray& encodin
Editor * e = new Editor(parentPageControl,filename,encoding,inProject,newFile,parentPageControl);
connect(e, &Editor::renamed, this, &EditorList::onEditorRenamed);
updateLayout();
if (pMainWindow->project()){
PProjectUnit unit = pMainWindow->project()->findUnitByFilename(filename);
if (unit) {
pMainWindow->project()->associateEditorToUnit(e,unit);
e->setInProject(true);
}
}
return e;
}

View File

@ -38,6 +38,7 @@
#include "widgets/ojproblempropertywidget.h"
#include "iconsmanager.h"
#include "widgets/newclassdialog.h"
#include "widgets/newheaderdialog.h"
#include <QCloseEvent>
#include <QComboBox>
@ -166,6 +167,10 @@ MainWindow::MainWindow(QWidget *parent)
mMenuNew->setTitle(tr("New"));
mMenuNew->addAction(ui->actionNew);
mMenuNew->addAction(ui->actionNew_Project);
mMenuNew->addSeparator();
mMenuNew->addAction(ui->actionNew_Class);
mMenuNew->addAction(ui->actionNew_Header);
ui->menuFile->insertMenu(ui->actionOpen,mMenuNew);
@ -474,6 +479,7 @@ void MainWindow::updateProjectActions()
ui->actionProject_options->setEnabled(hasProject);
ui->actionClose_Project->setEnabled(hasProject);
ui->actionNew_Class->setEnabled(hasProject);
ui->actionNew_Header->setEnabled(hasProject);
ui->actionProject_Open_Folder_In_Explorer->setEnabled(hasProject);
ui->actionProject_Open_In_Terminal->setEnabled(hasProject);
updateCompileActions();
@ -1010,9 +1016,9 @@ void MainWindow::openFile(const QString &filename, QTabWidget* page)
QByteArray encoding = unit ? unit->encoding() : ENCODING_AUTO_DETECT;
editor = mEditorList->newEditor(filename,encoding,
inProject, false, page);
if (mProject) {
mProject->associateEditorToUnit(editor,unit);
}
// if (mProject) {
// mProject->associateEditorToUnit(editor,unit);
// }
editor->activate();
this->updateForEncodingInfo();
} catch (FileError e) {
@ -2042,14 +2048,11 @@ void MainWindow::loadLastOpens()
bool inProject = (mProject && unit);
QByteArray encoding = unit ? unit->encoding() : ENCODING_AUTO_DETECT;
Editor * editor = mEditorList->newEditor(editorFilename, encoding, inProject,false,page);
if (mProject) {
mProject->associateEditorToUnit(editor,unit);
}
// if (mProject) {
// mProject->associateEditorToUnit(editor,unit);
// }
if (!editor)
continue;
// if (mProject) {
// mProject->associateEditor(editor);
// }
BufferCoord pos;
pos.Char = lastOpenIni.GetLongValue(sectionName,"CursorCol", 1);
pos.Line = lastOpenIni.GetLongValue(sectionName,"CursorRow", 1);
@ -2915,6 +2918,8 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
QMenu menu(this);
updateProjectActions();
menu.addAction(ui->actionProject_New_File);
menu.addAction(ui->actionNew_Class);
menu.addAction(ui->actionNew_Header);
menu.addAction(ui->actionAdd_to_project);
if (!onFolder) {
menu.addAction(ui->actionRemove_from_project);
@ -5327,7 +5332,7 @@ void MainWindow::newProjectUnitFile()
QString newFileName;
do {
newFileName = tr("untitled")+QString("%1").arg(getNewFileNumber());
if (mProject->options().useGPP) {
if (mProject->options().isCpp) {
newFileName+=".cpp";
} else {
newFileName+=".c";
@ -6148,6 +6153,55 @@ void MainWindow::on_actionDelete_to_Word_End_triggered()
}
void MainWindow::on_actionNew_Header_triggered()
{
if (!mProject)
return;
NewHeaderDialog dialog;
dialog.setPath(mProject->folder());
if (dialog.exec()==QDialog::Accepted) {
QDir dir(dialog.path());
if (dialog.headerName().isEmpty()
|| !dir.exists())
return;
QString headerFilename = includeTrailingPathDelimiter(dialog.path())+dialog.headerName();
if (fileExists(headerFilename)){
QMessageBox::critical(this,
tr("Header Exists"),
tr("Header file \"%1\" already exists!").arg(headerFilename));
return;
}
QString header_macro = QFileInfo(dialog.headerName()).baseName().toUpper()+"_H";
QStringList header;
QString indents;
if (pSettings->editor().tabToSpaces()) {
indents = QString(pSettings->editor().tabWidth(),' ');
} else {
indents = "\t";
}
header.append(QString("#ifndef %1").arg(header_macro));
header.append(QString("#define %1").arg(header_macro));
header.append("");
header.append("#endif");
stringsToFile(header, headerFilename);
mProject->addUnit(headerFilename,mProject->rootNode(),false);
mProject->cppParser()->addFileToScan(headerFilename);
mProject->rebuildNodes();
mProject->saveUnits();
parseFileList(mProject->cppParser());
updateProjectView();
Editor * editor = mEditorList->getEditorByFilename(headerFilename);
if (editor){
editor->activate();
}
}
pSettings->ui().setNewClassDialogWidth(dialog.width());
pSettings->ui().setNewClassDialogHeight(dialog.height());
}
void MainWindow::on_actionNew_Class_triggered()
{
if (!mProject)
@ -6161,6 +6215,20 @@ void MainWindow::on_actionNew_Class_triggered()
|| dialog.headerName().isEmpty()
|| !dir.exists())
return;
QString headerFilename = includeTrailingPathDelimiter(dialog.path())+dialog.headerName();
QString sourceFilename = includeTrailingPathDelimiter(dialog.path())+dialog.sourceName();
if (fileExists(headerFilename)){
QMessageBox::critical(this,
tr("Header Exists"),
tr("Header file \"%1\" already exists!").arg(headerFilename));
return;
}
if (fileExists(sourceFilename)){
QMessageBox::critical(this,
tr("Source Exists"),
tr("Source file \"%1\" already exists!").arg(sourceFilename));
return;
}
QString header_macro = dialog.className().toUpper()+"_H";
QStringList header;
QString indents;
@ -6180,13 +6248,11 @@ void MainWindow::on_actionNew_Class_triggered()
header.append("};");
header.append("");
header.append("#endif");
QString headerFilename = includeTrailingPathDelimiter(dialog.path())+dialog.headerName();
stringsToFile(header, headerFilename);
QStringList source;
source.append(QString("#include \"%1\"").arg(dialog.headerName()));
source.append("");
source.append("");
QString sourceFilename = includeTrailingPathDelimiter(dialog.path())+dialog.sourceName();
stringsToFile(source, sourceFilename);
mProject->addUnit(headerFilename,mProject->rootNode(),false);
@ -6197,8 +6263,14 @@ void MainWindow::on_actionNew_Class_triggered()
mProject->saveUnits();
parseFileList(mProject->cppParser());
updateProjectView();
Editor * editor = mEditorList->getEditorByFilename(headerFilename);
if (editor){
editor->activate();
}
editor = mEditorList->getEditorByFilename(sourceFilename);
}
pSettings->ui().setNewClassDialogWidth(dialog.width());
pSettings->ui().setNewClassDialogHeight(dialog.height());
pSettings->ui().setNewHeaderDialogWidth(dialog.width());
pSettings->ui().setNewHeaderDialogHeight(dialog.height());
}

View File

@ -561,6 +561,8 @@ private slots:
void on_actionNew_Class_triggered();
void on_actionNew_Header_triggered();
private:
Ui::MainWindow *ui;
EditorList *mEditorList;

View File

@ -543,7 +543,6 @@
<widget class="IssuesTable" name="tableIssues">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
@ -1389,7 +1388,7 @@
<x>0</x>
<y>0</y>
<width>1114</width>
<height>26</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1487,8 +1486,6 @@
<addaction name="actionBack"/>
<addaction name="actionForward"/>
<addaction name="separator"/>
<addaction name="actionNew_Class"/>
<addaction name="separator"/>
<addaction name="actionAdd_bookmark"/>
<addaction name="actionRemove_Bookmark"/>
<addaction name="actionModify_Bookmark_Description"/>
@ -1510,6 +1507,8 @@
<string>Project</string>
</property>
<addaction name="actionProject_New_File"/>
<addaction name="actionNew_Class"/>
<addaction name="actionNew_Header"/>
<addaction name="actionAdd_to_project"/>
<addaction name="actionRemove_from_project"/>
<addaction name="separator"/>
@ -2702,6 +2701,14 @@
<string>New Class...</string>
</property>
</action>
<action name="actionNew_Header">
<property name="text">
<string>New Header...</string>
</property>
<property name="toolTip">
<string>New Header...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -164,7 +164,7 @@ void Project::open()
newUnit->setFolder(fromByteArray(ini.GetValue(groupName,"Folder","")));
newUnit->setCompile(ini.GetBoolValue(groupName,"Compile", true));
newUnit->setCompileCpp(
ini.GetBoolValue(groupName,"CompileCpp",mOptions.useGPP));
ini.GetBoolValue(groupName,"CompileCpp",mOptions.isCpp));
newUnit->setLink(ini.GetBoolValue(groupName,"Link", true));
newUnit->setPriority(ini.GetLongValue(groupName,"Priority", 1000));
@ -268,7 +268,7 @@ PProjectUnit Project::newUnit(PFolderNode parentNode, const QString& customFileN
newUnit->node()->unitIndex = count;
//parentNode.Expand(True);
newUnit->setCompile(true);
newUnit->setCompileCpp(mOptions.useGPP);
newUnit->setCompileCpp(mOptions.isCpp);
newUnit->setLink(true);
newUnit->setPriority(1000);
newUnit->setOverrideBuildCmd(false);
@ -348,6 +348,7 @@ bool Project::removeUnit(int index, bool doClose , bool removeFile)
// qDebug()<<(qint64)unit->editor();
// Attempt to close it
if (doClose && (unit->editor())) {
unit->editor()->setInProject(false);
if (!pMainWindow->editorList()->closeEditor(unit->editor()))
return false;
}
@ -658,7 +659,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
}
mOptions = aTemplate->options();
mOptions.compilerSet = pSettings->compilerSets().defaultIndex();
mOptions.useGPP = useCpp;
mOptions.isCpp = useCpp;
updateCompilerSetType();
mOptions.icon = aTemplate->icon();
@ -690,7 +691,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
} else {
QString s;
PProjectUnit unit;
if (mOptions.useGPP) {
if (mOptions.isCpp) {
s = templateUnit->CppText;
unit = newUnit(mNode, templateUnit->CppName);
} else {
@ -743,7 +744,7 @@ void Project::saveOptions()
ini.SetValue("Project","Compiler", toByteArray(mOptions.compilerCmd));
ini.SetValue("Project","CppCompiler", toByteArray(mOptions.cppCompilerCmd));
ini.SetValue("Project","Linker", toByteArray(mOptions.linkerCmd));
ini.SetLongValue("Project","IsCpp", mOptions.useGPP);
ini.SetLongValue("Project","IsCpp", mOptions.isCpp);
ini.SetValue("Project","Icon", toByteArray(extractRelativePath(directory(), mOptions.icon)));
ini.SetValue("Project","ExeOutput", toByteArray(mOptions.exeOutput));
ini.SetValue("Project","ObjectOutput", toByteArray(mOptions.objectOutput));
@ -848,7 +849,7 @@ PProjectUnit Project::addUnit(const QString &inFileName, PFolderNode parentNode,
switch(getFileType(inFileName)) {
case FileType::CSource:
newUnit->setCompile(true);
newUnit->setCompileCpp(mOptions.useGPP);
newUnit->setCompileCpp(mOptions.isCpp);
newUnit->setLink(true);
break;
case FileType::CppSource:
@ -858,7 +859,7 @@ PProjectUnit Project::addUnit(const QString &inFileName, PFolderNode parentNode,
break;
case FileType::WindowsResourceSource:
newUnit->setCompile(true);
newUnit->setCompileCpp(mOptions.useGPP);
newUnit->setCompileCpp(mOptions.isCpp);
newUnit->setLink(false);
break;
default:
@ -1212,6 +1213,7 @@ void Project::closeUnit(int index)
PProjectUnit unit = mUnits[index];
if (unit->editor()) {
saveUnitLayout(unit->editor(),index);
unit->editor()->setInProject(false);
pMainWindow->editorList()->forceCloseEditor(unit->editor());
unit->setEditor(nullptr);
}
@ -1381,7 +1383,7 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts);
mOptions.makeIncludes = fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",QString::SkipEmptyParts);
mOptions.useGPP = ini.GetBoolValue("Project", "IsCpp", false);
mOptions.isCpp = ini.GetBoolValue("Project", "IsCpp", false);
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
mOptions.objectOutput = fromByteArray(ini.GetValue("Project", "ObjectOutput", ""));
mOptions.logOutput = fromByteArray(ini.GetValue("Project", "LogOutput", ""));
@ -1470,7 +1472,7 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts);
mOptions.includes = fromByteArray(ini.GetValue("Project", "IncludeDirs", "")).split(";",QString::SkipEmptyParts);
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "CompilerOptions", ""));
mOptions.useGPP = ini.GetBoolValue("Project", "Use_GPP", false);
mOptions.isCpp = ini.GetBoolValue("Project", "Use_GPP", false);
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
mOptions.objectOutput = fromByteArray(ini.GetValue("Project", "ObjectOutput", ""));
mOptions.overrideOutput = ini.GetBoolValue("Project", "OverrideOutput", false);

View File

@ -41,7 +41,7 @@ ProjectOptions::ProjectOptions()
{
type = ProjectType::GUI;
version = 2;
useGPP = false;
isCpp = false;
logOutputEnabled = false;
useCustomMakefile = false;
usePrecompiledHeader = false;

View File

@ -60,7 +60,7 @@ struct ProjectOptions{
QString privateResource;
QStringList resourceIncludes;
QStringList makeIncludes;
bool useGPP;
bool isCpp;
QString icon;
QString exeOutput;
QString objectOutput;

View File

@ -134,7 +134,7 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", ""));
mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", ""));
mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker",""));
mOptions.useGPP = mIni->GetBoolValue("Project", "IsCpp", false);
mOptions.isCpp = mIni->GetBoolValue("Project", "IsCpp", false);
mOptions.includeVersionInfo = mIni->GetBoolValue("Project", "IncludeVersionInfo", false);
mOptions.supportXPThemes = mIni->GetBoolValue("Project", "SupportXPThemes", false);
mOptions.exeOutput = fromByteArray(mIni->GetValue("Project", "ExeOutput", ""));

View File

@ -4738,6 +4738,26 @@ void Settings::UI::setNewClassDialogHeight(int newNewClassDialogHeight)
mNewClassDialogHeight = newNewClassDialogHeight;
}
int Settings::UI::newHeaderDialogHeight() const
{
return mNewHeaderDialogHeight;
}
void Settings::UI::setNewHeaderDialogHeight(int newNewFileDialogHeight)
{
mNewHeaderDialogHeight = newNewFileDialogHeight;
}
int Settings::UI::newHeaderDialogWidth() const
{
return mNewHeaderDialogWidth;
}
void Settings::UI::setNewHeaderDialogWidth(int newNewFileDialogWidth)
{
mNewHeaderDialogWidth = newNewFileDialogWidth;
}
int Settings::UI::settingsDialogHeight() const
{
return mSettingsDialogHeight;
@ -5002,6 +5022,8 @@ void Settings::UI::doSave()
saveValue("new_project_dialog_height", mNewProjectDialogHeight);
saveValue("new_class_dialog_width", mNewClassDialogWidth);
saveValue("new_class_dialog_height", mNewClassDialogHeight);
saveValue("new_header_dialog_width", mNewHeaderDialogWidth);
saveValue("new_header_dialog_height", mNewHeaderDialogHeight);
}
void Settings::UI::doLoad()
@ -5049,4 +5071,6 @@ void Settings::UI::doLoad()
mNewProjectDialogHeight = intValue("new_project_dialog_height", 600*qApp->desktop()->height()/1080);
mNewClassDialogWidth = intValue("new_class_dialog_width", 642*qApp->desktop()->width()/1920);
mNewClassDialogHeight = intValue("new_class_dialog_height", 300*qApp->desktop()->height()/1080);
mNewHeaderDialogWidth = intValue("new_header_dialog_width", 642*qApp->desktop()->width()/1920);
mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300*qApp->desktop()->height()/1080);
}

View File

@ -988,6 +988,12 @@ public:
int newClassDialogHeight() const;
void setNewClassDialogHeight(int newNewClassDialogHeight);
int newHeaderDialogWidth() const;
void setNewHeaderDialogWidth(int newNewFileDialogWidth);
int newHeaderDialogHeight() const;
void setNewHeaderDialogHeight(int newNewFileDialogHeight);
private:
QByteArray mMainWindowState;
QByteArray mMainWindowGeometry;
@ -1031,6 +1037,8 @@ public:
int mNewProjectDialogHeight;
int mNewClassDialogWidth;
int mNewClassDialogHeight;
int mNewHeaderDialogWidth;
int mNewHeaderDialogHeight;
protected:
void doSave() override;

View File

@ -81,7 +81,7 @@ void ProjectGeneralWidget::doLoad()
ui->lstType->setCurrentRow( static_cast<int>(project->options().type));
ui->cbDefaultCpp->setChecked(project->options().useGPP);
ui->cbDefaultCpp->setChecked(project->options().isCpp);
ui->cbSupportXPTheme->setChecked(project->options().supportXPThemes);
mIconPath = project->options().icon;
QPixmap icon(mIconPath);
@ -100,7 +100,7 @@ void ProjectGeneralWidget::doSave()
int row = std::max(0,ui->lstType->currentRow());
project->options().type = static_cast<ProjectType>(row);
project->options().useGPP = ui->cbDefaultCpp->isChecked();
project->options().isCpp = ui->cbDefaultCpp->isChecked();
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
if (mIconPath.isEmpty()
|| !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) {

View File

@ -11,6 +11,7 @@ NewClassDialog::NewClassDialog(QWidget *parent) :
ui->setupUi(this);
resize(pSettings->ui().newClassDialogWidth(),pSettings->ui().newClassDialogHeight());
updateIcons();
ui->txtClassName->setFocus();
}
NewClassDialog::~NewClassDialog()

View File

@ -1,14 +1,68 @@
#include "newheaderdialog.h"
#include "ui_newheaderdialog.h"
#include "../iconsmanager.h"
#include "../settings.h"
#include <QFileDialog>
NewHeaderDialog::NewHeaderDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewHeaderDialog)
{
ui->setupUi(this);
resize(pSettings->ui().newHeaderDialogWidth(),pSettings->ui().newHeaderDialogHeight());
updateIcons();
ui->txtHeader->setFocus();
}
NewHeaderDialog::~NewHeaderDialog()
{
delete ui;
}
QString NewHeaderDialog::headerName() const
{
return ui->txtHeader->text();
}
QString NewHeaderDialog::path() const
{
return ui->txtPath->text();
}
void NewHeaderDialog::setPath(const QString &location)
{
ui->txtPath->setText(location);
}
void NewHeaderDialog::updateIcons()
{
pIconsManager->setIcon(ui->btnBrowse, IconsManager::ACTION_FILE_OPEN_FOLDER);
}
void NewHeaderDialog::closeEvent(QCloseEvent */*event*/)
{
reject();
}
void NewHeaderDialog::on_btnCreate_clicked()
{
accept();
}
void NewHeaderDialog::on_btnCancel_clicked()
{
reject();
}
void NewHeaderDialog::on_btnBrowse_clicked()
{
QString fileName = QFileDialog::getExistingDirectory(
this,
tr("Path"),
ui->txtPath->text());
ui->txtPath->setText(fileName);
}

View File

@ -14,9 +14,23 @@ class NewHeaderDialog : public QDialog
public:
explicit NewHeaderDialog(QWidget *parent = nullptr);
~NewHeaderDialog();
QString headerName() const;
QString path() const;
void setPath(const QString& location);
private:
Ui::NewHeaderDialog *ui;
private:
void updateIcons();
// QWidget interface
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void on_btnCreate_clicked();
void on_btnCancel_clicked();
void on_btnBrowse_clicked();
};
#endif // NEWHEADERDIALOG_H

View File

@ -11,68 +11,93 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>New Header</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>69</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Header:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>150</x>
<y>40</y>
<width>113</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>40</x>
<y>90</y>
<width>69</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Path:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>150</x>
<y>80</y>
<width>113</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QToolButton" name="btnBrowse">
<property name="geometry">
<rect>
<x>350</x>
<y>80</y>
<width>28</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="txtPath"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Header:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="btnBrowse">
<property name="toolTip">
<string>Browse</string>
</property>
<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>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>179</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnCreate">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtHeader"/>
</item>
<item row="2" column="0">
<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/>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -208,7 +208,7 @@ void NewProjectDialog::on_lstTemplates_currentItemChanged(QListWidgetItem *curre
int index = current->data(Qt::UserRole).toInt();
PProjectTemplate t = mTemplates[index];
ui->lblDescription->setText(t->description());
if (t->options().useGPP) {
if (t->options().isCpp) {
ui->rdCProject->setEnabled(false);
ui->rdCppProject->setChecked(true);
} else {