| @@ -24,12 +24,20 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| class ModuleItem : public ConfigTreeItemBase | |||||
| class ModuleItem : public ConfigTreeItemBase, | |||||
| private Value::Listener | |||||
| { | { | ||||
| public: | public: | ||||
| ModuleItem (Project& p, const String& modID) | ModuleItem (Project& p, const String& modID) | ||||
| : project (p), moduleID (modID) | : project (p), moduleID (modID) | ||||
| { | { | ||||
| missingDependencies = project.getModules().getExtraDependenciesNeeded (moduleID).size() > 0; | |||||
| cppStandardHigherThanProject = project.getModules().doesModuleHaveHigherCppStandardThanProject (moduleID); | |||||
| projectCppStandardValue.referTo (project.getCppStandardValue()); | |||||
| projectCppStandardValue.addListener (this); | |||||
| info = project.getModules().getModuleInfo (moduleID); | |||||
| } | } | ||||
| bool canBeSelected() const override { return true; } | bool canBeSelected() const override { return true; } | ||||
| @@ -38,8 +46,8 @@ public: | |||||
| String getDisplayName() const override { return moduleID; } | String getDisplayName() const override { return moduleID; } | ||||
| String getRenamingName() const override { return getDisplayName(); } | String getRenamingName() const override { return getDisplayName(); } | ||||
| void setName (const String&) override {} | void setName (const String&) override {} | ||||
| bool isMissing() const override { return hasMissingDependencies(); } | |||||
| bool hasWarnings() const override { return hasHigherCppStandardThanProject(); } | |||||
| bool isMissing() const override { return missingDependencies; } | |||||
| bool hasWarnings() const override { return cppStandardHigherThanProject; } | |||||
| void showDocument() override | void showDocument() override | ||||
| { | { | ||||
| @@ -59,7 +67,6 @@ public: | |||||
| if (! isSelected()) | if (! isSelected()) | ||||
| { | { | ||||
| auto info = project.getModules().getModuleInfo (moduleID); | |||||
| if (info.isValid() && info.getVendor() == "juce") | if (info.isValid() && info.getVendor() == "juce") | ||||
| { | { | ||||
| if (info.getLicense() == "ISC") | if (info.getLicense() == "ISC") | ||||
| @@ -89,14 +96,28 @@ public: | |||||
| String moduleID; | String moduleID; | ||||
| private: | private: | ||||
| bool hasMissingDependencies() const | |||||
| { | |||||
| return project.getModules().getExtraDependenciesNeeded (moduleID).size() > 0; | |||||
| } | |||||
| ModuleDescription info; | |||||
| bool missingDependencies = false; | |||||
| bool cppStandardHigherThanProject = false; | |||||
| Value projectCppStandardValue; | |||||
| bool hasHigherCppStandardThanProject() const | |||||
| //============================================================================== | |||||
| void valueChanged (Value& v) override | |||||
| { | { | ||||
| return project.getModules().doesModuleHaveHigherCppStandardThanProject (moduleID); | |||||
| if (v == projectCppStandardValue) | |||||
| { | |||||
| auto oldVal = cppStandardHigherThanProject; | |||||
| cppStandardHigherThanProject = project.getModules().doesModuleHaveHigherCppStandardThanProject (moduleID); | |||||
| if (oldVal != cppStandardHigherThanProject) | |||||
| { | |||||
| if (auto* parent = dynamic_cast<EnabledModulesItem*> (getParentItem())) | |||||
| { | |||||
| parent->refreshSubItems(); | |||||
| return; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||