diff --git a/src/plugins/qmakeprojectmanager/CMakeLists.txt b/src/plugins/qmakeprojectmanager/CMakeLists.txt index 824506d90e7..5ee7324b559 100644 --- a/src/plugins/qmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/qmakeprojectmanager/CMakeLists.txt @@ -3,10 +3,10 @@ add_qtc_plugin(QmakeProjectManager PLUGIN_DEPENDS Core CppEditor QtSupport ResourceEditor TextEditor SOURCES addlibrarywizard.cpp addlibrarywizard.h - customwidgetwizard/classdefinition.cpp customwidgetwizard/classdefinition.h customwidgetwizard/classdefinition.ui + customwidgetwizard/classdefinition.cpp customwidgetwizard/classdefinition.h customwidgetwizard/classlist.cpp customwidgetwizard/classlist.h - customwidgetwizard/customwidgetpluginwizardpage.cpp customwidgetwizard/customwidgetpluginwizardpage.h customwidgetwizard/customwidgetpluginwizardpage.ui - customwidgetwizard/customwidgetwidgetswizardpage.cpp customwidgetwizard/customwidgetwidgetswizardpage.h customwidgetwizard/customwidgetwidgetswizardpage.ui + customwidgetwizard/customwidgetpluginwizardpage.cpp customwidgetwizard/customwidgetpluginwizardpage.h + customwidgetwizard/customwidgetwidgetswizardpage.cpp customwidgetwizard/customwidgetwidgetswizardpage.h customwidgetwizard/customwidgetwizard.cpp customwidgetwizard/customwidgetwizard.h customwidgetwizard/customwidgetwizarddialog.cpp customwidgetwizard/customwidgetwizarddialog.h customwidgetwizard/filenamingparameters.h diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp index d1e868412af..29e0ee3ee2a 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp @@ -3,7 +3,15 @@ #include "classdefinition.h" +#include +#include + +#include #include +#include +#include +#include +#include namespace QmakeProjectManager { namespace Internal { @@ -12,44 +20,102 @@ ClassDefinition::ClassDefinition(QWidget *parent) : QTabWidget(parent), m_domXmlChanged(false) { - m_ui.setupUi(this); - m_ui.iconPathChooser->setExpectedKind(Utils::PathChooser::File); - m_ui.iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History")); - m_ui.iconPathChooser->setPromptDialogTitle(tr("Select Icon")); - m_ui.iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)")); + using namespace Utils::Layouting; - connect(m_ui.libraryRadio, &QRadioButton::toggled, this, &ClassDefinition::enableButtons); - connect(m_ui.skeletonCheck, &QCheckBox::toggled, this, &ClassDefinition::enableButtons); - connect(m_ui.widgetLibraryEdit, &QLineEdit::textChanged, + // "Sources" tab + auto sourceTab = new QWidget; + m_libraryRadio = new QRadioButton(tr("&Link library")); + auto includeRadio = new QRadioButton(tr("Include pro&ject")); + includeRadio->setChecked(true); + m_skeletonCheck = new QCheckBox(tr("Create s&keleton")); + m_widgetLibraryLabel = new QLabel(tr("Widget librar&y:")); + m_widgetLibraryEdit = new QLineEdit; + m_widgetProjectLabel = new QLabel(tr("Widget project &file:")); + m_widgetProjectEdit = new QLineEdit; + m_widgetHeaderEdit = new QLineEdit; + m_widgetSourceLabel = new QLabel(tr("Widge&t source file:")); + m_widgetSourceEdit = new QLineEdit; + m_widgetBaseClassLabel = new QLabel(tr("Widget &base class:")); + m_widgetBaseClassEdit = new QLineEdit("QWidget"); + m_pluginClassEdit = new QLineEdit; + m_pluginHeaderEdit = new QLineEdit; + m_pluginSourceEdit = new QLineEdit; + m_iconPathChooser = new Utils::PathChooser; + m_iconPathChooser->setExpectedKind(Utils::PathChooser::File); + m_iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History")); + m_iconPathChooser->setPromptDialogTitle(tr("Select Icon")); + m_iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)")); + Form { + empty, Row { Column { m_libraryRadio, includeRadio }, m_skeletonCheck}, br, + m_widgetLibraryLabel, m_widgetLibraryEdit, br, + m_widgetProjectLabel, m_widgetProjectEdit, br, + tr("Widget h&eader file:"), m_widgetHeaderEdit, br, + m_widgetSourceLabel, m_widgetSourceEdit, br, + m_widgetBaseClassLabel, m_widgetBaseClassEdit, br, + tr("Plugin class &name:"), m_pluginClassEdit, br, + tr("Plugin &header file:"), m_pluginHeaderEdit, br, + tr("Plugin sou&rce file:"), m_pluginSourceEdit, br, + tr("Icon file:"), m_iconPathChooser, br, + }.attachTo(sourceTab); + addTab(sourceTab, tr("&Sources")); + + // "Description" tab + auto descriptionTab = new QWidget; + m_groupEdit = new QLineEdit; + m_tooltipEdit = new QLineEdit; + m_whatsthisEdit = new QTextEdit; + m_containerCheck = new QCheckBox(tr("The widget is a &container")); + Form { + tr("G&roup:"), m_groupEdit, br, + tr("&Tooltip:"), m_tooltipEdit, br, + tr("W&hat's this:"), m_whatsthisEdit, br, + empty, m_containerCheck, br, + }.attachTo(descriptionTab); + addTab(descriptionTab, tr("&Description")); + + // "Property defaults" tab + auto propertyDefaultsTab = new QWidget; + auto domXmlLabel = new QLabel(tr("dom&XML:")); + m_domXmlEdit = new QTextEdit; + domXmlLabel->setBuddy(m_domXmlEdit); + Column { + domXmlLabel, + m_domXmlEdit, + }.attachTo(propertyDefaultsTab); + addTab(propertyDefaultsTab, tr("Property defa&ults")); + + connect(m_libraryRadio, &QRadioButton::toggled, this, &ClassDefinition::enableButtons); + connect(m_skeletonCheck, &QCheckBox::toggled, this, &ClassDefinition::enableButtons); + connect(m_widgetLibraryEdit, &QLineEdit::textChanged, this, &ClassDefinition::widgetLibraryChanged); - connect(m_ui.widgetHeaderEdit, &QLineEdit::textChanged, + connect(m_widgetHeaderEdit, &QLineEdit::textChanged, this, &ClassDefinition::widgetHeaderChanged); - connect(m_ui.pluginClassEdit, &QLineEdit::textChanged, + connect(m_pluginClassEdit, &QLineEdit::textChanged, this, &ClassDefinition::pluginClassChanged); - connect(m_ui.pluginHeaderEdit, &QLineEdit::textChanged, + connect(m_pluginHeaderEdit, &QLineEdit::textChanged, this, &ClassDefinition::pluginHeaderChanged); - connect(m_ui.domXmlEdit, &QTextEdit::textChanged, + connect(m_domXmlEdit, &QTextEdit::textChanged, this, [this] { m_domXmlChanged = true; }); } void ClassDefinition::enableButtons() { - const bool enLib = m_ui.libraryRadio->isChecked(); - m_ui.widgetLibraryLabel->setEnabled(enLib); - m_ui.widgetLibraryEdit->setEnabled(enLib); + const bool enLib = m_libraryRadio->isChecked(); + m_widgetLibraryLabel->setEnabled(enLib); + m_widgetLibraryEdit->setEnabled(enLib); - const bool enSrc = m_ui.skeletonCheck->isChecked(); - m_ui.widgetSourceLabel->setEnabled(enSrc); - m_ui.widgetSourceEdit->setEnabled(enSrc); - m_ui.widgetBaseClassLabel->setEnabled(enSrc); - m_ui.widgetBaseClassEdit->setEnabled(enSrc); + const bool enSrc = m_skeletonCheck->isChecked(); + m_widgetSourceLabel->setEnabled(enSrc); + m_widgetSourceEdit->setEnabled(enSrc); + m_widgetBaseClassLabel->setEnabled(enSrc); + m_widgetBaseClassEdit->setEnabled(enSrc); const bool enPrj = !enLib || enSrc; - m_ui.widgetProjectLabel->setEnabled(enPrj); - m_ui.widgetProjectEdit->setEnabled(enPrj); - m_ui.widgetProjectEdit->setText( - QFileInfo(m_ui.widgetProjectEdit->text()).completeBaseName() + - (m_ui.libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri"))); + m_widgetProjectLabel->setEnabled(enPrj); + m_widgetProjectEdit->setEnabled(enPrj); + m_widgetProjectEdit->setText( + QFileInfo(m_widgetProjectEdit->text()).completeBaseName() + + (m_libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri"))); } static inline QString xmlFromClassName(const QString &name) @@ -68,59 +134,59 @@ static inline QString xmlFromClassName(const QString &name) void ClassDefinition::setClassName(const QString &name) { - m_ui.widgetLibraryEdit->setText(name.toLower()); - m_ui.widgetHeaderEdit->setText(m_fileNamingParameters.headerFileName(name)); - m_ui.pluginClassEdit->setText(name + QLatin1String("Plugin")); + m_widgetLibraryEdit->setText(name.toLower()); + m_widgetHeaderEdit->setText(m_fileNamingParameters.headerFileName(name)); + m_pluginClassEdit->setText(name + QLatin1String("Plugin")); if (!m_domXmlChanged) { - m_ui.domXmlEdit->setText(xmlFromClassName(name)); + m_domXmlEdit->setText(xmlFromClassName(name)); m_domXmlChanged = false; } } void ClassDefinition::widgetLibraryChanged(const QString &text) { - m_ui.widgetProjectEdit->setText(text + - (m_ui.libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri"))); + m_widgetProjectEdit->setText(text + + (m_libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri"))); } void ClassDefinition::widgetHeaderChanged(const QString &text) { - m_ui.widgetSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); + m_widgetSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); } void ClassDefinition::pluginClassChanged(const QString &text) { - m_ui.pluginHeaderEdit->setText(m_fileNamingParameters.headerFileName(text)); + m_pluginHeaderEdit->setText(m_fileNamingParameters.headerFileName(text)); } void ClassDefinition::pluginHeaderChanged(const QString &text) { - m_ui.pluginSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); + m_pluginSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); } PluginOptions::WidgetOptions ClassDefinition::widgetOptions(const QString &className) const { PluginOptions::WidgetOptions wo; - wo.createSkeleton = m_ui.skeletonCheck->isChecked(); + wo.createSkeleton = m_skeletonCheck->isChecked(); wo.sourceType = - m_ui.libraryRadio->isChecked() ? + m_libraryRadio->isChecked() ? PluginOptions::WidgetOptions::LinkLibrary : PluginOptions::WidgetOptions::IncludeProject; - wo.widgetLibrary = m_ui.widgetLibraryEdit->text(); - wo.widgetProjectFile = m_ui.widgetProjectEdit->text(); + wo.widgetLibrary = m_widgetLibraryEdit->text(); + wo.widgetProjectFile = m_widgetProjectEdit->text(); wo.widgetClassName = className; - wo.widgetHeaderFile = m_ui.widgetHeaderEdit->text(); - wo.widgetSourceFile = m_ui.widgetSourceEdit->text(); - wo.widgetBaseClassName = m_ui.widgetBaseClassEdit->text(); - wo.pluginClassName = m_ui.pluginClassEdit->text(); - wo.pluginHeaderFile = m_ui.pluginHeaderEdit->text(); - wo.pluginSourceFile = m_ui.pluginSourceEdit->text(); - wo.iconFile = m_ui.iconPathChooser->filePath().toString(); - wo.group = m_ui.groupEdit->text(); - wo.toolTip = m_ui.tooltipEdit->text(); - wo.whatsThis = m_ui.whatsthisEdit->toPlainText(); - wo.isContainer = m_ui.containerCheck->isChecked(); - wo.domXml = m_ui.domXmlEdit->toPlainText(); + wo.widgetHeaderFile = m_widgetHeaderEdit->text(); + wo.widgetSourceFile = m_widgetSourceEdit->text(); + wo.widgetBaseClassName = m_widgetBaseClassEdit->text(); + wo.pluginClassName = m_pluginClassEdit->text(); + wo.pluginHeaderFile = m_pluginHeaderEdit->text(); + wo.pluginSourceFile = m_pluginSourceEdit->text(); + wo.iconFile = m_iconPathChooser->filePath().toString(); + wo.group = m_groupEdit->text(); + wo.toolTip = m_tooltipEdit->text(); + wo.whatsThis = m_whatsthisEdit->toPlainText(); + wo.isContainer = m_containerCheck->isChecked(); + wo.domXml = m_domXmlEdit->toPlainText(); return wo; } diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.h b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.h index aa2e162dd5c..a152b2b533b 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.h +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.h @@ -3,12 +3,21 @@ #pragma once -#include "ui_classdefinition.h" #include "filenamingparameters.h" #include "pluginoptions.h" #include +QT_BEGIN_NAMESPACE +class QCheckBox; +class QLabel; +class QLineEdit; +class QRadioButton; +class QTextEdit; +QT_END_NAMESPACE + +namespace Utils { class PathChooser; } + namespace QmakeProjectManager { namespace Internal { @@ -34,9 +43,29 @@ private Q_SLOTS: void pluginHeaderChanged(const QString &text); private: - Ui::ClassDefinition m_ui; FileNamingParameters m_fileNamingParameters; bool m_domXmlChanged; + + Utils::PathChooser *m_iconPathChooser; + QRadioButton *m_libraryRadio; + QCheckBox *m_skeletonCheck; + QLabel *m_widgetLibraryLabel; + QLineEdit *m_widgetLibraryEdit; + QLabel *m_widgetSourceLabel; + QLineEdit *m_widgetSourceEdit; + QLabel *m_widgetBaseClassLabel; + QLineEdit *m_widgetBaseClassEdit; + QLabel *m_widgetProjectLabel; + QLineEdit *m_widgetProjectEdit; + QLineEdit *m_widgetHeaderEdit; + QLineEdit *m_pluginClassEdit; + QLineEdit *m_pluginSourceEdit; + QLineEdit *m_pluginHeaderEdit; + QLineEdit *m_groupEdit; + QLineEdit *m_tooltipEdit; + QTextEdit *m_whatsthisEdit; + QCheckBox *m_containerCheck; + QTextEdit *m_domXmlEdit; }; } diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.ui b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.ui deleted file mode 100644 index f459bbc33ef..00000000000 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.ui +++ /dev/null @@ -1,324 +0,0 @@ - - - QmakeProjectManager::Internal::ClassDefinition - - - true - - - - 0 - 0 - 649 - 427 - - - - - - - The header file - - - 0 - - - - &Sources - - - - - - - - Widget librar&y: - - - widgetLibraryEdit - - - - - - - - - - Widget project &file: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - widgetProjectEdit - - - - - - - - - - Widget h&eader file: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - widgetHeaderEdit - - - - - - - The header file has to be specified in source code. - - - - - - - Widge&t source file: - - - widgetSourceEdit - - - - - - - - - - Widget &base class: - - - widgetBaseClassEdit - - - - - - - QWidget - - - - - - - Plugin class &name: - - - pluginClassEdit - - - - - - - - - - Plugin &header file: - - - pluginHeaderEdit - - - - - - - - - - Plugin sou&rce file: - - - pluginSourceEdit - - - - - - - - - - Icon file: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - &Link library - - - false - - - - - - - Create s&keleton - - - true - - - - - - - Include pro&ject - - - true - - - - - - - - - - - - &Description - - - - QFormLayout::ExpandingFieldsGrow - - - - - G&roup: - - - groupEdit - - - - - - - - - - &Tooltip: - - - tooltipEdit - - - - - - - - - - W&hat's this: - - - whatsthisEdit - - - - - - - - 0 - 0 - - - - - 0 - 36 - - - - - 16777215 - 100 - - - - - - - - The widget is a &container - - - - - - - - Property defa&ults - - - - - - - - - dom&XML: - - - domXmlEdit - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
-
-
- - libraryRadio - includeRadio - skeletonCheck - widgetLibraryEdit - widgetProjectEdit - widgetHeaderEdit - widgetSourceEdit - widgetBaseClassEdit - pluginClassEdit - pluginHeaderEdit - pluginSourceEdit - groupEdit - tooltipEdit - whatsthisEdit - containerCheck - domXmlEdit - - - -
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp index 307872e04ac..e11f474db60 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.cpp @@ -3,10 +3,13 @@ #include "customwidgetpluginwizardpage.h" #include "customwidgetwidgetswizardpage.h" -#include "ui_customwidgetpluginwizardpage.h" +#include #include +#include +#include + namespace QmakeProjectManager { namespace Internal { @@ -18,41 +21,56 @@ static inline QString createPluginName(const QString &prefix) CustomWidgetPluginWizardPage::CustomWidgetPluginWizardPage(QWidget *parent) : QWizardPage(parent), - m_ui(new Ui::CustomWidgetPluginWizardPage), m_classCount(-1), m_complete(false) { - m_ui->setupUi(this); - connect(m_ui->collectionClassEdit, &QLineEdit::textEdited, + m_collectionClassLabel = new QLabel(tr("Collection class:")); + m_collectionClassEdit = new QLineEdit; + m_collectionHeaderLabel = new QLabel(tr("Collection header file:")); + m_collectionHeaderEdit = new QLineEdit; + m_collectionSourceLabel = new QLabel(tr("Collection source file:")); + m_collectionSourceEdit = new QLineEdit; + m_pluginNameEdit = new QLineEdit; + m_resourceFileEdit = new QLineEdit(tr("icons.qrc")); + + using namespace Utils::Layouting; + Column { + tr("Specify the properties of the plugin library and the collection class."), + Space(10), + Form { + m_collectionClassLabel, m_collectionClassEdit, br, + m_collectionHeaderLabel, m_collectionHeaderEdit, br, + m_collectionSourceLabel, m_collectionSourceEdit, br, + tr("Plugin name:"), m_pluginNameEdit, br, + tr("Resource file:"), m_resourceFileEdit, br, + } + }.attachTo(this); + + connect(m_collectionClassEdit, &QLineEdit::textEdited, this, &CustomWidgetPluginWizardPage::slotCheckCompleteness); - connect(m_ui->collectionClassEdit, &QLineEdit::textChanged, + connect(m_collectionClassEdit, &QLineEdit::textChanged, this, [this](const QString &collectionClass) { - m_ui->collectionHeaderEdit->setText(m_fileNamingParameters.headerFileName(collectionClass)); - m_ui->pluginNameEdit->setText(createPluginName(collectionClass)); + m_collectionHeaderEdit->setText(m_fileNamingParameters.headerFileName(collectionClass)); + m_pluginNameEdit->setText(createPluginName(collectionClass)); }); - connect(m_ui->pluginNameEdit, &QLineEdit::textEdited, + connect(m_pluginNameEdit, &QLineEdit::textEdited, this, &CustomWidgetPluginWizardPage::slotCheckCompleteness); - connect(m_ui->collectionHeaderEdit, &QLineEdit::textChanged, + connect(m_collectionHeaderEdit, &QLineEdit::textChanged, this, [this](const QString &text) { - m_ui->collectionSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); + m_collectionSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text)); }); setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Plugin Details")); } -CustomWidgetPluginWizardPage::~CustomWidgetPluginWizardPage() -{ - delete m_ui; -} - QString CustomWidgetPluginWizardPage::collectionClassName() const { - return m_ui->collectionClassEdit->text(); + return m_collectionClassEdit->text(); } QString CustomWidgetPluginWizardPage::pluginName() const { - return m_ui->pluginNameEdit->text(); + return m_pluginNameEdit->text(); } void CustomWidgetPluginWizardPage::init(const CustomWidgetWidgetsWizardPage *widgetsPage) @@ -60,37 +78,37 @@ void CustomWidgetPluginWizardPage::init(const CustomWidgetWidgetsWizardPage *wid m_classCount = widgetsPage->classCount(); const QString empty; if (m_classCount == 1) { - m_ui->pluginNameEdit->setText(createPluginName(widgetsPage->classNameAt(0))); + m_pluginNameEdit->setText(createPluginName(widgetsPage->classNameAt(0))); setCollectionEnabled(false); } else { - m_ui->pluginNameEdit->setText(empty); + m_pluginNameEdit->setText(empty); setCollectionEnabled(true); } - m_ui->collectionClassEdit->setText(empty); - m_ui->collectionHeaderEdit->setText(empty); - m_ui->collectionSourceEdit->setText(empty); + m_collectionClassEdit->setText(empty); + m_collectionHeaderEdit->setText(empty); + m_collectionSourceEdit->setText(empty); slotCheckCompleteness(); } void CustomWidgetPluginWizardPage::setCollectionEnabled(bool enColl) { - m_ui->collectionClassLabel->setEnabled(enColl); - m_ui->collectionClassEdit->setEnabled(enColl); - m_ui->collectionHeaderLabel->setEnabled(enColl); - m_ui->collectionHeaderEdit->setEnabled(enColl); - m_ui->collectionSourceLabel->setEnabled(enColl); - m_ui->collectionSourceEdit->setEnabled(enColl); + m_collectionClassLabel->setEnabled(enColl); + m_collectionClassEdit->setEnabled(enColl); + m_collectionHeaderLabel->setEnabled(enColl); + m_collectionHeaderEdit->setEnabled(enColl); + m_collectionSourceLabel->setEnabled(enColl); + m_collectionSourceEdit->setEnabled(enColl); } QSharedPointer CustomWidgetPluginWizardPage::basicPluginOptions() const { QSharedPointer po(new PluginOptions); po->pluginName = pluginName(); - po->resourceFile = m_ui->resourceFileEdit->text(); + po->resourceFile = m_resourceFileEdit->text(); po->collectionClassName = collectionClassName(); - po->collectionHeaderFile = m_ui->collectionHeaderEdit->text(); - po->collectionSourceFile = m_ui->collectionSourceEdit->text(); + po->collectionHeaderFile = m_collectionHeaderEdit->text(); + po->collectionSourceFile = m_collectionSourceEdit->text(); return po; } diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.h b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.h index 344985fae16..d3e64531bbf 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.h +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.h @@ -8,21 +8,23 @@ #include #include +QT_BEGIN_NAMESPACE +class QLineEdit; +class QLabel; +QT_END_NAMESPACE + namespace QmakeProjectManager { namespace Internal { struct PluginOptions; class CustomWidgetWidgetsWizardPage; -namespace Ui { class CustomWidgetPluginWizardPage; } - class CustomWidgetPluginWizardPage : public QWizardPage { Q_OBJECT public: explicit CustomWidgetPluginWizardPage(QWidget *parent = nullptr); - ~CustomWidgetPluginWizardPage() override; void init(const CustomWidgetWidgetsWizardPage *widgetsPage); @@ -40,10 +42,18 @@ private: inline QString pluginName() const; void setCollectionEnabled(bool enColl); - Ui::CustomWidgetPluginWizardPage *m_ui; FileNamingParameters m_fileNamingParameters; int m_classCount; bool m_complete; + + QLabel *m_collectionClassLabel; + QLineEdit *m_collectionClassEdit; + QLabel *m_collectionHeaderLabel; + QLineEdit *m_collectionHeaderEdit; + QLabel *m_collectionSourceLabel; + QLineEdit *m_collectionSourceEdit; + QLineEdit *m_pluginNameEdit; + QLineEdit *m_resourceFileEdit; }; } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.ui b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.ui deleted file mode 100644 index 2f70b02a432..00000000000 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetpluginwizardpage.ui +++ /dev/null @@ -1,157 +0,0 @@ - - - QmakeProjectManager::Internal::CustomWidgetPluginWizardPage - - - - 0 - 0 - 591 - 446 - - - - WizardPage - - - Plugin and Collection Class Information - - - - - - Specify the properties of the plugin library and the collection class. - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 10 - - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Collection class: - - - collectionClassEdit - - - - - - - - - - - - - - Collection header file: - - - collectionHeaderEdit - - - - - - - - - - Collection source file: - - - collectionSourceEdit - - - - - - - - - - Plugin name: - - - pluginNameEdit - - - - - - - - - - Resource file: - - - resourceFileEdit - - - - - - - icons.qrc - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.cpp index 0709532d682..70a1e5a7c0a 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.cpp @@ -2,33 +2,35 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "customwidgetwidgetswizardpage.h" -#include "ui_customwidgetwidgetswizardpage.h" #include "classdefinition.h" +#include "classlist.h" +#include #include #include -#include - -#include #include +#include +#include +#include +#include namespace QmakeProjectManager { namespace Internal { CustomWidgetWidgetsWizardPage::CustomWidgetWidgetsWizardPage(QWidget *parent) : QWizardPage(parent), - m_ui(new Ui::CustomWidgetWidgetsWizardPage), m_tabStackLayout(new QStackedLayout), m_complete(false) { - m_ui->setupUi(this); - m_ui->tabStackWidget->setLayout(m_tabStackLayout); - m_ui->addButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon()); - connect(m_ui->addButton, &QAbstractButton::clicked, m_ui->classList, &ClassList::startEditingNewClassItem); - m_ui->deleteButton->setIcon(Utils::Icons::MINUS_TOOLBAR.icon()); - connect(m_ui->deleteButton, &QAbstractButton::clicked, m_ui->classList, &ClassList::removeCurrentClass); - m_ui->deleteButton->setEnabled(false); + auto classListLabel = new QLabel(tr("Widget &Classes:")); + auto addButton = new QToolButton; + addButton->setIcon(Utils::Icons::PLUS.icon()); + m_deleteButton = new QToolButton; + m_deleteButton->setIcon(Utils::Icons::MINUS.icon()); + m_deleteButton->setEnabled(false); + m_classList = new ClassList; + classListLabel->setBuddy(m_classList); // Disabled dummy for column>. auto *dummy = new ClassDefinition; @@ -36,23 +38,33 @@ CustomWidgetWidgetsWizardPage::CustomWidgetWidgetsWizardPage(QWidget *parent) : dummy->setEnabled(false); m_tabStackLayout->addWidget(dummy); - connect(m_ui->classList, &ClassList::currentRowChanged, + using namespace Utils::Layouting; + Column { + tr("Specify the list of custom widgets and their properties."), + Space(10), + Row { + Column { + Row { classListLabel, addButton, m_deleteButton }, + m_classList, + }, + m_tabStackLayout, + } + }.attachTo(this); + + connect(m_deleteButton, &QAbstractButton::clicked, m_classList, &ClassList::removeCurrentClass); + connect(addButton, &QAbstractButton::clicked, m_classList, &ClassList::startEditingNewClassItem); + connect(m_classList, &ClassList::currentRowChanged, this, &CustomWidgetWidgetsWizardPage::slotCurrentRowChanged); - connect(m_ui->classList, &ClassList::classAdded, + connect(m_classList, &ClassList::classAdded, this, &CustomWidgetWidgetsWizardPage::slotClassAdded); - connect(m_ui->classList, &ClassList::classDeleted, + connect(m_classList, &ClassList::classDeleted, this, &CustomWidgetWidgetsWizardPage::slotClassDeleted); - connect(m_ui->classList, &ClassList::classRenamed, + connect(m_classList, &ClassList::classRenamed, this, &CustomWidgetWidgetsWizardPage::slotClassRenamed); setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Custom Widgets")); } -CustomWidgetWidgetsWizardPage::~CustomWidgetWidgetsWizardPage() -{ - delete m_ui; -} - bool CustomWidgetWidgetsWizardPage::isComplete() const { return m_complete; @@ -61,13 +73,13 @@ bool CustomWidgetWidgetsWizardPage::isComplete() const void CustomWidgetWidgetsWizardPage::initializePage() { // Takes effect only if visible. - QTimer::singleShot(0, m_ui->classList, &ClassList::startEditingNewClassItem); + QTimer::singleShot(0, m_classList, &ClassList::startEditingNewClassItem); } void CustomWidgetWidgetsWizardPage::slotCurrentRowChanged(int row) { const bool onDummyItem = row == m_tabStackLayout->count() - 1; - m_ui->deleteButton->setEnabled(!onDummyItem); + m_deleteButton->setEnabled(!onDummyItem); m_tabStackLayout->setCurrentIndex(row); } @@ -100,7 +112,7 @@ void CustomWidgetWidgetsWizardPage::slotClassRenamed(int index, const QString &n QString CustomWidgetWidgetsWizardPage::classNameAt(int i) const { - return m_ui->classList->className(i); + return m_classList->className(i); } QList CustomWidgetWidgetsWizardPage::widgetOptions() const diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.h b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.h index 27a4a93e558..be27f8ffcc7 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.h +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.h @@ -10,6 +10,7 @@ #include QT_BEGIN_NAMESPACE +class QToolButton; class QStackedLayout; QT_END_NAMESPACE @@ -17,6 +18,7 @@ namespace QmakeProjectManager { namespace Internal { class ClassDefinition; +class ClassList; struct PluginOptions; namespace Ui { class CustomWidgetWidgetsWizardPage; } @@ -27,7 +29,6 @@ class CustomWidgetWidgetsWizardPage : public QWizardPage public: explicit CustomWidgetWidgetsWizardPage(QWidget *parent = nullptr); - ~CustomWidgetWidgetsWizardPage() override; QList widgetOptions() const; @@ -51,11 +52,12 @@ private Q_SLOTS: private: void updatePluginTab(); - Ui::CustomWidgetWidgetsWizardPage *m_ui; QList m_uiClassDefs; QStackedLayout *m_tabStackLayout; FileNamingParameters m_fileNamingParameters; bool m_complete; + QToolButton *m_deleteButton; + ClassList *m_classList; }; } diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.ui b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.ui deleted file mode 100644 index 3b08551f1ee..00000000000 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwidgetswizardpage.ui +++ /dev/null @@ -1,105 +0,0 @@ - - - QmakeProjectManager::Internal::CustomWidgetWidgetsWizardPage - - - - 0 - 0 - 668 - 475 - - - - Custom Qt Widget Wizard - - - Custom Widget List - - - - - - - 400 - 200 - - - - - - - - - 0 - 400 - - - - - - - - Specify the list of custom widgets and their properties. - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 10 - - - - - - - - - - Widget &Classes: - - - classList - - - - - - - ... - - - - - - - ... - - - - - - - - - - QmakeProjectManager::Internal::ClassList - QListWidget -
qmakeprojectmanager/customwidgetwizard/classlist.h
-
-
- - classList - - - -
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 8d7a0b9edbf..70bfc300b11 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -50,10 +50,10 @@ Project { name: "Custom Widget Wizard" prefix: "customwidgetwizard/" files: [ - "classdefinition.cpp", "classdefinition.h", "classdefinition.ui", + "classdefinition.cpp", "classdefinition.h", "classlist.cpp", "classlist.h", - "customwidgetpluginwizardpage.cpp", "customwidgetpluginwizardpage.h", "customwidgetpluginwizardpage.ui", - "customwidgetwidgetswizardpage.cpp", "customwidgetwidgetswizardpage.h", "customwidgetwidgetswizardpage.ui", + "customwidgetpluginwizardpage.cpp", "customwidgetpluginwizardpage.h", + "customwidgetwidgetswizardpage.cpp", "customwidgetwidgetswizardpage.h", "customwidgetwizard.cpp", "customwidgetwizard.h", "customwidgetwizarddialog.cpp", "customwidgetwizarddialog.h", "filenamingparameters.h",