From 6bca5d2964b09bb448bcffd261df0b5a0c60d2f7 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Sun, 24 Apr 2016 23:58:48 +0200 Subject: [PATCH] ui: Removed simple setup as distinct step from project setup and moved it to include paths --- .../project_wizzard/QtProjectWizzard.cpp | 47 +------ .../window/project_wizzard/QtProjectWizzard.h | 5 - .../QtProjectWizzardContentPaths.cpp | 40 +----- .../QtProjectWizzardContentPaths.h | 14 -- .../QtProjectWizzardContentSimple.cpp | 121 ++++-------------- .../QtProjectWizzardContentSimple.h | 8 +- 6 files changed, 34 insertions(+), 201 deletions(-) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index d718d0c5..3b20dc43 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -389,25 +389,7 @@ void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::Projec void QtProjectWizzard::emptyProject() { QtProjectWizzardWindow* window = createWindowWithContent(); - connect(window, SIGNAL(next()), this, SLOT(simpleSetup())); -} - -void QtProjectWizzard::simpleSetup() -{ - QtProjectWizzardWindow* window = createWindowWithContent(); - connect(window, SIGNAL(next()), this, SLOT(simpleSetupDone())); -} - -void QtProjectWizzard::simpleSetupDone() -{ - if (m_settings.getUseSourcePathsForHeaderSearch()) - { - simpleSourcePaths(); - } - else - { - sourcePaths(); - } + connect(window, SIGNAL(next()), this, SLOT(sourcePaths())); } void QtProjectWizzard::sourcePaths() @@ -425,31 +407,8 @@ void QtProjectWizzard::headerSearchPaths() ProjectSettings* settings = &m_settings; summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(settings, window), false, false); - summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false); - - window->setup(); - } - ); - - connect(window, SIGNAL(next()), this, SLOT(headerSearchPathsDone())); -} - -void QtProjectWizzard::simpleSourcePaths() -{ - QtProjectWizzardWindow* window = createWindowWithContent(); - connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths())); - connectShowFiles(window->content()); -} - -void QtProjectWizzard::simpleHeaderSearchPaths() -{ - QtProjectWizzardWindow* window = createWindowWithSummary( - [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) - { - ProjectSettings* settings = &m_settings; - - summary->addContent(new QtProjectWizzardContentPathsHeaderSearchSimple(settings, window), false, false); - summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, false); + summary->addContent(new QtProjectWizzardContentSimple(settings, window), false, false); + summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window), false, true); window->setup(); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h index a93b9d30..c7187467 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h @@ -75,15 +75,10 @@ private slots: void selectedProjectType(QtProjectWizzardContentSelect::ProjectType type); void emptyProject(); - void simpleSetup(); - void simpleSetupDone(); void sourcePaths(); void headerSearchPaths(); - void simpleSourcePaths(); - void simpleHeaderSearchPaths(); - void headerSearchPathsDone(); void frameworkSearchPaths(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index e680c46d..2eb8707b 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -286,20 +286,6 @@ QStringList QtProjectWizzardContentPathsSource::getSourceFileNames(bool headersO return list; } -QtProjectWizzardContentPathsSourceSimple::QtProjectWizzardContentPathsSourceSimple( - ProjectSettings* settings, QtProjectWizzardWindow* window -) - : QtProjectWizzardContentPathsSource(settings, window) -{ - m_showFilesString = "show files"; - - 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." - ); -} - QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader( ProjectSettings* settings, QtProjectWizzardWindow* window ) @@ -339,9 +325,9 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear : QtProjectWizzardContentPaths(settings, window) { 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 " + "Include Paths", + "Add the paths for resolving #include directives in the analyzed source and header files.", + "Include Paths define where additional files, 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 analyzed, but Coati needs " "them for correct analysis." ); @@ -362,32 +348,20 @@ bool QtProjectWizzardContentPathsHeaderSearch::isScrollAble() const return true; } -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 ) : QtProjectWizzardContentPaths(settings, window) { setInfo( - "Global Header Search Paths", - "These header search paths will be used in all your projects. Use it to add system header paths " + "Global Include Paths", + "These include paths will be used in all your projects. Use it to add system header paths " "(See Finding System Header Locations " "or use the auto detection below).", - "Header Search Paths define where additional headers, that your project depends on, are found. Usually they are " + "Include Paths define where additional files, 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 analyzed, but Coati needs " "them for correct analysis.\n\n" - "Header Search Paths defined here will be used for all projects." + "Include Paths defined here will be used for all projects." ); m_detectionString = "headers"; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h index fe019301..43f424a5 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h @@ -74,13 +74,6 @@ protected: QStringList getSourceFileNames(bool headersOnly) const; }; -class QtProjectWizzardContentPathsSourceSimple - : public QtProjectWizzardContentPathsSource -{ -public: - QtProjectWizzardContentPathsSourceSimple(ProjectSettings* settings, QtProjectWizzardWindow* window); -}; - class QtProjectWizzardContentPathsCDBHeader : public QtProjectWizzardContentPathsSource { @@ -107,13 +100,6 @@ public: virtual bool isScrollAble() const override; }; -class QtProjectWizzardContentPathsHeaderSearchSimple - : public QtProjectWizzardContentPathsHeaderSearch -{ -public: - QtProjectWizzardContentPathsHeaderSearchSimple(ProjectSettings* settings, QtProjectWizzardWindow* window); -}; - class QtProjectWizzardContentPathsHeaderSearchGlobal : public QtProjectWizzardContentPaths { diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp index 17bd47c3..d7150523 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp @@ -1,136 +1,61 @@ #include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h" #include -#include -#include #include -#include -#include QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window) : QtProjectWizzardContent(settings, window) - , m_buttons(nullptr) , m_checkBox(nullptr) - , m_isForm(false) { } void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout) { - layout->setRowMinimumHeight(0, 10); + int row = 0; + populateWindow(layout, row); +} - QLabel* title = new QLabel("Simple Setup"); +void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout, int& row) +{ + QLabel* title = new QLabel("Lazy Include Search"); + title->setWordWrap(true); title->setObjectName("section"); - layout->addWidget(title, 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop | Qt::AlignRight); + layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); + layout->setRowStretch(row, 0); - QLabel* text = new QLabel( - "In simple setup you just provide the directory of your project and Coati will find all source files and " - "resolve header search paths within. Please note that simple setup slows down the analysis.\n\n" - "In the advanced setup you define analyzed source files and the corresponding header search paths separately." - ); + QLabel* text = new QLabel("Search for included files in all subdirectories of the project paths. " + "Warning: This slows down analysis speed."); text->setWordWrap(true); - layout->addWidget(text, 1, QtProjectWizzardWindow::BACK_COL); + layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); + layout->setRowStretch(row + 1, 1); - QRadioButton* a = new QRadioButton("simple setup"); - QRadioButton* b = new QRadioButton("advanced setup"); + m_checkBox = new QCheckBox("Search included files within the project paths"); + layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); - m_buttons = new QButtonGroup(this); - m_buttons->addButton(a); - m_buttons->addButton(b); - - m_buttons->setId(a, 0); - m_buttons->setId(b, 1); - - connect(m_buttons, static_cast(&QButtonGroup::buttonClicked), - [this](int id) - { - m_window->setNextEnabled(true); - } - ); - - QVBoxLayout* vlayout = new QVBoxLayout(); - - vlayout->addWidget(a); - vlayout->addWidget(b); - - vlayout->addStretch(); - - layout->addLayout(vlayout, 2, QtProjectWizzardWindow::BACK_COL); - - layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); - layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3); + row += 2; } void QtProjectWizzardContentSimple::populateForm(QGridLayout* layout, int& row) { - QLabel* label = createFormLabel("Simple Setup"); + QLabel* label = createFormLabel("Lazy Include Search"); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL); - m_checkBox = new QCheckBox("Search headers in project paths"); + m_checkBox = new QCheckBox("Search included files within the project paths"); layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); - // addHelpButton("help message", layout, row); + addHelpButton("Check this box to search for included files in all subdirectories of the project paths. " + "This avoids setting them manually if you are not familiar with the project you want to analyse.\n" + "Warning: This option slows down analysis speed.", layout, row); - m_isForm = true; row++; } -void QtProjectWizzardContentSimple::windowReady() -{ - if (!m_isForm) - { - m_window->setNextEnabled(false); - } -} - 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->setNextEnabled(true); - } + m_checkBox->setChecked(m_settings->getUseSourcePathsForHeaderSearch()); } 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; - default: return; - } - } - - 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; -} - -QSize QtProjectWizzardContentSimple::preferredWindowSize() const -{ - return QSize(650, 350); + m_settings->setUseSourcePathsForHeaderSearch(m_checkBox->isChecked()); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h index 514114b5..1ab2fc09 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h @@ -16,20 +16,14 @@ public: // 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 windowReady() override; virtual void load() override; virtual void save() override; - virtual bool check() override; - - virtual QSize preferredWindowSize() const override; private: - QButtonGroup* m_buttons; QCheckBox* m_checkBox; - - bool m_isForm; }; #endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H