From 2f7d0838b8fd338b20eb7059caf6bc5fba6e5266 Mon Sep 17 00:00:00 2001
From: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Date: Mon, 3 Nov 2014 17:44:50 +0100
Subject: [PATCH] WinRT: Add missing manifest specifier for rotation

Add WINRT_MANIFEST.rotation_preference as description which orientation
is allowed or preferred by the app. Valid values for Windows Phone are
portrait, landscape, landscapeFlipped. WinRT also allows portraitFlipped

Task-number: QTBUG-40830
Change-Id: I6b11afcdb72c2c158dadddafc5d90c1d18ab9d8b
Reviewed-by: Andrew Knight <andrew.knight@theqtcompany.com>
---
 .../manifests/8.1/AppxManifest.xml.in             |  2 +-
 .../manifests/8.1_wp/AppxManifest.xml.in          |  2 +-
 mkspecs/features/winrt/package_manifest.prf       | 15 +++++++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/mkspecs/common/winrt_winphone/manifests/8.1/AppxManifest.xml.in b/mkspecs/common/winrt_winphone/manifests/8.1/AppxManifest.xml.in
index 97d34074037..a6fc9697f41 100644
--- a/mkspecs/common/winrt_winphone/manifests/8.1/AppxManifest.xml.in
+++ b/mkspecs/common/winrt_winphone/manifests/8.1/AppxManifest.xml.in
@@ -34,7 +34,7 @@
             <m2:ShowOn Tile=\"square150x150Logo\" />
           </m2:ShowNameOnTiles>
         </m2:DefaultTile>
-        <m2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />
+        <m2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />$${WINRT_MANIFEST.rotation_preference}
       </m2:VisualElements>
     </Application>
   </Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}
diff --git a/mkspecs/common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in b/mkspecs/common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in
index cf18a4dc790..b75570ad4e3 100644
--- a/mkspecs/common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in
+++ b/mkspecs/common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in
@@ -37,7 +37,7 @@
             <m3:ShowOn Tile=\"square150x150Logo\" />
           </m3:ShowNameOnTiles>
         </m3:DefaultTile>
-        <m3:SplashScreen Image=\"$${WINRT_MANIFEST.logo_480x800}\" />
+        <m3:SplashScreen Image=\"$${WINRT_MANIFEST.logo_480x800}\" />$${WINRT_MANIFEST.rotation_preference}
       </m3:VisualElements>
     </Application>
   </Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}
diff --git a/mkspecs/features/winrt/package_manifest.prf b/mkspecs/features/winrt/package_manifest.prf
index b4242bfdaa5..2ccb5db9633 100644
--- a/mkspecs/features/winrt/package_manifest.prf
+++ b/mkspecs/features/winrt/package_manifest.prf
@@ -24,6 +24,7 @@
 # WINRT_MANIFEST.logo_medium: Medium logo image file. Default provided by the mkspec.
 # WINRT_MANIFEST.logo_large: Large logo image file. Default provided by the mkspec.
 # WINRT_MANIFEST.splash_screen: Splash screen image file. Default provided by the mkspec.
+# WINRT_MANIFEST.rotation_preference: Orientation specification. Default is empty. (portrait, landscape, landscapeFlipped)
 # WINRT_MANIFEST.iconic_tile_icon: Image file for the "iconic" tile template icon. Default provided by the mkspec.
 # WINRT_MANIFEST.iconic_tile_small: Image file for the small "iconic" tile template logo. Default provided by the mkspec.
 # WINRT_MANIFEST.default_language: Specifies the default language of the application
@@ -87,6 +88,20 @@
     isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
     isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
 
+    INDENT = "$$escape_expand(\\r\\n)        "
+
+    VS_XML_NAMESPACE = "m2"
+    winphone: VS_XML_NAMESPACE = "m3"
+    WINRT_MANIFEST.rotation_preference = $$unique(WINRT_MANIFEST.rotation_preference)
+    !isEmpty(WINRT_MANIFEST.rotation_preference) {
+        MANIFEST_ROTATION += "<$${VS_XML_NAMESPACE}:InitialRotationPreference>"
+        for(ROTATION, WINRT_MANIFEST.rotation_preference): \
+            MANIFEST_ROTATION += "  <$${VS_XML_NAMESPACE}:Rotation Preference=\"$$ROTATION\" />"
+        MANIFEST_ROTATION += "</$${VS_XML_NAMESPACE}:InitialRotationPreference>"
+
+        WINRT_MANIFEST.rotation_preference = $$join(MANIFEST_ROTATION, $$INDENT, $$INDENT)
+    }
+
     INDENT = "$$escape_expand(\\r\\n)  "
 
     # Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)
-- 
GitLab