diff --git a/src/plugins/qbsprojectmanager/CMakeLists.txt b/src/plugins/qbsprojectmanager/CMakeLists.txt index 844e1ea4e85..2caeb08b889 100644 --- a/src/plugins/qbsprojectmanager/CMakeLists.txt +++ b/src/plugins/qbsprojectmanager/CMakeLists.txt @@ -17,7 +17,6 @@ add_qtc_plugin(QbsProjectManager qbspmlogging.cpp qbspmlogging.h qbsprofilemanager.cpp qbsprofilemanager.h qbsprofilessettingspage.cpp qbsprofilessettingspage.h - qbsprofilessettingswidget.ui qbsproject.cpp qbsproject.h qbsprojectimporter.cpp qbsprojectimporter.h qbsprojectmanager.qrc diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp index 3cf44c36a01..6dc833f4f74 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "qbsprofilessettingspage.h" -#include "ui_qbsprofilessettingswidget.h" #include "qbsprofilemanager.h" #include "qbsprojectmanagerconstants.h" @@ -15,11 +14,15 @@ #include #include #include +#include #include #include #include +#include #include +#include +#include #include using namespace ProjectExplorer; @@ -99,8 +102,10 @@ private: void refreshKitsList(); void displayCurrentProfile(); - Ui::QbsProfilesSettingsWidget m_ui; ProfileModel m_model; + QComboBox *m_kitsComboBox; + QLabel *m_profileValueLabel; + QTreeView *m_propertiesView; }; QbsProfilesSettingsPage::QbsProfilesSettingsPage() @@ -125,61 +130,88 @@ void QbsProfilesSettingsPage::finish() QbsProfilesSettingsWidget::QbsProfilesSettingsWidget() { - m_ui.setupUi(this); + m_kitsComboBox = new QComboBox; + m_profileValueLabel = new QLabel; + m_propertiesView = new QTreeView; + + auto line = new QFrame; + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + + using namespace Utils::Layouting; + Column { + Form { + tr("Kit:"), m_kitsComboBox, br, + tr("Associated profile:"), m_profileValueLabel, br, + }, + line, + tr("Profile properties:"), + Row { + m_propertiesView, + Column { + PushButton { + text(tr("E&xpand All")), + onClicked([this] { m_propertiesView->expandAll(); }), + }, + PushButton { + text(tr("&Collapse All")), + onClicked([this] { m_propertiesView->collapseAll(); }), + }, + st, + }, + }, + }.attachTo(this); + connect(QbsProfileManager::instance(), &QbsProfileManager::qbsProfilesUpdated, this, &QbsProfilesSettingsWidget::refreshKitsList); - connect(m_ui.expandButton, &QAbstractButton::clicked, - m_ui.propertiesView, &QTreeView::expandAll); - connect(m_ui.collapseButton, &QAbstractButton::clicked, - m_ui.propertiesView, &QTreeView::collapseAll); refreshKitsList(); } void QbsProfilesSettingsWidget::refreshKitsList() { - m_ui.kitsComboBox->disconnect(this); - m_ui.propertiesView->setModel(nullptr); + m_kitsComboBox->disconnect(this); + m_propertiesView->setModel(nullptr); m_model.reload(); - m_ui.profileValueLabel->clear(); + m_profileValueLabel->clear(); Utils::Id currentId; - if (m_ui.kitsComboBox->count() > 0) - currentId = Utils::Id::fromSetting(m_ui.kitsComboBox->currentData()); - m_ui.kitsComboBox->clear(); + if (m_kitsComboBox->count() > 0) + currentId = Utils::Id::fromSetting(m_kitsComboBox->currentData()); + m_kitsComboBox->clear(); int newCurrentIndex = -1; QList validKits = KitManager::kits(); Utils::erase(validKits, [](const Kit *k) { return !k->isValid(); }); const bool hasKits = !validKits.isEmpty(); for (const Kit * const kit : qAsConst(validKits)) { if (kit->id() == currentId) - newCurrentIndex = m_ui.kitsComboBox->count(); - m_ui.kitsComboBox->addItem(kit->displayName(), kit->id().toSetting()); + newCurrentIndex = m_kitsComboBox->count(); + m_kitsComboBox->addItem(kit->displayName(), kit->id().toSetting()); } if (newCurrentIndex != -1) - m_ui.kitsComboBox->setCurrentIndex(newCurrentIndex); + m_kitsComboBox->setCurrentIndex(newCurrentIndex); else if (hasKits) - m_ui.kitsComboBox->setCurrentIndex(0); + m_kitsComboBox->setCurrentIndex(0); displayCurrentProfile(); - connect(m_ui.kitsComboBox, &QComboBox::currentIndexChanged, + connect(m_kitsComboBox, &QComboBox::currentIndexChanged, this, &QbsProfilesSettingsWidget::displayCurrentProfile); } void QbsProfilesSettingsWidget::displayCurrentProfile() { - m_ui.propertiesView->setModel(nullptr); - if (m_ui.kitsComboBox->currentIndex() == -1) + m_propertiesView->setModel(nullptr); + if (m_kitsComboBox->currentIndex() == -1) return; - const Utils::Id kitId = Utils::Id::fromSetting(m_ui.kitsComboBox->currentData()); + const Utils::Id kitId = Utils::Id::fromSetting(m_kitsComboBox->currentData()); const Kit * const kit = KitManager::kit(kitId); QTC_ASSERT(kit, return); const QString profileName = QbsProfileManager::ensureProfileForKit(kit); - m_ui.profileValueLabel->setText(profileName); + m_profileValueLabel->setText(profileName); for (int i = 0; i < m_model.rowCount(); ++i) { const QModelIndex currentProfileIndex = m_model.index(i, 0); if (m_model.data(currentProfileIndex, Qt::DisplayRole).toString() != profileName) continue; - m_ui.propertiesView->setModel(&m_model); - m_ui.propertiesView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); - m_ui.propertiesView->setRootIndex(currentProfileIndex); + m_propertiesView->setModel(&m_model); + m_propertiesView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); + m_propertiesView->setRootIndex(currentProfileIndex); return; } } diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui b/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui deleted file mode 100644 index 8f21aa7967b..00000000000 --- a/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui +++ /dev/null @@ -1,121 +0,0 @@ - - - QbsProjectManager::Internal::QbsProfilesSettingsWidget - - - - 0 - 0 - 537 - 458 - - - - - - - - - - - - Kit: - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Associated profile: - - - - - - - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - Qt::Horizontal - - - - - - - Profile properties: - - - - - - - - - - - - - - E&xpand All - - - - - - - &Collapse All - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index 9698d4f40cc..cadfe8e46f4 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -45,7 +45,6 @@ QtcPlugin { "qbsprofilemanager.h", "qbsprofilessettingspage.cpp", "qbsprofilessettingspage.h", - "qbsprofilessettingswidget.ui", "qbsproject.cpp", "qbsproject.h", "qbsprojectimporter.cpp",