From f75abb341ecd6f7f11a9b9ae01605135f3953ca3 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar <nikolai.kosjar@nokia.com> Date: Mon, 9 Jan 2012 16:23:40 +0100 Subject: [PATCH] Deploy steps: Introduce SimpleBuildStepConfigWidget. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This simplifies some deploy steps and replaces RemoteLinuxDeployStepWidget. Change-Id: I4ad82c498cee0f15e1c93bf915cd48355017eb84 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com> Reviewed-by: Paweł Polański <pawel.3.polanski@nokia.com> --- src/plugins/projectexplorer/buildstep.h | 22 ++++++ .../qt-s60/s60deploystep.cpp | 25 +----- .../qt4projectmanager/qt-s60/s60deploystep.h | 11 --- .../abstractremotelinuxdeploystep.cpp | 3 +- .../remotelinux/genericdirectuploadstep.cpp | 3 +- src/plugins/remotelinux/remotelinux.pro | 2 - ...remotelinuxcustomcommanddeploymentstep.cpp | 4 +- .../remotelinuxdeploystepwidget.cpp | 77 ------------------- .../remotelinux/remotelinuxdeploystepwidget.h | 64 --------------- .../remotelinux/tarpackagecreationstep.cpp | 19 ++--- .../uploadandinstalltarpackagestep.cpp | 25 +----- 11 files changed, 34 insertions(+), 221 deletions(-) delete mode 100644 src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp delete mode 100644 src/plugins/remotelinux/remotelinuxdeploystepwidget.h diff --git a/src/plugins/projectexplorer/buildstep.h b/src/plugins/projectexplorer/buildstep.h index d0eb7f223dc..7f45fc99479 100644 --- a/src/plugins/projectexplorer/buildstep.h +++ b/src/plugins/projectexplorer/buildstep.h @@ -147,6 +147,28 @@ signals: void updateAdditionalSummary(); }; +class PROJECTEXPLORER_EXPORT SimpleBuildStepConfigWidget + : public BuildStepConfigWidget +{ + Q_OBJECT +public: + SimpleBuildStepConfigWidget(BuildStep *step) + : m_step(step) + { + connect(m_step, SIGNAL(displayNameChanged()), SIGNAL(updateSummary())); + } + + ~SimpleBuildStepConfigWidget() {} + + QString summaryText() const { return QString("<b>%1</b>").arg(displayName()); } + QString displayName() const { return m_step->displayName(); } + bool showWidget() const { return false; } + BuildStep *step() const { return m_step; } + +private: + BuildStep *m_step; +}; + } // namespace ProjectExplorer Q_DECLARE_METATYPE(ProjectExplorer::BuildStep::OutputFormat) diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp index 476e50e50c6..5531fa55727 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp @@ -135,7 +135,7 @@ S60DeployStep::S60DeployStep(ProjectExplorer::BuildStepList *bc): void S60DeployStep::ctor() { //: Qt4 Deploystep display name - setDefaultDisplayName(tr("Deploy")); + setDefaultDisplayName(tr("Deploy SIS Package")); m_timeoutTimer->setSingleShot(true); m_timeoutTimer->setInterval(10000); connect(m_timeoutTimer, SIGNAL(timeout()), this, SLOT(timeout())); @@ -657,30 +657,9 @@ void S60DeployStep::timeout() reportError(tr("A timeout while deploying has occurred. CODA might not be responding. Try reconnecting the device.")); } -// #pragma mark -- S60DeployStepWidget - BuildStepConfigWidget *S60DeployStep::createConfigWidget() { - return new S60DeployStepWidget(); -} - -S60DeployStepWidget::S60DeployStepWidget() : ProjectExplorer::BuildStepConfigWidget() -{ -} - -QString S60DeployStepWidget::summaryText() const -{ - return QString("<b>%1</b>").arg(displayName()); -} - -QString S60DeployStepWidget::displayName() const -{ - return tr("Deploy SIS Package"); -} - -bool S60DeployStepWidget::showWidget() const -{ - return false; + return new SimpleBuildStepConfigWidget(this); } // #pragma mark -- S60DeployStepFactory diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h index 641e9fd26d6..ee8ba9d8bd0 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.h @@ -207,17 +207,6 @@ private: int m_copyProgress; }; -class S60DeployStepWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - S60DeployStepWidget(); - - QString summaryText() const; - QString displayName() const; - bool showWidget() const; -}; - } // Internal } // Qt4ProjectManager diff --git a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp index bdf98dec228..4140a1b9532 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeploystep.cpp @@ -33,7 +33,6 @@ #include "abstractremotelinuxdeployservice.h" #include "remotelinuxdeployconfiguration.h" -#include "remotelinuxdeploystepwidget.h" #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/target.h> @@ -115,7 +114,7 @@ void AbstractRemoteLinuxDeployStep::cancel() BuildStepConfigWidget *AbstractRemoteLinuxDeployStep::createConfigWidget() { - return new RemoteLinuxDeployStepWidget(this); + return new SimpleBuildStepConfigWidget(this); } RemoteLinuxDeployConfiguration *AbstractRemoteLinuxDeployStep::deployConfiguration() const diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 8323ce6b07c..7ac2818b0e0 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -35,7 +35,6 @@ #include "deploymentinfo.h" #include "genericdirectuploadservice.h" #include "remotelinuxdeployconfiguration.h" -#include "remotelinuxdeploystepwidget.h" #include <QtGui/QCheckBox> #include <QtGui/QVBoxLayout> @@ -78,7 +77,7 @@ private: myStep()->setIncrementalDeployment(incremental); } - RemoteLinuxDeployStepWidget m_widget; + SimpleBuildStepConfigWidget m_widget; QCheckBox m_incrementalCheckBox; }; diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 00990e02520..184f91c21ac 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -47,7 +47,6 @@ HEADERS += \ linuxdevicetestdialog.h \ remotelinuxprocesslist.h \ remotelinuxprocessesdialog.h \ - remotelinuxdeploystepwidget.h \ linuxdeviceconfigurationssettingswidget.h \ remotelinuxenvironmentreader.h \ sshkeydeployer.h \ @@ -103,7 +102,6 @@ SOURCES += \ linuxdevicetestdialog.cpp \ remotelinuxprocesslist.cpp \ remotelinuxprocessesdialog.cpp \ - remotelinuxdeploystepwidget.cpp \ linuxdeviceconfigurationssettingswidget.cpp \ remotelinuxenvironmentreader.cpp \ sshkeydeployer.cpp \ diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp index 0798243f85a..a05c0b64df7 100644 --- a/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeploymentstep.cpp @@ -31,8 +31,6 @@ **************************************************************************/ #include "remotelinuxcustomcommanddeploymentstep.h" -#include "remotelinuxdeploystepwidget.h" - #include <QtCore/QString> #include <QtGui/QHBoxLayout> #include <QtGui/QLabel> @@ -80,7 +78,7 @@ private: AbstractRemoteLinuxCustomCommandDeploymentStep * const m_step; QLineEdit m_commandLineEdit; - RemoteLinuxDeployStepWidget m_widget; + SimpleBuildStepConfigWidget m_widget; }; } // anonymous namespace diff --git a/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp b/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp deleted file mode 100644 index 7b76707c5f5..00000000000 --- a/src/plugins/remotelinux/remotelinuxdeploystepwidget.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ -#include "remotelinuxdeploystepwidget.h" - -#include "abstractremotelinuxdeploystep.h" -#include "deploymentinfo.h" -#include "remotelinuxdeployconfiguration.h" -#include "remotelinuxutils.h" - -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> - -using namespace ProjectExplorer; -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -using namespace Internal; - -RemoteLinuxDeployStepWidget::RemoteLinuxDeployStepWidget(AbstractRemoteLinuxDeployStep *step) - : m_step(step) -{ - BuildStepList * const list = step->deployConfiguration()->stepList(); - connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(aboutToRemoveStep(int)), - SLOT(handleStepToBeRemoved(int))); -} - -RemoteLinuxDeployStepWidget::~RemoteLinuxDeployStepWidget() -{ -} - -void RemoteLinuxDeployStepWidget::handleStepToBeRemoved(int step) -{ - BuildStepList * const list = m_step->deployConfiguration()->stepList(); - const AbstractRemoteLinuxDeployStep * const alds - = qobject_cast<AbstractRemoteLinuxDeployStep *>(list->steps().at(step)); - if (alds && alds == m_step) - disconnect(list, 0, this, 0); -} - -QString RemoteLinuxDeployStepWidget::summaryText() const -{ - return tr("<b>%1</b>").arg(m_step->displayName()); -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxdeploystepwidget.h b/src/plugins/remotelinux/remotelinuxdeploystepwidget.h deleted file mode 100644 index 54e047e0f9a..00000000000 --- a/src/plugins/remotelinux/remotelinuxdeploystepwidget.h +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef REMOTELINUXDEPLOYSTEPWIDGET_H -#define REMOTELINUXDEPLOYSTEPWIDGET_H - -#include "remotelinux_export.h" - -#include <projectexplorer/buildstep.h> - -namespace RemoteLinux { -class AbstractRemoteLinuxDeployStep; - -class REMOTELINUX_EXPORT RemoteLinuxDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT - -public: - RemoteLinuxDeployStepWidget(AbstractRemoteLinuxDeployStep *step); - ~RemoteLinuxDeployStepWidget(); - - QString summaryText() const; - QString displayName() const { return QString(); } - - AbstractRemoteLinuxDeployStep *step() const { return m_step; } - -private: - Q_SLOT void handleStepToBeRemoved(int step); - - AbstractRemoteLinuxDeployStep * const m_step; -}; - -} // namespace RemoteLinux - -#endif // REMOTELINUXDEPLOYSTEPWIDGET_H diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index 33d47e3ce77..c31b09bf9bc 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -47,32 +47,25 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace { -class CreateTarStepWidget : public BuildStepConfigWidget +class CreateTarStepWidget : public SimpleBuildStepConfigWidget { Q_OBJECT public: - CreateTarStepWidget(TarPackageCreationStep *step) : m_step(step) + CreateTarStepWidget(TarPackageCreationStep *step) : SimpleBuildStepConfigWidget(step) { - connect(m_step, SIGNAL(packageFilePathChanged()), SIGNAL(updateSummary())); + connect(step, SIGNAL(packageFilePathChanged()), SIGNAL(updateSummary())); } QString summaryText() const { - if (m_step->packageFilePath().isEmpty()) { + TarPackageCreationStep * const step = qobject_cast<TarPackageCreationStep *>(this->step()); + if (step->packageFilePath().isEmpty()) { return QLatin1String("<font color=\"red\">") + tr("Tarball creation not possible.") + QLatin1String("</font>"); } - return QLatin1String("<b>") + tr("Create tarball:") + QLatin1String("</b> ") - + m_step->packageFilePath(); + + step->packageFilePath(); } - - QString displayName() const { return QString(); } - - bool showWidget() const { return false; } - -private: - const TarPackageCreationStep * const m_step; }; diff --git a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp index 22dc896c42f..918e05aba92 100644 --- a/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp +++ b/src/plugins/remotelinux/uploadandinstalltarpackagestep.cpp @@ -32,7 +32,6 @@ #include "uploadandinstalltarpackagestep.h" #include "remotelinuxdeployconfiguration.h" -#include "remotelinuxdeploystepwidget.h" #include "remotelinuxpackageinstaller.h" #include "tarpackagecreationstep.h" @@ -42,26 +41,6 @@ using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -namespace { - -class ConfigWidget : public BuildStepConfigWidget -{ - Q_OBJECT -public: - ConfigWidget(UploadAndInstallTarPackageStep *step) : m_widget(step) - { - connect(&m_widget, SIGNAL(updateSummary()), SIGNAL(updateSummary())); - } - ~ConfigWidget() {} - -private: - QString summaryText() const { return m_widget.summaryText(); } - QString displayName() const { return m_widget.displayName(); } - bool showWidget() const { return false; } - - RemoteLinuxDeployStepWidget m_widget; -}; -} // anonymous namespace class UploadAndInstallTarPackageServicePrivate { @@ -124,7 +103,7 @@ bool UploadAndInstallTarPackageStep::initInternal(QString *error) BuildStepConfigWidget *UploadAndInstallTarPackageStep::createConfigWidget() { - return new ConfigWidget(this); + return new SimpleBuildStepConfigWidget(this); } QString UploadAndInstallTarPackageStep::stepId() @@ -138,5 +117,3 @@ QString UploadAndInstallTarPackageStep::displayName() } } //namespace RemoteLinux - -#include "uploadandinstalltarpackagestep.moc" -- GitLab