diff --git a/bin/app/data/ProjectSettings_template.xml b/bin/app/data/ProjectSettings_template.xml
index 84867338..0ba7b27f 100644
--- a/bin/app/data/ProjectSettings_template.xml
+++ b/bin/app/data/ProjectSettings_template.xml
@@ -39,5 +39,11 @@
+
+
+
+
+
+
diff --git a/bin/app/data/gui/startscreen/logo_blurry.png b/bin/app/data/gui/startscreen/logo_blurry.png
deleted file mode 100644
index 13eec631..00000000
Binary files a/bin/app/data/gui/startscreen/logo_blurry.png and /dev/null differ
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 90b6e32e..ddd955ad 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -237,7 +237,7 @@ add_files(
utility/messaging/type/MessageInterruptTasks.h
utility/messaging/type/MessageLoadProject.h
utility/messaging/type/MessageMoveIDECursor.h
- utility/messaging/type/MessageNewProject.h
+ utility/messaging/type/MessageProjectNew.h
utility/messaging/type/MessageRedo.h
utility/messaging/type/MessageRefresh.h
utility/messaging/type/MessageResetZoom.h
@@ -278,7 +278,7 @@ add_files(
utility/solution/ISolutionParser.h
utility/solution/SolutionParserVisualStudio.cpp
utility/solution/SolutionParserVisualStudio.h
-
+
utility/text/Dictionary.cpp
utility/text/Dictionary.h
utility/text/TextAccess.cpp
diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp
index 4b45a4f1..890112bc 100644
--- a/src/lib/Project.cpp
+++ b/src/lib/Project.cpp
@@ -189,20 +189,24 @@ Parser::Arguments Project::getParserArguments() const
// Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
utility::append(args.systemHeaderSearchPaths, m_fileManager.getSourcePaths());
- // std::vector headerSearchSubPaths;
- // for(FilePath p : projSettings->getHeaderSearchPaths())
- // {
- // std::vector tempPaths = FileSystem::getSubDirectories(p);
- // headerSearchSubPaths.insert( headerSearchSubPaths.end(), tempPaths.begin(), tempPaths.end() );
- // }
-
- // std::unique(headerSearchSubPaths.begin(),headerSearchSubPaths.end());
- // utility::append(args.systemHeaderSearchPaths, headerSearchSubPaths);
-
utility::append(args.systemHeaderSearchPaths, projSettings->getHeaderSearchPaths());
utility::append(args.systemHeaderSearchPaths, appSettings->getHeaderSearchPaths());
+ // Add all subdirectories of the header search paths
+ if (projSettings->getUseSourcePathsForHeaderSearch())
+ {
+ std::vector headerSearchSubPaths;
+ for (FilePath p : projSettings->getHeaderSearchPaths())
+ {
+ std::vector tempPaths = FileSystem::getSubDirectories(p);
+ headerSearchSubPaths.insert( headerSearchSubPaths.end(), tempPaths.begin(), tempPaths.end() );
+ }
+
+ std::unique(headerSearchSubPaths.begin(),headerSearchSubPaths.end());
+ utility::append(args.systemHeaderSearchPaths, headerSearchSubPaths);
+ }
+
utility::append(args.frameworkSearchPaths, projSettings->getFrameworkSearchPaths());
utility::append(args.frameworkSearchPaths, appSettings->getFrameworkSearchPaths());
diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp
index 1e2ae6fa..d3895c8f 100644
--- a/src/lib/component/controller/IDECommunicationController.cpp
+++ b/src/lib/component/controller/IDECommunicationController.cpp
@@ -7,10 +7,9 @@
#include "utility/messaging/type/MessageActivateTokenLocations.h"
#include "utility/messaging/type/MessageActivateWindow.h"
#include "utility/messaging/type/MessageLoadProject.h"
+#include "utility/messaging/type/MessageProjectNew.h"
#include "utility/messaging/type/MessageStatus.h"
-#include "utility/messaging/type/MessageNewProject.h"
#include "utility/logging/logging.h"
-#include "utility/solution/SolutionParserVisualStudio.h"
#include "settings/ProjectSettings.h"
@@ -86,38 +85,9 @@ void IDECommunicationController::handleCreateProjectMessage(const NetworkProtoco
{
if (message.ideId == NetworkProtocolHelper::CreateProjectMessage::IDE_ID::VS)
{
- SolutionParserVisualStudio parser;
-
- parser.openSolutionFile(message.solutionFileLocation);
- std::vector includePaths = parser.getIncludePaths();
- std::vector projectItems = parser.getProjectItems();
-
- /*std::vector projectFPs;
- std::vector includeFPs;
-
- for (unsigned int i = 0; i < projectItems.size(); i++)
- {
- projectFPs.push_back(FilePath(projectItems[i]));
- }
-
- for (unsigned int i = 0; i < includePaths.size(); i++)
- {
- includeFPs.push_back(FilePath(includePaths[i]));
- }*/
-
- /*ProjectSettings* projSettings = ProjectSettings::getInstance().get();
- projSettings->clear();
-
- projSettings->setLanguage("c++");
- projSettings->setStandard("11");
-
- projSettings->setSourcePaths(projectFPs);
- projSettings->setHeaderSearchPaths(includeFPs);
-
- std::string filePath = parser.getSolutionPath() + parser.getSolutionName() + ".coatiproject";
- projSettings->save(filePath);*/
-
- MessageNewProject(parser.getSolutionName(), parser.getSolutionPath(), projectItems, includePaths).dispatch();
+ MessageProjectNew msg;
+ msg.setVisualStudioSolutionPath(message.solutionFileLocation);
+ msg.dispatch();
}
else
{
diff --git a/src/lib/settings/ProjectSettings.cpp b/src/lib/settings/ProjectSettings.cpp
index a2b71f72..a057b9e1 100644
--- a/src/lib/settings/ProjectSettings.cpp
+++ b/src/lib/settings/ProjectSettings.cpp
@@ -1,5 +1,7 @@
#include "settings/ProjectSettings.h"
+#include "utility/utility.h"
+
std::vector ProjectSettings::getDefaultHeaderExtensions()
{
std::vector defaultValues;
@@ -38,6 +40,20 @@ ProjectSettings::~ProjectSettings()
{
}
+bool ProjectSettings::operator==(const ProjectSettings& other) const
+{
+ return
+ getFilePath() == other.getFilePath() &&
+ getLanguage() == other.getLanguage() &&
+ getStandard() == other.getStandard() &&
+ getVisualStudioSolutionPath() == other.getVisualStudioSolutionPath() &&
+ getCompilationDatabasePath() == other.getCompilationDatabasePath() &&
+ getUseSourcePathsForHeaderSearch() == other.getUseSourcePathsForHeaderSearch() &&
+ utility::isPermutation(getSourcePaths(), other.getSourcePaths()) &&
+ utility::isPermutation(getHeaderSearchPaths(), other.getHeaderSearchPaths()) &&
+ utility::isPermutation(getFrameworkSearchPaths(), other.getFrameworkSearchPaths());
+}
+
void ProjectSettings::save(const FilePath& filePath)
{
m_projectName = "";
@@ -126,6 +142,41 @@ bool ProjectSettings::setSourceExtensions(const std::vector &source
return setValues("source/extensions/source_extensions", sourceExtensions);
}
+bool ProjectSettings::isUseSourcePathsForHeaderSearchDefined() const
+{
+ return isValueDefined("source/use_source_paths_for_header_search");
+}
+
+bool ProjectSettings::getUseSourcePathsForHeaderSearch() const
+{
+ return getValue("source/use_source_paths_for_header_search", false);
+}
+
+bool ProjectSettings::setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch)
+{
+ return setValue("source/use_source_paths_for_header_search", useSourcePathsForHeaderSearch);
+}
+
+FilePath ProjectSettings::getVisualStudioSolutionPath() const
+{
+ return FilePath(getValue("source/build_file_path/vs_solution_path", ""));
+}
+
+bool ProjectSettings::setVisualStudioSolutionPath(const FilePath& visualStudioSolutionPath)
+{
+ return setValue("source/build_file_path/vs_solution_path", visualStudioSolutionPath.str());
+}
+
+FilePath ProjectSettings::getCompilationDatabasePath() const
+{
+ return FilePath(getValue("source/build_file_path/compilation_db_path", ""));
+}
+
+bool ProjectSettings::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
+{
+ return setValue("source/build_file_path/compilation_db_path", compilationDatabasePath.str());
+}
+
std::string ProjectSettings::getDescription() const
{
return getValue("info/description", "");
diff --git a/src/lib/settings/ProjectSettings.h b/src/lib/settings/ProjectSettings.h
index 82f34b3d..99b2da20 100644
--- a/src/lib/settings/ProjectSettings.h
+++ b/src/lib/settings/ProjectSettings.h
@@ -17,10 +17,9 @@ public:
ProjectSettings();
~ProjectSettings();
- virtual void save(const FilePath& filePath);
+ bool operator==(const ProjectSettings& other) const;
- // info
- std::string getDescription() const;
+ virtual void save(const FilePath& filePath);
// language settings
std::string getLanguage() const;
@@ -41,13 +40,25 @@ public:
std::vector getCompilerFlags() const;
- // extensions
std::vector getHeaderExtensions() const;
std::vector getSourceExtensions() const;
bool setHeaderExtensions(const std::vector& headerExtensions);
bool setSourceExtensions(const std::vector& sourceExtensions);
+ bool isUseSourcePathsForHeaderSearchDefined() const;
+ bool getUseSourcePathsForHeaderSearch() const;
+ bool setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch);
+
+ FilePath getVisualStudioSolutionPath() const;
+ bool setVisualStudioSolutionPath(const FilePath& visualStudioSolutionPath);
+
+ FilePath getCompilationDatabasePath() const;
+ bool setCompilationDatabasePath(const FilePath& compilationDatabasePath);
+
+ // info
+ std::string getDescription() const;
+
// used in project wizzard
std::string getProjectName() const;
void setProjectName(const std::string& name);
diff --git a/src/lib/settings/Settings.cpp b/src/lib/settings/Settings.cpp
index 9cddd882..f9a92ea6 100644
--- a/src/lib/settings/Settings.cpp
+++ b/src/lib/settings/Settings.cpp
@@ -5,6 +5,23 @@
#include "utility/text/TextAccess.h"
#include "utility/utilityString.h"
+Settings::Settings(const Settings& other)
+ : m_filePath(other.m_filePath)
+ , m_config(other.m_config->createCopy())
+{
+}
+
+Settings& Settings::operator=(const Settings& other)
+{
+ if (&other != this)
+ {
+ m_filePath = other.m_filePath;
+ m_config = other.m_config->createCopy();
+ }
+
+ return *this;
+}
+
Settings::~Settings()
{
}
@@ -137,6 +154,11 @@ bool Settings::moveRelativePathValues(const std::string& key, const FilePath& fi
return setValues(key, values);
}
+bool Settings::isValueDefined(const std::string& key) const
+{
+ return m_config->isValueDefined(key);
+}
+
void Settings::enableWarnings() const
{
m_config->setWarnOnEmptyKey(true);
diff --git a/src/lib/settings/Settings.h b/src/lib/settings/Settings.h
index 66ed1ecb..9d8cedcf 100644
--- a/src/lib/settings/Settings.h
+++ b/src/lib/settings/Settings.h
@@ -11,6 +11,8 @@
class Settings
{
public:
+ Settings(const Settings& other);
+ Settings& operator=(const Settings& other);
virtual ~Settings();
bool load(const FilePath& filePath);
@@ -43,6 +45,8 @@ protected:
bool setPathValues(const std::string& key, const std::vector& paths);
bool moveRelativePathValues(const std::string& key, const FilePath& filePath);
+ bool isValueDefined(const std::string& key) const;
+
void enableWarnings() const;
void disableWarnings() const;
diff --git a/src/lib/utility/ConfigManager.cpp b/src/lib/utility/ConfigManager.cpp
index 2d7fecc3..785b02ef 100644
--- a/src/lib/utility/ConfigManager.cpp
+++ b/src/lib/utility/ConfigManager.cpp
@@ -18,6 +18,11 @@ std::shared_ptr ConfigManager::createAndLoad(const std::shared_pt
return configManager;
}
+std::shared_ptr ConfigManager::createCopy()
+{
+ return std::shared_ptr(new ConfigManager(*this));
+}
+
void ConfigManager::clear()
{
m_values.clear();
@@ -215,6 +220,13 @@ void ConfigManager::setValues(const std::string& key, const std::vector& v
setValues(key, stringValues);
}
+bool ConfigManager::isValueDefined(const std::string& key) const
+{
+ std::multimap::const_iterator it = m_values.find(key);
+
+ return (it != m_values.end());
+}
+
bool ConfigManager::load(const std::shared_ptr textAccess)
{
std::string text = textAccess->getText();
@@ -258,6 +270,12 @@ ConfigManager::ConfigManager()
{
}
+ConfigManager::ConfigManager(const ConfigManager& other)
+ : m_values(other.m_values)
+ , m_warnOnEmptyKey(other.m_warnOnEmptyKey)
+{
+}
+
bool ConfigManager::createXmlDocument(bool saveAsFile, const std::string filepath, std::string& output)
{
bool success = true;
diff --git a/src/lib/utility/ConfigManager.h b/src/lib/utility/ConfigManager.h
index 53d085de..c717f202 100644
--- a/src/lib/utility/ConfigManager.h
+++ b/src/lib/utility/ConfigManager.h
@@ -14,6 +14,7 @@ class ConfigManager
public:
static std::shared_ptr createEmpty();
static std::shared_ptr createAndLoad(const std::shared_ptr textAccess);
+ std::shared_ptr createCopy();
void clear();
@@ -37,6 +38,8 @@ public:
void setValues(const std::string& key, const std::vector& values);
void setValues(const std::string& key, const std::vector& values);
+ bool isValueDefined(const std::string& key) const;
+
bool load(const std::shared_ptr textAccess);
void save(const std::string filepath);
std::string toString();
diff --git a/src/lib/utility/messaging/type/MessageNewProject.h b/src/lib/utility/messaging/type/MessageNewProject.h
deleted file mode 100644
index 163d2a84..00000000
--- a/src/lib/utility/messaging/type/MessageNewProject.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef MESSAGE_NEW_PROJECT_H
-#define MESSAGE_NEW_PROJECT_H
-
-#include "utility/messaging/Message.h"
-
-class MessageNewProject : public Message
-{
-public:
- MessageNewProject(const std::string& projectName, const std::string projectLocation,
- const std::vector& sourceFiles, const std::vector& includePaths)
- : projectName(projectName)
- , projectLocation(projectLocation)
- , projectSourceFiles(sourceFiles)
- , projectIncludePaths(includePaths)
- {
- }
-
- static const std::string getStaticType()
- {
- return "MessageNewProject";
- }
-
- virtual void print(std::ostream& os) const
- {
- }
-
- const std::string projectName;
- const std::string projectLocation;
- const std::vector projectSourceFiles;
- const std::vector projectIncludePaths;
-};
-
-#endif // MESSAGE_NEW_PROJECT_H
\ No newline at end of file
diff --git a/src/lib/utility/messaging/type/MessageProjectNew.h b/src/lib/utility/messaging/type/MessageProjectNew.h
new file mode 100644
index 00000000..245ff6a3
--- /dev/null
+++ b/src/lib/utility/messaging/type/MessageProjectNew.h
@@ -0,0 +1,32 @@
+#ifndef MESSAGE_PROJECT_NEW_H
+#define MESSAGE_PROJECT_NEW_H
+
+#include "utility/messaging/Message.h"
+
+class MessageProjectNew
+ : public Message
+{
+public:
+ MessageProjectNew()
+ {
+ }
+
+ static const std::string getStaticType()
+ {
+ return "MessageProjectNew";
+ }
+
+ bool fromVisualStudioSolution() const
+ {
+ return visualStudioSolutionPath.size() > 0;
+ }
+
+ void setVisualStudioSolutionPath(const std::string& path)
+ {
+ visualStudioSolutionPath = path;
+ }
+
+ std::string visualStudioSolutionPath;
+};
+
+#endif // MESSAGE_PROJECT_NEW_H
diff --git a/src/lib_gui/CMakeLists.txt b/src/lib_gui/CMakeLists.txt
index 4e33afd0..34b4bace 100644
--- a/src/lib_gui/CMakeLists.txt
+++ b/src/lib_gui/CMakeLists.txt
@@ -107,6 +107,8 @@ add_files(
qt/window/project_wizzard/QtProjectWizzard.h
qt/window/project_wizzard/QtProjectWizzardContent.cpp
qt/window/project_wizzard/QtProjectWizzardContent.h
+ qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h
qt/window/project_wizzard/QtProjectWizzardContentData.cpp
qt/window/project_wizzard/QtProjectWizzardContentData.h
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
@@ -115,6 +117,8 @@ add_files(
qt/window/project_wizzard/QtProjectWizzardContentSelect.h
qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
qt/window/project_wizzard/QtProjectWizzardContentSimple.h
+ qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp
+ qt/window/project_wizzard/QtProjectWizzardContentSourceList.h
qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
qt/window/project_wizzard/QtProjectWizzardContentSummary.h
qt/window/project_wizzard/QtProjectWizzardWindow.cpp
diff --git a/src/lib_gui/qt/element/QtDirectoryListBox.cpp b/src/lib_gui/qt/element/QtDirectoryListBox.cpp
index 3ad6169a..4187e386 100644
--- a/src/lib_gui/qt/element/QtDirectoryListBox.cpp
+++ b/src/lib_gui/qt/element/QtDirectoryListBox.cpp
@@ -56,10 +56,14 @@ void QtListItemWidget::setFocus()
void QtListItemWidget::handleButtonPress()
{
QFileDialog dialog(this);
- QListView *l = dialog.findChild("listView");
-
dialog.setFileMode(QFileDialog::Directory);
+ if (m_data->text().size())
+ {
+ dialog.setDirectory(m_data->text());
+ }
+
+ QListView *l = dialog.findChild("listView");
if (l)
{
l->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -69,6 +73,7 @@ void QtListItemWidget::handleButtonPress()
{
t->setSelectionMode(QAbstractItemView::SingleSelection);
}
+
if (dialog.exec())
{
QStringList list = dialog.selectedFiles();
@@ -229,6 +234,11 @@ void QtDirectoryListBox::resize()
height += (m_list->itemWidget(m_list->item(0))->height() + 1) * m_list->count() + 7;
}
+ if (height < 0)
+ {
+ height = 0;
+ }
+
m_list->setMaximumHeight(height);
}
diff --git a/src/lib_gui/qt/element/QtLocationPicker.cpp b/src/lib_gui/qt/element/QtLocationPicker.cpp
index de1ef205..30179e95 100644
--- a/src/lib_gui/qt/element/QtLocationPicker.cpp
+++ b/src/lib_gui/qt/element/QtLocationPicker.cpp
@@ -6,6 +6,7 @@
QtLocationPicker::QtLocationPicker(QWidget *parent)
: QWidget(parent)
+ , m_pickDirectory(false)
{
QBoxLayout* layout = new QHBoxLayout();
layout->setSpacing(0);
@@ -43,11 +44,30 @@ void QtLocationPicker::clearText()
m_data->clear();
}
+void QtLocationPicker::setPickDirectory(bool pickDirectory)
+{
+ m_pickDirectory = pickDirectory;
+}
+
+void QtLocationPicker::setFileFilter(const QString& fileFilter)
+{
+ m_fileFilter = fileFilter;
+}
+
void QtLocationPicker::handleButtonPress()
{
- QString file = QFileDialog::getExistingDirectory(this, tr("Select Directory"), "");
- if (!file.isEmpty())
+ QString fileName;
+ if (m_pickDirectory)
{
- m_data->setText(file);
+ fileName = QFileDialog::getExistingDirectory(this, tr("Select Directory"), m_data->text());
+ }
+ else
+ {
+ fileName = QFileDialog::getOpenFileName(this, tr("Open File"), m_data->text(), m_fileFilter);
+ }
+
+ if (!fileName.isEmpty())
+ {
+ m_data->setText(fileName);
}
}
diff --git a/src/lib_gui/qt/element/QtLocationPicker.h b/src/lib_gui/qt/element/QtLocationPicker.h
index 578e8876..aa57b321 100644
--- a/src/lib_gui/qt/element/QtLocationPicker.h
+++ b/src/lib_gui/qt/element/QtLocationPicker.h
@@ -17,12 +17,18 @@ public:
void setText(QString text);
void clearText();
+ void setPickDirectory(bool pickDirectory);
+ void setFileFilter(const QString& fileFilter);
+
private slots:
void handleButtonPress();
private:
QPushButton* m_button;
QtLineEdit* m_data;
+
+ bool m_pickDirectory;
+ QString m_fileFilter;
};
#endif // QT_LOCATION_PICKER_H
diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp
index e599259d..9acdf19d 100644
--- a/src/lib_gui/qt/window/QtMainWindow.cpp
+++ b/src/lib_gui/qt/window/QtMainWindow.cpp
@@ -113,7 +113,7 @@ bool MouseWheelFilter::eventFilter(QObject* obj, QEvent* event)
QtMainWindow::QtMainWindow()
: m_showDockWidgetTitleBars(true)
, m_windowStack(this)
- , m_createNewProjectFunctor(std::bind(&QtMainWindow::doCreateNewProject, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
+ , m_createNewProjectFunctor(std::bind(&QtMainWindow::doCreateNewProject, this, std::placeholders::_1))
{
setObjectName("QtMainWindow");
setCentralWidget(nullptr);
@@ -261,9 +261,10 @@ void QtMainWindow::forceEnterLicense()
enterLicenseWindow->setEnabled(true);
}
-void QtMainWindow::handleMessage(MessageNewProject* message)
+void QtMainWindow::handleMessage(MessageProjectNew* message)
{
- m_createNewProjectFunctor(message->projectName, message->projectLocation, message->projectSourceFiles, message->projectIncludePaths);
+ MessageProjectNew msg(*message);
+ m_createNewProjectFunctor(msg);
}
bool QtMainWindow::event(QEvent* event)
@@ -561,30 +562,18 @@ void QtMainWindow::toggleShowDockWidgetTitleBars()
setShowDockWidgetTitleBars(!m_showDockWidgetTitleBars);
}
-void QtMainWindow::doCreateNewProject(const std::string& name, const std::string& location,
- const std::vector& sourceFiles, const std::vector& includePaths)
+void QtMainWindow::doCreateNewProject(MessageProjectNew message)
{
- ProjectSettings settings;
- settings.setProjectName(name);
- settings.setProjectFileLocation(location);
-
- std::vector sourcePaths;
- for (const std::string& p : sourceFiles)
- {
- sourcePaths.push_back(FilePath(p));
- }
-
- std::vector headerPaths;
- for (const std::string& p : includePaths)
- {
- headerPaths.push_back(FilePath(p));
- }
-
- settings.setSourcePaths(sourcePaths);
- settings.setHeaderSearchPaths(headerPaths);
-
QtProjectWizzard* wizzard = createWindow();
- wizzard->editProject(settings);
+
+ if (message.fromVisualStudioSolution())
+ {
+ wizzard->newProjectFromVisualStudioSolution(message.visualStudioSolutionPath);
+ }
+ else
+ {
+ wizzard->newProject();
+ }
}
void QtMainWindow::setupEditMenu()
diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h
index 31dabc54..e28d3685 100644
--- a/src/lib_gui/qt/window/QtMainWindow.h
+++ b/src/lib_gui/qt/window/QtMainWindow.h
@@ -9,7 +9,7 @@
#include
#include "utility/messaging/MessageListener.h"
-#include "utility/messaging/type/MessageNewProject.h"
+#include "utility/messaging/type/MessageProjectNew.h"
#include "qt/utility/QtThreadedFunctor.h"
#include "qt/window/QtWindowStack.h"
@@ -66,7 +66,7 @@ protected:
class QtMainWindow
: public QMainWindow
- , public MessageListener
+ , public MessageListener
{
Q_OBJECT
@@ -87,7 +87,7 @@ public:
void forceEnterLicense();
- void handleMessage(MessageNewProject* message);
+ void handleMessage(MessageProjectNew* message);
protected:
bool event(QEvent* event);
@@ -142,8 +142,7 @@ private:
QtViewToggle* toggle;
};
- void doCreateNewProject(const std::string& name, const std::string& location,
- const std::vector& sourceFiles, const std::vector& includePaths);
+ void doCreateNewProject(MessageProjectNew message);
void setupEditMenu();
void setupProjectMenu();
@@ -170,7 +169,7 @@ private:
QShortcut* m_escapeShortcut;
- QtThreadedFunctor, std::vector> m_createNewProjectFunctor;
+ QtThreadedFunctor m_createNewProjectFunctor;
};
#endif // QT_MAIN_WINDOW_H
diff --git a/src/lib_gui/qt/window/QtProjectSetupScreen.cpp b/src/lib_gui/qt/window/QtProjectSetupScreen.cpp
deleted file mode 100644
index dd70fc92..00000000
--- a/src/lib_gui/qt/window/QtProjectSetupScreen.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-#include "qt/window/QtProjectSetupScreen.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include "utility/messaging/type/MessageLoadProject.h"
-#include "utility/utility.h"
-
-#include "settings/ProjectSettings.h"
-
-QtTextLine::QtTextLine(QWidget *parent)
- : QWidget(parent)
-{
- QBoxLayout* layout = new QHBoxLayout();
- layout->setSpacing(0);
- layout->setContentsMargins(1, 1, 1, 1);
- layout->setAlignment(Qt::AlignTop);
-
- setLayout(layout);
-
- m_data = new QtLineEdit(this);
- m_data->setAttribute(Qt::WA_MacShowFocusRect, 0);
- m_data->setObjectName("locationField");
-
- m_button = new QPushButton("...");
- m_button->setObjectName("moreButton");
-
- layout->addWidget(m_data);
- layout->addWidget(m_button);
-
- connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress()));
-}
-
-QString QtTextLine::getText()
-{
- return m_data->text();
-}
-
-void QtTextLine::setText(QString text)
-{
- m_data->setText(text);
-}
-
-void QtTextLine::clearText()
-{
- m_data->clear();
-}
-
-void QtTextLine::handleButtonPress()
-{
- QString file = QFileDialog::getExistingDirectory(this, tr("Select Directory"), "");
- if (!file.isEmpty())
- {
- m_data->setText(file);
- }
-}
-
-QtProjectSetupScreen::QtProjectSetupScreen(QWidget *parent)
- : QtSettingsWindow(parent)
- , m_frameworkPaths(nullptr)
-{
-}
-
-QSize QtProjectSetupScreen::sizeHint() const
-{
- return QSize(600,600);
-}
-
-void QtProjectSetupScreen::clear()
-{
- m_projectName->clear();
- m_projectFileLocation->clearText();
-
- m_language->setCurrentIndex(0);
- m_cppStandard->setCurrentIndex(0);
- m_cStandard->setCurrentIndex(0);
-
- m_sourcePaths->clear();
- m_includePaths->clear();
-
- if (m_frameworkPaths)
- {
- m_frameworkPaths->clear();
- }
-}
-
-void QtProjectSetupScreen::setup()
-{
- setupForm();
-
- QPushButton* preferencesButton = new QPushButton("Preferences");
- preferencesButton->setObjectName("windowButton");
- connect(preferencesButton, SIGNAL(clicked()), this, SLOT(handlePreferencesButtonPress()));
-
- m_buttonsLayout->insertWidget(2, preferencesButton);
- m_buttonsLayout->insertStretch(3);
-}
-
-void QtProjectSetupScreen::loadEmpty()
-{
- updateTitle("NEW PROJECT");
- updateDoneButton("Create");
-
- clear();
-}
-
-void QtProjectSetupScreen::loadProjectSettings()
-{
- updateTitle("EDIT PROJECT");
- updateDoneButton("Save");
-
- ProjectSettings* projSettings = ProjectSettings::getInstance().get();
-
- m_projectName->setText(QString::fromStdString(projSettings->getFilePath().withoutExtension().fileName()));
- m_projectFileLocation->setText(QString::fromStdString(projSettings->getFilePath().parentDirectory().str()));
-
- if (projSettings->getLanguage().length() > 0)
- {
- m_language->setCurrentText(QString::fromStdString(projSettings->getLanguage()));
- }
- if (projSettings->getStandard().length() > 0)
- {
- if (m_language->currentIndex() == 0) // c++
- {
- m_cppStandard->setCurrentText(QString::fromStdString(projSettings->getStandard()));
- }
- else if (m_language->currentIndex() == 1) // c
- {
- m_cStandard->setCurrentText(QString::fromStdString(projSettings->getStandard()));
- }
- }
-
- m_sourcePaths->setList(projSettings->getSourcePaths());
- m_includePaths->setList(projSettings->getHeaderSearchPaths());
-
- if (m_frameworkPaths)
- {
- m_frameworkPaths->setList(projSettings->getFrameworkSearchPaths());
- }
-}
-
-void QtProjectSetupScreen::setPresets(const std::string& name, const std::string& location,
- const std::vector& sourceFiles, const std::vector& includePaths)
-{
- m_projectName->setText(QString::fromStdString(name));
- m_projectFileLocation->setText(QString::fromStdString(location));
-
- std::vector sourceFilePaths;
- for (unsigned int i = 0; i < sourceFiles.size(); i++)
- {
- sourceFilePaths.push_back(FilePath(sourceFiles[i]));
- }
-
- std::vector includePathsPaths;
- for (unsigned int i = 0; i < includePaths.size(); i++)
- {
- includePathsPaths.push_back(FilePath(includePaths[i]));
- }
-
- m_sourcePaths->setList(sourceFilePaths);
- m_includePaths->setList(includePathsPaths);
-}
-
-void QtProjectSetupScreen::populateForm(QFormLayout* layout)
-{
- int minimumWidthForSecondCol = 360;
-
- QLabel* nameLabel = new QLabel("Name");
- m_projectName = new QLineEdit();
- m_projectName->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
- m_projectName->setMinimumWidth(minimumWidthForSecondCol);
- m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
- layout->addRow(nameLabel, m_projectName);
-
- QLabel* locationLabel = new QLabel("Location");
- m_projectFileLocation = new QtTextLine(this);
- m_projectFileLocation->setMinimumWidth(minimumWidthForSecondCol);
- layout->addRow(locationLabel, m_projectFileLocation);
-
- QLabel* languageLabel = new QLabel("Language");
- m_language = new QComboBox();
- m_language->insertItem(0, "C++");
- m_language->insertItem(1, "C");
- connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
- layout->addRow(languageLabel, m_language);
-
- m_cppStandardLabel = new QLabel("Standard");
-
- m_cppStandard = new QComboBox();
- m_cppStandard->insertItem(0, "1z");
- m_cppStandard->insertItem(1, "14");
- m_cppStandard->insertItem(2, "1y");
- m_cppStandard->insertItem(3, "11");
- m_cppStandard->insertItem(4, "0x");
- m_cppStandard->insertItem(5, "03");
- m_cppStandard->insertItem(6, "98");
- layout->addRow(m_cppStandardLabel, m_cppStandard);
-
-
- m_cStandardLabel = new QLabel("Standard");
-
- m_cStandard = new QComboBox();
- m_cStandard->insertItem(0, "1x");
- m_cStandard->insertItem(1, "11");
- m_cStandard->insertItem(2, "9x");
- m_cStandard->insertItem(3, "99");
- m_cStandard->insertItem(4, "90");
- m_cStandard->insertItem(5, "89");
- layout->addRow(m_cStandardLabel, m_cStandard);
- m_cStandardLabel->hide();
- m_cStandard->hide();
-
- QPushButton* helpButton;
-
- QWidget* sourcePathsWidget = createLabelWithHelpButton("Analyzed Paths", &helpButton);
- connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress()));
- m_sourcePaths = new QtDirectoryListBox(this);
- m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol);
- layout->addRow(sourcePathsWidget, m_sourcePaths);
-
- QWidget* includePathsWidget = createLabelWithHelpButton("Header\nSearch Paths", &helpButton);
- connect(helpButton, SIGNAL(clicked()), this, SLOT(handleIncludePathHelpPress()));
- m_includePaths = new QtDirectoryListBox(this);
- m_includePaths->setMinimumWidth(minimumWidthForSecondCol);
- layout->addRow(includePathsWidget, m_includePaths);
-
- if (QSysInfo::macVersion() != QSysInfo::MV_None)
- {
- QWidget* frameworkPathsWidget = createLabelWithHelpButton("Framework\nSearch Paths", &helpButton);
- connect(helpButton, SIGNAL(clicked()), this, SLOT(handleFrameworkPathHelpPress()));
- m_frameworkPaths = new QtDirectoryListBox(this);
- m_frameworkPaths->setMinimumWidth(minimumWidthForSecondCol);
- layout->addRow(frameworkPathsWidget, m_frameworkPaths);
- }
-}
-
-void QtProjectSetupScreen::handleCancelButtonPress()
-{
- emit canceled();
-}
-
-void QtProjectSetupScreen::handleUpdateButtonPress()
-{
- if (m_projectName->text().isEmpty())
- {
- QMessageBox msgBox;
- msgBox.setText("Please enter a project name.");
- msgBox.exec();
- return;
- }
-
- if (m_projectFileLocation->getText().isEmpty())
- {
- QMessageBox msgBox;
- msgBox.setText("Please define the location of the project file.");
- msgBox.exec();
- return;
- }
-
- if (!m_sourcePaths->getList().size())
- {
- QMessageBox msgBox;
- msgBox.setText("Please add at least one source path to your project.");
- msgBox.exec();
- return;
- }
-
-
- std::shared_ptr projectSettings = ProjectSettings::getInstance();
-
- std::string newLanguage = m_language->currentText().toStdString();
-
- std::string newStandard = "";
- if (m_cppStandard->isVisible())
- {
- newStandard = m_cppStandard->currentText().toStdString();
- }
- else if (m_cStandard->isVisible())
- {
- newStandard = m_cStandard->currentText().toStdString();
- }
-
- std::vector newSourcePaths = m_sourcePaths->getList();
- std::vector newHeaderSearchPaths = m_includePaths->getList();
- std::vector newFrameworkPaths = m_frameworkPaths ? m_frameworkPaths->getList() : std::vector();
-
- bool somethingChanged = !(
- newLanguage == projectSettings->getLanguage() &&
- newStandard == projectSettings->getStandard() &&
- utility::isPermutation(newSourcePaths, projectSettings->getSourcePaths()) &&
- utility::isPermutation(newHeaderSearchPaths, projectSettings->getHeaderSearchPaths()) &&
- utility::isPermutation(newFrameworkPaths, projectSettings->getFrameworkSearchPaths())
- );
-
- projectSettings->clear();
- projectSettings->setLanguage(newLanguage);
- projectSettings->setStandard(newStandard);
- projectSettings->setSourcePaths(newSourcePaths);
- projectSettings->setHeaderSearchPaths(newHeaderSearchPaths);
- projectSettings->setFrameworkSearchPaths(newFrameworkPaths);
-
- std::string projectFilePath =
- m_projectFileLocation->getText().toStdString() + "/" + m_projectName->text().toStdString() + ".coatiproject";
-
- projectSettings->save(projectFilePath);
-
- if (m_title->text() == "NEW PROJECT")
- {
- MessageLoadProject(projectFilePath, false).dispatch();
- }
- else if (somethingChanged)
- {
- MessageLoadProject(projectFilePath, true).dispatch();
- }
- emit finished();
-}
-
-void QtProjectSetupScreen::handleSourcePathHelpPress()
-{
- showHelpMessage(
- "Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the source "
- "and header files of your project or a subset of them."
- );
-}
-
-void QtProjectSetupScreen::handleIncludePathHelpPress()
-{
- showHelpMessage(
- "Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
- "header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
- "them for correct analysis.\n\n"
- "Please note that you can define Header Search Paths for all your projects in Coati's preferences."
- );
-}
-
-void QtProjectSetupScreen::handleFrameworkPathHelpPress()
-{
- showHelpMessage(
- "Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
- "Please note that you can define Framework Search Paths for all your projects in Coati's preferences."
- );
-}
-
-void QtProjectSetupScreen::handlePreferencesButtonPress()
-{
- emit showPreferences();
-}
-
-void QtProjectSetupScreen::handleSelectionChanged(int index)
-{
- if (index != 0)
- {
- m_cStandardLabel->show();
- m_cStandard->show();
- m_cppStandardLabel->hide();
- m_cppStandard->hide();
- }
- else
- {
- m_cppStandardLabel->show();
- m_cppStandard->show();
- m_cStandardLabel->hide();
- m_cStandard->hide();
- }
-}
diff --git a/src/lib_gui/qt/window/QtSettingsWindow.cpp b/src/lib_gui/qt/window/QtSettingsWindow.cpp
index 0d140927..26f92d60 100644
--- a/src/lib_gui/qt/window/QtSettingsWindow.cpp
+++ b/src/lib_gui/qt/window/QtSettingsWindow.cpp
@@ -120,13 +120,6 @@ void QtSettingsWindow::mouseReleaseEvent(QMouseEvent *event)
void QtSettingsWindow::setupForm()
{
- QtDeviceScaledPixmap coati_logo((ResourcePaths::getGuiPath() + "startscreen/logo_blurry.png").c_str());
- coati_logo.scaleToWidth(400);
- QLabel* coatiLogoLabel = new QLabel(m_window);
- coatiLogoLabel->setPixmap(coati_logo.pixmap());
- coatiLogoLabel->resize(coati_logo.width(), coati_logo.height());
- coatiLogoLabel->move(100, 100);
-
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "setting_window/window.css").c_str());
QVBoxLayout* windowLayout = new QVBoxLayout();
windowLayout->setContentsMargins(25, 30, 25, 20);
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
index 19ab3fd1..2114033c 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp
@@ -1,5 +1,6 @@
#include "qt/window/project_wizzard/QtProjectWizzard.h"
+#include
#include
#include
@@ -7,9 +8,11 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
#include "utility/messaging/type/MessageLoadProject.h"
+#include "utility/solution/SolutionParserVisualStudio.h"
QtProjectWizzard::QtProjectWizzard(QWidget* parent)
: QWidget(parent)
@@ -33,11 +36,52 @@ void QtProjectWizzard::newProject()
window->disablePrevious();
}
+void QtProjectWizzard::newProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath)
+{
+ ProjectSettings settings = getSettingsForVisualStudioSolution(visualStudioSolutionPath);
+
+ editProject(settings);
+
+ QWidget* window = m_windowStack.getTopWindow();
+
+ if (window)
+ {
+ dynamic_cast(window)->updateTitle("NEW PROJECT FROM VS SOLUTION");
+ }
+}
+
+void QtProjectWizzard::refreshProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath)
+{
+ QtProjectWizzardWindow* window = dynamic_cast(m_windowStack.getTopWindow());
+ if (window)
+ {
+ window->content()->save();
+ }
+
+ ProjectSettings settings = getSettingsForVisualStudioSolution(visualStudioSolutionPath);
+
+ m_settings.setSourcePaths(settings.getSourcePaths());
+ m_settings.setHeaderSearchPaths(settings.getHeaderSearchPaths());
+ m_settings.setVisualStudioSolutionPath(FilePath(visualStudioSolutionPath));
+
+ if (window)
+ {
+ window->content()->load();
+ }
+}
+
void QtProjectWizzard::editProject(const ProjectSettings& settings)
{
m_settings = settings;
- QtProjectWizzardWindow* window = createWindowWithContent();
+ showSummary();
+
+ QtProjectWizzardWindow* window = dynamic_cast(m_windowStack.getTopWindow());
+ if (!window)
+ {
+ return;
+ }
+
window->updateTitle("EDIT PROJECT");
window->updateDoneButton("Save");
@@ -51,7 +95,6 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
window->setContent(new T(&m_settings, window));
-
window->setup();
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
@@ -62,6 +105,68 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
return window;
}
+template
+QtProjectWizzardWindow* QtProjectWizzard::createPopupWithContent()
+{
+ QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
+
+ window->setShowAsPopup(true);
+ window->setContent(new T(&m_settings, window));
+ window->setup();
+
+ window->move(window->pos() + QPoint(50, 50));
+ window->show();
+
+ connect(window, SIGNAL(closed()), this, SLOT(popupClosed()));
+
+ if (m_popup)
+ {
+ m_popup->hide();
+ }
+
+ m_popup = std::shared_ptr(window);
+
+ return window;
+}
+
+ProjectSettings QtProjectWizzard::getSettingsForVisualStudioSolution(const std::string& visualStudioSolutionPath) const
+{
+ SolutionParserVisualStudio parser;
+ parser.openSolutionFile(visualStudioSolutionPath);
+
+ ProjectSettings settings;
+ settings.setProjectName(parser.getSolutionName());
+ settings.setProjectFileLocation(parser.getSolutionPath());
+ settings.setVisualStudioSolutionPath(FilePath(visualStudioSolutionPath));
+
+ std::vector sourceFiles = parser.getProjectItems();
+ std::vector sourcePaths;
+ for (const std::string& p : sourceFiles)
+ {
+ sourcePaths.push_back(FilePath(p));
+ }
+
+ std::vector includePaths = parser.getIncludePaths();
+ std::vector headerPaths;
+ for (const std::string& p : includePaths)
+ {
+ headerPaths.push_back(FilePath(p));
+ }
+
+ settings.setSourcePaths(sourcePaths);
+ settings.setHeaderSearchPaths(headerPaths);
+
+ // For testing
+
+ // ProjectSettings settings;
+ // settings.setProjectName("hallo");
+ // settings.setProjectFileLocation("~/Desktop");
+ // settings.setVisualStudioSolutionPath(FilePath(visualStudioSolutionPath));
+ // settings.setSourcePaths(std::vector(1, visualStudioSolutionPath));
+
+ return settings;
+}
+
void QtProjectWizzard::cancelWizzard()
{
m_windowStack.clearWindows();
@@ -78,6 +183,16 @@ void QtProjectWizzard::windowStackChanged()
}
}
+void QtProjectWizzard::popupClosed()
+{
+ QWidget* window = m_windowStack.getTopWindow();
+
+ if (window)
+ {
+ window->raise();
+ }
+}
+
void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::ProjectType type)
{
switch (type)
@@ -86,8 +201,20 @@ void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::Projec
emptyProject();
break;
- case QtProjectWizzardContentSelect::PROJECT_CDB:
case QtProjectWizzardContentSelect::PROJECT_VS:
+ {
+ QString fileName = QFileDialog::getOpenFileName(
+ this, tr("Open Visual Studio Solution"), "", "Visual Studio Solution (*.sln)"
+ );
+
+ if (!fileName.isNull())
+ {
+ newProjectFromVisualStudioSolution(fileName.toStdString());
+ }
+ break;
+ }
+
+ case QtProjectWizzardContentSelect::PROJECT_CDB:
QMessageBox msgBox;
msgBox.setText("Project type not implemented yet!");
msgBox.exec();
@@ -98,33 +225,68 @@ void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::Projec
void QtProjectWizzard::emptyProject()
{
QtProjectWizzardWindow* window = createWindowWithContent();
- // connect(window, SIGNAL(next()), this, SLOT(simpleSetup()));
- connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
+ connect(window, SIGNAL(next()), this, SLOT(simpleSetup()));
}
void QtProjectWizzard::simpleSetup()
{
QtProjectWizzardWindow* window = createWindowWithContent();
- connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
+ connect(window, SIGNAL(next()), this, SLOT(simpleSetupDone()));
+}
+
+void QtProjectWizzard::simpleSetupDone()
+{
+ if (m_settings.getUseSourcePathsForHeaderSearch())
+ {
+ simpleSourcePaths();
+ }
+ else
+ {
+ sourcePaths();
+ }
}
void QtProjectWizzard::sourcePaths()
{
QtProjectWizzardWindow* window = createWindowWithContent();
connect(window, SIGNAL(next()), this, SLOT(headerSearchPaths()));
+
+ connect(dynamic_cast(window->content()),
+ SIGNAL(showSourceFiles(std::vector)),
+ this, SLOT(showSourceFiles(std::vector)));
}
void QtProjectWizzard::headerSearchPaths()
{
QtProjectWizzardWindow* window = createWindowWithContent();
+ connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone()));
+}
+void QtProjectWizzard::simpleSourcePaths()
+{
+ QtProjectWizzardWindow* window = createWindowWithContent();
+ connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths()));
+
+ connect(dynamic_cast(window->content()),
+ SIGNAL(showSourceFiles(std::vector)),
+ this, SLOT(showSourceFiles(std::vector)));
+}
+
+void QtProjectWizzard::simpleHeaderSearchPaths()
+{
+ QtProjectWizzardWindow* window = createWindowWithContent();
+ connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone()));
+}
+
+void QtProjectWizzard::headerSearchPathsDone()
+{
if (QSysInfo::macVersion() != QSysInfo::MV_None)
{
- connect(window, SIGNAL(next()), this, SLOT(frameworkSearchPaths()));
+ frameworkSearchPaths();
}
else
{
- connect(window, SIGNAL(next()), this, SLOT(showSummary()));
+ showSummary();
}
}
@@ -134,10 +296,26 @@ void QtProjectWizzard::frameworkSearchPaths()
connect(window, SIGNAL(next()), this, SLOT(showSummary()));
}
+void QtProjectWizzard::showSourceFiles(std::vector sourcePaths)
+{
+ QtProjectWizzardWindow* window = createPopupWithContent();
+ dynamic_cast(window->content())->showFilesFromSourcePaths(sourcePaths);
+}
+
void QtProjectWizzard::showSummary()
{
QtProjectWizzardWindow* window = createWindowWithContent();
connect(window, SIGNAL(next()), this, SLOT(createProject()));
+
+ QtProjectWizzardContentSummary* summary = dynamic_cast(window->content());
+
+ connect(dynamic_cast(summary->contentBuildFile()),
+ SIGNAL(refreshVisualStudioSolution(const std::string&)),
+ this, SLOT(refreshProjectFromVisualStudioSolution(const std::string&)));
+
+ connect(dynamic_cast(summary->contentPathsSource()),
+ SIGNAL(showSourceFiles(std::vector)),
+ this, SLOT(showSourceFiles(std::vector)));
}
void QtProjectWizzard::createProject()
@@ -146,7 +324,9 @@ void QtProjectWizzard::createProject()
m_settings.save(path);
- MessageLoadProject(path, true).dispatch();
+ bool forceRefresh = !(m_settings == *ProjectSettings::getInstance().get());
+
+ MessageLoadProject(path, forceRefresh).dispatch();
m_windowStack.clearWindows();
emit finished();
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
index 5850c6b6..89ed064c 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h
@@ -23,27 +23,43 @@ public:
public slots:
void newProject();
+ void newProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath);
+ void refreshProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath);
void editProject(const ProjectSettings& settings);
private:
template
QtProjectWizzardWindow* createWindowWithContent();
+ template
+ QtProjectWizzardWindow* createPopupWithContent();
+
+ ProjectSettings getSettingsForVisualStudioSolution(const std::string& visualStudioSolutionPath) const;
QtWindowStack m_windowStack;
+ std::shared_ptr m_popup;
ProjectSettings m_settings;
private slots:
void cancelWizzard();
void windowStackChanged();
+ void popupClosed();
void selectedProjectType(QtProjectWizzardContentSelect::ProjectType type);
void emptyProject();
void simpleSetup();
+ void simpleSetupDone();
+
void sourcePaths();
void headerSearchPaths();
+
+ void simpleSourcePaths();
+ void simpleHeaderSearchPaths();
+
+ void headerSearchPathsDone();
void frameworkSearchPaths();
+ void showSourceFiles(std::vector sourcePaths);
void showSummary();
void createProject();
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
index abd1ec77..d4caa802 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp
@@ -31,3 +31,12 @@ bool QtProjectWizzardContent::check()
{
return true;
}
+
+QLabel* QtProjectWizzardContent::createFormLabel(QString name) const
+{
+ QLabel* label = new QLabel(name);
+ label->setAlignment(Qt::AlignRight);
+ label->setObjectName("label");
+ label->setWordWrap(true);
+ return label;
+}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
index e29ea4e4..f2d462d8 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h
@@ -1,6 +1,8 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_H
#define QT_PROJECT_WIZZARD_CONTENT_H
+#include
+#include
#include
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
@@ -25,6 +27,8 @@ public:
virtual bool check();
protected:
+ QLabel* createFormLabel(QString name) const;
+
ProjectSettings* m_settings;
QtProjectWizzardWindow* m_window;
};
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp
new file mode 100644
index 00000000..af5ae268
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp
@@ -0,0 +1,109 @@
+#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
+
+#include
+#include
+
+#include "qt/element/QtLocationPicker.h"
+
+QtProjectWizzardContentBuildFile::QtProjectWizzardContentBuildFile(
+ ProjectSettings* settings, QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContent(settings, window)
+ , m_type(QtProjectWizzardContentSelect::PROJECT_EMPTY)
+{
+ if (!m_settings->getVisualStudioSolutionPath().empty())
+ {
+ m_type = QtProjectWizzardContentSelect::PROJECT_VS;
+ }
+ else if (!m_settings->getCompilationDatabasePath().empty())
+ {
+ m_type = QtProjectWizzardContentSelect::PROJECT_CDB;
+ }
+}
+
+void QtProjectWizzardContentBuildFile::populateForm(QFormLayout* layout)
+{
+ QString name;
+ QString filter;
+
+ switch (m_type)
+ {
+ case QtProjectWizzardContentSelect::PROJECT_EMPTY:
+ return;
+ case QtProjectWizzardContentSelect::PROJECT_VS:
+ name = "Visual Studio Solution";
+ filter = "Visual Studio Solution (*.txt)";
+ break;
+ case QtProjectWizzardContentSelect::PROJECT_CDB:
+ name = "Compilation Database";
+ break;
+ }
+
+ QLabel* label = createFormLabel(name);
+ m_picker = new QtLocationPicker(this);
+ m_picker->setFileFilter(filter);
+
+ int minimumWidthForSecondCol = 360;
+ m_picker->setMinimumWidth(minimumWidthForSecondCol);
+
+ QPushButton* button = new QPushButton("r");
+ button->setObjectName("moreButton");
+ button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
+ button->setToolTip("refresh paths");
+ connect(button, SIGNAL(clicked()), this, SLOT(refreshClicked()));
+
+ m_picker->layout()->addWidget(button);
+
+ layout->addRow(label, m_picker);
+}
+
+void QtProjectWizzardContentBuildFile::load()
+{
+ switch (m_type)
+ {
+ case QtProjectWizzardContentSelect::PROJECT_EMPTY:
+ return;
+ case QtProjectWizzardContentSelect::PROJECT_VS:
+ m_picker->setText(QString::fromStdString(m_settings->getVisualStudioSolutionPath().str()));
+ break;
+ case QtProjectWizzardContentSelect::PROJECT_CDB:
+ m_picker->setText(QString::fromStdString(m_settings->getCompilationDatabasePath().str()));
+ break;
+ }
+}
+
+void QtProjectWizzardContentBuildFile::refreshClicked()
+{
+ FilePath path = FilePath(m_picker->getText().toStdString());
+ if (!path.exists())
+ {
+ return;
+ }
+
+ QMessageBox::StandardButton reply =
+ QMessageBox::question(
+ this,
+ "Refresh Paths",
+ "Do you really want to refresh from the given file? All changes you have made to the project's analyzed "
+ "paths and header search paths will be lost.",
+ QMessageBox::Yes | QMessageBox::No
+ );
+
+ if (reply == QMessageBox::No)
+ {
+ return;
+ }
+
+ switch (m_type)
+ {
+ case QtProjectWizzardContentSelect::PROJECT_EMPTY:
+ break;
+ case QtProjectWizzardContentSelect::PROJECT_VS:
+ {
+ emit refreshVisualStudioSolution(path.str());
+ break;
+ }
+ case QtProjectWizzardContentSelect::PROJECT_CDB:
+ break;
+ }
+}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h
new file mode 100644
index 00000000..c97a6282
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h
@@ -0,0 +1,35 @@
+#ifndef QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
+#define QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
+
+#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
+
+class QtLocationPicker;
+class QPushButton;
+
+class QtProjectWizzardContentBuildFile
+ : public QtProjectWizzardContent
+{
+ Q_OBJECT
+
+signals:
+ void refreshVisualStudioSolution(const std::string&);
+
+public:
+ QtProjectWizzardContentBuildFile(ProjectSettings* settings, QtProjectWizzardWindow* window);
+
+ // QtProjectWizzardContent implementation
+ virtual void populateForm(QFormLayout* layout) override;
+
+ virtual void load() override;
+
+private slots:
+ void refreshClicked();
+
+private:
+ QtLocationPicker* m_picker;
+
+ QtProjectWizzardContentSelect::ProjectType m_type;
+};
+
+#endif // QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp
index 8674e288..47d7822d 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp
@@ -23,17 +23,16 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout)
{
int minimumWidthForSecondCol = 360;
- QLabel* nameLabel = new QLabel("Name");
- nameLabel->setObjectName("label");
+ QLabel* nameLabel = createFormLabel("Name");
m_projectName = new QLineEdit();
m_projectName->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
m_projectName->setMinimumWidth(minimumWidthForSecondCol);
m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
layout->addRow(nameLabel, m_projectName);
- QLabel* locationLabel = new QLabel("Location");
- locationLabel->setObjectName("label");
+ QLabel* locationLabel = createFormLabel("Location");
m_projectFileLocation = new QtLocationPicker(this);
+ m_projectFileLocation->setPickDirectory(true);
m_projectFileLocation->setMinimumWidth(minimumWidthForSecondCol);
layout->addRow(locationLabel, m_projectFileLocation);
@@ -45,8 +44,7 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout)
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
layout->addRow(languageLabel, m_language);
- m_cppStandardLabel = new QLabel("Standard");
- m_cppStandardLabel->setObjectName("label");
+ m_cppStandardLabel = createFormLabel("Standard");
m_cppStandard = new QComboBox();
m_cppStandard->insertItem(0, "1z");
@@ -59,8 +57,7 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout)
layout->addRow(m_cppStandardLabel, m_cppStandard);
- m_cStandardLabel = new QLabel("Standard");
- m_cStandardLabel->setObjectName("label");
+ m_cStandardLabel = createFormLabel("Standard");
m_cStandard = new QComboBox();
m_cStandard->insertItem(0, "1x");
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
index c960dfd6..bb74429b 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
@@ -33,6 +33,7 @@ void QtHelpButton::handleHelpPress()
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
, m_subPaths(nullptr)
+ , m_addShowSourcesButton(false)
{
}
@@ -60,10 +61,18 @@ void QtProjectWizzardContentPaths::populateLayout(QVBoxLayout* layout)
QLabel* text = new QLabel(m_descriptionString);
text->setWordWrap(true);
+ text->setOpenExternalLinks(true);
layout->addWidget(text);
m_list = new QtDirectoryListBox(this);
layout->addWidget(m_list);
+
+ if (m_addShowSourcesButton)
+ {
+ QPushButton* button = new QPushButton("show files");
+ layout->addWidget(button);
+ connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked()));
+ }
}
void QtProjectWizzardContentPaths::populateForm(QFormLayout* layout)
@@ -74,15 +83,20 @@ void QtProjectWizzardContentPaths::populateForm(QFormLayout* layout)
vlayout->setContentsMargins(0, 5, 0, 5);
vlayout->setSpacing(5);
- QLabel* label = new QLabel(m_titleString);
- label->setAlignment(Qt::AlignRight);
- label->setObjectName("label");
- label->setWordWrap(true);
+ QLabel* label = createFormLabel(m_titleString);
vlayout->addWidget(label);
QtHelpButton* button = new QtHelpButton(m_helpString);
vlayout->addWidget(button, 0, Qt::AlignRight);
+
+ if (m_addShowSourcesButton)
+ {
+ QPushButton* button = new QPushButton("files");
+ vlayout->addWidget(button);
+ connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked()));
+ }
+
vlayout->addStretch();
widget->setLayout(vlayout);
@@ -148,17 +162,39 @@ void QtProjectWizzardContentPaths::setInfo(const QString& title, const QString&
m_helpString = help;
}
+void QtProjectWizzardContentPaths::setTitleString(const QString& title)
+{
+ m_titleString = title;
+}
+
+void QtProjectWizzardContentPaths::setDescriptionString(const QString& description)
+{
+ m_descriptionString = description;
+}
+
+void QtProjectWizzardContentPaths::setHelpString(const QString& help)
+{
+ m_helpString = help;
+}
+
+void QtProjectWizzardContentPaths::showSourcesClicked()
+{
+ emit showSourceFiles(m_list->getList());
+}
+
QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
+ m_addShowSourcesButton = true;
+
setInfo(
- "Analyzed Paths",
- "Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the "
- "source and header files of your project or a subset of them.",
- "Analyzed Paths define the source files and directories that will be analysed by Coati. Usually these are the "
+ "Project Paths",
+ "Add all directories or files you want to analyse. Usually these are all source and header files of "
+ "your project or a subset of them.",
+ "Project Paths define the source files and directories that will be analyzed by Coati. Usually these are the "
"source and header files of your project or a subset of them."
);
}
@@ -178,7 +214,7 @@ bool QtProjectWizzardContentPathsSource::checkPaths()
if (m_list->getList().size() == 0)
{
QMessageBox msgBox;
- msgBox.setText("Please set at least one source path for Coati to analyse.");
+ msgBox.setText("Please add at least one path.");
msgBox.exec();
return false;
}
@@ -186,6 +222,20 @@ bool QtProjectWizzardContentPathsSource::checkPaths()
return true;
}
+QtProjectWizzardContentPathsSourceSimple::QtProjectWizzardContentPathsSourceSimple(
+ ProjectSettings* settings, QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContentPathsSource(settings, window)
+{
+ m_addShowSourcesButton = true;
+
+ setTitleString("Project Paths");
+ setDescriptionString(
+ "Add all directories or files you want to analyse with Coati. It is sufficient to just provide the top level "
+ "project directory."
+ );
+}
+
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
ProjectSettings* settings, QtProjectWizzardWindow* window
@@ -194,13 +244,10 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear
{
setInfo(
"Header Search Paths",
+ "Add the header search paths for resolving #include directives in the analyzed source and header files.",
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
- "header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
- "them for correct analysis.",
- "Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
- "header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
- "them for correct analysis.\n\n"
- "Header Search Paths defined here will be used for all projects."
+ "header files of frameworks or libraries that your project uses. These files won't be analyzed, but Coati needs "
+ "them for correct analysis."
);
m_subPaths = new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window);
@@ -216,6 +263,18 @@ void QtProjectWizzardContentPathsHeaderSearch::savePaths()
m_settings->setHeaderSearchPaths(m_list->getList());
}
+QtProjectWizzardContentPathsHeaderSearchSimple::QtProjectWizzardContentPathsHeaderSearchSimple(
+ ProjectSettings* settings, QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContentPathsHeaderSearch(settings, window)
+{
+ setTitleString("External Header Search Paths");
+ setDescriptionString(
+ "Add the header search paths to external dependencies used in your project. The header search paths are "
+ "needed to resolve #include directives within your source and header files."
+ );
+}
+
QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHeaderSearchGlobal(
ProjectSettings* settings, QtProjectWizzardWindow* window
)
@@ -223,9 +282,11 @@ QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHead
{
setInfo(
"Global Header Search Paths",
- "Header Search Paths for all projects.",
+ "These header search paths will be used in all your projects. Use it to add system header and Standard Library "
+ "header paths (See Finding "
+ "System Header Locations).",
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
- "header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
+ "header files of frameworks or libraries that your project uses. These files won't be analyzed, but Coati needs "
"them for correct analysis.\n\n"
"Header Search Paths defined here will be used for all projects."
);
@@ -249,9 +310,8 @@ QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFramewo
{
setInfo(
"Framework Search Paths",
- "Framework Search Paths define where MacOS framework containers, that your project depends on, are found.",
- "Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
- "Framework Search Paths defined here will be used for all projects."
+ "Add search paths to Mac OS framework containers (.framework) that the project depends on.",
+ "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are found."
);
m_subPaths = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window);
@@ -274,8 +334,10 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF
{
setInfo(
"Global Framework Search Paths",
- "Framework Search Paths for all projects",
- "Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
+ "These framework search paths will be used in all your projects. Use it to add system frameworks "
+ "(See "
+ "Finding System Header Locations).",
+ "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are found.\n\n"
"Framework Search Paths defined here will be used for all projects."
);
}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h
index cbce1793..0e5b4332 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h
@@ -26,6 +26,11 @@ private:
class QtProjectWizzardContentPaths
: public QtProjectWizzardContent
{
+ Q_OBJECT
+
+signals:
+ void showSourceFiles(std::vector);
+
public:
QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window);
@@ -44,10 +49,18 @@ public:
protected:
void setInfo(const QString& title, const QString& description, const QString& help);
+ void setTitleString(const QString& title);
+ void setDescriptionString(const QString& description);
+ void setHelpString(const QString& help);
QtDirectoryListBox* m_list;
QtProjectWizzardContentPaths* m_subPaths;
+ bool m_addShowSourcesButton;
+
+private slots:
+ void showSourcesClicked();
+
private:
QString m_titleString;
QString m_descriptionString;
@@ -67,6 +80,13 @@ public:
virtual bool checkPaths() override;
};
+class QtProjectWizzardContentPathsSourceSimple
+ : public QtProjectWizzardContentPathsSource
+{
+public:
+ QtProjectWizzardContentPathsSourceSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
+};
+
class QtProjectWizzardContentPathsHeaderSearch
: public QtProjectWizzardContentPaths
@@ -79,6 +99,13 @@ public:
virtual void savePaths() override;
};
+class QtProjectWizzardContentPathsHeaderSearchSimple
+ : public QtProjectWizzardContentPathsHeaderSearch
+{
+public:
+ QtProjectWizzardContentPathsHeaderSearchSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
+};
+
class QtProjectWizzardContentPathsHeaderSearchGlobal
: public QtProjectWizzardContentPaths
{
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp
index 4b26ce03..d94c0ed2 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp
@@ -1,9 +1,9 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
#include
-#include
#include
#include
+#include
#include
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
@@ -15,13 +15,13 @@ QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(ProjectSettings* se
void QtProjectWizzardContentSelect::populateWindow(QWidget* widget)
{
- QVBoxLayout* layout = new QVBoxLayout(widget);
+ QVBoxLayout* vlayout = new QVBoxLayout();
- QLabel* title = new QLabel("project type");
+ QLabel* title = new QLabel("Project Type");
title->setObjectName("label");
- layout->addWidget(title);
+ vlayout->addWidget(title);
- QRadioButton* a = new QRadioButton("empty");
+ QRadioButton* a = new QRadioButton("empty project");
QRadioButton* b = new QRadioButton("from Visual Studio Solution");
QRadioButton* c = new QRadioButton("from Compilation Database");
@@ -31,8 +31,8 @@ void QtProjectWizzardContentSelect::populateWindow(QWidget* widget)
m_buttons->addButton(c);
m_buttons->setId(a, PROJECT_EMPTY);
- m_buttons->setId(b, PROJECT_CDB);
- m_buttons->setId(c, PROJECT_VS);
+ m_buttons->setId(b, PROJECT_VS);
+ m_buttons->setId(c, PROJECT_CDB);
connect(m_buttons, static_cast(&QButtonGroup::buttonClicked),
[this](int id)
@@ -41,13 +41,71 @@ void QtProjectWizzardContentSelect::populateWindow(QWidget* widget)
}
);
- layout->addWidget(a);
- layout->addWidget(b);
- layout->addWidget(c);
+ vlayout->addWidget(a);
+ vlayout->addWidget(b);
+ vlayout->addWidget(c);
- layout->addStretch();
+ vlayout->addStretch();
- widget->setLayout(layout);
+
+ QVBoxLayout* vlayout2 = new QVBoxLayout();
+
+
+ QPushButton* d = new QPushButton("C++");
+ QPushButton* e = new QPushButton("C");
+
+ d->setCheckable(true);
+ e->setCheckable(true);
+
+ d->setChecked(true);
+
+ m_languages = new QButtonGroup();
+ m_languages->addButton(d);
+ m_languages->addButton(e);
+
+ m_languages->setId(d, 0);
+ m_languages->setId(e, 1);
+
+ connect(m_languages, static_cast(&QButtonGroup::buttonClicked),
+ [this](int id)
+ {
+ m_buttons->setExclusive(false);
+ for (int i = 0; i < m_buttons->buttons().size(); i++)
+ {
+ m_buttons->button(i)->setChecked(false);
+ }
+ m_buttons->setExclusive(true);
+
+ m_window->disableNext();
+ }
+ );
+
+ vlayout2->addWidget(d);
+ vlayout2->addWidget(e);
+ vlayout2->addStretch();
+
+ QHBoxLayout* hlayout = new QHBoxLayout();
+
+ hlayout->addLayout(vlayout2);
+ hlayout->addLayout(vlayout);
+
+ widget->setLayout(hlayout);
+}
+
+void QtProjectWizzardContentSelect::save()
+{
+ m_settings->setLanguage(m_languages->checkedButton()->text().toStdString());
+
+ ProjectType type;
+
+ switch (m_buttons->checkedId())
+ {
+ case 0: type = PROJECT_EMPTY; break;
+ case 1: type = PROJECT_VS; break;
+ case 2: type = PROJECT_CDB; break;
+ }
+
+ emit selected(type);
}
bool QtProjectWizzardContentSelect::check()
@@ -55,21 +113,10 @@ bool QtProjectWizzardContentSelect::check()
if (m_buttons->checkedId() == -1)
{
QMessageBox msgBox;
- msgBox.setText("Please choose how you want to create your project.");
+ msgBox.setText("Please choose a method of creating a new project.");
msgBox.exec();
return false;
}
- ProjectType type;
-
- switch (m_buttons->checkedId())
- {
- case 0: type = PROJECT_EMPTY; break;
- case 1: type = PROJECT_CDB; break;
- case 2: type = PROJECT_VS; break;
- }
-
- emit selected(type);
-
return true;
}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h
index df628f63..2e42ab71 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h
@@ -14,8 +14,8 @@ public:
enum ProjectType : int
{
PROJECT_EMPTY = 0,
- PROJECT_CDB = 1,
- PROJECT_VS = 2
+ PROJECT_VS = 1,
+ PROJECT_CDB = 2
};
QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window);
@@ -26,9 +26,11 @@ signals:
protected:
// QtProjectWizzardContent implementation
virtual void populateWindow(QWidget* widget) override;
+ virtual void save() override;
virtual bool check() override;
private:
+ QButtonGroup* m_languages;
QButtonGroup* m_buttons;
};
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
index 1dac1fe8..da5b8465 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
@@ -1,12 +1,17 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
+#include
#include
#include
#include
+#include
#include
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
+ , m_buttons(nullptr)
+ , m_checkBox(nullptr)
+ , m_isForm(false)
{
}
@@ -14,18 +19,14 @@ void QtProjectWizzardContentSimple::populateWindow(QWidget* widget)
{
QVBoxLayout* layout = new QVBoxLayout(widget);
- QLabel* title = new QLabel("simple setup");
+ QLabel* title = new QLabel("Simple Setup?");
title->setObjectName("label");
layout->addWidget(title);
QLabel* text = new QLabel(
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do "
- "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut "
- "enim ad minim veniam, quis nostrud exercitation ullamco laboris "
- "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in "
- "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla "
- "pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
- "culpa qui officia deserunt mollit anim id est laborum."
+ "In simple setup you just provide the directory of your project and Coati will find the source files and "
+ "resolve header search paths within. Please note that simple setup makes Coati's analysis slower.\n\n"
+ "In the advanced setup you define analyzed source files and the corresponding header search paths separately."
);
text->setWordWrap(true);
layout->addWidget(text);
@@ -55,15 +56,66 @@ void QtProjectWizzardContentSimple::populateWindow(QWidget* widget)
widget->setLayout(layout);
}
+void QtProjectWizzardContentSimple::populateForm(QFormLayout* layout)
+{
+ QLabel* label = createFormLabel("search headers in project paths");
+ m_checkBox = new QCheckBox();
+
+ layout->addRow(label, m_checkBox);
+
+ m_isForm = true;
+}
+
+void QtProjectWizzardContentSimple::windowReady()
+{
+ if (!m_isForm)
+ {
+ m_window->disableNext();
+ }
+}
+
void QtProjectWizzardContentSimple::load()
{
+ if (m_isForm && m_checkBox)
+ {
+ m_checkBox->setChecked(m_settings->getUseSourcePathsForHeaderSearch());
+ }
+ else if (m_buttons && m_settings->isUseSourcePathsForHeaderSearchDefined())
+ {
+ m_buttons->button(m_settings->getUseSourcePathsForHeaderSearch() ? 0 : 1)->setChecked(true);
+ m_window->enableNext();
+ }
}
void QtProjectWizzardContentSimple::save()
{
+ bool simpleSetup;
+
+ if (m_isForm)
+ {
+ simpleSetup = m_checkBox->isChecked();
+ }
+ else
+ {
+ switch (m_buttons->checkedId())
+ {
+ case 0: simpleSetup = true; break;
+ case 1: simpleSetup = false; break;
+ }
+ }
+
+ m_settings->setUseSourcePathsForHeaderSearch(simpleSetup);
}
bool QtProjectWizzardContentSimple::check()
{
+ if (!m_isForm && m_buttons->checkedId() == -1)
+ {
+ QMessageBox msgBox;
+ msgBox.setText("Please choose if you want simple or advanced setup.");
+ msgBox.exec();
+ return false;
+ }
+
return true;
}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h
index 4b5e222b..87de6811 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h
@@ -3,6 +3,7 @@
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
+class QCheckBox;
class QButtonGroup;
class QtProjectWizzardContentSimple
@@ -13,15 +14,20 @@ class QtProjectWizzardContentSimple
public:
QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window);
-protected:
// QtProjectWizzardContent implementation
virtual void populateWindow(QWidget* widget) override;
+ virtual void populateForm(QFormLayout* layout) override;
+ virtual void windowReady() override;
+
virtual void load() override;
virtual void save() override;
virtual bool check() override;
private:
QButtonGroup* m_buttons;
+ QCheckBox* m_checkBox;
+
+ bool m_isForm;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp
new file mode 100644
index 00000000..d3e941e3
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp
@@ -0,0 +1,63 @@
+#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
+
+#include
+#include
+
+#include "utility/file/FileSystem.h"
+#include "utility/utility.h"
+
+QtProjectWizzardContentSourceList::QtProjectWizzardContentSourceList(
+ ProjectSettings* settings, QtProjectWizzardWindow* window
+)
+ : QtProjectWizzardContent(settings, window)
+{
+}
+
+void QtProjectWizzardContentSourceList::populateWindow(QWidget* widget)
+{
+ QVBoxLayout* layout = new QVBoxLayout(widget);
+
+ QLabel* label = new QLabel("Analyzed Files");
+ label->setObjectName("label");
+ layout->addWidget(label);
+
+ m_text = new QLabel("0 files will be analyzed.");
+ m_text->setWordWrap(true);
+ layout->addWidget(m_text);
+
+ m_list = new QListView(this);
+ m_list->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ m_list->setSelectionMode(QAbstractItemView::NoSelection);
+ m_list->setAttribute(Qt::WA_MacShowFocusRect, 0);
+ layout->addWidget(m_list);
+}
+
+void QtProjectWizzardContentSourceList::showFilesFromSourcePaths(const std::vector& sourcePaths)
+{
+ std::vector extensions;
+ utility::append(extensions, m_settings->getSourceExtensions());
+ utility::append(extensions, m_settings->getHeaderExtensions());
+
+ std::vector fileInfos = FileSystem::getFileInfosFromPaths(sourcePaths, extensions);
+
+ FilePath projectPath = FilePath(m_settings->getProjectFileLocation());
+
+ QStringList list;
+ for (const FileInfo& info : fileInfos)
+ {
+ FilePath path = info.path;
+
+ if (projectPath.exists())
+ {
+ path = path.relativeTo(projectPath);
+ }
+
+ list << QString::fromStdString(path.str());
+ }
+
+ m_text->setText(QString::number(list.size()) + " files will be analyzed.");
+
+ QStringListModel* model = new QStringListModel(this);
+ model->setStringList(list);
+ m_list->setModel(model);
+}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h
new file mode 100644
index 00000000..7eb6abf6
--- /dev/null
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h
@@ -0,0 +1,25 @@
+#ifndef QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
+#define QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
+
+#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
+
+class QLabel;
+class QListView;
+
+class QtProjectWizzardContentSourceList
+ : public QtProjectWizzardContent
+{
+public:
+ QtProjectWizzardContentSourceList(ProjectSettings* settings, QtProjectWizzardWindow* window);
+
+ // QtSettingsWindow implementation
+ virtual void populateWindow(QWidget* widget) override;
+
+ void showFilesFromSourcePaths(const std::vector& sourcePaths);
+
+private:
+ QLabel* m_text;
+ QListView* m_list;
+};
+
+#endif // QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
index 4d93213b..c7c3ec94 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
@@ -6,12 +6,16 @@
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
, m_data(nullptr)
+ , m_buildFile(nullptr)
, m_source(nullptr)
+ , m_simple(nullptr)
, m_headerSearch(nullptr)
, m_frameworkSearch(nullptr)
{
m_data = new QtProjectWizzardContentData(settings, window);
+ m_buildFile = new QtProjectWizzardContentBuildFile(settings, window);
m_source = new QtProjectWizzardContentPathsSource(settings, window);
+ m_simple = new QtProjectWizzardContentSimple(settings, window);
m_headerSearch = new QtProjectWizzardContentPathsHeaderSearch(settings, window);
if (QSysInfo::macVersion() != QSysInfo::MV_None)
@@ -20,6 +24,16 @@ QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings*
}
}
+QtProjectWizzardContentBuildFile* QtProjectWizzardContentSummary::contentBuildFile()
+{
+ return m_buildFile;
+}
+
+QtProjectWizzardContentPathsSource* QtProjectWizzardContentSummary::contentPathsSource()
+{
+ return m_source;
+}
+
void QtProjectWizzardContentSummary::populateWindow(QWidget* widget)
{
QFormLayout* layout = new QFormLayout();
@@ -27,7 +41,9 @@ void QtProjectWizzardContentSummary::populateWindow(QWidget* widget)
layout->setHorizontalSpacing(20);
m_data->populateForm(layout);
+ m_buildFile->populateForm(layout);
m_source->populateForm(layout);
+ m_simple->populateForm(layout);
m_headerSearch->populateForm(layout);
if (m_frameworkSearch)
@@ -40,14 +56,16 @@ void QtProjectWizzardContentSummary::populateWindow(QWidget* widget)
void QtProjectWizzardContentSummary::windowReady()
{
- m_window->updateTitle("NEW PROJECT WIZZARD - SUMMARY");
+ m_window->updateTitle("NEW PROJECT - SUMMARY");
m_window->updateDoneButton("Create");
}
void QtProjectWizzardContentSummary::load()
{
m_data->load();
+ m_buildFile->load();
m_source->load();
+ m_simple->load();
m_headerSearch->load();
if (m_frameworkSearch)
@@ -59,7 +77,9 @@ void QtProjectWizzardContentSummary::load()
void QtProjectWizzardContentSummary::save()
{
m_data->save();
+ m_buildFile->save();
m_source->save();
+ m_simple->save();
m_headerSearch->save();
if (m_frameworkSearch)
@@ -72,7 +92,9 @@ bool QtProjectWizzardContentSummary::check()
{
return
m_data->check() &&
+ m_buildFile->check() &&
m_source->check() &&
+ m_simple->check() &&
m_headerSearch->check() &&
(!m_frameworkSearch || m_frameworkSearch->check());
}
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h
index b1fe416d..61152a03 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h
@@ -2,7 +2,9 @@
#define QT_PROJECT_WIZZARD_CONTENT_SUMMARY_H
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
+#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
class QtProjectWizzardContentSummary
@@ -11,6 +13,9 @@ class QtProjectWizzardContentSummary
public:
QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window);
+ QtProjectWizzardContentBuildFile* contentBuildFile();
+ QtProjectWizzardContentPathsSource* contentPathsSource();
+
protected:
// QtProjectContentWindow implementation
virtual void populateWindow(QWidget* widget);
@@ -21,7 +26,9 @@ protected:
private:
QtProjectWizzardContentData* m_data;
+ QtProjectWizzardContentBuildFile* m_buildFile;
QtProjectWizzardContentPathsSource* m_source;
+ QtProjectWizzardContentSimple* m_simple;
QtProjectWizzardContentPathsHeaderSearch* m_headerSearch;
QtProjectWizzardContentPathsFrameworkSearch* m_frameworkSearch;
};
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp
index 9e46afdb..aa05c97b 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp
@@ -8,6 +8,7 @@ QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent)
: QtSettingsWindow(parent)
, m_content(nullptr)
, m_previousButton(nullptr)
+ , m_showAsPopup(false)
{
}
@@ -25,7 +26,7 @@ void QtProjectWizzardWindow::setup()
{
setupForm();
- updateTitle("NEW PROJECT WIZZARD");
+ updateTitle("NEW PROJECT");
updateDoneButton("Next");
m_previousButton = new QPushButton("Previous");
@@ -35,6 +36,16 @@ void QtProjectWizzardWindow::setup()
m_buttonsLayout->insertWidget(2, m_previousButton);
m_buttonsLayout->insertSpacing(3, 3);
+ if (m_showAsPopup)
+ {
+ updateDoneButton("Ok");
+ hideCancelButton(true);
+ hidePrevious();
+ m_title->hide();
+
+ setMaximumSize(QSize(500, 500));
+ }
+
m_content->windowReady();
}
@@ -59,6 +70,14 @@ void QtProjectWizzardWindow::disableNext()
}
}
+void QtProjectWizzardWindow::hideNext()
+{
+ if (m_doneButton)
+ {
+ m_doneButton->hide();
+ }
+}
+
void QtProjectWizzardWindow::disablePrevious()
{
if (m_previousButton)
@@ -75,6 +94,16 @@ void QtProjectWizzardWindow::hidePrevious()
}
}
+bool QtProjectWizzardWindow::getShowAsPopup() const
+{
+ return m_showAsPopup;
+}
+
+void QtProjectWizzardWindow::setShowAsPopup(bool showAsPopup)
+{
+ m_showAsPopup = showAsPopup;
+}
+
void QtProjectWizzardWindow::handleCancelButtonPress()
{
emit canceled();
@@ -82,6 +111,12 @@ void QtProjectWizzardWindow::handleCancelButtonPress()
void QtProjectWizzardWindow::handleUpdateButtonPress()
{
+ if (m_showAsPopup)
+ {
+ hide();
+ emit closed();
+ }
+
if (m_content->check())
{
m_content->save();
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h
index dad72666..292a3802 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h
@@ -15,6 +15,7 @@ class QtProjectWizzardWindow
signals:
void next();
void previous();
+ void closed();
public:
QtProjectWizzardWindow(QWidget *parent);
@@ -28,17 +29,23 @@ public:
void enableNext();
void disableNext();
+ void hideNext();
void disablePrevious();
void hidePrevious();
-private:
- QtProjectWizzardContent* m_content;
- QPushButton* m_previousButton;
+ bool getShowAsPopup() const;
+ void setShowAsPopup(bool showAsPopup);
private slots:
void handleCancelButtonPress();
void handleUpdateButtonPress();
void handlePreviousButtonPress();
+
+private:
+ QtProjectWizzardContent* m_content;
+ QPushButton* m_previousButton;
+
+ bool m_showAsPopup;
};
#endif // QT_PROJECT_WIZZARD_WINDOW_H