From bdb9a14de0f771c82cc7a93323fe43a1ff9d3427 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 31 Oct 2014 14:51:55 +0100 Subject: [PATCH] QbsProjectManager: Allow users to override profile properties. Creator derives its qbs profiles from the kits and overwrites them as it sees fit, which means users cannot set custom properties by editing the respective settings files or using the normal qbs command-line tools. Therefore, we need to provide them with a way to do this from Creator itself. For this purpose, we introduce a settings page where a user can add or override qbs properties per kit. The resulting "diff" is then applied whenever the profiles are written, so qbs will take the custom properties into account. Change-Id: I909f5243c65647f62c91a2afa242fd531ddaf915 Reviewed-by: Joerg Bornemann --- .../customqbspropertiesdialog.cpp | 104 ++++++++ .../customqbspropertiesdialog.h | 62 +++++ .../customqbspropertiesdialog.ui | 120 +++++++++ .../defaultpropertyprovider.cpp | 15 +- .../defaultpropertyprovider.h | 4 + src/plugins/qbsprojectmanager/qbsconstants.h | 7 + .../qbsprofilessettingspage.cpp | 241 ++++++++++++++++++ .../qbsprofilessettingspage.h | 56 ++++ .../qbsprofilessettingswidget.ui | 125 +++++++++ .../qbsprojectmanager/qbsprojectmanager.cpp | 2 +- .../qbsprojectmanager/qbsprojectmanager.h | 4 +- .../qbsprojectmanager/qbsprojectmanager.pro | 8 +- .../qbsprojectmanager/qbsprojectmanager.qbs | 8 +- .../qbsprojectmanagerplugin.cpp | 2 + 14 files changed, 752 insertions(+), 6 deletions(-) create mode 100644 src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp create mode 100644 src/plugins/qbsprojectmanager/customqbspropertiesdialog.h create mode 100644 src/plugins/qbsprojectmanager/customqbspropertiesdialog.ui create mode 100644 src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp create mode 100644 src/plugins/qbsprojectmanager/qbsprofilessettingspage.h create mode 100644 src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp new file mode 100644 index 00000000000..253d1fd9b11 --- /dev/null +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://www.qt.io/licensing. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ +#include "customqbspropertiesdialog.h" +#include "ui_customqbspropertiesdialog.h" + +#include +#include + +#include + +namespace QbsProjectManager { +namespace Internal { + +CustomQbsPropertiesDialog::CustomQbsPropertiesDialog(const QVariantMap &properties, QWidget *parent) + : QDialog(parent), m_ui(new Ui::CustomQbsPropertiesDialog) +{ + m_ui->setupUi(this); + m_ui->propertiesTable->setRowCount(properties.count()); + m_ui->propertiesTable->setHorizontalHeaderLabels(QStringList() << tr("Key") << tr("Value")); + int currentRow = 0; + for (QVariantMap::ConstIterator it = properties.constBegin(); it != properties.constEnd(); + ++it) { + QTableWidgetItem * const nameItem = new QTableWidgetItem; + nameItem->setData(Qt::DisplayRole, it.key()); + m_ui->propertiesTable->setItem(currentRow, 0, nameItem); + QTableWidgetItem * const valueItem = new QTableWidgetItem; + valueItem->setData(Qt::DisplayRole, it.value()); + m_ui->propertiesTable->setItem(currentRow, 1, valueItem); + ++currentRow; + } + connect(m_ui->addButton, SIGNAL(clicked()), SLOT(addProperty())); + connect(m_ui->removeButton, SIGNAL(clicked()), SLOT(removeSelectedProperty())); + connect(m_ui->propertiesTable, SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)), + SLOT(handleCurrentItemChanged())); + handleCurrentItemChanged(); +} + +QVariantMap CustomQbsPropertiesDialog::properties() const +{ + QVariantMap properties; + for (int row = 0; row < m_ui->propertiesTable->rowCount(); ++row) { + const QTableWidgetItem * const nameItem = m_ui->propertiesTable->item(row, 0); + const QString name = nameItem->text(); + if (name.isEmpty()) + continue; + properties.insert(name, m_ui->propertiesTable->item(row, 1)->text()); + } + return properties; +} + +CustomQbsPropertiesDialog::~CustomQbsPropertiesDialog() +{ + delete m_ui; +} + +void CustomQbsPropertiesDialog::addProperty() +{ + const int row = m_ui->propertiesTable->rowCount(); + m_ui->propertiesTable->insertRow(row); + m_ui->propertiesTable->setItem(row, 0, new QTableWidgetItem); + m_ui->propertiesTable->setItem(row, 1, new QTableWidgetItem); +} + +void CustomQbsPropertiesDialog::removeSelectedProperty() +{ + const QTableWidgetItem * const currentItem = m_ui->propertiesTable->currentItem(); + QTC_ASSERT(currentItem, return); + m_ui->propertiesTable->removeRow(currentItem->row()); +} + +void CustomQbsPropertiesDialog::handleCurrentItemChanged() +{ + m_ui->removeButton->setEnabled(m_ui->propertiesTable->currentItem()); +} + +} // namespace Internal +} // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h new file mode 100644 index 00000000000..b9d9a772cd2 --- /dev/null +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://www.qt.io/licensing. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ +#ifndef QTC_CUSTOMQBSPROPERTIESDIALOG_H +#define QTC_CUSTOMQBSPROPERTIESDIALOG_H + +#include +#include + +namespace QbsProjectManager { +namespace Internal { +namespace Ui { class CustomQbsPropertiesDialog; } + +class CustomQbsPropertiesDialog : public QDialog +{ + Q_OBJECT + +public: + explicit CustomQbsPropertiesDialog(const QVariantMap &properties, QWidget *parent = 0); + + QVariantMap properties() const; + ~CustomQbsPropertiesDialog(); + +private slots: + void addProperty(); + void removeSelectedProperty(); + void handleCurrentItemChanged(); + +private: + Ui::CustomQbsPropertiesDialog * const m_ui; +}; + +} // namespace Internal +} // namespace QbsProjectManager + +#endif // Include guard. diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.ui b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.ui new file mode 100644 index 00000000000..b18a460ab0f --- /dev/null +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.ui @@ -0,0 +1,120 @@ + + + QbsProjectManager::Internal::CustomQbsPropertiesDialog + + + + 0 + 0 + 400 + 300 + + + + Custom Properties + + + + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectItems + + + 2 + + + true + + + false + + + + + + + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + QbsProjectManager::Internal::CustomQbsPropertiesDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + QbsProjectManager::Internal::CustomQbsPropertiesDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp index 5421d47c67a..14cc7261a60 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp @@ -141,9 +141,22 @@ static QStringList toolchainList(const ProjectExplorer::ToolChain *tc) return list; } -QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const +QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, + const QVariantMap &defaultData) const { QTC_ASSERT(k, return defaultData); + QVariantMap data = autoGeneratedProperties(k, defaultData); + const QVariantMap customProperties = k->value(Core::Id(QBS_PROPERTIES_KEY_FOR_KITS)).toMap(); + for (QVariantMap::ConstIterator it = customProperties.constBegin(); + it != customProperties.constEnd(); ++it) { + data.insert(it.key(), it.value()); + } + return data; +} + +QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k, + const QVariantMap &defaultData) const +{ QVariantMap data = defaultData; const QString sysroot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput(); diff --git a/src/plugins/qbsprojectmanager/defaultpropertyprovider.h b/src/plugins/qbsprojectmanager/defaultpropertyprovider.h index 5193c2f825d..36254236ab4 100644 --- a/src/plugins/qbsprojectmanager/defaultpropertyprovider.h +++ b/src/plugins/qbsprojectmanager/defaultpropertyprovider.h @@ -42,6 +42,10 @@ class DefaultPropertyProvider : public PropertyProvider public: bool canHandle(const ProjectExplorer::Kit *k) const { return k; } QVariantMap properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const; + +private: + QVariantMap autoGeneratedProperties(const ProjectExplorer::Kit *k, + const QVariantMap &defaultData) const; }; } // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsconstants.h b/src/plugins/qbsprojectmanager/qbsconstants.h index 589e9511b0b..3c42dfd7e29 100644 --- a/src/plugins/qbsprojectmanager/qbsconstants.h +++ b/src/plugins/qbsprojectmanager/qbsconstants.h @@ -50,6 +50,13 @@ const char CPP_PLATFORMPATH[] = "cpp.platformPath"; const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName"; const char CPP_XCODESDKVERSION[] = "cpp.xcodeSdkVersion"; +// Settings page +const char QBS_SETTINGS_CATEGORY[] = "YM.qbs"; +const char QBS_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("QbsProjectManager", "qbs"); +const char QBS_SETTINGS_CATEGORY_ICON[] = ":/projectexplorer/images/build.png"; + +const char QBS_PROPERTIES_KEY_FOR_KITS[] = "QbsProjectManager.qbs-properties"; + } // namespace Constants } // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp new file mode 100644 index 00000000000..a842b8bfe77 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp @@ -0,0 +1,241 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://www.qt.io/licensing. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qbsprofilessettingspage.h" +#include "ui_qbsprofilessettingswidget.h" + +#include "customqbspropertiesdialog.h" +#include "qbsconstants.h" +#include "qbsprojectmanager.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +namespace QbsProjectManager { +namespace Internal { + +class QbsProfilesSettingsWidget : public QWidget +{ + Q_OBJECT +public: + QbsProfilesSettingsWidget(QWidget *parent = 0); + + void applyCustomProperties(); + +private slots: + void refreshKitsList(); + void displayCurrentProfile(); + void editProfile(); + +private: + void setupCustomProperties(const ProjectExplorer::Kit *kit); + void mergeCustomPropertiesIntoModel(); + + Ui::QbsProfilesSettingsWidget m_ui; + qbs::SettingsModel m_model; + + typedef QHash CustomProperties; + CustomProperties m_customProperties; + bool m_applyingProperties; +}; + +QbsProfilesSettingsPage::QbsProfilesSettingsPage(QObject *parent) + : Core::IOptionsPage(parent), m_widget(0) +{ + setId("AA.QbsProfiles"); + setDisplayName(tr("Profiles")); + setCategory(Constants::QBS_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("QbsProjectManager", + Constants::QBS_SETTINGS_TR_CATEGORY)); + setCategoryIcon(QLatin1String(Constants::QBS_SETTINGS_CATEGORY_ICON)); +} + +QWidget *QbsProfilesSettingsPage::widget() +{ + if (!m_widget) + m_widget = new QbsProfilesSettingsWidget; + return m_widget; +} + +void QbsProfilesSettingsPage::apply() +{ + if (m_widget) + m_widget->applyCustomProperties(); +} + +void QbsProfilesSettingsPage::finish() +{ + delete m_widget; + m_widget = 0; +} + + +QbsProfilesSettingsWidget::QbsProfilesSettingsWidget(QWidget *parent) + : QWidget(parent) + , m_model(Core::ICore::userResourcePath()) + , m_applyingProperties(false) +{ + m_model.setEditable(false); + m_ui.setupUi(this); + connect(ProjectExplorer::KitManager::instance(), &ProjectExplorer::KitManager::kitsChanged, + this, &QbsProfilesSettingsWidget::refreshKitsList); + connect(m_ui.expandButton, SIGNAL(clicked()), m_ui.propertiesView, SLOT(expandAll())); + connect(m_ui.collapseButton, SIGNAL(clicked()), m_ui.propertiesView, SLOT(collapseAll())); + connect(m_ui.editButton, SIGNAL(clicked()), SLOT(editProfile())); + refreshKitsList(); +} + +void QbsProfilesSettingsWidget::applyCustomProperties() +{ + QTC_ASSERT(!m_applyingProperties, return); + m_applyingProperties = true; // The following will cause kitsChanged() to be emitted. + for (CustomProperties::ConstIterator it = m_customProperties.constBegin(); + it != m_customProperties.constEnd(); ++it) { + ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(it.key()); + QTC_ASSERT(kit, continue); + kit->setValue(Core::Id(Constants::QBS_PROPERTIES_KEY_FOR_KITS), it.value()); + } + m_applyingProperties = false; + m_model.reload(); + displayCurrentProfile(); +} + +void QbsProfilesSettingsWidget::refreshKitsList() +{ + if (m_applyingProperties) + return; + + m_ui.kitsComboBox->disconnect(this); + m_ui.propertiesView->setModel(0); + m_model.reload(); + m_ui.profileValueLabel->clear(); + Core::Id currentId; + if (m_ui.kitsComboBox->count() > 0) + currentId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData()); + m_ui.kitsComboBox->clear(); + int newCurrentIndex = -1; + QList validKits = ProjectExplorer::KitManager::kits(); + Utils::erase(validKits, [](const ProjectExplorer::Kit *k) { return !k->isValid(); }); + const bool hasKits = !validKits.isEmpty(); + m_customProperties.clear(); + foreach (const ProjectExplorer::Kit * const kit, validKits) { + if (kit->id() == currentId) + newCurrentIndex = m_ui.kitsComboBox->count(); + m_ui.kitsComboBox->addItem(kit->displayName(), kit->id().toSetting()); + setupCustomProperties(kit); + } + mergeCustomPropertiesIntoModel(); + m_ui.editButton->setEnabled(hasKits); + if (newCurrentIndex != -1) + m_ui.kitsComboBox->setCurrentIndex(newCurrentIndex); + else if (hasKits) + m_ui.kitsComboBox->setCurrentIndex(0); + displayCurrentProfile(); + connect(m_ui.kitsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(displayCurrentProfile())); +} + +void QbsProfilesSettingsWidget::displayCurrentProfile() +{ + m_ui.propertiesView->setModel(0); + if (m_ui.kitsComboBox->currentIndex() == -1) + return; + const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData()); + const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId); + const QString profileName = QbsManager::profileForKit(kit); + m_ui.profileValueLabel->setText(profileName); + for (int i = 0; i < m_model.rowCount(); ++i) { + const QModelIndex profilesIndex = m_model.index(i, 0); + if (m_model.data(profilesIndex).toString() != QLatin1String("profiles")) + continue; + for (int i = 0; i < m_model.rowCount(profilesIndex); ++i) { + const QModelIndex currentProfileIndex = m_model.index(i, 0, profilesIndex); + if (m_model.data(currentProfileIndex).toString() != profileName) + continue; + m_ui.propertiesView->setModel(&m_model); + m_ui.propertiesView->header()->setSectionResizeMode(m_model.keyColumn(), + QHeaderView::ResizeToContents); + m_ui.propertiesView->setRootIndex(currentProfileIndex); + return; + } + } +} + +void QbsProfilesSettingsWidget::editProfile() +{ + QTC_ASSERT(m_ui.kitsComboBox->currentIndex() != -1, return); + + const Core::Id kitId = Core::Id::fromSetting(m_ui.kitsComboBox->currentData()); + CustomQbsPropertiesDialog dlg(m_customProperties.value(kitId), this); + if (dlg.exec() != QDialog::Accepted) + return; + + m_customProperties.insert(kitId, dlg.properties()); + mergeCustomPropertiesIntoModel(); + displayCurrentProfile(); +} + +void QbsProfilesSettingsWidget::setupCustomProperties(const ProjectExplorer::Kit *kit) +{ + const QVariantMap &properties + = kit->value(Core::Id(Constants::QBS_PROPERTIES_KEY_FOR_KITS)).toMap(); + m_customProperties.insert(kit->id(), properties); +} + +void QbsProfilesSettingsWidget::mergeCustomPropertiesIntoModel() +{ + QVariantMap customProperties; + for (CustomProperties::ConstIterator it = m_customProperties.constBegin(); + it != m_customProperties.constEnd(); ++it) { + const Core::Id kitId = it.key(); + const ProjectExplorer::Kit * const kit = ProjectExplorer::KitManager::find(kitId); + QTC_ASSERT(kit, continue); + const QString keyPrefix = QLatin1String("profiles.") + QbsManager::profileForKit(kit) + + QLatin1Char('.'); + for (QVariantMap::ConstIterator it2 = it.value().constBegin(); it2 != it.value().constEnd(); + ++it2) { + customProperties.insert(keyPrefix + it2.key(), it2.value()); + } + } + m_model.setAdditionalProperties(customProperties); +} + +} // namespace Internal +} // namespace QbsProjectManager + +#include "qbsprofilessettingspage.moc" diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.h b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.h new file mode 100644 index 00000000000..5f0af3a7a96 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://www.qt.io/licensing. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBSPROFILESSETTINGSPAGE_H +#define QBSPROFILESSETTINGSPAGE_H + +#include + +namespace QbsProjectManager { +namespace Internal { +class QbsProfilesSettingsWidget; + +class QbsProfilesSettingsPage : public Core::IOptionsPage +{ +public: + QbsProfilesSettingsPage(QObject *parent = 0); + +private: + QWidget *widget() Q_DECL_OVERRIDE; + void apply() Q_DECL_OVERRIDE; + void finish() Q_DECL_OVERRIDE; + + QbsProfilesSettingsWidget *m_widget; +}; + +} // namespace Internal +} // namespace QbsProjectManager + +#endif // Include guard. diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui b/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui new file mode 100644 index 00000000000..38a90165767 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingswidget.ui @@ -0,0 +1,125 @@ + + + QbsProjectManager::Internal::QbsProfilesSettingsWidget + + + + 0 + 0 + 421 + 315 + + + + Form + + + + + + + + Kit: + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Associated profile: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + Profile properties: + + + + + + + + + + + + + + E&xpand All + + + + + + + &Collapse All + + + + + + + &Edit... + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp index 5969bfa5ab3..b7cd889c333 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.cpp @@ -110,7 +110,7 @@ ProjectExplorer::Project *QbsManager::openProject(const QString &fileName, QStri return new Internal::QbsProject(this, fileName); } -QString QbsManager::profileForKit(const ProjectExplorer::Kit *k) const +QString QbsManager::profileForKit(const ProjectExplorer::Kit *k) { if (!k) return QString(); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.h b/src/plugins/qbsprojectmanager/qbsprojectmanager.h index 67330ee6fc1..8bffe677299 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.h @@ -70,8 +70,8 @@ public: ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString); // QBS profiles management: - QString profileForKit(const ProjectExplorer::Kit *k) const; - void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k); + static QString profileForKit(const ProjectExplorer::Kit *k); + static void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k); static qbs::Settings *settings() { return m_settings; } static Internal::QbsLogSink *logSink() { return m_logSink; } diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index 65f21669db7..9262c5317b2 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -18,6 +18,7 @@ DEFINES += \ QBSPROJECTMANAGER_LIBRARY HEADERS = \ + customqbspropertiesdialog.h \ defaultpropertyprovider.h \ propertyprovider.h \ qbsbuildconfiguration.h \ @@ -30,6 +31,7 @@ HEADERS = \ qbslogsink.h \ qbsnodes.h \ qbsparser.h \ + qbsprofilessettingspage.h \ qbsproject.h \ qbsprojectfile.h \ qbsprojectmanager.h \ @@ -42,6 +44,7 @@ HEADERS = \ qbsconstants.h SOURCES = \ + customqbspropertiesdialog.cpp \ defaultpropertyprovider.cpp \ qbsbuildconfiguration.cpp \ qbsbuildconfigurationwidget.cpp \ @@ -52,6 +55,7 @@ SOURCES = \ qbslogsink.cpp \ qbsnodes.cpp \ qbsparser.cpp \ + qbsprofilessettingspage.cpp \ qbsproject.cpp \ qbsprojectfile.cpp \ qbsprojectmanager.cpp \ @@ -61,9 +65,11 @@ SOURCES = \ qbsrunconfiguration.cpp FORMS = \ + customqbspropertiesdialog.ui \ qbsbuildstepconfigwidget.ui \ qbscleanstepconfigwidget.ui \ - qbsinstallstepconfigwidget.ui + qbsinstallstepconfigwidget.ui \ + qbsprofilessettingswidget.ui RESOURCES += \ qbsprojectmanager.qrc diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index d026f069f3a..175c6c24efb 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -61,7 +61,9 @@ QtcPlugin { cpp.dynamicLibraries: base.concat(externalQbsDynamicLibraries) files: [ - "qbsprojectmanager.qrc", + "customqbspropertiesdialog.h", + "customqbspropertiesdialog.cpp", + "customqbspropertiesdialog.ui", "defaultpropertyprovider.cpp", "defaultpropertyprovider.h", "propertyprovider.h", @@ -88,12 +90,16 @@ QtcPlugin { "qbsnodes.h", "qbsparser.cpp", "qbsparser.h", + "qbsprofilessettingspage.cpp", + "qbsprofilessettingspage.h", + "qbsprofilessettingswidget.ui", "qbsproject.cpp", "qbsproject.h", "qbsprojectfile.cpp", "qbsprojectfile.h", "qbsprojectmanager.cpp", "qbsprojectmanager.h", + "qbsprojectmanager.qrc", "qbsprojectmanager_global.h", "qbsprojectmanagerconstants.h", "qbsprojectmanagerplugin.cpp", diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index dc5bbe251a3..61c18136689 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -36,6 +36,7 @@ #include "qbsdeployconfigurationfactory.h" #include "qbsinstallstep.h" #include "qbsnodes.h" +#include "qbsprofilessettingspage.h" #include "qbsproject.h" #include "qbsprojectmanager.h" #include "qbsprojectmanagerconstants.h" @@ -104,6 +105,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * addAutoReleasedObject(new QbsInstallStepFactory); addAutoReleasedObject(new QbsDeployConfigurationFactory); addAutoReleasedObject(new QbsRunConfigurationFactory); + addAutoReleasedObject(new QbsProfilesSettingsPage); //menus // Build Menu: