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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user