diff --git a/bin/app/data/gui/window/window.css b/bin/app/data/gui/window/window.css index c6b9949e..230813bc 100644 --- a/bin/app/data/gui/window/window.css +++ b/bin/app/data/gui/window/window.css @@ -11,7 +11,7 @@ QLabel, QCheckBox { font-weight: bold; } -#section, #projectTitle { +#projectTitle { font-size: 14pt; font-weight: bold; } diff --git a/src/lib/utility/solution/SolutionParserVisualStudio.cpp b/src/lib/utility/solution/SolutionParserVisualStudio.cpp index 0d186688..bacdadf5 100644 --- a/src/lib/utility/solution/SolutionParserVisualStudio.cpp +++ b/src/lib/utility/solution/SolutionParserVisualStudio.cpp @@ -270,7 +270,7 @@ std::string SolutionParserVisualStudio::getButtonText() const std::string SolutionParserVisualStudio::getDescription() const { - return "Create a new project from an existing Visual Studio Solution file."; + return "Create a new project from an existing Visual Studio Solution file. Unstable!"; } std::string SolutionParserVisualStudio::getIconPath() const diff --git a/src/lib_gui/qt/element/QtDirectoryListBox.cpp b/src/lib_gui/qt/element/QtDirectoryListBox.cpp index 30328c78..2f29a469 100644 --- a/src/lib_gui/qt/element/QtDirectoryListBox.cpp +++ b/src/lib_gui/qt/element/QtDirectoryListBox.cpp @@ -134,12 +134,14 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName, m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_addButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_addButton->setObjectName("plusButton"); + m_addButton->setToolTip("add line"); innerLayout->addWidget(m_addButton); m_removeButton = new QPushButton("", this); m_removeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_removeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_removeButton->setObjectName("minusButton"); + m_removeButton->setToolTip("remove line"); innerLayout->addWidget(m_removeButton); innerLayout->addStretch(); @@ -154,6 +156,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName, editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac editButton->setObjectName("editButton"); + editButton->setToolTip("edit plain text"); innerLayout->addWidget(editButton); if (isForStrings()) diff --git a/src/lib_gui/qt/element/QtLocationPicker.cpp b/src/lib_gui/qt/element/QtLocationPicker.cpp index dac3b658..99891770 100644 --- a/src/lib_gui/qt/element/QtLocationPicker.cpp +++ b/src/lib_gui/qt/element/QtLocationPicker.cpp @@ -24,6 +24,7 @@ QtLocationPicker::QtLocationPicker(QWidget *parent) m_button = new QPushButton(""); m_button->setObjectName("dotsButton"); + m_button->setToolTip("pick file"); m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress())); layout->addWidget(m_button); diff --git a/src/lib_gui/qt/window/QtTextEditDialog.cpp b/src/lib_gui/qt/window/QtTextEditDialog.cpp index 238eb977..3b01d4b2 100644 --- a/src/lib_gui/qt/window/QtTextEditDialog.cpp +++ b/src/lib_gui/qt/window/QtTextEditDialog.cpp @@ -30,6 +30,15 @@ std::string QtTextEditDialog::getText() void QtTextEditDialog::setReadOnly(bool readOnly) { m_text->setReadOnly(readOnly); + + if (readOnly) + { + updateNextButton("OK"); + } + else + { + updateNextButton("Save"); + } } void QtTextEditDialog::populateWindow(QWidget* widget) @@ -51,7 +60,7 @@ void QtTextEditDialog::populateWindow(QWidget* widget) void QtTextEditDialog::windowReady() { - updateNextButton("Ok"); + updateNextButton("Save"); updateCloseButton("Cancel"); setPreviousVisible(false); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index bba05519..eb88659b 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -237,6 +237,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent() connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard())); window->setContent(new T(m_settings, window)); + window->setPreferredSize(QSize(580, 340)); window->setup(); m_windowStack.pushWindow(window); @@ -255,6 +256,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContentsetContent(content); + window->setPreferredSize(QSize(570, 380)); window->setup(); m_windowStack.pushWindow(window); @@ -273,6 +275,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary( QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(m_settings, window); window->setContent(summary); + window->setPreferredSize(QSize(750, 500)); func(window, summary); m_windowStack.pushWindow(window); @@ -373,7 +376,7 @@ void QtProjectWizzard::sourcePaths() [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) { summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window), false, false); - summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), false, false); + summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), false, true); window->setup(); } @@ -388,7 +391,7 @@ void QtProjectWizzard::headerSearchPaths() [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) { summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), false, false); - summary->addContent(new QtProjectWizzardContentSimple(m_settings, window), false, false); + summary->addContent(new QtProjectWizzardContentSimple(m_settings, window), false, true); summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, true); window->setup(); @@ -416,7 +419,7 @@ void QtProjectWizzard::frameworkSearchPaths() [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) { summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, false); - summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); + summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, true); window->setup(); } @@ -429,8 +432,6 @@ void QtProjectWizzard::emptyProjectCDB() { QtProjectWizzardWindow* window = createWindowWithContent(); - window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE"); - connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB())); } @@ -440,31 +441,13 @@ void QtProjectWizzard::headerPathsCDB() [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) { summary->addContent(new QtProjectWizzardContentCDBSource(m_settings, window), false, false); - summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window), false, false); + summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window), false, true); window->setup(); - - window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE"); } ); - connect(window, SIGNAL(next()), this, SLOT(headerPathsCDBDone())); -} - -void QtProjectWizzard::headerPathsCDBDone() -{ - showSummary(); - - QWidget* widget = m_windowStack.getTopWindow(); - - if (widget) - { - QtProjectWizzardWindow* window = dynamic_cast(widget); - - window->updateTitle("NEW PROJECT FROM COMPILATION DATABASE - SUMMARY"); - window->updateNextButton("Create"); - window->setPreviousVisible(m_windowStack.getWindowCount() > 0); - } + connect(window, SIGNAL(next()), this, SLOT(showSummary())); } void QtProjectWizzard::sourcePathsJava() @@ -473,7 +456,7 @@ void QtProjectWizzard::sourcePathsJava() [this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary) { summary->addContent(new QtProjectWizzardContentPathsSourceJava(m_settings, window), false, false); - summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, false); + summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, true); window->setup(); } @@ -514,6 +497,10 @@ void QtProjectWizzard::showSummary() summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), false, true); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); } + + summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, false); + summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, true); + summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true); } else { @@ -522,19 +509,18 @@ void QtProjectWizzard::showSummary() QtProjectWizzardContent* headers = new QtProjectWizzardContentPathsCDBHeader(m_settings, window); summary->addContent(headers, false, true); - summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), true, false); - summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, true); + summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window, true), false, true); + summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, false); if (QSysInfo::macVersion() != QSysInfo::MV_None) { - summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window), true, false); + summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window, true), false, true); summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window), false, false); } - } - summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, true); - summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, true); - summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, true); + summary->addContent(new QtProjectWizzardContentFlags(m_settings, window), true, false); + summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window), true, 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 9d93a042..68ae9f5a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h @@ -74,7 +74,6 @@ private slots: void emptyProjectCDB(); void headerPathsCDB(); - void headerPathsCDBDone(); void sourcePathsJava(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp index bc6f3318..ec382005 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp @@ -12,6 +12,7 @@ QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent) setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac setObjectName("helpButton"); + setToolTip("help"); connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress())); } @@ -31,14 +32,11 @@ QtProjectWizzardContent::QtProjectWizzardContent(std::shared_ptr QtProjectWizzardContent::getFileNames() const { return std::vector(); @@ -84,6 +77,16 @@ QString QtProjectWizzardContent::getFileNamesDescription() const return "files"; } +bool QtProjectWizzardContent::isInForm() const +{ + return m_isInForm; +} + +void QtProjectWizzardContent::setIsInForm(bool isInForm) +{ + m_isInForm = isInForm; +} + QLabel* QtProjectWizzardContent::createFormLabel(QString name) const { QLabel* label = new QLabel(name); @@ -132,6 +135,8 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout* void QtProjectWizzardContent::filesButtonClicked() { + save(); + if (!m_filesDialog) { std::vector fileNames = getFileNames(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h index e341a727..15ff21eb 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h @@ -36,8 +36,7 @@ class QtProjectWizzardContent public: QtProjectWizzardContent(std::shared_ptr settings, QtProjectWizzardWindow* window); - virtual void populateWindow(QGridLayout* layout, int& row); - virtual void populateForm(QGridLayout* layout, int& row); + virtual void populate(QGridLayout* layout, int& row); virtual void windowReady(); virtual void load(); @@ -46,12 +45,13 @@ public: virtual bool isScrollAble() const; - virtual QSize preferredWindowSize() const; - virtual std::vector getFileNames() const; virtual QString getFileNamesTitle() const; virtual QString getFileNamesDescription() const; + bool isInForm() const; + void setIsInForm(bool isInForm); + protected: QLabel* createFormLabel(QString name) const; QLabel* createFormTitle(QString name) const; @@ -69,6 +69,8 @@ private slots: private: std::shared_ptr m_filesDialog; + + bool m_isInForm; }; #endif // QT_PROJECT_WIZZARD_CONTENT_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp index 177c42f0..e8dbdb0c 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp @@ -31,7 +31,7 @@ QtProjectWizzardContentSelect::ProjectType QtProjectWizzardContentBuildFile::get return m_type; } -void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& row) +void QtProjectWizzardContentBuildFile::populate(QGridLayout* layout, int& row) { QString name; QString filter; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h index 5a816e39..13591168 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h @@ -21,7 +21,7 @@ public: QtProjectWizzardContentSelect::ProjectType getType() const; // QtProjectWizzardContent implementation - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp index 0e783df5..439d0284 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp @@ -11,13 +11,9 @@ QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource( { } -void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int& row) +void QtProjectWizzardContentCDBSource::populate(QGridLayout* layout, int& row) { - layout->setRowMinimumHeight(row++, 10); - - QLabel* title = new QLabel("Source Files"); - title->setWordWrap(true); - title->setObjectName("section"); + QLabel* title = createFormLabel("Source Files"); layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->setRowStretch(row, 0); @@ -27,9 +23,6 @@ void QtProjectWizzardContentCDBSource::populateWindow(QGridLayout* layout, int& addFilesButton("show source files", layout, row + 1); row += 2; - - layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); - layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2); } void QtProjectWizzardContentCDBSource::load() diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h index 18ff8e19..fd3e0517 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h @@ -12,7 +12,7 @@ public: QtProjectWizzardContentCDBSource(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp index a0b1f40d..7466d88e 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp @@ -17,24 +17,28 @@ QtProjectWizzardContentData::QtProjectWizzardContentData(std::shared_ptrsetRowMinimumHeight(0, 15); - row++; + if (!isInForm()) + { + layout->setRowMinimumHeight(0, 15); + row++; + } - populateForm(layout, row); - - layout->setRowMinimumHeight(row, 15); - layout->setRowStretch(row, 1); - - layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); - layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3); -} - -void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row) -{ addNameAndLocation(layout, row); + + if (!isInForm()) + { + layout->setRowMinimumHeight(row++, 20); + } + addLanguageAndStandard(layout, row); + + if (!isInForm()) + { + layout->setRowMinimumHeight(row, 15); + layout->setRowStretch(row, 1); + } } void QtProjectWizzardContentData::load() @@ -116,14 +120,9 @@ bool QtProjectWizzardContentData::check() return true; } -QSize QtProjectWizzardContentData::preferredWindowSize() const -{ - return QSize(580, 340); -} - void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& row) { - QLabel* nameLabel = createFormLabel("Name"); + QLabel* nameLabel = createFormLabel("Project Name"); m_projectName = new QLineEdit(); m_projectName->setObjectName("name"); m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0); @@ -133,7 +132,7 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r row++; - QLabel* locationLabel = createFormLabel("Location"); + QLabel* locationLabel = createFormLabel("Project File Location"); m_projectFileLocation = new QtLocationPicker(this); m_projectFileLocation->setPickDirectory(true); @@ -144,21 +143,14 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r void QtProjectWizzardContentData::addLanguageAndStandard(QGridLayout* layout, int& row) { - QLabel* languageLabel = new QLabel("Language"); - languageLabel->setObjectName("label"); m_language = new QLabel(); - - layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); row++; - - QLabel* standardLabel = createFormLabel("Standard"); m_standard = new QComboBox(); - - layout->addWidget(standardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); - row++; } @@ -176,7 +168,8 @@ void QtProjectWizzardContentData::addBuildFilePicker( row++; QLabel* description = new QLabel( - "The project will stay up-to-date with changes in the compilation database on refresh.", this); + "Coati will use all include paths and compiler flags from the compilation database and stay up-to-date " + "with changes on refresh.", this); description->setObjectName("description"); description->setWordWrap(true); layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL); @@ -191,16 +184,27 @@ QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB( { } -void QtProjectWizzardContentDataCDB::populateForm(QGridLayout* layout, int& row) +void QtProjectWizzardContentDataCDB::populate(QGridLayout* layout, int& row) { - QString name = "Compilation Database"; - QString filter = "JSON Compilation Database (*.json)"; + if (!isInForm()) + { + layout->setRowMinimumHeight(0, 15); + row++; + } addNameAndLocation(layout, row); layout->setRowMinimumHeight(row++, 20); + QString name = "Compilation Database (compile_commands.json)"; + QString filter = "JSON Compilation Database (*.json)"; addBuildFilePicker(layout, row, name, filter); + + if (!isInForm()) + { + layout->setRowMinimumHeight(row, 15); + layout->setRowStretch(row, 1); + } } void QtProjectWizzardContentDataCDB::load() diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h index ce552d33..c64eda18 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h @@ -16,15 +16,12 @@ public: QtProjectWizzardContentData(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; virtual bool check() override; - virtual QSize preferredWindowSize() const override; - protected: virtual void addNameAndLocation(QGridLayout* layout, int& row); virtual void addLanguageAndStandard(QGridLayout* layout, int& row); @@ -48,7 +45,7 @@ class QtProjectWizzardContentDataCDB public: QtProjectWizzardContentDataCDB(std::shared_ptr settings, QtProjectWizzardWindow* window); - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp index 16ad8a51..373b9aee 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp @@ -11,28 +11,7 @@ QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions( { } -void QtProjectWizzardContentExtensions::populateWindow(QGridLayout* layout, int& row) -{ - layout->setRowMinimumHeight(row++, 20); - - QLabel* title = new QLabel("Source File Extensions"); - title->setWordWrap(true); - title->setObjectName("section"); - layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row, 0); - - QLabel* text = new QLabel("Define extensions for source files including the dot e.g. .cpp"); - text->setWordWrap(true); - text->setOpenExternalLinks(true); - layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row + 1, 1); - - m_sourceList = new QtDirectoryListBox(this, title->text()); - layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop); - row += 2; -} - -void QtProjectWizzardContentExtensions::populateForm(QGridLayout* layout, int& row) +void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row) { QLabel* sourceLabel = createFormLabel("Source File Extensions"); sourceLabel->setObjectName("label"); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.h index e8905dad..80e574d1 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentExtensions.h @@ -14,8 +14,7 @@ public: QtProjectWizzardContentExtensions(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp index c51831d5..8851ecc0 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp @@ -10,7 +10,7 @@ QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptrsetObjectName("label"); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.h index 0a78d210..2295d862 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.h @@ -14,7 +14,7 @@ public: QtProjectWizzardContentFlags(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index d669e89c..cb895d0a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -20,45 +20,7 @@ QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(std::shared_ptrsetRowMinimumHeight(row++, 10); - - QLabel* title = new QLabel(m_titleString); - title->setWordWrap(true); - title->setObjectName("section"); - layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row, 0); - - QLabel* text = new QLabel(m_descriptionString); - text->setWordWrap(true); - text->setOpenExternalLinks(true); - layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row + 1, 1); - - m_list = new QtDirectoryListBox(this, m_titleString); - layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop); - - row += 2; - - if (m_showFilesString.size() > 0) - { - layout->setRowStretch(row, 0); - addFilesButton(m_showFilesString, layout, row); - } - - if (m_pathDetector) - { - addDetection(layout, row); - } - - row++; - - layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); - layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2); -} - -void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row) +void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row) { QLabel* label = createFormLabel(m_titleString); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); @@ -85,11 +47,6 @@ void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row) } } -QSize QtProjectWizzardContentPaths::preferredWindowSize() const -{ - return QSize(750, 500); -} - bool QtProjectWizzardContentPaths::check() { QString missingPaths; @@ -120,23 +77,11 @@ bool QtProjectWizzardContentPaths::check() return true; } -void QtProjectWizzardContentPaths::setInfo(const QString& title, const QString& description, const QString& help) -{ - m_titleString = title; - m_descriptionString = description; - 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; @@ -190,20 +135,13 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource( { m_showFilesString = "show files"; - setInfo( - "Project Paths", - "Add all directories or files you want to index. Usually these are all source and header files of " - "your project or a subset of them.", - "Project Paths define the files and directories that will be indexed by Coati. Usually these are the " - "source and header files of your project or a subset of them." + setTitleString("Project Paths"); + setHelpString( + "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively " + "add all contained files.\n\nProject Paths are usually the source and header files of your project or a subset of them." ); } -QSize QtProjectWizzardContentPathsSource::preferredWindowSize() const -{ - return QSize(750, 400); -} - void QtProjectWizzardContentPathsSource::load() { m_list->setList(m_settings->getSourcePaths()); @@ -269,12 +207,11 @@ QtProjectWizzardContentPathsSourceJava::QtProjectWizzardContentPathsSourceJava( ) : 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." + setHelpString( + "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively " + "add all contained files. Adding the root source directory of your project is usually sufficient.\n\n" + "If your project's source code resides in one location, but generated source files are kept at a different location, " + "you will also need to add that directory." ); } @@ -285,14 +222,12 @@ QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader( { m_showFilesString = ""; - setTitleString("Header Paths"); - setDescriptionString( - "Where are the header files of the source files? Add the directories or files that should be " - "indexed if included by one of the source files." - ); + setTitleString("Indexed Header Paths"); setHelpString( - "The compilation database only contains source files. Add the header files or directories containing the header " - "files here. Header files will be indexed if included." + "Define which header files should be indexed by Coati. Provide a directory to recursively add all contained files. " + "Every time an included header is encountered, Coati will check if the file is located in one of these paths to " + "decide whether or not to index it.\n\n" + "This is necessary since the Compilation Database only specifies the source files of your project." ); } @@ -302,11 +237,8 @@ QtProjectWizzardContentPathsExclude::QtProjectWizzardContentPathsExclude( ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "Exclude Paths", - "Add all directories or files you want to exclude from indexing.", - "Exclude Paths define the files and directories that will be left out from indexing." - ); + setTitleString("Exclude Paths"); + setHelpString("Exclude Paths define the files and directories that will be left out from indexing."); } void QtProjectWizzardContentPathsExclude::load() @@ -321,16 +253,18 @@ void QtProjectWizzardContentPathsExclude::save() QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch( - std::shared_ptr settings, QtProjectWizzardWindow* window + std::shared_ptr settings, QtProjectWizzardWindow* window, bool isCDB ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "Include Paths", - "Add the paths for resolving #include directives in the indexed 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 indexed, but Coati needs " - "them for correct indexing." + setTitleString(isCDB ? "Additional Include Paths" : "Include Paths"); + setHelpString( + "Include Paths are used for resolving #include directives in the indexed source and header files. These paths are " + "usually passed to the compiler with the '-I' or '-iquote' flags.\n\n" + "Add all the paths the #include directives throughout your project are relative to. If all #include directives are " + "specified relative to the project's root directory, please add that.\n\n" + "If your project also includes files from external libraries (e.g. boost), please add these directories as well " + "(e.g. add '/include')." ); } @@ -362,15 +296,12 @@ QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHead ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "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).", - "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 indexed, but Coati needs " - "them for correct indexing.\n\n" - "Include Paths defined here will be used for all projects." + setTitleString("Global Include Paths"); + setHelpString( + "The Global Include Paths will be used in all your projects - in addition to the project specific Include Paths. " + "These paths are usually passed to the compiler with the '-isystem' flag.\n\n" + "Use them to add system header paths (See " + "Finding System Header Locations or use the auto detection below)." ); m_pathDetector = std::make_shared(); @@ -399,15 +330,14 @@ void QtProjectWizzardContentPathsHeaderSearchGlobal::save() QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch( - std::shared_ptr settings, QtProjectWizzardWindow* window + std::shared_ptr settings, QtProjectWizzardWindow* window, bool isCDB ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "Framework Search Paths", - "Add search paths to Mac OS framework containers (.framework) that the project depends on.", + setTitleString(isCDB ? "Additional Framework Search Paths" : "Framework Search Paths"); + setHelpString( "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are " - "found." + "found. These paths are usually passed to the compiler with the '-iframework' flag." ); } @@ -439,14 +369,12 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "Global Framework Search Paths", - "These framework search paths will be used in all your projects. Use it to add system frameworks " + setTitleString("Global Framework Search Paths"); + setHelpString( + "The Global Framework Search Paths will be used in all your projects - in addition to the project specific " + "Framework Search Paths.\n\nThey define where MacOS framework containers (.framework) are found " "(See " - "Finding System Header Locations or use the auto detection below).", - "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." + "Finding System Header Locations or use the auto detection below)." ); m_pathDetector = std::make_shared(); @@ -471,9 +399,8 @@ QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava( ) : QtProjectWizzardContentPaths(settings, window) { - setInfo( - "Class Path", - "Paths to .jar files and root directories of .class files your project depends on.", + setTitleString("Class Path"); + setHelpString( "Enter the paths to .jar files and root directories of .class files your project depends on." ); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h index 6d052676..a646d120 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h @@ -21,17 +21,12 @@ public: QtProjectWizzardContentPaths(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtSettingsWindow implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; - - virtual QSize preferredWindowSize() const override; + virtual void populate(QGridLayout* layout, int& row) override; virtual bool check() override; 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); void addDetection(QGridLayout* layout, int row); @@ -46,7 +41,6 @@ private slots: private: QString m_titleString; - QString m_descriptionString; QString m_helpString; QComboBox* m_detectorBox; @@ -60,8 +54,6 @@ public: QtProjectWizzardContentPathsSource(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual QSize preferredWindowSize() const override; - virtual void load() override; virtual void save() override; @@ -100,7 +92,8 @@ class QtProjectWizzardContentPathsHeaderSearch : public QtProjectWizzardContentPaths { public: - QtProjectWizzardContentPathsHeaderSearch(std::shared_ptr settings, QtProjectWizzardWindow* window); + QtProjectWizzardContentPathsHeaderSearch( + std::shared_ptr settings, QtProjectWizzardWindow* window, bool isCDB = false); // QtProjectWizzardContent implementation virtual void load() override; @@ -125,7 +118,8 @@ class QtProjectWizzardContentPathsFrameworkSearch : public QtProjectWizzardContentPaths { public: - QtProjectWizzardContentPathsFrameworkSearch(std::shared_ptr settings, QtProjectWizzardWindow* window); + QtProjectWizzardContentPathsFrameworkSearch( + std::shared_ptr settings, QtProjectWizzardWindow* window, bool isCDB = false); // QtProjectWizzardContent implementation virtual void load() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp index 0e8d94ec..9cb0e134 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp @@ -29,12 +29,7 @@ QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences() } } -void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout, int& row) -{ - populateForm(layout, row); -} - -void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int& row) +void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row) { ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h index b8fc62b0..e9c86107 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h @@ -19,8 +19,7 @@ public: ~QtProjectWizzardContentPreferences(); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp index 85129046..443ae478 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp @@ -20,7 +20,7 @@ QtProjectWizzardContentSelect::QtProjectWizzardContentSelect( { } -void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout, int& row) +void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row) { QPushButton* d = new QPushButton(languageTypeToString(LANGUAGE_CPP).c_str(), this); QPushButton* e = new QPushButton(languageTypeToString(LANGUAGE_C).c_str(), this); @@ -81,15 +81,15 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout, int& row QToolButton* a = createProjectButton( - "empty project", (ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str()); + "Empty Project", (ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str()); QToolButton* c = createProjectButton( "from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str()); m_solutionDescription.push_back("Create a new Coati project by defining what files will be indexed."); - m_solutionDescription.push_back("Create a project from an existing Compilation Database. Compilation Databases can be created from " - "Make and CMake projects. Have a look at the " - "" - "documentation to find out more."); + m_solutionDescription.push_back( + "Create a project from an existing Compilation Database (compile_commands.json). They can be created from Make and " + "CMake projects. Have a look at the " + "documentation to find out more."); m_buttons = new QButtonGroup(this); m_buttons->addButton(a); @@ -187,8 +187,3 @@ bool QtProjectWizzardContentSelect::check() return true; } - -QSize QtProjectWizzardContentSelect::preferredWindowSize() const -{ - return QSize(570, 380); -} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h index a535d795..b5083513 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h @@ -20,16 +20,16 @@ public: }; QtProjectWizzardContentSelect( - std::shared_ptr settings, QtProjectWizzardWindow* window, std::weak_ptr solutionParserManager); + std::shared_ptr settings, + QtProjectWizzardWindow* window, + std::weak_ptr solutionParserManager); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void save() override; virtual bool check() override; - virtual QSize preferredWindowSize() const override; - signals: void selected(LanguageType, QtProjectWizzardContentSelect::ProjectType); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp index 946e603e..5740fac3 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp @@ -11,37 +11,19 @@ QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptrsetWordWrap(true); - title->setObjectName("section"); - layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row, 0); - - QLabel* text = new QLabel("Search for included files in all subdirectories of the project paths. " - "Warning: This slows down indexing speed."); - text->setWordWrap(true); - layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - layout->setRowStretch(row + 1, 1); + m_title = createFormLabel("Lazy Include Search"); + layout->addWidget(m_title, row, QtProjectWizzardWindow::FRONT_COL); m_checkBox = new QCheckBox("Search included files within the project paths"); layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); - row += 2; -} - -void QtProjectWizzardContentSimple::populateForm(QGridLayout* layout, int& row) -{ - QLabel* label = createFormLabel("Lazy Include Search"); - layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL); - - m_checkBox = new QCheckBox("Search included files within the project paths"); - layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); - - 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 index.\n" - "Warning: This option slows down indexing speed.", layout, row); + addHelpButton( + "If enabled Coati also uses the project paths and their subdirectories when resolving #include directives.\n\n" + "Use this option when you know that the project is self contained but don't know which paths to " + "specify as include paths.\n\n" + "Warning: This slows down indexing speed.", layout, row); row++; } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h index dcb1a0d3..7af17fea 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h @@ -15,14 +15,14 @@ public: QtProjectWizzardContentSimple(std::shared_ptr settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; private: QCheckBox* m_checkBox; + QLabel* m_title; }; #endif // QT_PROJECT_WIZZARD_CONTENT_SIMPLE_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp index 1a1390ce..65e27348 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp @@ -20,6 +20,8 @@ void QtProjectWizzardContentSummary::addContent(QtProjectWizzardContent* content element.advanced = advanced; element.gapBefore = gapBefore; m_elements.push_back(element); + + content->setIsInForm(m_isForm); } void QtProjectWizzardContentSummary::setIsForm(bool isForm) @@ -27,7 +29,7 @@ void QtProjectWizzardContentSummary::setIsForm(bool isForm) m_isForm = isForm; } -void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& row) +void QtProjectWizzardContentSummary::populate(QGridLayout* layout, int& row) { if (m_isForm) { @@ -35,7 +37,7 @@ void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& ro return; } - layout->setRowMinimumHeight(row++, 10); + layout->setRowMinimumHeight(row++, 20); for (const Element& element : m_elements) { @@ -49,10 +51,10 @@ void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout, int& ro layout->setRowMinimumHeight(row++, 20); } - element.content->populateWindow(layout, row); + element.content->populate(layout, row); } - layout->setRowMinimumHeight(row, 10); + layout->setRowMinimumHeight(row, 20); layout->setRowStretch(row, 1); } @@ -78,7 +80,7 @@ void QtProjectWizzardContentSummary::populateForm(QGridLayout* layout, int& row) layout->setRowMinimumHeight(row++, 15); } - element.content->populateForm(layout, row); + element.content->populate(layout, row); } if (i > 0 || !hasAdvanced) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h index 7786abe8..9db61299 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h @@ -26,8 +26,8 @@ public: protected: // QtProjectWizzardContent implementation - virtual void populateWindow(QGridLayout* layout, int& row) override; - virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void populate(QGridLayout* layout, int& row) override; + void populateForm(QGridLayout* layout, int& row); virtual void load() override; virtual void save() override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp index 8dc81fee..7223595f 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp @@ -17,11 +17,11 @@ QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent) QSize QtProjectWizzardWindow::sizeHint() const { - if (content()) + if (m_preferredSize.width()) { - return content()->preferredWindowSize(); + return m_preferredSize; } - return QSize(); + return QSize(750, 620); } QtProjectWizzardContent* QtProjectWizzardWindow::content() const @@ -35,13 +35,24 @@ void QtProjectWizzardWindow::setContent(QtProjectWizzardContent* content) setScrollAble(content->isScrollAble()); } +void QtProjectWizzardWindow::setPreferredSize(QSize size) +{ + m_preferredSize = size; +} + void QtProjectWizzardWindow::populateWindow(QWidget* widget) { QGridLayout* layout = new QGridLayout(); layout->setContentsMargins(0, 0, 0, 0); + layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); + layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3); + + layout->setColumnStretch(HELP_COL, 0); + layout->setColumnStretch(LINE_COL, 0); + int row = 0; - m_content->populateWindow(layout, row); + m_content->populate(layout, row); QFrame* separator = new QFrame(); separator->setFrameShape(QFrame::VLine); @@ -52,9 +63,6 @@ void QtProjectWizzardWindow::populateWindow(QWidget* widget) layout->addWidget(separator, 0, LINE_COL, -1, 1); - layout->setColumnStretch(HELP_COL, 0); - layout->setColumnStretch(LINE_COL, 0); - if (isScrollAble()) { layout->setColumnMinimumWidth(BACK_COL + 1, 10); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h index 349dff29..e9c58032 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h @@ -18,6 +18,8 @@ public: QtProjectWizzardContent* content() const; void setContent(QtProjectWizzardContent* content); + void setPreferredSize(QSize size); + static const int FRONT_COL = 0; static const int HELP_COL = 1; static const int LINE_COL = 2; @@ -33,6 +35,7 @@ protected: private: QtProjectWizzardContent* m_content; + QSize m_preferredSize; }; #endif // QT_PROJECT_WIZZARD_WINDOW_H