- 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: Sort header completion infos by suffix-trimmed filename.
|
||||
- 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
|
||||
|
||||
|
|
|
@ -1923,6 +1923,27 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
|||
mCompilerManager->stopPausing();
|
||||
CompileTarget target =getCompileTarget();
|
||||
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()) {
|
||||
mProject->saveAll();
|
||||
}
|
||||
|
@ -1985,11 +2006,10 @@ bool MainWindow::compile(bool rebuild, CppCompileType compileType)
|
|||
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild,compileType);
|
||||
updateCompileActions();
|
||||
updateAppTitle();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::runExecutable(
|
||||
const QString &exeName,
|
||||
|
@ -5366,9 +5386,16 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
settings.setShrinkMessagesTabs(ui->tabMessages->isShrinked());
|
||||
settings.save();
|
||||
|
||||
if (pSettings->sync()!=QSettings::NoError) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Save Error"),
|
||||
tr("Save settings failed!"));
|
||||
}
|
||||
|
||||
//save current folder ( for files view )
|
||||
pSettings->environment().setDefaultOpenFolder(QDir::currentPath());
|
||||
pSettings->environment().save();
|
||||
|
||||
try {
|
||||
mBookmarkModel->saveBookmarks(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BOOKMARK_FILE);
|
||||
|
|
|
@ -228,7 +228,7 @@ void Project::open()
|
|||
// QMessageBox::Ok);
|
||||
// newUnit->setModified(true);
|
||||
// } else {
|
||||
newUnit->setFileMissing(!QFileInfo(newUnit->fileName()).exists());
|
||||
// newUnit->setFileMissing(!QFileInfo(newUnit->fileName()).exists());
|
||||
newUnit->setFolder(fromByteArray(ini.GetValue(groupName,"Folder","")));
|
||||
newUnit->setCompile(ini.GetBoolValue(groupName,"Compile", true));
|
||||
newUnit->setCompileCpp(
|
||||
|
@ -2347,7 +2347,7 @@ ProjectUnit::ProjectUnit(Project* parent)
|
|||
{
|
||||
mNode = nullptr;
|
||||
mParent = parent;
|
||||
mFileMissing = false;
|
||||
// mFileMissing = false;
|
||||
mPriority=0;
|
||||
mNew = true;
|
||||
mEncoding=ENCODING_PROJECT;
|
||||
|
@ -2490,15 +2490,15 @@ void ProjectUnit::setNode(const PProjectModelNode &newNode)
|
|||
mNode = newNode;
|
||||
}
|
||||
|
||||
bool ProjectUnit::FileMissing() const
|
||||
{
|
||||
return mFileMissing;
|
||||
}
|
||||
//bool ProjectUnit::FileMissing() const
|
||||
//{
|
||||
// return mFileMissing;
|
||||
//}
|
||||
|
||||
void ProjectUnit::setFileMissing(bool newDontSave)
|
||||
{
|
||||
mFileMissing = newDontSave;
|
||||
}
|
||||
//void ProjectUnit::setFileMissing(bool newDontSave)
|
||||
//{
|
||||
// mFileMissing = newDontSave;
|
||||
//}
|
||||
|
||||
ProjectModel::ProjectModel(Project *project, QObject *parent):
|
||||
QAbstractItemModel(parent),
|
||||
|
|
|
@ -99,8 +99,8 @@ public:
|
|||
PProjectModelNode &node();
|
||||
void setNode(const PProjectModelNode &newNode);
|
||||
|
||||
bool FileMissing() const;
|
||||
void setFileMissing(bool newDontSave);
|
||||
// bool FileMissing() const;
|
||||
// void setFileMissing(bool newDontSave);
|
||||
|
||||
void setNew(bool newNew);
|
||||
|
||||
|
@ -121,7 +121,7 @@ private:
|
|||
QByteArray mEncoding;
|
||||
QByteArray mRealEncoding;
|
||||
PProjectModelNode mNode;
|
||||
bool mFileMissing;
|
||||
// bool mFileMissing;
|
||||
};
|
||||
|
||||
using PProjectUnit = std::shared_ptr<ProjectUnit>;
|
||||
|
|
|
@ -56,7 +56,7 @@ Settings::Settings(const QString &filename):
|
|||
|
||||
Settings::~Settings()
|
||||
{
|
||||
mEditor.save();
|
||||
//mEditor.save();
|
||||
}
|
||||
|
||||
void Settings::beginGroup(const QString &group)
|
||||
|
@ -116,6 +116,12 @@ void Settings::load()
|
|||
mLanguages.load();
|
||||
}
|
||||
|
||||
QSettings::Status Settings::sync()
|
||||
{
|
||||
mSettings.sync();
|
||||
return mSettings.status();
|
||||
}
|
||||
|
||||
Settings::Dirs &Settings::dirs()
|
||||
{
|
||||
return mDirs;
|
||||
|
|
|
@ -1538,6 +1538,7 @@ public:
|
|||
QVariant value(const QString& group, const QString &key, const QVariant& defaultValue);
|
||||
QVariant value(const QString &key, const QVariant& defaultValue);
|
||||
void load();
|
||||
QSettings::Status sync();
|
||||
|
||||
Dirs& dirs();
|
||||
Editor& editor();
|
||||
|
|
|
@ -5127,6 +5127,18 @@
|
|||
<source>New Text File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>MemoryModel</name>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4880,6 +4880,18 @@
|
|||
<source>New Text File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</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>
|
||||
<name>MemoryModel</name>
|
||||
|
|
Loading…
Reference in New Issue