Browse Source

Introjucer: Refactored global path implementation

tags/2021-05-28
jules 9 years ago
parent
commit
21dabf778d
13 changed files with 221 additions and 274 deletions
  1. +27
    -0
      extras/Introjucer/Source/Application/jucer_CommonHeaders.h
  2. +21
    -122
      extras/Introjucer/Source/Application/jucer_GlobalPreferences.cpp
  3. +1
    -5
      extras/Introjucer/Source/Application/jucer_GlobalPreferences.h
  4. +7
    -11
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h
  5. +6
    -23
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h
  6. +15
    -23
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h
  7. +7
    -11
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h
  8. +11
    -23
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  9. +4
    -12
      extras/Introjucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp
  10. +5
    -35
      extras/Introjucer/Source/Project/jucer_DependencyPathPropertyComponent.h
  11. +4
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h
  12. +101
    -0
      extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp
  13. +12
    -9
      extras/Introjucer/Source/Utility/jucer_StoredSettings.h

+ 27
- 0
extras/Introjucer/Source/Application/jucer_CommonHeaders.h View File

@@ -25,7 +25,34 @@
#ifndef JUCER_COMMONHEADERS_H_INCLUDED #ifndef JUCER_COMMONHEADERS_H_INCLUDED
#define JUCER_COMMONHEADERS_H_INCLUDED #define JUCER_COMMONHEADERS_H_INCLUDED
//==============================================================================
struct TargetOS
{
enum OS
{
windows = 0,
osx,
linux,
unknown
};
static OS getThisOS() noexcept
{
#if JUCE_WINDOWS
return windows;
#elif JUCE_MAC
return osx;
#elif JUCE_LINUX
return linux;
#else
return unknown;
#endif
}
};
typedef TargetOS::OS DependencyPathOS;
//==============================================================================
#include "../Utility/jucer_StoredSettings.h" #include "../Utility/jucer_StoredSettings.h"
#include "../Utility/jucer_Icons.h" #include "../Utility/jucer_Icons.h"
#include "../Utility/jucer_MiscUtilities.h" #include "../Utility/jucer_MiscUtilities.h"


+ 21
- 122
extras/Introjucer/Source/Application/jucer_GlobalPreferences.cpp View File

@@ -29,28 +29,22 @@ public:
}; };
//============================================================================== //==============================================================================
namespace PathSettingsHelpers
{
bool checkSdkPathContainsFile (const String& path, const String& fileToCheckFor)
{
return File::getCurrentWorkingDirectory().getChildFile( path + "/" + fileToCheckFor).existsAsFile();
}
}
PathSettingsTab::PathSettingsTab (DependencyPathOS os) PathSettingsTab::PathSettingsTab (DependencyPathOS os)
{ {
const int maxChars = 1024; const int maxChars = 1024;
vst2PathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::vst2KeyName, os), "VST SDK", maxChars, false));
vst3PathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::vst3KeyName, os), "VST3 SDK", maxChars, false));
StoredSettings& settings = getAppSettings();
vst2PathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::vst2Path, os), "VST SDK", maxChars, false));
vst3PathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::vst3Path, os), "VST3 SDK", maxChars, false));
#if ! JUCE_LINUX #if ! JUCE_LINUX
rtasPathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::rtasKeyName, os), "RTAS SDK", maxChars, false));
aaxPathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::aaxKeyName, os), "AAX SDK", maxChars, false));
rtasPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::rtasPath, os), "RTAS SDK", maxChars, false));
aaxPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::aaxPath, os), "AAX SDK", maxChars, false));
#endif #endif
androidSdkPathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::androidSdkKeyName, os), "Android SDK", maxChars, false));
androidNdkPathComponent = pathComponents.add (new TextPropertyComponent (getPathByKey (DependencyPath::androidNdkKeyName, os), "Android NDK", maxChars, false));
androidSdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidSDKPath, os), "Android SDK", maxChars, false));
androidNdkPathComponent = pathComponents.add (new TextPropertyComponent (settings.getGlobalPath (Ids::androidNDKPath, os), "Android NDK", maxChars, false));
for (TextPropertyComponent** component = pathComponents.begin(); component != pathComponents.end(); ++component) for (TextPropertyComponent** component = pathComponents.begin(); component != pathComponents.end(); ++component)
{ {
@@ -66,20 +60,23 @@ PathSettingsTab::~PathSettingsTab()
void PathSettingsTab::textPropertyComponentChanged (TextPropertyComponent* textPropertyComponent) void PathSettingsTab::textPropertyComponentChanged (TextPropertyComponent* textPropertyComponent)
{ {
String keyName = getKeyForPropertyComponent (textPropertyComponent);
Identifier keyName = getKeyForPropertyComponent (textPropertyComponent);
Colour textColour = getAppSettings().isGlobalPathValid (keyName, textPropertyComponent->getText())
? Colours::black
: Colours::red;
Colour textColour = checkPathByKey (keyName, textPropertyComponent->getText()) ? Colours::black : Colours::red;
textPropertyComponent->setColour (TextPropertyComponent::textColourId, textColour); textPropertyComponent->setColour (TextPropertyComponent::textColourId, textColour);
} }
String PathSettingsTab::getKeyForPropertyComponent (TextPropertyComponent* component) const
Identifier PathSettingsTab::getKeyForPropertyComponent (TextPropertyComponent* component) const
{ {
if (component == vst2PathComponent) return DependencyPath::vst2KeyName;
if (component == vst3PathComponent) return DependencyPath::vst3KeyName;
if (component == rtasPathComponent) return DependencyPath::rtasKeyName;
if (component == aaxPathComponent) return DependencyPath::aaxKeyName;
if (component == androidSdkPathComponent) return DependencyPath::androidSdkKeyName;
if (component == androidNdkPathComponent) return DependencyPath::androidNdkKeyName;
if (component == vst2PathComponent) return Ids::vst2Path;
if (component == vst3PathComponent) return Ids::vst3Path;
if (component == rtasPathComponent) return Ids::rtasPath;
if (component == aaxPathComponent) return Ids::aaxPath;
if (component == androidSdkPathComponent) return Ids::androidSDKPath;
if (component == androidNdkPathComponent) return Ids::androidNDKPath;
// this property component does not have a key associated to it! // this property component does not have a key associated to it!
jassertfalse; jassertfalse;
@@ -107,104 +104,6 @@ void PathSettingsTab::resized()
} }
} }
//==============================================================================
Value& PathSettingsTab::getPathByKey (const String& key, DependencyPathOS os)
{
getAppSettings().pathValues[key].referTo (getAppSettings().projectDefaults.getPropertyAsValue (key, nullptr));
Value& value = getAppSettings().pathValues[key];
if (value.toString().isEmpty())
value = getFallbackPathByKey (key, os);
return value;
}
//==============================================================================
String PathSettingsTab::getFallbackPathByKey (const String& key, DependencyPathOS os)
{
if (key == DependencyPath::vst2KeyName || key == DependencyPath::vst3KeyName)
return os == DependencyPath::windows ? "c:\\SDKs\\VST3 SDK"
: "~/SDKs/VST3 SDK";
if (key == DependencyPath::rtasKeyName)
{
if (os == DependencyPath::windows) return "c:\\SDKs\\PT_80_SDK";
if (os == DependencyPath::osx) return "~/SDKs/PT_80_SDK";
// no RTAS on this OS!
jassertfalse;
return String();
}
if (key == DependencyPath::aaxKeyName)
{
if (os == DependencyPath::windows) return "c:\\SDKs\\AAX";
if (os == DependencyPath::osx) return "~/SDKs/AAX" ;
// no RTAS on this OS!
jassertfalse;
return String();
}
if (key == DependencyPath::androidSdkKeyName)
return os == DependencyPath::windows ? "c:\\SDKs\\android-sdk"
: "~/Library/Android/sdk";
if (key == DependencyPath::androidNdkKeyName)
return os == DependencyPath::windows ? "c:\\SDKs\\android-ndk"
: "~/Library/Android/ndk";
// didn't recognise the key provided!
jassertfalse;
return String();
}
//==============================================================================
bool PathSettingsTab::checkPathByKey (const String& key, const String& path)
{
String fileToCheckFor;
if (key == DependencyPath::vst2KeyName)
{
fileToCheckFor = "public.sdk/source/vst2.x/audioeffectx.h";
}
else if (key == DependencyPath::vst3KeyName)
{
fileToCheckFor = "base/source/baseiids.cpp";
}
else if (key == DependencyPath::rtasKeyName)
{
fileToCheckFor = "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses/CEffectProcessMIDI.cpp";
}
else if (key == DependencyPath::aaxKeyName)
{
fileToCheckFor = "Interfaces/AAX_Exports.cpp";
}
else if (key == DependencyPath::androidSdkKeyName)
{
#if JUCE_WINDOWS
fileToCheckFor = "platform-tools/adb.exe";
#else
fileToCheckFor = "platform-tools/adb";
#endif
}
else if (key == DependencyPath::androidNdkKeyName)
{
#if JUCE_WINDOWS
fileToCheckFor = "ndk-depends.exe";
#else
fileToCheckFor = "ndk-depends";
#endif
}
else
{
// didn't recognise the key provided!
jassertfalse;
return false;
}
return PathSettingsHelpers::checkSdkPathContainsFile (path, fileToCheckFor);
}
//============================================================================== //==============================================================================
struct AppearanceEditor struct AppearanceEditor
@@ -469,7 +368,7 @@ String AppearanceSettingsTab::getName() const noexcept
GlobalPreferencesComponent::GlobalPreferencesComponent() GlobalPreferencesComponent::GlobalPreferencesComponent()
: TabbedComponent (TabbedButtonBar::TabsAtTop) : TabbedComponent (TabbedButtonBar::TabsAtTop)
{ {
preferenceTabs.add (new PathSettingsTab (DependencyPath::getThisOS()));
preferenceTabs.add (new PathSettingsTab (TargetOS::getThisOS()));
preferenceTabs.add (new AppearanceSettingsTab); preferenceTabs.add (new AppearanceSettingsTab);
for (GlobalPreferencesTab** tab = preferenceTabs.begin(); tab != preferenceTabs.end(); ++tab) for (GlobalPreferencesTab** tab = preferenceTabs.begin(); tab != preferenceTabs.end(); ++tab)


+ 1
- 5
extras/Introjucer/Source/Application/jucer_GlobalPreferences.h View File

@@ -43,14 +43,10 @@ public:
void resized() override; void resized() override;
static Value& getPathByKey (const String& key, DependencyPathOS);
static String getFallbackPathByKey (const String& key, DependencyPathOS);
static bool checkPathByKey (const String& key, const String& path);
private: private:
void textPropertyComponentChanged (TextPropertyComponent*) override; void textPropertyComponentChanged (TextPropertyComponent*) override;
String getKeyForPropertyComponent (TextPropertyComponent*) const;
Identifier getKeyForPropertyComponent (TextPropertyComponent*) const;
OwnedArray<TextPropertyComponent> pathComponents; OwnedArray<TextPropertyComponent> pathComponents;


+ 7
- 11
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h View File

@@ -753,17 +753,13 @@ private:
void initialiseDependencyPathValues() void initialiseDependencyPathValues()
{ {
sdkPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::androidSDKPath),
DependencyPath::androidSdkKeyName,
DependencyPath::getThisOS()
)));
ndkPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::androidNDKPath),
DependencyPath::androidNdkKeyName,
DependencyPath::getThisOS()
)));
sdkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidSDKPath),
Ids::androidSDKPath,
TargetOS::getThisOS())));
ndkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidNDKPath),
Ids::androidNDKPath,
TargetOS::getThisOS())));
} }
//============================================================================== //==============================================================================


+ 6
- 23
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h View File

@@ -405,33 +405,16 @@ private:
void initialiseDependencyPathValues() void initialiseDependencyPathValues()
{ {
DependencyPathOS pathOS = isLinux() ? DependencyPath::linux : DependencyPath::windows;
DependencyPathOS pathOS = isLinux() ? TargetOS::linux
: TargetOS::windows;
vst2Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vstFolder),
DependencyPath::vst2KeyName,
pathOS
)));
vst3Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vst3Folder),
DependencyPath::vst3KeyName,
pathOS
)));
vst2Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vstFolder), Ids::vst2Path, pathOS)));
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, pathOS)));
if (! isLinux()) if (! isLinux())
{ {
aaxPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::aaxFolder),
DependencyPath::aaxKeyName,
pathOS
)));
rtasPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::rtasFolder),
DependencyPath::rtasKeyName,
pathOS
)));
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, pathOS)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, pathOS)));
} }
} }


+ 15
- 23
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h View File

@@ -559,29 +559,21 @@ protected:
void initialiseDependencyPathValues() void initialiseDependencyPathValues()
{ {
vst2Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vstFolder),
DependencyPath::vst2KeyName,
DependencyPath::windows
)));
vst3Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vst3Folder),
DependencyPath::vst3KeyName,
DependencyPath::windows
)));
aaxPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::aaxFolder),
DependencyPath::aaxKeyName,
DependencyPath::windows
)));
rtasPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::rtasFolder),
DependencyPath::rtasKeyName,
DependencyPath::windows
)));
vst2Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vstFolder),
Ids::vst2Path,
TargetOS::windows)));
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::windows)));
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder),
Ids::aaxPath,
TargetOS::windows)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder),
Ids::rtasPath,
TargetOS::windows)));
} }
JUCE_DECLARE_NON_COPYABLE (MSVCProjectExporterBase) JUCE_DECLARE_NON_COPYABLE (MSVCProjectExporterBase)


+ 7
- 11
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h View File

@@ -350,17 +350,13 @@ private:
void initialiseDependencyPathValues() void initialiseDependencyPathValues()
{ {
vst2Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vstFolder),
DependencyPath::vst2KeyName,
DependencyPath::linux
)));
vst3Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vst3Folder),
DependencyPath::vst3KeyName,
DependencyPath::linux
)));
vst2Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vstFolder),
Ids::vst2Path,
TargetOS::linux)));
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::linux)));
} }
JUCE_DECLARE_NON_COPYABLE (MakefileProjectExporter) JUCE_DECLARE_NON_COPYABLE (MakefileProjectExporter)


+ 11
- 23
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h View File

@@ -1504,28 +1504,16 @@ private:
void initialiseDependencyPathValues() void initialiseDependencyPathValues()
{ {
vst2Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vstFolder),
DependencyPath::vst2KeyName,
DependencyPath::osx
)));
vst3Path.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::vst3Folder),
DependencyPath::vst3KeyName,
DependencyPath::osx
)));
aaxPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::aaxFolder),
DependencyPath::aaxKeyName,
DependencyPath::osx
)));
rtasPath.referTo (Value (new DependencyPathValueSource (
getSetting (Ids::rtasFolder),
DependencyPath::rtasKeyName,
DependencyPath::osx
)));
vst2Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vstFolder),
Ids::vst2Path, TargetOS::osx)));
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path, TargetOS::osx)));
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder),
Ids::aaxPath, TargetOS::osx)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder),
Ids::rtasPath, TargetOS::osx)));
} }
}; };

+ 4
- 12
extras/Introjucer/Source/Project/jucer_DependencyPathPropertyComponent.cpp View File

@@ -12,24 +12,16 @@
#include "jucer_DependencyPathPropertyComponent.h" #include "jucer_DependencyPathPropertyComponent.h"
#include "../Application/jucer_GlobalPreferences.h" #include "../Application/jucer_GlobalPreferences.h"
//==============================================================================
const String DependencyPath::vst2KeyName = "vst2Path";
const String DependencyPath::vst3KeyName = "vst3Path";
const String DependencyPath::rtasKeyName = "rtasPath";
const String DependencyPath::aaxKeyName = "aaxPath";
const String DependencyPath::androidSdkKeyName = "androidSdkPath";
const String DependencyPath::androidNdkKeyName = "androidNdkPath";
//============================================================================== //==============================================================================
DependencyPathValueSource::DependencyPathValueSource (const Value& projectSettingsPath, DependencyPathValueSource::DependencyPathValueSource (const Value& projectSettingsPath,
String globalSettingsKey,
Identifier globalSettingsKey,
DependencyPathOS osThisSettingAppliesTo) DependencyPathOS osThisSettingAppliesTo)
: projectSettingsValue (projectSettingsPath), : projectSettingsValue (projectSettingsPath),
globalKey (globalSettingsKey), globalKey (globalSettingsKey),
os (osThisSettingAppliesTo), os (osThisSettingAppliesTo),
globalSettingsValue (PathSettingsTab::getPathByKey (globalKey, os)),
fallbackValue (PathSettingsTab::getFallbackPathByKey (globalKey, os))
globalSettingsValue (getAppSettings().getGlobalPath (globalKey, os)),
fallbackValue (getAppSettings().getFallbackPath (globalKey, os))
{ {
globalSettingsValue.addListener (this); globalSettingsValue.addListener (this);
} }
@@ -41,7 +33,7 @@ bool DependencyPathValueSource::isValidPath() const
if (! appliesToThisOS()) if (! appliesToThisOS())
return true; return true;
return PathSettingsTab::checkPathByKey (globalKey, getValue().toString());
return getAppSettings().isGlobalPathValid (globalKey, getValue().toString());
} }
//============================================================================== //==============================================================================


+ 5
- 35
extras/Introjucer/Source/Project/jucer_DependencyPathPropertyComponent.h View File

@@ -11,36 +11,6 @@
#ifndef JUCER_DEPENDENCYPATHPROPERTYCOMPONENT_H_INCLUDED #ifndef JUCER_DEPENDENCYPATHPROPERTYCOMPONENT_H_INCLUDED
#define JUCER_DEPENDENCYPATHPROPERTYCOMPONENT_H_INCLUDED #define JUCER_DEPENDENCYPATHPROPERTYCOMPONENT_H_INCLUDED
//==============================================================================
class DependencyPath
{
public:
enum OS
{
windows = 0,
osx,
linux,
unknown
};
static OS getThisOS()
{
#if JUCE_WINDOWS
return DependencyPath::windows;
#elif JUCE_MAC
return DependencyPath::osx;
#elif JUCE_LINUX
return DependencyPath::linux;
#else
return DependencyPath::unknown;
#endif
}
const static String vst2KeyName, vst3KeyName, rtasKeyName, aaxKeyName,
androidSdkKeyName, androidNdkKeyName;
};
typedef DependencyPath::OS DependencyPathOS;
//============================================================================== //==============================================================================
/** This ValueSource type implements the fallback logic required for dependency /** This ValueSource type implements the fallback logic required for dependency
@@ -54,7 +24,7 @@ class DependencyPathValueSource : public Value::ValueSource,
{ {
public: public:
DependencyPathValueSource (const Value& projectSettingsPath, DependencyPathValueSource (const Value& projectSettingsPath,
String globalSettingsKey,
Identifier globalSettingsKey,
DependencyPathOS osThisSettingAppliesTo); DependencyPathOS osThisSettingAppliesTo);
/** This gets the currently used value, which may be either /** This gets the currently used value, which may be either
@@ -95,7 +65,7 @@ public:
bool appliesToThisOS() const bool appliesToThisOS() const
{ {
return os == DependencyPath::getThisOS();
return os == TargetOS::getThisOS();
} }
bool isValidPath() const; bool isValidPath() const;
@@ -124,9 +94,9 @@ private:
{ {
// only use the global settings if they are set on the same OS // only use the global settings if they are set on the same OS
// that this setting is for! // that this setting is for!
DependencyPathOS thisOS = DependencyPath::getThisOS();
DependencyPathOS thisOS = TargetOS::getThisOS();
return thisOS == DependencyPath::unknown ? false : os == thisOS;
return thisOS == TargetOS::unknown ? false : os == thisOS;
} }
/** the dependency path setting as set in this Introjucer project. */ /** the dependency path setting as set in this Introjucer project. */
@@ -134,7 +104,7 @@ private:
/** the global key used in the application settings for the global setting value. /** the global key used in the application settings for the global setting value.
needed for checking whether the path is valid. */ needed for checking whether the path is valid. */
String globalKey;
Identifier globalKey;
/** on what operating system should this dependency path be used? /** on what operating system should this dependency path be used?
note that this is *not* the os that is targeted by the project, note that this is *not* the os that is targeted by the project,


+ 4
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h View File

@@ -55,6 +55,10 @@ namespace Ids
DECLARE_ID (vst3Folder); DECLARE_ID (vst3Folder);
DECLARE_ID (rtasFolder); DECLARE_ID (rtasFolder);
DECLARE_ID (auFolder); DECLARE_ID (auFolder);
DECLARE_ID (vst2Path);
DECLARE_ID (vst3Path);
DECLARE_ID (rtasPath);
DECLARE_ID (aaxPath);
DECLARE_ID (flags); DECLARE_ID (flags);
DECLARE_ID (line); DECLARE_ID (line);
DECLARE_ID (index); DECLARE_ID (index);


+ 101
- 0
extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp View File

@@ -216,3 +216,104 @@ void StoredSettings::ColourSelectorWithSwatches::setSwatchColour (int index, con
{ {
getAppSettings().swatchColours.set (index, newColour); getAppSettings().swatchColours.set (index, newColour);
} }
//==============================================================================
static bool doesSDKPathContainFile (const String& path, const String& fileToCheckFor)
{
return File::getCurrentWorkingDirectory().getChildFile( path + "/" + fileToCheckFor).existsAsFile();
}
Value StoredSettings::getGlobalPath (const Identifier& key, DependencyPathOS os)
{
Value v (projectDefaults.getPropertyAsValue (key, nullptr));
if (v.toString().isEmpty())
v = getFallbackPath (key, os);
return v;
}
String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS os)
{
if (key == Ids::vst2Path || key == Ids::vst3Path)
return os == TargetOS::windows ? "c:\\SDKs\\VST3 SDK"
: "~/SDKs/VST3 SDK";
if (key == Ids::rtasPath)
{
if (os == TargetOS::windows) return "c:\\SDKs\\PT_80_SDK";
if (os == TargetOS::osx) return "~/SDKs/PT_80_SDK";
// no RTAS on this OS!
jassertfalse;
return String();
}
if (key == Ids::aaxPath)
{
if (os == TargetOS::windows) return "c:\\SDKs\\AAX";
if (os == TargetOS::osx) return "~/SDKs/AAX" ;
// no AAX on this OS!
jassertfalse;
return String();
}
if (key == Ids::androidSDKPath)
return os == TargetOS::windows ? "c:\\SDKs\\android-sdk"
: "~/Library/Android/sdk";
if (key == Ids::androidNDKPath)
return os == TargetOS::windows ? "c:\\SDKs\\android-ndk"
: "~/Library/Android/ndk";
// didn't recognise the key provided!
jassertfalse;
return String();
}
bool StoredSettings::isGlobalPathValid (const Identifier& key, const String& path)
{
String fileToCheckFor;
if (key == Ids::vst2Path)
{
fileToCheckFor = "public.sdk/source/vst2.x/audioeffectx.h";
}
else if (key == Ids::vst3Path)
{
fileToCheckFor = "base/source/baseiids.cpp";
}
else if (key == Ids::rtasPath)
{
fileToCheckFor = "AlturaPorts/TDMPlugIns/PlugInLibrary/EffectClasses/CEffectProcessMIDI.cpp";
}
else if (key == Ids::aaxPath)
{
fileToCheckFor = "Interfaces/AAX_Exports.cpp";
}
else if (key == Ids::androidSDKPath)
{
#if JUCE_WINDOWS
fileToCheckFor = "platform-tools/adb.exe";
#else
fileToCheckFor = "platform-tools/adb";
#endif
}
else if (key == Ids::androidNDKPath)
{
#if JUCE_WINDOWS
fileToCheckFor = "ndk-depends.exe";
#else
fileToCheckFor = "ndk-depends";
#endif
}
else
{
// didn't recognise the key provided!
jassertfalse;
return false;
}
return doesSDKPathContainFile (path, fileToCheckFor);
}

+ 12
- 9
extras/Introjucer/Source/Utility/jucer_StoredSettings.h View File

@@ -41,13 +41,6 @@ public:
void flush(); void flush();
void reload(); void reload();
//==============================================================================
void valueTreePropertyChanged (ValueTree&, const Identifier&) override { changed(); }
void valueTreeChildAdded (ValueTree&, ValueTree&) override { changed(); }
void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { changed(); }
void valueTreeChildOrderChanged (ValueTree&, int, int) override { changed(); }
void valueTreeParentChanged (ValueTree&) override { changed(); }
//============================================================================== //==============================================================================
RecentlyOpenedFilesList recentFiles; RecentlyOpenedFilesList recentFiles;
@@ -71,11 +64,14 @@ public:
StringArray monospacedFontNames; StringArray monospacedFontNames;
ValueTree projectDefaults;
std::map<String, Value> pathValues;
//==============================================================================
Value getGlobalPath (const Identifier& key, DependencyPathOS);
String getFallbackPath (const Identifier& key, DependencyPathOS);
bool isGlobalPathValid (const Identifier& key, const String& path);
private: private:
OwnedArray<PropertiesFile> propertyFiles; OwnedArray<PropertiesFile> propertyFiles;
ValueTree projectDefaults;
void changed() void changed()
{ {
@@ -91,6 +87,13 @@ private:
void loadSwatchColours(); void loadSwatchColours();
void saveSwatchColours(); void saveSwatchColours();
//==============================================================================
void valueTreePropertyChanged (ValueTree&, const Identifier&) override { changed(); }
void valueTreeChildAdded (ValueTree&, ValueTree&) override { changed(); }
void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { changed(); }
void valueTreeChildOrderChanged (ValueTree&, int, int) override { changed(); }
void valueTreeParentChanged (ValueTree&) override { changed(); }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StoredSettings) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StoredSettings)
}; };


Loading…
Cancel
Save