- fix: editor's modified state not correctly initiated

- fix: project's modified state not correctly initiated
This commit is contained in:
royqh1979@gmail.com 2021-09-18 11:08:30 +08:00
parent 88ac399b4e
commit deabf1e847
5 changed files with 22 additions and 17 deletions

Binary file not shown.

View File

@ -2791,12 +2791,12 @@ Are you really want to continue?</source>
<message> <message>
<location filename="mainwindow.ui" line="1703"/> <location filename="mainwindow.ui" line="1703"/>
<source>Open Folder in Explorer</source> <source>Open Folder in Explorer</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="1712"/> <location filename="mainwindow.ui" line="1712"/>
<source>Open In Terminal</source> <source>Open In Terminal</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="98"/> <location filename="mainwindow.cpp" line="98"/>
@ -2975,33 +2975,33 @@ Are you really want to continue?</source>
<message> <message>
<location filename="mainwindow.cpp" line="1479"/> <location filename="mainwindow.cpp" line="1479"/>
<source>Rename File</source> <source>Rename File</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1487"/> <location filename="mainwindow.cpp" line="1487"/>
<location filename="mainwindow.cpp" line="1506"/> <location filename="mainwindow.cpp" line="1506"/>
<source>Add Folder</source> <source>Add Folder</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1503"/> <location filename="mainwindow.cpp" line="1503"/>
<source>New folder</source> <source>New folder</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1507"/> <location filename="mainwindow.cpp" line="1507"/>
<source>Folder name:</source> <source>Folder name:</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1521"/> <location filename="mainwindow.cpp" line="1521"/>
<source>Rename Folder</source> <source>Rename Folder</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1529"/> <location filename="mainwindow.cpp" line="1529"/>
<source>Remove Folder</source> <source>Remove Folder</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="1612"/> <location filename="mainwindow.cpp" line="1612"/>
@ -3647,24 +3647,24 @@ Are you really want to continue?</source>
<message> <message>
<location filename="project.cpp" line="1848"/> <location filename="project.cpp" line="1848"/>
<source>File exists</source> <source>File exists</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1849"/> <location filename="project.cpp" line="1849"/>
<source>File &apos;%1&apos; already exists. Delete it now?</source> <source>File &apos;%1&apos; already exists. Delete it now?</source>
<translation type="unfinished"></translation> <translation>&apos;%1&apos;</translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1867"/> <location filename="project.cpp" line="1867"/>
<location filename="project.cpp" line="1887"/> <location filename="project.cpp" line="1887"/>
<source>Remove failed</source> <source>Remove failed</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="project.cpp" line="1868"/> <location filename="project.cpp" line="1868"/>
<location filename="project.cpp" line="1888"/> <location filename="project.cpp" line="1888"/>
<source>Failed to remove file &apos;%1&apos;</source> <source>Failed to remove file &apos;%1&apos;</source>
<translation type="unfinished"></translation> <translation>&apos;%1&apos;</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -2003,7 +2003,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
} }
if (mProject) { if (mProject) {
mProject = nullptr; closeProject(false);
} }
delete mEditorList; delete mEditorList;
@ -2991,7 +2991,9 @@ void MainWindow::on_actionOpen_Containing_Folder_triggered()
if (editor) { if (editor) {
QFileInfo info(editor->filename()); QFileInfo info(editor->filename());
if (!info.path().isEmpty()) { if (!info.path().isEmpty()) {
QDesktopServices::openUrl(info.path()); QDesktopServices::openUrl(
QUrl("file:///"+
includeTrailingPathDelimiter(info.path()),QUrl::TolerantMode));
} }
} }
} }
@ -3293,7 +3295,8 @@ void MainWindow::on_actionProject_Open_Folder_In_Explorer_triggered()
{ {
if (!mProject) if (!mProject)
return; return;
QDesktopServices::openUrl(mProject->directory()); QDesktopServices::openUrl(
QUrl("file:///"+includeTrailingPathDelimiter(mProject->directory()),QUrl::TolerantMode));
} }

View File

@ -29,9 +29,10 @@ Project::Project(const QString &filename, const QString &name, QObject *parent)
&EditorList::getContentFromOpenedEditor,pMainWindow->editorList(), &EditorList::getContentFromOpenedEditor,pMainWindow->editorList(),
std::placeholders::_1, std::placeholders::_2)); std::placeholders::_1, std::placeholders::_2));
resetCppParser(mParser); resetCppParser(mParser);
if (name == DEV_INTERNAL_OPEN) if (name == DEV_INTERNAL_OPEN) {
open(); open();
else { mModified = false;
} else {
mName = name; mName = name;
SimpleIni ini; SimpleIni ini;
ini.SetValue("Project","filename", toByteArray(extractRelativePath(directory(),mFilename))); ini.SetValue("Project","filename", toByteArray(extractRelativePath(directory(),mFilename)));

View File

@ -20,6 +20,7 @@
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
{ {
mModified = false;
mPaintLock = 0; mPaintLock = 0;
mPainterLock = 0; mPainterLock = 0;
mPainting = false; mPainting = false;