From 41cadaadad80ee70bed092c753e3e462dd97b57f Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 28 Jul 2022 13:02:49 +0200 Subject: [PATCH] QMake: inline librarydetailswidget.ui Change-Id: I9c2ff650c297eb6c707304efc6a650f287b734e7 Reviewed-by: Alessandro Portale Reviewed-by: --- .../qmakeprojectmanager/CMakeLists.txt | 1 - .../qmakeprojectmanager/addlibrarywizard.cpp | 106 ++++++- .../qmakeprojectmanager/addlibrarywizard.h | 51 +++- .../librarydetailscontroller.cpp | 26 +- .../librarydetailscontroller.h | 19 +- .../librarydetailswidget.ui | 263 ------------------ .../qmakeprojectmanager.qbs | 1 - 7 files changed, 165 insertions(+), 302 deletions(-) delete mode 100644 src/plugins/qmakeprojectmanager/librarydetailswidget.ui diff --git a/src/plugins/qmakeprojectmanager/CMakeLists.txt b/src/plugins/qmakeprojectmanager/CMakeLists.txt index 6556e2c2b1a..824506d90e7 100644 --- a/src/plugins/qmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/qmakeprojectmanager/CMakeLists.txt @@ -14,7 +14,6 @@ add_qtc_plugin(QmakeProjectManager customwidgetwizard/pluginoptions.h externaleditors.cpp externaleditors.h librarydetailscontroller.cpp librarydetailscontroller.h - librarydetailswidget.ui makefileparse.cpp makefileparse.h profilecompletionassist.cpp profilecompletionassist.h profileeditor.cpp profileeditor.h diff --git a/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp b/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp index 8839a89e8ab..feb0011f872 100644 --- a/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp +++ b/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp @@ -24,22 +24,27 @@ ****************************************************************************/ #include "addlibrarywizard.h" -#include "ui_librarydetailswidget.h" + #include "librarydetailscontroller.h" +#include #include -#include +#include +#include #include -#include +#include +#include +#include #include +#include +#include #include #include #include #include -namespace QmakeProjectManager { -namespace Internal { +namespace QmakeProjectManager::Internal { const char qt_file_dialog_filter_reg_exp[] = "^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; @@ -190,8 +195,8 @@ AddLibraryWizard::LibraryKind LibraryTypePage::libraryKind() const DetailsPage::DetailsPage(AddLibraryWizard *parent) : QWizardPage(parent), m_libraryWizard(parent) { - m_libraryDetailsWidget = new Ui::LibraryDetailsWidget(); - m_libraryDetailsWidget->setupUi(this); + m_libraryDetailsWidget = new LibraryDetailsWidget(this); + resize(456, 438); Utils::PathChooser * const libPathChooser = m_libraryDetailsWidget->libraryPathChooser; libPathChooser->setHistoryCompleter("Qmake.LibDir.History"); @@ -316,5 +321,88 @@ QString SummaryPage::snippet() const return m_snippet; } -} // Internal -} // QmakeProjectManager +LibraryDetailsWidget::LibraryDetailsWidget(QWidget *parent) +{ + includePathChooser = new Utils::PathChooser(parent); + + packageLineEdit = new QLineEdit(parent); + + libraryPathChooser = new Utils::PathChooser(parent); + + libraryComboBox = new QComboBox(parent); + + libraryTypeComboBox = new QComboBox(parent); + + + platformGroupBox = new QGroupBox(tr("Platform:")); + platformGroupBox->setFlat(true); + + linkageGroupBox = new QGroupBox(tr("Linkage:")); + linkageGroupBox->setFlat(true); + + macGroupBox = new QGroupBox(tr("Mac:")); + macGroupBox->setFlat(true); + + winGroupBox = new QGroupBox(tr("Windows:")); + winGroupBox->setFlat(true); + + + linCheckBox = new QCheckBox(tr("Linux")); + linCheckBox->setChecked(true); + + macCheckBox = new QCheckBox(tr("Mac")); + macCheckBox->setChecked(true); + + winCheckBox = new QCheckBox(tr("Windows")); + winCheckBox->setChecked(true); + + dynamicRadio = new QRadioButton(tr("Dynamic"), linkageGroupBox); + staticRadio = new QRadioButton(tr("Static"), linkageGroupBox); + + libraryRadio = new QRadioButton(tr("Library"), macGroupBox); + frameworkRadio = new QRadioButton(tr("Framework"), macGroupBox); + + useSubfoldersCheckBox = new QCheckBox(tr("Library inside \"debug\" or \"release\" subfolder"), + winGroupBox); + useSubfoldersCheckBox->setChecked(true); + + addSuffixCheckBox = new QCheckBox(tr("Add \"d\" suffix for debug version"), winGroupBox); + removeSuffixCheckBox = new QCheckBox(tr("Remove \"d\" suffix for release version"), winGroupBox); + + using namespace Utils::Layouting; + + Column { linCheckBox, macCheckBox, winCheckBox, st }.attachTo(platformGroupBox); + + Row { dynamicRadio, staticRadio }.attachTo(linkageGroupBox); + + Row { libraryRadio, frameworkRadio }.attachTo(macGroupBox); + + Column { useSubfoldersCheckBox, addSuffixCheckBox, removeSuffixCheckBox }.attachTo(winGroupBox); + + libraryLabel = new QLabel(tr("Library:")); + libraryFileLabel = new QLabel(tr("Library file:")); + libraryTypeLabel = new QLabel(tr("Library type:")); + packageLabel = new QLabel(tr("Package:")); + includeLabel = new QLabel(tr("Include path:")); + + Column { + Form { + libraryLabel, libraryComboBox, br, + libraryTypeLabel, libraryTypeComboBox, br, + libraryFileLabel, libraryPathChooser, br, + packageLabel, packageLineEdit, br, + includeLabel, includePathChooser + }, + Row { + platformGroupBox, + Column { + linkageGroupBox, + macGroupBox, + winGroupBox, + } + }, + st + }.attachTo(parent); +} + +} // QmakeProjectManager::Internal diff --git a/src/plugins/qmakeprojectmanager/addlibrarywizard.h b/src/plugins/qmakeprojectmanager/addlibrarywizard.h index 5825fae4d99..62a455ab551 100644 --- a/src/plugins/qmakeprojectmanager/addlibrarywizard.h +++ b/src/plugins/qmakeprojectmanager/addlibrarywizard.h @@ -28,21 +28,59 @@ #include #include +#include + QT_BEGIN_NAMESPACE +class QCheckBox; +class QComboBox; +class QGroupBox; class QRadioButton; class QLabel; QT_END_NAMESPACE -namespace QmakeProjectManager { -namespace Internal { +namespace Utils { class PathChooser; } + +namespace QmakeProjectManager::Internal { -class LibraryDetailsWidget; class LibraryDetailsController; class LibraryTypePage; class DetailsPage; class SummaryPage; -namespace Ui { class LibraryDetailsWidget; } +class LibraryDetailsWidget +{ + Q_DECLARE_TR_FUNCTIONS(QmakeProjectManager::Internal::LibraryDetailsWidget) + +public: + explicit LibraryDetailsWidget(QWidget *parent); + +public: + QGroupBox *platformGroupBox; + QGroupBox *linkageGroupBox; + QGroupBox *macGroupBox; + QGroupBox *winGroupBox; + + Utils::PathChooser *includePathChooser; + QLineEdit *packageLineEdit; + Utils::PathChooser *libraryPathChooser; + QComboBox *libraryComboBox; + QComboBox *libraryTypeComboBox; + QLabel *libraryLabel; + QLabel *libraryFileLabel; + QLabel *libraryTypeLabel; + QLabel *packageLabel; + QLabel *includeLabel; + QCheckBox *linCheckBox; + QCheckBox *macCheckBox; + QCheckBox *winCheckBox; + QRadioButton *dynamicRadio; + QRadioButton *staticRadio; + QRadioButton *libraryRadio; + QRadioButton *frameworkRadio; + QCheckBox *useSubfoldersCheckBox; + QCheckBox *addSuffixCheckBox; + QCheckBox *removeSuffixCheckBox; +}; class AddLibraryWizard : public Utils::Wizard { @@ -115,7 +153,7 @@ public: private: AddLibraryWizard *m_libraryWizard; - Ui::LibraryDetailsWidget *m_libraryDetailsWidget = nullptr; + LibraryDetailsWidget *m_libraryDetailsWidget = nullptr; LibraryDetailsController *m_libraryDetailsController = nullptr; }; @@ -133,7 +171,6 @@ private: QString m_snippet; }; -} // namespace Internal -} // namespace QmakeProjectManager +} // QmakeProjectManager::Internal Q_DECLARE_OPERATORS_FOR_FLAGS(QmakeProjectManager::Internal::AddLibraryWizard::Platforms) diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp index 4a9132b3b8e..5da63b1b407 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp @@ -24,7 +24,7 @@ ****************************************************************************/ #include "librarydetailscontroller.h" -#include "ui_librarydetailswidget.h" + #include "qmakebuildconfiguration.h" #include "qmakeparsernodes.h" #include "qmakeproject.h" @@ -37,8 +37,12 @@ #include #include -#include +#include +#include #include +#include +#include +#include #include using namespace ProjectExplorer; @@ -58,7 +62,7 @@ static void fillLibraryPlatformTypes(QComboBox *comboBox) } LibraryDetailsController::LibraryDetailsController( - Ui::LibraryDetailsWidget *libraryDetails, + LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : QObject(parent), m_proFile(proFile), @@ -92,7 +96,7 @@ LibraryDetailsController::LibraryDetailsController( this, &LibraryDetailsController::slotPlatformChanged); } -Ui::LibraryDetailsWidget *LibraryDetailsController::libraryDetailsWidget() const +LibraryDetailsWidget *LibraryDetailsController::libraryDetailsWidget() const { return m_libraryDetailsWidget; } @@ -187,7 +191,7 @@ void LibraryDetailsController::updateGui() // we use it as a hacky solution to the above issue. // For reference please see: QTBUG-88666 if (!m_wizard) { - QWidget *widget = libraryDetailsWidget()->detailsLayout->parentWidget(); + QWidget *widget = libraryDetailsWidget()->platformGroupBox->parentWidget(); while (widget) { QWizard *wizard = qobject_cast(widget); if (wizard) { @@ -612,8 +616,7 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform return snippetMessage; } -NonInternalLibraryDetailsController::NonInternalLibraryDetailsController( - Ui::LibraryDetailsWidget *libraryDetails, +NonInternalLibraryDetailsController::NonInternalLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : LibraryDetailsController(libraryDetails, proFile, parent) { @@ -850,8 +853,7 @@ QString NonInternalLibraryDetailsController::snippet() const ///////////// -PackageLibraryDetailsController::PackageLibraryDetailsController( - Ui::LibraryDetailsWidget *libraryDetails, +PackageLibraryDetailsController::PackageLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : NonInternalLibraryDetailsController(libraryDetails, proFile, parent) { @@ -910,7 +912,7 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const ///////////// SystemLibraryDetailsController::SystemLibraryDetailsController( - Ui::LibraryDetailsWidget *libraryDetails, + LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : NonInternalLibraryDetailsController(libraryDetails, proFile, parent) { @@ -923,7 +925,7 @@ SystemLibraryDetailsController::SystemLibraryDetailsController( ///////////// ExternalLibraryDetailsController::ExternalLibraryDetailsController( - Ui::LibraryDetailsWidget *libraryDetails, + LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : NonInternalLibraryDetailsController(libraryDetails, proFile, parent) { @@ -958,7 +960,7 @@ void ExternalLibraryDetailsController::updateWindowsOptionsEnablement() ///////////// -InternalLibraryDetailsController::InternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, +InternalLibraryDetailsController::InternalLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const FilePath &proFile, QObject *parent) : LibraryDetailsController(libraryDetails, proFile, parent) { diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.h b/src/plugins/qmakeprojectmanager/librarydetailscontroller.h index d93bf4f3cab..93e62b51cb8 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.h +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.h @@ -31,15 +31,16 @@ namespace QmakeProjectManager { class QmakeProFile; + namespace Internal { -namespace Ui { class LibraryDetailsWidget; } +class LibraryDetailsWidget; class LibraryDetailsController : public QObject { Q_OBJECT public: - explicit LibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit LibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); virtual bool isComplete() const = 0; @@ -49,7 +50,7 @@ signals: void completeChanged(); protected: - Ui::LibraryDetailsWidget *libraryDetailsWidget() const; + LibraryDetailsWidget *libraryDetailsWidget() const; AddLibraryWizard::Platforms platforms() const; AddLibraryWizard::LinkageType linkageType() const; @@ -109,7 +110,7 @@ private: bool m_includePathVisible = true; bool m_windowsGroupVisible = true; - Ui::LibraryDetailsWidget *m_libraryDetailsWidget; + LibraryDetailsWidget *m_libraryDetailsWidget; QWizard *m_wizard = nullptr; }; @@ -117,7 +118,7 @@ class NonInternalLibraryDetailsController : public LibraryDetailsController { Q_OBJECT public: - explicit NonInternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit NonInternalLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); bool isComplete() const override; @@ -142,7 +143,7 @@ class PackageLibraryDetailsController : public NonInternalLibraryDetailsControll { Q_OBJECT public: - explicit PackageLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit PackageLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); bool isComplete() const override; @@ -159,7 +160,7 @@ class SystemLibraryDetailsController : public NonInternalLibraryDetailsControlle { Q_OBJECT public: - explicit SystemLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit SystemLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); protected: @@ -172,7 +173,7 @@ class ExternalLibraryDetailsController : public NonInternalLibraryDetailsControl { Q_OBJECT public: - explicit ExternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit ExternalLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); protected: @@ -183,7 +184,7 @@ class InternalLibraryDetailsController : public LibraryDetailsController { Q_OBJECT public: - explicit InternalLibraryDetailsController(Ui::LibraryDetailsWidget *libraryDetails, + explicit InternalLibraryDetailsController(LibraryDetailsWidget *libraryDetails, const Utils::FilePath &proFile, QObject *parent = nullptr); bool isComplete() const override; diff --git a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui b/src/plugins/qmakeprojectmanager/librarydetailswidget.ui deleted file mode 100644 index 0fdace08198..00000000000 --- a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui +++ /dev/null @@ -1,263 +0,0 @@ - - - QmakeProjectManager::Internal::LibraryDetailsWidget - - - - 0 - 0 - 456 - 438 - - - - - QLayout::SetMinimumSize - - - - - - - Library file: - - - - - - - Library: - - - - - - - Include path: - - - - - - - - - - - - - Package: - - - - - - - - - - - - - Library type: - - - - - - - - - - - - - - Platform - - - true - - - - - - Linux - - - true - - - - - - - Mac - - - true - - - - - - - Windows - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - QLayout::SetMinimumSize - - - - - Linkage: - - - true - - - - - - Dynamic - - - - - - - Static - - - - - - - - - - Mac: - - - true - - - - - - Library - - - - - - - Framework - - - - - - - - - - Windows: - - - true - - - - - - Library inside "debug" or "release" subfolder - - - true - - - - - - - Add "d" suffix for debug version - - - - - - - Remove "d" suffix for release version - - - - - - - - - - Qt::Vertical - - - - 17 - 0 - - - - - - - - - - Qt::Vertical - - - - 20 - 55 - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 -
-
- - -
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 588230ffd90..8d7a0b9edbf 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -22,7 +22,6 @@ Project { "addlibrarywizard.cpp", "addlibrarywizard.h", "externaleditors.cpp", "externaleditors.h", "librarydetailscontroller.cpp", "librarydetailscontroller.h", - "librarydetailswidget.ui", "makefileparse.cpp", "makefileparse.h", "profilecompletionassist.cpp", "profilecompletionassist.h", "profileeditor.cpp", "profileeditor.h",