summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-01-12 16:34:53 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-02-04 09:13:37 +0200
commit2665bbe56e22ca71beb686d985d9859da72cbac2 (patch)
tree4e14a6149ad15693d650c619c8680af47c0aac62
parent6f8b0581c9ee373b9b75a0e0879527b9efe013b8 (diff)
Add support for setting minimum wizard dimensions in config.xml
Task-number: QTIFW-1903 Change-Id: I4d8eaf71a1a63dfbfa75ea61af728fa1f5e3e9f3 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--doc/installerfw.qdoc8
-rw-r--r--src/libs/installer/constants.h2
-rw-r--r--src/libs/installer/packagemanagergui.cpp11
-rw-r--r--src/libs/installer/settings.cpp13
-rw-r--r--src/libs/installer/settings.h2
-rw-r--r--tests/auto/installer/settings/data/length_units_invalid.xml2
-rw-r--r--tests/auto/installer/settings/data/length_units_valid_em.xml2
-rw-r--r--tests/auto/installer/settings/data/length_units_valid_ex.xml2
-rw-r--r--tests/auto/installer/settings/data/length_units_valid_px.xml2
-rw-r--r--tests/auto/installer/settings/tst_settings.cpp6
10 files changed, 48 insertions, 2 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index ef7479a33..38dac805d 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -431,6 +431,14 @@
override this. You can add the \c em or \c ex suffix to the specified value to
use the \e em or \e ex unit, as in a CSS file.
\row
+ \li WizardMinimumWidth
+ \li Sets the minimum width of the wizard in pixels. You can add the \c em or \c ex
+ suffix to the specified value to use the \e em or \e ex unit, as in a CSS file.
+ \row
+ \li WizardMinimumHeight
+ \li Sets the minimum height of the wizard in pixels. You can add the \c em or \c ex
+ suffix to the specified value to use the \e em or \e ex unit, as in a CSS file.
+ \row
\li WizardShowPageList
\li Set to \c false if the widget listing installer pages on the left side of the
wizard should not be shown. Defaults to \c true. If visible, this widget hides
diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h
index 304efb772..feee73fad 100644
--- a/src/libs/installer/constants.h
+++ b/src/libs/installer/constants.h
@@ -93,6 +93,8 @@ static const QLatin1String scStyleSheet("StyleSheet");
static const QLatin1String scTitleColor("TitleColor");
static const QLatin1String scWizardDefaultWidth("WizardDefaultWidth");
static const QLatin1String scWizardDefaultHeight("WizardDefaultHeight");
+static const QLatin1String scWizardMinimumWidth("WizardMinimumWidth");
+static const QLatin1String scWizardMinimumHeight("WizardMinimumHeight");
static const QLatin1String scWizardShowPageList("WizardShowPageList");
static const QLatin1String scProductImages("ProductImages");
static const QLatin1String scUrlQueryString("UrlQueryString");
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index c33d9bb3b..beb8603a4 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -743,7 +743,16 @@ void PackageManagerGui::showEvent(QShowEvent *event)
}
}
}
- setMinimumSize(size());
+ QSize minimumSize;
+ minimumSize.setWidth(m_core->settings().wizardMinimumWidth()
+ ? m_core->settings().wizardMinimumWidth()
+ : width());
+
+ minimumSize.setHeight(m_core->settings().wizardMinimumHeight()
+ ? m_core->settings().wizardMinimumHeight()
+ : height());
+
+ setMinimumSize(minimumSize);
if (minimumWidth() < m_core->settings().wizardDefaultWidth())
resize(m_core->settings().wizardDefaultWidth(), height());
if (minimumHeight() < m_core->settings().wizardDefaultHeight())
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp
index 7c1400aed..7273080f9 100644
--- a/src/libs/installer/settings.cpp
+++ b/src/libs/installer/settings.cpp
@@ -299,7 +299,8 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix,
<< scAllowSpaceInPath << scAllowNonAsciiCharacters << scDisableAuthorizationFallback
<< scDisableCommandLineInterface
<< scWizardStyle << scStyleSheet << scTitleColor
- << scWizardDefaultWidth << scWizardDefaultHeight << scWizardShowPageList << scProductImages
+ << scWizardDefaultWidth << scWizardDefaultHeight << scWizardMinimumWidth << scWizardMinimumHeight
+ << scWizardShowPageList << scProductImages
<< scRepositorySettingsPageVisible << scTargetConfigurationFile
<< scRemoteRepositories << scTranslations << scUrlQueryString << QLatin1String(scControlScript)
<< scCreateLocalRepository << scInstallActionColumnVisible << scSupportsModify << scAllowUnstableComponents
@@ -481,6 +482,16 @@ int Settings::wizardDefaultHeight() const
return lengthToInt(d->m_data.value(scWizardDefaultHeight));
}
+int Settings::wizardMinimumWidth() const
+{
+ return lengthToInt(d->m_data.value(scWizardMinimumWidth));
+}
+
+int Settings::wizardMinimumHeight() const
+{
+ return lengthToInt(d->m_data.value(scWizardMinimumHeight));
+}
+
bool Settings::wizardShowPageList() const
{
return d->m_data.value(scWizardShowPageList, true).toBool();
diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h
index 4227ae957..68a1592ff 100644
--- a/src/libs/installer/settings.h
+++ b/src/libs/installer/settings.h
@@ -89,6 +89,8 @@ public:
QString titleColor() const;
int wizardDefaultWidth() const;
int wizardDefaultHeight() const;
+ int wizardMinimumWidth() const;
+ int wizardMinimumHeight() const;
bool wizardShowPageList() const;
QStringList productImages() const;
void setProductImages(const QStringList &images);
diff --git a/tests/auto/installer/settings/data/length_units_invalid.xml b/tests/auto/installer/settings/data/length_units_invalid.xml
index b1dc5aa62..7c5e99dd0 100644
--- a/tests/auto/installer/settings/data/length_units_invalid.xml
+++ b/tests/auto/installer/settings/data/length_units_invalid.xml
@@ -4,4 +4,6 @@
<Version>1.2.3</Version>
<WizardDefaultWidth>800pt</WizardDefaultWidth>
<WizardDefaultHeight>600pt</WizardDefaultHeight>
+ <WizardMinimumWidth>640pt</WizardMinimumWidth>
+ <WizardMinimumHeight>480pt</WizardMinimumHeight>
</Installer>
diff --git a/tests/auto/installer/settings/data/length_units_valid_em.xml b/tests/auto/installer/settings/data/length_units_valid_em.xml
index af087fdfe..81eec5af7 100644
--- a/tests/auto/installer/settings/data/length_units_valid_em.xml
+++ b/tests/auto/installer/settings/data/length_units_valid_em.xml
@@ -4,4 +4,6 @@
<Version>1.2.3</Version>
<WizardDefaultWidth>800em</WizardDefaultWidth>
<WizardDefaultHeight>600em</WizardDefaultHeight>
+ <WizardMinimumWidth>640em</WizardMinimumWidth>
+ <WizardMinimumHeight>480em</WizardMinimumHeight>
</Installer>
diff --git a/tests/auto/installer/settings/data/length_units_valid_ex.xml b/tests/auto/installer/settings/data/length_units_valid_ex.xml
index 3b39cf7a7..633a239ef 100644
--- a/tests/auto/installer/settings/data/length_units_valid_ex.xml
+++ b/tests/auto/installer/settings/data/length_units_valid_ex.xml
@@ -4,4 +4,6 @@
<Version>1.2.3</Version>
<WizardDefaultWidth>800ex</WizardDefaultWidth>
<WizardDefaultHeight>600ex</WizardDefaultHeight>
+ <WizardMinimumWidth>640ex</WizardMinimumWidth>
+ <WizardMinimumHeight>480ex</WizardMinimumHeight>
</Installer>
diff --git a/tests/auto/installer/settings/data/length_units_valid_px.xml b/tests/auto/installer/settings/data/length_units_valid_px.xml
index 3553dd7d8..71518a71c 100644
--- a/tests/auto/installer/settings/data/length_units_valid_px.xml
+++ b/tests/auto/installer/settings/data/length_units_valid_px.xml
@@ -4,4 +4,6 @@
<Version>1.2.3</Version>
<WizardDefaultWidth>800px</WizardDefaultWidth>
<WizardDefaultHeight>600px</WizardDefaultHeight>
+ <WizardMinimumWidth>640px</WizardMinimumWidth>
+ <WizardMinimumHeight>480px</WizardMinimumHeight>
</Installer>
diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp
index 945f08e78..f8aa00528 100644
--- a/tests/auto/installer/settings/tst_settings.cpp
+++ b/tests/auto/installer/settings/tst_settings.cpp
@@ -90,6 +90,8 @@ void tst_Settings::loadTutorialConfig()
QCOMPARE(settings.wizardStyle(), QString());
QCOMPARE(settings.wizardDefaultWidth(), settings.wizardShowPageList() ? 800 : 0);
QCOMPARE(settings.wizardDefaultHeight(), 0);
+ QCOMPARE(settings.wizardMinimumWidth(), 0);
+ QCOMPARE(settings.wizardMinimumHeight(), 0);
QCOMPARE(settings.wizardShowPageList(), true);
QCOMPARE(settings.productImages(), QStringList());
QCOMPARE(settings.titleColor(), QString());
@@ -244,6 +246,8 @@ void tst_Settings::loadConfigWithValidLengthUnits()
Settings settings = Settings::fromFileAndPrefix(":///data/length_units_valid_px.xml", ":///data");
QCOMPARE(settings.wizardDefaultWidth(), 800);
QCOMPARE(settings.wizardDefaultHeight(), 600);
+ QCOMPARE(settings.wizardMinimumWidth(), 640);
+ QCOMPARE(settings.wizardMinimumHeight(), 480);
// Cannot test the parsed values for these units portably since the
// pixel value depends on the font metrics. Let's just check for parse
@@ -261,6 +265,8 @@ void tst_Settings::loadConfigWithInvalidLengthUnits()
Settings settings = Settings::fromFileAndPrefix(":///data/length_units_invalid.xml", ":///data");
QCOMPARE(settings.wizardDefaultWidth(), 0);
QCOMPARE(settings.wizardDefaultHeight(), 0);
+ QCOMPARE(settings.wizardMinimumWidth(), 0);
+ QCOMPARE(settings.wizardMinimumHeight(), 0);
} catch (const Error &error) {
QFAIL(qPrintable(QString::fromLatin1("Exception caught: %1").arg(error.message())));
}