Use ICore::dialogParent for message boxes without parent so far

Change-Id: I2ee35796b2c041e6ea2ae6bd677e10167451d1b8
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
hjk
2014-03-11 18:09:23 +01:00
parent f4db27a65c
commit 3b84a6dc88
25 changed files with 104 additions and 58 deletions
+2 -1
View File
@@ -39,6 +39,7 @@
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -631,7 +632,7 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
} }
if (forceUpdate) if (forceUpdate)
QMessageBox::warning(0, tr("Warning"), tr("Android files have been updated automatically.")); QMessageBox::warning(Core::ICore::dialogParent(), tr("Warning"), tr("Android files have been updated automatically."));
return true; return true;
} }
+3 -2
View File
@@ -1658,7 +1658,8 @@ bool ClearCasePlugin::vcsSetActivity(const QString &workingDir, const QString &t
const ClearCaseResponse actResponse = const ClearCaseResponse actResponse =
runCleartool(workingDir, args, m_settings.timeOutMS(), ShowStdOutInLogWindow); runCleartool(workingDir, args, m_settings.timeOutMS(), ShowStdOutInLogWindow);
if (actResponse.error) { if (actResponse.error) {
QMessageBox::warning(0, title, tr("Set current activity failed: %1").arg(actResponse.message), QMessageBox::Ok); QMessageBox::warning(ICore::dialogParent(), title,
tr("Set current activity failed: %1").arg(actResponse.message), QMessageBox::Ok);
return false; return false;
} }
m_activity = activity; m_activity = activity;
@@ -1821,7 +1822,7 @@ bool ClearCasePlugin::vcsAdd(const QString &workingDir, const QString &fileName)
bool ClearCasePlugin::vcsDelete(const QString &workingDir, const QString &fileName) bool ClearCasePlugin::vcsDelete(const QString &workingDir, const QString &fileName)
{ {
const QString title(tr("ClearCase Remove Element %1").arg(baseName(fileName))); const QString title(tr("ClearCase Remove Element %1").arg(baseName(fileName)));
if (QMessageBox::warning(0, title, tr("This operation is irreversible. Are you sure?"), if (QMessageBox::warning(ICore::dialogParent(), title, tr("This operation is irreversible. Are you sure?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
return true; return true;
@@ -108,7 +108,7 @@ void ExecuteFilter::accept(LocatorFilterEntry selection) const
if (m_process->state() != QProcess::NotRunning) { if (m_process->state() != QProcess::NotRunning) {
const QString info(tr("Previous command is still running ('%1').\nDo you want to kill it?") const QString info(tr("Previous command is still running ('%1').\nDo you want to kill it?")
.arg(p->headCommand())); .arg(p->headCommand()));
int r = QMessageBox::question(0, tr("Kill Previous Process?"), info, int r = QMessageBox::question(ICore::dialogParent(), tr("Kill Previous Process?"), info,
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
QMessageBox::Yes); QMessageBox::Yes);
if (r == QMessageBox::Yes) if (r == QMessageBox::Yes)
+1 -1
View File
@@ -382,7 +382,7 @@ bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
const QString msg = tr("Would you like to remove this file from the version control system (%1)?\n" const QString msg = tr("Would you like to remove this file from the version control system (%1)?\n"
"Note: This might remove the local file.").arg(vc->displayName()); "Note: This might remove the local file.").arg(vc->displayName());
const QMessageBox::StandardButton button = const QMessageBox::StandardButton button =
QMessageBox::question(0, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); QMessageBox::question(ICore::dialogParent(), title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (button != QMessageBox::Yes) if (button != QMessageBox::Yes)
return true; return true;
return vc->vcsDelete(fileName); return vc->vcsDelete(fileName);
+4 -3
View File
@@ -151,9 +151,9 @@ static inline QString debugCodec(const QTextCodec *c)
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec"); return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
} }
static inline bool messageBoxQuestion(const QString &title, const QString &question, QWidget *parent = 0) static inline bool messageBoxQuestion(const QString &title, const QString &question)
{ {
return QMessageBox::question(parent, title, question, QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes; return QMessageBox::question(ICore::dialogParent(), title, question, QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes;
} }
// ------------- CVSPlugin // ------------- CVSPlugin
@@ -579,7 +579,8 @@ void CvsPlugin::revertAll()
if (revertResponse.result == CvsResponse::Ok) if (revertResponse.result == CvsResponse::Ok)
cvsVersionControl()->emitRepositoryChanged(state.topLevel()); cvsVersionControl()->emitRepositoryChanged(state.topLevel());
else else
QMessageBox::warning(0, title, tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok); QMessageBox::warning(ICore::dialogParent(), title,
tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok);
} }
void CvsPlugin::revertCurrentFile() void CvsPlugin::revertCurrentFile()
+1 -1
View File
@@ -356,7 +356,7 @@ void GerritPlugin::openView()
{ {
if (m_dialog.isNull()) { if (m_dialog.isNull()) {
while (!m_parameters->isValid()) { while (!m_parameters->isValid()) {
QMessageBox::warning(0, tr("Error"), QMessageBox::warning(ICore::dialogParent(), tr("Error"),
tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory.")); tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
const Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY; const Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
if (!ICore::showOptionsDialog(group, "Gerrit")) if (!ICore::showOptionsDialog(group, "Gerrit"))
+4 -2
View File
@@ -33,6 +33,7 @@
#include "gitversioncontrol.h" #include "gitversioncontrol.h"
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <vcsbase/vcsbaseoutputwindow.h> #include <vcsbase/vcsbaseoutputwindow.h>
#include <QMessageBox> #include <QMessageBox>
@@ -89,7 +90,8 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
arguments << QLatin1String("mergetool") << QLatin1String("-y"); arguments << QLatin1String("mergetool") << QLatin1String("-y");
if (!files.isEmpty()) { if (!files.isEmpty()) {
if (m_gitClient->gitVersion() < 0x010708) { if (m_gitClient->gitVersion() < 0x010708) {
QMessageBox::warning(0, tr("Error"), tr("File input for the merge tool requires Git 1.7.8, or later.")); QMessageBox::warning(Core::ICore::dialogParent(), tr("Error"),
tr("File input for the merge tool requires Git 1.7.8, or later."));
return false; return false;
} }
arguments << files; arguments << files;
@@ -244,7 +246,7 @@ void MergeTool::readData()
m_remoteState = waitAndReadStatus(m_remoteInfo); m_remoteState = waitAndReadStatus(m_remoteInfo);
chooseAction(); chooseAction();
} else if (m_merging && line.startsWith("Continue merging")) { } else if (m_merging && line.startsWith("Continue merging")) {
if (QMessageBox::question(0, tr("Continue Merging"), if (QMessageBox::question(Core::ICore::dialogParent(), tr("Continue Merging"),
tr("Continue merging other unresolved paths?"), tr("Continue merging other unresolved paths?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) { QMessageBox::No) == QMessageBox::Yes) {
+2 -2
View File
@@ -462,7 +462,7 @@ void PerforcePlugin::revertCurrentFile()
bool doNotRevert = false; bool doNotRevert = false;
if (!result.stdOut.isEmpty()) if (!result.stdOut.isEmpty())
doNotRevert = (QMessageBox::warning(0, tr("p4 revert"), doNotRevert = (QMessageBox::warning(Core::ICore::dialogParent(), tr("p4 revert"),
tr("The file has been changed. Do you want to revert it?"), tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No); QMessageBox::Yes, QMessageBox::No) == QMessageBox::No);
if (doNotRevert) if (doNotRevert)
@@ -514,7 +514,7 @@ void PerforcePlugin::revertCurrentProject()
QTC_ASSERT(state.hasProject(), return); QTC_ASSERT(state.hasProject(), return);
const QString msg = tr("Do you want to revert all changes to the project \"%1\"?").arg(state.currentProjectName()); const QString msg = tr("Do you want to revert all changes to the project \"%1\"?").arg(state.currentProjectName());
if (QMessageBox::warning(0, tr("p4 revert"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) if (QMessageBox::warning(Core::ICore::dialogParent(), tr("p4 revert"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return; return;
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), false); revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), false);
} }
@@ -32,6 +32,7 @@
#include "session.h" #include "session.h"
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <QDebug> #include <QDebug>
@@ -114,7 +115,7 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
emit dataChanged(index, index); emit dataChanged(index, index);
return true; return true;
} else { } else {
QMessageBox::warning(0, QCoreApplication::translate("DependenciesModel", "Unable to Add Dependency"), QMessageBox::warning(Core::ICore::dialogParent(), QCoreApplication::translate("DependenciesModel", "Unable to Add Dependency"),
QCoreApplication::translate("DependenciesModel", "This would create a circular dependency.")); QCoreApplication::translate("DependenciesModel", "This would create a circular dependency."));
} }
} else if (c == Qt::Unchecked) { } else if (c == Qt::Unchecked) {
+2 -2
View File
@@ -395,7 +395,7 @@ bool SessionManager::save()
bool result = d->m_writer->save(data, Core::ICore::mainWindow()); bool result = d->m_writer->save(data, Core::ICore::mainWindow());
if (!result) { if (!result) {
QMessageBox::warning(0, tr("Error while saving session"), QMessageBox::warning(ICore::dialogParent(), tr("Error while saving session"),
tr("Could not save session to file %1").arg(d->m_writer->fileName().toUserOutput())); tr("Could not save session to file %1").arg(d->m_writer->fileName().toUserOutput()));
} }
@@ -864,7 +864,7 @@ bool SessionManager::loadSession(const QString &session)
PersistentSettingsReader reader; PersistentSettingsReader reader;
if (fileName.toFileInfo().exists()) { if (fileName.toFileInfo().exists()) {
if (!reader.load(fileName)) { if (!reader.load(fileName)) {
QMessageBox::warning(0, tr("Error while restoring session"), QMessageBox::warning(ICore::dialogParent(), tr("Error while restoring session"),
tr("Could not restore session %1").arg(fileName.toUserOutput())); tr("Could not restore session %1").arg(fileName.toUserOutput()));
return false; return false;
} }
@@ -34,6 +34,7 @@
#include "toolchainconfigwidget.h" #include "toolchainconfigwidget.h"
#include "toolchainmanager.h" #include "toolchainmanager.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
@@ -308,7 +309,7 @@ void ToolChainModel::apply()
qDeleteAll(m_toAddList); qDeleteAll(m_toAddList);
if (removedTcs.count() == 1) { if (removedTcs.count() == 1) {
QMessageBox::warning(0, QMessageBox::warning(Core::ICore::dialogParent(),
tr("Duplicate Compilers Detected"), tr("Duplicate Compilers Detected"),
tr("The following compiler was already configured:<br>" tr("The following compiler was already configured:<br>"
"&nbsp;%1<br>" "&nbsp;%1<br>"
@@ -316,7 +317,7 @@ void ToolChainModel::apply()
.arg(removedTcs.at(0))); .arg(removedTcs.at(0)));
} else if (!removedTcs.isEmpty()) { } else if (!removedTcs.isEmpty()) {
QMessageBox::warning(0, QMessageBox::warning(Core::ICore::dialogParent(),
tr("Duplicate Compilers Detected"), tr("Duplicate Compilers Detected"),
tr("The following compilers were already configured:<br>" tr("The following compilers were already configured:<br>"
"&nbsp;%1<br>" "&nbsp;%1<br>"
@@ -42,6 +42,7 @@
#include "wizards/html5app.h" #include "wizards/html5app.h"
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
@@ -101,7 +102,7 @@ void updateBoilerPlateCodeFiles(const AbstractMobileApp *app, const QString &pro
"outdated or have been modified:<br><br>%2<br><br>Do you want " "outdated or have been modified:<br><br>%2<br><br>Do you want "
"Qt Creator to update the files? Any changes will be lost.") "Qt Creator to update the files? Any changes will be lost.")
.arg(nativeProFile, fileNames.join(QLatin1String(", "))); .arg(nativeProFile, fileNames.join(QLatin1String(", ")));
if (QMessageBox::question(0, title, message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { if (QMessageBox::question(Core::ICore::dialogParent(), title, message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QString error; QString error;
if (!app->updateFiles(updates, error)) if (!app->updateFiles(updates, error))
QMessageBox::critical(0, title, error); QMessageBox::critical(0, title, error);
@@ -30,6 +30,8 @@
#include "modelnodeoperations.h" #include "modelnodeoperations.h"
#include "modelnodecontextmenu_helper.h" #include "modelnodecontextmenu_helper.h"
#include <coreplugin/icore.h>
#include <cmath> #include <cmath>
#include <QMessageBox> #include <QMessageBox>
#include <QByteArray> #include <QByteArray>
@@ -48,6 +50,11 @@ namespace QmlDesigner {
const PropertyName auxDataString("anchors_"); const PropertyName auxDataString("anchors_");
static void showError(const RewritingException &e)
{
QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
}
static inline QList<QmlItemNode> siblingsForNode(const QmlItemNode &itemNode) static inline QList<QmlItemNode> siblingsForNode(const QmlItemNode &itemNode)
{ {
QList<QmlItemNode> siblingList; QList<QmlItemNode> siblingList;
@@ -184,7 +191,7 @@ void toFront(const SelectionContext &selectionState)
node.setVariantProperty("z", maximumZ); node.setVariantProperty("z", maximumZ);
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -202,7 +209,7 @@ void toBack(const SelectionContext &selectionState)
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -222,7 +229,7 @@ void raise(const SelectionContext &selectionState)
} }
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -243,7 +250,7 @@ void lower(const SelectionContext &selectionState)
} }
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -267,7 +274,7 @@ void setVisible(const SelectionContext &selectionState)
try { try {
selectionState.selectedModelNodes().first().variantProperty("visible").setValue(selectionState.toggled()); selectionState.selectedModelNodes().first().variantProperty("visible").setValue(selectionState.toggled());
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -280,7 +287,7 @@ void setFillWidth(const SelectionContext &selectionState)
try { try {
selectionState.firstSelectedModelNode().variantProperty("Layout.fillWidth").setValue(selectionState.toggled()); selectionState.firstSelectedModelNode().variantProperty("Layout.fillWidth").setValue(selectionState.toggled());
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -293,7 +300,7 @@ void setFillHeight(const SelectionContext &selectionState)
try { try {
selectionState.firstSelectedModelNode().variantProperty("Layout.fillHeight").setValue(selectionState.toggled()); selectionState.firstSelectedModelNode().variantProperty("Layout.fillHeight").setValue(selectionState.toggled());
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -309,7 +316,7 @@ void resetSize(const SelectionContext &selectionState)
node.removeProperty("height"); node.removeProperty("height");
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -325,7 +332,7 @@ void resetPosition(const SelectionContext &selectionState)
node.removeProperty("y"); node.removeProperty("y");
} }
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -390,7 +397,7 @@ void anchorsFill(const SelectionContext &selectionState)
transaction.commit(); transaction.commit();
} catch (RewritingException &e) { //better save then sorry } catch (RewritingException &e) { //better save then sorry
QMessageBox::warning(0, "Error", e.description()); showError(e);
} }
} }
@@ -35,6 +35,8 @@
#include <metainfo.h> #include <metainfo.h>
#include <rewritingexception.h> #include <rewritingexception.h>
#include <coreplugin/icore.h>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QDebug> #include <QDebug>
#include <QMimeData> #include <QMimeData>
@@ -275,7 +277,7 @@ void DragTool::commitTransaction()
try { try {
m_rewriterTransaction.commit(); m_rewriterTransaction.commit();
} catch (RewritingException &e) { } catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -32,6 +32,8 @@
#include <rewritingexception.h> #include <rewritingexception.h>
#include <coreplugin/icore.h>
#include <QMessageBox> #include <QMessageBox>
namespace QmlDesigner { namespace QmlDesigner {
@@ -252,7 +254,7 @@ void ImportManagerView::removeImport(const Import &import)
model()->changeImports(QList<Import>(), QList<Import>() << import); model()->changeImports(QList<Import>(), QList<Import>() << import);
} }
catch (RewritingException &e) { catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -263,7 +265,7 @@ void ImportManagerView::addImport(const Import &import)
model()->changeImports(QList<Import>() << import, QList<Import>()); model()->changeImports(QList<Import>() << import, QList<Import>());
} }
catch (RewritingException &e) { catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -40,6 +40,7 @@
#include <viewmanager.h> #include <viewmanager.h>
#include <nodeinstanceview.h> #include <nodeinstanceview.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -365,7 +366,7 @@ void DesignDocument::deleteSelected()
} }
} catch (RewritingException &e) { } catch (RewritingException &e) {
QMessageBox::warning(0, tr("Error"), e.description()); QMessageBox::warning(Core::ICore::dialogParent(), tr("Error"), e.description());
} }
} }
@@ -41,6 +41,8 @@
#include <modelnodecontextmenu.h> #include <modelnodecontextmenu.h>
#include <qmlitemnode.h> #include <qmlitemnode.h>
#include <coreplugin/icore.h>
#include <QMimeData> #include <QMimeData>
#include <QMessageBox> #include <QMessageBox>
#include <QApplication> #include <QApplication>
@@ -326,7 +328,7 @@ void NavigatorTreeModel::handleChangedItem(QStandardItem *item)
try { try {
node.setId(item->text()); node.setId(item->text());
} catch (InvalidIdException &e) { //better save then sorry } catch (InvalidIdException &e) { //better save then sorry
QMessageBox::warning(0, tr("Invalid Id"), e.description()); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), e.description());
} }
} else { //there is already an id, so we refactor } else { //there is already an id, so we refactor
if (node.view()->rewriterView()) if (node.view()->rewriterView())
@@ -335,9 +337,9 @@ void NavigatorTreeModel::handleChangedItem(QStandardItem *item)
} else { } else {
if (!node.isValidId(item->text())) if (!node.isValidId(item->text()))
QMessageBox::warning(0, tr("Invalid Id"), tr("%1 is an invalid id.").arg(item->text())); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 is an invalid id.").arg(item->text()));
else else
QMessageBox::warning(0, tr("Invalid Id"), tr("%1 already exists.").arg(item->text())); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 already exists.").arg(item->text()));
bool blockSingals = blockItemChangedSignal(true); bool blockSingals = blockItemChangedSignal(true);
item->setText(node.id()); item->setText(node.id());
blockItemChangedSignal(blockSingals); blockItemChangedSignal(blockSingals);
@@ -535,7 +537,11 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert
continue; continue;
if (propertyNode.isValid()) { if (propertyNode.isValid()) {
QApplication::setOverrideCursor(Qt::ArrowCursor); QApplication::setOverrideCursor(Qt::ArrowCursor);
if (QMessageBox::warning(0, tr("Warning"), tr("Reparenting the component %1 here will cause the component %2 to be deleted. Do you want to proceed?").arg(node.id(), propertyNode.id()), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { if (QMessageBox::warning(Core::ICore::dialogParent(), tr("Warning"),
tr("Reparenting the component %1 here will cause the "
"component %2 to be deleted. Do you want to proceed?")
.arg(node.id(), propertyNode.id()),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
continue; continue;
} }
@@ -574,7 +580,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert
} }
} }
} catch (RewritingException &e) { //better safe than sorry! There always might be cases where we fail } catch (RewritingException &e) { //better safe than sorry! There always might be cases where we fail
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -45,6 +45,7 @@
#include <nodeabstractproperty.h> #include <nodeabstractproperty.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <coreplugin/icore.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <QCoreApplication> #include <QCoreApplication>
@@ -155,7 +156,7 @@ void PropertyEditorView::changeValue(const QString &name)
m_locked = true; m_locked = true;
value->setValue(m_selectedNode.id()); value->setValue(m_selectedNode.id());
m_locked = false; m_locked = false;
QMessageBox::warning(0, tr("Invalid Id"), e.description()); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), e.description());
} }
} else { //there is already an id, so we refactor } else { //there is already an id, so we refactor
if (rewriterView()) if (rewriterView())
@@ -166,9 +167,9 @@ void PropertyEditorView::changeValue(const QString &name)
value->setValue(m_selectedNode.id()); value->setValue(m_selectedNode.id());
m_locked = false; m_locked = false;
if (!m_selectedNode.isValidId(newId)) if (!m_selectedNode.isValidId(newId))
QMessageBox::warning(0, tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId)); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId));
else else
QMessageBox::warning(0, tr("Invalid Id"), tr("%1 already exists.").arg(newId)); QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 already exists.").arg(newId));
} }
return; return;
} }
@@ -226,7 +227,7 @@ void PropertyEditorView::changeValue(const QString &name)
} }
} }
catch (RewritingException &e) { catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -302,7 +303,7 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
} }
catch (RewritingException &e) { catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -37,6 +37,8 @@
#include <modelnode.h> #include <modelnode.h>
#include <variantproperty.h> #include <variantproperty.h>
#include <coreplugin/icore.h>
enum { enum {
debug = false debug = false
}; };
@@ -169,7 +171,7 @@ void StatesEditorModel::renameState(int nodeId, const QString &newName)
return; return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) { if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
QMessageBox::warning(0, tr("Invalid state name"), QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid state name"),
newName.isEmpty() ? newName.isEmpty() ?
tr("The empty string as a name is reserved for the base state.") : tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state")); tr("Name already used in another state"));
@@ -43,6 +43,9 @@
#include <qmlitemnode.h> #include <qmlitemnode.h>
#include <coreplugin/icore.h>
namespace QmlDesigner { namespace QmlDesigner {
/** /**
@@ -158,7 +161,7 @@ void StatesEditorView::removeState(int nodeId)
stateNode.destroy(); stateNode.destroy();
} }
} catch (RewritingException &e) { } catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -209,7 +212,7 @@ void StatesEditorView::addState()
ModelNode newState = rootStateGroup().addState(newStateName); ModelNode newState = rootStateGroup().addState(newStateName);
setCurrentState(newState); setCurrentState(newState);
} catch (RewritingException &e) { } catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
@@ -304,7 +307,7 @@ void StatesEditorView::renameState(int nodeId, const QString &newName)
setCurrentState(oldState); setCurrentState(oldState);
} }
} catch (RewritingException &e) { } catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
} }
} }
@@ -73,6 +73,7 @@
#include "qmldesignerplugin.h" #include "qmldesignerplugin.h"
#include <coreplugin/icore.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <QMessageBox> #include <QMessageBox>
@@ -262,7 +263,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
} }
} else { } else {
QMessageBox::warning(0, tr("Cannot Start QML Puppet Executable"), QMessageBox::warning(Core::ICore::dialogParent(),
tr("Cannot Start QML Puppet Executable"),
tr("The executable of the QML Puppet process (%1) cannot be started. " tr("The executable of the QML Puppet process (%1) cannot be started. "
"Please check your installation. " "Please check your installation. "
"QML Puppet is a process which runs in the background to render the items."). "QML Puppet is a process which runs in the background to render the items.").
@@ -274,11 +276,15 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
m_localServer->close(); m_localServer->close();
} else { } else {
QMessageBox::warning(0, tr("Wrong QML Puppet Executable Version"), tr("The QML Puppet version is incompatible with the Qt Creator version.")); QMessageBox::warning(Core::ICore::dialogParent(),
tr("Wrong QML Puppet Executable Version"),
tr("The QML Puppet version is incompatible with the Qt Creator version."));
QmlDesignerPlugin::instance()->switchToTextModeDeferred(); QmlDesignerPlugin::instance()->switchToTextModeDeferred();
} }
} else { } else {
QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"), missingQmlPuppetErrorMessage(applicationPath)); QMessageBox::warning(Core::ICore::dialogParent(),
tr("Cannot Find QML Puppet Executable"),
missingQmlPuppetErrorMessage(applicationPath));
QmlDesignerPlugin::instance()->switchToTextModeDeferred(); QmlDesignerPlugin::instance()->switchToTextModeDeferred();
} }
@@ -433,8 +439,9 @@ void NodeInstanceServerProxy::processFinished(int /*exitCode*/, QProcess::ExitSt
if (m_captureFileForTest.isOpen()) { if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close(); m_captureFileForTest.close();
m_captureFileForTest.remove(); m_captureFileForTest.remove();
QMessageBox::warning(0, tr("QML Puppet Crashed"), tr("You are recording a puppet stream and the puppet crashed. " QMessageBox::warning(Core::ICore::dialogParent(), tr("QML Puppet Crashed"),
"It is recommended to reopen the Qt Quick Designer and start again.")); tr("You are recording a puppet stream and the puppet crashed. "
"It is recommended to reopen the Qt Quick Designer and start again."));
} }
@@ -42,6 +42,8 @@
#include "modelmerger.h" #include "modelmerger.h"
#include "rewritingexception.h" #include "rewritingexception.h"
#include <coreplugin/icore.h>
#include <QMessageBox> #include <QMessageBox>
#include <QUrl> #include <QUrl>
#include <QPlainTextEdit> #include <QPlainTextEdit>
@@ -174,7 +176,7 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary
Q_ASSERT(newQmlItemNode.isValid()); Q_ASSERT(newQmlItemNode.isValid());
} }
catch (RewritingException &e) { catch (RewritingException &e) {
QMessageBox::warning(0, "Error", e.description()); QMessageBox::warning(Core::ICore::dialogParent(), "Error", e.description());
} }
Q_ASSERT(newQmlItemNode.isValid()); Q_ASSERT(newQmlItemNode.isValid());
@@ -29,6 +29,8 @@
#include "qmljspreviewrunner.h" #include "qmljspreviewrunner.h"
#include <coreplugin/icore.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -71,7 +73,7 @@ void QmlJSPreviewRunner::run(const QString &filename)
} }
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
QMessageBox::warning(0, tr("Failed to preview Qt Quick file"), QMessageBox::warning(Core::ICore::dialogParent(), tr("Failed to preview Qt Quick file"),
tr("Could not preview Qt Quick (QML) file. Reason:\n%1").arg(errorMessage)); tr("Could not preview Qt Quick (QML) file. Reason:\n%1").arg(errorMessage));
} }
+6 -3
View File
@@ -564,7 +564,8 @@ void SubversionPlugin::revertAll()
const VcsBase::VcsBasePluginState state = currentState(); const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
const QString title = tr("Revert repository"); const QString title = tr("Revert repository");
if (QMessageBox::warning(0, title, tr("Revert all pending changes to the repository?"), if (QMessageBox::warning(Core::ICore::dialogParent(), title,
tr("Revert all pending changes to the repository?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return; return;
// NoteL: Svn "revert ." doesn not work. // NoteL: Svn "revert ." doesn not work.
@@ -574,7 +575,8 @@ void SubversionPlugin::revertAll()
runSvn(state.topLevel(), args, m_settings.timeOutMs(), runSvn(state.topLevel(), args, m_settings.timeOutMs(),
SshPasswordPrompt|ShowStdOutInLogWindow); SshPasswordPrompt|ShowStdOutInLogWindow);
if (revertResponse.error) if (revertResponse.error)
QMessageBox::warning(0, title, tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok); QMessageBox::warning(Core::ICore::dialogParent(), title,
tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok);
else else
subVersionControl()->emitRepositoryChanged(state.topLevel()); subVersionControl()->emitRepositoryChanged(state.topLevel());
} }
@@ -594,7 +596,8 @@ void SubversionPlugin::revertCurrentFile()
if (diffResponse.stdOut.isEmpty()) if (diffResponse.stdOut.isEmpty())
return; return;
if (QMessageBox::warning(0, QLatin1String("svn revert"), tr("The file has been changed. Do you want to revert it?"), if (QMessageBox::warning(Core::ICore::dialogParent(), QLatin1String("svn revert"),
tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return; return;
+1 -1
View File
@@ -632,7 +632,7 @@ void VcsBasePlugin::promptToDeleteCurrentFile()
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
const bool rc = Core::VcsManager::promptToDelete(versionControl(), state.currentFile()); const bool rc = Core::VcsManager::promptToDelete(versionControl(), state.currentFile());
if (!rc) if (!rc)
QMessageBox::warning(0, tr("Version Control"), QMessageBox::warning(Core::ICore::dialogParent(), tr("Version Control"),
tr("The file '%1' could not be deleted."). tr("The file '%1' could not be deleted.").
arg(QDir::toNativeSeparators(state.currentFile())), arg(QDir::toNativeSeparators(state.currentFile())),
QMessageBox::Ok); QMessageBox::Ok);