ui: Extended project setup to support creation and editing of Source Groups (issue #230)

* Turned QtProjectWizzard into window for Source Group ui
* Clicking into FilePicker when empty will open dialog right away
* Fixed environment variable use throughout all Source Group path values
* Moved Preferences to QtPreferencesWindow

bug id = 230

fortune cookie message = Zwischen dir und deinen Freunden besteht echte Freundschaft.
This commit is contained in:
Eberhard Graether
2017-05-29 17:08:28 +02:00
parent 13f7acbb70
commit 9256618f7c
53 changed files with 1666 additions and 1220 deletions
@@ -135,32 +135,30 @@ void IDECommunicationController::handleSetActiveTokenMessage(
void IDECommunicationController::handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message)
{
if (message.valid)
{
if (message.ideId == "vs")
{
std::shared_ptr<MessageProjectNew> msg = std::make_shared<MessageProjectNew>();
msg->setSolutionPath(message.solutionFileLocation);
msg->ideId = message.ideId;
MessageDispatchWhenLicenseValid(msg).dispatch();
}
else
{
LOG_ERROR_STREAM(<< "Unable to parse provided solution, unknown format");
}
}
LOG_ERROR_STREAM(<< "Network Protocol CreateProjectMessage not supported anymore.");
// if (message.valid)
// {
// if (message.ideId == "vs")
// {
// std::shared_ptr<MessageProjectNew> msg = std::make_shared<MessageProjectNew>();
// msg->setSolutionPath(message.solutionFileLocation);
// msg->ideId = message.ideId;
// MessageDispatchWhenLicenseValid(msg).dispatch();
// }
// else
// {
// LOG_ERROR_STREAM(<< "Unable to parse provided solution, unknown format");
// }
// }
}
void IDECommunicationController::handleCreateCDBProjectMessage(const NetworkProtocolHelper::CreateCDBProjectMessage& message)
{
if (message.valid)
{
std::shared_ptr<MessageProjectNew> msg = std::make_shared<MessageProjectNew>();
msg->setSolutionPath(message.cdbFileLocation);
msg->setHeaderPaths(message.headerPaths);
msg->ideId = message.ideId;
MessageDispatchWhenLicenseValid(msg).dispatch();
MessageDispatchWhenLicenseValid(
std::make_shared<MessageProjectNew>(message.cdbFileLocation, message.headerPaths)).dispatch();
}
else
{
+18 -8
View File
@@ -177,6 +177,12 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
continue;
}
const std::string name = getValue<std::string>(key + "/name", "");
if (name.size())
{
settings->setName(name);
}
settings->setStandard(getValue<std::string>(key + "/standard", ""));
settings->setSourcePaths(getPathValues(key + "/source_paths/source_path"));
settings->setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path"));
@@ -188,7 +194,7 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
return allSettings;
}
void ProjectSettings::setAllSourceGroupSettings(std::vector<std::shared_ptr<SourceGroupSettings>> allSettings)
void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_ptr<SourceGroupSettings>>& allSettings)
{
for (const std::string& key: m_config->getSublevelKeys("source_groups"))
{
@@ -201,6 +207,7 @@ void ProjectSettings::setAllSourceGroupSettings(std::vector<std::shared_ptr<Sour
const SourceGroupType type = settings->getType();
setValue(key + "/type", sourceGroupTypeToString(type));
setValue(key + "/name", settings->getName());
setValue(key + "/standard", settings->getStandard());
setPathValues(key + "/source_paths/source_path", settings->getSourcePaths());
setPathValues(key + "/exclude_paths/exclude_path", settings->getExcludePaths());
@@ -246,12 +253,13 @@ void ProjectSettings::setAllSourceGroupSettings(std::vector<std::shared_ptr<Sour
}
}
std::vector<FilePath> ProjectSettings::makePathsAbsolute(const std::vector<FilePath>& paths) const
std::vector<FilePath> ProjectSettings::makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const
{
std::vector<FilePath> absPaths;
std::vector<FilePath> p = expandPaths(paths);
std::vector<FilePath> absPaths;
FilePath basePath = getProjectFileLocation();
for (const FilePath& path : paths)
for (const FilePath& path : p)
{
if (path.isAbsolute())
{
@@ -266,14 +274,16 @@ std::vector<FilePath> ProjectSettings::makePathsAbsolute(const std::vector<FileP
return absPaths;
}
FilePath ProjectSettings::makePathAbsolute(const FilePath& path) const
FilePath ProjectSettings::makePathExpandedAndAbsolute(const FilePath& path) const
{
if (path.empty() || path.isAbsolute())
FilePath p = expandPath(path);
if (p.empty() || p.isAbsolute())
{
return path;
return p;
}
return getProjectFileLocation().concat(path).canonical();
return getProjectFileLocation().concat(p).canonical();
}
SettingsMigrator ProjectSettings::getMigrations() const
+3 -3
View File
@@ -38,10 +38,10 @@ public:
std::string getDescription() const;
std::vector<std::shared_ptr<SourceGroupSettings>> getAllSourceGroupSettings() const;
void setAllSourceGroupSettings(std::vector<std::shared_ptr<SourceGroupSettings>> allSettings);
void setAllSourceGroupSettings(const std::vector<std::shared_ptr<SourceGroupSettings>>& allSettings);
std::vector<FilePath> makePathsAbsolute(const std::vector<FilePath>& paths) const;
FilePath makePathAbsolute(const FilePath& path) const;
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
private:
SettingsMigrator getMigrations() const;
+28 -6
View File
@@ -5,6 +5,7 @@
SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: m_projectSettings(projectSettings)
, m_id(id)
, m_name(sourceGroupTypeToString(type))
, m_type(type)
, m_standard("")
, m_sourcePaths(std::vector<FilePath>())
@@ -21,6 +22,7 @@ bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) con
{
return (
m_id == other->m_id &&
m_name == other->m_name &&
m_type == other->m_type &&
m_standard == other->m_standard &&
utility::isPermutation(m_sourcePaths, other->m_sourcePaths) &&
@@ -34,14 +36,34 @@ std::string SourceGroupSettings::getId() const
return m_id;
}
void SourceGroupSettings::setId(const std::string& id)
{
m_id = id;
}
std::string SourceGroupSettings::getName() const
{
return m_name;
}
void SourceGroupSettings::setName(const std::string& name)
{
m_name = name;
}
FilePath SourceGroupSettings::getProjectFileLocation() const
{
return m_projectSettings->getProjectFileLocation();
}
FilePath SourceGroupSettings::makePathAbsolute(const FilePath& path) const
FilePath SourceGroupSettings::makePathExpandedAndAbsolute(const FilePath& path) const
{
return m_projectSettings->makePathAbsolute(path);
return m_projectSettings->makePathExpandedAndAbsolute(path);
}
std::vector<FilePath> SourceGroupSettings::makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const
{
return m_projectSettings->makePathsExpandedAndAbsolute(paths);
}
SourceGroupType SourceGroupSettings::getType() const
@@ -68,9 +90,9 @@ std::vector<FilePath> SourceGroupSettings::getSourcePaths() const
return m_sourcePaths;
}
std::vector<FilePath> SourceGroupSettings::getAbsoluteSourcePaths() const
std::vector<FilePath> SourceGroupSettings::getSourcePathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsAbsolute(getSourcePaths());
return m_projectSettings->makePathsExpandedAndAbsolute(getSourcePaths());
}
void SourceGroupSettings::setSourcePaths(const std::vector<FilePath>& sourcePaths)
@@ -83,9 +105,9 @@ std::vector<FilePath> SourceGroupSettings::getExcludePaths() const
return m_excludePaths;
}
std::vector<FilePath> SourceGroupSettings::getAbsoluteExcludePaths() const
std::vector<FilePath> SourceGroupSettings::getExcludePathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsAbsolute(getExcludePaths());
return m_projectSettings->makePathsExpandedAndAbsolute(getExcludePaths());
}
void SourceGroupSettings::setExcludePaths(const std::vector<FilePath>& excludePaths)
+10 -4
View File
@@ -18,9 +18,14 @@ public:
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
std::string getId() const;
void setId(const std::string& id);
std::string getName() const;
void setName(const std::string& name);
FilePath getProjectFileLocation() const;
FilePath makePathAbsolute(const FilePath& path) const;
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
virtual std::vector<std::string> getAvailableLanguageStandards() const = 0;
virtual SourceGroupType getType() const;
@@ -29,11 +34,11 @@ public:
void setStandard(const std::string& standard);
std::vector<FilePath> getSourcePaths() const;
std::vector<FilePath> getAbsoluteSourcePaths() const;
std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const;
void setSourcePaths(const std::vector<FilePath>& sourcePaths);
std::vector<FilePath> getExcludePaths() const;
std::vector<FilePath> getAbsoluteExcludePaths() const;
std::vector<FilePath> getExcludePathsExpandedAndAbsolute() const;
void setExcludePaths(const std::vector<FilePath>& excludePaths);
std::vector<std::string> getSourceExtensions() const;
@@ -46,7 +51,8 @@ private:
virtual std::vector<std::string> getDefaultSourceExtensions() const = 0;
virtual std::string getDefaultStandard() const = 0;
const std::string m_id;
std::string m_id;
std::string m_name;
const SourceGroupType m_type;
std::string m_standard;
+6 -6
View File
@@ -101,9 +101,9 @@ std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPaths() const
return m_headerSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsCxx::getAbsoluteHeaderSearchPaths() const
std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsAbsolute(getHeaderSearchPaths());
return m_projectSettings->makePathsExpandedAndAbsolute(getHeaderSearchPaths());
}
void SourceGroupSettingsCxx::setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths)
@@ -116,9 +116,9 @@ std::vector<FilePath> SourceGroupSettingsCxx::getFrameworkSearchPaths() const
return m_frameworkSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsCxx::getAbsoluteFrameworkSearchPaths() const
std::vector<FilePath> SourceGroupSettingsCxx::getFrameworkSearchPathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsAbsolute(getFrameworkSearchPaths());
return m_projectSettings->makePathsExpandedAndAbsolute(getFrameworkSearchPaths());
}
void SourceGroupSettingsCxx::setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths)
@@ -161,9 +161,9 @@ FilePath SourceGroupSettingsCxx::getCompilationDatabasePath() const
return m_compilationDatabasePath;
}
FilePath SourceGroupSettingsCxx::getAbsoluteCompilationDatabasePath() const
FilePath SourceGroupSettingsCxx::getCompilationDatabasePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathAbsolute(getCompilationDatabasePath());
return m_projectSettings->makePathExpandedAndAbsolute(getCompilationDatabasePath());
}
void SourceGroupSettingsCxx::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
+3 -3
View File
@@ -15,11 +15,11 @@ public:
virtual std::vector<std::string> getAvailableLanguageStandards() const;
std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getAbsoluteHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
void setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
std::vector<FilePath> getFrameworkSearchPaths() const;
std::vector<FilePath> getAbsoluteFrameworkSearchPaths() const;
std::vector<FilePath> getFrameworkSearchPathsExpandedAndAbsolute() const;
void setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths);
std::vector<std::string> getCompilerFlags() const;
@@ -33,7 +33,7 @@ public:
// deprecated end
FilePath getCompilationDatabasePath() const;
FilePath getAbsoluteCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
private:
+6 -6
View File
@@ -39,9 +39,9 @@ std::vector<FilePath> SourceGroupSettingsJava::getClasspaths() const
return m_classpaths;
}
std::vector<FilePath> SourceGroupSettingsJava::getAbsoluteClasspaths() const
std::vector<FilePath> SourceGroupSettingsJava::getClasspathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsAbsolute(getClasspaths());
return m_projectSettings->makePathsExpandedAndAbsolute(getClasspaths());
}
void SourceGroupSettingsJava::setClasspaths(const std::vector<FilePath>& classpaths)
@@ -54,9 +54,9 @@ FilePath SourceGroupSettingsJava::getMavenProjectFilePath() const
return m_mavenProjectFilePath;
}
FilePath SourceGroupSettingsJava::getAbsoluteMavenProjectFilePath() const
FilePath SourceGroupSettingsJava::getMavenProjectFilePathExpandedAndAbsolute() const
{
return m_projectSettings->makePathAbsolute(getMavenProjectFilePath());
return m_projectSettings->makePathExpandedAndAbsolute(getMavenProjectFilePath());
}
void SourceGroupSettingsJava::setMavenProjectFilePath(const FilePath& path)
@@ -69,9 +69,9 @@ FilePath SourceGroupSettingsJava::getMavenDependenciesDirectory() const
return m_mavenDependenciesDirectory;
}
FilePath SourceGroupSettingsJava::getAbsoluteMavenDependenciesDirectory() const
FilePath SourceGroupSettingsJava::getMavenDependenciesDirectoryExpandedAndAbsolute() const
{
return m_projectSettings->makePathAbsolute(getMavenDependenciesDirectory());
return m_projectSettings->makePathExpandedAndAbsolute(getMavenDependenciesDirectory());
}
void SourceGroupSettingsJava::setMavenDependenciesDirectory(const FilePath& path)
+3 -3
View File
@@ -18,15 +18,15 @@ public:
virtual std::vector<std::string> getAvailableLanguageStandards() const;
std::vector<FilePath> getClasspaths() const;
std::vector<FilePath> getAbsoluteClasspaths() const;
std::vector<FilePath> getClasspathsExpandedAndAbsolute() const;
void setClasspaths(const std::vector<FilePath>& classpaths);
FilePath getMavenProjectFilePath() const;
FilePath getAbsoluteMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
void setMavenProjectFilePath(const FilePath& path);
FilePath getMavenDependenciesDirectory() const;
FilePath getAbsoluteMavenDependenciesDirectory() const;
FilePath getMavenDependenciesDirectoryExpandedAndAbsolute() const;
void setMavenDependenciesDirectory(const FilePath& path);
bool getShouldIndexMavenTests() const;
+4 -4
View File
@@ -27,17 +27,17 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
switch (v)
{
case SOURCE_GROUP_C_EMPTY:
return "Empty C Project";
return "Empty C Source Group";
case SOURCE_GROUP_CPP_EMPTY:
return "Empty C++ Project";
return "Empty C++ Source Group";
case SOURCE_GROUP_CXX_CDB:
return "C/C++ from Compilation Database";
case SOURCE_GROUP_CXX_VS:
return "C/C++ from Visual Studio";
case SOURCE_GROUP_JAVA_EMPTY:
return "Empty Java Project";
return "Empty Java Source Group";
case SOURCE_GROUP_JAVA_MAVEN:
return "Java Project from Maven";
return "Java Source Group from Maven";
case SOURCE_GROUP_UNKNOWN:
break;
}
@@ -7,10 +7,9 @@ class MessageProjectNew
: public Message<MessageProjectNew>
{
public:
MessageProjectNew()
: solutionPath("")
, headerPaths()
, ideId("")
MessageProjectNew(const std::string cdbPath, const std::vector<std::string> headerPaths)
: cdbPath(cdbPath)
, headerPaths(headerPaths)
{
}
@@ -19,44 +18,8 @@ public:
return "MessageProjectNew";
}
bool fromSolution() const
{
return solutionPath.size() > 0;
}
bool fromCDB() const
{
if (solutionPath.length() > 0)
{
size_t pos = solutionPath.find_last_of('.');
if (pos != std::string::npos)
{
std::string extension = solutionPath.substr(pos + 1);
return (extension == "json");
}
else
{
return false;
}
}
return false;
}
void setSolutionPath(const std::string& path)
{
solutionPath = path;
}
void setHeaderPaths(const std::vector<std::string>& headerPaths)
{
this->headerPaths = headerPaths;
}
std::string solutionPath;
std::vector<std::string> headerPaths;
std::string ideId;
const std::string cdbPath;
const std::vector<std::string> headerPaths;
};
#endif // MESSAGE_PROJECT_NEW_H