- enhancement: Warn user and stop compile if project has missing files.
- enhancement: Warn user when exit and save settings failed.
This commit is contained in:
parent
0b0e941155
commit
aaac2bfcf7
2
NEWS.md
2
NEWS.md
|
@ -5,6 +5,8 @@ Red Panda C++ Version 2.18
|
||||||
- enhancement: Slightly speed up code parsing.
|
- enhancement: Slightly speed up code parsing.
|
||||||
- enhancement: Sort header completion infos by suffix-trimmed filename.
|
- enhancement: Sort header completion infos by suffix-trimmed filename.
|
||||||
- fix: Code completion info for stl::map/std::unordered_map is not correct.
|
- fix: Code completion info for stl::map/std::unordered_map is not correct.
|
||||||
|
- enhancement: Warn user and stop compile if project has missing files.
|
||||||
|
- enhancement: Warn user when exit and save settings failed.
|
||||||
|
|
||||||
Red Panda C++ Version 2.17
|
Red Panda C++ Version 2.17
|
||||||
|
|
||||||
|
|
|
@ -1923,6 +1923,27 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
||||||
mCompilerManager->stopPausing();
|
mCompilerManager->stopPausing();
|
||||||
CompileTarget target =getCompileTarget();
|
CompileTarget target =getCompileTarget();
|
||||||
if (target == CompileTarget::Project && compileType == CppCompileType::Normal) {
|
if (target == CompileTarget::Project && compileType == CppCompileType::Normal) {
|
||||||
|
QStringList missedUnits;
|
||||||
|
foreach(const PProjectUnit &unit, mProject->unitList()) {
|
||||||
|
if (!fileExists(unit->fileName())) {
|
||||||
|
missedUnits.append(
|
||||||
|
extractRelativePath(
|
||||||
|
mProject->directory(),
|
||||||
|
unit->fileName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!missedUnits.empty()) {
|
||||||
|
ui->actionProject->setChecked(true);
|
||||||
|
showHideInfosTab(ui->tabProject,true);
|
||||||
|
ui->tabExplorer->setCurrentWidget(ui->tabProject);
|
||||||
|
QString s=missedUnits.join("<br/>");
|
||||||
|
QMessageBox::critical(this,
|
||||||
|
tr("Missing Project Files"),
|
||||||
|
tr("The following files is missing, can't build the project:")
|
||||||
|
+"<br/><br/>"
|
||||||
|
+s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (mProject->modified()) {
|
if (mProject->modified()) {
|
||||||
mProject->saveAll();
|
mProject->saveAll();
|
||||||
}
|
}
|
||||||
|
@ -1985,11 +2006,10 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
||||||
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild,compileType);
|
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild,compileType);
|
||||||
updateCompileActions();
|
updateCompileActions();
|
||||||
updateAppTitle();
|
updateAppTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::runExecutable(
|
void MainWindow::runExecutable(
|
||||||
const QString &exeName,
|
const QString &exeName,
|
||||||
|
@ -5366,9 +5386,16 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
settings.setShrinkMessagesTabs(ui->tabMessages->isShrinked());
|
settings.setShrinkMessagesTabs(ui->tabMessages->isShrinked());
|
||||||
settings.save();
|
settings.save();
|
||||||
|
|
||||||
|
if (pSettings->sync()!=QSettings::NoError) {
|
||||||
|
QMessageBox::warning(nullptr,
|
||||||
|
tr("Save Error"),
|
||||||
|
tr("Save settings failed!"));
|
||||||
|
}
|
||||||
|
|
||||||
//save current folder ( for files view )
|
//save current folder ( for files view )
|
||||||
pSettings->environment().setDefaultOpenFolder(QDir::currentPath());
|
pSettings->environment().setDefaultOpenFolder(QDir::currentPath());
|
||||||
pSettings->environment().save();
|
pSettings->environment().save();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mBookmarkModel->saveBookmarks(includeTrailingPathDelimiter(pSettings->dirs().config())
|
mBookmarkModel->saveBookmarks(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||||
+DEV_BOOKMARK_FILE);
|
+DEV_BOOKMARK_FILE);
|
||||||
|
|
|
@ -228,7 +228,7 @@ void Project::open()
|
||||||
// QMessageBox::Ok);
|
// QMessageBox::Ok);
|
||||||
// newUnit->setModified(true);
|
// newUnit->setModified(true);
|
||||||
// } else {
|
// } else {
|
||||||
newUnit->setFileMissing(!QFileInfo(newUnit->fileName()).exists());
|
// newUnit->setFileMissing(!QFileInfo(newUnit->fileName()).exists());
|
||||||
newUnit->setFolder(fromByteArray(ini.GetValue(groupName,"Folder","")));
|
newUnit->setFolder(fromByteArray(ini.GetValue(groupName,"Folder","")));
|
||||||
newUnit->setCompile(ini.GetBoolValue(groupName,"Compile", true));
|
newUnit->setCompile(ini.GetBoolValue(groupName,"Compile", true));
|
||||||
newUnit->setCompileCpp(
|
newUnit->setCompileCpp(
|
||||||
|
@ -2347,7 +2347,7 @@ ProjectUnit::ProjectUnit(Project* parent)
|
||||||
{
|
{
|
||||||
mNode = nullptr;
|
mNode = nullptr;
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
mFileMissing = false;
|
// mFileMissing = false;
|
||||||
mPriority=0;
|
mPriority=0;
|
||||||
mNew = true;
|
mNew = true;
|
||||||
mEncoding=ENCODING_PROJECT;
|
mEncoding=ENCODING_PROJECT;
|
||||||
|
@ -2490,15 +2490,15 @@ void ProjectUnit::setNode(const PProjectModelNode &newNode)
|
||||||
mNode = newNode;
|
mNode = newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectUnit::FileMissing() const
|
//bool ProjectUnit::FileMissing() const
|
||||||
{
|
//{
|
||||||
return mFileMissing;
|
// return mFileMissing;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void ProjectUnit::setFileMissing(bool newDontSave)
|
//void ProjectUnit::setFileMissing(bool newDontSave)
|
||||||
{
|
//{
|
||||||
mFileMissing = newDontSave;
|
// mFileMissing = newDontSave;
|
||||||
}
|
//}
|
||||||
|
|
||||||
ProjectModel::ProjectModel(Project *project, QObject *parent):
|
ProjectModel::ProjectModel(Project *project, QObject *parent):
|
||||||
QAbstractItemModel(parent),
|
QAbstractItemModel(parent),
|
||||||
|
|
|
@ -99,8 +99,8 @@ public:
|
||||||
PProjectModelNode &node();
|
PProjectModelNode &node();
|
||||||
void setNode(const PProjectModelNode &newNode);
|
void setNode(const PProjectModelNode &newNode);
|
||||||
|
|
||||||
bool FileMissing() const;
|
// bool FileMissing() const;
|
||||||
void setFileMissing(bool newDontSave);
|
// void setFileMissing(bool newDontSave);
|
||||||
|
|
||||||
void setNew(bool newNew);
|
void setNew(bool newNew);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ private:
|
||||||
QByteArray mEncoding;
|
QByteArray mEncoding;
|
||||||
QByteArray mRealEncoding;
|
QByteArray mRealEncoding;
|
||||||
PProjectModelNode mNode;
|
PProjectModelNode mNode;
|
||||||
bool mFileMissing;
|
// bool mFileMissing;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PProjectUnit = std::shared_ptr<ProjectUnit>;
|
using PProjectUnit = std::shared_ptr<ProjectUnit>;
|
||||||
|
|
|
@ -56,7 +56,7 @@ Settings::Settings(const QString &filename):
|
||||||
|
|
||||||
Settings::~Settings()
|
Settings::~Settings()
|
||||||
{
|
{
|
||||||
mEditor.save();
|
//mEditor.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::beginGroup(const QString &group)
|
void Settings::beginGroup(const QString &group)
|
||||||
|
@ -116,6 +116,12 @@ void Settings::load()
|
||||||
mLanguages.load();
|
mLanguages.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSettings::Status Settings::sync()
|
||||||
|
{
|
||||||
|
mSettings.sync();
|
||||||
|
return mSettings.status();
|
||||||
|
}
|
||||||
|
|
||||||
Settings::Dirs &Settings::dirs()
|
Settings::Dirs &Settings::dirs()
|
||||||
{
|
{
|
||||||
return mDirs;
|
return mDirs;
|
||||||
|
|
|
@ -1538,6 +1538,7 @@ public:
|
||||||
QVariant value(const QString& group, const QString &key, const QVariant& defaultValue);
|
QVariant value(const QString& group, const QString &key, const QVariant& defaultValue);
|
||||||
QVariant value(const QString &key, const QVariant& defaultValue);
|
QVariant value(const QString &key, const QVariant& defaultValue);
|
||||||
void load();
|
void load();
|
||||||
|
QSettings::Status sync();
|
||||||
|
|
||||||
Dirs& dirs();
|
Dirs& dirs();
|
||||||
Editor& editor();
|
Editor& editor();
|
||||||
|
|
|
@ -5127,6 +5127,18 @@
|
||||||
<source>New Text File</source>
|
<source>New Text File</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Missing Project Files</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The following files is missing, can't build the project:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Save settings failed!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MemoryModel</name>
|
<name>MemoryModel</name>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4880,6 +4880,18 @@
|
||||||
<source>New Text File</source>
|
<source>New Text File</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Missing Project Files</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The following files is missing, can't build the project:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Save settings failed!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MemoryModel</name>
|
<name>MemoryModel</name>
|
||||||
|
|
Loading…
Reference in New Issue