logic: cleaned up code for SourceGroupSettings and Wizzard

* Flattened sourcegroupsettings class hierarchy by moving cross compilation options to own base class
* QtProjectWizzardContentFlags constructor required correct settings object to reduce the need for type casting
* QtProjectWizzardContentPath constructors required correct settings objects
* moved SourcePaths from SourceGroupSettingsJava to SourceGroupSettingsJavaEmpty because they are not required for Gradle and Maven projects
* removed classpath from maven and gradle source group settings
* reuse code of SourceGroup for "show source files" in wizard
This commit is contained in:
mlangkabel
2018-06-12 21:16:51 +02:00
parent dca4c3c16b
commit c65a5d04b1
34 changed files with 697 additions and 570 deletions
+2 -2
View File
@@ -324,8 +324,6 @@ add_files(
settings/SourceGroupSettingsCxxCdb.h
settings/SourceGroupSettingsCxxCodeblocks.cpp
settings/SourceGroupSettingsCxxCodeblocks.h
settings/SourceGroupSettingsCxxEmpty.cpp
settings/SourceGroupSettingsCxxEmpty.h
settings/SourceGroupSettingsCxxSonargraph.cpp
settings/SourceGroupSettingsCxxSonargraph.h
settings/SourceGroupSettingsJava.cpp
@@ -344,6 +342,8 @@ add_files(
settings/SourceGroupSettingsWithCppStandard.h
settings/SourceGroupSettingsWithCStandard.cpp
settings/SourceGroupSettingsWithCStandard.h
settings/SourceGroupSettingsWithCxxCrossCompilationOptions.cpp
settings/SourceGroupSettingsWithCxxCrossCompilationOptions.h
settings/SourceGroupSettingsWithExcludeFilters.cpp
settings/SourceGroupSettingsWithExcludeFilters.h
settings/SourceGroupSettingsWithIndexedHeaderPaths.cpp
+17 -5
View File
@@ -1,26 +1,34 @@
#include "settings/SourceGroupSettingsCEmpty.h"
SourceGroupSettingsCEmpty::SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_C_EMPTY, projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_C_EMPTY, projectSettings)
{
}
void SourceGroupSettingsCEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxxEmpty::load(config);
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCStandard::load(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
}
void SourceGroupSettingsCEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxxEmpty::save(config);
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCStandard::save(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
}
bool SourceGroupSettingsCEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
@@ -29,8 +37,12 @@ bool SourceGroupSettingsCEmpty::equals(std::shared_ptr<SourceGroupSettings> othe
return (
otherCxxEmpty &&
SourceGroupSettingsCxxEmpty::equals(other) &&
SourceGroupSettingsWithCStandard::equals(otherCxxEmpty)
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCStandard::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxCrossCompilationOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty)
);
}
+10 -2
View File
@@ -1,12 +1,20 @@
#ifndef SOURCE_GROUP_SETTINGS_C_EMPTY_H
#define SOURCE_GROUP_SETTINGS_C_EMPTY_H
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsWithCStandard.h"
#include "settings/SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCEmpty
: public SourceGroupSettingsCxxEmpty
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCStandard
, public SourceGroupSettingsWithCxxCrossCompilationOptions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings);
@@ -1,26 +1,34 @@
#include "settings/SourceGroupSettingsCppEmpty.h"
SourceGroupSettingsCppEmpty::SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_CPP_EMPTY, projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CPP_EMPTY, projectSettings)
{
}
void SourceGroupSettingsCppEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxxEmpty::load(config);
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::load(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
}
void SourceGroupSettingsCppEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxxEmpty::save(config);
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::save(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
}
bool SourceGroupSettingsCppEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
@@ -29,8 +37,12 @@ bool SourceGroupSettingsCppEmpty::equals(std::shared_ptr<SourceGroupSettings> ot
return (
otherCxxEmpty &&
SourceGroupSettingsCxxEmpty::equals(other) &&
SourceGroupSettingsWithCppStandard::equals(otherCxxEmpty)
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCppStandard::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxCrossCompilationOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty)
);
}
+10 -2
View File
@@ -1,12 +1,20 @@
#ifndef SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#define SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsWithCppStandard.h"
#include "settings/SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCppEmpty
: public SourceGroupSettingsCxxEmpty
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCppStandard
, public SourceGroupSettingsWithCxxCrossCompilationOptions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings);
+1 -12
View File
@@ -12,10 +12,8 @@ void SourceGroupSettingsJava::load(std::shared_ptr<const ConfigManager> config)
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithJavaStandard::load(config, key);
SourceGroupSettingsWithClasspath::load(config, key);
}
void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
@@ -25,10 +23,8 @@ void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
SourceGroupSettingsWithJavaStandard::save(config, key);
SourceGroupSettingsWithClasspath::save(config, key);
}
bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other) const
@@ -39,18 +35,11 @@ bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other)
otherJava &&
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithSourceExtensions::equals(otherJava) &&
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
SourceGroupSettingsWithJavaStandard::equals(otherJava) &&
SourceGroupSettingsWithClasspath::equals(otherJava)
SourceGroupSettingsWithJavaStandard::equals(otherJava)
);
}
const ProjectSettings* SourceGroupSettingsJava::getProjectSettings() const
{
return m_projectSettings;
}
std::vector<std::wstring> SourceGroupSettingsJava::getDefaultSourceExtensions() const
{
return { L".java" };
@@ -5,19 +5,15 @@
#include <vector>
#include "settings/SourceGroupSettings.h"
#include "settings/SourceGroupSettingsWithClasspath.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
#include "settings/SourceGroupSettingsWithJavaStandard.h"
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsJava
: public SourceGroupSettings
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithJavaStandard
, public SourceGroupSettingsWithClasspath
{
public:
SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
@@ -28,7 +24,6 @@ public:
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
private:
const ProjectSettings* getProjectSettings() const override;
std::vector<std::wstring> getDefaultSourceExtensions() const override;
};
@@ -4,3 +4,40 @@ SourceGroupSettingsJavaEmpty::SourceGroupSettingsJavaEmpty(const std::string& id
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_EMPTY, projectSettings)
{
}
void SourceGroupSettingsJavaEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithClasspath::load(config, key);
}
void SourceGroupSettingsJavaEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithClasspath::save(config, key);
}
bool SourceGroupSettingsJavaEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaEmpty> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(other);
return (
otherJava &&
SourceGroupSettingsJava::equals(other) &&
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
SourceGroupSettingsWithClasspath::equals(otherJava)
);
}
const ProjectSettings* SourceGroupSettingsJavaEmpty::getProjectSettings() const
{
return m_projectSettings;
}
@@ -2,12 +2,24 @@
#define SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#include "settings/SourceGroupSettingsJava.h"
#include "settings/SourceGroupSettingsWithClasspath.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsJavaEmpty
: public SourceGroupSettingsJava
, public SourceGroupSettingsWithSourcePaths
, public SourceGroupSettingsWithClasspath
{
public:
SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings);
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
private:
const ProjectSettings* getProjectSettings() const override;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
@@ -85,3 +85,8 @@ void SourceGroupSettingsJavaGradle::setShouldIndexGradleTests(bool value)
{
m_shouldIndexGradleTests = value;
}
const ProjectSettings* SourceGroupSettingsJavaGradle::getProjectSettings() const
{
return m_projectSettings;
}
@@ -2,6 +2,7 @@
#define SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FilePath.h"
class SourceGroupSettingsJavaGradle
: public SourceGroupSettingsJava
@@ -26,6 +27,8 @@ public:
void setShouldIndexGradleTests(bool value);
private:
const ProjectSettings* getProjectSettings() const override;
FilePath m_gradleProjectFilePath;
FilePath m_gradleDependenciesDirectory;
bool m_shouldIndexGradleTests;
@@ -85,3 +85,8 @@ void SourceGroupSettingsJavaMaven::setShouldIndexMavenTests(bool value)
{
m_shouldIndexMavenTests = value;
}
const ProjectSettings* SourceGroupSettingsJavaMaven::getProjectSettings() const
{
return m_projectSettings;
}
@@ -2,6 +2,7 @@
#define SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FilePath.h"
class SourceGroupSettingsJavaMaven
: public SourceGroupSettingsJava
@@ -26,6 +27,8 @@ public:
void setShouldIndexMavenTests(bool value);
private:
const ProjectSettings* getProjectSettings() const override;
FilePath m_mavenProjectFilePath;
FilePath m_mavenDependenciesDirectory;
bool m_shouldIndexMavenTests;
@@ -1,12 +1,11 @@
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "utility/ConfigManager.h"
#include "utility/utility.h"
#include "utility/utilityApp.h"
#include "settings/ProjectSettings.h"
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableArchTypes()
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableArchTypes()
{
return {
return{
L"aarch64",
L"aarch64_be",
L"arm",
@@ -58,9 +57,9 @@ std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableArchTypes()
};
}
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableVendorTypes()
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableVendorTypes()
{
return {
return{
L"unknown",
L"apple",
L"pc",
@@ -79,9 +78,9 @@ std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableVendorTypes()
};
}
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableOsTypes()
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableOsTypes()
{
return {
return{
L"unknown",
L"cloudabi",
L"darwin",
@@ -116,9 +115,9 @@ std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableOsTypes()
};
}
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableEnvironmentTypes()
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableEnvironmentTypes()
{
return {
return{
L"unknown",
L"gnu",
L"gnuabi64",
@@ -141,9 +140,8 @@ std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getAvailableEnvironmentTy
};
}
SourceGroupSettingsCxxEmpty::SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, type, projectSettings)
, m_targetOptionsEnabled(false)
SourceGroupSettingsWithCxxCrossCompilationOptions::SourceGroupSettingsWithCxxCrossCompilationOptions()
: m_targetOptionsEnabled(false)
, m_targetArch(L"")
, m_targetVendor(L"")
, m_targetSys(L"")
@@ -151,16 +149,16 @@ SourceGroupSettingsCxxEmpty::SourceGroupSettingsCxxEmpty(const std::string& id,
{
}
void SourceGroupSettingsCxxEmpty::load(std::shared_ptr<const ConfigManager> config)
bool SourceGroupSettingsWithCxxCrossCompilationOptions::equals(std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> other) const
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
return (
other &&
getTargetFlag() == other->getTargetFlag()
);
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setTargetOptionsEnabled(config->getValueOrDefault<bool>(key + "/cross_compilation/target_options_enabled", false));
setTargetArch(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/arch", L""));
setTargetVendor(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/vendor", L""));
@@ -168,16 +166,8 @@ void SourceGroupSettingsCxxEmpty::load(std::shared_ptr<const ConfigManager> conf
setTargetAbi(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/abi", L""));
}
void SourceGroupSettingsCxxEmpty::save(std::shared_ptr<ConfigManager> config)
void SourceGroupSettingsWithCxxCrossCompilationOptions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
config->setValue(key + "/cross_compilation/target_options_enabled", getTargetOptionsEnabled());
config->setValue(key + "/cross_compilation/target/arch", getTargetArch());
config->setValue(key + "/cross_compilation/target/vendor", getTargetVendor());
@@ -185,71 +175,57 @@ void SourceGroupSettingsCxxEmpty::save(std::shared_ptr<ConfigManager> config)
config->setValue(key + "/cross_compilation/target/abi", getTargetAbi());
}
bool SourceGroupSettingsCxxEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(other);
return (
otherCxxEmpty &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty) &&
getTargetFlag() == otherCxxEmpty->getTargetFlag()
);
}
bool SourceGroupSettingsCxxEmpty::getTargetOptionsEnabled() const
bool SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetOptionsEnabled() const
{
return m_targetOptionsEnabled;
}
void SourceGroupSettingsCxxEmpty::setTargetOptionsEnabled(bool targetOptionsEnabled)
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetOptionsEnabled(bool targetOptionsEnabled)
{
m_targetOptionsEnabled = targetOptionsEnabled;
}
std::wstring SourceGroupSettingsCxxEmpty::getTargetArch() const
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetArch() const
{
return m_targetArch;
}
void SourceGroupSettingsCxxEmpty::setTargetArch(const std::wstring& arch)
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetArch(const std::wstring& arch)
{
m_targetArch = arch;
}
std::wstring SourceGroupSettingsCxxEmpty::getTargetVendor() const
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetVendor() const
{
return m_targetVendor;
}
void SourceGroupSettingsCxxEmpty::setTargetVendor(const std::wstring& vendor)
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetVendor(const std::wstring& vendor)
{
m_targetVendor = vendor;
}
std::wstring SourceGroupSettingsCxxEmpty::getTargetSys() const
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetSys() const
{
return m_targetSys;
}
void SourceGroupSettingsCxxEmpty::setTargetSys(const std::wstring& sys)
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetSys(const std::wstring& sys)
{
m_targetSys = sys;
}
std::wstring SourceGroupSettingsCxxEmpty::getTargetAbi() const
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetAbi() const
{
return m_targetAbi;
}
void SourceGroupSettingsCxxEmpty::setTargetAbi(const std::wstring& abi)
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetAbi(const std::wstring& abi)
{
m_targetAbi = abi;
}
std::wstring SourceGroupSettingsCxxEmpty::getTargetFlag() const
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetFlag() const
{
std::wstring targetFlag = L"";
if (m_targetOptionsEnabled && !m_targetArch.empty())
@@ -261,4 +237,4 @@ std::wstring SourceGroupSettingsCxxEmpty::getTargetFlag() const
targetFlag += L"-" + (m_targetAbi.empty() ? L"unknown" : m_targetAbi);
}
return targetFlag;
}
}
@@ -1,16 +1,14 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
#define SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
#ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
#define SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
#include <memory>
#include <string>
#include <vector>
class SourceGroupSettingsCxxEmpty
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
class ConfigManager;
class ProjectSettings;
class SourceGroupSettingsWithCxxCrossCompilationOptions
{
public:
static std::vector<std::wstring> getAvailableArchTypes();
@@ -18,12 +16,10 @@ public:
static std::vector<std::wstring> getAvailableOsTypes();
static std::vector<std::wstring> getAvailableEnvironmentTypes();
SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
SourceGroupSettingsWithCxxCrossCompilationOptions();
virtual ~SourceGroupSettingsWithCxxCrossCompilationOptions() = default;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
bool equals(std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> other) const;
bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled);
@@ -42,7 +38,13 @@ public:
std::wstring getTargetFlag() const;
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
virtual const ProjectSettings* getProjectSettings() const = 0;
bool m_targetOptionsEnabled;
std::wstring m_targetArch;
std::wstring m_targetVendor;
@@ -50,4 +52,4 @@ private:
std::wstring m_targetAbi;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_EMPTY_H
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
+56 -14
View File
@@ -2,13 +2,14 @@
#include "data/indexer/IndexerCommandCxxEmpty.h"
#include "settings/ApplicationSettings.h"
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsCEmpty.h"
#include "settings/SourceGroupSettingsCppEmpty.h"
#include "settings/SourceGroupSettingsWithCppStandard.h"
#include "settings/SourceGroupSettingsWithCStandard.h"
#include "utility/file/FileManager.h"
#include "utility/utility.h"
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxxEmpty> settings)
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings)
: m_settings(settings)
{
}
@@ -18,8 +19,21 @@ std::set<FilePath> SourceGroupCxxEmpty::filterToContainedFilePaths(const std::se
std::set<FilePath> containedFilePaths;
const std::set<FilePath> allSourceFilePaths = getAllSourceFilePaths();
const std::vector<FilePath> indexedPaths = m_settings->getSourcePathsExpandedAndAbsolute();
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
std::vector<FilePath> indexedPaths;
std::vector<FilePathFilter> excludeFilters;
if (std::shared_ptr<SourceGroupSettingsCEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(m_settings))
{
indexedPaths = settings->getSourcePathsExpandedAndAbsolute();
excludeFilters = settings->getExcludeFiltersExpandedAndAbsolute();
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(m_settings))
{
indexedPaths = settings->getSourcePathsExpandedAndAbsolute();
excludeFilters = settings->getExcludeFiltersExpandedAndAbsolute();
}
for (const FilePath& filePath : filePaths)
{
@@ -56,11 +70,25 @@ std::set<FilePath> SourceGroupCxxEmpty::filterToContainedFilePaths(const std::se
std::set<FilePath> SourceGroupCxxEmpty::getAllSourceFilePaths() const
{
FileManager fileManager;
fileManager.update(
m_settings->getSourcePathsExpandedAndAbsolute(),
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
if (std::shared_ptr<SourceGroupSettingsCEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(m_settings))
{
fileManager.update(
settings->getSourcePathsExpandedAndAbsolute(),
settings->getExcludeFiltersExpandedAndAbsolute(),
settings->getSourceExtensions()
);
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(m_settings))
{
fileManager.update(
settings->getSourcePathsExpandedAndAbsolute(),
settings->getExcludeFiltersExpandedAndAbsolute(),
settings->getSourceExtensions()
);
}
return fileManager.getAllSourceFilePaths();
}
@@ -70,8 +98,26 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
std::vector<FilePath> systemHeaderSearchPaths;
std::set<FilePath> indexedPaths;
std::set<FilePathFilter> excludeFilters;
std::wstring targetFlag;
if (std::shared_ptr<SourceGroupSettingsCEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(m_settings))
{
indexedPaths = utility::toSet(settings->getSourcePathsExpandedAndAbsolute());
excludeFilters = utility::toSet(settings->getExcludeFiltersExpandedAndAbsolute());
targetFlag = settings->getTargetFlag();
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(m_settings))
{
indexedPaths = utility::toSet(settings->getSourcePathsExpandedAndAbsolute());
excludeFilters = utility::toSet(settings->getExcludeFiltersExpandedAndAbsolute());
targetFlag = settings->getTargetFlag();
}
// Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
for (const FilePath& sourcePath: m_settings->getSourcePathsExpandedAndAbsolute())
for (const FilePath& sourcePath: indexedPaths)
{
if (sourcePath.isDirectory())
{
@@ -88,7 +134,6 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
std::vector<std::wstring> compilerFlags;
{
const std::wstring targetFlag = m_settings->getTargetFlag();
if (!targetFlag.empty())
{
compilerFlags.push_back(targetFlag);
@@ -97,9 +142,6 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerComm
utility::append(compilerFlags, m_settings->getCompilerFlags());
const std::set<FilePath> indexedPaths = utility::toSet(m_settings->getSourcePathsExpandedAndAbsolute());
const std::set<FilePathFilter> excludeFilters = utility::toSet(m_settings->getExcludeFiltersExpandedAndAbsolute());
std::string languageStandard = SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic();
if (std::shared_ptr<SourceGroupSettingsWithCStandard> cSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithCStandard>(m_settings))
+3 -3
View File
@@ -6,12 +6,12 @@
#include "project/SourceGroup.h"
class SourceGroupSettingsCxxEmpty;
class SourceGroupSettingsCxx;
class SourceGroupCxxEmpty: public SourceGroup
{
public:
SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxxEmpty> settings);
SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings);
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override;
@@ -21,7 +21,7 @@ private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
std::shared_ptr<SourceGroupSettingsCxxEmpty> m_settings;
std::shared_ptr<SourceGroupSettingsCxx> m_settings;
};
#endif // SOURCE_GROUP_CXX_EMPTY_H
@@ -6,7 +6,8 @@
#include "project/SourceGroupCxxSonargraph.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsCEmpty.h"
#include "settings/SourceGroupSettingsCppEmpty.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
SourceGroupFactoryModuleCxx::~SourceGroupFactoryModuleCxx()
@@ -40,7 +41,11 @@ std::shared_ptr<SourceGroup> SourceGroupFactoryModuleCxx::createSourceGroup(std:
{
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxCodeblocks(cxxSettings));
}
else if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(settings))
else if (std::shared_ptr<SourceGroupSettingsCEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(settings))
{
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxEmpty(cxxSettings));
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(settings))
{
sourceGroup = std::shared_ptr<SourceGroup>(new SourceGroupCxxEmpty(cxxSettings));
}
@@ -441,15 +441,15 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
{
if (std::shared_ptr<SourceGroupSettingsJavaGradle> settingsJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(group))
{
summary->addContent(new QtProjectWizzardContentPathSourceGradle(group, this));
summary->addContent(new QtProjectWizzardContentPathSourceGradle(settingsJavaGradle, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathDependenciesGradle(group, this));
summary->addContent(new QtProjectWizzardContentPathDependenciesGradle(settingsJavaGradle, this));
}
else if (std::shared_ptr<SourceGroupSettingsJavaMaven> settingsJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(group))
{
summary->addContent(new QtProjectWizzardContentPathSourceMaven(group, this));
summary->addContent(new QtProjectWizzardContentPathSourceMaven(settingsJavaMaven, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(group, this));
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(settingsJavaMaven, this));
}
summary->addSpace();
@@ -462,44 +462,44 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
{
summary->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaSonargraph, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(
settingsJavaSonargraph, std::shared_ptr<SourceGroupSettingsCxxSonargraph>(), settingsJavaSonargraph, this
));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsClassJava(group, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxx> settingsCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(group))
{
bool indicateSearchPathsAsAdditional = false;
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> settingsCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(group))
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(group))
{
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(group))
{
summary->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(group))
{
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
}
summary->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentCrossCompilationOptions(group, this));
summary->addContent(new QtProjectWizzardContentCrossCompilationOptions(settingsCEmpty, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsCxxEmpty, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsCEmpty, this));
}
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(group))
{
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentCrossCompilationOptions(settingsCppEmpty, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsCppEmpty, this));
}
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> settingsCxxCdb = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(group))
{
indicateSearchPathsAsAdditional = true;
summary->addContent(new QtProjectWizzardContentPathCDB(group, this));
summary->addContent(new QtProjectWizzardContentPathCDB(settingsCxxCdb, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", group, this));
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settingsCxxCodeblocks = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(group))
{
@@ -513,7 +513,6 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Code::Blocks project", settingsCxxCodeblocks, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentExtensions(settingsCxxCodeblocks, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(group))
{
@@ -521,12 +520,12 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCxxSonargraph, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(settingsCxxSonargraph, settingsCxxSonargraph, settingsCxxSonargraph, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", group, this));
summary->addSpace();
}
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(group, this, indicateSearchPathsAsAdditional));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(this));
@@ -539,7 +538,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addSpace();
}
summary->addContent(new QtProjectWizzardContentFlags(group, this, indicateSearchPathsAsAdditional));
summary->addContent(new QtProjectWizzardContentFlags(settingsCxx, this, indicateSearchPathsAsAdditional));
}
setContent(summary);
@@ -822,10 +821,11 @@ void QtProjectWizzard::emptySourceGroup()
{
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaEmpty, this));
}
if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_C_EMPTY ||
m_newSourceGroupSettings->getType() == SOURCE_GROUP_CPP_EMPTY)
if (std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> settingsCrossCompile =
std::dynamic_pointer_cast<SourceGroupSettingsWithCxxCrossCompilationOptions>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentCrossCompilationOptions(m_newSourceGroupSettings, window));
contentGroup->addContent(new QtProjectWizzardContentCrossCompilationOptions(settingsCrossCompile, window));
window->setPreferredSize(QSize(470, 460));
}
else
@@ -852,12 +852,15 @@ void QtProjectWizzard::emptySourceGroupCDBVS()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentVS(window));
contentGroup->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsCxxCdb> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentVS(window));
contentGroup->addContent(new QtProjectWizzardContentPathCDB(settings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
}
);
@@ -870,11 +873,14 @@ void QtProjectWizzard::emptySourceGroupCDB()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsCxxCdb> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentPathCDB(settings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
}
);
@@ -914,7 +920,7 @@ void QtProjectWizzard::emptySourceGroupCxxSonargraph()
{
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settings, this));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(settings, settings, settings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", m_newSourceGroupSettings, window));
}
@@ -934,12 +940,14 @@ void QtProjectWizzard::emptySourceGroupJavaSonargraph()
{
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settings, this));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(
settings, std::shared_ptr<SourceGroupSettingsCxxSonargraph>(), settings, window)
);
}
}
);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::dependenciesJava);
window->updateSubTitle("Sonargraph Project Path");
}
@@ -953,12 +961,12 @@ void QtProjectWizzard::sourcePaths()
contentGroup->addContent(new QtProjectWizzardContentPathsSource(settingsCxx, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(settingsCxx, window));
if (std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settingsSourceExtension =
std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_newSourceGroupSettings))
{
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourceExtension, window));
}
}
if (std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settingsSourceExtension =
std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_newSourceGroupSettings))
{
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourceExtension, window));
}
}
);
@@ -1044,21 +1052,29 @@ void QtProjectWizzard::dependenciesJava()
void QtProjectWizzard::sourcePathsJavaMaven()
{
std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_newSourceGroupSettings)->setMavenDependenciesDirectory(
FilePath(
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
L"/" +
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
L"/maven"
)
);
if (std::shared_ptr<SourceGroupSettingsJavaMaven> settingsJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_newSourceGroupSettings))
{
settingsJavaMaven->setMavenDependenciesDirectory(
FilePath(
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
L"/" +
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
L"/maven"
)
);
}
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathSourceMaven(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsJavaMaven> settingsJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaMaven, this));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathSourceMaven(settingsJavaMaven, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathDependenciesMaven(settingsJavaMaven, window));
}
}
);
@@ -1068,21 +1084,29 @@ void QtProjectWizzard::sourcePathsJavaMaven()
void QtProjectWizzard::sourcePathsJavaGradle()
{
std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_newSourceGroupSettings)->setGradleDependenciesDirectory(
FilePath(
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
L"/" +
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
L"/gradle"
)
);
if (std::shared_ptr<SourceGroupSettingsJavaGradle> settingsJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_newSourceGroupSettings))
{
settingsJavaGradle->setGradleDependenciesDirectory(
FilePath(
L"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), L" ", L"_") +
L"/" +
utility::decodeFromUtf8(m_newSourceGroupSettings->getId()) +
L"/gradle"
)
);
}
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathSourceGradle(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathDependenciesGradle(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsJavaGradle> settingsJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaGradle, this));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathSourceGradle(settingsJavaGradle, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathDependenciesGradle(settingsJavaGradle, window));
}
}
);
@@ -1095,7 +1119,10 @@ void QtProjectWizzard::advancedSettingsCxx()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentFlags(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsCxx> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentFlags(settings, window));
}
}
);
@@ -4,11 +4,11 @@
#include <QComboBox>
#include <QLabel>
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "utility/logging/logging.h"
QtProjectWizzardContentCrossCompilationOptions::QtProjectWizzardContentCrossCompilationOptions(
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> sourceGroupSettings,
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(window)
@@ -61,7 +61,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
QLabel* label = new QLabel("Architecture:");
m_arch = new QComboBox();
std::vector<std::wstring> archTypes = SourceGroupSettingsCxxEmpty::getAvailableArchTypes();
std::vector<std::wstring> archTypes = SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableArchTypes();
std::sort(archTypes.begin(), archTypes.end());
for (size_t i = 0; i < archTypes.size(); i++)
{
@@ -77,7 +77,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
QLabel* label = new QLabel("Vendor:");
m_vendor = new QComboBox();
std::vector<std::wstring> vendorTypes = SourceGroupSettingsCxxEmpty::getAvailableVendorTypes();
std::vector<std::wstring> vendorTypes = SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableVendorTypes();
std::sort(vendorTypes.begin() + 1, vendorTypes.end());
for (size_t i = 0; i < vendorTypes.size(); i++)
{
@@ -92,7 +92,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
QLabel* label = new QLabel("OS:");
m_sys = new QComboBox();
std::vector<std::wstring> osTypes = SourceGroupSettingsCxxEmpty::getAvailableOsTypes();
std::vector<std::wstring> osTypes = SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableOsTypes();
std::sort(osTypes.begin() + 1, osTypes.end());
for (size_t i = 0; i < osTypes.size(); i++)
{
@@ -107,7 +107,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
QLabel* label = new QLabel("Environment:");
m_abi = new QComboBox();
std::vector<std::wstring> environmentTypes = SourceGroupSettingsCxxEmpty::getAvailableEnvironmentTypes();
std::vector<std::wstring> environmentTypes = SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableEnvironmentTypes();
std::sort(environmentTypes.begin() + 1, environmentTypes.end());
for (size_t i = 0; i < environmentTypes.size(); i++)
{
@@ -129,28 +129,22 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
void QtProjectWizzardContentCrossCompilationOptions::load()
{
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(m_sourceGroupSettings))
{
m_useTargetOptions->setChecked(cxxSettings->getTargetOptionsEnabled());
m_arch->setCurrentText(QString::fromStdWString(cxxSettings->getTargetArch()));
m_vendor->setCurrentText(QString::fromStdWString(cxxSettings->getTargetVendor()));
m_sys->setCurrentText(QString::fromStdWString(cxxSettings->getTargetSys()));
m_abi->setCurrentText(QString::fromStdWString(cxxSettings->getTargetAbi()));
}
m_useTargetOptions->setChecked(m_sourceGroupSettings->getTargetOptionsEnabled());
m_arch->setCurrentText(QString::fromStdWString(m_sourceGroupSettings->getTargetArch()));
m_vendor->setCurrentText(QString::fromStdWString(m_sourceGroupSettings->getTargetVendor()));
m_sys->setCurrentText(QString::fromStdWString(m_sourceGroupSettings->getTargetSys()));
m_abi->setCurrentText(QString::fromStdWString(m_sourceGroupSettings->getTargetAbi()));
updateTargetOptionsEnabled();
}
void QtProjectWizzardContentCrossCompilationOptions::save()
{
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(m_sourceGroupSettings))
{
cxxSettings->setTargetOptionsEnabled(m_useTargetOptions->isChecked());
cxxSettings->setTargetArch(m_arch->currentText().toStdWString());
cxxSettings->setTargetVendor(m_vendor->currentText().toStdWString());
cxxSettings->setTargetSys(m_sys->currentText().toStdWString());
cxxSettings->setTargetAbi(m_abi->currentText().toStdWString());
}
m_sourceGroupSettings->setTargetOptionsEnabled(m_useTargetOptions->isChecked());
m_sourceGroupSettings->setTargetArch(m_arch->currentText().toStdWString());
m_sourceGroupSettings->setTargetVendor(m_vendor->currentText().toStdWString());
m_sourceGroupSettings->setTargetSys(m_sys->currentText().toStdWString());
m_sourceGroupSettings->setTargetAbi(m_abi->currentText().toStdWString());
}
bool QtProjectWizzardContentCrossCompilationOptions::check()
@@ -6,7 +6,7 @@
class QCheckBox;
class QComboBox;
class QLabel;
class SourceGroupSettings;
class SourceGroupSettingsWithCxxCrossCompilationOptions;
class QtProjectWizzardContentCrossCompilationOptions
: public QtProjectWizzardContent
@@ -15,7 +15,7 @@ class QtProjectWizzardContentCrossCompilationOptions
public:
QtProjectWizzardContentCrossCompilationOptions(
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> sourceGroupSettings,
QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
@@ -29,7 +29,7 @@ private:
void onUseTargetOptionsChanged();
void updateTargetOptionsEnabled();
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> m_sourceGroupSettings;
QCheckBox* m_useTargetOptions;
QComboBox* m_arch;
@@ -6,7 +6,8 @@
#include "qt/element/QtStringListBox.h"
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings,
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(window)
, m_settings(settings)
@@ -14,7 +14,10 @@ class QtProjectWizzardContentExtensions
Q_OBJECT
public:
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentExtensions(
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings,
QtProjectWizzardWindow* window
);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -6,7 +6,7 @@
#include "qt/element/QtStringListBox.h"
#include "settings/SourceGroupSettingsCxx.h"
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional)
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettingsCxx> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_indicateAsAdditional(indicateAsAdditional)
@@ -35,20 +35,12 @@ void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentFlags::load()
{
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
m_list->setStrings(cxxSettings->getCompilerFlags());
}
m_list->setStrings(m_settings->getCompilerFlags());
}
void QtProjectWizzardContentFlags::save()
{
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
cxxSettings->setCompilerFlags(m_list->getStrings());
}
m_settings->setCompilerFlags(m_list->getStrings());
}
bool QtProjectWizzardContentFlags::check()
@@ -4,7 +4,7 @@
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
class QtStringListBox;
class SourceGroupSettings;
class SourceGroupSettingsCxx;
class QtProjectWizzardContentFlags
: public QtProjectWizzardContent
@@ -12,7 +12,7 @@ class QtProjectWizzardContentFlags
Q_OBJECT
public:
QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional = false);
QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettingsCxx> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional = false);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -22,7 +22,7 @@ public:
virtual bool check() override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
std::shared_ptr<SourceGroupSettingsCxx> m_settings;
const bool m_indicateAsAdditional;
QtStringListBox* m_list;
@@ -8,6 +8,11 @@
#include "data/indexer/IndexerCommandCxxCdb.h"
#include "project/SourceGroupCxxCdb.h"
#include "project/SourceGroupCxxCodeblocks.h"
#include "project/SourceGroupCxxSonargraph.h"
#include "project/SourceGroupJavaSonargraph.h"
#include "project/SourceGroupJavaGradle.h"
#include "project/SourceGroupJavaMaven.h"
#include "qt/element/QtLocationPicker.h"
#include "qt/view/QtDialogView.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
@@ -16,21 +21,20 @@
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "settings/SourceGroupSettingsJavaMaven.h"
#include "settings/SourceGroupSettingsJavaGradle.h"
#include "settings/SourceGroupSettingsJavaSonargraph.h"
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
#include "utility/file/FileManager.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/sonargraph/SonargraphProject.h"
#include "utility/codeblocks/CodeblocksProject.h"
#include "utility/ScopedFunctor.h"
#include "utility/utility.h"
#include "utility/utilityGradle.h"
#include "utility/utilityMaven.h"
#include "Application.h"
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
QtProjectWizzardContentPath::QtProjectWizzardContentPath(QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_makePathRelativeToProjectFileLocation(true)
{
}
@@ -50,7 +54,7 @@ void QtProjectWizzardContentPath::populate(QGridLayout* layout, int& row)
if (m_makePathRelativeToProjectFileLocation)
{
m_picker->setRelativeRootDirectory(m_settings->getProjectDirectoryPath());
m_picker->setRelativeRootDirectory(getSourceGroupSettings()->getProjectDirectoryPath());
}
layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL);
@@ -69,7 +73,7 @@ bool QtProjectWizzardContentPath::check()
break;
}
FilePath path = m_settings->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdWString()));
FilePath path = getSourceGroupSettings()->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdWString()));
if (m_picker->pickDirectory())
{
@@ -119,9 +123,10 @@ void QtProjectWizzardContentPath::setFileEndings(const std::set<std::wstring>& f
QtProjectWizzardContentPathCDB::QtProjectWizzardContentPathCDB(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsCxxCdb> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Compilation Database (compile_commands.json)");
setHelpString(
@@ -164,39 +169,30 @@ void QtProjectWizzardContentPathCDB::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentPathCDB::load()
{
m_picker->setText(QString::fromStdWString(m_settings->getCompilationDatabasePath().wstr()));
m_filePaths.clear();
const FilePath projectPath = m_settings->getProjectDirectoryPath();
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
for (FilePath path : SourceGroupCxxCdb(m_settings).getAllSourceFilePaths())
{
m_picker->setText(QString::fromStdWString(cxxSettings->getCompilationDatabasePath().wstr()));
for (FilePath path : SourceGroupCxxCdb(cxxSettings).getAllSourceFilePaths())
if (projectPath.exists())
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
m_filePaths.push_back(path);
path.makeRelativeTo(projectPath);
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the compilation database.");
}
m_filePaths.push_back(path);
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the compilation database.");
}
}
void QtProjectWizzardContentPathCDB::save()
{
std::shared_ptr<SourceGroupSettingsCxxCdb> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
if (settings)
{
settings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdWString()));
}
m_settings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdWString()));
}
std::vector<FilePath> QtProjectWizzardContentPathCDB::getFilePaths() const
@@ -220,29 +216,32 @@ void QtProjectWizzardContentPathCDB::pickedPath()
{
m_window->saveContent();
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
const FilePath projectPath = m_settings->getProjectDirectoryPath();
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings))
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(m_settings))
{
if (projectPath.contains(path))
{
if (projectPath.contains(path))
{
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
cdbSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
}
m_settings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
m_window->loadContent();
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentPathCDB::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentCodeblocksProjectPath::QtProjectWizzardContentCodeblocksProjectPath(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Code::Blocks Project (.cbp)");
setHelpString(
@@ -284,40 +283,30 @@ void QtProjectWizzardContentCodeblocksProjectPath::populate(QGridLayout* layout,
void QtProjectWizzardContentCodeblocksProjectPath::load()
{
m_picker->setText(QString::fromStdWString(m_settings->getCodeblocksProjectPath().wstr()));
m_filePaths.clear();
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
if (settings)
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : SourceGroupCxxCodeblocks(m_settings).getAllSourceFilePaths())
{
m_picker->setText(QString::fromStdWString(settings->getCodeblocksProjectPath().wstr()));
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
if (projectPath.exists())
{
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(
codeblocksProjectPath
))
{
m_filePaths = utility::toVector(codeblocksProject->getAllSourceFilePathsCanonical(settings));
}
path.makeRelativeTo(projectPath);
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Code::Blocks project.");
}
m_filePaths.push_back(path);
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Code::Blocks project.");
}
}
void QtProjectWizzardContentCodeblocksProjectPath::save()
{
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
if (settings)
{
settings->setCodeblocksProjectPath(FilePath(m_picker->getText().toStdWString()));
}
m_settings->setCodeblocksProjectPath(FilePath(m_picker->getText().toStdWString()));
}
bool QtProjectWizzardContentCodeblocksProjectPath::check()
@@ -346,29 +335,37 @@ void QtProjectWizzardContentCodeblocksProjectPath::pickedPath()
{
m_window->saveContent();
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
{
const FilePath projectPath = m_settings->getProjectDirectoryPath();
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings))
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(m_settings))
{
if (projectPath.contains(path))
{
if (projectPath.contains(path))
{
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
codeblocksSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
}
m_settings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
m_window->loadContent();
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentCodeblocksProjectPath::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentSonargraphProjectPath::QtProjectWizzardContentSonargraphProjectPath(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings,
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph,
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settingsWithSonargraphProjectPath,
QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
, m_settingsCxxSonargraph(settingsCxxSonargraph)
, m_settingsWithSonargraphProjectPath(settingsWithSonargraphProjectPath)
{
setTitleString("Sonargraph Project (system.sonargraph)");
setHelpString(
@@ -410,65 +407,59 @@ void QtProjectWizzardContentSonargraphProjectPath::populate(QGridLayout* layout,
void QtProjectWizzardContentSonargraphProjectPath::load()
{
m_picker->setText(QString::fromStdWString(m_settingsWithSonargraphProjectPath->getSonargraphProjectPath().wstr()));
m_filePaths.clear();
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
std::set<FilePath> allSourceFilePaths;
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
{
m_picker->setText(QString::fromStdWString(settings->getSonargraphProjectPath().wstr()));
const FilePath sonargraphProjectPath = settings->getSonargraphProjectPathExpandedAndAbsolute();
if (!sonargraphProjectPath.empty() && sonargraphProjectPath.exists())
allSourceFilePaths = SourceGroupCxxSonargraph(settings).getAllSourceFilePaths();
}
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(m_settings))
{
allSourceFilePaths = SourceGroupJavaSonargraph(settings).getAllSourceFilePaths();
}
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : allSourceFilePaths)
{
if (projectPath.exists())
{
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
sonargraphProjectPath, m_settings->getLanguage()
))
{
m_filePaths = utility::toVector(sonargraphProject->getAllSourceFilePathsCanonical());
}
path.makeRelativeTo(projectPath);
}
m_filePaths.push_back(path);
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Sonargraph project.");
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Sonargraph project.");
}
}
void QtProjectWizzardContentSonargraphProjectPath::save()
{
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
{
settings->setSonargraphProjectPath(FilePath(m_picker->getText().toStdWString()));
}
m_settingsWithSonargraphProjectPath->setSonargraphProjectPath(FilePath(m_picker->getText().toStdWString()));
}
bool QtProjectWizzardContentSonargraphProjectPath::check()
{
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
m_settingsWithSonargraphProjectPath->getSonargraphProjectPathExpandedAndAbsolute(), m_settings->getLanguage()
))
{
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
settings->getSonargraphProjectPathExpandedAndAbsolute(), m_settings->getLanguage()
))
if (sonargraphProject->getLoadedModuleCount() == 0)
{
if (sonargraphProject->getLoadedModuleCount() == 0)
{
QMessageBox msgBox;
msgBox.setText(QString::fromStdString(
"The Sonargraph project file doesn't seem to contain any supported " +
languageTypeToString(m_settings->getLanguage()) + " modules. Please " +
"consider choosing another project file or removing this sourcegroup."
));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
return msgBox.exec() == QMessageBox::Ok;
}
QMessageBox msgBox;
msgBox.setText(QString::fromStdString(
"The Sonargraph project file doesn't seem to contain any supported " +
languageTypeToString(m_settings->getLanguage()) + " modules. Please " +
"consider choosing another project file or removing this sourcegroup."
));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
return msgBox.exec() == QMessageBox::Ok;
}
}
return true;
@@ -495,30 +486,34 @@ void QtProjectWizzardContentSonargraphProjectPath::pickedPath()
{
m_window->saveContent();
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
if (m_settingsCxxSonargraph)
{
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::set<FilePath> indexedHeaderPaths;
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings))
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromSonargraphProject(m_settingsCxxSonargraph))
{
std::string asdasd = path.str();
if (projectPath.contains(path))
{
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
}
}
sonargraphSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
m_settingsCxxSonargraph->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
}
m_window->loadContent();
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentSonargraphProjectPath::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentPathSourceMaven::QtProjectWizzardContentPathSourceMaven(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsJavaMaven> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Maven Project File (pom.xml)");
setHelpString(
@@ -550,88 +545,77 @@ void QtProjectWizzardContentPathSourceMaven::populate(QGridLayout* layout, int&
void QtProjectWizzardContentPathSourceMaven::load()
{
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
if (settings)
{
m_picker->setText(QString::fromStdWString(settings->getMavenProjectFilePath().wstr()));
m_shouldIndexTests->setChecked(settings->getShouldIndexMavenTests());
}
m_picker->setText(QString::fromStdWString(m_settings->getMavenProjectFilePath().wstr()));
m_shouldIndexTests->setChecked(m_settings->getShouldIndexMavenTests());
}
void QtProjectWizzardContentPathSourceMaven::save()
{
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
if (settings)
{
settings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdWString()));
settings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
}
m_settings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdWString()));
m_settings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
}
std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() const
{
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
{
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
const FilePath mavenProjectRoot = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
if (!mavenProjectRoot.exists())
{
LOG_INFO("Could not find any source file paths because Maven project path does not exist.");
return std::vector<FilePath>();
}
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
ScopedFunctor scopedFunctor([&dialogView]() {
dialogView->hideUnknownProgressDialog();
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nGenerating Source Files");
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
if (!success)
{
const std::wstring dialogMessage =
L"Sourcetrail was unable to locate Maven on this machine.\n"
"Please make sure to provide the correct Maven Path in the preferences.";
MessageStatus(dialogMessage, true, false).dispatch();
Application::getInstance()->handleDialog(dialogMessage);
return std::vector<FilePath>();
}
}
std::vector<FilePath> list;
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
ScopedFunctor scopedFunctor([&dialogView](){
dialogView->hideUnknownProgressDialog();
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nGenerating Source Files");
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
if (!success)
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : SourceGroupJavaMaven(m_settings).getAllSourceFilePaths())
{
const std::wstring dialogMessage =
L"Sourcetrail was unable to locate Maven on this machine.\n"
"Please make sure to provide the correct Maven Path in the preferences.";
MessageStatus(dialogMessage, true, false).dispatch();
Application::getInstance()->handleDialog(dialogMessage);
}
else
{
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nFetching Source Directories");
const std::vector<FilePath> sourceDirectories = utility::mavenGetAllDirectoriesFromEffectivePom(
mavenPath,
mavenProjectRoot,
settings->getShouldIndexMavenTests()
);
FileManager fileManager;
fileManager.update(
sourceDirectories,
settings->getExcludeFiltersExpandedAndAbsolute(),
settings->getSourceExtensions()
);
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : fileManager.getAllSourceFilePaths())
if (projectPath.exists())
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
list.push_back(path);
path.makeRelativeTo(projectPath);
}
list.push_back(path);
}
return list;
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentPathSourceMaven::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDependenciesMaven(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsJavaMaven> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Intermediate Dependencies Directory");
setHelpString(
@@ -643,27 +627,25 @@ QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDepende
void QtProjectWizzardContentPathDependenciesMaven::load()
{
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
if (settings)
{
m_picker->setText(QString::fromStdWString(settings->getMavenDependenciesDirectory().wstr()));
}
m_picker->setText(QString::fromStdWString(m_settings->getMavenDependenciesDirectory().wstr()));
}
void QtProjectWizzardContentPathDependenciesMaven::save()
{
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
if (settings)
{
settings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
}
m_settings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentPathDependenciesMaven::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentPathSourceGradle::QtProjectWizzardContentPathSourceGradle(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsJavaGradle> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Gradle Project File (build.gradle)");
setHelpString(
@@ -695,74 +677,43 @@ void QtProjectWizzardContentPathSourceGradle::populate(QGridLayout* layout, int&
void QtProjectWizzardContentPathSourceGradle::load()
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
if (settings)
{
m_picker->setText(QString::fromStdWString(settings->getGradleProjectFilePath().wstr()));
m_shouldIndexTests->setChecked(settings->getShouldIndexGradleTests());
}
m_picker->setText(QString::fromStdWString(m_settings->getGradleProjectFilePath().wstr()));
m_shouldIndexTests->setChecked(m_settings->getShouldIndexGradleTests());
}
void QtProjectWizzardContentPathSourceGradle::save()
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
if (settings)
{
settings->setGradleProjectFilePath(FilePath(m_picker->getText().toStdWString()));
settings->setShouldIndexGradleTests(m_shouldIndexTests->isChecked());
}
m_settings->setGradleProjectFilePath(FilePath(m_picker->getText().toStdWString()));
m_settings->setShouldIndexGradleTests(m_shouldIndexTests->isChecked());
}
std::vector<FilePath> QtProjectWizzardContentPathSourceGradle::getFilePaths() const
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
std::vector<FilePath> list;
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
ScopedFunctor scopedFunctor([&dialogView]() {
dialogView->hideUnknownProgressDialog();
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : SourceGroupJavaGradle(m_settings).getAllSourceFilePaths())
{
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Gradle\nFetching Source Directories");
const std::vector<FilePath> sourceDirectories = utility::gradleGetAllSourceDirectories(
gradleProjectRoot,
settings->getShouldIndexGradleTests()
);
FileManager fileManager;
fileManager.update(
sourceDirectories,
settings->getExcludeFiltersExpandedAndAbsolute(),
settings->getSourceExtensions()
);
const FilePath projectPath = settings->getProjectDirectoryPath();
for (FilePath path : fileManager.getAllSourceFilePaths())
if (projectPath.exists())
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
list.push_back(path);
path.makeRelativeTo(projectPath);
}
list.push_back(path);
}
return list;
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentPathSourceGradle::getSourceGroupSettings()
{
return m_settings;
}
QtProjectWizzardContentPathDependenciesGradle::QtProjectWizzardContentPathDependenciesGradle(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsJavaGradle> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
: QtProjectWizzardContentPath(window)
, m_settings(settings)
{
setTitleString("Intermediate Dependencies Directory");
setHelpString(
@@ -774,18 +725,15 @@ QtProjectWizzardContentPathDependenciesGradle::QtProjectWizzardContentPathDepend
void QtProjectWizzardContentPathDependenciesGradle::load()
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
if (settings)
{
m_picker->setText(QString::fromStdWString(settings->getGradleDependenciesDirectory().wstr()));
}
m_picker->setText(QString::fromStdWString(m_settings->getGradleDependenciesDirectory().wstr()));
}
void QtProjectWizzardContentPathDependenciesGradle::save()
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
if (settings)
{
settings->setGradleDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
}
m_settings->setGradleDependenciesDirectory(FilePath(m_picker->getText().toStdWString()));
}
std::shared_ptr<SourceGroupSettings> QtProjectWizzardContentPathDependenciesGradle::getSourceGroupSettings()
{
return m_settings;
}
@@ -11,6 +11,12 @@ class QPushButton;
class QtLocationPicker;
class SourceGroupSettings;
class SourceGroupSettingsCxxCdb;
class SourceGroupSettingsCxxCodeblocks;
class SourceGroupSettingsCxxSonargraph;
class SourceGroupSettingsJavaGradle;
class SourceGroupSettingsJavaMaven;
class SourceGroupSettingsWithSonargraphProjectPath;
class QtProjectWizzardContentPath
: public QtProjectWizzardContent
@@ -18,7 +24,7 @@ class QtProjectWizzardContentPath
Q_OBJECT
public:
QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPath(QtProjectWizzardWindow* window);
// QtSettingsWindow implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -31,13 +37,13 @@ protected:
void setFileEndings(const std::set<std::wstring>& fileEndings);
std::shared_ptr<SourceGroupSettings> m_settings;
QtLocationPicker* m_picker;
bool m_makePathRelativeToProjectFileLocation;
private:
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0;
QString m_titleString;
QString m_helpString;
std::set<std::wstring> m_fileEndings;
@@ -50,22 +56,25 @@ class QtProjectWizzardContentPathCDB
Q_OBJECT
public:
QtProjectWizzardContentPathCDB(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathCDB(std::shared_ptr<SourceGroupSettingsCxxCdb> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
void load() override;
void save() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
std::vector<FilePath> getFilePaths() const override;
QString getFileNamesTitle() const override;
QString getFileNamesDescription() const override;
private slots:
void pickedPath();
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsCxxCdb> m_settings;
QLabel* m_fileCountLabel;
std::vector<FilePath> m_filePaths;
};
@@ -77,23 +86,28 @@ class QtProjectWizzardContentCodeblocksProjectPath
Q_OBJECT
public:
QtProjectWizzardContentCodeblocksProjectPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentCodeblocksProjectPath(
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings,
QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
virtual bool check() override;
void load() override;
void save() override;
bool check() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
std::vector<FilePath> getFilePaths() const override;
QString getFileNamesTitle() const override;
QString getFileNamesDescription() const override;
private slots:
void pickedPath();
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> m_settings;
QLabel* m_fileCountLabel;
std::vector<FilePath> m_filePaths;
};
@@ -105,23 +119,32 @@ class QtProjectWizzardContentSonargraphProjectPath
Q_OBJECT
public:
QtProjectWizzardContentSonargraphProjectPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentSonargraphProjectPath(
std::shared_ptr<SourceGroupSettings> settings,
std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph,
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settingsWithSonargraphProjectPath,
QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
virtual bool check() override;
void load() override;
void save() override;
bool check() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
std::vector<FilePath> getFilePaths() const override;
QString getFileNamesTitle() const override;
QString getFileNamesDescription() const override;
private slots:
void pickedPath();
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettings> m_settings;
std::shared_ptr<SourceGroupSettingsCxxSonargraph> m_settingsCxxSonargraph;
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> m_settingsWithSonargraphProjectPath;
QLabel* m_fileCountLabel;
std::vector<FilePath> m_filePaths;
};
@@ -132,17 +155,20 @@ class QtProjectWizzardContentPathSourceMaven
{
Q_OBJECT
public:
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<SourceGroupSettingsJavaMaven> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
void load() override;
void save() override;
virtual std::vector<FilePath> getFilePaths() const override;
std::vector<FilePath> getFilePaths() const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsJavaMaven> m_settings;
QCheckBox* m_shouldIndexTests;
};
@@ -152,11 +178,16 @@ class QtProjectWizzardContentPathDependenciesMaven
{
Q_OBJECT
public:
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<SourceGroupSettingsJavaMaven> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
virtual void save() override;
void load() override;
void save() override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsJavaMaven> m_settings;
};
@@ -165,17 +196,20 @@ class QtProjectWizzardContentPathSourceGradle
{
Q_OBJECT
public:
QtProjectWizzardContentPathSourceGradle(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathSourceGradle(std::shared_ptr<SourceGroupSettingsJavaGradle> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
void load() override;
void save() override;
virtual std::vector<FilePath> getFilePaths() const override;
std::vector<FilePath> getFilePaths() const override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsJavaGradle> m_settings;
QCheckBox* m_shouldIndexTests;
};
@@ -185,11 +219,16 @@ class QtProjectWizzardContentPathDependenciesGradle
{
Q_OBJECT
public:
QtProjectWizzardContentPathDependenciesGradle(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathDependenciesGradle(std::shared_ptr<SourceGroupSettingsJavaGradle> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
virtual void save() override;
void load() override;
void save() override;
private:
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<SourceGroupSettingsJavaGradle> m_settings;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_PATH_H
@@ -6,18 +6,19 @@
#include <QMessageBox>
#include <QVBoxLayout>
#include "Application.h"
#include "component/view/DialogView.h"
#include "data/indexer/IndexerCommandCxxCdb.h"
#include "utility/IncludeDirective.h"
#include "utility/IncludeProcessing.h"
#include "project/SourceGroupCxxEmpty.h"
#include "project/SourceGroupJavaEmpty.h"
#include "qt/view/QtDialogView.h"
#include "qt/window/QtPathListDialog.h"
#include "qt/window/QtSelectPathsDialog.h"
#include "settings/ApplicationSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "settings/SourceGroupSettingsJavaEmpty.h"
#include "settings/SourceGroupSettingsWithClasspath.h"
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
@@ -27,11 +28,14 @@
#include "utility/file/FileManager.h"
#include "utility/sonargraph/SonargraphProject.h"
#include "utility/CompilationDatabase.h"
#include "utility/IncludeDirective.h"
#include "utility/IncludeProcessing.h"
#include "utility/ScopedFunctor.h"
#include "utility/utility.h"
#include "utility/utilityFile.h"
#include "utility/utilityPathDetection.h"
#include "utility/utilityString.h"
#include "Application.h"
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(
std::shared_ptr<SourceGroupSettings> settings,
@@ -235,32 +239,29 @@ void QtProjectWizzardContentPathsSource::save()
std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
{
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
ScopedFunctor scopedFunctor([&dialogView](){
dialogView->hideUnknownProgressDialog();
});
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
std::set<FilePath> allSourceFilePaths;
if (std::shared_ptr<SourceGroupSettingsCxx> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings))
{
FileManager fileManager;
fileManager.update(
pathSettings->getSourcePathsExpandedAndAbsolute(),
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
extensionSettings->getSourceExtensions()
);
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
return utility::toVector(filePaths);
allSourceFilePaths = SourceGroupCxxEmpty(settings).getAllSourceFilePaths();
}
return std::vector<FilePath>();
else if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(m_settings))
{
allSourceFilePaths = SourceGroupJavaEmpty(settings).getAllSourceFilePaths();
}
std::vector<FilePath> filePaths;
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : allSourceFilePaths)
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
filePaths.push_back(path);
}
return filePaths;
}
QString QtProjectWizzardContentPathsSource::getFileNamesTitle() const
@@ -24,7 +24,7 @@ std::vector<FilePath> SourceGroupJavaEmpty::getAllSourcePaths() const
std::vector<FilePath> SourceGroupJavaEmpty::doGetClassPath() const
{
return utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
return utility::getClassPath(m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths());
}
std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSettingsJava()
@@ -42,12 +42,16 @@ std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const
dialogView->hideUnknownProgressDialog();
}
else
{
LOG_INFO("Could not find any source paths because Gradle project path does not exist.");
}
return sourcePaths;
}
std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() const
{
std::vector<FilePath> classPath = utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
std::vector<FilePath> classPath = utility::getClassPath({}, true, getAllSourceFilePaths());
if (m_settings->getGradleDependenciesDirectoryExpandedAndAbsolute().exists())
{
@@ -50,7 +50,7 @@ std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const
std::vector<FilePath> SourceGroupJavaMaven::doGetClassPath() const
{
std::vector<FilePath> classPath = utility::getClassPath(getSourceGroupSettingsJava(), getAllSourceFilePaths());
std::vector<FilePath> classPath = utility::getClassPath({}, true, getAllSourceFilePaths());
if (m_settings && m_settings->getMavenDependenciesDirectoryExpandedAndAbsolute().exists())
{
@@ -92,7 +92,10 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJavaSonargraph::getIndex
if (!indexerCommands.empty())
{
const std::vector<FilePath> classPath = utility::getClassPath(m_settings, getAllSourceFilePaths()); // TODO: remove this hack once sourcegroup and sourcegroupsettings are merged
// TODO: remove this hack once sourcegroup and sourcegroupsettings are merged
const std::vector<FilePath> classPath = utility::getClassPath(
m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths()
);
for (std::shared_ptr<IndexerCommand> indexerCommand : indexerCommands)
{
if (std::shared_ptr<IndexerCommandJava> javaIndexerCommand = std::dynamic_pointer_cast<IndexerCommandJava>(indexerCommand))
+3 -3
View File
@@ -149,11 +149,11 @@ namespace utility
return rootDirectories;
}
std::vector<FilePath> getClassPath(std::shared_ptr<const SourceGroupSettingsWithClasspath> settings, const std::set<FilePath>& sourceFilePaths)
std::vector<FilePath> getClassPath(const std::vector<FilePath>& classpathItems, bool useJreSystemLibrary, const std::set<FilePath>& sourceFilePaths)
{
std::vector<FilePath> classPath;
for (const FilePath& classpath : settings->getClasspathExpandedAndAbsolute())
for (const FilePath& classpath : classpathItems)
{
if (classpath.exists())
{
@@ -162,7 +162,7 @@ namespace utility
}
}
if (settings->getUseJreSystemLibrary())
if (useJreSystemLibrary)
{
for (const FilePath& systemLibraryPath : ApplicationSettings::getInstance()->getJreSystemLibraryPathsExpanded())
{
+2 -1
View File
@@ -15,7 +15,8 @@ namespace utility
bool prepareJavaEnvironmentAndDisplayOccurringErrors();
std::set<FilePath> fetchRootDirectories(const std::set<FilePath>& sourceFilePaths);
std::vector<FilePath> getClassPath(
std::shared_ptr<const SourceGroupSettingsWithClasspath> settings,
const std::vector<FilePath>& classpathItems,
bool useJreSystemLibrary,
const std::set<FilePath>& sourceFilePaths);
}