summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-09-27 12:14:59 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-09-30 10:49:48 +0200
commit7a5aa97c9bb4a558ae344ca615ce5ed9642388a4 (patch)
treec40b1211b0619b32fbc75f1968dfbb9e39498b43
parenta25620f52693e086b54c09518d4b7a0cab412da1 (diff)
remove slotCurrentPageChanged and call it directly
- also renamed it to better name: executeControlScript Change-Id: Id2bb7cada2386561c2b25b158c6aa101382e5cc4 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
-rw-r--r--src/libs/installer/packagemanagergui.cpp12
-rw-r--r--src/libs/installer/packagemanagergui.h3
-rw-r--r--tests/auto/installer/scriptengine/tst_scriptengine.cpp12
3 files changed, 9 insertions, 18 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index cececaef4..338e8fad9 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -254,7 +254,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent)
connect(m_core, SIGNAL(installationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection);
connect(m_core, SIGNAL(uninstallationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection);
- connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentPageChanged(int)));
+ connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(executeControlScript(int)));
connect(this, SIGNAL(currentIdChanged(int)), m_core, SIGNAL(currentPageChanged(int)));
connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SIGNAL(finishButtonClicked()));
connect(button(QWizard::FinishButton), SIGNAL(clicked()), m_core, SIGNAL(finishButtonClicked()));
@@ -359,12 +359,6 @@ void PackageManagerGui::loadControlScript(const QString &scriptPath)
qDebug() << "Loaded control script" << scriptPath;
}
-void PackageManagerGui::slotCurrentPageChanged(int id)
-{
- QMetaObject::invokeMethod(this, "delayedControlScriptExecution", Qt::QueuedConnection,
- Q_ARG(int, id));
-}
-
void PackageManagerGui::callControlScriptMethod(const QString &methodName)
{
if (!d->m_controlScriptContext.isValid())
@@ -382,9 +376,9 @@ void PackageManagerGui::callControlScriptMethod(const QString &methodName)
}
}
-void PackageManagerGui::delayedControlScriptExecution(int id)
+void PackageManagerGui::executeControlScript(int pageId)
{
- if (PackageManagerPage *const p = qobject_cast<PackageManagerPage*> (page(id)))
+ if (PackageManagerPage *const p = qobject_cast<PackageManagerPage*> (page(pageId)))
callControlScriptMethod(p->objectName() + QLatin1String("Callback"));
}
diff --git a/src/libs/installer/packagemanagergui.h b/src/libs/installer/packagemanagergui.h
index 5c428bf87..4f58a077d 100644
--- a/src/libs/installer/packagemanagergui.h
+++ b/src/libs/installer/packagemanagergui.h
@@ -116,8 +116,7 @@ protected Q_SLOTS:
void wizardWidgetInsertionRequested(QWidget *widget, QInstaller::PackageManagerCore::WizardPage page);
void wizardWidgetRemovalRequested(QWidget *widget);
void wizardPageVisibilityChangeRequested(bool visible, int page);
- void slotCurrentPageChanged(int id);
- void delayedControlScriptExecution(int id);
+ void executeControlScript(int pageId);
void setValidatorForCustomPageRequested(QInstaller::Component *component, const QString &name,
const QString &callbackName);
diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
index 283d7bdad..b626d5a2e 100644
--- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp
+++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
@@ -26,9 +26,9 @@ public:
virtual void init() {}
- void callProtectedDelayedControlScriptExecution(int id)
+ void callProtectedDelayedExecuteControlScript(int id)
{
- delayedControlScriptExecution(id);
+ executeControlScript(id);
}
};
@@ -218,18 +218,16 @@ private slots:
testGui.loadControlScript(":///data/auto-install.qs");
QCOMPARE(m_core.value("GuiTestValue"), QString("hello"));
- testGui.show();
// show event calls automatically the first callback which does not exist
setExpectedScriptOutput("Control script callback \"IntroductionPageCallback\" does not exist. ");
- // give some time to the event triggering mechanism
- qApp->processEvents();
+ testGui.show();
// inside the auto-install script we are clicking the next button, with a not existing button
QTest::ignoreMessage(QtWarningMsg, "Button with type: \"unknown button\" not found! ");
- testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::ComponentSelection);
+ testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::ComponentSelection);
setExpectedScriptOutput("FinishedPageCallback - OK");
- testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::InstallationFinished);
+ testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::InstallationFinished);
} catch (const Error &error) {
QFAIL(qPrintable(error.message()));
}