diff options
author | Christoph VogtlÃĪnder <c.vogtlaender@sigma-surface-science.com> | 2015-03-10 15:08:10 +0100 |
---|---|---|
committer | Niels Weber <niels.weber@theqtcompany.com> | 2015-07-17 09:40:58 +0000 |
commit | ca59912053e6a1ed6b96c5d11bb6d4531973544f (patch) | |
tree | f1976093af39eef6f6529f47e18effa568b8b179 /src/libs/installer | |
parent | 5a635073b45da1a3e82d27d1b29f099966ace81c (diff) |
add silent mode
Add possibility to run silently without a gui. Silent mode can be
enabled in a controller script using gui.setSilent(true).
Change-Id: I5c5d0cc2be734e8e447edfe4e71106fe08f87188
Task-number: QTIFW-166
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 19 | ||||
-rw-r--r-- | src/libs/installer/packagemanagergui.h | 3 | ||||
-rw-r--r-- | src/libs/installer/scriptengine.cpp | 9 | ||||
-rw-r--r-- | src/libs/installer/scriptengine_p.h | 2 |
4 files changed, 33 insertions, 0 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 22092cfdd..85bf4e1f0 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -208,6 +208,7 @@ public: , m_modified(false) , m_autoSwitchPage(true) , m_showSettingsButton(false) + , m_silent(false) { m_wizardButtonTypes.insert(QWizard::BackButton, QLatin1String("QWizard::BackButton")); m_wizardButtonTypes.insert(QWizard::NextButton, QLatin1String("QWizard::NextButton")); @@ -231,6 +232,7 @@ public: bool m_modified; bool m_autoSwitchPage; bool m_showSettingsButton; + bool m_silent; QHash<int, QWizardPage*> m_defaultPages; QHash<int, QString> m_defaultButtonText; @@ -405,6 +407,23 @@ QWizard::WizardStyle PackageManagerGui::getStyle(const QString &name) } /*! + Hides the GUI when \a silent is \c true. +*/ +void PackageManagerGui::setSilent(bool silent) +{ + d->m_silent = silent; + setVisible(!silent); +} + +/*! + Returns the current silent state. +*/ +bool PackageManagerGui::isSilent() const +{ + return d->m_silent; +} + +/*! Enables automatic page switching when \a request is \c true. */ void PackageManagerGui::setAutomatedPageSwitchEnabled(bool request) diff --git a/src/libs/installer/packagemanagergui.h b/src/libs/installer/packagemanagergui.h index 7956075c5..63012c334 100644 --- a/src/libs/installer/packagemanagergui.h +++ b/src/libs/installer/packagemanagergui.h @@ -93,6 +93,9 @@ public: void updateButtonLayout(); static QWizard::WizardStyle getStyle(const QString &name); + void setSilent(bool silent); + bool isSilent() const; + Q_SIGNALS: void interrupted(); void languageChanged(); diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp index eebfdf214..0397307b9 100644 --- a/src/libs/installer/scriptengine.cpp +++ b/src/libs/installer/scriptengine.cpp @@ -204,6 +204,15 @@ QList<QJSValue> GuiProxy::findChildren(QObject *parent, const QString &objectNam return children; } +/*! + Hides the GUI when \a silent is \c true. +*/ +void GuiProxy::setSilent(bool silent) +{ + if (m_gui) + m_gui->setSilent(silent); +} + void GuiProxy::cancelButtonClicked() { if (m_gui) diff --git a/src/libs/installer/scriptengine_p.h b/src/libs/installer/scriptengine_p.h index e1ff08b87..3998f5bbd 100644 --- a/src/libs/installer/scriptengine_p.h +++ b/src/libs/installer/scriptengine_p.h @@ -159,6 +159,8 @@ public: Q_INVOKABLE QJSValue findChild(QObject *parent, const QString &objectName); Q_INVOKABLE QList<QJSValue> findChildren(QObject *parent, const QString &objectName); + Q_INVOKABLE void setSilent(bool silent); + signals: void interrupted(); void languageChanged(); |