QMakeStep: Allow UI to update when asking user whether to recompile

Makes sure that the warning about security implications are visible
before the user answers whether to recompile.

Task-number: QTCREATORBUG-5411
Change-Id: I43fe6aeb9e24d25be4fb51f356b6238ce0cd3924
Reviewed-on: http://codereview.qt.nokia.com/1832
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Kai Koehne
2011-07-19 16:03:42 +02:00
parent bbe5405a4b
commit a2c612c170
2 changed files with 26 additions and 12 deletions

View File

@@ -49,6 +49,7 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/mainwindow.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
@@ -417,18 +418,14 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged(); qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
qt4BuildConfiguration()->emitProFileEvaluateNeeded(); qt4BuildConfiguration()->emitProFileEvaluateNeeded();
int button = QMessageBox::question(QApplication::activeWindow(), tr("QML Debugging"), Core::ICore * const core = Core::ICore::instance();
tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"), QMessageBox *question = new QMessageBox(core->mainWindow());
QMessageBox::Yes, QMessageBox::No); question->setWindowTitle(tr("QML Debugging"));
question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
if (button == QMessageBox::Yes) { question->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
Qt4BuildConfiguration *bc = qt4BuildConfiguration(); question->setModal(true);
connect(question, SIGNAL(finished(int)), this, SLOT(recompileMessageBoxFinished(int)));
QList<ProjectExplorer::BuildStepList *> stepLists; question->show();
stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorerPlugin::instance()->buildManager()->buildLists(stepLists);
}
} }
QStringList QMakeStep::parserArguments() QStringList QMakeStep::parserArguments()
@@ -491,6 +488,20 @@ bool QMakeStep::fromMap(const QVariantMap &map)
return BuildStep::fromMap(map); return BuildStep::fromMap(map);
} }
void QMakeStep::recompileMessageBoxFinished(int button)
{
if (button == QMessageBox::Yes) {
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
if (!bc)
return;
QList<ProjectExplorer::BuildStepList *> stepLists;
stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
stepLists << bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
ProjectExplorerPlugin::instance()->buildManager()->buildLists(stepLists);
}
}
//// ////
// QMakeStepConfigWidget // QMakeStepConfigWidget
//// ////

View File

@@ -115,6 +115,9 @@ signals:
void userArgumentsChanged(); void userArgumentsChanged();
void linkQmlDebuggingLibraryChanged(); void linkQmlDebuggingLibraryChanged();
private slots:
void recompileMessageBoxFinished(int button);
protected: protected:
QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source); QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
QMakeStep(ProjectExplorer::BuildStepList *parent, const QString &id); QMakeStep(ProjectExplorer::BuildStepList *parent, const QString &id);