ui: Extended wizzard with simple setup and vs solution parsing

* removed blurry coati background
* added language selection to project type window
* search for headers in project paths option as part of simple setup
* show popup containing list of all analyzed symbols
* show build file path in summary and allow refreshing
* only force refresh after editing project and something changed
This commit is contained in:
Eberhard Graether
2016-02-17 13:32:21 +01:00
parent b7bb1349f2
commit a4c6cebce6
40 changed files with 1019 additions and 573 deletions
@@ -39,5 +39,11 @@
<source_extensions><!-- STRING: extension for source e.g. .cpp --></source_extensions>
</extensions>
<use_source_paths_for_header_search><!-- BOOL: If enabled all subfolder of the source paths will be used for header search --></use_source_paths_for_header_search>
<build_file_path>
<vs_solution_path><!-- STRING: path to Visual Studio solution *.sln --></vs_solution_path>
<compilation_db_path><!-- STRING: path to Compilation Database --></compilation_db_path>
</build_file_path>
</source>
</config>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB

+2 -2
View File
@@ -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
+14 -10
View File
@@ -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<FilePath> headerSearchSubPaths;
// for(FilePath p : projSettings->getHeaderSearchPaths())
// {
// std::vector<FilePath> 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<FilePath> headerSearchSubPaths;
for (FilePath p : projSettings->getHeaderSearchPaths())
{
std::vector<FilePath> 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());
@@ -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<std::string> includePaths = parser.getIncludePaths();
std::vector<std::string> projectItems = parser.getProjectItems();
/*std::vector<FilePath> projectFPs;
std::vector<FilePath> 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
{
+51
View File
@@ -1,5 +1,7 @@
#include "settings/ProjectSettings.h"
#include "utility/utility.h"
std::vector<std::string> ProjectSettings::getDefaultHeaderExtensions()
{
std::vector<std::string> 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<FilePath>(getSourcePaths(), other.getSourcePaths()) &&
utility::isPermutation<FilePath>(getHeaderSearchPaths(), other.getHeaderSearchPaths()) &&
utility::isPermutation<FilePath>(getFrameworkSearchPaths(), other.getFrameworkSearchPaths());
}
void ProjectSettings::save(const FilePath& filePath)
{
m_projectName = "";
@@ -126,6 +142,41 @@ bool ProjectSettings::setSourceExtensions(const std::vector<std::string> &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<bool>("source/use_source_paths_for_header_search", false);
}
bool ProjectSettings::setUseSourcePathsForHeaderSearch(bool useSourcePathsForHeaderSearch)
{
return setValue<bool>("source/use_source_paths_for_header_search", useSourcePathsForHeaderSearch);
}
FilePath ProjectSettings::getVisualStudioSolutionPath() const
{
return FilePath(getValue<std::string>("source/build_file_path/vs_solution_path", ""));
}
bool ProjectSettings::setVisualStudioSolutionPath(const FilePath& visualStudioSolutionPath)
{
return setValue<std::string>("source/build_file_path/vs_solution_path", visualStudioSolutionPath.str());
}
FilePath ProjectSettings::getCompilationDatabasePath() const
{
return FilePath(getValue<std::string>("source/build_file_path/compilation_db_path", ""));
}
bool ProjectSettings::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
{
return setValue<std::string>("source/build_file_path/compilation_db_path", compilationDatabasePath.str());
}
std::string ProjectSettings::getDescription() const
{
return getValue<std::string>("info/description", "");
+15 -4
View File
@@ -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<std::string> getCompilerFlags() const;
// extensions
std::vector<std::string> getHeaderExtensions() const;
std::vector<std::string> getSourceExtensions() const;
bool setHeaderExtensions(const std::vector<std::string>& headerExtensions);
bool setSourceExtensions(const std::vector<std::string>& 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);
+22
View File
@@ -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);
+4
View File
@@ -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<FilePath>& paths);
bool moveRelativePathValues(const std::string& key, const FilePath& filePath);
bool isValueDefined(const std::string& key) const;
void enableWarnings() const;
void disableWarnings() const;
+18
View File
@@ -18,6 +18,11 @@ std::shared_ptr<ConfigManager> ConfigManager::createAndLoad(const std::shared_pt
return configManager;
}
std::shared_ptr<ConfigManager> ConfigManager::createCopy()
{
return std::shared_ptr<ConfigManager>(new ConfigManager(*this));
}
void ConfigManager::clear()
{
m_values.clear();
@@ -215,6 +220,13 @@ void ConfigManager::setValues(const std::string& key, const std::vector<bool>& v
setValues(key, stringValues);
}
bool ConfigManager::isValueDefined(const std::string& key) const
{
std::multimap<std::string, std::string>::const_iterator it = m_values.find(key);
return (it != m_values.end());
}
bool ConfigManager::load(const std::shared_ptr<TextAccess> 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;
+3
View File
@@ -14,6 +14,7 @@ class ConfigManager
public:
static std::shared_ptr<ConfigManager> createEmpty();
static std::shared_ptr<ConfigManager> createAndLoad(const std::shared_ptr<TextAccess> textAccess);
std::shared_ptr<ConfigManager> createCopy();
void clear();
@@ -37,6 +38,8 @@ public:
void setValues(const std::string& key, const std::vector<float>& values);
void setValues(const std::string& key, const std::vector<bool>& values);
bool isValueDefined(const std::string& key) const;
bool load(const std::shared_ptr<TextAccess> textAccess);
void save(const std::string filepath);
std::string toString();
@@ -1,33 +0,0 @@
#ifndef MESSAGE_NEW_PROJECT_H
#define MESSAGE_NEW_PROJECT_H
#include "utility/messaging/Message.h"
class MessageNewProject : public Message<MessageNewProject>
{
public:
MessageNewProject(const std::string& projectName, const std::string projectLocation,
const std::vector<std::string>& sourceFiles, const std::vector<std::string>& 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<std::string> projectSourceFiles;
const std::vector<std::string> projectIncludePaths;
};
#endif // MESSAGE_NEW_PROJECT_H
@@ -0,0 +1,32 @@
#ifndef MESSAGE_PROJECT_NEW_H
#define MESSAGE_PROJECT_NEW_H
#include "utility/messaging/Message.h"
class MessageProjectNew
: public Message<MessageProjectNew>
{
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
+4
View File
@@ -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
+12 -2
View File
@@ -56,10 +56,14 @@ void QtListItemWidget::setFocus()
void QtListItemWidget::handleButtonPress()
{
QFileDialog dialog(this);
QListView *l = dialog.findChild<QListView*>("listView");
dialog.setFileMode(QFileDialog::Directory);
if (m_data->text().size())
{
dialog.setDirectory(m_data->text());
}
QListView *l = dialog.findChild<QListView*>("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);
}
+23 -3
View File
@@ -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);
}
}
@@ -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
+14 -25
View File
@@ -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<std::string>& sourceFiles, const std::vector<std::string>& includePaths)
void QtMainWindow::doCreateNewProject(MessageProjectNew message)
{
ProjectSettings settings;
settings.setProjectName(name);
settings.setProjectFileLocation(location);
std::vector<FilePath> sourcePaths;
for (const std::string& p : sourceFiles)
{
sourcePaths.push_back(FilePath(p));
}
std::vector<FilePath> headerPaths;
for (const std::string& p : includePaths)
{
headerPaths.push_back(FilePath(p));
}
settings.setSourcePaths(sourcePaths);
settings.setHeaderSearchPaths(headerPaths);
QtProjectWizzard* wizzard = createWindow<QtProjectWizzard>();
wizzard->editProject(settings);
if (message.fromVisualStudioSolution())
{
wizzard->newProjectFromVisualStudioSolution(message.visualStudioSolutionPath);
}
else
{
wizzard->newProject();
}
}
void QtMainWindow::setupEditMenu()
+5 -6
View File
@@ -9,7 +9,7 @@
#include <QShortcut>
#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<MessageNewProject>
, public MessageListener<MessageProjectNew>
{
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<std::string>& sourceFiles, const std::vector<std::string>& includePaths);
void doCreateNewProject(MessageProjectNew message);
void setupEditMenu();
void setupProjectMenu();
@@ -170,7 +169,7 @@ private:
QShortcut* m_escapeShortcut;
QtThreadedFunctor<std::string, std::string, std::vector<std::string>, std::vector<std::string>> m_createNewProjectFunctor;
QtThreadedFunctor<MessageProjectNew> m_createNewProjectFunctor;
};
#endif // QT_MAIN_WINDOW_H
@@ -1,368 +0,0 @@
#include "qt/window/QtProjectSetupScreen.h"
#include <QFileDialog>
#include <QFormLayout>
#include <QLineEdit>
#include <QMessageBox>
#include <QSysInfo>
#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<std::string>& sourceFiles, const std::vector<std::string>& includePaths)
{
m_projectName->setText(QString::fromStdString(name));
m_projectFileLocation->setText(QString::fromStdString(location));
std::vector<FilePath> sourceFilePaths;
for (unsigned int i = 0; i < sourceFiles.size(); i++)
{
sourceFilePaths.push_back(FilePath(sourceFiles[i]));
}
std::vector<FilePath> 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 = 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<FilePath> newSourcePaths = m_sourcePaths->getList();
std::vector<FilePath> newHeaderSearchPaths = m_includePaths->getList();
std::vector<FilePath> newFrameworkPaths = m_frameworkPaths ? m_frameworkPaths->getList() : std::vector<FilePath>();
bool somethingChanged = !(
newLanguage == projectSettings->getLanguage() &&
newStandard == projectSettings->getStandard() &&
utility::isPermutation<FilePath>(newSourcePaths, projectSettings->getSourcePaths()) &&
utility::isPermutation<FilePath>(newHeaderSearchPaths, projectSettings->getHeaderSearchPaths()) &&
utility::isPermutation<FilePath>(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();
}
}
@@ -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);
@@ -1,5 +1,6 @@
#include "qt/window/project_wizzard/QtProjectWizzard.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QSysInfo>
@@ -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<QtProjectWizzardWindow*>(window)->updateTitle("NEW PROJECT FROM VS SOLUTION");
}
}
void QtProjectWizzard::refreshProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath)
{
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(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<QtProjectWizzardContentSummary>();
showSummary();
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(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<typename T>
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<QtProjectWizzardWindow>(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<std::string> sourceFiles = parser.getProjectItems();
std::vector<FilePath> sourcePaths;
for (const std::string& p : sourceFiles)
{
sourcePaths.push_back(FilePath(p));
}
std::vector<std::string> includePaths = parser.getIncludePaths();
std::vector<FilePath> 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<FilePath>(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<QtProjectWizzardContentData>();
// 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<QtProjectWizzardContentSimple>();
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<QtProjectWizzardContentPathsSource>();
connect(window, SIGNAL(next()), this, SLOT(headerSearchPaths()));
connect(dynamic_cast<QtProjectWizzardContentPathsSource*>(window->content()),
SIGNAL(showSourceFiles(std::vector<FilePath>)),
this, SLOT(showSourceFiles(std::vector<FilePath>)));
}
void QtProjectWizzard::headerSearchPaths()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsHeaderSearch>();
connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone()));
}
void QtProjectWizzard::simpleSourcePaths()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsSourceSimple>();
connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths()));
connect(dynamic_cast<QtProjectWizzardContentPathsSourceSimple*>(window->content()),
SIGNAL(showSourceFiles(std::vector<FilePath>)),
this, SLOT(showSourceFiles(std::vector<FilePath>)));
}
void QtProjectWizzard::simpleHeaderSearchPaths()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentPathsHeaderSearchSimple>();
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<FilePath> sourcePaths)
{
QtProjectWizzardWindow* window = createPopupWithContent<QtProjectWizzardContentSourceList>();
dynamic_cast<QtProjectWizzardContentSourceList*>(window->content())->showFilesFromSourcePaths(sourcePaths);
}
void QtProjectWizzard::showSummary()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSummary>();
connect(window, SIGNAL(next()), this, SLOT(createProject()));
QtProjectWizzardContentSummary* summary = dynamic_cast<QtProjectWizzardContentSummary*>(window->content());
connect(dynamic_cast<QtProjectWizzardContentBuildFile*>(summary->contentBuildFile()),
SIGNAL(refreshVisualStudioSolution(const std::string&)),
this, SLOT(refreshProjectFromVisualStudioSolution(const std::string&)));
connect(dynamic_cast<QtProjectWizzardContentPathsSource*>(summary->contentPathsSource()),
SIGNAL(showSourceFiles(std::vector<FilePath>)),
this, SLOT(showSourceFiles(std::vector<FilePath>)));
}
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();
@@ -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<typename T>
QtProjectWizzardWindow* createWindowWithContent();
template<typename T>
QtProjectWizzardWindow* createPopupWithContent();
ProjectSettings getSettingsForVisualStudioSolution(const std::string& visualStudioSolutionPath) const;
QtWindowStack m_windowStack;
std::shared_ptr<QtProjectWizzardWindow> 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<FilePath> sourcePaths);
void showSummary();
void createProject();
@@ -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;
}
@@ -1,6 +1,8 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_H
#define QT_PROJECT_WIZZARD_CONTENT_H
#include <QFormLayout>
#include <QLabel>
#include <QWidget>
#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;
};
@@ -0,0 +1,109 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
#include <QMessageBox>
#include <QPushButton>
#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;
}
}
@@ -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
@@ -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");
@@ -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 <a href=\"https://staging.coati.io/documentation/#FindingSystemHeaderLocations\">Finding "
"System Header Locations</a>).",
"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 <a href=\"https://staging.coati.io/documentation/#FindingSystemHeaderLocations\">"
"Finding System Header Locations</a>).",
"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."
);
}
@@ -26,6 +26,11 @@ private:
class QtProjectWizzardContentPaths
: public QtProjectWizzardContent
{
Q_OBJECT
signals:
void showSourceFiles(std::vector<FilePath>);
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
{
@@ -1,9 +1,9 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
#include <QButtonGroup>
#include <QFormLayout>
#include <QMessageBox>
#include <QLabel>
#include <QPushButton>
#include <QRadioButton>
#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<void(QButtonGroup::*)(int)>(&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<void(QButtonGroup::*)(int)>(&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;
}
@@ -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;
};
@@ -1,12 +1,17 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
#include <QCheckBox>
#include <QButtonGroup>
#include <QVBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QRadioButton>
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;
}
@@ -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
@@ -0,0 +1,63 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
#include <QListView>
#include <QStringListModel>
#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<FilePath>& sourcePaths)
{
std::vector<std::string> extensions;
utility::append(extensions, m_settings->getSourceExtensions());
utility::append(extensions, m_settings->getHeaderExtensions());
std::vector<FileInfo> 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);
}
@@ -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<FilePath>& sourcePaths);
private:
QLabel* m_text;
QListView* m_list;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
@@ -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());
}
@@ -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;
};
@@ -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();
@@ -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