@@ -34,16 +34,20 @@ class GlobalSearchPathsWindowComponent : public Component, | |||
public: | |||
GlobalSearchPathsWindowComponent() | |||
: modulesLabel ("modulesLabel", "Modules"), | |||
sdksLabel ("sdksLabel", "SDKs") | |||
sdksLabel ("sdksLabel", "SDKs"), | |||
cLionLabel ("cLionLabel", "CLion") | |||
{ | |||
addAndMakeVisible (modulesLabel); | |||
addAndMakeVisible (sdksLabel); | |||
addAndMakeVisible (cLionLabel); | |||
modulesLabel.setFont (Font (18.0f, Font::FontStyleFlags::bold)); | |||
sdksLabel.setFont (Font (18.0f, Font::FontStyleFlags::bold)); | |||
sdksLabel .setFont (Font (18.0f, Font::FontStyleFlags::bold)); | |||
cLionLabel .setFont (Font (18.0f, Font::FontStyleFlags::bold)); | |||
modulesLabel.setJustificationType (Justification::centredLeft); | |||
sdksLabel.setJustificationType (Justification::centredLeft); | |||
sdksLabel .setJustificationType (Justification::centredLeft); | |||
cLionLabel .setJustificationType (Justification::centredLeft); | |||
addAndMakeVisible (info); | |||
info.setInfoToDisplay ("Use this dropdown to set the global paths for different OSes. " | |||
@@ -85,10 +89,13 @@ public: | |||
modulesLabel.setBounds (b.removeFromTop (20)); | |||
b.removeFromTop (20); | |||
auto i = 0; | |||
for (auto propertyComponent : pathPropertyComponents) | |||
auto thisOS = TargetOS::getThisOS(); | |||
auto selectedOS = getSelectedOS(); | |||
const int numComps = pathPropertyComponents.size(); | |||
for (int i = 0; i < numComps; ++i) | |||
{ | |||
propertyComponent->setBounds (b.removeFromTop (propertyComponent->getPreferredHeight())); | |||
pathPropertyComponents[i]->setBounds (b.removeFromTop (pathPropertyComponents[i]->getPreferredHeight())); | |||
b.removeFromTop (5); | |||
if (i == 1) | |||
@@ -98,12 +105,17 @@ public: | |||
b.removeFromTop (20); | |||
} | |||
++i; | |||
if (selectedOS == thisOS && i == numComps - 2) | |||
{ | |||
b.removeFromTop (15); | |||
cLionLabel.setBounds (b.removeFromTop (20)); | |||
b.removeFromTop (20); | |||
} | |||
} | |||
} | |||
private: | |||
Label modulesLabel, sdksLabel; | |||
Label modulesLabel, sdksLabel, cLionLabel; | |||
OwnedArray<PropertyComponent> pathPropertyComponents; | |||
ComboBox osSelector; | |||
InfoButton info; | |||
@@ -113,11 +125,8 @@ private: | |||
updateFilePathPropertyComponents(); | |||
} | |||
void updateFilePathPropertyComponents() | |||
TargetOS::OS getSelectedOS() const | |||
{ | |||
pathPropertyComponents.clear(); | |||
auto thisOS = TargetOS::getThisOS(); | |||
auto selectedOS = TargetOS::unknown; | |||
switch (osSelector.getSelectedId()) | |||
@@ -128,6 +137,16 @@ private: | |||
default: break; | |||
} | |||
return selectedOS; | |||
} | |||
void updateFilePathPropertyComponents() | |||
{ | |||
pathPropertyComponents.clear(); | |||
const auto thisOS = TargetOS::getThisOS(); | |||
const auto selectedOS = getSelectedOS(); | |||
auto& settings = getAppSettings(); | |||
if (selectedOS == thisOS) | |||
@@ -160,6 +179,16 @@ private: | |||
"Android SDK", true))); | |||
addAndMakeVisible (pathPropertyComponents.add (new FilePathPropertyComponent (settings.getStoredPath (Ids::androidNDKPath), | |||
"Android NDK", true))); | |||
#if JUCE_MAC | |||
String exeLabel ("app"); | |||
#elif JUCE_WINDOWS | |||
String exeLabel ("executable"); | |||
#else | |||
String exeLabel ("startup script"); | |||
#endif | |||
addAndMakeVisible (pathPropertyComponents.add (new FilePathPropertyComponent (settings.getStoredPath (Ids::clionExePath), | |||
"CLion " + exeLabel, false))); | |||
} | |||
else | |||
{ | |||
@@ -109,6 +109,8 @@ public: | |||
static Identifier exporterName ("XCODE_MAC"); | |||
#elif JUCE_WINDOWS | |||
static Identifier exporterName ("CODEBLOCKS_WINDOWS"); | |||
#elif JUCE_LINUX | |||
static Identifier exporterName ("LINUX_MAKE"); | |||
#else | |||
static Identifier exporterName; | |||
#endif | |||
@@ -121,7 +123,7 @@ public: | |||
bool launchProject() override | |||
{ | |||
return getCLionExecutable().startAsProcess (getTargetFolder().getFullPathName()); | |||
return getCLionExecutable().startAsProcess (getTargetFolder().getFullPathName().quoted()); | |||
} | |||
String getDescription() override | |||
@@ -148,7 +150,7 @@ public: | |||
<< newLine | |||
<< "Not all features of all the exporters are currently supported. Notable omissions are AUv3 " | |||
<< "plug-ins, embedding resources and fat binaries on MacOS, and adding application icons. On " | |||
<< "Windows CLion requires a GCC-based compiler like MinGW."; | |||
<< "Windows the CLion exporter requires a GCC-based compiler like MinGW."; | |||
return description; | |||
} | |||
@@ -225,17 +227,17 @@ private: | |||
//============================================================================== | |||
static File getCLionExecutable() | |||
{ | |||
#if JUCE_MAC | |||
return { "/Applications/CLion.app/Contents/MacOS/clion" }; | |||
#elif JUCE_WINDOWS | |||
auto regValue = WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\clion64.exe\\shell\\open\\command\\", {}, {}); | |||
auto openCmd = StringArray::fromTokens (regValue, true); | |||
File clionExe (getAppSettings() | |||
.getStoredPath (Ids::clionExePath) | |||
.toString() | |||
.replace ("${user.home}", File::getSpecialLocation (File::userHomeDirectory).getFullPathName())); | |||
if (! openCmd.isEmpty()) | |||
return { openCmd[0].unquoted() }; | |||
#if JUCE_MAC | |||
if (clionExe.getFileName().endsWith (".app")) | |||
clionExe = clionExe.getChildFile ("Contents/MacOS/clion"); | |||
#endif | |||
return {}; | |||
return clionExe; | |||
} | |||
//============================================================================== | |||
@@ -295,7 +295,7 @@ Value StoredSettings::getFallbackPathForOS (const Identifier& key, DependencyPat | |||
else if (key == Ids::aaxPath) | |||
{ | |||
if (os == TargetOS::windows) v = "C:\\SDKs\\AAX"; | |||
else if (os == TargetOS::osx) v = "~/SDKs/AAX" ; | |||
else if (os == TargetOS::osx) v = "~/SDKs/AAX"; | |||
else jassertfalse; // no AAX on this OS! | |||
} | |||
else if (key == Ids::androidSDKPath) | |||
@@ -306,6 +306,29 @@ Value StoredSettings::getFallbackPathForOS (const Identifier& key, DependencyPat | |||
{ | |||
v = "${user.home}/Library/Android/sdk/ndk-bundle"; | |||
} | |||
else if (key == Ids::clionExePath) | |||
{ | |||
if (os == TargetOS::windows) | |||
{ | |||
#if JUCE_WINDOWS | |||
auto regValue = WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\clion64.exe\\shell\\open\\command\\", {}, {}); | |||
auto openCmd = StringArray::fromTokens (regValue, true); | |||
if (! openCmd.isEmpty()) | |||
return Value (openCmd[0].unquoted()); | |||
#endif | |||
v = "C:\\Program Files\\JetBrains\\CLion YYYY.MM.DD\\bin\\clion64.exe"; | |||
} | |||
else if (os == TargetOS::osx) | |||
{ | |||
v = "/Applications/CLion.app"; | |||
} | |||
else | |||
{ | |||
v = "${user.home}/clion/bin/clion.sh"; | |||
} | |||
} | |||
} | |||
return v; | |||
@@ -357,6 +380,16 @@ bool StoredSettings::isGlobalPathValid (const File& relativeTo, const Identifier | |||
{ | |||
fileToCheckFor = {}; | |||
} | |||
else if (key == Ids::clionExePath) | |||
{ | |||
#if JUCE_MAC | |||
fileToCheckFor = path.trim().endsWith (".app") ? "Contents/MacOS/clion" : "../clion"; | |||
#elif JUCE_WIDOWS | |||
fileToCheckFor = "../clion64.exe"; | |||
#else | |||
fileToCheckFor = "../clion.sh"; | |||
#endif | |||
} | |||
else | |||
{ | |||
// didn't recognise the key provided! | |||
@@ -221,6 +221,7 @@ namespace Ids | |||
DECLARE_ID (clionMakefileEnabled); | |||
DECLARE_ID (clionXcodeEnabled); | |||
DECLARE_ID (clionCodeBlocksEnabled); | |||
DECLARE_ID (clionExePath); | |||
DECLARE_ID (font); | |||
DECLARE_ID (colour); | |||
DECLARE_ID (userNotes); | |||