mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Added all iOS orientations options
This commit is contained in:
parent
19ef27410e
commit
74df988e9d
3 changed files with 55 additions and 26 deletions
|
|
@ -248,19 +248,10 @@ namespace build_tools
|
|||
|
||||
void PlistOptions::addIosScreenOrientations (XmlElement& dict) const
|
||||
{
|
||||
String screenOrientations[] = { iPhoneScreenOrientations, iPadScreenOrientations };
|
||||
String plistSuffix[] = { "", "~ipad" };
|
||||
auto orientationsAreTheSame = screenOrientations[0] == screenOrientations[1];
|
||||
addArrayToPlist (dict, "UISupportedInterfaceOrientations", iPhoneScreenOrientations);
|
||||
|
||||
for (int i = 0; i < (orientationsAreTheSame ? 1 : 2); ++i)
|
||||
{
|
||||
StringArray iOSOrientations;
|
||||
|
||||
if (screenOrientations[i].contains ("portrait")) { iOSOrientations.add ("UIInterfaceOrientationPortrait"); }
|
||||
if (screenOrientations[i].contains ("landscape")) { iOSOrientations.add ("UIInterfaceOrientationLandscapeLeft"); iOSOrientations.add ("UIInterfaceOrientationLandscapeRight"); }
|
||||
|
||||
addArrayToPlist (dict, String ("UISupportedInterfaceOrientations") + plistSuffix[i], iOSOrientations);
|
||||
}
|
||||
if (iPadScreenOrientations != iPhoneScreenOrientations)
|
||||
addArrayToPlist (dict, "UISupportedInterfaceOrientations~ipad", iPadScreenOrientations);
|
||||
}
|
||||
|
||||
void PlistOptions::addIosBackgroundModes (XmlElement& dict) const
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ namespace build_tools
|
|||
String pluginCode;
|
||||
int versionAsHex = 0;
|
||||
|
||||
String iPhoneScreenOrientations;
|
||||
String iPadScreenOrientations;
|
||||
StringArray iPhoneScreenOrientations;
|
||||
StringArray iPadScreenOrientations;
|
||||
|
||||
String pluginName;
|
||||
String pluginManufacturer;
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ public:
|
|||
prebuildCommandValue (settings, Ids::prebuildCommand, getUndoManager()),
|
||||
duplicateAppExResourcesFolderValue (settings, Ids::duplicateAppExResourcesFolder, getUndoManager(), true),
|
||||
iosDeviceFamilyValue (settings, Ids::iosDeviceFamily, getUndoManager(), "1,2"),
|
||||
iPhoneScreenOrientationValue (settings, Ids::iPhoneScreenOrientation, getUndoManager(), "portraitlandscape"),
|
||||
iPadScreenOrientationValue (settings, Ids::iPadScreenOrientation, getUndoManager(), "portraitlandscape"),
|
||||
iPhoneScreenOrientationValue (settings, Ids::iPhoneScreenOrientation, getUndoManager(), getDefaultScreenOrientations(), ","),
|
||||
iPadScreenOrientationValue (settings, Ids::iPadScreenOrientation, getUndoManager(), getDefaultScreenOrientations(), ","),
|
||||
customXcodeResourceFoldersValue (settings, Ids::customXcodeResourceFolders, getUndoManager()),
|
||||
customXcassetsFolderValue (settings, Ids::customXcassetsFolder, getUndoManager()),
|
||||
appSandboxValue (settings, Ids::appSandbox, getUndoManager()),
|
||||
|
|
@ -162,8 +162,12 @@ public:
|
|||
|
||||
String getDeviceFamilyString() const { return iosDeviceFamilyValue.get(); }
|
||||
|
||||
String getiPhoneScreenOrientationString() const { return iPhoneScreenOrientationValue.get(); }
|
||||
String getiPadScreenOrientationString() const { return iPadScreenOrientationValue.get(); }
|
||||
Array<var> getDefaultScreenOrientations() const { return { "UIInterfaceOrientationPortrait",
|
||||
"UIInterfaceOrientationLandscapeLeft",
|
||||
"UIInterfaceOrientationLandscapeRight" }; }
|
||||
|
||||
Array<var> getiPhoneScreenOrientations() const { return *iPhoneScreenOrientationValue.get().getArray(); }
|
||||
Array<var> getiPadScreenOrientations() const { return *iPadScreenOrientationValue.get().getArray(); }
|
||||
|
||||
String getCustomResourceFoldersString() const { return customXcodeResourceFoldersValue.get().toString().replaceCharacters ("\r\n", "::"); }
|
||||
String getCustomXcassetsFolderString() const { return customXcassetsFolderValue.get(); }
|
||||
|
|
@ -288,15 +292,16 @@ public:
|
|||
"The device family to target.");
|
||||
|
||||
{
|
||||
StringArray orientationStrings { "Portrait and Landscape", "Portrait", "Landscape" };
|
||||
Array<var> orientationValues { "portraitlandscape", "portrait", "landscape"};
|
||||
StringArray orientationStrings { "Portrait", "Portrait Upside Down",
|
||||
"Landscape Left", "Landsscape Right" };
|
||||
|
||||
props.add (new ChoicePropertyComponent (iPhoneScreenOrientationValue, "iPhone Screen Orientation",
|
||||
orientationStrings, orientationValues),
|
||||
Array<var> orientationVars { "UIInterfaceOrientationPortrait", "UIInterfaceOrientationPortraitUpsideDown",
|
||||
"UIInterfaceOrientationLandscapeLeft", "UIInterfaceOrientationLandscapeRight" };
|
||||
|
||||
props.add (new MultiChoicePropertyComponent (iPhoneScreenOrientationValue, "iPhone Screen Orientation", orientationStrings, orientationVars),
|
||||
"The screen orientations that this app should support on iPhones.");
|
||||
|
||||
props.add (new ChoicePropertyComponent (iPadScreenOrientationValue, "iPad Screen Orientation",
|
||||
orientationStrings, orientationValues),
|
||||
props.add (new MultiChoicePropertyComponent (iPadScreenOrientationValue, "iPad Screen Orientation", orientationStrings, orientationVars),
|
||||
"The screen orientations that this app should support on iPads.");
|
||||
}
|
||||
|
||||
|
|
@ -607,6 +612,12 @@ public:
|
|||
jassert (targets.size() > 0);
|
||||
}
|
||||
|
||||
void updateDeprecatedSettings() override
|
||||
{
|
||||
if (iOS)
|
||||
updateOldOrientationSettings();
|
||||
}
|
||||
|
||||
void updateDeprecatedSettingsInteractively() override
|
||||
{
|
||||
if (hasInvalidPostBuildScript())
|
||||
|
|
@ -1590,8 +1601,8 @@ public:
|
|||
options.IAATypeCode = owner.project.getIAATypeCode();
|
||||
options.pluginCode = owner.project.getPluginCodeString();
|
||||
options.versionAsHex = owner.project.getVersionAsHexInteger();
|
||||
options.iPhoneScreenOrientations = owner.getiPhoneScreenOrientationString();
|
||||
options.iPadScreenOrientations = owner.getiPadScreenOrientationString();
|
||||
options.iPhoneScreenOrientations = owner.getiPhoneScreenOrientations();
|
||||
options.iPadScreenOrientations = owner.getiPadScreenOrientations();
|
||||
|
||||
options.storyboardName = [&]
|
||||
{
|
||||
|
|
@ -3185,5 +3196,32 @@ private:
|
|||
return file.hasFileExtension (sourceFileExtensions);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void updateOldOrientationSettings()
|
||||
{
|
||||
jassert (iOS);
|
||||
|
||||
StringArray orientationSettingStrings { getSetting (Ids::iPhoneScreenOrientation).getValue().toString(),
|
||||
getSetting (Ids::iPadScreenOrientation).getValue().toString() };
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
auto& settingsString = orientationSettingStrings[i];
|
||||
|
||||
if (settingsString.isNotEmpty())
|
||||
{
|
||||
Array<var> orientations;
|
||||
|
||||
if (settingsString.contains ("portrait")) orientations.add ("UIInterfaceOrientationPortrait");
|
||||
if (settingsString.contains ("landscape")) orientations.addArray ({ "UIInterfaceOrientationLandscapeLeft",
|
||||
"UIInterfaceOrientationLandscapeRight" });
|
||||
if (i == 0)
|
||||
iPhoneScreenOrientationValue = orientations;
|
||||
else
|
||||
iPadScreenOrientationValue = orientations;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (XcodeProjectExporter)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue