From eaabc261265340c94b770997f6893e82c3423276 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 9 Feb 2016 15:56:48 +0100 Subject: [PATCH] QbsProjectManager: Display qbs version in settings page. Task-number: QBS-855 Change-Id: I2f9c5536a79a8a5564daeca869c1d7951732658c Reviewed-by: Leena Miettinen Reviewed-by: Jake Petroules --- src/plugins/qbsprojectmanager/qbsinfopage.cpp | 76 +++++++++++++++++++ src/plugins/qbsprojectmanager/qbsinfopage.h | 48 ++++++++++++ .../qbsprojectmanager/qbsinfowidget.ui | 35 +++++++++ .../qbsprojectmanager/qbsprojectmanager.pro | 3 + .../qbsprojectmanager/qbsprojectmanager.qbs | 5 +- .../qbsprojectmanagerplugin.cpp | 2 + 6 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 src/plugins/qbsprojectmanager/qbsinfopage.cpp create mode 100644 src/plugins/qbsprojectmanager/qbsinfopage.h create mode 100644 src/plugins/qbsprojectmanager/qbsinfowidget.ui diff --git a/src/plugins/qbsprojectmanager/qbsinfopage.cpp b/src/plugins/qbsprojectmanager/qbsinfopage.cpp new file mode 100644 index 00000000000..2432c48fe32 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsinfopage.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "qbsinfopage.h" +#include "ui_qbsinfowidget.h" + +#include "qbsconstants.h" + +#include + +namespace QbsProjectManager { +namespace Internal { + +class QbsInfoWidget : public QWidget +{ + Q_OBJECT +public: + QbsInfoWidget(QWidget *parent = 0) : QWidget(parent) + { + m_ui.setupUi(this); + m_ui.versionValueLabel->setText(qbs::LanguageInfo::qbsVersion()); + } + + Ui::QbsInfoWidget m_ui; +}; + + +QbsInfoPage::QbsInfoPage(QObject *parent) : Core::IOptionsPage(parent), m_widget(nullptr) +{ + setId("AB.QbsInfo"); + setDisplayName(QCoreApplication::translate("QbsProjectManager", "Version Info")); + setCategory(Constants::QBS_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("QbsProjectManager", + Constants::QBS_SETTINGS_TR_CATEGORY)); + setCategoryIcon(QLatin1String(Constants::QBS_SETTINGS_CATEGORY_ICON)); +} + +QWidget *QbsInfoPage::widget() +{ + if (!m_widget) + m_widget = new QbsInfoWidget; + return m_widget; +} + +void QbsInfoPage::finish() +{ + delete m_widget; + m_widget = nullptr; +} + +} // namespace Internal +} // namespace QbsProjectManager + +#include "qbsinfopage.moc" diff --git a/src/plugins/qbsprojectmanager/qbsinfopage.h b/src/plugins/qbsprojectmanager/qbsinfopage.h new file mode 100644 index 00000000000..f7cfa882d62 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsinfopage.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +namespace QbsProjectManager { +namespace Internal { +class QbsInfoWidget; + +class QbsInfoPage : public Core::IOptionsPage +{ +public: + QbsInfoPage(QObject *parent = nullptr); + +private: + QWidget *widget() override; + void apply() override { }; + void finish() override; + + QbsInfoWidget *m_widget; +}; + +} // namespace Internal +} // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsinfowidget.ui b/src/plugins/qbsprojectmanager/qbsinfowidget.ui new file mode 100644 index 00000000000..5f7bffd73b8 --- /dev/null +++ b/src/plugins/qbsprojectmanager/qbsinfowidget.ui @@ -0,0 +1,35 @@ + + + QbsProjectManager::Internal::QbsInfoWidget + + + + 0 + 0 + 229 + 40 + + + + Form + + + + + + Qbs version: + + + + + + + + + + + + + + + diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index 9a905b529a3..f21a589e301 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -26,6 +26,7 @@ HEADERS = \ qbsbuildstep.h \ qbscleanstep.h \ qbsdeployconfigurationfactory.h \ + qbsinfopage.h \ qbsinstallstep.h \ qbslogsink.h \ qbsnodes.h \ @@ -49,6 +50,7 @@ SOURCES = \ qbsbuildstep.cpp \ qbscleanstep.cpp \ qbsdeployconfigurationfactory.cpp \ + qbsinfopage.cpp \ qbsinstallstep.cpp \ qbslogsink.cpp \ qbsnodes.cpp \ @@ -65,6 +67,7 @@ FORMS = \ customqbspropertiesdialog.ui \ qbsbuildstepconfigwidget.ui \ qbscleanstepconfigwidget.ui \ + qbsinfowidget.ui \ qbsinstallstepconfigwidget.ui \ qbsprofilessettingswidget.ui diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index a517a7662eb..eee1a7b50d0 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -78,6 +78,9 @@ QtcPlugin { "qbsconstants.h", "qbsdeployconfigurationfactory.cpp", "qbsdeployconfigurationfactory.h", + "qbsinfopage.cpp", + "qbsinfopage.h", + "qbsinfowidget.ui", "qbsinstallstep.cpp", "qbsinstallstep.h", "qbsinstallstepconfigwidget.ui", @@ -104,7 +107,7 @@ QtcPlugin { "qbsprojectparser.cpp", "qbsprojectparser.h", "qbsrunconfiguration.cpp", - "qbsrunconfiguration.h" + "qbsrunconfiguration.h", ] } diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index 68dac074bf9..2bd00069782 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -29,6 +29,7 @@ #include "qbsbuildstep.h" #include "qbscleanstep.h" #include "qbsdeployconfigurationfactory.h" +#include "qbsinfopage.h" #include "qbsinstallstep.h" #include "qbsnodes.h" #include "qbsprofilessettingspage.h" @@ -104,6 +105,7 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * addAutoReleasedObject(new QbsDeployConfigurationFactory); addAutoReleasedObject(new QbsRunConfigurationFactory); addAutoReleasedObject(new QbsProfilesSettingsPage); + addAutoReleasedObject(new QbsInfoPage); //menus // Build Menu: