diff --git a/bin/app/data/gui/window/window.css b/bin/app/data/gui/window/window.css
index c88073f7..2e724f4c 100644
--- a/bin/app/data/gui/window/window.css
+++ b/bin/app/data/gui/window/window.css
@@ -25,18 +25,15 @@ QCheckBox:disabled {
color: gray;
}
-#projectTitle {
+#sourceGroupTitle {
font-size: 14px;
font-weight: bold;
-}
-
-#projectTitle {
background: white;
padding: 5px;
margin-left: 40px;
}
-#projectDescription {
+#sourceGroupDescription {
font-size: 12px;
margin-left: 20px;
}
@@ -113,7 +110,7 @@ QCheckBox:disabled {
border: 1px solid lightgray;
border-radius: 8px;
color: black;
- padding: 3px 5px 2px;
+ padding: 3px 8px 2px;
font-size: 14px;
min-width: 5em;
}
@@ -148,7 +145,7 @@ QCheckBox:disabled {
background: #CFD2E0;
}
-#projectContainer {
+#sourceGroupContainer {
background: white;
border: 1px solid lightgray;
border-radius: 8px;
@@ -156,7 +153,7 @@ QCheckBox:disabled {
margin-left: 20px;
}
-#projectButton {
+#sourceGroupButton {
background: white;
border-radius: 8px;
color: black;
@@ -166,7 +163,7 @@ QCheckBox:disabled {
margin-top: 10px;
}
-#projectButton:hover, #projectButton:checked {
+#sourceGroupButton:hover, #sourceGroupButton:checked {
background: #CFD2E0;
}
@@ -177,3 +174,57 @@ QCheckBox:disabled {
color: black;
padding: 6px;
}
+
+#project_menu {
+ border-left: 1px solid lightgray;
+}
+
+#project_menu QListWidget {
+ background: white;
+ border: none;
+ border-bottom: 1px solid lightgray;
+ border-left: 1px solid lightgray;
+ color: black;
+ font-size: 12px;
+}
+
+#project_menu QListWidget::item, #project_menu #general_button {
+ background: white;
+ border: none;
+ color: black;
+ margin-top: 5px;
+ padding: 3px 5px;
+}
+
+#project_menu #general_button {
+ margin-top: 10px;
+ font-size: 12px;
+ text-align: left;
+ border-left: 1px solid lightgray;
+ padding: 4px 10px;
+}
+
+#project_menu QLabel {
+ background: white;
+ font-weight: bold;
+ border: none;
+ color: black;
+ font-size: 12px;
+ margin-top: 5px;
+ padding: 3px 7px;
+ border-left: 1px solid lightgray;
+}
+
+#project_menu QListWidget::item:hover, #project_menu QListWidget::item:selected,
+#project_menu #general_button:hover, #project_menu #general_button:checked {
+ background: #CFD2E0;
+ color: black;
+}
+
+#project_menu #action_button {
+ background: white;
+ border: none;
+ color: white;
+ margin: 5px;
+ padding: 1px;
+}
diff --git a/bin/app/user/projects/tictactoe/tictactoe.srctrlprj b/bin/app/user/projects/tictactoe/tictactoe.srctrlprj
index b29d67c8..e9a3b92a 100644
--- a/bin/app/user/projects/tictactoe/tictactoe.srctrlprj
+++ b/bin/app/user/projects/tictactoe/tictactoe.srctrlprj
@@ -13,7 +13,6 @@
c++1z
C++ Source Group
- 0
4
diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp
index 3608bb6b..8cf23b2f 100644
--- a/src/lib/component/controller/IDECommunicationController.cpp
+++ b/src/lib/component/controller/IDECommunicationController.cpp
@@ -135,32 +135,30 @@ void IDECommunicationController::handleSetActiveTokenMessage(
void IDECommunicationController::handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message)
{
- if (message.valid)
- {
- if (message.ideId == "vs")
- {
- std::shared_ptr msg = std::make_shared();
- 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 msg = std::make_shared();
+ // 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 msg = std::make_shared();
- msg->setSolutionPath(message.cdbFileLocation);
- msg->setHeaderPaths(message.headerPaths);
- msg->ideId = message.ideId;
-
- MessageDispatchWhenLicenseValid(msg).dispatch();
+ MessageDispatchWhenLicenseValid(
+ std::make_shared(message.cdbFileLocation, message.headerPaths)).dispatch();
}
else
{
diff --git a/src/lib/settings/ProjectSettings.cpp b/src/lib/settings/ProjectSettings.cpp
index 1e9782e6..8db923df 100644
--- a/src/lib/settings/ProjectSettings.cpp
+++ b/src/lib/settings/ProjectSettings.cpp
@@ -177,6 +177,12 @@ std::vector> ProjectSettings::getAllSourceG
continue;
}
+ const std::string name = getValue(key + "/name", "");
+ if (name.size())
+ {
+ settings->setName(name);
+ }
+
settings->setStandard(getValue(key + "/standard", ""));
settings->setSourcePaths(getPathValues(key + "/source_paths/source_path"));
settings->setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path"));
@@ -188,7 +194,7 @@ std::vector> ProjectSettings::getAllSourceG
return allSettings;
}
-void ProjectSettings::setAllSourceGroupSettings(std::vector> allSettings)
+void ProjectSettings::setAllSourceGroupSettings(const std::vector>& allSettings)
{
for (const std::string& key: m_config->getSublevelKeys("source_groups"))
{
@@ -201,6 +207,7 @@ void ProjectSettings::setAllSourceGroupSettings(std::vectorgetType();
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 ProjectSettings::makePathsAbsolute(const std::vector& paths) const
+std::vector ProjectSettings::makePathsExpandedAndAbsolute(const std::vector& paths) const
{
- std::vector absPaths;
+ std::vector p = expandPaths(paths);
+ std::vector absPaths;
FilePath basePath = getProjectFileLocation();
- for (const FilePath& path : paths)
+ for (const FilePath& path : p)
{
if (path.isAbsolute())
{
@@ -266,14 +274,16 @@ std::vector ProjectSettings::makePathsAbsolute(const std::vector> getAllSourceGroupSettings() const;
- void setAllSourceGroupSettings(std::vector> allSettings);
+ void setAllSourceGroupSettings(const std::vector>& allSettings);
- std::vector makePathsAbsolute(const std::vector& paths) const;
- FilePath makePathAbsolute(const FilePath& path) const;
+ std::vector makePathsExpandedAndAbsolute(const std::vector& paths) const;
+ FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
private:
SettingsMigrator getMigrations() const;
diff --git a/src/lib/settings/SourceGroupSettings.cpp b/src/lib/settings/SourceGroupSettings.cpp
index 5321ce90..705a20d2 100644
--- a/src/lib/settings/SourceGroupSettings.cpp
+++ b/src/lib/settings/SourceGroupSettings.cpp
@@ -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())
@@ -21,6 +22,7 @@ bool SourceGroupSettings::equals(std::shared_ptr 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 SourceGroupSettings::makePathsExpandedAndAbsolute(const std::vector& paths) const
+{
+ return m_projectSettings->makePathsExpandedAndAbsolute(paths);
}
SourceGroupType SourceGroupSettings::getType() const
@@ -68,9 +90,9 @@ std::vector SourceGroupSettings::getSourcePaths() const
return m_sourcePaths;
}
-std::vector SourceGroupSettings::getAbsoluteSourcePaths() const
+std::vector SourceGroupSettings::getSourcePathsExpandedAndAbsolute() const
{
- return m_projectSettings->makePathsAbsolute(getSourcePaths());
+ return m_projectSettings->makePathsExpandedAndAbsolute(getSourcePaths());
}
void SourceGroupSettings::setSourcePaths(const std::vector& sourcePaths)
@@ -83,9 +105,9 @@ std::vector SourceGroupSettings::getExcludePaths() const
return m_excludePaths;
}
-std::vector SourceGroupSettings::getAbsoluteExcludePaths() const
+std::vector SourceGroupSettings::getExcludePathsExpandedAndAbsolute() const
{
- return m_projectSettings->makePathsAbsolute(getExcludePaths());
+ return m_projectSettings->makePathsExpandedAndAbsolute(getExcludePaths());
}
void SourceGroupSettings::setExcludePaths(const std::vector& excludePaths)
diff --git a/src/lib/settings/SourceGroupSettings.h b/src/lib/settings/SourceGroupSettings.h
index 59ccb26a..4b9ffd44 100644
--- a/src/lib/settings/SourceGroupSettings.h
+++ b/src/lib/settings/SourceGroupSettings.h
@@ -18,9 +18,14 @@ public:
virtual bool equals(std::shared_ptr 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 makePathsExpandedAndAbsolute(const std::vector& paths) const;
virtual std::vector getAvailableLanguageStandards() const = 0;
virtual SourceGroupType getType() const;
@@ -29,11 +34,11 @@ public:
void setStandard(const std::string& standard);
std::vector getSourcePaths() const;
- std::vector getAbsoluteSourcePaths() const;
+ std::vector getSourcePathsExpandedAndAbsolute() const;
void setSourcePaths(const std::vector& sourcePaths);
std::vector getExcludePaths() const;
- std::vector getAbsoluteExcludePaths() const;
+ std::vector getExcludePathsExpandedAndAbsolute() const;
void setExcludePaths(const std::vector& excludePaths);
std::vector getSourceExtensions() const;
@@ -46,7 +51,8 @@ private:
virtual std::vector 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;
diff --git a/src/lib/settings/SourceGroupSettingsCxx.cpp b/src/lib/settings/SourceGroupSettingsCxx.cpp
index e7084dc6..16f9ef72 100644
--- a/src/lib/settings/SourceGroupSettingsCxx.cpp
+++ b/src/lib/settings/SourceGroupSettingsCxx.cpp
@@ -101,9 +101,9 @@ std::vector SourceGroupSettingsCxx::getHeaderSearchPaths() const
return m_headerSearchPaths;
}
-std::vector SourceGroupSettingsCxx::getAbsoluteHeaderSearchPaths() const
+std::vector SourceGroupSettingsCxx::getHeaderSearchPathsExpandedAndAbsolute() const
{
- return m_projectSettings->makePathsAbsolute(getHeaderSearchPaths());
+ return m_projectSettings->makePathsExpandedAndAbsolute(getHeaderSearchPaths());
}
void SourceGroupSettingsCxx::setHeaderSearchPaths(const std::vector& headerSearchPaths)
@@ -116,9 +116,9 @@ std::vector SourceGroupSettingsCxx::getFrameworkSearchPaths() const
return m_frameworkSearchPaths;
}
-std::vector SourceGroupSettingsCxx::getAbsoluteFrameworkSearchPaths() const
+std::vector SourceGroupSettingsCxx::getFrameworkSearchPathsExpandedAndAbsolute() const
{
- return m_projectSettings->makePathsAbsolute(getFrameworkSearchPaths());
+ return m_projectSettings->makePathsExpandedAndAbsolute(getFrameworkSearchPaths());
}
void SourceGroupSettingsCxx::setFrameworkSearchPaths(const std::vector& 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)
diff --git a/src/lib/settings/SourceGroupSettingsCxx.h b/src/lib/settings/SourceGroupSettingsCxx.h
index 8af3795c..880ec60e 100644
--- a/src/lib/settings/SourceGroupSettingsCxx.h
+++ b/src/lib/settings/SourceGroupSettingsCxx.h
@@ -15,11 +15,11 @@ public:
virtual std::vector getAvailableLanguageStandards() const;
std::vector getHeaderSearchPaths() const;
- std::vector getAbsoluteHeaderSearchPaths() const;
+ std::vector getHeaderSearchPathsExpandedAndAbsolute() const;
void setHeaderSearchPaths(const std::vector& headerSearchPaths);
std::vector getFrameworkSearchPaths() const;
- std::vector getAbsoluteFrameworkSearchPaths() const;
+ std::vector getFrameworkSearchPathsExpandedAndAbsolute() const;
void setFrameworkSearchPaths(const std::vector& frameworkSearchPaths);
std::vector getCompilerFlags() const;
@@ -33,7 +33,7 @@ public:
// deprecated end
FilePath getCompilationDatabasePath() const;
- FilePath getAbsoluteCompilationDatabasePath() const;
+ FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
private:
diff --git a/src/lib/settings/SourceGroupSettingsJava.cpp b/src/lib/settings/SourceGroupSettingsJava.cpp
index fc9c4bf9..25f03426 100644
--- a/src/lib/settings/SourceGroupSettingsJava.cpp
+++ b/src/lib/settings/SourceGroupSettingsJava.cpp
@@ -39,9 +39,9 @@ std::vector SourceGroupSettingsJava::getClasspaths() const
return m_classpaths;
}
-std::vector SourceGroupSettingsJava::getAbsoluteClasspaths() const
+std::vector SourceGroupSettingsJava::getClasspathsExpandedAndAbsolute() const
{
- return m_projectSettings->makePathsAbsolute(getClasspaths());
+ return m_projectSettings->makePathsExpandedAndAbsolute(getClasspaths());
}
void SourceGroupSettingsJava::setClasspaths(const std::vector& 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)
diff --git a/src/lib/settings/SourceGroupSettingsJava.h b/src/lib/settings/SourceGroupSettingsJava.h
index 55e33396..c7956355 100644
--- a/src/lib/settings/SourceGroupSettingsJava.h
+++ b/src/lib/settings/SourceGroupSettingsJava.h
@@ -18,15 +18,15 @@ public:
virtual std::vector getAvailableLanguageStandards() const;
std::vector getClasspaths() const;
- std::vector getAbsoluteClasspaths() const;
+ std::vector getClasspathsExpandedAndAbsolute() const;
void setClasspaths(const std::vector& 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;
diff --git a/src/lib/settings/SourceGroupType.cpp b/src/lib/settings/SourceGroupType.cpp
index c5e48c90..a0f99398 100644
--- a/src/lib/settings/SourceGroupType.cpp
+++ b/src/lib/settings/SourceGroupType.cpp
@@ -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;
}
diff --git a/src/lib/utility/messaging/type/MessageProjectNew.h b/src/lib/utility/messaging/type/MessageProjectNew.h
index 1f2b5cb4..4de09c38 100644
--- a/src/lib/utility/messaging/type/MessageProjectNew.h
+++ b/src/lib/utility/messaging/type/MessageProjectNew.h
@@ -7,10 +7,9 @@ class MessageProjectNew
: public Message
{
public:
- MessageProjectNew()
- : solutionPath("")
- , headerPaths()
- , ideId("")
+ MessageProjectNew(const std::string cdbPath, const std::vector 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& headerPaths)
- {
- this->headerPaths = headerPaths;
- }
-
- std::string solutionPath;
- std::vector headerPaths;
- std::string ideId;
+ const std::string cdbPath;
+ const std::vector headerPaths;
};
#endif // MESSAGE_PROJECT_NEW_H
diff --git a/src/lib_cxx/project/SourceGroupCxx.cpp b/src/lib_cxx/project/SourceGroupCxx.cpp
index 08aa65d2..15d8703a 100644
--- a/src/lib_cxx/project/SourceGroupCxx.cpp
+++ b/src/lib_cxx/project/SourceGroupCxx.cpp
@@ -30,7 +30,7 @@ SourceGroupType SourceGroupCxx::getType() const
bool SourceGroupCxx::prepareRefresh()
{
- FilePath cdbPath = m_settings->getAbsoluteCompilationDatabasePath();
+ FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && !cdbPath.exists())
{
MessageStatus("Can't refresh project").dispatch();
@@ -56,19 +56,19 @@ void SourceGroupCxx::fetchAllSourceFilePaths()
{
std::vector sourcePaths;
- FilePath cdbPath = m_settings->getAbsoluteCompilationDatabasePath();
+ FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
if (cdbPath.exists())
{
sourcePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
}
else
{
- sourcePaths = m_settings->getAbsoluteSourcePaths();
+ sourcePaths = m_settings->getSourcePathsExpandedAndAbsolute();
}
m_sourceFilePathsToIndex.clear();
FileManager fileManager;
- fileManager.update(sourcePaths, m_settings->getAbsoluteExcludePaths(), m_settings->getSourceExtensions());
+ fileManager.update(sourcePaths, m_settings->getExcludePathsExpandedAndAbsolute(), m_settings->getSourceExtensions());
m_allSourceFilePaths = fileManager.getAllSourceFilePaths();
}
@@ -77,11 +77,11 @@ std::vector> SourceGroupCxx::getIndexerCommands(
std::shared_ptr appSettings = ApplicationSettings::getInstance();
std::vector systemHeaderSearchPaths;
- utility::append(systemHeaderSearchPaths, m_settings->getAbsoluteHeaderSearchPaths());
+ utility::append(systemHeaderSearchPaths, m_settings->getHeaderSearchPathsExpandedAndAbsolute());
utility::append(systemHeaderSearchPaths, appSettings->getHeaderSearchPathsExpanded());
// Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
- for (const FilePath& sourcePath: m_settings->getAbsoluteSourcePaths())
+ for (const FilePath& sourcePath: m_settings->getSourcePathsExpandedAndAbsolute())
{
if (sourcePath.isDirectory())
{
@@ -93,7 +93,7 @@ std::vector> SourceGroupCxx::getIndexerCommands(
if (m_settings->getUseSourcePathsForHeaderSearch())
{
std::vector headerSearchSubPaths;
- for (const FilePath& sourcePath : m_settings->getAbsoluteSourcePaths())
+ for (const FilePath& sourcePath : m_settings->getSourcePathsExpandedAndAbsolute())
{
utility::append(headerSearchSubPaths, FileSystem::getSubDirectories(sourcePath));
}
@@ -102,13 +102,13 @@ std::vector> SourceGroupCxx::getIndexerCommands(
}
std::vector frameworkSearchPaths;
- utility::append(frameworkSearchPaths, m_settings->getAbsoluteFrameworkSearchPaths());
+ utility::append(frameworkSearchPaths, m_settings->getFrameworkSearchPathsExpandedAndAbsolute());
utility::append(frameworkSearchPaths, appSettings->getFrameworkSearchPathsExpanded());
const std::vector compilerFlags = m_settings->getCompilerFlags();
std::set indexedPaths;
- for (FilePath p: m_settings->getAbsoluteSourcePaths())
+ for (FilePath p: m_settings->getSourcePathsExpandedAndAbsolute())
{
if (p.exists())
{
@@ -117,7 +117,7 @@ std::vector> SourceGroupCxx::getIndexerCommands(
}
std::set excludedPaths;
- for (FilePath p: m_settings->getAbsoluteExcludePaths())
+ for (FilePath p: m_settings->getExcludePathsExpandedAndAbsolute())
{
if (p.exists())
{
@@ -129,7 +129,7 @@ std::vector> SourceGroupCxx::getIndexerCommands(
const std::set& sourceFilePathsToIndex = (fullRefresh ? getAllSourceFilePaths() : getSourceFilePathsToIndex());
- FilePath cdbPath = m_settings->getAbsoluteCompilationDatabasePath();
+ FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
if (cdbPath.exists())
{
std::string error;
diff --git a/src/lib_gui/CMakeLists.txt b/src/lib_gui/CMakeLists.txt
index 4a5f1a1f..2ed2bded 100644
--- a/src/lib_gui/CMakeLists.txt
+++ b/src/lib_gui/CMakeLists.txt
@@ -156,24 +156,30 @@ add_files(
qt/window/project_wizzard/QtProjectWizzardContent.h
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h
- qt/window/project_wizzard/QtProjectWizzardContentData.cpp
- qt/window/project_wizzard/QtProjectWizzardContentData.h
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
qt/window/project_wizzard/QtProjectWizzardContentExtensions.h
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
qt/window/project_wizzard/QtProjectWizzardContentFlags.h
+ qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h
qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
qt/window/project_wizzard/QtProjectWizzardContentPath.h
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
qt/window/project_wizzard/QtProjectWizzardContentPaths.h
qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp
qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
+ qt/window/project_wizzard/QtProjectWizzardContentProjectData.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentProjectData.h
qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp
qt/window/project_wizzard/QtProjectWizzardContentSelect.h
qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
qt/window/project_wizzard/QtProjectWizzardContentSimple.h
+ qt/window/project_wizzard/QtProjectWizzardContentSourceGroupData.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentSourceGroupData.h
qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
qt/window/project_wizzard/QtProjectWizzardContentSummary.h
+ qt/window/project_wizzard/QtProjectWizzardContentVS.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentVS.h
qt/window/project_wizzard/QtProjectWizzardWindow.cpp
qt/window/project_wizzard/QtProjectWizzardWindow.h
@@ -193,6 +199,8 @@ add_files(
qt/window/QtLicense.h
qt/window/QtMainWindow.cpp
qt/window/QtMainWindow.h
+ qt/window/QtPreferencesWindow.cpp
+ qt/window/QtPreferencesWindow.h
qt/window/QtSelectPathsDialog.cpp
qt/window/QtSelectPathsDialog.h
qt/window/QtSplashScreen.cpp
diff --git a/src/lib_gui/qt/element/QtLocationPicker.cpp b/src/lib_gui/qt/element/QtLocationPicker.cpp
index d4897348..a924117e 100644
--- a/src/lib_gui/qt/element/QtLocationPicker.cpp
+++ b/src/lib_gui/qt/element/QtLocationPicker.cpp
@@ -26,6 +26,7 @@ QtLocationPicker::QtLocationPicker(QWidget *parent)
m_data->setAttribute(Qt::WA_MacShowFocusRect, 0);
m_data->setObjectName("locationField");
layout->addWidget(m_data);
+ connect(m_data, SIGNAL(focus()), this, SLOT(handleFocus()));
m_button = new QtIconButton(
(ResourcePaths::getGuiPath().str() + "window/dots.png").c_str(),
@@ -68,6 +69,11 @@ void QtLocationPicker::clearText()
m_data->clear();
}
+bool QtLocationPicker::pickDirectory() const
+{
+ return m_pickDirectory;
+}
+
void QtLocationPicker::setPickDirectory(bool pickDirectory)
{
m_pickDirectory = pickDirectory;
@@ -119,3 +125,11 @@ void QtLocationPicker::handleButtonPress()
emit locationPicked();
}
}
+
+void QtLocationPicker::handleFocus()
+{
+ if (!m_data->text().size())
+ {
+ handleButtonPress();
+ }
+}
diff --git a/src/lib_gui/qt/element/QtLocationPicker.h b/src/lib_gui/qt/element/QtLocationPicker.h
index 4b8f00bc..18e12731 100644
--- a/src/lib_gui/qt/element/QtLocationPicker.h
+++ b/src/lib_gui/qt/element/QtLocationPicker.h
@@ -21,7 +21,9 @@ public:
void setText(QString text);
void clearText();
+ bool pickDirectory() const;
void setPickDirectory(bool pickDirectory);
+
void setFileFilter(const QString& fileFilter);
void setRelativeRootDirectory(const FilePath& dir);
@@ -34,6 +36,7 @@ protected:
private slots:
void handleButtonPress();
+ void handleFocus();
private:
QPushButton* m_button;
diff --git a/src/lib_gui/qt/view/QtMainView.cpp b/src/lib_gui/qt/view/QtMainView.cpp
index 652bd0d8..ce3c8cfd 100644
--- a/src/lib_gui/qt/view/QtMainView.cpp
+++ b/src/lib_gui/qt/view/QtMainView.cpp
@@ -3,15 +3,6 @@
#include "qt/window/QtMainWindow.h"
QtMainView::QtMainView()
- : m_editProjectFunctor(std::bind(&QtMainView::doEditProject, this))
- , m_createNewProjectFromSolutionFunctor(std::bind(&QtMainView::doCreateNewProjectFromSolution, this, std::placeholders::_1, std::placeholders::_2))
- , m_createNewProjectFromCDBFunctor(std::bind(&QtMainView::doCreateNewProjectFromCDB, this, std::placeholders::_1, std::placeholders::_2))
- , m_showStartScreenFunctor(std::bind(&QtMainView::doShowStartScreen, this))
- , m_hideStartScreenFunctor(std::bind(&QtMainView::doHideStartScreen, this))
- , m_setTitleFunctor(std::bind(&QtMainView::doSetTitle, this, std::placeholders::_1))
- , m_activateWindowFunctor(std::bind(&QtMainView::doActivateWindow, this))
- , m_updateRecentProjectMenuFunctor(std::bind(&QtMainView::doUpdateRecentProjectMenu, this))
- , m_forceLicenseScreenFunctor(std::bind(&QtMainView::doForceLicenseScreen, this, std::placeholders::_1))
{
m_window = std::make_shared();
m_window->show();
@@ -86,22 +77,45 @@ void QtMainView::setStatusBar(QStatusBar* statusbar)
void QtMainView::hideStartScreen()
{
- m_hideStartScreenFunctor();
+ m_onQtThread(
+ [=]()
+ {
+ m_window->hideStartScreen();
+ }
+ );
}
void QtMainView::setTitle(const std::string& title)
{
- m_setTitleFunctor(title);
+ m_onQtThread(
+ [=]()
+ {
+ m_window->setWindowTitle(QString::fromStdString(title));
+ }
+ );
}
void QtMainView::activateWindow()
{
- m_activateWindowFunctor();
+ m_onQtThread(
+ [=]()
+ {
+ // It's platform dependent which of these commands does the right thing, for now we just use them all at once.
+ m_window->setEnabled(true);
+ m_window->raise();
+ m_window->setFocus(Qt::ActiveWindowFocusReason);
+ }
+ );
}
void QtMainView::updateRecentProjectMenu()
{
- m_updateRecentProjectMenuFunctor();
+ m_onQtThread(
+ [=]()
+ {
+ m_window->updateRecentProjectMenu();
+ }
+ );
}
void QtMainView::updateHistoryMenu(const std::vector& history)
@@ -116,78 +130,45 @@ void QtMainView::updateHistoryMenu(const std::vector& history)
void QtMainView::handleMessage(MessageForceEnterLicense* message)
{
- m_forceLicenseScreenFunctor(message->licenseExpired);
+ bool expired = message->licenseExpired;
+
+ m_onQtThread(
+ [=]()
+ {
+ m_window->forceEnterLicense(expired);
+ }
+ );
}
void QtMainView::handleMessage(MessageProjectEdit* message)
{
- m_editProjectFunctor();
+ m_onQtThread(
+ [=]()
+ {
+ m_window->editProject();
+ }
+ );
}
void QtMainView::handleMessage(MessageProjectNew* message)
{
- if (message->ideId.size() != 0 && message->solutionPath.size() != 0)
- {
- if (message->fromCDB() == false)
+ std::string cdbPath = message->cdbPath;
+ std::vector headerPaths = message->headerPaths;
+
+ m_onQtThread(
+ [=]()
{
- m_createNewProjectFromSolutionFunctor(message->ideId, message->solutionPath);
+ m_window->newProjectFromCDB(cdbPath, headerPaths);
}
- else
- {
- m_createNewProjectFromCDBFunctor(message->solutionPath, message->headerPaths);
- }
- }
+ );
}
void QtMainView::handleMessage(MessageShowStartScreen* message)
{
- m_showStartScreenFunctor();
-}
-
-void QtMainView::doEditProject()
-{
- m_window->editProject();
-}
-
-void QtMainView::doCreateNewProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
-{
- m_window->newProjectFromSolution(ideId, solutionPath);
-}
-
-void QtMainView::doCreateNewProjectFromCDB(const std::string& filePath, const std::vector& headerPaths)
-{
- m_window->newProjectFromCDB(filePath, headerPaths);
-}
-
-void QtMainView::doShowStartScreen()
-{
- m_window->showStartScreen();
-}
-
-void QtMainView::doHideStartScreen()
-{
- m_window->hideStartScreen();
-}
-
-void QtMainView::doSetTitle(const std::string& title)
-{
- m_window->setWindowTitle(QString::fromStdString(title));
-}
-
-void QtMainView::doActivateWindow()
-{
- // It's platform dependent which of these commands does the right thing, for now we just use them all at once.
- m_window->setEnabled(true);
- m_window->raise();
- m_window->setFocus(Qt::ActiveWindowFocusReason);
-}
-
-void QtMainView::doUpdateRecentProjectMenu()
-{
- m_window->updateRecentProjectMenu();
-}
-
-void QtMainView::doForceLicenseScreen(bool expired)
-{
- m_window->forceEnterLicense(expired);
+ m_onQtThread(
+ [=]()
+ {
+ m_window->showStartScreen();
+ }
+ );
}
diff --git a/src/lib_gui/qt/view/QtMainView.h b/src/lib_gui/qt/view/QtMainView.h
index e6e20984..2c645ad4 100644
--- a/src/lib_gui/qt/view/QtMainView.h
+++ b/src/lib_gui/qt/view/QtMainView.h
@@ -57,29 +57,9 @@ private:
void handleMessage(MessageProjectNew* message);
void handleMessage(MessageShowStartScreen* message);
- void doEditProject();
- void doCreateNewProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
- void doCreateNewProjectFromCDB(const std::string& filePath, const std::vector& headerPaths);
- void doShowStartScreen();
- void doHideStartScreen();
- void doSetTitle(const std::string& title);
- void doActivateWindow();
- void doUpdateRecentProjectMenu();
- void doForceLicenseScreen(bool expired);
-
std::shared_ptr m_window;
std::vector m_views;
- QtThreadedFunctor<> m_editProjectFunctor;
- QtThreadedFunctor m_createNewProjectFromSolutionFunctor;
- QtThreadedFunctor&> m_createNewProjectFromCDBFunctor;
- QtThreadedFunctor<> m_showStartScreenFunctor;
- QtThreadedFunctor<> m_hideStartScreenFunctor;
- QtThreadedFunctor m_setTitleFunctor;
- QtThreadedFunctor<> m_activateWindowFunctor;
- QtThreadedFunctor<> m_updateRecentProjectMenuFunctor;
- QtThreadedFunctor m_forceLicenseScreenFunctor;
-
QtThreadedLambdaFunctor m_onQtThread;
};
diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp
index e261a6c7..c6e70a9f 100644
--- a/src/lib_gui/qt/window/QtMainWindow.cpp
+++ b/src/lib_gui/qt/window/QtMainWindow.cpp
@@ -11,20 +11,21 @@
#include
#include "Application.h"
-#include "component/view/View.h"
+#include "component/controller/LogController.h"
#include "component/view/CompositeView.h"
#include "component/view/TabbedView.h"
-#include "component/controller/LogController.h"
+#include "component/view/View.h"
#include "LicenseChecker.h"
#include "qt/utility/QtContextMenu.h"
#include "qt/utility/utilityQt.h"
#include "qt/view/QtViewWidgetWrapper.h"
#include "qt/window/project_wizzard/QtProjectWizzard.h"
-#include "qt/window/QtStartScreen.h"
-#include "qt/window/QtAboutLicense.h"
#include "qt/window/QtAbout.h"
+#include "qt/window/QtAboutLicense.h"
#include "qt/window/QtKeyboardShortcuts.h"
#include "qt/window/QtLicense.h"
+#include "qt/window/QtPreferencesWindow.h"
+#include "qt/window/QtStartScreen.h"
#include "settings/ApplicationSettings.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
@@ -312,8 +313,8 @@ void QtMainWindow::about()
void QtMainWindow::openSettings()
{
- QtProjectWizzard* wizzard = createWindow();
- wizzard->showPreferences();
+ QtPreferencesWindow* window = createWindow();
+ window->setup();
}
void QtMainWindow::showDocumentation()
@@ -421,17 +422,15 @@ void QtMainWindow::newProject()
wizzard->newProject();
}
-void QtMainWindow::newProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
-{
- QtProjectWizzard* wizzard = createWindow();
- wizzard->newProjectFromSolution(ideId, FilePath(solutionPath));
-}
-
void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vector& headerPaths)
{
- QtProjectWizzard* wizzard = createWindow();
+ QtProjectWizzard* wizzard = dynamic_cast(m_windowStack.getTopWindow());
+ if (!wizzard)
+ {
+ wizzard = createWindow();
+ }
- std::vector headerFilePaths(headerPaths.size());
+ std::vector headerFilePaths;
for (const std::string& s: headerPaths)
{
headerFilePaths.push_back(FilePath(s));
diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h
index 913f9e29..442138e8 100644
--- a/src/lib_gui/qt/window/QtMainWindow.h
+++ b/src/lib_gui/qt/window/QtMainWindow.h
@@ -94,7 +94,6 @@ public slots:
void hideStartScreen();
void newProject();
- void newProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
void newProjectFromCDB(const std::string& filePath, const std::vector& headerPaths);
void openProject();
void editProject();
diff --git a/src/lib_gui/qt/window/QtPreferencesWindow.cpp b/src/lib_gui/qt/window/QtPreferencesWindow.cpp
new file mode 100644
index 00000000..44ade359
--- /dev/null
+++ b/src/lib_gui/qt/window/QtPreferencesWindow.cpp
@@ -0,0 +1,93 @@
+#include "qt/window/QtPreferencesWindow.h"
+
+#include "utility/messaging/type/MessageLoadProject.h"
+#include "utility/messaging/type/MessagePluginPortChange.h"
+#include "utility/messaging/type/MessageRefresh.h"
+#include "utility/messaging/type/MessageScrollSpeedChange.h"
+
+#include "Application.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
+
+QtPreferencesWindow::QtPreferencesWindow(QWidget* parent)
+ : QtProjectWizzardWindow(parent)
+{
+ // save old application settings so they can be compared later
+ ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
+ m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
+ m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
+ m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
+ m_appSettings.setSourcetrailPort(appSettings->getSourcetrailPort());
+ m_appSettings.setPluginPort(appSettings->getPluginPort());
+
+
+ QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(this);
+ summary->setIsForm(true);
+ summary->addContent(new QtProjectWizzardContentPreferences(this));
+
+ summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(this));
+ if (QSysInfo::macVersion() != QSysInfo::MV_None)
+ {
+ summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(this));
+ }
+
+ setPreferredSize(QSize(750, 500));
+ setContent(summary);
+ setScrollAble(content()->isScrollAble());
+}
+
+QtPreferencesWindow::~QtPreferencesWindow()
+{
+}
+
+void QtPreferencesWindow::windowReady()
+{
+ QtProjectWizzardWindow::windowReady();
+
+ updateTitle("PREFERENCES");
+ updateNextButton("Save");
+ setPreviousVisible(false);
+
+ loadContent();
+}
+
+void QtPreferencesWindow::handleNext()
+{
+ if (!content()->check())
+ {
+ return;
+ }
+
+ saveContent();
+
+ bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
+
+ if (m_appSettings.getScrollSpeed() != ApplicationSettings::getInstance()->getScrollSpeed())
+ {
+ MessageScrollSpeedChange(ApplicationSettings::getInstance()->getScrollSpeed()).dispatch();
+ }
+
+ if (m_appSettings.getSourcetrailPort() != ApplicationSettings::getInstance()->getSourcetrailPort() ||
+ m_appSettings.getPluginPort() != ApplicationSettings::getInstance()->getPluginPort())
+ {
+ MessagePluginPortChange().dispatch();
+ }
+
+ Application::getInstance()->loadSettings();
+
+ if (appSettingsChanged)
+ {
+ Project* currentProject = Application::getInstance()->getCurrentProject().get();
+ if (currentProject)
+ {
+ MessageLoadProject(currentProject->getProjectSettingsFilePath(), true).dispatch();
+ }
+ }
+ else
+ {
+ MessageRefresh().refreshUiOnly().dispatch();
+ }
+
+ QtWindow::handleNext();
+}
diff --git a/src/lib_gui/qt/window/QtPreferencesWindow.h b/src/lib_gui/qt/window/QtPreferencesWindow.h
new file mode 100644
index 00000000..387ced0e
--- /dev/null
+++ b/src/lib_gui/qt/window/QtPreferencesWindow.h
@@ -0,0 +1,25 @@
+#ifndef QT_PREFERENCES_WINDOW_H
+#define QT_PREFERENCES_WINDOW_H
+
+#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
+
+#include "settings/ApplicationSettings.h"
+
+class QtPreferencesWindow
+ : public QtProjectWizzardWindow
+{
+ Q_OBJECT
+
+public:
+ QtPreferencesWindow(QWidget* parent = 0);
+ virtual ~QtPreferencesWindow();
+
+protected:
+ virtual void windowReady() override;
+ virtual void handleNext() override;
+
+private:
+ ApplicationSettings m_appSettings;
+};
+
+#endif // QT_PREFERENCES_WINDOW_H
diff --git a/src/lib_gui/qt/window/QtSelectPathsDialog.cpp b/src/lib_gui/qt/window/QtSelectPathsDialog.cpp
index 5c60367d..4a891214 100644
--- a/src/lib_gui/qt/window/QtSelectPathsDialog.cpp
+++ b/src/lib_gui/qt/window/QtSelectPathsDialog.cpp
@@ -1,5 +1,7 @@
#include "qt/window/QtSelectPathsDialog.h"
+#include
+
#include
#include
#include
@@ -28,12 +30,14 @@ std::vector QtSelectPathsDialog::getPathsList() const
void QtSelectPathsDialog::setPathsList(const std::vector& paths, const std::vector& checkedPaths)
{
+ std::set checked(checkedPaths.begin(), checkedPaths.end());
+
for (FilePath s : paths)
{
QListWidgetItem* item = new QListWidgetItem(s.str().c_str(), m_list);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
- if (std::find(checkedPaths.begin(), checkedPaths.end(), s) == checkedPaths.end())
+ if (checked.find(s) == checked.end())
{
item->setCheckState(Qt::Unchecked); // AND initialize check state
}
diff --git a/src/lib_gui/qt/window/QtWindow.cpp b/src/lib_gui/qt/window/QtWindow.cpp
index 9151fe7f..d57dedbd 100644
--- a/src/lib_gui/qt/window/QtWindow.cpp
+++ b/src/lib_gui/qt/window/QtWindow.cpp
@@ -186,6 +186,14 @@ void QtWindow::updateNextButton(QString text)
}
}
+void QtWindow::updatePreviousButton(QString text)
+{
+ if (m_previousButton)
+ {
+ m_previousButton->setText(text);
+ }
+}
+
void QtWindow::updateCloseButton(QString text)
{
if (m_closeButton)
diff --git a/src/lib_gui/qt/window/QtWindow.h b/src/lib_gui/qt/window/QtWindow.h
index 5c7e207b..06fd10de 100644
--- a/src/lib_gui/qt/window/QtWindow.h
+++ b/src/lib_gui/qt/window/QtWindow.h
@@ -35,6 +35,7 @@ public:
void updateSubTitle(QString subTitle);
void updateNextButton(QString text);
+ void updatePreviousButton(QString text);
void updateCloseButton(QString text);
void setNextEnabled(bool enabled);
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
index c7b3cbbc..6e2a1557 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
@@ -1,28 +1,29 @@
#include "qt/window/project_wizzard/QtProjectWizzard.h"
#include
+#include
#include
+#include
#include
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
-#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPath.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
-#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentProjectData.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentSourceGroupData.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
-#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentVS.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/messaging/type/MessageLoadProject.h"
-#include "utility/messaging/type/MessagePluginPortChange.h"
-#include "utility/messaging/type/MessageRefresh.h"
-#include "utility/messaging/type/MessageScrollSpeedChange.h"
#include "utility/messaging/type/MessageStatus.h"
+#include "utility/ResourcePaths.h"
#include "utility/utility.h"
#include "utility/utilityPathDetection.h"
#include "utility/utilityString.h"
@@ -31,77 +32,69 @@
#include "Application.h"
QtProjectWizzard::QtProjectWizzard(QWidget* parent)
- : QtWindowStackElement(parent)
+ : QtProjectWizzardWindow(parent, false)
, m_windowStack(this)
, m_editing(false)
+ , m_contentWidget(nullptr)
{
+ setScrollAble(true);
+
connect(&m_windowStack, SIGNAL(push()), this, SLOT(windowStackChanged()));
connect(&m_windowStack, SIGNAL(pop()), this, SLOT(windowStackChanged()));
+ connect(&m_windowStack, SIGNAL(empty()), this, SLOT(windowStackChanged()));
// save old application settings so they can be compared later
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
- m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
- m_appSettings.setSourcetrailPort(appSettings->getSourcetrailPort());
- m_appSettings.setPluginPort(appSettings->getPluginPort());
}
-void QtProjectWizzard::showWindow()
+QSize QtProjectWizzard::sizeHint() const
{
- QtWindowStackElement* element = m_windowStack.getTopWindow();
-
- if (element)
- {
- element->show();
- }
-}
-
-void QtProjectWizzard::hideWindow()
-{
- QtWindowStackElement* element = m_windowStack.getTopWindow();
-
- if (element)
- {
- element->hide();
- }
+ return QSize(1000, 700);
}
void QtProjectWizzard::newProject()
{
- QtProjectWizzardWindow* window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
- {
- window->setPreferredSize(QSize(570, 420));
- return new QtProjectWizzardContentSelect(window);
- }
- );
-
- connect(dynamic_cast(window->content()),
- SIGNAL(selected(SourceGroupType)),
- this, SLOT(selectedProjectType(SourceGroupType)));
-
- window->setNextEnabled(false);
- window->setPreviousEnabled(false);
- window->updateSubTitle("Type Selection");
-}
-
-void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const FilePath& solutionPath)
-{
+ m_projectSettings = std::make_shared();
+ setup();
}
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::vector& headerPaths)
{
- m_projectSettings = std::make_shared();
+ if (!m_projectSettings)
+ {
+ m_projectSettings = std::make_shared();
+ }
- std::shared_ptr sourceGroupSettings = std::make_shared(utility::getUuidString(), SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
- m_projectSettings->setProjectName(filePath.withoutExtension().fileName());
- m_projectSettings->setProjectFileLocation(filePath.parentDirectory());
+ if (!m_projectSettings->getProjectName().size())
+ {
+ m_projectSettings->setProjectName(filePath.withoutExtension().fileName());
+ }
+
+ if (m_projectSettings->getProjectFileLocation().empty())
+ {
+ m_projectSettings->setProjectFileLocation(filePath.parentDirectory());
+ }
+
+ if (!m_contentWidget)
+ {
+ setup();
+ }
+ else
+ {
+ loadContent();
+ }
+
+ cancelSourceGroup();
+
+ std::shared_ptr sourceGroupSettings =
+ std::make_shared(utility::getUuidString(), SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
sourceGroupSettings->setCompilationDatabasePath(filePath);
sourceGroupSettings->setSourcePaths(headerPaths);
- m_sourceGroupSettings = sourceGroupSettings;
+ m_newSourceGroupSettings = sourceGroupSettings;
- emptyProjectCDBVS();
+ emptySourceGroupCDBVS();
}
void QtProjectWizzard::refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
@@ -118,57 +111,146 @@ void QtProjectWizzard::editProject(const FilePath& settingsPath)
void QtProjectWizzard::editProject(std::shared_ptr settings)
{
m_projectSettings = settings;
-
- {
- const std::vector> allSourceGroupSettings = m_projectSettings->getAllSourceGroupSettings();
- if (!allSourceGroupSettings.empty())
- {
- // Todo: regard the rest of the source groups once we can have more than one in a project.
- m_sourceGroupSettings = allSourceGroupSettings.front();
- }
- }
+ m_allSourceGroupSettings = settings->getAllSourceGroupSettings();
m_editing = true;
- switch (getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType()))
+ setup();
+}
+
+void QtProjectWizzard::populateWindow(QWidget* widget)
+{
+ QHBoxLayout* layout = new QHBoxLayout();
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+
{
- case LANGUAGE_JAVA:
- showSummaryJava();
- break;
+ QWidget* menu = new QWidget();
+ menu->setObjectName("project_menu");
+ menu->setFixedWidth(200);
+ layout->addWidget(menu);
- case LANGUAGE_C:
- case LANGUAGE_CPP:
- showSummary();
- break;
+ QVBoxLayout* menuLayout = new QVBoxLayout(menu);
+ menuLayout->setContentsMargins(0, 0, 0, 0);
+ menuLayout->setSpacing(0);
- default:
- break;
+ m_generalButton = new QPushButton("General");
+ m_generalButton->setObjectName("general_button");
+ m_generalButton->setCheckable(true);
+ connect(m_generalButton, SIGNAL(clicked()), this, SLOT(generalButtonClicked()));
+ menuLayout->addWidget(m_generalButton);
+
+ QLabel* sourceGroupLabel = new QLabel("Source Groups:");
+ menuLayout->addWidget(sourceGroupLabel);
+
+ m_sourceGroupList = new QListWidget();
+ m_sourceGroupList->setAttribute(Qt::WA_MacShowFocusRect, 0);
+ connect(m_sourceGroupList, SIGNAL(currentRowChanged(int)), this, SLOT(selectedSourceGroupChanged(int)));
+ menuLayout->addWidget(m_sourceGroupList);
+
+ QHBoxLayout* buttonsLayout = new QHBoxLayout();
+ buttonsLayout->setContentsMargins(0, 0, 0, 0);
+ buttonsLayout->setSpacing(0);
+
+ QPushButton* addButton = new QtIconButton(
+ (ResourcePaths::getGuiPath().str() + "window/plus.png").c_str(),
+ (ResourcePaths::getGuiPath().str() + "window/plus_hover.png").c_str());
+
+ m_removeButton = new QtIconButton(
+ (ResourcePaths::getGuiPath().str() + "window/minus.png").c_str(),
+ (ResourcePaths::getGuiPath().str() + "window/minus_hover.png").c_str());
+
+ m_duplicateButton = new QtIconButton(
+ (ResourcePaths::getGuiPath().str() + "window/minus.png").c_str(),
+ (ResourcePaths::getGuiPath().str() + "window/minus_hover.png").c_str());
+
+ addButton->setIconSize(QSize(20, 20));
+ m_removeButton->setIconSize(QSize(20, 20));
+ m_duplicateButton->setIconSize(QSize(20, 20));
+
+ addButton->setToolTip("Add Source Group");
+ m_removeButton->setToolTip("Remove Source Group");
+ m_duplicateButton->setToolTip("Copy Source Group");
+
+ addButton->setObjectName("action_button");
+ m_removeButton->setObjectName("action_button");
+ m_duplicateButton->setObjectName("action_button");
+
+ m_removeButton->setEnabled(false);
+ m_duplicateButton->setEnabled(false);
+
+ connect(addButton, SIGNAL(clicked()), this, SLOT(newSourceGroup()));
+ connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeSelectedSourceGroup()));
+ connect(m_duplicateButton, SIGNAL(clicked()), this, SLOT(duplicateSelectedSourceGroup()));
+
+ buttonsLayout->addStretch();
+ buttonsLayout->addWidget(addButton);
+ buttonsLayout->addStretch();
+ buttonsLayout->addWidget(m_removeButton);
+ buttonsLayout->addStretch();
+ buttonsLayout->addWidget(m_duplicateButton);
+ buttonsLayout->addStretch();
+
+ menuLayout->addLayout(buttonsLayout);
+ }
+
+ QFrame* separator = new QFrame();
+ separator->setFrameShape(QFrame::VLine);
+
+ QPalette palette = separator->palette();
+ palette.setColor(QPalette::WindowText, Qt::lightGray);
+ separator->setPalette(palette);
+
+ layout->addWidget(separator);
+
+ m_contentWidget = new QWidget();
+ m_contentWidget->setObjectName("form");
+
+ QScrollArea* scrollArea = new QScrollArea();
+ scrollArea->setFrameShadow(QFrame::Plain);
+ scrollArea->setObjectName("formArea");
+ scrollArea->setWidgetResizable(true);
+
+ scrollArea->setWidget(m_contentWidget);
+ layout->addWidget(scrollArea);
+
+ widget->setLayout(layout);
+}
+
+void QtProjectWizzard::windowReady()
+{
+ if (m_editing)
+ {
+ updateTitle("Edit Project");
+ updateNextButton("Save");
+ }
+ else
+ {
+ updateTitle("New Project");
+ updateNextButton("Create");
+ setNextEnabled(false);
+ }
+
+ updateSubTitle("Overview");
+ updatePreviousButton("Add Source Group");
+
+ connect(this, SIGNAL(previous()), this, SLOT(newSourceGroup()));
+ connect(this, SIGNAL(next()), this, SLOT(createProject()));
+
+ updateSourceGroupList();
+
+ if (m_allSourceGroupSettings.size())
+ {
+ m_sourceGroupList->setCurrentRow(0);
+ }
+ else
+ {
+ generalButtonClicked();
}
}
-void QtProjectWizzard::showPreferences()
+void QtProjectWizzard::handlePrevious()
{
- QtProjectWizzardWindow* window = createWindowWithSummary(
- [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
- {
- summary->setIsForm(true);
-
- summary->addContent(new QtProjectWizzardContentPreferences(window));
-
- summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
- if (QSysInfo::macVersion() != QSysInfo::MV_None)
- {
- summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
- }
-
- window->setup();
-
- window->updateTitle("PREFERENCES");
- window->updateNextButton("Save");
- window->setPreviousVisible(false);
- }
- );
-
- connect(window, SIGNAL(next()), this, SLOT(savePreferences()));
+ QtWindow::handlePrevious();
}
bool QtProjectWizzard::applicationSettingsContainVisualStudioHeaderSearchPaths()
@@ -183,7 +265,8 @@ bool QtProjectWizzard::applicationSettingsContainVisualStudioHeaderSearchPaths()
}
}
- std::vector usedExpandedGlobalHeaderSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
+ std::vector usedExpandedGlobalHeaderSearchPaths =
+ ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
for (const FilePath& usedExpandedPath: usedExpandedGlobalHeaderSearchPaths)
{
for (const FilePath& expandedPath: expandedPaths)
@@ -204,10 +287,11 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent(
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
- connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
+ connect(window, SIGNAL(canceled()), this, SLOT(cancelSourceGroup()));
window->setPreferredSize(QSize(580, 340));
window->setContent(func(window));
+ window->setScrollAble(window->content()->isScrollAble());
window->setup();
m_windowStack.pushWindow(window);
@@ -221,19 +305,256 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
- connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
+ connect(window, SIGNAL(canceled()), this, SLOT(cancelSourceGroup()));
QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(window);
window->setPreferredSize(QSize(750, 500));
window->setContent(summary);
+ window->setScrollAble(window->content()->isScrollAble());
func(window, summary);
+ window->setup();
m_windowStack.pushWindow(window);
return window;
}
+void QtProjectWizzard::updateSourceGroupList()
+{
+ m_sourceGroupList->clear();
+
+ for (const std::shared_ptr group : m_allSourceGroupSettings)
+ {
+ QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(group->getName()));
+ m_sourceGroupList->addItem(item);
+ }
+}
+
+bool QtProjectWizzard::canExitContent()
+{
+ if (content())
+ {
+ if (!content()->check())
+ {
+ return false;
+ }
+
+ saveContent();
+ }
+
+ return true;
+}
+
+void QtProjectWizzard::generalButtonClicked()
+{
+ if (!canExitContent())
+ {
+ m_generalButton->setChecked(false);
+ return;
+ }
+
+ setContent(new QtProjectWizzardContentProjectData(m_projectSettings, this, m_editing));
+
+ qDeleteAll(m_contentWidget->children());
+ QtProjectWizzardWindow::populateWindow(m_contentWidget);
+
+ loadContent();
+
+ m_generalButton->setChecked(true);
+ m_sourceGroupList->setCurrentRow(-1);
+}
+
+void QtProjectWizzard::selectedSourceGroupChanged(int index)
+{
+ if (index < 0 || index >= int(m_allSourceGroupSettings.size()))
+ {
+ m_removeButton->setEnabled(false);
+ m_duplicateButton->setEnabled(false);
+ return;
+ }
+
+ if (!canExitContent())
+ {
+ return;
+ }
+
+ m_generalButton->setChecked(false);
+ m_removeButton->setEnabled(true);
+ m_duplicateButton->setEnabled(true);
+
+ std::shared_ptr group = m_allSourceGroupSettings[index];
+
+ QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(this);
+ summary->setIsForm(true);
+
+ QtProjectWizzardContentSourceGroupData* content = new QtProjectWizzardContentSourceGroupData(group, this);
+ connect(content, SIGNAL(nameUpdated(QString)), this, SLOT(selectedSourceGroupNameChanged(QString)));
+ summary->addContent(content);
+ summary->addSpace();
+
+ if (group->getType() == SOURCE_GROUP_JAVA_EMPTY || group->getType() == SOURCE_GROUP_JAVA_MAVEN)
+ {
+ bool isMaven = false;
+ std::shared_ptr javaSettings =
+ std::dynamic_pointer_cast(group);
+ if (javaSettings)
+ {
+ isMaven = javaSettings->getMavenProjectFilePathExpandedAndAbsolute().exists();
+ }
+
+ summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
+ summary->addSpace();
+
+ if (isMaven)
+ {
+ summary->addContent(new QtProjectWizzardContentPathSourceMaven(group, this));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(group, this));
+ }
+ else
+ {
+ summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathsClassJava(group, this));
+ }
+
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentExtensions(group, this));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
+ }
+ else
+ {
+ const bool isCDB = group->getType() == SOURCE_GROUP_CXX_CDB || group->getType() == SOURCE_GROUP_CXX_CDB;
+
+ if (isCDB)
+ {
+ summary->addContent(new QtProjectWizzardContentPathCDB(group, this));
+ summary->addContent(new QtProjectWizzardContentCDBSource(group, this));
+ summary->addSpace();
+
+ summary->addContent(new QtProjectWizzardContentPathsCDBHeader(group, this));
+ summary->addSpace();
+ }
+ else
+ {
+ summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
+ summary->addSpace();
+
+ summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
+ summary->addContent(new QtProjectWizzardContentExtensions(group, this));
+ summary->addSpace();
+ }
+
+ summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(group, this, isCDB));
+
+ std::shared_ptr cxxSettings = std::dynamic_pointer_cast(group);
+ if (!isCDB && cxxSettings && cxxSettings->getHasDefinedUseSourcePathsForHeaderSearch())
+ {
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentSimple(group, this));
+ }
+
+ summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(this));
+ summary->addSpace();
+
+ if (QSysInfo::macVersion() != QSysInfo::MV_None)
+ {
+ summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(group, this, isCDB));
+ summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(this));
+ summary->addSpace();
+ }
+
+ summary->addContent(new QtProjectWizzardContentFlags(group, this));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
+ }
+
+ setContent(summary);
+
+ qDeleteAll(m_contentWidget->children());
+ QtProjectWizzardWindow::populateWindow(m_contentWidget);
+
+ loadContent();
+}
+
+void QtProjectWizzard::selectedSourceGroupNameChanged(QString name)
+{
+ m_sourceGroupList->item(m_sourceGroupList->currentRow())->setText(name);
+}
+
+void QtProjectWizzard::removeSelectedSourceGroup()
+{
+ if (!m_allSourceGroupSettings.size() || m_sourceGroupList->currentRow() < 0)
+ {
+ return;
+ }
+
+ QMessageBox msgBox;
+ msgBox.setText("Remove Source Group");
+ msgBox.setInformativeText("Do you really want to remove this source group from the project?");
+ msgBox.addButton("Yes", QMessageBox::ButtonRole::YesRole);
+ msgBox.addButton("No", QMessageBox::ButtonRole::NoRole);
+ msgBox.setIcon(QMessageBox::Icon::Question);
+ int ret = msgBox.exec();
+
+ if (ret == 0) // QMessageBox::Yes
+ {
+ int currentRow = m_sourceGroupList->currentRow();
+ m_allSourceGroupSettings.erase(m_allSourceGroupSettings.begin() + currentRow);
+ updateSourceGroupList();
+
+ if (!m_allSourceGroupSettings.size())
+ {
+ setNextEnabled(false);
+ generalButtonClicked();
+ return;
+ }
+
+ if (currentRow >= int(m_allSourceGroupSettings.size()))
+ {
+ currentRow--;
+ }
+
+ m_sourceGroupList->setCurrentRow(currentRow);
+ }
+}
+
+void QtProjectWizzard::duplicateSelectedSourceGroup()
+{
+ if (!m_allSourceGroupSettings.size() || m_sourceGroupList->currentRow() < 0)
+ {
+ return;
+ }
+
+ std::shared_ptr oldSourceGroup = m_allSourceGroupSettings[m_sourceGroupList->currentRow()];
+ std::shared_ptr newSourceGroup;
+
+ if (oldSourceGroup->getType() == SOURCE_GROUP_JAVA_EMPTY || oldSourceGroup->getType() == SOURCE_GROUP_JAVA_MAVEN)
+ {
+ newSourceGroup = std::make_shared(*dynamic_cast(oldSourceGroup.get()));
+ }
+ else
+ {
+ newSourceGroup = std::make_shared(*dynamic_cast(oldSourceGroup.get()));
+ }
+
+ newSourceGroup->setId(utility::getUuidString());
+
+ int newRow = m_sourceGroupList->currentRow() + 1;
+ m_allSourceGroupSettings.insert(m_allSourceGroupSettings.begin() + newRow, newSourceGroup);
+
+ updateSourceGroupList();
+ m_sourceGroupList->setCurrentRow(newRow);
+}
+
+void QtProjectWizzard::cancelSourceGroup()
+{
+ m_windowStack.clearWindows();
+ m_newSourceGroupSettings.reset();
+}
+
void QtProjectWizzard::cancelWizzard()
{
m_windowStack.clearWindows();
@@ -253,117 +574,135 @@ void QtProjectWizzard::windowStackChanged()
if (window)
{
dynamic_cast(window)->content()->load();
+ setEnabled(false);
}
+ else
+ {
+ setEnabled(true);
+ raise();
+ }
+}
+
+void QtProjectWizzard::newSourceGroup()
+{
+ if (!canExitContent())
+ {
+ return;
+ }
+
+ QtProjectWizzardWindow* window = createWindowWithContent(
+ [this](QtProjectWizzardWindow* window)
+ {
+ window->setPreferredSize(QSize(570, 420));
+ return new QtProjectWizzardContentSelect(window);
+ }
+ );
+
+ connect(dynamic_cast(window->content()),
+ SIGNAL(selected(SourceGroupType)),
+ this, SLOT(selectedProjectType(SourceGroupType)));
+
+ window->show();
+ window->setNextEnabled(false);
+ window->setPreviousEnabled(false);
+ window->updateSubTitle("Type Selection");
}
void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
{
- m_projectSettings = std::make_shared();
-
const std::string sourceGroupId = utility::getUuidString();
switch (sourceGroupType)
{
case SOURCE_GROUP_C_EMPTY:
case SOURCE_GROUP_CPP_EMPTY:
- m_sourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
+ m_newSourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
if (applicationSettingsContainVisualStudioHeaderSearchPaths())
{
std::vector flags;
flags.push_back("-fms-extensions");
flags.push_back("-fms-compatibility");
flags.push_back("-fms-compatibility-version=19");
- std::dynamic_pointer_cast(m_sourceGroupSettings)->setCompilerFlags(flags);
+ std::dynamic_pointer_cast(m_newSourceGroupSettings)->setCompilerFlags(flags);
}
- emptyProject();
+ emptySourceGroup();
break;
case SOURCE_GROUP_CXX_CDB:
- m_sourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
- emptyProjectCDB();
+ m_newSourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
+ emptySourceGroupCDB();
break;
case SOURCE_GROUP_CXX_VS:
- m_sourceGroupSettings = std::make_shared(sourceGroupId, SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
- emptyProjectCDBVS();
+ m_newSourceGroupSettings =
+ std::make_shared(sourceGroupId, SOURCE_GROUP_CXX_CDB, m_projectSettings.get());
+ emptySourceGroupCDBVS();
break;
case SOURCE_GROUP_JAVA_EMPTY:
- m_sourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
- emptyProject();
+ m_newSourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
+ emptySourceGroup();
break;
case SOURCE_GROUP_JAVA_MAVEN:
- m_sourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
- emptyProjectJavaMaven();
+ m_newSourceGroupSettings = std::make_shared(sourceGroupId, sourceGroupType, m_projectSettings.get());
+ sourcePathsJavaMaven();
break;
case SOURCE_GROUP_UNKNOWN:
break;
}
}
-void QtProjectWizzard::emptyProject()
+void QtProjectWizzard::emptySourceGroup()
{
- QtProjectWizzardWindow* window;
+ QtProjectWizzardWindow* window = createWindowWithContent(
+ [this](QtProjectWizzardWindow* window)
+ {
+ return new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window);
+ }
+ );
- switch (m_sourceGroupSettings->getType())
+ if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_JAVA_EMPTY)
{
- case SOURCE_GROUP_C_EMPTY:
- case SOURCE_GROUP_CPP_EMPTY:
- window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
- {
- return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
- }
- );
- connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
- break;
- case SOURCE_GROUP_JAVA_EMPTY:
- window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
- {
- return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
- }
- );
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJava()));
- break;
- default:
- return;
+ }
+ else
+ {
+ connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
}
- window->updateSubTitle("Project Data");
+ window->updateSubTitle("Standard");
}
-void QtProjectWizzard::emptyProjectCDBVS()
+void QtProjectWizzard::emptySourceGroupCDBVS()
{
- QtProjectWizzardWindow* window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
+ QtProjectWizzardWindow* window = createWindowWithSummary(
+ [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- return new QtProjectWizzardContentDataCDBVS(m_projectSettings, m_sourceGroupSettings, window);
+ summary->addContent(new QtProjectWizzardContentVS(window));
+ summary->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentCDBSource(m_newSourceGroupSettings, window));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_newSourceGroupSettings, window));
}
);
- connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
- window->updateSubTitle("Project Data");
+
+ connect(window, SIGNAL(next()), this, SLOT(advancedSettingsCxx()));
+ window->updateSubTitle("VS Solution");
}
-void QtProjectWizzard::emptyProjectCDB()
+void QtProjectWizzard::emptySourceGroupCDB()
{
- QtProjectWizzardWindow* window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
+ QtProjectWizzardWindow* window = createWindowWithSummary(
+ [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- return new QtProjectWizzardContentDataCDB(m_projectSettings, m_sourceGroupSettings, window);
+ summary->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentCDBSource(m_newSourceGroupSettings, window));
+ summary->addSpace();
+ summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_newSourceGroupSettings, window));
}
);
- connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
- window->updateSubTitle("Project Data");
-}
-void QtProjectWizzard::emptyProjectJavaMaven()
-{
- QtProjectWizzardWindow* window = createWindowWithContent(
- [this](QtProjectWizzardWindow* window)
- {
- return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
- }
- );
- connect(window, SIGNAL(next()), this, SLOT(sourcePathsJavaMaven()));
- window->updateSubTitle("Project Data");
+ connect(window, SIGNAL(next()), this, SLOT(advancedSettingsCxx()));
+ window->updateSubTitle("CDB Path");
}
void QtProjectWizzard::sourcePaths()
@@ -371,11 +710,9 @@ void QtProjectWizzard::sourcePaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentPathsSource(m_newSourceGroupSettings, window));
summary->addSpace();
- summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
-
- window->setup();
+ summary->addContent(new QtProjectWizzardContentExtensions(m_newSourceGroupSettings, window));
}
);
@@ -388,11 +725,9 @@ void QtProjectWizzard::headerSearchPaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_newSourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
-
- window->setup();
}
);
@@ -417,11 +752,9 @@ void QtProjectWizzard::frameworkSearchPaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_newSourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
-
- window->setup();
}
);
@@ -429,33 +762,14 @@ void QtProjectWizzard::frameworkSearchPaths()
window->updateSubTitle("Framework Search Paths");
}
-void QtProjectWizzard::headerPathsCDB()
-{
- QtProjectWizzardWindow* window = createWindowWithSummary(
- [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
- {
- summary->addContent(new QtProjectWizzardContentCDBSource(m_sourceGroupSettings, window));
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_sourceGroupSettings, window));
-
- window->setup();
- }
- );
-
- connect(window, SIGNAL(next()), this, SLOT(advancedSettingsCxx()));
- window->updateSubTitle("Indexed Header Paths");
-}
-
void QtProjectWizzard::sourcePathsJava()
{
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentPathsSource(m_newSourceGroupSettings, window));
summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsClassJava(m_sourceGroupSettings, window));
-
- window->setup();
+ summary->addContent(new QtProjectWizzardContentPathsClassJava(m_newSourceGroupSettings, window));
}
);
@@ -465,18 +779,16 @@ void QtProjectWizzard::sourcePathsJava()
void QtProjectWizzard::sourcePathsJavaMaven()
{
- std::dynamic_pointer_cast(m_sourceGroupSettings)->setMavenDependenciesDirectory(
+ std::dynamic_pointer_cast(m_newSourceGroupSettings)->setMavenDependenciesDirectory(
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/maven")
);
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_newSourceGroupSettings, window));
summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_sourceGroupSettings, window));
-
- window->setup();
+ summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_newSourceGroupSettings, window));
}
);
@@ -489,15 +801,13 @@ void QtProjectWizzard::advancedSettingsCxx()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentFlags(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentFlags(m_newSourceGroupSettings, window));
summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
-
- window->setup();
+ summary->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
);
- connect(window, SIGNAL(next()), this, SLOT(showSummary()));
+ connect(window, SIGNAL(next()), this, SLOT(createSourceGroup()));
window->updateSubTitle("Advanced (optional)");
}
@@ -506,141 +816,27 @@ void QtProjectWizzard::advancedSettingsJava()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
- summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
+ summary->addContent(new QtProjectWizzardContentExtensions(m_newSourceGroupSettings, window));
summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
-
- window->setup();
+ summary->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
);
- connect(window, SIGNAL(next()), this, SLOT(showSummaryJava()));
+ connect(window, SIGNAL(next()), this, SLOT(createSourceGroup()));
window->updateSubTitle("Advanced (optional)");
}
-void QtProjectWizzard::showSummary()
+void QtProjectWizzard::createSourceGroup()
{
- QtProjectWizzardWindow* window = createWindowWithSummary(
- [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
- {
- summary->setIsForm(true);
+ m_allSourceGroupSettings.push_back(m_newSourceGroupSettings);
+ m_newSourceGroupSettings.reset();
- const bool isCDB = m_sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB || m_sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB;
+ updateSourceGroupList();
+ cancelSourceGroup();
- if (!isCDB)
- {
- summary->addContent(new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window, m_editing));
- summary->addSpace();
+ setNextEnabled(true);
- summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
- summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
- summary->addSpace();
- }
- else
- {
- summary->addContent(new QtProjectWizzardContentDataCDB(m_projectSettings, m_sourceGroupSettings, window, m_editing));
- summary->addContent(new QtProjectWizzardContentCDBSource(m_sourceGroupSettings, window));
- summary->addSpace();
-
- summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_sourceGroupSettings, window));
- summary->addSpace();
- }
-
- summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_sourceGroupSettings, window, isCDB));
-
- std::shared_ptr cxxSettings = std::dynamic_pointer_cast(m_sourceGroupSettings);
- if (!isCDB && cxxSettings && cxxSettings->getHasDefinedUseSourcePathsForHeaderSearch())
- {
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentSimple(m_sourceGroupSettings, window));
- }
-
- summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
- summary->addSpace();
-
- if (QSysInfo::macVersion() != QSysInfo::MV_None)
- {
- summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_sourceGroupSettings, window, isCDB));
- summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
- summary->addSpace();
- }
-
- summary->addContent(new QtProjectWizzardContentFlags(m_sourceGroupSettings, window));
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
-
- window->setup();
-
- if (m_editing)
- {
- window->updateTitle("EDIT PROJECT");
- window->updateNextButton("Save");
- window->setPreviousVisible(false);
- }
- else
- {
- window->updateSubTitle("Summary");
- window->updateNextButton("Create");
- }
- }
- );
-
- connect(window, SIGNAL(next()), this, SLOT(createProject()));
-}
-
-void QtProjectWizzard::showSummaryJava()
-{
- QtProjectWizzardWindow* window = createWindowWithSummary(
- [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
- {
- summary->setIsForm(true);
-
- bool isMaven = false;
- std::shared_ptr javaSettings = std::dynamic_pointer_cast(m_sourceGroupSettings);
- if (javaSettings)
- {
- isMaven = javaSettings->getAbsoluteMavenProjectFilePath().exists();
- }
-
-
- summary->addContent(new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window, m_editing));
- summary->addSpace();
-
- if (isMaven)
- {
- summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_sourceGroupSettings, window));
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_sourceGroupSettings, window));
- }
- else
- {
- summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsClassJava(m_sourceGroupSettings, window));
- }
-
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
- summary->addSpace();
- summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
-
- window->setup();
-
- if (m_editing)
- {
- window->updateTitle("EDIT PROJECT");
- window->updateNextButton("Save");
- window->setPreviousVisible(false);
- }
- else
- {
- window->updateSubTitle("Summary");
- window->updateNextButton("Create");
- }
- }
- );
-
- connect(window, SIGNAL(next()), this, SLOT(createProject()));
+ m_sourceGroupList->setCurrentRow(m_allSourceGroupSettings.size() - 1);
}
void QtProjectWizzard::createProject()
@@ -648,7 +844,7 @@ void QtProjectWizzard::createProject()
FilePath path = m_projectSettings->getFilePath();
m_projectSettings->setVersion(ProjectSettings::VERSION);
- m_projectSettings->setAllSourceGroupSettings({m_sourceGroupSettings});
+ m_projectSettings->setAllSourceGroupSettings(m_allSourceGroupSettings);
m_projectSettings->save(path);
bool forceRefreshProject = false;
@@ -678,36 +874,3 @@ void QtProjectWizzard::createProject()
finishWizzard();
}
-
-void QtProjectWizzard::savePreferences()
-{
- bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
-
- if (m_appSettings.getScrollSpeed() != ApplicationSettings::getInstance()->getScrollSpeed())
- {
- MessageScrollSpeedChange(ApplicationSettings::getInstance()->getScrollSpeed()).dispatch();
- }
-
- if (m_appSettings.getSourcetrailPort() != ApplicationSettings::getInstance()->getSourcetrailPort() ||
- m_appSettings.getPluginPort() != ApplicationSettings::getInstance()->getPluginPort())
- {
- MessagePluginPortChange().dispatch();
- }
-
- Application::getInstance()->loadSettings();
-
- if (appSettingsChanged)
- {
- Project* currentProject = Application::getInstance()->getCurrentProject().get();
- if (currentProject)
- {
- MessageLoadProject(currentProject->getProjectSettingsFilePath(), true).dispatch();
- }
- }
- else
- {
- MessageRefresh().refreshUiOnly().dispatch();
- }
-
- cancelWizzard();
-}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
index 6fd24f3a..f5663ef7 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
@@ -3,41 +3,41 @@
#include
-#include "qt/window/QtWindowStack.h"
+#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
+#include "qt/window/QtWindow.h"
#include "settings/ApplicationSettings.h"
#include "settings/ProjectSettings.h"
+class QListWidget;
+class QPushButton;
class QtProjectWizzardContent;
class QtProjectWizzardContentSummary;
class QtProjectWizzardWindow;
class QtProjectWizzard
- : public QtWindowStackElement
+ : public QtProjectWizzardWindow
{
Q_OBJECT
-signals:
- void finished();
- void canceled();
-
public:
QtProjectWizzard(QWidget* parent = nullptr);
-
- // QtWindowStackElement implementation
- virtual void showWindow() override;
- virtual void hideWindow() override;
+ virtual QSize sizeHint() const override;
public slots:
void newProject();
- void newProjectFromSolution(const std::string& ideId, const FilePath& solutionPath);
void newProjectFromCDB(const FilePath& filePath, const std::vector& headerPaths);
void refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
void editProject(const FilePath& settingsPath);
void editProject(std::shared_ptr settings);
- void showPreferences();
+
+protected:
+ virtual void populateWindow(QWidget* widget) override;
+ virtual void windowReady() override;
+
+ virtual void handlePrevious() override;
private:
static bool applicationSettingsContainVisualStudioHeaderSearchPaths();
@@ -48,26 +48,44 @@ private:
QtProjectWizzardWindow* createWindowWithSummary(
std::function func);
+ void updateSourceGroupList();
+ bool canExitContent();
+
QtWindowStack m_windowStack;
std::shared_ptr m_projectSettings;
- std::shared_ptr m_sourceGroupSettings;
+ std::vector> m_allSourceGroupSettings;
+ std::shared_ptr m_newSourceGroupSettings;
ApplicationSettings m_appSettings;
bool m_editing;
+ QPushButton* m_generalButton;
+ QPushButton* m_removeButton;
+ QPushButton* m_duplicateButton;
+ QListWidget* m_sourceGroupList;
+ QWidget* m_contentWidget;
+
private slots:
+ void generalButtonClicked();
+ void selectedSourceGroupChanged(int index);
+ void selectedSourceGroupNameChanged(QString name);
+ void removeSelectedSourceGroup();
+ void duplicateSelectedSourceGroup();
+
+ void cancelSourceGroup();
+
void cancelWizzard();
void finishWizzard();
void windowStackChanged();
+ void newSourceGroup();
void selectedProjectType(SourceGroupType sourceGroupType);
- void emptyProject();
- void emptyProjectCDBVS();
- void emptyProjectCDB();
- void emptyProjectJavaMaven();
+ void emptySourceGroup();
+ void emptySourceGroupCDBVS();
+ void emptySourceGroupCDB();
void sourcePaths();
void headerSearchPaths();
@@ -75,19 +93,14 @@ private slots:
void headerSearchPathsDone();
void frameworkSearchPaths();
- void headerPathsCDB();
-
void sourcePathsJava();
void sourcePathsJavaMaven();
void advancedSettingsCxx();
void advancedSettingsJava();
- void showSummary();
- void showSummaryJava();
-
+ void createSourceGroup();
void createProject();
- void savePreferences();
};
#endif // QT_PROJECT_WIZZARD_H
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
index 83767d61..5ca74122 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
@@ -67,7 +67,7 @@ void QtProjectWizzardContent::setIsInForm(bool isInForm)
QLabel* QtProjectWizzardContent::createFormLabel(QString name) const
{
QLabel* label = new QLabel(name);
- label->setAlignment(Qt::AlignRight);
+ label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
label->setObjectName("label");
label->setWordWrap(true);
return label;
@@ -81,10 +81,10 @@ QLabel* QtProjectWizzardContent::createFormTitle(QString name) const
return label;
}
-QToolButton* QtProjectWizzardContent::createProjectButton(QString name, QString iconPath) const
+QToolButton* QtProjectWizzardContent::createSourceGroupButton(QString name, QString iconPath) const
{
QToolButton* button = new QToolButton();
- button->setObjectName("projectButton");
+ button->setObjectName("sourceGroupButton");
button->setText(name);
button->setIcon(QPixmap(iconPath));
button->setIconSize(QSize(64, 64));
@@ -104,6 +104,7 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout*
{
QPushButton* button = new QPushButton(name);
button->setObjectName("windowButton");
+ button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
if (layout)
{
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
@@ -113,6 +114,19 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout*
return button;
}
+QFrame* QtProjectWizzardContent::addSeparator(QGridLayout* layout, int row) const
+{
+ QFrame* separator = new QFrame();
+ separator->setFrameShape(QFrame::HLine);
+
+ QPalette palette = separator->palette();
+ palette.setColor(QPalette::WindowText, Qt::lightGray);
+ separator->setPalette(palette);
+
+ layout->addWidget(separator, row, 0, 1, -1);
+ return separator;
+}
+
void QtProjectWizzardContent::filesButtonClicked()
{
m_window->saveContent();
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
index bb84044d..b8664916 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
@@ -39,10 +39,11 @@ public:
protected:
QLabel* createFormLabel(QString name) const;
QLabel* createFormTitle(QString name) const;
- QToolButton* createProjectButton(QString name, QString iconPath) const;
+ QToolButton* createSourceGroupButton(QString name, QString iconPath) const;
QtHelpButton* addHelpButton(QString helpString, QGridLayout* layout, int row) const;
QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const;
+ QFrame* addSeparator(QGridLayout* layout, int row) const;
QtProjectWizzardWindow* m_window;
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
index aee48898..981c3a3e 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
@@ -20,6 +20,7 @@ void QtProjectWizzardContentCDBSource::populate(QGridLayout* layout, int& row)
layout->setRowStretch(row, 0);
m_text = new QLabel("");
+ m_text->setWordWrap(true);
layout->addWidget(m_text, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
addFilesButton("show source files", layout, row + 1);
@@ -32,42 +33,47 @@ void QtProjectWizzardContentCDBSource::load()
m_fileNames.clear();
const FilePath projectPath = m_settings->getProjectFileLocation();
- std::vector excludePaths = m_settings->getAbsoluteExcludePaths();
+ std::vector excludePaths = m_settings->getExcludePathsExpandedAndAbsolute();
std::shared_ptr cxxSettings = std::dynamic_pointer_cast(m_settings);
if (cxxSettings)
{
- std::vector filePaths =
- IndexerCommandCxxCdb::getSourceFilesFromCDB(cxxSettings->getAbsoluteCompilationDatabasePath());
-
- for (FilePath path : filePaths)
+ FilePath cdbPath = cxxSettings->getCompilationDatabasePathExpandedAndAbsolute();
+ if (!cdbPath.empty() && cdbPath.exists())
{
- bool excluded = false;
- for (FilePath p : excludePaths)
+ std::vector filePaths =
+ IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
+
+ for (FilePath path : filePaths)
{
- if (p == path || p.contains(path))
+ bool excluded = false;
+ for (FilePath p : excludePaths)
{
- excluded = true;
- break;
+ if (p == path || p.contains(path))
+ {
+ excluded = true;
+ break;
+ }
}
- }
- if (excluded)
- {
- continue;
- }
+ if (excluded)
+ {
+ continue;
+ }
- if (projectPath.exists())
- {
- path = path.relativeTo(projectPath);
- }
+ if (projectPath.exists())
+ {
+ path = path.relativeTo(projectPath);
+ }
- m_fileNames.push_back(path.str());
+ m_fileNames.push_back(path.str());
+ }
}
}
+
if (m_text)
{
- m_text->setText(QString::number(m_fileNames.size()) + " source files were found in the compilation database.");
+ m_text->setText("" + QString::number(m_fileNames.size()) + " source files were found in the compilation database.");
}
}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp
deleted file mode 100644
index c40885f0..00000000
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
-
-#include
-#include
-
-#include "settings/SourceGroupSettingsCxx.h"
-#include "utility/messaging/type/MessageIDECreateCDB.h"
-#include "utility/logging/logging.h"
-
-QtProjectWizzardContentData::QtProjectWizzardContentData(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window,
- bool disableNameEditing
-)
- : QtProjectWizzardContent(window)
- , m_projectSettings(projectSettings)
- , m_sourceGroupSettings(sourceGroupSettings)
- , m_disableNameEditing(disableNameEditing)
- , m_projectName(nullptr)
- , m_projectFileLocation(nullptr)
- , m_language(nullptr)
- , m_standard(nullptr)
- , m_buildFilePicker(nullptr)
-{
-}
-
-void QtProjectWizzardContentData::populate(QGridLayout* layout, int& row)
-{
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- row++;
- }
-
- addNameAndLocation(layout, row);
-
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row++, 20);
- }
-
- addLanguageAndStandard(layout, row);
-
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- layout->setRowStretch(row, 1);
- }
-}
-
-void QtProjectWizzardContentData::load()
-{
- if (m_projectName)
- {
- m_projectName->setText(QString::fromStdString(m_projectSettings->getProjectName()));
- m_projectFileLocation->setText(QString::fromStdString(m_projectSettings->getProjectFileLocation().str()));
- }
-
- if (m_language)
- {
- LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
-
- if (type == LANGUAGE_UNKNOWN)
- {
- LOG_ERROR("No language type defined");
- return;
- }
-
- m_language->setText(languageTypeToString(type).c_str());
-
- m_standard->clear();
- std::vector standards = m_sourceGroupSettings->getAvailableLanguageStandards();
- for (size_t i = 0; i < standards.size(); i++)
- {
- m_standard->insertItem(i, standards[i].c_str());
- }
-
- m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
- }
-}
-
-void QtProjectWizzardContentData::save()
-{
- if (m_projectName)
- {
- m_projectSettings->setProjectName(m_projectName->text().toStdString());
- m_projectSettings->setProjectFileLocation(FilePath(m_projectFileLocation->getText().toStdString()));
- }
-
- if (m_standard)
- {
- m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
- }
-}
-
-bool QtProjectWizzardContentData::check()
-{
- if (!m_projectName)
- {
- return true;
- }
-
- if (m_projectName->text().isEmpty())
- {
- QMessageBox msgBox;
- msgBox.setText("Please enter a project name.");
- msgBox.exec();
- return false;
- }
-
- if (m_projectFileLocation->getText().isEmpty())
- {
- QMessageBox msgBox;
- msgBox.setText("Please define the location for the Sourcetrail project file.");
- msgBox.exec();
- return false;
- }
-
- std::vector paths = FilePath(m_projectFileLocation->getText().toStdString()).expandEnvironmentVariables();
- if (paths.size() != 1 || !paths[0].exists())
- {
- QMessageBox msgBox;
- msgBox.setText("The specified location does not exist.");
- msgBox.exec();
- return false;
- }
-
- return true;
-}
-
-void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& row)
-{
- QLabel* nameLabel = createFormLabel("Sourcetrail Project Name");
- m_projectName = new QLineEdit();
- m_projectName->setObjectName("name");
- m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
- m_projectName->setEnabled(!m_disableNameEditing);
-
- layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
- layout->addWidget(m_projectName, row, QtProjectWizzardWindow::BACK_COL);
- layout->setRowMinimumHeight(row, 30);
- row++;
-
- QLabel* locationLabel = createFormLabel("Sourcetrail Project Location");
- m_projectFileLocation = new QtLocationPicker(this);
- m_projectFileLocation->setPickDirectory(true);
- m_projectFileLocation->setEnabled(!m_disableNameEditing);
-
- layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
- layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
- addHelpButton("The directory where Sourcetrail project files will be saved to.", layout, row);
- layout->setRowMinimumHeight(row, 30);
- row++;
-}
-
-void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, int& row)
-{
- m_language = new QLabel();
- layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
- layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
- row++;
-
- m_standard = new QComboBox();
- layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
- layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
- row++;
-}
-
-void QtProjectWizzardContentData::addBuildFilePicker(
- QGridLayout* layout, int& row, const QString& name, const QString& filter)
-{
- QLabel* label = createFormLabel(name);
- layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL);
-
- m_buildFilePicker = new QtLocationPicker(this);
- m_buildFilePicker->setFileFilter(filter);
- connect(m_buildFilePicker, SIGNAL(locationPicked()), this, SLOT(pickedCDBPath()));
-
- layout->addWidget(m_buildFilePicker, row, QtProjectWizzardWindow::BACK_COL);
-
- row++;
-
- QLabel* description = new QLabel(
- "Sourcetrail will use all include paths and compiler flags from the compilation database and stay up-to-date "
- "with changes on refresh.", this);
- description->setObjectName("description");
- description->setWordWrap(true);
- layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
-
- row++;
-}
-
-
-QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window,
- bool disableNameEditing
-)
- : QtProjectWizzardContentData(projectSettings, sourceGroupSettings, window, disableNameEditing)
-{
-}
-
-void QtProjectWizzardContentDataCDB::populate(QGridLayout* layout, int& row)
-{
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- row++;
- }
-
- addNameAndLocation(layout, row);
-
- layout->setRowMinimumHeight(row++, 20);
-
- QString name = "Compilation Database (compile_commands.json)";
- QString filter = "JSON Compilation Database (*.json)";
- addBuildFilePicker(layout, row, name, filter);
-
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- layout->setRowStretch(row, 1);
- }
-}
-
-void QtProjectWizzardContentDataCDB::load()
-{
- QtProjectWizzardContentData::load();
- std::shared_ptr cxxSettings = std::dynamic_pointer_cast(m_sourceGroupSettings);
- if (cxxSettings)
- {
- m_buildFilePicker->setText(QString::fromStdString(cxxSettings->getCompilationDatabasePath().str()));
- }
-}
-
-void QtProjectWizzardContentDataCDB::save()
-{
- QtProjectWizzardContentData::save();
-
- FilePath path(m_buildFilePicker->getText().toStdString());
- FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path)); // maybe we can use SourceGroupSettings for this... that's where the the cdb path is stored.
- if (!absPath.exists() || absPath.extension() != ".json")
- {
- return;
- }
-
- std::shared_ptr cxxSettings = std::dynamic_pointer_cast(m_sourceGroupSettings);
- if (cxxSettings)
- {
- cxxSettings->setCompilationDatabasePath(path);
- }
-}
-
-bool QtProjectWizzardContentDataCDB::check()
-{
- if (!QtProjectWizzardContentData::check())
- {
- return false;
- }
-
- FilePath path(m_buildFilePicker->getText().toStdString());
- FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path));
- if (!absPath.exists() || absPath.extension() != ".json")
- {
- QMessageBox msgBox;
- msgBox.setText("Please enter a valid compilation database file (*.json).");
- msgBox.exec();
- return false;
- }
-
- return true;
-}
-
-void QtProjectWizzardContentDataCDB::pickedCDBPath()
-{
- FilePath projectPath = m_projectSettings->getProjectFileLocation();
- if (m_projectFileLocation)
- {
- projectPath = FilePath(m_projectFileLocation->getText().toStdString());
- }
-
- FilePath cdbPath(m_buildFilePicker->getText().toStdString());
-
- if (!projectPath.empty() && !cdbPath.empty())
- {
- FilePath relPath(cdbPath.relativeTo(projectPath));
- if (relPath.str().size() < cdbPath.str().size())
- {
- m_buildFilePicker->setText(relPath.str().c_str());
- }
- }
-
- m_window->saveContent();
- m_window->loadContent();
-}
-
-
-QtProjectWizzardContentDataCDBVS::QtProjectWizzardContentDataCDBVS(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window
-)
- : QtProjectWizzardContentDataCDB(projectSettings, sourceGroupSettings, window, false)
-{
-}
-
-void QtProjectWizzardContentDataCDBVS::populate(QGridLayout* layout, int& row)
-{
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- row++;
- }
-
- QLabel* nameLabel = createFormLabel("Create Compilation Database");
- layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL);
-
- addHelpButton("To create a new Compilation Database from a Visual Studio Solution, this Solution has to be open in Visual Studio.\n\
-Sourcetrail will call Visual Studio to open the 'Create Compilation Database' dialog.\
- Please follow the instructions in Visual Studio to complete the process.\n\
-Note: Sourcetrail's Visual Studio plugin has to be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded.", layout, row);
-
- QLabel* descriptionLabel = createFormLabel("Call Visual Studio to create a Compilation Database from the loaded Solution.");
- descriptionLabel->setObjectName("description");
- descriptionLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
- layout->addWidget(descriptionLabel, row, QtProjectWizzardWindow::BACK_COL);
- row++;
-
- QPushButton* button = new QPushButton("Create CDB");
- button->setObjectName("windowButton");
- layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL);
- row++;
-
- QLabel* skipLabel = createFormLabel("*Skip this step if you already have a Compilation Database for your Solution.");
- skipLabel->setObjectName("description");
- skipLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
- layout->addWidget(skipLabel, row, QtProjectWizzardWindow::BACK_COL);
- row++;
-
-
- QFrame* separator = new QFrame();
- separator->setFrameShape(QFrame::HLine);
-
- QPalette palette = separator->palette();
- palette.setColor(QPalette::WindowText, Qt::lightGray);
- separator->setPalette(palette);
-
- layout->addWidget(separator, row++, 0, 1, -1);
-
-
- connect(button, SIGNAL(clicked()), this, SLOT(handleVSCDBClicked()));
-
- addNameAndLocation(layout, row);
-
- layout->setRowMinimumHeight(row++, 20);
-
- QString name = "Compilation Database";
- QString filter = "JSON Compilation Database (*.json)";
- addBuildFilePicker(layout, row, name, filter);
-
- if (!isInForm())
- {
- layout->setRowMinimumHeight(row, 15);
- layout->setRowStretch(row, 1);
- }
-}
-
-void QtProjectWizzardContentDataCDBVS::handleVSCDBClicked()
-{
- MessageIDECreateCDB().dispatch();
-}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h
deleted file mode 100644
index fd0cfc06..00000000
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef QT_PROJECT_WIZZARD_CONTENT_DATA_H
-#define QT_PROJECT_WIZZARD_CONTENT_DATA_H
-
-#include
-#include
-
-#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
-#include "qt/element/QtLocationPicker.h"
-
-class ProjectSettings;
-class SourceGroupSettings;
-
-class QtProjectWizzardContentData
- : public QtProjectWizzardContent
-{
- Q_OBJECT
-
-public:
- QtProjectWizzardContentData(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window,
- bool disableNameEditing = false);
-
- // QtProjectWizzardContent implementation
- virtual void populate(QGridLayout* layout, int& row) override;
-
- virtual void load() override;
- virtual void save() override;
- virtual bool check() override;
-
-protected:
- virtual void addNameAndLocation(QGridLayout* layout, int& row);
- virtual void addLanguageAndStandard(QGridLayout* layout, int& row);
- virtual void addBuildFilePicker(QGridLayout* layout, int& row, const QString& name, const QString& filter);
-
- std::shared_ptr m_projectSettings;
- std::shared_ptr m_sourceGroupSettings;
-
- bool m_disableNameEditing;
- QLineEdit* m_projectName;
- QtLocationPicker* m_projectFileLocation;
-
- QLabel* m_language;
- QComboBox* m_standard;
-
- QtLocationPicker* m_buildFilePicker;
-};
-
-
-class QtProjectWizzardContentDataCDB
- : public QtProjectWizzardContentData
-{
- Q_OBJECT
-
-public:
- QtProjectWizzardContentDataCDB(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window,
- bool disableNameEditing = false);
-
- virtual void populate(QGridLayout* layout, int& row) override;
-
- virtual void load() override;
- virtual void save() override;
- virtual bool check() override;
-
-private slots:
- void pickedCDBPath();
-};
-
-
-class QtProjectWizzardContentDataCDBVS
- : public QtProjectWizzardContentDataCDB
-{
- Q_OBJECT
-
-public:
- QtProjectWizzardContentDataCDBVS(
- std::shared_ptr projectSettings,
- std::shared_ptr sourceGroupSettings,
- QtProjectWizzardWindow* window);
-
- virtual void populate(QGridLayout* layout, int& row) override;
-
-private slots:
- void handleVSCDBClicked();
-};
-
-#endif // QT_PROJECT_WIZZARD_CONTENT_DATA_H
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
index 213788ab..14161d9b 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
@@ -16,8 +16,7 @@ QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row)
{
QLabel* sourceLabel = createFormLabel("Source File Extensions");
- sourceLabel->setObjectName("label");
- layout->addWidget(sourceLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(sourceLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
addHelpButton("Define extensions for source files including the dot e.g. .cpp", layout, row);
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
index 89354f63..8ccd2aa5 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
@@ -14,8 +14,7 @@ QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptrsetObjectName("label");
- layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
addHelpButton("Define compiler flags used during indexing including the dash (e.g. use \"-D RELEASE\" to add a #define for \"RELEASE\").", layout, row);
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
new file mode 100644
index 00000000..910e4e79
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
@@ -0,0 +1,75 @@
+#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
+
+#include
+#include
+
+#include "settings/SourceGroupSettings.h"
+#include "utility/logging/logging.h"
+
+QtProjectWizzardContentLanguageAndStandard::QtProjectWizzardContentLanguageAndStandard(
+ std::shared_ptr sourceGroupSettings,
+ QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContent(window)
+ , m_sourceGroupSettings(sourceGroupSettings)
+ , m_language(nullptr)
+ , m_standard(nullptr)
+{
+}
+
+void QtProjectWizzardContentLanguageAndStandard::populate(QGridLayout* layout, int& row)
+{
+ if (!isInForm())
+ {
+ layout->setRowMinimumHeight(row, 15);
+ row++;
+ }
+
+ m_language = new QLabel();
+ layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
+ row++;
+
+ m_standard = new QComboBox();
+ layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
+ layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
+ row++;
+
+ if (!isInForm())
+ {
+ layout->setRowMinimumHeight(row, 15);
+ layout->setRowStretch(row, 1);
+ }
+}
+
+void QtProjectWizzardContentLanguageAndStandard::load()
+{
+ LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
+
+ if (type == LANGUAGE_UNKNOWN)
+ {
+ LOG_ERROR("No language type defined");
+ return;
+ }
+
+ m_language->setText(languageTypeToString(type).c_str());
+
+ m_standard->clear();
+ std::vector standards = m_sourceGroupSettings->getAvailableLanguageStandards();
+ for (size_t i = 0; i < standards.size(); i++)
+ {
+ m_standard->insertItem(i, standards[i].c_str());
+ }
+
+ m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
+}
+
+void QtProjectWizzardContentLanguageAndStandard::save()
+{
+ m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
+}
+
+bool QtProjectWizzardContentLanguageAndStandard::check()
+{
+ return true;
+}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h
new file mode 100644
index 00000000..69b24bc0
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h
@@ -0,0 +1,34 @@
+#ifndef QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
+#define QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
+
+#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
+
+class QComboBox;
+class QLabel;
+class SourceGroupSettings;
+
+class QtProjectWizzardContentLanguageAndStandard
+ : public QtProjectWizzardContent
+{
+ Q_OBJECT
+
+public:
+ QtProjectWizzardContentLanguageAndStandard(
+ std::shared_ptr sourceGroupSettings,
+ QtProjectWizzardWindow* window);
+
+ // QtProjectWizzardContent implementation
+ virtual void populate(QGridLayout* layout, int& row) override;
+
+ virtual void load() override;
+ virtual void save() override;
+ virtual bool check() override;
+
+private:
+ std::shared_ptr m_sourceGroupSettings;
+
+ QLabel* m_language;
+ QComboBox* m_standard;
+};
+
+#endif // QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
index dcd672de..1987126e 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
@@ -6,14 +6,15 @@
#include
#include
+#include "Application.h"
#include "component/view/DialogView.h"
#include "qt/element/QtLocationPicker.h"
#include "settings/ApplicationSettings.h"
+#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FileManager.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utilityMaven.h"
-#include "Application.h"
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
@@ -46,10 +47,42 @@ void QtProjectWizzardContentPath::populate(QGridLayout* layout, int& row)
bool QtProjectWizzardContentPath::check()
{
- if (m_picker->getText().isEmpty())
+ QString error;
+
+ while (true)
+ {
+ if (m_picker->getText().isEmpty())
+ {
+ error = "Please define a path at \"" + m_titleString + "\".";
+ break;
+ }
+
+ FilePath path = m_settings->makePathExpandedAndAbsolute(FilePath(m_picker->getText().toStdString()));
+
+ if (m_picker->pickDirectory())
+ {
+ break;
+ }
+
+ if (!path.exists())
+ {
+ error = "The entered path does not exist at \"" + m_titleString + "\".";
+ break;
+ }
+
+ if (m_fileEndings.find(path.extension()) == m_fileEndings.end())
+ {
+ error = "The entered path does have a correct file ending at \"" + m_titleString + "\".";
+ break;
+ }
+
+ break;
+ }
+
+ if (error.size())
{
QMessageBox msgBox;
- msgBox.setText("Please define the location for the \"" + m_titleString + "\".");
+ msgBox.setText(error);
msgBox.exec();
return false;
}
@@ -67,17 +100,82 @@ void QtProjectWizzardContentPath::setHelpString(const QString& help)
m_helpString = help;
}
+void QtProjectWizzardContentPath::setFileEndings(const std::set& fileEndings)
+{
+ m_fileEndings = fileEndings;
+}
+
+
+QtProjectWizzardContentPathCDB::QtProjectWizzardContentPathCDB(
+ std::shared_ptr settings, QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContentPath(settings, window)
+{
+ setTitleString("Compilation Database (compile_commands.json)");
+ setHelpString(
+ "Sourcetrail will use all include paths and compiler flags from the compilation database and stay up-to-date "
+ "with changes on refresh.
"
+ "
"
+ "You can make use of environment variables with ${ENV_VAR}."
+ );
+ setFileEndings({ ".json" });
+}
+
+void QtProjectWizzardContentPathCDB::populate(QGridLayout* layout, int& row)
+{
+ QtProjectWizzardContentPath::populate(layout, row);
+ m_picker->setPickDirectory(false);
+ m_picker->setFileFilter("JSON Compilation Database (*.json)");
+ connect(m_picker, SIGNAL(locationPicked()), this, SLOT(pickedCDBPath()));
+
+ QLabel* description = new QLabel(
+ "Sourcetrail will use all include paths and compiler flags from the compilation database and stay up-to-date "
+ "with changes on refresh.", this);
+ description->setObjectName("description");
+ description->setWordWrap(true);
+ layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
+ row++;
+}
+
+void QtProjectWizzardContentPathCDB::load()
+{
+ std::shared_ptr cxxSettings =
+ std::dynamic_pointer_cast(m_settings);
+ if (cxxSettings)
+ {
+ m_picker->setText(QString::fromStdString(cxxSettings->getCompilationDatabasePath().str()));
+ }
+}
+
+void QtProjectWizzardContentPathCDB::save()
+{
+ std::shared_ptr cxxSettings =
+ std::dynamic_pointer_cast(m_settings);
+ if (cxxSettings)
+ {
+ cxxSettings->setCompilationDatabasePath(FilePath(m_picker->getText().toStdString()));
+ }
+}
+
+void QtProjectWizzardContentPathCDB::pickedCDBPath()
+{
+ m_window->saveContent();
+ m_window->loadContent();
+}
+
+
QtProjectWizzardContentPathSourceMaven::QtProjectWizzardContentPathSourceMaven(
std::shared_ptr settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
{
- setTitleString("Maven Project File");
+ setTitleString("Maven Project File (pom.xml)");
setHelpString(
- "Enter the path to the main .pom file of your Maven project.
"
+ "Enter the path to the main pom.xml file of your Maven project.
"
"
"
"You can make use of environment variables with ${ENV_VAR}."
);
+ setFileEndings({ ".xml" });
}
void QtProjectWizzardContentPathSourceMaven::populate(QGridLayout* layout, int& row)
@@ -124,7 +222,7 @@ std::vector QtProjectWizzardContentPathSourceMaven::getFileNames()
std::shared_ptr javaSettings = std::dynamic_pointer_cast(m_settings);
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
- const FilePath mavenProjectRoot = javaSettings->getAbsoluteMavenProjectFilePath().parentDirectory();
+ const FilePath mavenProjectRoot = javaSettings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
std::vector list;
std::shared_ptr dialogView = Application::getInstance()->getDialogView();
@@ -153,7 +251,7 @@ std::vector QtProjectWizzardContentPathSourceMaven::getFileNames()
FileManager fileManager;
fileManager.update(
sourceDirectories,
- m_settings->getAbsoluteExcludePaths(),
+ m_settings->getExcludePathsExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
@@ -174,6 +272,7 @@ std::vector QtProjectWizzardContentPathSourceMaven::getFileNames()
return list;
}
+
QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDependenciesMaven(
std::shared_ptr settings, QtProjectWizzardWindow* window
)
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.h
index 8e838e45..ab52d3d1 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.h
@@ -1,6 +1,8 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_PATH_H
#define QT_PROJECT_WIZZARD_CONTENT_PATH_H
+#include
+
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
class QCheckBox;
@@ -27,6 +29,8 @@ protected:
void setTitleString(const QString& title);
void setHelpString(const QString& help);
+ void setFileEndings(const std::set& fileEndings);
+
std::shared_ptr m_settings;
QtLocationPicker* m_picker;
@@ -36,18 +40,38 @@ protected:
private:
QString m_titleString;
QString m_helpString;
+ std::set m_fileEndings;
};
+
+class QtProjectWizzardContentPathCDB
+ : public QtProjectWizzardContentPath
+{
+ Q_OBJECT
+
+public:
+ QtProjectWizzardContentPathCDB(std::shared_ptr settings, QtProjectWizzardWindow* window);
+
+ // QtProjectWizzardContent implementation
+ virtual void populate(QGridLayout* layout, int& row) override;
+
+ virtual void load() override;
+ virtual void save() override;
+
+private slots:
+ void pickedCDBPath();
+};
+
+
class QtProjectWizzardContentPathSourceMaven
: public QtProjectWizzardContentPath
{
public:
QtProjectWizzardContentPathSourceMaven(std::shared_ptr settings, QtProjectWizzardWindow* window);
- // QtSettingsWindow implementation
+ // QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
- // QtProjectWizzardContent implementation
virtual void load() override;
virtual void save() override;
@@ -57,6 +81,7 @@ private:
QCheckBox* m_shouldIndexTests;
};
+
class QtProjectWizzardContentPathDependenciesMaven
: public QtProjectWizzardContentPath
{
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
index e10da644..25860215 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
@@ -34,7 +34,7 @@ void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row)
m_list = new QtDirectoryListBox(this, m_titleString);
- if (m_makePathsRelativeToProjectFileLocation)
+ if (m_makePathsRelativeToProjectFileLocation && m_settings)
{
m_list->setRelativeRootDirectory(m_settings->getProjectFileLocation());
}
@@ -59,29 +59,26 @@ bool QtProjectWizzardContentPaths::check()
{
QString missingPaths;
- for (const FilePath& path : m_list->getList())
+ std::vector paths = m_list->getList();
+ if (m_settings)
{
- std::vector