Browse Source

CPack/IFW: Add StyleSheet field

Zaytsev Yuriy 6 years ago
parent
commit
c474fb2777

+ 4 - 0
Help/cpack_gen/ifw.rst

@@ -135,6 +135,10 @@ Package
 
  Wizard style to be used ("Modern", "Mac", "Aero" or "Classic").
 
+.. variable:: CPACK_IFW_PACKAGE_STYLE_SHEET
+
+ Filename for a stylesheet.
+
 .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH
 
  Default width of the wizard in pixels. Setting a banner image will override this.

+ 6 - 0
Help/release/dev/cpackifw-package-style-sheet.rst

@@ -0,0 +1,6 @@
+cpackifw-package-style-sheet
+----------------------------
+
+* The :cpack_gen:`CPack IFW Generator` gained a new
+  :variable:`CPACK_IFW_PACKAGE_STYLE_SHEET` variable to customize the
+  installer stylesheet.

+ 17 - 0
Source/CPack/IFW/cmCPackIFWInstaller.cxx

@@ -152,6 +152,15 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
     }
   }
 
+  // StyleSheet
+  if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) {
+    if (cmSystemTools::FileExists(option)) {
+      this->StyleSheet = option;
+    } else {
+      this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option);
+    }
+  }
+
   // WizardDefaultWidth
   if (const char* option =
         this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
@@ -381,6 +390,14 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
     xout.Element("WizardStyle", this->WizardStyle);
   }
 
+  // Stylesheet
+  if (!this->StyleSheet.empty()) {
+    std::string name = cmSystemTools::GetFilenameName(this->StyleSheet);
+    std::string path = this->Directory + "/config/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path);
+    xout.Element("StyleSheet", name);
+  }
+
   // WizardDefaultWidth
   if (!this->WizardDefaultWidth.empty()) {
     xout.Element("WizardDefaultWidth", this->WizardDefaultWidth);

+ 3 - 0
Source/CPack/IFW/cmCPackIFWInstaller.h

@@ -72,6 +72,9 @@ public:
   /// Wizard style name
   std::string WizardStyle;
 
+  /// Filename for a style sheet
+  std::string StyleSheet;
+
   /// Wizard width
   std::string WizardDefaultWidth;