diff options
Diffstat (limited to 'src')
60 files changed, 307 insertions, 2197 deletions
diff --git a/src/plugins/madde/Madde.pluginspec.in b/src/plugins/madde/Madde.pluginspec.in index 83445ce9ea4..b217e0fad1e 100644 --- a/src/plugins/madde/Madde.pluginspec.in +++ b/src/plugins/madde/Madde.pluginspec.in @@ -15,5 +15,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General <url>http://www.qt-project.org</url> <dependencyList> <dependency name=\"RemoteLinux\" version=\"$$QTCREATOR_VERSION\"/> + <dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/> </dependencyList> </plugin> diff --git a/src/plugins/madde/madde.pro b/src/plugins/madde/madde.pro index b72a2043393..35205d52c52 100644 --- a/src/plugins/madde/madde.pro +++ b/src/plugins/madde/madde.pro @@ -36,7 +36,6 @@ HEADERS += \ maemoqemusettings.h \ qt4maemodeployconfiguration.h \ maemodeviceconfigwizard.h \ - maemodeployconfigurationwidget.h \ maemoinstalltosysrootstep.h \ maemodeploymentmounter.h \ maemopackageinstaller.h \ @@ -79,7 +78,6 @@ SOURCES += \ maemoqemusettings.cpp \ qt4maemodeployconfiguration.cpp \ maemodeviceconfigwizard.cpp \ - maemodeployconfigurationwidget.cpp \ maemoinstalltosysrootstep.cpp \ maemodeploymentmounter.cpp \ maemopackageinstaller.cpp \ @@ -105,8 +103,7 @@ FORMS += \ maemodeviceconfigwizardpreviouskeysetupcheckpage.ui \ maemodeviceconfigwizardreusekeyscheckpage.ui \ maemodeviceconfigwizardkeycreationpage.ui \ - maemodeviceconfigwizardkeydeploymentpage.ui \ - maemodeployconfigurationwidget.ui + maemodeviceconfigwizardkeydeploymentpage.ui RESOURCES += qt-maemo.qrc DEFINES += QT_NO_CAST_TO_ASCII diff --git a/src/plugins/madde/madde.qbs b/src/plugins/madde/madde.qbs index 9ed834d1dbf..a74597f1273 100644 --- a/src/plugins/madde/madde.qbs +++ b/src/plugins/madde/madde.qbs @@ -33,9 +33,6 @@ QtcPlugin { "maemoconstants.h", "maemodeploybymountsteps.cpp", "maemodeploybymountsteps.h", - "maemodeployconfigurationwidget.cpp", - "maemodeployconfigurationwidget.h", - "maemodeployconfigurationwidget.ui", "maemodeploymentmounter.cpp", "maemodeploymentmounter.h", "maemodeploystepfactory.cpp", diff --git a/src/plugins/madde/madde_dependencies.pri b/src/plugins/madde/madde_dependencies.pri index 94d99fc73dc..630796bcbf7 100644 --- a/src/plugins/madde/madde_dependencies.pri +++ b/src/plugins/madde/madde_dependencies.pri @@ -1 +1,2 @@ +include(../../plugins/qt4projectmanager/qt4projectmanager.pri) include(../../plugins/remotelinux/remotelinux.pri) diff --git a/src/plugins/madde/maemodeploybymountsteps.cpp b/src/plugins/madde/maemodeploybymountsteps.cpp index 0503b9d72ef..0967ae9f25b 100644 --- a/src/plugins/madde/maemodeploybymountsteps.cpp +++ b/src/plugins/madde/maemodeploybymountsteps.cpp @@ -37,14 +37,13 @@ #include "maemoremotecopyfacility.h" #include "qt4maemodeployconfiguration.h" +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qtsupport/baseqtversion.h> #include <qtsupport/qtprofileinformation.h> #include <remotelinux/abstractremotelinuxdeployservice.h> -#include <remotelinux/deployablefile.h> -#include <remotelinux/deploymentinfo.h> #include <remotelinux/linuxdevice.h> #include <utils/qtcassert.h> #include <ssh/sshconnection.h> @@ -131,7 +130,7 @@ private: void cancelInstallation(); void handleInstallationSuccess(); - Q_SLOT void handleFileCopied(const RemoteLinux::DeployableFile&deployable); + Q_SLOT void handleFileCopied(const ProjectExplorer::DeployableFile &deployable); MaemoRemoteCopyFacility * const m_copyFacility; mutable QList<DeployableFile> m_filesToCopy; @@ -327,8 +326,8 @@ MaemoMountAndCopyFilesService::MaemoMountAndCopyFilesService(QObject *parent) connect(m_copyFacility, SIGNAL(stdoutData(QString)), SIGNAL(stdOutData(QString))); connect(m_copyFacility, SIGNAL(stderrData(QString)), SIGNAL(stdErrData(QString))); connect(m_copyFacility, SIGNAL(progress(QString)), SIGNAL(progressMessage(QString))); - connect(m_copyFacility, SIGNAL(fileCopied(RemoteLinux::DeployableFile)), - SLOT(handleFileCopied(RemoteLinux::DeployableFile))); + connect(m_copyFacility, SIGNAL(fileCopied(ProjectExplorer::DeployableFile)), + SLOT(handleFileCopied(ProjectExplorer::DeployableFile))); connect(m_copyFacility, SIGNAL(finished(QString)), SLOT(handleInstallationFinished(QString))); } @@ -337,7 +336,7 @@ bool MaemoMountAndCopyFilesService::isDeploymentNecessary() const m_filesToCopy.clear(); for (int i = 0; i < m_deployableFiles.count(); ++i) { const DeployableFile &d = m_deployableFiles.at(i); - if (hasChangedSinceLastDeployment(d) || QFileInfo(d.localFilePath).isDir()) + if (hasChangedSinceLastDeployment(d) || d.localFilePath().toFileInfo().isDir()) m_filesToCopy << d; } return !m_filesToCopy.isEmpty(); @@ -350,7 +349,7 @@ QList<MaemoMountSpecification> MaemoMountAndCopyFilesService::mountSpecification bool drivesToMount[26]; qFill(drivesToMount, drivesToMount + sizeof drivesToMount / sizeof drivesToMount[0], false); for (int i = 0; i < m_filesToCopy.count(); ++i) { - const QString localDir = QFileInfo(m_filesToCopy.at(i).localFilePath).canonicalPath(); + const QString localDir = m_filesToCopy.at(i).localFilePath().toFileInfo().canonicalPath(); const char driveLetter = localDir.at(0).toLower().toLatin1(); if (driveLetter < 'a' || driveLetter > 'z') { qWarning("Weird: drive letter is '%c'.", driveLetter); @@ -467,12 +466,7 @@ AbstractRemoteLinuxDeployService *MaemoCopyFilesViaMountStep::deployService() co bool MaemoCopyFilesViaMountStep::initInternal(QString *error) { - QList<DeployableFile> deployableFiles; - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); - const int deployableCount = deploymentInfo->deployableCount(); - for (int i = 0; i < deployableCount; ++i) - deployableFiles << deploymentInfo->deployableAt(i); - m_deployService->setDeployableFiles(deployableFiles); + m_deployService->setDeployableFiles(target()->deploymentData().allFiles()); return deployService()->isDeploymentPossible(error); } diff --git a/src/plugins/madde/maemodeployconfigurationwidget.cpp b/src/plugins/madde/maemodeployconfigurationwidget.cpp deleted file mode 100644 index 8f6829a04e4..00000000000 --- a/src/plugins/madde/maemodeployconfigurationwidget.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ -#include "maemodeployconfigurationwidget.h" -#include "ui_maemodeployconfigurationwidget.h" - -#include "maemoglobal.h" -#include "maemoconstants.h" -#include "qt4maemodeployconfiguration.h" - -#include <projectexplorer/profileinformation.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4nodes.h> -#include <remotelinux/deployablefile.h> -#include <remotelinux/deployablefilesperprofile.h> -#include <remotelinux/deploymentinfo.h> -#include <remotelinux/deploymentsettingsassistant.h> -#include <remotelinux/remotelinuxdeployconfigurationwidget.h> -#include <utils/fileutils.h> -#include <utils/qtcassert.h> - -#include <QFileInfo> -#include <QFileDialog> -#include <QMessageBox> -#include <QPixmap> -#include <QVBoxLayout> - -using namespace ProjectExplorer; -using namespace Qt4ProjectManager; -using namespace RemoteLinux; - -namespace Madde { -namespace Internal { - -MaemoDeployConfigurationWidget::MaemoDeployConfigurationWidget(QWidget *parent) - : DeployConfigurationWidget(parent), - ui(new Ui::MaemoDeployConfigurationWidget), - m_remoteLinuxWidget(new RemoteLinuxDeployConfigurationWidget) -{ - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setSpacing(0); - mainLayout->addWidget(m_remoteLinuxWidget); - QWidget * const subWidget = new QWidget; - ui->setupUi(subWidget); - mainLayout->addWidget(subWidget); - mainLayout->addStretch(1); - - connect(m_remoteLinuxWidget, - SIGNAL(currentModelChanged(const RemoteLinux::DeployableFilesPerProFile*)), - SLOT(handleCurrentModelChanged(const RemoteLinux::DeployableFilesPerProFile*))); - handleCurrentModelChanged(m_remoteLinuxWidget->currentModel()); -} - -MaemoDeployConfigurationWidget::~MaemoDeployConfigurationWidget() -{ - delete ui; -} - -void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc) -{ - m_remoteLinuxWidget->init(dc); - connect(ui->addDesktopFileButton, SIGNAL(clicked()), SLOT(addDesktopFile())); - connect(ui->addIconButton, SIGNAL(clicked()), SLOT(addIcon())); - connect(deployConfiguration()->deploymentInfo(), SIGNAL(modelAboutToBeReset()), - SLOT(handleDeploymentInfoToBeReset())); -} - -Qt4MaemoDeployConfiguration *MaemoDeployConfigurationWidget::deployConfiguration() const -{ - return qobject_cast<Qt4MaemoDeployConfiguration *>(m_remoteLinuxWidget->deployConfiguration()); -} - -void MaemoDeployConfigurationWidget::handleDeploymentInfoToBeReset() -{ - ui->addDesktopFileButton->setEnabled(false); - ui->addIconButton->setEnabled(false); -} - -void MaemoDeployConfigurationWidget::handleCurrentModelChanged(const DeployableFilesPerProFile *proFileInfo) -{ - ui->addDesktopFileButton->setEnabled(canAddDesktopFile(proFileInfo)); - ui->addIconButton->setEnabled(canAddIcon(proFileInfo)); -} - -void MaemoDeployConfigurationWidget::addDesktopFile() -{ - DeployableFilesPerProFile * const proFileInfo = m_remoteLinuxWidget->currentModel(); - QTC_ASSERT(canAddDesktopFile(proFileInfo), return); - - const QString desktopFilePath = QFileInfo(proFileInfo->proFilePath()).path() - + QLatin1Char('/') + proFileInfo->projectName() + QLatin1String(".desktop"); - if (!QFile::exists(desktopFilePath)) { - const QString desktopTemplate = QLatin1String("[Desktop Entry]\nEncoding=UTF-8\n" - "Version=1.0\nType=Application\nTerminal=false\nName=%1\nExec=%2\n" - "Icon=%1\nX-Window-Icon=\nX-HildonDesk-ShowInToolbar=true\n" - "X-Osso-Type=application/x-executable\n"); - Utils::FileSaver saver(desktopFilePath); - saver.write(desktopTemplate.arg(proFileInfo->projectName(), - proFileInfo->remoteExecutableFilePath()).toUtf8()); - if (!saver.finalize(this)) - return; - } - - DeployableFile d; - d.remoteDir = QLatin1String("/usr/share/applications"); - Core::Id deviceType - = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(deployConfiguration()->target()->profile()); - if (deviceType == Maemo5OsType) - d.remoteDir += QLatin1String("/hildon"); - d.localFilePath = desktopFilePath; - if (!deployConfiguration()->deploymentSettingsAssistant() - ->addDeployableToProFile(deployConfiguration()->qmakeScope(), proFileInfo, - QLatin1String("desktopfile"), d)) { - QMessageBox::critical(this, tr("Project File Update Failed"), - tr("Could not update the project file.")); - } else { - ui->addDesktopFileButton->setEnabled(false); - } -} - -void MaemoDeployConfigurationWidget::addIcon() -{ - DeployableFilesPerProFile * const proFileInfo = m_remoteLinuxWidget->currentModel(); - const int iconDim - = MaemoGlobal::applicationIconSize(deployConfiguration()->target()); - const QString origFilePath = QFileDialog::getOpenFileName(this, - tr("Choose Icon (will be scaled to %1x%1 pixels, if necessary)").arg(iconDim), - proFileInfo->projectDir(), QLatin1String("(*.png)")); - if (origFilePath.isEmpty()) - return; - QPixmap pixmap(origFilePath); - if (pixmap.isNull()) { - QMessageBox::critical(this, tr("Invalid Icon"), - tr("Unable to read image")); - return; - } - const QSize iconSize(iconDim, iconDim); - if (pixmap.size() != iconSize) - pixmap = pixmap.scaled(iconSize); - const QString newFileName = proFileInfo->projectName() + QLatin1Char('.') - + QFileInfo(origFilePath).suffix(); - const QString newFilePath = proFileInfo->projectDir() + QLatin1Char('/') + newFileName; - if (!pixmap.save(newFilePath)) { - QMessageBox::critical(this, tr("Failed to Save Icon"), - tr("Could not save icon to '%1'.").arg(newFilePath)); - return; - } - - if (!deployConfiguration()->deploymentSettingsAssistant() - ->addDeployableToProFile(deployConfiguration()->qmakeScope(), proFileInfo, - QLatin1String("icon"), DeployableFile(newFilePath, remoteIconDir()))) { - QMessageBox::critical(this, tr("Project File Update Failed"), - tr("Could not update the project file.")); - } else { - ui->addIconButton->setEnabled(false); - } -} - -bool MaemoDeployConfigurationWidget::canAddDesktopFile(const DeployableFilesPerProFile *proFileInfo) const -{ - return proFileInfo && proFileInfo->isApplicationProject() - && deployConfiguration()->localDesktopFilePath(proFileInfo).isEmpty(); -} - -bool MaemoDeployConfigurationWidget::canAddIcon(const DeployableFilesPerProFile *proFileInfo) const -{ - return proFileInfo && proFileInfo->isApplicationProject() - && remoteIconFilePath(proFileInfo).isEmpty(); -} - -QString MaemoDeployConfigurationWidget::remoteIconFilePath(const DeployableFilesPerProFile *proFileInfo) const -{ - QTC_ASSERT(proFileInfo->projectType() == ApplicationTemplate, return QString()); - - const QStringList imageTypes = QStringList() << QLatin1String("jpg") << QLatin1String("png") - << QLatin1String("svg"); - for (int i = 0; i < proFileInfo->rowCount(); ++i) { - const DeployableFile &d = proFileInfo->deployableAt(i); - const QString extension = QFileInfo(d.localFilePath).suffix(); - if (d.remoteDir.startsWith(remoteIconDir()) && imageTypes.contains(extension)) - return d.remoteDir + QLatin1Char('/') + QFileInfo(d.localFilePath).fileName(); - } - return QString(); -} - -QString MaemoDeployConfigurationWidget::remoteIconDir() const -{ - return QString::fromLatin1("/usr/share/icons/hicolor/%1x%1/apps") - .arg(MaemoGlobal::applicationIconSize(deployConfiguration()->target())); -} - -} // namespace Internal -} // namespace Madde diff --git a/src/plugins/madde/maemodeployconfigurationwidget.h b/src/plugins/madde/maemodeployconfigurationwidget.h deleted file mode 100644 index 21c6353c017..00000000000 --- a/src/plugins/madde/maemodeployconfigurationwidget.h +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ - -#ifndef MAEMODEPLOYCONFIGURATIONWIDGET_H -#define MAEMODEPLOYCONFIGURATIONWIDGET_H - -#include <projectexplorer/deployconfiguration.h> - -namespace RemoteLinux { -class DeployableFilesPerProFile; -class RemoteLinuxDeployConfigurationWidget; -} - -namespace Madde { -namespace Internal { - -class Qt4MaemoDeployConfiguration; -namespace Ui { class MaemoDeployConfigurationWidget; } - - -class MaemoDeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget -{ - Q_OBJECT - -public: - explicit MaemoDeployConfigurationWidget(QWidget *parent = 0); - ~MaemoDeployConfigurationWidget(); - - void init(ProjectExplorer::DeployConfiguration *dc); - - Qt4MaemoDeployConfiguration *deployConfiguration() const; - -private slots: - void addDesktopFile(); - void addIcon(); - void handleDeploymentInfoToBeReset(); - void handleCurrentModelChanged(const RemoteLinux::DeployableFilesPerProFile *proFileInfo); - -private: - bool canAddDesktopFile(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const; - bool canAddIcon(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const; - QString remoteIconFilePath(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const; - QString remoteIconDir() const; - - Ui::MaemoDeployConfigurationWidget *ui; - RemoteLinux::RemoteLinuxDeployConfigurationWidget * const m_remoteLinuxWidget; -}; - -} // namespace Internal -} // namespace Madde - -#endif // MAEMODEPLOYCONFIGURATIONWIDGET_H diff --git a/src/plugins/madde/maemodeployconfigurationwidget.ui b/src/plugins/madde/maemodeployconfigurationwidget.ui deleted file mode 100644 index 04f5b74fd91..00000000000 --- a/src/plugins/madde/maemodeployconfigurationwidget.ui +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>Madde::Internal::MaemoDeployConfigurationWidget</class> - <widget class="QWidget" name="Madde::Internal::MaemoDeployConfigurationWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>276</width> - <height>45</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="addDesktopFileButton"> - <property name="text"> - <string>Add Desktop File</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="addIconButton"> - <property name="text"> - <string>Add Launcher Icon...</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/madde/maemoinstalltosysrootstep.cpp b/src/plugins/madde/maemoinstalltosysrootstep.cpp index 7268d2fd78b..29123625231 100644 --- a/src/plugins/madde/maemoinstalltosysrootstep.cpp +++ b/src/plugins/madde/maemoinstalltosysrootstep.cpp @@ -35,13 +35,13 @@ #include "maemopackagecreationstep.h" #include "maemoqtversion.h" -#include <utils/fileutils.h> +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qtsupport/baseqtversion.h> #include <qtsupport/qtprofileinformation.h> -#include <remotelinux/deploymentinfo.h> #include <remotelinux/remotelinuxdeployconfiguration.h> +#include <utils/fileutils.h> #include <QDir> #include <QFileInfo> @@ -282,11 +282,7 @@ bool MaemoCopyToSysrootStep::init() } m_systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(target()->profile()).toString(); - const DeploymentInfo * const deploymentInfo - = static_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo(); - m_files.clear(); - for (int i = 0; i < deploymentInfo->deployableCount(); ++i) - m_files << deploymentInfo->deployableAt(i); + m_files = target()->deploymentData().allFiles(); return true; } @@ -298,13 +294,13 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi) const QChar sep = QLatin1Char('/'); foreach (const DeployableFile &deployable, m_files) { - const QFileInfo localFileInfo(deployable.localFilePath); + const QFileInfo localFileInfo = deployable.localFilePath().toFileInfo(); const QString targetFilePath = m_systemRoot + sep - + deployable.remoteDir + sep + localFileInfo.fileName(); - sysrootDir.mkpath(deployable.remoteDir.mid(1)); + + deployable.remoteDirectory() + sep + localFileInfo.fileName(); + sysrootDir.mkpath(deployable.remoteDirectory().mid(1)); QString errorMsg; Utils::FileUtils::removeRecursively(targetFilePath, &errorMsg); - if (!Utils::FileUtils::copyRecursively(deployable.localFilePath, + if (!Utils::FileUtils::copyRecursively(deployable.localFilePath().toString(), targetFilePath, &errorMsg)) { emit addOutput(tr("Sysroot installation failed: %1\n" " Continuing anyway.").arg(errorMsg), ErrorMessageOutput); diff --git a/src/plugins/madde/maemoinstalltosysrootstep.h b/src/plugins/madde/maemoinstalltosysrootstep.h index 4cb5f8f3198..23293affe66 100644 --- a/src/plugins/madde/maemoinstalltosysrootstep.h +++ b/src/plugins/madde/maemoinstalltosysrootstep.h @@ -33,7 +33,7 @@ #include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildstep.h> -#include <remotelinux/deployablefile.h> +#include <projectexplorer/deployablefile.h> #include <QStringList> @@ -105,7 +105,7 @@ public: static QString displayName(); private: QString m_systemRoot; - QList<RemoteLinux::DeployableFile> m_files; + QList<ProjectExplorer::DeployableFile> m_files; }; class MaemoMakeInstallToSysrootStep : public ProjectExplorer::AbstractProcessStep diff --git a/src/plugins/madde/maemopublisherfremantlefree.cpp b/src/plugins/madde/maemopublisherfremantlefree.cpp index 8ca0d9c7bcf..1907c2cf392 100644 --- a/src/plugins/madde/maemopublisherfremantlefree.cpp +++ b/src/plugins/madde/maemopublisherfremantlefree.cpp @@ -43,8 +43,6 @@ #include <qt4projectmanager/qt4buildconfiguration.h> #include <qtsupport/baseqtversion.h> #include <qtsupport/qtprofileinformation.h> -#include <remotelinux/deployablefilesperprofile.h> -#include <remotelinux/deploymentinfo.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> #include <ssh/sshremoteprocessrunner.h> @@ -153,13 +151,6 @@ void MaemoPublisherFremantleFree::createPackage() return; } - QString error; - if (!updateDesktopFiles(&error)) { - finishWithFailure(error, - tr("Publishing failed: Could not create package.")); - return; - } - emit progressReport(tr("Cleaning up temporary directory...")); AbstractMaemoPackageCreationStep::preparePackagingProcess(m_process, m_buildConfig, m_tmpProjectDir); @@ -542,65 +533,6 @@ void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg, setState(Inactive); } -bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const -{ - bool success = true; - const Qt4MaemoDeployConfiguration *const deployConfig - = qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration()); - QTC_ASSERT(deployConfig, return false); - const DeploymentInfo *const deploymentInfo = deployConfig->deploymentInfo(); - for (int i = 0; i < deploymentInfo->modelCount(); ++i) { - const DeployableFilesPerProFile * const model = deploymentInfo->modelAt(i); - QString desktopFilePath = deployConfig->localDesktopFilePath(model); - if (desktopFilePath.isEmpty()) - continue; - desktopFilePath.replace(model->projectDir(), m_tmpProjectDir); - const QString executableFilePath = model->remoteExecutableFilePath(); - if (executableFilePath.isEmpty()) { - qDebug("%s: Skipping subproject %s with missing deployment information.", - Q_FUNC_INFO, qPrintable(model->proFilePath())); - continue; - } - Utils::FileReader reader; - if (!reader.fetch(desktopFilePath, error)) { - success = false; - continue; - } - QByteArray desktopFileContents = reader.data(); - bool fileNeedsUpdate = addOrReplaceDesktopFileValue(desktopFileContents, - "Exec", executableFilePath.toUtf8()); - if (fileNeedsUpdate) { - Utils::FileSaver saver(desktopFilePath); - saver.write(desktopFileContents); - if (!saver.finalize(error)) - success = false; - } - } - return success; -} - -bool MaemoPublisherFremantleFree::addOrReplaceDesktopFileValue(QByteArray &fileContent, - const QByteArray &key, const QByteArray &newValue) const -{ - const int keyPos = fileContent.indexOf(key + '='); - if (keyPos == -1) { - if (!fileContent.endsWith('\n')) - fileContent += '\n'; - fileContent += key + '=' + newValue + '\n'; - return true; - } - int nextNewlinePos = fileContent.indexOf('\n', keyPos); - if (nextNewlinePos == -1) - nextNewlinePos = fileContent.count(); - const int replacePos = keyPos + key.count() + 1; - const int replaceCount = nextNewlinePos - replacePos; - const QByteArray &oldValue = fileContent.mid(replacePos, replaceCount); - if (oldValue == newValue) - return false; - fileContent.replace(replacePos, replaceCount, newValue); - return true; -} - QStringList MaemoPublisherFremantleFree::findProblems() const { QStringList problems; diff --git a/src/plugins/madde/maemopublisherfremantlefree.h b/src/plugins/madde/maemopublisherfremantlefree.h index d3ee46b60cf..89a26c51e06 100644 --- a/src/plugins/madde/maemopublisherfremantlefree.h +++ b/src/plugins/madde/maemopublisherfremantlefree.h @@ -105,9 +105,6 @@ private: void prepareToSendFile(); void sendFile(); void finishWithFailure(const QString &progressMsg, const QString &resultMsg); - bool updateDesktopFiles(QString *error = 0) const; - bool addOrReplaceDesktopFileValue(QByteArray &fileContent, - const QByteArray &key, const QByteArray &newValue) const; QStringList findProblems() const; const ProjectExplorer::Project * const m_project; diff --git a/src/plugins/madde/maemoremotecopyfacility.cpp b/src/plugins/madde/maemoremotecopyfacility.cpp index d148ca51efa..7292f55cc18 100644 --- a/src/plugins/madde/maemoremotecopyfacility.cpp +++ b/src/plugins/madde/maemoremotecopyfacility.cpp @@ -38,7 +38,6 @@ using namespace ProjectExplorer; using namespace QSsh; -using namespace RemoteLinux; namespace Madde { namespace Internal { @@ -126,18 +125,18 @@ void MaemoRemoteCopyFacility::copyNextFile() const DeployableFile &d = m_deployables.first(); QString sourceFilePath = m_mountPoint; #ifdef Q_OS_WIN - const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath); + const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath().toString()); sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower() + localFilePath.mid(2); #else - sourceFilePath += d.localFilePath; + sourceFilePath += d.localFilePath().toString(); #endif QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -a %2 %3") .arg(MaemoGlobal::remoteSudo(m_devConf->type(), m_devConf->sshParameters().userName), - sourceFilePath, d.remoteDir); + sourceFilePath, d.remoteDirectory()); emit progress(tr("Copying file '%1' to directory '%2' on the device...") - .arg(d.localFilePath, d.remoteDir)); + .arg(d.localFilePath().toString(), d.remoteDirectory())); m_copyRunner->run(command.toUtf8(), m_devConf->sshParameters()); } diff --git a/src/plugins/madde/maemoremotecopyfacility.h b/src/plugins/madde/maemoremotecopyfacility.h index fc3beee28f2..834351176fa 100644 --- a/src/plugins/madde/maemoremotecopyfacility.h +++ b/src/plugins/madde/maemoremotecopyfacility.h @@ -31,7 +31,7 @@ #ifndef MAEMOREMOTECOPYFACILITY_H #define MAEMOREMOTECOPYFACILITY_H -#include <remotelinux/deployablefile.h> +#include <projectexplorer/deployablefile.h> #include <projectexplorer/devicesupport/idevice.h> #include <QList> @@ -54,14 +54,14 @@ public: void copyFiles(QSsh::SshConnection *connection, const ProjectExplorer::IDevice::ConstPtr &device, - const QList<RemoteLinux::DeployableFile> &deployables, const QString &mountPoint); + const QList<ProjectExplorer::DeployableFile> &deployables, const QString &mountPoint); void cancel(); signals: void stdoutData(const QString &output); void stderrData(const QString &output); void progress(const QString &message); - void fileCopied(const RemoteLinux::DeployableFile &deployable); + void fileCopied(const ProjectExplorer::DeployableFile &deployable); void finished(const QString &errorMsg = QString()); private slots: @@ -77,7 +77,7 @@ private: QSsh::SshRemoteProcessRunner *m_copyRunner; QSsh::SshRemoteProcessRunner *m_killProcess; ProjectExplorer::IDevice::ConstPtr m_devConf; - QList<RemoteLinux::DeployableFile> m_deployables; + QList<ProjectExplorer::DeployableFile> m_deployables; QString m_mountPoint; bool m_isCopying; // TODO: Redundant due to being in sync with m_copyRunner? }; diff --git a/src/plugins/madde/maemorunconfiguration.h b/src/plugins/madde/maemorunconfiguration.h index b816f6682df..f84bf0cd4cd 100644 --- a/src/plugins/madde/maemorunconfiguration.h +++ b/src/plugins/madde/maemorunconfiguration.h @@ -40,7 +40,8 @@ class MaemoRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration Q_OBJECT public: - MaemoRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &proFilePath); + MaemoRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, + const QString &projectFilePath); MaemoRunConfiguration(ProjectExplorer::Target *parent, MaemoRunConfiguration *source); QVariantMap toMap() const; diff --git a/src/plugins/madde/maemorunfactories.cpp b/src/plugins/madde/maemorunfactories.cpp index bfa191e9c48..0802294e8c6 100644 --- a/src/plugins/madde/maemorunfactories.cpp +++ b/src/plugins/madde/maemorunfactories.cpp @@ -110,7 +110,8 @@ bool MaemoRunConfigurationFactory::canClone(Target *parent, return false; const RemoteLinuxRunConfiguration * const rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(source); - QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + rlrc->proFilePath(); + QString idStr = QString::fromLatin1(source->id().name()) + QLatin1Char('.') + + rlrc->projectFilePath(); return rlrc && canCreate(parent, Core::Id(idStr)); } @@ -178,7 +179,7 @@ QList<RunConfiguration *> MaemoRunConfigurationFactory::runConfigurationsForNode QList<ProjectExplorer::RunConfiguration *> result; foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc)) - if (mrc->proFilePath() == n->path()) + if (mrc->projectFilePath() == n->path()) result << rc; return result; } diff --git a/src/plugins/madde/qt4maemodeployconfiguration.cpp b/src/plugins/madde/qt4maemodeployconfiguration.cpp index a48668f6440..49ecdc1c3c0 100644 --- a/src/plugins/madde/qt4maemodeployconfiguration.cpp +++ b/src/plugins/madde/qt4maemodeployconfiguration.cpp @@ -33,23 +33,21 @@ #include "maddeuploadandinstallpackagesteps.h" #include "maemoconstants.h" #include "maemodeploybymountsteps.h" -#include "maemodeployconfigurationwidget.h" #include "maemoglobal.h" #include "maemoinstalltosysrootstep.h" #include "maemopackagecreationstep.h" #include <coreplugin/icore.h> #include <projectexplorer/buildsteplist.h> +#include <projectexplorer/deployablefile.h> #include <projectexplorer/target.h> #include <projectexplorer/projectexplorer.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4project.h> #include <qtsupport/qtprofileinformation.h> #include <qtsupport/qtsupportconstants.h> -#include <remotelinux/deployablefile.h> -#include <remotelinux/deployablefilesperprofile.h> -#include <remotelinux/deploymentinfo.h> #include <remotelinux/remotelinuxcheckforfreediskspacestep.h> +#include <remotelinux/remotelinuxdeployconfigurationwidget.h> #include <utils/qtcassert.h> #include <QFileInfo> @@ -62,38 +60,26 @@ using namespace ProjectExplorer; using namespace Qt4ProjectManager; using namespace RemoteLinux; -const char OldDeployConfigId[] = "2.2MaemoDeployConfig"; -const char DEPLOYMENT_ASSISTANT_SETTING[] = "RemoteLinux.DeploymentAssistant"; - namespace Madde { namespace Internal { Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, const Core::Id id, const QString &displayName) : RemoteLinuxDeployConfiguration(target, id, displayName) -{ init(); } +{ + init(); +} Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, Qt4MaemoDeployConfiguration *source) : RemoteLinuxDeployConfiguration(target, source) -{ init(); } - -QString Qt4MaemoDeployConfiguration::localDesktopFilePath(const DeployableFilesPerProFile *proFileInfo) const { - QTC_ASSERT(proFileInfo->projectType() == ApplicationTemplate, return QString()); - - for (int i = 0; i < proFileInfo->rowCount(); ++i) { - const DeployableFile &d = proFileInfo->deployableAt(i); - if (QFileInfo(d.localFilePath).fileName().endsWith(QLatin1String(".desktop"))) - return d.localFilePath; - } - return QString(); + init(); } - DeployConfigurationWidget *Qt4MaemoDeployConfiguration::configurationWidget() const { - return new MaemoDeployConfigurationWidget; + return new RemoteLinuxDeployConfigurationWidget; } Qt4MaemoDeployConfiguration::~Qt4MaemoDeployConfiguration() {} @@ -113,33 +99,6 @@ Core::Id Qt4MaemoDeployConfiguration::harmattanId() return Core::Id("DeployToHarmattan"); } -DeploymentSettingsAssistant *Qt4MaemoDeployConfiguration::deploymentSettingsAssistant() -{ - return static_cast<DeploymentSettingsAssistant *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING)).value<QObject *>()); -} - -QString Qt4MaemoDeployConfiguration::qmakeScope() const -{ - Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile()); - - if (deviceType == Maemo5OsType) - return QLatin1String("maemo5"); - if (deviceType == HarmattanOsType) - return QLatin1String("contains(MEEGO_EDITION,harmattan)"); - return QString("unix"); -} - -QString Qt4MaemoDeployConfiguration::installPrefix() const -{ - Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile()); - - if (deviceType == Maemo5OsType) - return QLatin1String("/opt"); - if (deviceType == HarmattanOsType) - return QLatin1String("/opt"); - return QLatin1String("/usr/local"); -} - void Qt4MaemoDeployConfiguration::debianDirChanged(const Utils::FileName &dir) { if (dir == DebianManager::debianDirectory(target())) @@ -245,15 +204,6 @@ void Qt4MaemoDeployConfiguration::addFilesToProject(const QStringList &files) void Qt4MaemoDeployConfiguration::init() { - // Make sure we have deploymentInfo, but create it only once: - DeploymentSettingsAssistant *assistant - = qobject_cast<DeploymentSettingsAssistant *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING)).value<QObject *>()); - if (!assistant) { - assistant = new DeploymentSettingsAssistant(deploymentInfo(), static_cast<Qt4ProjectManager::Qt4Project *>(target()->project())); - QVariant data = QVariant::fromValue(static_cast<QObject *>(assistant)); - target()->project()->setNamedSettings(QLatin1String(DEPLOYMENT_ASSISTANT_SETTING), data); - } - connect(target()->project(), SIGNAL(fileListChanged()), this, SLOT(setupPackaging())); } @@ -321,25 +271,16 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent, bool Qt4MaemoDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const { Core::Id id = idFromMap(map); - return canHandle(parent) - && (availableCreationIds(parent).contains(id) || id == OldDeployConfigId) + return canHandle(parent) && availableCreationIds(parent).contains(id) && MaemoGlobal::supportsMaemoDevice(parent->profile()); } DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map) { - if (!canRestore(parent, map)) - return 0; - Core::Id id = idFromMap(map); - Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile()); - if (id == OldDeployConfigId) { - if (deviceType == Maemo5OsType) - id = Qt4MaemoDeployConfiguration::fremantleWithPackagingId(); - else if (deviceType == HarmattanOsType) - id = Qt4MaemoDeployConfiguration::harmattanId(); - } + QTC_ASSERT(canRestore(parent, map), return 0); + Qt4MaemoDeployConfiguration * const dc - = qobject_cast<Qt4MaemoDeployConfiguration *>(create(parent, id)); + = qobject_cast<Qt4MaemoDeployConfiguration *>(create(parent, idFromMap(map))); if (!dc->fromMap(map)) { delete dc; return 0; diff --git a/src/plugins/madde/qt4maemodeployconfiguration.h b/src/plugins/madde/qt4maemodeployconfiguration.h index cc08f0ea357..116bef50c29 100644 --- a/src/plugins/madde/qt4maemodeployconfiguration.h +++ b/src/plugins/madde/qt4maemodeployconfiguration.h @@ -31,15 +31,9 @@ #ifndef QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H #define QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H -#include <remotelinux/deploymentsettingsassistant.h> #include <remotelinux/remotelinuxdeployconfiguration.h> #include <utils/fileutils.h> -namespace RemoteLinux { -class DeployableFilesPerProFile; -class DeploymentSettingsAssistant; -} // namespace RemoteLinux - namespace Madde { namespace Internal { @@ -71,17 +65,10 @@ public: ProjectExplorer::DeployConfigurationWidget *configurationWidget() const; - QString localDesktopFilePath(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const; - static Core::Id fremantleWithPackagingId(); static Core::Id fremantleWithoutPackagingId(); static Core::Id harmattanId(); - RemoteLinux::DeploymentSettingsAssistant *deploymentSettingsAssistant(); - - QString qmakeScope() const; - QString installPrefix() const; - private slots: void debianDirChanged(const Utils::FileName &dir); void setupPackaging(); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 6d36a723b21..6ac1e47f56e 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -165,7 +165,7 @@ plugin_remotelinux.subdir = remotelinux plugin_remotelinux.depends += plugin_coreplugin plugin_remotelinux.depends += plugin_debugger plugin_remotelinux.depends += plugin_projectexplorer -plugin_remotelinux.depends += plugin_qt4projectmanager +plugin_remotelinux.depends += plugin_qtsupport plugin_android.subdir = android plugin_android.depends = plugin_coreplugin @@ -175,6 +175,7 @@ plugin_android.depends += plugin_qt4projectmanager plugin_madde.subdir = madde plugin_madde.depends += plugin_remotelinux +plugin_madde.depends += plugin_qt4projectmanager plugin_locator.subdir = locator plugin_locator.depends = plugin_coreplugin diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index fb43cad2403..a1c6a2b84c9 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -43,7 +43,8 @@ class QnxRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration { Q_OBJECT public: - QnxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, const QString &proFilePath); + QnxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, + const QString &projectFilePath); QString environmentPreparationCommand() const; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 4f04f945a06..33c9dea516e 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -1918,7 +1918,6 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) m_subProjectsNotToDeploy = subProjectsNotToDeploy; setupInstallsList(m_readerExact); - setupProjectVersion(m_readerExact); // update other variables QHash<Qt4Variable, QStringList> newVarValues; @@ -2342,59 +2341,6 @@ void Qt4ProFileNode::setupInstallsList(const QtSupport::ProFileReader *reader) } } -void Qt4ProFileNode::setupProjectVersion(const QtSupport::ProFileReader *reader) -{ - m_projectVersion.major = m_projectVersion.minor = m_projectVersion.patch = -1; - bool ok; - int val = reader->value(QLatin1String("VER_MAJ")).toInt(&ok); - if (ok) - m_projectVersion.major = val; - val = reader->value(QLatin1String("VER_MIN")).toInt(&ok); - if (ok) - m_projectVersion.minor = val; - val = reader->value(QLatin1String("VER_PAT")).toInt(&ok); - if (ok) - m_projectVersion.patch = val; - if (m_projectVersion.major != -1 && m_projectVersion.minor != -1 - && m_projectVersion.patch != -1) { - return; - } - - const QString &version = reader->value(QLatin1String("VERSION")); - const QChar dot(QLatin1Char('.')); - int dotIndex = version.indexOf(dot); - if (m_projectVersion.major == -1) { - val = version.left(dotIndex).toInt(&ok); - if (ok) - m_projectVersion.major = val; - } - if (dotIndex != -1) { - int numberStartIndex = dotIndex + 1; - dotIndex = version.indexOf(dot, numberStartIndex); - if (m_projectVersion.minor == -1) { - val = version.mid(numberStartIndex, dotIndex - numberStartIndex).toInt(&ok); - if (ok) - m_projectVersion.minor = val; - } - } - if (dotIndex != -1) { - int numberStartIndex = dotIndex + 1; - dotIndex = version.indexOf(dot, numberStartIndex); - if (m_projectVersion.patch == -1) { - val = version.mid(numberStartIndex, dotIndex - numberStartIndex).toInt(&ok); - if (ok) - m_projectVersion.patch= val; - } - } - - if (m_projectVersion.major == -1) - m_projectVersion.major = 1; - if (m_projectVersion.minor == -1) - m_projectVersion.minor = 0; - if (m_projectVersion.patch == -1) - m_projectVersion.patch = 0; -} - InstallsList Qt4ProFileNode::installsList() const { return m_installsList; diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index 118b3bedc2d..300730eccb6 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -381,7 +381,6 @@ public: TargetInformation targetInformation() const; InstallsList installsList() const; - ProjectVersion projectVersion() const { return m_projectVersion; } QString makefile() const; QString objectExtension() const; @@ -434,7 +433,6 @@ private: TargetInformation targetInformation(QtSupport::ProFileReader *reader) const; void setupInstallsList(const QtSupport::ProFileReader *reader); - void setupProjectVersion(const QtSupport::ProFileReader *reader); Qt4ProjectType m_projectType; Qt4VariablesHash m_varValues; @@ -445,7 +443,6 @@ private: QString m_resolvedMkspecPath; QStringList m_subProjectsNotToDeploy; InstallsList m_installsList; - ProjectVersion m_projectVersion; friend class Qt4NodeHierarchy; bool m_validParse; diff --git a/src/plugins/remotelinux/RemoteLinux.pluginspec.in b/src/plugins/remotelinux/RemoteLinux.pluginspec.in index 8cf3bcec707..84270a6269b 100644 --- a/src/plugins/remotelinux/RemoteLinux.pluginspec.in +++ b/src/plugins/remotelinux/RemoteLinux.pluginspec.in @@ -17,6 +17,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/> <dependency name=\"Debugger\" version=\"$$QTCREATOR_VERSION\"/> <dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/> - <dependency name=\"Qt4ProjectManager\" version=\"$$QTCREATOR_VERSION\"/> + <dependency name=\"QtSupport\" version=\"$$QTCREATOR_VERSION\"/> </dependencyList> </plugin> diff --git a/src/plugins/remotelinux/abstractpackagingstep.cpp b/src/plugins/remotelinux/abstractpackagingstep.cpp index 05a40566313..f002f6988b3 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.cpp +++ b/src/plugins/remotelinux/abstractpackagingstep.cpp @@ -28,12 +28,12 @@ **************************************************************************/ #include "abstractpackagingstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" #include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <projectexplorer/task.h> #include <utils/fileutils.h> @@ -54,6 +54,7 @@ public: BuildConfiguration *currentBuildConfiguration; QString cachedPackageFilePath; QString cachedPackageDirectory; + bool deploymentDataModified; }; } // namespace Internal @@ -77,8 +78,10 @@ void AbstractPackagingStep::ctor() SLOT(handleBuildConfigurationChanged())); handleBuildConfigurationChanged(); - connect(this, SIGNAL(unmodifyDeploymentInfo()), - this, SLOT(setDeploymentInfoUnmodified())); + connect(project(), SIGNAL(buildSystemEvaluated()), SLOT(setDeploymentDataModified())); + setDeploymentDataModified(); + + connect(this, SIGNAL(unmodifyDeploymentData()), this, SLOT(setDeploymentDataUnmodified())); } AbstractPackagingStep::~AbstractPackagingStep() @@ -128,16 +131,16 @@ RemoteLinuxDeployConfiguration *AbstractPackagingStep::deployConfiguration() con bool AbstractPackagingStep::isPackagingNeeded() const { - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); QFileInfo packageInfo(packageFilePath()); - if (!packageInfo.exists() || deploymentInfo->isModified()) + if (!packageInfo.exists() || d->deploymentDataModified) return true; - const int deployableCount = deploymentInfo->deployableCount(); - for (int i = 0; i < deployableCount; ++i) { - if (Utils::FileUtils::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath, - packageInfo.lastModified())) + const DeploymentData &dd = target()->deploymentData(); + for (int i = 0; i < dd.fileCount(); ++i) { + if (Utils::FileUtils::isFileNewerThan(dd.fileAt(i).localFilePath().toString(), + packageInfo.lastModified())) { return true; + } } return false; @@ -158,13 +161,18 @@ void AbstractPackagingStep::setPackagingStarted() void AbstractPackagingStep::setPackagingFinished(bool success) { if (success) - emit unmodifyDeploymentInfo(); + emit unmodifyDeploymentData(); } // called in gui thread -void AbstractPackagingStep::setDeploymentInfoUnmodified() +void AbstractPackagingStep::setDeploymentDataUnmodified() +{ + d->deploymentDataModified = false; +} + +void AbstractPackagingStep::setDeploymentDataModified() { - deployConfiguration()->deploymentInfo()->setUnmodified(); + d->deploymentDataModified = true; } void AbstractPackagingStep::raiseError(const QString &errorMessage) diff --git a/src/plugins/remotelinux/abstractpackagingstep.h b/src/plugins/remotelinux/abstractpackagingstep.h index cdb09dd9c2f..0fcd759b523 100644 --- a/src/plugins/remotelinux/abstractpackagingstep.h +++ b/src/plugins/remotelinux/abstractpackagingstep.h @@ -35,11 +35,8 @@ namespace RemoteLinux { class RemoteLinuxDeployConfiguration; -class DeploymentInfo; -namespace Internal { -class AbstractPackagingStepPrivate; -} +namespace Internal { class AbstractPackagingStepPrivate; } class REMOTELINUX_EXPORT AbstractPackagingStep : public ProjectExplorer::BuildStep { @@ -56,7 +53,7 @@ public: signals: void packageFilePathChanged(); - void unmodifyDeploymentInfo(); + void unmodifyDeploymentData(); protected: void setPackagingStarted(); @@ -71,7 +68,8 @@ protected: private slots: void handleBuildConfigurationChanged(); - void setDeploymentInfoUnmodified(); + void setDeploymentDataUnmodified(); + void setDeploymentDataModified(); private: virtual QString packageFileName() const = 0; diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index e0b3640f89b..978ba516cdf 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -30,9 +30,8 @@ #include "abstractremotelinuxdeployservice.h" -#include "deployablefile.h" - #include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/deployablefile.h> #include <projectexplorer/target.h> #include <qtsupport/qtprofileinformation.h> #include <utils/qtcassert.h> @@ -160,7 +159,7 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile, deviceConfiguration()->sshParameters().host, systemRoot)); return !lastDeployed.isValid() - || QFileInfo(deployableFile.localFilePath).lastModified() > lastDeployed; + || deployableFile.localFilePath().toFileInfo().lastModified() > lastDeployed; } void AbstractRemoteLinuxDeployService::setBuildConfiguration(BuildConfiguration *bc) @@ -236,8 +235,8 @@ QVariantMap AbstractRemoteLinuxDeployService::exportDeployTimes() const QVariantList timeList; typedef QHash<DeployParameters, QDateTime>::ConstIterator DepIt; for (DepIt it = d->lastDeployed.begin(); it != d->lastDeployed.end(); ++it) { - fileList << it.key().file.localFilePath; - remotePathList << it.key().file.remoteDir; + fileList << it.key().file.localFilePath().toString(); + remotePathList << it.key().file.remoteDirectory(); hostList << it.key().host; sysrootList << it.key().sysroot; timeList << it.value(); diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h index 0060db5df71..0cae51e5861 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h @@ -42,16 +42,12 @@ namespace QSsh { class SshConnection; } namespace ProjectExplorer { class BuildConfiguration; +class DeployableFile; class Profile; } namespace RemoteLinux { -class DeployableFile; -class DeploymentInfo; - -namespace Internal { -class AbstractRemoteLinuxDeployServicePrivate; -} +namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; } class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject { @@ -83,8 +79,8 @@ protected: ProjectExplorer::IDevice::ConstPtr deviceConfiguration() const; QSsh::SshConnection *connection() const; - void saveDeploymentTimeStamp(const DeployableFile &deployableFile); - bool hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const; + void saveDeploymentTimeStamp(const ProjectExplorer::DeployableFile &deployableFile); + bool hasChangedSinceLastDeployment(const ProjectExplorer::DeployableFile &deployableFile) const; void handleDeviceSetupDone(bool success); void handleDeploymentDone(); diff --git a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp index 9683622d563..07a58d35a8a 100644 --- a/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp +++ b/src/plugins/remotelinux/abstractuploadandinstallpackageservice.cpp @@ -30,16 +30,18 @@ #include "abstractuploadandinstallpackageservice.h" -#include "deployablefile.h" #include "packageuploader.h" #include "remotelinuxpackageinstaller.h" +#include <projectexplorer/deployablefile.h> #include <utils/qtcassert.h> #include <ssh/sshconnection.h> #include <QFileInfo> #include <QString> +using namespace ProjectExplorer; + namespace RemoteLinux { namespace Internal { namespace { diff --git a/src/plugins/remotelinux/deployablefile.h b/src/plugins/remotelinux/deployablefile.h deleted file mode 100644 index ed4041d4f70..00000000000 --- a/src/plugins/remotelinux/deployablefile.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ - -#ifndef DEPLOYABLEFILE_H -#define DEPLOYABLEFILE_H - -#include "remotelinux_export.h" - -#include <QFileInfo> -#include <QHash> -#include <QString> - -namespace RemoteLinux { - -class REMOTELINUX_EXPORT DeployableFile -{ -public: - DeployableFile() {} - - DeployableFile(const QString &localFilePath, const QString &remoteDir) - : localFilePath(localFilePath), remoteDir(remoteDir) {} - - bool operator==(const DeployableFile &other) const - { - return localFilePath == other.localFilePath - && remoteDir == other.remoteDir; - } - - QString remoteFilePath() const { - return remoteDir + QLatin1Char('/') + QFileInfo(localFilePath).fileName(); - } - - QString localFilePath; - QString remoteDir; -}; - -inline uint qHash(const DeployableFile &d) -{ - return qHash(qMakePair(d.localFilePath, d.remoteDir)); -} - -} // namespace RemoteLinux - -#endif // DEPLOYABLEFILE_H diff --git a/src/plugins/remotelinux/deployablefilesperprofile.cpp b/src/plugins/remotelinux/deployablefilesperprofile.cpp deleted file mode 100644 index a7b930c9741..00000000000 --- a/src/plugins/remotelinux/deployablefilesperprofile.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ -#include "deployablefilesperprofile.h" - -#include "deployablefile.h" - -#include <utils/qtcassert.h> - -#include <QFileInfo> -#include <QDir> -#include <QBrush> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -class DeployableFilesPerProFilePrivate -{ -public: - DeployableFilesPerProFilePrivate(const Qt4ProFileNode *proFileNode) - : projectType(proFileNode->projectType()), - proFilePath(proFileNode->path()), - projectName(proFileNode->displayName()), - targetInfo(proFileNode->targetInformation()), - installsList(proFileNode->installsList()), - projectVersion(proFileNode->projectVersion()), - config(proFileNode->variableValue(ConfigVar)), - modified(true) - { - } - - const Qt4ProjectType projectType; - const QString proFilePath; - const QString projectName; - const Qt4ProjectManager::TargetInformation targetInfo; - const Qt4ProjectManager::InstallsList installsList; - const Qt4ProjectManager::ProjectVersion projectVersion; - const QStringList config; - QList<DeployableFile> deployables; - bool modified; -}; - -} // namespace Internal - -using namespace Internal; - -DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFileNode, - const QString &installPrefix, QObject *parent) - : QAbstractTableModel(parent), d(new DeployableFilesPerProFilePrivate(proFileNode)) -{ - if (hasTargetPath()) { - if (d->projectType == ApplicationTemplate) { - d->deployables.prepend(DeployableFile(localExecutableFilePath(), - d->installsList.targetPath)); - } else if (d->projectType == LibraryTemplate) { - foreach (const QString &filePath, localLibraryFilePaths()) { - d->deployables.prepend(DeployableFile(filePath, - d->installsList.targetPath)); - } - } - } - - foreach (const InstallsItem &elem, d->installsList.items) { - foreach (const QString &file, elem.files) - d->deployables << DeployableFile(file, elem.path); - } - - if (!installPrefix.isEmpty()) { - for (int i = 0; i < d->deployables.count(); ++i) - d->deployables[i].remoteDir.prepend(installPrefix + QLatin1Char('/')); - } -} - -DeployableFilesPerProFile::~DeployableFilesPerProFile() -{ - delete d; -} - -DeployableFile DeployableFilesPerProFile::deployableAt(int row) const -{ - Q_ASSERT(row >= 0 && row < rowCount()); - return d->deployables.at(row); -} - -int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : d->deployables.count(); -} - -int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : 2; -} - -QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount()) - return QVariant(); - - const DeployableFile &d = deployableAt(index.row()); - if (index.column() == 0 && role == Qt::DisplayRole) - return QDir::toNativeSeparators(d.localFilePath); - if (role == Qt::DisplayRole) - return QDir::cleanPath(d.remoteDir); - return QVariant(); -} - -QVariant DeployableFilesPerProFile::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (orientation == Qt::Vertical || role != Qt::DisplayRole) - return QVariant(); - return section == 0 ? tr("Local File Path") : tr("Remote Directory"); -} - -QString DeployableFilesPerProFile::localExecutableFilePath() const -{ - if (!d->targetInfo.valid || d->projectType != ApplicationTemplate) - return QString(); - return QDir::cleanPath(d->targetInfo.workingDir + '/' + d->targetInfo.target); -} - -QStringList DeployableFilesPerProFile::localLibraryFilePaths() const -{ - QStringList list; - - if (!d->targetInfo.valid || d->projectType != LibraryTemplate) - return list; - QString basePath = d->targetInfo.workingDir + QLatin1String("/lib"); - const bool isStatic = d->config.contains(QLatin1String("static")) - || d->config.contains(QLatin1String("staticlib")); - basePath += d->targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); - basePath = QDir::cleanPath(basePath); - if (!isStatic && !d->config.contains(QLatin1String("plugin"))) { - const QChar dot(QLatin1Char('.')); - const QString filePathMajor = basePath + dot - + QString::number(d->projectVersion.major); - const QString filePathMinor = filePathMajor + dot - + QString::number(d->projectVersion.minor); - const QString filePathPatch = filePathMinor + dot - + QString::number(d->projectVersion.patch); - list << filePathPatch << filePathMinor << filePathMajor; - } - return list << basePath; -} - -QString DeployableFilesPerProFile::remoteExecutableFilePath() const -{ - return hasTargetPath() && d->projectType == ApplicationTemplate - ? deployableAt(0).remoteDir + QLatin1Char('/') - + QFileInfo(localExecutableFilePath()).fileName() - : QString(); -} - -QString DeployableFilesPerProFile::projectDir() const -{ - return QFileInfo(d->proFilePath).dir().path(); -} - -bool DeployableFilesPerProFile::hasTargetPath() const -{ - return !d->installsList.targetPath.isEmpty(); -} - -bool DeployableFilesPerProFile::isModified() const { return d->modified; } -void DeployableFilesPerProFile::setUnModified() { d->modified = false; } -QString DeployableFilesPerProFile::projectName() const { return d->projectName; } -QString DeployableFilesPerProFile::proFilePath() const { return d->proFilePath; } -Qt4ProjectType DeployableFilesPerProFile::projectType() const { return d->projectType; } -QString DeployableFilesPerProFile::applicationName() const { return d->targetInfo.target; } - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deployablefilesperprofile.h b/src/plugins/remotelinux/deployablefilesperprofile.h deleted file mode 100644 index d2c8210eb75..00000000000 --- a/src/plugins/remotelinux/deployablefilesperprofile.h +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ - -#ifndef DEPLOYABLEFILESPERPROFILE_H -#define DEPLOYABLEFILESPERPROFILE_H - -#include "remotelinux_export.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QAbstractTableModel> -#include <QList> -#include <QString> - -namespace RemoteLinux { -class DeployableFile; - -namespace Internal { -class DeployableFilesPerProFilePrivate; -} - -class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel -{ - Q_OBJECT -public: - DeployableFilesPerProFile(const Qt4ProjectManager::Qt4ProFileNode *proFileNode, - const QString &installPrefix, QObject *parent); - ~DeployableFilesPerProFile(); - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - - DeployableFile deployableAt(int row) const; - bool isModified() const; - void setUnModified(); - QString localExecutableFilePath() const; - QString remoteExecutableFilePath() const; - QString projectName() const; - QString projectDir() const; - QString proFilePath() const; - Qt4ProjectManager::Qt4ProjectType projectType() const; - bool isApplicationProject() const { return projectType() == Qt4ProjectManager::ApplicationTemplate; } - QString applicationName() const; - bool hasTargetPath() const; - -private: - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, - int role = Qt::DisplayRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - - QStringList localLibraryFilePaths() const; - - Internal::DeployableFilesPerProFilePrivate * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYABLEFILESPERPROFILE_H diff --git a/src/plugins/remotelinux/deploymentinfo.cpp b/src/plugins/remotelinux/deploymentinfo.cpp deleted file mode 100644 index 7c69ef89fa3..00000000000 --- a/src/plugins/remotelinux/deploymentinfo.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** 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. -** -** -**************************************************************************/ - -#include "deploymentinfo.h" - -#include "deployablefile.h" -#include "deployablefilesperprofile.h" -#include "remotelinuxdeployconfiguration.h" - -#include <projectexplorer/buildstep.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> -#include <qtsupport/qtprofileinformation.h> - -#include <QList> -#include <QTimer> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -class DeploymentInfoPrivate -{ -public: - DeploymentInfoPrivate(const Qt4ProjectManager::Qt4Project *p) : project(p) {} - - QList<DeployableFilesPerProFile *> listModels; - const Qt4ProjectManager::Qt4Project *const project; - QString installPrefix; -}; -} // namespace Internal - -using namespace Internal; - -DeploymentInfo::DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix) - : QAbstractListModel(project), d(new DeploymentInfoPrivate(project)) -{ - connect(project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); - setInstallPrefix(installPrefix); -} - -DeploymentInfo::~DeploymentInfo() -{ - delete d; -} - -void DeploymentInfo::createModels() -{ - ProjectExplorer::Target *target = d->project->activeTarget(); - if (!target - || !target->activeDeployConfiguration() - || !qobject_cast<RemoteLinuxDeployConfiguration *>(target->activeDeployConfiguration())) - return; - - QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile()); - if (!version || !version->isValid()) { - beginResetModel(); - qDeleteAll(d->listModels); - d->listModels.clear(); - endResetModel(); - return; - } - const Qt4ProFileNode *const rootNode = d->project->rootQt4ProjectNode(); - if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard. - return; - disconnect(d->project, SIGNAL(buildSystemEvaluated()), this, SLOT(createModels())); - beginResetModel(); - qDeleteAll(d->listModels); - d->listModels.clear(); - createModels(rootNode); - endResetModel(); - connect (d->project, SIGNAL(buildSystemEvaluated()), SLOT(createModels())); -} - -void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode) -{ - switch (proFileNode->projectType()) { - case ApplicationTemplate: - case LibraryTemplate: - case AuxTemplate: - d->listModels << new DeployableFilesPerProFile(proFileNode, d->installPrefix, this); - break; - case SubDirsTemplate: { - const QList<Qt4PriFileNode *> &subProjects = proFileNode->subProjectNodesExact(); - foreach (const ProjectExplorer::ProjectNode * const subProject, subProjects) { - const Qt4ProFileNode * const qt4SubProject - = qobject_cast<const Qt4ProFileNode *>(subProject); - if (!qt4SubProject) - continue; - if (qt4SubProject->path().endsWith(QLatin1String(".pri"))) - continue; - if (!proFileNode->isSubProjectDeployable(subProject->path())) - continue; - createModels(qt4SubProject); - } - } - default: - break; - } -} - -void DeploymentInfo::setUnmodified() -{ - foreach (DeployableFilesPerProFile * const model, d->listModels) - model->setUnModified(); -} - -bool DeploymentInfo::isModified() const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - if (model->isModified()) - return true; - } - return false; -} - -void DeploymentInfo::setInstallPrefix(const QString &installPrefix) -{ - d->installPrefix = installPrefix; - createModels(); -} - -int DeploymentInfo::deployableCount() const -{ - int count = 0; - foreach (const DeployableFilesPerProFile * const model, d->listModels) - count += model->rowCount(); - return count; -} - -DeployableFile DeploymentInfo::deployableAt(int i) const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - Q_ASSERT(i >= 0); - if (i < model->rowCount()) - return model->deployableAt(i); - i -= model->rowCount(); - } - - Q_ASSERT(!"Invalid deployable number"); - return DeployableFile(QString(), QString()); -} - -QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const -{ - foreach (const DeployableFilesPerProFile * const model, d->listModels) { - if (model->localExecutableFilePath() == localExecutableFilePath) - return model->remoteExecutableFilePath(); - } - return QString(); -} - -int DeploymentInfo::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : modelCount(); -} - -QVariant DeploymentInfo::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() - || index.column() != 0) - return QVariant(); - const DeployableFilesPerProFile * const model = d->listModels.at(index.row()); - if (role == Qt::ForegroundRole && model->projectType() != AuxTemplate - && !model->hasTargetPath()) { - QBrush brush; - brush.setColor(Qt::red); - return brush; - } - if (role == Qt::DisplayRole) - return QFileInfo(model->proFilePath()).fileName(); - return QVariant(); -} - -int DeploymentInfo::modelCount() const { return d->listModels.count(); } -DeployableFilesPerProFile *DeploymentInfo::modelAt(int i) const { return d->listModels.at(i); } - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentinfo.h b/src/plugins/remotelinux/deploymentinfo.h deleted file mode 100644 index db8bf35d0a8..00000000000 --- a/src/plugins/remotelinux/deploymentinfo.h +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** 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. -** -** -**************************************************************************/ - -#ifndef DEPLOYMENTINFO_H -#define DEPLOYMENTINFO_H - -#include "remotelinux_export.h" - -#include <QAbstractListModel> - -namespace ProjectExplorer { class Target; } -namespace Qt4ProjectManager { -class Qt4ProFileNode; -class Qt4Project; -} // namespace Qt4ProjectManager - -namespace RemoteLinux { -class DeployableFile; -class DeployableFilesPerProFile; - -namespace Internal { -class DeploymentInfoPrivate; -} - -class REMOTELINUX_EXPORT DeploymentInfo : public QAbstractListModel -{ - Q_OBJECT -public: - DeploymentInfo(Qt4ProjectManager::Qt4Project *project, const QString &installPrefix = QString()); - ~DeploymentInfo(); - - void setUnmodified(); - bool isModified() const; - void setInstallPrefix(const QString &installPrefix); - int deployableCount() const; - DeployableFile deployableAt(int i) const; - QString remoteExecutableFilePath(const QString &localExecutableFilePath) const; - int modelCount() const; - DeployableFilesPerProFile *modelAt(int i) const; - -private slots: - void createModels(); - -private: - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - - void createModels(const Qt4ProjectManager::Qt4ProFileNode *proFileNode); - - Internal::DeploymentInfoPrivate * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYMENTINFO_H diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp deleted file mode 100644 index d8518cd3769..00000000000 --- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** 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. -** -** -**************************************************************************/ -#include "deploymentsettingsassistant.h" - -#include "deploymentinfo.h" -#include "deployablefile.h" -#include "deployablefilesperprofile.h" -#include "profilesupdatedialog.h" -#include "remotelinuxdeployconfiguration.h" - -#include <coreplugin/documentmanager.h> -#include <coreplugin/icore.h> -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4nodes.h> -#include <utils/fileutils.h> -#include <utils/qtcassert.h> - -#include <QDir> -#include <QHash> -#include <QString> - -using namespace Qt4ProjectManager; - -namespace RemoteLinux { -namespace Internal { -namespace { - -enum ProFileUpdateSetting { UpdateProFile, DontUpdateProFile }; -typedef QHash<QString, ProFileUpdateSetting> UpdateSettingsMap; - -} // anonymous namespace - -class DeploymentSettingsAssistantInternal -{ -public: - DeploymentSettingsAssistantInternal(DeploymentInfo *deploymentInfo) - : deploymentInfo(deploymentInfo) - { - } - - DeploymentInfo * const deploymentInfo; - UpdateSettingsMap updateSettings; -}; - -} // namespace Internal - -using namespace Internal; - -DeploymentSettingsAssistant::DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, - ProjectExplorer::Project *parent) - : QObject(parent), - d(new DeploymentSettingsAssistantInternal(deploymentInfo)) -{ - connect(d->deploymentInfo, SIGNAL(modelReset()), SLOT(handleDeploymentInfoUpdated())); -} - -DeploymentSettingsAssistant::~DeploymentSettingsAssistant() -{ - delete d; -} - -bool DeploymentSettingsAssistant::addDeployableToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, const QString &variableName, - const DeployableFile &deployable) -{ - const QString filesLine = variableName + QLatin1String(".files = ") - + QDir(proFileInfo->projectDir()).relativeFilePath(deployable.localFilePath); - const QString pathLine = variableName + QLatin1String(".path = ") + deployable.remoteDir; - const QString installsLine = QLatin1String("INSTALLS += ") + variableName; - return addLinesToProFile(qmakeScope, proFileInfo, - QStringList() << filesLine << pathLine << installsLine); -} - -bool DeploymentSettingsAssistant::addLinesToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, - const QStringList &lines) -{ - Core::FileChangeBlocker update(proFileInfo->proFilePath()); - - const QString separator = QLatin1String("\n "); - const QString proFileString = QLatin1Char('\n') + qmakeScope + QLatin1String(" {") - + separator + lines.join(separator) + QLatin1String("\n}\n"); - Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append); - saver.write(proFileString.toLocal8Bit()); - return saver.finalize(Core::ICore::mainWindow()); -} - -void DeploymentSettingsAssistant::handleDeploymentInfoUpdated() -{ - ProjectExplorer::Project *project = static_cast<ProjectExplorer::Project *>(parent()); - QStringList scopes; - QStringList pathes; - foreach (ProjectExplorer::Target *target, project->targets()) { - foreach (ProjectExplorer::DeployConfiguration *dc, target->deployConfigurations()) { - RemoteLinuxDeployConfiguration *rldc = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); - if (!rldc) - continue; - const QString scope = rldc->qmakeScope(); - if (!scopes.contains(scope)) { - scopes.append(scope); - pathes.append(rldc->installPrefix()); - } - } - } - if (scopes.isEmpty()) - return; - - QList<DeployableFilesPerProFile *> proFilesToAskAbout; - QList<DeployableFilesPerProFile *> proFilesToUpdate; - for (int i = 0; i < d->deploymentInfo->modelCount(); ++i) { - DeployableFilesPerProFile * const proFileInfo = d->deploymentInfo->modelAt(i); - if (proFileInfo->projectType() != AuxTemplate && !proFileInfo->hasTargetPath()) { - const UpdateSettingsMap::ConstIterator it - = d->updateSettings.find(proFileInfo->proFilePath()); - if (it == d->updateSettings.constEnd()) - proFilesToAskAbout << proFileInfo; - else if (it.value() == UpdateProFile) - proFilesToUpdate << proFileInfo; - } - } - - if (!proFilesToAskAbout.isEmpty()) { - ProFilesUpdateDialog dialog(proFilesToAskAbout); - dialog.exec(); - const QList<ProFilesUpdateDialog::UpdateSetting> &settings = dialog.getUpdateSettings(); - foreach (const ProFilesUpdateDialog::UpdateSetting &setting, settings) { - const ProFileUpdateSetting updateSetting = setting.second - ? UpdateProFile : DontUpdateProFile; - d->updateSettings.insert(setting.first->proFilePath(), updateSetting); - if (updateSetting == UpdateProFile) - proFilesToUpdate << setting.first; - } - } - - foreach (const DeployableFilesPerProFile * const proFileInfo, proFilesToUpdate) { - const QString remoteDirSuffix = QLatin1String(proFileInfo->projectType() == LibraryTemplate - ? "/lib" : "/bin"); - for (int i = 0; i < scopes.count(); ++i) { - const QString remoteDir = QLatin1String("target.path = ") + pathes.at(i) - + QLatin1Char('/') + proFileInfo->projectName() + remoteDirSuffix; - const QStringList deployInfo = QStringList() << remoteDir - << QLatin1String("INSTALLS += target"); - addLinesToProFile(scopes.at(i), proFileInfo, deployInfo); - } - } -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.h b/src/plugins/remotelinux/deploymentsettingsassistant.h deleted file mode 100644 index 63775e946a4..00000000000 --- a/src/plugins/remotelinux/deploymentsettingsassistant.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** 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. -** -** -**************************************************************************/ -#ifndef DEPLOYMENTSETTINGSASSISTANT_H -#define DEPLOYMENTSETTINGSASSISTANT_H - -#include "remotelinux_export.h" - -#include <QObject> -#include <QStringList> - -namespace ProjectExplorer { class Project; } - -namespace RemoteLinux { -class DeployableFile; -class DeployableFilesPerProFile; -class DeploymentInfo; - -namespace Internal { class DeploymentSettingsAssistantInternal; } - -class REMOTELINUX_EXPORT DeploymentSettingsAssistant : public QObject -{ - Q_OBJECT - -public: - DeploymentSettingsAssistant(DeploymentInfo *deploymentInfo, ProjectExplorer::Project *parent); - ~DeploymentSettingsAssistant(); - - bool addDeployableToProFile(const QString &qmakeScope, - const DeployableFilesPerProFile *proFileInfo, - const QString &variableName, const DeployableFile &deployable); - -private slots: - void handleDeploymentInfoUpdated(); - -private: - bool addLinesToProFile(const QString &qmakeScope, const DeployableFilesPerProFile *proFileInfo, const QStringList &lines); - - Internal::DeploymentSettingsAssistantInternal * const d; -}; - -} // namespace RemoteLinux - -#endif // DEPLOYMENTSETTINGSASSISTANT_H diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 1024d191914..01c9a2efd0a 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -29,8 +29,7 @@ **************************************************************************/ #include "genericdirectuploadservice.h" -#include "deployablefile.h" - +#include <projectexplorer/deployablefile.h> #include <utils/qtcassert.h> #include <ssh/sftpchannel.h> #include <ssh/sshconnection.h> @@ -41,6 +40,7 @@ #include <QList> #include <QString> +using namespace ProjectExplorer; using namespace QSsh; namespace RemoteLinux { @@ -163,8 +163,9 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con const DeployableFile df = d->filesToUpload.takeFirst(); if (!errorMsg.isEmpty()) { QString errorString = tr("Upload of file '%1' failed. The server said: '%2'.") - .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg); - if (errorMsg == QLatin1String("Failure") && df.remoteDir.contains(QLatin1String("/bin"))) { + .arg(df.localFilePath().toUserOutput(), errorMsg); + if (errorMsg == QLatin1String("Failure") + && df.remoteDirectory().contains(QLatin1String("/bin"))) { errorString += QLatin1Char(' ') + tr("If '%1' is currently running " "on the remote host, you might need to stop it first.").arg(df.remoteFilePath()); } @@ -175,7 +176,7 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con saveDeploymentTimeStamp(df); // Terrible hack for Windows. - if (df.remoteDir.contains(QLatin1String("bin"))) { + if (df.remoteDirectory().contains(QLatin1String("bin"))) { const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath(); connection()->createRemoteProcess(command.toUtf8())->start(); } @@ -194,7 +195,7 @@ void GenericDirectUploadService::handleLnFinished(int exitStatus) } const DeployableFile df = d->filesToUpload.takeFirst(); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->lnProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -216,8 +217,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) } const DeployableFile &df = d->filesToUpload.first(); - QFileInfo fi(df.localFilePath); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->mkdirProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -227,7 +228,7 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) d->filesToUpload.removeFirst(); uploadNextFile(); } else { - const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName(); + const QString remoteFilePath = df.remoteDirectory() + QLatin1Char('/') + fi.fileName(); if (fi.isSymLink()) { const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817. const QString command = QLatin1String("ln -sf ") + target + QLatin1Char(' ') @@ -240,8 +241,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) connect(d->lnProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); d->lnProc->start(); } else { - const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath, - SftpOverwriteExisting); + const SftpJobId job = d->uploader->uploadFile(df.localFilePath().toString(), + remoteFilePath, SftpOverwriteExisting); if (job == SftpInvalidJob) { emit errorMessage(tr("Failed to upload file '%1': " "Could not open for reading.").arg(nativePath)); @@ -276,16 +277,16 @@ void GenericDirectUploadService::stopDeployment() void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &deployable) const { - QFileInfo fileInfo(deployable.localFilePath); + QFileInfo fileInfo = deployable.localFilePath().toFileInfo(); if (fileInfo.isDir()) { - const QStringList files = QDir(deployable.localFilePath) + const QStringList files = QDir(deployable.localFilePath().toString()) .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable))) d->filesToUpload << deployable; foreach (const QString &fileName, files) { - const QString localFilePath = deployable.localFilePath + const QString localFilePath = deployable.localFilePath().toString() + QLatin1Char('/') + fileName; - const QString remoteDir = deployable.remoteDir + QLatin1Char('/') + const QString remoteDir = deployable.remoteDirectory() + QLatin1Char('/') + fileInfo.fileName(); checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir)); } @@ -318,16 +319,16 @@ void GenericDirectUploadService::uploadNextFile() } const DeployableFile &df = d->filesToUpload.first(); - QString dirToCreate = df.remoteDir; + QString dirToCreate = df.remoteDirectory(); if (dirToCreate.isEmpty()) { emit warningMessage(tr("Warning: No remote path set for local file '%1'. Skipping upload.") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->filesToUpload.takeFirst(); uploadNextFile(); return; } - QFileInfo fi(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); if (fi.isDir()) dirToCreate += QLatin1Char('/') + fi.fileName(); const QString command = QLatin1String("mkdir -p ") + dirToCreate; @@ -336,7 +337,7 @@ void GenericDirectUploadService::uploadNextFile() connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData())); connect(d->mkdirProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); emit progressMessage(tr("Uploading file '%1'...") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->mkdirProc->start(); } diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h index e268b856c43..55d07287aea 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.h +++ b/src/plugins/remotelinux/genericdirectuploadservice.h @@ -39,8 +39,9 @@ QT_FORWARD_DECLARE_CLASS(QString) +namespace ProjectExplorer { class DeployableFile; } + namespace RemoteLinux { -class DeployableFile; namespace Internal { class GenericDirectUploadServicePrivate; } class REMOTELINUX_EXPORT GenericDirectUploadService : public AbstractRemoteLinuxDeployService @@ -50,7 +51,7 @@ public: GenericDirectUploadService(QObject *parent = 0); ~GenericDirectUploadService(); - void setDeployableFiles(const QList<DeployableFile> &deployableFiles); + void setDeployableFiles(const QList<ProjectExplorer::DeployableFile> &deployableFiles); void setIncrementalDeployment(bool incremental); protected: @@ -72,7 +73,7 @@ private slots: void handleStdErrData(); private: - void checkDeploymentNeeded(const DeployableFile &file) const; + void checkDeploymentNeeded(const ProjectExplorer::DeployableFile &file) const; void setFinished(); void uploadNextFile(); diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 6a4c6cf9f33..7aa0b0c08ca 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -29,11 +29,12 @@ **************************************************************************/ #include "genericdirectuploadstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "genericdirectuploadservice.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/deploymentdata.h> +#include <projectexplorer/target.h> + #include <QCheckBox> #include <QVBoxLayout> #include <QList> @@ -109,12 +110,7 @@ BuildStepConfigWidget *GenericDirectUploadStep::createConfigWidget() bool GenericDirectUploadStep::initInternal(QString *error) { - QList<DeployableFile> deployableFiles; - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); - const int deployableCount = deploymentInfo->deployableCount(); - for (int i = 0; i < deployableCount; ++i) - deployableFiles << deploymentInfo->deployableAt(i); - deployService()->setDeployableFiles(deployableFiles); + deployService()->setDeployableFiles(target()->deploymentData().allFiles()); deployService()->setIncrementalDeployment(incrementalDeployment()); return deployService()->isDeploymentPossible(error); } diff --git a/src/plugins/remotelinux/profilesupdatedialog.cpp b/src/plugins/remotelinux/profilesupdatedialog.cpp deleted file mode 100644 index 8a6e25a7801..00000000000 --- a/src/plugins/remotelinux/profilesupdatedialog.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** 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. -** -** -**************************************************************************/ -#include "profilesupdatedialog.h" -#include "ui_profilesupdatedialog.h" - -#include "deployablefilesperprofile.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QDir> -#include <QTableWidgetItem> - -namespace RemoteLinux { -namespace Internal { - -ProFilesUpdateDialog::ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models, - QWidget *parent) - : QDialog(parent), - m_models(models), - ui(new Ui::ProFilesUpdateDialog) -{ - ui->setupUi(this); - ui->tableWidget->setRowCount(models.count()); - ui->tableWidget->setHorizontalHeaderItem(0, - new QTableWidgetItem(tr("Updateable Project Files"))); - for (int row = 0; row < models.count(); ++row) { - QTableWidgetItem *const item - = new QTableWidgetItem(QDir::toNativeSeparators(models.at(row)->proFilePath())); - item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - item->setCheckState(Qt::Unchecked); - ui->tableWidget->setItem(row, 0, item); - } - ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); - ui->tableWidget->resizeRowsToContents(); - connect(ui->checkAllButton, SIGNAL(clicked()), this, SLOT(checkAll())); - connect(ui->uncheckAllButton, SIGNAL(clicked()), this, SLOT(uncheckAll())); -} - -ProFilesUpdateDialog::~ProFilesUpdateDialog() -{ - delete ui; -} - -void ProFilesUpdateDialog::checkAll() -{ - setCheckStateForAll(Qt::Checked); -} - -void ProFilesUpdateDialog::uncheckAll() -{ - setCheckStateForAll(Qt::Unchecked); -} - -void ProFilesUpdateDialog::setCheckStateForAll(Qt::CheckState checkState) -{ - for (int row = 0; row < ui->tableWidget->rowCount(); ++row) { - ui->tableWidget->item(row, 0)->setCheckState(checkState); - } -} - -QList<ProFilesUpdateDialog::UpdateSetting> ProFilesUpdateDialog::getUpdateSettings() const -{ - QList<UpdateSetting> settings; - for (int row = 0; row < m_models.count(); ++row) { - const bool doUpdate = result() != Rejected - && ui->tableWidget->item(row, 0)->checkState() == Qt::Checked; - settings << UpdateSetting(m_models.at(row), doUpdate); - } - return settings; -} - -} // namespace RemoteLinux -} // namespace Internal diff --git a/src/plugins/remotelinux/profilesupdatedialog.ui b/src/plugins/remotelinux/profilesupdatedialog.ui deleted file mode 100644 index 7885a3f4181..00000000000 --- a/src/plugins/remotelinux/profilesupdatedialog.ui +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>RemoteLinux::Internal::ProFilesUpdateDialog</class> - <widget class="QDialog" name="RemoteLinux::Internal::ProFilesUpdateDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>659</width> - <height>494</height> - </rect> - </property> - <property name="windowTitle"> - <string>Maemo Deployment Issue</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="infoLabel"> - <property name="text"> - <string>The project files listed below do not contain deployment information, which means the respective targets cannot be deployed to and/or run on a device. Qt Creator will add the missing information to these files if you check the respective rows below.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="checkAllButton"> - <property name="text"> - <string>&Check all</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="uncheckAllButton"> - <property name="text"> - <string>&Uncheck All</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QTableWidget" name="tableWidget"> - <property name="showGrid"> - <bool>false</bool> - </property> - <property name="columnCount"> - <number>1</number> - </property> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>200</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - <column/> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>RemoteLinux::Internal::ProFilesUpdateDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>248</x> - <y>254</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>RemoteLinux::Internal::ProFilesUpdateDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>316</x> - <y>260</y> - </hint> - <hint type="destinationlabel"> - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 6059ce60abd..aaa4162a03d 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -21,9 +21,6 @@ HEADERS += \ remotelinuxruncontrolfactory.h \ remotelinuxdebugsupport.h \ genericlinuxdeviceconfigurationwizardpages.h \ - deployablefile.h \ - deployablefilesperprofile.h \ - deploymentinfo.h \ abstractremotelinuxdeploystep.h \ genericdirectuploadstep.h \ uploadandinstalltarpackagestep.h \ @@ -44,14 +41,13 @@ HEADERS += \ sshkeydeployer.h \ typespecificdeviceconfigurationlistmodel.h \ remotelinuxutils.h \ - deploymentsettingsassistant.h \ remotelinuxdeployconfigurationwidget.h \ - profilesupdatedialog.h \ remotelinuxcustomcommanddeployservice.h \ remotelinuxcustomcommanddeploymentstep.h \ genericlinuxdeviceconfigurationwidget.h \ remotelinuxcheckforfreediskspaceservice.h \ - remotelinuxcheckforfreediskspacestep.h + remotelinuxcheckforfreediskspacestep.h \ + remotelinuxdeploymentdatamodel.h SOURCES += \ embeddedlinuxqtversion.cpp \ @@ -68,8 +64,6 @@ SOURCES += \ remotelinuxruncontrolfactory.cpp \ remotelinuxdebugsupport.cpp \ genericlinuxdeviceconfigurationwizardpages.cpp \ - deployablefilesperprofile.cpp \ - deploymentinfo.cpp \ abstractremotelinuxdeploystep.cpp \ genericdirectuploadstep.cpp \ uploadandinstalltarpackagestep.cpp \ @@ -89,20 +83,18 @@ SOURCES += \ sshkeydeployer.cpp \ typespecificdeviceconfigurationlistmodel.cpp \ remotelinuxutils.cpp \ - deploymentsettingsassistant.cpp \ remotelinuxdeployconfigurationwidget.cpp \ - profilesupdatedialog.cpp \ remotelinuxcustomcommanddeployservice.cpp \ remotelinuxcustomcommanddeploymentstep.cpp \ genericlinuxdeviceconfigurationwidget.cpp \ remotelinuxcheckforfreediskspaceservice.cpp \ - remotelinuxcheckforfreediskspacestep.cpp + remotelinuxcheckforfreediskspacestep.cpp \ + remotelinuxdeploymentdatamodel.cpp FORMS += \ genericlinuxdeviceconfigurationwizardsetuppage.ui \ linuxdevicetestdialog.ui \ remotelinuxdeployconfigurationwidget.ui \ - profilesupdatedialog.ui \ genericlinuxdeviceconfigurationwidget.ui \ remotelinuxcheckforfreediskspacestepwidget.ui diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 221172e3223..3bb4c43ef52 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -9,7 +9,6 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "Debugger" } Depends { name: "ProjectExplorer" } - Depends { name: "Qt4ProjectManager" } Depends { name: "QtSupport" } Depends { name: "QtcSsh" } @@ -28,13 +27,6 @@ QtcPlugin { "abstractremotelinuxdeploystep.h", "abstractuploadandinstallpackageservice.cpp", "abstractuploadandinstallpackageservice.h", - "deployablefile.h", - "deployablefilesperprofile.cpp", - "deployablefilesperprofile.h", - "deploymentinfo.cpp", - "deploymentinfo.h", - "deploymentsettingsassistant.cpp", - "deploymentsettingsassistant.h", "embeddedlinuxqtversion.cpp", "embeddedlinuxqtversion.h", "embeddedlinuxqtversionfactory.cpp", @@ -93,9 +85,6 @@ QtcPlugin { "linuxdevicetestdialog.ui", "packageuploader.cpp", "packageuploader.h", - "profilesupdatedialog.cpp", - "profilesupdatedialog.h", - "profilesupdatedialog.ui", "remotelinuxdeployconfigurationwidget.ui", "remotelinuxenvironmentreader.cpp", "remotelinuxenvironmentreader.h", @@ -117,6 +106,8 @@ QtcPlugin { "remotelinuxcheckforfreediskspacestep.h", "remotelinuxcheckforfreediskspacestep.cpp", "remotelinuxcheckforfreediskspacestepwidget.ui", + "remotelinuxdeploymentdatamodel.h", + "remotelinuxdeploymentdatamodel.cpp", "images/embeddedtarget.png" ] diff --git a/src/plugins/remotelinux/remotelinux_dependencies.pri b/src/plugins/remotelinux/remotelinux_dependencies.pri index c2940f93623..697ec645a18 100644 --- a/src/plugins/remotelinux/remotelinux_dependencies.pri +++ b/src/plugins/remotelinux/remotelinux_dependencies.pri @@ -1,4 +1,4 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/debugger/debugger.pri) include(../../plugins/projectexplorer/projectexplorer.pri) -include(../../plugins/qt4projectmanager/qt4projectmanager.pri) +include(../../plugins/qtsupport/qtsupport.pri) diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp index 7de56a9c2a5..54b0573057e 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.cpp @@ -29,21 +29,12 @@ **************************************************************************/ #include "remotelinuxdeployconfiguration.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfigurationwidget.h" -#include "typespecificdeviceconfigurationlistmodel.h" -#include <projectexplorer/devicesupport/devicemanager.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; - -namespace { -const char DEPLOYMENT_INFO_SETTING[] = "RemoteLinux.DeploymentInfo"; -} // namespace namespace RemoteLinux { @@ -54,15 +45,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer:: : DeployConfiguration(target, id) { setDefaultDisplayName(defaultDisplayName); - - // Make sure we have deploymentInfo, but create it only once: - DeploymentInfo *info - = qobject_cast<DeploymentInfo *>(target->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>()); - if (!info) { - info = new DeploymentInfo(static_cast<Qt4ProjectManager::Qt4Project *>(target->project())); - QVariant data = QVariant::fromValue(static_cast<QObject *>(info)); - target->project()->setNamedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING), data); - } } RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, @@ -70,23 +52,6 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer:: : DeployConfiguration(target, source) { } -DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const -{ - DeploymentInfo *info - = qobject_cast<DeploymentInfo *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>()); - return info; -} - -QString RemoteLinuxDeployConfiguration::qmakeScope() const -{ - return QLatin1String("unix"); -} - -QString RemoteLinuxDeployConfiguration::installPrefix() const -{ - return QString(); -} - DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const { return new RemoteLinuxDeployConfigurationWidget; diff --git a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h index 4ba7e42be9f..119d2c8d7fe 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfiguration.h @@ -39,9 +39,6 @@ #include <projectexplorer/devicesupport/idevice.h> namespace RemoteLinux { -class AbstractEmbeddedLinuxTarget; -class DeploymentInfo; - namespace Internal { class RemoteLinuxDeployConfigurationFactory; } class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration @@ -57,8 +54,6 @@ public: ProjectExplorer::DeployConfigurationWidget *configurationWidget() const; - DeploymentInfo *deploymentInfo() const; - template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const { const QList<ProjectExplorer::BuildStep *> &buildSteps = stepList()->steps(); @@ -71,9 +66,6 @@ public: return 0; } - virtual QString qmakeScope() const; - virtual QString installPrefix() const; - signals: void packagingChanged(); diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp index ee917462afa..3656bc17edb 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp @@ -37,8 +37,8 @@ #include <projectexplorer/abi.h> #include <projectexplorer/profileinformation.h> #include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> #include <QCoreApplication> @@ -59,8 +59,6 @@ RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QOb QList<Core::Id> RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const { QList<Core::Id> ids; - if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project())) - return ids; if (!parent->project()->supportsProfile(parent->profile())) return ids; ProjectExplorer::ToolChain *tc diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp index f7afcc2cb46..d5c951c529d 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp @@ -29,51 +29,24 @@ #include "remotelinuxdeployconfigurationwidget.h" #include "ui_remotelinuxdeployconfigurationwidget.h" -#include "deployablefilesperprofile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" -#include "typespecificdeviceconfigurationlistmodel.h" +#include "remotelinuxdeploymentdatamodel.h" -#include <coreplugin/editormanager/editormanager.h> -#include <coreplugin/icore.h> -#include <coreplugin/id.h> -#include <projectexplorer/devicesupport/devicemanager.h> -#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> -#include <QTreeView> - using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -namespace { -class MyTreeView : public QTreeView -{ - Q_OBJECT -public: - MyTreeView(QWidget *parent = 0) : QTreeView(parent) {} - -signals: - void doubleClicked(); - -private: - void mouseDoubleClickEvent(QMouseEvent *event) - { - emit doubleClicked(); - QTreeView::mouseDoubleClickEvent(event); - } -}; - -} // anonymous namespace class RemoteLinuxDeployConfigurationWidgetPrivate { public: Ui::RemoteLinuxDeployConfigurationWidget ui; - MyTreeView treeView; RemoteLinuxDeployConfiguration *deployConfiguration; + RemoteLinuxDeploymentDataModel deploymentDataModel; }; } // namespace Internal @@ -84,10 +57,10 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate) { d->ui.setupUi(this); - d->treeView.setTextElideMode(Qt::ElideMiddle); - d->treeView.setWordWrap(false); - d->treeView.setUniformRowHeights(true); - layout()->addWidget(&d->treeView); + d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle); + d->ui.deploymentDataView->setWordWrap(false); + d->ui.deploymentDataView->setUniformRowHeights(true); + d->ui.deploymentDataView->setModel(&d->deploymentDataModel); } RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() @@ -98,78 +71,17 @@ RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc) { d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); - Q_ASSERT(d->deployConfiguration); + QTC_ASSERT(d->deployConfiguration, return); - connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile())); - - d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo()); - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()), - SLOT(handleModelListToBeReset())); - - // Queued connection because of race condition with combo box's reaction - // to modelReset(). - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleModelListReset()), Qt::QueuedConnection); - - connect(d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int))); - handleModelListReset(); + connect(dc->target()->project(), SIGNAL(buildSystemEvaluated()), + SLOT(updateDeploymentDataModel())); + updateDeploymentDataModel(); } -RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const +void RemoteLinuxDeployConfigurationWidget::updateDeploymentDataModel() { - return d->deployConfiguration; -} - -DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const -{ - const int modelRow = d->ui.projectsComboBox->currentIndex(); - if (modelRow == -1) - return 0; - return d->deployConfiguration->deploymentInfo()->modelAt(modelRow); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset() -{ - d->treeView.setModel(0); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListReset() -{ - QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount() - == d->ui.projectsComboBox->count(), return); - - if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) { - d->treeView.setToolTip(tr("Double-click to edit the project file")); - if (d->ui.projectsComboBox->currentIndex() == -1) - d->ui.projectsComboBox->setCurrentIndex(0); - else - setModel(d->ui.projectsComboBox->currentIndex()); - } else { - d->treeView.setToolTip(QString()); - } -} - -void RemoteLinuxDeployConfigurationWidget::setModel(int row) -{ - DeployableFilesPerProFile * const proFileInfo = row == -1 - ? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row); - d->treeView.setModel(proFileInfo); - if (proFileInfo) - d->treeView.resizeColumnToContents(0); - emit currentModelChanged(proFileInfo); -} - -void RemoteLinuxDeployConfigurationWidget::openProjectFile() -{ - const int row = d->ui.projectsComboBox->currentIndex(); - if (row == -1) - return; - const DeployableFilesPerProFile * const proFileInfo = - d->deployConfiguration->deploymentInfo()->modelAt(row); - Core::EditorManager::openEditor(proFileInfo->proFilePath(), Core::Id(), - Core::EditorManager::ModeSwitch); + d->deploymentDataModel.setDeploymentData(d->deployConfiguration->target()->deploymentData()); + d->ui.deploymentDataView->resizeColumnToContents(0); } } // namespace RemoteLinux - -#include "remotelinuxdeployconfigurationwidget.moc" diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h index a8b1cac985b..64f8dd145aa 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.h @@ -34,9 +34,6 @@ #include <projectexplorer/deployconfiguration.h> namespace RemoteLinux { -class DeployableFilesPerProFile; -class RemoteLinuxDeployConfiguration; - namespace Internal { class RemoteLinuxDeployConfigurationWidgetPrivate; } // namespace Internal @@ -52,17 +49,8 @@ public: void init(ProjectExplorer::DeployConfiguration *dc); - RemoteLinuxDeployConfiguration *deployConfiguration() const; - DeployableFilesPerProFile *currentModel() const; - -signals: - void currentModelChanged(const RemoteLinux::DeployableFilesPerProFile *proFileInfo); - private slots: - void handleModelListToBeReset(); - void handleModelListReset(); - void setModel(int row); - void openProjectFile(); + void updateDeploymentDataModel(); private: Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d; diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui index 2bfa1bd8a6a..fb765741e91 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.ui @@ -15,45 +15,14 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Files to deploy:</string> </property> - <item row="0" column="0"> - <widget class="QLabel" name="installLabel"> - <property name="toolTip"> - <string>These show the INSTALLS settings from the project file(s).</string> - </property> - <property name="text"> - <string>Files to install for subproject:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="projectsComboBox"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> + </widget> + </item> + <item> + <widget class="QTreeView" name="deploymentDataView"/> </item> </layout> </widget> diff --git a/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp new file mode 100644 index 00000000000..ea78d795b75 --- /dev/null +++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.cpp @@ -0,0 +1,81 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: http://www.qt-project.org/ +** +** +** 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. +** +** +**************************************************************************/ +#include "remotelinuxdeploymentdatamodel.h" + +#include <QDir> + +using namespace ProjectExplorer; + +namespace RemoteLinux { + +RemoteLinuxDeploymentDataModel::RemoteLinuxDeploymentDataModel(QObject *parent) + : QAbstractTableModel(parent) +{ +} + +void RemoteLinuxDeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData) +{ + beginResetModel(); + m_deploymentData = deploymentData; + endResetModel(); +} + +int RemoteLinuxDeploymentDataModel::rowCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : m_deploymentData.fileCount(); +} + +int RemoteLinuxDeploymentDataModel::columnCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : 2; +} + +QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (orientation == Qt::Vertical || role != Qt::DisplayRole) + return QVariant(); + return section == 0 ? tr("Local File Path") : tr("Remote Directory"); +} + +QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount()) + return QVariant(); + + const DeployableFile &d = m_deploymentData.fileAt(index.row()); + if (index.column() == 0 && role == Qt::DisplayRole) + return d.localFilePath().toUserOutput(); + if (role == Qt::DisplayRole) + return d.remoteDirectory(); + return QVariant(); +} + +} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/profilesupdatedialog.h b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h index d02480805bf..c708bdc45e9 100644 --- a/src/plugins/remotelinux/profilesupdatedialog.h +++ b/src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h @@ -27,43 +27,32 @@ ** ** **************************************************************************/ +#ifndef REMOTELINUXDEPLOYMENTDATAMODEL_H +#define REMOTELINUXDEPLOYMENTDATAMODEL_H -#ifndef PROFILESUPDATEDIALOG_H -#define PROFILESUPDATEDIALOG_H +#include <projectexplorer/deploymentdata.h> -#include <QList> -#include <QPair> -#include <QString> -#include <QDialog> +#include <QAbstractTableModel> namespace RemoteLinux { -class DeployableFilesPerProFile; -namespace Internal { -namespace Ui { class ProFilesUpdateDialog; } - -class ProFilesUpdateDialog : public QDialog +class RemoteLinuxDeploymentDataModel : public QAbstractTableModel { Q_OBJECT - public: - typedef QPair<DeployableFilesPerProFile *, bool> UpdateSetting; + explicit RemoteLinuxDeploymentDataModel(QObject *parent = 0); - explicit ProFilesUpdateDialog(const QList<DeployableFilesPerProFile *> &models, - QWidget *parent = 0); - ~ProFilesUpdateDialog(); - QList<UpdateSetting> getUpdateSettings() const; + void setDeploymentData(const ProjectExplorer::DeploymentData &deploymentData); private: - Q_SLOT void checkAll(); - Q_SLOT void uncheckAll(); - void setCheckStateForAll(Qt::CheckState checkState); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - const QList<DeployableFilesPerProFile *> m_models; - Ui::ProFilesUpdateDialog *ui; + ProjectExplorer::DeploymentData m_deploymentData; }; } // namespace RemoteLinux -} // namespace Internal -#endif // PROFILESUPDATEDIALOG_H +#endif // REMOTELINUXDEPLOYMENTDATAMODEL_H diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 42e291aaa33..280757163df 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -31,10 +31,8 @@ #include "remotelinuxplugin.h" #include "embeddedlinuxqtversionfactory.h" -#include "deployablefile.h" #include "genericlinuxdeviceconfigurationfactory.h" #include "genericremotelinuxdeploystepfactory.h" -#include "qt4projectmanager/qt4projectmanagerconstants.h" #include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxrunconfigurationfactory.h" #include "remotelinuxruncontrolfactory.h" @@ -72,8 +70,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory); - qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile"); - return true; } diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 33b311d3c7c..07650bfc0ee 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -30,23 +30,21 @@ #include "remotelinuxrunconfiguration.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" #include "remotelinuxrunconfigurationwidget.h" -#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/buildtargetinfo.h> +#include <projectexplorer/deploymentdata.h> +#include <projectexplorer/project.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> #include <qtsupport/qtoutputformatter.h> -#include <qt4projectmanager/qt4nodes.h> -#include <qt4projectmanager/qt4project.h> #include <utils/portlist.h> #include <utils/qtcassert.h> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; using namespace QSsh; using namespace Utils; @@ -66,38 +64,32 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory"; class RemoteLinuxRunConfigurationPrivate { public: - RemoteLinuxRunConfigurationPrivate(const QString &proFilePath, const ProjectExplorer::Target *target) - : proFilePath(proFilePath), + RemoteLinuxRunConfigurationPrivate(const QString &projectFilePath) + : projectFilePath(projectFilePath), baseEnvironmentType(RemoteLinuxRunConfiguration::RemoteBaseEnvironment), - validParse(false), - parseInProgress(true), useAlternateRemoteExecutable(false) { - validParse = static_cast<Qt4Project *>(target->project())->validParse(proFilePath); - parseInProgress = static_cast<Qt4Project *>(target->project())->parseInProgress(proFilePath); } RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other) - : proFilePath(other->proFilePath), gdbPath(other->gdbPath), arguments(other->arguments), + : projectFilePath(other->projectFilePath), + gdbPath(other->gdbPath), + arguments(other->arguments), baseEnvironmentType(other->baseEnvironmentType), remoteEnvironment(other->remoteEnvironment), userEnvironmentChanges(other->userEnvironmentChanges), - validParse(other->validParse), - parseInProgress(other->parseInProgress), useAlternateRemoteExecutable(other->useAlternateRemoteExecutable), alternateRemoteExecutable(other->alternateRemoteExecutable), workingDirectory(other->workingDirectory) { } - QString proFilePath; + QString projectFilePath; QString gdbPath; QString arguments; RemoteLinuxRunConfiguration::BaseEnvironmentType baseEnvironmentType; Environment remoteEnvironment; QList<EnvironmentItem> userEnvironmentChanges; - bool validParse; - bool parseInProgress; QString disabledReason; bool useAlternateRemoteExecutable; QString alternateRemoteExecutable; @@ -111,7 +103,7 @@ using namespace Internal; RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id, const QString &proFilePath) : RunConfiguration(parent, id), - d(new RemoteLinuxRunConfigurationPrivate(proFilePath, parent)) + d(new RemoteLinuxRunConfigurationPrivate(proFilePath)) { init(); } @@ -134,34 +126,14 @@ void RemoteLinuxRunConfiguration::init() setDefaultDisplayName(defaultDisplayName()); debuggerAspect()->suppressQmlDebuggingSpinbox(); - connect(target(), - SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), - this, SLOT(handleDeployConfigChanged())); - handleDeployConfigChanged(); - Project *pro = target()->project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)), - this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool,bool))); + connect(pro, SIGNAL(buildSystemEvaluated()), SLOT(handleBuildSystemDataUpdated())); connect(target(), SIGNAL(profileChanged()), - this, SLOT(handleDeployablesUpdated())); // Handles device changes, etc. + this, SLOT(handleBuildSystemDataUpdated())); // Handles device changes, etc. } bool RemoteLinuxRunConfiguration::isEnabled() const { - if (d->parseInProgress) { - d->disabledReason = tr("The .pro file '%1' is being parsed.") - .arg(QFileInfo(d->proFilePath).fileName()); - return false; - } - if (!d->validParse) { - Qt4Project *project = static_cast<Qt4Project *>(target()->project()); - d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath); - return false; - } - if (!activeBuildConfiguration()) { - d->disabledReason = tr("No active build configuration."); - return false; - } if (remoteExecutableFilePath().isEmpty()) { d->disabledReason = tr("Don't know what to run."); return false; @@ -185,26 +157,12 @@ OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const return new QtSupport::QtOutputFormatter(target()->project()); } -void RemoteLinuxRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress) -{ - if (d->proFilePath == pro->path()) { - bool enabled = isEnabled(); - QString reason = disabledReason(); - d->validParse = success; - d->parseInProgress = parseInProgress; - if (enabled != isEnabled() || reason != disabledReason()) - updateEnabledState(); - if (!parseInProgress) - emit targetInformationChanged(); - } -} - QVariantMap RemoteLinuxRunConfiguration::toMap() const { QVariantMap map(RunConfiguration::toMap()); map.insert(QLatin1String(ArgumentsKey), d->arguments); const QDir dir = QDir(target()->project()->projectDirectory()); - map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->proFilePath)); + map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->projectFilePath)); map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType); map.insert(QLatin1String(UserEnvironmentChangesKey), EnvironmentItem::toStringList(d->userEnvironmentChanges)); @@ -221,7 +179,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) d->arguments = map.value(QLatin1String(ArgumentsKey)).toString(); const QDir dir = QDir(target()->project()->projectDirectory()); - d->proFilePath = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString())); + d->projectFilePath + = QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString())); d->userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(UserEnvironmentChangesKey)) .toStringList()); @@ -231,10 +190,6 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString(); d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString(); - Qt4Project *project = static_cast<Qt4Project *>(target()->project()); - d->validParse = project->validParse(d->proFilePath); - d->parseInProgress = project->parseInProgress(d->proFilePath); - setDefaultDisplayName(defaultDisplayName()); return true; @@ -242,18 +197,13 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map) QString RemoteLinuxRunConfiguration::defaultDisplayName() { - if (!d->proFilePath.isEmpty()) + if (!d->projectFilePath.isEmpty()) //: %1 is the name of a project which is being run on remote Linux - return tr("%1 (on Remote Device)").arg(QFileInfo(d->proFilePath).completeBaseName()); + return tr("%1 (on Remote Device)").arg(QFileInfo(d->projectFilePath).completeBaseName()); //: Remote Linux run configuration default display name return tr("Run on Remote Device"); } -RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const -{ - return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration()); -} - QString RemoteLinuxRunConfiguration::arguments() const { return d->arguments; @@ -281,19 +231,14 @@ QString RemoteLinuxRunConfiguration::commandPrefix() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const { - TargetInformation ti = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode() - ->targetInformation(d->proFilePath); - if (!ti.valid) - return QString(); - - return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target); + return target()->applicationTargets() + .targetForProject(Utils::FileName::fromString(d->projectFilePath)).toString(); } QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const { - return deployConfig() - ? deployConfig()->deploymentInfo()->remoteExecutableFilePath(localExecutableFilePath()) - : QString(); + return target()->deploymentData().deployableForLocalFile(localExecutableFilePath()) + .remoteFilePath(); } QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const @@ -348,17 +293,10 @@ int RemoteLinuxRunConfiguration::portsUsedByDebuggers() const return ports; } -void RemoteLinuxRunConfiguration::handleDeployConfigChanged() -{ - RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig(); - if (activeDeployConf) - connect(activeDeployConf->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleDeployablesUpdated()), Qt::UniqueConnection); -} - -void RemoteLinuxRunConfiguration::handleDeployablesUpdated() +void RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated() { emit deploySpecsChanged(); + emit targetInformationChanged(); updateEnabledState(); } @@ -433,9 +371,9 @@ void RemoteLinuxRunConfiguration::setRemoteEnvironment(const Environment &enviro } } -QString RemoteLinuxRunConfiguration::proFilePath() const +QString RemoteLinuxRunConfiguration::projectFilePath() const { - return d->proFilePath; + return d->projectFilePath; } void RemoteLinuxRunConfiguration::setDisabledReason(const QString &reason) const diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index ee869a62de4..074907f346b 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -36,10 +36,6 @@ #include <projectexplorer/runconfiguration.h> #include <utils/environment.h> -namespace Qt4ProjectManager { -class Qt4ProFileNode; -} // namespace Qt4ProjectManager - namespace Utils { class PortList; } namespace RemoteLinux { @@ -67,7 +63,7 @@ public: enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, const Core::Id id, - const QString &proFilePath); + const QString &projectFilePath); ~RemoteLinuxRunConfiguration(); bool isEnabled() const; @@ -75,8 +71,6 @@ public: QWidget *createConfigurationWidget(); Utils::OutputFormatter *createOutputFormatter() const; - RemoteLinuxDeployConfiguration *deployConfig() const; - virtual QString environmentPreparationCommand() const; virtual QString commandPrefix() const; @@ -103,7 +97,7 @@ public: int portsUsedByDebuggers() const; - QString proFilePath() const; + QString projectFilePath() const; static const QString IdPrefix; @@ -126,9 +120,7 @@ protected slots: void updateEnabledState() { emit enabledChanged(); } private slots: - void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success, bool parseInProgress); - void handleDeployConfigChanged(); - void handleDeployablesUpdated(); + void handleBuildSystemDataUpdated(); private: void init(); diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp index 782e7fd4513..bc4ee72bfae 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp @@ -30,14 +30,12 @@ #include "remotelinuxrunconfigurationfactory.h" #include "remotelinux_constants.h" -#include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxrunconfiguration.h" +#include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/profileinformation.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4nodes.h> -#include <qtsupport/customexecutablerunconfiguration.h> #include <utils/qtcassert.h> #include <QFileInfo> @@ -45,7 +43,6 @@ #include <QStringList> using namespace ProjectExplorer; -using namespace Qt4ProjectManager; namespace RemoteLinux { namespace Internal { @@ -62,8 +59,10 @@ QString pathFromId(Core::Id id) } // namespace RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *parent) - : Qt4ProjectManager::QmakeRunConfigurationFactory(parent) -{ setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); } + : IRunConfigurationFactory(parent) +{ + setObjectName(QLatin1String("RemoteLinuxRunConfigurationFactory")); +} RemoteLinuxRunConfigurationFactory::~RemoteLinuxRunConfigurationFactory() { @@ -73,14 +72,14 @@ bool RemoteLinuxRunConfigurationFactory::canCreate(Target *parent, const Core::I { if (!canHandle(parent)) return false; - return static_cast<Qt4Project *>(parent->project())->hasApplicationProFile(pathFromId(id)); + return !parent->applicationTargets().targetForProject(pathFromId(id)).isEmpty(); } bool RemoteLinuxRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const { if (!canHandle(parent)) return false; - return ProjectExplorer::idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix); + return idFromMap(map).toString().startsWith(RemoteLinuxRunConfiguration::IdPrefix); } bool RemoteLinuxRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const @@ -96,10 +95,8 @@ QList<Core::Id> RemoteLinuxRunConfigurationFactory::availableCreationIds(Target if (!canHandle(parent)) return result; - QStringList proFiles = static_cast<Qt4Project *>(parent->project()) - ->applicationProFilePathes(RemoteLinuxRunConfiguration::IdPrefix); - foreach (const QString &pf, proFiles) - result << Core::Id(pf); + foreach (const BuildTargetInfo &bti, parent->applicationTargets().list) + result << (Core::Id(RemoteLinuxRunConfiguration::IdPrefix + bti.projectFilePath.toString())); return result; } @@ -119,8 +116,8 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::restore(Target *parent, const QVariantMap &map) { QTC_ASSERT(canRestore(parent, map), return 0); - RemoteLinuxRunConfiguration *rc - = new RemoteLinuxRunConfiguration(parent, Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString()); + RemoteLinuxRunConfiguration *rc = new RemoteLinuxRunConfiguration(parent, + Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString()); if (rc->fromMap(map)) return rc; @@ -136,26 +133,13 @@ RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent, return new RemoteLinuxRunConfiguration(parent, old); } -bool RemoteLinuxRunConfigurationFactory::canHandle(Target *t) const +bool RemoteLinuxRunConfigurationFactory::canHandle(const Target *target) const { - if (!t->project()->supportsProfile(t->profile())) + if (!target->project()->supportsProfile(target->profile())) return false; - if (!qobject_cast<Qt4Project *>(t->project())) - return false; - - Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(t->profile()); + const Core::Id deviceType = DeviceTypeProfileInformation::deviceTypeId(target->profile()); return deviceType == RemoteLinux::Constants::GenericLinuxOsType; } -QList<RunConfiguration *> RemoteLinuxRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n) -{ - QList<ProjectExplorer::RunConfiguration *> result; - foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) - if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc)) - if (qt4c->proFilePath() == n->path()) - result << rc; - return result; -} - } // namespace Internal } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h index b126aa6a530..de3c965c370 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h @@ -31,14 +31,11 @@ #define REMOTELINUXRUNCONFIGURATIONFACTORY_H #include <projectexplorer/runconfiguration.h> -#include <qt4projectmanager/qmakerunconfigurationfactory.h> - -namespace ProjectExplorer { class Node; } namespace RemoteLinux { namespace Internal { -class RemoteLinuxRunConfigurationFactory : public Qt4ProjectManager::QmakeRunConfigurationFactory +class RemoteLinuxRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory { Q_OBJECT @@ -60,9 +57,8 @@ public: ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); - bool canHandle(ProjectExplorer::Target *t) const; - QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, - ProjectExplorer::Node *n); +private: + bool canHandle(const ProjectExplorer::Target *target) const; }; } // namespace Internal diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp index 8cc6c45283c..4b6e6317f96 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp @@ -230,13 +230,23 @@ void RemoteLinuxRunConfigurationWidget::argumentsEdited(const QString &text) void RemoteLinuxRunConfigurationWidget::updateTargetInformation() { - d->localExecutableLabel - .setText(QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath())); + setLabelText(d->localExecutableLabel, + QDir::toNativeSeparators(d->runConfiguration->localExecutableFilePath()), + tr("Unknown")); } void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged() { - d->remoteExecutableLabel.setText(d->runConfiguration->defaultRemoteExecutableFilePath()); + setLabelText(d->remoteExecutableLabel, d->runConfiguration->defaultRemoteExecutableFilePath(), + tr("Remote path not set")); +} + +void RemoteLinuxRunConfigurationWidget::setLabelText(QLabel &label, const QString ®ularText, + const QString &errorText) +{ + const QString errorMessage = QLatin1String("<font color=\"red\">") + errorText + + QLatin1String("</font>"); + label.setText(regularText.isEmpty() ? errorMessage : regularText); } void RemoteLinuxRunConfigurationWidget::handleUseAlternateCommandChanged() diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h index d0874a668af..6493d224045 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.h @@ -35,6 +35,7 @@ #include <QWidget> QT_BEGIN_NAMESPACE +class QLabel; class QVBoxLayout; QT_END_NAMESPACE @@ -80,6 +81,7 @@ private slots: private: void addGenericWidgets(QVBoxLayout *mainLayout); void addEnvironmentWidgets(QVBoxLayout *mainLayout); + void setLabelText(QLabel &label, const QString ®ularText, const QString &errorText); Internal::RemoteLinuxRunConfigurationWidgetPrivate * const d; }; diff --git a/src/plugins/remotelinux/tarpackagecreationstep.cpp b/src/plugins/remotelinux/tarpackagecreationstep.cpp index f649fa7272a..1151c551ea3 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.cpp +++ b/src/plugins/remotelinux/tarpackagecreationstep.cpp @@ -28,10 +28,9 @@ **************************************************************************/ #include "tarpackagecreationstep.h" -#include "deployablefile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" +#include <projectexplorer/deploymentdata.h> #include <projectexplorer/project.h> #include <projectexplorer/target.h> @@ -112,13 +111,8 @@ bool TarPackageCreationStep::init() if (!AbstractPackagingStep::init()) return false; m_packagingNeeded = isPackagingNeeded(); - if (!m_packagingNeeded) - return true; - - const DeploymentInfo * const deploymentInfo = deployConfiguration()->deploymentInfo(); - for (int i = 0; i < deploymentInfo->deployableCount(); ++i) - m_files.append(deploymentInfo->deployableAt(i)); - + if (m_packagingNeeded) + m_files = target()->deploymentData().allFiles(); return true; } @@ -152,13 +146,13 @@ bool TarPackageCreationStep::doPackage(QFutureInterface<bool> &fi) } foreach (const DeployableFile &d, m_files) { - if (d.remoteDir.isEmpty()) { + if (d.remoteDirectory().isEmpty()) { emit addOutput(tr("No remote path specified for file '%1', skipping.") - .arg(QDir::toNativeSeparators(d.localFilePath)), ErrorMessageOutput); + .arg(d.localFilePath().toUserOutput()), ErrorMessageOutput); continue; } - QFileInfo fileInfo(d.localFilePath); - if (!appendFile(tarFile, fileInfo, d.remoteDir + QLatin1Char('/') + QFileInfo fileInfo = d.localFilePath().toFileInfo(); + if (!appendFile(tarFile, fileInfo, d.remoteDirectory() + QLatin1Char('/') + fileInfo.fileName(), fi)) { return false; } diff --git a/src/plugins/remotelinux/tarpackagecreationstep.h b/src/plugins/remotelinux/tarpackagecreationstep.h index d6cbbabe721..bdc30aa1c8f 100644 --- a/src/plugins/remotelinux/tarpackagecreationstep.h +++ b/src/plugins/remotelinux/tarpackagecreationstep.h @@ -31,7 +31,8 @@ #include "abstractpackagingstep.h" #include "remotelinux_export.h" -#include "deployablefile.h" + +#include <projectexplorer/deployablefile.h> QT_BEGIN_NAMESPACE class QFile; @@ -65,7 +66,7 @@ private: const QString &remoteFilePath); bool m_packagingNeeded; - QList<DeployableFile> m_files; + QList<ProjectExplorer::DeployableFile> m_files; }; } // namespace RemoteLinux |