Core: Use new MessageManager API

Bring messages pane to front when triggering an external tool or
command, write output silently and flash when tool finishes or fails.

Also bring pane to front if file renaming or removing fails (this should
happen only as a direct consequence of the user choosing this action).

Task-number: QTCREATORBUG-24430
Change-Id: Ib47431bd57a9c05bfdbfb03ad4c7cd38bdf3ddd1
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-12-01 13:02:12 +01:00
parent a0079b171f
commit 5738418d41
6 changed files with 59 additions and 41 deletions

View File

@@ -187,10 +187,9 @@ void FileUtils::removeFiles(const FilePaths &filePaths, bool deleteFromFS)
if (!file.exists()) // could have been deleted by vc
continue;
if (!file.remove()) {
MessageManager::write(QCoreApplication::translate(
"Core::Internal",
"Failed to remove file \"%1\")1.").
arg(fp.toUserOutput()), MessageManager::ModeSwitch);
MessageManager::writeDisrupting(
QCoreApplication::translate("Core::Internal", "Failed to remove file \"%1\")1.")
.arg(fp.toUserOutput()));
}
}
}
@@ -226,10 +225,10 @@ bool FileUtils::renameFile(const QString &orgFilePath, const QString &newFilePat
QFileInfo fi(orgFilePath);
bool headerUpdateSuccess = updateHeaderFileGuardAfterRename(newFilePath, fi.baseName());
if (!headerUpdateSuccess) {
Core::MessageManager::write(QCoreApplication::translate(
"Core::FileUtils",
Core::MessageManager::writeDisrupting(
QCoreApplication::translate("Core::FileUtils",
"Failed to rename the include guard in file \"%1\".")
.arg(newFilePath));
.arg(newFilePath));
}
}