diff --git a/CMakeLists.txt b/CMakeLists.txt index 4107fda0..8a8a792e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,11 +47,10 @@ endif () project(${PROJECT_NAME}) #RPATH -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib/:$$ORIGIN/lib/") - if(UNIX AND NOT APPLE) + set(CMAKE_SKIP_BUILD_RPATH FALSE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_INSTALL_RPATH "$ORIGIN/lib/:$$ORIGIN/lib/") include(cmake/external.cmake) endif() diff --git a/bin/app/data/gui/icon/project_256_256.png b/bin/app/data/gui/icon/project_256_256.png index d6726001..666d3376 100644 Binary files a/bin/app/data/gui/icon/project_256_256.png and b/bin/app/data/gui/icon/project_256_256.png differ diff --git a/bin/app/data/gui/icon/project_cdb_256_256.png b/bin/app/data/gui/icon/project_cdb_256_256.png new file mode 100644 index 00000000..ec7dc5ca Binary files /dev/null and b/bin/app/data/gui/icon/project_cdb_256_256.png differ diff --git a/bin/app/data/gui/icon/project_vs_256_256.png b/bin/app/data/gui/icon/project_vs_256_256.png new file mode 100644 index 00000000..db2a9e90 Binary files /dev/null and b/bin/app/data/gui/icon/project_vs_256_256.png differ diff --git a/bin/app/data/gui/project_wizzard/window.css b/bin/app/data/gui/project_wizzard/window.css new file mode 100644 index 00000000..ab0f1637 --- /dev/null +++ b/bin/app/data/gui/project_wizzard/window.css @@ -0,0 +1,145 @@ +#title { + color: black; + font-size: 16pt; + font-weight: bold; +} + +#section, #projectTitle { + color: black; + font-size: 15pt; + font-weight: bold; +} + +#projectTitle { + background: white; + padding: 5px; + margin-left: 40px; +} + +#label { + font-weight: bold; +} + +#formArea { + background: white; + border: none; + border-top: 1px solid lightgrey; + border-bottom: 1px solid lightgrey; +} + +#form { + background: white; +} + +#helpButton, #dotsButton, #refreshButton { + border: none; + color: white; + height: 16px; + width: 16px; +} + +#helpButton { + border-image: url(setting_window/help.png); +} + +#helpButton:hover { + border-image: url(setting_window/help_hover.png); +} + +#dotsButton { + border-image: url(setting_window/dots.png); +} + +#dotsButton:hover { + border-image: url(setting_window/dots_hover.png); +} + +#refreshButton { + border-image: url(setting_window/refresh.png); +} + +#refreshButton:hover { + border-image: url(setting_window/refresh_hover.png); +} + +#name, #picker { + border-radius: 10px; + border: 1px solid lightgrey; + height: 20px; + padding-left: 5px; + padding-right: 5px; +} + +#locationField { + background: white; + border: none; + border-radius: 5px; + margin-left: 5px; + height: 20px; +} + +#dotsButton, #refreshButton { + margin-right: 2px; +} + +#windowButton { + background: white; + border: 1px solid lightgray; + border-radius: 8px; + color: black; + font-size: 14pt; + height: 22px; + width: 90px; +} + +#menuButton { + background: white; + border: none; + border-radius: 8px; + border-bottom-right-radius: 0px; + border-top-right-radius: 0px; + font-size: 15pt; + margin-right: 0px; + margin-bottom: 7px; + height: 25px; + width: 90px; +} + +#windowButton:hover { + color: white; + background: #2D3F85; +} + +#menuButton:hover, #menuButton:checked { + background: #CFD2E0; +} + +#windowButton:disabled { + color: lightgray; +} + +#projectContainer { + background: white; + border: 1px solid lightgray; + border-radius: 8px; + margin-top: 15px; + margin-left: 20px; +} + +#projectButton { + background: white; + border-radius: 8px; + font-size: 12pt; + width: 110px; + height: 100px; +} + +#projectButton:hover, #projectButton:checked { + background: #CFD2E0; +} + +#files { + border: 1px solid lightgray; + border-radius: 12px; + padding: 6px; +} diff --git a/bin/app/data/gui/setting_window/dots.png b/bin/app/data/gui/setting_window/dots.png new file mode 100644 index 00000000..8bb1956a Binary files /dev/null and b/bin/app/data/gui/setting_window/dots.png differ diff --git a/bin/app/data/gui/setting_window/dots_hover.png b/bin/app/data/gui/setting_window/dots_hover.png new file mode 100644 index 00000000..7ebf7142 Binary files /dev/null and b/bin/app/data/gui/setting_window/dots_hover.png differ diff --git a/bin/app/data/gui/setting_window/help.png b/bin/app/data/gui/setting_window/help.png new file mode 100644 index 00000000..149b878d Binary files /dev/null and b/bin/app/data/gui/setting_window/help.png differ diff --git a/bin/app/data/gui/setting_window/help_hover.png b/bin/app/data/gui/setting_window/help_hover.png new file mode 100644 index 00000000..aa442d67 Binary files /dev/null and b/bin/app/data/gui/setting_window/help_hover.png differ diff --git a/bin/app/data/gui/setting_window/listbox.css b/bin/app/data/gui/setting_window/listbox.css index 17eb8d15..ba04fba4 100644 --- a/bin/app/data/gui/setting_window/listbox.css +++ b/bin/app/data/gui/setting_window/listbox.css @@ -24,27 +24,14 @@ QtListItemWidget #field { border: none; font-size: 12px; margin-top: 2px; -} - -QtListItemWidget #button { - border: 1px solid lightgray; - border-radius: 7px; - font-size: 12px; - height: 14px; - margin-right: 2px; - width: 20px; -} - -QtListItemWidget #button:hover { - color: white; - background: #2D3F85; + margin-left: 5px; } #bar { border-top: 1px solid lightgray; } -#roundedButton { +#plusButton, #minusButton, #dotsButton { color: white; height: 16px; margin-right: 3px; @@ -52,6 +39,34 @@ QtListItemWidget #button:hover { border: none; } +#dotsButton { + margin-top: 2px; +} + +#plusButton { + border-image: url(setting_window/plus.png); +} + +#plusButton:hover { + border-image: url(setting_window/plus_hover.png); +} + +#minusButton { + border-image: url(setting_window/minus.png); +} + +#minusButton:hover { + border-image: url(setting_window/minus_hover.png); +} + +#dotsButton { + border-image: url(setting_window/dots.png); +} + +#dotsButton:hover { + border-image: url(setting_window/dots_hover.png); +} + #dropInfo { color: lightgray; } diff --git a/bin/app/data/gui/setting_window/minus.png b/bin/app/data/gui/setting_window/minus.png index 290b0a33..9e66a794 100644 Binary files a/bin/app/data/gui/setting_window/minus.png and b/bin/app/data/gui/setting_window/minus.png differ diff --git a/bin/app/data/gui/setting_window/minus_hover.png b/bin/app/data/gui/setting_window/minus_hover.png new file mode 100644 index 00000000..dc82e816 Binary files /dev/null and b/bin/app/data/gui/setting_window/minus_hover.png differ diff --git a/bin/app/data/gui/setting_window/plus.png b/bin/app/data/gui/setting_window/plus.png index 366e1044..f8232feb 100644 Binary files a/bin/app/data/gui/setting_window/plus.png and b/bin/app/data/gui/setting_window/plus.png differ diff --git a/bin/app/data/gui/setting_window/plus_hover.png b/bin/app/data/gui/setting_window/plus_hover.png new file mode 100644 index 00000000..12270077 Binary files /dev/null and b/bin/app/data/gui/setting_window/plus_hover.png differ diff --git a/bin/app/data/gui/setting_window/refresh.png b/bin/app/data/gui/setting_window/refresh.png new file mode 100644 index 00000000..ab663e01 Binary files /dev/null and b/bin/app/data/gui/setting_window/refresh.png differ diff --git a/bin/app/data/gui/setting_window/refresh_hover.png b/bin/app/data/gui/setting_window/refresh_hover.png new file mode 100644 index 00000000..fdbc1849 Binary files /dev/null and b/bin/app/data/gui/setting_window/refresh_hover.png differ diff --git a/src/lib_gui/CMakeLists.txt b/src/lib_gui/CMakeLists.txt index 34b4bace..5f92de34 100644 --- a/src/lib_gui/CMakeLists.txt +++ b/src/lib_gui/CMakeLists.txt @@ -113,6 +113,8 @@ add_files( qt/window/project_wizzard/QtProjectWizzardContentData.h qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp qt/window/project_wizzard/QtProjectWizzardContentPaths.h + qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp + qt/window/project_wizzard/QtProjectWizzardContentPreferences.h qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp qt/window/project_wizzard/QtProjectWizzardContentSelect.h qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp @@ -128,8 +130,6 @@ add_files( qt/window/QtAbout.h qt/window/QtAboutLicense.cpp qt/window/QtAboutLicense.h - qt/window/QtApplicationSettingsScreen.cpp - qt/window/QtApplicationSettingsScreen.h qt/window/QtLicense.cpp qt/window/QtLicense.h qt/window/QtMainWindow.cpp diff --git a/src/lib_gui/qt/element/QtDirectoryListBox.cpp b/src/lib_gui/qt/element/QtDirectoryListBox.cpp index 4187e386..0a3ee811 100644 --- a/src/lib_gui/qt/element/QtDirectoryListBox.cpp +++ b/src/lib_gui/qt/element/QtDirectoryListBox.cpp @@ -25,9 +25,9 @@ QtListItemWidget::QtListItemWidget(QtDirectoryListBox* list, QListWidgetItem* it m_data->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac m_data->setObjectName("field"); - m_button = new QPushButton("..."); + m_button = new QPushButton(""); m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_button->setObjectName("button"); + m_button->setObjectName("dotsButton"); layout->addWidget(m_data); layout->addWidget(m_button); @@ -115,18 +115,16 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent) innerLayout->setContentsMargins(8, 4, 8, 3); innerLayout->setSpacing(0); - std::string iconPath = ResourcePaths::getGuiPath() + "setting_window/plus.png"; - m_addButton = new QPushButton(QIcon(iconPath.c_str()), "", this); + m_addButton = new QPushButton("", this); m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_addButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - m_addButton->setObjectName("roundedButton"); + m_addButton->setObjectName("plusButton"); innerLayout->addWidget(m_addButton); - iconPath = ResourcePaths::getGuiPath() + "setting_window/minus.png"; - m_removeButton = new QPushButton(QIcon(iconPath.c_str()), "", this); + 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("roundedButton"); + m_removeButton->setObjectName("minusButton"); innerLayout->addWidget(m_removeButton); QLabel* dropInfoText = new QLabel("Drop Files & Folders"); diff --git a/src/lib_gui/qt/element/QtLocationPicker.cpp b/src/lib_gui/qt/element/QtLocationPicker.cpp index 30179e95..8bfdaf99 100644 --- a/src/lib_gui/qt/element/QtLocationPicker.cpp +++ b/src/lib_gui/qt/element/QtLocationPicker.cpp @@ -3,30 +3,41 @@ #include #include #include +#include +#include QtLocationPicker::QtLocationPicker(QWidget *parent) : QWidget(parent) , m_pickDirectory(false) { + setObjectName("picker"); + QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); layout->setContentsMargins(1, 1, 1, 1); layout->setAlignment(Qt::AlignTop); - setLayout(layout); - m_data = new QtLineEdit(this); m_data->setAttribute(Qt::WA_MacShowFocusRect, 0); m_data->setObjectName("locationField"); - - m_button = new QPushButton("..."); - m_button->setObjectName("moreButton"); - m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - layout->addWidget(m_data); + + m_button = new QPushButton(""); + m_button->setObjectName("dotsButton"); + m_button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress())); layout->addWidget(m_button); - connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress())); + setLayout(layout); +} + +void QtLocationPicker::paintEvent(QPaintEvent*) +{ + QStyleOption opt; + opt.init(this); + + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } QString QtLocationPicker::getText() diff --git a/src/lib_gui/qt/element/QtLocationPicker.h b/src/lib_gui/qt/element/QtLocationPicker.h index aa57b321..001ebb9a 100644 --- a/src/lib_gui/qt/element/QtLocationPicker.h +++ b/src/lib_gui/qt/element/QtLocationPicker.h @@ -13,6 +13,8 @@ class QtLocationPicker public: QtLocationPicker(QWidget *parent); + virtual void paintEvent(QPaintEvent*) override; + QString getText(); void setText(QString text); void clearText(); diff --git a/src/lib_gui/qt/window/QtApplicationSettingsScreen.cpp b/src/lib_gui/qt/window/QtApplicationSettingsScreen.cpp deleted file mode 100644 index e199f6eb..00000000 --- a/src/lib_gui/qt/window/QtApplicationSettingsScreen.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "qt/window/QtApplicationSettingsScreen.h" - -#include -#include -#include -#include - -#include "utility/messaging/type/MessageLoadProject.h" -#include "utility/messaging/type/MessageRefresh.h" - -#include "settings/ApplicationSettings.h" - -QtApplicationSettingsScreen::QtApplicationSettingsScreen(QWidget *parent) - : QtSettingsWindow(parent) - , m_headerPaths(nullptr) - , m_frameworkPaths(nullptr) -{ - m_headerPaths = new QtProjectWizzardContentPathsHeaderSearchGlobal(nullptr, nullptr); - - if (QSysInfo::macVersion() != QSysInfo::MV_None) - { - m_frameworkPaths = new QtProjectWizzardContentPathsFrameworkSearchGlobal(nullptr, nullptr); - } -} - -QSize QtApplicationSettingsScreen::sizeHint() const -{ - return QSize(600,600); -} - -void QtApplicationSettingsScreen::setup() -{ - setupForm(); - - updateTitle("PREFERENCES"); - updateDoneButton("Save"); -} - -void QtApplicationSettingsScreen::load() -{ - m_headerPaths->load(); - - if (m_frameworkPaths) - { - m_frameworkPaths->load(); - } -} - -void QtApplicationSettingsScreen::populateWindow(QWidget* widget) -{ - QFormLayout* layout = new QFormLayout(); - layout->setContentsMargins(10, 10, 10, 10); - layout->setHorizontalSpacing(20); - - m_headerPaths->populateForm(layout); - - if (m_frameworkPaths) - { - m_frameworkPaths->populateForm(layout); - } - - widget->setLayout(layout); -} - -void QtApplicationSettingsScreen::handleCancelButtonPress() -{ - emit canceled(); -} - -void QtApplicationSettingsScreen::handleUpdateButtonPress() -{ - m_headerPaths->save(); - - if (m_frameworkPaths) - { - m_frameworkPaths->save(); - } - - ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); - appSettings->save(); - - MessageRefresh().dispatch(); - emit finished(); -} diff --git a/src/lib_gui/qt/window/QtApplicationSettingsScreen.h b/src/lib_gui/qt/window/QtApplicationSettingsScreen.h deleted file mode 100644 index bbbf662b..00000000 --- a/src/lib_gui/qt/window/QtApplicationSettingsScreen.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef QT_APPLICATION_SETTINGS_SCREEN_H -#define QT_APPLICATION_SETTINGS_SCREEN_H - -#include -#include - -#include "utility/file/FilePath.h" - -#include "qt/element/QtDirectoryListBox.h" -#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h" -#include "qt/window/QtSettingsWindow.h" - -class QtApplicationSettingsScreen - : public QtSettingsWindow -{ - Q_OBJECT - -public: - QtApplicationSettingsScreen(QWidget* parent = 0); - QSize sizeHint() const Q_DECL_OVERRIDE; - - virtual void setup() override; - - void load(); - -protected: - virtual void populateWindow(QWidget* widget) override; - -private slots: - void handleCancelButtonPress(); - void handleUpdateButtonPress(); - -private: - QPushButton* m_cancelButton; - QPushButton* m_updateButton; - - QtProjectWizzardContentPathsHeaderSearchGlobal* m_headerPaths; - QtProjectWizzardContentPathsFrameworkSearchGlobal* m_frameworkPaths; -}; - -#endif //QT_APPLICATION_SETTINGS_SCREEN_H diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 9acdf19d..83b9f799 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -13,7 +13,6 @@ #include "qt/utility/utilityQt.h" #include "qt/view/QtViewWidgetWrapper.h" #include "qt/window/project_wizzard/QtProjectWizzard.h" -#include "qt/window/QtApplicationSettingsScreen.h" #include "qt/window/QtStartScreen.h" #include "qt/window/QtAboutLicense.h" #include "qt/window/QtAbout.h" @@ -303,18 +302,10 @@ QtSettingsWindow* QtMainWindow::about() return aboutWindow; } -QtSettingsWindow* QtMainWindow::openSettings() +void QtMainWindow::openSettings() { - QtApplicationSettingsScreen* applicationSettingsScreen = new QtApplicationSettingsScreen(this); - applicationSettingsScreen->setup(); - - connect(applicationSettingsScreen, SIGNAL(finished()), &m_windowStack, SLOT(popWindow())); - connect(applicationSettingsScreen, SIGNAL(canceled()), &m_windowStack, SLOT(popWindow())); - - applicationSettingsScreen->load(); - m_windowStack.pushWindow(applicationSettingsScreen); - - return applicationSettingsScreen; + QtProjectWizzard* wizzard = createWindow(); + wizzard->showPreferences(); } QtSettingsWindow* QtMainWindow::showLicenses() diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h index e28d3685..732a41b6 100644 --- a/src/lib_gui/qt/window/QtMainWindow.h +++ b/src/lib_gui/qt/window/QtMainWindow.h @@ -97,7 +97,7 @@ public slots: void activateWindow(); QtSettingsWindow* about(); - QtSettingsWindow* openSettings(); + void openSettings(); QtSettingsWindow* showLicenses(); QtSettingsWindow* enterLicense(); diff --git a/src/lib_gui/qt/window/QtSettingsWindow.cpp b/src/lib_gui/qt/window/QtSettingsWindow.cpp index 26f92d60..21895135 100644 --- a/src/lib_gui/qt/window/QtSettingsWindow.cpp +++ b/src/lib_gui/qt/window/QtSettingsWindow.cpp @@ -163,7 +163,7 @@ void QtSettingsWindow::addLogo() QLabel* coatiLogoLabel = new QLabel(this); coatiLogoLabel->setPixmap(coatiLogo.pixmap()); coatiLogoLabel->resize(coatiLogo.width(), coatiLogo.height()); - coatiLogoLabel->move(30,10); + coatiLogoLabel->move(30, 10); } void QtSettingsWindow::showButtons(QVBoxLayout* layout) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 2114033c..63cb4b63 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -7,6 +7,7 @@ #include "qt/window/project_wizzard/QtProjectWizzardContent.h" #include "qt/window/project_wizzard/QtProjectWizzardContentData.h" #include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h" +#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h" #include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h" #include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h" #include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h" @@ -89,6 +90,12 @@ void QtProjectWizzard::editProject(const ProjectSettings& settings) connect(window, SIGNAL(next()), this, SLOT(createProject())); } +void QtProjectWizzard::showPreferences() +{ + QtProjectWizzardWindow* window = createWindowWithContent(); + connect(window, SIGNAL(next()), this, SLOT(cancelWizzard())); +} + template QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent() { @@ -252,8 +259,7 @@ void QtProjectWizzard::sourcePaths() connect(window, SIGNAL(next()), this, SLOT(headerSearchPaths())); connect(dynamic_cast(window->content()), - SIGNAL(showSourceFiles(std::vector)), - this, SLOT(showSourceFiles(std::vector))); + SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles())); } void QtProjectWizzard::headerSearchPaths() @@ -268,8 +274,7 @@ void QtProjectWizzard::simpleSourcePaths() connect(window, SIGNAL(next()), this, SLOT(simpleHeaderSearchPaths())); connect(dynamic_cast(window->content()), - SIGNAL(showSourceFiles(std::vector)), - this, SLOT(showSourceFiles(std::vector))); + SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles())); } void QtProjectWizzard::simpleHeaderSearchPaths() @@ -296,10 +301,16 @@ void QtProjectWizzard::frameworkSearchPaths() connect(window, SIGNAL(next()), this, SLOT(showSummary())); } -void QtProjectWizzard::showSourceFiles(std::vector sourcePaths) +void QtProjectWizzard::showSourceFiles() { + QWidget* topWindow = m_windowStack.getTopWindow(); + if (topWindow) + { + dynamic_cast(topWindow)->content()->save(); + } + QtProjectWizzardWindow* window = createPopupWithContent(); - dynamic_cast(window->content())->showFilesFromSourcePaths(sourcePaths); + dynamic_cast(window->content())->showFilesFromSourcePaths(); } void QtProjectWizzard::showSummary() @@ -314,8 +325,7 @@ void QtProjectWizzard::showSummary() this, SLOT(refreshProjectFromVisualStudioSolution(const std::string&))); connect(dynamic_cast(summary->contentPathsSource()), - SIGNAL(showSourceFiles(std::vector)), - this, SLOT(showSourceFiles(std::vector))); + SIGNAL(showSourceFiles()), this, SLOT(showSourceFiles())); } void QtProjectWizzard::createProject() diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h index 89ed064c..1e88976a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h @@ -26,6 +26,7 @@ public slots: void newProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath); void refreshProjectFromVisualStudioSolution(const std::string& visualStudioSolutionPath); void editProject(const ProjectSettings& settings); + void showPreferences(); private: template @@ -59,7 +60,7 @@ private slots: void headerSearchPathsDone(); void frameworkSearchPaths(); - void showSourceFiles(std::vector sourcePaths); + void showSourceFiles(); void showSummary(); void createProject(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp index d4caa802..2c37633a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.cpp @@ -1,5 +1,29 @@ #include "qt/window/project_wizzard/QtProjectWizzardContent.h" +#include + +QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent) + : QPushButton("", parent) + , m_helpText(helpText) +{ + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + setObjectName("helpButton"); + + connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress())); +} + +void QtHelpButton::handleHelpPress() +{ + QMessageBox msgBox; + msgBox.setText("Help"); + msgBox.setInformativeText(m_helpText); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); +} + + QtProjectWizzardContent::QtProjectWizzardContent(ProjectSettings* settings, QtProjectWizzardWindow* window) : QWidget(window) , m_settings(settings) @@ -11,7 +35,11 @@ void QtProjectWizzardContent::populateWindow(QWidget* widget) { } -void QtProjectWizzardContent::populateForm(QFormLayout* layout) +void QtProjectWizzardContent::populateWindow(QGridLayout* layout) +{ +} + +void QtProjectWizzardContent::populateForm(QGridLayout* layout, int& row) { } @@ -32,6 +60,16 @@ bool QtProjectWizzardContent::check() return true; } +bool QtProjectWizzardContent::isScrollAble() const +{ + return false; +} + +QSize QtProjectWizzardContent::preferredWindowSize() const +{ + return QSize(600, 620); +} + QLabel* QtProjectWizzardContent::createFormLabel(QString name) const { QLabel* label = new QLabel(name); @@ -40,3 +78,22 @@ QLabel* QtProjectWizzardContent::createFormLabel(QString name) const label->setWordWrap(true); return label; } + +QToolButton* QtProjectWizzardContent::createProjectButton(QString name, QString iconPath) const +{ + QToolButton* button = new QToolButton(); + button->setObjectName("projectButton"); + button->setText(name); + button->setIcon(QPixmap(iconPath)); + button->setIconSize(QSize(64, 64)); + button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); + button->setCheckable(true); + return button; +} + +QtHelpButton* QtProjectWizzardContent::addHelpButton(QString helpString, QGridLayout* layout, int row) const +{ + QtHelpButton* button = new QtHelpButton(helpString); + layout->addWidget(button, row, QtProjectWizzardWindow::HELP_COL, Qt::AlignTop); + return button; +} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h index f2d462d8..4122ac99 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContent.h @@ -1,14 +1,31 @@ #ifndef QT_PROJECT_WIZZARD_CONTENT_H #define QT_PROJECT_WIZZARD_CONTENT_H -#include +#include #include +#include +#include #include #include "qt/window/project_wizzard/QtProjectWizzardWindow.h" #include "settings/ProjectSettings.h" -class QFormLayout; + +class QtHelpButton + : public QPushButton +{ + Q_OBJECT + +public: + QtHelpButton(const QString& helpText, QWidget* parent = nullptr); + +private slots: + void handleHelpPress(); + +private: + QString m_helpText; +}; + class QtProjectWizzardContent : public QWidget @@ -19,15 +36,23 @@ public: QtProjectWizzardContent(ProjectSettings* settings, QtProjectWizzardWindow* window); virtual void populateWindow(QWidget* widget); - virtual void populateForm(QFormLayout* layout); + virtual void populateWindow(QGridLayout* layout); + virtual void populateForm(QGridLayout* layout, int& row); virtual void windowReady(); virtual void load(); virtual void save(); virtual bool check(); + virtual bool isScrollAble() const; + + virtual QSize preferredWindowSize() const; + protected: QLabel* createFormLabel(QString name) const; + QToolButton* createProjectButton(QString name, QString iconPath) const; + + QtHelpButton* addHelpButton(QString helpString, QGridLayout* layout, int row) const; ProjectSettings* m_settings; QtProjectWizzardWindow* m_window; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp index af5ae268..f50db922 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp @@ -21,7 +21,7 @@ QtProjectWizzardContentBuildFile::QtProjectWizzardContentBuildFile( } } -void QtProjectWizzardContentBuildFile::populateForm(QFormLayout* layout) +void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& row) { QString name; QString filter; @@ -29,10 +29,12 @@ void QtProjectWizzardContentBuildFile::populateForm(QFormLayout* layout) switch (m_type) { case QtProjectWizzardContentSelect::PROJECT_EMPTY: + name = "Build Text"; + filter = "Text (*.txt)"; return; case QtProjectWizzardContentSelect::PROJECT_VS: name = "Visual Studio Solution"; - filter = "Visual Studio Solution (*.txt)"; + filter = "Visual Studio Solution (*.sln)"; break; case QtProjectWizzardContentSelect::PROJECT_CDB: name = "Compilation Database"; @@ -40,21 +42,25 @@ void QtProjectWizzardContentBuildFile::populateForm(QFormLayout* layout) } QLabel* label = createFormLabel(name); + layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL); + m_picker = new QtLocationPicker(this); m_picker->setFileFilter(filter); int minimumWidthForSecondCol = 360; m_picker->setMinimumWidth(minimumWidthForSecondCol); - QPushButton* button = new QPushButton("r"); - button->setObjectName("moreButton"); + 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_picker->layout()->addWidget(button); - layout->addRow(label, m_picker); + layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL); + + row++; } void QtProjectWizzardContentBuildFile::load() diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h index c97a6282..e2bd25fb 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h @@ -19,7 +19,7 @@ public: QtProjectWizzardContentBuildFile(ProjectSettings* settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateForm(QFormLayout* layout) override; + virtual void populateForm(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 47d7822d..5ef1a384 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp @@ -8,33 +8,44 @@ QtProjectWizzardContentData::QtProjectWizzardContentData(ProjectSettings* settin { } -void QtProjectWizzardContentData::populateWindow(QWidget* widget) +void QtProjectWizzardContentData::populateWindow(QGridLayout* layout) { - QFormLayout* layout = new QFormLayout(); - layout->setContentsMargins(10, 10, 10, 10); - layout->setHorizontalSpacing(20); + int row = 0; + layout->setRowMinimumHeight(0, 15); + row++; - populateForm(layout); + populateForm(layout, row); - widget->setLayout(layout); + layout->setRowMinimumHeight(row, 15); + layout->setRowStretch(row, 1); + + layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); + layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3); } -void QtProjectWizzardContentData::populateForm(QFormLayout* layout) +void QtProjectWizzardContentData::populateForm(QGridLayout* layout, int& row) { int minimumWidthForSecondCol = 360; QLabel* nameLabel = createFormLabel("Name"); m_projectName = new QLineEdit(); + m_projectName->setObjectName("name"); m_projectName->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); m_projectName->setMinimumWidth(minimumWidthForSecondCol); m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0); - layout->addRow(nameLabel, m_projectName); + + layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(m_projectName, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); + row++; QLabel* locationLabel = createFormLabel("Location"); m_projectFileLocation = new QtLocationPicker(this); m_projectFileLocation->setPickDirectory(true); m_projectFileLocation->setMinimumWidth(minimumWidthForSecondCol); - layout->addRow(locationLabel, m_projectFileLocation); + + layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); + row++; QLabel* languageLabel = new QLabel("Language"); languageLabel->setObjectName("label"); @@ -42,9 +53,13 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout) m_language->insertItem(0, "C++"); m_language->insertItem(1, "C"); connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); - layout->addRow(languageLabel, m_language); - m_cppStandardLabel = createFormLabel("Standard"); + layout->addWidget(languageLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); + row++; + + + QLabel* cppStandardLabel = createFormLabel("Standard"); m_cppStandard = new QComboBox(); m_cppStandard->insertItem(0, "1z"); @@ -54,10 +69,12 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout) m_cppStandard->insertItem(4, "0x"); m_cppStandard->insertItem(5, "03"); m_cppStandard->insertItem(6, "98"); - layout->addRow(m_cppStandardLabel, m_cppStandard); + + layout->addWidget(cppStandardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(m_cppStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); - m_cStandardLabel = createFormLabel("Standard"); + QLabel* cStandardLabel = createFormLabel("Standard"); m_cStandard = new QComboBox(); m_cStandard->insertItem(0, "1x"); @@ -66,9 +83,11 @@ void QtProjectWizzardContentData::populateForm(QFormLayout* layout) m_cStandard->insertItem(3, "99"); m_cStandard->insertItem(4, "90"); m_cStandard->insertItem(5, "89"); - layout->addRow(m_cStandardLabel, m_cStandard); - m_cStandardLabel->hide(); - m_cStandard->hide(); + + layout->addWidget(cStandardLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + layout->addWidget(m_cStandard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft); + + row++; } void QtProjectWizzardContentData::load() @@ -128,23 +147,32 @@ bool QtProjectWizzardContentData::check() return false; } + if (!FilePath(m_projectFileLocation->getText().toStdString()).exists()) + { + QMessageBox msgBox; + msgBox.setText("The specified location does not exist."); + msgBox.exec(); + return false; + } + return true; } +QSize QtProjectWizzardContentData::preferredWindowSize() const +{ + return QSize(580, 340); +} + void QtProjectWizzardContentData::handleSelectionChanged(int index) { if (index != 0) { - m_cStandardLabel->show(); m_cStandard->show(); - m_cppStandardLabel->hide(); m_cppStandard->hide(); } else { - m_cppStandardLabel->show(); m_cppStandard->show(); - m_cStandardLabel->hide(); m_cStandard->hide(); } } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h index ec9c32a5..9a29e214 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.h @@ -16,12 +16,15 @@ public: QtProjectWizzardContentData(ProjectSettings* settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QWidget* widget) override; - virtual void populateForm(QFormLayout* layout) override; + virtual void populateWindow(QGridLayout* layout) override; + virtual void populateForm(QGridLayout* layout, int& row) override; + virtual void load() override; virtual void save() override; virtual bool check() override; + virtual QSize preferredWindowSize() const override; + private: QLineEdit* m_projectName; QtLocationPicker* m_projectFileLocation; @@ -30,9 +33,6 @@ private: QComboBox* m_cppStandard; QComboBox* m_cStandard; - QLabel* m_cppStandardLabel; - QLabel* m_cStandardLabel; - private slots: void handleSelectionChanged(int index); }; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index bb74429b..99f08dd0 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -1,34 +1,12 @@ #include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h" -#include -#include #include #include +#include #include "qt/element/QtDirectoryListBox.h" #include "settings/ApplicationSettings.h" -QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent) - : QPushButton("?", parent) - , m_helpText(helpText) -{ - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - setObjectName("help"); - - connect(this, SIGNAL(clicked()), this, SLOT(handleHelpPress())); -} - -void QtHelpButton::handleHelpPress() -{ - QMessageBox msgBox; - msgBox.setText("Help"); - msgBox.setInformativeText(m_helpText); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.exec(); -} - QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window) : QtProjectWizzardContent(settings, window) @@ -37,78 +15,79 @@ QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(ProjectSettings* sett { } -void QtProjectWizzardContentPaths::populateWindow(QWidget* widget) +void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout) { - QVBoxLayout* layout = new QVBoxLayout(widget); + int row = 0; - populateLayout(layout); + layout->setRowMinimumHeight(row, 10); + row++; + + populateLayout(layout, row); + + if (m_addShowSourcesButton) + { + layout->setRowStretch(row, 10); + addSourcesButton(layout, row); + } if (m_subPaths) { - layout->addSpacing(30); + layout->setRowMinimumHeight(row, 30); + row++; - m_subPaths->populateLayout(layout); + m_subPaths->populateLayout(layout, row); + + layout->setRowMinimumHeight(row, 10); + row++; } - layout->addStretch(); + layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); + layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 2); } -void QtProjectWizzardContentPaths::populateLayout(QVBoxLayout* layout) +void QtProjectWizzardContentPaths::populateLayout(QGridLayout* layout, int& row) { QLabel* label = new QLabel(m_titleString); - label->setObjectName("label"); - layout->addWidget(label); + label->setObjectName("section"); + layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop | Qt::AlignLeft); + layout->setRowMinimumHeight(row, 20); QLabel* text = new QLabel(m_descriptionString); text->setWordWrap(true); text->setOpenExternalLinks(true); - layout->addWidget(text); + layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); + layout->setRowStretch(row + 1, 1); m_list = new QtDirectoryListBox(this); - layout->addWidget(m_list); + layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop); - if (m_addShowSourcesButton) - { - QPushButton* button = new QPushButton("show files"); - layout->addWidget(button); - connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked())); - } + row += 2; } -void QtProjectWizzardContentPaths::populateForm(QFormLayout* layout) +void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row) { - QWidget* widget = new QWidget(); - - QVBoxLayout* vlayout = new QVBoxLayout(); - vlayout->setContentsMargins(0, 5, 0, 5); - vlayout->setSpacing(5); - QLabel* label = createFormLabel(m_titleString); - vlayout->addWidget(label); + layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); - QtHelpButton* button = new QtHelpButton(m_helpString); - - vlayout->addWidget(button, 0, Qt::AlignRight); - - if (m_addShowSourcesButton) + if (m_helpString.size() > 0) { - QPushButton* button = new QPushButton("files"); - vlayout->addWidget(button); - connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked())); + addHelpButton(m_helpString, layout, row); } - vlayout->addStretch(); - - widget->setLayout(vlayout); - int minimumWidthForSecondCol = 360; m_list = new QtDirectoryListBox(this); m_list->setMinimumWidth(minimumWidthForSecondCol); - layout->addRow(widget, m_list); + layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL); + row++; + + if (m_addShowSourcesButton) + { + addSourcesButton(layout, row); + } if (m_subPaths) { - m_subPaths->populateForm(layout); + m_subPaths->populateForm(layout, row); } } @@ -142,6 +121,11 @@ bool QtProjectWizzardContentPaths::check() return checkPaths(); } +QSize QtProjectWizzardContentPaths::preferredWindowSize() const +{ + return QSize(700, 500); +} + void QtProjectWizzardContentPaths::loadPaths() { } @@ -179,9 +163,22 @@ void QtProjectWizzardContentPaths::setHelpString(const QString& help) void QtProjectWizzardContentPaths::showSourcesClicked() { - emit showSourceFiles(m_list->getList()); + emit showSourceFiles(); } +void QtProjectWizzardContentPaths::addSourcesButton(QGridLayout* layout, int& row) +{ + if (!m_addShowSourcesButton) + { + return; + } + + QPushButton* button = new QPushButton("show files"); + button->setObjectName("windowButton"); + layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop); + connect(button, SIGNAL(clicked()), this, SLOT(showSourcesClicked())); + row++; +} QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource( ProjectSettings* settings, QtProjectWizzardWindow* window @@ -199,6 +196,11 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource( ); } +QSize QtProjectWizzardContentPathsSource::preferredWindowSize() const +{ + return QSize(700, 370); +} + void QtProjectWizzardContentPathsSource::loadPaths() { m_list->setList(m_settings->getSourcePaths()); @@ -263,6 +265,11 @@ void QtProjectWizzardContentPathsHeaderSearch::savePaths() m_settings->setHeaderSearchPaths(m_list->getList()); } +bool QtProjectWizzardContentPathsHeaderSearch::isScrollAble() const +{ + return true; +} + QtProjectWizzardContentPathsHeaderSearchSimple::QtProjectWizzardContentPathsHeaderSearchSimple( ProjectSettings* settings, QtProjectWizzardWindow* window ) @@ -311,7 +318,8 @@ QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFramewo setInfo( "Framework Search Paths", "Add search paths to Mac OS framework containers (.framework) that the project depends on.", - "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are found." + "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are " + "found." ); m_subPaths = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window); @@ -327,6 +335,11 @@ void QtProjectWizzardContentPathsFrameworkSearch::savePaths() m_settings->setFrameworkSearchPaths(m_list->getList()); } +bool QtProjectWizzardContentPathsFrameworkSearch::isScrollAble() const +{ + return true; +} + QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsFrameworkSearchGlobal( ProjectSettings* settings, QtProjectWizzardWindow* window ) @@ -337,7 +350,8 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF "These framework search paths will be used in all your projects. Use it to add system frameworks " "(See " "Finding System Header Locations).", - "Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are found.\n\n" + "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." ); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h index 0e5b4332..f0127878 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.h @@ -7,21 +7,6 @@ class QtDirectoryListBox; -class QtHelpButton - : public QPushButton -{ - Q_OBJECT - -public: - QtHelpButton(const QString& helpText, QWidget* parent = nullptr); - -private slots: - void handleHelpPress(); - -private: - QString m_helpText; -}; - class QtProjectWizzardContentPaths : public QtProjectWizzardContent @@ -29,20 +14,22 @@ class QtProjectWizzardContentPaths Q_OBJECT signals: - void showSourceFiles(std::vector); + void showSourceFiles(); public: QtProjectWizzardContentPaths(ProjectSettings* settings, QtProjectWizzardWindow* window); // QtSettingsWindow implementation - virtual void populateWindow(QWidget* widget) override; - void populateLayout(QVBoxLayout* layout); - virtual void populateForm(QFormLayout* layout) override; + virtual void populateWindow(QGridLayout* layout) override; + void populateLayout(QGridLayout* layout, int& row); + virtual void populateForm(QGridLayout* layout, int& row) override; virtual void load() override; virtual void save() override; virtual bool check() override; + virtual QSize preferredWindowSize() const override; + virtual void loadPaths(); virtual void savePaths(); virtual bool checkPaths(); @@ -62,6 +49,8 @@ private slots: void showSourcesClicked(); private: + void addSourcesButton(QGridLayout* layout, int& row); + QString m_titleString; QString m_descriptionString; QString m_helpString; @@ -75,6 +64,9 @@ public: QtProjectWizzardContentPathsSource(ProjectSettings* settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation + virtual QSize preferredWindowSize() const override; + + // QtProjectWizzardContentPaths implementation virtual void loadPaths() override; virtual void savePaths() override; virtual bool checkPaths() override; @@ -97,6 +89,8 @@ public: // QtProjectWizzardContent implementation virtual void loadPaths() override; virtual void savePaths() override; + + virtual bool isScrollAble() const override; }; class QtProjectWizzardContentPathsHeaderSearchSimple @@ -127,6 +121,8 @@ public: // QtProjectWizzardContent implementation virtual void loadPaths() override; virtual void savePaths() override; + + virtual bool isScrollAble() const override; }; class QtProjectWizzardContentPathsFrameworkSearchGlobal diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp new file mode 100644 index 00000000..9525c3a4 --- /dev/null +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp @@ -0,0 +1,65 @@ +#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h" + +#include + +QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window) + : QtProjectWizzardContent(settings, window) + , m_headerSearch(nullptr) + , m_frameworkSearch(nullptr) +{ + m_headerSearch = new QtProjectWizzardContentPathsHeaderSearchGlobal(settings, window); + + if (QSysInfo::macVersion() != QSysInfo::MV_None) + { + m_frameworkSearch = new QtProjectWizzardContentPathsFrameworkSearchGlobal(settings, window); + } +} + +void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout) +{ + int row = 0; + + layout->setRowMinimumHeight(row, 10); + row++; + + m_headerSearch->populateForm(layout, row); + + if (m_frameworkSearch) + { + m_frameworkSearch->populateForm(layout, row); + } + + layout->setRowMinimumHeight(row, 10); +} + +void QtProjectWizzardContentPreferences::windowReady() +{ + m_window->updateTitle("PREFERENCES"); + m_window->updateDoneButton("Save"); + m_window->hidePrevious(); +} + +void QtProjectWizzardContentPreferences::load() +{ + m_headerSearch->load(); + + if (m_frameworkSearch) + { + m_frameworkSearch->load(); + } +} + +void QtProjectWizzardContentPreferences::save() +{ + m_headerSearch->save(); + + if (m_frameworkSearch) + { + m_frameworkSearch->save(); + } +} + +bool QtProjectWizzardContentPreferences::isScrollAble() const +{ + return true; +} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h new file mode 100644 index 00000000..1eb49538 --- /dev/null +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h @@ -0,0 +1,28 @@ +#ifndef QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H +#define QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H + +#include "qt/window/project_wizzard/QtProjectWizzardContent.h" +#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h" + +class QtProjectWizzardContentPreferences + : public QtProjectWizzardContent +{ +public: + QtProjectWizzardContentPreferences(ProjectSettings* settings, QtProjectWizzardWindow* window); + +protected: + // QtProjectContentWindow implementation + virtual void populateWindow(QGridLayout* layout) override; + virtual void windowReady() override; + + virtual void load() override; + virtual void save() override; + + virtual bool isScrollAble() const override; + +private: + QtProjectWizzardContentPathsHeaderSearchGlobal* m_headerSearch; + QtProjectWizzardContentPathsFrameworkSearchGlobal* m_frameworkSearch; +}; + +#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp index d94c0ed2..b726594a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp @@ -4,56 +4,23 @@ #include #include #include -#include #include "qt/window/project_wizzard/QtProjectWizzardWindow.h" +#include "utility/ResourcePaths.h" QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window) : QtProjectWizzardContent(settings, window) { } -void QtProjectWizzardContentSelect::populateWindow(QWidget* widget) +void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout) { - QVBoxLayout* vlayout = new QVBoxLayout(); - - QLabel* title = new QLabel("Project Type"); - title->setObjectName("label"); - vlayout->addWidget(title); - - QRadioButton* a = new QRadioButton("empty project"); - QRadioButton* b = new QRadioButton("from Visual Studio Solution"); - QRadioButton* c = new QRadioButton("from Compilation Database"); - - m_buttons = new QButtonGroup(this); - m_buttons->addButton(a); - m_buttons->addButton(b); - m_buttons->addButton(c); - - m_buttons->setId(a, PROJECT_EMPTY); - m_buttons->setId(b, PROJECT_VS); - m_buttons->setId(c, PROJECT_CDB); - - connect(m_buttons, static_cast(&QButtonGroup::buttonClicked), - [this](int id) - { - m_window->enableNext(); - } - ); - - vlayout->addWidget(a); - vlayout->addWidget(b); - vlayout->addWidget(c); - - vlayout->addStretch(); - - - QVBoxLayout* vlayout2 = new QVBoxLayout(); - - QPushButton* d = new QPushButton("C++"); QPushButton* e = new QPushButton("C"); + d->setObjectName("menuButton"); + e->setObjectName("menuButton"); + d->setCheckable(true); e->setCheckable(true); @@ -80,16 +47,63 @@ void QtProjectWizzardContentSelect::populateWindow(QWidget* widget) } ); - vlayout2->addWidget(d); - vlayout2->addWidget(e); - vlayout2->addStretch(); + QVBoxLayout* vlayout = new QVBoxLayout(); + vlayout->setContentsMargins(0, 30, 0, 0); + + vlayout->addWidget(d); + vlayout->addWidget(e); + + vlayout->addStretch(); + + layout->addLayout(vlayout, 0, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); + + + QToolButton* a = createProjectButton( + "empty project", (ResourcePaths::getGuiPath() + "icon/project_256_256.png").c_str()); + QToolButton* b = createProjectButton( + "from Visual\nStudio Solution", (ResourcePaths::getGuiPath() + "icon/project_vs_256_256.png").c_str()); + QToolButton* c = createProjectButton( + "from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str()); + + m_buttons = new QButtonGroup(this); + m_buttons->addButton(a); + m_buttons->addButton(b); + m_buttons->addButton(c); + + m_buttons->setId(a, PROJECT_EMPTY); + m_buttons->setId(b, PROJECT_VS); + m_buttons->setId(c, PROJECT_CDB); + + connect(m_buttons, static_cast(&QButtonGroup::buttonClicked), + [this](int id) + { + m_window->enableNext(); + } + ); QHBoxLayout* hlayout = new QHBoxLayout(); - hlayout->addLayout(vlayout2); - hlayout->addLayout(vlayout); + hlayout->addWidget(a); + hlayout->addWidget(b); + hlayout->addWidget(c); - widget->setLayout(hlayout); + QFrame* container = new QFrame(); + container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + container->setObjectName("projectContainer"); + container->setLayout(hlayout); + + layout->addWidget(container, 0, QtProjectWizzardWindow::BACK_COL); + + + QLabel* title = new QLabel("Project Type"); + title->setObjectName("projectTitle"); + + layout->addWidget(title, 0, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft | Qt::AlignTop); + + + layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 0); + layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 1); + layout->setHorizontalSpacing(0); } void QtProjectWizzardContentSelect::save() @@ -120,3 +134,8 @@ bool QtProjectWizzardContentSelect::check() return true; } + +QSize QtProjectWizzardContentSelect::preferredWindowSize() const +{ + return QSize(600, 340); +} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h index 2e42ab71..f3f7c923 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h @@ -20,15 +20,17 @@ public: QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window); -signals: - void selected(QtProjectWizzardContentSelect::ProjectType); - -protected: // QtProjectWizzardContent implementation - virtual void populateWindow(QWidget* widget) override; + virtual void populateWindow(QGridLayout* layout) override; + virtual void save() override; virtual bool check() override; + virtual QSize preferredWindowSize() const override; + +signals: + void selected(QtProjectWizzardContentSelect::ProjectType); + private: QButtonGroup* m_languages; QButtonGroup* m_buttons; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp index da5b8465..02242cba 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp @@ -15,21 +15,21 @@ QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(ProjectSettings* se { } -void QtProjectWizzardContentSimple::populateWindow(QWidget* widget) +void QtProjectWizzardContentSimple::populateWindow(QGridLayout* layout) { - QVBoxLayout* layout = new QVBoxLayout(widget); + layout->setRowMinimumHeight(0, 10); - QLabel* title = new QLabel("Simple Setup?"); - title->setObjectName("label"); - layout->addWidget(title); + QLabel* title = new QLabel("Simple Setup"); + title->setObjectName("section"); + layout->addWidget(title, 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop | Qt::AlignRight); QLabel* text = new QLabel( - "In simple setup you just provide the directory of your project and Coati will find the source files and " - "resolve header search paths within. Please note that simple setup makes Coati's analysis slower.\n\n" + "In 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." ); text->setWordWrap(true); - layout->addWidget(text); + layout->addWidget(text, 1, QtProjectWizzardWindow::BACK_COL); QRadioButton* a = new QRadioButton("simple setup"); QRadioButton* b = new QRadioButton("advanced setup"); @@ -48,22 +48,29 @@ void QtProjectWizzardContentSimple::populateWindow(QWidget* widget) } ); - layout->addWidget(a); - layout->addWidget(b); + QVBoxLayout* vlayout = new QVBoxLayout(); - layout->addStretch(); + vlayout->addWidget(a); + vlayout->addWidget(b); - widget->setLayout(layout); + vlayout->addStretch(); + + layout->addLayout(vlayout, 2, QtProjectWizzardWindow::BACK_COL); + + layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1); + layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3); } -void QtProjectWizzardContentSimple::populateForm(QFormLayout* layout) +void QtProjectWizzardContentSimple::populateForm(QGridLayout* layout, int& row) { - QLabel* label = createFormLabel("search headers in project paths"); - m_checkBox = new QCheckBox(); + QLabel* label = createFormLabel("Search headers in project paths"); + layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL); - layout->addRow(label, m_checkBox); + m_checkBox = new QCheckBox(); + layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); m_isForm = true; + row++; } void QtProjectWizzardContentSimple::windowReady() @@ -101,6 +108,7 @@ void QtProjectWizzardContentSimple::save() { case 0: simpleSetup = true; break; case 1: simpleSetup = false; break; + default: return; } } @@ -119,3 +127,8 @@ bool QtProjectWizzardContentSimple::check() return true; } + +QSize QtProjectWizzardContentSimple::preferredWindowSize() const +{ + return QSize(580, 350); +} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h index 87de6811..514114b5 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.h @@ -15,14 +15,16 @@ public: QtProjectWizzardContentSimple(ProjectSettings* settings, QtProjectWizzardWindow* window); // QtProjectWizzardContent implementation - virtual void populateWindow(QWidget* widget) override; - virtual void populateForm(QFormLayout* layout) override; + virtual void populateWindow(QGridLayout* layout) 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; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp index d3e941e3..2c82e7b3 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp @@ -16,24 +16,34 @@ QtProjectWizzardContentSourceList::QtProjectWizzardContentSourceList( void QtProjectWizzardContentSourceList::populateWindow(QWidget* widget) { QVBoxLayout* layout = new QVBoxLayout(widget); - - QLabel* label = new QLabel("Analyzed Files"); - label->setObjectName("label"); - layout->addWidget(label); + layout->setContentsMargins(0, 0, 0, 0); m_text = new QLabel("0 files will be analyzed."); m_text->setWordWrap(true); layout->addWidget(m_text); m_list = new QListView(this); + m_list->setObjectName("files"); m_list->setEditTriggers(QAbstractItemView::NoEditTriggers); m_list->setSelectionMode(QAbstractItemView::NoSelection); m_list->setAttribute(Qt::WA_MacShowFocusRect, 0); layout->addWidget(m_list); } -void QtProjectWizzardContentSourceList::showFilesFromSourcePaths(const std::vector& sourcePaths) +void QtProjectWizzardContentSourceList::windowReady() { + m_window->updateTitle("Analyzed Files"); +} + +QSize QtProjectWizzardContentSourceList::preferredWindowSize() const +{ + return QSize(500, 500); +} + +void QtProjectWizzardContentSourceList::showFilesFromSourcePaths() +{ + std::vector sourcePaths = m_settings->getSourcePaths(); + std::vector extensions; utility::append(extensions, m_settings->getSourceExtensions()); utility::append(extensions, m_settings->getHeaderExtensions()); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h index 7eb6abf6..b1ee0dba 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSourceList.h @@ -14,8 +14,11 @@ public: // QtSettingsWindow implementation virtual void populateWindow(QWidget* widget) override; + virtual void windowReady() override; - void showFilesFromSourcePaths(const std::vector& sourcePaths); + virtual QSize preferredWindowSize() const override; + + void showFilesFromSourcePaths(); private: QLabel* m_text; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp index c7c3ec94..1d50cd0a 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp @@ -1,6 +1,5 @@ #include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h" -#include #include QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(ProjectSettings* settings, QtProjectWizzardWindow* window) @@ -34,24 +33,25 @@ QtProjectWizzardContentPathsSource* QtProjectWizzardContentSummary::contentPaths return m_source; } -void QtProjectWizzardContentSummary::populateWindow(QWidget* widget) +void QtProjectWizzardContentSummary::populateWindow(QGridLayout* layout) { - QFormLayout* layout = new QFormLayout(); - layout->setContentsMargins(10, 10, 10, 10); - layout->setHorizontalSpacing(20); + int row = 0; - m_data->populateForm(layout); - m_buildFile->populateForm(layout); - m_source->populateForm(layout); - m_simple->populateForm(layout); - m_headerSearch->populateForm(layout); + layout->setRowMinimumHeight(row, 10); + row++; + + m_data->populateForm(layout, row); + m_buildFile->populateForm(layout, row); + m_source->populateForm(layout, row); + m_simple->populateForm(layout, row); + m_headerSearch->populateForm(layout, row); if (m_frameworkSearch) { - m_frameworkSearch->populateForm(layout); + m_frameworkSearch->populateForm(layout, row); } - widget->setLayout(layout); + layout->setRowMinimumHeight(row, 10); } void QtProjectWizzardContentSummary::windowReady() @@ -98,3 +98,8 @@ bool QtProjectWizzardContentSummary::check() m_headerSearch->check() && (!m_frameworkSearch || m_frameworkSearch->check()); } + +bool QtProjectWizzardContentSummary::isScrollAble() const +{ + return true; +} diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h index 61152a03..452facdc 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSummary.h @@ -18,11 +18,14 @@ public: protected: // QtProjectContentWindow implementation - virtual void populateWindow(QWidget* widget); - virtual void windowReady(); - virtual void load(); - virtual void save(); - virtual bool check(); + virtual void populateWindow(QGridLayout* layout) override; + virtual void windowReady() override; + + virtual void load() override; + virtual void save() override; + virtual bool check() override; + + virtual bool isScrollAble() const override; private: QtProjectWizzardContentData* m_data; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp index aa05c97b..9ba37f6b 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.cpp @@ -1,14 +1,20 @@ #include "qt/window/project_wizzard/QtProjectWizzardWindow.h" +#include +#include #include +#include +#include "qt/utility/utilityQt.h" #include "qt/window/project_wizzard/QtProjectWizzardContent.h" +#include "utility/ResourcePaths.h" QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent) : QtSettingsWindow(parent) , m_content(nullptr) , m_previousButton(nullptr) , m_showAsPopup(false) + , m_scrollAble(false) { } @@ -20,11 +26,47 @@ QtProjectWizzardContent* QtProjectWizzardWindow::content() const void QtProjectWizzardWindow::setContent(QtProjectWizzardContent* content) { m_content = content; + m_scrollAble = content->isScrollAble(); } void QtProjectWizzardWindow::setup() { - setupForm(); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "project_wizzard/window.css").c_str()); + QVBoxLayout* windowLayout = new QVBoxLayout(); + windowLayout->setContentsMargins(25, 30, 25, 20); + + m_title = new QLabel(); + m_title->setObjectName("title"); + windowLayout->addWidget(m_title); + windowLayout->addSpacing(10); + + QWidget* contentWidget = new QWidget(); + contentWidget->setObjectName("form"); + + populateWindow(contentWidget); + + if (m_scrollAble) + { + QScrollArea* scrollArea = new QScrollArea(); + scrollArea->setObjectName("formArea"); + scrollArea->setFrameShadow(QFrame::Plain); + scrollArea->setWidgetResizable(true); + + scrollArea->setWidget(contentWidget); + windowLayout->addWidget(scrollArea); + } + else + { + windowLayout->addWidget(contentWidget); + windowLayout->setStretchFactor(contentWidget, 1); + } + + showButtons(windowLayout); + + m_window->setLayout(windowLayout); + + resize(content()->preferredWindowSize()); + updateTitle("NEW PROJECT"); updateDoneButton("Next"); @@ -41,9 +83,6 @@ void QtProjectWizzardWindow::setup() updateDoneButton("Ok"); hideCancelButton(true); hidePrevious(); - m_title->hide(); - - setMaximumSize(QSize(500, 500)); } m_content->windowReady(); @@ -51,7 +90,31 @@ void QtProjectWizzardWindow::setup() void QtProjectWizzardWindow::populateWindow(QWidget* widget) { - m_content->populateWindow(widget); + QGridLayout* layout = new QGridLayout(); + layout->setContentsMargins(0, 0, 0, 0); + + m_content->populateWindow(layout); + + if (layout->columnCount() < 2) + { + m_content->populateWindow(widget); + } + else + { + QFrame* separator = new QFrame(); + separator->setFrameShape(QFrame::VLine); + + QPalette palette = separator->palette(); + palette.setColor(QPalette::WindowText, Qt::lightGray); + separator->setPalette(palette); + + layout->addWidget(separator, 0, LINE_COL, -1, 1); + + layout->setColumnStretch(HELP_COL, 0); + layout->setColumnStretch(LINE_COL, 0); + + widget->setLayout(layout); + } } void QtProjectWizzardWindow::enableNext() @@ -94,16 +157,16 @@ void QtProjectWizzardWindow::hidePrevious() } } -bool QtProjectWizzardWindow::getShowAsPopup() const -{ - return m_showAsPopup; -} - void QtProjectWizzardWindow::setShowAsPopup(bool showAsPopup) { m_showAsPopup = showAsPopup; } +void QtProjectWizzardWindow::setScrollAble(bool scrollAble) +{ + m_scrollAble = scrollAble; +} + void QtProjectWizzardWindow::handleCancelButtonPress() { emit canceled(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h index 292a3802..029eaefe 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardWindow.h @@ -33,8 +33,13 @@ public: void disablePrevious(); void hidePrevious(); - bool getShowAsPopup() const; void setShowAsPopup(bool showAsPopup); + void setScrollAble(bool scrollAble); + + static const int FRONT_COL = 0; + static const int HELP_COL = 1; + static const int LINE_COL = 2; + static const int BACK_COL = 3; private slots: void handleCancelButtonPress(); @@ -46,6 +51,7 @@ private: QPushButton* m_previousButton; bool m_showAsPopup; + bool m_scrollAble; }; #endif // QT_PROJECT_WIZZARD_WINDOW_H