summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Voitenko <game.boostify@gmail.com>2017-01-17 11:12:02 (GMT)
committerAlexander Voitenko <game.boostify@gmail.com>2017-01-17 11:12:02 (GMT)
commit3fc4a2b71a25ba4045a8b80e66ecffba54bd0d54 (patch)
tree6cd6a38d22177b12f5c7da18fd8bd014fc74a8c4
parent7bd1d53505045bfa97f573f7b587514012618913 (diff)
downloadCMake-3fc4a2b71a25ba4045a8b80e66ecffba54bd0d54.zip
CMake-3fc4a2b71a25ba4045a8b80e66ecffba54bd0d54.tar.gz
CMake-3fc4a2b71a25ba4045a8b80e66ecffba54bd0d54.tar.bz2
QtIFW: Added new options to QtIFW cpack generator for modifying wizard style
-rw-r--r--Help/release/dev/cpack-ifw-package-options.rst7
-rw-r--r--Modules/CPackIFW.cmake28
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx119
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h25
4 files changed, 176 insertions, 3 deletions
diff --git a/Help/release/dev/cpack-ifw-package-options.rst b/Help/release/dev/cpack-ifw-package-options.rst
new file mode 100644
index 0000000..1fec324
--- /dev/null
+++ b/Help/release/dev/cpack-ifw-package-options.rst
@@ -0,0 +1,7 @@
+cpack-ifw-package-options
+-------------------------
+
+* The :module:`CPackIFW` module gained new :variable:`CPACK_IFW_PACKAGE_WATERMARK`, :variable:`CPACK_IFW_PACKAGE_BANNER`,
+ :variable:`CPACK_IFW_PACKAGE_BACKGROUND`, :variable:`CPACK_IFW_PACKAGE_WIZARD_STYLE`, :variable:`CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH`,
+ :variable:`CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT` and :variable:`CPACK_IFW_PACKAGE_TITLE_COLOR`
+ variables to customize a QtIFW installer look.
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index b3ab055..ae595fb 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -76,6 +76,34 @@
#
# Filename for a logo is used as QWizard::LogoPixmap.
#
+# .. variable:: CPACK_IFW_PACKAGE_WATERMARK
+#
+# Filename for a watermark is used as QWizard::WatermarkPixmap.
+#
+# .. variable:: CPACK_IFW_PACKAGE_BANNER
+#
+# Filename for a banner is used as QWizard::BannerPixmap.
+#
+# .. variable:: CPACK_IFW_PACKAGE_BACKGROUND
+#
+# Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle).
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE
+#
+# Wizard style to be used ("Modern", "Mac", "Aero" or "Classic").
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH
+#
+# Default width of the wizard in pixels. Setting a banner image will override this.
+#
+# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT
+#
+# Default height of the wizard in pixels. Setting a watermark image will override this.
+#
+# .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR
+#
+# Color of the titles and subtitles (takes an HTML color code, such as "#88FF33").
+#
# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY
#
# Name of the default program group for the product in the Windows Start menu.
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 9ca7750..d8bafee 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -60,6 +60,16 @@ bool cmCPackIFWInstaller::IsVersionEqual(const char* version)
return Generator ? Generator->IsVersionEqual(version) : false;
}
+void cmCPackIFWInstaller::printSkippedOptionWarning(
+ const std::string& optionName, const std::string& optionValue)
+{
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING, "Option "
+ << optionName << " is set to \"" << optionValue
+ << "\" but will be skipped because the specified file does not exist."
+ << std::endl);
+}
+
void cmCPackIFWInstaller::ConfigureFromOptions()
{
// Name;
@@ -110,7 +120,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (cmSystemTools::FileExists(option)) {
InstallerApplicationIcon = option;
} else {
- // TODO: implement warning
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option);
}
}
@@ -119,7 +129,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (cmSystemTools::FileExists(option)) {
InstallerWindowIcon = option;
} else {
- // TODO: implement warning
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option);
}
}
@@ -128,10 +138,69 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (cmSystemTools::FileExists(option)) {
Logo = option;
} else {
- // TODO: implement warning
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option);
+ }
+ }
+
+ // Watermark
+ if (const char* option = GetOption("CPACK_IFW_PACKAGE_WATERMARK")) {
+ if (cmSystemTools::FileExists(option)) {
+ Watermark = option;
+ } else {
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option);
}
}
+ // Banner
+ if (const char* option = GetOption("CPACK_IFW_PACKAGE_BANNER")) {
+ if (cmSystemTools::FileExists(option)) {
+ Banner = option;
+ } else {
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option);
+ }
+ }
+
+ // Background
+ if (const char* option = GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) {
+ if (cmSystemTools::FileExists(option)) {
+ Background = option;
+ } else {
+ printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option);
+ }
+ }
+
+ // WizardStyle
+ if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
+ if (WizardStyle.compare("Modern") == 0 &&
+ WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 &&
+ WizardStyle.compare("Classic") == 0) {
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING,
+ "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
+ << option << "\". Expected values are: Modern, Aero, Mac, Classic."
+ << std::endl);
+ }
+
+ WizardStyle = option;
+ }
+
+ // WizardDefaultWidth
+ if (const char* option =
+ GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
+ WizardDefaultWidth = option;
+ }
+
+ // WizardDefaultHeight
+ if (const char* option =
+ GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) {
+ WizardDefaultHeight = option;
+ }
+
+ // TitleColor
+ if (const char* option = GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) {
+ TitleColor = option;
+ }
+
// Start menu
if (const char* optIFW_START_MENU_DIR =
this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) {
@@ -313,6 +382,50 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.Element("Logo", name);
}
+ // Banner
+ if (!Banner.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(Banner);
+ std::string path = Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data());
+ xout.Element("Banner", name);
+ }
+
+ // Watermark
+ if (!Watermark.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(Watermark);
+ std::string path = Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data());
+ xout.Element("Watermark", name);
+ }
+
+ // Background
+ if (!Background.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(Background);
+ std::string path = Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data());
+ xout.Element("Background", name);
+ }
+
+ // WizardStyle
+ if (!WizardStyle.empty()) {
+ xout.Element("WizardStyle", WizardStyle);
+ }
+
+ // WizardDefaultWidth
+ if (!WizardDefaultWidth.empty()) {
+ xout.Element("WizardDefaultWidth", WizardDefaultWidth);
+ }
+
+ // WizardDefaultHeight
+ if (!WizardDefaultHeight.empty()) {
+ xout.Element("WizardDefaultHeight", WizardDefaultHeight);
+ }
+
+ // TitleColor
+ if (!TitleColor.empty()) {
+ xout.Element("TitleColor", TitleColor);
+ }
+
// Start menu
if (!IsVersionLess("2.0")) {
xout.Element("StartMenuDir", StartMenuDir);
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index eba9bec..4ec3e70 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -60,6 +60,27 @@ public:
/// Filename for a logo
std::string Logo;
+ /// Filename for a watermark
+ std::string Watermark;
+
+ /// Filename for a banner
+ std::string Banner;
+
+ /// Filename for a background
+ std::string Background;
+
+ /// Wizard style name
+ std::string WizardStyle;
+
+ /// Wizard width
+ std::string WizardDefaultWidth;
+
+ /// Wizard height
+ std::string WizardDefaultHeight;
+
+ /// Title color
+ std::string TitleColor;
+
/// Name of the default program group in the Windows Start menu
std::string StartMenuDir;
@@ -110,6 +131,10 @@ public:
protected:
void WriteGeneratedByToStrim(cmXMLWriter& xout);
+
+private:
+ void printSkippedOptionWarning(const std::string& optionName,
+ const std::string& optionValue);
};
#endif // cmCPackIFWInstaller_h