Use dialogParent() instead of mainWindow()

There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-06-02 09:10:40 +02:00
parent 26d46fc19d
commit 5b364de168
82 changed files with 239 additions and 211 deletions
+1 -1
View File
@@ -290,7 +290,7 @@ void AndroidBuildApkStep::setupOutputFormatter(OutputFormatter *formatter)
void AndroidBuildApkStep::showInGraphicalShell()
{
Core::FileUtils::showInGraphicalShell(Core::ICore::mainWindow(), m_packagePath);
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), m_packagePath);
}
ProjectExplorer::BuildStepConfigWidget *AndroidBuildApkStep::createConfigWidget()
@@ -1114,7 +1114,7 @@ AndroidDeviceInfo AndroidConfigurations::showDeviceDialog(Project *project,
if (!serialNumber.isEmpty())
break;
}
AndroidDeviceDialog dialog(apiLevel, abis, serialNumber, Core::ICore::mainWindow());
AndroidDeviceDialog dialog(apiLevel, abis, serialNumber, Core::ICore::dialogParent());
AndroidDeviceInfo info = dialog.device();
if (dialog.saveDeviceSelection() && info.isValid()) {
const QString serialNumber = info.type == AndroidDeviceInfo::Hardware ?
@@ -152,7 +152,7 @@ void DebugServerProviderManager::saveProviders()
}
}
data.insert(countKeyC, count);
m_writer->save(data, Core::ICore::mainWindow());
m_writer->save(data, Core::ICore::dialogParent());
}
QList<IDebugServerProvider *> DebugServerProviderManager::providers()
+4 -4
View File
@@ -261,7 +261,7 @@ public:
if (errorString)
*errorString = msg;
else
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), msg);
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), msg);
return OpenResult::CannotHandle;
}
if (size / 16 >= qint64(1) << 31) {
@@ -270,7 +270,7 @@ public:
if (errorString)
*errorString = msg;
else
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), msg);
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), msg);
return OpenResult::CannotHandle;
}
if (offset >= size)
@@ -284,7 +284,7 @@ public:
if (errorString)
*errorString = errStr;
else
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errStr);
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errStr);
return OpenResult::ReadError;
}
@@ -304,7 +304,7 @@ public:
data += QByteArray(blockSize - dataSize, 0);
m_widget->addData(address, data);
} else {
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
QMessageBox::critical(ICore::dialogParent(), tr("File Error"),
tr("Cannot open %1: %2").arg(
fn.toUserOutput(), file.errorString()));
}
+1 -1
View File
@@ -291,7 +291,7 @@ QdbLinuxDeviceFactory::QdbLinuxDeviceFactory()
IDevice::Ptr QdbLinuxDeviceFactory::create() const
{
QdbDeviceWizard wizard(Core::ICore::mainWindow());
QdbDeviceWizard wizard(Core::ICore::dialogParent());
if (wizard.exec() != QDialog::Accepted)
return IDevice::Ptr();
+2 -2
View File
@@ -639,7 +639,7 @@ static bool continueDespiteReleaseBuild(const QString &toolName)
"<p>%2</p>"
"</body></html>")
.arg(problem, question);
return CheckableMessageBox::doNotAskAgainQuestion(ICore::mainWindow(),
return CheckableMessageBox::doNotAskAgainQuestion(ICore::dialogParent(),
title,
message,
ICore::settings(),
@@ -791,7 +791,7 @@ void ClangTool::loadDiagnosticsFromFiles()
{
// Ask user for files
const QStringList filePaths
= QFileDialog::getOpenFileNames(Core::ICore::mainWindow(),
= QFileDialog::getOpenFileNames(Core::ICore::dialogParent(),
tr("Select YAML Files with Diagnostics"),
QDir::homePath(),
tr("YAML Files (*.yml *.yaml);;All Files (*)"));
@@ -949,7 +949,7 @@ bool CMakeBuildSystem::checkConfiguration()
}
table += QLatin1String("\n</table>");
QPointer<QMessageBox> box = new QMessageBox(Core::ICore::mainWindow());
QPointer<QMessageBox> box = new QMessageBox(Core::ICore::dialogParent());
box->setText(tr("The project has been changed outside of %1.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
box->setInformativeText(table);
@@ -609,7 +609,7 @@ bool EditorManagerPrivate::skipOpeningBigTextFile(const QString &filePath)
.arg(fileInfo.fileName())
.arg(fileSizeInMB, 0, 'f', 2);
CheckableMessageBox messageBox(ICore::mainWindow());
CheckableMessageBox messageBox(ICore::dialogParent());
messageBox.setWindowTitle(title);
messageBox.setText(text);
messageBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::No);
@@ -738,7 +738,11 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN
.arg(FilePath::fromString(realFn).toUserOutput());
}
QMessageBox msgbox(QMessageBox::Critical, EditorManager::tr("File Error"), errorString, QMessageBox::Open | QMessageBox::Cancel, ICore::mainWindow());
QMessageBox msgbox(QMessageBox::Critical,
EditorManager::tr("File Error"),
errorString,
QMessageBox::Open | QMessageBox::Cancel,
ICore::dialogParent());
IEditorFactory *selectedFactory = nullptr;
if (!factories.isEmpty()) {
@@ -872,8 +876,7 @@ MakeWritableResult EditorManagerPrivate::makeFileWritable(IDocument *document)
{
if (!document)
return Failed;
// TODO: dialog parent is wrong
ReadOnlyFilesDialog roDialog(document, ICore::mainWindow(), document->isSaveAsAllowed());
ReadOnlyFilesDialog roDialog(document, ICore::dialogParent(), document->isSaveAsAllowed());
switch (roDialog.exec()) {
case ReadOnlyFilesDialog::RO_MakeWritable:
case ReadOnlyFilesDialog::RO_OpenVCS:
@@ -1039,7 +1042,7 @@ Id EditorManagerPrivate::getOpenWithEditorId(const QString &fileName, bool *isEx
return Id();
QTC_ASSERT(allEditorIds.size() == allEditorDisplayNames.size(), return Id());
// Run dialog.
OpenWithDialog dialog(fileName, ICore::mainWindow());
OpenWithDialog dialog(fileName, ICore::dialogParent());
dialog.setEditors(allEditorDisplayNames);
dialog.setCurrentEditor(0);
if (dialog.exec() != QDialog::Accepted)
@@ -2082,7 +2085,7 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
if (!versionControl->vcsOpen(document->filePath().toString())) {
// TODO: wrong dialog parent
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"),
QMessageBox::warning(ICore::dialogParent(), tr("Cannot Open File"),
tr("Cannot open the file for editing with VCS."));
}
}
@@ -2156,7 +2159,8 @@ void EditorManagerPrivate::autoSave()
errors << errorString;
}
if (!errors.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
QMessageBox::critical(ICore::dialogParent(),
tr("File Error"),
errors.join(QLatin1Char('\n')));
emit m_instance->autoSaved();
}
@@ -2343,10 +2347,12 @@ void EditorManagerPrivate::revertToSaved(IDocument *document)
if (fileName.isEmpty())
return;
if (document->isModified()) {
// TODO: wrong dialog parent
QMessageBox msgBox(QMessageBox::Question, tr("Revert to Saved"),
tr("You will lose your current changes if you proceed reverting %1.").arg(QDir::toNativeSeparators(fileName)),
QMessageBox::Yes|QMessageBox::No, ICore::mainWindow());
QMessageBox msgBox(QMessageBox::Question,
tr("Revert to Saved"),
tr("You will lose your current changes if you proceed reverting %1.")
.arg(QDir::toNativeSeparators(fileName)),
QMessageBox::Yes | QMessageBox::No,
ICore::dialogParent());
msgBox.button(QMessageBox::Yes)->setText(tr("Proceed"));
msgBox.button(QMessageBox::No)->setText(tr("Cancel"));
@@ -2367,7 +2373,7 @@ void EditorManagerPrivate::revertToSaved(IDocument *document)
}
QString errorString;
if (!document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents))
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errorString);
}
void EditorManagerPrivate::autoSuspendDocuments()
@@ -2397,7 +2403,8 @@ void EditorManagerPrivate::showInGraphicalShell()
{
if (!d->m_contextMenuEntry || d->m_contextMenuEntry->fileName().isEmpty())
return;
FileUtils::showInGraphicalShell(ICore::mainWindow(), d->m_contextMenuEntry->fileName().toString());
FileUtils::showInGraphicalShell(ICore::dialogParent(),
d->m_contextMenuEntry->fileName().toString());
}
void EditorManagerPrivate::openTerminal()
@@ -2983,7 +2990,7 @@ bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
const bool ok = ee->startEditor(fileName, &errorMessage);
QApplication::restoreOverrideCursor();
if (!ok)
QMessageBox::critical(ICore::mainWindow(), tr("Opening File"), errorMessage);
QMessageBox::critical(ICore::dialogParent(), tr("Opening File"), errorMessage);
return ok;
}
+1 -1
View File
@@ -163,7 +163,7 @@ void FileUtils::removeFile(const QString &filePath, bool deleteFromFS)
if (file.exists()) {
// could have been deleted by vc
if (!file.remove())
QMessageBox::warning(ICore::mainWindow(),
QMessageBox::warning(ICore::dialogParent(),
QApplication::translate("Core::Internal", "Deleting File Failed"),
QApplication::translate("Core::Internal", "Could not delete file %1.").arg(filePath));
}
+2 -1
View File
@@ -98,7 +98,8 @@ GeneralSettingsWidget::GeneralSettingsWidget(GeneralSettings *q)
m_ui.dpiCheckbox->setChecked(ICore::settings()->value(settingsKeyDPI, defaultValue).toBool());
connect(m_ui.dpiCheckbox, &QCheckBox::toggled, this, [](bool checked) {
ICore::settings()->setValue(settingsKeyDPI, checked);
QMessageBox::information(ICore::mainWindow(), tr("Restart Required"),
QMessageBox::information(ICore::dialogParent(),
tr("Restart Required"),
tr("The high DPI settings will take effect after restart."));
});
}
+3 -2
View File
@@ -404,7 +404,7 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
if (unmanagedFiles.isEmpty())
return;
Internal::AddToVcsDialog dlg(ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
Internal::AddToVcsDialog dlg(ICore::dialogParent(), VcsManager::msgAddToVcsTitle(),
unmanagedFiles, vc->displayName());
if (dlg.exec() == QDialog::Accepted) {
QStringList notAddedToVc;
@@ -414,7 +414,8 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
}
if (!notAddedToVc.isEmpty()) {
QMessageBox::warning(ICore::mainWindow(), VcsManager::msgAddToVcsFailedTitle(),
QMessageBox::warning(ICore::dialogParent(),
VcsManager::msgAddToVcsFailedTitle(),
VcsManager::msgToAddToVcsFailed(notAddedToVc, vc));
}
}
+2 -2
View File
@@ -159,7 +159,7 @@ bool Protocol::showConfigurationError(const Protocol *p,
showConfig = false;
if (!parent)
parent = Core::ICore::mainWindow();
parent = Core::ICore::dialogParent();
const QString title = tr("%1 - Configuration Error").arg(p->name());
QMessageBox mb(QMessageBox::Warning, title, message, QMessageBox::Cancel, parent);
QPushButton *settingsButton = nullptr;
@@ -220,7 +220,7 @@ bool NetworkProtocol::httpStatus(QString url, QString *errorMessage, bool useHtt
tr("Checking connection"),
tr("Connecting to %1...").arg(url),
QMessageBox::Cancel,
Core::ICore::mainWindow());
Core::ICore::dialogParent());
connect(reply.data(), &QNetworkReply::finished, &box, &QWidget::close);
QApplication::setOverrideCursor(Qt::WaitCursor);
box.exec();
+1 -1
View File
@@ -357,7 +357,7 @@ void CppEditorPluginPrivate::inspectCppCodeModel()
if (m_cppCodeModelInspectorDialog) {
ICore::raiseWindow(m_cppCodeModelInspectorDialog);
} else {
m_cppCodeModelInspectorDialog = new CppCodeModelInspectorDialog(ICore::mainWindow());
m_cppCodeModelInspectorDialog = new CppCodeModelInspectorDialog(ICore::dialogParent());
m_cppCodeModelInspectorDialog->show();
}
}
@@ -159,7 +159,7 @@ void CtfTraceManager::load(const QString &filename)
std::ifstream file(filename.toStdString());
if (!file.is_open()) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("CTF Visualizer"),
tr("Cannot read the CTF file."));
return;
@@ -179,10 +179,13 @@ void CtfTraceManager::finalize()
for (qint64 tid: m_threadModels.keys()) {
if (m_threadModels[tid]->m_maxStackSize > 512) {
if (!userConsentToIgnoreDeepTraces) {
QMessageBox::StandardButton answer = QMessageBox::question(Core::ICore::mainWindow(),
QMessageBox::StandardButton answer
= QMessageBox::question(Core::ICore::dialogParent(),
tr("CTF Visualizer"),
tr("The trace contains threads with stack depth > 512.\nDo you want to display them anyway?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
tr("The trace contains threads with stack depth > "
"512.\nDo you want to display them anyway?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (answer == QMessageBox::No) {
userConsentToIgnoreDeepTraces = true;
} else {
@@ -171,7 +171,7 @@ void CtfVisualizerTool::loadJson()
m_isLoading = true;
QString filename = QFileDialog::getOpenFileName(
ICore::mainWindow(), tr("Load Chrome Trace Format File"),
ICore::dialogParent(), tr("Load Chrome Trace Format File"),
"", tr("JSON File (*.json)"));
if (filename.isEmpty()) {
m_isLoading = false;
@@ -192,7 +192,7 @@ void CtfVisualizerTool::loadJson()
connect(thread, &QThread::finished, this, [this, thread, task, futureInterface]() {
// in main thread:
if (m_traceManager->isEmpty()) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("CTF Visualizer"),
tr("The file does not contain any trace data."));
} else {
+1 -1
View File
@@ -1513,7 +1513,7 @@ void DebuggerEnginePrivate::updateState()
m_detachAction.setEnabled(detachable);
if (stopped)
QApplication::alert(ICore::mainWindow(), 3000);
QApplication::alert(ICore::dialogParent(), 3000);
updateReverseActions();
+1 -1
View File
@@ -955,7 +955,7 @@ void DebuggerItemManagerPrivate::saveDebuggers()
}
});
data.insert(DEBUGGER_COUNT_KEY, count);
m_writer.save(data, ICore::mainWindow());
m_writer.save(data, ICore::dialogParent());
// Do not save default debuggers as they are set by the SDK.
}
+5 -5
View File
@@ -1749,7 +1749,7 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const
void DebuggerPluginPrivate::attachToQmlPort()
{
AttachToQmlPortDialog dlg(ICore::mainWindow());
AttachToQmlPortDialog dlg(ICore::dialogParent());
const QVariant qmlServerPort = configValue("LastQmlServerPort");
if (qmlServerPort.isValid())
@@ -1954,7 +1954,7 @@ void DebuggerPluginPrivate::dumpLog()
LogWindow *logWindow = engine->logWindow();
QTC_ASSERT(logWindow, return);
QString fileName = QFileDialog::getSaveFileName(ICore::mainWindow(),
QString fileName = QFileDialog::getSaveFileName(ICore::dialogParent(),
tr("Save Debugger Log"), Utils::TemporaryDirectory::masterDirectoryPath());
if (fileName.isEmpty())
return;
@@ -1966,7 +1966,7 @@ void DebuggerPluginPrivate::dumpLog()
ts << logWindow->combinedContents();
saver.setResult(&ts);
}
saver.finalize(ICore::mainWindow());
saver.finalize(ICore::dialogParent());
}
void DebuggerPluginPrivate::aboutToShutdown()
@@ -2186,7 +2186,7 @@ static BuildConfiguration::BuildType startupBuildType()
void showCannotStartDialog(const QString &text)
{
auto errorDialog = new QMessageBox(ICore::mainWindow());
auto errorDialog = new QMessageBox(ICore::dialogParent());
errorDialog->setAttribute(Qt::WA_DeleteOnClose);
errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(text);
@@ -2251,7 +2251,7 @@ bool wantRunTool(ToolMode toolMode, const QString &toolName)
"or otherwise insufficient output.</p><p>"
"Do you want to continue and run the tool in %2 mode?</p></body></html>")
.arg(toolName).arg(currentMode).arg(toolModeString);
if (Utils::CheckableMessageBox::doNotAskAgainQuestion(ICore::mainWindow(),
if (Utils::CheckableMessageBox::doNotAskAgainQuestion(ICore::dialogParent(),
title, message, ICore::settings(), "AnalyzerCorrectModeWarning")
!= QDialogButtonBox::Yes)
return false;
+1 -1
View File
@@ -709,7 +709,7 @@ void DebuggerRunTool::start()
static bool checked = true;
if (checked)
CheckableMessageBox::information(Core::ICore::mainWindow(),
CheckableMessageBox::information(Core::ICore::dialogParent(),
tr("Debugger"),
warningMessage,
tr("&Show this message again."),
@@ -483,7 +483,11 @@ public:
if (parentWidget()) {
// We are currently within a text editor tooltip:
// Rip out of parent widget and re-show as a tooltip
ToolTip::pinToolTip(this, ICore::mainWindow());
// Find parent with different window than the tooltip itself:
QWidget *top = parentWidget();
while (top->window() == window() && top->parentWidget())
top = top->parentWidget();
ToolTip::pinToolTip(this, top->window());
} else {
// We have just be restored from session data.
setWindowFlags(Qt::ToolTip);
+1 -1
View File
@@ -107,7 +107,7 @@ static QMessageBox *showMessageBox(QMessageBox::Icon icon,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons)
{
auto mb = new QMessageBox(icon, title, text, buttons, ICore::mainWindow());
auto mb = new QMessageBox(icon, title, text, buttons, ICore::dialogParent());
mb->setAttribute(Qt::WA_DeleteOnClose);
mb->setTextInteractionFlags(Qt::TextSelectableByMouse);
mb->show();
+2 -2
View File
@@ -404,7 +404,7 @@ void QmlEngine::connectionStartupFailed()
return;
}
auto infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::dialogParent());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(tr("Could not connect to the in-process QML debugger."
@@ -425,7 +425,7 @@ void QmlEngine::appStartupFailed(const QString &errorMessage)
QString error = tr("Could not connect to the in-process QML debugger. %1").arg(errorMessage);
if (companionEngine()) {
auto infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::dialogParent());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
infoBox->setText(error);
+1 -1
View File
@@ -706,7 +706,7 @@ void FormEditorData::saveSettings(QSettings *s)
void FormEditorData::critical(const QString &errorMessage)
{
QMessageBox::critical(ICore::mainWindow(), tr("Designer"), errorMessage);
QMessageBox::critical(ICore::dialogParent(), tr("Designer"), errorMessage);
}
// Apply the command shortcut to the action and connects to the command's keySequenceChanged signal
@@ -302,7 +302,7 @@ bool GenericBuildSystem::saveRawList(const QStringList &rawList, const QString &
stream << filePath << '\n';
saver.setResult(&stream);
}
bool result = saver.finalize(ICore::mainWindow());
bool result = saver.finalize(ICore::dialogParent());
return result;
}
@@ -655,7 +655,7 @@ void GenericProject::editFilesTriggered()
{
SelectableFilesDialogEditFiles sfd(projectDirectory(),
files(Project::AllFiles),
ICore::mainWindow());
ICore::dialogParent());
if (sfd.exec() == QDialog::Accepted) {
if (Target *t = activeTarget()) {
auto bs = static_cast<GenericBuildSystem *>(t->buildSystem());
+1 -1
View File
@@ -157,7 +157,7 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url)
saver.setAutoRemove(false);
if (!saver.hasError())
saver.write(helpEngine.fileData(resolvedUrl));
if (saver.finalize(Core::ICore::mainWindow()))
if (saver.finalize(Core::ICore::dialogParent()))
QDesktopServices::openUrl(QUrl(saver.fileName()));
return true;
}
+5 -5
View File
@@ -187,7 +187,7 @@ void MacroManagerPrivate::changeMacroDescription(Macro *macro, const QString &de
if (!macro->load())
return;
macro->setDescription(description);
macro->save(macro->fileName(), Core::ICore::mainWindow());
macro->save(macro->fileName(), Core::ICore::dialogParent());
QAction *action = actions[macro->displayName()];
QTC_ASSERT(action, return);
@@ -210,7 +210,8 @@ bool MacroManagerPrivate::executeMacro(Macro *macro)
}
if (error) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(
Core::ICore::dialogParent(),
MacroManager::tr("Playing Macro"),
MacroManager::tr("An error occurred while replaying the macro, execution stopped."));
}
@@ -225,8 +226,7 @@ bool MacroManagerPrivate::executeMacro(Macro *macro)
void MacroManagerPrivate::showSaveDialog()
{
QWidget *mainWindow = Core::ICore::mainWindow();
SaveDialog dialog(mainWindow);
SaveDialog dialog(Core::ICore::dialogParent());
if (dialog.exec()) {
if (dialog.name().isEmpty())
return;
@@ -235,7 +235,7 @@ void MacroManagerPrivate::showSaveDialog()
QString fileName = q->macrosDirectory() + QLatin1Char('/') + dialog.name()
+ QLatin1Char('.') + QLatin1String(Constants::M_EXTENSION);
currentMacro->setDescription(dialog.description());
currentMacro->save(fileName, mainWindow);
currentMacro->save(fileName, Core::ICore::dialogParent());
addMacro(currentMacro);
}
}
@@ -92,9 +92,7 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
m_statusInfoLabel->setOpenExternalLinks(false);
mainLayout->addWidget(m_statusInfoLabel);
connect(m_statusInfoLabel, &QLabel::linkActivated, this, [] {
Core::ICore::showOptionsDialog(
CMakeProjectManager::Constants::CMAKE_SETTINGS_PAGE_ID,
Core::ICore::mainWindow());
Core::ICore::showOptionsDialog(CMakeProjectManager::Constants::CMAKE_SETTINGS_PAGE_ID);
});
}
+3 -2
View File
@@ -189,13 +189,14 @@ void ActionHandler::createActions()
Utils::Icons::LINK_TOOLBAR.icon())->action();
d->synchronizeBrowserAction->setCheckable(true);
auto editPropertiesAction = new QAction(tr("Edit Element Properties"), Core::ICore::mainWindow());
auto editPropertiesAction = new QAction(tr("Edit Element Properties"),
Core::ICore::dialogParent());
Core::Command *editPropertiesCommand = Core::ActionManager::registerAction(
editPropertiesAction, Constants::SHORTCUT_MODEL_EDITOR_EDIT_PROPERTIES, d->context);
editPropertiesCommand->setDefaultKeySequence(QKeySequence(tr("Shift+Return")));
connect(editPropertiesAction, &QAction::triggered, this, &ActionHandler::onEditProperties);
auto editItemAction = new QAction(tr("Edit Item on Diagram"), Core::ICore::mainWindow());
auto editItemAction = new QAction(tr("Edit Item on Diagram"), Core::ICore::dialogParent());
Core::Command *editItemCommand = Core::ActionManager::registerAction(
editItemAction, Constants::SHORTCUT_MODEL_EDITOR_EDIT_ITEM, d->context);
editItemCommand->setDefaultKeySequence(QKeySequence(tr("Return")));
+1 -1
View File
@@ -812,7 +812,7 @@ IEditor *PerforcePluginPrivate::openPerforceSubmitEditor(const QString &fileName
void PerforcePluginPrivate::printPendingChanges()
{
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
PendingChangesDialog dia(pendingChangesData(), ICore::mainWindow());
PendingChangesDialog dia(pendingChangesData(), ICore::dialogParent());
QGuiApplication::restoreOverrideCursor();
if (dia.exec() == QDialog::Accepted) {
const int i = dia.changeNumber();
+4 -4
View File
@@ -79,7 +79,7 @@ PerfDataReader::PerfDataReader(QObject *parent) :
emit finished();
}
if (exitCode != 0) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Perf Data Parser Failed"),
tr("The Perf data parser failed to process all the samples. "
"Your trace is incomplete. The exit code was %1.")
@@ -107,7 +107,7 @@ PerfDataReader::PerfDataReader(QObject *parent) :
switch (e) {
case QProcess::FailedToStart:
emit processFailed(tr("perfparser failed to start."));
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Perf Data Parser Failed"),
tr("Could not start the perfparser utility program. "
"Make sure a working Perf parser is available at the location "
@@ -115,7 +115,7 @@ PerfDataReader::PerfDataReader(QObject *parent) :
"variable."));
break;
case QProcess::Crashed:
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Perf Data Parser Crashed"),
tr("This is a bug. Please report it."));
break;
@@ -347,7 +347,7 @@ void PerfDataReader::writeChunk()
m_input.disconnect();
m_input.kill();
emit finished();
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Cannot Send Data to Perf Data Parser"),
tr("The Perf data parser does not accept further input. "
"Your trace is incomplete."));
@@ -138,7 +138,7 @@ public:
// in that. FailedToStart is the only actual failure.
if (e == QProcess::FailedToStart) {
QString msg = tr("Perf Process Failed to Start");
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
msg, tr("Make sure that you are running a recent Linux kernel and "
"that the \"perf\" utility is available."));
reportFailure(msg);
@@ -281,7 +281,7 @@ void PerfProfilerTool::createViews()
m_delayLabel->setIndent(10);
connect(m_traceManager, &PerfProfilerTraceManager::error, this, [](const QString &message) {
QMessageBox *errorDialog = new QMessageBox(ICore::mainWindow());
QMessageBox *errorDialog = new QMessageBox(ICore::dialogParent());
errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(tr("Performance Analyzer"));
errorDialog->setText(message);
@@ -416,7 +416,7 @@ void PerfProfilerTool::onReaderFinished()
{
m_readerRunning = false;
if (m_traceManager->traceDuration() <= 0) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("No Data Loaded"),
tr("The profiler did not produce any samples. "
"Make sure that you are running a recent Linux kernel and that "
@@ -602,7 +602,7 @@ void PerfProfilerTool::showLoadPerfDialog()
{
m_perspective.select();
PerfLoadDialog dlg(Core::ICore::mainWindow());
PerfLoadDialog dlg(Core::ICore::dialogParent());
if (dlg.exec() != PerfLoadDialog::Accepted)
return;
@@ -620,7 +620,7 @@ void PerfProfilerTool::showLoadTraceDialog()
m_perspective.select();
QString filename = QFileDialog::getOpenFileName(
ICore::mainWindow(), tr("Load Trace File"),
ICore::dialogParent(), tr("Load Trace File"),
"", tr("Trace File (*.ptq)"));
if (filename.isEmpty())
return;
@@ -640,7 +640,7 @@ void PerfProfilerTool::showSaveTraceDialog()
m_perspective.select();
QString filename = QFileDialog::getSaveFileName(
ICore::mainWindow(), tr("Save Trace File"),
ICore::dialogParent(), tr("Save Trace File"),
"", tr("Trace File (*.ptq)"));
if (filename.isEmpty())
return;
+2 -2
View File
@@ -141,7 +141,7 @@ static int queue(const QList<Project *> &projects, const QList<Id> &stepIds,
bool stopThem = true;
if (settings.prompToStopRunControl) {
QStringList names = Utils::transform(toStop, &RunControl::displayName);
if (QMessageBox::question(ICore::mainWindow(),
if (QMessageBox::question(ICore::dialogParent(),
BuildManager::tr("Stop Applications"),
BuildManager::tr("Stop these applications before building?")
+ "\n\n" + names.join('\n'))
@@ -477,7 +477,7 @@ void BuildManager::finish()
const QString elapsedTime = Utils::formatElapsedTime(d->m_elapsed.elapsed());
m_instance->addToOutputWindow(elapsedTime, BuildStep::OutputFormat::NormalMessage);
QApplication::alert(ICore::mainWindow(), 3000);
QApplication::alert(ICore::dialogParent(), 3000);
}
void BuildManager::emitCancelMessage()
@@ -222,11 +222,13 @@ void BuildSettingsWidget::createConfiguration(const BuildInfo &info_)
BuildInfo info = info_;
if (info.displayName.isEmpty()) {
bool ok = false;
info.displayName = QInputDialog::getText(Core::ICore::mainWindow(),
info.displayName = QInputDialog::getText(Core::ICore::dialogParent(),
tr("New Configuration"),
tr("New configuration name:"),
QLineEdit::Normal,
QString(), &ok).trimmed();
QString(),
&ok)
.trimmed();
if (!ok || info.displayName.isEmpty())
return;
}
@@ -381,10 +381,11 @@ void BuildStepListWidget::updateBuildStepButtonsState()
connect(s->toolWidget, &ToolWidget::removeClicked,
this, [this, i] {
if (!m_buildStepList->removeStep(i)) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Removing Step failed"),
tr("Cannot remove build step while building"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::Ok,
QMessageBox::Ok);
}
});
@@ -133,7 +133,7 @@ void DeviceManager::save()
return;
QVariantMap data;
data.insert(QLatin1String(DeviceManagerKey), toMap());
d->writer->save(data, Core::ICore::mainWindow());
d->writer->save(data, Core::ICore::dialogParent());
}
void DeviceManager::load()
+1 -1
View File
@@ -437,7 +437,7 @@ void KitManager::saveKits()
d->m_defaultKit ? QString::fromLatin1(d->m_defaultKit->id().name()) : QString());
data.insert(KIT_IRRELEVANT_ASPECTS_KEY,
transform<QVariantList>(d->m_irrelevantAspects, &Id::toSetting));
d->m_writer->save(data, ICore::mainWindow());
d->m_writer->save(data, ICore::dialogParent());
}
bool KitManager::isLoaded()
+4 -4
View File
@@ -471,7 +471,7 @@ bool Project::copySteps(Target *sourceTarget, Target *newTarget)
if (fatalError) {
// That could be a more granular error message
QMessageBox::critical(Core::ICore::mainWindow(),
QMessageBox::critical(Core::ICore::dialogParent(),
tr("Incompatible Kit"),
tr("Kit %1 is incompatible with kit %2.")
.arg(sourceTarget->kit()->displayName())
@@ -499,7 +499,7 @@ bool Project::copySteps(Target *sourceTarget, Target *newTarget)
+ runconfigurationError.join(QLatin1Char('\n'));
}
QMessageBox msgBox(Core::ICore::mainWindow());
QMessageBox msgBox(Core::ICore::dialogParent());
msgBox.setIcon(QMessageBox::Warning);
msgBox.setWindowTitle(tr("Partially Incompatible Kit"));
msgBox.setText(tr("Some configurations could not be copied."));
@@ -579,14 +579,14 @@ void Project::saveSettings()
if (!d->m_accessor)
d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this);
if (!targets().isEmpty())
d->m_accessor->saveSettings(toMap(), Core::ICore::mainWindow());
d->m_accessor->saveSettings(toMap(), Core::ICore::dialogParent());
}
Project::RestoreResult Project::restoreSettings(QString *errorMessage)
{
if (!d->m_accessor)
d->m_accessor = std::make_unique<Internal::UserFileAccessor>(this);
QVariantMap map(d->m_accessor->restoreSettings(Core::ICore::mainWindow()));
QVariantMap map(d->m_accessor->restoreSettings(Core::ICore::dialogParent()));
RestoreResult result = fromMap(map, errorMessage);
if (result == RestoreResult::Ok)
emit settingsLoaded();
+22 -26
View File
@@ -1452,8 +1452,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_projectSelectorAction->setObjectName("KitSelector"); // used for UI introduction
dd->m_projectSelectorAction->setCheckable(true);
dd->m_projectSelectorAction->setEnabled(false);
QWidget *mainWindow = ICore::mainWindow();
dd->m_targetSelector = new MiniProjectTargetSelector(dd->m_projectSelectorAction, mainWindow);
dd->m_targetSelector = new MiniProjectTargetSelector(dd->m_projectSelectorAction, ICore::dialogParent());
connect(dd->m_projectSelectorAction, &QAction::triggered,
dd->m_targetSelector, &QWidget::show);
ModeManager::addProjectSelector(dd->m_projectSelectorAction);
@@ -2032,7 +2031,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
Command * const cmd = ActionManager::registerAction(parseIssuesAction,
"ProjectExplorer.ParseIssuesAction");
connect(parseIssuesAction, &QAction::triggered, this, [] {
ParseIssuesDialog dlg(ICore::mainWindow());
ParseIssuesDialog dlg(ICore::dialogParent());
dlg.exec();
});
mtools->addAction(cmd);
@@ -2096,7 +2095,7 @@ void ProjectExplorerPlugin::openNewProjectDialog()
void ProjectExplorerPluginPrivate::showSessionManager()
{
SessionManager::save();
SessionDialog sessionDialog(ICore::mainWindow());
SessionDialog sessionDialog(ICore::dialogParent());
sessionDialog.setAutoLoadSession(dd->m_projectExplorerSettings.autorestoreLastSession);
sessionDialog.exec();
dd->m_projectExplorerSettings.autorestoreLastSession = sessionDialog.autoLoadSession();
@@ -2243,7 +2242,7 @@ void ProjectExplorerPlugin::showOpenProjectError(const OpenProjectResult &result
QString errorMessage = result.errorMessage();
if (!errorMessage.isEmpty()) {
// ignore alreadyOpen
QMessageBox::critical(ICore::mainWindow(), tr("Failed to Open Project"), errorMessage);
QMessageBox::critical(ICore::dialogParent(), tr("Failed to Open Project"), errorMessage);
} else {
// ignore multiple alreadyOpen
Project *alreadyOpen = result.alreadyOpen().constFirst();
@@ -3456,7 +3455,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
QTC_ASSERT(projectNode, return);
const QString dir = currentNode->directory();
QStringList subProjectFilePaths = QFileDialog::getOpenFileNames(
ICore::mainWindow(), tr("Choose Project File"), dir,
ICore::dialogParent(), tr("Choose Project File"), dir,
projectNode->subProjectFileNamePatterns().join(";;"));
if (!ProjectTree::hasNode(projectNode))
return;
@@ -3479,7 +3478,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
if (!failedProjects.empty()) {
const QString message = tr("The following subprojects could not be added to project "
"\"%1\":").arg(projectNode->managingProject()->displayName());
QMessageBox::warning(ICore::mainWindow(), tr("Adding Subproject Failed"),
QMessageBox::warning(ICore::dialogParent(), tr("Adding Subproject Failed"),
message + "\n " + failedProjects.join("\n "));
return;
}
@@ -3493,7 +3492,7 @@ void ProjectExplorerPluginPrivate::handleAddExistingFiles()
QTC_ASSERT(folderNode, return);
QStringList fileNames = QFileDialog::getOpenFileNames(ICore::mainWindow(),
QStringList fileNames = QFileDialog::getOpenFileNames(ICore::dialogParent(),
tr("Add Existing Files"), node->directory());
if (fileNames.isEmpty())
return;
@@ -3509,7 +3508,7 @@ void ProjectExplorerPluginPrivate::addExistingDirectory()
QTC_ASSERT(folderNode, return);
SelectableFilesDialogAddDirectory dialog(Utils::FilePath::fromString(node->directory()),
Utils::FilePaths(), ICore::mainWindow());
Utils::FilePaths(), ICore::dialogParent());
dialog.setAddFileFilter({});
if (dialog.exec() == QDialog::Accepted)
@@ -3532,7 +3531,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const QStri
.arg(folderNode->managingProject()->displayName()) + QLatin1Char('\n');
const QStringList nativeFiles
= Utils::transform(notAdded, &QDir::toNativeSeparators);
QMessageBox::warning(ICore::mainWindow(), tr("Adding Files to Project Failed"),
QMessageBox::warning(ICore::dialogParent(), tr("Adding Files to Project Failed"),
message + nativeFiles.join(QLatin1Char('\n')));
fileNames = Utils::filtered(fileNames,
[&notAdded](const QString &f) { return !notAdded.contains(f); });
@@ -3548,7 +3547,7 @@ void ProjectExplorerPluginPrivate::removeProject()
return;
ProjectNode *projectNode = node->managingProject();
if (projectNode) {
Utils::RemoveFileDialog removeFileDialog(node->filePath().toString(), ICore::mainWindow());
Utils::RemoveFileDialog removeFileDialog(node->filePath().toString(), ICore::dialogParent());
removeFileDialog.setDeleteFileVisible(false);
if (removeFileDialog.exec() == QDialog::Accepted)
projectNode->removeSubProject(node->filePath().toString());
@@ -3573,7 +3572,7 @@ void ProjectExplorerPluginPrivate::showInGraphicalShell()
{
Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return);
FileUtils::showInGraphicalShell(ICore::mainWindow(), currentNode->path());
FileUtils::showInGraphicalShell(ICore::dialogParent(), currentNode->path());
}
void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env)
@@ -3622,14 +3621,14 @@ void ProjectExplorerPluginPrivate::removeFile()
for (const Node * const n : ProjectTree::siblingsWithSameBaseName(currentNode))
siblings << qMakePair(n, n->filePath());
Utils::RemoveFileDialog removeFileDialog(filePath.toString(), ICore::mainWindow());
Utils::RemoveFileDialog removeFileDialog(filePath.toString(), ICore::dialogParent());
if (removeFileDialog.exec() != QDialog::Accepted)
return;
const bool deleteFile = removeFileDialog.isDeleteFileChecked();
const QMessageBox::StandardButton reply = QMessageBox::question(
Core::ICore::mainWindow(), tr("Remove More Files?"),
Core::ICore::dialogParent(), tr("Remove More Files?"),
tr("Would you like to remove these files as well?\n %1")
.arg(Utils::transform<QStringList>(siblings, [](const NodeAndPath &np) {
return np.second.toFileInfo().fileName();
@@ -3640,7 +3639,7 @@ void ProjectExplorerPluginPrivate::removeFile()
for (const NodeAndPath &file : filesToRemove) {
// Nodes can become invalid if the project was re-parsed while the dialog was open
if (!ProjectTree::hasNode(file.first)) {
QMessageBox::warning(ICore::mainWindow(), tr("Removing File Failed"),
QMessageBox::warning(ICore::dialogParent(), tr("Removing File Failed"),
tr("File \"%1\" was not removed, because the project has changed "
"in the meantime.\nPlease try again.")
.arg(file.second.toUserOutput()));
@@ -3684,7 +3683,7 @@ void ProjectExplorerPluginPrivate::duplicateFile()
newFileName.insert(copyTokenIndex, tr("_copy"));
bool okPressed;
newFileName = QInputDialog::getText(ICore::mainWindow(), tr("Choose File Name"),
newFileName = QInputDialog::getText(ICore::dialogParent(), tr("Choose File Name"),
tr("New file name:"), QLineEdit::Normal, newFileName, &okPressed);
if (!okPressed)
return;
@@ -3696,14 +3695,14 @@ void ProjectExplorerPluginPrivate::duplicateFile()
QTC_ASSERT(folderNode, return);
QFile sourceFile(filePath);
if (!sourceFile.copy(newFilePath)) {
QMessageBox::critical(ICore::mainWindow(), tr("Duplicating File Failed"),
QMessageBox::critical(ICore::dialogParent(), tr("Duplicating File Failed"),
tr("Failed to copy file \"%1\" to \"%2\": %3.")
.arg(QDir::toNativeSeparators(filePath),
QDir::toNativeSeparators(newFilePath), sourceFile.errorString()));
return;
}
if (!folderNode->addFiles(QStringList(newFilePath))) {
QMessageBox::critical(ICore::mainWindow(), tr("Duplicating File Failed"),
QMessageBox::critical(ICore::dialogParent(), tr("Duplicating File Failed"),
tr("Failed to add new file \"%1\" to the project.")
.arg(QDir::toNativeSeparators(newFilePath)));
}
@@ -3718,7 +3717,7 @@ void ProjectExplorerPluginPrivate::deleteFile()
QString filePath = currentNode->filePath().toString();
QMessageBox::StandardButton button =
QMessageBox::question(ICore::mainWindow(),
QMessageBox::question(ICore::dialogParent(),
tr("Delete File"),
tr("Delete %1 from file system?")
.arg(QDir::toNativeSeparators(filePath)),
@@ -3739,7 +3738,7 @@ void ProjectExplorerPluginPrivate::deleteFile()
QFile file(filePath);
if (file.exists()) {
if (!file.remove())
QMessageBox::warning(ICore::mainWindow(), tr("Deleting File Failed"),
QMessageBox::warning(ICore::dialogParent(), tr("Deleting File Failed"),
tr("Could not delete file %1.")
.arg(QDir::toNativeSeparators(filePath)));
}
@@ -3770,7 +3769,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
if (!folderNode->canRenameFile(oldFilePath, newFilePath)) {
QTimer::singleShot(0, [oldFilePath, newFilePath, projectFileName] {
int res = QMessageBox::question(ICore::mainWindow(),
int res = QMessageBox::question(ICore::dialogParent(),
tr("Project Editing Failed"),
tr("The project file %1 cannot be automatically changed.\n\n"
"Rename %2 to %3 anyway?")
@@ -3780,7 +3779,6 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
if (res == QMessageBox::Yes) {
QTC_CHECK(FileUtils::renameFile(oldFilePath, newFilePath));
}
});
return;
}
@@ -3795,7 +3793,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
.arg(projectFileName);
QTimer::singleShot(0, [renameFileError]() {
QMessageBox::warning(ICore::mainWindow(),
QMessageBox::warning(ICore::dialogParent(),
tr("Project Editing Failed"),
renameFileError);
});
@@ -3806,9 +3804,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
.arg(QDir::toNativeSeparators(newFilePath));
QTimer::singleShot(0, [renameFileError]() {
QMessageBox::warning(ICore::mainWindow(),
tr("Cannot Rename File"),
renameFileError);
QMessageBox::warning(ICore::dialogParent(), tr("Cannot Rename File"), renameFileError);
});
}
}
@@ -189,7 +189,7 @@ bool ProjectFileWizardExtension::processFiles(
errorMessage->clear();
}
message.append(tr("Open project anyway?"));
if (QMessageBox::question(ICore::mainWindow(), tr("Version Control Failure"), message,
if (QMessageBox::question(ICore::dialogParent(), tr("Version Control Failure"), message,
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return false;
}
@@ -102,7 +102,8 @@ const QList<BuildInfo> ProjectImporter::import(const Utils::FilePath &importPath
const auto handleFailure = [this, importPath, silent] {
if (silent)
return;
QMessageBox::critical(Core::ICore::mainWindow(), tr("No Build Found"),
QMessageBox::critical(Core::ICore::dialogParent(),
tr("No Build Found"),
tr("No build found in %1 matching project %2.")
.arg(importPath.toUserOutput(), projectFilePath().toUserOutput()));
};
@@ -217,7 +217,7 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol
const QList<Node *> candidateNodes = ProjectTree::siblingsWithSameBaseName(node);
if (!candidateNodes.isEmpty()) {
const QMessageBox::StandardButton reply = QMessageBox::question(
Core::ICore::mainWindow(), tr("Rename More Files?"),
Core::ICore::dialogParent(), tr("Rename More Files?"),
tr("Would you like to rename these files as well?\n %1")
.arg(transform<QStringList>(candidateNodes, [](const Node *n) {
return n->filePath().toFileInfo().fileName();
@@ -748,8 +748,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
"files. Please check your repository."))
.append("\n ").append(makeUserFileList(failedVcsOp));
}
QMessageBox::warning(Core::ICore::mainWindow(), tr("Failure Updating Project"),
message);
QMessageBox::warning(Core::ICore::dialogParent(), tr("Failure Updating Project"), message);
}
return true;
@@ -397,9 +397,9 @@ public:
if (m_activeSwitchToRect.contains(pos))
sessionModel->switchToSession(sessionName);
else if (m_activeActionRects[0].contains(pos))
sessionModel->cloneSession(ICore::mainWindow(), sessionName);
sessionModel->cloneSession(ICore::dialogParent(), sessionName);
else if (m_activeActionRects[1].contains(pos))
sessionModel->renameSession(ICore::mainWindow(), sessionName);
sessionModel->renameSession(ICore::dialogParent(), sessionName);
else if (m_activeActionRects[2].contains(pos))
sessionModel->deleteSessions(QStringList(sessionName));
return true;
@@ -559,7 +559,7 @@ public:
if (auto kitPage = KitOptionsPage::instance())
kitPage->showKit(KitManager::kit(Id::fromSetting(projectItem->data(0, KitIdRole))));
}
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, ICore::mainWindow());
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID);
}
void handleImportBuild()
@@ -570,7 +570,7 @@ public:
QTC_ASSERT(projectImporter, return);
QString dir = project->projectDirectory().toString();
QString importDir = QFileDialog::getExistingDirectory(ICore::mainWindow(),
QString importDir = QFileDialog::getExistingDirectory(ICore::dialogParent(),
ProjectWindow::tr("Import Directory"),
dir);
FilePath path = FilePath::fromString(importDir);
+1 -1
View File
@@ -1038,7 +1038,7 @@ bool RunControl::showPromptToStopDialog(const QString &title,
{
// Show a question message box where user can uncheck this
// question for this class.
Utils::CheckableMessageBox messageBox(Core::ICore::mainWindow());
Utils::CheckableMessageBox messageBox(Core::ICore::dialogParent());
messageBox.setWindowTitle(title);
messageBox.setText(text);
messageBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::Cancel);
+2 -2
View File
@@ -527,7 +527,7 @@ bool SessionManager::save()
delete d->m_writer;
d->m_writer = new PersistentSettingsWriter(filePath, "QtCreatorSession");
}
const bool result = d->m_writer->save(data, ICore::mainWindow());
const bool result = d->m_writer->save(data, ICore::dialogParent());
if (result) {
if (!isDefaultVirgin())
d->m_sessionDateTimes.insert(activeSession(), QDateTime::currentDateTime());
@@ -823,7 +823,7 @@ bool SessionManager::confirmSessionDelete(const QStringList &sessions)
const QString question = sessions.size() == 1
? tr("Delete session %1?").arg(sessions.first())
: tr("Delete these sessions?\n %1").arg(sessions.join("\n "));
return QMessageBox::question(ICore::mainWindow(),
return QMessageBox::question(ICore::dialogParent(),
title,
question,
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes;
+2 -2
View File
@@ -257,7 +257,7 @@ bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &f
FileSaver saver(fileName, QIODevice::ReadOnly | QIODevice::Text);
if (!saver.hasError()) {
QString content = QTextStream(saver.file()).readAll();
if (saver.finalize(ICore::mainWindow())) {
if (saver.finalize(ICore::dialogParent())) {
QString errorMessage;
result = writePyProjectFile(fileName, content, rawList, &errorMessage);
if (!errorMessage.isEmpty())
@@ -271,7 +271,7 @@ bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &f
for (const QString &filePath : rawList)
stream << filePath << '\n';
saver.setResult(&stream);
result = saver.finalize(ICore::mainWindow());
result = saver.finalize(ICore::dialogParent());
}
}
+1 -1
View File
@@ -345,7 +345,7 @@ bool QbsBuildSystem::ensureWriteableQbsFile(const QString &file)
if (!versionControl || !versionControl->vcsOpen(file)) {
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
if (!makeWritable) {
QMessageBox::warning(ICore::mainWindow(),
QMessageBox::warning(ICore::dialogParent(),
tr("Failed"),
tr("Could not write project file %1.").arg(file));
return false;
@@ -783,9 +783,11 @@ bool QmakePriFile::ensureWriteableProFile(const QString &file)
if (!versionControl || !versionControl->vcsOpen(file)) {
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
if (!makeWritable) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
QCoreApplication::translate("QmakePriFile", "Failed"),
QCoreApplication::translate("QmakePriFile", "Could not write project file %1.").arg(file));
QCoreApplication::translate("QmakePriFile",
"Could not write project file %1.")
.arg(file));
return false;
}
}
@@ -963,7 +965,7 @@ void QmakePriFile::save(const QStringList &lines)
FileChangeBlocker changeGuard(filePath().toString());
QString errorMsg;
if (!m_textFormat.writeFile(filePath().toString(), lines.join('\n'), &errorMsg)) {
QMessageBox::critical(Core::ICore::mainWindow(), QCoreApplication::translate(
QMessageBox::critical(Core::ICore::dialogParent(), QCoreApplication::translate(
"QmakePriFile", "File Error"), errorMsg);
}
}
@@ -981,7 +983,8 @@ void QmakePriFile::save(const QStringList &lines)
errorStrings << errorString;
}
if (!errorStrings.isEmpty())
QMessageBox::warning(Core::ICore::mainWindow(), QCoreApplication::translate("QmakePriFile", "File Error"),
QMessageBox::warning(Core::ICore::dialogParent(),
QCoreApplication::translate("QmakePriFile", "File Error"),
errorStrings.join(QLatin1Char('\n')));
}
@@ -703,7 +703,7 @@ void QMakeStepConfigWidget::buildConfigurationSelected()
void QMakeStepConfigWidget::askForRebuild(const QString &title)
{
auto *question = new QMessageBox(Core::ICore::mainWindow());
auto *question = new QMessageBox(Core::ICore::dialogParent());
question->setWindowTitle(title);
question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
question->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
@@ -207,7 +207,7 @@ void BackendModel::addNewBackend()
if (!model)
return;
AddNewBackendDialog dialog(Core::ICore::mainWindow());
AddNewBackendDialog dialog(Core::ICore::dialogParent());
RewriterView *rewriterView = model->rewriterView();
@@ -518,12 +518,11 @@ void ItemLibraryWidget::addResources()
static QString lastDir;
const QString currentDir = lastDir.isEmpty() ? document->fileName().parentDir().toString() : lastDir;
const auto fileNames = QFileDialog::getOpenFileNames(Core::ICore::mainWindow(),
const auto fileNames = QFileDialog::getOpenFileNames(Core::ICore::dialogParent(),
tr("Add Assets"),
currentDir,
filters.join(";;"));
if (!fileNames.isEmpty())
lastDir = QFileInfo(fileNames.first()).absolutePath();
@@ -105,7 +105,8 @@ static ModelNode findTabViewModelNode(const ModelNode &currentModelNode)
void AddTabDesignerAction::addNewTab()
{
QString tabName = AddTabToTabViewDialog::create(QStringLiteral("Tab"), Core::ICore::mainWindow());
QString tabName = AddTabToTabViewDialog::create(QStringLiteral("Tab"),
Core::ICore::dialogParent());
if (!tabName.isEmpty()) {
QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath();
@@ -270,7 +270,7 @@ static QString idealProcessCount()
bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
{
PuppetBuildProgressDialog progressDialog;
progressDialog.setParent(Core::ICore::mainWindow());
progressDialog.setParent(Core::ICore::dialogParent());
m_compileLog.clear();
+4 -3
View File
@@ -304,10 +304,11 @@ void DocumentManager::addFileToVersionControl(const QString &directoryPath, cons
{
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(directoryPath);
if (versionControl && versionControl->supportsOperation(Core::IVersionControl::AddOperation)) {
const QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(),
const QMessageBox::StandardButton button
= QMessageBox::question(Core::ICore::dialogParent(),
Core::VcsManager::msgAddToVcsTitle(),
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFilePath), versionControl),
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFilePath),
versionControl),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes && !versionControl->vcsAdd(newFilePath)) {
Core::AsynchronousMessageBox::warning(Core::VcsManager::msgAddToVcsFailedTitle(),
+1 -1
View File
@@ -273,7 +273,7 @@ void SettingsPageWidget::apply()
for (const QByteArray &key : restartNecessaryKeys) {
if (currentSettings.value(key) != newSettings.value(key)) {
QMessageBox::information(Core::ICore::mainWindow(), tr("Restart Required"),
QMessageBox::information(Core::ICore::dialogParent(), tr("Restart Required"),
tr("The made changes will take effect after a "
"restart of the QML Emulation layer or %1.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
@@ -217,15 +217,16 @@ public:
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(path);
if (versionControl
&& versionControl->supportsOperation(Core::IVersionControl::AddOperation)) {
const QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(),
const QMessageBox::StandardButton button = QMessageBox::question(
Core::ICore::dialogParent(),
Core::VcsManager::msgAddToVcsTitle(),
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFileName), versionControl),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes && !versionControl->vcsAdd(newFileName)) {
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
Core::VcsManager::msgAddToVcsFailedTitle(),
Core::VcsManager::msgToAddToVcsFailed(QStringList(newFileName), versionControl));
Core::VcsManager::msgToAddToVcsFailed(QStringList(newFileName),
versionControl));
}
}
}
@@ -181,9 +181,8 @@ void QmlPreviewConnectionManager::createClients()
}
});
QObject::connect(m_clientPlugin.data(), &QmlPreviewClient::debugServiceUnavailable,
this, []() {
QMessageBox::warning(Core::ICore::mainWindow(), "Error loading QML Live Preview",
QObject::connect(m_clientPlugin.data(), &QmlPreviewClient::debugServiceUnavailable, this, []() {
QMessageBox::warning(Core::ICore::dialogParent(), "Error loading QML Live Preview",
"QML Live Preview is not available for this version of Qt.");
}, Qt::QueuedConnection); // Queue it, so that it interfere with the connection timer
+5 -5
View File
@@ -351,7 +351,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionFailed,
runWorker, [this, runWorker]() {
auto infoBox = new QMessageBox(ICore::mainWindow());
auto infoBox = new QMessageBox(ICore::dialogParent());
infoBox->setIcon(QMessageBox::Critical);
infoBox->setWindowTitle(Core::Constants::IDE_DISPLAY_NAME);
@@ -580,7 +580,7 @@ void QmlProfilerTool::logError(const QString &msg)
void QmlProfilerTool::showErrorDialog(const QString &error)
{
auto errorDialog = new QMessageBox(ICore::mainWindow());
auto errorDialog = new QMessageBox(ICore::dialogParent());
errorDialog->setIcon(QMessageBox::Warning);
errorDialog->setWindowTitle(tr("QML Profiler"));
errorDialog->setText(error);
@@ -604,7 +604,7 @@ void QmlProfilerTool::showSaveDialog()
QLatin1String tFile(QtdFileExtension);
QLatin1String zFile(QztFileExtension);
QString filename = QFileDialog::getSaveFileName(
ICore::mainWindow(), tr("Save QML Trace"),
ICore::dialogParent(), tr("Save QML Trace"),
QmlProfilerPlugin::globalSettings()->lastTraceFile(),
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
if (!filename.isEmpty()) {
@@ -628,7 +628,7 @@ void QmlProfilerTool::showLoadDialog()
QLatin1String tFile(QtdFileExtension);
QLatin1String zFile(QztFileExtension);
QString filename = QFileDialog::getOpenFileName(
ICore::mainWindow(), tr("Load QML Trace"),
ICore::dialogParent(), tr("Load QML Trace"),
QmlProfilerPlugin::globalSettings()->lastTraceFile(),
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
@@ -773,7 +773,7 @@ QList <QAction *> QmlProfilerTool::profilerContextMenuActions()
void QmlProfilerTool::showNonmodalWarning(const QString &warningMsg)
{
auto noExecWarning = new QMessageBox(ICore::mainWindow());
auto noExecWarning = new QMessageBox(ICore::dialogParent());
noExecWarning->setIcon(QMessageBox::Warning);
noExecWarning->setWindowTitle(tr("QML Profiler"));
noExecWarning->setText(warningMsg);
+3 -2
View File
@@ -147,10 +147,11 @@ bool QnxConfiguration::activate()
foreach (const QString &error, validationErrors())
errorMessage += QLatin1String("\n") + error;
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
"Cannot Set Up QNX Configuration"),
errorMessage, QMessageBox::Ok);
errorMessage,
QMessageBox::Ok);
return false;
}
+1 -1
View File
@@ -121,7 +121,7 @@ void QnxConfigurationManager::saveConfigs()
data.insert(QLatin1String(QNXConfigCountKey), count);
m_writer->save(data, Core::ICore::mainWindow());
m_writer->save(data, Core::ICore::dialogParent());
}
void QnxConfigurationManager::restoreConfigurations()
+3 -2
View File
@@ -119,7 +119,8 @@ void QnxSettingsWidget::addConfiguration()
QnxConfiguration *config = new QnxConfiguration(Utils::FilePath::fromString(envFile));
if (m_qnxConfigManager->configurations().contains(config)
|| !config->isValid()) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Warning"),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("Warning"),
tr("Configuration already exists or is invalid."));
delete config;
return;
@@ -140,7 +141,7 @@ void QnxSettingsWidget::removeConfiguration()
return;
QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(),
QMessageBox::question(Core::ICore::dialogParent(),
tr("Remove QNX Configuration"),
tr("Are you sure you want to remove:\n %1?").arg(config->displayName()),
QMessageBox::Yes | QMessageBox::No);
@@ -85,7 +85,7 @@ Id ExamplesWelcomePage::id() const
QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileInfo, QStringList &filesToOpen, const QStringList& dependencies)
{
const QString projectDir = proFileInfo.canonicalPath();
QDialog d(ICore::mainWindow());
QDialog d(ICore::dialogParent());
auto lay = new QGridLayout(&d);
auto descrLbl = new QLabel;
d.setWindowTitle(tr("Copy Project to writable Location?"));
@@ -130,10 +130,12 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
QDir toDirWithExamplesDir(destBaseDir);
if (toDirWithExamplesDir.cd(exampleDirName)) {
toDirWithExamplesDir.cdUp(); // step out, just to not be in the way
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Use Location"),
QMessageBox::warning(ICore::dialogParent(),
tr("Cannot Use Location"),
tr("The specified location already exists. "
"Please specify a valid location."),
QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::Ok,
QMessageBox::NoButton);
return QString();
} else {
QString error;
@@ -150,7 +152,9 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
.pathAppended(QDir(dependency).dirName());
if (!FileUtils::copyRecursively(FilePath::fromString(dependency), targetFile,
&error)) {
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Copy Project"), error);
QMessageBox::warning(ICore::dialogParent(),
tr("Cannot Copy Project"),
error);
// do not fail, just warn;
}
}
@@ -158,7 +162,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
return targetDir + QLatin1Char('/') + proFileInfo.fileName();
} else {
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Copy Project"), error);
QMessageBox::warning(ICore::dialogParent(), tr("Cannot Copy Project"), error);
}
}
+1 -1
View File
@@ -135,7 +135,7 @@ static void askAboutQtInstallation()
info.setCustomButtonInfo(QtSupportPlugin::tr("Link with Qt"), [] {
ICore::infoBar()->removeInfo(kLinkWithQtInstallationSetting);
ICore::infoBar()->globallySuppressInfo(kLinkWithQtInstallationSetting);
QTimer::singleShot(0, ICore::mainWindow(), &QtOptionsPage::linkWithQt);
QTimer::singleShot(0, ICore::dialogParent(), &QtOptionsPage::linkWithQt);
});
ICore::infoBar()->addInfo(info);
}
+1 -1
View File
@@ -386,7 +386,7 @@ static void saveQtVersions()
data.insert(QString::fromLatin1(QTVERSION_DATA_KEY) + QString::number(count), tmp);
++count;
}
m_writer->save(data, Core::ICore::mainWindow());
m_writer->save(data, Core::ICore::dialogParent());
}
// Executes qtchooser with arguments in a process and returns its output
+1 -1
View File
@@ -295,7 +295,7 @@ LinuxDeviceFactory::LinuxDeviceFactory()
IDevice::Ptr LinuxDeviceFactory::create() const
{
GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow());
GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::dialogParent());
if (wizard.exec() != QDialog::Accepted)
return IDevice::Ptr();
return wizard.device();
@@ -52,7 +52,7 @@ PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(
{
const QString &dir = QFileInfo(deviceConfig->sshParameters().privateKeyFile).path();
const QString publicKeyFileName = QFileDialog::getOpenFileName(parent
? parent : Core::ICore::mainWindow(),
? parent : Core::ICore::dialogParent(),
tr("Choose Public Key File"), dir,
tr("Public Key Files (*.pub);;All Files (*)"));
if (publicKeyFileName.isEmpty())
@@ -72,7 +72,8 @@ RemoteLinuxEnvironmentAspectWidget::RemoteLinuxEnvironmentAspectWidget
= [target](const Utils::Environment &env) {
IDevice::ConstPtr device = DeviceKitAspect::device(target->kit());
if (!device) {
QMessageBox::critical(Core::ICore::mainWindow(), tr("Cannot Open Terminal"),
QMessageBox::critical(Core::ICore::dialogParent(),
tr("Cannot Open Terminal"),
tr("Cannot open remote terminal: Current kit has no device."));
return;
}
@@ -1251,7 +1251,7 @@ EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index)
deleteItem(index);
return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup);
}
Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::mainWindow());
Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::dialogParent());
if (removeFileDialog.exec() == QDialog::Accepted) {
deleteItem(index);
Core::FileUtils::removeFile(fileNameBackup, removeFileDialog.isDeleteFileChecked());
@@ -284,7 +284,7 @@ void ResourceEditorPluginPrivate::addPrefixContextMenu()
{
auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode());
QTC_ASSERT(topLevel, return);
PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::mainWindow());
PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return;
QString prefix = dialog.prefix();
@@ -297,7 +297,7 @@ void ResourceEditorPluginPrivate::removePrefixContextMenu()
{
auto rfn = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
QTC_ASSERT(rfn, return);
if (QMessageBox::question(Core::ICore::mainWindow(),
if (QMessageBox::question(Core::ICore::dialogParent(),
tr("Remove Prefix"),
tr("Remove prefix %1 and all its files?").arg(rfn->displayName()))
== QMessageBox::Yes) {
@@ -326,7 +326,7 @@ void ResourceEditorPluginPrivate::removeFileContextMenu()
FolderNode *parent = rfn->parentFolderNode();
QTC_ASSERT(parent, return);
if (parent->removeFiles(QStringList() << path) != RemovedFilesFromProject::Ok)
QMessageBox::warning(Core::ICore::mainWindow(),
QMessageBox::warning(Core::ICore::dialogParent(),
tr("File Removal Failed"),
tr("Removing file %1 from the project failed.").arg(path));
}
@@ -355,7 +355,10 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu()
auto node = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
QTC_ASSERT(node, return);
PrefixLangDialog dialog(tr("Rename Prefix"), node->prefix(), node->lang(), Core::ICore::mainWindow());
PrefixLangDialog dialog(tr("Rename Prefix"),
node->prefix(),
node->lang(),
Core::ICore::dialogParent());
if (dialog.exec() != QDialog::Accepted)
return;
QString prefix = dialog.prefix();
@@ -195,7 +195,7 @@ bool ResourceEditorDocument::setContents(const QByteArray &contents)
{
TempFileSaver saver;
saver.write(contents);
if (!saver.finalize(Core::ICore::mainWindow()))
if (!saver.finalize(Core::ICore::dialogParent()))
return false;
const QString originalFileName = m_model->fileName();
+1 -1
View File
@@ -174,7 +174,7 @@ IDocument *TaskListPlugin::openTasks(const FilePath &fileName)
QString errorString;
if (!file->load(&errorString, fileName)) {
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString);
QMessageBox::critical(ICore::dialogParent(), tr("File Error"), errorString);
delete file;
return nullptr;
}
+2 -2
View File
@@ -345,7 +345,7 @@ void BaseFileFind::doReplace(const QString &text,
{
const QStringList files = replaceAll(text, items, preserveCase);
if (!files.isEmpty()) {
Utils::FadingIndicator::showText(ICore::mainWindow(),
Utils::FadingIndicator::showText(ICore::dialogParent(),
tr("%n occurrences replaced.", nullptr, items.size()),
Utils::FadingIndicator::SmallText);
DocumentManager::notifyFilesChangedInternally(files);
@@ -505,7 +505,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
// Query the user for permissions
if (!roFiles.isEmpty()) {
ReadOnlyFilesDialog roDialog(Utils::toList(roFiles), ICore::mainWindow());
ReadOnlyFilesDialog roDialog(Utils::toList(roFiles), ICore::dialogParent());
roDialog.setShowFailWarning(true, tr("Aborting replace."));
if (roDialog.exec() == ReadOnlyFilesDialog::RO_Cancel)
return QStringList();
+1 -1
View File
@@ -289,6 +289,6 @@ void CodeStylePool::exportCodeStyle(const Utils::FilePath &fileName, ICodeStyleP
tmp.insert(QLatin1String(displayNameKey), codeStyle->displayName());
tmp.insert(QLatin1String(codeStyleDataKey), map);
Utils::PersistentSettingsWriter writer(fileName, QLatin1String(codeStyleDocKey));
writer.save(tmp, Core::ICore::mainWindow());
writer.save(tmp, Core::ICore::dialogParent());
}
+1 -1
View File
@@ -440,7 +440,7 @@ bool FontSettings::loadColorScheme(const QString &fileName,
bool FontSettings::saveColorScheme(const QString &fileName)
{
const bool saved = m_scheme.save(fileName, Core::ICore::mainWindow());
const bool saved = m_scheme.save(fileName, Core::ICore::dialogParent());
if (saved)
m_schemeFileName = fileName;
return saved;
+3 -3
View File
@@ -473,7 +473,7 @@ void FontSettingsPageWidget::copyColorScheme(const QString &name)
ColorScheme scheme = m_value.colorScheme();
scheme.setDisplayName(name);
if (scheme.save(fileName, Core::ICore::mainWindow()))
if (scheme.save(fileName, Core::ICore::dialogParent()))
m_value.setColorSchemeFileName(fileName);
refreshColorSchemeList();
@@ -540,7 +540,7 @@ void FontSettingsPageWidget::maybeSaveColorScheme()
if (messageBox.exec() == QMessageBox::Save) {
const ColorScheme &scheme = m_ui.schemeEdit->colorScheme();
scheme.save(m_value.colorSchemeFileName(), Core::ICore::mainWindow());
scheme.save(m_value.colorSchemeFileName(), Core::ICore::dialogParent());
}
}
@@ -590,7 +590,7 @@ void FontSettingsPageWidget::apply()
// Update the scheme and save it under the name it already has
m_value.setColorScheme(m_ui.schemeEdit->colorScheme());
const ColorScheme &scheme = m_value.colorScheme();
scheme.save(m_value.colorSchemeFileName(), Core::ICore::mainWindow());
scheme.save(m_value.colorSchemeFileName(), Core::ICore::dialogParent());
}
bool ok;
@@ -312,7 +312,7 @@ bool RefactoringFile::apply()
{
// test file permissions
if (!QFileInfo(fileName()).isWritable()) {
ReadOnlyFilesDialog roDialog(FilePath::fromString(fileName()), ICore::mainWindow());
ReadOnlyFilesDialog roDialog(FilePath::fromString(fileName()), ICore::dialogParent());
const QString &failDetailText = QApplication::translate("RefactoringFile::apply",
"Refactoring cannot be applied.");
roDialog.setShowFailWarning(true, failDetailText);
+1 -1
View File
@@ -908,7 +908,7 @@ void CallgrindToolPrivate::slotRequestDump()
void CallgrindToolPrivate::loadExternalLogFile()
{
const QString filePath = QFileDialog::getOpenFileName(
ICore::mainWindow(),
ICore::dialogParent(),
CallgrindTool::tr("Open Callgrind Log File"),
QString(),
CallgrindTool::tr("Callgrind Output (callgrind.out*);;All Files (*)"));
+4 -4
View File
@@ -776,7 +776,7 @@ void MemcheckToolPrivate::heobAction()
executable.remove(0, wdSlashed.size());
// heob arguments
HeobDialog dialog(Core::ICore::mainWindow());
HeobDialog dialog(Core::ICore::dialogParent());
if (!dialog.exec())
return;
const QString heobArguments = dialog.arguments();
@@ -786,7 +786,7 @@ void MemcheckToolPrivate::heobAction()
const QString heobPath = dialog.path() + '/' + heob;
if (!QFile::exists(heobPath)) {
QMessageBox::critical(
Core::ICore::mainWindow(),
Core::ICore::dialogParent(),
MemcheckTool::tr("Heob"),
MemcheckTool::tr("The %1 executables must be in the appropriate location.")
.arg("<a href=\"https://github.com/ssbssa/heob/releases\">Heob</a>"));
@@ -799,7 +799,7 @@ void MemcheckToolPrivate::heobAction()
const QString dwarfstackPath = dialog.path() + '/' + dwarfstack;
if (!QFile::exists(dwarfstackPath)
&& CheckableMessageBox::doNotShowAgainInformation(
Core::ICore::mainWindow(),
Core::ICore::dialogParent(),
MemcheckTool::tr("Heob"),
MemcheckTool::tr("Heob used with MinGW projects needs the %1 DLLs for proper "
"stacktrace resolution.")
@@ -1015,7 +1015,7 @@ void MemcheckToolPrivate::loadShowXmlLogFile(const QString &filePath, const QStr
void MemcheckToolPrivate::loadExternalXmlLogFile()
{
const QString filePath = QFileDialog::getOpenFileName(
ICore::mainWindow(),
ICore::dialogParent(),
MemcheckTool::tr("Open Memcheck XML Log File"),
QString(),
MemcheckTool::tr("XML Files (*.xml);;All Files (*)"));
+1 -1
View File
@@ -149,7 +149,7 @@ void ValgrindToolRunner::handleProgressCanceled()
void ValgrindToolRunner::handleProgressFinished()
{
QApplication::alert(ICore::mainWindow(), 3000);
QApplication::alert(ICore::dialogParent(), 3000);
}
void ValgrindToolRunner::runnerFinished()
+1 -1
View File
@@ -643,7 +643,7 @@ void VcsBasePluginPrivate::createRepository()
if (const Project *currentProject = ProjectTree::currentProject())
directory = currentProject->projectFilePath().toString();
// Prompt for a directory that is not under version control yet
QWidget *mw = ICore::mainWindow();
QWidget *mw = ICore::dialogParent();
do {
directory = QFileDialog::getExistingDirectory(mw, tr("Choose Repository Directory"), directory);
if (directory.isEmpty())
+1 -1
View File
@@ -272,7 +272,7 @@ static inline QStringList fieldTexts(const QString &fileContents)
void VcsBaseSubmitEditor::createUserFields(const QString &fieldConfigFile)
{
FileReader reader;
if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::mainWindow()))
if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::dialogParent()))
return;
// Parse into fields
const QStringList fields = fieldTexts(QString::fromUtf8(reader.data()));