diff options
-rw-r--r-- | doc/installerfw.qdoc | 3 | ||||
-rw-r--r-- | examples/doc/images/qtifw-examples-stylesheet.png | bin | 0 -> 14796 bytes | |||
-rw-r--r-- | examples/doc/stylesheet.qdoc | 51 | ||||
-rw-r--r-- | examples/examples.pro | 3 | ||||
-rw-r--r-- | examples/stylesheet/README | 6 | ||||
-rw-r--r-- | examples/stylesheet/config/config.xml | 12 | ||||
-rw-r--r-- | examples/stylesheet/config/style.qss | 25 | ||||
-rw-r--r-- | examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs | 39 | ||||
-rw-r--r-- | examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml | 8 | ||||
-rw-r--r-- | examples/stylesheet/stylesheet.pro | 13 | ||||
-rw-r--r-- | src/libs/installer/constants.h | 1 | ||||
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 13 | ||||
-rw-r--r-- | src/libs/installer/settings.cpp | 7 | ||||
-rw-r--r-- | src/libs/installer/settings.h | 1 |
14 files changed, 180 insertions, 2 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index f648afa23..3b33b77a4 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -217,6 +217,9 @@ \li WizardStyle \li Set the wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). \row + \li StyleSheet + \li Set the stylesheet file. + \row \li WizardDefaultWidth \li Sets the default width of the wizard in pixels. Setting a banner image will override this. diff --git a/examples/doc/images/qtifw-examples-stylesheet.png b/examples/doc/images/qtifw-examples-stylesheet.png Binary files differnew file mode 100644 index 000000000..eaa42b8b8 --- /dev/null +++ b/examples/doc/images/qtifw-examples-stylesheet.png diff --git a/examples/doc/stylesheet.qdoc b/examples/doc/stylesheet.qdoc new file mode 100644 index 000000000..cc408df33 --- /dev/null +++ b/examples/doc/stylesheet.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example stylesheet + \ingroup qtifwexamples + \title Stylesheet Example + + \brief Using a stylesheet to customize a UI. + + \image qtifw-examples-stylesheet.png + + \e {Stylesheet} demonstrates how to use a stylesheet to customize + a wizard UI. + + \include installerfw-examples-configuring.qdocinc + + \list + \li The \c <WizardStyle> element sets the wizard style to be used. + \li The \c <StyleSheet> element sets the stylesheet file. + \li The \c <TitleColor> element sets the color of the titles and subtitles. + \endlist + + \quotefile stylesheet/config/config.xml + + \include installerfw-examples-generating.qdocinc +*/ diff --git a/examples/examples.pro b/examples/examples.pro index 92a976ff2..377632b9c 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -12,4 +12,5 @@ SUBDIRS += \ quitinstaller \ registerfileextension \ startmenu \ - systeminfo + systeminfo \ + stylesheet diff --git a/examples/stylesheet/README b/examples/stylesheet/README new file mode 100644 index 000000000..ee0d445db --- /dev/null +++ b/examples/stylesheet/README @@ -0,0 +1,6 @@ +Shows how to customize a UI using stylesheet. + +Generate installer with + +binarycreator --offline-only -c config/config.xml -p packages installer + diff --git a/examples/stylesheet/config/config.xml b/examples/stylesheet/config/config.xml new file mode 100644 index 000000000..3cd8e6060 --- /dev/null +++ b/examples/stylesheet/config/config.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Installer> + <Name>Stylesheet Example</Name> + <Version>1.0.0</Version> + <Title>Stylesheet Example</Title> + <Publisher>Qt-Project</Publisher> + <StartMenuDir>Qt IFW Examples</StartMenuDir> + <TargetDir>@HomeDir@/IfwExamples/stylesheet</TargetDir> + <WizardStyle>Classic</WizardStyle> + <StyleSheet>style.qss</StyleSheet> + <TitleColor>#FFFFFF</TitleColor> +</Installer> diff --git a/examples/stylesheet/config/style.qss b/examples/stylesheet/config/style.qss new file mode 100644 index 000000000..8d4f75d65 --- /dev/null +++ b/examples/stylesheet/config/style.qss @@ -0,0 +1,25 @@ +QWidget +{ + color: white; + background-color: rgb(65, 65, 65); +} + +QPushButton +{ + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(150, 150, 150, 60%), stop:1 rgba(50, 50, 50, 60%)); + border-color: rgb(60, 60, 60); + border-style: solid; + border-width: 2px; + border-radius: 9px; + min-height: 20px; + max-height: 20px; + min-width: 60px; + max-width: 60px; + padding-left: 15px; + padding-right: 15px; +} + +QPushButton:pressed, QPushButton:checked +{ + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(50, 50, 50, 60%), stop:1 rgba(150, 150, 150, 60%)); +} diff --git a/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs new file mode 100644 index 000000000..e99733ff3 --- /dev/null +++ b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/installscript.qs @@ -0,0 +1,39 @@ +/************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +function Component() +{ + // constructor + installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); +} diff --git a/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml new file mode 100644 index 000000000..c0698a4e4 --- /dev/null +++ b/examples/stylesheet/packages/org.qtproject.ifw.example.stylesheet/meta/package.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Package> + <DisplayName>Dummy</DisplayName> + <ReleaseDate>2015-09-09</ReleaseDate> + <Version>1.0.1</Version> + <Default>true</Default> + <Script>installscript.qs</Script> +</Package> diff --git a/examples/stylesheet/stylesheet.pro b/examples/stylesheet/stylesheet.pro new file mode 100644 index 000000000..415df49d5 --- /dev/null +++ b/examples/stylesheet/stylesheet.pro @@ -0,0 +1,13 @@ +TEMPLATE = aux + +INSTALLER = installer + +INPUT = $$PWD/config/config.xml $$PWD/packages +example.input = INPUT +example.output = $$INSTALLER +example.commands = ../../bin/binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT} +example.CONFIG += target_predeps no_link combine + +QMAKE_EXTRA_COMPILERS += example + +OTHER_FILES = README diff --git a/src/libs/installer/constants.h b/src/libs/installer/constants.h index df31a2cd8..ea6d1334c 100644 --- a/src/libs/installer/constants.h +++ b/src/libs/installer/constants.h @@ -84,6 +84,7 @@ static const QLatin1String scAllowNonAsciiCharacters("AllowNonAsciiCharacters"); static const QLatin1String scRepositorySettingsPageVisible("RepositorySettingsPageVisible"); static const QLatin1String scAllowSpaceInPath("AllowSpaceInPath"); static const QLatin1String scWizardStyle("WizardStyle"); +static const QLatin1String scStyleSheet("StyleSheet"); static const QLatin1String scTitleColor("TitleColor"); static const QLatin1String scWizardDefaultWidth("WizardDefaultWidth"); static const QLatin1String scWizardDefaultHeight("WizardDefaultHeight"); diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 85bf4e1f0..df1a008ba 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -318,6 +318,19 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) if (!m_core->settings().wizardStyle().isEmpty()) setWizardStyle(getStyle(m_core->settings().wizardStyle())); + // set custom stylesheet + const QString styleSheetFile = m_core->settings().styleSheet(); + if (!styleSheetFile.isEmpty() + && QFileInfo::exists(styleSheetFile)) { + QFile sheet(styleSheetFile); + if (sheet.open(QIODevice::ReadOnly)) + setStyleSheet(QString::fromLatin1(sheet.readAll())); + else + qWarning() << "The specified style sheet file can not be opened."; + } else { + qWarning() << "A style sheet file is specified, but it does not exist."; + } + setOption(QWizard::NoBackButtonOnStartPage); setOption(QWizard::NoBackButtonOnLastPage); diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp index 94adbf8af..9d9eb9574 100644 --- a/src/libs/installer/settings.cpp +++ b/src/libs/installer/settings.cpp @@ -255,7 +255,7 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, << scStartMenuDir << scMaintenanceToolName << scMaintenanceToolIniFile << scRemoveTargetDir << scRunProgram << scRunProgramArguments << scRunProgramDescription << scDependsOnLocalInstallerBinary - << scAllowSpaceInPath << scAllowNonAsciiCharacters << scWizardStyle << scTitleColor + << scAllowSpaceInPath << scAllowNonAsciiCharacters << scWizardStyle << scStyleSheet << scTitleColor << scWizardDefaultWidth << scWizardDefaultHeight << scRepositorySettingsPageVisible << scTargetConfigurationFile << scRemoteRepositories << scTranslations << QLatin1String(scControlScript) @@ -382,6 +382,11 @@ QString Settings::wizardStyle() const return d->m_data.value(scWizardStyle).toString(); } +QString Settings::styleSheet() const +{ + return d->absolutePathFromKey(scStyleSheet); +} + QString Settings::titleColor() const { return d->m_data.value(scTitleColor).toString(); diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h index 96c2ba450..17ae53a7f 100644 --- a/src/libs/installer/settings.h +++ b/src/libs/installer/settings.h @@ -89,6 +89,7 @@ public: QString installerWindowIcon() const; QString systemIconSuffix() const; QString wizardStyle() const; + QString styleSheet() const; QString titleColor() const; int wizardDefaultWidth() const; int wizardDefaultHeight() const; |