ui: Added Java project setup UI

This commit is contained in:
Eberhard Graether
2016-08-17 13:12:26 +02:00
parent 566cface6c
commit a3001b2b72
30 changed files with 329 additions and 176 deletions
-2
View File
@@ -315,8 +315,6 @@ add_files(
utility/solution/ISolutionParser.h utility/solution/ISolutionParser.h
utility/solution/SolutionParserCodeBlocks.cpp utility/solution/SolutionParserCodeBlocks.cpp
utility/solution/SolutionParserCodeBlocks.h utility/solution/SolutionParserCodeBlocks.h
utility/solution/SolutionParserEclipse.cpp
utility/solution/SolutionParserEclipse.h
utility/solution/SolutionParserManager.cpp utility/solution/SolutionParserManager.cpp
utility/solution/SolutionParserManager.h utility/solution/SolutionParserManager.h
utility/solution/SolutionParserUtility.cpp utility/solution/SolutionParserUtility.cpp
+2 -2
View File
@@ -64,7 +64,7 @@ void Project::refresh()
{ {
if (allowsRefresh()) if (allowsRefresh())
{ {
bool loadedSettings = getProjectSettings()->load(); bool loadedSettings = getProjectSettings()->reload();
updateFileManager(m_fileManager); updateFileManager(m_fileManager);
@@ -112,7 +112,7 @@ Project::Project(StorageAccessProxy* storageAccessProxy)
void Project::load() void Project::load()
{ {
const std::shared_ptr<ProjectSettings> projectSettings = getProjectSettings(); const std::shared_ptr<ProjectSettings> projectSettings = getProjectSettings();
bool loadedSettings = projectSettings->load(); bool loadedSettings = projectSettings->reload();
if (loadedSettings) if (loadedSettings)
{ {
const FilePath projectSettingsPath = projectSettings->getFilePath(); const FilePath projectSettingsPath = projectSettings->getFilePath();
@@ -47,7 +47,11 @@ void CodeController::handleMessage(MessageActivateAll* message)
statsSnippet.locationFile = std::make_shared<TokenLocationFile>(FilePath()); statsSnippet.locationFile = std::make_shared<TokenLocationFile>(FilePath());
statsSnippet.locationFile->isWholeCopy = true; statsSnippet.locationFile->isWholeCopy = true;
statsSnippet.title = Application::getInstance()->getCurrentProject()->getProjectSettingsFilePath().withoutExtension().fileName(); Project* currentProject = Application::getInstance()->getCurrentProject().get();
if (currentProject)
{
statsSnippet.title = currentProject->getProjectSettingsFilePath().withoutExtension().fileName();
}
std::vector<std::string> description = getProjectDescription(statsSnippet.locationFile.get()); std::vector<std::string> description = getProjectDescription(statsSnippet.locationFile.get());
@@ -662,8 +666,13 @@ std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope
std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile* locationFile) const std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile* locationFile) const
{ {
std::string description = Application::getInstance()->getCurrentProject()->getDescription(); Project* currentProject = Application::getInstance()->getCurrentProject().get();
if (!currentProject)
{
return std::vector<std::string>();
}
std::string description = currentProject->getDescription();
if (!description.size()) if (!description.size())
{ {
return std::vector<std::string>(); return std::vector<std::string>();
+37
View File
@@ -36,6 +36,38 @@ bool CxxProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& othe
return false; return false;
} }
std::vector<std::string> CxxProjectSettings::getLanguageStandards() const
{
std::vector<std::string> standards;
switch (getLanguage())
{
case LANGUAGE_CPP:
standards.push_back("1z");
standards.push_back("14");
standards.push_back("1y");
standards.push_back("11");
standards.push_back("0x");
standards.push_back("03");
standards.push_back("98");
break;
case LANGUAGE_C:
standards.push_back("1x");
standards.push_back("11");
standards.push_back("9x");
standards.push_back("99");
standards.push_back("90");
standards.push_back("89");
break;
default:
break;
}
return standards;
}
std::vector<FilePath> CxxProjectSettings::getHeaderSearchPaths() const std::vector<FilePath> CxxProjectSettings::getHeaderSearchPaths() const
{ {
return getPathValues("source/header_search_paths/header_search_path"); return getPathValues("source/header_search_paths/header_search_path");
@@ -122,3 +154,8 @@ std::vector<std::string> CxxProjectSettings::getDefaultSourceExtensions() const
defaultValues.push_back(".cc"); defaultValues.push_back(".cc");
return defaultValues; return defaultValues;
} }
std::string CxxProjectSettings::getDefaultStandard() const
{
return "1z";
}
+3
View File
@@ -13,6 +13,8 @@ public:
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const; virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual std::vector<std::string> getLanguageStandards() const;
std::vector<FilePath> getHeaderSearchPaths() const; std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getAbsoluteHeaderSearchPaths() const; std::vector<FilePath> getAbsoluteHeaderSearchPaths() const;
bool setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths); bool setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
@@ -35,6 +37,7 @@ public:
private: private:
virtual std::vector<std::string> getDefaultSourceExtensions() const; virtual std::vector<std::string> getDefaultSourceExtensions() const;
virtual std::string getDefaultStandard() const;
}; };
#endif // CXX_PROJECT_SETTINGS_H #endif // CXX_PROJECT_SETTINGS_H
+10
View File
@@ -36,6 +36,11 @@ bool JavaProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& oth
return false; return false;
} }
std::vector<std::string> JavaProjectSettings::getLanguageStandards() const
{
return std::vector<std::string>(1, "8");
}
std::vector<FilePath> JavaProjectSettings::getClasspaths() const std::vector<FilePath> JavaProjectSettings::getClasspaths() const
{ {
return getPathValues("source/class_paths/class_path"); return getPathValues("source/class_paths/class_path");
@@ -60,3 +65,8 @@ std::vector<std::string> JavaProjectSettings::getDefaultSourceExtensions() const
defaultValues.push_back(".java"); defaultValues.push_back(".java");
return defaultValues; return defaultValues;
} }
std::string JavaProjectSettings::getDefaultStandard() const
{
return "8";
}
+5 -1
View File
@@ -3,7 +3,8 @@
#include "settings/ProjectSettings.h" #include "settings/ProjectSettings.h"
class JavaProjectSettings: public ProjectSettings class JavaProjectSettings
: public ProjectSettings
{ {
public: public:
JavaProjectSettings(); JavaProjectSettings();
@@ -13,12 +14,15 @@ public:
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const; virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual std::vector<std::string> getLanguageStandards() const;
std::vector<FilePath> getClasspaths() const; std::vector<FilePath> getClasspaths() const;
std::vector<FilePath> getAbsoluteClasspaths() const; std::vector<FilePath> getAbsoluteClasspaths() const;
bool setClasspaths(const std::vector<FilePath>& headerSearchPaths); bool setClasspaths(const std::vector<FilePath>& headerSearchPaths);
private: private:
virtual std::vector<std::string> getDefaultSourceExtensions() const; virtual std::vector<std::string> getDefaultSourceExtensions() const;
virtual std::string getDefaultStandard() const;
}; };
#endif // JAVA_PROJECT_SETTINGS_H #endif // JAVA_PROJECT_SETTINGS_H
+15 -4
View File
@@ -6,8 +6,8 @@
LanguageType ProjectSettings::getLanguageOfProject(FilePath projectFilePath) LanguageType ProjectSettings::getLanguageOfProject(FilePath projectFilePath)
{ {
ProjectSettings tempSettings(projectFilePath); ProjectSettings tempSettings;
tempSettings.load(); tempSettings.load(projectFilePath);
return tempSettings.getLanguage(); return tempSettings.getLanguage();
} }
@@ -40,7 +40,12 @@ bool ProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other)
); );
} }
bool ProjectSettings::load() std::vector<std::string> ProjectSettings::getLanguageStandards() const
{
return std::vector<std::string>();
}
bool ProjectSettings::reload()
{ {
return Settings::load(getFilePath()); return Settings::load(getFilePath());
} }
@@ -82,7 +87,7 @@ bool ProjectSettings::setLanguage(LanguageType language)
std::string ProjectSettings::getStandard() const std::string ProjectSettings::getStandard() const
{ {
return getValue<std::string>("language_settings/standard", "1z"); return getValue<std::string>("language_settings/standard", getDefaultStandard());
} }
bool ProjectSettings::setStandard(const std::string& standard) bool ProjectSettings::setStandard(const std::string& standard)
@@ -152,3 +157,9 @@ std::vector<std::string> ProjectSettings::getDefaultSourceExtensions() const
{ {
return std::vector<std::string>(); return std::vector<std::string>();
} }
std::string ProjectSettings::getDefaultStandard() const
{
return "";
}
+4 -1
View File
@@ -20,7 +20,9 @@ public:
virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const; virtual bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
virtual bool load(); virtual std::vector<std::string> getLanguageStandards() const;
bool reload();
std::string getProjectName() const; std::string getProjectName() const;
void setProjectName(const std::string& name); void setProjectName(const std::string& name);
@@ -52,6 +54,7 @@ protected:
private: private:
virtual std::vector<std::string> getDefaultSourceExtensions() const; virtual std::vector<std::string> getDefaultSourceExtensions() const;
virtual std::string getDefaultStandard() const;
}; };
#endif // PROJECT_SETTINGS_H #endif // PROJECT_SETTINGS_H
@@ -1,11 +0,0 @@
#ifndef SOLUTION_PARSER_ECLIPSE_H
#define SOLUTION_PARSER_ECLIPSE_H
#include "ISolutionParser.h"
class SolutionParserEclipse
{
};
#endif // SOLUTION_PARSER_ECLIPSE_H
+7 -2
View File
@@ -419,8 +419,13 @@ void QtMainWindow::openProject(const QString &path)
void QtMainWindow::editProject() void QtMainWindow::editProject()
{ {
QtProjectWizzard* wizzard = createWindow<QtProjectWizzard>(); Project* currentProject = Application::getInstance()->getCurrentProject().get();
wizzard->editProject(Application::getInstance()->getCurrentProject()->getProjectSettingsFilePath()); if (currentProject)
{
QtProjectWizzard* wizzard = createWindow<QtProjectWizzard>();
wizzard->editProject(currentProject->getProjectSettingsFilePath());
}
} }
void QtMainWindow::find() void QtMainWindow::find()
@@ -1,7 +1,5 @@
#include "qt/window/project_wizzard/QtProjectWizzard.h" #include "qt/window/project_wizzard/QtProjectWizzard.h"
#include <boost/algorithm/string.hpp>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSysInfo> #include <QSysInfo>
@@ -21,16 +19,13 @@
#include "settings/CxxProjectSettings.h" #include "settings/CxxProjectSettings.h"
#include "settings/JavaProjectSettings.h" #include "settings/JavaProjectSettings.h"
#include "utility/file/FileSystem.h" #include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
#include "utility/messaging/type/MessageLoadProject.h" #include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageRefresh.h" #include "utility/messaging/type/MessageRefresh.h"
#include "utility/solution/SolutionParserVisualStudio.h"
// #include "utility/solution/SolutionParserCodeBlocks.h"
#include "utility/messaging/type/MessageStatus.h" #include "utility/messaging/type/MessageStatus.h"
#include "utility/solution/SolutionParserVisualStudio.h"
#include "utility/logging/logging.h" #include "utility/utilityString.h"
#include "Application.h" #include "Application.h"
@@ -101,11 +96,9 @@ void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const st
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(widget); QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(widget);
std::string title = "NEW PROJECT FROM "; std::string title = "NEW PROJECT FROM ";
title += ideId; title += utility::toUpperCase(ideId);
title += " SOLUTION"; title += " SOLUTION";
boost::algorithm::to_upper(title);
window->updateTitle(QString(title.c_str())); window->updateTitle(QString(title.c_str()));
window->updateNextButton("Create"); window->updateNextButton("Create");
window->setPreviousVisible(m_windowStack.getWindowCount() > 0); window->setPreviousVisible(m_windowStack.getWindowCount() > 0);
@@ -162,11 +155,13 @@ void QtProjectWizzard::editProject(const FilePath& settingsPath)
case LANGUAGE_JAVA: case LANGUAGE_JAVA:
settings = std::make_shared<JavaProjectSettings>(settingsPath); settings = std::make_shared<JavaProjectSettings>(settingsPath);
break; break;
default:
return;
} }
if (settings) if (settings)
{ {
settings->load(); settings->reload();
editProject(settings); editProject(settings);
} }
} }
@@ -176,7 +171,20 @@ void QtProjectWizzard::editProject(std::shared_ptr<ProjectSettings> settings)
m_settings = settings; m_settings = settings;
m_editing = true; m_editing = true;
showSummary(); switch (m_settings->getLanguage())
{
case LANGUAGE_JAVA:
showSummaryJava();
break;
case LANGUAGE_C:
case LANGUAGE_CPP:
showSummary();
break;
default:
break;
}
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(m_windowStack.getTopWindow()); QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(m_windowStack.getTopWindow());
if (!window) if (!window)
@@ -334,7 +342,14 @@ void QtProjectWizzard::selectedProjectType(LanguageType languageType, QtProjectW
switch (type) switch (type)
{ {
case QtProjectWizzardContentSelect::PROJECT_EMPTY: case QtProjectWizzardContentSelect::PROJECT_EMPTY:
m_settings = std::make_shared<CxxProjectSettings>(); if (languageType == LANGUAGE_JAVA)
{
m_settings = std::make_shared<JavaProjectSettings>();
}
else
{
m_settings = std::make_shared<CxxProjectSettings>();
}
m_settings->setLanguage(languageType); m_settings->setLanguage(languageType);
emptyProject(); emptyProject();
break; break;
@@ -376,7 +391,15 @@ void QtProjectWizzard::selectedProjectType(LanguageType languageType, QtProjectW
void QtProjectWizzard::emptyProject() void QtProjectWizzard::emptyProject()
{ {
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>(); QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>();
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
if (m_settings->getLanguage() == LANGUAGE_JAVA)
{
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJava()));
}
else
{
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
}
} }
void QtProjectWizzard::sourcePaths() void QtProjectWizzard::sourcePaths()
@@ -487,6 +510,25 @@ void QtProjectWizzard::headerPathsCDBDone()
} }
} }
void QtProjectWizzard::sourcePathsJava()
{
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
QtProjectWizzardContent* source = new QtProjectWizzardContentPathsSourceJava(m_settings, window);
summary->addContent(source, false, false);
connectShowFiles(source);
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, false);
window->setup();
}
);
connect(window, SIGNAL(next()), this, SLOT(showSummaryJava()));
}
void QtProjectWizzard::showFiles(QtProjectWizzardContent* content) void QtProjectWizzard::showFiles(QtProjectWizzardContent* content)
{ {
QWidget* widget = m_windowStack.getTopWindow(); QWidget* widget = m_windowStack.getTopWindow();
@@ -566,17 +608,51 @@ void QtProjectWizzard::showSummary()
connect(window, SIGNAL(next()), this, SLOT(createProject())); connect(window, SIGNAL(next()), this, SLOT(createProject()));
} }
void QtProjectWizzard::showSummaryJava()
{
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->setIsForm(true);
summary->addContent(new QtProjectWizzardContentData(m_settings, window), false, false);
QtProjectWizzardContentPathsSourceJava* source = new QtProjectWizzardContentPathsSourceJava(m_settings, window);
summary->addContent(source, false, true);
connectShowFiles(source);
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, true);
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, false);
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true);
window->setup();
window->updateTitle("NEW PROJECT - SUMMARY");
window->updateNextButton("Create");
}
);
connect(window, SIGNAL(next()), this, SLOT(createProject()));
}
void QtProjectWizzard::createProject() void QtProjectWizzard::createProject()
{ {
FilePath path = m_settings->getFilePath(); FilePath path = m_settings->getFilePath();
m_settings->save(path); m_settings->save(path);
bool foreceRefreshProject = false; bool forceRefreshProject = false;
if (m_editing) if (m_editing)
{ {
std::shared_ptr<Application> application = Application::getInstance(); std::shared_ptr<Application> application = Application::getInstance();
FilePath oldPath = application->getCurrentProject()->getProjectSettingsFilePath(); FilePath oldPath;
Project* currentProject = application->getCurrentProject().get();
if (currentProject)
{
oldPath = currentProject->getProjectSettingsFilePath();
}
if (oldPath.exists() && oldPath != path) if (oldPath.exists() && oldPath != path)
{ {
@@ -608,12 +684,12 @@ void QtProjectWizzard::createProject()
if (settingsChanged || appSettingsChanged) if (settingsChanged || appSettingsChanged)
{ {
foreceRefreshProject = true; forceRefreshProject = true;
} }
} }
MessageDispatchWhenLicenseValid( MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(path, foreceRefreshProject) std::make_shared<MessageLoadProject>(path, forceRefreshProject)
).dispatch(); ).dispatch();
finishWizzard(); finishWizzard();
@@ -625,11 +701,15 @@ void QtProjectWizzard::savePreferences()
if (appSettingsChanged) if (appSettingsChanged)
{ {
MessageDispatchWhenLicenseValid( Project* currentProject = Application::getInstance()->getCurrentProject().get();
std::make_shared<MessageLoadProject>( if (currentProject)
Application::getInstance()->getCurrentProject()->getProjectSettingsFilePath(), true {
) MessageDispatchWhenLicenseValid(
).dispatch(); std::make_shared<MessageLoadProject>(
currentProject->getProjectSettingsFilePath(), true
)
).dispatch();
}
} }
else else
{ {
@@ -82,9 +82,12 @@ private slots:
void headerPathsCDB(); void headerPathsCDB();
void headerPathsCDBDone(); void headerPathsCDBDone();
void sourcePathsJava();
void showFiles(QtProjectWizzardContent* content); void showFiles(QtProjectWizzardContent* content);
void showSummary(); void showSummary();
void showSummaryJava();
void createProject(); void createProject();
void savePreferences(); void savePreferences();
@@ -35,10 +35,6 @@ void QtProjectWizzardContent::populateWindow(QWidget* widget)
{ {
} }
void QtProjectWizzardContent::populateWindow(QGridLayout* layout)
{
}
void QtProjectWizzardContent::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContent::populateWindow(QGridLayout* layout, int& row)
{ {
} }
@@ -36,7 +36,6 @@ public:
QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
virtual void populateWindow(QWidget* widget); virtual void populateWindow(QWidget* widget);
virtual void populateWindow(QGridLayout* layout);
virtual void populateWindow(QGridLayout* layout, int& row); virtual void populateWindow(QGridLayout* layout, int& row);
virtual void populateForm(QGridLayout* layout, int& row); virtual void populateForm(QGridLayout* layout, int& row);
virtual void windowReady(); virtual void windowReady();
@@ -5,20 +5,20 @@
#include "settings/CxxProjectSettings.h" #include "settings/CxxProjectSettings.h"
#include "utility/logging/logging.h"
QtProjectWizzardContentData::QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window) QtProjectWizzardContentData::QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window) : QtProjectWizzardContent(settings, window)
, m_projectName(nullptr) , m_projectName(nullptr)
, m_projectFileLocation(nullptr) , m_projectFileLocation(nullptr)
, m_language(nullptr) , m_language(nullptr)
, m_cppStandard(nullptr) , m_standard(nullptr)
, m_cStandard(nullptr)
, m_buildFilePicker(nullptr) , m_buildFilePicker(nullptr)
{ {
} }
void QtProjectWizzardContentData::populateWindow(QGridLayout* layout) void QtProjectWizzardContentData::populateWindow(QGridLayout* layout, int& row)
{ {
int row = 0;
layout->setRowMinimumHeight(0, 15); layout->setRowMinimumHeight(0, 15);
row++; row++;
@@ -47,24 +47,24 @@ void QtProjectWizzardContentData::load()
if (m_language) if (m_language)
{ {
if (m_settings->getLanguage() != LANGUAGE_UNKNOWN) LanguageType type = m_settings->getLanguage();
if (type == LANGUAGE_UNKNOWN)
{ {
m_language->setCurrentText(QString::fromStdString(languageTypeToString(m_settings->getLanguage()))); LOG_ERROR("No language type defined");
return;
} }
if (m_settings->getStandard().length() > 0) m_language->setText(languageTypeToString(type).c_str());
{
if (m_language->currentIndex() == 0) // c++
{
m_cppStandard->setCurrentText(QString::fromStdString(m_settings->getStandard()));
}
else if (m_language->currentIndex() == 1) // c
{
m_cStandard->setCurrentText(QString::fromStdString(m_settings->getStandard()));
}
handleSelectionChanged(m_language->currentIndex()); m_standard->clear();
std::vector<std::string> standards = m_settings->getLanguageStandards();
for (size_t i = 0; i < standards.size(); i++)
{
m_standard->insertItem(i, standards[i].c_str());
} }
m_standard->setCurrentText(QString::fromStdString(m_settings->getStandard()));
} }
} }
@@ -76,18 +76,9 @@ void QtProjectWizzardContentData::save()
m_settings->setProjectFileLocation(m_projectFileLocation->getText().toStdString()); m_settings->setProjectFileLocation(m_projectFileLocation->getText().toStdString());
} }
if (m_language) if (m_standard)
{ {
m_settings->setLanguage(stringToLanguageType(m_language->currentText().toStdString())); m_settings->setStandard(m_standard->currentText().toStdString());
if (m_cppStandard->isVisible())
{
m_settings->setStandard(m_cppStandard->currentText().toStdString());
}
else if (m_cStandard->isVisible())
{
m_settings->setStandard(m_cStandard->currentText().toStdString());
}
} }
} }
@@ -155,10 +146,7 @@ void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, in
{ {
QLabel* languageLabel = new QLabel("Language"); QLabel* languageLabel = new QLabel("Language");
languageLabel->setObjectName("label"); languageLabel->setObjectName("label");
m_language = new QComboBox(); m_language = new QLabel();
m_language->insertItem(0, "C++");
m_language->insertItem(1, "C");
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
@@ -166,27 +154,11 @@ void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, in
QLabel* standardLabel = createFormLabel("Standard"); QLabel* standardLabel = createFormLabel("Standard");
m_standard = new QComboBox();
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");
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->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_cppStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
layout->addWidget(m_cStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
row++; row++;
} }
@@ -199,14 +171,6 @@ void QtProjectWizzardContentData::addBuildFilePicker(
m_buildFilePicker = new QtLocationPicker(this); m_buildFilePicker = new QtLocationPicker(this);
m_buildFilePicker->setFileFilter(filter); m_buildFilePicker->setFileFilter(filter);
// QPushButton* button = new QPushButton("", this);
// button->setObjectName("refreshButton");
// button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
// button->setToolTip("refresh paths");
// connect(button, SIGNAL(clicked()), this, SLOT(refreshClicked()));
// m_buildFilePicker->layout()->addWidget(button);
layout->addWidget(m_buildFilePicker, row, QtProjectWizzardWindow::BACK_COL); layout->addWidget(m_buildFilePicker, row, QtProjectWizzardWindow::BACK_COL);
row++; row++;
@@ -220,25 +184,6 @@ void QtProjectWizzardContentData::addBuildFilePicker(
row++; row++;
} }
void QtProjectWizzardContentData::handleSelectionChanged(int index)
{
if (!m_language)
{
return;
}
if (index != 0)
{
m_cStandard->show();
m_cppStandard->hide();
}
else
{
m_cppStandard->show();
m_cStandard->hide();
}
}
QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB( QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window) std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
@@ -16,7 +16,7 @@ public:
QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
@@ -33,14 +33,10 @@ protected:
QLineEdit* m_projectName; QLineEdit* m_projectName;
QtLocationPicker* m_projectFileLocation; QtLocationPicker* m_projectFileLocation;
QComboBox* m_language; QLabel* m_language;
QComboBox* m_cppStandard; QComboBox* m_standard;
QComboBox* m_cStandard;
QtLocationPicker* m_buildFilePicker; QtLocationPicker* m_buildFilePicker;
private slots:
void handleSelectionChanged(int index);
}; };
@@ -5,8 +5,9 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include "qt/element/QtDirectoryListBox.h" #include "qt/element/QtDirectoryListBox.h"
#include "settings/CxxProjectSettings.h"
#include "settings/ApplicationSettings.h" #include "settings/ApplicationSettings.h"
#include "settings/CxxProjectSettings.h"
#include "settings/JavaProjectSettings.h"
#include "utility/file/FileManager.h" #include "utility/file/FileManager.h"
#include "utility/file/FileSystem.h" #include "utility/file/FileSystem.h"
#include "utility/headerSearch/StandardHeaderDetection.h" #include "utility/headerSearch/StandardHeaderDetection.h"
@@ -17,12 +18,6 @@ QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(std::shared_ptr<Proje
{ {
} }
void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout)
{
int row = 0;
populateWindow(layout, row);
}
void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout, int& row)
{ {
layout->setRowMinimumHeight(row++, 10); layout->setRowMinimumHeight(row++, 10);
@@ -278,6 +273,20 @@ QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
return "files will be indexed."; return "files will be indexed.";
} }
QtProjectWizzardContentPathsSourceJava::QtProjectWizzardContentPathsSourceJava(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPathsSource(settings, window)
{
setInfo(
"Source Paths",
"Add all directories or files you want to index. Usually these are all source files of "
"your project or a subset of them.",
"Source Paths define the files and directories that will be indexed by Coati. Usually these are the "
"source files of your project or a subset of them."
);
}
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader( QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
) )
@@ -452,3 +461,34 @@ void QtProjectWizzardContentPathsFrameworkSearchGlobal::save()
ApplicationSettings::getInstance()->setFrameworkSearchPaths(m_list->getList()); ApplicationSettings::getInstance()->setFrameworkSearchPaths(m_list->getList());
ApplicationSettings::getInstance()->save(); ApplicationSettings::getInstance()->save();
} }
QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
setInfo(
"Class Path",
"Paths to .jar files and root directories of .class files your project depends on.",
"Enter the paths to .jar files and root directories of .class files your project depends on."
);
}
void QtProjectWizzardContentPathsClassJava::load()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
if (javaSettings)
{
m_list->setList(javaSettings->getClasspaths());
}
}
void QtProjectWizzardContentPathsClassJava::save()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
if (javaSettings)
{
javaSettings->setClasspaths(m_list->getList());
}
}
@@ -20,7 +20,6 @@ public:
QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtSettingsWindow implementation // QtSettingsWindow implementation
virtual void populateWindow(QGridLayout* layout) override;
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populateForm(QGridLayout* layout, int& row) override;
@@ -70,6 +69,13 @@ public:
virtual QString getFileNamesDescription() const override; virtual QString getFileNamesDescription() const override;
}; };
class QtProjectWizzardContentPathsSourceJava
: public QtProjectWizzardContentPathsSource
{
public:
QtProjectWizzardContentPathsSourceJava(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
};
class QtProjectWizzardContentPathsCDBHeader class QtProjectWizzardContentPathsCDBHeader
: public QtProjectWizzardContentPathsSource : public QtProjectWizzardContentPathsSource
{ {
@@ -138,4 +144,16 @@ public:
virtual void save() override; virtual void save() override;
}; };
class QtProjectWizzardContentPathsClassJava
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsClassJava(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
virtual void save() override;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_PATHS_H #endif // QT_PROJECT_WIZZARD_CONTENT_PATHS_H
@@ -27,9 +27,8 @@ QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences()
} }
} }
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout) void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout, int& row)
{ {
int row = 0;
populateForm(layout, row); populateForm(layout, row);
} }
@@ -17,7 +17,7 @@ public:
~QtProjectWizzardContentPreferences(); ~QtProjectWizzardContentPreferences();
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
@@ -10,39 +10,55 @@
#include "utility/solution/SolutionParserManager.h" #include "utility/solution/SolutionParserManager.h"
QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, std::weak_ptr<SolutionParserManager> solutionParserManager) QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(
std::shared_ptr<ProjectSettings> settings,
QtProjectWizzardWindow* window,
std::weak_ptr<SolutionParserManager> solutionParserManager
)
: QtProjectWizzardContent(settings, window) : QtProjectWizzardContent(settings, window)
, m_solutionParserManager(solutionParserManager) , m_solutionParserManager(solutionParserManager)
{ {
} }
void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout) void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout, int& row)
{ {
QPushButton* d = new QPushButton("C++"); QPushButton* d = new QPushButton(languageTypeToString(LANGUAGE_CPP).c_str(), this);
QPushButton* e = new QPushButton("C"); QPushButton* e = new QPushButton(languageTypeToString(LANGUAGE_C).c_str(), this);
QPushButton* f = new QPushButton(languageTypeToString(LANGUAGE_JAVA).c_str(), this);
d->setObjectName("menuButton"); d->setObjectName("menuButton");
e->setObjectName("menuButton"); e->setObjectName("menuButton");
f->setObjectName("menuButton");
d->setCheckable(true); d->setCheckable(true);
e->setCheckable(true); e->setCheckable(true);
f->setCheckable(true);
d->setChecked(true); d->setChecked(true);
m_languages = new QButtonGroup(); m_languages = new QButtonGroup();
m_languages->addButton(d); m_languages->addButton(d);
m_languages->addButton(e); m_languages->addButton(e);
m_languages->addButton(f);
m_languages->setId(d, 0); m_languages->setId(d, 0);
m_languages->setId(e, 1); m_languages->setId(e, 1);
m_languages->setId(f, 2);
connect(m_languages, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), connect(m_languages, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
[this](int id) [this](int id)
{ {
bool isJava = stringToLanguageType(m_languages->checkedButton()->text().toStdString()) == LANGUAGE_JAVA;
m_buttons->setExclusive(false); m_buttons->setExclusive(false);
for (int i = 0; i < m_buttons->buttons().size(); i++) for (int i = 0; i < m_buttons->buttons().size(); i++)
{ {
m_buttons->button(i)->setChecked(false); m_buttons->button(i)->setChecked(false);
if (i != 0)
{
m_buttons->button(i)->setVisible(!isJava);
}
} }
m_buttons->setExclusive(true); m_buttons->setExclusive(true);
@@ -57,6 +73,7 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout)
vlayout->addWidget(d); vlayout->addWidget(d);
vlayout->addWidget(e); vlayout->addWidget(e);
vlayout->addWidget(f);
vlayout->addStretch(); vlayout->addStretch();
@@ -19,10 +19,11 @@ public:
PROJECT_MANAGED = 2 // use this type for all standard parser (parsers that are handled by the parser manager) PROJECT_MANAGED = 2 // use this type for all standard parser (parsers that are handled by the parser manager)
}; };
QtProjectWizzardContentSelect(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, std::weak_ptr<SolutionParserManager> solutionParserManager); QtProjectWizzardContentSelect(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, std::weak_ptr<SolutionParserManager> solutionParserManager);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void save() override; virtual void save() override;
virtual bool check() override; virtual bool check() override;
@@ -32,8 +33,6 @@ public:
signals: signals:
void selected(LanguageType, QtProjectWizzardContentSelect::ProjectType); void selected(LanguageType, QtProjectWizzardContentSelect::ProjectType);
// void selected(unsigned int type);
private: private:
QButtonGroup* m_languages; QButtonGroup* m_languages;
QButtonGroup* m_buttons; QButtonGroup* m_buttons;
@@ -11,12 +11,6 @@ QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptr<Pro
{ {
} }
void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout)
{
int row = 0;
populateWindow(layout, row);
}
void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout, int& row) void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout, int& row)
{ {
QLabel* title = new QLabel("Lazy Include Search"); QLabel* title = new QLabel("Lazy Include Search");
@@ -15,7 +15,6 @@ public:
QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window); QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override;
virtual void populateWindow(QGridLayout* layout, int& row) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populateForm(QGridLayout* layout, int& row) override;
@@ -27,10 +27,8 @@ void QtProjectWizzardContentSummary::setIsForm(bool isForm)
m_isForm = isForm; m_isForm = isForm;
} }
void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout) void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& row)
{ {
int row = 0;
if (m_isForm) if (m_isForm)
{ {
populateForm(layout, row); populateForm(layout, row);
@@ -26,7 +26,7 @@ public:
protected: protected:
// QtProjectWizzardContent implementation // QtProjectWizzardContent implementation
virtual void populateWindow(QGridLayout* layout) override; virtual void populateWindow(QGridLayout* layout, int& row) override;
virtual void populateForm(QGridLayout* layout, int& row) override; virtual void populateForm(QGridLayout* layout, int& row) override;
virtual void load() override; virtual void load() override;
@@ -40,7 +40,8 @@ void QtProjectWizzardWindow::populateWindow(QWidget* widget)
QGridLayout* layout = new QGridLayout(); QGridLayout* layout = new QGridLayout();
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
m_content->populateWindow(layout); int row = 0;
m_content->populateWindow(layout, row);
if (layout->columnCount() < 2) if (layout->columnCount() < 2)
{ {
+6 -6
View File
@@ -109,14 +109,14 @@ public:
void test_load_project_settings_from_file() void test_load_project_settings_from_file()
{ {
ProjectSettings settings(FilePath("data/SettingsTestSuite/settings.xml")); ProjectSettings settings;
TS_ASSERT(settings.load()); TS_ASSERT(settings.load(FilePath("data/SettingsTestSuite/settings.xml")));
} }
void test_load_source_path_from_file() void test_load_source_path_from_file()
{ {
ProjectSettings settings(FilePath("data/SettingsTestSuite/settings.xml")); ProjectSettings settings;
settings.load(); settings.load(FilePath("data/SettingsTestSuite/settings.xml"));
std::vector<FilePath> paths = settings.getSourcePaths(); std::vector<FilePath> paths = settings.getSourcePaths();
TS_ASSERT_EQUALS(paths.size(), 1); TS_ASSERT_EQUALS(paths.size(), 1);
@@ -125,8 +125,8 @@ public:
void test_load_header_search_paths_from_file() void test_load_header_search_paths_from_file()
{ {
CxxProjectSettings settings(FilePath("data/SettingsTestSuite/settings.xml")); CxxProjectSettings settings;
settings.load(); settings.load(FilePath("data/SettingsTestSuite/settings.xml"));
std::vector<FilePath> paths = settings.getHeaderSearchPaths(); std::vector<FilePath> paths = settings.getHeaderSearchPaths();
TS_ASSERT_EQUALS(paths.size(), 2); TS_ASSERT_EQUALS(paths.size(), 2);