- fix: crash when create an empty project
This commit is contained in:
parent
0225854159
commit
b2e88c4c00
1
NEWS.md
1
NEWS.md
|
@ -9,6 +9,7 @@ Version 0.7.3
|
|||
- fix: syntax issues not correctly cleared when the file was saved as another name.
|
||||
- enhancement: when running a program, redirect a data file to its stdin
|
||||
- fix: can't correctly handle '&&' and '||' in the #if directive (and correctly parse windows.h header file)
|
||||
- fix: crash when create an empty project
|
||||
|
||||
Version 0.7.2
|
||||
- fix: rainbow parenthesis stop functioning when change editor's general options
|
||||
|
|
|
@ -3114,6 +3114,16 @@ void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line,
|
|||
}
|
||||
}
|
||||
|
||||
bool Editor::useCppSyntax() const
|
||||
{
|
||||
return mUseCppSyntax;
|
||||
}
|
||||
|
||||
void Editor::setUseCppSyntax(bool newUseCppSyntax)
|
||||
{
|
||||
mUseCppSyntax = newUseCppSyntax;
|
||||
}
|
||||
|
||||
void Editor::setInProject(bool newInProject)
|
||||
{
|
||||
if (mInProject == newInProject)
|
||||
|
|
|
@ -299,6 +299,9 @@ public:
|
|||
// QWidget interface
|
||||
void setInProject(bool newInProject);
|
||||
|
||||
bool useCppSyntax() const;
|
||||
void setUseCppSyntax(bool newUseCppSyntax);
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
|
|
|
@ -4169,6 +4169,7 @@ void MainWindow::on_actionNew_Project_triggered()
|
|||
tr("Can't assign project template"),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
mProject->options().useGPP = dialog.isCppProject();
|
||||
mProject->saveAll();
|
||||
updateProjectView();
|
||||
}
|
||||
|
@ -4209,11 +4210,12 @@ void MainWindow::on_actionProject_New_File_triggered()
|
|||
node = static_cast<FolderNode*>(current.internalPointer());
|
||||
}
|
||||
PProjectUnit newUnit = mProject->newUnit(
|
||||
mProject->pointerToNode(node) );
|
||||
mProject->pointerToNode(node));
|
||||
idx = mProject->units().count()-1;
|
||||
mProject->saveUnits();
|
||||
updateProjectView();
|
||||
Editor * editor = mProject->openUnit(idx);
|
||||
editor->setUseCppSyntax(mProject->options().useGPP);
|
||||
editor->setModified(true);
|
||||
editor->activate();
|
||||
}
|
||||
|
|
|
@ -661,8 +661,14 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate)
|
|||
true);
|
||||
|
||||
QString s2 = QDir(pSettings->dirs().templateDir()).absoluteFilePath(s);
|
||||
if (fileExists(s2)) {
|
||||
editor->loadFile(s2);
|
||||
if (fileExists(s2) && !s.isEmpty()) {
|
||||
try {
|
||||
editor->loadFile(s2);
|
||||
} catch(FileError& e) {
|
||||
QMessageBox::critical(pMainWindow,
|
||||
tr("Error Load File"),
|
||||
e.reason());
|
||||
}
|
||||
} else {
|
||||
s.replace("#13#10","\r\n");
|
||||
editor->insertString(s,false);
|
||||
|
|
Loading…
Reference in New Issue