diff options
Diffstat (limited to 'src/plugins/madde')
18 files changed, 43 insertions, 545 deletions
diff --git a/src/plugins/madde/Madde.pluginspec.in b/src/plugins/madde/Madde.pluginspec.in index 83445ce9ea..b217e0fad1 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 b72a204339..35205d52c5 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 9ed834d1db..a74597f127 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 94d99fc73d..630796bcbf 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 0503b9d72e..0967ae9f25 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 8f6829a04e..0000000000 --- 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 21c6353c01..0000000000 --- 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 04f5b74fd9..0000000000 --- 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 7268d2fd78..2912362523 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 4cb5f8f319..23293affe6 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 8ca0d9c7bc..1907c2cf39 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 d3ee46b60c..89a26c51e0 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 d148ca51ef..7292f55cc1 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 fc3beee28f..834351176f 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 b816f6682d..f84bf0cd4c 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 bfa191e9c4..0802294e8c 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 a48668f644..49ecdc1c3c 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 cc08f0ea35..116bef50c2 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(); |