From e17b99e7f362649d06c50e8b7b2988dbc6c3cb73 Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Tue, 13 Jul 2010 17:00:12 +0200 Subject: [PATCH] Maemo: Introduce class for maemo-global functions. --- .../qt-maemo/maemodeploystep.cpp | 9 ++-- .../qt-maemo/maemodeviceconfigurations.cpp | 12 ----- .../qt-maemo/maemodeviceconfigurations.h | 3 -- .../qt-maemo/maemoglobal.cpp | 48 +++++++++++++++++ .../qt4projectmanager/qt-maemo/maemoglobal.h | 52 +++++++++++++++++++ .../qt-maemo/maemorunconfiguration.cpp | 4 +- .../qt-maemo/maemoruncontrol.cpp | 5 +- .../qt4projectmanager/qt-maemo/qt-maemo.pri | 8 +-- 8 files changed, 115 insertions(+), 26 deletions(-) create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp create mode 100644 src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp index 19eed45c798..eb13bb89333 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.cpp @@ -32,6 +32,7 @@ #include "maemoconstants.h" #include "maemodeployables.h" #include "maemodeploystepwidget.h" +#include "maemoglobal.h" #include "maemopackagecreationstep.h" #include "maemorunconfiguration.h" @@ -191,7 +192,7 @@ void MaemoDeployStep::stop() QString MaemoDeployStep::uploadDir() const { - return homeDirOnDevice(m_connection->connectionParameters().uname); + return MaemoGlobal::homeDirOnDevice(m_connection->connectionParameters().uname); } bool MaemoDeployStep::currentlyNeedsDeployment(const QString &host, @@ -350,7 +351,7 @@ void MaemoDeployStep::handleSftpJobFinished(Core::SftpJobId job, .arg(deployInfo.first.localFilePath)); const QString remoteFilePath = deployInfo.first.remoteDir + '/' + QFileInfo(deployInfo.first.localFilePath).fileName(); - QByteArray linkCommand = remoteSudo().toUtf8() + " ln -sf " + QByteArray linkCommand = MaemoGlobal::remoteSudo().toUtf8() + " ln -sf " + deployInfo.second.toUtf8() + ' ' + remoteFilePath.toUtf8(); SshRemoteProcess::Ptr linkProcess = m_connection->createRemoteProcess(linkCommand); @@ -397,8 +398,8 @@ void MaemoDeployStep::handleLinkProcessFinished(int exitStatus) writeOutput(tr("Installing package ...")); const QString packageFileName = QFileInfo(packagingStep()->packageFilePath()).fileName(); - const QByteArray cmd = remoteSudo().toUtf8() + " dpkg -i " - + packageFileName.toUtf8(); + const QByteArray cmd = MaemoGlobal::remoteSudo().toUtf8() + + " dpkg -i " + packageFileName.toUtf8(); m_installer = m_connection->createRemoteProcess(cmd); connect(m_installer.data(), SIGNAL(closed(int)), this, SLOT(handleInstallationFinished(int))); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp index 18496019f6d..0749e00e1c3 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp @@ -48,18 +48,6 @@ typedef Core::SshConnectionParameters::AuthType AuthType; namespace Qt4ProjectManager { namespace Internal { -QString homeDirOnDevice(const QString &uname) -{ - return uname == QLatin1String("root") - ? QString::fromLatin1("/root") - : QLatin1String("/home/") + uname; -} - -QString remoteSudo() -{ - return QLatin1String("/usr/lib/mad-developer/devrootsh"); -} - namespace { const QLatin1String SettingsGroup("MaemoDeviceConfigs"); const QLatin1String IdCounterKey("IdCounter"); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h index 6f8ad3a7b04..463911f817d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h @@ -48,9 +48,6 @@ QT_END_NAMESPACE namespace Qt4ProjectManager { namespace Internal { -QString homeDirOnDevice(const QString &uname); -QString remoteSudo(); - class MaemoDeviceConfig { public: diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp new file mode 100644 index 00000000000..3a6f7853511 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "maemoglobal.h" + +namespace Qt4ProjectManager { +namespace Internal { + +QString MaemoGlobal::homeDirOnDevice(const QString &uname) +{ + return uname == QLatin1String("root") + ? QString::fromLatin1("/root") + : QLatin1String("/home/") + uname; +} + +QString MaemoGlobal::remoteSudo() +{ + return QLatin1String("/usr/lib/mad-developer/devrootsh"); +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h new file mode 100644 index 00000000000..3d23e6eef18 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h @@ -0,0 +1,52 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#ifndef MAEMOGLOBAL_H +#define MAEMOGLOBAL_H + +#include <projectexplorer/buildconfiguration.h> + +QT_BEGIN_NAMESPACE +class QString; +QT_END_NAMESPACE + +namespace Qt4ProjectManager { +namespace Internal { + +class MaemoGlobal +{ +public: + static QString homeDirOnDevice(const QString &uname); + static QString remoteSudo(); +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // MAEMOGLOBAL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 9a76be87c4b..1ab2ded58e7 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -49,7 +49,7 @@ #include <QtCore/QStringBuilder> namespace Qt4ProjectManager { - namespace Internal { +namespace Internal { using namespace ProjectExplorer; @@ -269,5 +269,5 @@ void MaemoRunConfiguration::updateDeviceConfigurations() emit deviceConfigurationsUpdated(target()); } - } // namespace Internal +} // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index 5dee500af98..f35ceeab51d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -36,6 +36,7 @@ #include "maemodeployables.h" #include "maemodeploystep.h" +#include "maemoglobal.h" #include "maemopackagecreationstep.h" #include "maemorunconfiguration.h" @@ -271,13 +272,13 @@ const QString AbstractMaemoRunControl::executableFileName() const const QString AbstractMaemoRunControl::uploadDir() const { - return homeDirOnDevice(m_devConfig.server.uname); + return MaemoGlobal::homeDirOnDevice(m_devConfig.server.uname); } const QString AbstractMaemoRunControl::targetCmdLinePrefix() const { return QString::fromLocal8Bit("%1 chmod a+x %2 && source /etc/profile && DISPLAY=:0.0 ") - .arg(remoteSudo()).arg(executableFilePathOnTarget()); + .arg(MaemoGlobal::remoteSudo()).arg(executableFilePathOnTarget()); } QString AbstractMaemoRunControl::targetCmdLineSuffix() const diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri index 5d3c84c1308..2ea996a8c0f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri @@ -22,7 +22,8 @@ HEADERS += \ $$PWD/maemodeployablelistwidget.h \ $$PWD/maemodeploystep.h \ $$PWD/maemodeploystepwidget.h \ - $$PWD/maemodeploystepfactory.h + $$PWD/maemodeploystepfactory.h \ + $$PWD/maemoglobal.h SOURCES += \ $$PWD/maemoconfigtestdialog.cpp \ @@ -46,7 +47,8 @@ SOURCES += \ $$PWD/maemodeployablelistwidget.cpp \ $$PWD/maemodeploystep.cpp \ $$PWD/maemodeploystepwidget.cpp \ - $$PWD/maemodeploystepfactory.cpp + $$PWD/maemodeploystepfactory.cpp \ + $$PWD/maemoglobal.cpp FORMS += \ $$PWD/maemoconfigtestdialog.ui \ @@ -54,6 +56,6 @@ FORMS += \ $$PWD/maemosshconfigdialog.ui \ $$PWD/maemopackagecreationwidget.ui \ $$PWD/maemodeployablelistwidget.ui \ - qt-maemo/maemodeploystepwidget.ui + $$PWD/maemodeploystepwidget.ui RESOURCES += $$PWD/qt-maemo.qrc -- GitLab