diff options
Diffstat (limited to 'src/plugins/qt4projectmanager')
173 files changed, 260 insertions, 26839 deletions
diff --git a/src/plugins/qt4projectmanager/findqt4profiles.h b/src/plugins/qt4projectmanager/findqt4profiles.h index 6a2ba3efdd..9231d356e1 100644 --- a/src/plugins/qt4projectmanager/findqt4profiles.h +++ b/src/plugins/qt4projectmanager/findqt4profiles.h @@ -36,9 +36,8 @@ #include <projectexplorer/nodesvisitor.h> namespace Qt4ProjectManager { -namespace Internal { - class Qt4ProFileNode; +namespace Internal { class FindQt4ProFiles: protected ProjectExplorer::NodesVisitor { diff --git a/src/plugins/qt4projectmanager/librarydetailscontroller.h b/src/plugins/qt4projectmanager/librarydetailscontroller.h index 4151dfdf1f..a52c04b520 100644 --- a/src/plugins/qt4projectmanager/librarydetailscontroller.h +++ b/src/plugins/qt4projectmanager/librarydetailscontroller.h @@ -37,14 +37,13 @@ #include "addlibrarywizard.h" namespace Qt4ProjectManager { +class Qt4ProFileNode; namespace Internal { namespace Ui { class LibraryDetailsWidget; } -class Qt4ProFileNode; - class LibraryDetailsController : public QObject { Q_OBJECT diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index de216f6238..2187f59184 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -31,6 +31,7 @@ **************************************************************************/ #include "qmakestep.h" +#include "ui_qmakestep.h" #include <projectexplorer/projectexplorerconstants.h> #include "qmakeparser.h" @@ -465,16 +466,17 @@ bool QMakeStep::fromMap(const QVariantMap &map) //// QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) - : BuildStepConfigWidget(), m_step(step), m_ignoreChange(false) + : BuildStepConfigWidget(), m_ui(new Ui::QMakeStep), m_step(step), + m_ignoreChange(false) { - m_ui.setupUi(this); - connect(m_ui.qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(const QString&)), + m_ui->setupUi(this); + connect(m_ui->qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(qmakeArgumentsLineEdited())); - connect(m_ui.buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)), + connect(m_ui->buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigurationSelected())); - connect(m_ui.qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)), + connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)), this, SLOT(linkQmlDebuggingLibraryChecked(bool))); - connect(m_ui.qmlDebuggingWarningText, SIGNAL(linkActivated(QString)), + connect(m_ui->qmlDebuggingWarningText, SIGNAL(linkActivated(QString)), this, SLOT(buildQmlDebuggingHelper())); connect(step, SIGNAL(userArgumentsChanged()), this, SLOT(userArgumentsChanged())); @@ -490,10 +492,15 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) this, SLOT(qtVersionsDumpUpdated(QString))); } +QMakeStepConfigWidget::~QMakeStepConfigWidget() +{ + delete m_ui; +} + void QMakeStepConfigWidget::init() { - m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments()); - m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); + m_ui->qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments()); + m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); qmakeBuildConfigChanged(); @@ -531,7 +538,7 @@ void QMakeStepConfigWidget::qmakeBuildConfigChanged() Qt4BuildConfiguration *bc = m_step->qt4BuildConfiguration(); bool debug = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild; m_ignoreChange = true; - m_ui.buildConfigurationComboBox->setCurrentIndex(debug? 0 : 1); + m_ui->buildConfigurationComboBox->setCurrentIndex(debug? 0 : 1); m_ignoreChange = false; updateSummaryLabel(); updateEffectiveQMakeCall(); @@ -541,7 +548,7 @@ void QMakeStepConfigWidget::userArgumentsChanged() { if (m_ignoreChange) return; - m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments()); + m_ui->qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments()); updateSummaryLabel(); updateEffectiveQMakeCall(); } @@ -550,7 +557,7 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged() { if (m_ignoreChange) return; - m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); + m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); updateSummaryLabel(); updateEffectiveQMakeCall(); @@ -560,7 +567,7 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged() void QMakeStepConfigWidget::qmakeArgumentsLineEdited() { m_ignoreChange = true; - m_step->setUserArguments(m_ui.qmakeAdditonalArgumentsLineEdit->text()); + m_step->setUserArguments(m_ui->qmakeAdditonalArgumentsLineEdit->text()); m_ignoreChange = false; updateSummaryLabel(); @@ -573,7 +580,7 @@ void QMakeStepConfigWidget::buildConfigurationSelected() return; Qt4BuildConfiguration *bc = m_step->qt4BuildConfiguration(); QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration(); - if (m_ui.buildConfigurationComboBox->currentIndex() == 0) { // debug + if (m_ui->buildConfigurationComboBox->currentIndex() == 0) { // debug buildConfiguration = buildConfiguration | QtSupport::BaseQtVersion::DebugBuild; } else { buildConfiguration = buildConfiguration & ~QtSupport::BaseQtVersion::DebugBuild; @@ -638,13 +645,13 @@ void QMakeStepConfigWidget::updateSummaryLabel() void QMakeStepConfigWidget::updateQmlDebuggingOption() { - m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported()); + m_ui->qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported()); QtSupport::BaseQtVersion *qtVersion = m_step->qt4BuildConfiguration()->qtVersion(); if (!qtVersion || !qtVersion->needsQmlDebuggingLibrary()) - m_ui.debuggingLibraryLabel->setText(tr("Enable QML debugging:")); + m_ui->debuggingLibraryLabel->setText(tr("Enable QML debugging:")); else - m_ui.debuggingLibraryLabel->setText(tr("Link QML debugging library:")); + m_ui->debuggingLibraryLabel->setText(tr("Link QML debugging library:")); QString warningText; @@ -653,8 +660,8 @@ void QMakeStepConfigWidget::updateQmlDebuggingOption() else if (m_step->linkQmlDebuggingLibrary()) warningText = tr("Might make your application vulnerable. Only use in a safe environment!"); - m_ui.qmlDebuggingWarningText->setText(warningText); - m_ui.qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty()); + m_ui->qmlDebuggingWarningText->setText(warningText); + m_ui->qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty()); } void QMakeStepConfigWidget::updateEffectiveQMakeCall() @@ -664,7 +671,7 @@ void QMakeStepConfigWidget::updateEffectiveQMakeCall() QString program = tr("<No qtversion>"); if (qtVersion) program = QFileInfo(qtVersion->qmakeCommand()).fileName(); - m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + m_step->allArguments()); + m_ui->qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + m_step->allArguments()); } //// diff --git a/src/plugins/qt4projectmanager/qmakestep.h b/src/plugins/qt4projectmanager/qmakestep.h index a9d0a131d7..4f217e6b48 100644 --- a/src/plugins/qt4projectmanager/qmakestep.h +++ b/src/plugins/qt4projectmanager/qmakestep.h @@ -33,7 +33,11 @@ #ifndef QMAKESTEP_H #define QMAKESTEP_H -#include "ui_qmakestep.h" +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE +namespace Ui { class QMakeStep; } +QT_END_NAMESPACE #include <projectexplorer/abstractprocessstep.h> @@ -137,6 +141,7 @@ class QMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget Q_OBJECT public: QMakeStepConfigWidget(QMakeStep *step); + ~QMakeStepConfigWidget(); void init(); QString summaryText() const; QString displayName() const; @@ -160,7 +165,7 @@ private: void updateSummaryLabel(); void updateQmlDebuggingOption(); void updateEffectiveQMakeCall(); - Ui::QMakeStep m_ui; + Ui::QMakeStep *m_ui; QMakeStep *m_step; QString m_summaryText; bool m_ignoreChange; diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp index 6508f9ec50..4d52a55ecf 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp @@ -153,7 +153,7 @@ void Qt4RunConfiguration::handleParseState(bool success) emit isEnabledChanged(!enabled); } -void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success) +void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success) { if (m_proFilePath != pro->path()) return; @@ -161,7 +161,7 @@ void Qt4RunConfiguration::proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFile emit effectiveTargetInformationChanged(); } -void Qt4RunConfiguration::proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro) +void Qt4RunConfiguration::proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro) { if (pro->path() != m_proFilePath) return; @@ -174,11 +174,11 @@ void Qt4RunConfiguration::ctor() connect(qt4Target(), SIGNAL(environmentChanged()), this, SIGNAL(baseEnvironmentChanged())); - connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - this, SLOT(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool))); + connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool)), + this, SLOT(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool))); - connect(qt4Target()->qt4Project(), SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), - this, SLOT(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*))); + connect(qt4Target()->qt4Project(), SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*)), + this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*))); } ////// diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h index 71870757e9..f68c0d6d77 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.h @@ -62,11 +62,11 @@ namespace Qt4ProjectManager { class Qt4Project; class Qt4BaseTarget; +class Qt4ProFileNode; namespace Internal { class Qt4DesktopTarget; class Qt4PriFileNode; -class Qt4ProFileNode; class Qt4RunConfigurationFactory; class Qt4RunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration @@ -117,8 +117,8 @@ signals: void effectiveTargetInformationChanged(); private slots: - void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success); - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro); + void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *pro, bool success); + void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro); protected: Qt4RunConfiguration(Qt4BaseTarget *parent, Qt4RunConfiguration *source); diff --git a/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.cpp deleted file mode 100644 index 265a886013..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "abstractlinuxdevicedeploystep.h" - -#include "maemoconstants.h" -#include "maemodeploystepwidget.h" -#include "maemopertargetdeviceconfigurationlistmodel.h" -#include "qt4maemodeployconfiguration.h" - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - - -AbstractLinuxDeviceDeployStep::AbstractLinuxDeviceDeployStep(DeployConfiguration *dc) - : m_helper(qobject_cast<Qt4MaemoDeployConfiguration *>(dc)) -{ -} - -bool AbstractLinuxDeviceDeployStep::isDeploymentPossible(QString &whyNot) const -{ - if (!m_helper.deviceConfig()) { - whyNot = tr("No valid device set."); - return false; - } - return isDeploymentPossibleInternal(whyNot); -} - -bool AbstractLinuxDeviceDeployStep::initialize(QString &errorMsg) -{ - if (!isDeploymentPossible(errorMsg)) - return false; - m_helper.prepareDeployment(); - return true; -} - - -LinuxDeviceDeployStepHelper::LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc) - : m_deployConfiguration(dc) -{ - m_deviceConfig = dc->deviceConfigModel()->defaultDeviceConfig(); - connect(dc->deviceConfigModel().data(), SIGNAL(updated()), - SLOT(handleDeviceConfigurationsUpdated())); -} - -LinuxDeviceDeployStepHelper::~LinuxDeviceDeployStepHelper() {} - -void LinuxDeviceDeployStepHelper::handleDeviceConfigurationsUpdated() -{ - setDeviceConfig(MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig)); -} - -void LinuxDeviceDeployStepHelper::setDeviceConfig(MaemoDeviceConfig::Id internalId) -{ - m_deviceConfig = deployConfiguration()->deviceConfigModel()->find(internalId); - emit deviceConfigChanged(); -} - -void LinuxDeviceDeployStepHelper::setDeviceConfig(int i) -{ - m_deviceConfig = deployConfiguration()->deviceConfigModel()->deviceAt(i); - emit deviceConfigChanged(); -} - -QVariantMap LinuxDeviceDeployStepHelper::toMap() const -{ - QVariantMap map; - map.insert(DeviceIdKey, - MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig)); - return map; -} - -bool LinuxDeviceDeployStepHelper::fromMap(const QVariantMap &map) -{ - setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong()); - return true; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.h deleted file mode 100644 index e3a4ece673..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/abstractlinuxdevicedeploystep.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef ABSTRACTLINUXDEVICEDEPLOYSTEP_H -#define ABSTRACTLINUXDEVICEDEPLOYSTEP_H - -#include "maemodeviceconfigurations.h" - -#include <QtCore/QCoreApplication> -#include <QtCore/QSharedPointer> -#include <QtCore/QVariantMap> - -namespace ProjectExplorer { class DeployConfiguration; } - -namespace Qt4ProjectManager { -namespace Internal { -class Qt4MaemoDeployConfiguration; - - -class LinuxDeviceDeployStepHelper : public QObject -{ - Q_OBJECT -public: - LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc); - ~LinuxDeviceDeployStepHelper(); - - QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; } - QSharedPointer<const MaemoDeviceConfig> cachedDeviceConfig() const { return m_cachedDeviceConfig; } - Qt4MaemoDeployConfiguration *deployConfiguration() const { return m_deployConfiguration; } - - void setDeviceConfig(int i); - void prepareDeployment() { m_cachedDeviceConfig = m_deviceConfig; } - - QVariantMap toMap() const; - bool fromMap(const QVariantMap &map); - -signals: - void deviceConfigChanged(); - -private: - void setDeviceConfig(MaemoDeviceConfig::Id internalId); - Q_SLOT void handleDeviceConfigurationsUpdated(); - - QSharedPointer<const MaemoDeviceConfig> m_deviceConfig; - QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig; - Qt4MaemoDeployConfiguration * const m_deployConfiguration; -}; - -class AbstractLinuxDeviceDeployStep -{ - Q_DECLARE_TR_FUNCTIONS(AbstractLinuxDeviceDeployStep) -public: - virtual ~AbstractLinuxDeviceDeployStep() {} - - Qt4MaemoDeployConfiguration *maemoDeployConfig() const { return m_helper.deployConfiguration(); } - bool isDeploymentPossible(QString &whyNot) const; - LinuxDeviceDeployStepHelper &helper() { return m_helper; } - const LinuxDeviceDeployStepHelper &helper() const { return m_helper; } - -protected: - AbstractLinuxDeviceDeployStep(ProjectExplorer::DeployConfiguration *dc); - - bool initialize(QString &errorMsg); - -private: - virtual bool isDeploymentPossibleInternal(QString &whynot) const=0; - - LinuxDeviceDeployStepHelper m_helper; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // ABSTRACTLINUXDEVICEDEPLOYSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.cpp deleted file mode 100644 index 57033b746e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "abstractmaemodeploystep.h" - -#include "maemoconstants.h" -#include "maemodeploystepwidget.h" -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemopertargetdeviceconfigurationlistmodel.h" -#include "maemoqemumanager.h" -#include "qt4maemodeployconfiguration.h" - -#include <utils/ssh/sshconnection.h> - -#include <projectexplorer/projectexplorerconstants.h> - -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> - -#include <utils/ssh/sshconnectionmanager.h> - -#include <QtCore/QEventLoop> -#include <QtCore/QFileInfo> -#include <QtCore/QTimer> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(BaseState, state, m_baseState) - -using namespace Core; -using namespace Utils; -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { - -class MaemoDeployEventHandler : public QObject -{ - Q_OBJECT -public: - MaemoDeployEventHandler(AbstractMaemoDeployStep *deployStep, - QFutureInterface<bool> &future); - -private slots: - void handleDeployingDone(); - void handleDeployingFailed(); - void checkForCanceled(); - -private: - AbstractMaemoDeployStep * const m_deployStep; - const QFutureInterface<bool> m_future; - QEventLoop * const m_eventLoop; - bool m_error; -}; - -} // anonymous namespace - - -AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent, - const QString &id) - : BuildStep(parent, id), - AbstractLinuxDeviceDeployStep(deployConfiguration()) -{ - baseCtor(); -} - -AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent, - AbstractMaemoDeployStep *other) - : BuildStep(parent, other), - AbstractLinuxDeviceDeployStep(deployConfiguration()), - m_lastDeployed(other->m_lastDeployed) -{ - baseCtor(); -} - -AbstractMaemoDeployStep::~AbstractMaemoDeployStep() { } - -void AbstractMaemoDeployStep::baseCtor() -{ - m_baseState = BaseInactive; -} - -bool AbstractMaemoDeployStep::init() -{ - QString errorMsg; - if (!initialize(errorMsg)) { - writeOutput(errorMsg, ErrorMessageOutput); - return false; - } - return true; -} - -void AbstractMaemoDeployStep::run(QFutureInterface<bool> &fi) -{ - // Move to GUI thread. - QTimer::singleShot(0, this, SLOT(start())); - - MaemoDeployEventHandler eventHandler(this, fi); -} - -BuildStepConfigWidget *AbstractMaemoDeployStep::createConfigWidget() -{ - return new MaemoDeployStepWidget(this); -} - -QVariantMap AbstractMaemoDeployStep::toMap() const -{ - QVariantMap map(BuildStep::toMap()); - addDeployTimesToMap(map); - map.unite(helper().toMap()); - return map; -} - -void AbstractMaemoDeployStep::addDeployTimesToMap(QVariantMap &map) const -{ - QVariantList hostList; - QVariantList fileList; - QVariantList remotePathList; - QVariantList timeList; - typedef QHash<DeployablePerHost, QDateTime>::ConstIterator DepIt; - for (DepIt it = m_lastDeployed.begin(); it != m_lastDeployed.end(); ++it) { - fileList << it.key().first.localFilePath; - remotePathList << it.key().first.remoteDir; - hostList << it.key().second; - timeList << it.value(); - } - map.insert(LastDeployedHostsKey, hostList); - map.insert(LastDeployedFilesKey, fileList); - map.insert(LastDeployedRemotePathsKey, remotePathList); - map.insert(LastDeployedTimesKey, timeList); -} - -bool AbstractMaemoDeployStep::fromMap(const QVariantMap &map) -{ - if (!BuildStep::fromMap(map)) - return false; - if (!helper().fromMap(map)) - return false; - getDeployTimesFromMap(map); - return true; -} - -void AbstractMaemoDeployStep::getDeployTimesFromMap(const QVariantMap &map) -{ - const QVariantList &hostList = map.value(LastDeployedHostsKey).toList(); - const QVariantList &fileList = map.value(LastDeployedFilesKey).toList(); - const QVariantList &remotePathList - = map.value(LastDeployedRemotePathsKey).toList(); - const QVariantList &timeList = map.value(LastDeployedTimesKey).toList(); - const int elemCount - = qMin(qMin(hostList.size(), fileList.size()), - qMin(remotePathList.size(), timeList.size())); - for (int i = 0; i < elemCount; ++i) { - const MaemoDeployable d(fileList.at(i).toString(), - remotePathList.at(i).toString()); - m_lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()), - timeList.at(i).toDateTime()); - } -} - -void AbstractMaemoDeployStep::raiseError(const QString &errorString) -{ - emit addTask(Task(Task::Error, errorString, QString(), -1, - ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); - m_hasError = true; - emit error(); -} - -void AbstractMaemoDeployStep::writeOutput(const QString &text, OutputFormat format, - OutputNewlineSetting newlineSetting) -{ - emit addOutput(text, format, newlineSetting); -} - -void AbstractMaemoDeployStep::stop() -{ - if (m_baseState == StopRequested || m_baseState == BaseInactive) - return; - - writeOutput(tr("Operation canceled by user, cleaning up...")); - const BaseState oldState = m_baseState; - setBaseState(StopRequested); - switch (oldState) { - case Connecting: - m_connection->disconnectFromHost(); - setDeploymentFinished(); - break; - case Deploying: - stopInternal(); - break; - default: - qFatal("Missing switch case in %s.", Q_FUNC_INFO); - } -} - -bool AbstractMaemoDeployStep::currentlyNeedsDeployment(const QString &host, - const MaemoDeployable &deployable) const -{ - const QDateTime &lastDeployed - = m_lastDeployed.value(DeployablePerHost(deployable, host)); - return !lastDeployed.isValid() - || QFileInfo(deployable.localFilePath).lastModified() > lastDeployed; -} - -void AbstractMaemoDeployStep::setDeployed(const QString &host, - const MaemoDeployable &deployable) -{ - m_lastDeployed.insert(DeployablePerHost(deployable, host), - QDateTime::currentDateTime()); -} - -void AbstractMaemoDeployStep::start() -{ - if (m_baseState != BaseInactive) { - raiseError(tr("Cannot deploy: Still cleaning up from last time.")); - emit done(); - return; - } - - m_hasError = false; - if (isDeploymentNeeded(helper().cachedDeviceConfig()->sshParameters().host)) { - if (helper().cachedDeviceConfig()->type() == MaemoDeviceConfig::Emulator - && !MaemoQemuManager::instance().qemuIsRunning()) { - MaemoQemuManager::instance().startRuntime(); - raiseError(tr("Cannot deploy: Qemu was not running. " - "It has now been started up for you, but it will take " - "a bit of time until it is ready.")); - emit done(); - return; - } - - connectToDevice(); - } else { - writeOutput(tr("All files up to date, no installation necessary.")); - emit done(); - } -} - -void AbstractMaemoDeployStep::handleConnectionFailure() -{ - if (m_baseState == BaseInactive) - return; - - const QString errorMsg = m_baseState == Connecting - ? MaemoGlobal::failedToConnectToServerMessage(m_connection, helper().cachedDeviceConfig()) - : tr("Connection error: %1").arg(m_connection->errorString()); - raiseError(errorMsg); - setDeploymentFinished(); -} - -void AbstractMaemoDeployStep::connectToDevice() -{ - ASSERT_STATE(QList<BaseState>() << BaseInactive); - setBaseState(Connecting); - - m_connection = SshConnectionManager::instance().acquireConnection(helper().cachedDeviceConfig()->sshParameters()); - connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this, - SLOT(handleConnectionFailure())); - if (m_connection->state() == SshConnection::Connected) { - handleConnected(); - } else { - connect(m_connection.data(), SIGNAL(connected()), this, - SLOT(handleConnected())); - writeOutput(tr("Connecting to device...")); - m_connection->connectToHost(); - } -} - -void AbstractMaemoDeployStep::handleConnected() -{ - ASSERT_STATE(QList<BaseState>() << Connecting << StopRequested); - - if (m_baseState == Connecting) { - setBaseState(Deploying); - startInternal(); - } -} - -void AbstractMaemoDeployStep::handleProgressReport(const QString &progressMsg) -{ - ASSERT_STATE(QList<BaseState>() << Deploying << StopRequested << BaseInactive); - - switch (m_baseState) { - case Deploying: - case StopRequested: - writeOutput(progressMsg); - break; - case BaseInactive: - default: - break; - } -} - -void AbstractMaemoDeployStep::setDeploymentFinished() -{ - if (m_hasError) - writeOutput(tr("Deployment failed."), ErrorMessageOutput); - else - writeOutput(tr("Deployment finished.")); - setBaseState(BaseInactive); -} - -void AbstractMaemoDeployStep::setBaseState(BaseState newState) -{ - if (newState == m_baseState) - return; - m_baseState = newState; - if (m_baseState == BaseInactive) { - disconnect(m_connection.data(), 0, this, 0); - SshConnectionManager::instance().releaseConnection(m_connection); - emit done(); - } -} - -void AbstractMaemoDeployStep::handleRemoteStdout(const QString &output) -{ - ASSERT_STATE(QList<BaseState>() << Deploying << StopRequested); - - switch (m_baseState) { - case Deploying: - case StopRequested: - writeOutput(output, NormalOutput, DontAppendNewline); - break; - default: - break; - } -} - -void AbstractMaemoDeployStep::handleRemoteStderr(const QString &output) -{ - ASSERT_STATE(QList<BaseState>() << Deploying << StopRequested); - - switch (m_baseState) { - case Deploying: - case StopRequested: - writeOutput(output, ErrorOutput, DontAppendNewline); - break; - default: - break; - } -} - -const Qt4BuildConfiguration *AbstractMaemoDeployStep::qt4BuildConfiguration() const -{ - return static_cast<Qt4BuildConfiguration *>(buildConfiguration()); -} - -MaemoDeployEventHandler::MaemoDeployEventHandler(AbstractMaemoDeployStep *deployStep, - QFutureInterface<bool> &future) - : m_deployStep(deployStep), m_future(future), m_eventLoop(new QEventLoop), - m_error(false) -{ - connect(m_deployStep, SIGNAL(done()), this, SLOT(handleDeployingDone())); - connect(m_deployStep, SIGNAL(error()), this, SLOT(handleDeployingFailed())); - QTimer cancelChecker; - connect(&cancelChecker, SIGNAL(timeout()), this, SLOT(checkForCanceled())); - cancelChecker.start(500); - future.reportResult(m_eventLoop->exec() == 0); -} - -void MaemoDeployEventHandler::handleDeployingDone() -{ - m_eventLoop->exit(m_error ? 1 : 0); -} - -void MaemoDeployEventHandler::handleDeployingFailed() -{ - m_error = true; -} - -void MaemoDeployEventHandler::checkForCanceled() -{ - if (!m_error && m_future.isCanceled()) { - QMetaObject::invokeMethod(m_deployStep, "stop"); - m_error = true; - handleDeployingDone(); - } -} - -} // namespace Internal -} // namespace Qt4ProjectManager - -#include "abstractmaemodeploystep.moc" diff --git a/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.h deleted file mode 100644 index 210eb71cb4..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/abstractmaemodeploystep.h +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef ABSTRACTMAEMODEPLOYSTEP_H -#define ABSTRACTMAEMODEPLOYSTEP_H - -#include "abstractlinuxdevicedeploystep.h" -#include "maemodeployable.h" -#include "maemodeployables.h" -#include "maemodeviceconfigurations.h" - -#include <projectexplorer/buildstep.h> - -#include <QtCore/QHash> -#include <QtCore/QList> -#include <QtCore/QPair> -#include <QtCore/QSharedPointer> - -QT_BEGIN_NAMESPACE -class QEventLoop; -QT_END_NAMESPACE - -namespace Utils { class SshConnection; } - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -namespace Internal { -class AbstractMaemoPackageCreationStep; -class MaemoDeviceConfig; -class Qt4MaemoDeployConfiguration; - -class AbstractMaemoDeployStep - : public ProjectExplorer::BuildStep, public AbstractLinuxDeviceDeployStep -{ - Q_OBJECT -public: - virtual ~AbstractMaemoDeployStep(); - - Q_INVOKABLE void stop(); - -signals: - void done(); - void error(); - -protected: - AbstractMaemoDeployStep(ProjectExplorer::BuildStepList *bc, - const QString &id); - AbstractMaemoDeployStep(ProjectExplorer::BuildStepList *bc, - AbstractMaemoDeployStep *other); - - enum BaseState { BaseInactive, StopRequested, Connecting, Deploying }; - BaseState baseState() const { return m_baseState; } - - bool currentlyNeedsDeployment(const QString &host, - const MaemoDeployable &deployable) const; - void setDeployed(const QString &host, const MaemoDeployable &deployable); - void raiseError(const QString &error); - void writeOutput(const QString &text, OutputFormat format = MessageOutput, - OutputNewlineSetting newlineSetting = DoAppendNewline); - void setDeploymentFinished(); - - virtual const AbstractMaemoPackageCreationStep *packagingStep() const=0; - - QString deployMountPoint() const; - const Qt4BuildConfiguration *qt4BuildConfiguration() const; - QSharedPointer<Utils::SshConnection> connection() const { return m_connection; } - -private slots: - void start(); - void handleConnected(); - void handleConnectionFailure(); - void handleProgressReport(const QString &progressMsg); - void handleRemoteStdout(const QString &output); - void handleRemoteStderr(const QString &output); - -private: - virtual bool init(); - virtual void run(QFutureInterface<bool> &fi); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - virtual QVariantMap toMap() const; - virtual bool fromMap(const QVariantMap &map); - - virtual bool isDeploymentNeeded(const QString &hostName) const=0; - virtual void startInternal()=0; - virtual void stopInternal()=0; - - void baseCtor(); - void addDeployTimesToMap(QVariantMap &map) const; - void getDeployTimesFromMap(const QVariantMap &map); - void connectToDevice(); - void setBaseState(BaseState newState); - - QSharedPointer<Utils::SshConnection> m_connection; - typedef QPair<MaemoDeployable, QString> DeployablePerHost; - QHash<DeployablePerHost, QDateTime> m_lastDeployed; - BaseState m_baseState; - bool m_hasError; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // ABSTRACTMAEMODEPLOYSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/images/qemu-run.png b/src/plugins/qt4projectmanager/qt-maemo/images/qemu-run.png Binary files differdeleted file mode 100644 index c65d15faf7..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/images/qemu-run.png +++ /dev/null diff --git a/src/plugins/qt4projectmanager/qt-maemo/images/qemu-stop.png b/src/plugins/qt4projectmanager/qt-maemo/images/qemu-stop.png Binary files differdeleted file mode 100644 index 97bc159599..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/images/qemu-stop.png +++ /dev/null diff --git a/src/plugins/qt4projectmanager/qt-maemo/images/qemu.xcf b/src/plugins/qt4projectmanager/qt-maemo/images/qemu.xcf Binary files differdeleted file mode 100644 index 226dd2b30a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/images/qemu.xcf +++ /dev/null diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp deleted file mode 100644 index ec14f7751d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoanalyzersupport.h" -#include "maemoglobal.h" - -#include <analyzerbase/analyzermanager.h> -#include <analyzerbase/analyzerstartparameters.h> -#include <analyzerbase/analyzerconstants.h> -#include <analyzerbase/analyzerruncontrol.h> - -#include <QtCore/QDir> - -using namespace Utils; -using namespace Analyzer; -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(MaemoRunConfiguration *runConfig) -{ - AnalyzerStartParameters params; - - const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); - params.debuggee = runConfig->remoteExecutableFilePath(); - params.debuggeeArgs = runConfig->arguments(); - params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(), - devConf->sshParameters().userName, runConfig->remoteExecutableFilePath()) - + MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges()); - params.startMode = StartRemote; - params.connParams = devConf->sshParameters(); - params.localMountDir = runConfig->localDirToMountForRemoteGdb(); - params.remoteMountPoint = runConfig->remoteProjectSourcesMountPoint(); - const QString execDirAbs - = QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path()); - const QString execDirRel - = QDir(params.localMountDir).relativeFilePath(execDirAbs); - params.remoteSourcesDir = QString(params.remoteMountPoint - + QLatin1Char('/') + execDirRel).toUtf8(); - params.displayName = runConfig->displayName(); - - return AnalyzerManager::instance()->createAnalyzer(params, runConfig); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.h deleted file mode 100644 index e7ee3ea7e1..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOANALYZERSUPPORT_H -#define MAEMOANALYZERSUPPORT_H - -#include "maemorunconfiguration.h" - -namespace Qt4ProjectManager { -namespace Internal { - -namespace MaemoAnalyzerSupport { - -ProjectExplorer::RunControl *createAnalyzerRunControl(MaemoRunConfiguration *runConfig); - -} - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOANALYZERSUPPORT_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp deleted file mode 100644 index d652a69475..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoconfigtestdialog.h" -#include "ui_maemoconfigtestdialog.h" - -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" -#include "maemousedportsgatherer.h" - -#include <utils/ssh/sshremoteprocessrunner.h> - -#include <QtGui/QPalette> -#include <QtGui/QPushButton> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig::ConstPtr &config, - QWidget *parent) - : QDialog(parent) - , m_ui(new Ui_MaemoConfigTestDialog) - , m_config(config) - , m_portsGatherer(new MaemoUsedPortsGatherer(this)) -{ - setAttribute(Qt::WA_DeleteOnClose); - - m_ui->setupUi(this); - m_closeButton = m_ui->buttonBox->button(QDialogButtonBox::Close); - - connect(m_closeButton, SIGNAL(clicked()), SLOT(stopConfigTest())); - connect(m_portsGatherer, SIGNAL(error(QString)), - SLOT(handlePortListFailure(QString))); - connect(m_portsGatherer, SIGNAL(portListReady()), - SLOT(handlePortListReady())); - - startConfigTest(); -} - -MaemoConfigTestDialog::~MaemoConfigTestDialog() -{ - stopConfigTest(); -} - -void MaemoConfigTestDialog::startConfigTest() -{ - if (m_testProcessRunner) - return; - - m_currentTest = GeneralTest; - const QString testingText = m_config->type() == MaemoDeviceConfig::Emulator - ? tr("Testing configuration. This may take a while.") - : tr("Testing configuration..."); - m_ui->testResultEdit->setPlainText(testingText); - m_closeButton->setText(tr("Stop Test")); - - // We need to explicitly create the connection here, because the other - // constructor uses a managed connection, i.e. it might re-use an - // existing one, which we explicitly don't want here. - m_testProcessRunner = SshRemoteProcessRunner::create(SshConnection::create(m_config->sshParameters())); - - connect(m_testProcessRunner.data(), SIGNAL(connectionError(Utils::SshError)), - this, SLOT(handleConnectionError())); - connect(m_testProcessRunner.data(), SIGNAL(processClosed(int)), this, - SLOT(handleTestProcessFinished(int))); - connect(m_testProcessRunner.data(), - SIGNAL(processOutputAvailable(QByteArray)), this, - SLOT(processSshOutput(QByteArray))); - const QLatin1String sysInfoCmd("uname -rsm"); - QString command = sysInfoCmd; - QString qtInfoCmd; - switch (MaemoGlobal::packagingSystem(m_config->osVersion())) { - case MaemoGlobal::Rpm: - qtInfoCmd = QLatin1String("rpm -qa 'libqt*' " - "--queryformat '%{NAME} %{VERSION}\\n'"); - break; - case MaemoGlobal::Dpkg: - qtInfoCmd = QLatin1String("dpkg-query -W -f " - "'${Package} ${Version} ${Status}\n' 'libqt*' |grep ' installed$'"); - break; - default: - break; - } - if (!qtInfoCmd.isEmpty()) - command += QLatin1String(" && ") + qtInfoCmd; - m_testProcessRunner->run(command.toUtf8()); -} - -void MaemoConfigTestDialog::handleConnectionError() -{ - if (!m_testProcessRunner) - return; - QString output = tr("Could not connect to host: %1") - .arg(m_testProcessRunner->connection()->errorString()); - if (m_config->type() == MaemoDeviceConfig::Emulator) - output += tr("\nDid you start Qemu?"); - m_ui->testResultEdit->setPlainText(output); - stopConfigTest(); -} - -void MaemoConfigTestDialog::handleTestProcessFinished(int exitStatus) -{ - if (!m_testProcessRunner) - return; - - Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart - || exitStatus == SshRemoteProcess::KilledBySignal - || exitStatus == SshRemoteProcess::ExitedNormally); - - if (m_currentTest == GeneralTest) - handleGeneralTestResult(exitStatus); - else - handleMadDeveloperTestResult(exitStatus); -} - -void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus) -{ - if (exitStatus != SshRemoteProcess::ExitedNormally - || m_testProcessRunner->process()->exitCode() != 0) { - m_ui->testResultEdit->setPlainText(tr("Remote process failed: %1") - .arg(m_testProcessRunner->process()->errorString())); - } else { - const QString &output = parseTestOutput(); - if (!m_qtVersionOk) { - m_ui->errorLabel->setText(tr("Qt version mismatch! " - " Expected Qt on device: 4.6.2 or later.")); - } - m_ui->testResultEdit->setPlainText(output); - } - - switch (m_config->osVersion()) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - case MaemoDeviceConfig::Meego: - m_currentTest = MadDeveloperTest; - disconnect(m_testProcessRunner.data(), - SIGNAL(processOutputAvailable(QByteArray)), this, - SLOT(processSshOutput(QByteArray))); - m_testProcessRunner->run("test -x " - + MaemoGlobal::devrootshPath().toUtf8()); - break; - default: - testPorts(); - } -} - -void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus) -{ - if (exitStatus != SshRemoteProcess::ExitedNormally) { - m_ui->testResultEdit->setPlainText(tr("Remote process failed: %1") - .arg(m_testProcessRunner->process()->errorString())); - } else if (m_testProcessRunner->process()->exitCode() != 0) { - QString errorMsg = m_ui->errorLabel->text() + QLatin1String("<br>") - + tr("%1 is not installed.<br>You will not be able to deploy " - "to this device.") - .arg(MaemoGlobal::madDeveloperUiName(m_config->osVersion())); - if (m_config->osVersion() == MaemoDeviceConfig::Maemo6) { - errorMsg += QLatin1String("<br>") - + tr("Please switch the device to developer mode via Settings -> Security."); - } - m_ui->errorLabel->setText(errorMsg); - } - testPorts(); -} - -void MaemoConfigTestDialog::handlePortListFailure(const QString &errMsg) -{ - m_ui->testResultEdit->appendPlainText(tr("Error retrieving list of used ports: %1") - .arg(errMsg)); - finish(); -} - -void MaemoConfigTestDialog::handlePortListReady() -{ - const QList<int> &usedPorts = m_portsGatherer->usedPorts(); - QString output; - if (usedPorts.isEmpty()) { - output = tr("All specified ports are available."); - } else { - output = tr("The following supposedly free ports are being used on the device:"); - foreach (const int port, usedPorts) - output += QLatin1Char(' ') + QString::number(port); - } - m_ui->testResultEdit->appendPlainText(output); - finish(); -} - -void MaemoConfigTestDialog::testPorts() -{ - if (m_config->freePorts().hasMore()) - m_portsGatherer->start(m_testProcessRunner->connection(), m_config); - else - finish(); -} - -void MaemoConfigTestDialog::finish() -{ - if (m_ui->errorLabel->text().isEmpty()) { - QPalette palette = m_ui->errorLabel->palette(); - palette.setColor(m_ui->errorLabel->foregroundRole(), - QColor(QLatin1String("blue"))); - m_ui->errorLabel->setPalette(palette); - m_ui->errorLabel->setText(tr("Device configuration okay.")); - } - stopConfigTest(); -} - -void MaemoConfigTestDialog::stopConfigTest() -{ - if (m_testProcessRunner) { - disconnect(m_testProcessRunner.data(), 0, this, 0); - m_testProcessRunner = SshRemoteProcessRunner::Ptr(); - } - m_deviceTestOutput.clear(); - m_closeButton->setText(tr("Close")); -} - -void MaemoConfigTestDialog::processSshOutput(const QByteArray &output) -{ - m_deviceTestOutput.append(QString::fromUtf8(output)); -} - -QString MaemoConfigTestDialog::parseTestOutput() -{ - m_qtVersionOk = false; - - QString output; - const QRegExp unamePattern(QLatin1String("Linux (\\S+)\\s(\\S+)")); - int index = unamePattern.indexIn(m_deviceTestOutput); - if (index == -1) { - output = tr("Device configuration test failed: Unexpected output:\n%1") - .arg(m_deviceTestOutput); - return output; - } - - output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2)); - output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1))); - - QString patternString; - switch (MaemoGlobal::packagingSystem(m_config->osVersion())) { - case MaemoGlobal::Rpm: - patternString = QLatin1String("(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))"); - break; - case MaemoGlobal::Dpkg: - patternString = QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+"); - break; - default: - m_qtVersionOk = true; - return output; - } - - const QRegExp packagePattern(patternString); - index = packagePattern.indexIn(m_deviceTestOutput); - if (index == -1) { - output.append(tr("No Qt packages installed.")); - return output; - } - - output.append(tr("List of installed Qt packages:") + QLatin1Char('\n')); - do { - output.append(QLatin1Char('\t') + packagePattern.cap(1) + QLatin1Char(' ') - + packagePattern.cap(2) + QLatin1Char('\n')); - index = packagePattern.indexIn(m_deviceTestOutput, index - + packagePattern.cap(0).length()); - if (!m_qtVersionOk && QT_VERSION_CHECK(packagePattern.cap(3).toInt(), - packagePattern.cap(4).toInt(), packagePattern.cap(5).toInt()) >= 0x040602) { - m_qtVersionOk = true; - } - } while (index != -1); - return output; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.h deleted file mode 100644 index 45fca1750c..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.h +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOCONFIGTESTDIALOG_H -#define MAEMOCONFIGTESTDIALOG_H - -#include <QtCore/QSharedPointer> -#include <QtGui/QDialog> - -QT_BEGIN_NAMESPACE -class QPushButton; -class Ui_MaemoConfigTestDialog; -QT_END_NAMESPACE - -namespace Utils { - class SshRemoteProcessRunner; -} // namespace Utils - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeviceConfig; -class MaemoUsedPortsGatherer; - -/** - * A dialog that runs a test of a device configuration. - */ -class MaemoConfigTestDialog : public QDialog -{ - Q_OBJECT -public: - explicit MaemoConfigTestDialog(const QSharedPointer<const MaemoDeviceConfig> &config, - QWidget *parent = 0); - ~MaemoConfigTestDialog(); - -private slots: - void stopConfigTest(); - void processSshOutput(const QByteArray &output); - void handleConnectionError(); - void handleTestProcessFinished(int exitStatus); - void handlePortListReady(); - void handlePortListFailure(const QString &errMsg); - -private: - void startConfigTest(); - QString parseTestOutput(); - void handleGeneralTestResult(int exitStatus); - void handleMadDeveloperTestResult(int exitStatus); - void testPorts(); - void finish(); - - Ui_MaemoConfigTestDialog *m_ui; - QPushButton *m_closeButton; - - const QSharedPointer<const MaemoDeviceConfig> m_config; - QSharedPointer<Utils::SshRemoteProcessRunner> m_testProcessRunner; - QString m_deviceTestOutput; - bool m_qtVersionOk; - MaemoUsedPortsGatherer *const m_portsGatherer; - - enum DeviceTest { GeneralTest, MadDeveloperTest }; - DeviceTest m_currentTest; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOCONFIGTESTDIALOG_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.ui deleted file mode 100644 index 9afda1b87f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.ui +++ /dev/null @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoConfigTestDialog</class> - <widget class="QDialog" name="MaemoConfigTestDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>684</width> - <height>544</height> - </rect> - </property> - <property name="windowTitle"> - <string>Device Configuration Test</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPlainTextEdit" name="testResultEdit"> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="errorLabel"> - <property name="palette"> - <palette> - <active> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - </active> - <inactive> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - </inactive> - <disabled> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>120</red> - <green>120</green> - <blue>120</blue> - </color> - </brush> - </colorrole> - </disabled> - </palette> - </property> - <property name="text"> - <string/> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Close</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>MaemoConfigTestDialog</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>MaemoConfigTestDialog</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/qt4projectmanager/qt-maemo/maemoconstants.h b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h deleted file mode 100644 index 3e582f8b5e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOCONSTANTS_H -#define MAEMOCONSTANTS_H - -#include <QtCore/QLatin1String> - -namespace Qt4ProjectManager { -namespace Internal { - -#define PREFIX "Qt4ProjectManager.MaemoRunConfiguration" - -#ifdef Q_OS_WIN32 -#define EXEC_SUFFIX ".exe" -#else -#define EXEC_SUFFIX "" -#endif - -static const QLatin1String MAEMO_RC_ID(PREFIX); -static const QLatin1String MAEMO_RC_ID_PREFIX(PREFIX "."); - -static const QLatin1String ArgumentsKey(PREFIX ".Arguments"); -static const QLatin1String DeviceIdKey(PREFIX ".DeviceId"); -static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts"); -static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles"); -static const QLatin1String LastDeployedRemotePathsKey(PREFIX ".LastDeployedRemotePaths"); -static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes"); -static const QLatin1String ProFileKey(PREFIX ".ProFile"); -static const QLatin1String ExportedLocalDirsKey(PREFIX ".ExportedLocalDirs"); -static const QLatin1String RemoteMountPointsKey(PREFIX ".RemoteMountPoints"); -static const QLatin1String BaseEnvironmentBaseKey(PREFIX ".BaseEnvironmentBase"); -static const QLatin1String UserEnvironmentChangesKey(PREFIX ".UserEnvironmentChanges"); -static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb"); - -} // namespace Internal - -namespace Constants { -const char * const MAEMO_SETTINGS_CATEGORY = "X.Maemo"; -const char * const MAEMO_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Qt4ProjectManager", "Maemo"); -const char * const MAEMO_SETTINGS_CATEGORY_ICON = ":/projectexplorer/images/MaemoDevice.png"; -} - -} // namespace Qt4ProjectManager - -#endif // MAEMOCONSTANTS_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp deleted file mode 100644 index 79efdf9858..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodebugsupport.h" - -#include "maemodeployables.h" -#include "maemoglobal.h" -#include "maemosshrunner.h" -#include "maemousedportsgatherer.h" -#include "qt4maemotarget.h" - -#include <debugger/debuggerplugin.h> -#include <debugger/debuggerstartparameters.h> -#include <debugger/debuggerrunner.h> -#include <debugger/debuggerengine.h> -#include <projectexplorer/abi.h> -#include <projectexplorer/toolchain.h> - -#include <QtCore/QDir> -#include <QtCore/QFileInfo> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Utils; -using namespace Debugger; -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runConfig) -{ - DebuggerStartParameters params; - const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); - - const MaemoRunConfiguration::DebuggingType debuggingType - = runConfig->debuggingType(); - if (debuggingType != MaemoRunConfiguration::DebugCppOnly) { - params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host; - params.qmlServerPort = -1; - } - if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) { - params.processArgs = runConfig->arguments(); - if (runConfig->activeQt4BuildConfiguration()->qtVersion()) - params.sysRoot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot(); - params.toolChainAbi = runConfig->abi(); - if (runConfig->useRemoteGdb()) { - params.startMode = StartRemoteGdb; - params.executable = runConfig->remoteExecutableFilePath(); - params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->deviceConfig()->osVersion(), - runConfig->deviceConfig()->sshParameters().userName, - runConfig->remoteExecutableFilePath()) - + MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges()) - + QLatin1String(" /usr/bin/gdb"); - params.connParams = devConf->sshParameters(); - params.localMountDir = runConfig->localDirToMountForRemoteGdb(); - params.remoteMountPoint - = runConfig->remoteProjectSourcesMountPoint(); - const QString execDirAbs - = QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path()); - const QString execDirRel - = QDir(params.localMountDir).relativeFilePath(execDirAbs); - params.remoteSourcesDir = QString(params.remoteMountPoint - + QLatin1Char('/') + execDirRel).toUtf8(); - } else { - params.startMode = AttachToRemote; - params.executable = runConfig->localExecutableFilePath(); - params.debuggerCommand = runConfig->gdbCmd(); - params.remoteChannel - = devConf->sshParameters().host + QLatin1String(":-1"); - params.useServerStartScript = true; - - // TODO: This functionality should be inside the debugger. - const ProjectExplorer::Abi &abi = runConfig->target() - ->activeBuildConfiguration()->toolChain()->targetAbi(); - params.remoteArchitecture = abi.toString(); - params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture - ? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu"); - } - } else { - params.startMode = AttachToRemote; - } - params.displayName = runConfig->displayName(); - - DebuggerRunControl * const runControl = - DebuggerPlugin::createDebugger(params, runConfig); - bool useGdb = params.startMode == StartRemoteGdb - && debuggingType != MaemoRunConfiguration::DebugQmlOnly; - MaemoDebugSupport *debugSupport = - new MaemoDebugSupport(runConfig, runControl->engine(), useGdb); - connect(runControl, SIGNAL(finished()), - debugSupport, SLOT(handleDebuggingFinished())); - return runControl; -} - -MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig, - DebuggerEngine *engine, bool useGdb) - : QObject(engine), m_engine(engine), m_runConfig(runConfig), - m_deviceConfig(m_runConfig->deviceConfig()), - m_runner(new MaemoSshRunner(this, runConfig, true)), - m_debuggingType(runConfig->debuggingType()), - m_userEnvChanges(runConfig->userEnvironmentChanges()), - m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1), - m_useGdb(useGdb) -{ - connect(m_engine, SIGNAL(requestRemoteSetup()), this, - SLOT(handleAdapterSetupRequested())); -} - -MaemoDebugSupport::~MaemoDebugSupport() -{ - setState(Inactive); -} - -void MaemoDebugSupport::showMessage(const QString &msg, int channel) -{ - if (m_engine) - m_engine->showMessage(msg, channel); -} - -void MaemoDebugSupport::handleAdapterSetupRequested() -{ - ASSERT_STATE(Inactive); - - setState(StartingRunner); - showMessage(tr("Preparing remote side ...\n"), AppStuff); - disconnect(m_runner, 0, this, 0); - connect(m_runner, SIGNAL(error(QString)), this, - SLOT(handleSshError(QString))); - connect(m_runner, SIGNAL(readyForExecution()), this, - SLOT(startExecution())); - connect(m_runner, SIGNAL(reportProgress(QString)), this, - SLOT(handleProgressReport(QString))); - m_runner->start(); -} - -void MaemoDebugSupport::handleSshError(const QString &error) -{ - if (m_state == Debugging) { - showMessage(error, AppError); - if (m_engine) - m_engine->notifyInferiorIll(); - } else if (m_state != Inactive) { - handleAdapterSetupFailed(error); - } -} - -void MaemoDebugSupport::startExecution() -{ - if (m_state == Inactive) - return; - - ASSERT_STATE(StartingRunner); - - if (!useGdb() && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { - if (!setPort(m_gdbServerPort)) - return; - } - if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { - if (!setPort(m_qmlPort)) - return; - } - - if (useGdb()) { - handleAdapterSetupDone(); - return; - } - - setState(StartingRemoteProcess); - m_gdbserverOutput.clear(); - connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this, - SLOT(handleRemoteErrorOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, - SLOT(handleRemoteOutput(QByteArray))); - if (m_debuggingType == MaemoRunConfiguration::DebugQmlOnly) { - connect(m_runner, SIGNAL(remoteProcessStarted()), - SLOT(handleRemoteProcessStarted())); - } - const QString &remoteExe = m_runner->remoteExecutable(); - const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(m_deviceConfig->osVersion(), - m_deviceConfig->sshParameters().userName, remoteExe); - const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges); - QString args = m_runner->arguments(); - if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { - args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) - .arg(m_qmlPort); - } - - const QString remoteCommandLine = m_debuggingType == MaemoRunConfiguration::DebugQmlOnly - ? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env) - .arg(remoteExe).arg(args) - : QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5") - .arg(cmdPrefix).arg(env).arg(m_gdbServerPort) - .arg(remoteExe).arg(args); - connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), - SLOT(handleRemoteProcessFinished(qint64))); - m_runner->startExecution(remoteCommandLine.toUtf8()); -} - -void MaemoDebugSupport::handleRemoteProcessFinished(qint64 exitCode) -{ - if (!m_engine || m_state == Inactive || exitCode == 0) - return; - - if (m_state == Debugging) { - if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) - m_engine->notifyInferiorIll(); - } else { - const QString errorMsg = m_debuggingType == MaemoRunConfiguration::DebugQmlOnly - ? tr("Remote application failed with exit code %1.").arg(exitCode) - : tr("The gdbserver process closed unexpectedly."); - m_engine->handleRemoteSetupFailed(errorMsg); - } -} - -void MaemoDebugSupport::handleDebuggingFinished() -{ - setState(Inactive); -} - -void MaemoDebugSupport::handleRemoteOutput(const QByteArray &output) -{ - ASSERT_STATE(QList<State>() << Inactive << Debugging); - showMessage(QString::fromUtf8(output), AppOutput); -} - -void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output) -{ - ASSERT_STATE(QList<State>() << Inactive << StartingRemoteProcess << Debugging); - - if (!m_engine) - return; - - showMessage(QString::fromUtf8(output), AppOutput); - if (m_state == StartingRemoteProcess - && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { - m_gdbserverOutput += output; - if (m_gdbserverOutput.contains("Listening on port")) { - handleAdapterSetupDone(); - m_gdbserverOutput.clear(); - } - } -} - -void MaemoDebugSupport::handleProgressReport(const QString &progressOutput) -{ - showMessage(progressOutput + QLatin1Char('\n'), AppStuff); -} - -void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error) -{ - setState(Inactive); - m_engine->handleRemoteSetupFailed(tr("Initial setup failed: %1").arg(error)); -} - -void MaemoDebugSupport::handleAdapterSetupDone() -{ - setState(Debugging); - m_engine->handleRemoteSetupDone(m_gdbServerPort, m_qmlPort); -} - -void MaemoDebugSupport::handleRemoteProcessStarted() -{ - Q_ASSERT(m_debuggingType == MaemoRunConfiguration::DebugQmlOnly); - ASSERT_STATE(StartingRemoteProcess); - handleAdapterSetupDone(); -} - -void MaemoDebugSupport::setState(State newState) -{ - if (m_state == newState) - return; - m_state = newState; - if (m_state == Inactive) - m_runner->stop(); -} - -bool MaemoDebugSupport::useGdb() const -{ - return m_useGdb; -} - -bool MaemoDebugSupport::setPort(int &port) -{ - port = m_runner->usedPortsGatherer()->getNextFreePort(m_runner->freePorts()); - if (port == -1) { - handleAdapterSetupFailed(tr("Not enough free ports on device for debugging.")); - return false; - } - return true; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h deleted file mode 100644 index ac441179ee..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEBUGSUPPORT_H -#define MAEMODEBUGSUPPORT_H - -#include "maemorunconfiguration.h" - -#include <utils/environment.h> - -#include <QtCore/QObject> -#include <QtCore/QPointer> -#include <QtCore/QSharedPointer> - -namespace Debugger { -class DebuggerEngine; -} -namespace ProjectExplorer { class RunControl; } - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeviceConfig; -class MaemoRunConfiguration; -class MaemoSshRunner; - -class MaemoDebugSupport : public QObject -{ - Q_OBJECT -public: - static ProjectExplorer::RunControl *createDebugRunControl(MaemoRunConfiguration *runConfig); - - MaemoDebugSupport(MaemoRunConfiguration *runConfig, - Debugger::DebuggerEngine *engine, bool useGdb); - ~MaemoDebugSupport(); - -private slots: - void handleAdapterSetupRequested(); - void handleSshError(const QString &error); - void startExecution(); - void handleDebuggingFinished(); - void handleRemoteOutput(const QByteArray &output); - void handleRemoteErrorOutput(const QByteArray &output); - void handleProgressReport(const QString &progressOutput); - void handleRemoteProcessStarted(); - void handleRemoteProcessFinished(qint64 exitCode); - -private: - enum State { - Inactive, StartingRunner, StartingRemoteProcess, Debugging - }; - - void handleAdapterSetupFailed(const QString &error); - void handleAdapterSetupDone(); - bool useGdb() const; - void setState(State newState); - bool setPort(int &port); - void showMessage(const QString &msg, int channel); - - const QPointer<Debugger::DebuggerEngine> m_engine; - const QPointer<MaemoRunConfiguration> m_runConfig; - const QSharedPointer<const MaemoDeviceConfig> m_deviceConfig; - MaemoSshRunner * const m_runner; - const MaemoRunConfiguration::DebuggingType m_debuggingType; - const QList<Utils::EnvironmentItem> m_userEnvChanges; - - QByteArray m_gdbserverOutput; - State m_state; - int m_gdbServerPort; - int m_qmlPort; - bool m_useGdb; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEBUGSUPPORT_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h deleted file mode 100644 index 2c9a35d1e4..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYABLE_H -#define MAEMODEPLOYABLE_H - -#include <QtCore/QHash> -#include <QtCore/QString> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeployable -{ -public: - MaemoDeployable() {} - - MaemoDeployable(const QString &localFilePath, const QString &remoteDir) - : localFilePath(localFilePath), remoteDir(remoteDir) {} - - bool operator==(const MaemoDeployable &other) const - { - return localFilePath == other.localFilePath - && remoteDir == other.remoteDir; - } - - QString localFilePath; - QString remoteDir; -}; - -inline uint qHash(const MaemoDeployable &d) -{ - return qHash(qMakePair(d.localFilePath, d.remoteDir)); -} - -} // namespace Qt4ProjectManager -} // namespace Internal - -#endif // MAEMODEPLOYABLE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp deleted file mode 100644 index e262b63043..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeployablelistmodel.h" - -#include "maemoglobal.h" - -#include <coreplugin/icore.h> -#include <coreplugin/filemanager.h> -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/session.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4target.h> -#include <qtsupport/baseqtversion.h> - -#include <utils/qtcassert.h> -#include <utils/fileutils.h> - -#include <QtCore/QFile> -#include <QtCore/QFileInfo> -#include <QtGui/QBrush> -#include <QtGui/QImageReader> -#include <QtGui/QMainWindow> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, - ProFileUpdateSetting updateSetting, QObject *parent) - : QAbstractTableModel(parent), - m_projectType(proFileNode->projectType()), - m_proFilePath(proFileNode->path()), - m_projectName(proFileNode->displayName()), - m_targetInfo(proFileNode->targetInformation()), - m_installsList(proFileNode->installsList()), - m_projectVersion(proFileNode->projectVersion()), - m_config(proFileNode->variableValue(ConfigVar)), - m_modified(false), - m_proFileUpdateSetting(updateSetting), - m_hasTargetPath(false) -{ - buildModel(); -} - -MaemoDeployableListModel::~MaemoDeployableListModel() {} - -bool MaemoDeployableListModel::buildModel() -{ - m_deployables.clear(); - - m_hasTargetPath = !m_installsList.targetPath.isEmpty(); - if (!m_hasTargetPath && m_proFileUpdateSetting == UpdateProFile) { - const QString remoteDirSuffix - = QLatin1String(m_projectType == LibraryTemplate - ? "/lib" : "/bin"); - const QString remoteDir = QLatin1String("target.path = ") - + installPrefix() + remoteDirSuffix; - const QStringList deployInfo = QStringList() << remoteDir - << QLatin1String("INSTALLS += target"); - return addLinesToProFile(deployInfo); - } else if (m_projectType == ApplicationTemplate) { - m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), - m_installsList.targetPath)); - } else if (m_projectType == LibraryTemplate) { - foreach (const QString &filePath, localLibraryFilePaths()) { - m_deployables.prepend(MaemoDeployable(filePath, - m_installsList.targetPath)); - } - } - foreach (const InstallsItem &elem, m_installsList.items) { - foreach (const QString &file, elem.files) - m_deployables << MaemoDeployable(file, elem.path); - } - - m_modified = true; - return true; -} - -MaemoDeployable MaemoDeployableListModel::deployableAt(int row) const -{ - Q_ASSERT(row >= 0 && row < rowCount()); - return m_deployables.at(row); -} - -int MaemoDeployableListModel::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : m_deployables.count(); -} - -int MaemoDeployableListModel::columnCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : 2; -} - -QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount()) - return QVariant(); - - if (isEditable(index)) { - if (role == Qt::DisplayRole) - return tr("<no target path set>"); - if (role == Qt::ForegroundRole) { - QBrush brush; - brush.setColor("red"); - return brush; - } - } - - const MaemoDeployable &d = deployableAt(index.row()); - if (index.column() == 0 && role == Qt::DisplayRole) - return QDir::toNativeSeparators(d.localFilePath); - if (role == Qt::DisplayRole || role == Qt::EditRole) - return d.remoteDir; - return QVariant(); -} - -Qt::ItemFlags MaemoDeployableListModel::flags(const QModelIndex &index) const -{ - Qt::ItemFlags parentFlags = QAbstractTableModel::flags(index); - if (isEditable(index)) - return parentFlags | Qt::ItemIsEditable; - return parentFlags; -} - -bool MaemoDeployableListModel::setData(const QModelIndex &index, - const QVariant &value, int role) -{ - if (!isEditable(index) || role != Qt::EditRole) - return false; - const QString &remoteDir = value.toString(); - if (!addLinesToProFile(QStringList() - << QString::fromLocal8Bit("target.path = %1").arg(remoteDir) - << QLatin1String("INSTALLS += target"))) - return false; - m_deployables.first().remoteDir = remoteDir; - emit dataChanged(index, index); - return true; -} - -QVariant MaemoDeployableListModel::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 MaemoDeployableListModel::localExecutableFilePath() const -{ - if (!m_targetInfo.valid || m_projectType != ApplicationTemplate) - return QString(); - return QDir::cleanPath(m_targetInfo.workingDir + '/' + m_targetInfo.target); -} - -QStringList MaemoDeployableListModel::localLibraryFilePaths() const -{ - if (!m_targetInfo.valid || m_projectType != LibraryTemplate) - return QStringList(); - QString basePath = m_targetInfo.workingDir + QLatin1String("/lib"); - const bool isStatic = m_config.contains(QLatin1String("static")) - || m_config.contains(QLatin1String("staticlib")); - basePath += m_targetInfo.target + QLatin1String(isStatic ? ".a" : ".so"); - basePath = QDir::cleanPath(basePath); - const QChar dot(QLatin1Char('.')); - const QString filePathMajor = basePath + dot - + QString::number(m_projectVersion.major); - const QString filePathMinor = filePathMajor + dot - + QString::number(m_projectVersion.minor); - const QString filePathPatch = filePathMinor + dot - + QString::number(m_projectVersion.patch); - return QStringList() << filePathPatch << filePathMinor << filePathMajor - << basePath; -} - -QString MaemoDeployableListModel::remoteExecutableFilePath() const -{ - return m_hasTargetPath && m_projectType == ApplicationTemplate - ? deployableAt(0).remoteDir + '/' - + QFileInfo(localExecutableFilePath()).fileName() - : QString(); -} - -QString MaemoDeployableListModel::projectDir() const -{ - return QFileInfo(m_proFilePath).dir().path(); -} - -void MaemoDeployableListModel::setProFileUpdateSetting(ProFileUpdateSetting updateSetting) -{ - m_proFileUpdateSetting = updateSetting; - if (updateSetting == UpdateProFile) - buildModel(); -} - -bool MaemoDeployableListModel::isEditable(const QModelIndex &index) const -{ - return m_projectType != AuxTemplate - && index.row() == 0 && index.column() == 1 - && m_deployables.first().remoteDir.isEmpty(); -} - -QString MaemoDeployableListModel::localDesktopFilePath() const -{ - if (m_projectType == LibraryTemplate) - return QString(); - foreach (const MaemoDeployable &d, m_deployables) { - if (QFileInfo(d.localFilePath).fileName() == m_projectName + QLatin1String(".desktop")) - return d.localFilePath; - } - return QString(); -} - -bool MaemoDeployableListModel::addDesktopFile() -{ - if (!canAddDesktopFile()) - return true; - const QString desktopFilePath = QFileInfo(m_proFilePath).path() - + QLatin1Char('/') + m_projectName + QLatin1String(".desktop"); - if (!QFile::exists(desktopFilePath)) { - const QByteArray desktopTemplate("[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(QString::fromLatin1(desktopTemplate) - .arg(m_projectName, remoteExecutableFilePath()).toUtf8()); - if (!saver.finalize(Core::ICore::instance()->mainWindow())) - return false; - } - - const QtSupport::BaseQtVersion * const version = qtVersion(); - QTC_ASSERT(version, return false); - QString remoteDir = QLatin1String("/usr/share/applications"); - if (MaemoGlobal::version(version->qmakeCommand()) == MaemoDeviceConfig::Maemo5) - remoteDir += QLatin1String("/hildon"); - const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop"); - const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir; - const QLatin1String installsLine("INSTALLS += desktopfile"); - if (!addLinesToProFile(QStringList() << filesLine << pathLine - << installsLine)) - return false; - - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_deployables << MaemoDeployable(desktopFilePath, remoteDir); - endInsertRows(); - return true; -} - -bool MaemoDeployableListModel::addIcon(const QString &fileName) -{ - if (!canAddIcon()) - return true; - - const QString filesLine = QLatin1String("icon.files = ") + fileName; - const QString pathLine = QLatin1String("icon.path = ") + remoteIconDir(); - const QLatin1String installsLine("INSTALLS += icon"); - if (!addLinesToProFile(QStringList() << filesLine << pathLine - << installsLine)) - return false; - - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - const QString filePath = QFileInfo(m_proFilePath).path() - + QLatin1Char('/') + fileName; - m_deployables << MaemoDeployable(filePath, remoteIconDir()); - endInsertRows(); - return true; -} - -QString MaemoDeployableListModel::remoteIconFilePath() const -{ - if (m_projectType == LibraryTemplate) - return QString(); - const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats(); - foreach (const MaemoDeployable &d, m_deployables) { - const QByteArray extension - = QFileInfo(d.localFilePath).suffix().toLocal8Bit(); - if (d.remoteDir.startsWith(remoteIconDir()) - && imageTypes.contains(extension)) - return d.remoteDir + QLatin1Char('/') - + QFileInfo(d.localFilePath).fileName(); - } - return QString(); -} - -bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines) -{ - Core::FileChangeBlocker update(m_proFilePath); - - const QLatin1String separator("\n "); - const QString proFileString = QString(QLatin1Char('\n') + proFileScope() - + QLatin1String(" {") + separator + lines.join(separator) - + QLatin1String("\n}\n")); - Utils::FileSaver saver(m_proFilePath, QIODevice::Append); - saver.write(proFileString.toLocal8Bit()); - return saver.finalize(Core::ICore::instance()->mainWindow()); -} - -const QtSupport::BaseQtVersion *MaemoDeployableListModel::qtVersion() const -{ - const ProjectExplorer::Project *const activeProject - = ProjectExplorer::ProjectExplorerPlugin::instance()->session()->startupProject(); - QTC_ASSERT(activeProject, return 0); - const Qt4BaseTarget *const activeTarget - = qobject_cast<Qt4BaseTarget *>(activeProject->activeTarget()); - QTC_ASSERT(activeTarget, return 0); - const Qt4BuildConfiguration *const bc - = activeTarget->activeBuildConfiguration(); - QTC_ASSERT(bc, return 0); - return bc->qtVersion(); -} - -QString MaemoDeployableListModel::proFileScope() const -{ - const QtSupport::BaseQtVersion *const qv = qtVersion(); - QTC_ASSERT(qv, return QString()); - return QLatin1String(MaemoGlobal::version(qv->qmakeCommand()) == MaemoDeviceConfig::Maemo5 - ? "maemo5" : "unix:!symbian:!maemo5"); -} - -QString MaemoDeployableListModel::installPrefix() const -{ - return QLatin1String("/opt/") + m_projectName; -} - -QString MaemoDeployableListModel::remoteIconDir() const -{ - const QtSupport::BaseQtVersion *const qv = qtVersion(); - QTC_ASSERT(qv, return QString()); - return QString::fromLocal8Bit("/usr/share/icons/hicolor/%1x%1/apps") - .arg(MaemoGlobal::applicationIconSize(MaemoGlobal::version(qv->qmakeCommand()))); -} - -} // namespace Qt4ProjectManager -} // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h deleted file mode 100644 index e858e110b6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPACKAGECONTENTS_H -#define MAEMOPACKAGECONTENTS_H - -#include "maemodeployable.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QtCore/QAbstractTableModel> -#include <QtCore/QHash> -#include <QtCore/QList> -#include <QtCore/QScopedPointer> -#include <QtCore/QString> - -namespace QtSupport { -class BaseQtVersion; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeployableListModel : public QAbstractTableModel -{ - Q_OBJECT -public: - enum ProFileUpdateSetting { - UpdateProFile, DontUpdateProFile, AskToUpdateProFile - }; - - MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, - ProFileUpdateSetting updateSetting, QObject *parent); - ~MaemoDeployableListModel(); - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - - MaemoDeployable deployableAt(int row) const; - bool isModified() const { return m_modified; } - void setUnModified() { m_modified = false; } - const QtSupport::BaseQtVersion *qtVersion() const; - QString localExecutableFilePath() const; - QString remoteExecutableFilePath() const; - QString projectName() const { return m_projectName; } - QString projectDir() const; - QString proFilePath() const { return m_proFilePath; } - Qt4ProjectType projectType() const { return m_projectType; } - bool isApplicationProject() const { return m_projectType == ApplicationTemplate; } - QString applicationName() const { return m_targetInfo.target; } - bool hasTargetPath() const { return m_hasTargetPath; } - bool canAddDesktopFile() const { return isApplicationProject() && !hasDesktopFile(); } - QString localDesktopFilePath() const; - bool hasDesktopFile() const { return !localDesktopFilePath().isEmpty(); } - bool addDesktopFile(); - bool canAddIcon() const { return isApplicationProject() && remoteIconFilePath().isEmpty(); } - bool addIcon(const QString &fileName); - QString remoteIconFilePath() const; - ProFileUpdateSetting proFileUpdateSetting() const { - return m_proFileUpdateSetting; - } - void setProFileUpdateSetting(ProFileUpdateSetting updateSetting); - -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; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole); - - bool isEditable(const QModelIndex &index) const; - bool buildModel(); - bool addLinesToProFile(const QStringList &lines); - QString proFileScope() const; - QString installPrefix() const; - QString remoteIconDir() const; - QStringList localLibraryFilePaths() const; - - const Qt4ProjectType m_projectType; - const QString m_proFilePath; - const QString m_projectName; - const TargetInformation m_targetInfo; - const InstallsList m_installsList; - const ProjectVersion m_projectVersion; - const QStringList m_config; - QList<MaemoDeployable> m_deployables; - mutable bool m_modified; - ProFileUpdateSetting m_proFileUpdateSetting; - bool m_hasTargetPath; -}; - -} // namespace Qt4ProjectManager -} // namespace Internal - -#endif // MAEMOPACKAGECONTENTS_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp deleted file mode 100644 index 15ebbbfafe..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeployables.h" - -#include "maemoprofilesupdatedialog.h" - -#include <proparser/profileevaluator.h> -#include <projectexplorer/buildstep.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4target.h> - -#include <QtCore/QTimer> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeployables::MaemoDeployables(const Qt4BaseTarget *target) - : m_target(target), m_updateTimer(new QTimer(this)) -{ - QTimer::singleShot(0, this, SLOT(init())); - m_updateTimer->setInterval(1500); - m_updateTimer->setSingleShot(true); - connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(createModels())); -} - -MaemoDeployables::~MaemoDeployables() {} - -void MaemoDeployables::init() -{ - Qt4Project * const pro = m_target->qt4Project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - m_updateTimer, SLOT(start())); - - // TODO do we want to disable the view - - createModels(); -} - -void MaemoDeployables::createModels() -{ - if (m_target->project()->activeTarget() != m_target) - return; - const Qt4ProFileNode *const rootNode - = m_target->qt4Project()->rootProjectNode(); - if (!rootNode) // Happens on project creation by wizard. - return; - m_updateTimer->stop(); - disconnect(m_target->qt4Project(), - SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - m_updateTimer, SLOT(start())); - beginResetModel(); - qDeleteAll(m_listModels); - m_listModels.clear(); - createModels(rootNode); - QList<MaemoDeployableListModel *> modelsWithoutTargetPath; - foreach (MaemoDeployableListModel *const model, m_listModels) { - if (!model->hasTargetPath()) { - if (model->proFileUpdateSetting() == MaemoDeployableListModel::AskToUpdateProFile) - modelsWithoutTargetPath << model; - } - } - - if (!modelsWithoutTargetPath.isEmpty()) { - MaemoProFilesUpdateDialog dialog(modelsWithoutTargetPath); - dialog.exec(); - const QList<MaemoProFilesUpdateDialog::UpdateSetting> &settings - = dialog.getUpdateSettings(); - foreach (const MaemoProFilesUpdateDialog::UpdateSetting &setting, settings) { - const MaemoDeployableListModel::ProFileUpdateSetting updateSetting - = setting.second - ? MaemoDeployableListModel::UpdateProFile - : MaemoDeployableListModel::DontUpdateProFile; - m_updateSettings.insert(setting.first->proFilePath(), - updateSetting); - setting.first->setProFileUpdateSetting(updateSetting); - } - } - - endResetModel(); - connect(m_target->qt4Project(), - SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - m_updateTimer, SLOT(start())); -} - -void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode) -{ - switch (proFileNode->projectType()) { - case ApplicationTemplate: - case LibraryTemplate: - case AuxTemplate: { - MaemoDeployableListModel::ProFileUpdateSetting updateSetting; - if (proFileNode->projectType() == AuxTemplate) { - updateSetting = MaemoDeployableListModel::DontUpdateProFile; - } else { - UpdateSettingsMap::ConstIterator it - = m_updateSettings.find(proFileNode->path()); - updateSetting = it != m_updateSettings.end() - ? it.value() : MaemoDeployableListModel::AskToUpdateProFile; - } - MaemoDeployableListModel *const newModel - = new MaemoDeployableListModel(proFileNode, updateSetting, this); - m_listModels << newModel; - break; - } - case SubDirsTemplate: { - const QList<ProjectExplorer::ProjectNode *> &subProjects - = proFileNode->subProjectNodes(); - foreach (const ProjectExplorer::ProjectNode *subProject, subProjects) { - const Qt4ProFileNode * const qt4SubProject - = qobject_cast<const Qt4ProFileNode *>(subProject); - if (qt4SubProject && !qt4SubProject->path() - .endsWith(QLatin1String(".pri"))) - createModels(qt4SubProject); - } - } - default: - break; - } -} - -void MaemoDeployables::setUnmodified() -{ - foreach (MaemoDeployableListModel *model, m_listModels) - model->setUnModified(); -} - -bool MaemoDeployables::isModified() const -{ - foreach (const MaemoDeployableListModel *model, m_listModels) { - if (model->isModified()) - return true; - } - return false; -} - -int MaemoDeployables::deployableCount() const -{ - int count = 0; - foreach (const MaemoDeployableListModel *model, m_listModels) - count += model->rowCount(); - return count; -} - -MaemoDeployable MaemoDeployables::deployableAt(int i) const -{ - foreach (const MaemoDeployableListModel *model, m_listModels) { - Q_ASSERT(i >= 0); - if (i < model->rowCount()) - return model->deployableAt(i); - i -= model->rowCount(); - } - - Q_ASSERT(!"Invalid deployable number"); - return MaemoDeployable(QString(), QString()); -} - -QString MaemoDeployables::remoteExecutableFilePath(const QString &localExecutableFilePath) const -{ - foreach (const MaemoDeployableListModel *model, m_listModels) { - if (model->localExecutableFilePath() == localExecutableFilePath) - return model->remoteExecutableFilePath(); - } - return QString(); -} - -int MaemoDeployables::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : modelCount(); -} - -QVariant MaemoDeployables::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() - || index.column() != 0) - return QVariant(); - const MaemoDeployableListModel *const model = m_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(); -} - -} // namespace Qt4ProjectManager -} // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h deleted file mode 100644 index a21745bb91..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYABLES_H -#define MAEMODEPLOYABLES_H - -#include "maemodeployable.h" -#include "maemodeployablelistmodel.h" - -#include <QtCore/QAbstractListModel> -#include <QtCore/QHash> -#include <QtCore/QList> - -QT_FORWARD_DECLARE_CLASS(QTimer) - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -class Qt4BaseTarget; - -namespace Internal { -class Qt4ProFileNode; - -class MaemoDeployables : public QAbstractListModel -{ - Q_OBJECT -public: - MaemoDeployables(const Qt4BaseTarget *target); - ~MaemoDeployables(); - void setUnmodified(); - bool isModified() const; - int deployableCount() const; - MaemoDeployable deployableAt(int i) const; - QString remoteExecutableFilePath(const QString &localExecutableFilePath) const; - int modelCount() const { return m_listModels.count(); } - MaemoDeployableListModel *modelAt(int i) const { return m_listModels.at(i); } - -private: - typedef QHash<QString, MaemoDeployableListModel::ProFileUpdateSetting> UpdateSettingsMap; - - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - - Q_SLOT void createModels(); - Q_SLOT void init(); - void createModels(const Qt4ProFileNode *proFileNode); - - QList<MaemoDeployableListModel *> m_listModels; - UpdateSettingsMap m_updateSettings; - const Qt4BaseTarget * const m_target; - QTimer *const m_updateTimer; -}; - -} // namespace Qt4ProjectManager -} // namespace Internal - -#endif // MAEMODEPLOYABLES_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.cpp deleted file mode 100644 index eddcc68bf0..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeploybymountstep.h" - -#include "maemodeploymentmounter.h" -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemopackageinstaller.h" -#include "maemoremotecopyfacility.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <utils/ssh/sshconnection.h> - -#include <QtCore/QFileInfo> - -#define ASSERT_BASE_STATE(state) ASSERT_STATE_GENERIC(BaseState, state, baseState()) -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(ExtendedState, state, m_extendedState) - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -AbstractMaemoDeployByMountStep::AbstractMaemoDeployByMountStep(BuildStepList *parent, - const QString &id) - : AbstractMaemoDeployStep(parent, id) -{ - ctor(); -} - -AbstractMaemoDeployByMountStep::AbstractMaemoDeployByMountStep(BuildStepList *parent, - AbstractMaemoDeployByMountStep *other) - : AbstractMaemoDeployStep(parent, other) -{ - ctor(); -} - -void AbstractMaemoDeployByMountStep::ctor() -{ - m_extendedState= Inactive; - - m_mounter = new MaemoDeploymentMounter(this); - connect(m_mounter, SIGNAL(setupDone()), this, SLOT(handleMounted())); - connect(m_mounter, SIGNAL(tearDownDone()), this, SLOT(handleUnmounted())); - connect(m_mounter, SIGNAL(error(QString)), this, - SLOT(handleMountError(QString))); - connect(m_mounter, SIGNAL(reportProgress(QString)), this, - SLOT(handleProgressReport(QString))); - connect(m_mounter, SIGNAL(debugOutput(QString)), this, - SLOT(handleMountDebugOutput(QString))); -} - -void AbstractMaemoDeployByMountStep::stopInternal() -{ - ASSERT_STATE(QList<ExtendedState>() << Mounting << Installing - << Unmounting); - - switch (m_extendedState) { - case Installing: - cancelInstallation(); - unmount(); - break; - case Mounting: - case Unmounting: - break; // Nothing to do here. - case Inactive: - setDeploymentFinished(); - break; - default: - qFatal("Missing switch case in %s.", Q_FUNC_INFO); - } -} - -void AbstractMaemoDeployByMountStep::startInternal() -{ - Q_ASSERT(m_extendedState == Inactive); - - mount(); -} - -void AbstractMaemoDeployByMountStep::handleMounted() -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - ASSERT_STATE(Mounting); - - if (baseState() == StopRequested) { - unmount(); - return; - } - - writeOutput(tr("Installing package to device...")); - m_extendedState = Installing; - deploy(); -} - -void AbstractMaemoDeployByMountStep::handleUnmounted() -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - ASSERT_STATE(Unmounting); - - setFinished(); -} - -void AbstractMaemoDeployByMountStep::handleMountError(const QString &errorMsg) -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - ASSERT_STATE(QList<ExtendedState>() << Mounting << Unmounting); - - raiseError(errorMsg); - setFinished(); -} - -void AbstractMaemoDeployByMountStep::handleMountDebugOutput(const QString &output) -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - - if (m_extendedState != Inactive) - writeOutput(output, ErrorOutput, DontAppendNewline); -} - -void AbstractMaemoDeployByMountStep::mount() -{ - m_extendedState = Mounting; - m_mounter->setupMounts(connection(), helper().cachedDeviceConfig(), - mountSpecifications(), qt4BuildConfiguration()); -} - -QString AbstractMaemoDeployByMountStep::deployMountPoint() const -{ - return MaemoGlobal::homeDirOnDevice(connection()->connectionParameters().userName) - + QLatin1String("/deployMountPoint_") + target()->project()->displayName(); -} - -void AbstractMaemoDeployByMountStep::handleInstallationFinished(const QString &errorMsg) -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - - if (baseState() == StopRequested) { - unmount(); - return; - } - - if (m_extendedState != Installing) - return; - - if (errorMsg.isEmpty()) - handleInstallationSuccess(); - else - raiseError(errorMsg); - unmount(); -} - -void AbstractMaemoDeployByMountStep::unmount() -{ - m_extendedState = Unmounting; - m_mounter->tearDownMounts(); -} - -void AbstractMaemoDeployByMountStep::setFinished() -{ - m_extendedState = Inactive; - setDeploymentFinished(); -} - - -MaemoMountAndInstallDeployStep::MaemoMountAndInstallDeployStep(BuildStepList *bc) - : AbstractMaemoDeployByMountStep(bc, Id) -{ - ctor(); -} - -MaemoMountAndInstallDeployStep::MaemoMountAndInstallDeployStep(BuildStepList *bc, - MaemoMountAndInstallDeployStep *other) - : AbstractMaemoDeployByMountStep(bc, other) -{ - ctor(); -} - -void MaemoMountAndInstallDeployStep::ctor() -{ - //: MaemoMountAndInstallDeployStep default display name - setDefaultDisplayName(DisplayName); - - if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(target())) - m_installer = new MaemoDebianPackageInstaller(this); - else - m_installer = new MaemoRpmPackageInstaller(this); - connect(m_installer, SIGNAL(stdoutData(QString)), - SLOT(handleRemoteStdout(QString))); - connect(m_installer, SIGNAL(stderrData(QString)), - SLOT(handleRemoteStderr(QString))); - connect(m_installer, SIGNAL(finished(QString)), - SLOT(handleInstallationFinished(QString))); -} - -const AbstractMaemoPackageCreationStep *MaemoMountAndInstallDeployStep::packagingStep() const -{ - return MaemoGlobal::earlierBuildStep<MaemoDebianPackageCreationStep>(maemoDeployConfig(), this); -} - -bool MaemoMountAndInstallDeployStep::isDeploymentPossibleInternal(QString &whyNot) const -{ - if (!packagingStep()) { - whyNot = tr("No matching packaging step found."); - return false; - } - return true; -} - -bool MaemoMountAndInstallDeployStep::isDeploymentNeeded(const QString &hostName) const -{ - const AbstractMaemoPackageCreationStep * const pStep = packagingStep(); - Q_ASSERT(pStep); - const MaemoDeployable d(pStep->packageFilePath(), QString()); - return currentlyNeedsDeployment(hostName, d); -} - -QList<MaemoMountSpecification> MaemoMountAndInstallDeployStep::mountSpecifications() const -{ - const QString localDir - = QFileInfo(packagingStep()->packageFilePath()).absolutePath(); - return QList<MaemoMountSpecification>() - << MaemoMountSpecification(localDir, deployMountPoint()); -} - -void MaemoMountAndInstallDeployStep::deploy() -{ - const QString remoteFilePath = deployMountPoint() + QLatin1Char('/') - + QFileInfo(packagingStep()->packageFilePath()).fileName(); - m_installer->installPackage(connection(), helper().cachedDeviceConfig(), - remoteFilePath, false); -} - -void MaemoMountAndInstallDeployStep::cancelInstallation() -{ - m_installer->cancelInstallation(); -} - -void MaemoMountAndInstallDeployStep::handleInstallationSuccess() -{ - setDeployed(connection()->connectionParameters().host, - MaemoDeployable(packagingStep()->packageFilePath(), QString())); - writeOutput(tr("Package installed.")); -} - -const QString MaemoMountAndInstallDeployStep::Id("MaemoMountAndInstallDeployStep"); -const QString MaemoMountAndInstallDeployStep::DisplayName - = tr("Deploy package via UTFS mount"); - - -MaemoMountAndCopyDeployStep::MaemoMountAndCopyDeployStep(BuildStepList *bc) - : AbstractMaemoDeployByMountStep(bc, Id) -{ - ctor(); -} - -MaemoMountAndCopyDeployStep::MaemoMountAndCopyDeployStep(BuildStepList *bc, - MaemoMountAndCopyDeployStep *other) - : AbstractMaemoDeployByMountStep(bc, other) -{ - ctor(); -} - -void MaemoMountAndCopyDeployStep::ctor() -{ - //: MaemoMountAndCopyDeployStep default display name - setDefaultDisplayName(DisplayName); - - m_copyFacility = new MaemoRemoteCopyFacility(this); - connect(m_copyFacility, SIGNAL(stdoutData(QString)), - SLOT(handleRemoteStdout(QString))); - connect(m_copyFacility, SIGNAL(stderrData(QString)), - SLOT(handleRemoteStderr(QString))); - connect(m_copyFacility, SIGNAL(progress(QString)), - SLOT(handleProgressReport(QString))); - connect(m_copyFacility, SIGNAL(fileCopied(MaemoDeployable)), - SLOT(handleFileCopied(MaemoDeployable))); - connect(m_copyFacility, SIGNAL(finished(QString)), - SLOT(handleInstallationFinished(QString))); -} - -bool MaemoMountAndCopyDeployStep::isDeploymentPossibleInternal(QString &) const -{ - return true; -} - -bool MaemoMountAndCopyDeployStep::isDeploymentNeeded(const QString &hostName) const -{ - m_filesToCopy.clear(); - const QSharedPointer<MaemoDeployables> deployables - = maemoDeployConfig()->deployables(); - const int deployableCount = deployables->deployableCount(); - for (int i = 0; i < deployableCount; ++i) { - const MaemoDeployable &d = deployables->deployableAt(i); - if (currentlyNeedsDeployment(hostName, d) - || QFileInfo(d.localFilePath).isDir()) { - m_filesToCopy << d; - } - } - return !m_filesToCopy.isEmpty(); -} - -QList<MaemoMountSpecification> MaemoMountAndCopyDeployStep::mountSpecifications() const -{ - QList<MaemoMountSpecification> mountSpecs; -#ifdef Q_OS_WIN - 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 char driveLetter = localDir.at(0).toLower().toLatin1(); - if (driveLetter < 'a' || driveLetter > 'z') { - qWarning("Weird: drive letter is '%c'.", driveLetter); - continue; - } - - const int index = driveLetter - 'a'; - if (drivesToMount[index]) - continue; - - const QString mountPoint = deployMountPoint() + QLatin1Char('/') - + QLatin1Char(driveLetter); - const MaemoMountSpecification mountSpec(localDir.left(3), mountPoint); - mountSpecs << mountSpec; - drivesToMount[index] = true; - } -#else - mountSpecs << MaemoMountSpecification(QLatin1String("/"), - deployMountPoint()); -#endif - return mountSpecs; -} - -void MaemoMountAndCopyDeployStep::deploy() -{ - m_copyFacility->copyFiles(connection(), helper().cachedDeviceConfig(), - m_filesToCopy, deployMountPoint()); -} - -void MaemoMountAndCopyDeployStep::handleFileCopied(const MaemoDeployable &deployable) -{ - setDeployed(connection()->connectionParameters().host, deployable); -} - -void MaemoMountAndCopyDeployStep::cancelInstallation() -{ - m_copyFacility->cancel(); -} - -void MaemoMountAndCopyDeployStep::handleInstallationSuccess() -{ - writeOutput(tr("All files copied.")); -} - -const QString MaemoMountAndCopyDeployStep::Id("MaemoMountAndCopyDeployStep"); -const QString MaemoMountAndCopyDeployStep::DisplayName - = tr("Deploy files via UTFS mount"); - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.h deleted file mode 100644 index e9159474c3..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploybymountstep.h +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYBYMOUNTSTEP_H -#define MAEMODEPLOYBYMOUNTSTEP_H - -#include "abstractmaemodeploystep.h" - -#include "maemodeployable.h" -#include "maemomountspecification.h" - -namespace Qt4ProjectManager { -namespace Internal { -class AbstractMaemoPackageInstaller; -class MaemoDeploymentMounter; -class MaemoRemoteCopyFacility; - -class AbstractMaemoDeployByMountStep : public AbstractMaemoDeployStep -{ - Q_OBJECT -public: - -private slots: - void handleMounted(); - void handleUnmounted(); - void handleMountError(const QString &errorMsg); - void handleMountDebugOutput(const QString &output); - void handleInstallationFinished(const QString &errorMsg); - -protected: - AbstractMaemoDeployByMountStep(ProjectExplorer::BuildStepList *bc, - const QString &id); - AbstractMaemoDeployByMountStep(ProjectExplorer::BuildStepList *bc, - AbstractMaemoDeployByMountStep *other); - - QString deployMountPoint() const; - -private: - enum ExtendedState { Inactive, Mounting, Installing, Unmounting }; - - virtual void startInternal(); - virtual void stopInternal(); - - virtual QList<MaemoMountSpecification> mountSpecifications() const=0; - virtual void deploy()=0; - virtual void cancelInstallation()=0; - virtual void handleInstallationSuccess()=0; - - void ctor(); - void mount(); - void unmount(); - void setFinished(); - - MaemoDeploymentMounter *m_mounter; - ExtendedState m_extendedState; -}; - - -class MaemoMountAndInstallDeployStep : public AbstractMaemoDeployByMountStep -{ - Q_OBJECT -public: - MaemoMountAndInstallDeployStep(ProjectExplorer::BuildStepList *bc); - MaemoMountAndInstallDeployStep(ProjectExplorer::BuildStepList *bc, - MaemoMountAndInstallDeployStep *other); - - static const QString Id; - static const QString DisplayName; -private: - virtual const AbstractMaemoPackageCreationStep *packagingStep() const; - virtual bool isDeploymentPossibleInternal(QString &whynot) const; - virtual bool isDeploymentNeeded(const QString &hostName) const; - - virtual QList<MaemoMountSpecification> mountSpecifications() const; - virtual void deploy(); - virtual void cancelInstallation(); - virtual void handleInstallationSuccess(); - - void ctor(); - - AbstractMaemoPackageInstaller *m_installer; -}; - - -class MaemoMountAndCopyDeployStep : public AbstractMaemoDeployByMountStep -{ - Q_OBJECT -public: - MaemoMountAndCopyDeployStep(ProjectExplorer::BuildStepList *bc); - MaemoMountAndCopyDeployStep(ProjectExplorer::BuildStepList *bc, - MaemoMountAndCopyDeployStep *other); - - static const QString Id; - static const QString DisplayName; -private: - virtual const AbstractMaemoPackageCreationStep *packagingStep() const { return 0; } - virtual bool isDeploymentPossibleInternal(QString &whynot) const; - virtual bool isDeploymentNeeded(const QString &hostName) const; - - virtual QList<MaemoMountSpecification> mountSpecifications() const; - virtual void deploy(); - virtual void cancelInstallation(); - virtual void handleInstallationSuccess(); - - void ctor(); - Q_SLOT void handleFileCopied(const MaemoDeployable &deployable); - - MaemoRemoteCopyFacility *m_copyFacility; - mutable QList<MaemoDeployable> m_filesToCopy; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYBYMOUNTSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.cpp deleted file mode 100644 index ed80e2206d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeployconfigurationwidget.h" -#include "ui_maemodeployconfigurationwidget.h" - -#include "maemodeployablelistmodel.h" -#include "maemodeployables.h" -#include "qt4maemodeployconfiguration.h" - -#include <utils/qtcassert.h> - -#include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> -#include <QtGui/QPixmap> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeployConfigurationWidget::MaemoDeployConfigurationWidget(QWidget *parent) - : DeployConfigurationWidget(parent), - ui(new Ui::MaemoDeployConfigurationWidget) -{ - ui->setupUi(this); -} - -MaemoDeployConfigurationWidget::~MaemoDeployConfigurationWidget() -{ - delete ui; -} - -void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc) -{ - m_deployConfig = qobject_cast<Qt4MaemoDeployConfiguration *>(dc); - Q_ASSERT(m_deployConfig); - - ui->modelComboBox->setModel(m_deployConfig->deployables().data()); - connect(m_deployConfig->deployables().data(), SIGNAL(modelAboutToBeReset()), - SLOT(handleModelListToBeReset())); - - // Queued connection because of race condition with combo box's reaction - // to modelReset(). - connect(m_deployConfig->deployables().data(), SIGNAL(modelReset()), - SLOT(handleModelListReset()), Qt::QueuedConnection); - - connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)), - SLOT(setModel(int))); - connect(ui->addDesktopFileButton, SIGNAL(clicked()), - SLOT(addDesktopFile())); - connect(ui->addIconButton, SIGNAL(clicked()), SLOT(addIcon())); - handleModelListReset(); -} - -void MaemoDeployConfigurationWidget::handleModelListToBeReset() -{ - ui->tableView->reset(); // Otherwise we'll crash if the user is currently editing. - ui->tableView->setModel(0); - ui->addDesktopFileButton->setEnabled(false); - ui->addIconButton->setEnabled(false); -} - -void MaemoDeployConfigurationWidget::handleModelListReset() -{ - QTC_ASSERT(m_deployConfig->deployables()->modelCount() == ui->modelComboBox->count(), return); - if (m_deployConfig->deployables()->modelCount() > 0) { - if (ui->modelComboBox->currentIndex() == -1) - ui->modelComboBox->setCurrentIndex(0); - else - setModel(ui->modelComboBox->currentIndex()); - } -} - -void MaemoDeployConfigurationWidget::setModel(int row) -{ - bool canAddDesktopFile = false; - bool canAddIconFile = false; - if (row != -1) { - MaemoDeployableListModel * const model - = m_deployConfig->deployables()->modelAt(row); - ui->tableView->setModel(model); - ui->tableView->resizeRowsToContents(); - canAddDesktopFile = model->canAddDesktopFile(); - canAddIconFile = model->canAddIcon(); - } - ui->addDesktopFileButton->setEnabled(canAddDesktopFile); - ui->addIconButton->setEnabled(canAddIconFile); -} - -void MaemoDeployConfigurationWidget::addDesktopFile() -{ - const int modelRow = ui->modelComboBox->currentIndex(); - if (modelRow == -1) - return; - MaemoDeployableListModel *const model - = m_deployConfig->deployables()->modelAt(modelRow); - model->addDesktopFile(); - ui->addDesktopFileButton->setEnabled(model->canAddDesktopFile()); - ui->tableView->resizeRowsToContents(); -} - -void MaemoDeployConfigurationWidget::addIcon() -{ - const int modelRow = ui->modelComboBox->currentIndex(); - if (modelRow == -1) - return; - - MaemoDeployableListModel *const model - = m_deployConfig->deployables()->modelAt(modelRow); - const int iconDim = MaemoGlobal::applicationIconSize(MaemoGlobal::version(model->qtVersion()->qmakeCommand())); - const QString origFilePath = QFileDialog::getOpenFileName(this, - tr("Choose Icon (will be scaled to %1x%1 pixels, if necessary)").arg(iconDim), - model->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 = model->projectName() + QLatin1Char('.') - + QFileInfo(origFilePath).suffix(); - const QString newFilePath = model->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; - } - - model->addIcon(newFileName); - ui->addIconButton->setEnabled(model->canAddIcon()); - ui->tableView->resizeRowsToContents(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.h deleted file mode 100644 index 59d42254c8..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYCONFIGURATIONWIDGET_H -#define MAEMODEPLOYCONFIGURATIONWIDGET_H - -#include <projectexplorer/deployconfiguration.h> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoDeployConfigurationWidget; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class Qt4MaemoDeployConfiguration; - -class MaemoDeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget -{ - Q_OBJECT - -public: - explicit MaemoDeployConfigurationWidget(QWidget *parent = 0); - ~MaemoDeployConfigurationWidget(); - - void init(ProjectExplorer::DeployConfiguration *dc); - -private: - Q_SLOT void handleModelListToBeReset(); - Q_SLOT void handleModelListReset(); - Q_SLOT void setModel(int row); - Q_SLOT void addDesktopFile(); - Q_SLOT void addIcon(); - - Ui::MaemoDeployConfigurationWidget *ui; - Qt4MaemoDeployConfiguration * m_deployConfig; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYCONFIGURATIONWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.ui deleted file mode 100644 index 92d3d03819..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployconfigurationwidget.ui +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeployConfigurationWidget</class> - <widget class="QWidget" name="MaemoDeployConfigurationWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>584</width> - <height>315</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <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><b>Files to install for subproject:</b></string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="modelComboBox"> - <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> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QTableView" name="tableView"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>150</height> - </size> - </property> - <property name="toolTip"> - <string>Edit the project file to add or remove entries.</string> - </property> - <property name="textElideMode"> - <enum>Qt::ElideMiddle</enum> - </property> - <property name="horizontalScrollMode"> - <enum>QAbstractItemView::ScrollPerPixel</enum> - </property> - <property name="showGrid"> - <bool>false</bool> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>400</number> - </attribute> - <attribute name="horizontalHeaderHighlightSections"> - <bool>false</bool> - </attribute> - <attribute name="horizontalHeaderMinimumSectionSize"> - <number>100</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <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="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.cpp deleted file mode 100644 index 89f1f4e342..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeploymentmounter.h" - -#include "maemoglobal.h" -#include "maemoremotemounter.h" -#include "maemousedportsgatherer.h" - -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <utils/ssh/sshconnection.h> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeploymentMounter::MaemoDeploymentMounter(QObject *parent) - : QObject(parent), - m_state(Inactive), - m_mounter(new MaemoRemoteMounter(this)), - m_portsGatherer(new MaemoUsedPortsGatherer(this)) -{ - connect(m_mounter, SIGNAL(error(QString)), SLOT(handleMountError(QString))); - connect(m_mounter, SIGNAL(mounted()), SLOT(handleMounted())); - connect(m_mounter, SIGNAL(unmounted()), SLOT(handleUnmounted())); - connect(m_mounter, SIGNAL(reportProgress(QString)), - SIGNAL(reportProgress(QString))); - connect(m_mounter, SIGNAL(debugOutput(QString)), - SIGNAL(debugOutput(QString))); - - connect(m_portsGatherer, SIGNAL(error(QString)), - SLOT(handlePortsGathererError(QString))); - connect(m_portsGatherer, SIGNAL(portListReady()), - SLOT(handlePortListReady())); -} - -void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, - const QList<MaemoMountSpecification> &mountSpecs, - const Qt4BuildConfiguration *bc) -{ - ASSERT_STATE(Inactive); - - m_mountSpecs = mountSpecs; - m_connection = connection; - m_devConf = devConf; - m_mounter->setConnection(m_connection, m_devConf); - m_buildConfig = bc; - connect(m_connection.data(), SIGNAL(error(Utils::SshError)), - SLOT(handleConnectionError())); - setState(UnmountingOldDirs); - unmount(); -} - -void MaemoDeploymentMounter::tearDownMounts() -{ - ASSERT_STATE(Mounted); - - setState(UnmountingCurrentMounts); - unmount(); -} - -void MaemoDeploymentMounter::setupMounter() -{ - ASSERT_STATE(UnmountingOldDirs); - setState(UnmountingCurrentDirs); - - m_mounter->resetMountSpecifications(); - m_mounter->setBuildConfiguration(m_buildConfig); - foreach (const MaemoMountSpecification &mountSpec, m_mountSpecs) - m_mounter->addMountSpecification(mountSpec, true); - unmount(); -} - -void MaemoDeploymentMounter::unmount() -{ - ASSERT_STATE(QList<State>() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts); - - if (m_mounter->hasValidMountSpecifications()) - m_mounter->unmount(); - else - handleUnmounted(); -} - -void MaemoDeploymentMounter::handleMounted() -{ - ASSERT_STATE(QList<State>() << Mounting << Inactive); - - if (m_state == Inactive) - return; - - setState(Mounted); - emit setupDone(); -} - -void MaemoDeploymentMounter::handleUnmounted() -{ - ASSERT_STATE(QList<State>() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts << Inactive); - - switch (m_state) { - case UnmountingOldDirs: - setupMounter(); - break; - case UnmountingCurrentDirs: - setState(GatheringPorts); - m_portsGatherer->start(m_connection, m_devConf); - break; - case UnmountingCurrentMounts: - setState(Inactive); - emit tearDownDone(); - break; - case Inactive: - default: - break; - } -} - -void MaemoDeploymentMounter::handlePortsGathererError(const QString &errorMsg) -{ - ASSERT_STATE(QList<State>() << GatheringPorts << Inactive); - if (m_state == Inactive) - return; - - setState(Inactive); - m_mounter->resetMountSpecifications(); - emit error(errorMsg); -} - -void MaemoDeploymentMounter::handlePortListReady() -{ - ASSERT_STATE(QList<State>() << GatheringPorts << Inactive); - if (m_state == Inactive) - return; - - setState(Mounting); - m_freePorts = MaemoGlobal::freePorts(m_devConf, m_buildConfig->qtVersion()); - m_mounter->mount(&m_freePorts, m_portsGatherer); -} - -void MaemoDeploymentMounter::handleMountError(const QString &errorMsg) -{ - ASSERT_STATE(QList<State>() << UnmountingOldDirs << UnmountingCurrentDirs - << UnmountingCurrentMounts << Mounting << Mounted << Inactive); - if (m_state == Inactive) - return; - - setState(Inactive); - emit error(errorMsg); -} - -void MaemoDeploymentMounter::handleConnectionError() -{ - if (m_state == Inactive) - return; - - setState(Inactive); - emit error(tr("Connection failed: %1").arg(m_connection->errorString())); -} - -void MaemoDeploymentMounter::setState(State newState) -{ - if (m_state == newState) - return; - if (newState == Inactive && m_connection) { - disconnect(m_connection.data(), 0, this, 0); - m_connection.clear(); - } - m_state = newState; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.h deleted file mode 100644 index 7ee41129c6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploymentmounter.h +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYMENTMOUNTER_H -#define MAEMODEPLOYMENTMOUNTER_H - -#include "maemodeviceconfigurations.h" -#include "maemomountspecification.h" - -#include <QtCore/QList> -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> - -namespace Utils { class SshConnection; } - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -namespace Internal { -class MaemoDeviceConfig; -class MaemoRemoteMounter; -class MaemoUsedPortsGatherer; - -class MaemoDeploymentMounter : public QObject -{ - Q_OBJECT -public: - explicit MaemoDeploymentMounter(QObject *parent = 0); - - // Connection must be in connected state. - void setupMounts(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &devConf, - const QList<MaemoMountSpecification> &mountSpecs, - const Qt4BuildConfiguration *bc); - void tearDownMounts(); - -signals: - void debugOutput(const QString &output); - void setupDone(); - void tearDownDone(); - void error(const QString &error); - void reportProgress(const QString &message); - -private slots: - void handleMounted(); - void handleUnmounted(); - void handleMountError(const QString &errorMsg); - void handlePortsGathererError(const QString &errorMsg); - void handlePortListReady(); - void handleConnectionError(); - -private: - enum State { - Inactive, UnmountingOldDirs, UnmountingCurrentDirs, GatheringPorts, - Mounting, Mounted, UnmountingCurrentMounts - }; - - void unmount(); - void setupMounter(); - void setState(State newState); - - State m_state; - QSharedPointer<Utils::SshConnection> m_connection; - QSharedPointer<const MaemoDeviceConfig> m_devConf; - MaemoRemoteMounter * const m_mounter; - MaemoUsedPortsGatherer * const m_portsGatherer; - MaemoPortList m_freePorts; - QList<MaemoMountSpecification> m_mountSpecs; - const Qt4BuildConfiguration *m_buildConfig; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYMENTMOUNTER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h deleted file mode 100644 index 9bccdc39bc..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystep.h +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYSTEP_H -#define MAEMODEPLOYSTEP_H - -#include "maemodeployable.h" -#include "maemodeployables.h" -#include "maemodeviceconfigurations.h" - -#include <projectexplorer/buildstep.h> - -#include <QtCore/QHash> -#include <QtCore/QList> -#include <QtCore/QMap> -#include <QtCore/QPair> -#include <QtCore/QSharedPointer> - -QT_BEGIN_NAMESPACE -class QEventLoop; -QT_END_NAMESPACE - -namespace Utils { -class SshConnection; -} - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -namespace Internal { -class AbstractMaemoPackageCreationStep; -class AbstractMaemoPackageInstaller; -class MaemoDeploymentMounter; -class MaemoDeviceConfig; -class MaemoPackageUploader; -class MaemoRemoteCopyFacility; -class MaemoToolChain; -class Qt4MaemoDeployConfiguration; - -class MaemoDeployStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT - friend class MaemoDeployStepFactory; -public: - MaemoDeployStep(ProjectExplorer::BuildStepList *bc); - - virtual ~MaemoDeployStep(); - QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; } - const AbstractQt4MaemoTarget *maemotarget() const; - void setDeviceConfig(int i); - bool currentlyNeedsDeployment(const QString &host, - const MaemoDeployable &deployable) const; - void setDeployed(const QString &host, const MaemoDeployable &deployable); - MaemoPortList freePorts() const; - Qt4MaemoDeployConfiguration *maemoDeployConfig() const; - - Q_INVOKABLE void stop(); - -signals: - void done(); - void error(); - void deviceConfigChanged(); - -private slots: - void start(); - void handleConnected(); - void handleConnectionFailure(); - void handleMounted(); - void handleUnmounted(); - void handleMountError(const QString &errorMsg); - void handleMountDebugOutput(const QString &output); - void handleProgressReport(const QString &progressMsg); - void handleUploadFinished(const QString &errorMsg); - void handleInstallationFinished(const QString &errorMsg); - void handleFileCopied(const MaemoDeployable &deployable); - void handleCopyingFinished(const QString &errorMsg); - void handleRemoteStdout(const QString &output); - void handleRemoteStderr(const QString &output); - void handleDeviceConfigurationsUpdated(); - -private: - enum State { - Inactive, StopRequested, Connecting, Uploading, Mounting, Installing, - Copying, Unmounting - }; - - MaemoDeployStep(ProjectExplorer::BuildStepList *bc, - MaemoDeployStep *other); - virtual bool init(); - virtual void run(QFutureInterface<bool> &fi); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - virtual QVariantMap toMap() const; - virtual bool fromMap(const QVariantMap &map); - - void ctor(); - void raiseError(const QString &error); - void writeOutput(const QString &text, OutputFormat = MessageOutput); - void addDeployTimesToMap(QVariantMap &map) const; - void getDeployTimesFromMap(const QVariantMap &map); - const AbstractMaemoPackageCreationStep *packagingStep() const; - QString deployMountPoint() const; - const MaemoToolChain *toolChain() const; - QString uploadDir() const; - void connectToDevice(); - void upload(); - void runPackageInstaller(const QString &packageFilePath); - void mount(); - void setDeploymentFinished(); - void setState(State newState); - void setDeviceConfig(MaemoDeviceConfig::Id internalId); - const Qt4BuildConfiguration *qt4BuildConfiguration() const; - MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConfig) const; - - static const QLatin1String Id; - - QSharedPointer<Utils::SshConnection> m_connection; - QList<MaemoDeployable> m_filesToCopy; - MaemoDeploymentMounter *m_mounter; - MaemoPackageUploader *m_uploader; - AbstractMaemoPackageInstaller *m_installer; - MaemoRemoteCopyFacility *m_copyFacility; - - bool m_needsInstall; - typedef QPair<MaemoDeployable, QString> DeployablePerHost; - QHash<DeployablePerHost, QDateTime> m_lastDeployed; - QSharedPointer<const MaemoDeviceConfig> m_deviceConfig; - QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig; - State m_state; - bool m_hasError; -}; - -class MaemoDeployEventHandler : public QObject -{ - Q_OBJECT -public: - MaemoDeployEventHandler(MaemoDeployStep *deployStep, - QFutureInterface<bool> &future); - -private slots: - void handleDeployingDone(); - void handleDeployingFailed(); - void checkForCanceled(); - -private: - MaemoDeployStep * const m_deployStep; - const QFutureInterface<bool> m_future; - QEventLoop * const m_eventLoop; - bool m_error; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.cpp deleted file mode 100644 index cb1356673a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeploystepfactory.h" - -#include "maemodeploybymountstep.h" -#include "maemodirectdeviceuploadstep.h" -#include "maemoglobal.h" -#include "maemoinstalltosysrootstep.h" -#include "maemouploadandinstalldeploystep.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> - -#include <QtCore/QCoreApplication> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QString OldMaemoDeployStepId(QLatin1String("Qt4ProjectManager.MaemoDeployStep")); -} // anonymous namespace - -MaemoDeployStepFactory::MaemoDeployStepFactory(QObject *parent) - : IBuildStepFactory(parent) -{ -} - -QStringList MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const -{ - QStringList ids; - AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(parent->target()); - if (maemoTarget) - ids << MaemoMakeInstallToSysrootStep::Id; - else if (MaemoGlobal::hasLinuxQt(parent->target())) - ids << MaemoUploadAndInstallTarPackageStep::Id; - if (maemoTarget && !qobject_cast<Qt4HarmattanTarget *>(parent->target())) - ids << MaemoUploadAndInstallTarPackageStep::Id; - if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())) { - ids << MaemoInstallDebianPackageToSysrootStep::Id; - ids << MaemoUploadAndInstallDpkgPackageStep::Id; - } else if (qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target())) { - ids << MaemoInstallRpmPackageToSysrootStep::Id; - ids << MaemoUploadAndInstallRpmPackageStep::Id; - } - if (qobject_cast<Qt4Maemo5Target *>(parent->target())) { - ids << MaemoMountAndInstallDeployStep::Id - << MaemoMountAndCopyDeployStep::Id; - } - - return ids; -} - -QString MaemoDeployStepFactory::displayNameForId(const QString &id) const -{ - if (id == MaemoMountAndInstallDeployStep::Id) - return MaemoMountAndInstallDeployStep::DisplayName; - else if (id == MaemoMountAndCopyDeployStep::Id) - return MaemoMountAndCopyDeployStep::DisplayName; - else if (id == MaemoUploadAndInstallDpkgPackageStep::Id) - return MaemoUploadAndInstallDpkgPackageStep::DisplayName; - else if (id == MaemoUploadAndInstallRpmPackageStep::Id) - return MaemoUploadAndInstallRpmPackageStep::DisplayName; - else if (id == MaemoUploadAndInstallTarPackageStep::Id) - return MaemoUploadAndInstallTarPackageStep::DisplayName; - else if (id == MaemoInstallDebianPackageToSysrootStep::Id) - return MaemoInstallDebianPackageToSysrootStep::DisplayName; - else if (id == MaemoInstallRpmPackageToSysrootStep::Id) - return MaemoInstallRpmPackageToSysrootStep::DisplayName; - else if (id == MaemoCopyToSysrootStep::Id) - return MaemoCopyToSysrootStep::DisplayName; - else if (id == MaemoMakeInstallToSysrootStep::Id) - return MaemoMakeInstallToSysrootStep::DisplayName; - else if (id == MaemoDirectDeviceUploadStep::Id) - return MaemoDirectDeviceUploadStep::DisplayName; - return QString(); -} - -bool MaemoDeployStepFactory::canCreate(BuildStepList *parent, const QString &id) const -{ - return availableCreationIds(parent).contains(id) && !parent->contains(id); -} - -BuildStep *MaemoDeployStepFactory::create(BuildStepList *parent, const QString &id) -{ - const Target * const t = parent->target(); - - if (id == MaemoInstallDebianPackageToSysrootStep::Id) { - return new MaemoInstallDebianPackageToSysrootStep(parent); - } else if (id == MaemoInstallRpmPackageToSysrootStep::Id) { - return new MaemoInstallRpmPackageToSysrootStep(parent); - } else if (id == MaemoCopyToSysrootStep::Id) { - return new MaemoCopyToSysrootStep(parent); - } else if (id == MaemoMakeInstallToSysrootStep::Id) { - return new MaemoMakeInstallToSysrootStep(parent); - } else if (id == MaemoMountAndInstallDeployStep::Id - || (id == OldMaemoDeployStepId && qobject_cast< const Qt4Maemo5Target *>(t))) { - return new MaemoMountAndInstallDeployStep(parent); - } else if (id == MaemoMountAndCopyDeployStep::Id) { - return new MaemoMountAndCopyDeployStep(parent); - } else if (id == MaemoUploadAndInstallDpkgPackageStep::Id - || (id == OldMaemoDeployStepId && (qobject_cast<const Qt4HarmattanTarget *>(t)))) { - return new MaemoUploadAndInstallDpkgPackageStep(parent); - } else if (id == MaemoUploadAndInstallRpmPackageStep::Id - || (id == OldMaemoDeployStepId && (qobject_cast<const Qt4MeegoTarget *>(t)))) { - return new MaemoUploadAndInstallRpmPackageStep(parent); - } else if (id == MaemoUploadAndInstallTarPackageStep::Id) { - return new MaemoUploadAndInstallTarPackageStep(parent); - } else if (id == MaemoDirectDeviceUploadStep::Id) { - return new MaemoDirectDeviceUploadStep(parent); - } - - return 0; -} - -bool MaemoDeployStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const -{ - return canCreate(parent, idFromMap(map)) - || idFromMap(map) == OldMaemoDeployStepId; -} - -BuildStep *MaemoDeployStepFactory::restore(BuildStepList *parent, const QVariantMap &map) -{ - Q_ASSERT(canRestore(parent, map)); - BuildStep * const step = create(parent, idFromMap(map)); - if (!step->fromMap(map)) { - delete step; - return 0; - } - return step; -} - -bool MaemoDeployStepFactory::canClone(BuildStepList *parent, BuildStep *product) const -{ - return canCreate(parent, product->id()); -} - -BuildStep *MaemoDeployStepFactory::clone(BuildStepList *parent, BuildStep *product) -{ - Q_ASSERT(canClone(parent, product)); - if (product->id() == MaemoMountAndInstallDeployStep::Id) { - return new MaemoMountAndInstallDeployStep(parent, - qobject_cast<MaemoMountAndInstallDeployStep *>(product)); - } else if (product->id() == MaemoMountAndCopyDeployStep::Id) { - return new MaemoMountAndCopyDeployStep(parent, - qobject_cast<MaemoMountAndCopyDeployStep *>(product)); - } else if (product->id() == MaemoUploadAndInstallDpkgPackageStep::Id) { - return new MaemoUploadAndInstallDpkgPackageStep(parent, - qobject_cast<MaemoUploadAndInstallDpkgPackageStep*>(product)); - } else if (product->id() == MaemoUploadAndInstallRpmPackageStep::Id) { - return new MaemoUploadAndInstallRpmPackageStep(parent, - qobject_cast<MaemoUploadAndInstallRpmPackageStep*>(product)); - } else if (product->id() == MaemoUploadAndInstallTarPackageStep::Id) { - return new MaemoUploadAndInstallTarPackageStep(parent, - qobject_cast<MaemoUploadAndInstallTarPackageStep*>(product)); - } else if (product->id() == MaemoInstallDebianPackageToSysrootStep::Id) { - return new MaemoInstallDebianPackageToSysrootStep(parent, - qobject_cast<MaemoInstallDebianPackageToSysrootStep *>(product)); - } else if (product->id() == MaemoInstallRpmPackageToSysrootStep::Id) { - return new MaemoInstallRpmPackageToSysrootStep(parent, - qobject_cast<MaemoInstallRpmPackageToSysrootStep *>(product)); - } else if (product->id() == MaemoCopyToSysrootStep::Id) { - return new MaemoCopyToSysrootStep(parent, - qobject_cast<MaemoCopyToSysrootStep *>(product)); - } else if (product->id() == MaemoMakeInstallToSysrootStep::Id) { - return new MaemoMakeInstallToSysrootStep(parent, - qobject_cast<MaemoMakeInstallToSysrootStep *>(product)); - } else if (product->id() == MaemoDirectDeviceUploadStep::Id) { - return new MaemoDirectDeviceUploadStep(parent, - qobject_cast<MaemoDirectDeviceUploadStep *>(product)); - } - return 0; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.h deleted file mode 100644 index 9d17c36bc6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepfactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYSTEPFACTORY_H -#define MAEMODEPLOYSTEPFACTORY_H - -#include <projectexplorer/buildstep.h> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeployStepFactory : public ProjectExplorer::IBuildStepFactory -{ -public: - MaemoDeployStepFactory(QObject *parent); - - virtual QStringList availableCreationIds(ProjectExplorer::BuildStepList *parent) const; - virtual QString displayNameForId(const QString &id) const; - - virtual bool canCreate(ProjectExplorer::BuildStepList *parent, - const QString &id) const; - virtual ProjectExplorer::BuildStep * - create(ProjectExplorer::BuildStepList *parent, const QString &id); - - virtual bool canRestore(ProjectExplorer::BuildStepList *parent, - const QVariantMap &map) const; - virtual ProjectExplorer::BuildStep * - restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map); - - virtual bool canClone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product) const; - virtual ProjectExplorer::BuildStep * - clone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYSTEPFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp deleted file mode 100644 index 33aadb9f3d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeploystepwidget.h" -#include "ui_maemodeploystepwidget.h" - -#include "abstractmaemodeploystep.h" -#include "maemodeviceconfigurations.h" -#include "maemosettingspages.h" -#include "maemoglobal.h" -#include "maemomanager.h" -#include "maemopertargetdeviceconfigurationlistmodel.h" -#include "maemorunconfiguration.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <coreplugin/icore.h> -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/target.h> -#include <utils/qtcassert.h> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeployStepBaseWidget::MaemoDeployStepBaseWidget(AbstractLinuxDeviceDeployStep *step) : - ui(new Ui::MaemoDeployStepWidget), - m_step(step) -{ - ui->setupUi(this); - BuildStepList * const list = step->maemoDeployConfig()->stepList(); - connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(aboutToRemoveStep(int)), - SLOT(handleStepToBeRemoved(int))); -} - -MaemoDeployStepBaseWidget::~MaemoDeployStepBaseWidget() -{ - delete ui; -} - -void MaemoDeployStepBaseWidget::init() -{ - ui->deviceConfigComboBox->setModel(m_step->maemoDeployConfig()->deviceConfigModel().data()); - connect(&m_step->helper(), SIGNAL(deviceConfigChanged()), - SLOT(handleDeviceUpdate())); - handleDeviceUpdate(); - connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this, - SLOT(setCurrentDeviceConfig(int))); - connect(ui->manageDevConfsLabel, SIGNAL(linkActivated(QString)), - SLOT(showDeviceConfigurations())); -} - -void MaemoDeployStepBaseWidget::handleDeviceUpdate() -{ - const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig(); - const MaemoDeviceConfig::Id internalId - = MaemoDeviceConfigurations::instance()->internalId(devConf); - const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel() - ->indexForInternalId(internalId); - ui->deviceConfigComboBox->setCurrentIndex(newIndex); - emit updateSummary(); -} - -void MaemoDeployStepBaseWidget::handleStepToBeRemoved(int step) -{ - BuildStepList * const list = m_step->maemoDeployConfig()->stepList(); - const AbstractLinuxDeviceDeployStep * const alds - = dynamic_cast<AbstractLinuxDeviceDeployStep *>(list->steps().at(step)); - if (alds && alds == m_step) - disconnect(list, 0, this, 0); -} - -QString MaemoDeployStepBaseWidget::summaryText() const -{ - QString error; - if (!m_step->isDeploymentPossible(error)) { - return QLatin1String("<font color=\"red\">") - + tr("Cannot deploy: %1").arg(error) - + QLatin1String("</font>"); - } - return tr("<b>%1 using device</b>: %2").arg(dynamic_cast<BuildStep *>(m_step)->displayName(), - MaemoGlobal::deviceConfigurationName(m_step->helper().deviceConfig())); -} - -void MaemoDeployStepBaseWidget::setCurrentDeviceConfig(int index) -{ - disconnect(&m_step->helper(), SIGNAL(deviceConfigChanged()), this, - SLOT(handleDeviceUpdate())); - m_step->helper().setDeviceConfig(index); - connect(&m_step->helper(), SIGNAL(deviceConfigChanged()), - SLOT(handleDeviceUpdate())); - updateSummary(); -} - -void MaemoDeployStepBaseWidget::showDeviceConfigurations() -{ - MaemoDeviceConfigurationsSettingsPage *page - = MaemoManager::instance().deviceConfigurationsSettingsPage(); - Core::ICore::instance()->showOptionsDialog(page->category(), page->id()); -} - - -MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractMaemoDeployStep *step) - : m_baseWidget(step) -{ - connect(&m_baseWidget, SIGNAL(updateSummary()), SIGNAL(updateSummary())); - (new QVBoxLayout(this))->addWidget(&m_baseWidget); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h deleted file mode 100644 index 7d915b9995..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYSTEPWIDGET_H -#define MAEMODEPLOYSTEPWIDGET_H - -#include <projectexplorer/buildstep.h> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoDeployStepWidget; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class AbstractLinuxDeviceDeployStep; -class AbstractMaemoDeployStep; - -class MaemoDeployStepBaseWidget : public QWidget -{ - Q_OBJECT - -public: - MaemoDeployStepBaseWidget(AbstractLinuxDeviceDeployStep *step); - ~MaemoDeployStepBaseWidget(); - - void init(); - QString summaryText() const; - -signals: - void updateSummary(); - -private: - Q_SLOT void handleDeviceUpdate(); - Q_SLOT void setCurrentDeviceConfig(int index); - Q_SLOT void showDeviceConfigurations(); - Q_SLOT void handleStepToBeRemoved(int step); - - Ui::MaemoDeployStepWidget *ui; - AbstractLinuxDeviceDeployStep *const m_step; -}; - -class MaemoDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - MaemoDeployStepWidget(AbstractMaemoDeployStep *step); - -private: - virtual void init() { return m_baseWidget.init(); } - virtual QString summaryText() const { return m_baseWidget.summaryText(); } - virtual QString displayName() const { return QString(); } - - MaemoDeployStepBaseWidget m_baseWidget; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYSTEPWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui deleted file mode 100644 index a724ba6ad6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeployStepWidget</class> - <widget class="QWidget" name="MaemoDeployStepWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>597</width> - <height>74</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="deviceConfigLabel"> - <property name="text"> - <string>Device configuration:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="deviceConfigComboBox"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="manageDevConfsLabel"> - <property name="text"> - <string><a href="irrelevant">Manage device configurations</a></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> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp deleted file mode 100644 index 1468fd747a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.cpp +++ /dev/null @@ -1,690 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" - -#include <coreplugin/icore.h> - -#include <QtCore/QCoreApplication> -#include <QtCore/QSettings> -#include <QtCore/QStringBuilder> -#include <QtGui/QDesktopServices> - -#include <algorithm> -#include <cctype> - -typedef Utils::SshConnectionParameters::AuthenticationType AuthType; - -namespace Qt4ProjectManager { -namespace Internal { - -namespace { - const QLatin1String SettingsGroup("MaemoDeviceConfigs"); - const QLatin1String IdCounterKey("IdCounter"); - const QLatin1String ConfigListKey("ConfigList"); - const QLatin1String NameKey("Name"); - const QLatin1String OsVersionKey("OsVersion"); - const QLatin1String TypeKey("Type"); - const QLatin1String HostKey("Host"); - const QLatin1String SshPortKey("SshPort"); - const QLatin1String PortsSpecKey("FreePortsSpec"); - const QLatin1String UserNameKey("Uname"); - const QLatin1String AuthKey("Authentication"); - const QLatin1String KeyFileKey("KeyFile"); - const QLatin1String PasswordKey("Password"); - const QLatin1String TimeoutKey("Timeout"); - const QLatin1String IsDefaultKey("IsDefault"); - const QLatin1String InternalIdKey("InternalId"); - const QLatin1String DefaultKeyFilePathKey("DefaultKeyFile"); - - const int DefaultSshPortHW(22); - const int DefaultSshPortSim(6666); - const int DefaultGdbServerPortHW(10000); - const int DefaultGdbServerPortSim(13219); - const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthenticationByKey); - const int DefaultTimeout(30); - const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical); -} - -class DevConfNameMatcher -{ -public: - DevConfNameMatcher(const QString &name) : m_name(name) {} - bool operator()(const MaemoDeviceConfig::ConstPtr &devConfig) - { - return devConfig->name() == m_name; - } -private: - const QString m_name; -}; - -class PortsSpecParser -{ - struct ParseException { - ParseException(const char *error) : error(error) {} - const char * const error; - }; - -public: - PortsSpecParser(const QString &portsSpec) - : m_pos(0), m_portsSpec(portsSpec) { } - - /* - * Grammar: Spec -> [ ElemList ] - * ElemList -> Elem [ ',' ElemList ] - * Elem -> Port [ '-' Port ] - */ - MaemoPortList parse() - { - try { - if (!atEnd()) - parseElemList(); - } catch (ParseException &e) { - qWarning("Malformed ports specification: %s", e.error); - } - return m_portList; - } - -private: - void parseElemList() - { - if (atEnd()) - throw ParseException("Element list empty."); - parseElem(); - if (atEnd()) - return; - if (nextChar() != ',') { - throw ParseException("Element followed by something else " - "than a comma."); - } - ++m_pos; - parseElemList(); - } - - void parseElem() - { - const int startPort = parsePort(); - if (atEnd() || nextChar() != '-') { - m_portList.addPort(startPort); - return; - } - ++m_pos; - const int endPort = parsePort(); - if (endPort < startPort) - throw ParseException("Invalid range (end < start)."); - m_portList.addRange(startPort, endPort); - } - - int parsePort() - { - if (atEnd()) - throw ParseException("Empty port string."); - int port = 0; - do { - const char next = nextChar(); - if (!std::isdigit(next)) - break; - port = 10*port + next - '0'; - ++m_pos; - } while (!atEnd()); - if (port == 0 || port >= 2 << 16) - throw ParseException("Invalid port value."); - return port; - } - - bool atEnd() const { return m_pos == m_portsSpec.length(); } - char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); } - - MaemoPortList m_portList; - int m_pos; - const QString &m_portsSpec; -}; - - -void MaemoPortList::addPort(int port) { addRange(port, port); } - -void MaemoPortList::addRange(int startPort, int endPort) -{ - m_ranges << Range(startPort, endPort); -} - -bool MaemoPortList::hasMore() const { return !m_ranges.isEmpty(); } - -int MaemoPortList::count() const -{ - int n = 0; - foreach (const Range &r, m_ranges) - n += r.second - r.first + 1; - return n; -} - -int MaemoPortList::getNext() -{ - Q_ASSERT(!m_ranges.isEmpty()); - Range &firstRange = m_ranges.first(); - const int next = firstRange.first++; - if (firstRange.first > firstRange.second) - m_ranges.removeFirst(); - return next; -} - -QString MaemoPortList::toString() const -{ - QString stringRep; - foreach (const Range &range, m_ranges) { - stringRep += QString::number(range.first); - if (range.second != range.first) - stringRep += QLatin1Char('-') + QString::number(range.second); - stringRep += QLatin1Char(','); - } - if (!stringRep.isEmpty()) - stringRep.remove(stringRep.length() - 1, 1); // Trailing comma. - return stringRep; -} - - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings, - Id &nextId) -{ - return Ptr(new MaemoDeviceConfig(settings, nextId)); -} - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const ConstPtr &other) -{ - return Ptr(new MaemoDeviceConfig(other)); -} - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::createHardwareConfig(const QString &name, - MaemoDeviceConfig::OsVersion osVersion, const QString &hostName, - const QString &privateKeyFilePath, Id &nextId) -{ - Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy); - sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey; - sshParams.host = hostName; - sshParams.userName = defaultUser(osVersion); - sshParams.privateKeyFile = privateKeyFilePath; - return Ptr(new MaemoDeviceConfig(name, osVersion, Physical, sshParams, nextId)); -} - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingPassword(const QString &name, - const QString &hostName, const QString &userName, const QString &password, - Id &nextId) -{ - Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy); - sshParams.authenticationType - = Utils::SshConnectionParameters::AuthenticationByPassword; - sshParams.host = hostName; - sshParams.userName = userName; - sshParams.password = password; - return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical, - sshParams, nextId)); -} - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::createGenericLinuxConfigUsingKey(const QString &name, - const QString &hostName, const QString &userName, const QString &privateKeyFile, - Id &nextId) -{ - Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy); - sshParams.authenticationType - = Utils::SshConnectionParameters::AuthenticationByKey; - sshParams.host = hostName; - sshParams.userName = userName; - sshParams.privateKeyFile = privateKeyFile; - return Ptr(new MaemoDeviceConfig(name, MaemoDeviceConfig::GenericLinux, Physical, - sshParams, nextId)); -} - -MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &name, - MaemoDeviceConfig::OsVersion osVersion, Id &nextId) -{ - Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy); - sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword; - sshParams.host = defaultHost(Emulator, osVersion); - sshParams.userName = defaultUser(osVersion); - sshParams.password = defaultQemuPassword(osVersion); - return Ptr(new MaemoDeviceConfig(name, osVersion, Emulator, sshParams, nextId)); -} - -MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, - MaemoDeviceConfig::OsVersion osVersion, DeviceType devType, - const Utils::SshConnectionParameters &sshParams, Id &nextId) - : m_sshParameters(sshParams), - m_name(name), - m_osVersion(osVersion), - m_type(devType), - m_portsSpec(defaultPortsSpec(m_type)), - m_isDefault(false), - m_internalId(nextId++) -{ - m_sshParameters.port = defaultSshPort(m_type); - m_sshParameters.timeout = DefaultTimeout; -} - -MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings, - Id &nextId) - : m_sshParameters(Utils::SshConnectionParameters::NoProxy), - m_name(settings.value(NameKey).toString()), - m_osVersion(static_cast<MaemoDeviceConfig::OsVersion>(settings.value(OsVersionKey, MaemoDeviceConfig::Maemo5).toInt())), - m_type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())), - m_portsSpec(settings.value(PortsSpecKey, defaultPortsSpec(m_type)).toString()), - m_isDefault(settings.value(IsDefaultKey, false).toBool()), - m_internalId(settings.value(InternalIdKey, nextId).toULongLong()) -{ - if (m_internalId == nextId) - ++nextId; - m_sshParameters.host = settings.value(HostKey, defaultHost(m_type, m_osVersion)).toString(); - m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt(); - m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osVersion)).toString(); - m_sshParameters.authenticationType - = static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt()); - m_sshParameters.password = settings.value(PasswordKey).toString(); - m_sshParameters.privateKeyFile - = settings.value(KeyFileKey, defaultPrivateKeyFilePath()).toString(); - m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt(); -} - -MaemoDeviceConfig::MaemoDeviceConfig(const MaemoDeviceConfig::ConstPtr &other) - : m_sshParameters(other->m_sshParameters), - m_name(other->m_name), - m_osVersion(other->m_osVersion), - m_type(other->type()), - m_portsSpec(other->m_portsSpec), - m_isDefault(other->m_isDefault), - m_internalId(other->m_internalId) -{ -} - -QString MaemoDeviceConfig::portsRegExpr() -{ - const QLatin1String portExpr("(\\d)+"); - const QString listElemExpr = QString::fromLatin1("%1(-%1)?").arg(portExpr); - return QString::fromLatin1("((%1)(,%1)*)?").arg(listElemExpr); -} - -int MaemoDeviceConfig::defaultSshPort(DeviceType type) -{ - return type == Physical ? DefaultSshPortHW : DefaultSshPortSim; -} - -QString MaemoDeviceConfig::defaultPortsSpec(DeviceType type) const -{ - return QLatin1String(type == Physical ? "10000-10100" : "13219,14168"); -} - -QString MaemoDeviceConfig::defaultHost(DeviceType type, MaemoDeviceConfig::OsVersion osVersion) -{ - switch (osVersion) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - case MaemoDeviceConfig::Meego: - return QLatin1String(type == Physical ? "192.168.2.15" : "localhost"); - case MaemoDeviceConfig::GenericLinux: - return QString(); - default: - qDebug("%s: Unknown OS version %d.", Q_FUNC_INFO, osVersion); - return QString(); - } -} - -QString MaemoDeviceConfig::defaultPrivateKeyFilePath() -{ - return QDesktopServices::storageLocation(QDesktopServices::HomeLocation) - + QLatin1String("/.ssh/id_rsa"); -} - -QString MaemoDeviceConfig::defaultPublicKeyFilePath() -{ - return defaultPrivateKeyFilePath() + QLatin1String(".pub"); -} - -QString MaemoDeviceConfig::defaultUser(MaemoDeviceConfig::OsVersion osVersion) -{ - switch (osVersion) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - return QLatin1String("developer"); - case MaemoDeviceConfig::Meego: - return QLatin1String("meego"); - case MaemoDeviceConfig::GenericLinux: - return QString(); - default: - qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion); - return QString(); - } -} - -QString MaemoDeviceConfig::defaultQemuPassword(MaemoDeviceConfig::OsVersion osVersion) -{ - switch (osVersion) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - return QString(); - case MaemoDeviceConfig::Meego: - return QLatin1String("meego"); - default: - qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, osVersion); - return QString(); - } -} - -MaemoPortList MaemoDeviceConfig::freePorts() const -{ - return PortsSpecParser(m_portsSpec).parse(); -} - -void MaemoDeviceConfig::save(QSettings &settings) const -{ - settings.setValue(NameKey, m_name); - settings.setValue(OsVersionKey, m_osVersion); - settings.setValue(TypeKey, m_type); - settings.setValue(HostKey, m_sshParameters.host); - settings.setValue(SshPortKey, m_sshParameters.port); - settings.setValue(PortsSpecKey, m_portsSpec); - settings.setValue(UserNameKey, m_sshParameters.userName); - settings.setValue(AuthKey, m_sshParameters.authenticationType); - settings.setValue(PasswordKey, m_sshParameters.password); - settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile); - settings.setValue(TimeoutKey, m_sshParameters.timeout); - settings.setValue(IsDefaultKey, m_isDefault); - settings.setValue(InternalIdKey, m_internalId); -} - -const MaemoDeviceConfig::Id MaemoDeviceConfig::InvalidId = 0; - - -MaemoDeviceConfigurations *MaemoDeviceConfigurations::instance(QObject *parent) -{ - if (m_instance == 0) { - m_instance = new MaemoDeviceConfigurations(parent); - m_instance->load(); - } - return m_instance; -} - -void MaemoDeviceConfigurations::replaceInstance(const MaemoDeviceConfigurations *other) -{ - Q_ASSERT(m_instance); - m_instance->beginResetModel(); - copy(other, m_instance, false); - m_instance->save(); - m_instance->endResetModel(); - emit m_instance->updated(); -} - -MaemoDeviceConfigurations *MaemoDeviceConfigurations::cloneInstance() -{ - MaemoDeviceConfigurations * const other = new MaemoDeviceConfigurations(0); - copy(m_instance, other, true); - return other; -} - -void MaemoDeviceConfigurations::copy(const MaemoDeviceConfigurations *source, - MaemoDeviceConfigurations *target, bool deep) -{ - if (deep) { - foreach (const MaemoDeviceConfig::ConstPtr &devConf, source->m_devConfigs) - target->m_devConfigs << MaemoDeviceConfig::create(devConf); - } else { - target->m_devConfigs = source->m_devConfigs; - } - target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath; - target->m_nextId = source->m_nextId; -} - -void MaemoDeviceConfigurations::save() -{ - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(SettingsGroup); - settings->setValue(IdCounterKey, m_nextId); - settings->setValue(DefaultKeyFilePathKey, m_defaultSshKeyFilePath); - settings->beginWriteArray(ConfigListKey, m_devConfigs.count()); - for (int i = 0; i < m_devConfigs.count(); ++i) { - settings->setArrayIndex(i); - m_devConfigs.at(i)->save(*settings); - } - settings->endArray(); - settings->endGroup(); -} - -void MaemoDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name, - MaemoDeviceConfig::OsVersion osVersion, const QString &hostName, - const QString &privateKeyFilePath) -{ - const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createHardwareConfig(name, - osVersion, hostName, privateKeyFilePath, m_nextId); - addConfiguration(devConf); -} - -void MaemoDeviceConfigurations::addGenericLinuxConfigurationUsingPassword(const QString &name, - const QString &hostName, const QString &userName, const QString &password) -{ - const MaemoDeviceConfig::Ptr &devConf - = MaemoDeviceConfig::createGenericLinuxConfigUsingPassword(name, - hostName, userName, password, m_nextId); - addConfiguration(devConf); -} - -void MaemoDeviceConfigurations::addGenericLinuxConfigurationUsingKey(const QString &name, - const QString &hostName, const QString &userName, const QString &privateKeyFilePath) -{ - const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createGenericLinuxConfigUsingKey(name, - hostName, userName, privateKeyFilePath, m_nextId); - addConfiguration(devConf); -} - -void MaemoDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name, - MaemoDeviceConfig::OsVersion osVersion) -{ - const MaemoDeviceConfig::Ptr &devConf - = MaemoDeviceConfig::createEmulatorConfig(name, osVersion, m_nextId); - addConfiguration(devConf); -} - -void MaemoDeviceConfigurations::addConfiguration(const MaemoDeviceConfig::Ptr &devConfig) -{ - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - if (!defaultDeviceConfig(devConfig->osVersion())) - devConfig->m_isDefault = true; - m_devConfigs << devConfig; - endInsertRows(); -} - -void MaemoDeviceConfigurations::removeConfiguration(int idx) -{ - Q_ASSERT(idx >= 0 && idx < rowCount()); - beginRemoveRows(QModelIndex(), idx, idx); - const bool wasDefault = deviceAt(idx)->m_isDefault; - const MaemoDeviceConfig::OsVersion osVersion = deviceAt(idx)->osVersion(); - m_devConfigs.removeAt(idx); - endRemoveRows(); - if (wasDefault) { - for (int i = 0; i < m_devConfigs.count(); ++i) { - if (deviceAt(i)->osVersion() == osVersion) { - m_devConfigs.at(i)->m_isDefault = true; - const QModelIndex changedIndex = index(i, 0); - emit dataChanged(changedIndex, changedIndex); - break; - } - } - } -} - -void MaemoDeviceConfigurations::setConfigurationName(int i, const QString &name) -{ - Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_name = name; - const QModelIndex changedIndex = index(i, 0); - emit dataChanged(changedIndex, changedIndex); -} - -void MaemoDeviceConfigurations::setSshParameters(int i, - const Utils::SshConnectionParameters ¶ms) -{ - Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_sshParameters = params; -} - -void MaemoDeviceConfigurations::setPortsSpec(int i, const QString &portsSpec) -{ - Q_ASSERT(i >= 0 && i < rowCount()); - m_devConfigs.at(i)->m_portsSpec = portsSpec; -} - -void MaemoDeviceConfigurations::setDefaultDevice(int idx) -{ - Q_ASSERT(idx >= 0 && idx < rowCount()); - const MaemoDeviceConfig::Ptr &devConf = m_devConfigs.at(idx); - if (devConf->m_isDefault) - return; - QModelIndex oldDefaultIndex; - for (int i = 0; i < m_devConfigs.count(); ++i) { - const MaemoDeviceConfig::Ptr &oldDefaultDev = m_devConfigs.at(i); - if (oldDefaultDev->m_isDefault - && oldDefaultDev->osVersion() == devConf->osVersion()) { - oldDefaultDev->m_isDefault = false; - oldDefaultIndex = index(i, 0); - break; - } - } - Q_ASSERT(oldDefaultIndex.isValid()); - emit dataChanged(oldDefaultIndex, oldDefaultIndex); - devConf->m_isDefault = true; - const QModelIndex newDefaultIndex = index(idx, 0); - emit dataChanged(newDefaultIndex, newDefaultIndex); -} - -MaemoDeviceConfigurations::MaemoDeviceConfigurations(QObject *parent) - : QAbstractListModel(parent) -{ -} - -void MaemoDeviceConfigurations::load() -{ - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(SettingsGroup); - m_nextId = settings->value(IdCounterKey, 1).toULongLong(); - m_defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey, - MaemoDeviceConfig::defaultPrivateKeyFilePath()).toString(); - int count = settings->beginReadArray(ConfigListKey); - for (int i = 0; i < count; ++i) { - settings->setArrayIndex(i); - MaemoDeviceConfig::Ptr devConf - = MaemoDeviceConfig::create(*settings, m_nextId); - m_devConfigs << devConf; - } - settings->endArray(); - settings->endGroup(); - ensureDefaultExists(MaemoDeviceConfig::Maemo5); - ensureDefaultExists(MaemoDeviceConfig::Maemo6); - ensureDefaultExists(MaemoDeviceConfig::Meego); - ensureDefaultExists(MaemoDeviceConfig::GenericLinux); -} - -MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int idx) const -{ - Q_ASSERT(idx >= 0 && idx < rowCount()); - return m_devConfigs.at(idx); -} - -bool MaemoDeviceConfigurations::hasConfig(const QString &name) const -{ - QList<MaemoDeviceConfig::Ptr>::ConstIterator resultIt = - std::find_if(m_devConfigs.constBegin(), m_devConfigs.constEnd(), - DevConfNameMatcher(name)); - return resultIt != m_devConfigs.constEnd(); -} - -MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::find(MaemoDeviceConfig::Id id) const -{ - const int index = indexForInternalId(id); - return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index); -} - -MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig(const MaemoDeviceConfig::OsVersion osVersion) const -{ - foreach (const MaemoDeviceConfig::ConstPtr &devConf, m_devConfigs) { - if (devConf->m_isDefault && devConf->osVersion() == osVersion) - return devConf; - } - return MaemoDeviceConfig::ConstPtr(); -} - -int MaemoDeviceConfigurations::indexForInternalId(MaemoDeviceConfig::Id internalId) const -{ - for (int i = 0; i < m_devConfigs.count(); ++i) { - if (deviceAt(i)->m_internalId == internalId) - return i; - } - return -1; -} - -MaemoDeviceConfig::Id MaemoDeviceConfigurations::internalId(MaemoDeviceConfig::ConstPtr devConf) const -{ - return devConf ? devConf->m_internalId : MaemoDeviceConfig::InvalidId; -} - -void MaemoDeviceConfigurations::ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion) -{ - if (!defaultDeviceConfig(osVersion)) { - foreach (const MaemoDeviceConfig::Ptr &devConf, m_devConfigs) { - if (devConf->osVersion() == osVersion) { - devConf->m_isDefault = true; - break; - } - } - } -} - -int MaemoDeviceConfigurations::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return m_devConfigs.count(); -} - -QVariant MaemoDeviceConfigurations::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole) - return QVariant(); - const MaemoDeviceConfig::ConstPtr devConf = deviceAt(index.row()); - QString name = devConf->name(); - if (devConf->m_isDefault) { - name += QLatin1Char(' ') + tr("(default for %1)") - .arg(MaemoGlobal::osVersionToString(devConf->osVersion())); - } - return name; -} - -MaemoDeviceConfigurations *MaemoDeviceConfigurations::m_instance = 0; - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h deleted file mode 100644 index 8887053336..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurations.h +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEVICECONFIGURATIONS_H -#define MAEMODEVICECONFIGURATIONS_H - -#include <utils/ssh/sshconnection.h> - -#include <QtCore/QAbstractListModel> -#include <QtCore/QList> -#include <QtCore/QPair> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> - -QT_BEGIN_NAMESPACE -class QSettings; -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPortList -{ -public: - void addPort(int port); - void addRange(int startPort, int endPort); - bool hasMore() const; - int count() const; - int getNext(); - QString toString() const; - -private: - typedef QPair<int, int> Range; - QList<Range> m_ranges; -}; - - -class MaemoDeviceConfig -{ - friend class MaemoDeviceConfigurations; -public: - typedef QSharedPointer<const MaemoDeviceConfig> ConstPtr; - typedef quint64 Id; - enum OsVersion { Maemo5, Maemo6, Meego, GenericLinux }; - enum DeviceType { Physical, Emulator }; - - MaemoPortList freePorts() const; - Utils::SshConnectionParameters sshParameters() const { return m_sshParameters; } - QString name() const { return m_name; } - OsVersion osVersion() const { return m_osVersion; } - DeviceType type() const { return m_type; } - QString portsSpec() const { return m_portsSpec; } - Id internalId() const { return m_internalId; } - bool isDefault() const { return m_isDefault; } - static QString portsRegExpr(); - static QString defaultHost(DeviceType type, OsVersion osVersion); - static QString defaultPrivateKeyFilePath(); - static QString defaultPublicKeyFilePath(); - static QString defaultUser(OsVersion osVersion); - static int defaultSshPort(DeviceType type); - static QString defaultQemuPassword(OsVersion osVersion); - - static const Id InvalidId; - -private: - typedef QSharedPointer<MaemoDeviceConfig> Ptr; - - MaemoDeviceConfig(const QString &name, OsVersion osVersion, - DeviceType type, const Utils::SshConnectionParameters &sshParams, - Id &nextId); - MaemoDeviceConfig(const QSettings &settings, Id &nextId); - MaemoDeviceConfig(const ConstPtr &other); - - MaemoDeviceConfig(const MaemoDeviceConfig &); - MaemoDeviceConfig &operator=(const MaemoDeviceConfig &); - - static Ptr createHardwareConfig(const QString &name, OsVersion osVersion, - const QString &hostName, const QString &privateKeyFilePath, Id &nextId); - static Ptr createGenericLinuxConfigUsingPassword(const QString &name, - const QString &hostName, const QString &userName, - const QString &password, Id &nextId); - static Ptr createGenericLinuxConfigUsingKey(const QString &name, - const QString &hostName, const QString &userName, - const QString &privateKeyFilePath, Id &nextId); - static Ptr createEmulatorConfig(const QString &name, OsVersion osVersion, - Id &nextId); - static Ptr create(const QSettings &settings, Id &nextId); - static Ptr create(const ConstPtr &other); - - void save(QSettings &settings) const; - QString defaultPortsSpec(DeviceType type) const; - - Utils::SshConnectionParameters m_sshParameters; - QString m_name; - OsVersion m_osVersion; - DeviceType m_type; - QString m_portsSpec; - bool m_isDefault; - Id m_internalId; -}; - - -class MaemoDeviceConfigurations : public QAbstractListModel -{ - Q_OBJECT - Q_DISABLE_COPY(MaemoDeviceConfigurations) -public: - static MaemoDeviceConfigurations *instance(QObject *parent = 0); - - static void replaceInstance(const MaemoDeviceConfigurations *other); - static MaemoDeviceConfigurations *cloneInstance(); - - MaemoDeviceConfig::ConstPtr deviceAt(int index) const; - MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) const; - MaemoDeviceConfig::ConstPtr defaultDeviceConfig(const MaemoDeviceConfig::OsVersion osVersion) const; - bool hasConfig(const QString &name) const; - int indexForInternalId(MaemoDeviceConfig::Id internalId) const; - MaemoDeviceConfig::Id internalId(MaemoDeviceConfig::ConstPtr devConf) const; - - void setDefaultSshKeyFilePath(const QString &path) { m_defaultSshKeyFilePath = path; } - QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; } - - void addHardwareDeviceConfiguration(const QString &name, - MaemoDeviceConfig::OsVersion osVersion, const QString &hostName, - const QString &privateKeyFilePath); - void addGenericLinuxConfigurationUsingPassword(const QString &name, - const QString &hostName, const QString &userName, - const QString &password); - void addGenericLinuxConfigurationUsingKey(const QString &name, - const QString &hostName, const QString &userName, - const QString &privateKeyFilePath); - void addEmulatorDeviceConfiguration(const QString &name, - MaemoDeviceConfig::OsVersion osVersion); - void removeConfiguration(int index); - void setConfigurationName(int i, const QString &name); - void setSshParameters(int i, const Utils::SshConnectionParameters ¶ms); - void setPortsSpec(int i, const QString &portsSpec); - void setDefaultDevice(int index); - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, - int role = Qt::DisplayRole) const; - -signals: - void updated(); - -private: - MaemoDeviceConfigurations(QObject *parent); - void load(); - void save(); - static void copy(const MaemoDeviceConfigurations *source, - MaemoDeviceConfigurations *target, bool deep); - void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig); - void ensureDefaultExists(MaemoDeviceConfig::OsVersion osVersion); - - static MaemoDeviceConfigurations *m_instance; - MaemoDeviceConfig::Id m_nextId; - QList<MaemoDeviceConfig::Ptr> m_devConfigs; - QString m_defaultSshKeyFilePath; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEVICECONFIGURATIONS_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp deleted file mode 100644 index 058f437fd2..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeviceconfigurationssettingswidget.h" - -#include "ui_maemodeviceconfigurationssettingswidget.h" - -#include "maemoconfigtestdialog.h" -#include "maemodeviceconfigwizard.h" -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" -#include "maemokeydeployer.h" -#include "maemoremoteprocessesdialog.h" -#include "maemosshconfigdialog.h" - -#include <coreplugin/icore.h> -#include <utils/ssh/sshremoteprocessrunner.h> - -#include <QtCore/QFileInfo> -#include <QtCore/QRegExp> -#include <QtCore/QSettings> -#include <QtCore/QTextStream> - -#include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> -#include <QtGui/QIntValidator> - -#include <algorithm> - -using namespace Core; -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QLatin1String LastDeviceConfigIndexKey("LastDisplayedMaemoDeviceConfig"); -} // anonymous namespace - - -class NameValidator : public QValidator -{ -public: - NameValidator(const MaemoDeviceConfigurations *devConfigs, - QWidget *parent = 0) - : QValidator(parent), m_devConfigs(devConfigs) - { - } - - void setDisplayName(const QString &name) { m_oldName = name; } - - virtual State validate(QString &input, int & /* pos */) const - { - if (input.trimmed().isEmpty() - || (input != m_oldName && m_devConfigs->hasConfig(input))) - return Intermediate; - return Acceptable; - } - - virtual void fixup(QString &input) const - { - int dummy = 0; - if (validate(input, dummy) != Acceptable) - input = m_oldName; - } - -private: - QString m_oldName; - const MaemoDeviceConfigurations * const m_devConfigs; -}; - - -MaemoDeviceConfigurationsSettingsWidget::MaemoDeviceConfigurationsSettingsWidget(QWidget *parent) - : QWidget(parent), - m_ui(new Ui_MaemoDeviceConfigurationsSettingsWidget), - m_devConfigs(MaemoDeviceConfigurations::cloneInstance()), - m_nameValidator(new NameValidator(m_devConfigs.data(), this)), - m_keyDeployer(new MaemoKeyDeployer(this)), - m_saveSettingsRequested(false) -{ - initGui(); - connect(m_keyDeployer, SIGNAL(error(QString)), this, - SLOT(handleDeploymentError(QString)), Qt::QueuedConnection); - connect(m_keyDeployer, SIGNAL(finishedSuccessfully()), - SLOT(handleDeploymentSuccess())); -} - -MaemoDeviceConfigurationsSettingsWidget::~MaemoDeviceConfigurationsSettingsWidget() -{ - if (m_saveSettingsRequested) { - Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey, - currentIndex()); - MaemoDeviceConfigurations::replaceInstance(m_devConfigs.data()); - } - delete m_ui; -} - -QString MaemoDeviceConfigurationsSettingsWidget::searchKeywords() const -{ - QString rc; - QTextStream(&rc) << m_ui->configurationLabel->text() - << ' ' << m_ui->sshPortLabel->text() - << ' ' << m_ui->keyButton->text() - << ' ' << m_ui->passwordButton->text() - << ' ' << m_ui->authTypeLabel->text() - << ' ' << m_ui->connectionTimeoutLabel->text() - << ' ' << m_ui->deviceTypeLabel->text() - << ' ' << m_ui->deviceTypeValueLabel->text() - << ' ' << m_ui->deviceNameLabel->text() - << ' ' << m_ui->hostNameLabel->text() - << ' ' << m_ui->keyLabel->text() - << ' ' << m_ui->nameLineEdit->text() - << ' ' << m_ui->passwordLabel->text() - << ' ' << m_ui->freePortsLabel->text() - << ' ' << m_ui->portsWarningLabel->text() - << ' ' << m_ui->pwdLineEdit->text() - << ' ' << m_ui->timeoutSpinBox->value() - << ' ' << m_ui->userLineEdit->text() - << ' ' << m_ui->userNameLabel->text(); - rc.remove(QLatin1Char('&')); - return rc; -} - -void MaemoDeviceConfigurationsSettingsWidget::initGui() -{ - m_ui->setupUi(this); - m_ui->configurationComboBox->setModel(m_devConfigs.data()); - m_ui->nameLineEdit->setValidator(m_nameValidator); - m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File); - QRegExpValidator * const portsValidator - = new QRegExpValidator(QRegExp(MaemoDeviceConfig::portsRegExpr()), this); - m_ui->portsLineEdit->setValidator(portsValidator); - connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()), - SLOT(setDefaultKeyFilePath())); - int lastIndex = Core::ICore::instance()->settings() - ->value(LastDeviceConfigIndexKey, 0).toInt(); - if (lastIndex == -1) - lastIndex = 0; - if (lastIndex < m_ui->configurationComboBox->count()) - m_ui->configurationComboBox->setCurrentIndex(lastIndex); - connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)), - SLOT(currentConfigChanged(int))); - currentConfigChanged(currentIndex()); - connect(m_ui->defaultDeviceButton, SIGNAL(clicked()), - SLOT(setDefaultDevice())); -} - -void MaemoDeviceConfigurationsSettingsWidget::addConfig() -{ - MaemoDeviceConfigWizard wizard(m_devConfigs.data(), this); - if (wizard.exec() == QDialog::Accepted) { - wizard.createDeviceConfig(); - m_ui->removeConfigButton->setEnabled(true); - m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1); - if (currentConfig()->type() != MaemoDeviceConfig::Emulator) - testConfig(); - } -} - -void MaemoDeviceConfigurationsSettingsWidget::deleteConfig() -{ - m_devConfigs->removeConfiguration(currentIndex()); - if (m_devConfigs->rowCount() == 0) - currentConfigChanged(-1); -} - -void MaemoDeviceConfigurationsSettingsWidget::displayCurrent() -{ - const MaemoDeviceConfig::ConstPtr ¤t = currentConfig(); - m_ui->defaultDeviceButton->setEnabled(!current->isDefault()); - m_ui->osTypeValueLabel->setText(MaemoGlobal::osVersionToString(current->osVersion())); - const SshConnectionParameters &sshParams = current->sshParameters(); - if (current->type() == MaemoDeviceConfig::Physical) { - m_ui->deviceTypeValueLabel->setText(tr("Physical Device")); - m_ui->portsLineEdit->setReadOnly(false); - } else { - m_ui->deviceTypeValueLabel->setText(tr("Emulator (Qemu)")); - m_ui->portsLineEdit->setReadOnly(true); - } - if (sshParams.authenticationType == Utils::SshConnectionParameters::AuthenticationByPassword) - m_ui->passwordButton->setChecked(true); - else - m_ui->keyButton->setChecked(true); - m_ui->detailsWidget->setEnabled(true); - m_nameValidator->setDisplayName(current->name()); - m_ui->timeoutSpinBox->setValue(sshParams.timeout); - fillInValues(); -} - -void MaemoDeviceConfigurationsSettingsWidget::fillInValues() -{ - const MaemoDeviceConfig::ConstPtr ¤t = currentConfig(); - m_ui->nameLineEdit->setText(current->name()); - const SshConnectionParameters &sshParams = current->sshParameters(); - m_ui->hostLineEdit->setText(sshParams.host); - m_ui->sshPortSpinBox->setValue(sshParams.port); - m_ui->portsLineEdit->setText(current->portsSpec()); - m_ui->timeoutSpinBox->setValue(sshParams.timeout); - m_ui->userLineEdit->setText(sshParams.userName); - m_ui->pwdLineEdit->setText(sshParams.password); - m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile); - m_ui->showPasswordCheckBox->setChecked(false); - updatePortsWarningLabel(); - const bool isSimulator = current->type() == MaemoDeviceConfig::Emulator; - m_ui->hostLineEdit->setReadOnly(isSimulator); - m_ui->sshPortSpinBox->setReadOnly(isSimulator); -} - -void MaemoDeviceConfigurationsSettingsWidget::saveSettings() -{ - // We must defer this step because of a stupid bug on MacOS. See QTCREATORBUG-1675. - m_saveSettingsRequested = true; -} - -int MaemoDeviceConfigurationsSettingsWidget::currentIndex() const -{ - return m_ui->configurationComboBox->currentIndex(); -} - -MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const -{ - Q_ASSERT(currentIndex() != -1); - return m_devConfigs->deviceAt(currentIndex()); -} - -void MaemoDeviceConfigurationsSettingsWidget::configNameEditingFinished() -{ - if (m_ui->configurationComboBox->count() == 0) - return; - - const QString &newName = m_ui->nameLineEdit->text(); - m_devConfigs->setConfigurationName(currentIndex(), newName); - m_nameValidator->setDisplayName(newName); -} - -void MaemoDeviceConfigurationsSettingsWidget::authenticationTypeChanged() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - const bool usePassword = m_ui->passwordButton->isChecked(); - sshParams.authenticationType = usePassword - ? SshConnectionParameters::AuthenticationByPassword - : SshConnectionParameters::AuthenticationByKey; - m_devConfigs->setSshParameters(currentIndex(), sshParams); - m_ui->pwdLineEdit->setEnabled(usePassword); - m_ui->passwordLabel->setEnabled(usePassword); - m_ui->keyFileLineEdit->setEnabled(!usePassword); - m_ui->keyLabel->setEnabled(!usePassword); - m_ui->makeKeyFileDefaultButton->setEnabled(!usePassword); -} - -void MaemoDeviceConfigurationsSettingsWidget::hostNameEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.host = m_ui->hostLineEdit->text(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::sshPortEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.port = m_ui->sshPortSpinBox->value(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::timeoutEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.timeout = m_ui->timeoutSpinBox->value(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::userNameEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.userName = m_ui->userLineEdit->text(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::passwordEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.password = m_ui->pwdLineEdit->text(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::keyFileEditingFinished() -{ - SshConnectionParameters sshParams = currentConfig()->sshParameters(); - sshParams.privateKeyFile = m_ui->keyFileLineEdit->path(); - m_devConfigs->setSshParameters(currentIndex(), sshParams); -} - -void MaemoDeviceConfigurationsSettingsWidget::handleFreePortsChanged() -{ - m_devConfigs->setPortsSpec(currentIndex(), m_ui->portsLineEdit->text()); - updatePortsWarningLabel(); -} - -void MaemoDeviceConfigurationsSettingsWidget::showPassword(bool showClearText) -{ - m_ui->pwdLineEdit->setEchoMode(showClearText - ? QLineEdit::Normal : QLineEdit::Password); -} - -void MaemoDeviceConfigurationsSettingsWidget::testConfig() -{ - QDialog *dialog = new MaemoConfigTestDialog(currentConfig(), this); - dialog->open(); -} - -void MaemoDeviceConfigurationsSettingsWidget::showGenerateSshKeyDialog() -{ - MaemoSshConfigDialog dialog(this); - dialog.exec(); -} - -void MaemoDeviceConfigurationsSettingsWidget::showRemoteProcesses() -{ - MaemoRemoteProcessesDialog dlg(currentConfig(), this); - dlg.exec(); -} - -void MaemoDeviceConfigurationsSettingsWidget::setDefaultKeyFilePath() -{ - m_devConfigs->setDefaultSshKeyFilePath(m_ui->keyFileLineEdit->path()); -} - -void MaemoDeviceConfigurationsSettingsWidget::setDefaultDevice() -{ - m_devConfigs->setDefaultDevice(currentIndex()); - m_ui->defaultDeviceButton->setEnabled(false); -} - -void MaemoDeviceConfigurationsSettingsWidget::setPrivateKey(const QString &path) -{ - m_ui->keyFileLineEdit->setPath(path); - keyFileEditingFinished(); -} - -void MaemoDeviceConfigurationsSettingsWidget::deployKey() -{ - const SshConnectionParameters sshParams = currentConfig()->sshParameters(); - const QString &dir = QFileInfo(sshParams.privateKeyFile).path(); - QString publicKeyFileName = QFileDialog::getOpenFileName(this, - tr("Choose Public Key File"), dir, - tr("Public Key Files(*.pub);;All Files (*)")); - if (publicKeyFileName.isEmpty()) - return; - - disconnect(m_ui->deployKeyButton, 0, this, 0); - m_ui->deployKeyButton->setText(tr("Stop Deploying")); - connect(m_ui->deployKeyButton, SIGNAL(clicked()), this, - SLOT(finishDeployment())); - m_keyDeployer->deployPublicKey(sshParams, publicKeyFileName); -} - -void MaemoDeviceConfigurationsSettingsWidget::handleDeploymentError(const QString &errorMsg) -{ - QMessageBox::critical(this, tr("Deployment Failed"), errorMsg); - finishDeployment(); -} - -void MaemoDeviceConfigurationsSettingsWidget::handleDeploymentSuccess() -{ - QMessageBox::information(this, tr("Deployment Succeeded"), - tr("Key was successfully deployed.")); - finishDeployment(); -} - -void MaemoDeviceConfigurationsSettingsWidget::finishDeployment() -{ - m_keyDeployer->stopDeployment(); - m_ui->deployKeyButton->disconnect(); - m_ui->deployKeyButton->setText(tr("&Deploy Public Key...")); - connect(m_ui->deployKeyButton, SIGNAL(clicked()), this, SLOT(deployKey())); -} - -void MaemoDeviceConfigurationsSettingsWidget::currentConfigChanged(int index) -{ - finishDeployment(); - if (index == -1) { - m_ui->removeConfigButton->setEnabled(false); - m_ui->testConfigButton->setEnabled(false); - m_ui->generateKeyButton->setEnabled(false); - m_ui->deployKeyButton->setEnabled(false); - m_ui->remoteProcessesButton->setEnabled(false); - clearDetails(); - m_ui->detailsWidget->setEnabled(false); - m_ui->defaultDeviceButton->setEnabled(false); - } else { - m_ui->removeConfigButton->setEnabled(true); - m_ui->testConfigButton->setEnabled(true); - m_ui->generateKeyButton->setEnabled(true); - m_ui->deployKeyButton->setEnabled(true); - m_ui->remoteProcessesButton->setEnabled(true); - m_ui->configurationComboBox->setCurrentIndex(index); - displayCurrent(); - } -} - -void MaemoDeviceConfigurationsSettingsWidget::clearDetails() -{ - m_ui->nameLineEdit->clear(); - m_ui->osTypeValueLabel->clear(); - m_ui->deviceTypeValueLabel->clear(); - m_ui->hostLineEdit->clear(); - m_ui->sshPortSpinBox->clear(); - m_ui->timeoutSpinBox->clear(); - m_ui->userLineEdit->clear(); - m_ui->pwdLineEdit->clear(); - m_ui->portsLineEdit->clear(); - m_ui->portsWarningLabel->clear(); - m_ui->keyFileLineEdit->lineEdit()->clear(); -} - -void MaemoDeviceConfigurationsSettingsWidget::updatePortsWarningLabel() -{ - if (currentConfig()->freePorts().hasMore()) { - m_ui->portsWarningLabel->clear(); - } else { - m_ui->portsWarningLabel->setText(QLatin1String("<font color=\"red\">") - + tr("You will need at least one port.") + QLatin1String("</font>")); - } -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.h deleted file mode 100644 index e8a6390724..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.h +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEVICECONFIGURATIONSSETTINGSWIDGET_H -#define MAEMODEVICECONFIGURATIONSSETTINGSWIDGET_H - -#include <QtCore/QList> -#include <QtCore/QScopedPointer> -#include <QtCore/QString> -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE -class QLineEdit; - -class Ui_MaemoDeviceConfigurationsSettingsWidget; -QT_END_NAMESPACE - -namespace Utils { -class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class NameValidator; -class MaemoDeviceConfig; -class MaemoDeviceConfigurations; -class MaemoKeyDeployer; - -class MaemoDeviceConfigurationsSettingsWidget : public QWidget -{ - Q_OBJECT -public: - MaemoDeviceConfigurationsSettingsWidget(QWidget *parent); - ~MaemoDeviceConfigurationsSettingsWidget(); - - void saveSettings(); - QString searchKeywords() const; - -private slots: - void currentConfigChanged(int index); - void addConfig(); - void deleteConfig(); - void configNameEditingFinished(); - void authenticationTypeChanged(); - void hostNameEditingFinished(); - void sshPortEditingFinished(); - void timeoutEditingFinished(); - void userNameEditingFinished(); - void passwordEditingFinished(); - void keyFileEditingFinished(); - void showPassword(bool showClearText); - void handleFreePortsChanged(); - void showRemoteProcesses(); - void setDefaultKeyFilePath(); - void setDefaultDevice(); - - // For configuration testing. - void testConfig(); - - void showGenerateSshKeyDialog(); - void setPrivateKey(const QString &path); - - // For key deploying. - void deployKey(); - void finishDeployment(); - void handleDeploymentError(const QString &errorMsg); - void handleDeploymentSuccess(); - -private: - void initGui(); - void displayCurrent(); - QSharedPointer<const MaemoDeviceConfig> currentConfig() const; - int currentIndex() const; - void clearDetails(); - QString parseTestOutput(); - void fillInValues(); - void updatePortsWarningLabel(); - - Ui_MaemoDeviceConfigurationsSettingsWidget *m_ui; - const QScopedPointer<MaemoDeviceConfigurations> m_devConfigs; - NameValidator * const m_nameValidator; - MaemoKeyDeployer *const m_keyDeployer; - bool m_saveSettingsRequested; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEVICECONFIGURATIONSSETTINGSWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.ui deleted file mode 100644 index b095b6ff3a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigurationssettingswidget.ui +++ /dev/null @@ -1,841 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigurationsSettingsWidget</class> - <widget class="QWidget" name="MaemoDeviceConfigurationsSettingsWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>708</width> - <height>421</height> - </rect> - </property> - <property name="windowTitle"> - <string>Maemo Device Configurations</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="configurationLabel"> - <property name="text"> - <string>&Configuration:</string> - </property> - <property name="buddy"> - <cstring>configurationComboBox</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="configurationComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="editable"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QWidget" name="detailsWidget" native="true"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="deviceNameLabel"> - <property name="text"> - <string>&Name:</string> - </property> - <property name="buddy"> - <cstring>nameLineEdit</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="nameLineEdit"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="deviceTypeLabel"> - <property name="text"> - <string>Device type:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="authTypeLabel"> - <property name="text"> - <string>Authentication type:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QWidget" name="authTypeButtonsWidget" native="true"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QRadioButton" name="passwordButton"> - <property name="text"> - <string>Password</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="keyButton"> - <property name="text"> - <string>&Key</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <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> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="hostNameLabel"> - <property name="text"> - <string>&Host name:</string> - </property> - <property name="buddy"> - <cstring>hostLineEdit</cstring> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="hostLineEdit"> - <property name="placeholderText"> - <string>IP or host name of the device</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="sshPortLabel"> - <property name="text"> - <string>&SSH port:</string> - </property> - <property name="buddy"> - <cstring>sshPortSpinBox</cstring> - </property> - </widget> - </item> - <item row="5" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QSpinBox" name="sshPortSpinBox"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - <property name="value"> - <number>22</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <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 row="6" column="0"> - <widget class="QLabel" name="freePortsLabel"> - <property name="text"> - <string>Free ports:</string> - </property> - <property name="buddy"> - <cstring>portsLineEdit</cstring> - </property> - </widget> - </item> - <item row="6" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <widget class="QLineEdit" name="portsLineEdit"> - <property name="toolTip"> - <string>You can enter lists and ranges like this: 1024,1026-1028,1030</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="portsWarningLabel"> - <property name="text"> - <string>TextLabel</string> - </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> - <item row="7" column="0"> - <widget class="QLabel" name="connectionTimeoutLabel"> - <property name="text"> - <string>Connection time&out:</string> - </property> - <property name="buddy"> - <cstring>timeoutSpinBox</cstring> - </property> - </widget> - </item> - <item row="7" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QSpinBox" name="timeoutSpinBox"> - <property name="suffix"> - <string>s</string> - </property> - <property name="maximum"> - <number>10000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>1000</number> - </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 row="8" column="0"> - <widget class="QLabel" name="userNameLabel"> - <property name="text"> - <string>&Username:</string> - </property> - <property name="buddy"> - <cstring>userLineEdit</cstring> - </property> - </widget> - </item> - <item row="8" column="1"> - <widget class="QLineEdit" name="userLineEdit"/> - </item> - <item row="9" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="text"> - <string>&Password:</string> - </property> - <property name="buddy"> - <cstring>pwdLineEdit</cstring> - </property> - </widget> - </item> - <item row="9" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QLineEdit" name="pwdLineEdit"> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="showPasswordCheckBox"> - <property name="text"> - <string>Show password</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="10" column="0"> - <widget class="QLabel" name="keyLabel"> - <property name="text"> - <string>Private key file:</string> - </property> - </widget> - </item> - <item row="10" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <widget class="Utils::PathChooser" name="keyFileLineEdit" native="true"/> - </item> - <item> - <widget class="QPushButton" name="makeKeyFileDefaultButton"> - <property name="text"> - <string>Set as Default</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="deviceTypeValueLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="oSTypeLabel"> - <property name="text"> - <string>OS type:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="osTypeValueLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPushButton" name="addConfigButton"> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="text"> - <string>&Add</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeConfigButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="text"> - <string>&Remove</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="testConfigButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>Click here to check whether this device is properly set up to run Maemo projects.</string> - </property> - <property name="text"> - <string>&Test</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="generateKeyButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>Click here if you do not have an SSH key yet.</string> - </property> - <property name="text"> - <string>&Generate SSH Key...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="deployKeyButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>This will enable you to log into the device without a password.</string> - </property> - <property name="text"> - <string>&Deploy Public Key...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="remoteProcessesButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="toolTip"> - <string>Click here to see which processes are running on the device.</string> - </property> - <property name="text"> - <string>Remote Processes...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="defaultDeviceButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::StrongFocus</enum> - </property> - <property name="text"> - <string>Set As Default</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - <container>1</container> - <slots> - <signal>editingFinished()</signal> - <signal>browsingFinished()</signal> - </slots> - </customwidget> - </customwidgets> - <resources/> - <connections> - <connection> - <sender>hostLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>hostNameEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>484</x> - <y>174</y> - </hint> - <hint type="destinationlabel"> - <x>424</x> - <y>231</y> - </hint> - </hints> - </connection> - <connection> - <sender>userLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>userNameEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>540</x> - <y>317</y> - </hint> - <hint type="destinationlabel"> - <x>422</x> - <y>301</y> - </hint> - </hints> - </connection> - <connection> - <sender>pwdLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>passwordEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>424</x> - <y>349</y> - </hint> - <hint type="destinationlabel"> - <x>423</x> - <y>336</y> - </hint> - </hints> - </connection> - <connection> - <sender>addConfigButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>addConfig()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>33</y> - </hint> - <hint type="destinationlabel"> - <x>516</x> - <y>118</y> - </hint> - </hints> - </connection> - <connection> - <sender>passwordButton</sender> - <signal>toggled(bool)</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>authenticationTypeChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>228</x> - <y>147</y> - </hint> - <hint type="destinationlabel"> - <x>513</x> - <y>240</y> - </hint> - </hints> - </connection> - <connection> - <sender>keyFileLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>keyFileEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>344</x> - <y>383</y> - </hint> - <hint type="destinationlabel"> - <x>257</x> - <y>185</y> - </hint> - </hints> - </connection> - <connection> - <sender>keyFileLineEdit</sender> - <signal>browsingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>keyFileEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>344</x> - <y>383</y> - </hint> - <hint type="destinationlabel"> - <x>257</x> - <y>185</y> - </hint> - </hints> - </connection> - <connection> - <sender>testConfigButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>testConfig()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>99</y> - </hint> - <hint type="destinationlabel"> - <x>428</x> - <y>351</y> - </hint> - </hints> - </connection> - <connection> - <sender>deployKeyButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>deployKey()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>163</y> - </hint> - <hint type="destinationlabel"> - <x>510</x> - <y>351</y> - </hint> - </hints> - </connection> - <connection> - <sender>keyButton</sender> - <signal>toggled(bool)</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>authenticationTypeChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>279</x> - <y>156</y> - </hint> - <hint type="destinationlabel"> - <x>525</x> - <y>351</y> - </hint> - </hints> - </connection> - <connection> - <sender>nameLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>configNameEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>520</x> - <y>82</y> - </hint> - <hint type="destinationlabel"> - <x>330</x> - <y>332</y> - </hint> - </hints> - </connection> - <connection> - <sender>generateKeyButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>showGenerateSshKeyDialog()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>131</y> - </hint> - <hint type="destinationlabel"> - <x>358</x> - <y>0</y> - </hint> - </hints> - </connection> - <connection> - <sender>timeoutSpinBox</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>timeoutEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>222</x> - <y>285</y> - </hint> - <hint type="destinationlabel"> - <x>6</x> - <y>333</y> - </hint> - </hints> - </connection> - <connection> - <sender>timeoutSpinBox</sender> - <signal>valueChanged(int)</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>timeoutEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>222</x> - <y>285</y> - </hint> - <hint type="destinationlabel"> - <x>0</x> - <y>299</y> - </hint> - </hints> - </connection> - <connection> - <sender>sshPortSpinBox</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>sshPortEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>210</x> - <y>201</y> - </hint> - <hint type="destinationlabel"> - <x>4</x> - <y>211</y> - </hint> - </hints> - </connection> - <connection> - <sender>sshPortSpinBox</sender> - <signal>valueChanged(int)</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>sshPortEditingFinished()</slot> - <hints> - <hint type="sourcelabel"> - <x>210</x> - <y>201</y> - </hint> - <hint type="destinationlabel"> - <x>3</x> - <y>136</y> - </hint> - </hints> - </connection> - <connection> - <sender>showPasswordCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>showPassword(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>539</x> - <y>347</y> - </hint> - <hint type="destinationlabel"> - <x>3</x> - <y>262</y> - </hint> - </hints> - </connection> - <connection> - <sender>portsLineEdit</sender> - <signal>editingFinished()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>handleFreePortsChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>310</x> - <y>230</y> - </hint> - <hint type="destinationlabel"> - <x>0</x> - <y>393</y> - </hint> - </hints> - </connection> - <connection> - <sender>remoteProcessesButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>showRemoteProcesses()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>195</y> - </hint> - <hint type="destinationlabel"> - <x>598</x> - <y>378</y> - </hint> - </hints> - </connection> - <connection> - <sender>removeConfigButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeviceConfigurationsSettingsWidget</receiver> - <slot>deleteConfig()</slot> - <hints> - <hint type="sourcelabel"> - <x>697</x> - <y>63</y> - </hint> - <hint type="destinationlabel"> - <x>351</x> - <y>210</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <slot>configNameEditingFinished()</slot> - <slot>deviceTypeChanged()</slot> - <slot>hostNameEditingFinished()</slot> - <slot>sshPortEditingFinished()</slot> - <slot>timeoutEditingFinished()</slot> - <slot>userNameEditingFinished()</slot> - <slot>passwordEditingFinished()</slot> - <slot>addConfig()</slot> - <slot>selectionChanged()</slot> - <slot>deleteConfig()</slot> - <slot>authenticationTypeChanged()</slot> - <slot>keyFileEditingFinished()</slot> - <slot>testConfig()</slot> - <slot>deployKey()</slot> - <slot>gdbServerPortEditingFinished()</slot> - <slot>currentConfigChanged(int)</slot> - <slot>showGenerateSshKeyDialog()</slot> - <slot>showPassword(bool)</slot> - <slot>handleFreePortsChanged()</slot> - <slot>showRemoteProcesses()</slot> - </slots> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp deleted file mode 100644 index e9309ce839..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp +++ /dev/null @@ -1,727 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeviceconfigwizard.h" -#include "ui_maemodeviceconfigwizardkeycreationpage.h" -#include "ui_maemodeviceconfigwizardkeydeploymentpage.h" -#include "ui_maemodeviceconfigwizardlogindatapage.h" -#include "ui_maemodeviceconfigwizardpreviouskeysetupcheckpage.h" -#include "ui_maemodeviceconfigwizardreusekeyscheckpage.h" -#include "ui_maemodeviceconfigwizardstartpage.h" - -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" -#include "maemokeydeployer.h" - -#include <utils/fileutils.h> -#include <utils/ssh/sshkeygenerator.h> - -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtGui/QButtonGroup> -#include <QtGui/QDesktopServices> -#include <QtGui/QMessageBox> -#include <QtGui/QWizardPage> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { - -struct WizardData -{ - QString configName; - QString hostName; - MaemoDeviceConfig::OsVersion osVersion; - SshConnectionParameters::AuthenticationType authType; - MaemoDeviceConfig::DeviceType deviceType; - QString privateKeyFilePath; - QString publicKeyFilePath; - QString userName; - QString password; -}; - -enum PageId { - StartPageId, LoginDataPageId, PreviousKeySetupCheckPageId, - ReuseKeysCheckPageId, KeyCreationPageId, KeyDeploymentPageId, FinalPageId -}; - -class MaemoDeviceConfigWizardStartPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardStartPage(QWidget *parent = 0) - : QWizardPage(parent), m_ui(new Ui::MaemoDeviceConfigWizardStartPage) - { - m_ui->setupUi(this); - setTitle(tr("General Information")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo5)); - m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo6)); - m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Meego)); - m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::GenericLinux)); - - QButtonGroup *buttonGroup = new QButtonGroup(this); - buttonGroup->setExclusive(true); - buttonGroup->addButton(m_ui->hwButton); - buttonGroup->addButton(m_ui->qemuButton); - connect(buttonGroup, SIGNAL(buttonClicked(int)), - SLOT(handleDeviceTypeChanged())); - - buttonGroup = new QButtonGroup(this); - buttonGroup->setExclusive(true); - buttonGroup->addButton(m_ui->fremantleButton); - buttonGroup->addButton(m_ui->harmattanButton); - buttonGroup->addButton(m_ui->meegoButton); - buttonGroup->addButton(m_ui->genericLinuxButton); - connect(buttonGroup, SIGNAL(buttonClicked(int)), - SLOT(handleOsTypeChanged())); - - m_ui->nameLineEdit->setText(QLatin1String("(New Configuration)")); - m_ui->harmattanButton->setChecked(true); - m_ui->hwButton->setChecked(true); - handleDeviceTypeChanged(); - m_ui->hostNameLineEdit->setText(MaemoDeviceConfig::defaultHost(deviceType(), - osVersion())); - connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this, - SIGNAL(completeChanged())); - connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this, - SIGNAL(completeChanged())); - } - - virtual bool isComplete() const - { - return !configName().isEmpty() && !hostName().isEmpty(); - } - - QString configName() const { return m_ui->nameLineEdit->text().trimmed(); } - - QString hostName() const - { - return deviceType() == MaemoDeviceConfig::Emulator - ? MaemoDeviceConfig::defaultHost(MaemoDeviceConfig::Emulator, osVersion()) - : m_ui->hostNameLineEdit->text().trimmed(); - } - - MaemoDeviceConfig::OsVersion osVersion() const - { - return m_ui->fremantleButton->isChecked() ? MaemoDeviceConfig::Maemo5 - : m_ui->harmattanButton->isChecked() ? MaemoDeviceConfig::Maemo6 - : m_ui->meegoButton->isChecked() ? MaemoDeviceConfig::Meego - : MaemoDeviceConfig::GenericLinux; - } - - MaemoDeviceConfig::DeviceType deviceType() const - { - return m_ui->hwButton->isChecked() - ? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Emulator; - } - -private slots: - void handleDeviceTypeChanged() - { - const bool enable = deviceType() == MaemoDeviceConfig::Physical; - m_ui->hostNameLabel->setEnabled(enable); - m_ui->hostNameLineEdit->setEnabled(enable); - } - - void handleOsTypeChanged() - { - if (osVersion() == MaemoDeviceConfig::GenericLinux) { - m_ui->hwButton->setChecked(true); - m_ui->hwButton->setEnabled(false); - m_ui->qemuButton->setEnabled(false); - } else { - m_ui->hwButton->setEnabled(true); - m_ui->qemuButton->setEnabled(true); - } - handleDeviceTypeChanged(); - } - -private: - const QScopedPointer<Ui::MaemoDeviceConfigWizardStartPage> m_ui; -}; - -class MaemoDeviceConfigWizardLoginDataPage : public QWizardPage -{ - Q_OBJECT - -public: - MaemoDeviceConfigWizardLoginDataPage(WizardData &wizardData, QWidget *parent) - : QWizardPage(parent), - m_ui(new Ui::MaemoDeviceConfigWizardLoginDataPage), - m_wizardData(wizardData) - { - m_ui->setupUi(this); - setTitle(tr("Login Data")); - m_ui->privateKeyPathChooser->setExpectedKind(PathChooser::File); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - connect(m_ui->userNameLineEdit, SIGNAL(textChanged(QString)), - SIGNAL(completeChanged())); - connect(m_ui->privateKeyPathChooser, SIGNAL(validChanged()), - SIGNAL(completeChanged())); - connect(m_ui->passwordButton, SIGNAL(toggled(bool)), - SLOT(handleAuthTypeChanged())); - } - - virtual bool isComplete() const - { - return !userName().isEmpty() - && (authType() == SshConnectionParameters::AuthenticationByPassword - || m_ui->privateKeyPathChooser->isValid()); - } - - virtual void initializePage() - { - m_ui->userNameLineEdit->setText(MaemoDeviceConfig::defaultUser(m_wizardData.osVersion)); - m_ui->passwordButton->setChecked(true); - m_ui->passwordLineEdit->clear(); - m_ui->privateKeyPathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); - handleAuthTypeChanged(); - } - - SshConnectionParameters::AuthenticationType authType() const - { - return m_ui->passwordButton->isChecked() - ? SshConnectionParameters::AuthenticationByPassword - : SshConnectionParameters::AuthenticationByKey; - } - - QString userName() const { return m_ui->userNameLineEdit->text().trimmed(); } - QString password() const { return m_ui->passwordLineEdit->text(); } - QString privateKeyFilePath() const { return m_ui->privateKeyPathChooser->path(); } - -private: - Q_SLOT void handleAuthTypeChanged() - { - m_ui->passwordLineEdit->setEnabled(authType() == SshConnectionParameters::AuthenticationByPassword); - m_ui->privateKeyPathChooser->setEnabled(authType() == SshConnectionParameters::AuthenticationByKey); - emit completeChanged(); - } - - const QScopedPointer<Ui::MaemoDeviceConfigWizardLoginDataPage> m_ui; - const WizardData &m_wizardData; -}; - -class MaemoDeviceConfigWizardPreviousKeySetupCheckPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardPreviousKeySetupCheckPage(QWidget *parent) - : QWizardPage(parent), - m_ui(new Ui::MaemoDeviceConfigWizardCheckPreviousKeySetupPage) - { - m_ui->setupUi(this); - m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File); - setTitle(tr("Device Status Check")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - QButtonGroup * const buttonGroup = new QButtonGroup(this); - buttonGroup->setExclusive(true); - buttonGroup->addButton(m_ui->keyWasSetUpButton); - buttonGroup->addButton(m_ui->keyWasNotSetUpButton); - connect(buttonGroup, SIGNAL(buttonClicked(int)), - SLOT(handleSelectionChanged())); - connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)), - this, SIGNAL(completeChanged())); - } - - virtual bool isComplete() const - { - return !keyBasedLoginWasSetup() - || m_ui->privateKeyFilePathChooser->isValid(); - } - - virtual void initializePage() - { - m_ui->keyWasNotSetUpButton->setChecked(true); - m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); - handleSelectionChanged(); - } - - bool keyBasedLoginWasSetup() const { - return m_ui->keyWasSetUpButton->isChecked(); - } - - QString privateKeyFilePath() const { - return m_ui->privateKeyFilePathChooser->path(); - } - -private: - Q_SLOT void handleSelectionChanged() - { - m_ui->privateKeyFilePathChooser->setEnabled(keyBasedLoginWasSetup()); - emit completeChanged(); - } - - const QScopedPointer<Ui::MaemoDeviceConfigWizardCheckPreviousKeySetupPage> m_ui; -}; - -class MaemoDeviceConfigWizardReuseKeysCheckPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardReuseKeysCheckPage(QWidget *parent) - : QWizardPage(parent), - m_ui(new Ui::MaemoDeviceConfigWizardReuseKeysCheckPage) - { - m_ui->setupUi(this); - setTitle(tr("Existing Keys Check")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_ui->publicKeyFilePathChooser->setExpectedKind(PathChooser::File); - m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File); - QButtonGroup * const buttonGroup = new QButtonGroup(this); - buttonGroup->setExclusive(true); - buttonGroup->addButton(m_ui->reuseButton); - buttonGroup->addButton(m_ui->dontReuseButton); - connect(buttonGroup, SIGNAL(buttonClicked(int)), - SLOT(handleSelectionChanged())); - connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)), - this, SIGNAL(completeChanged())); - connect(m_ui->publicKeyFilePathChooser, SIGNAL(changed(QString)), - this, SIGNAL(completeChanged())); - } - - virtual bool isComplete() const - { - return !reuseKeys() || (m_ui->publicKeyFilePathChooser->isValid() - && m_ui->privateKeyFilePathChooser->isValid()); - } - - virtual void initializePage() - { - m_ui->dontReuseButton->setChecked(true); - m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath()); - m_ui->publicKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPublicKeyFilePath()); - handleSelectionChanged(); - } - - bool reuseKeys() const { return m_ui->reuseButton->isChecked(); } - - QString privateKeyFilePath() const { - return m_ui->privateKeyFilePathChooser->path(); - } - - QString publicKeyFilePath() const { - return m_ui->publicKeyFilePathChooser->path(); - } - -private: - Q_SLOT void handleSelectionChanged() - { - m_ui->privateKeyFilePathLabel->setEnabled(reuseKeys()); - m_ui->privateKeyFilePathChooser->setEnabled(reuseKeys()); - m_ui->publicKeyFilePathLabel->setEnabled(reuseKeys()); - m_ui->publicKeyFilePathChooser->setEnabled(reuseKeys()); - emit completeChanged(); - } - - const QScopedPointer<Ui::MaemoDeviceConfigWizardReuseKeysCheckPage> m_ui; -}; - -class MaemoDeviceConfigWizardKeyCreationPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardKeyCreationPage(QWidget *parent) - : QWizardPage(parent), - m_ui(new Ui::MaemoDeviceConfigWizardKeyCreationPage) - { - m_ui->setupUi(this); - setTitle(tr("Key Creation")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - connect(m_ui->createKeysButton, SIGNAL(clicked()), SLOT(createKeys())); - } - - QString privateKeyFilePath() const { - return m_ui->keyDirPathChooser->path() + QLatin1String("/qtc_id_rsa"); - } - - QString publicKeyFilePath() const { - return privateKeyFilePath() + QLatin1String(".pub"); - } - - virtual void initializePage() - { - m_isComplete = false; - const QString &dir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation) - + QLatin1String("/.ssh"); - m_ui->keyDirPathChooser->setPath(dir); - enableInput(); - } - - virtual bool isComplete() const { return m_isComplete; } - -private: - - Q_SLOT void createKeys() - { - const QString &dirPath = m_ui->keyDirPathChooser->path(); - QFileInfo fi(dirPath); - if (fi.exists() && !fi.isDir()) { - QMessageBox::critical(this, tr("Cannot Create Keys"), - tr("The path you have entered is not a directory.")); - return; - } - if (!fi.exists() && !QDir::root().mkpath(dirPath)) { - QMessageBox::critical(this, tr("Cannot Create Keys"), - tr("The directory you have entered does not exist and " - "cannot be created.")); - return; - } - - m_ui->keyDirPathChooser->setEnabled(false); - m_ui->createKeysButton->setEnabled(false); - m_ui->statusLabel->setText(tr("Creating keys ... ")); - SshKeyGenerator keyGenerator; - if (!keyGenerator.generateKeys(SshKeyGenerator::Rsa, - SshKeyGenerator::OpenSsl, 1024)) { - QMessageBox::critical(this, tr("Cannot Create Keys"), - tr("Key creation failed: %1").arg(keyGenerator.error())); - enableInput(); - return; - } - - if (!saveFile(privateKeyFilePath(), keyGenerator.privateKey()) - || !saveFile(publicKeyFilePath(), keyGenerator.publicKey())) { - enableInput(); - return; - } - QFile::setPermissions(privateKeyFilePath(), - QFile::ReadOwner | QFile::WriteOwner); - - m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done.")); - m_isComplete = true; - emit completeChanged(); - } - - bool saveFile(const QString &filePath, const QByteArray &data) - { - Utils::FileSaver saver(filePath); - saver.write(data); - if (!saver.finalize()) { - QMessageBox::critical(this, tr("Could Not Save Key File"), saver.errorString()); - return false; - } - return true; - } - - void enableInput() - { - m_ui->keyDirPathChooser->setEnabled(true); - m_ui->createKeysButton->setEnabled(true); - m_ui->statusLabel->clear(); - } - - const QScopedPointer<Ui::MaemoDeviceConfigWizardKeyCreationPage> m_ui; - bool m_isComplete; -}; - -class MaemoDeviceConfigWizardKeyDeploymentPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardKeyDeploymentPage(const WizardData &wizardData, - QWidget *parent = 0) - : QWizardPage(parent), - m_ui(new Ui::MaemoDeviceConfigWizardKeyDeploymentPage), - m_wizardData(wizardData), - m_keyDeployer(new MaemoKeyDeployer(this)) - { - m_ui->setupUi(this); - m_instructionTextTemplate = m_ui->instructionLabel->text(); - setTitle(tr("Key Deployment")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - connect(m_ui->deviceAddressLineEdit, SIGNAL(textChanged(QString)), - SLOT(enableOrDisableButton())); - connect(m_ui->passwordLineEdit, SIGNAL(textChanged(QString)), - SLOT(enableOrDisableButton())); - connect(m_ui->deployButton, SIGNAL(clicked()), SLOT(deployKey())); - connect(m_keyDeployer, SIGNAL(error(QString)), - SLOT(handleKeyDeploymentError(QString))); - connect(m_keyDeployer, SIGNAL(finishedSuccessfully()), - SLOT(handleKeyDeploymentSuccess())); - } - - virtual void initializePage() - { - m_isComplete = false; - m_ui->deviceAddressLineEdit->setText(m_wizardData.hostName); - m_ui->instructionLabel->setText(QString(m_instructionTextTemplate) - .replace(QLatin1String("%%%maddev%%%"), - MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion))); - m_ui->passwordLineEdit->clear(); - enableInput(); - } - - virtual bool isComplete() const { return m_isComplete; } - - QString hostAddress() const { - return m_ui->deviceAddressLineEdit->text().trimmed(); - } - -private: - Q_SLOT void enableOrDisableButton() - { - m_ui->deployButton->setEnabled(!hostAddress().isEmpty() - && !password().isEmpty()); - } - - Q_SLOT void deployKey() - { - using namespace Utils; - m_ui->deviceAddressLineEdit->setEnabled(false); - m_ui->passwordLineEdit->setEnabled(false); - m_ui->deployButton->setEnabled(false); - SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); - sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword; - sshParams.host = hostAddress(); - sshParams.port = MaemoDeviceConfig::defaultSshPort(MaemoDeviceConfig::Physical); - sshParams.password = password(); - sshParams.timeout = 30; - sshParams.userName = MaemoDeviceConfig::defaultUser(m_wizardData.osVersion); - m_ui->statusLabel->setText(tr("Deploying... ")); - m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath); - } - - Q_SLOT void handleKeyDeploymentError(const QString &errorMsg) - { - QMessageBox::critical(this, tr("Key Deployment Failure"), errorMsg); - enableInput(); - } - - Q_SLOT void handleKeyDeploymentSuccess() - { - QMessageBox::information(this, tr("Key Deployment Success"), - tr("The key was successfully deployed. You may now close " - "the \"%1\" application and continue.") - .arg(MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion))); - m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done.")); - m_isComplete = true; - emit completeChanged(); - } - - void enableInput() - { - m_ui->deviceAddressLineEdit->setEnabled(true); - m_ui->passwordLineEdit->setEnabled(true); - m_ui->statusLabel->clear(); - enableOrDisableButton(); - } - - QString password() const { - return m_ui->passwordLineEdit->text().trimmed(); - } - - - const QScopedPointer<Ui::MaemoDeviceConfigWizardKeyDeploymentPage> m_ui; - bool m_isComplete; - const WizardData &m_wizardData; - MaemoKeyDeployer * const m_keyDeployer; - QString m_instructionTextTemplate; -}; - -class MaemoDeviceConfigWizardFinalPage : public QWizardPage -{ - Q_OBJECT -public: - MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, - QWidget *parent) - : QWizardPage(parent), - m_infoLabel(new QLabel(this)), - m_wizardData(wizardData) - { - setTitle(tr("Setup Finished")); - setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - m_infoLabel->setWordWrap(true); - QVBoxLayout * const layout = new QVBoxLayout(this); - layout->addWidget(m_infoLabel); - } - - virtual void initializePage() - { - QString infoText; - if (m_wizardData.deviceType == MaemoDeviceConfig::Physical) { - infoText = tr("The new device configuration will now be " - "created and a test procedure will be run to check whether " - "Qt Creator can connect to the device and to provide some " - "information about its features."); - } else { - infoText = tr("The new device configuration will now be created."); - } - m_infoLabel->setText(infoText); - } - -private: - QLabel * const m_infoLabel; - const WizardData &m_wizardData; -}; - -} // anonymous namespace - -struct MaemoDeviceConfigWizardPrivate -{ - MaemoDeviceConfigWizardPrivate(MaemoDeviceConfigurations *devConfigs, - QWidget *parent) - : devConfigs(devConfigs), - startPage(parent), - loginDataPage(wizardData, parent), - previousKeySetupPage(parent), - reuseKeysCheckPage(parent), - keyCreationPage(parent), - keyDeploymentPage(wizardData, parent), - finalPage(wizardData, parent) - { - } - - WizardData wizardData; - MaemoDeviceConfigurations * const devConfigs; - MaemoDeviceConfigWizardStartPage startPage; - MaemoDeviceConfigWizardLoginDataPage loginDataPage; - MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage; - MaemoDeviceConfigWizardReuseKeysCheckPage reuseKeysCheckPage; - MaemoDeviceConfigWizardKeyCreationPage keyCreationPage; - MaemoDeviceConfigWizardKeyDeploymentPage keyDeploymentPage; - MaemoDeviceConfigWizardFinalPage finalPage; -}; - - -MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, - QWidget *parent) - : QWizard(parent), - d(new MaemoDeviceConfigWizardPrivate(devConfigs, this)) -{ - setWindowTitle(tr("New Device Configuration Setup")); - setPage(StartPageId, &d->startPage); - setPage(LoginDataPageId, &d->loginDataPage); - setPage(PreviousKeySetupCheckPageId, &d->previousKeySetupPage); - setPage(ReuseKeysCheckPageId, &d->reuseKeysCheckPage); - setPage(KeyCreationPageId, &d->keyCreationPage); - setPage(KeyDeploymentPageId, &d->keyDeploymentPage); - setPage(FinalPageId, &d->finalPage); - d->finalPage.setCommitPage(true); -} - -MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard() {} - -void MaemoDeviceConfigWizard::createDeviceConfig() -{ - QString name = d->wizardData.configName; - if (d->devConfigs->hasConfig(name)) { - const QString nameTemplate = name + QLatin1String(" (%1)"); - int suffix = 2; - do - name = nameTemplate.arg(QString::number(suffix++)); - while (d->devConfigs->hasConfig(name)); - } - - if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { - if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) { - d->devConfigs->addGenericLinuxConfigurationUsingPassword(name, - d->wizardData.hostName, d->wizardData.userName, - d->wizardData.password); - } else { - d->devConfigs->addGenericLinuxConfigurationUsingKey(name, - d->wizardData.hostName, d->wizardData.userName, - d->wizardData.privateKeyFilePath); - } - } else if (d->wizardData.deviceType == MaemoDeviceConfig::Physical) { - d->devConfigs->addHardwareDeviceConfiguration(name, - d->wizardData.osVersion, d->wizardData.hostName, - d->wizardData.privateKeyFilePath); - } else { - d->devConfigs->addEmulatorDeviceConfiguration(name, - d->wizardData.osVersion); - } -} - -int MaemoDeviceConfigWizard::nextId() const -{ - switch (currentId()) { - case StartPageId: - d->wizardData.configName = d->startPage.configName(); - d->wizardData.osVersion = d->startPage.osVersion(); - d->wizardData.deviceType = d->startPage.deviceType(); - d->wizardData.hostName = d->startPage.hostName(); - - if (d->wizardData.deviceType == MaemoDeviceConfig::Emulator) { - return FinalPageId; - } else if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) { - return LoginDataPageId; - } else { - return PreviousKeySetupCheckPageId; - } - case LoginDataPageId: - d->wizardData.userName = d->loginDataPage.userName(); - d->wizardData.authType = d->loginDataPage.authType(); - if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) - d->wizardData.password = d->loginDataPage.password(); - else - d->wizardData.privateKeyFilePath = d->loginDataPage.privateKeyFilePath(); - return FinalPageId; - case PreviousKeySetupCheckPageId: - if (d->previousKeySetupPage.keyBasedLoginWasSetup()) { - d->wizardData.privateKeyFilePath - = d->previousKeySetupPage.privateKeyFilePath(); - return FinalPageId; - } else { - return ReuseKeysCheckPageId; - } - case ReuseKeysCheckPageId: - if (d->reuseKeysCheckPage.reuseKeys()) { - d->wizardData.privateKeyFilePath - = d->reuseKeysCheckPage.privateKeyFilePath(); - d->wizardData.publicKeyFilePath - = d->reuseKeysCheckPage.publicKeyFilePath(); - return KeyDeploymentPageId; - } else { - return KeyCreationPageId; - } - case KeyCreationPageId: - d->wizardData.privateKeyFilePath - = d->keyCreationPage.privateKeyFilePath(); - d->wizardData.publicKeyFilePath - = d->keyCreationPage.publicKeyFilePath(); - return KeyDeploymentPageId; - case KeyDeploymentPageId: - d->wizardData.hostName = d->keyDeploymentPage.hostAddress(); - return FinalPageId; - case FinalPageId: return -1; - default: - Q_ASSERT(false); - return -1; - } -} - -} // namespace Internal -} // namespace Qt4ProjectManager - -#include "maemodeviceconfigwizard.moc" diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.h deleted file mode 100644 index 1a887ef6d1..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEVICECONFIGWIZARD_H -#define MAEMODEVICECONFIGWIZARD_H - -#include <QtCore/QScopedPointer> -#include <QtGui/QWizard> - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; -class MaemoDeviceConfigurations; -struct MaemoDeviceConfigWizardPrivate; - -class MaemoDeviceConfigWizard : public QWizard -{ - Q_OBJECT -public: - explicit MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs, - QWidget *parent = 0); - ~MaemoDeviceConfigWizard(); - void createDeviceConfig(); - virtual int nextId() const; - -private: - const QScopedPointer<MaemoDeviceConfigWizardPrivate> d; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEVICECONFIGWIZARD_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeycreationpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeycreationpage.ui deleted file mode 100644 index 2d38c79d3f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeycreationpage.ui +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardKeyCreationPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardKeyCreationPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>447</width> - <height>115</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="explanationLabel"> - <property name="text"> - <string>Qt Creator will now generate a new pair of keys. Please enter the directory to save the key files in and then press "Create Keys".</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="directoryLabel"> - <property name="text"> - <string>Directory:</string> - </property> - </widget> - </item> - <item> - <widget class="Utils::PathChooser" name="keyDirPathChooser"/> - </item> - <item> - <widget class="QPushButton" name="createKeysButton"> - <property name="text"> - <string>Create Keys</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="statusLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeydeploymentpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeydeploymentpage.ui deleted file mode 100644 index ec9069fff5..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardkeydeploymentpage.ui +++ /dev/null @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardKeyDeploymentPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardKeyDeploymentPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>470</width> - <height>322</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="instructionLabel"> - <property name="text"> - <string>To deploy the public key to your device, please execute the following steps: -<ul> -<li>Connect the device to your computer (unless you plan to connect via WLAN).</li> -<li>On the device, start the "%%%maddev%%%" application.</li> -<li>In "%%%maddev%%%", configure the device's IP address to the one shown below (or edit the field below to match the address you have configured).</li> -<li>In "%%%maddev%%%", press "Developer Password" and enter it in the field below.</li> -<li>Click "Deploy Key"</li> -</string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="DeviceAddressLabel"> - <property name="text"> - <string>Device address:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLineEdit" name="deviceAddressLineEdit"/> - </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 row="1" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="text"> - <string>Password:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLineEdit" name="passwordLineEdit"/> - </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> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QPushButton" name="deployButton"> - <property name="text"> - <string>Deploy Key</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="statusLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <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> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardlogindatapage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardlogindatapage.ui deleted file mode 100644 index c36cf115b4..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardlogindatapage.ui +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardLoginDataPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardLoginDataPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>423</width> - <height>127</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="userNameLabel"> - <property name="text"> - <string>User name:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLineEdit" name="userNameLineEdit"/> - </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 row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Authentication type:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QRadioButton" name="passwordButton"> - <property name="text"> - <string>Password</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton"> - <property name="text"> - <string>Key</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <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 row="2" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Password:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLineEdit" name="passwordLineEdit"> - <property name="echoMode"> - <enum>QLineEdit::Password</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> - <item row="3" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Private key:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="Utils::PathChooser" name="privateKeyPathChooser"/> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <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> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - <container>1</container> - <slots> - <signal>editingFinished()</signal> - <signal>browsingFinished()</signal> - </slots> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardpreviouskeysetupcheckpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardpreviouskeysetupcheckpage.ui deleted file mode 100644 index 46f20e9e1a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardpreviouskeysetupcheckpage.ui +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardCheckPreviousKeySetupPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardCheckPreviousKeySetupPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>621</width> - <height>121</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="questionLabel"> - <property name="text"> - <string>Has a passwordless (key-based) login already been set up for this device?</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QRadioButton" name="keyWasSetUpButton"> - <property name="text"> - <string>Yes, and the private key is located at</string> - </property> - </widget> - </item> - <item> - <widget class="Utils::PathChooser" name="privateKeyFilePathChooser"/> - </item> - </layout> - </item> - <item> - <widget class="QRadioButton" name="keyWasNotSetUpButton"> - <property name="text"> - <string>No</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>44</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardreusekeyscheckpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardreusekeyscheckpage.ui deleted file mode 100644 index 8332f17a75..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardreusekeyscheckpage.ui +++ /dev/null @@ -1,133 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardReuseKeysCheckPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardReuseKeysCheckPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>574</width> - <height>185</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="questionLabel"> - <property name="text"> - <string>Do wou want to re-use an existing pair of keys or should a new one be created?</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QRadioButton" name="reuseButton"> - <property name="text"> - <string>Re-use existing keys</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="publicKeyFilePathLabel"> - <property name="text"> - <string>File containing the public key:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="privateKeyFilePathLabel"> - <property name="text"> - <string>File containing the private key:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="Utils::PathChooser" name="publicKeyFilePathChooser"/> - </item> - <item row="1" column="1"> - <widget class="Utils::PathChooser" name="privateKeyFilePathChooser"/> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QRadioButton" name="dontReuseButton"> - <property name="text"> - <string>Create new keys</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui deleted file mode 100644 index 443ca96de7..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui +++ /dev/null @@ -1,134 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeviceConfigWizardStartPage</class> - <widget class="QWizardPage" name="MaemoDeviceConfigWizardStartPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>727</width> - <height>132</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="nameLabel"> - <property name="text"> - <string>The name to identify this configuration:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="nameLineEdit"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="maemoVersionLabel"> - <property name="text"> - <string>The system running on the device:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QRadioButton" name="fremantleButton"> - <property name="text"> - <string>Maemo 5 (Fremantle)</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="harmattanButton"> - <property name="text"> - <string>Maemo 6 (Harmattan)</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="meegoButton"> - <property name="text"> - <string>Meego</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="genericLinuxButton"> - <property name="text"> - <string>Generic Linux</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 row="2" column="0"> - <widget class="QLabel" name="typeLabel"> - <property name="text"> - <string>The kind of device:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QRadioButton" name="qemuButton"> - <property name="text"> - <string>Emulator (Qemu)</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="hwButton"> - <property name="text"> - <string>Hardware Device</string> - </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> - <item row="3" column="0"> - <widget class="QLabel" name="hostNameLabel"> - <property name="text"> - <string>The device's host name or IP address:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="hostNameLineEdit"/> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp deleted file mode 100644 index 34ba12aaa6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodeviceenvreader.h" - -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" -#include "maemorunconfiguration.h" - -#include <utils/ssh/sshremoteprocessrunner.h> - -namespace Qt4ProjectManager { - namespace Internal { - -MaemoDeviceEnvReader::MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config) - : QObject(parent) - , m_stop(false) - , m_devConfig(config->deviceConfig()) - , m_runConfig(config) -{ - connect(config, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - this, SLOT(handleCurrentDeviceConfigChanged())); -} - -MaemoDeviceEnvReader::~MaemoDeviceEnvReader() -{ -} - -void MaemoDeviceEnvReader::start() -{ - if (!m_devConfig) - return; - m_stop = false; - if (!m_remoteProcessRunner - || m_remoteProcessRunner->connection()->state() != Utils::SshConnection::Connected - || m_remoteProcessRunner->connection()->connectionParameters() != m_devConfig->sshParameters()) { - m_remoteProcessRunner - = Utils::SshRemoteProcessRunner::create(m_devConfig->sshParameters()); - } - connect(m_remoteProcessRunner.data(), - SIGNAL(connectionError(Utils::SshError)), this, - SLOT(handleConnectionFailure())); - connect(m_remoteProcessRunner.data(), SIGNAL(processClosed(int)), this, - SLOT(remoteProcessFinished(int))); - connect(m_remoteProcessRunner.data(), - SIGNAL(processOutputAvailable(QByteArray)), this, - SLOT(remoteOutput(QByteArray))); - connect(m_remoteProcessRunner.data(), - SIGNAL(processErrorOutputAvailable(QByteArray)), this, - SLOT(remoteErrorOutput(QByteArray))); - const QByteArray remoteCall = MaemoGlobal::remoteSourceProfilesCommand() - .toUtf8() + "; env"; - m_remoteOutput.clear(); - m_remoteProcessRunner->run(remoteCall); -} - -void MaemoDeviceEnvReader::stop() -{ - m_stop = true; - if (m_remoteProcessRunner) - disconnect(m_remoteProcessRunner.data(), 0, this, 0); -} - -void MaemoDeviceEnvReader::handleConnectionFailure() -{ - if (m_stop) - return; - - disconnect(m_remoteProcessRunner.data(), 0, this, 0); - emit error(tr("Connection error: %1") - .arg(m_remoteProcessRunner->connection()->errorString())); - emit finished(); -} - -void MaemoDeviceEnvReader::handleCurrentDeviceConfigChanged() -{ - m_devConfig = m_runConfig->deviceConfig(); - - if (m_remoteProcessRunner) - disconnect(m_remoteProcessRunner.data(), 0, this, 0); - m_env.clear(); - setFinished(); -} - -void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode) -{ - Q_ASSERT(exitCode == Utils::SshRemoteProcess::FailedToStart - || exitCode == Utils::SshRemoteProcess::KilledBySignal - || exitCode == Utils::SshRemoteProcess::ExitedNormally); - - if (m_stop) - return; - - disconnect(m_remoteProcessRunner.data(), 0, this, 0); - m_env.clear(); - if (exitCode == Utils::SshRemoteProcess::ExitedNormally) { - if (!m_remoteOutput.isEmpty()) { - m_env = Utils::Environment(m_remoteOutput.split(QLatin1Char('\n'), - QString::SkipEmptyParts)); - } - } else { - QString errorMsg = tr("Error running remote process: %1") - .arg(m_remoteProcessRunner->process()->errorString()); - if (!m_remoteErrorOutput.isEmpty()) { - errorMsg += tr("\nRemote stderr was: '%1'") - .arg(QString::fromUtf8(m_remoteErrorOutput)); - } - emit error(errorMsg); - } - setFinished(); -} - -void MaemoDeviceEnvReader::remoteOutput(const QByteArray &data) -{ - m_remoteOutput.append(QString::fromUtf8(data)); -} - -void MaemoDeviceEnvReader::remoteErrorOutput(const QByteArray &data) -{ - m_remoteErrorOutput += data; -} - -void MaemoDeviceEnvReader::setFinished() -{ - stop(); - emit finished(); -} - -} // Internal -} // Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h deleted file mode 100644 index 57faa1ac26..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef DEVICEENVREADER_H -#define DEVICEENVREADER_H - -#include <utils/environment.h> - -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> - -namespace Utils { - class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeviceConfig; -class MaemoRunConfiguration; - -class MaemoDeviceEnvReader : public QObject -{ - Q_OBJECT -public: - MaemoDeviceEnvReader(QObject *parent, MaemoRunConfiguration *config); - ~MaemoDeviceEnvReader(); - - void start(); - void stop(); - - Utils::Environment deviceEnvironment() const { return m_env; } - -signals: - void finished(); - void error(const QString &error); - -private slots: - void handleConnectionFailure(); - void handleCurrentDeviceConfigChanged(); - - void remoteProcessFinished(int exitCode); - void remoteOutput(const QByteArray &data); - void remoteErrorOutput(const QByteArray &data); - -private: - void setFinished(); - - bool m_stop; - QString m_remoteOutput; - QByteArray m_remoteErrorOutput; - Utils::Environment m_env; - QSharedPointer<const MaemoDeviceConfig> m_devConfig; - MaemoRunConfiguration *m_runConfig; - QSharedPointer<Utils::SshRemoteProcessRunner> m_remoteProcessRunner; -}; - - } // Internal -} // Qt4ProjectManager - -#endif // DEVICEENVREADER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.cpp deleted file mode 100644 index c6da541390..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemodirectdeviceuploadstep.h" - -#include "maemodeployable.h" -#include "maemoglobal.h" -#include "qt4maemodeployconfiguration.h" - -#include <utils/ssh/sftpchannel.h> -#include <utils/ssh/sshremoteprocess.h> - -#include <QtCore/QDir> -#include <QtCore/QFileInfo> - -#define ASSERT_BASE_STATE(state) ASSERT_STATE_GENERIC(BaseState, state, baseState()) -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(ExtendedState, state, m_extendedState) - -using namespace ProjectExplorer; -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDirectDeviceUploadStep::MaemoDirectDeviceUploadStep(BuildStepList *parent) - : AbstractMaemoDeployStep(parent, Id) -{ - ctor(); -} - -MaemoDirectDeviceUploadStep::MaemoDirectDeviceUploadStep(BuildStepList *parent, - MaemoDirectDeviceUploadStep *other) - : AbstractMaemoDeployStep(parent, other) -{ - ctor(); -} - -MaemoDirectDeviceUploadStep::~MaemoDirectDeviceUploadStep() {} - - -void MaemoDirectDeviceUploadStep::ctor() -{ - setDefaultDisplayName(DisplayName); - m_extendedState = Inactive; -} - -bool MaemoDirectDeviceUploadStep::isDeploymentPossibleInternal(QString &whyNot) const -{ - Q_UNUSED(whyNot); - return true; -} - -bool MaemoDirectDeviceUploadStep::isDeploymentNeeded(const QString &hostName) const -{ - m_filesToUpload.clear(); - const QSharedPointer<MaemoDeployables> deployables - = maemoDeployConfig()->deployables(); - const int deployableCount = deployables->deployableCount(); - for (int i = 0; i < deployableCount; ++i) - checkDeploymentNeeded(hostName, deployables->deployableAt(i)); - return !m_filesToUpload.isEmpty(); -} - -void MaemoDirectDeviceUploadStep::checkDeploymentNeeded(const QString &hostName, - const MaemoDeployable &deployable) const -{ - QFileInfo fileInfo(deployable.localFilePath); - if (fileInfo.isDir()) { - const QStringList files = QDir(deployable.localFilePath) - .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); - if (files.isEmpty() && currentlyNeedsDeployment(hostName, deployable)) - m_filesToUpload << deployable; - foreach (const QString &fileName, files) { - const QString localFilePath = deployable.localFilePath - + QLatin1Char('/') + fileName; - const QString remoteDir = deployable.remoteDir + QLatin1Char('/') - + fileInfo.fileName(); - checkDeploymentNeeded(hostName, - MaemoDeployable(localFilePath, remoteDir)); - } - } else if (currentlyNeedsDeployment(hostName, deployable)) { - m_filesToUpload << deployable; - } -} - - -void MaemoDirectDeviceUploadStep::startInternal() -{ - Q_ASSERT(m_extendedState == Inactive); - - m_uploader = connection()->createSftpChannel(); - connect(m_uploader.data(), SIGNAL(initialized()), - SLOT(handleSftpInitialized())); - connect(m_uploader.data(), SIGNAL(initializationFailed(QString)), - SLOT(handleSftpInitializationFailed(QString))); - m_uploader->initialize(); - m_extendedState = InitializingSftp; -} - -void MaemoDirectDeviceUploadStep::handleSftpInitializationFailed(const QString &errorMessage) -{ - ASSERT_STATE(QList<ExtendedState>() << Inactive << InitializingSftp); - - if (m_extendedState == InitializingSftp) { - raiseError(tr("SFTP initialization failed: %1").arg(errorMessage)); - setFinished(); - } -} - -void MaemoDirectDeviceUploadStep::handleSftpInitialized() -{ - ASSERT_STATE(QList<ExtendedState>() << Inactive << InitializingSftp); - if (m_extendedState == InitializingSftp) { - Q_ASSERT(!m_filesToUpload.isEmpty()); - connect(m_uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)), - SLOT(handleUploadFinished(Utils::SftpJobId,QString))); - uploadNextFile(); - } -} - -void MaemoDirectDeviceUploadStep::uploadNextFile() -{ - if (m_filesToUpload.isEmpty()) { - writeOutput(tr("All files successfully deployed.")); - setFinished(); - return; - } - - const MaemoDeployable &d = m_filesToUpload.first(); - QString dirToCreate = d.remoteDir; - QFileInfo fi(d.localFilePath); - if (fi.isDir()) - dirToCreate += QLatin1Char('/') + fi.fileName(); - const QByteArray command = "mkdir -p " + dirToCreate.toUtf8(); - m_mkdirProc = connection()->createRemoteProcess(command); - connect(m_mkdirProc.data(), SIGNAL(closed(int)), - SLOT(handleMkdirFinished(int))); - // TODO: Connect stderr. - writeOutput(tr("Uploading file '%1'...") - .arg(QDir::toNativeSeparators(d.localFilePath))); - m_mkdirProc->start(); - m_extendedState = Uploading; -} - -void MaemoDirectDeviceUploadStep::handleMkdirFinished(int exitStatus) -{ - ASSERT_STATE(QList<ExtendedState>() << Inactive << Uploading); - if (m_extendedState == Inactive) - return; - - const MaemoDeployable &d = m_filesToUpload.first(); - QFileInfo fi(d.localFilePath); - const QString nativePath = QDir::toNativeSeparators(d.localFilePath); - if (exitStatus != SshRemoteProcess::ExitedNormally - || m_mkdirProc->exitCode() != 0) { - raiseError(tr("Failed to upload file '%1'.").arg(nativePath)); - setFinished(); - } else if (fi.isDir()) { - setDeployed(helper().cachedDeviceConfig()->sshParameters().host, d); - m_filesToUpload.removeFirst(); - uploadNextFile(); - } else { - const SftpJobId job = m_uploader->uploadFile(d.localFilePath, - d.remoteDir + QLatin1Char('/') + fi.fileName(), - SftpOverwriteExisting); - if (job == SftpInvalidJob) { - raiseError(tr("Failed to upload file '%1': " - "Could not open for reading.").arg(nativePath)); - setFinished(); - } - } -} - -void MaemoDirectDeviceUploadStep::handleUploadFinished(Utils::SftpJobId jobId, - const QString &errorMsg) -{ - Q_UNUSED(jobId); - - ASSERT_STATE(QList<ExtendedState>() << Inactive << Uploading); - if (m_extendedState == Inactive) - return; - - const MaemoDeployable d = m_filesToUpload.takeFirst(); - if (!errorMsg.isEmpty()) { - raiseError(tr("Upload of file '%1' failed: %2") - .arg(QDir::toNativeSeparators(d.localFilePath), errorMsg)); - setFinished(); - } else { - setDeployed(connection()->connectionParameters().host, d); - uploadNextFile(); - } -} - -void MaemoDirectDeviceUploadStep::stopInternal() -{ - ASSERT_BASE_STATE(StopRequested); - ASSERT_STATE(QList<ExtendedState>() << InitializingSftp << Uploading); - - setFinished(); -} - -void MaemoDirectDeviceUploadStep::setFinished() -{ - m_extendedState = Inactive; - if (m_mkdirProc) { - disconnect(m_mkdirProc.data(), 0, this, 0); - } - if (m_uploader) { - disconnect(m_uploader.data(), 0, this, 0); - m_uploader->closeChannel(); - } - setDeploymentFinished(); -} - -const QString MaemoDirectDeviceUploadStep::Id("MaemoDirectDeviceUploadStep"); -const QString MaemoDirectDeviceUploadStep::DisplayName - = tr("Upload files via SFTP"); - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.h deleted file mode 100644 index 28e7391702..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodirectdeviceuploadstep.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODIRECTDEVICEUPLOADSTEP_H -#define MAEMODIRECTDEVICEUPLOADSTEP_H - -#include "abstractmaemodeploystep.h" - -#include <utils/ssh/sftpdefs.h> - -#include <QtCore/QList> -#include <QtCore/QSharedPointer> - -namespace Utils { -class SshRemoteProcess; -class SftpChannel; -} - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeployable; - -class MaemoDirectDeviceUploadStep : public AbstractMaemoDeployStep -{ - Q_OBJECT -public: - MaemoDirectDeviceUploadStep(ProjectExplorer::BuildStepList *bc); - MaemoDirectDeviceUploadStep(ProjectExplorer::BuildStepList *bc, - MaemoDirectDeviceUploadStep *other); - ~MaemoDirectDeviceUploadStep(); - - static const QString Id; - static const QString DisplayName; - -private slots: - void handleSftpInitialized(); - void handleSftpInitializationFailed(const QString &errorMessage); - void handleUploadFinished(Utils::SftpJobId jobId, const QString &errorMsg); - void handleMkdirFinished(int exitStatus); - -private: - enum ExtendedState { Inactive, InitializingSftp, Uploading }; - - virtual bool isDeploymentPossibleInternal(QString &whynot) const; - virtual bool isDeploymentNeeded(const QString &hostName) const; - virtual void startInternal(); - virtual void stopInternal(); - virtual const AbstractMaemoPackageCreationStep *packagingStep() const { return 0; } - - void ctor(); - void setFinished(); - void checkDeploymentNeeded(const QString &hostName, - const MaemoDeployable &deployable) const; - void uploadNextFile(); - - QSharedPointer<Utils::SftpChannel> m_uploader; - QSharedPointer<Utils::SshRemoteProcess> m_mkdirProc; - mutable QList<MaemoDeployable> m_filesToUpload; - ExtendedState m_extendedState; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODIRECTDEVICEUPLOADSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp deleted file mode 100644 index b304e946e6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemoglobal.h" - -#include "maemoconstants.h" -#include "maemoqemumanager.h" - -#include <projectexplorer/projectexplorerconstants.h> - -#include <coreplugin/filemanager.h> -#include <utils/ssh/sshconnection.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <qtsupport/qtversionmanager.h> -#include <qt4projectmanager/qt4target.h> -#include <utils/environment.h> - -#include <QtCore/QDateTime> -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtCore/QProcess> -#include <QtCore/QString> -#include <QtGui/QDesktopServices> - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX); -} - -bool MaemoGlobal::isMaemoTargetId(const QString &id) -{ - return isFremantleTargetId(id) || isHarmattanTargetId(id) - || isMeegoTargetId(id); -} - -bool MaemoGlobal::isFremantleTargetId(const QString &id) -{ - return id == QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID); -} - -bool MaemoGlobal::isHarmattanTargetId(const QString &id) -{ - return id == QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID); -} - -bool MaemoGlobal::isMeegoTargetId(const QString &id) -{ - return id == QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID); -} - -bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath) -{ - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo5); -} - -bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath) -{ - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Maemo6); -} - -bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath) -{ - return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Meego); -} - -bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion) -{ - if (!qtVersion) - return false; - const QList<ProjectExplorer::Abi> &abis = qtVersion->qtAbis(); - foreach (const ProjectExplorer::Abi &abi, abis) { - if (abi.os() == ProjectExplorer::Abi::LinuxOS) - return true; - } - return false; -} - -bool MaemoGlobal::hasLinuxQt(const ProjectExplorer::Target *target) -{ - const Qt4BaseTarget * const qtTarget - = qobject_cast<const Qt4BaseTarget *>(target); - if (!qtTarget) - return false; - const Qt4BuildConfiguration * const bc - = qtTarget->activeBuildConfiguration(); - return bc && isLinuxQt(bc->qtVersion()); -} - -bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, - MaemoDeviceConfig::OsVersion maemoVersion) -{ - if (version(qmakePath) != maemoVersion) - return false; - QProcess madAdminProc; - const QStringList arguments(QLatin1String("list")); - if (!callMadAdmin(madAdminProc, arguments, qmakePath, false)) - return false; - if (!madAdminProc.waitForStarted() || !madAdminProc.waitForFinished()) - return false; - - madAdminProc.setReadChannel(QProcess::StandardOutput); - const QByteArray tgtName = targetName(qmakePath).toAscii(); - while (madAdminProc.canReadLine()) { - const QByteArray &line = madAdminProc.readLine(); - if (line.contains(tgtName) - && (line.contains("(installed)") || line.contains("(default)"))) - return true; - } - return false; -} - - -QString MaemoGlobal::homeDirOnDevice(const QString &uname) -{ - return uname == QLatin1String("root") - ? QString::fromLatin1("/root") - : QLatin1String("/home/") + uname; -} - -QString MaemoGlobal::devrootshPath() -{ - return QLatin1String("/usr/lib/mad-developer/devrootsh"); -} - -int MaemoGlobal::applicationIconSize(MaemoDeviceConfig::OsVersion osVersion) -{ - return osVersion == MaemoDeviceConfig::Maemo6 ? 80 : 64; -} - -QString MaemoGlobal::remoteSudo(MaemoDeviceConfig::OsVersion osVersion, - const QString &uname) -{ - if (uname == QLatin1String("root")) - return QString(); - switch (osVersion) { - case MaemoDeviceConfig::Maemo5: - case MaemoDeviceConfig::Maemo6: - case MaemoDeviceConfig::Meego: - return devrootshPath(); - default: - return QString(); // Using sudo would open a can of worms. - } -} - -QString MaemoGlobal::remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion, - const QString &userName, const QString &commandFilePath) -{ - QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ") - .arg(remoteSudo(osVersion, userName), commandFilePath, remoteSourceProfilesCommand()); - if (osVersion != MaemoDeviceConfig::Maemo5 && osVersion != MaemoDeviceConfig::Maemo6) - prefix += QLatin1String("DISPLAY=:0.0 "); - return prefix; -} - -QString MaemoGlobal::remoteSourceProfilesCommand() -{ - const QList<QByteArray> profiles = QList<QByteArray>() << "/etc/profile" - << "/home/user/.profile" << "~/.profile"; - QByteArray remoteCall(":"); - foreach (const QByteArray &profile, profiles) - remoteCall += "; test -f " + profile + " && source " + profile; - return QString::fromAscii(remoteCall); -} - -QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list) -{ - QString env; - QString placeHolder = QLatin1String("%1=%2 "); - foreach (const Utils::EnvironmentItem &item, list) - env.append(placeHolder.arg(item.name).arg(item.value)); - return env.mid(0, env.size() - 1); -} - -QString MaemoGlobal::failedToConnectToServerMessage(const Utils::SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &deviceConfig) -{ - QString errorMsg = tr("Could not connect to host: %1") - .arg(connection->errorString()); - - if (deviceConfig->type() == MaemoDeviceConfig::Emulator) { - if (connection->errorState() == Utils::SshTimeoutError - || connection->errorState() == Utils::SshSocketError) { - errorMsg += tr("\nDid you start Qemu?"); - } - } else if (connection->errorState() == Utils::SshTimeoutError) { - errorMsg += tr("\nIs the device connected and set up for network access?"); - } - return errorMsg; -} - -QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &devConf) -{ - return devConf ? devConf->name() : tr("(No device)"); -} - -MaemoPortList MaemoGlobal::freePorts(const MaemoDeviceConfig::ConstPtr &devConf, - const QtSupport::BaseQtVersion *qtVersion) -{ - if (!devConf || !qtVersion) - return MaemoPortList(); - if (devConf->type() == MaemoDeviceConfig::Emulator) { - MaemoQemuRuntime rt; - const int id = qtVersion->uniqueId(); - if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt)) - return rt.m_freePorts; - } - return devConf->freePorts(); -} - -QString MaemoGlobal::maddeRoot(const QString &qmakePath) -{ - QDir dir(targetRoot(qmakePath)); - dir.cdUp(); dir.cdUp(); - return dir.absolutePath(); -} - -QString MaemoGlobal::targetRoot(const QString &qmakePath) -{ - return QDir::cleanPath(qmakePath).remove(binQmake); -} - -QString MaemoGlobal::targetName(const QString &qmakePath) -{ - return QDir(targetRoot(qmakePath)).dirName(); -} - -QString MaemoGlobal::madAdminCommand(const QString &qmakePath) -{ - return maddeRoot(qmakePath) + QLatin1String("/bin/mad-admin"); -} - -QString MaemoGlobal::madCommand(const QString &qmakePath) -{ - return maddeRoot(qmakePath) + QLatin1String("/bin/mad"); -} - -QString MaemoGlobal::madDeveloperUiName(MaemoDeviceConfig::OsVersion osVersion) -{ - return osVersion == MaemoDeviceConfig::Maemo6 - ? tr("SDK Connectivity") : tr("Mad Developer"); -} - -MaemoDeviceConfig::OsVersion MaemoGlobal::version(const QString &qmakePath) -{ - const QString &name = targetName(qmakePath); - if (name.startsWith(QLatin1String("fremantle"))) - return MaemoDeviceConfig::Maemo5; - if (name.startsWith(QLatin1String("harmattan"))) - return MaemoDeviceConfig::Maemo6; - if (name.startsWith(QLatin1String("meego"))) - return MaemoDeviceConfig::Meego; - return MaemoDeviceConfig::GenericLinux; -} - -QString MaemoGlobal::architecture(const QString &qmakePath) -{ - QProcess proc; - const QStringList args = QStringList() << QLatin1String("uname") - << QLatin1String("-m"); - if (!callMad(proc, args, qmakePath, true)) - return QString(); - if (!proc.waitForFinished()) - return QString(); - QString arch = QString::fromUtf8(proc.readAllStandardOutput()); - arch.chop(1); // Newline - return arch; -} - -bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error) -{ - error.clear(); - QFileInfo fileInfo(filePath); - if (!fileInfo.exists()) - return true; - QFile::setPermissions(filePath, fileInfo.permissions() | QFile::WriteUser); - if (fileInfo.isDir()) { - QDir dir(filePath); - QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden - | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &fileName, fileNames) { - if (!removeRecursively(filePath + QLatin1Char('/') + fileName, error)) - return false; - } - dir.cdUp(); - if (!dir.rmdir(fileInfo.fileName())) { - error = tr("Failed to remove directory '%1'.") - .arg(QDir::toNativeSeparators(filePath)); - return false; - } - } else { - if (!QFile::remove(filePath)) { - error = tr("Failed to remove file '%1'.") - .arg(QDir::toNativeSeparators(filePath)); - return false; - } - } - return true; -} - -bool MaemoGlobal::copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath, QString *error) -{ - QFileInfo srcFileInfo(srcFilePath); - if (srcFileInfo.isDir()) { - QDir targetDir(tgtFilePath); - targetDir.cdUp(); - if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) { - if (error) { - *error = tr("Failed to create directory '%1'.") - .arg(QDir::toNativeSeparators(tgtFilePath)); - return false; - } - } - QDir sourceDir(srcFilePath); - QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &fileName, fileNames) { - const QString newSrcFilePath - = srcFilePath + QLatin1Char('/') + fileName; - const QString newTgtFilePath - = tgtFilePath + QLatin1Char('/') + fileName; - if (!copyRecursively(newSrcFilePath, newTgtFilePath)) - return false; - } - } else { - if (!QFile::copy(srcFilePath, tgtFilePath)) { - if (error) { - *error = tr("Could not copy file '%1' to '%2'.") - .arg(QDir::toNativeSeparators(srcFilePath), - QDir::toNativeSeparators(tgtFilePath)); - } - return false; - } - } - return true; -} - -bool MaemoGlobal::isFileNewerThan(const QString &filePath, - const QDateTime &timeStamp) -{ - QFileInfo fileInfo(filePath); - if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp) - return true; - if (fileInfo.isDir()) { - const QStringList dirContents = QDir(filePath) - .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &curFileName, dirContents) { - const QString curFilePath - = filePath + QLatin1Char('/') + curFileName; - if (isFileNewerThan(curFilePath, timeStamp)) - return true; - } - } - return false; -} - -bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args, - const QString &qmakePath, bool useTarget) -{ - return callMaddeShellScript(proc, qmakePath, madCommand(qmakePath), args, - useTarget); -} - -bool MaemoGlobal::callMadAdmin(QProcess &proc, const QStringList &args, - const QString &qmakePath, bool useTarget) -{ - return callMaddeShellScript(proc, qmakePath, madAdminCommand(qmakePath), - args, useTarget); -} - -bool MaemoGlobal::callMaddeShellScript(QProcess &proc, - const QString &qmakePath, const QString &command, const QStringList &args, - bool useTarget) -{ - if (!QFileInfo(command).exists()) - return false; - QString actualCommand = command; - QStringList actualArgs = targetArgs(qmakePath, useTarget) + args; -#ifdef Q_OS_WIN - Utils::Environment env(proc.systemEnvironment()); - const QString root = maddeRoot(qmakePath); - env.prependOrSetPath(root + QLatin1String("/bin")); - env.prependOrSet(QLatin1String("HOME"), - QDesktopServices::storageLocation(QDesktopServices::HomeLocation)); - proc.setEnvironment(env.toStringList()); - actualArgs.prepend(command); - actualCommand = root + QLatin1String("/bin/sh.exe"); -#endif - proc.start(actualCommand, actualArgs); - return true; -} - -QStringList MaemoGlobal::targetArgs(const QString &qmakePath, bool useTarget) -{ - QStringList args; - if (useTarget) { - args << QLatin1String("-t") << targetName(qmakePath); - } - return args; -} - -QString MaemoGlobal::osVersionToString(MaemoDeviceConfig::OsVersion version) -{ - switch (version) { - case MaemoDeviceConfig::Maemo5: return QLatin1String("Maemo5/Fremantle"); - case MaemoDeviceConfig::Maemo6: return QLatin1String("Harmattan"); - case MaemoDeviceConfig::Meego: return QLatin1String("Meego"); - case MaemoDeviceConfig::GenericLinux: return QLatin1String("Other Linux"); - } - qDebug("%s: Unknown OS Version %d.", Q_FUNC_INFO, version); - return QString(); -} - -MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoDeviceConfig::OsVersion osVersion) -{ - switch (osVersion) { - case MaemoDeviceConfig::Maemo5: case MaemoDeviceConfig::Maemo6: return Dpkg; - case MaemoDeviceConfig::Meego: return Rpm; - case MaemoDeviceConfig::GenericLinux: return Tar; - default: qFatal("%s: Missing case in switch.", Q_FUNC_INFO); - } - return static_cast<PackagingSystem>(-1); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h deleted file mode 100644 index b22c8d8efc..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOGLOBAL_H -#define MAEMOGLOBAL_H - -#include "maemodeviceconfigurations.h" - -#include <coreplugin/ifile.h> -#include <utils/environment.h> - -#include <projectexplorer/buildstep.h> -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/deployconfiguration.h> - -#include <QtCore/QList> -#include <QtCore/QSharedPointer> -#include <QtCore/QCoreApplication> - -#define ASSERT_STATE_GENERIC(State, expected, actual) \ - MaemoGlobal::assertState<State>(expected, actual, Q_FUNC_INFO) - -QT_BEGIN_NAMESPACE -class QDateTime; -class QProcess; -class QString; -QT_END_NAMESPACE - -namespace Utils { class SshConnection; } -namespace QtSupport { -class BaseQtVersion; -} -namespace Qt4ProjectManager { -namespace Internal { - -class WatchableFile : public Core::IFile -{ - Q_OBJECT -public: - WatchableFile(const QString &fileName, QObject *parent = 0) - : Core::IFile(parent), m_fileName(fileName) {} - - bool save(QString *, const QString &, bool) { return false; } - QString fileName() const { return m_fileName; } - QString defaultPath() const { return QString(); } - QString suggestedFileName() const { return QString(); } - QString mimeType() const { return QLatin1String("text/plain"); } - bool isModified() const { return false; } - bool isReadOnly() const { return false; } - bool isSaveAsAllowed() const { return false; } - ReloadBehavior reloadBehavior(ChangeTrigger, ChangeType) const { return BehaviorSilent; } - bool reload(QString *, ReloadFlag, ChangeType) { emit modified(); return true; } - void rename(const QString &) {} - -signals: - void modified(); - -private: - QString m_fileName; -}; - -class MaemoGlobal -{ - Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal) -public: - enum PackagingSystem { Dpkg, Rpm, Tar }; - - static bool isMaemoTargetId(const QString &id); - static bool isFremantleTargetId(const QString &id); - static bool isHarmattanTargetId(const QString &id); - static bool isMeegoTargetId(const QString &id); - static bool isValidMaemo5QtVersion(const QString &qmakePath); - static bool isValidHarmattanQtVersion(const QString &qmakePath); - static bool isValidMeegoQtVersion(const QString &qmakePath); - - static bool isLinuxQt(const QtSupport::BaseQtVersion *qtVersion); - static bool hasLinuxQt(const ProjectExplorer::Target *target); - - static QString homeDirOnDevice(const QString &uname); - static QString devrootshPath(); - static int applicationIconSize(MaemoDeviceConfig::OsVersion osVersion); - static QString remoteSudo(MaemoDeviceConfig::OsVersion, - const QString &uname); - static QString remoteCommandPrefix(MaemoDeviceConfig::OsVersion osVersion, - const QString &userName, const QString &commandFilePath); - static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list); - static QString remoteSourceProfilesCommand(); - static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &deviceConfig); - static QString deviceConfigurationName(const QSharedPointer<const MaemoDeviceConfig> &devConf); - static MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConf, - const QtSupport::BaseQtVersion *qtVersion); - - static QString maddeRoot(const QString &qmakePath); - static QString targetRoot(const QString &qmakePath); - static QString targetName(const QString &qmakePath); - static QString madCommand(const QString &qmakePath); - static QString madDeveloperUiName(MaemoDeviceConfig::OsVersion maemoVersion); - static MaemoDeviceConfig::OsVersion version(const QString &qmakePath); - - // TODO: IS this still needed with Qt Version having an Abi? - static QString architecture(const QString &qmakePath); - - static bool callMad(QProcess &proc, const QStringList &args, - const QString &qmakePath, bool useTarget); - static bool callMadAdmin(QProcess &proc, const QStringList &args, - const QString &qmakePath, bool useTarget); - - static QString osVersionToString(MaemoDeviceConfig::OsVersion version); - - static PackagingSystem packagingSystem(MaemoDeviceConfig::OsVersion osVersion); - - static bool removeRecursively(const QString &filePath, QString &error); - static bool copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath, QString *error = 0); - - static bool isFileNewerThan(const QString &filePath, - const QDateTime &timeStamp); - - template<class T> static T *earlierBuildStep(const ProjectExplorer::DeployConfiguration *dc, - const ProjectExplorer::BuildStep *laterBuildStep) - { - if (!dc) - return 0; - const ProjectExplorer::BuildStepList * const bsl = dc->stepList(); - const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps(); - for (int i = 0; i < buildSteps.count(); ++i) { - if (buildSteps.at(i) == laterBuildStep) - return 0; - if (T * const step = dynamic_cast<T *>(buildSteps.at(i))) - return step; - } - return 0; - } - - template<typename State> static void assertState(State expected, - State actual, const char *func) - { - assertState(QList<State>() << expected, actual, func); - } - - template<typename State> static void assertState(const QList<State> &expected, - State actual, const char *func) - { - if (!expected.contains(actual)) { - qWarning("Warning: Unexpected state %d in function %s.", - actual, func); - } - } - - static bool isValidMaemoQtVersion(const QString &qmakePath, - MaemoDeviceConfig::OsVersion maemoVersion); -private: - static QString madAdminCommand(const QString &qmakePath); - static bool callMaddeShellScript(QProcess &proc, const QString &qmakePath, - const QString &command, const QStringList &args, bool useTarget); - static QStringList targetArgs(const QString &qmakePath, bool useTarget); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOGLOBAL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp deleted file mode 100644 index c4b31f67dd..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoinstalltosysrootstep.h" - -#include "maemodeployables.h" -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemotoolchain.h" -#include "qt4maemodeployconfiguration.h" - -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4target.h> -#include <qtsupport/baseqtversion.h> - -#include <QtCore/QLatin1Char> -#include <QtCore/QProcess> -#include <QtCore/QWeakPointer> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -class AbstractMaemoInstallPackageToSysrootWidget : public BuildStepConfigWidget -{ - Q_OBJECT -public: - AbstractMaemoInstallPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step) - : m_step(step) {} - - virtual void init() - { - BuildStepList * const list - = qobject_cast<BuildStepList *>(m_step->parent()); - connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary())); - connect(list, SIGNAL(aboutToRemoveStep(int)), SLOT(handleStepToBeRemoved(int))); - connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary())); - } - - virtual QString summaryText() const - { - if (!MaemoGlobal::earlierBuildStep<AbstractMaemoPackageCreationStep>(m_step->deployConfiguration(), m_step)) { - return QLatin1String("<font color=\"red\">") - + tr("Cannot deploy to sysroot: No packaging step found.") - + QLatin1String("</font>"); - } - return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); - } - -private: - Q_SLOT void handleStepToBeRemoved(int step) - { - BuildStepList * const list - = qobject_cast<BuildStepList *>(m_step->parent()); - if (list->steps().at(step) == m_step) - disconnect(list, 0, this, 0); - } - - const AbstractMaemoInstallPackageToSysrootStep * const m_step; -}; - - -class MaemoInstallDebianPackageToSysrootWidget : public AbstractMaemoInstallPackageToSysrootWidget -{ - Q_OBJECT -public: - MaemoInstallDebianPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step) - : AbstractMaemoInstallPackageToSysrootWidget(step) {} - - virtual QString displayName() const { return MaemoInstallDebianPackageToSysrootStep::DisplayName; } -}; - -class MaemoInstallRpmPackageToSysrootWidget : public AbstractMaemoInstallPackageToSysrootWidget -{ - Q_OBJECT -public: - MaemoInstallRpmPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step) - : AbstractMaemoInstallPackageToSysrootWidget(step) {} - - virtual QString displayName() const { return MaemoInstallRpmPackageToSysrootStep::DisplayName; } -}; - -class MaemoCopyFilesToSysrootWidget : public BuildStepConfigWidget -{ - Q_OBJECT -public: - MaemoCopyFilesToSysrootWidget(const BuildStep *buildStep) - : m_buildStep(buildStep) {} - - virtual void init() - { - if (m_buildStep) { - connect(m_buildStep.data(), SIGNAL(displayNameChanged()), - SIGNAL(updateSummary())); - } - } - virtual QString summaryText() const { - return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); } - virtual QString displayName() const { - return m_buildStep ? m_buildStep.data()->displayName() : QString(); - } -private: - const QWeakPointer<const BuildStep> m_buildStep; -}; - - -AbstractMaemoInstallPackageToSysrootStep::AbstractMaemoInstallPackageToSysrootStep(BuildStepList *bsl, - const QString &id) - : BuildStep(bsl, id) -{ -} - -AbstractMaemoInstallPackageToSysrootStep::AbstractMaemoInstallPackageToSysrootStep(BuildStepList *bsl, - AbstractMaemoInstallPackageToSysrootStep *other) - : BuildStep(bsl, other) -{ -} - -void AbstractMaemoInstallPackageToSysrootStep::run(QFutureInterface<bool> &fi) -{ - const Qt4BuildConfiguration * const bc - = qobject_cast<Qt4BaseTarget *>(target())->activeBuildConfiguration(); - if (!bc) { - addOutput(tr("Can't install to sysroot without build configuration."), - ErrorMessageOutput); - fi.reportResult(false); - return; - } - - const AbstractMaemoPackageCreationStep * const pStep - = MaemoGlobal::earlierBuildStep<AbstractMaemoPackageCreationStep>(deployConfiguration(), this); - if (!pStep) { - addOutput(tr("Can't install package to sysroot without packaging step."), - ErrorMessageOutput); - fi.reportResult(false); - return; - } - - if (!bc->qtVersion()) { - addOutput(tr("Can't install package to sysroot without a qt version."), - ErrorMessageOutput); - fi.reportResult(false); - return; - } - - m_installerProcess = new QProcess; - connect(m_installerProcess, SIGNAL(readyReadStandardOutput()), - SLOT(handleInstallerStdout())); - connect(m_installerProcess, SIGNAL(readyReadStandardError()), - SLOT(handleInstallerStderr())); - - emit addOutput(tr("Installing package to sysroot ..."), MessageOutput); - const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion(); - const QString packageFilePath = pStep->packageFilePath(); - const int packageFileSize = QFileInfo(packageFilePath).size() / (1024*1024); - const QStringList args = madArguments() << packageFilePath; - MaemoGlobal::callMadAdmin(*m_installerProcess, args, qtVersion->qmakeCommand(), true); - if (!m_installerProcess->waitForFinished((2*packageFileSize + 10)*1000) - || m_installerProcess->exitStatus() != QProcess::NormalExit - || m_installerProcess->exitCode() != 0) { - emit addOutput(tr("Installation to sysroot failed, continuing anyway."), - ErrorMessageOutput); - if (m_installerProcess->state() != QProcess::NotRunning) { - m_installerProcess->terminate(); - m_installerProcess->waitForFinished(); - m_installerProcess->kill(); - } - fi.reportResult(true); - return; - } - - fi.reportResult(true); - m_installerProcess->deleteLater(); - m_installerProcess = 0; -} - -void AbstractMaemoInstallPackageToSysrootStep::handleInstallerStdout() -{ - if (m_installerProcess) - emit addOutput(QString::fromLocal8Bit(m_installerProcess->readAllStandardOutput()), NormalOutput); -} - -void AbstractMaemoInstallPackageToSysrootStep::handleInstallerStderr() -{ - if (m_installerProcess) - emit addOutput(QString::fromLocal8Bit(m_installerProcess->readAllStandardError()), ErrorOutput); -} - - -MaemoInstallDebianPackageToSysrootStep::MaemoInstallDebianPackageToSysrootStep(BuildStepList *bsl) - : AbstractMaemoInstallPackageToSysrootStep(bsl, Id) -{ - setDisplayName(DisplayName); -} - -MaemoInstallDebianPackageToSysrootStep::MaemoInstallDebianPackageToSysrootStep(BuildStepList *bsl, - MaemoInstallDebianPackageToSysrootStep *other) - : AbstractMaemoInstallPackageToSysrootStep(bsl, other) -{ - setDisplayName(DisplayName); -} - -BuildStepConfigWidget *MaemoInstallDebianPackageToSysrootStep::createConfigWidget() -{ - return new MaemoInstallDebianPackageToSysrootWidget(this); -} - - -QStringList MaemoInstallDebianPackageToSysrootStep::madArguments() const -{ - return QStringList() << QLatin1String("xdpkg") << QLatin1String("-i") - << QLatin1String("--no-force-downgrade"); -} - -const QString MaemoInstallDebianPackageToSysrootStep::Id - = QLatin1String("MaemoInstallDebianPackageToSysrootStep"); -const QString MaemoInstallDebianPackageToSysrootStep::DisplayName - = tr("Install Debian package to sysroot"); - -MaemoInstallRpmPackageToSysrootStep::MaemoInstallRpmPackageToSysrootStep(BuildStepList *bsl) - : AbstractMaemoInstallPackageToSysrootStep(bsl, Id) -{ - setDisplayName(DisplayName); -} - -MaemoInstallRpmPackageToSysrootStep::MaemoInstallRpmPackageToSysrootStep(BuildStepList *bsl, - MaemoInstallRpmPackageToSysrootStep *other) - : AbstractMaemoInstallPackageToSysrootStep(bsl, other) -{ - setDisplayName(DisplayName); -} - -BuildStepConfigWidget *MaemoInstallRpmPackageToSysrootStep::createConfigWidget() -{ - return new MaemoInstallRpmPackageToSysrootWidget(this); -} - -QStringList MaemoInstallRpmPackageToSysrootStep::madArguments() const -{ - return QStringList() << QLatin1String("xrpm") << QLatin1String("-i"); -} - -const QString MaemoInstallRpmPackageToSysrootStep::Id - = QLatin1String("MaemoInstallRpmPackageToSysrootStep"); -const QString MaemoInstallRpmPackageToSysrootStep::DisplayName - = tr("Install RPM package to sysroot"); - - -MaemoCopyToSysrootStep::MaemoCopyToSysrootStep(BuildStepList *bsl) - : BuildStep(bsl, Id) -{ - setDisplayName(DisplayName); -} - -MaemoCopyToSysrootStep::MaemoCopyToSysrootStep(BuildStepList *bsl, - MaemoCopyToSysrootStep *other) - : BuildStep(bsl, other) -{ - setDisplayName(DisplayName); -} - -void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi) -{ - const Qt4BuildConfiguration * const bc - = qobject_cast<Qt4BaseTarget *>(target())->activeBuildConfiguration(); - if (!bc) { - addOutput(tr("Can't copy to sysroot without build configuration."), - ErrorMessageOutput); - fi.reportResult(false); - return; - } - - const MaemoToolChain * const tc - = dynamic_cast<MaemoToolChain *>(bc->toolChain()); - if (!tc) { - addOutput(tr("Can't copy to sysroot without toolchain."), - ErrorMessageOutput); - fi.reportResult(false); - return; - } - - emit addOutput(tr("Copying files to sysroot ..."), MessageOutput); - QDir sysRootDir(tc->sysroot()); - const QSharedPointer<MaemoDeployables> deployables - = qobject_cast<Qt4MaemoDeployConfiguration *>(deployConfiguration())->deployables(); - const QChar sep = QLatin1Char('/'); - for (int i = 0; i < deployables->deployableCount(); ++i) { - const MaemoDeployable &deployable = deployables->deployableAt(i); - const QFileInfo localFileInfo(deployable.localFilePath); - const QString targetFilePath = tc->sysroot() + sep - + deployable.remoteDir + sep + localFileInfo.fileName(); - sysRootDir.mkpath(deployable.remoteDir.mid(1)); - QString errorMsg; - MaemoGlobal::removeRecursively(targetFilePath, errorMsg); - if (!MaemoGlobal::copyRecursively(deployable.localFilePath, - targetFilePath, &errorMsg)) { - emit addOutput(tr("Sysroot installation failed: %1\n" - " Continuing anyway.").arg(errorMsg), ErrorMessageOutput); - } - QCoreApplication::processEvents(); - if (fi.isCanceled()) { - fi.reportResult(false); - return; - } - } - fi.reportResult(true); -} - -BuildStepConfigWidget *MaemoCopyToSysrootStep::createConfigWidget() -{ - return new MaemoCopyFilesToSysrootWidget(this); -} - -const QString MaemoCopyToSysrootStep::Id - = QLatin1String("MaemoCopyToSysrootStep"); -const QString MaemoCopyToSysrootStep::DisplayName - = tr("Copy files to sysroot"); - - -MaemoMakeInstallToSysrootStep::MaemoMakeInstallToSysrootStep(BuildStepList *bsl) - : AbstractProcessStep(bsl, Id) -{ - setDefaultDisplayName(DisplayName); -} - -MaemoMakeInstallToSysrootStep::MaemoMakeInstallToSysrootStep(BuildStepList *bsl, - MaemoMakeInstallToSysrootStep *other) - : AbstractProcessStep(bsl, other) -{ - setDefaultDisplayName(DisplayName); -} - -bool MaemoMakeInstallToSysrootStep::init() -{ - const Qt4BuildConfiguration * const bc - = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration()); - if (!bc) { - addOutput("Can't deploy: No active build dconfiguration.", - ErrorMessageOutput); - return false; - } - const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion(); - if (!qtVersion) { - addOutput("Can't deploy: Unusable build configuration.", - ErrorMessageOutput); - return false; - - } - processParameters()->setCommand(MaemoGlobal::madCommand(qtVersion->qmakeCommand())); - const QStringList args = QStringList() << QLatin1String("-t") - << MaemoGlobal::targetName(qtVersion->qmakeCommand()) << QLatin1String("make") - << QLatin1String("install") - << (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot()); - processParameters()->setArguments(args.join(QLatin1String(" "))); - processParameters()->setEnvironment(bc->environment()); - processParameters()->setWorkingDirectory(bc->buildDirectory()); - return true; -} - -BuildStepConfigWidget *MaemoMakeInstallToSysrootStep::createConfigWidget() -{ - return new MaemoCopyFilesToSysrootWidget(this); -} - -const QString MaemoMakeInstallToSysrootStep::Id - = QLatin1String("MaemoMakeInstallToSysrootStep"); -const QString MaemoMakeInstallToSysrootStep::DisplayName - = tr("Copy files to sysroot"); - -} // namespace Internal -} // namespace Qt4ProjectManager - -#include "maemoinstalltosysrootstep.moc" diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.h deleted file mode 100644 index 1137ac9fbb..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.h +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOINSTALLTOSYSROOTSTEP_H -#define MAEMOINSTALLTOSYSROOTSTEP_H - -#include <projectexplorer/abstractprocessstep.h> -#include <projectexplorer/buildstep.h> - -#include <QtCore/QStringList> - -QT_FORWARD_DECLARE_CLASS(QProcess) - -namespace Qt4ProjectManager { -namespace Internal { - -class AbstractMaemoInstallPackageToSysrootStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT -public: - virtual bool init() { return true; } - virtual void run(QFutureInterface<bool> &fi); - -protected: - AbstractMaemoInstallPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl, - const QString &id); - AbstractMaemoInstallPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl, - AbstractMaemoInstallPackageToSysrootStep *other); - -private slots: - void handleInstallerStdout(); - void handleInstallerStderr(); - -private: - virtual QStringList madArguments() const=0; - - QProcess *m_installerProcess; -}; - -class MaemoInstallDebianPackageToSysrootStep : public AbstractMaemoInstallPackageToSysrootStep -{ - Q_OBJECT -public: - explicit MaemoInstallDebianPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl); - MaemoInstallDebianPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl, - MaemoInstallDebianPackageToSysrootStep *other); - - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - static const QString Id; - static const QString DisplayName; -private: - virtual QStringList madArguments() const; -}; - -class MaemoInstallRpmPackageToSysrootStep : public AbstractMaemoInstallPackageToSysrootStep -{ - Q_OBJECT -public: - explicit MaemoInstallRpmPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl); - MaemoInstallRpmPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl, - MaemoInstallRpmPackageToSysrootStep *other); - - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - static const QString Id; - static const QString DisplayName; -private: - virtual QStringList madArguments() const; -}; - -class MaemoCopyToSysrootStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT -public: - explicit MaemoCopyToSysrootStep(ProjectExplorer::BuildStepList *bsl); - MaemoCopyToSysrootStep(ProjectExplorer::BuildStepList *bsl, - MaemoCopyToSysrootStep *other); - - virtual bool init() { return true; } - virtual void run(QFutureInterface<bool> &fi); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - static const QString Id; - static const QString DisplayName; -}; - -class MaemoMakeInstallToSysrootStep : public ProjectExplorer::AbstractProcessStep -{ - Q_OBJECT -public: - explicit MaemoMakeInstallToSysrootStep(ProjectExplorer::BuildStepList *bsl); - MaemoMakeInstallToSysrootStep(ProjectExplorer::BuildStepList *bsl, - MaemoMakeInstallToSysrootStep *other); - - virtual bool immutable() const { return false; } - virtual bool init(); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - static const QString Id; - static const QString DisplayName; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOINSTALLTOSYSROOTSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.cpp deleted file mode 100644 index 389cc7d71a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemokeydeployer.h" - -#include <utils/ssh/sshremoteprocessrunner.h> -#include <utils/fileutils.h> - -#include <QtCore/QFile> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoKeyDeployer::MaemoKeyDeployer(QObject *parent) - : QObject(parent) -{ -} - -MaemoKeyDeployer::~MaemoKeyDeployer() -{ - cleanup(); -} - -void MaemoKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams, - const QString &keyFilePath) -{ - cleanup(); - m_deployProcess = SshRemoteProcessRunner::create(sshParams); - - Utils::FileReader reader; - if (!reader.fetch(keyFilePath)) { - emit error(tr("Public key error: %1").arg(reader.errorString())); - return; - } - - connect(m_deployProcess.data(), SIGNAL(connectionError(Utils::SshError)), this, - SLOT(handleConnectionFailure())); - connect(m_deployProcess.data(), SIGNAL(processClosed(int)), this, - SLOT(handleKeyUploadFinished(int))); - const QByteArray command = "test -d .ssh " - "|| mkdir .ssh && chmod 0700 .ssh && echo '" - + reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys"; - m_deployProcess->run(command); -} - -void MaemoKeyDeployer::handleConnectionFailure() -{ - if (!m_deployProcess) - return; - const QString errorMsg = m_deployProcess->connection()->errorString(); - cleanup(); - emit error(tr("Connection failed: %1").arg(errorMsg)); -} - -void MaemoKeyDeployer::handleKeyUploadFinished(int exitStatus) -{ - Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart - || exitStatus == SshRemoteProcess::KilledBySignal - || exitStatus == SshRemoteProcess::ExitedNormally); - - if (!m_deployProcess) - return; - - const int exitCode = m_deployProcess->process()->exitCode(); - const QString errorMsg = m_deployProcess->process()->errorString(); - cleanup(); - if (exitStatus == SshRemoteProcess::ExitedNormally && exitCode == 0) - emit finishedSuccessfully(); - else - emit error(tr("Key deployment failed: %1.").arg(errorMsg)); -} - -void MaemoKeyDeployer::stopDeployment() -{ - cleanup(); -} - -void MaemoKeyDeployer::cleanup() -{ - if (m_deployProcess) { - disconnect(m_deployProcess.data(), 0, this, 0); - m_deployProcess.clear(); - } -} - - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.h b/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.h deleted file mode 100644 index 2b78dd62ac..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemokeydeployer.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOKEYDEPLOYER_H -#define MAEMOKEYDEPLOYER_H - -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> - -namespace Utils { -struct SshConnectionParameters; -class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoKeyDeployer : public QObject -{ - Q_OBJECT -public: - explicit MaemoKeyDeployer(QObject *parent = 0); - ~MaemoKeyDeployer(); - - void deployPublicKey(const Utils::SshConnectionParameters &sshParams, - const QString &keyFilePath); - void stopDeployment(); - -signals: - void error(const QString &errorMsg); - void finishedSuccessfully(); - -private slots: - void handleConnectionFailure(); - void handleKeyUploadFinished(int exitStatus); - -private: - void cleanup(); - - QSharedPointer<Utils::SshRemoteProcessRunner> m_deployProcess; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOKEYDEPLOYER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp deleted file mode 100644 index 2a96cfe39e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemomanager.h" - -#include "maemoconstants.h" -#include "maemodeployable.h" -#include "maemodeploystepfactory.h" -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" -#include "maemopackagecreationfactory.h" -#include "maemopublishingwizardfactories.h" -#include "maemoqemumanager.h" -#include "maemorunfactories.h" -#include "maemosettingspages.h" -#include "maemotoolchain.h" -#include "qt4maemodeployconfiguration.h" -#include "maemoqtversionfactory.h" -#include "qt4maemotargetfactory.h" -#include "qt4projectmanager/qt4projectmanagerconstants.h" - -#include <extensionsystem/pluginmanager.h> - -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtCore/QTextStream> - -using namespace ExtensionSystem; -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { - namespace Internal { - -MaemoManager *MaemoManager::m_instance = 0; - -MaemoManager::MaemoManager() - : QObject(0) - , m_runControlFactory(new MaemoRunControlFactory(this)) - , m_runConfigurationFactory(new MaemoRunConfigurationFactory(this)) - , m_deployConfigurationFactory(new Qt4MaemoDeployConfigurationFactory(this)) - , m_packageCreationFactory(new MaemoPackageCreationFactory(this)) - , m_deployStepFactory(new MaemoDeployStepFactory(this)) - , m_deviceConfigurationsSettingsPage(new MaemoDeviceConfigurationsSettingsPage(this)) - , m_qemuSettingsPage(new MaemoQemuSettingsPage(this)) - , m_publishingFactoryFremantleFree(new MaemoPublishingWizardFactoryFremantleFree(this)) - , m_maemoTargetFactory(new Qt4MaemoTargetFactory(this)) - , m_toolChainFactory(new MaemoToolChainFactory) - , m_maemoQtVersionFactory(new MaemoQtVersionFactory(this)) -{ - Q_ASSERT(!m_instance); - - m_instance = this; - MaemoQemuManager::instance(this); - MaemoDeviceConfigurations::instance(this); - - PluginManager *pluginManager = PluginManager::instance(); - pluginManager->addObject(m_toolChainFactory); - pluginManager->addObject(m_runControlFactory); - pluginManager->addObject(m_runConfigurationFactory); - pluginManager->addObject(m_deployConfigurationFactory); - pluginManager->addObject(m_packageCreationFactory); - pluginManager->addObject(m_deployStepFactory); - pluginManager->addObject(m_deviceConfigurationsSettingsPage); - pluginManager->addObject(m_qemuSettingsPage); - pluginManager->addObject(m_publishingFactoryFremantleFree); - pluginManager->addObject(m_maemoTargetFactory); - pluginManager->addObject(m_maemoQtVersionFactory); - - qRegisterMetaType<MaemoDeployable>("MaemoDeployable"); -} - -MaemoManager::~MaemoManager() -{ - PluginManager *pluginManager = PluginManager::instance(); - pluginManager->removeObject(m_maemoQtVersionFactory); - pluginManager->removeObject(m_maemoTargetFactory); - pluginManager->removeObject(m_publishingFactoryFremantleFree); - pluginManager->removeObject(m_qemuSettingsPage); - pluginManager->removeObject(m_deviceConfigurationsSettingsPage); - pluginManager->removeObject(m_deployStepFactory); - pluginManager->removeObject(m_packageCreationFactory); - pluginManager->removeObject(m_deployConfigurationFactory); - pluginManager->removeObject(m_runConfigurationFactory); - pluginManager->removeObject(m_runControlFactory); - pluginManager->removeObject(m_toolChainFactory); - delete m_toolChainFactory; - - m_instance = 0; -} - -MaemoManager &MaemoManager::instance() -{ - Q_ASSERT(m_instance); - return *m_instance; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h deleted file mode 100644 index 0c14f04094..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.h +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOMANAGER_H -#define MAEMOMANAGER_H - -#include <QtCore/QObject> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoDeployStepFactory; -class MaemoPackageCreationFactory; -class MaemoPublishingWizardFactoryFremantleFree; -class MaemoRunControlFactory; -class MaemoRunConfigurationFactory; -class MaemoDeviceConfigurationsSettingsPage; -class MaemoQemuManager; -class MaemoQemuSettingsPage; -class Qt4MaemoDeployConfigurationFactory; -class Qt4MaemoTargetFactory; -class MaemoToolChainFactory; -class MaemoQtVersionFactory; - -class MaemoManager : public QObject -{ - Q_OBJECT - -public: - MaemoManager(); - ~MaemoManager(); - static MaemoManager &instance(); - - MaemoDeviceConfigurationsSettingsPage *deviceConfigurationsSettingsPage() const { return m_deviceConfigurationsSettingsPage; } - MaemoQemuSettingsPage *qemuSettingsPage() const { return m_qemuSettingsPage; } - -private: - static MaemoManager *m_instance; - - MaemoRunControlFactory *m_runControlFactory; - MaemoRunConfigurationFactory *m_runConfigurationFactory; - Qt4MaemoDeployConfigurationFactory *m_deployConfigurationFactory; - MaemoPackageCreationFactory *m_packageCreationFactory; - MaemoDeployStepFactory *m_deployStepFactory; - MaemoDeviceConfigurationsSettingsPage *m_deviceConfigurationsSettingsPage; - MaemoQemuSettingsPage *m_qemuSettingsPage; - MaemoQemuManager *m_qemuRuntimeManager; - MaemoPublishingWizardFactoryFremantleFree *m_publishingFactoryFremantleFree; - Qt4MaemoTargetFactory *m_maemoTargetFactory; - MaemoToolChainFactory *m_toolChainFactory; - MaemoQtVersionFactory *m_maemoQtVersionFactory; -}; - - } // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOMANAGER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp deleted file mode 100644 index 5c46389a37..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemomountspecification.h" - -namespace Qt4ProjectManager { -namespace Internal { - -const QLatin1String MaemoMountSpecification::InvalidMountPoint("/"); - -MaemoMountSpecification::MaemoMountSpecification(const QString &localDir, - const QString &remoteDir) - : localDir(localDir), remoteMountPoint(remoteDir) -{ -} - -} // namespace Internal -} // namespace Qt4ProjectManager - diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h deleted file mode 100644 index 81ed29b02d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOMOUNTSPECIFICATION_H -#define MAEMOMOUNTSPECIFICATION_H - -#include <QtCore/QLatin1String> - -namespace Qt4ProjectManager { -namespace Internal { - -struct MaemoMountSpecification { - MaemoMountSpecification(const QString &localDir, const QString &remoteDir); - bool isValid() const { return remoteMountPoint != InvalidMountPoint; } - - static const QLatin1String InvalidMountPoint; - - QString localDir; - QString remoteMountPoint; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOMOUNTSPECIFICATION_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp deleted file mode 100644 index 9ef79f7af0..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopackagecreationfactory.h" - -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/buildconfiguration.h> -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/deployconfiguration.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/target.h> -#include <qt4projectmanagerconstants.h> - -#include <QtCore/QCoreApplication> - -using ProjectExplorer::BuildStepList; -using ProjectExplorer::BuildStep; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QString OldCreatePackageId("Qt4ProjectManager.MaemoPackageCreationStep"); -} // anonymous namespace - -MaemoPackageCreationFactory::MaemoPackageCreationFactory(QObject *parent) - : ProjectExplorer::IBuildStepFactory(parent) -{ -} - -QStringList MaemoPackageCreationFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const -{ - QStringList ids; - if (!MaemoGlobal::hasLinuxQt(parent->target())) - return ids; - if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target()) - && !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) { - ids << MaemoDebianPackageCreationStep::CreatePackageId; - } else if (qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target()) - && !parent->contains(MaemoRpmPackageCreationStep::CreatePackageId)) { - ids << MaemoRpmPackageCreationStep::CreatePackageId; - } - if (!qobject_cast<Qt4HarmattanTarget *>(parent->target()) - && !parent->contains(MaemoTarPackageCreationStep::CreatePackageId)) { - ids << MaemoTarPackageCreationStep::CreatePackageId; - } - return ids; -} - -QString MaemoPackageCreationFactory::displayNameForId(const QString &id) const -{ - if (id == MaemoDebianPackageCreationStep::CreatePackageId) { - return QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoPackageCreationFactory", - "Create Debian Package"); - } else if (id == MaemoRpmPackageCreationStep::CreatePackageId) { - return QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoPackageCreationFactory", - "Create RPM Package"); - } else if (id == MaemoTarPackageCreationStep::CreatePackageId) { - return QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoPackageCreationFactory", - "Create tarball"); - } - return QString(); -} - -bool MaemoPackageCreationFactory::canCreate(ProjectExplorer::BuildStepList *parent, const QString &id) const -{ - return availableCreationIds(parent).contains(id); -} - -BuildStep *MaemoPackageCreationFactory::create(ProjectExplorer::BuildStepList *parent, const QString &id) -{ - Q_ASSERT(canCreate(parent, id)); - if (id == MaemoDebianPackageCreationStep::CreatePackageId) - return new MaemoDebianPackageCreationStep(parent); - else if (id == MaemoRpmPackageCreationStep::CreatePackageId) - return new MaemoRpmPackageCreationStep(parent); - else if (id == MaemoTarPackageCreationStep::CreatePackageId) - return new MaemoTarPackageCreationStep(parent); - return 0; -} - -bool MaemoPackageCreationFactory::canRestore(ProjectExplorer::BuildStepList *parent, - const QVariantMap &map) const -{ - const QString id = ProjectExplorer::idFromMap(map); - return canCreate(parent, id) || id == OldCreatePackageId; -} - -BuildStep *MaemoPackageCreationFactory::restore(ProjectExplorer::BuildStepList *parent, - const QVariantMap &map) -{ - Q_ASSERT(canRestore(parent, map)); - BuildStep * step = 0; - const QString id = ProjectExplorer::idFromMap(map); - if (id == MaemoDebianPackageCreationStep::CreatePackageId - || (id == OldCreatePackageId - && qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target()))) { - step = new MaemoDebianPackageCreationStep(parent); - } else if (id == MaemoRpmPackageCreationStep::CreatePackageId - || (id == OldCreatePackageId - && qobject_cast<AbstractRpmBasedQt4MaemoTarget *>(parent->target()))) { - step = new MaemoRpmPackageCreationStep(parent); - } else if (id == MaemoTarPackageCreationStep::CreatePackageId) { - step = new MaemoTarPackageCreationStep(parent); - } - Q_ASSERT(step); - - if (!step->fromMap(map)) { - delete step; - return 0; - } - return step; -} - -bool MaemoPackageCreationFactory::canClone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product) const -{ - return canCreate(parent, product->id()); -} - -BuildStep *MaemoPackageCreationFactory::clone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product) -{ - Q_ASSERT(canClone(parent, product)); - MaemoDebianPackageCreationStep * const debianStep - = qobject_cast<MaemoDebianPackageCreationStep *>(product); - if (debianStep) { - return new MaemoDebianPackageCreationStep(parent, debianStep); - } else { - MaemoRpmPackageCreationStep * const rpmStep - = qobject_cast<MaemoRpmPackageCreationStep *>(product); - if (rpmStep) { - return new MaemoRpmPackageCreationStep(parent, rpmStep); - } else { - return new MaemoTarPackageCreationStep(parent, - qobject_cast<MaemoTarPackageCreationStep *>(product)); - } - } -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h deleted file mode 100644 index c790df2ac9..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationfactory.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPACKAGECREATIONFACTORY_H -#define MAEMOPACKAGECREATIONFACTORY_H - -#include <projectexplorer/buildstep.h> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPackageCreationFactory : public ProjectExplorer::IBuildStepFactory -{ -public: - MaemoPackageCreationFactory(QObject *parent); - - virtual QStringList availableCreationIds(ProjectExplorer::BuildStepList *parent) const; - virtual QString displayNameForId(const QString &id) const; - - virtual bool canCreate(ProjectExplorer::BuildStepList *parent, - const QString &id) const; - virtual ProjectExplorer::BuildStep * - create(ProjectExplorer::BuildStepList *parent, const QString &id); - - virtual bool canRestore(ProjectExplorer::BuildStepList *parent, - const QVariantMap &map) const; - virtual ProjectExplorer::BuildStep * - restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map); - - virtual bool canClone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product) const; - virtual ProjectExplorer::BuildStep * - clone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPACKAGECREATIONFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp deleted file mode 100644 index b6be190e59..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ /dev/null @@ -1,831 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopackagecreationstep.h" - -#include "maemoconstants.h" -#include "maemodeployables.h" -#include "maemoglobal.h" -#include "maemopackagecreationwidget.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <qt4buildconfiguration.h> -#include <qt4project.h> -#include <qt4target.h> -#include <utils/environment.h> -#include <utils/fileutils.h> - -#include <QtCore/QDateTime> -#include <QtCore/QProcess> -#include <QtCore/QRegExp> -#include <QtCore/QStringBuilder> -#include <QtGui/QWidget> - -namespace { - const QLatin1String MagicFileName(".qtcreator"); -} - -using namespace ProjectExplorer::Constants; -using ProjectExplorer::BuildStepList; -using ProjectExplorer::BuildStepConfigWidget; -using ProjectExplorer::Task; - -namespace Qt4ProjectManager { -namespace Internal { - -const QLatin1String AbstractMaemoPackageCreationStep::DefaultVersionNumber("0.0.1"); - -AbstractMaemoPackageCreationStep::AbstractMaemoPackageCreationStep(BuildStepList *bsl, - const QString &id) - : ProjectExplorer::BuildStep(bsl, id) -{ - ctor(); -} - -AbstractMaemoPackageCreationStep::AbstractMaemoPackageCreationStep(BuildStepList *bsl, - AbstractMaemoPackageCreationStep *other) : BuildStep(bsl, other) -{ - ctor(); -} - -AbstractMaemoPackageCreationStep::~AbstractMaemoPackageCreationStep() -{ -} - -void AbstractMaemoPackageCreationStep::ctor() -{ - m_lastBuildConfig = qt4BuildConfiguration(); - connect(target(), - SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(handleBuildConfigChanged())); - handleBuildConfigChanged(); -} - -bool AbstractMaemoPackageCreationStep::init() -{ - return true; -} - -void AbstractMaemoPackageCreationStep::run(QFutureInterface<bool> &fi) -{ - if (!packagingNeeded()) { - emit addOutput(tr("Package up to date."), MessageOutput); - fi.reportResult(true); - return; - } - - // TODO: Make the build process asynchronous; i.e. no waitFor()-functions etc. - QProcess * const buildProc = new QProcess; - connect(buildProc, SIGNAL(readyReadStandardOutput()), this, - SLOT(handleBuildOutput())); - connect(buildProc, SIGNAL(readyReadStandardError()), this, - SLOT(handleBuildOutput())); - emit addOutput(tr("Creating package file ..."), MessageOutput); - const bool success = createPackage(buildProc, fi); - disconnect(buildProc, 0, this, 0); - buildProc->deleteLater(); - if (success) { - emit addOutput(tr("Package created."), BuildStep::MessageOutput); - deployConfig()->deployables()->setUnmodified(); - } - fi.reportResult(success); -} - -BuildStepConfigWidget *AbstractMaemoPackageCreationStep::createConfigWidget() -{ - return new MaemoPackageCreationWidget(this); -} - -void AbstractMaemoPackageCreationStep::handleBuildOutput() -{ - QProcess * const buildProc = qobject_cast<QProcess *>(sender()); - if (!buildProc) - return; - QByteArray stdOut = buildProc->readAllStandardOutput(); - stdOut.replace('\0', QByteArray()); // Output contains NUL characters. - if (!stdOut.isEmpty()) - emit addOutput(QString::fromLocal8Bit(stdOut), BuildStep::NormalOutput, - BuildStep::DontAppendNewline); - QByteArray errorOut = buildProc->readAllStandardError(); - errorOut.replace('\0', QByteArray()); - if (!errorOut.isEmpty()) { - emit addOutput(QString::fromLocal8Bit(errorOut), BuildStep::ErrorOutput, - BuildStep::DontAppendNewline); - } -} - -void AbstractMaemoPackageCreationStep::handleBuildConfigChanged() -{ - if (m_lastBuildConfig) - disconnect(m_lastBuildConfig, 0, this, 0); - m_lastBuildConfig = qt4BuildConfiguration(); - connect(m_lastBuildConfig, SIGNAL(qtVersionChanged()), this, - SIGNAL(qtVersionChanged())); - connect(m_lastBuildConfig, SIGNAL(buildDirectoryChanged()), this, - SIGNAL(packageFilePathChanged())); - emit qtVersionChanged(); - emit packageFilePathChanged(); -} - -const Qt4BuildConfiguration *AbstractMaemoPackageCreationStep::qt4BuildConfiguration() const -{ - return static_cast<Qt4BuildConfiguration *>(buildConfiguration()); -} - -AbstractQt4MaemoTarget *AbstractMaemoPackageCreationStep::maemoTarget() const -{ - return qobject_cast<AbstractQt4MaemoTarget *>(buildConfiguration()->target()); -} - -AbstractDebBasedQt4MaemoTarget *AbstractMaemoPackageCreationStep::debBasedMaemoTarget() const -{ - return qobject_cast<AbstractDebBasedQt4MaemoTarget*>(buildConfiguration()->target()); -} - -AbstractRpmBasedQt4MaemoTarget *AbstractMaemoPackageCreationStep::rpmBasedMaemoTarget() const -{ - return qobject_cast<AbstractRpmBasedQt4MaemoTarget*>(buildConfiguration()->target()); -} - -Qt4MaemoDeployConfiguration *AbstractMaemoPackageCreationStep::deployConfig() const -{ - return qobject_cast<Qt4MaemoDeployConfiguration *>(parent()->parent()); -} - -QString AbstractMaemoPackageCreationStep::buildDirectory() const -{ - return qt4BuildConfiguration()->buildDirectory(); -} - -QString AbstractMaemoPackageCreationStep::projectName() const -{ - return qt4BuildConfiguration()->qt4Target()->qt4Project() - ->rootProjectNode()->displayName().toLower(); -} - -bool AbstractMaemoPackageCreationStep::packagingNeeded() const -{ - const QSharedPointer<MaemoDeployables> &deployables - = deployConfig()->deployables(); - QFileInfo packageInfo(packageFilePath()); - if (!packageInfo.exists() || deployables->isModified()) - return true; - - const int deployableCount = deployables->deployableCount(); - for (int i = 0; i < deployableCount; ++i) { - if (MaemoGlobal::isFileNewerThan(deployables->deployableAt(i).localFilePath, - packageInfo.lastModified())) - return true; - } - - return isMetaDataNewerThan(packageInfo.lastModified()); -} - -QString AbstractMaemoPackageCreationStep::packageFilePath() const -{ - QString error; - const QString &version = versionString(&error); - if (version.isEmpty()) - return QString(); - QFileInfo fi(maemoTarget()->packageFileName()); - const QString baseName = replaceDots(fi.completeBaseName()); - return buildDirectory() + QLatin1Char('/') + baseName - + QLatin1Char('.') + fi.suffix(); -} - -QString AbstractMaemoPackageCreationStep::versionString(QString *error) const -{ - return maemoTarget()->projectVersion(error); -} - -bool AbstractMaemoPackageCreationStep::setVersionString(const QString &version, - QString *error) -{ - const bool success = maemoTarget()->setProjectVersion(version, error); - if (success) - emit packageFilePathChanged(); - return success; -} - -QString AbstractMaemoPackageCreationStep::nativePath(const QFile &file) -{ - return QDir::toNativeSeparators(QFileInfo(file).filePath()); -} - -void AbstractMaemoPackageCreationStep::raiseError(const QString &shortMsg, - const QString &detailedMsg) -{ - emit addOutput(detailedMsg.isNull() ? shortMsg : detailedMsg, BuildStep::ErrorOutput); - emit addTask(Task(Task::Error, shortMsg, QString(), -1, - TASK_CATEGORY_BUILDSYSTEM)); -} - -bool AbstractMaemoPackageCreationStep::callPackagingCommand(QProcess *proc, - const QStringList &arguments) -{ - preparePackagingProcess(proc, qt4BuildConfiguration(), buildDirectory()); - const QtSupport::BaseQtVersion * const qtVersion = qt4BuildConfiguration()->qtVersion(); - if (!qtVersion) { - raiseError(tr("Packaging failed."), tr("Packaging error: No qt version.")); - return false; - } - const QString madCommand = MaemoGlobal::madCommand(qtVersion->qmakeCommand()); - const QString cmdLine = madCommand + QLatin1Char(' ') - + arguments.join(QLatin1String(" ")); - emit addOutput(tr("Package Creation: Running command '%1'.").arg(cmdLine), - BuildStep::MessageOutput); - MaemoGlobal::callMad(*proc, arguments, qtVersion->qmakeCommand(), true); - if (!proc->waitForStarted()) { - raiseError(tr("Packaging failed."), - tr("Packaging error: Could not start command '%1'. Reason: %2") - .arg(cmdLine, proc->errorString())); - return false; - } - proc->waitForFinished(-1); - if (proc->error() != QProcess::UnknownError || proc->exitCode() != 0) { - QString mainMessage = tr("Packaging Error: Command '%1' failed.") - .arg(cmdLine); - if (proc->error() != QProcess::UnknownError) - mainMessage += tr(" Reason: %1").arg(proc->errorString()); - else - mainMessage += tr("Exit code: %1").arg(proc->exitCode()); - raiseError(mainMessage); - return false; - } - return true; -} - - -void AbstractMaemoPackageCreationStep::preparePackagingProcess(QProcess *proc, - const Qt4BuildConfiguration *bc, const QString &workingDir) -{ - Utils::Environment env = bc->environment(); - if (bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild) { - env.appendOrSet(QLatin1String("DEB_BUILD_OPTIONS"), - QLatin1String("nostrip"), QLatin1String(" ")); - } - proc->setEnvironment(env.toStringList()); - proc->setWorkingDirectory(workingDir); -} - -QString AbstractMaemoPackageCreationStep::replaceDots(const QString &name) -{ - QString adaptedName = name; - return adaptedName.replace(QLatin1Char('.'), QLatin1Char('_')); -} - - -MaemoDebianPackageCreationStep::MaemoDebianPackageCreationStep(BuildStepList *bsl) - : AbstractMaemoPackageCreationStep(bsl, CreatePackageId) -{ - ctor(); -} - -const QString MaemoDebianPackageCreationStep::CreatePackageId - = QLatin1String("MaemoDebianPackageCreationStep"); - -MaemoDebianPackageCreationStep::MaemoDebianPackageCreationStep(BuildStepList *buildConfig, - MaemoDebianPackageCreationStep *other) - : AbstractMaemoPackageCreationStep(buildConfig, other) -{ - ctor(); -} - -void MaemoDebianPackageCreationStep::ctor() -{ - setDefaultDisplayName(tr("Create Debian Package")); -} - -bool MaemoDebianPackageCreationStep::createPackage(QProcess *buildProc, - const QFutureInterface<bool> &fi) -{ - Q_UNUSED(fi); - checkProjectName(); - const QString projectDir - = buildConfiguration()->target()->project()->projectDirectory(); - const bool inSourceBuild - = QFileInfo(buildDirectory()) == QFileInfo(projectDir); - if (!copyDebianFiles(inSourceBuild)) - return false; - const QStringList args = QStringList() << QLatin1String("dpkg-buildpackage") - << QLatin1String("-nc") << QLatin1String("-uc") << QLatin1String("-us"); - if (!callPackagingCommand(buildProc, args)) - return false; - - QFile::remove(packageFilePath()); - - // Workaround for non-working dh_builddeb --destdir=. - if (!QDir(buildDirectory()).isRoot()) { - const AbstractQt4MaemoTarget * const target = maemoTarget(); - QString error; - const QString pkgFileName = target->packageFileName(); - if (!error.isEmpty()) - raiseError(tr("Packaging failed."), "Failed to get package name."); - const QString changesSourceFileName = QFileInfo(pkgFileName).completeBaseName() - + QLatin1String(".changes"); - const QString changesTargetFileName = replaceDots(QFileInfo(pkgFileName).completeBaseName()) - + QLatin1String(".changes"); - const QString packageSourceDir = buildDirectory() + QLatin1String("/../"); - const QString packageSourceFilePath - = packageSourceDir + pkgFileName; - const QString changesSourceFilePath - = packageSourceDir + changesSourceFileName; - const QString changesTargetFilePath - = buildDirectory() + QLatin1Char('/') + changesTargetFileName; - QFile::remove(changesTargetFilePath); - if (!QFile::rename(packageSourceFilePath, packageFilePath()) - || !QFile::rename(changesSourceFilePath, changesTargetFilePath)) { - raiseError(tr("Packaging failed."), - tr("Could not move package files from %1 to %2.") - .arg(packageSourceDir, buildDirectory())); - return false; - } - } - - if (inSourceBuild) { - buildProc->start(packagingCommand(qt4BuildConfiguration(), - QLatin1String("dh_clean"))); - buildProc->waitForFinished(); - buildProc->terminate(); - } - return true; -} - -bool MaemoDebianPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const -{ - const QString debianPath = debBasedMaemoTarget()->debianDirPath(); - if (packageDate <= QFileInfo(debianPath).lastModified()) - return true; - const QStringList debianFiles = debBasedMaemoTarget()->debianFiles(); - foreach (const QString &debianFile, debianFiles) { - const QString absFilePath - = debianPath + QLatin1Char('/') + debianFile; - if (packageDate <= QFileInfo(absFilePath).lastModified()) - return true; - } - return false; -} - -void MaemoDebianPackageCreationStep::checkProjectName() -{ - const QRegExp legalName(QLatin1String("[0-9-+a-z\\.]+")); - if (!legalName.exactMatch(buildConfiguration()->target()->project()->displayName())) { - emit addTask(Task(Task::Warning, - tr("Your project name contains characters not allowed in " - "Debian packages.\nThey must only use lower-case letters, " - "numbers, '-', '+' and '.'.\n""We will try to work around that, " - "but you may experience problems."), - QString(), -1, TASK_CATEGORY_BUILDSYSTEM)); - } -} - -bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild) -{ - const QString debianDirPath = buildDirectory() + QLatin1String("/debian"); - const QString magicFilePath - = debianDirPath + QLatin1Char('/') + MagicFileName; - if (inSourceBuild && QFileInfo(debianDirPath).isDir() - && !QFileInfo(magicFilePath).exists()) { - raiseError(tr("Packaging failed: Foreign debian directory detected."), - tr("You are not using a shadow build and there is a debian " - "directory in your project root ('%1'). Qt Creator will not " - "overwrite that directory. Please remove it or use the " - "shadow build feature.") - .arg(QDir::toNativeSeparators(debianDirPath))); - return false; - } - QString error; - if (!MaemoGlobal::removeRecursively(debianDirPath, error)) { - raiseError(tr("Packaging failed."), - tr("Could not remove directory '%1': %2").arg(debianDirPath, error)); - return false; - } - QDir buildDir(buildDirectory()); - if (!buildDir.mkdir("debian")) { - raiseError(tr("Could not create Debian directory '%1'.") - .arg(debianDirPath)); - return false; - } - const QString templatesDirPath = debBasedMaemoTarget()->debianDirPath(); - QDir templatesDir(templatesDirPath); - const QStringList &files = templatesDir.entryList(QDir::Files); - foreach (const QString &fileName, files) { - const QString srcFile - = templatesDirPath + QLatin1Char('/') + fileName; - const QString destFile - = debianDirPath + QLatin1Char('/') + fileName; - if (fileName == QLatin1String("rules")) { - if (!adaptRulesFile(srcFile, destFile)) - return false; - } else if (!QFile::copy(srcFile, destFile)) { - raiseError(tr("Could not copy file '%1' to '%2'") - .arg(QDir::toNativeSeparators(srcFile), - QDir::toNativeSeparators(destFile))); - return false; - } - } - - QFile magicFile(magicFilePath); - if (!magicFile.open(QIODevice::WriteOnly)) { - raiseError(tr("Error: Could not create file '%1'.") - .arg(QDir::toNativeSeparators(magicFilePath))); - return false; - } - - return true; -} - -QString MaemoDebianPackageCreationStep::packagingCommand(const Qt4BuildConfiguration *bc, - const QString &commandName) -{ - QString perl; - QtSupport::BaseQtVersion *v = bc->qtVersion(); - const QString maddeRoot = MaemoGlobal::maddeRoot(v->qmakeCommand()); -#ifdef Q_OS_WIN - perl = maddeRoot + QLatin1String("/bin/perl.exe "); -#endif - return perl + maddeRoot % QLatin1String("/madbin/") % commandName; -} - -void MaemoDebianPackageCreationStep::ensureShlibdeps(QByteArray &rulesContent) -{ - QString contentAsString = QString::fromLocal8Bit(rulesContent); - const QString whiteSpace(QLatin1String("[ \\t]*")); - const QString pattern = QLatin1String("\\n") + whiteSpace - + QLatin1Char('#') + whiteSpace + QLatin1String("dh_shlibdeps") - + QLatin1String("[^\\n]*\\n"); - contentAsString.replace(QRegExp(pattern), - QLatin1String("\n\tdh_shlibdeps\n")); - rulesContent = contentAsString.toLocal8Bit(); -} - -bool MaemoDebianPackageCreationStep::adaptRulesFile( - const QString &templatePath, const QString &rulesFilePath) -{ - Utils::FileReader reader; - if (!reader.fetch(templatePath)) { - raiseError(reader.errorString()); - return false; - } - QByteArray content = reader.data(); - const Qt4BuildConfiguration * const bc = qt4BuildConfiguration(); - - // Always check for dependencies in release builds. - if (!(bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild)) - ensureShlibdeps(content); - - Utils::FileSaver saver(rulesFilePath); - saver.write(content); - if (!saver.finalize()) { - raiseError(saver.errorString()); - return false; - } - QFile rulesFile(rulesFilePath); - rulesFile.setPermissions(rulesFile.permissions() | QFile::ExeUser); - return true; -} - - -MaemoRpmPackageCreationStep::MaemoRpmPackageCreationStep(BuildStepList *bsl) - : AbstractMaemoPackageCreationStep(bsl, CreatePackageId) -{ - ctor(); -} - -MaemoRpmPackageCreationStep::MaemoRpmPackageCreationStep(BuildStepList *buildConfig, - MaemoRpmPackageCreationStep *other) - : AbstractMaemoPackageCreationStep(buildConfig, other) -{ - ctor(); -} - -void MaemoRpmPackageCreationStep::ctor() -{ - setDefaultDisplayName(tr("Create RPM Package")); -} - -bool MaemoRpmPackageCreationStep::createPackage(QProcess *buildProc, - const QFutureInterface<bool> &fi) -{ - Q_UNUSED(fi); - const QStringList args = QStringList() << QLatin1String("rrpmbuild") - << QLatin1String("-bb") << rpmBasedMaemoTarget()->specFilePath(); - if (!callPackagingCommand(buildProc, args)) - return false; - QFile::remove(packageFilePath()); - const QString packageSourceFilePath = rpmBuildDir(qt4BuildConfiguration()) - + QLatin1Char('/') + rpmBasedMaemoTarget()->packageFileName(); - if (!QFile::rename(packageSourceFilePath, packageFilePath())) { - raiseError(tr("Packaging failed."), - tr("Could not move package file from %1 to %2.") - .arg(packageSourceFilePath, packageFilePath())); - return false; - } - - return true; -} - -bool MaemoRpmPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const -{ - const QDateTime specFileChangeDate - = QFileInfo(rpmBasedMaemoTarget()->specFilePath()).lastModified(); - return packageDate <= specFileChangeDate; -} - -QString MaemoRpmPackageCreationStep::rpmBuildDir(const Qt4BuildConfiguration *bc) -{ - return bc->buildDirectory() + QLatin1String("/rrpmbuild"); -} - -const QString MaemoRpmPackageCreationStep::CreatePackageId - = QLatin1String("MaemoRpmPackageCreationStep"); - - - -class CreateTarStepWidget : public BuildStepConfigWidget -{ - Q_OBJECT -public: - CreateTarStepWidget(MaemoTarPackageCreationStep *step) : m_step(step) {} - - virtual void init() - { - connect(m_step, SIGNAL(packageFilePathChanged()), - SIGNAL(updateSummary())); - } - - virtual QString summaryText() const - { - return QLatin1String("<b>") + tr("Create tarball:") - + QLatin1String("</b> ") + m_step->packageFilePath(); - } - - virtual QString displayName() const { return QString(); } - -private: - const MaemoTarPackageCreationStep * const m_step; -}; - -namespace { -const int TarBlockSize = 512; -struct TarFileHeader { - char fileName[100]; - char fileMode[8]; - char uid[8]; - char gid[8]; - char length[12]; - char mtime[12]; - char chksum[8]; - char typeflag; - char linkname[100]; - char magic[6]; - char version[2]; - char uname[32]; - char gname[32]; - char devmajor[8]; - char devminor[8]; - char fileNamePrefix[155]; - char padding[12]; -}; -} // Anonymous namespace. - -MaemoTarPackageCreationStep::MaemoTarPackageCreationStep(BuildStepList *bsl) - : AbstractMaemoPackageCreationStep(bsl, CreatePackageId) -{ - ctor(); -} - -MaemoTarPackageCreationStep::MaemoTarPackageCreationStep(BuildStepList *buildConfig, - MaemoTarPackageCreationStep *other) - : AbstractMaemoPackageCreationStep(buildConfig, other) -{ - ctor(); -} - -void MaemoTarPackageCreationStep::ctor() -{ - setDefaultDisplayName(tr("Create tar ball")); -} - -bool MaemoTarPackageCreationStep::createPackage(QProcess *buildProc, - const QFutureInterface<bool> &fi) -{ - Q_UNUSED(buildProc); - - // TODO: Optimization: Only package changed files (needs refactoring in upper level; worth the effort?) - QFile tarFile(packageFilePath()); - if (!tarFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - raiseError(tr("Error: tar file %1 cannot be opened (%2).") - .arg(QDir::toNativeSeparators(packageFilePath()), - tarFile.errorString())); - return false; - } - const QSharedPointer<MaemoDeployables> deployables = deployConfig()->deployables(); - for (int i = 0; i < deployables->deployableCount(); ++i) { - const MaemoDeployable &d = deployables->deployableAt(i); - QFileInfo fileInfo(d.localFilePath); - if (!appendFile(tarFile, fileInfo, d.remoteDir + QLatin1Char('/') - + fileInfo.fileName(), fi)) { - return false; - } - } - - const QByteArray eofIndicator(2*sizeof(TarFileHeader), 0); - if (tarFile.write(eofIndicator) != eofIndicator.length()) { - raiseError(tr("Error writing tar file '%1': %2.") - .arg(QDir::toNativeSeparators(tarFile.fileName()), - tarFile.errorString())); - return false; - } - - return true; -} - -bool MaemoTarPackageCreationStep::appendFile(QFile &tarFile, - const QFileInfo &fileInfo, const QString &remoteFilePath, - const QFutureInterface<bool> &fi) -{ - if (!writeHeader(tarFile, fileInfo, remoteFilePath)) - return false; - if (fileInfo.isDir()) { - QDir dir(fileInfo.absoluteFilePath()); - foreach (const QString &fileName, - dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) { - const QString thisLocalFilePath - = dir.path() + QLatin1Char('/') + fileName; - const QString thisRemoteFilePath = remoteFilePath - + QLatin1Char('/') + fileName; - if (!appendFile(tarFile, QFileInfo(thisLocalFilePath), - thisRemoteFilePath, fi)) { - return false; - } - } - } else { - const QString nativePath - = QDir::toNativeSeparators(fileInfo.filePath()); - QFile file(fileInfo.filePath()); - if (!file.open(QIODevice::ReadOnly)) { - raiseError(tr("Error reading file '%1': %2.") - .arg(nativePath, file.errorString())); - return false; - } - - const int chunkSize = 1024*1024; - - // TODO: Wasteful. Work with fixed-size buffer. - while (!file.atEnd() && !file.error() != QFile::NoError - && !tarFile.error() != QFile::NoError) { - const QByteArray data = file.read(chunkSize); - tarFile.write(data); - if (fi.isCanceled()) - return false; - } - if (file.error() != QFile::NoError) { - raiseError(tr("Error reading file '%1': %2.") - .arg(nativePath, file.errorString())); - return false; - } - - const int blockModulo = file.size() % TarBlockSize; - if (blockModulo != 0) { - tarFile.write(QByteArray(TarBlockSize - blockModulo, 0)); - } - - if (tarFile.error() != QFile::NoError) { - raiseError(tr("Error writing tar file '%1': %2.") - .arg(QDir::toNativeSeparators(tarFile.fileName()), - tarFile.errorString())); - return false; - } - } - return true; -} - -bool MaemoTarPackageCreationStep::writeHeader(QFile &tarFile, - const QFileInfo &fileInfo, const QString &remoteFilePath) -{ - TarFileHeader header; - qMemSet(&header, '\0', sizeof header); - const QByteArray &filePath = remoteFilePath.toUtf8(); - const int maxFilePathLength = sizeof header.fileNamePrefix - + sizeof header.fileName; - if (filePath.count() > maxFilePathLength) { - raiseError(tr("Cannot tar file '%1': path is too long.") - .arg(QDir::toNativeSeparators(filePath))); - return false; - } - - const int fileNameBytesToWrite - = qMin<int>(filePath.length(), sizeof header.fileName); - const int fileNameOffset = filePath.length() - fileNameBytesToWrite; - qMemCopy(&header.fileName, filePath.data() + fileNameOffset, - fileNameBytesToWrite); - if (fileNameOffset > 0) - qMemCopy(&header.fileNamePrefix, filePath.data(), fileNameOffset); - int permissions = (0400 * fileInfo.permission(QFile::ReadOwner)) - | (0200 * fileInfo.permission(QFile::WriteOwner)) - | (0100 * fileInfo.permission(QFile::ExeOwner)) - | (040 * fileInfo.permission(QFile::ReadGroup)) - | (020 * fileInfo.permission(QFile::WriteGroup)) - | (010 * fileInfo.permission(QFile::ExeGroup)) - | (04 * fileInfo.permission(QFile::ReadOther)) - | (02 * fileInfo.permission(QFile::WriteOther)) - | (01 * fileInfo.permission(QFile::ExeOther)); - const QByteArray permissionString = QString("%1").arg(permissions, - sizeof header.fileMode - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.fileMode, permissionString.data(), - permissionString.length()); - const QByteArray uidString = QString("%1").arg(fileInfo.ownerId(), - sizeof header.uid - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.uid, uidString.data(), uidString.length()); - const QByteArray gidString = QString("%1").arg(fileInfo.groupId(), - sizeof header.gid - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.gid, gidString.data(), gidString.length()); - const QByteArray sizeString = QString("%1").arg(fileInfo.size(), - sizeof header.length - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.length, sizeString.data(), sizeString.length()); - const QByteArray mtimeString = QString("%1").arg(fileInfo.lastModified().toTime_t(), - sizeof header.mtime - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.mtime, mtimeString.data(), mtimeString.length()); - if (fileInfo.isDir()) - header.typeflag = '5'; - qMemCopy(&header.magic, "ustar", sizeof "ustar"); - qMemCopy(&header.version, "00", 2); - const QByteArray &owner = fileInfo.owner().toUtf8(); - qMemCopy(&header.uname, owner.data(), - qMin<int>(owner.length(), sizeof header.uname - 1)); - const QByteArray &group = fileInfo.group().toUtf8(); - qMemCopy(&header.gname, group.data(), - qMin<int>(group.length(), sizeof header.gname - 1)); - qMemSet(&header.chksum, ' ', sizeof header.chksum); - quint64 checksum = 0; - for (size_t i = 0; i < sizeof header; ++i) - checksum += reinterpret_cast<char *>(&header)[i]; - const QByteArray checksumString = QString("%1").arg(checksum, - sizeof header.chksum - 1, 8, QLatin1Char('0')).toAscii(); - qMemCopy(&header.chksum, checksumString.data(), checksumString.length()); - header.chksum[sizeof header.chksum-1] = 0; - if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) { - raiseError(tr("Error writing tar file '%1': %2") - .arg(QDir::toNativeSeparators(packageFilePath()), - tarFile.errorString())); - return false; - } - return true; -} - -bool MaemoTarPackageCreationStep::isMetaDataNewerThan(const QDateTime &packageDate) const -{ - Q_UNUSED(packageDate); - return false; -} - -QString MaemoTarPackageCreationStep::packageFilePath() const -{ - return buildDirectory() + QLatin1Char('/') + projectName() - + QLatin1String(".tar"); -} - -BuildStepConfigWidget *MaemoTarPackageCreationStep::createConfigWidget() -{ - return new CreateTarStepWidget(this); -} - -const QString MaemoTarPackageCreationStep::CreatePackageId - = QLatin1String("MaemoTarPackageCreationStep"); - -} // namespace Internal -} // namespace Qt4ProjectManager - -#include "maemopackagecreationstep.moc" diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h deleted file mode 100644 index 3ef2ec54cd..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPACKAGECREATIONSTEP_H -#define MAEMOPACKAGECREATIONSTEP_H - -#include <projectexplorer/buildstep.h> - -QT_BEGIN_NAMESPACE -class QDateTime; -class QFile; -class QFileInfo; -class QProcess; -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; - -namespace Internal { -class MaemoDeployableListModel; -class AbstractQt4MaemoTarget; -class AbstractDebBasedQt4MaemoTarget; -class AbstractRpmBasedQt4MaemoTarget; -class Qt4MaemoDeployConfiguration; - -class AbstractMaemoPackageCreationStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT -public: - virtual ~AbstractMaemoPackageCreationStep(); - - virtual QString packageFilePath() const; - - QString versionString(QString *error) const; - bool setVersionString(const QString &version, QString *error); - - static void preparePackagingProcess(QProcess *proc, - const Qt4BuildConfiguration *bc, const QString &workingDir); - - QString projectName() const; - const Qt4BuildConfiguration *qt4BuildConfiguration() const; - AbstractQt4MaemoTarget *maemoTarget() const; - AbstractDebBasedQt4MaemoTarget *debBasedMaemoTarget() const; - AbstractRpmBasedQt4MaemoTarget *rpmBasedMaemoTarget() const; - Qt4MaemoDeployConfiguration *deployConfig() const; - - static const QLatin1String DefaultVersionNumber; - -signals: - void packageFilePathChanged(); - void qtVersionChanged(); - -protected: - AbstractMaemoPackageCreationStep(ProjectExplorer::BuildStepList *bsl, - const QString &id); - AbstractMaemoPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig, - AbstractMaemoPackageCreationStep *other); - - void raiseError(const QString &shortMsg, - const QString &detailedMsg = QString()); - bool callPackagingCommand(QProcess *proc, const QStringList &arguments); - static QString replaceDots(const QString &name); - QString buildDirectory() const; - -private slots: - void handleBuildOutput(); - void handleBuildConfigChanged(); - -private: - void ctor(); - virtual bool init(); - virtual void run(QFutureInterface<bool> &fi); - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi)=0; - virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const=0; - - static QString nativePath(const QFile &file); - bool packagingNeeded() const; - - const Qt4BuildConfiguration *m_lastBuildConfig; -}; - - -class MaemoDebianPackageCreationStep : public AbstractMaemoPackageCreationStep -{ - Q_OBJECT - friend class MaemoPackageCreationFactory; -public: - MaemoDebianPackageCreationStep(ProjectExplorer::BuildStepList *bsl); - - static void ensureShlibdeps(QByteArray &rulesContent); - -private: - MaemoDebianPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig, - MaemoDebianPackageCreationStep *other); - - virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi); - virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const; - - void ctor(); - static QString packagingCommand(const Qt4BuildConfiguration *bc, - const QString &commandName); - bool copyDebianFiles(bool inSourceBuild); - void checkProjectName(); - bool adaptRulesFile(const QString &templatePath, const QString &rulesFilePath); - - static const QString CreatePackageId; -}; - -class MaemoRpmPackageCreationStep : public AbstractMaemoPackageCreationStep -{ - Q_OBJECT - friend class MaemoPackageCreationFactory; -public: - MaemoRpmPackageCreationStep(ProjectExplorer::BuildStepList *bsl); - -private: - virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi); - virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const; - - MaemoRpmPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig, - MaemoRpmPackageCreationStep *other); - - void ctor(); - static QString rpmBuildDir(const Qt4BuildConfiguration *bc); - - static const QString CreatePackageId; -}; - -class MaemoTarPackageCreationStep : public AbstractMaemoPackageCreationStep -{ - Q_OBJECT - friend class MaemoPackageCreationFactory; -public: - MaemoTarPackageCreationStep(ProjectExplorer::BuildStepList *bsl); - - virtual QString packageFilePath() const; -private: - virtual bool createPackage(QProcess *buildProc, const QFutureInterface<bool> &fi); - virtual bool isMetaDataNewerThan(const QDateTime &packageDate) const; - virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); - - MaemoTarPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig, - MaemoTarPackageCreationStep *other); - - void ctor(); - bool appendFile(QFile &tarFile, const QFileInfo &fileInfo, - const QString &remoteFilePath, const QFutureInterface<bool> &fi); - bool writeHeader(QFile &tarFile, const QFileInfo &fileInfo, - const QString &remoteFilePath); - - static const QString CreatePackageId; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPACKAGECREATIONSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp deleted file mode 100644 index 596a4ca220..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopackagecreationwidget.h" -#include "ui_maemopackagecreationwidget.h" - -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "qt4maemotarget.h" - -#include <coreplugin/editormanager/editormanager.h> -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <utils/qtcassert.h> - -#include <QtCore/QTimer> -#include <QtGui/QFileDialog> -#include <QtGui/QImageReader> -#include <QtGui/QMessageBox> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -// TODO: Split up into dedicated widgets for Debian and RPM steps. -MaemoPackageCreationWidget::MaemoPackageCreationWidget(AbstractMaemoPackageCreationStep *step) - : ProjectExplorer::BuildStepConfigWidget(), - m_step(step), - m_ui(new Ui::MaemoPackageCreationWidget) -{ - m_ui->setupUi(this); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - QTimer::singleShot(0, this, SLOT(initGui())); -} - -MaemoPackageCreationWidget::~MaemoPackageCreationWidget() -{ - delete m_ui; -} - -void MaemoPackageCreationWidget::init() -{ -} - -void MaemoPackageCreationWidget::initGui() -{ - m_ui->shortDescriptionLineEdit->setMaxLength(60); - updateVersionInfo(); - versionInfoChanged(); - const AbstractDebBasedQt4MaemoTarget * const debBasedMaemoTarget - = m_step->debBasedMaemoTarget(); - if (debBasedMaemoTarget) { - m_ui->editSpecFileButton->setVisible(false); - updateDebianFileList(); - handleControlFileUpdate(); - connect(m_ui->packageManagerNameLineEdit, SIGNAL(editingFinished()), - SLOT(setPackageManagerName())); - connect(debBasedMaemoTarget, SIGNAL(debianDirContentsChanged()), - SLOT(updateDebianFileList())); - connect(debBasedMaemoTarget, SIGNAL(changeLogChanged()), - SLOT(updateVersionInfo())); - connect(debBasedMaemoTarget, SIGNAL(controlChanged()), - SLOT(handleControlFileUpdate())); - } else { - m_ui->packageManagerNameLabel->hide(); - m_ui->packageManagerNameLineEdit->hide(); - m_ui->packageManagerIconLabel->hide(); - m_ui->packageManagerIconButton->hide(); - m_ui->editDebianFileLabel->hide(); - m_ui->debianFilesComboBox->hide(); - m_ui->editDebianFileButton->hide(); - - // This is fragile; be careful when editing the UI file. - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(4, QFormLayout::LabelRole)); - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(4, QFormLayout::FieldRole)); - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(5, QFormLayout::LabelRole)); - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(5, QFormLayout::FieldRole)); - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(6, QFormLayout::LabelRole)); - m_ui->formLayout->removeItem(m_ui->formLayout->itemAt(6, QFormLayout::FieldRole)); - handleSpecFileUpdate(); - connect(m_step->rpmBasedMaemoTarget(), SIGNAL(specFileChanged()), - SLOT(handleSpecFileUpdate())); - connect(m_ui->editSpecFileButton, SIGNAL(clicked()), - SLOT(editSpecFile())); - } - connect(m_step, SIGNAL(packageFilePathChanged()), this, - SIGNAL(updateSummary())); - connect(m_ui->packageNameLineEdit, SIGNAL(editingFinished()), - SLOT(setPackageName())); - connect(m_ui->shortDescriptionLineEdit, SIGNAL(editingFinished()), - SLOT(setShortDescription())); -} - -void MaemoPackageCreationWidget::updateDebianFileList() -{ - m_ui->debianFilesComboBox->clear(); - const QStringList &debianFiles = m_step->debBasedMaemoTarget()->debianFiles(); - foreach (const QString &fileName, debianFiles) { - if (fileName != QLatin1String("compat") - && !fileName.endsWith(QLatin1Char('~'))) - m_ui->debianFilesComboBox->addItem(fileName); - } -} - -void MaemoPackageCreationWidget::updateVersionInfo() -{ - QString error; - QString versionString = m_step->versionString(&error); - if (versionString.isEmpty()) { - QMessageBox::critical(this, tr("No Version Available."), error); - versionString = AbstractMaemoPackageCreationStep::DefaultVersionNumber; - } - const QStringList list = versionString.split(QLatin1Char('.'), - QString::SkipEmptyParts); - m_ui->major->setValue(list.value(0, QLatin1String("0")).toInt()); - m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt()); - m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt()); -} - -void MaemoPackageCreationWidget::handleControlFileUpdate() -{ - updatePackageName(); - updateShortDescription(); - updatePackageManagerName(); - updatePackageManagerIcon(); - updateSummary(); -} - -void MaemoPackageCreationWidget::handleSpecFileUpdate() -{ - updatePackageName(); - updateShortDescription(); - updateVersionInfo(); - updateSummary(); -} - -void MaemoPackageCreationWidget::updatePackageManagerIcon() -{ - QString error; - const QIcon &icon = m_step->debBasedMaemoTarget()->packageManagerIcon(&error); - if (!error.isEmpty()) { - QMessageBox::critical(this, tr("Could not read icon"), error); - } else { - m_ui->packageManagerIconButton->setIcon(icon); - m_ui->packageManagerIconButton->setIconSize(m_ui->packageManagerIconButton->size()); - } -} - -void MaemoPackageCreationWidget::updatePackageName() -{ - m_ui->packageNameLineEdit->setText(m_step->maemoTarget()->packageName()); -} - -void MaemoPackageCreationWidget::updatePackageManagerName() -{ - m_ui->packageManagerNameLineEdit->setText(m_step->debBasedMaemoTarget()->packageManagerName()); -} - -void MaemoPackageCreationWidget::updateShortDescription() -{ - m_ui->shortDescriptionLineEdit->setText(m_step->maemoTarget()->shortDescription()); -} - -void MaemoPackageCreationWidget::setPackageManagerIcon() -{ - QString imageFilter = tr("Images") + QLatin1String("( "); - const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats(); - foreach (const QByteArray &imageType, imageTypes) - imageFilter += "*." + QString::fromAscii(imageType) + QLatin1Char(' '); - imageFilter += QLatin1Char(')'); - const QString iconFileName = QFileDialog::getOpenFileName(this, - tr("Choose Image (will be scaled to 48x48 pixels if necessary)"), - QString(), imageFilter); - if (!iconFileName.isEmpty()) { - QString error; - if (!m_step->debBasedMaemoTarget()->setPackageManagerIcon(iconFileName, &error)) - QMessageBox::critical(this, tr("Could Not Set New Icon"), error); - } -} - -void MaemoPackageCreationWidget::setPackageName() -{ - if (!m_step->maemoTarget()->setPackageName(m_ui->packageNameLineEdit->text())) { - QMessageBox::critical(this, tr("File Error"), - tr("Could not set project name.")); - } -} - -void MaemoPackageCreationWidget::setPackageManagerName() -{ - if (!m_step->debBasedMaemoTarget()->setPackageManagerName(m_ui->packageManagerNameLineEdit->text())) { - QMessageBox::critical(this, tr("File Error"), - tr("Could not set package name for project manager.")); - } -} - -void MaemoPackageCreationWidget::setShortDescription() -{ - if (!m_step->maemoTarget()->setShortDescription(m_ui->shortDescriptionLineEdit->text())) { - QMessageBox::critical(this, tr("File Error"), - tr("Could not set project description.")); - } -} - -QString MaemoPackageCreationWidget::summaryText() const -{ - return tr("<b>Create Package:</b> ") - + QDir::toNativeSeparators(m_step->packageFilePath()); -} - -QString MaemoPackageCreationWidget::displayName() const -{ - return m_step->displayName(); -} - -void MaemoPackageCreationWidget::versionInfoChanged() -{ - QString error; - const bool success = m_step->setVersionString(m_ui->major->text() - + QLatin1Char('.') + m_ui->minor->text() + QLatin1Char('.') - + m_ui->patch->text(), &error); - if (!success) - QMessageBox::critical(this, tr("Could Not Set Version Number"), error); -} - -void MaemoPackageCreationWidget::editDebianFile() -{ - editFile(m_step->debBasedMaemoTarget()->debianDirPath() - + QLatin1Char('/') + m_ui->debianFilesComboBox->currentText()); -} - -void MaemoPackageCreationWidget::editSpecFile() -{ - editFile(m_step->rpmBasedMaemoTarget()->specFilePath()); -} - -void MaemoPackageCreationWidget::editFile(const QString &filePath) -{ - Core::EditorManager::instance()->openEditor(filePath, QString(), - Core::EditorManager::ModeSwitch); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h deleted file mode 100644 index ce5758ed42..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPACKAGECREATIONWIDGET_H -#define MAEMOPACKAGECREATIONWIDGET_H - -#include <projectexplorer/buildstep.h> - -QT_BEGIN_NAMESPACE -namespace Ui { class MaemoPackageCreationWidget; } -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class AbstractMaemoPackageCreationStep; - -class MaemoPackageCreationWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - MaemoPackageCreationWidget(AbstractMaemoPackageCreationStep *step); - ~MaemoPackageCreationWidget(); - - virtual void init(); - virtual QString summaryText() const; - virtual QString displayName() const; - -private slots: - void editDebianFile(); - void editSpecFile(); - void versionInfoChanged(); - void initGui(); - void updateDebianFileList(); - void updateVersionInfo(); - void handleControlFileUpdate(); - void handleSpecFileUpdate(); - void setPackageManagerIcon(); - void setPackageManagerName(); - void setPackageName(); - void setShortDescription(); - -private: - void updatePackageManagerIcon(); - void updatePackageName(); - void updatePackageManagerName(); - void updateShortDescription(); - void editFile(const QString &filePath); - - AbstractMaemoPackageCreationStep * const m_step; - Ui::MaemoPackageCreationWidget * const m_ui; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPACKAGECREATIONWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui deleted file mode 100644 index 922a768f63..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui +++ /dev/null @@ -1,365 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoPackageCreationWidget</class> - <widget class="QWidget" name="MaemoPackageCreationWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>584</width> - <height>284</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>1</horstretch> - <verstretch>1</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="packageNameLabel"> - <property name="text"> - <string>Package name:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="packageNameLineEdit"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text"> - <string>Package version:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Major:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="major"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>99</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Minor:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="minor"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>99</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Patch:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="patch"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>99</number> - </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> - <item row="3" column="0"> - <widget class="QLabel" name="shortDescriptionLabel"> - <property name="text"> - <string>Short package description:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QLineEdit" name="shortDescriptionLineEdit"/> - </item> - </layout> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="packageManagerNameLabel"> - <property name="text"> - <string>Name to be displayed in Package Manager:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QLineEdit" name="packageManagerNameLineEdit"/> - </item> - </layout> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="packageManagerIconLabel"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>48</height> - </size> - </property> - <property name="text"> - <string>Icon to be displayed in Package Manager:</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QToolButton" name="packageManagerIconButton"> - <property name="minimumSize"> - <size> - <width>48</width> - <height>48</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>48</width> - <height>48</height> - </size> - </property> - <property name="toolTip"> - <string>Size is 48x48 pixels</string> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <spacer name="packageManagerIconSpacer"> - <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 row="6" column="0"> - <widget class="QLabel" name="editDebianFileLabel"> - <property name="text"> - <string>Adapt Debian file:</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="debianFilesComboBox"/> - </item> - <item> - <widget class="QPushButton" name="editDebianFileButton"> - <property name="text"> - <string>Edit</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 row="7" column="1"> - <widget class="QPushButton" name="editSpecFileButton"> - <property name="text"> - <string>Edit spec file</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>major</sender> - <signal>valueChanged(int)</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>versionInfoChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>352</x> - <y>88</y> - </hint> - <hint type="destinationlabel"> - <x>461</x> - <y>32</y> - </hint> - </hints> - </connection> - <connection> - <sender>minor</sender> - <signal>valueChanged(int)</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>versionInfoChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>449</x> - <y>88</y> - </hint> - <hint type="destinationlabel"> - <x>5</x> - <y>15</y> - </hint> - </hints> - </connection> - <connection> - <sender>patch</sender> - <signal>valueChanged(int)</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>versionInfoChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>546</x> - <y>88</y> - </hint> - <hint type="destinationlabel"> - <x>466</x> - <y>0</y> - </hint> - </hints> - </connection> - <connection> - <sender>editDebianFileButton</sender> - <signal>clicked()</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>editDebianFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>398</x> - <y>218</y> - </hint> - <hint type="destinationlabel"> - <x>8</x> - <y>86</y> - </hint> - </hints> - </connection> - <connection> - <sender>packageManagerIconButton</sender> - <signal>clicked()</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>setPackageManagerIcon()</slot> - <hints> - <hint type="sourcelabel"> - <x>289</x> - <y>186</y> - </hint> - <hint type="destinationlabel"> - <x>2</x> - <y>143</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <slot>addFile()</slot> - <slot>removeFile()</slot> - <slot>handleSkipButtonToggled(bool)</slot> - <slot>versionInfoChanged()</slot> - <slot>editDebianFile()</slot> - <slot>setPackageManagerIcon()</slot> - </slots> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp deleted file mode 100644 index 4493f1422a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopackageinstaller.h" - -#include "maemoglobal.h" - -#include <utils/ssh/sshconnection.h> -#include <utils/ssh/sshremoteprocessrunner.h> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -AbstractMaemoPackageInstaller::AbstractMaemoPackageInstaller(QObject *parent) - : QObject(parent), m_isRunning(false) -{ -} - -AbstractMaemoPackageInstaller::~AbstractMaemoPackageInstaller() {} - -void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, const QString &packageFilePath, - bool removePackageFile) -{ - Q_ASSERT(connection && connection->state() == SshConnection::Connected); - Q_ASSERT(!m_isRunning); - - prepareInstallation(); - m_installer = SshRemoteProcessRunner::create(connection); - connect(m_installer.data(), SIGNAL(connectionError(Utils::SshError)), - SLOT(handleConnectionError())); - connect(m_installer.data(), SIGNAL(processOutputAvailable(QByteArray)), - SLOT(handleInstallerOutput(QByteArray))); - connect(m_installer.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), - SLOT(handleInstallerErrorOutput(QByteArray))); - connect(m_installer.data(), SIGNAL(processClosed(int)), - SLOT(handleInstallationFinished(int))); - - const QString space = QLatin1String(" "); - QString cmdLine = QLatin1String("cd ") + workingDirectory() - + QLatin1String(" && ") - + MaemoGlobal::remoteSudo(devConf->osVersion(), - m_installer->connection()->connectionParameters().userName) - + space + installCommand() - + space + installCommandArguments().join(space) + space - + packageFilePath; - if (removePackageFile) { - cmdLine += QLatin1String(" && (rm ") + packageFilePath - + QLatin1String(" || :)"); - } - m_installer->run(cmdLine.toUtf8()); - m_isRunning = true; -} - -void AbstractMaemoPackageInstaller::cancelInstallation() -{ - Q_ASSERT(m_isRunning); - const SshRemoteProcessRunner::Ptr killProcess - = SshRemoteProcessRunner::create(m_installer->connection()); - killProcess->run("pkill " + installCommand().toUtf8()); - setFinished(); -} - -void AbstractMaemoPackageInstaller::handleConnectionError() -{ - if (!m_isRunning) - return; - emit finished(tr("Connection failure: %1") - .arg(m_installer->connection()->errorString())); - setFinished(); -} - -void AbstractMaemoPackageInstaller::handleInstallationFinished(int exitStatus) -{ - if (!m_isRunning) - return; - - if (exitStatus != SshRemoteProcess::ExitedNormally - || m_installer->process()->exitCode() != 0) { - emit finished(tr("Installing package failed.")); - } else if (!errorString().isEmpty()) { - emit finished(errorString()); - } else { - emit finished(); - } - - setFinished(); -} - -void AbstractMaemoPackageInstaller::handleInstallerOutput(const QByteArray &output) -{ - emit stdoutData(QString::fromUtf8(output)); -} - -void AbstractMaemoPackageInstaller::handleInstallerErrorOutput(const QByteArray &output) -{ - emit stderrData(QString::fromUtf8(output)); -} - -void AbstractMaemoPackageInstaller::setFinished() -{ - disconnect(m_installer.data(), 0, this, 0); - m_installer.clear(); - m_isRunning = false; -} - - -MaemoDebianPackageInstaller::MaemoDebianPackageInstaller(QObject *parent) - : AbstractMaemoPackageInstaller(parent) -{ - connect(this, SIGNAL(stderrData(QString)), - SLOT(handleInstallerErrorOutput(QString))); -} - -void MaemoDebianPackageInstaller::prepareInstallation() -{ - m_installerStderr.clear(); -} - -QString MaemoDebianPackageInstaller::installCommand() const -{ - return QLatin1String("dpkg"); -} - -QStringList MaemoDebianPackageInstaller::installCommandArguments() const -{ - return QStringList() << QLatin1String("-i") - << QLatin1String("--no-force-downgrade"); -} - -void MaemoDebianPackageInstaller::handleInstallerErrorOutput(const QString &output) -{ - m_installerStderr += output; -} - -QString MaemoDebianPackageInstaller::errorString() const -{ - if (m_installerStderr.contains(QLatin1String("Will not downgrade"))) { - return tr("Installation failed: " - "You tried to downgrade a package, which is not allowed."); - } else { - return QString(); - } -} - - -MaemoRpmPackageInstaller::MaemoRpmPackageInstaller(QObject *parent) - : AbstractMaemoPackageInstaller(parent) -{ -} - -QString MaemoRpmPackageInstaller::installCommand() const -{ - return QLatin1String("rpm"); -} - -QStringList MaemoRpmPackageInstaller::installCommandArguments() const -{ - // rpm -U does not allow to re-install a package with the same version - // number, so we need --replacepkgs. Even then, it inexplicably reports - // a conflict if the files are not identical to the installed version, - // so we need --replacefiles as well. - // TODO: --replacefiles is dangerous. Is there perhaps a way around it - // after all? - return QStringList() << QLatin1String("-Uhv") << QLatin1String("--replacepkgs") << QLatin1String("--replacefiles"); -} - - -MaemoTarPackageInstaller::MaemoTarPackageInstaller(QObject *parent) - : AbstractMaemoPackageInstaller(parent) -{ -} - -QString MaemoTarPackageInstaller::installCommand() const -{ - return QLatin1String("tar"); -} - -QStringList MaemoTarPackageInstaller::installCommandArguments() const -{ - return QStringList() << QLatin1String("xvf"); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.h deleted file mode 100644 index fc8fceaca9..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.h +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef ABSTRACTMAEMOPACKAGEINSTALLER_H -#define ABSTRACTMAEMOPACKAGEINSTALLER_H - -namespace Utils { -class SshConnection; -class SshRemoteProcessRunner; -} - -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> -#include <QtCore/QStringList> - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; - -class AbstractMaemoPackageInstaller : public QObject -{ - Q_OBJECT -public: - ~AbstractMaemoPackageInstaller(); - - void installPackage(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &devConfig, - const QString &packageFilePath, bool removePackageFile); - void cancelInstallation(); - -signals: - void stdoutData(const QString &output); - void stderrData(const QString &output); - void finished(const QString &errorMsg = QString()); - -protected: - explicit AbstractMaemoPackageInstaller(QObject *parent = 0); - bool isRunning() const { return m_isRunning; } - -private slots: - void handleConnectionError(); - void handleInstallationFinished(int exitStatus); - void handleInstallerOutput(const QByteArray &output); - void handleInstallerErrorOutput(const QByteArray &output); - -private: - virtual void prepareInstallation() {} - virtual QString workingDirectory() const { return QLatin1String("/tmp"); } - virtual QString installCommand() const=0; - virtual QStringList installCommandArguments() const=0; - virtual QString errorString() const { return QString(); } - void setFinished(); - - bool m_isRunning; - QSharedPointer<Utils::SshRemoteProcessRunner> m_installer; -}; - - -class MaemoDebianPackageInstaller: public AbstractMaemoPackageInstaller -{ - Q_OBJECT -public: - MaemoDebianPackageInstaller(QObject *parent); - -private slots: - virtual void prepareInstallation(); - virtual QString installCommand() const; - virtual QStringList installCommandArguments() const; - virtual QString errorString() const; - void handleInstallerErrorOutput(const QString &output); - -private: - QString m_installerStderr; -}; - - -class MaemoRpmPackageInstaller : public AbstractMaemoPackageInstaller -{ - Q_OBJECT -public: - MaemoRpmPackageInstaller(QObject *parent); - -private: - virtual QString installCommand() const; - virtual QStringList installCommandArguments() const; -}; - - -class MaemoTarPackageInstaller : public AbstractMaemoPackageInstaller -{ - Q_OBJECT -public: - MaemoTarPackageInstaller(QObject *parent); - -private: - virtual QString installCommand() const; - virtual QStringList installCommandArguments() const; - virtual QString workingDirectory() const { return QLatin1String("/"); } -}; - - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // ABSTRACTMAEMOPACKAGEINSTALLER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.cpp deleted file mode 100644 index 91c74567e2..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopackageuploader.h" - -#include "maemoglobal.h" - -#include <utils/ssh/sftpchannel.h> -#include <utils/ssh/sshconnection.h> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPackageUploader::MaemoPackageUploader(QObject *parent) : - QObject(parent), m_state(Inactive) -{ -} - -MaemoPackageUploader::~MaemoPackageUploader() -{ -} - -void MaemoPackageUploader::uploadPackage(const SshConnection::Ptr &connection, - const QString &localFilePath, const QString &remoteFilePath) -{ - ASSERT_STATE(Inactive); - setState(InitializingSftp); - emit progress(tr("Preparing SFTP connection...")); - - m_localFilePath = localFilePath; - m_remoteFilePath = remoteFilePath; - m_connection = connection; - connect(m_connection.data(), SIGNAL(error(Utils::SshError)), - SLOT(handleConnectionFailure())); - m_uploader = m_connection->createSftpChannel(); - connect(m_uploader.data(), SIGNAL(initialized()), this, - SLOT(handleSftpChannelInitialized())); - connect(m_uploader.data(), SIGNAL(initializationFailed(QString)), this, - SLOT(handleSftpChannelInitializationFailed(QString))); - connect(m_uploader.data(), SIGNAL(finished(Utils::SftpJobId, QString)), - this, SLOT(handleSftpJobFinished(Utils::SftpJobId, QString))); - m_uploader->initialize(); -} - -void MaemoPackageUploader::cancelUpload() -{ - ASSERT_STATE(QList<State>() << InitializingSftp << Uploading); - - cleanup(); -} - -void MaemoPackageUploader::handleConnectionFailure() -{ - if (m_state == Inactive) - return; - - const QString errorMsg = m_connection->errorString(); - setState(Inactive); - emit uploadFinished(tr("Connection failed: %1").arg(errorMsg)); -} - -void MaemoPackageUploader::handleSftpChannelInitializationFailed(const QString &errorMsg) -{ - ASSERT_STATE(QList<State>() << InitializingSftp << Inactive); - if (m_state == Inactive) - return; - - setState(Inactive); - emit uploadFinished(tr("SFTP error: %1").arg(errorMsg)); -} - -void MaemoPackageUploader::handleSftpChannelInitialized() -{ - ASSERT_STATE(QList<State>() << InitializingSftp << Inactive); - if (m_state == Inactive) - return; - - const SftpJobId job = m_uploader->uploadFile(m_localFilePath, - m_remoteFilePath, SftpOverwriteExisting); - if (job == SftpInvalidJob) { - setState(Inactive); - emit uploadFinished(tr("Package upload failed: Could not open file.")); - } else { - emit progress("Starting upload..."); - setState(Uploading); - } -} - -void MaemoPackageUploader::handleSftpJobFinished(SftpJobId, const QString &errorMsg) -{ - ASSERT_STATE(QList<State>() << Uploading << Inactive); - if (m_state == Inactive) - return; - - if (!errorMsg.isEmpty()) - emit uploadFinished(tr("Failed to upload package: %2").arg(errorMsg)); - else - emit uploadFinished(); - cleanup(); -} - -void MaemoPackageUploader::cleanup() -{ - m_uploader->closeChannel(); - setState(Inactive); -} - -void MaemoPackageUploader::setState(State newState) -{ - if (m_state == newState) - return; - if (newState == Inactive) { - if (m_uploader) { - disconnect(m_uploader.data(), 0, this, 0); - m_uploader.clear(); - } - if (m_connection) { - disconnect(m_connection.data(), 0, this, 0); - m_connection.clear(); - } - } - m_state = newState; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.h deleted file mode 100644 index 2709744722..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackageuploader.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPACKAGEUPLOADER_H -#define MAEMOPACKAGEUPLOADER_H - -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> - -#include <utils/ssh/sftpdefs.h> - -namespace Utils { -class SftpChannel; -class SshConnection; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPackageUploader : public QObject -{ - Q_OBJECT -public: - explicit MaemoPackageUploader(QObject *parent = 0); - ~MaemoPackageUploader(); - - // Connection has to be established already. - void uploadPackage(const QSharedPointer<Utils::SshConnection> &connection, - const QString &localFilePath, const QString &remoteFilePath); - void cancelUpload(); - -signals: - void progress(const QString &message); - void uploadFinished(const QString &errorMsg = QString()); - -private slots: - void handleConnectionFailure(); - void handleSftpChannelInitialized(); - void handleSftpChannelInitializationFailed(const QString &error); - void handleSftpJobFinished(Utils::SftpJobId job, const QString &error); - -private: - enum State { InitializingSftp, Uploading, Inactive }; - - void cleanup(); - void setState(State newState); - - State m_state; - QSharedPointer<Utils::SshConnection> m_connection; - QSharedPointer<Utils::SftpChannel> m_uploader; - QString m_localFilePath; - QString m_remoteFilePath; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPACKAGEUPLOADER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.cpp deleted file mode 100644 index d8e2ac804f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopertargetdeviceconfigurationlistmodel.h" - -#include "qt4maemotarget.h" - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationListModel(QObject *parent, - const Target *target) : QAbstractListModel(parent) -{ - if (qobject_cast<const Qt4Maemo5Target *>(target)) - m_targetOsVersion = MaemoDeviceConfig::Maemo5; - else if (qobject_cast<const Qt4HarmattanTarget *>(target)) - m_targetOsVersion = MaemoDeviceConfig::Maemo6; - else if (qobject_cast<const Qt4MeegoTarget *>(target)) - m_targetOsVersion = MaemoDeviceConfig::Meego; - else - m_targetOsVersion = MaemoDeviceConfig::GenericLinux; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); - connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset())); - connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated())); -} - -MaemoPerTargetDeviceConfigurationListModel::~MaemoPerTargetDeviceConfigurationListModel() -{ -} - -int MaemoPerTargetDeviceConfigurationListModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - int count = 0; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); - const int devConfsCount = devConfs->rowCount(); - if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) - return devConfsCount; - for (int i = 0; i < devConfsCount; ++i) { - if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) - ++count; - } - return count; -} - -QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &index, - int role) const -{ - if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole) - return QVariant(); - const MaemoDeviceConfig::ConstPtr &devConf = deviceAt(index.row()); - Q_ASSERT(devConf); - QString displayedName = devConf->name(); - if (devConf->isDefault() && devConf->osVersion() == m_targetOsVersion) - displayedName += QLatin1Char(' ') + tr("(default)"); - return displayedName; -} - -MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const -{ - int currentRow = -1; - const MaemoDeviceConfigurations * const devConfs - = MaemoDeviceConfigurations::instance(); - if (m_targetOsVersion == MaemoDeviceConfig::GenericLinux) - return devConfs->deviceAt(idx); - const int devConfsCount = devConfs->rowCount(); - for (int i = 0; i < devConfsCount; ++i) { - if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) { - if (++currentRow == idx) - return devConfs->deviceAt(i); - } - } - Q_ASSERT(false); - return MaemoDeviceConfig::ConstPtr(); -} - -MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::defaultDeviceConfig() const -{ - return MaemoDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsVersion); -} - -MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(MaemoDeviceConfig::Id id) const -{ - const MaemoDeviceConfig::ConstPtr &devConf - = MaemoDeviceConfigurations::instance()->find(id); - return devConf && (devConf->osVersion() == m_targetOsVersion - || m_targetOsVersion == MaemoDeviceConfig::GenericLinux) - ? devConf : defaultDeviceConfig(); -} - -int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(MaemoDeviceConfig::Id id) const -{ - const int count = rowCount(); - for (int i = 0; i < count; ++i) { - if (deviceAt(i)->internalId() == id) - return i; - } - return -1; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.h deleted file mode 100644 index 9f066828c2..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopertargetdeviceconfigurationlistmodel.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H -#define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H - -#include "maemodeviceconfigurations.h" -#include "maemoglobal.h" - -#include <QtCore/QAbstractListModel> -#include <QtCore/QSharedPointer> - -namespace ProjectExplorer { class Target; } - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPerTargetDeviceConfigurationListModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit MaemoPerTargetDeviceConfigurationListModel(QObject *parent, const - ProjectExplorer::Target *target); - ~MaemoPerTargetDeviceConfigurationListModel(); - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, - int role = Qt::DisplayRole) const; - - QSharedPointer<const MaemoDeviceConfig> deviceAt(int idx) const; - QSharedPointer<const MaemoDeviceConfig> defaultDeviceConfig() const; - QSharedPointer<const MaemoDeviceConfig> find(MaemoDeviceConfig::Id id) const; - int indexForInternalId(MaemoDeviceConfig::Id id) const; - -signals: - void updated(); - -private: - MaemoDeviceConfig::OsVersion m_targetOsVersion; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp deleted file mode 100644 index 04e439edca..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemoprofilesupdatedialog.h" -#include "ui_maemoprofilesupdatedialog.h" - -#include "maemodeployablelistmodel.h" - -#include <qt4projectmanager/qt4nodes.h> - -#include <QtCore/QDir> -#include <QtGui/QTableWidgetItem> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoProFilesUpdateDialog::MaemoProFilesUpdateDialog(const QList<MaemoDeployableListModel *> &models, - QWidget *parent) - : QDialog(parent), - m_models(models), - ui(new Ui::MaemoProFilesUpdateDialog) -{ - 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())); -} - -MaemoProFilesUpdateDialog::~MaemoProFilesUpdateDialog() -{ - delete ui; -} - -void MaemoProFilesUpdateDialog::checkAll() -{ - setCheckStateForAll(Qt::Checked); -} - -void MaemoProFilesUpdateDialog::uncheckAll() -{ - setCheckStateForAll(Qt::Unchecked); -} - -void MaemoProFilesUpdateDialog::setCheckStateForAll(Qt::CheckState checkState) -{ - for (int row = 0; row < ui->tableWidget->rowCount(); ++row) { - ui->tableWidget->item(row, 0)->setCheckState(checkState); - } -} - -QList<MaemoProFilesUpdateDialog::UpdateSetting> -MaemoProFilesUpdateDialog::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 Qt4ProjectManager -} // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.h deleted file mode 100644 index a181506134..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.h +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPROFILESUPDATEDIALOG_H -#define MAEMOPROFILESUPDATEDIALOG_H - -#include <QtCore/QList> -#include <QtCore/QPair> -#include <QtCore/QString> -#include <QtGui/QDialog> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoProFilesUpdateDialog; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeployableListModel; - -class MaemoProFilesUpdateDialog : public QDialog -{ - Q_OBJECT - -public: - typedef QPair<MaemoDeployableListModel *, bool> UpdateSetting; - - explicit MaemoProFilesUpdateDialog(const QList<MaemoDeployableListModel *> &models, - QWidget *parent = 0); - ~MaemoProFilesUpdateDialog(); - QList<UpdateSetting> getUpdateSettings() const; - -private: - Q_SLOT void checkAll(); - Q_SLOT void uncheckAll(); - void setCheckStateForAll(Qt::CheckState checkState); - - const QList<MaemoDeployableListModel *> m_models; - Ui::MaemoProFilesUpdateDialog *ui; -}; - -} // namespace Qt4ProjectManager -} // namespace Internal - -#endif // MAEMOPROFILESUPDATEDIALOG_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui deleted file mode 100644 index 22d38a5eab..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoProFilesUpdateDialog</class> - <widget class="QDialog" name="MaemoProFilesUpdateDialog"> - <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 Maemo 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>MaemoProFilesUpdateDialog</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>MaemoProFilesUpdateDialog</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/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp deleted file mode 100644 index cc2797d6bf..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopublishedprojectmodel.h" - -#include <QtCore/QFileInfo> - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const int IncludeColumn = 2; -} // anonymous namespace - -MaemoPublishedProjectModel::MaemoPublishedProjectModel(QObject *parent) - : QFileSystemModel(parent) -{ - setFilter(filter() | QDir::Hidden | QDir::System); -} - -void MaemoPublishedProjectModel::initFilesToExclude() -{ - initFilesToExclude(rootPath()); -} - -void MaemoPublishedProjectModel::initFilesToExclude(const QString &filePath) -{ - QFileInfo fi(filePath); - if (fi.isDir()) { - const QStringList fileNames = QDir(filePath).entryList(QDir::Files - | QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden); - foreach (const QString &fileName, fileNames) - initFilesToExclude(filePath + QLatin1Char('/') + fileName); - } else { - const QString &fileName = fi.fileName(); - if (fi.isHidden() || fileName.endsWith(QLatin1String(".o")) - || fileName == QLatin1String("Makefile") - || fileName.contains(QLatin1String(".pro.user")) - || fileName.contains(QLatin1String(".so")) - || fileName.endsWith(QLatin1String(".a"))) { - m_filesToExclude.insert(filePath); - } - } -} - -int MaemoPublishedProjectModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return IncludeColumn + 1; -} - -int MaemoPublishedProjectModel::rowCount(const QModelIndex &parent) const -{ - if (isDir(parent) && m_filesToExclude.contains(filePath(parent))) - return 0; - return QFileSystemModel::rowCount(parent); -} - -QVariant MaemoPublishedProjectModel::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (orientation != Qt::Horizontal || section != IncludeColumn) - return QFileSystemModel::headerData(section, orientation, role); - return tr("Include in package"); -} - -Qt::ItemFlags MaemoPublishedProjectModel::flags(const QModelIndex &index) const -{ - if (index.column() != IncludeColumn) - return QFileSystemModel::flags(index); - return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; -} - -QVariant MaemoPublishedProjectModel::data(const QModelIndex &index, - int role) const -{ - if (index.column() != IncludeColumn) - return QFileSystemModel::data(index, role); - const bool include = !m_filesToExclude.contains(filePath(index)); - if (role == Qt::DisplayRole) - return include ? tr("Include") : tr("Do not include"); - else if (role == Qt::CheckStateRole) - return include ? Qt::Checked : Qt::Unchecked; - else - return QVariant(); -} - -bool MaemoPublishedProjectModel::setData(const QModelIndex &index, - const QVariant &value, int role) -{ - if (index.column() != IncludeColumn) - return QFileSystemModel::setData(index, value, role); - if (role == Qt::CheckStateRole) { - if (value == Qt::Checked) { - m_filesToExclude.remove(filePath(index)); - } else { - m_filesToExclude.insert(filePath(index)); - } - if (isDir(index)) - emit layoutChanged(); - return true; - } - return false; -} - - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h deleted file mode 100644 index 35d4c1f306..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishedprojectmodel.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPUBLISHEDPROJECTMODEL_H -#define MAEMOPUBLISHEDPROJECTMODEL_H - -#include <QtCore/QSet> -#include <QtCore/QStringList> -#include <QtGui/QFileSystemModel> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPublishedProjectModel : public QFileSystemModel -{ - Q_OBJECT -public: - explicit MaemoPublishedProjectModel(QObject *parent = 0); - void initFilesToExclude(); - QStringList filesToExclude() const { return m_filesToExclude.toList(); } - -private: - virtual int columnCount(const QModelIndex &parent) const; - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role) const; - virtual QVariant data(const QModelIndex &index, int role) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - - void initFilesToExclude(const QString &filePath); - - QSet<QString> m_filesToExclude; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHEDPROJECTMODEL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp deleted file mode 100644 index 3a0070bd1e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.cpp +++ /dev/null @@ -1,643 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopublisherfremantlefree.h" - -#include "maemodeployablelistmodel.h" -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemopublishingfileselectiondialog.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <coreplugin/ifile.h> -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qmakestep.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qtsupport/baseqtversion.h> -#include <utils/fileutils.h> - -#include <QtCore/QCoreApplication> -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtCore/QStringList> -#include <QtGui/QIcon> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Core; -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPublisherFremantleFree::MaemoPublisherFremantleFree(const ProjectExplorer::Project *project, - QObject *parent) : - QObject(parent), - m_project(project), - m_state(Inactive), - m_sshParams(SshConnectionParameters::DefaultProxy) -{ - m_sshParams.authenticationType = SshConnectionParameters::AuthenticationByKey; - m_sshParams.timeout = 30; - m_sshParams.port = 22; - m_process = new QProcess(this); - connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), - SLOT(handleProcessFinished())); - connect(m_process, SIGNAL(error(QProcess::ProcessError)), - SLOT(handleProcessError(QProcess::ProcessError))); - connect(m_process, SIGNAL(readyReadStandardOutput()), - SLOT(handleProcessStdOut())); - connect(m_process, SIGNAL(readyReadStandardError()), - SLOT(handleProcessStdErr())); -} - -MaemoPublisherFremantleFree::~MaemoPublisherFremantleFree() -{ - ASSERT_STATE(Inactive); - m_process->kill(); -} - -void MaemoPublisherFremantleFree::publish() -{ - createPackage(); -} - -void MaemoPublisherFremantleFree::setSshParams(const QString &hostName, - const QString &userName, const QString &keyFile, const QString &remoteDir) -{ - Q_ASSERT(m_doUpload); - m_sshParams.host = hostName; - m_sshParams.userName = userName; - m_sshParams.privateKeyFile = keyFile; - m_remoteDir = remoteDir; -} - -void MaemoPublisherFremantleFree::cancel() -{ - finishWithFailure(tr("Canceled."), tr("Publishing canceled by user.")); -} - -void MaemoPublisherFremantleFree::createPackage() -{ - setState(CopyingProjectDir); - - const QStringList &problems = findProblems(); - if (!problems.isEmpty()) { - const QLatin1String separator("\n- "); - finishWithFailure(tr("The project is missing some information " - "important to publishing:") + separator + problems.join(separator), - tr("Publishing failed: Missing project information.")); - return; - } - - m_tmpProjectDir = tmpDirContainer() + QLatin1Char('/') - + m_project->displayName(); - if (QFileInfo(tmpDirContainer()).exists()) { - emit progressReport(tr("Removing left-over temporary directory ...")); - QString error; - if (!MaemoGlobal::removeRecursively(tmpDirContainer(), error)) { - finishWithFailure(tr("Error removing temporary directory: %1").arg(error), - tr("Publishing failed: Could not create source package.")); - return; - } - } - - emit progressReport(tr("Setting up temporary directory ...")); - if (!QDir::temp().mkdir(QFileInfo(tmpDirContainer()).fileName())) { - finishWithFailure(tr("Error: Could not create temporary directory."), - tr("Publishing failed: Could not create source package.")); - return; - } - if (!copyRecursively(m_project->projectDirectory(), m_tmpProjectDir)) { - finishWithFailure(tr("Error: Could not copy project directory"), - tr("Publishing failed: Could not create source package.")); - return; - } - if (!fixNewlines()) { - finishWithFailure(tr("Error: Could not fix newlines"), - tr("Publishing failed: Could not create source package.")); - 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); - setState(RunningQmake); - ProjectExplorer::AbstractProcessStep * const qmakeStep - = m_buildConfig->qmakeStep(); - qmakeStep->init(); - const ProjectExplorer::ProcessParameters * const pp - = qmakeStep->processParameters(); - m_process->start(pp->effectiveCommand() + QLatin1String(" ") - + pp->effectiveArguments()); -} - -bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath) -{ - if (m_state == Inactive) - return true; - - QFileInfo srcFileInfo(srcFilePath); - if (srcFileInfo.isDir()) { - if (srcFileInfo == QFileInfo(m_project->projectDirectory() - + QLatin1String("/debian"))) - return true; - QString actualSourcePath = srcFilePath; - QString actualTargetPath = tgtFilePath; - - if (srcFileInfo.fileName() == QLatin1String("qtc_packaging")) { - actualSourcePath += QLatin1String("/debian_fremantle"); - actualTargetPath.replace(QRegExp(QLatin1String("qtc_packaging$")), - QLatin1String("debian")); - } - - QDir targetDir(actualTargetPath); - targetDir.cdUp(); - if (!targetDir.mkdir(QFileInfo(actualTargetPath).fileName())) { - emit progressReport(tr("Failed to create directory '%1'.") - .arg(QDir::toNativeSeparators(actualTargetPath)), ErrorOutput); - return false; - } - QDir sourceDir(actualSourcePath); - QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Hidden - | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &fileName, fileNames) { - if (!copyRecursively(actualSourcePath + QLatin1Char('/') + fileName, - actualTargetPath + QLatin1Char('/') + fileName)) - return false; - } - } else { - if (tgtFilePath == m_tmpProjectDir + QLatin1String("/debian/rules")) { - Utils::FileReader reader; - if (!reader.fetch(srcFilePath)) { - emit progressReport(reader.errorString(), ErrorOutput); - return false; - } - QByteArray rulesContents = reader.data(); - rulesContents.replace("$(MAKE) clean", "# $(MAKE) clean"); - rulesContents.replace("# Add here commands to configure the package.", - "qmake " + QFileInfo(m_project->file()->fileName()).fileName().toLocal8Bit()); - MaemoDebianPackageCreationStep::ensureShlibdeps(rulesContents); - Utils::FileSaver saver(tgtFilePath); - saver.write(rulesContents); - if (!saver.finalize()) { - emit progressReport(saver.errorString(), ErrorOutput); - return false; - } - } else { - QFile srcFile(srcFilePath); - if (!srcFile.copy(tgtFilePath)) { - emit progressReport(tr("Could not copy file '%1' to '%2': %3.") - .arg(QDir::toNativeSeparators(srcFilePath), - QDir::toNativeSeparators(tgtFilePath), - srcFile.errorString())); - return false; - } - } - } - return true; -} - -bool MaemoPublisherFremantleFree::fixNewlines() -{ - QDir debianDir(m_tmpProjectDir + QLatin1String("/debian")); - const QStringList &fileNames = debianDir.entryList(QDir::Files); - foreach (const QString &fileName, fileNames) { - QString filePath = debianDir.filePath(fileName); - Utils::FileReader reader; - if (!reader.fetch(filePath)) - return false; - QByteArray contents = reader.data(); - const QByteArray crlf("\r\n"); - if (!contents.contains(crlf)) - continue; - contents.replace(crlf, "\n"); - Utils::FileSaver saver(filePath); - saver.write(contents); - if (!saver.finalize()) - return false; - } - return true; -} - -void MaemoPublisherFremantleFree::handleProcessError(QProcess::ProcessError error) -{ - if (error == QProcess::FailedToStart) - handleProcessFinished(true); -} - -void MaemoPublisherFremantleFree::handleProcessFinished() -{ - handleProcessFinished(false); -} - -void MaemoPublisherFremantleFree::handleProcessStdOut() -{ - if (m_state == RunningQmake || m_state == RunningMakeDistclean - || m_state == BuildingPackage) { - emit progressReport(QString::fromLocal8Bit(m_process->readAllStandardOutput()), - ToolStatusOutput); - } -} - -void MaemoPublisherFremantleFree::handleProcessStdErr() -{ - if (m_state == RunningQmake || m_state == RunningMakeDistclean - || m_state == BuildingPackage) { - emit progressReport(QString::fromLocal8Bit(m_process->readAllStandardError()), - ToolErrorOutput); - } -} - -void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart) -{ - ASSERT_STATE(QList<State>() << RunningQmake << RunningMakeDistclean - << BuildingPackage << Inactive); - - switch (m_state) { - case RunningQmake: - if (failedToStart || m_process->exitStatus() != QProcess::NormalExit - ||m_process->exitCode() != 0) { - runDpkgBuildPackage(); - } else { - setState(RunningMakeDistclean); - m_process->start(m_buildConfig->makeCommand(), - QStringList() << QLatin1String("distclean")); - } - break; - case RunningMakeDistclean: - runDpkgBuildPackage(); - break; - case BuildingPackage: { - QString error; - if (failedToStart) { - error = tr("Error: Failed to start dpkg-buildpackage."); - } else if (m_process->exitStatus() != QProcess::NormalExit - || m_process->exitCode() != 0) { - error = tr("Error: dpkg-buildpackage did not succeed."); - } - - if (!error.isEmpty()) { - finishWithFailure(error, tr("Package creation failed.")); - return; - } - - QDir dir(tmpDirContainer()); - const QStringList &fileNames = dir.entryList(QDir::Files); - foreach (const QString &fileName, fileNames) { - const QString filePath - = tmpDirContainer() + QLatin1Char('/') + fileName; - if (fileName.endsWith(QLatin1String(".dsc"))) - m_filesToUpload.append(filePath); - else - m_filesToUpload.prepend(filePath); - } - if (!m_doUpload) { - emit progressReport(tr("Done.")); - QStringList nativeFilePaths; - foreach (const QString &filePath, m_filesToUpload) - nativeFilePaths << QDir::toNativeSeparators(filePath); - m_resultString = tr("Packaging finished successfully. " - "The following files were created:\n") - + nativeFilePaths.join(QLatin1String("\n")); - setState(Inactive); - } else { - uploadPackage(); - } - break; - } - default: - break; - } -} - -void MaemoPublisherFremantleFree::runDpkgBuildPackage() -{ - MaemoPublishingFileSelectionDialog d(m_tmpProjectDir); - if (d.exec() == QDialog::Rejected) { - cancel(); - return; - } - foreach (const QString &filePath, d.filesToExclude()) { - QString error; - if (!MaemoGlobal::removeRecursively(filePath, error)) { - finishWithFailure(error, - tr("Publishing failed: Could not create package.")); - } - } - - QtSupport::BaseQtVersion *lqt = m_buildConfig->qtVersion(); - if (!lqt) - finishWithFailure(QString(), tr("No qt version set")); - - if (m_state == Inactive) - return; - setState(BuildingPackage); - emit progressReport(tr("Building source package...")); - const QStringList args = QStringList() << QLatin1String("dpkg-buildpackage") - << QLatin1String("-S") << QLatin1String("-us") << QLatin1String("-uc"); - MaemoGlobal::callMad(*m_process, args, lqt->qmakeCommand(), true); -} - -// We have to implement the SCP protocol, because the maemo.org -// webmaster refuses to enable SFTP "for security reasons" ... -void MaemoPublisherFremantleFree::uploadPackage() -{ - m_uploader = SshRemoteProcessRunner::create(m_sshParams); - connect(m_uploader.data(), SIGNAL(processStarted()), - SLOT(handleScpStarted())); - connect(m_uploader.data(), SIGNAL(connectionError(Utils::SshError)), - SLOT(handleConnectionError())); - connect(m_uploader.data(), SIGNAL(processClosed(int)), - SLOT(handleUploadJobFinished(int))); - connect(m_uploader.data(), SIGNAL(processOutputAvailable(QByteArray)), - SLOT(handleScpStdOut(QByteArray))); - emit progressReport(tr("Starting scp ...")); - setState(StartingScp); - m_uploader->run("scp -td " + m_remoteDir.toUtf8()); -} - -void MaemoPublisherFremantleFree::handleScpStarted() -{ - ASSERT_STATE(QList<State>() << StartingScp << Inactive); - - if (m_state == StartingScp) - prepareToSendFile(); -} - -void MaemoPublisherFremantleFree::handleConnectionError() -{ - if (m_state != Inactive) { - finishWithFailure(tr("SSH error: %1").arg(m_uploader->connection()->errorString()), - tr("Upload failed.")); - } -} - -void MaemoPublisherFremantleFree::handleUploadJobFinished(int exitStatus) -{ - ASSERT_STATE(QList<State>() << PreparingToUploadFile << UploadingFile - << Inactive); - - if (m_state != Inactive && (exitStatus != SshRemoteProcess::ExitedNormally - || m_uploader->process()->exitCode() != 0)) { - QString error; - if (exitStatus != SshRemoteProcess::ExitedNormally) { - error = tr("Error uploading file: %1") - .arg(m_uploader->process()->errorString()); - } else { - error = tr("Error uploading file."); - } - finishWithFailure(error, tr("Upload failed.")); - } -} - -void MaemoPublisherFremantleFree::prepareToSendFile() -{ - if (m_filesToUpload.isEmpty()) { - emit progressReport(tr("All files uploaded.")); - m_resultString = tr("Upload succeeded. You should shortly " - "receive an email informing you about the outcome " - "of the build process."); - setState(Inactive); - return; - } - - setState(PreparingToUploadFile); - const QString &nextFilePath = m_filesToUpload.first(); - emit progressReport(tr("Uploading file %1 ...") - .arg(QDir::toNativeSeparators(nextFilePath))); - QFileInfo info(nextFilePath); - m_uploader->process()->sendInput("C0644 " + QByteArray::number(info.size()) - + ' ' + info.fileName().toUtf8() + '\n'); -} - -void MaemoPublisherFremantleFree::sendFile() -{ - Q_ASSERT(!m_filesToUpload.isEmpty()); - Q_ASSERT(m_state == PreparingToUploadFile); - - setState(UploadingFile); - const QString filePath = m_filesToUpload.takeFirst(); - QFile file(filePath); - if (!file.open(QIODevice::ReadOnly)) { - finishWithFailure(tr("Cannot open file for reading: %1") - .arg(file.errorString()), tr("Upload failed.")); - return; - } - qint64 bytesToSend = file.size(); - while (bytesToSend > 0) { - const QByteArray &data - = file.read(qMin(bytesToSend, Q_INT64_C(1024*1024))); - if (data.count() == 0) { - finishWithFailure(tr("Cannot read file: %1").arg(file.errorString()), - tr("Upload failed.")); - return; - } - m_uploader->process()->sendInput(data); - bytesToSend -= data.size(); - QCoreApplication::processEvents(); - if (m_state == Inactive) - return; - } - m_uploader->process()->sendInput(QByteArray(1, '\0')); -} - -void MaemoPublisherFremantleFree::handleScpStdOut(const QByteArray &output) -{ - ASSERT_STATE(QList<State>() << PreparingToUploadFile << UploadingFile - << Inactive); - - if (m_state == Inactive) - return; - - m_scpOutput += output; - if (m_scpOutput == QByteArray(1, '\0')) { - m_scpOutput.clear(); - switch (m_state) { - case PreparingToUploadFile: - sendFile(); - break; - case UploadingFile: - prepareToSendFile(); - break; - default: - break; - } - } else if (m_scpOutput.endsWith('\n')) { - const QByteArray error = m_scpOutput.mid(1, m_scpOutput.count() - 2); - QString progressError; - if (!error.isEmpty()) { - progressError = tr("Error uploading file: %1") - .arg(QString::fromUtf8(error)); - } else { - progressError = tr("Error uploading file."); - } - finishWithFailure(progressError, tr("Upload failed.")); - } -} - -QString MaemoPublisherFremantleFree::tmpDirContainer() const -{ - return QDir::tempPath() + QLatin1String("/qtc_packaging_") - + m_project->displayName(); -} - -void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg, - const QString &resultMsg) -{ - if (!progressMsg.isEmpty()) - emit progressReport(progressMsg, ErrorOutput); - m_resultString = resultMsg; - setState(Inactive); -} - -bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const -{ - bool success = true; - const Qt4MaemoDeployConfiguration * const deployConfig - = qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration()); - const QSharedPointer<MaemoDeployables> deployables - = deployConfig->deployables(); - for (int i = 0; i < deployables->modelCount(); ++i) { - const MaemoDeployableListModel * const model = deployables->modelAt(i); - QString desktopFilePath = model->localDesktopFilePath(); - 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; - const Qt4Maemo5Target * const target - = qobject_cast<Qt4Maemo5Target *>(m_buildConfig->target()); - const QString &description = target->shortDescription(); - if (description.trimmed().isEmpty()) { - problems << tr("The package description is empty. You must set one " - "in Projects -> Run -> Create Package -> Details."); - } else if (description.contains(QLatin1String("insert up to"))) { - problems << tr("The package description is '%1', which is probably " - "not what you want. Please change it in " - "Projects -> Run -> Create Package -> Details.").arg(description); - } - QString dummy; - if (target->packageManagerIcon(&dummy).isNull()) - problems << tr("You have not set an icon for the package manager. " - "The icon must be set in Projects -> Run -> Create Package -> Details."); - return problems; -} - -void MaemoPublisherFremantleFree::setState(State newState) -{ - if (m_state == newState) - return; - const State oldState = m_state; - m_state = newState; - if (m_state == Inactive) { - switch (oldState) { - case RunningQmake: - case RunningMakeDistclean: - case BuildingPackage: - disconnect(m_process, 0, this, 0); - m_process->terminate(); - break; - case StartingScp: - case PreparingToUploadFile: - case UploadingFile: - // TODO: Can we ensure the remote scp exits, e.g. by sending - // an illegal sequence of bytes? (Probably not, if - // we are currently uploading a file.) - disconnect(m_uploader.data(), 0, this, 0); - m_uploader = SshRemoteProcessRunner::Ptr(); - break; - default: - break; - } - emit finished(); - } -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h deleted file mode 100644 index e1bcd7d18a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublisherfremantlefree.h +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPUBLISHERFREMANTLEFREE_H -#define MAEMOPUBLISHERFREMANTLEFREE_H - -#include <utils/ssh/sshremoteprocessrunner.h> - -#include <QtCore/QObject> -#include <QtCore/QProcess> - -namespace ProjectExplorer { -class Project; -} - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -namespace Internal { - -class MaemoPublisherFremantleFree : public QObject -{ - Q_OBJECT -public: - enum OutputType { - StatusOutput, ErrorOutput, ToolStatusOutput, ToolErrorOutput - }; - - explicit MaemoPublisherFremantleFree(const ProjectExplorer::Project *project, - QObject *parent = 0); - ~MaemoPublisherFremantleFree(); - - void publish(); - void cancel(); - - void setBuildConfiguration(const Qt4BuildConfiguration *buildConfig) { m_buildConfig = buildConfig; } - void setDoUpload(bool doUpload) { m_doUpload = doUpload; } - void setSshParams(const QString &hostName, const QString &userName, - const QString &keyFile, const QString &remoteDir); - - QString resultString() const { return m_resultString; } - -signals: - void progressReport(const QString &text, - MaemoPublisherFremantleFree::OutputType = StatusOutput); - void finished(); - -private slots: - void handleProcessFinished(); - void handleProcessStdOut(); - void handleProcessStdErr(); - void handleProcessError(QProcess::ProcessError error); - void handleScpStarted(); - void handleConnectionError(); - void handleUploadJobFinished(int exitStatus); - void handleScpStdOut(const QByteArray &output); - -private: - enum State { - Inactive, CopyingProjectDir, RunningQmake, RunningMakeDistclean, - BuildingPackage, StartingScp, PreparingToUploadFile, UploadingFile - }; - - void setState(State newState); - void createPackage(); - void uploadPackage(); - bool copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath); - bool fixNewlines(); - void handleProcessFinished(bool failedToStart); - void runDpkgBuildPackage(); - QString tmpDirContainer() const; - 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; - bool m_doUpload; - const Qt4BuildConfiguration *m_buildConfig; - State m_state; - QString m_tmpProjectDir; - QProcess *m_process; - Utils::SshConnectionParameters m_sshParams; - QString m_remoteDir; - QSharedPointer<Utils::SshRemoteProcessRunner> m_uploader; - QByteArray m_scpOutput; - QList<QString> m_filesToUpload; - QString m_resultString; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHERFREMANTLEFREE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp deleted file mode 100644 index 2af56dae1b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopublishingbuildsettingspagefremantlefree.h" -#include "ui_maemopublishingbuildsettingspagefremantlefree.h" - -#include "maemoglobal.h" -#include "maemopublisherfremantlefree.h" - -#include <projectexplorer/project.h> -#include <projectexplorer/target.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <qtsupport/baseqtversion.h> -#include <utils/qtcassert.h> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPublishingBuildSettingsPageFremantleFree::MaemoPublishingBuildSettingsPageFremantleFree(const Project *project, - MaemoPublisherFremantleFree *publisher, QWidget *parent) : - QWizardPage(parent), - m_publisher(publisher), - ui(new Ui::MaemoPublishingWizardPageFremantleFree) -{ - ui->setupUi(this); - collectBuildConfigurations(project); - QTC_ASSERT(!m_buildConfigs.isEmpty(), return); - foreach (const Qt4BuildConfiguration * const bc, m_buildConfigs) { - ui->buildConfigComboBox->addItem(bc->displayName()); - } - ui->buildConfigComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow); - ui->buildConfigComboBox->setCurrentIndex(0); - connect(ui->skipUploadCheckBox, SIGNAL(toggled(bool)), - SLOT(handleNoUploadSettingChanged())); -} - -MaemoPublishingBuildSettingsPageFremantleFree::~MaemoPublishingBuildSettingsPageFremantleFree() -{ - delete ui; -} - -void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(const Project *project) -{ - foreach (const Target *const target, project->targets()) { - if (target->id() != QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) - continue; - foreach (BuildConfiguration * const bc, target->buildConfigurations()) { - Qt4BuildConfiguration * const qt4Bc - = qobject_cast<Qt4BuildConfiguration *>(bc); - if (!qt4Bc) - continue; - - QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion(); - if (!lqt) - continue; - if (MaemoGlobal::version(lqt->qmakeCommand()) == MaemoDeviceConfig::Maemo5) - m_buildConfigs << qt4Bc; - } - break; - } -} - -void MaemoPublishingBuildSettingsPageFremantleFree::initializePage() -{ - ui->skipUploadCheckBox->setChecked(true); -} - -bool MaemoPublishingBuildSettingsPageFremantleFree::validatePage() -{ - m_publisher->setBuildConfiguration(m_buildConfigs.at(ui->buildConfigComboBox->currentIndex())); - m_publisher->setDoUpload(!skipUpload()); - return true; -} - -void MaemoPublishingBuildSettingsPageFremantleFree::handleNoUploadSettingChanged() -{ - setCommitPage(skipUpload()); -} - -bool MaemoPublishingBuildSettingsPageFremantleFree::skipUpload() const -{ - return ui->skipUploadCheckBox->isChecked(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h deleted file mode 100644 index 283894f1ed..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H -#define MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H - -#include <QtCore/QList> -#include <QtGui/QWizardPage> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoPublishingWizardPageFremantleFree; -} -QT_END_NAMESPACE - -namespace ProjectExplorer { class Project; } - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; - -namespace Internal { -class MaemoPublisherFremantleFree; - -class MaemoPublishingBuildSettingsPageFremantleFree : public QWizardPage -{ - Q_OBJECT - -public: - explicit MaemoPublishingBuildSettingsPageFremantleFree(const ProjectExplorer::Project *project, - MaemoPublisherFremantleFree *publisher, QWidget *parent = 0); - ~MaemoPublishingBuildSettingsPageFremantleFree(); - -private: - Q_SLOT void handleNoUploadSettingChanged(); - virtual void initializePage(); - virtual bool validatePage(); - void collectBuildConfigurations(const ProjectExplorer::Project *project); - bool skipUpload() const; - - QList<Qt4BuildConfiguration *> m_buildConfigs; - MaemoPublisherFremantleFree * const m_publisher; - Ui::MaemoPublishingWizardPageFremantleFree *ui; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGBUILDSETTINGSPAGEFREMANTLEFREE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui deleted file mode 100644 index 6e536f6cc8..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingbuildsettingspagefremantlefree.ui +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoPublishingWizardPageFremantleFree</class> - <widget class="QWizardPage" name="MaemoPublishingWizardPageFremantleFree"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>433</width> - <height>149</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="buildConfigLabel"> - <property name="text"> - <string>Choose build configuration:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="buildConfigComboBox"/> - </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"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="skipUploadCheckBox"> - <property name="text"> - <string>Only create source package, do not upload</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>78</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp deleted file mode 100644 index 8c7762975c..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopublishingfileselectiondialog.h" -#include "ui_maemopublishingfileselectiondialog.h" - -#include "maemopublishedprojectmodel.h" - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPublishingFileSelectionDialog::MaemoPublishingFileSelectionDialog(const QString &projectPath, - QWidget *parent) : - QDialog(parent), - ui(new Ui::MaemoPublishingFileSelectionDialog) -{ - ui->setupUi(this); - m_projectModel = new MaemoPublishedProjectModel(this); - const QModelIndex rootIndex = m_projectModel->setRootPath(projectPath); - m_projectModel->initFilesToExclude(); - ui->projectView->setModel(m_projectModel); - ui->projectView->setRootIndex(rootIndex); - ui->projectView->header()->setResizeMode(0, QHeaderView::ResizeToContents); -} - -MaemoPublishingFileSelectionDialog::~MaemoPublishingFileSelectionDialog() -{ - delete ui; -} - -QStringList MaemoPublishingFileSelectionDialog::filesToExclude() const -{ - return m_projectModel->filesToExclude(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h deleted file mode 100644 index 7527147f7f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPUBLISHINGFILESELECTIONDIALOG_H -#define MAEMOPUBLISHINGFILESELECTIONDIALOG_H - -#include <QtCore/QStringList> -#include <QtGui/QDialog> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoPublishingFileSelectionDialog; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPublishingFileSelectionDialog : public QDialog -{ - Q_OBJECT - -public: - explicit MaemoPublishingFileSelectionDialog(const QString &projectPath, - QWidget *parent = 0); - ~MaemoPublishingFileSelectionDialog(); - QStringList filesToExclude() const; - -private: - Ui::MaemoPublishingFileSelectionDialog *ui; - class MaemoPublishedProjectModel *m_projectModel; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGFILESELECTIONDIALOG_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui deleted file mode 100644 index a66247f9ee..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingfileselectiondialog.ui +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoPublishingFileSelectionDialog</class> - <widget class="QDialog" name="MaemoPublishingFileSelectionDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>704</width> - <height>528</height> - </rect> - </property> - <property name="windowTitle"> - <string>Choose Package Contents</string> - </property> - <property name="modal"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string><b>Please select the files you want to be included in the source tarball.</b> -</string> - </property> - </widget> - </item> - <item> - <widget class="QTreeView" name="projectView"/> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>MaemoPublishingFileSelectionDialog</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>MaemoPublishingFileSelectionDialog</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/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp deleted file mode 100644 index 9a356e1be8..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopublishingresultpagefremantlefree.h" -#include "ui_maemopublishingresultpagefremantlefree.h" - -#include <QtGui/QAbstractButton> - -namespace Qt4ProjectManager { -namespace Internal { -typedef MaemoPublisherFremantleFree MPFF; - -MaemoPublishingResultPageFremantleFree::MaemoPublishingResultPageFremantleFree(MPFF *publisher, - QWidget *parent) : QWizardPage(parent), m_publisher(publisher), - ui(new Ui::MaemoPublishingResultPageFremantleFree) -{ - m_lastOutputType = MPFF::StatusOutput; - ui->setupUi(this); -} - -MaemoPublishingResultPageFremantleFree::~MaemoPublishingResultPageFremantleFree() -{ - delete ui; -} - -void MaemoPublishingResultPageFremantleFree::initializePage() -{ - cancelButton()->disconnect(); - connect(cancelButton(), SIGNAL(clicked()), SLOT(handleCancelRequest())); - connect(m_publisher, SIGNAL(finished()), SLOT(handleFinished())); - connect(m_publisher, - SIGNAL(progressReport(QString, MaemoPublisherFremantleFree::OutputType)), - SLOT(handleProgress(QString, MaemoPublisherFremantleFree::OutputType))); - m_publisher->publish(); -} - -void MaemoPublishingResultPageFremantleFree::handleFinished() -{ - handleProgress(m_publisher->resultString(), MPFF::StatusOutput); - m_isComplete = true; - cancelButton()->setEnabled(false); - emit completeChanged(); -} - -void MaemoPublishingResultPageFremantleFree::handleProgress(const QString &text, - MPFF::OutputType type) -{ - const QString color = QLatin1String(type == MPFF::StatusOutput - || type == MPFF::ToolStatusOutput ? "blue" : "red"); - ui->progressTextEdit->setTextColor(QColor(color)); - const bool bold = type == MPFF::StatusOutput - || type == MPFF::ErrorOutput ? true : false; - QFont font = ui->progressTextEdit->currentFont(); - font.setBold(bold); - ui->progressTextEdit->setCurrentFont(font); - - if (type == MPFF::StatusOutput || type == MPFF::ErrorOutput - || m_lastOutputType == MPFF::StatusOutput - || m_lastOutputType == MPFF::ErrorOutput) { - ui->progressTextEdit->append(text); - } else { - ui->progressTextEdit->insertPlainText(text); - } - ui->progressTextEdit->moveCursor(QTextCursor::End); - m_lastOutputType = type; -} - -void MaemoPublishingResultPageFremantleFree::handleCancelRequest() -{ - cancelButton()->setEnabled(false); - m_publisher->cancel(); -} - -QAbstractButton *MaemoPublishingResultPageFremantleFree::cancelButton() const -{ - return wizard()->button(QWizard::CancelButton); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h deleted file mode 100644 index 533374e73a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H -#define MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H - -#include "maemopublisherfremantlefree.h" -#include <QtGui/QWizardPage> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoPublishingResultPageFremantleFree; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPublishingResultPageFremantleFree : public QWizardPage -{ - Q_OBJECT - -public: - explicit MaemoPublishingResultPageFremantleFree(MaemoPublisherFremantleFree *publisher, - QWidget *parent = 0); - ~MaemoPublishingResultPageFremantleFree(); - -private slots: - void handleFinished(); - void handleProgress(const QString &text, - MaemoPublisherFremantleFree::OutputType type); - void handleCancelRequest(); - -private: - virtual bool isComplete() const { return m_isComplete; } - virtual void initializePage(); - - QAbstractButton *cancelButton() const; - - MaemoPublisherFremantleFree * const m_publisher; - bool m_isComplete; - MaemoPublisherFremantleFree::OutputType m_lastOutputType; - Ui::MaemoPublishingResultPageFremantleFree *ui; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGRESULTPAGEFREMANTLEFREE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui deleted file mode 100644 index f7f429ccf8..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingresultpagefremantlefree.ui +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoPublishingResultPageFremantleFree</class> - <widget class="QWizardPage" name="MaemoPublishingResultPageFremantleFree"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>414</width> - <height>337</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="progressGroupBox"> - <property name="title"> - <string>Progress</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTextEdit" name="progressTextEdit"/> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp deleted file mode 100644 index 3991b24174..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopublishinguploadsettingspagefremantlefree.h" -#include "ui_maemopublishinguploadsettingspagefremantlefree.h" - -#include "maemopublisherfremantlefree.h" - -#include <utils/pathchooser.h> - -#include <QtCore/QDir> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPublishingUploadSettingsPageFremantleFree::MaemoPublishingUploadSettingsPageFremantleFree(MaemoPublisherFremantleFree *publisher, - QWidget *parent) : - QWizardPage(parent), - m_publisher(publisher), - ui(new Ui::MaemoPublishingUploadSettingsPageFremantleFree) -{ - ui->setupUi(this); - ui->serverAddressLabel->hide(); - ui->serverAddressLineEdit->hide(); - ui->targetDirectoryOnServerLabel->hide(); - ui->targetDirectoryOnServerLineEdit->hide(); - setTitle(tr("Publishing to Fremantle's \"Extras-devel/free\" Repository")); - setSubTitle(tr("Upload options")); - connect(ui->garageAccountLineEdit, SIGNAL(textChanged(QString)), - SIGNAL(completeChanged())); - connect(ui->privateKeyPathChooser, SIGNAL(changed(QString)), - SIGNAL(completeChanged())); - connect(ui->serverAddressLineEdit, SIGNAL(textChanged(QString)), - SIGNAL(completeChanged())); - connect(ui->targetDirectoryOnServerLineEdit, SIGNAL(textChanged(QString)), - SIGNAL(completeChanged())); -} - -MaemoPublishingUploadSettingsPageFremantleFree::~MaemoPublishingUploadSettingsPageFremantleFree() -{ - delete ui; -} - -void MaemoPublishingUploadSettingsPageFremantleFree::initializePage() -{ - ui->garageAccountLineEdit->clear(); - ui->privateKeyPathChooser->setExpectedKind(Utils::PathChooser::File); - ui->privateKeyPathChooser->setPromptDialogTitle(tr("Choose a private key file")); - ui->privateKeyPathChooser->setPath(QDir::toNativeSeparators(QDir::homePath() + QLatin1String("/.ssh/id_rsa"))); - ui->serverAddressLineEdit->setText(QLatin1String("drop.maemo.org")); - ui->targetDirectoryOnServerLineEdit->setText(QLatin1String("/var/www/extras-devel/incoming-builder/fremantle/")); -} - -bool MaemoPublishingUploadSettingsPageFremantleFree::isComplete() const -{ - return !garageAccountName().isEmpty() && !privateKeyFilePath().isEmpty() - && !serverName().isEmpty() && !directoryOnServer().isEmpty(); -} - -QString MaemoPublishingUploadSettingsPageFremantleFree::garageAccountName() const -{ - return ui->garageAccountLineEdit->text().trimmed(); -} - -QString MaemoPublishingUploadSettingsPageFremantleFree::privateKeyFilePath() const -{ - return ui->privateKeyPathChooser->path(); -} - -QString MaemoPublishingUploadSettingsPageFremantleFree::serverName() const -{ - return ui->serverAddressLineEdit->text().trimmed(); -} - -QString MaemoPublishingUploadSettingsPageFremantleFree::directoryOnServer() const -{ - return ui->targetDirectoryOnServerLineEdit->text().trimmed(); -} - -bool MaemoPublishingUploadSettingsPageFremantleFree::validatePage() -{ - m_publisher->setSshParams(serverName(), garageAccountName(), - privateKeyFilePath(), directoryOnServer()); - return true; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h deleted file mode 100644 index 3a5891a3bd..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H -#define MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H - -#include <QtGui/QWizardPage> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoPublishingUploadSettingsPageFremantleFree; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoPublisherFremantleFree; - -class MaemoPublishingUploadSettingsPageFremantleFree : public QWizardPage -{ - Q_OBJECT - -public: - explicit MaemoPublishingUploadSettingsPageFremantleFree(MaemoPublisherFremantleFree *publisher, - QWidget *parent = 0); - ~MaemoPublishingUploadSettingsPageFremantleFree(); - -private: - virtual void initializePage(); - virtual bool isComplete() const; - virtual bool validatePage(); - - QString garageAccountName() const; - QString privateKeyFilePath() const; - QString serverName() const; - QString directoryOnServer() const; - - MaemoPublisherFremantleFree * const m_publisher; - Ui::MaemoPublishingUploadSettingsPageFremantleFree *ui; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGUPLOADSETTINGSWIZARDPAGE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui deleted file mode 100644 index 48064654d3..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishinguploadsettingspagefremantlefree.ui +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoPublishingUploadSettingsPageFremantleFree</class> - <widget class="QWizardPage" name="MaemoPublishingUploadSettingsPageFremantleFree"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>636</width> - <height>128</height> - </rect> - </property> - <property name="windowTitle"> - <string>WizardPage</string> - </property> - <property name="title"> - <string>Upload Settings</string> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="accountNameLabel"> - <property name="text"> - <string>Garage account name:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLineEdit" name="garageAccountLineEdit"/> - </item> - <item> - <widget class="QLabel" name="getAccountLabel"> - <property name="text"> - <string><a href="https://garage.maemo.org/account/register.php">Get an account</a></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string><a href="https://garage.maemo.org/extras-assistant/index.php">Request upload rights</a></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="keyFileLabel"> - <property name="text"> - <string>Private key file:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="Utils::PathChooser" name="privateKeyPathChooser" native="true"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="serverAddressLabel"> - <property name="text"> - <string>Server address:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="serverAddressLineEdit"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="targetDirectoryOnServerLabel"> - <property name="text"> - <string>Target directory on server:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="targetDirectoryOnServerLineEdit"/> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QWidget</extends> - <header location="global">utils/pathchooser.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp deleted file mode 100644 index 9ff41fcea4..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemopublishingwizardfactories.h" - -#include "maemoglobal.h" -#include "maemopublishingwizardfremantlefree.h" - -#include <projectexplorer/target.h> -#include <qt4projectmanager/qmakestep.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <qtsupport/baseqtversion.h> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoPublishingWizardFactoryFremantleFree::MaemoPublishingWizardFactoryFremantleFree(QObject *parent) - : IPublishingWizardFactory(parent) -{ -} - -QString MaemoPublishingWizardFactoryFremantleFree::displayName() const -{ - return tr("Publish for \"Fremantle Extras-devel free\" repository"); -} - -QString MaemoPublishingWizardFactoryFremantleFree::description() const -{ - return tr("This wizard will create a source archive and optionally upload " - "it to a build server, where the project will be compiled and " - "packaged and then moved to the \"Extras-devel free\" " - "repository, from where users can install it onto their N900 " - "devices. For the upload functionality, an account at " - "garage.maemo.org is required."); -} - -bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *project) const -{ - if (!qobject_cast<const Qt4Project *>(project)) - return false; - foreach (const Target *const target, project->targets()) { - if (target->id() != QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) - continue; - foreach (const BuildConfiguration *const bc, target->buildConfigurations()) { - const Qt4BuildConfiguration *const qt4Bc - = qobject_cast<const Qt4BuildConfiguration *>(bc); - if (!qt4Bc) - continue; - - QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion(); - if (!qt) - continue; - if (MaemoGlobal::version(qt->qmakeCommand()) == MaemoDeviceConfig::Maemo5) - return true; - } - break; - } - return false; -} - -QWizard *MaemoPublishingWizardFactoryFremantleFree::createWizard(const Project *project) const -{ - Q_ASSERT(canCreateWizard(project)); - return new MaemoPublishingWizardFremantleFree(project); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h deleted file mode 100644 index dc1594f203..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfactories.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOPUBLISHINGSERVICE_H -#define MAEMOPUBLISHINGSERVICE_H - -#include <projectexplorer/publishing/ipublishingwizardfactory.h> - -namespace Core { -class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoPublishingWizardFactoryFremantleFree - : public ProjectExplorer::IPublishingWizardFactory -{ - Q_OBJECT -public: - explicit MaemoPublishingWizardFactoryFremantleFree(QObject *parent =0); -private: - virtual QString displayName() const; - virtual QString description() const; - virtual bool canCreateWizard(const ProjectExplorer::Project *project) const; - virtual QWizard *createWizard(const ProjectExplorer::Project *project) const; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGSERVICE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp deleted file mode 100644 index 9e2959a7e8..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemopublishingwizardfremantlefree.h" - -#include "maemopublishingresultpagefremantlefree.h" -#include "maemopublisherfremantlefree.h" -#include "maemopublishinguploadsettingspagefremantlefree.h" -#include "maemopublishingbuildsettingspagefremantlefree.h" - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -enum PageId { BuildSettingsPageId, UploadSettingsPageId, ResultPageId }; -} // anonymous namespace - -MaemoPublishingWizardFremantleFree::MaemoPublishingWizardFremantleFree(const Project *project, - QWidget *parent) : - Wizard(parent), - m_project(project), - m_publisher(new MaemoPublisherFremantleFree(project, this)) -{ - setOption(NoCancelButton, false); - setWindowTitle(tr("Publishing to Fremantle's \"Extras-devel free\" Repository")); - - m_buildSettingsPage - = new MaemoPublishingBuildSettingsPageFremantleFree(project, m_publisher); - m_buildSettingsPage->setTitle(tr("Build Settings")); - setPage(BuildSettingsPageId, m_buildSettingsPage); - - m_uploadSettingsPage - = new MaemoPublishingUploadSettingsPageFremantleFree(m_publisher); - m_uploadSettingsPage->setTitle(tr("Upload Settings")); - m_uploadSettingsPage->setCommitPage(true); - setPage(UploadSettingsPageId, m_uploadSettingsPage); - - m_resultPage = new MaemoPublishingResultPageFremantleFree(m_publisher); - m_resultPage->setTitle(tr("Result")); - setPage(ResultPageId, m_resultPage); -} - -int MaemoPublishingWizardFremantleFree::nextId() const -{ - if (currentPage()->isCommitPage()) - return ResultPageId; - return QWizard::nextId(); -} - - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h b/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h deleted file mode 100644 index 9a3c0b628a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopublishingwizardfremantlefree.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H -#define MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H - -#include <utils/wizard.h> - -namespace ProjectExplorer { -class Project; -} - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoPublishingResultPageFremantleFree; -class MaemoPublisherFremantleFree; -class MaemoPublishingUploadSettingsPageFremantleFree; -class MaemoPublishingBuildSettingsPageFremantleFree; - -class MaemoPublishingWizardFremantleFree : public Utils::Wizard -{ - Q_OBJECT -public: - explicit MaemoPublishingWizardFremantleFree(const ProjectExplorer::Project *project, - QWidget *parent = 0); - -private: - virtual int nextId() const; - - const ProjectExplorer::Project * const m_project; - MaemoPublisherFremantleFree * const m_publisher; - MaemoPublishingBuildSettingsPageFremantleFree *m_buildSettingsPage; - MaemoPublishingUploadSettingsPageFremantleFree *m_uploadSettingsPage; - MaemoPublishingResultPageFremantleFree *m_resultPage; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOPUBLISHINGWIZARDFREMANTLEFREE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp deleted file mode 100644 index b3882ded56..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp +++ /dev/null @@ -1,622 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoqemumanager.h" - -#include "maemoglobal.h" -#include "maemomanager.h" -#include "maemoqemuruntimeparser.h" -#include "maemosettingspages.h" -#include "maemorunconfiguration.h" -#include "qt4project.h" -#include "qt4projectmanagerconstants.h" -#include "qt4maemotarget.h" -#include "maemoqtversion.h" - -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/actionmanager/command.h> -#include <coreplugin/uniqueidmanager.h> -#include <coreplugin/coreconstants.h> -#include <coreplugin/icore.h> -#include <coreplugin/icontext.h> -#include <coreplugin/modemanager.h> - -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/session.h> -#include <qtsupport/qtversionmanager.h> -#include <utils/filesystemwatcher.h> - -#include <QtCore/QDebug> -#include <QtCore/QDir> -#include <QtCore/QList> -#include <QtCore/QSet> -#include <QtCore/QStringBuilder> - -#include <QtGui/QAction> -#include <QtGui/QDesktopServices> -#include <QtGui/QMessageBox> - -#include <limits.h> - -using namespace ProjectExplorer; -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -MaemoQemuManager *MaemoQemuManager::m_instance = 0; - -const QSize iconSize = QSize(24, 20); - -MaemoQemuManager::MaemoQemuManager(QObject *parent) - : QObject(parent) - , m_qemuAction(0) - , m_qemuProcess(new QProcess(this)) - , m_runningQtId(INT_MIN) - , m_userTerminated(false) - , m_runtimeRootWatcher(0) - , m_runtimeFolderWatcher(0) -{ - m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize); - m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize, - QIcon::Normal, QIcon::On); - - m_qemuAction = new QAction("Maemo Emulator", this); - m_qemuAction->setIcon(m_qemuStarterIcon.pixmap(iconSize)); - m_qemuAction->setToolTip(tr("Start Maemo Emulator")); - connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); - - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *actionManager = core->actionManager(); - Core::Command *qemuCommand = actionManager->registerAction(m_qemuAction, - "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL)); - qemuCommand->setAttribute(Core::Command::CA_UpdateText); - qemuCommand->setAttribute(Core::Command::CA_UpdateIcon); - - Core::ModeManager *modeManager = core->modeManager(); - modeManager->addAction(qemuCommand->action(), 1); - m_qemuAction->setEnabled(false); - m_qemuAction->setVisible(false); - - // listen to qt version changes to update the start button - connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>)), - this, SLOT(qtVersionsChanged(QList<int>))); - - // listen to project add, remove and startup changes to udate start button - SessionManager *session = ProjectExplorerPlugin::instance()->session(); - connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this, - SLOT(projectAdded(ProjectExplorer::Project*))); - connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this, - SLOT(projectRemoved(ProjectExplorer::Project*))); - connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), - this, SLOT(projectChanged(ProjectExplorer::Project*))); - - connect(m_qemuProcess, SIGNAL(error(QProcess::ProcessError)), this, - SLOT(qemuProcessError(QProcess::ProcessError))); - connect(m_qemuProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, - SLOT(qemuProcessFinished())); - connect(m_qemuProcess, SIGNAL(readyReadStandardOutput()), this, - SLOT(qemuOutput())); - connect(m_qemuProcess, SIGNAL(readyReadStandardError()), this, - SLOT(qemuOutput())); - connect(this, SIGNAL(qemuProcessStatus(QemuStatus, QString)), - this, SLOT(qemuStatusChanged(QemuStatus, QString))); -} - -Utils::FileSystemWatcher *MaemoQemuManager::runtimeRootWatcher() -{ - if (!m_runtimeRootWatcher) { - m_runtimeRootWatcher = new Utils::FileSystemWatcher(this); - m_runtimeRootWatcher->setObjectName(QLatin1String("MaemoQemuRuntimeRootWatcher")); - connect(m_runtimeRootWatcher, SIGNAL(directoryChanged(QString)), this, - SLOT(runtimeRootChanged(QString))); - } - return m_runtimeRootWatcher; -} - -Utils::FileSystemWatcher *MaemoQemuManager::runtimeFolderWatcher() -{ - if (!m_runtimeFolderWatcher) { - m_runtimeFolderWatcher = new Utils::FileSystemWatcher(this); - m_runtimeFolderWatcher->setObjectName(QLatin1String("MaemoQemuRuntimeFolderWatcher")); - connect(m_runtimeFolderWatcher, SIGNAL(directoryChanged(QString)), this, - SLOT(runtimeFolderChanged(QString))); - } - return m_runtimeFolderWatcher; -} - -MaemoQemuManager::~MaemoQemuManager() -{ - terminateRuntime(); - m_instance = 0; -} - -MaemoQemuManager &MaemoQemuManager::instance(QObject *parent) -{ - if (m_instance == 0) - m_instance = new MaemoQemuManager(parent); - return *m_instance; -} - -bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const -{ - *rt = m_runtimes.value(uniqueId, MaemoQemuRuntime()); - return rt->isValid(); -} - -bool MaemoQemuManager::qemuIsRunning() const -{ - return m_runningQtId != INT_MIN; -} - -void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds) -{ - QtSupport::QtVersionManager *manager = QtSupport::QtVersionManager::instance(); - foreach (int uniqueId, uniqueIds) { - if (manager->isValidId(uniqueId)) { - MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(manager->version(uniqueId)); - - if (version) { - MaemoQemuRuntime runtime - = MaemoQemuRuntimeParser::parseRuntime(version); - if (runtime.isValid()) { - m_runtimes.insert(uniqueId, runtime); - if (!runtimeRootWatcher()->watchesDirectory(runtime.m_watchPath)) - runtimeRootWatcher()->addDirectory(runtime.m_watchPath, - Utils::FileSystemWatcher::WatchAllChanges); - } else { - m_runtimes.remove(uniqueId); - } - } - } else { - // this qt version has been removed from the settings - m_runtimes.remove(uniqueId); - if (uniqueId == m_runningQtId) { - terminateRuntime(); - emit qemuProcessStatus(QemuUserReason, tr("Qemu has been shut " - "down, because you removed the corresponding Qt version.")); - } - } - } - - showOrHideQemuButton(); -} - -void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project) -{ - // handle all target related changes, add, remove, etc... - connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this, - SLOT(targetAdded(ProjectExplorer::Target*))); - connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this, - SLOT(targetRemoved(ProjectExplorer::Target*))); - connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)), - this, SLOT(targetChanged(ProjectExplorer::Target*))); - - foreach (Target *target, project->targets()) - targetAdded(target); -} - -void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project) -{ - disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this, - SLOT(targetAdded(ProjectExplorer::Target*))); - disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this, - SLOT(targetRemoved(ProjectExplorer::Target*))); - disconnect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)), - this, SLOT(targetChanged(ProjectExplorer::Target*))); - - foreach (Target *target, project->targets()) - targetRemoved(target); - showOrHideQemuButton(); -} - -void MaemoQemuManager::projectChanged(ProjectExplorer::Project *project) -{ - if (project) { - toggleStarterButton(project->activeTarget()); - deviceConfigurationChanged(project->activeTarget()); - } -} - -void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target) -{ - if (!target || !MaemoGlobal::isMaemoTargetId(target->id())) - return; - - // handle all run configuration changes, add, remove, etc... - connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationAdded(ProjectExplorer::RunConfiguration*))); - connect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationRemoved(ProjectExplorer::RunConfiguration*))); - connect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationChanged(ProjectExplorer::RunConfiguration*))); - - // handle all build configuration changes, add, remove, etc... - connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationAdded(ProjectExplorer::BuildConfiguration*))); - connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationRemoved(ProjectExplorer::BuildConfiguration*))); - connect(target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationChanged(ProjectExplorer::BuildConfiguration*))); - - // handle the qt version changes the build configuration uses - connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); - - foreach (RunConfiguration *rc, target->runConfigurations()) - toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true); - toggleStarterButton(target); -} - -void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target) -{ - if (!target || !MaemoGlobal::isMaemoTargetId(target->id())) - return; - - disconnect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationAdded(ProjectExplorer::RunConfiguration*))); - disconnect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationRemoved(ProjectExplorer::RunConfiguration*))); - disconnect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)), - this, SLOT(runConfigurationChanged(ProjectExplorer::RunConfiguration*))); - - disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationAdded(ProjectExplorer::BuildConfiguration*))); - disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationRemoved(ProjectExplorer::BuildConfiguration*))); - disconnect(target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(buildConfigurationChanged(ProjectExplorer::BuildConfiguration*))); - - disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); - - foreach (RunConfiguration *rc, target->runConfigurations()) - toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false); - showOrHideQemuButton(); -} - -void MaemoQemuManager::targetChanged(ProjectExplorer::Target *target) -{ - if (target) { - toggleStarterButton(target); - deviceConfigurationChanged(target); - } -} - -void MaemoQemuManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *rc) -{ - if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) - return; - toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true); -} - -void MaemoQemuManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc) -{ - if (!rc || !MaemoGlobal::isMaemoTargetId(rc->target()->id())) - return; - toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false); -} - -void MaemoQemuManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc) -{ - if (rc) - m_qemuAction->setEnabled(targetUsesMatchingRuntimeConfig(rc->target())); -} - -void MaemoQemuManager::buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc) -{ - if (!bc || !MaemoGlobal::isMaemoTargetId(bc->target()->id())) - return; - - connect(bc, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); -} - -void MaemoQemuManager::buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc) -{ - if (!bc || !MaemoGlobal::isMaemoTargetId(bc->target()->id())) - return; - - disconnect(bc, SIGNAL(environmentChanged()), this, SLOT(environmentChanged())); -} - -void MaemoQemuManager::buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc) -{ - if (bc) - toggleStarterButton(bc->target()); -} - -void MaemoQemuManager::environmentChanged() -{ - // likely to happen when the qt version changes the build config is using - if (ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance()) { - if (Project *project = explorer->session()->startupProject()) - toggleStarterButton(project->activeTarget()); - } -} - -void MaemoQemuManager::deviceConfigurationChanged(ProjectExplorer::Target *target) -{ - m_qemuAction->setEnabled(targetUsesMatchingRuntimeConfig(target)); -} - -void MaemoQemuManager::startRuntime() -{ - m_userTerminated = false; - Project *p = ProjectExplorerPlugin::instance()->session()->startupProject(); - if (!p) - return; - QtSupport::BaseQtVersion *version; - if (!targetUsesMatchingRuntimeConfig(p->activeTarget(), &version)) { - qWarning("Strange: Qemu button was enabled, but target does not match."); - return; - } - - m_runningQtId = version->uniqueId(); - const MaemoQemuRuntime rt = m_runtimes.value(version->uniqueId()); - m_qemuProcess->setProcessEnvironment(rt.environment()); - m_qemuProcess->setWorkingDirectory(rt.m_root); - m_qemuProcess->start(rt.m_bin % QLatin1Char(' ') % rt.m_args); - if (!m_qemuProcess->waitForStarted()) - return; - - emit qemuProcessStatus(QemuStarting); - connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(terminateRuntime())); - disconnect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); -} - -void MaemoQemuManager::terminateRuntime() -{ - m_userTerminated = true; - - if (m_qemuProcess->state() != QProcess::NotRunning) { - m_qemuProcess->terminate(); - m_qemuProcess->kill(); - } - - connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); - disconnect(m_qemuAction, SIGNAL(triggered()), this, SLOT(terminateRuntime())); -} - -void MaemoQemuManager::qemuProcessFinished() -{ - m_runningQtId = INT_MIN; - QemuStatus status = QemuFinished; - QString error; - - if (!m_userTerminated) { - if (m_qemuProcess->exitStatus() == QProcess::CrashExit) { - status = QemuCrashed; - error = m_qemuProcess->errorString(); - } else if (m_qemuProcess->exitCode() != 0) { - error = tr("Qemu finished with error: Exit code was %1.") - .arg(m_qemuProcess->exitCode()); - } - } - - m_userTerminated = false; - emit qemuProcessStatus(status, error); -} - -void MaemoQemuManager::qemuProcessError(QProcess::ProcessError error) -{ - if (error == QProcess::FailedToStart) - emit qemuProcessStatus(QemuFailedToStart, m_qemuProcess->errorString()); -} - -void MaemoQemuManager::qemuStatusChanged(QemuStatus status, const QString &error) -{ - bool running = false; - switch (status) { - case QemuStarting: - running = true; - break; - case QemuFailedToStart: - QMessageBox::warning(0, tr("Qemu error"), - tr("Qemu failed to start: %1")); - break; - case QemuCrashed: - MaemoManager::instance().qemuSettingsPage()->showQemuCrashDialog(); - break; - case QemuFinished: - case QemuUserReason: - if (!error.isEmpty()) - QMessageBox::warning(0, tr("Qemu error"), error); - break; - default: - Q_ASSERT(!"Missing handling of Qemu status"); - } - - updateStarterIcon(running); -} - -void MaemoQemuManager::qemuOutput() -{ - qDebug("%s", m_qemuProcess->readAllStandardOutput().data()); - qDebug("%s", m_qemuProcess->readAllStandardError().data()); -} - -void MaemoQemuManager::runtimeRootChanged(const QString &directory) -{ - QList<int> uniqueIds; - QMap<int, MaemoQemuRuntime>::const_iterator it; - for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) { - if (QDir(it.value().m_watchPath) == QDir(directory)) - uniqueIds.append(it.key()); - } - - foreach (int uniqueId, uniqueIds) { - MaemoQemuRuntime runtime = m_runtimes.value(uniqueId, MaemoQemuRuntime()); - if (runtime.isValid()) { - if (QFile::exists(runtime.m_root)) { - // nothing changed, so we can remove it - uniqueIds.removeAll(uniqueId); - } - } else { - if (QFile::exists(runtime.m_root)) { - if (!QFile::exists(runtime.m_root + QLatin1String("/information"))) { - // install might be still in progress - uniqueIds.removeAll(uniqueId); - runtimeFolderWatcher()->addDirectory(runtime.m_root, - Utils::FileSystemWatcher::WatchAllChanges); - } - } - } - } - notify(uniqueIds); -} - -void MaemoQemuManager::runtimeFolderChanged(const QString &directory) -{ - if (QFile::exists(directory + QLatin1String("/information"))) { - QList<int> uniqueIds; - QMap<int, MaemoQemuRuntime>::const_iterator it; - for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) { - if (QDir(it.value().m_root) == QDir(directory)) - uniqueIds.append(it.key()); - } - notify(uniqueIds); - if (m_runtimeFolderWatcher) - m_runtimeFolderWatcher->removeDirectory(directory); - } -} - -// -- private - -void MaemoQemuManager::updateStarterIcon(bool running) -{ - QIcon::State state; - QString toolTip; - if (running) { - state = QIcon::On; - toolTip = tr("Stop Maemo Emulator"); - } else { - state = QIcon::Off; - toolTip = tr("Start Maemo Emulator"); - } - - m_qemuAction->setToolTip(toolTip); - m_qemuAction->setIcon(m_qemuStarterIcon.pixmap(iconSize, QIcon::Normal, - state)); -} - -void MaemoQemuManager::toggleStarterButton(Target *target) -{ - int uniqueId = -1; - if (target) { - if (AbstractQt4MaemoTarget *qt4Target = qobject_cast<AbstractQt4MaemoTarget*>(target)) { - if (Qt4BuildConfiguration *bc = qt4Target->activeBuildConfiguration()) { - if (QtSupport::BaseQtVersion *version = bc->qtVersion()) - uniqueId = version->uniqueId(); - } - } - } - - if (uniqueId >= 0 && (m_runtimes.isEmpty() || !m_runtimes.contains(uniqueId))) - qtVersionsChanged(QList<int>() << uniqueId); - - bool isRunning = m_qemuProcess->state() != QProcess::NotRunning; - if (m_runningQtId == uniqueId) - isRunning = false; - - const Project * const p - = ProjectExplorerPlugin::instance()->session()->startupProject(); - const bool qemuButtonEnabled - = p && p->activeTarget() && MaemoGlobal::isMaemoTargetId(p->activeTarget()->id()) - && m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid() - && targetUsesMatchingRuntimeConfig(target) && !isRunning; - m_qemuAction->setEnabled(qemuButtonEnabled); - showOrHideQemuButton(); -} - -bool MaemoQemuManager::sessionHasMaemoTarget() const -{ - ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance(); - const QList<Project*> &projects = explorer->session()->projects(); - foreach (const Project *p, projects) { - foreach (const Target * const target, p->targets()) { - if (MaemoGlobal::isMaemoTargetId(target->id())) - return true; - } - } - return false; -} - -bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target, - QtSupport::BaseQtVersion **qtVersion) -{ - if (!target) - return false; - if (target != target->project()->activeTarget()) - return false; - - MaemoRunConfiguration *mrc = - qobject_cast<MaemoRunConfiguration *> (target->activeRunConfiguration()); - if (!mrc) - return false; - Qt4BuildConfiguration *bc - = qobject_cast<Qt4BuildConfiguration *>(target->activeBuildConfiguration()); - if (!bc) - return false; - QtSupport::BaseQtVersion *version = bc->qtVersion(); - if (!version || !m_runtimes.value(version->uniqueId(), MaemoQemuRuntime()).isValid()) - return false; - - if (qtVersion) - *qtVersion = version; - const MaemoDeviceConfig::ConstPtr &config = mrc->deviceConfig(); - return config && config->type() == MaemoDeviceConfig::Emulator; -} - -void MaemoQemuManager::notify(const QList<int> uniqueIds) -{ - qtVersionsChanged(uniqueIds); - environmentChanged(); // to toggle the start button -} - -void MaemoQemuManager::toggleDeviceConnections(MaemoRunConfiguration *mrc, - bool _connect) -{ - if (!mrc) - return; - - if (_connect) { // handle device configuration changes - connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*))); - } else { - disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*))); - } -} - -void MaemoQemuManager::showOrHideQemuButton() -{ - const bool showButton = !m_runtimes.isEmpty() && sessionHasMaemoTarget(); - if (!showButton) - terminateRuntime(); - m_qemuAction->setVisible(showButton); -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h deleted file mode 100644 index 075d40b1b1..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QEMURUNTIMEMANAGER_H -#define QEMURUNTIMEMANAGER_H - -#include "maemoconstants.h" -#include "maemoqemuruntime.h" - -#include <QtCore/QMap> -#include <QtCore/QObject> -#include <QtCore/QProcess> - -#include <QtGui/QIcon> - -QT_FORWARD_DECLARE_CLASS(QAction) -QT_FORWARD_DECLARE_CLASS(QStringList) - -namespace Utils { -class FileSystemWatcher; -} - -namespace ProjectExplorer { - class BuildConfiguration; - class Project; - class RunConfiguration; - class Target; -} - -namespace QtSupport { -class BaseQtVersion; -} -namespace Qt4ProjectManager { - namespace Internal { - class MaemoRunConfiguration; - - -class MaemoQemuManager : public QObject -{ - Q_OBJECT - -public: - static MaemoQemuManager& instance(QObject *parent = 0); - - bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const; - bool qemuIsRunning() const; - Q_SLOT void startRuntime(); - -signals: - void qemuProcessStatus(QemuStatus, const QString &error = QString()); - -private slots: - void qtVersionsChanged(const QList<int> &uniqueIds); - - void projectAdded(ProjectExplorer::Project *project); - void projectRemoved(ProjectExplorer::Project *project); - void projectChanged(ProjectExplorer::Project *project); - - void targetAdded(ProjectExplorer::Target *target); - void targetRemoved(ProjectExplorer::Target *target); - void targetChanged(ProjectExplorer::Target *target); - - void runConfigurationAdded(ProjectExplorer::RunConfiguration *rc); - void runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc); - void runConfigurationChanged(ProjectExplorer::RunConfiguration *rc); - - void buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc); - void buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc); - void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc); - - void environmentChanged(); // needed to check for qt version - void deviceConfigurationChanged(ProjectExplorer::Target *target); - - void terminateRuntime(); - - void qemuProcessFinished(); - void qemuProcessError(QProcess::ProcessError error); - void qemuStatusChanged(QemuStatus status, const QString &error); - void qemuOutput(); - - void runtimeRootChanged(const QString &directory); - void runtimeFolderChanged(const QString &directory); - -private: - MaemoQemuManager(QObject *parent); - ~MaemoQemuManager(); - - bool sessionHasMaemoTarget() const; - - void updateStarterIcon(bool running); - void toggleStarterButton(ProjectExplorer::Target *target); - bool targetUsesMatchingRuntimeConfig(ProjectExplorer::Target *target, - QtSupport::BaseQtVersion **qtVersion = 0); - - void notify(const QList<int> uniqueIds); - void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect); - void showOrHideQemuButton(); - -private: - QAction *m_qemuAction; - QProcess *m_qemuProcess; - Utils::FileSystemWatcher *runtimeRootWatcher(); - Utils::FileSystemWatcher *runtimeFolderWatcher(); - - int m_runningQtId; - bool m_userTerminated; - QIcon m_qemuStarterIcon; - QMap<int, MaemoQemuRuntime> m_runtimes; - static MaemoQemuManager *m_instance; - Utils::FileSystemWatcher *m_runtimeRootWatcher; - Utils::FileSystemWatcher *m_runtimeFolderWatcher; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // QEMURUNTIMEMANAGER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h deleted file mode 100644 index 585842187d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOQEMURUNTIME_H -#define MAEMOQEMURUNTIME_H - -#include "maemodeviceconfigurations.h" -#include "maemoqemusettings.h" - -#include <QtCore/QHash> -#include <QtCore/QList> -#include <QtCore/QPair> -#include <QtCore/QProcessEnvironment> -#include <QtCore/QString> - -namespace Qt4ProjectManager { -namespace Internal { - -enum QemuStatus { - QemuStarting, - QemuFailedToStart, - QemuFinished, - QemuCrashed, - QemuUserReason -}; - -struct MaemoQemuRuntime -{ - typedef QPair<QString, QString> Variable; - - MaemoQemuRuntime() {} - MaemoQemuRuntime(const QString &root) : m_root(root) {} - bool isValid() const { - return !m_bin.isEmpty(); - } - QProcessEnvironment environment() const { - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - foreach (const Variable &var, m_normalVars) - env.insert(var.first, var.second); - QHash<MaemoQemuSettings::OpenGlMode, QString>::ConstIterator it - = m_openGlBackendVarValues.find(MaemoQemuSettings::openGlMode()); - if (it != m_openGlBackendVarValues.constEnd()) - env.insert(m_openGlBackendVarName, it.value()); - return env; - } - - QString m_name; - QString m_bin; - QString m_root; - QString m_args; - QString m_sshPort; - QString m_watchPath; - MaemoPortList m_freePorts; - QList<Variable> m_normalVars; - QString m_openGlBackendVarName; - QHash<MaemoQemuSettings::OpenGlMode, QString> m_openGlBackendVarValues; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOQEMURUNTIME_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp deleted file mode 100644 index 8a94ea2535..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp +++ /dev/null @@ -1,431 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#include "maemoqemuruntimeparser.h" - -#include "maemoglobal.h" -#include "maemoqemusettings.h" - -#include <qtsupport/baseqtversion.h> -#include <utils/qtcassert.h> - -#include <QtCore/QDir> -#include <QtCore/QProcess> -#include <QtCore/QStringList> -#include <QtCore/QTextStream> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQemuRuntimeParserV1 : public MaemoQemuRuntimeParser -{ -public: - MaemoQemuRuntimeParserV1(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot); - MaemoQemuRuntime parseRuntime(); - -private: - void fillRuntimeInformation(MaemoQemuRuntime *runtime) const; - void setEnvironment(MaemoQemuRuntime *runTime, const QString &envSpec) const; -}; - -class MaemoQemuRuntimeParserV2 : public MaemoQemuRuntimeParser -{ -public: - MaemoQemuRuntimeParserV2(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot); - MaemoQemuRuntime parseRuntime(); - -private: - struct Port { - Port() : port(-1), ssh(false) {} - int port; - bool ssh; - }; - - void handleTargetTag(QString &runtimeName); - MaemoQemuRuntime handleRuntimeTag(); - void handleEnvironmentTag(MaemoQemuRuntime &runtime); - void handleVariableTag(MaemoQemuRuntime &runtime); - QList<Port> handleTcpPortListTag(); - Port handlePortTag(); - MaemoQemuSettings::OpenGlMode openGlTagToEnum(const QString &tag) const; -}; - -MaemoQemuRuntimeParser::MaemoQemuRuntimeParser(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot) - : m_targetName(targetName), - m_maddeRoot(maddeRoot), - m_madInfoReader(madInfoOutput) -{ -} - -MaemoQemuRuntime MaemoQemuRuntimeParser::parseRuntime(const QtSupport::BaseQtVersion *qtVersion) -{ - MaemoQemuRuntime runtime; - const QString maddeRootPath = MaemoGlobal::maddeRoot(qtVersion->qmakeCommand()); - QProcess madProc; - if (!MaemoGlobal::callMad(madProc, QStringList() << QLatin1String("info"), qtVersion->qmakeCommand(), false)) - return runtime; - if (!madProc.waitForStarted() || !madProc.waitForFinished()) - return runtime; - const QByteArray &madInfoOutput = madProc.readAllStandardOutput(); - const QString &targetName = MaemoGlobal::targetName(qtVersion->qmakeCommand()); - runtime = MaemoQemuRuntimeParserV2(madInfoOutput, targetName, maddeRootPath) - .parseRuntime(); - if (!runtime.m_name.isEmpty()) { - runtime.m_root = maddeRootPath + QLatin1String("/runtimes/") - + runtime.m_name; - } else { - runtime = MaemoQemuRuntimeParserV1(madInfoOutput, targetName, - maddeRootPath).parseRuntime(); - } - runtime.m_watchPath = runtime.m_root - .left(runtime.m_root.lastIndexOf(QLatin1Char('/'))); - - return runtime; -} - -MaemoQemuRuntimeParserV1::MaemoQemuRuntimeParserV1(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot) - : MaemoQemuRuntimeParser(madInfoOutput, targetName, maddeRoot) -{ -} - -MaemoQemuRuntime MaemoQemuRuntimeParserV1::parseRuntime() -{ - QStringList installedRuntimes; - QString targetRuntime; - while (!m_madInfoReader.atEnd() && !installedRuntimes.contains(targetRuntime)) { - if (m_madInfoReader.readNext() == QXmlStreamReader::StartElement) { - if (targetRuntime.isEmpty() - && m_madInfoReader.name() == QLatin1String("target")) { - const QXmlStreamAttributes &attrs = m_madInfoReader.attributes(); - if (attrs.value(QLatin1String("target_id")) == m_targetName) - targetRuntime = attrs.value("runtime_id").toString(); - } else if (m_madInfoReader.name() == QLatin1String("runtime")) { - const QXmlStreamAttributes attrs = m_madInfoReader.attributes(); - while (!m_madInfoReader.atEnd()) { - if (m_madInfoReader.readNext() == QXmlStreamReader::EndElement - && m_madInfoReader.name() == QLatin1String("runtime")) - break; - if (m_madInfoReader.tokenType() == QXmlStreamReader::StartElement - && m_madInfoReader.name() == QLatin1String("installed")) { - if (m_madInfoReader.readNext() == QXmlStreamReader::Characters - && m_madInfoReader.text() == QLatin1String("true")) { - if (attrs.hasAttribute(QLatin1String("runtime_id"))) - installedRuntimes << attrs.value(QLatin1String("runtime_id")).toString(); - else if (attrs.hasAttribute(QLatin1String("id"))) { - // older MADDE seems to use only id - installedRuntimes << attrs.value(QLatin1String("id")).toString(); - } - } - break; - } - } - } - } - } - - MaemoQemuRuntime runtime; - if (installedRuntimes.contains(targetRuntime)) { - runtime.m_name = targetRuntime; - runtime.m_root = m_maddeRoot + QLatin1String("/runtimes/") - + targetRuntime; - fillRuntimeInformation(&runtime); - } - return runtime; - -} - -void MaemoQemuRuntimeParserV1::fillRuntimeInformation(MaemoQemuRuntime *runtime) const -{ - const QStringList files = QDir(runtime->m_root).entryList(QDir::Files - | QDir::NoSymLinks | QDir::NoDotAndDotDot); - - const QLatin1String infoFile("information"); - if (files.contains(infoFile)) { - QFile file(runtime->m_root + QLatin1Char('/') + infoFile); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QMap<QString, QString> map; - QTextStream stream(&file); - while (!stream.atEnd()) { - const QString &line = stream.readLine().trimmed(); - const int index = line.indexOf(QLatin1Char('=')); - map.insert(line.mid(0, index).remove(QLatin1Char('\'')), - line.mid(index + 1).remove(QLatin1Char('\''))); - } - - runtime->m_bin = map.value(QLatin1String("qemu")); - runtime->m_args = map.value(QLatin1String("qemu_args")); - setEnvironment(runtime, map.value(QLatin1String("libpath"))); - runtime->m_sshPort = map.value(QLatin1String("sshport")); - runtime->m_freePorts = MaemoPortList(); - int i = 2; - while (true) { - const QString port = map.value(QLatin1String("redirport") - + QString::number(i++)); - if (port.isEmpty()) - break; - runtime->m_freePorts.addPort(port.toInt()); - } - - // This is complex because of extreme MADDE weirdness. - const QString root = m_maddeRoot + QLatin1Char('/'); - const bool pathIsRelative = QFileInfo(runtime->m_bin).isRelative(); - runtime->m_bin = - #ifdef Q_OS_WIN - root + (pathIsRelative - ? QLatin1String("madlib/") + runtime->m_bin // Fremantle. - : runtime->m_bin) // Harmattan. - + QLatin1String(".exe"); - #else - pathIsRelative - ? root + QLatin1String("madlib/") + runtime->m_bin // Fremantle. - : runtime->m_bin; // Harmattan. - #endif - } - } -} - -void MaemoQemuRuntimeParserV1::setEnvironment(MaemoQemuRuntime *runTime, - const QString &envSpec) const -{ - QString remainingEnvSpec = envSpec; - QString currentKey; - while (true) { - const int nextEqualsSignPos - = remainingEnvSpec.indexOf(QLatin1Char('=')); - if (nextEqualsSignPos == -1) { - if (!currentKey.isEmpty()) - runTime->m_normalVars << MaemoQemuRuntime::Variable(currentKey, - remainingEnvSpec); - break; - } - const int keyStartPos - = remainingEnvSpec.lastIndexOf(QRegExp(QLatin1String("\\s")), - nextEqualsSignPos) + 1; - if (!currentKey.isEmpty()) { - const int valueEndPos - = remainingEnvSpec.lastIndexOf(QRegExp(QLatin1String("\\S")), - qMax(0, keyStartPos - 1)) + 1; - runTime->m_normalVars << MaemoQemuRuntime::Variable(currentKey, - remainingEnvSpec.left(valueEndPos)); - } - currentKey = remainingEnvSpec.mid(keyStartPos, - nextEqualsSignPos - keyStartPos); - remainingEnvSpec.remove(0, nextEqualsSignPos + 1); - } -} - - -MaemoQemuRuntimeParserV2::MaemoQemuRuntimeParserV2(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot) - : MaemoQemuRuntimeParser(madInfoOutput, targetName, maddeRoot) -{ -} - -MaemoQemuRuntime MaemoQemuRuntimeParserV2::parseRuntime() -{ - QString runtimeName; - QList<MaemoQemuRuntime> runtimes; - while (m_madInfoReader.readNextStartElement()) { - if (m_madInfoReader.name() == QLatin1String("madde")) { - while (m_madInfoReader.readNextStartElement()) { - if (m_madInfoReader.name() == QLatin1String("targets")) { - while (m_madInfoReader.readNextStartElement()) - handleTargetTag(runtimeName); - } else if (m_madInfoReader.name() == QLatin1String("runtimes")) { - while (m_madInfoReader.readNextStartElement()) { - const MaemoQemuRuntime &rt = handleRuntimeTag(); - if (!rt.m_name.isEmpty() && !rt.m_bin.isEmpty() - && !rt.m_args.isEmpty()) { - runtimes << rt; - } - } - } else { - m_madInfoReader.skipCurrentElement(); - } - } - } - } - foreach (const MaemoQemuRuntime &rt, runtimes) { - if (rt.m_name == runtimeName) - return rt; - } - return MaemoQemuRuntime(); -} - -void MaemoQemuRuntimeParserV2::handleTargetTag(QString &runtimeName) -{ - const QXmlStreamAttributes &attrs = m_madInfoReader.attributes(); - if (m_madInfoReader.name() == QLatin1String("target") && runtimeName.isEmpty() - && attrs.value(QLatin1String("name")) == m_targetName - && attrs.value(QLatin1String("installed")) == QLatin1String("true")) { - while (m_madInfoReader.readNextStartElement()) { - if (m_madInfoReader.name() == QLatin1String("runtime")) - runtimeName = m_madInfoReader.readElementText(); - else - m_madInfoReader.skipCurrentElement(); - } - } else { - m_madInfoReader.skipCurrentElement(); - } -} - -MaemoQemuRuntime MaemoQemuRuntimeParserV2::handleRuntimeTag() -{ - MaemoQemuRuntime runtime; - const QXmlStreamAttributes &attrs = m_madInfoReader.attributes(); - if (m_madInfoReader.name() != QLatin1String("runtime") - || attrs.value(QLatin1String("installed")) != QLatin1String("true")) { - m_madInfoReader.skipCurrentElement(); - return runtime; - } - runtime.m_name = attrs.value(QLatin1String("name")).toString(); - while (m_madInfoReader.readNextStartElement()) { - if (m_madInfoReader.name() == QLatin1String("exec-path")) { - runtime.m_bin = m_madInfoReader.readElementText(); - } else if (m_madInfoReader.name() == QLatin1String("args")) { - runtime.m_args = m_madInfoReader.readElementText(); - } else if (m_madInfoReader.name() == QLatin1String("environment")) { - handleEnvironmentTag(runtime); - } else if (m_madInfoReader.name() == QLatin1String("tcpportmap")) { - const QList<Port> &ports = handleTcpPortListTag(); - foreach (const Port &port, ports) { - if (port.ssh) - runtime.m_sshPort = QString::number(port.port); - else - runtime.m_freePorts.addPort(port.port); - } - } else { - m_madInfoReader.skipCurrentElement(); - } - } - return runtime; -} - -void MaemoQemuRuntimeParserV2::handleEnvironmentTag(MaemoQemuRuntime &runtime) -{ - while (m_madInfoReader.readNextStartElement()) - handleVariableTag(runtime); - -#ifdef Q_OS_WIN - const QString root = QDir::toNativeSeparators(m_maddeRoot) - + QLatin1Char('/'); - const QLatin1Char colon(';'); - const QLatin1String key("PATH"); - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - runtime.m_normalVars << MaemoQemuRuntime::Variable(key, - root + QLatin1String("bin") + colon + env.value(key)); - runtime.m_normalVars << MaemoQemuRuntime::Variable(key, - root + QLatin1String("madlib") + colon + env.value(key)); -#endif -} - -void MaemoQemuRuntimeParserV2::handleVariableTag(MaemoQemuRuntime &runtime) -{ - if (m_madInfoReader.name() != QLatin1String("variable")) { - m_madInfoReader.skipCurrentElement(); - return; - } - - const bool isGlBackend = m_madInfoReader.attributes().value(QLatin1String("purpose")) - == QLatin1String("glbackend"); - QString varName; - QString varValue; - while (m_madInfoReader.readNextStartElement()) { - const QXmlStreamAttributes &attrs = m_madInfoReader.attributes(); - if (m_madInfoReader.name() == QLatin1String("name")) { - varName = m_madInfoReader.readElementText(); - } else if (m_madInfoReader.name() == QLatin1String("value") - && attrs.value(QLatin1String("set")) != QLatin1String("false")) { - varValue = m_madInfoReader.readElementText(); - if (isGlBackend) { - MaemoQemuSettings::OpenGlMode openGlMode - = openGlTagToEnum(attrs.value(QLatin1String("option")).toString()); - runtime.m_openGlBackendVarValues.insert(openGlMode, varValue); - } - } else { - m_madInfoReader.skipCurrentElement(); - } - } - - if (varName.isEmpty()) - return; - if (isGlBackend) { - runtime.m_openGlBackendVarName = varName; - } else { - runtime.m_normalVars << MaemoQemuRuntime::Variable(varName, varValue); - } -} - -QList<MaemoQemuRuntimeParserV2::Port> MaemoQemuRuntimeParserV2::handleTcpPortListTag() -{ - QList<Port> ports; - while (m_madInfoReader.readNextStartElement()) { - const Port &port = handlePortTag(); - if (port.port != -1) - ports << port; - } - return ports; -} - -MaemoQemuRuntimeParserV2::Port MaemoQemuRuntimeParserV2::handlePortTag() -{ - Port port; - if (m_madInfoReader.name() == QLatin1String("port")) { - const QXmlStreamAttributes &attrs = m_madInfoReader.attributes(); - port.ssh = attrs.value(QLatin1String("service")) == QLatin1String("ssh"); - while (m_madInfoReader.readNextStartElement()) { - if (m_madInfoReader.name() == QLatin1String("host")) - port.port = m_madInfoReader.readElementText().toInt(); - else - m_madInfoReader.skipCurrentElement(); - } - } - return port; -} - -MaemoQemuSettings::OpenGlMode MaemoQemuRuntimeParserV2::openGlTagToEnum(const QString &tag) const -{ - if (tag == QLatin1String("hardware-acceleration")) - return MaemoQemuSettings::HardwareAcceleration; - if (tag == QLatin1String("software-rendering")) - return MaemoQemuSettings::SoftwareRendering; - if (tag == QLatin1String("autodetect")) - return MaemoQemuSettings::AutoDetect; - QTC_ASSERT(false, /**/); - return MaemoQemuSettings::AutoDetect; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h deleted file mode 100644 index fa1a328ac3..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOQEMURUNTIMEPARSER_H -#define MAEMOQEMURUNTIMEPARSER_H - -#include "maemoqemuruntime.h" - -#include <QtCore/QString> -#include <QtXml/QXmlStreamReader> - -namespace QtSupport { -class BaseQtVersion; -} - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQemuRuntimeParser -{ -public: - static MaemoQemuRuntime parseRuntime(const QtSupport::BaseQtVersion *qtVersion); - -protected: - MaemoQemuRuntimeParser(const QString &madInfoOutput, - const QString &targetName, const QString &maddeRoot); - - const QString m_targetName; - const QString m_maddeRoot; - QXmlStreamReader m_madInfoReader; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOQEMURUNTIMEPARSER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.cpp deleted file mode 100644 index da8118a97e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoqemusettings.h" - -#include <coreplugin/icore.h> - -#include <QtCore/QSettings> - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QString SettingsGroup = QLatin1String("Maemo Qemu Settings"); -const QString OpenGlModeKey = QLatin1String("OpenGl Mode"); -} // anonymous namespace - -MaemoQemuSettings::OpenGlMode MaemoQemuSettings::openGlMode() -{ - if (!m_initialized) { - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(SettingsGroup); - m_openGlMode = static_cast<OpenGlMode>(settings->value(OpenGlModeKey, AutoDetect).toInt()); - settings->endGroup(); - m_initialized = true; - } - return m_openGlMode; -} - -void MaemoQemuSettings::setOpenGlMode(OpenGlMode openGlMode) -{ - Q_ASSERT(m_initialized); - m_openGlMode = openGlMode; - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(SettingsGroup); - settings->setValue(OpenGlModeKey, m_openGlMode); - settings->endGroup(); -} - -bool MaemoQemuSettings::m_initialized = false; -MaemoQemuSettings::OpenGlMode MaemoQemuSettings::m_openGlMode; - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.h deleted file mode 100644 index 0ee389d80d..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettings.h +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOQEMUSETTINGS_H -#define MAEMOQEMUSETTINGS_H - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQemuSettings -{ -public: - enum OpenGlMode { HardwareAcceleration, SoftwareRendering, AutoDetect }; - - static OpenGlMode openGlMode(); - static void setOpenGlMode(OpenGlMode openGlMode); - -private: - MaemoQemuSettings(); - - static bool m_initialized; - static OpenGlMode m_openGlMode; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOQEMUSETTINGS_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.cpp deleted file mode 100644 index e5e1768e0f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoqemusettingswidget.h" -#include "ui_maemoqemusettingswidget.h" - -#include "maemoqemusettings.h" - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoQemuSettingsWidget::MaemoQemuSettingsWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::MaemoQemuSettingsWidget) -{ - ui->setupUi(this); - switch (MaemoQemuSettings::openGlMode()) { - case MaemoQemuSettings::HardwareAcceleration: - ui->hardwareAccelerationButton->setChecked(true); - break; - case MaemoQemuSettings::SoftwareRendering: - ui->softwareRenderingButton->setChecked(true); - break; - case MaemoQemuSettings::AutoDetect: - ui->autoDetectButton->setChecked(true); - break; - } -} - -MaemoQemuSettingsWidget::~MaemoQemuSettingsWidget() -{ - delete ui; -} - -QString MaemoQemuSettingsWidget::keywords() const -{ - const QChar space = QLatin1Char(' '); - QString keywords = ui->groupBox->title() + space - + ui->hardwareAccelerationButton->text() + space - + ui->softwareRenderingButton->text() + space - + ui->autoDetectButton->text(); - keywords.remove(QLatin1Char('&')); - return keywords; -} - -void MaemoQemuSettingsWidget::saveSettings() -{ - const MaemoQemuSettings::OpenGlMode openGlMode - = ui->hardwareAccelerationButton->isChecked() - ? MaemoQemuSettings::HardwareAcceleration - : ui->softwareRenderingButton->isChecked() - ? MaemoQemuSettings::SoftwareRendering - : MaemoQemuSettings::AutoDetect; - MaemoQemuSettings::setOpenGlMode(openGlMode); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.h deleted file mode 100644 index 51f26fe4d5..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOQEMUSETTINGSWIDGET_H -#define MAEMOQEMUSETTINGSWIDGET_H - -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoQemuSettingsWidget; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQemuSettingsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit MaemoQemuSettingsWidget(QWidget *parent = 0); - ~MaemoQemuSettingsWidget(); - void saveSettings(); - QString keywords() const; - -private: - Ui::MaemoQemuSettingsWidget *ui; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOQEMUSETTINGSWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.ui deleted file mode 100644 index f500f94680..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemusettingswidget.ui +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoQemuSettingsWidget</class> - <widget class="QWidget" name="MaemoQemuSettingsWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>OpenGL Mode</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QRadioButton" name="hardwareAccelerationButton"> - <property name="text"> - <string>&Hardware acceleration</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="softwareRenderingButton"> - <property name="text"> - <string>&Software rendering</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="autoDetectButton"> - <property name="text"> - <string>&Auto-detect</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.cpp deleted file mode 100644 index f0bb16469c..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoqtversion.h" -#include "qt4projectmanagerconstants.h" -#include "qt-maemo/maemoglobal.h" - -#include <qtsupport/qtsupportconstants.h> - -#include <QtCore/QCoreApplication> -#include <QtCore/QFile> -#include <QtCore/QDir> - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -MaemoQtVersion::MaemoQtVersion() - : QtSupport::BaseQtVersion() -{ - -} - -MaemoQtVersion::MaemoQtVersion(const QString &path, bool isAutodetected, const QString &autodetectionSource) - : QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource), - m_osVersion(MaemoGlobal::version(path)), - m_isvalidVersion(MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion)) -{ - -} - -MaemoQtVersion::~MaemoQtVersion() -{ - -} - -void MaemoQtVersion::fromMap(const QVariantMap &map) -{ - QtSupport::BaseQtVersion::fromMap(map); - QString path = qmakeCommand(); - m_osVersion = MaemoGlobal::version(path); - m_isvalidVersion = MaemoGlobal::isValidMaemoQtVersion(path, m_osVersion); -} - -QString MaemoQtVersion::type() const -{ - return QtSupport::Constants::MAEMOQT; -} - -MaemoQtVersion *MaemoQtVersion::clone() const -{ - return new MaemoQtVersion(*this); -} - -QString MaemoQtVersion::systemRoot() const -{ - if (m_systemRoot.isNull()) { - QFile file(QDir::cleanPath(MaemoGlobal::targetRoot(qmakeCommand())) - + QLatin1String("/information")); - if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream stream(&file); - while (!stream.atEnd()) { - const QString &line = stream.readLine().trimmed(); - const QStringList &list = line.split(QLatin1Char(' ')); - if (list.count() <= 1) - continue; - if (list.at(0) == QLatin1String("sysroot")) { - m_systemRoot = MaemoGlobal::maddeRoot(qmakeCommand()) - + QLatin1String("/sysroots/") + list.at(1); - } - } - } - } - return m_systemRoot; -} - -QList<ProjectExplorer::Abi> MaemoQtVersion::qtAbis() const -{ - QList<ProjectExplorer::Abi> result; - if (!m_isvalidVersion) - return result; - if (m_osVersion == MaemoDeviceConfig::Maemo5) { - result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, - ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat, - 32)); - } else if (m_osVersion == MaemoDeviceConfig::Maemo6) { - result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, - ProjectExplorer::Abi::HarmattanLinuxFlavor, - ProjectExplorer::Abi::ElfFormat, - 32)); - } else if (m_osVersion == MaemoDeviceConfig::Meego) { - result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS, - ProjectExplorer::Abi::MeegoLinuxFlavor, - ProjectExplorer::Abi::ElfFormat, 32)); - } - return result; -} - -bool MaemoQtVersion::supportsTargetId(const QString &id) const -{ - return supportedTargetIds().contains(id); -} - -QSet<QString> MaemoQtVersion::supportedTargetIds() const -{ - QSet<QString> result; - if (!m_isvalidVersion) - return result; - if (m_osVersion == MaemoDeviceConfig::Maemo5) { - result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)); - } else if (m_osVersion == MaemoDeviceConfig::Maemo6) { - result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)); - } else if (m_osVersion == MaemoDeviceConfig::Meego) { - result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)); - } - return result; -} - -QString MaemoQtVersion::description() const -{ - if (m_osVersion == MaemoDeviceConfig::Maemo5) - return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5"); - else if (m_osVersion == MaemoDeviceConfig::Maemo6) - return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan"); - else if (m_osVersion == MaemoDeviceConfig::Meego) - return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego"); - return QString(); -} - -bool MaemoQtVersion::supportsShadowBuilds() const -{ -#ifdef Q_OS_WIN - return false; -#endif - return true; -} - -MaemoDeviceConfig::OsVersion MaemoQtVersion::osVersion() const -{ - return m_osVersion; -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.h deleted file mode 100644 index a4e8541d47..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversion.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ -#ifndef MAEMOQTVERSION_H -#define MAEMOQTVERSION_H - -#include "maemodeviceconfigurations.h" -#include <qtsupport/baseqtversion.h> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQtVersion : public QtSupport::BaseQtVersion -{ -public: - MaemoQtVersion(); - MaemoQtVersion(const QString &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); - ~MaemoQtVersion(); - - void fromMap(const QVariantMap &map); - MaemoQtVersion *clone() const; - - virtual QString type() const; - - virtual QString systemRoot() const; - virtual QList<ProjectExplorer::Abi> qtAbis() const; - - virtual bool supportsTargetId(const QString &id) const; - virtual QSet<QString> supportedTargetIds() const; - - virtual QString description() const; - - virtual bool supportsShadowBuilds() const; - MaemoDeviceConfig::OsVersion osVersion() const; -private: - mutable QString m_systemRoot; - mutable MaemoDeviceConfig::OsVersion m_osVersion; - mutable bool m_isvalidVersion; -}; - -} -} - - -#endif // MAEMOQTVERSION_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.cpp deleted file mode 100644 index f8817b2d2a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoqtversionfactory.h" -#include "maemoglobal.h" -#include "qt4projectmanagerconstants.h" -#include "maemoqtversion.h" - -#include <qtsupport/qtsupportconstants.h> - -#include <QtCore/QFileInfo> - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -MaemoQtVersionFactory::MaemoQtVersionFactory(QObject *parent) - : QtSupport::QtVersionFactory(parent) -{ - -} - -MaemoQtVersionFactory::~MaemoQtVersionFactory() -{ - -} - -bool MaemoQtVersionFactory::canRestore(const QString &type) -{ - return type == QLatin1String(QtSupport::Constants::MAEMOQT); -} - -QtSupport::BaseQtVersion *MaemoQtVersionFactory::restore(const QVariantMap &data) -{ - MaemoQtVersion *v = new MaemoQtVersion; - v->fromMap(data); - return v; -} - -int MaemoQtVersionFactory::priority() const -{ - return 50; -} - -QtSupport::BaseQtVersion *MaemoQtVersionFactory::create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource) -{ - Q_UNUSED(evaluator); - // we are the fallback :) so we don't care what kinf of qt it is - QFileInfo fi(qmakePath); - if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) - return 0; - - if (MaemoGlobal::isValidMaemo5QtVersion(qmakePath) - || MaemoGlobal::isValidHarmattanQtVersion(qmakePath) - || MaemoGlobal::isValidMeegoQtVersion(qmakePath)) - return new MaemoQtVersion(qmakePath, isAutoDetected, autoDetectionSource); - return 0; -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.h deleted file mode 100644 index 914c922a80..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqtversionfactory.h +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOQTVERSIONFACTORY_H -#define MAEMOQTVERSIONFACTORY_H - -#include <qtsupport/qtversionfactory.h> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoQtVersionFactory : public QtSupport::QtVersionFactory -{ -public: - explicit MaemoQtVersionFactory(QObject *parent = 0); - ~MaemoQtVersionFactory(); - - virtual bool canRestore(const QString &type); - virtual QtSupport::BaseQtVersion *restore(const QVariantMap &data); - - virtual int priority() const; - virtual QtSupport::BaseQtVersion *create(const QString &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); -}; - -} // Internal -} // Qt4ProjectManager - - -#endif // MAEMOQTVERSIONFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp deleted file mode 100644 index 42815face2..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoremotecopyfacility.h" - -#include "maemoglobal.h" -#include <QtCore/QDir> - -#include <utils/ssh/sshconnection.h> -#include <utils/ssh/sshremoteprocessrunner.h> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoRemoteCopyFacility::MaemoRemoteCopyFacility(QObject *parent) : - QObject(parent), m_isCopying(false) -{ -} - -MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {} - -void MaemoRemoteCopyFacility::copyFiles(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf, - const QList<MaemoDeployable> &deployables, const QString &mountPoint) -{ - Q_ASSERT(connection->state() == SshConnection::Connected); - Q_ASSERT(!m_isCopying); - - m_devConf = devConf; - m_deployables = deployables; - m_mountPoint = mountPoint; - - m_copyRunner = SshRemoteProcessRunner::create(connection); - connect(m_copyRunner.data(), SIGNAL(connectionError(Utils::SshError)), - SLOT(handleConnectionError())); - connect(m_copyRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), - SLOT(handleRemoteStdout(QByteArray))); - connect(m_copyRunner.data(), - SIGNAL(processErrorOutputAvailable(QByteArray)), - SLOT(handleRemoteStderr(QByteArray))); - connect(m_copyRunner.data(), SIGNAL(processClosed(int)), - SLOT(handleCopyFinished(int))); - - m_isCopying = true; - copyNextFile(); -} - -void MaemoRemoteCopyFacility::cancel() -{ - Q_ASSERT(m_isCopying); - - SshRemoteProcessRunner::Ptr killProcess - = SshRemoteProcessRunner::create(m_copyRunner->connection()); - killProcess->run("pkill cp"); - setFinished(); -} - -void MaemoRemoteCopyFacility::handleConnectionError() -{ - const QString errMsg = m_copyRunner->connection()->errorString(); - setFinished(); - emit finished(tr("Connection failed: %1").arg(errMsg)); -} - -void MaemoRemoteCopyFacility::handleRemoteStdout(const QByteArray &output) -{ - emit stdoutData(QString::fromUtf8(output)); -} - -void MaemoRemoteCopyFacility::handleRemoteStderr(const QByteArray &output) -{ - emit stderrData(QString::fromUtf8(output)); -} - -void MaemoRemoteCopyFacility::handleCopyFinished(int exitStatus) -{ - if (!m_isCopying) - return; - - if (exitStatus != SshRemoteProcess::ExitedNormally - || m_copyRunner->process()->exitCode() != 0) { - setFinished(); - emit finished(tr("Error: Copy command failed.")); - } else { - emit fileCopied(m_deployables.takeFirst()); - copyNextFile(); - } -} - -void MaemoRemoteCopyFacility::copyNextFile() -{ - Q_ASSERT(m_isCopying); - - if (m_deployables.isEmpty()) { - setFinished(); - emit finished(); - return; - } - - const MaemoDeployable &d = m_deployables.first(); - QString sourceFilePath = m_mountPoint; -#ifdef Q_OS_WIN - const QString localFilePath = QDir::fromNativeSeparators(d.localFilePath); - sourceFilePath += QLatin1Char('/') + localFilePath.at(0).toLower() - + localFilePath.mid(2); -#else - sourceFilePath += d.localFilePath; -#endif - - QString command = QString::fromLatin1("%1 mkdir -p %3 && %1 cp -r %2 %3") - .arg(MaemoGlobal::remoteSudo(m_devConf->osVersion(), - m_copyRunner->connection()->connectionParameters().userName), - sourceFilePath, d.remoteDir); - emit progress(tr("Copying file '%1' to directory '%2' on the device...") - .arg(d.localFilePath, d.remoteDir)); - m_copyRunner->run(command.toUtf8()); -} - -void MaemoRemoteCopyFacility::setFinished() -{ - disconnect(m_copyRunner.data(), 0, this, 0); - m_copyRunner.clear(); - m_deployables.clear(); - m_isCopying = false; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.h deleted file mode 100644 index 7478d21b4b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.h +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOREMOTECOPYFACILITY_H -#define MAEMOREMOTECOPYFACILITY_H - -#include "maemodeployable.h" - -#include <QtCore/QList> -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> - -namespace Utils { -class SshConnection; -class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; - -class MaemoRemoteCopyFacility : public QObject -{ - Q_OBJECT -public: - explicit MaemoRemoteCopyFacility(QObject *parent = 0); - ~MaemoRemoteCopyFacility(); - - void copyFiles(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &devConf, - const QList<MaemoDeployable> &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 MaemoDeployable &deployable); - void finished(const QString &errorMsg = QString()); - -private slots: - void handleConnectionError(); - void handleCopyFinished(int exitStatus); - void handleRemoteStdout(const QByteArray &output); - void handleRemoteStderr(const QByteArray &output); - -private: - void copyNextFile(); - void setFinished(); - - QSharedPointer<Utils::SshRemoteProcessRunner> m_copyRunner; - QSharedPointer<const MaemoDeviceConfig> m_devConf; - QList<MaemoDeployable> m_deployables; - QString m_mountPoint; - bool m_isCopying; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOREMOTECOPYFACILITY_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp deleted file mode 100644 index 8b4c7267ed..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoremotemounter.h" - -#include "maemoglobal.h" -#include "maemousedportsgatherer.h" -#include "qt4maemotarget.h" - -#include <utils/ssh/sshconnection.h> -#include <utils/ssh/sshremoteprocess.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qtsupport/baseqtversion.h> -#include <utils/qtcassert.h> - -#include <QtCore/QTimer> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent) - : QObject(parent), m_utfsServerTimer(new QTimer(this)), m_state(Inactive) -{ - connect(m_utfsServerTimer, SIGNAL(timeout()), this, - SLOT(handleUtfsServerTimeout())); - m_utfsServerTimer->setSingleShot(true); -} - -MaemoRemoteMounter::~MaemoRemoteMounter() -{ - killAllUtfsServers(); -} - -void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf) -{ - ASSERT_STATE(Inactive); - m_connection = connection; - m_devConf = devConf; -} - -void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc) -{ - ASSERT_STATE(Inactive); - const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion(); - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(bc->target()); - m_remoteMountsAllowed = maemoTarget && maemoTarget->allowsRemoteMounts(); - m_maddeRoot = qtVersion ? MaemoGlobal::maddeRoot(qtVersion->qmakeCommand()) : QString(); -} - -void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec, - bool mountAsRoot) -{ - ASSERT_STATE(Inactive); - - if (m_remoteMountsAllowed && mountSpec.isValid()) - m_mountSpecs << MountInfo(mountSpec, mountAsRoot); -} - -bool MaemoRemoteMounter::hasValidMountSpecifications() const -{ - return !m_mountSpecs.isEmpty(); -} - -void MaemoRemoteMounter::mount(MaemoPortList *freePorts, - const MaemoUsedPortsGatherer *portsGatherer) -{ - ASSERT_STATE(Inactive); - Q_ASSERT(m_utfsServers.isEmpty()); - Q_ASSERT(m_connection); - - if (m_mountSpecs.isEmpty()) { - setState(Inactive); - emit reportProgress(tr("No directories to mount")); - emit mounted(); - } else { - m_freePorts = freePorts; - m_portsGatherer = portsGatherer; - startUtfsClients(); - } -} - -void MaemoRemoteMounter::unmount() -{ - ASSERT_STATE(Inactive); - - if (m_mountSpecs.isEmpty()) { - emit reportProgress(tr("No directories to unmount")); - emit unmounted(); - return; - } - - QString remoteCall; - const QString remoteSudo = MaemoGlobal::remoteSudo(m_devConf->osVersion(), - m_connection->connectionParameters().userName); - for (int i = 0; i < m_mountSpecs.count(); ++i) { - remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;") - .arg(remoteSudo, m_mountSpecs.at(i).mountSpec.remoteMountPoint); - } - - m_umountStderr.clear(); - m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8()); - connect(m_unmountProcess.data(), SIGNAL(closed(int)), this, - SLOT(handleUnmountProcessFinished(int))); - connect(m_unmountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)), - this, SLOT(handleUmountStderr(QByteArray))); - setState(Unmounting); - m_unmountProcess->start(); -} - -void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus) -{ - ASSERT_STATE(QList<State>() << Unmounting << Inactive); - - if (m_state == Inactive) - return; - setState(Inactive); - - QString errorMsg; - switch (exitStatus) { - case SshRemoteProcess::FailedToStart: - errorMsg = tr("Could not execute unmount request."); - break; - case SshRemoteProcess::KilledBySignal: - errorMsg = tr("Failure unmounting: %1") - .arg(m_unmountProcess->errorString()); - break; - case SshRemoteProcess::ExitedNormally: - break; - default: - Q_ASSERT_X(false, Q_FUNC_INFO, - "Impossible SshRemoteProcess exit status."); - } - - killAllUtfsServers(); - - if (errorMsg.isEmpty()) { - emit reportProgress(tr("Finished unmounting.")); - emit unmounted(); - } else { - if (!m_umountStderr.isEmpty()) { - errorMsg += tr("\nstderr was: '%1'") - .arg(QString::fromUtf8(m_umountStderr)); - } - emit error(errorMsg); - } -} - -void MaemoRemoteMounter::stop() -{ - setState(Inactive); -} - -void MaemoRemoteMounter::startUtfsClients() -{ - const QString userName = m_connection->connectionParameters().userName; - const QString chmodFuse = MaemoGlobal::remoteSudo(m_devConf->osVersion(), - userName) + QLatin1String(" chmod a+r+w /dev/fuse"); - const QString chmodUtfsClient - = QLatin1String("chmod a+x ") + utfsClientOnDevice(); - const QLatin1String andOp(" && "); - QString remoteCall = chmodFuse + andOp + chmodUtfsClient; - for (int i = 0; i < m_mountSpecs.count(); ++i) { - MountInfo &mountInfo = m_mountSpecs[i]; - mountInfo.remotePort - = m_portsGatherer->getNextFreePort(m_freePorts); - if (mountInfo.remotePort == -1) { - setState(Inactive); - emit error(tr("Error: Not enough free ports on device to fulfill all mount requests.")); - return; - } - - const QString remoteSudo - = MaemoGlobal::remoteSudo(m_devConf->osVersion(), userName); - const MaemoMountSpecification &mountSpec = mountInfo.mountSpec; - const QString mkdir = QString::fromLocal8Bit("%1 mkdir -p %2") - .arg(remoteSudo, mountSpec.remoteMountPoint); - const QString chmod = QString::fromLocal8Bit("%1 chmod a+r+w+x %2") - .arg(remoteSudo, mountSpec.remoteMountPoint); - QString utfsClient - = QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4 -o nonempty") - .arg(utfsClientOnDevice()).arg(mountInfo.remotePort) - .arg(mountSpec.remoteMountPoint); - if (mountInfo.mountAsRoot) { - utfsClient.prepend(MaemoGlobal::remoteSudo(m_devConf->osVersion(), - userName) + QLatin1Char(' ')); - } - QLatin1String seqOp("; "); - remoteCall += seqOp + MaemoGlobal::remoteSourceProfilesCommand() - + seqOp + mkdir + andOp + chmod + andOp + utfsClient; - } - - emit reportProgress(tr("Starting remote UTFS clients...")); - m_utfsClientStderr.clear(); - m_mountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8()); - connect(m_mountProcess.data(), SIGNAL(started()), this, - SLOT(handleUtfsClientsStarted())); - connect(m_mountProcess.data(), SIGNAL(closed(int)), this, - SLOT(handleUtfsClientsFinished(int))); - connect(m_mountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)), - this, SLOT(handleUtfsClientStderr(QByteArray))); - m_mountProcess->start(); - - setState(UtfsClientsStarting); -} - -void MaemoRemoteMounter::handleUtfsClientsStarted() -{ - ASSERT_STATE(QList<State>() << UtfsClientsStarting << Inactive); - if (m_state == UtfsClientsStarting) { - setState(UtfsClientsStarted); - QTimer::singleShot(250, this, SLOT(startUtfsServers())); - } -} - -void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus) -{ - ASSERT_STATE(QList<State>() << UtfsClientsStarting << UtfsClientsStarted - << UtfsServersStarted << Inactive); - - if (m_state == Inactive) - return; - - setState(Inactive); - if (exitStatus == SshRemoteProcess::ExitedNormally - && m_mountProcess->exitCode() == 0) { - emit reportProgress(tr("Mount operation succeeded.")); - emit mounted(); - } else { - QString errMsg = tr("Failure running UTFS client: %1") - .arg(m_mountProcess->errorString()); - if (!m_utfsClientStderr.isEmpty()) - errMsg += tr("\nstderr was: '%1'") - .arg(QString::fromUtf8(m_utfsClientStderr)); - emit error(errMsg); - } -} - -void MaemoRemoteMounter::startUtfsServers() -{ - ASSERT_STATE(QList<State>() << UtfsClientsStarted << Inactive); - - if (m_state == Inactive) - return; - - emit reportProgress(tr("Starting UTFS servers...")); - m_utfsServerTimer->start(30000); - for (int i = 0; i < m_mountSpecs.count(); ++i) { - const MountInfo &mountInfo = m_mountSpecs.at(i); - const MaemoMountSpecification &mountSpec = mountInfo.mountSpec; - const ProcPtr utfsServerProc(new QProcess); - const QString port = QString::number(mountInfo.remotePort); - const QString localSecretOpt = QLatin1String("-l"); - const QString remoteSecretOpt = QLatin1String("-r"); - const QStringList utfsServerArgs = QStringList() << localSecretOpt - << port << remoteSecretOpt << port << QLatin1String("-c") - << (m_connection->connectionParameters().host + QLatin1Char(':') + port) - << mountSpec.localDir; - connect(utfsServerProc.data(), - SIGNAL(finished(int,QProcess::ExitStatus)), this, - SLOT(handleUtfsServerFinished(int,QProcess::ExitStatus))); - connect(utfsServerProc.data(), SIGNAL(error(QProcess::ProcessError)), - this, SLOT(handleUtfsServerError(QProcess::ProcessError))); - connect(utfsServerProc.data(), SIGNAL(readyReadStandardError()), this, - SLOT(handleUtfsServerStderr())); - m_utfsServers << utfsServerProc; - utfsServerProc->start(utfsServer(), utfsServerArgs); - } - - setState(UtfsServersStarted); -} - -void MaemoRemoteMounter::handleUtfsServerStderr() -{ - if (m_state != Inactive) { - QProcess * const proc = static_cast<QProcess *>(sender()); - const QByteArray &output = proc->readAllStandardError(); - emit debugOutput(QString::fromLocal8Bit(output)); - } -} - -void MaemoRemoteMounter::handleUtfsServerError(QProcess::ProcessError) -{ - if (m_state == Inactive || m_utfsServers.isEmpty()) - return; - - QProcess * const proc = static_cast<QProcess *>(sender()); - QString errorString = proc->errorString(); - const QByteArray &errorOutput = proc->readAllStandardError(); - if (!errorOutput.isEmpty()) { - errorString += tr("\nstderr was: %1") - .arg(QString::fromLocal8Bit(errorOutput)); - } - killAllUtfsServers(); - emit error(tr("Error running UTFS server: %1").arg(errorString)); - - setState(Inactive); -} - -void MaemoRemoteMounter::handleUtfsServerFinished(int /* exitCode */, - QProcess::ExitStatus exitStatus) -{ - if (m_state != Inactive && exitStatus != QProcess::NormalExit) - handleUtfsServerError(static_cast<QProcess *>(sender())->error()); -} - -void MaemoRemoteMounter::handleUtfsClientStderr(const QByteArray &output) -{ - if (m_state != Inactive) - m_utfsClientStderr += output; -} - -void MaemoRemoteMounter::handleUmountStderr(const QByteArray &output) -{ - if (m_state != Inactive) - m_umountStderr += output; -} - -QString MaemoRemoteMounter::utfsClientOnDevice() const -{ - return QLatin1String("/usr/lib/mad-developer/utfs-client"); -} - -QString MaemoRemoteMounter::utfsServer() const -{ - return m_maddeRoot + QLatin1String("/madlib/utfs-server"); -} - -void MaemoRemoteMounter::killAllUtfsServers() -{ - foreach (const ProcPtr &proc, m_utfsServers) - killUtfsServer(proc.data()); - m_utfsServers.clear(); -} - -void MaemoRemoteMounter::killUtfsServer(QProcess *proc) -{ - disconnect(proc, 0, this, 0); - proc->terminate(); - proc->waitForFinished(1000); - proc->kill(); -} - -void MaemoRemoteMounter::handleUtfsServerTimeout() -{ - ASSERT_STATE(QList<State>() << UtfsServersStarted << Inactive); - if (m_state == Inactive) - return; - - killAllUtfsServers(); - emit error(tr("Timeout waiting for UTFS servers to connect.")); - - setState(Inactive); -} - -void MaemoRemoteMounter::setState(State newState) -{ - if (newState == Inactive) { - m_utfsServerTimer->stop(); - if (m_mountProcess) { - disconnect(m_mountProcess.data(), 0, this, 0); - m_mountProcess->closeChannel(); - } - if (m_unmountProcess) { - disconnect(m_unmountProcess.data(), 0, this, 0); - m_unmountProcess->closeChannel(); - } - } - m_state = newState; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h deleted file mode 100644 index 3fec6f313a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.h +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOREMOTEMOUNTER_H -#define MAEMOREMOTEMOUNTER_H - -#include "maemodeviceconfigurations.h" -#include "maemomountspecification.h" - -#include <QtCore/QList> -#include <QtCore/QObject> -#include <QtCore/QProcess> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> - -QT_FORWARD_DECLARE_CLASS(QTimer) - -namespace Utils { -class SftpChannel; -class SshConnection; -class SshRemoteProcess; -} - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; -namespace Internal { -class MaemoDeviceConfig; -class MaemoUsedPortsGatherer; - -class MaemoRemoteMounter : public QObject -{ - Q_OBJECT -public: - MaemoRemoteMounter(QObject *parent); - ~MaemoRemoteMounter(); - - // Must already be connected. - void setConnection(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &devConf); - - void setBuildConfiguration(const Qt4BuildConfiguration *bc); - void addMountSpecification(const MaemoMountSpecification &mountSpec, - bool mountAsRoot); - bool hasValidMountSpecifications() const; - void resetMountSpecifications() { m_mountSpecs.clear(); } - void mount(MaemoPortList *freePorts, - const MaemoUsedPortsGatherer *portsGatherer); - void unmount(); - void stop(); - -signals: - void mounted(); - void unmounted(); - void error(const QString &reason); - void reportProgress(const QString &progressOutput); - void debugOutput(const QString &output); - -private slots: - void handleUtfsClientsStarted(); - void handleUtfsClientsFinished(int exitStatus); - void handleUtfsClientStderr(const QByteArray &output); - void handleUnmountProcessFinished(int exitStatus); - void handleUmountStderr(const QByteArray &output); - void handleUtfsServerError(QProcess::ProcessError procError); - void handleUtfsServerFinished(int exitCode, - QProcess::ExitStatus exitStatus); - void handleUtfsServerTimeout(); - void handleUtfsServerStderr(); - void startUtfsServers(); - -private: - enum State { - Inactive, Unmounting, UtfsClientsStarting, UtfsClientsStarted, - UtfsServersStarted - }; - - void setState(State newState); - - void startUtfsClients(); - void killUtfsServer(QProcess *proc); - void killAllUtfsServers(); - QString utfsClientOnDevice() const; - QString utfsServer() const; - - QTimer * const m_utfsServerTimer; - - struct MountInfo { - MountInfo(const MaemoMountSpecification &m, bool root) - : mountSpec(m), mountAsRoot(root), remotePort(-1) {} - MaemoMountSpecification mountSpec; - bool mountAsRoot; - int remotePort; - }; - - QSharedPointer<Utils::SshConnection> m_connection; - QSharedPointer<const MaemoDeviceConfig> m_devConf; - QList<MountInfo> m_mountSpecs; - QSharedPointer<Utils::SshRemoteProcess> m_mountProcess; - QSharedPointer<Utils::SshRemoteProcess> m_unmountProcess; - - typedef QSharedPointer<QProcess> ProcPtr; - QList<ProcPtr> m_utfsServers; - - QByteArray m_utfsClientStderr; - QByteArray m_umountStderr; - MaemoPortList *m_freePorts; - const MaemoUsedPortsGatherer *m_portsGatherer; - bool m_remoteMountsAllowed; - QString m_maddeRoot; - - State m_state; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOREMOTEMOUNTER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp deleted file mode 100644 index e27d6ae418..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoremotemountsmodel.h" - -#include "maemoconstants.h" - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoRemoteMountsModel::MaemoRemoteMountsModel(QObject *parent) : - QAbstractTableModel(parent) -{ -} - -void MaemoRemoteMountsModel::addMountSpecification(const QString &localDir) -{ - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_mountSpecs << MaemoMountSpecification(localDir, - MaemoMountSpecification::InvalidMountPoint); - endInsertRows(); -} - -void MaemoRemoteMountsModel::removeMountSpecificationAt(int pos) -{ - Q_ASSERT(pos >= 0 && pos < rowCount()); - beginRemoveRows(QModelIndex(), pos, pos); - m_mountSpecs.removeAt(pos); - endRemoveRows(); -} - -void MaemoRemoteMountsModel::setLocalDir(int pos, const QString &localDir) -{ - Q_ASSERT(pos >= 0 && pos < rowCount()); - m_mountSpecs[pos].localDir = localDir; - const QModelIndex currentIndex = index(pos, LocalDirRow); - emit dataChanged(currentIndex, currentIndex); -} - -int MaemoRemoteMountsModel::validMountSpecificationCount() const -{ - int count = 0; - foreach (const MaemoMountSpecification &m, m_mountSpecs) { - if (m.isValid()) - ++count; - } - return count; -} - -bool MaemoRemoteMountsModel::hasValidMountSpecifications() const -{ - foreach (const MaemoMountSpecification &m, m_mountSpecs) { - if (m.isValid()) - return true; - } - return false; -} - -QVariantMap MaemoRemoteMountsModel::toMap() const -{ - QVariantMap map; - QVariantList localDirsList; - QVariantList remoteMountPointsList; - foreach (const MaemoMountSpecification &mountSpec, m_mountSpecs) { - localDirsList << mountSpec.localDir; - remoteMountPointsList << mountSpec.remoteMountPoint; - } - map.insert(ExportedLocalDirsKey, localDirsList); - map.insert(RemoteMountPointsKey, remoteMountPointsList); - return map; -} - -void MaemoRemoteMountsModel::fromMap(const QVariantMap &map) -{ - const QVariantList &localDirsList - = map.value(ExportedLocalDirsKey).toList(); - const QVariantList &remoteMountPointsList - = map.value(RemoteMountPointsKey).toList(); - const int count - = qMin(localDirsList.count(), remoteMountPointsList.count()); - for (int i = 0; i < count; ++i) { - const QString &localDir = localDirsList.at(i).toString(); - const QString &remoteMountPoint - = remoteMountPointsList.at(i).toString(); - m_mountSpecs << MaemoMountSpecification(localDir, remoteMountPoint); - } -} - -Qt::ItemFlags MaemoRemoteMountsModel::flags(const QModelIndex &index) const -{ - Qt::ItemFlags ourFlags = QAbstractTableModel::flags(index); - if (index.column() == RemoteMountPointRow) - ourFlags |= Qt::ItemIsEditable; - return ourFlags; -} - -QVariant MaemoRemoteMountsModel::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (role != Qt::DisplayRole || orientation != Qt::Horizontal) - return QVariant(); - - switch (section) { - case LocalDirRow: return tr("Local directory"); - case RemoteMountPointRow: return tr("Remote mount point"); - default: return QVariant(); - } -} - -QVariant MaemoRemoteMountsModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount()) - return QVariant(); - - const MaemoMountSpecification &mountSpec = mountSpecificationAt(index.row()); - switch (index.column()) { - case LocalDirRow: - if (role == Qt::DisplayRole) - return mountSpec.localDir; - break; - case RemoteMountPointRow: - if (role == Qt::DisplayRole || role == Qt::EditRole) - return mountSpec.remoteMountPoint; - break; - } - return QVariant(); -} - -bool MaemoRemoteMountsModel::setData(const QModelIndex &index, - const QVariant &value, int role) -{ - if (!index.isValid() || index.row() >= rowCount() || role != Qt::EditRole) - return false; - - bool set; - switch (index.column()) { - case RemoteMountPointRow: { - const QString &newRemoteMountPoint = value.toString(); - for (int i = 0; i < m_mountSpecs.count(); ++i) { - const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i); - if (i != index.row() && mountSpec.isValid() - && mountSpec.remoteMountPoint == newRemoteMountPoint) - return false; - } - m_mountSpecs[index.row()].remoteMountPoint = newRemoteMountPoint; - set = true; - break; - } - case LocalDirRow: - default: - set = false; - break; - } - - if (set) - emit dataChanged(index, index); - return set; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h deleted file mode 100644 index b41da0163a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOREMOTEMOUNTSMODEL_H -#define MAEMOREMOTEMOUNTSMODEL_H - -#include "maemomountspecification.h" - -#include <QtCore/QAbstractTableModel> -#include <QtCore/QList> -#include <QtCore/QString> -#include <QtCore/QVariantMap> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoRemoteMountsModel : public QAbstractTableModel -{ - Q_OBJECT -public: - explicit MaemoRemoteMountsModel(QObject *parent = 0); - int mountSpecificationCount() const { return m_mountSpecs.count(); } - int validMountSpecificationCount() const; - MaemoMountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); } - bool hasValidMountSpecifications() const; - const QList<MaemoMountSpecification> &mountSpecs() const { return m_mountSpecs; } - - void addMountSpecification(const QString &localDir); - void removeMountSpecificationAt(int pos); - void setLocalDir(int pos, const QString &localDir); - - QVariantMap toMap() const; - void fromMap(const QVariantMap &map); - - static const int LocalDirRow = 0; - static const int RemoteMountPointRow = 1; - -private: - virtual int columnCount(const QModelIndex& = QModelIndex()) const; - virtual int rowCount(const QModelIndex& = QModelIndex()) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QModelIndex parent(const QModelIndex &child) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role) const; - virtual QVariant data(const QModelIndex &index, int role) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role); - - QList<MaemoMountSpecification> m_mountSpecs; -}; - -inline int MaemoRemoteMountsModel::columnCount(const QModelIndex &) const -{ - return 2; -} - -inline int MaemoRemoteMountsModel::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : mountSpecificationCount(); -} - -inline QModelIndex MaemoRemoteMountsModel::parent(const QModelIndex &) const -{ - return QModelIndex(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOREMOTEMOUNTSMODEL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.cpp deleted file mode 100644 index eec17f8636..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoremoteprocessesdialog.h" -#include "ui_maemoremoteprocessesdialog.h" - -#include "maemodeviceconfigurations.h" -#include "maemoremoteprocesslist.h" - -#include <QtGui/QMessageBox> -#include <QtGui/QSortFilterProxyModel> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const MaemoDeviceConfig::ConstPtr &devConfig, - QWidget *parent): - QDialog(parent), - m_ui(new Ui::MaemoRemoteProcessesDialog), - m_processList(new MaemoRemoteProcessList(devConfig, this)), - m_proxyModel(new QSortFilterProxyModel(this)) -{ - m_ui->setupUi(this); - m_ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_proxyModel->setSourceModel(m_processList); - m_proxyModel->setDynamicSortFilter(true); - m_proxyModel->setFilterKeyColumn(1); - m_ui->tableView->setModel(m_proxyModel); - connect(m_ui->processFilterLineEdit, SIGNAL(textChanged(QString)), - m_proxyModel, SLOT(setFilterRegExp(QString))); - - // Manually gathered process information is missing the command line for - // some system processes. Dont's show these lines by default. - if (devConfig->osVersion() == MaemoDeviceConfig::Maemo5) - m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+")); - - connect(m_ui->tableView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(handleSelectionChanged())); - connect(m_ui->updateListButton, SIGNAL(clicked()), - SLOT(updateProcessList())); - connect(m_ui->killProcessButton, SIGNAL(clicked()), SLOT(killProcess())); - connect(m_processList, SIGNAL(error(QString)), - SLOT(handleRemoteError(QString))); - connect(m_processList, SIGNAL(modelReset()), - SLOT(handleProcessListUpdated())); - connect(m_processList, SIGNAL(processKilled()), - SLOT(handleProcessKilled()), Qt::QueuedConnection); - connect(m_proxyModel, SIGNAL(layoutChanged()), - SLOT(handleProcessListUpdated())); - handleSelectionChanged(); - updateProcessList(); -} - -MaemoRemoteProcessesDialog::~MaemoRemoteProcessesDialog() -{ - delete m_ui; -} - -void MaemoRemoteProcessesDialog::handleRemoteError(const QString &errorMsg) -{ - QMessageBox::critical(this, tr("Remote Error"), errorMsg); - m_ui->updateListButton->setEnabled(true); - handleSelectionChanged(); -} - -void MaemoRemoteProcessesDialog::handleProcessListUpdated() -{ - m_ui->updateListButton->setEnabled(true); - m_ui->tableView->resizeRowsToContents(); - handleSelectionChanged(); -} - -void MaemoRemoteProcessesDialog::updateProcessList() -{ - m_ui->updateListButton->setEnabled(false); - m_ui->killProcessButton->setEnabled(false); - m_processList->update(); -} - -void MaemoRemoteProcessesDialog::killProcess() -{ - const QModelIndexList &indexes - = m_ui->tableView->selectionModel()->selectedIndexes(); - if (indexes.empty()) - return; - m_ui->updateListButton->setEnabled(false); - m_ui->killProcessButton->setEnabled(false); - m_processList->killProcess(m_proxyModel->mapToSource(indexes.first()).row()); -} - -void MaemoRemoteProcessesDialog::handleProcessKilled() -{ - updateProcessList(); -} - -void MaemoRemoteProcessesDialog::handleSelectionChanged() -{ - m_ui->killProcessButton->setEnabled(m_ui->tableView->selectionModel()->hasSelection()); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.h deleted file mode 100644 index 8862e8069c..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOREMOTEPROCESSDIALOG_H -#define MAEMOREMOTEPROCESSDIALOG_H - -#include <QtCore/QSharedPointer> -#include <QtGui/QDialog> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoRemoteProcessesDialog; -} -class QSortFilterProxyModel; -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; -class MaemoRemoteProcessList; - -class MaemoRemoteProcessesDialog : public QDialog -{ - Q_OBJECT - -public: - explicit MaemoRemoteProcessesDialog(const QSharedPointer<const MaemoDeviceConfig> &devConfig, - QWidget *parent = 0); - ~MaemoRemoteProcessesDialog(); - -private slots: - void updateProcessList(); - void killProcess(); - void handleRemoteError(const QString &errorMsg); - void handleProcessListUpdated(); - void handleProcessKilled(); - void handleSelectionChanged(); - -private: - Ui::MaemoRemoteProcessesDialog *m_ui; - MaemoRemoteProcessList *const m_processList; - QSortFilterProxyModel *const m_proxyModel; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOREMOTEPROCESSDIALOG_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.ui deleted file mode 100644 index 7e74791729..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocessesdialog.ui +++ /dev/null @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoRemoteProcessesDialog</class> - <widget class="QDialog" name="MaemoRemoteProcessesDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>766</width> - <height>684</height> - </rect> - </property> - <property name="windowTitle"> - <string>List of Remote Processes</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="filterLabel"> - <property name="text"> - <string>&Filter by process name:</string> - </property> - <property name="buddy"> - <cstring>processFilterLineEdit</cstring> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="processFilterLineEdit"/> - </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> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QTableView" name="tableView"> - <property name="showGrid"> - <bool>false</bool> - </property> - <property name="sortingEnabled"> - <bool>true</bool> - </property> - <attribute name="horizontalHeaderDefaultSectionSize"> - <number>100</number> - </attribute> - <attribute name="horizontalHeaderStretchLastSection"> - <bool>true</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPushButton" name="updateListButton"> - <property name="text"> - <string>&Update List</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="killProcessButton"> - <property name="text"> - <string>&Kill Selected Process</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Close</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>MaemoRemoteProcessesDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>257</x> - <y>290</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>MaemoRemoteProcessesDialog</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/qt4projectmanager/qt-maemo/maemoremoteprocesslist.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.cpp deleted file mode 100644 index 68e19294ab..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoremoteprocesslist.h" - -#include "maemodeviceconfigurations.h" - -#include <utils/ssh/sshremoteprocessrunner.h> - -#include <QtCore/QStringList> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QByteArray LineSeparator1("---"); -const QByteArray LineSeparator2("QTCENDOFLINE---"); -const QByteArray LineSeparator = LineSeparator1 + LineSeparator2; -} // anonymous namespace - -MaemoRemoteProcessList::MaemoRemoteProcessList(const MaemoDeviceConfig::ConstPtr &devConfig, - QObject *parent) - : QAbstractTableModel(parent), - m_process(SshRemoteProcessRunner::create(devConfig->sshParameters())), - m_state(Inactive), - m_devConfig(devConfig) -{ -} - -MaemoRemoteProcessList::~MaemoRemoteProcessList() {} - -void MaemoRemoteProcessList::update() -{ - if (m_state != Inactive) { - qDebug("%s: Did not expect state to be %d.", Q_FUNC_INFO, m_state); - stop(); - } - beginResetModel(); - m_remoteProcs.clear(); - QByteArray command; - - // The ps command on Fremantle ignores all command line options, so - // we have to collect the information in /proc manually. - if (m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5) { - command = "sep1=" + LineSeparator1 + '\n' - + "sep2=" + LineSeparator2 + '\n' - + "pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; " - + "for pid in $pidlist\n" - + "do\n" - + " echo -n \"$pid \"\n" - + " tr '\\0' ' ' < /proc/$pid/cmdline\n" - + " echo -n \"$sep1$sep2\"\n" - + "done\n" - + "echo ''"; - } else { - command = "ps -eo pid,args"; - } - - startProcess(command, Listing); -} - -void MaemoRemoteProcessList::killProcess(int row) -{ - Q_ASSERT(row >= 0 && row < m_remoteProcs.count()); - const QByteArray command - = "kill -9 " + QByteArray::number(m_remoteProcs.at(row).pid); - startProcess(command, Killing); -} - -void MaemoRemoteProcessList::startProcess(const QByteArray &cmdLine, - State newState) -{ - if (m_state != Inactive) { - qDebug("%s: Did not expect state to be %d.", Q_FUNC_INFO, m_state); - stop(); - } - m_state = newState; - connect(m_process.data(), SIGNAL(connectionError(Utils::SshError)), - SLOT(handleConnectionError())); - connect(m_process.data(), SIGNAL(processOutputAvailable(QByteArray)), - SLOT(handleRemoteStdOut(QByteArray))); - connect(m_process.data(), - SIGNAL(processErrorOutputAvailable(QByteArray)), - SLOT(handleRemoteStdErr(QByteArray))); - connect(m_process.data(), SIGNAL(processClosed(int)), - SLOT(handleRemoteProcessFinished(int))); - m_remoteStdout.clear(); - m_remoteStderr.clear(); - m_errorMsg.clear(); - m_process->run(cmdLine); -} - -void MaemoRemoteProcessList::handleConnectionError() -{ - if (m_state == Inactive) - return; - - emit error(tr("Connection failure: %1") - .arg(m_process->connection()->errorString())); - stop(); -} - -void MaemoRemoteProcessList::handleRemoteStdOut(const QByteArray &output) -{ - if (m_state == Listing) - m_remoteStdout += output; -} - -void MaemoRemoteProcessList::handleRemoteStdErr(const QByteArray &output) -{ - if (m_state != Inactive) - m_remoteStderr += output; -} - -void MaemoRemoteProcessList::handleRemoteProcessFinished(int exitStatus) -{ - if (m_state == Inactive) - return; - - switch (exitStatus) { - case SshRemoteProcess::FailedToStart: - m_errorMsg = tr("Error: Remote process failed to start: %1") - .arg(m_process->process()->errorString()); - break; - case SshRemoteProcess::KilledBySignal: - m_errorMsg = tr("Error: Remote process crashed: %1") - .arg(m_process->process()->errorString()); - break; - case SshRemoteProcess::ExitedNormally: - if (m_process->process()->exitCode() == 0) { - if (m_state == Listing) - buildProcessList(); - } else { - m_errorMsg = tr("Remote process failed."); - } - break; - default: - Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid exit status"); - } - - if (!m_errorMsg.isEmpty()) { - if (!m_remoteStderr.isEmpty()) { - m_errorMsg += tr("\nRemote stderr was: %1") - .arg(QString::fromUtf8(m_remoteStderr)); - } - emit error(m_errorMsg); - } - stop(); -} - -void MaemoRemoteProcessList::stop() -{ - if (m_state == Inactive) - return; - - disconnect(m_process.data(), 0, this, 0); - if (m_state == Listing) - endResetModel(); - else if (m_errorMsg.isEmpty()) - emit processKilled(); - m_state = Inactive; -} - -void MaemoRemoteProcessList::buildProcessList() -{ - const bool isFremantle = m_devConfig->osVersion() == MaemoDeviceConfig::Maemo5; - const QString remoteOutput = QString::fromUtf8(m_remoteStdout); - const QByteArray lineSeparator = isFremantle ? LineSeparator : "\n"; - QStringList lines = remoteOutput.split(QString::fromUtf8(lineSeparator)); - if (!isFremantle) - lines.removeFirst(); // column headers - foreach (const QString &line, lines) { - const QString &trimmedLine = line.trimmed(); - const int pidEndPos = trimmedLine.indexOf(' '); - if (pidEndPos == -1) - continue; - bool isNumber; - const int pid = trimmedLine.left(pidEndPos).toInt(&isNumber); - if (!isNumber) { - qDebug("%s: Non-integer value where pid was expected. Line was: '%s'", - Q_FUNC_INFO, qPrintable(trimmedLine)); - continue; - } - m_remoteProcs << RemoteProc(pid, trimmedLine.mid(pidEndPos)); - } -} - -int MaemoRemoteProcessList::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : m_remoteProcs.count(); -} - -int MaemoRemoteProcessList::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent); - return 2; -} - -QVariant MaemoRemoteProcessList::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (orientation != Qt::Horizontal || role != Qt::DisplayRole - || section < 0 || section >= columnCount()) - return QVariant(); - if (section == 0) - return tr("PID"); - else - return tr("Command Line"); -} - -QVariant MaemoRemoteProcessList::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= rowCount(index.parent()) - || index.column() >= columnCount() || role != Qt::DisplayRole) - return QVariant(); - const RemoteProc &proc = m_remoteProcs.at(index.row()); - if (index.column() == 0) - return proc.pid; - else - return proc.cmdLine; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.h deleted file mode 100644 index 9bad8a66e7..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremoteprocesslist.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOREMOTEPROCESSLIST_H -#define MAEMOREMOTEPROCESSLIST_H - -#include <QtCore/QAbstractTableModel> -#include <QtCore/QByteArray> -#include <QtCore/QList> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> -#include <utils/ssh/sshremoteprocessrunner.h> - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; - -class MaemoRemoteProcessList : public QAbstractTableModel -{ - Q_OBJECT -public: - explicit MaemoRemoteProcessList(const QSharedPointer<const MaemoDeviceConfig> &devConfig, - QObject *parent = 0); - ~MaemoRemoteProcessList(); - void update(); - void killProcess(int row); - -signals: - void error(const QString &errorMsg); - void processKilled(); - -private slots: - void handleRemoteStdOut(const QByteArray &output); - void handleRemoteStdErr(const QByteArray &output); - void handleConnectionError(); - void handleRemoteProcessFinished(int exitStatus); - -private: - enum State { Inactive, Listing, Killing }; - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - 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; - - void buildProcessList(); - void stop(); - void startProcess(const QByteArray &cmdLine, State newState); - - const QSharedPointer<Utils::SshRemoteProcessRunner> m_process; - QByteArray m_remoteStdout; - QByteArray m_remoteStderr; - QString m_errorMsg; - State m_state; - - struct RemoteProc { - RemoteProc(int pid, const QString &cmdLine) - : pid(pid), cmdLine(cmdLine) {} - int pid; - QString cmdLine; - }; - QList<RemoteProc> m_remoteProcs; - const QSharedPointer<const MaemoDeviceConfig> m_devConfig; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOREMOTEPROCESSLIST_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp deleted file mode 100644 index f54b4d0792..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ /dev/null @@ -1,439 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemorunconfiguration.h" - -#include "abstractlinuxdevicedeploystep.h" -#include "maemodeployables.h" -#include "maemoglobal.h" -#include "maemoqemumanager.h" -#include "maemoremotemountsmodel.h" -#include "maemorunconfigurationwidget.h" -#include "maemotoolchain.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" -#include "maemoqtversion.h" - -#include <coreplugin/icore.h> -#include <coreplugin/messagemanager.h> - -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/session.h> - -#include <qtsupport/qtoutputformatter.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4target.h> - -#include <utils/qtcassert.h> -#include <utils/qtcprocess.h> - -#include <QtCore/QStringBuilder> - -namespace Qt4ProjectManager { -namespace Internal { - -namespace { -const bool DefaultUseRemoteGdbValue = false; -} // anonymous namespace - -using namespace ProjectExplorer; - -MaemoRunConfiguration::MaemoRunConfiguration(Qt4BaseTarget *parent, - const QString &proFilePath) - : RunConfiguration(parent, QLatin1String(MAEMO_RC_ID)) - , m_proFilePath(proFilePath) - , m_useRemoteGdb(DefaultUseRemoteGdbValue) - , m_baseEnvironmentBase(SystemEnvironmentBase) - , m_validParse(parent->qt4Project()->validParse(m_proFilePath)) -{ - init(); -} - -MaemoRunConfiguration::MaemoRunConfiguration(Qt4BaseTarget *parent, - MaemoRunConfiguration *source) - : RunConfiguration(parent, source) - , m_proFilePath(source->m_proFilePath) - , m_gdbPath(source->m_gdbPath) - , m_arguments(source->m_arguments) - , m_useRemoteGdb(source->useRemoteGdb()) - , m_baseEnvironmentBase(source->m_baseEnvironmentBase) - , m_systemEnvironment(source->m_systemEnvironment) - , m_userEnvironmentChanges(source->m_userEnvironmentChanges) - , m_validParse(source->m_validParse) -{ - init(); -} - -void MaemoRunConfiguration::init() -{ - setDefaultDisplayName(defaultDisplayName()); - setUseCppDebugger(true); - setUseQmlDebugger(false); - m_remoteMounts = new MaemoRemoteMountsModel(this); - - connect(target(), - SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), - this, SLOT(handleDeployConfigChanged())); - handleDeployConfigChanged(); - - Qt4Project *pro = qt4Target()->qt4Project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool))); - connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *)), - this, SLOT(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*))); -} - -MaemoRunConfiguration::~MaemoRunConfiguration() -{ -} - -Qt4BaseTarget *MaemoRunConfiguration::qt4Target() const -{ - return static_cast<Qt4BaseTarget *>(target()); -} - -Qt4BuildConfiguration *MaemoRunConfiguration::activeQt4BuildConfiguration() const -{ - return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration()); -} - -bool MaemoRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration * /* config */) const -{ - if (!m_validParse) - return false; - return true; -} - -QWidget *MaemoRunConfiguration::createConfigurationWidget() -{ - return new MaemoRunConfigurationWidget(this); -} - -Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const -{ - return new QtSupport::QtOutputFormatter(qt4Target()->qt4Project()); -} - -void MaemoRunConfiguration::handleParseState(bool success) -{ - bool enabled = isEnabled(); - m_validParse = success; - if (enabled != isEnabled()) { - emit isEnabledChanged(!enabled); - } -} - -void MaemoRunConfiguration::proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro) -{ - if (m_proFilePath != pro->path()) - return; - handleParseState(false); -} - -void MaemoRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success) -{ - if (m_proFilePath == pro->path()) { - handleParseState(success); - emit targetInformationChanged(); - } -} - -QVariantMap MaemoRunConfiguration::toMap() const -{ - QVariantMap map(RunConfiguration::toMap()); - map.insert(ArgumentsKey, m_arguments); - const QDir dir = QDir(target()->project()->projectDirectory()); - map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath)); - map.insert(UseRemoteGdbKey, useRemoteGdb()); - map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase); - map.insert(UserEnvironmentChangesKey, - Utils::EnvironmentItem::toStringList(m_userEnvironmentChanges)); - map.unite(m_remoteMounts->toMap()); - return map; -} - -bool MaemoRunConfiguration::fromMap(const QVariantMap &map) -{ - if (!RunConfiguration::fromMap(map)) - return false; - - m_arguments = map.value(ArgumentsKey).toString(); - const QDir dir = QDir(target()->project()->projectDirectory()); - m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); - m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool(); - m_userEnvironmentChanges = - Utils::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey) - .toStringList()); - m_baseEnvironmentBase = static_cast<BaseEnvironmentBase> (map.value(BaseEnvironmentBaseKey, - SystemEnvironmentBase).toInt()); - m_remoteMounts->fromMap(map); - - m_validParse = qt4Target()->qt4Project()->validParse(m_proFilePath); - - setDefaultDisplayName(defaultDisplayName()); - - return true; -} - -QString MaemoRunConfiguration::defaultDisplayName() -{ - if (!m_proFilePath.isEmpty()) - return (QFileInfo(m_proFilePath).completeBaseName()) + QLatin1String(" (remote)"); - //: Maemo run configuration default display name - return tr("Run on remote device"); -} - -MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const -{ - const AbstractLinuxDeviceDeployStep * const step = deployStep(); - return step ? step->helper().deviceConfig() : MaemoDeviceConfig::ConstPtr(); -} - -const QString MaemoRunConfiguration::gdbCmd() const -{ - return QDir::toNativeSeparators(activeBuildConfiguration()->toolChain()->debuggerCommand()); -} - -Qt4MaemoDeployConfiguration *MaemoRunConfiguration::deployConfig() const -{ - return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration()); -} - -AbstractLinuxDeviceDeployStep *MaemoRunConfiguration::deployStep() const -{ - return MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(deployConfig(), 0); -} - -const QString MaemoRunConfiguration::targetRoot() const -{ - QTC_ASSERT(activeQt4BuildConfiguration(), return QString()); - QtSupport::BaseQtVersion *v = activeQt4BuildConfiguration()->qtVersion(); - if (!v) - return QString(); - return MaemoGlobal::targetRoot(v->qmakeCommand()); -} - -const QString MaemoRunConfiguration::arguments() const -{ - return m_arguments; -} - -QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const -{ - const QString projectDir - = QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration() - ->target()->project()->projectDirectory())); - const QString execDir - = QDir::fromNativeSeparators(QFileInfo(localExecutableFilePath()).path()); - const int length = qMin(projectDir.length(), execDir.length()); - int lastSeparatorPos = 0; - for (int i = 0; i < length; ++i) { - if (projectDir.at(i) != execDir.at(i)) - return projectDir.left(lastSeparatorPos); - if (projectDir.at(i) == QLatin1Char('/')) - lastSeparatorPos = i; - } - return projectDir.length() == execDir.length() - ? projectDir : projectDir.left(lastSeparatorPos); -} - -QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const -{ - return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName) - + QLatin1String("/gdbSourcesDir_") - + QFileInfo(localExecutableFilePath()).fileName(); -} - -QString MaemoRunConfiguration::localExecutableFilePath() const -{ - TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode() - ->targetInformation(m_proFilePath); - if (!ti.valid) - return QString(); - - return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target); -} - -QString MaemoRunConfiguration::remoteExecutableFilePath() const -{ - return deployConfig()->deployables()->remoteExecutableFilePath(localExecutableFilePath()); -} - -MaemoPortList MaemoRunConfiguration::freePorts() const -{ - const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration(); - const AbstractLinuxDeviceDeployStep * const step = deployStep(); - return bc && step - ? MaemoGlobal::freePorts(deployStep()->helper().deviceConfig(), bc->qtVersion()) - : MaemoPortList(); -} - -bool MaemoRunConfiguration::useRemoteGdb() const -{ - if (!m_useRemoteGdb) - return false; - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(target()); - return maemoTarget && maemoTarget->allowsRemoteMounts(); -} - -void MaemoRunConfiguration::setArguments(const QString &args) -{ - m_arguments = args; -} - -MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const -{ - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(target()); - if (!maemoTarget || !maemoTarget->allowsQmlDebugging()) - return DebugCppOnly; - if (useCppDebugger()) { - if (useQmlDebugger()) - return DebugCppAndQml; - return DebugCppOnly; - } - return DebugQmlOnly; -} - -int MaemoRunConfiguration::portsUsedByDebuggers() const -{ - switch (debuggingType()) { - case DebugCppOnly: - case DebugQmlOnly: - return 1; - case DebugCppAndQml: - default: - return 2; - } -} - -void MaemoRunConfiguration::updateDeviceConfigurations() -{ - emit deviceConfigurationChanged(target()); -} - -void MaemoRunConfiguration::handleDeployConfigChanged() -{ - DeployConfiguration * const activeDeployConf - = target()->activeDeployConfiguration(); - if (activeDeployConf) { - connect(activeDeployConf->stepList(), SIGNAL(stepInserted(int)), - SLOT(handleDeployConfigChanged()), Qt::UniqueConnection); - connect(activeDeployConf->stepList(), SIGNAL(stepInserted(int)), - SLOT(handleDeployConfigChanged()), Qt::UniqueConnection); - connect(activeDeployConf->stepList(), SIGNAL(stepMoved(int,int)), - SLOT(handleDeployConfigChanged()), Qt::UniqueConnection); - connect(activeDeployConf->stepList(), SIGNAL(stepRemoved(int)), - SLOT(handleDeployConfigChanged()), Qt::UniqueConnection); - AbstractLinuxDeviceDeployStep * const step - = MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(activeDeployConf, 0); - if (step) { - connect(&step->helper(), SIGNAL(deviceConfigChanged()), - SLOT(updateDeviceConfigurations()), Qt::UniqueConnection); - } - } - - updateDeviceConfigurations(); - updateFactoryState(); -} - -QString MaemoRunConfiguration::baseEnvironmentText() const -{ - if (m_baseEnvironmentBase == CleanEnvironmentBase) - return tr("Clean Environment"); - else if (m_baseEnvironmentBase == SystemEnvironmentBase) - return tr("System Environment"); - return QString(); -} - -MaemoRunConfiguration::BaseEnvironmentBase MaemoRunConfiguration::baseEnvironmentBase() const -{ - return m_baseEnvironmentBase; -} - -void MaemoRunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env) -{ - if (m_baseEnvironmentBase != env) { - m_baseEnvironmentBase = env; - emit baseEnvironmentChanged(); - } -} - -Utils::Environment MaemoRunConfiguration::environment() const -{ - Utils::Environment env = baseEnvironment(); - env.modify(userEnvironmentChanges()); - return env; -} - -Utils::Environment MaemoRunConfiguration::baseEnvironment() const -{ - return (m_baseEnvironmentBase == SystemEnvironmentBase ? systemEnvironment() - : Utils::Environment()); -} - -QList<Utils::EnvironmentItem> MaemoRunConfiguration::userEnvironmentChanges() const -{ - return m_userEnvironmentChanges; -} - -void MaemoRunConfiguration::setUserEnvironmentChanges( - const QList<Utils::EnvironmentItem> &diff) -{ - if (m_userEnvironmentChanges != diff) { - m_userEnvironmentChanges = diff; - emit userEnvironmentChangesChanged(diff); - } -} - -Utils::Environment MaemoRunConfiguration::systemEnvironment() const -{ - return m_systemEnvironment; -} - -void MaemoRunConfiguration::setSystemEnvironment(const Utils::Environment &environment) -{ - if (m_systemEnvironment.size() == 0 || m_systemEnvironment != environment) { - m_systemEnvironment = environment; - emit systemEnvironmentChanged(); - } -} - -QString MaemoRunConfiguration::proFilePath() const -{ - return m_proFilePath; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h deleted file mode 100644 index f28bad75e0..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ /dev/null @@ -1,167 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMORUNCONFIGURATION_H -#define MAEMORUNCONFIGURATION_H - -#include "maemoconstants.h" -#include "maemodeviceconfigurations.h" -#include "maemodeployable.h" - -#include <utils/environment.h> - -#include <projectexplorer/runconfiguration.h> - -#include <QtCore/QDateTime> -#include <QtCore/QStringList> - -QT_FORWARD_DECLARE_CLASS(QWidget) - -namespace Qt4ProjectManager { - -class Qt4BuildConfiguration; -class Qt4Project; -class Qt4BaseTarget; - -namespace Internal { - -class Qt4ProFileNode; - -class AbstractLinuxDeviceDeployStep; -class MaemoDeviceConfigListModel; -class MaemoManager; -class MaemoRemoteMountsModel; -class MaemoRunConfigurationFactory; -class MaemoToolChain; -class Qt4MaemoDeployConfiguration; - -class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration -{ - Q_OBJECT - friend class MaemoRunConfigurationFactory; - -public: - enum BaseEnvironmentBase { - CleanEnvironmentBase = 0, - SystemEnvironmentBase = 1 - }; - - enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml }; - - MaemoRunConfiguration(Qt4BaseTarget *parent, const QString &proFilePath); - virtual ~MaemoRunConfiguration(); - - using ProjectExplorer::RunConfiguration::isEnabled; - bool isEnabled(ProjectExplorer::BuildConfiguration *config) const; - QWidget *createConfigurationWidget(); - Utils::OutputFormatter *createOutputFormatter() const; - Qt4BaseTarget *qt4Target() const; - Qt4BuildConfiguration *activeQt4BuildConfiguration() const; - - Qt4MaemoDeployConfiguration *deployConfig() const; - MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; } - - QString localExecutableFilePath() const; - QString remoteExecutableFilePath() const; - const QString targetRoot() const; - const QString arguments() const; - void setArguments(const QString &args); - QSharedPointer<const MaemoDeviceConfig> deviceConfig() const; - MaemoPortList freePorts() const; - bool useRemoteGdb() const; - void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; } - void updateFactoryState() { emit isEnabledChanged(true); } - DebuggingType debuggingType() const; - - const QString gdbCmd() const; - QString localDirToMountForRemoteGdb() const; - QString remoteProjectSourcesMountPoint() const; - - virtual QVariantMap toMap() const; - - QString baseEnvironmentText() const; - BaseEnvironmentBase baseEnvironmentBase() const; - void setBaseEnvironmentBase(BaseEnvironmentBase env); - - Utils::Environment environment() const; - Utils::Environment baseEnvironment() const; - - QList<Utils::EnvironmentItem> userEnvironmentChanges() const; - void setUserEnvironmentChanges(const QList<Utils::EnvironmentItem> &diff); - - Utils::Environment systemEnvironment() const; - void setSystemEnvironment(const Utils::Environment &environment); - - int portsUsedByDebuggers() const; - - QString proFilePath() const; - -signals: - void deviceConfigurationChanged(ProjectExplorer::Target *target); - void targetInformationChanged() const; - - void baseEnvironmentChanged(); - void systemEnvironmentChanged(); - void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff); - -protected: - MaemoRunConfiguration(Qt4BaseTarget *parent, MaemoRunConfiguration *source); - virtual bool fromMap(const QVariantMap &map); - QString defaultDisplayName(); - -private slots: - void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success); - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro); - void updateDeviceConfigurations(); - void handleDeployConfigChanged(); - -private: - void init(); - void handleParseState(bool success); - AbstractLinuxDeviceDeployStep *deployStep() const; - - QString m_proFilePath; - mutable QString m_gdbPath; - MaemoRemoteMountsModel *m_remoteMounts; - QString m_arguments; - bool m_useRemoteGdb; - - BaseEnvironmentBase m_baseEnvironmentBase; - Utils::Environment m_systemEnvironment; - QList<Utils::EnvironmentItem> m_userEnvironmentChanges; - bool m_validParse; -}; - - } // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMORUNCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp deleted file mode 100644 index 0d8aa29dc6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ /dev/null @@ -1,542 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemorunconfigurationwidget.h" - -#include "maemodeployables.h" -#include "maemodeviceenvreader.h" -#include "maemomanager.h" -#include "maemoglobal.h" -#include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" -#include "maemosettingspages.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <coreplugin/coreconstants.h> -#include <coreplugin/icore.h> -#include <projectexplorer/environmentwidget.h> -#include <qt4projectmanager/qt4buildconfiguration.h> -#include <qt4projectmanager/qt4target.h> -#include <utils/detailswidget.h> - -#include <QtGui/QButtonGroup> -#include <QtCore/QCoreApplication> -#include <QtGui/QComboBox> -#include <QtGui/QFileDialog> -#include <QtGui/QFormLayout> -#include <QtGui/QGroupBox> -#include <QtGui/QHBoxLayout> -#include <QtGui/QHeaderView> -#include <QtGui/QLabel> -#include <QtGui/QLineEdit> -#include <QtGui/QMessageBox> -#include <QtGui/QPushButton> -#include <QtGui/QRadioButton> -#include <QtGui/QTableView> -#include <QtGui/QToolButton> - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QString FetchEnvButtonText - = QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoRunConfigurationWidget", - "Fetch Device Environment"); -} // anonymous namespace - -MaemoRunConfigurationWidget::MaemoRunConfigurationWidget( - MaemoRunConfiguration *runConfiguration, QWidget *parent) - : QWidget(parent), - m_runConfiguration(runConfiguration), - m_ignoreChange(false), - m_deviceEnvReader(new MaemoDeviceEnvReader(this, runConfiguration)), - m_deployablesConnected(false) -{ - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); - addGenericWidgets(mainLayout); - mainLayout->addSpacing(20); - addDebuggingWidgets(mainLayout); - addMountWidgets(mainLayout); - addEnvironmentWidgets(mainLayout); - connect(m_runConfiguration, - SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)), - this, SLOT(handleCurrentDeviceConfigChanged())); - handleCurrentDeviceConfigChanged(); - - connect(m_runConfiguration, SIGNAL(isEnabledChanged(bool)), - this, SLOT(runConfigurationEnabledChange(bool))); - - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(runConfiguration->target()); - const bool remoteMountsAvailable - = maemoTarget && maemoTarget->allowsRemoteMounts(); - m_debugDetailsContainer->setVisible(remoteMountsAvailable); - m_mountDetailsContainer->setVisible(remoteMountsAvailable); - const bool qmlDebuggingAvailable - = !maemoTarget || maemoTarget->allowsQmlDebugging(); - m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable); - m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable); - m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable); - m_debugCppAndQmlButton->setVisible(qmlDebuggingAvailable); - - setEnabled(m_runConfiguration->isEnabled()); -} - -void MaemoRunConfigurationWidget::runConfigurationEnabledChange(bool enabled) -{ - setEnabled(enabled); -} - -void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) -{ - QFormLayout *formLayout = new QFormLayout; - mainLayout->addLayout(formLayout); - formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter); - - QWidget *devConfWidget = new QWidget; - QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget); - m_devConfLabel = new QLabel; - devConfLayout->setMargin(0); - devConfLayout->addWidget(m_devConfLabel); - QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>") - .arg(QLatin1String("deviceconfig"))); - addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - devConfLayout->addWidget(addDevConfLabel); - - QLabel *debuggerConfLabel = new QLabel(tr("<a href=\"%1\">Set Debugger</a>") - .arg(QLatin1String("debugger"))); - debuggerConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - devConfLayout->addWidget(debuggerConfLabel); - - formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget); - m_localExecutableLabel - = new QLabel(m_runConfiguration->localExecutableFilePath()); - formLayout->addRow(tr("Executable on host:"), m_localExecutableLabel); - m_remoteExecutableLabel = new QLabel; - formLayout->addRow(tr("Executable on device:"), m_remoteExecutableLabel); - m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments()); - formLayout->addRow(tr("Arguments:"), m_argsLineEdit); - - QHBoxLayout * const debugButtonsLayout = new QHBoxLayout; - m_debugCppOnlyButton = new QRadioButton(tr("C++ only")); - m_debugQmlOnlyButton = new QRadioButton(tr("QML only")); - m_debugCppAndQmlButton = new QRadioButton(tr("C++ and QML")); - m_debuggingLanguagesLabel = new QLabel(tr("Debugging type:")); - QButtonGroup * const buttonGroup = new QButtonGroup; - buttonGroup->addButton(m_debugCppOnlyButton); - buttonGroup->addButton(m_debugQmlOnlyButton); - buttonGroup->addButton(m_debugCppAndQmlButton); - debugButtonsLayout->addWidget(m_debugCppOnlyButton); - debugButtonsLayout->addWidget(m_debugQmlOnlyButton); - debugButtonsLayout->addWidget(m_debugCppAndQmlButton); - formLayout->addRow(m_debuggingLanguagesLabel, debugButtonsLayout); - if (m_runConfiguration->useCppDebugger()) { - if (m_runConfiguration->useQmlDebugger()) - m_debugCppAndQmlButton->setChecked(true); - else - m_debugCppOnlyButton->setChecked(true); - } else { - m_debugQmlOnlyButton->setChecked(true); - } - - connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this, - SLOT(showDeviceConfigurationsDialog(QString))); - connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this, - SLOT(showDeviceConfigurationsDialog(QString))); - connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this, - SLOT(argumentsEdited(QString))); - connect(m_debugCppOnlyButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_debugQmlOnlyButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_debugCppAndQmlButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged())); - connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, - SLOT(updateTargetInformation())); - connect(m_runConfiguration->target(), - SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), - SLOT(handleActiveDeployConfigurationChanged())); - handleActiveDeployConfigurationChanged(); -} - -void MaemoRunConfigurationWidget::addDebuggingWidgets(QVBoxLayout *mainLayout) -{ - m_debugDetailsContainer = new Utils::DetailsWidget(this); - QWidget *debugWidget = new QWidget; - m_debugDetailsContainer->setWidget(debugWidget); - mainLayout->addWidget(m_debugDetailsContainer); - QFormLayout *debugLayout = new QFormLayout(debugWidget); - QHBoxLayout *debugRadioButtonsLayout = new QHBoxLayout; - debugLayout->addRow(debugRadioButtonsLayout); - QRadioButton *gdbButton = new QRadioButton(tr("Use remote GDB")); - QRadioButton *gdbServerButton = new QRadioButton(tr("Use remote GDB server")); - debugRadioButtonsLayout->addWidget(gdbButton); - debugRadioButtonsLayout->addWidget(gdbServerButton); - debugRadioButtonsLayout->addStretch(1); - gdbButton->setChecked(m_runConfiguration->useRemoteGdb()); - gdbServerButton->setChecked(!gdbButton->isChecked()); - connect(gdbButton, SIGNAL(toggled(bool)), this, - SLOT(handleDebuggingTypeChanged(bool))); - handleDebuggingTypeChanged(gdbButton->isChecked()); -} - -void MaemoRunConfigurationWidget::addMountWidgets(QVBoxLayout *mainLayout) -{ - - m_mountDetailsContainer = new Utils::DetailsWidget(this); - QWidget *mountViewWidget = new QWidget; - m_mountDetailsContainer->setWidget(mountViewWidget); - mainLayout->addWidget(m_mountDetailsContainer); - QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewWidget); - m_mountWarningLabel = new QLabel; - mountViewLayout->addWidget(m_mountWarningLabel); - QHBoxLayout *tableLayout = new QHBoxLayout; - mountViewLayout->addLayout(tableLayout); - m_mountView = new QTableView; - m_mountView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); - m_mountView->setSelectionBehavior(QTableView::SelectRows); - m_mountView->setModel(m_runConfiguration->remoteMounts()); - tableLayout->addWidget(m_mountView); - QVBoxLayout *mountViewButtonsLayout = new QVBoxLayout; - tableLayout->addLayout(mountViewButtonsLayout); - QToolButton *addMountButton = new QToolButton; - QIcon plusIcon; - plusIcon.addFile(QLatin1String(Core::Constants::ICON_PLUS)); - addMountButton->setIcon(plusIcon); - mountViewButtonsLayout->addWidget(addMountButton); - m_removeMountButton = new QToolButton; - QIcon minusIcon; - minusIcon.addFile(QLatin1String(Core::Constants::ICON_MINUS)); - m_removeMountButton->setIcon(minusIcon); - mountViewButtonsLayout->addWidget(m_removeMountButton); - mountViewButtonsLayout->addStretch(1); - - connect(addMountButton, SIGNAL(clicked()), this, SLOT(addMount())); - connect(m_removeMountButton, SIGNAL(clicked()), this, SLOT(removeMount())); - connect(m_mountView, SIGNAL(doubleClicked(QModelIndex)), this, - SLOT(changeLocalMountDir(QModelIndex))); - connect(m_mountView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, - SLOT(enableOrDisableRemoveMountSpecButton())); - connect(m_runConfiguration->remoteMounts(), - SIGNAL(rowsInserted(QModelIndex, int, int)), this, - SLOT(handleRemoteMountsChanged())); - connect(m_runConfiguration->remoteMounts(), - SIGNAL(rowsRemoved(QModelIndex, int, int)), this, - SLOT(handleRemoteMountsChanged())); - connect(m_runConfiguration->remoteMounts(), - SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, - SLOT(handleRemoteMountsChanged())); - connect(m_runConfiguration->remoteMounts(), SIGNAL(modelReset()), this, - SLOT(handleRemoteMountsChanged())); - enableOrDisableRemoveMountSpecButton(); - handleRemoteMountsChanged(); -} - -void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout) -{ - QWidget *baseEnvironmentWidget = new QWidget; - QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget); - baseEnvironmentLayout->setMargin(0); - QLabel *label = new QLabel(tr("Base environment for this run configuration:"), this); - baseEnvironmentLayout->addWidget(label); - m_baseEnvironmentComboBox = new QComboBox(this); - m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment") - << tr("System Environment")); - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); - baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox); - - m_fetchEnv = new QPushButton(FetchEnvButtonText); - baseEnvironmentLayout->addWidget(m_fetchEnv); - baseEnvironmentLayout->addStretch(10); - - m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget); - m_environmentWidget->setBaseEnvironment(m_deviceEnvReader->deviceEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); - m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges()); - mainLayout->addWidget(m_environmentWidget); - - connect(m_environmentWidget, SIGNAL(userChangesChanged()), this, - SLOT(userChangesEdited())); - connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(baseEnvironmentSelected(int))); - connect(m_runConfiguration, SIGNAL(baseEnvironmentChanged()), - this, SLOT(baseEnvironmentChanged())); - connect(m_runConfiguration, SIGNAL(systemEnvironmentChanged()), - this, SLOT(systemEnvironmentChanged())); - connect(m_runConfiguration, - SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)), - this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>))); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); - connect(m_deviceEnvReader, SIGNAL(error(QString)), this, - SLOT(fetchEnvironmentError(QString))); -} - -void MaemoRunConfigurationWidget::argumentsEdited(const QString &text) -{ - m_runConfiguration->setArguments(text); -} - -void MaemoRunConfigurationWidget::updateTargetInformation() -{ - m_localExecutableLabel - ->setText(QDir::toNativeSeparators(m_runConfiguration->localExecutableFilePath())); -} - -void MaemoRunConfigurationWidget::handleActiveDeployConfigurationChanged() -{ - if (m_deployablesConnected) - return; - connect(m_runConfiguration->deployConfig()->deployables().data(), - SIGNAL(modelReset()), SLOT(handleDeploySpecsChanged())); - handleDeploySpecsChanged(); - m_deployablesConnected = true; - disconnect(m_runConfiguration->target(), - SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)), - this, - SLOT(handleActiveDeployConfigurationChanged())); - -} - -void MaemoRunConfigurationWidget::handleDeploySpecsChanged() -{ - m_remoteExecutableLabel->setText(m_runConfiguration->remoteExecutableFilePath()); - m_runConfiguration->updateFactoryState(); -} - -void MaemoRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link) -{ - if (link == QLatin1String("deviceconfig")) { - MaemoDeviceConfigurationsSettingsPage *page - = MaemoManager::instance().deviceConfigurationsSettingsPage(); - Core::ICore::instance()->showOptionsDialog(page->category(), page->id()); - } else if (link == QLatin1String("debugger")) { - Core::ICore::instance()->showOptionsDialog(QLatin1String("O.Debugger"), - QLatin1String("M.Gdb")); - } -} - -void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged() -{ - m_devConfLabel->setText(MaemoGlobal::deviceConfigurationName(m_runConfiguration->deviceConfig())); - updateMountWarning(); -} - -void MaemoRunConfigurationWidget::enableOrDisableRemoveMountSpecButton() -{ - const QModelIndexList selectedRows - = m_mountView->selectionModel()->selectedRows(); - m_removeMountButton->setEnabled(!selectedRows.isEmpty()); -} - -void MaemoRunConfigurationWidget::addMount() -{ - const QString localDir = QFileDialog::getExistingDirectory(this, - tr("Choose directory to mount")); - if (!localDir.isEmpty()) { - MaemoRemoteMountsModel * const mountsModel - = m_runConfiguration->remoteMounts(); - mountsModel->addMountSpecification(localDir); - m_mountView->edit(mountsModel->index(mountsModel->mountSpecificationCount() - 1, - mountsModel->RemoteMountPointRow)); - } -} - -void MaemoRunConfigurationWidget::removeMount() -{ - const QModelIndexList selectedRows - = m_mountView->selectionModel()->selectedRows(); - if (!selectedRows.isEmpty()) { - m_runConfiguration->remoteMounts() - ->removeMountSpecificationAt(selectedRows.first().row()); - } -} - -void MaemoRunConfigurationWidget::changeLocalMountDir(const QModelIndex &index) -{ - if (index.column() == MaemoRemoteMountsModel::LocalDirRow) { - MaemoRemoteMountsModel * const mountsModel - = m_runConfiguration->remoteMounts(); - const QString oldDir - = mountsModel->mountSpecificationAt(index.row()).localDir; - const QString localDir = QFileDialog::getExistingDirectory(this, - tr("Choose directory to mount"), oldDir); - if (!localDir.isEmpty()) - mountsModel->setLocalDir(index.row(), localDir); - } -} - -void MaemoRunConfigurationWidget::handleDebuggingTypeChanged(bool useGdb) -{ - m_runConfiguration->setUseRemoteGdb(useGdb); - const QString detailsText = useGdb ? - tr("<b>Debugging details:</b> Use GDB") : - tr("<b>Debugging details:</b> Use GDB server"); - m_debugDetailsContainer->setSummaryText(detailsText); -} - -void MaemoRunConfigurationWidget::fetchEnvironment() -{ - disconnect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); - m_fetchEnv->setText(tr("Cancel Fetch Operation")); - m_deviceEnvReader->start(); -} - -void MaemoRunConfigurationWidget::stopFetchEnvironment() -{ - m_deviceEnvReader->stop(); - fetchEnvironmentFinished(); -} - -void MaemoRunConfigurationWidget::fetchEnvironmentFinished() -{ - disconnect(m_fetchEnv, SIGNAL(clicked()), this, - SLOT(stopFetchEnvironment())); - connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); - m_fetchEnv->setText(FetchEnvButtonText); - m_runConfiguration->setSystemEnvironment(m_deviceEnvReader->deviceEnvironment()); -} - -void MaemoRunConfigurationWidget::fetchEnvironmentError(const QString &error) -{ - QMessageBox::warning(this, tr("Device error"), - tr("Fetching environment failed: %1").arg(error)); -} - -void MaemoRunConfigurationWidget::userChangesEdited() -{ - m_ignoreChange = true; - m_runConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges()); - m_ignoreChange = false; -} - -void MaemoRunConfigurationWidget::baseEnvironmentSelected(int index) -{ - m_ignoreChange = true; - m_runConfiguration->setBaseEnvironmentBase(MaemoRunConfiguration::BaseEnvironmentBase(index)); - - m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); - m_ignoreChange = false; -} - -void MaemoRunConfigurationWidget::baseEnvironmentChanged() -{ - if (m_ignoreChange) - return; - - m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); - m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment()); - m_environmentWidget->setBaseEnvironmentText(m_runConfiguration->baseEnvironmentText()); -} - -void MaemoRunConfigurationWidget::systemEnvironmentChanged() -{ - m_environmentWidget->setBaseEnvironment(m_runConfiguration->systemEnvironment()); -} - -void MaemoRunConfigurationWidget::userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges) -{ - if (m_ignoreChange) - return; - m_environmentWidget->setUserChanges(userChanges); -} - -void MaemoRunConfigurationWidget::handleRemoteMountsChanged() -{ - const int mountCount - = m_runConfiguration->remoteMounts()->validMountSpecificationCount(); - QString text; - switch (mountCount) { - case 0: - text = tr("No local directories to be mounted on the device."); - break; - case 1: - text = tr("One local directory to be mounted on the device."); - break; - default: - //: Note: Only mountCount>1 will occur here as 0, 1 are handled above. - text = tr("%n local directories to be mounted on the device.", 0, mountCount); - break; - } - m_mountDetailsContainer->setSummaryText(QLatin1String("<b>") + text - + QLatin1String("</b>")); - updateMountWarning(); -} - -void MaemoRunConfigurationWidget::handleDebuggingTypeChanged() -{ - m_runConfiguration->setUseCppDebugger(m_debugCppOnlyButton->isChecked() - || m_debugCppAndQmlButton->isChecked()); - m_runConfiguration->setUseQmlDebugger(m_debugQmlOnlyButton->isChecked() - || m_debugCppAndQmlButton->isChecked()); - updateMountWarning(); -} - -void MaemoRunConfigurationWidget::updateMountWarning() -{ - QString mountWarning; - const MaemoPortList &portList = m_runConfiguration->freePorts(); - const int availablePortCount = portList.count(); - const int mountDirCount - = m_runConfiguration->remoteMounts()->validMountSpecificationCount(); - if (mountDirCount > availablePortCount) { - mountWarning = tr("WARNING: You want to mount %1 directories, but " - "your device has only %n free ports.<br>You will not be able " - "to run this configuration.", 0, availablePortCount) - .arg(mountDirCount); - } else if (mountDirCount > 0) { - const int portsLeftByDebuggers = availablePortCount - - m_runConfiguration->portsUsedByDebuggers(); - if (mountDirCount > portsLeftByDebuggers) { - mountWarning = tr("WARNING: You want to mount %1 directories, " - "but only %n ports on the device will be available " - "in debug mode. <br>You will not be able to debug your " - "application with this configuration.", 0, portsLeftByDebuggers) - .arg(mountDirCount); - } - } - if (mountWarning.isEmpty()) { - m_mountWarningLabel->hide(); - } else { - m_mountWarningLabel->setText(QLatin1String("<font color=\"red\">") - + mountWarning + QLatin1String("</font>")); - m_mountWarningLabel->show(); - m_mountDetailsContainer->setState(Utils::DetailsWidget::Expanded); - } - m_runConfiguration->updateFactoryState(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h deleted file mode 100644 index 4c4fc5fe96..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMORUNCONFIGURATIONWIDGET_H -#define MAEMORUNCONFIGURATIONWIDGET_H - -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE -class QComboBox; -class QLabel; -class QLineEdit; -class QModelIndex; -class QPushButton; -class QRadioButton; -class QTableView; -class QToolButton; -class QVBoxLayout; -QT_END_NAMESPACE - -namespace Utils { -class EnvironmentItem; -} - -namespace ProjectExplorer { -class EnvironmentWidget; -} - -namespace Utils { class DetailsWidget; } - -namespace Qt4ProjectManager { -class Qt4BuildConfiguration; - -namespace Internal { -class MaemoDeviceEnvReader; -class MaemoRunConfiguration; - -class MaemoRunConfigurationWidget : public QWidget -{ - Q_OBJECT -public: - explicit MaemoRunConfigurationWidget(MaemoRunConfiguration *runConfiguration, - QWidget *parent = 0); - -private slots: - void runConfigurationEnabledChange(bool enabled); - void argumentsEdited(const QString &args); - void showDeviceConfigurationsDialog(const QString &link); - void updateTargetInformation(); - void handleCurrentDeviceConfigChanged(); - void addMount(); - void removeMount(); - void changeLocalMountDir(const QModelIndex &index); - void enableOrDisableRemoveMountSpecButton(); - void handleDebuggingTypeChanged(bool useGdb); - void fetchEnvironment(); - void fetchEnvironmentFinished(); - void fetchEnvironmentError(const QString &error); - void stopFetchEnvironment(); - void userChangesEdited(); - void baseEnvironmentSelected(int index); - void baseEnvironmentChanged(); - void systemEnvironmentChanged(); - void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges); - void handleRemoteMountsChanged(); - void handleDebuggingTypeChanged(); - void handleDeploySpecsChanged(); - void handleActiveDeployConfigurationChanged(); - -private: - void addGenericWidgets(QVBoxLayout *mainLayout); - void addDebuggingWidgets(QVBoxLayout *mainLayout); - void addMountWidgets(QVBoxLayout *mainLayout); - void addEnvironmentWidgets(QVBoxLayout *mainLayout); - void updateMountWarning(); - - QLineEdit *m_argsLineEdit; - QLabel *m_localExecutableLabel; - QLabel *m_remoteExecutableLabel; - QLabel *m_devConfLabel; - QLabel *m_debuggingLanguagesLabel; - QRadioButton *m_debugCppOnlyButton; - QRadioButton *m_debugQmlOnlyButton; - QRadioButton *m_debugCppAndQmlButton; - QLabel *m_mountWarningLabel; - QTableView *m_mountView; - QToolButton *m_removeMountButton; - Utils::DetailsWidget *m_mountDetailsContainer; - Utils::DetailsWidget *m_debugDetailsContainer; - MaemoRunConfiguration *m_runConfiguration; - - bool m_ignoreChange; - QPushButton *m_fetchEnv; - QComboBox *m_baseEnvironmentComboBox; - MaemoDeviceEnvReader *m_deviceEnvReader; - ProjectExplorer::EnvironmentWidget *m_environmentWidget; - bool m_deployablesConnected; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMORUNCONFIGURATIONWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp deleted file mode 100644 index 7a0a0bd35b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemoruncontrol.h" - -#include "maemoglobal.h" -#include "maemorunconfiguration.h" -#include "maemosshrunner.h" - -#include <projectexplorer/projectexplorerconstants.h> -#include <utils/qtcassert.h> - -#include <QtGui/QMessageBox> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { - -using ProjectExplorer::RunConfiguration; - -MaemoRunControl::MaemoRunControl(RunConfiguration *rc) - : RunControl(rc, ProjectExplorer::Constants::RUNMODE) - , m_runner(new MaemoSshRunner(this, qobject_cast<MaemoRunConfiguration *>(rc), false)) - , m_running(false) -{ -} - -MaemoRunControl::~MaemoRunControl() -{ - stop(); -} - -void MaemoRunControl::start() -{ - m_running = true; - emit started(); - disconnect(m_runner, 0, this, 0); - connect(m_runner, SIGNAL(error(QString)), SLOT(handleSshError(QString))); - connect(m_runner, SIGNAL(readyForExecution()), SLOT(startExecution())); - connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), - SLOT(handleRemoteErrorOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteOutput(QByteArray)), - SLOT(handleRemoteOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteProcessStarted()), - SLOT(handleRemoteProcessStarted())); - connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), - SLOT(handleRemoteProcessFinished(qint64))); - connect(m_runner, SIGNAL(reportProgress(QString)), - SLOT(handleProgressReport(QString))); - connect(m_runner, SIGNAL(mountDebugOutput(QString)), - SLOT(handleMountDebugOutput(QString))); - m_runner->start(); -} - -RunControl::StopResult MaemoRunControl::stop() -{ - m_runner->stop(); - return StoppedSynchronously; -} - -void MaemoRunControl::handleSshError(const QString &error) -{ - handleError(error); - setFinished(); -} - -void MaemoRunControl::startExecution() -{ - appendMessage(tr("Starting remote process ...\n"), Utils::NormalMessageFormat); - m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4") - .arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(), - m_runner->connection()->connectionParameters().userName, - m_runner->remoteExecutable())) - .arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges())) - .arg(m_runner->remoteExecutable()) - .arg(m_runner->arguments()).toUtf8()); -} - -void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode) -{ - if (exitCode != MaemoSshRunner::InvalidExitCode) { - appendMessage(tr("Finished running remote process. Exit code was %1.\n") - .arg(exitCode), Utils::NormalMessageFormat); - } - setFinished(); -} - -void MaemoRunControl::handleRemoteOutput(const QByteArray &output) -{ - appendMessage(QString::fromUtf8(output), Utils::StdOutFormatSameLine); -} - -void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output) -{ - appendMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine); -} - -void MaemoRunControl::handleProgressReport(const QString &progressString) -{ - appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat); -} - -void MaemoRunControl::handleMountDebugOutput(const QString &output) -{ - appendMessage(output, Utils::StdErrFormatSameLine); -} - -bool MaemoRunControl::isRunning() const -{ - return m_running; -} - -QIcon MaemoRunControl::icon() const -{ - return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL); -} - -void MaemoRunControl::handleError(const QString &errString) -{ - stop(); - appendMessage(errString, Utils::ErrorMessageFormat); - QMessageBox::critical(0, tr("Remote Execution Failure"), errString); -} - -void MaemoRunControl::setFinished() -{ - disconnect(m_runner, 0, this, 0); - m_running = false; - emit finished(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h deleted file mode 100644 index 5bf14dc7c6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMORUNCONTROL_H -#define MAEMORUNCONTROL_H - -#include <projectexplorer/runconfiguration.h> - -#include <QtCore/QString> - -namespace Qt4ProjectManager { -namespace Internal { - -class MaemoRunConfiguration; -class MaemoSshRunner; - -class MaemoRunControl : public ProjectExplorer::RunControl -{ - Q_OBJECT -public: - explicit MaemoRunControl(ProjectExplorer::RunConfiguration *runConfig); - virtual ~MaemoRunControl(); - - virtual void start(); - virtual StopResult stop(); - virtual bool isRunning() const; - virtual QIcon icon() const; - -private slots: - void startExecution(); - void handleSshError(const QString &error); - void handleRemoteProcessStarted() {} - void handleRemoteProcessFinished(qint64 exitCode); - void handleRemoteOutput(const QByteArray &output); - void handleRemoteErrorOutput(const QByteArray &output); - void handleProgressReport(const QString &progressString); - void handleMountDebugOutput(const QString &output); - -private: - void setFinished(); - void handleError(const QString &errString); - - MaemoSshRunner * const m_runner; - bool m_running; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMORUNCONTROL_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp deleted file mode 100644 index 8bb017a76e..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemorunfactories.h" - -#include "maemoconstants.h" -#include "maemodebugsupport.h" -#include "maemoanalyzersupport.h" -#include "maemoglobal.h" -#include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" -#include "maemoruncontrol.h" -#include "maemotoolchain.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/projectexplorerconstants.h> -#include <debugger/debuggerconstants.h> -#include <qt4projectmanager/qt4project.h> -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <analyzerbase/analyzerconstants.h> - -namespace Qt4ProjectManager { -namespace Internal { - -using namespace ProjectExplorer; - -namespace { - -QString pathFromId(const QString &id) -{ - if (!id.startsWith(MAEMO_RC_ID_PREFIX)) - return QString(); - return id.mid(QString(MAEMO_RC_ID_PREFIX).size()); -} - -} // namespace - -MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject *parent) - : IRunConfigurationFactory(parent) -{ -} - -MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory() -{ -} - -bool MaemoRunConfigurationFactory::canCreate(Target *parent, - const QString &id) const -{ - if (!MaemoGlobal::hasLinuxQt(parent)) - return false; - return qobject_cast<Qt4BaseTarget *>(parent)->qt4Project() - ->hasApplicationProFile(pathFromId(id)); -} - -bool MaemoRunConfigurationFactory::canRestore(Target *parent, - const QVariantMap &map) const -{ - if (!MaemoGlobal::hasLinuxQt(parent)) - return false; - return ProjectExplorer::idFromMap(map) - .startsWith(QLatin1String(MAEMO_RC_ID)); -} - -bool MaemoRunConfigurationFactory::canClone(Target *parent, - RunConfiguration *source) const -{ - return canCreate(parent, source->id()); -} - -QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const -{ - if (Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent)) { - if (t && MaemoGlobal::hasLinuxQt(t)) { - return t->qt4Project()-> - applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX)); - } - } - return QStringList(); -} - -QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const -{ - return QFileInfo(pathFromId(id)).completeBaseName() - + QLatin1String(" (remote)"); -} - -RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, - const QString &id) -{ - if (!canCreate(parent, id)) - return 0; - return new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), - pathFromId(id)); -} - -RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent, - const QVariantMap &map) -{ - if (!canRestore(parent, map)) - return 0; - MaemoRunConfiguration *rc - = new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), QString()); - if (rc->fromMap(map)) - return rc; - - delete rc; - return 0; -} - -RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent, - RunConfiguration *source) -{ - if (!canClone(parent, source)) - return 0; - - MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source); - return new MaemoRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old); -} - -// #pragma mark -- MaemoRunControlFactory - -MaemoRunControlFactory::MaemoRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ -} - -MaemoRunControlFactory::~MaemoRunControlFactory() -{ -} - -bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, - const QString &mode) const -{ - const MaemoRunConfiguration * const maemoRunConfig - = qobject_cast<MaemoRunConfiguration *>(runConfiguration); - if (!maemoRunConfig - || !maemoRunConfig->deviceConfig() - || !maemoRunConfig->activeQt4BuildConfiguration() - || maemoRunConfig->remoteExecutableFilePath().isEmpty()) - return false; - const int freePortCount = maemoRunConfig->freePorts().count(); - - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(maemoRunConfig->target()); - const bool remoteMountsAllowed - = maemoTarget && maemoTarget->allowsRemoteMounts(); - if (remoteMountsAllowed && freePortCount == 0) - return false; - const int mountDirCount - = remoteMountsAllowed - ? maemoRunConfig->remoteMounts()->validMountSpecificationCount() - : 0; - if (mode == Debugger::Constants::DEBUGMODE) - return freePortCount >= mountDirCount + maemoRunConfig->portsUsedByDebuggers(); - if (mode == ProjectExplorer::Constants::RUNMODE - || Analyzer::Constants::MODE_ANALYZE) - return freePortCount >= mountDirCount; - return false; -} - -RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, - const QString &mode) -{ - Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE - || mode == Debugger::Constants::DEBUGMODE - || mode == Analyzer::Constants::MODE_ANALYZE); - Q_ASSERT(canRun(runConfig, mode)); - MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig); - Q_ASSERT(rc); - if (mode == ProjectExplorer::Constants::RUNMODE) - return new MaemoRunControl(rc); - if (mode == Analyzer::Constants::MODE_ANALYZE) - return MaemoAnalyzerSupport::createAnalyzerRunControl(rc); - return MaemoDebugSupport::createDebugRunControl(rc); -} - -QString MaemoRunControlFactory::displayName() const -{ - return tr("Run on device"); -} - -RunConfigWidget *MaemoRunControlFactory::createConfigurationWidget(RunConfiguration *config) -{ - Q_UNUSED(config) - return 0; -} - - } // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h deleted file mode 100644 index fc67b85ffe..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.h +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMORUNFACTORIES_H -#define MAEMORUNFACTORIES_H - -#include <projectexplorer/runconfiguration.h> - -namespace ProjectExplorer { - class RunConfiguration; - class RunControl; - class Target; -} -using ProjectExplorer::IRunConfigurationFactory; -using ProjectExplorer::IRunControlFactory; -using ProjectExplorer::RunConfiguration; -using ProjectExplorer::RunConfigWidget; -using ProjectExplorer::RunControl; -using ProjectExplorer::Target; - -namespace Qt4ProjectManager { - namespace Internal { - -class MaemoRunConfigurationFactory : public IRunConfigurationFactory -{ - Q_OBJECT - -public: - explicit MaemoRunConfigurationFactory(QObject *parent = 0); - ~MaemoRunConfigurationFactory(); - - QString displayNameForId(const QString &id) const; - QStringList availableCreationIds(Target *parent) const; - - bool canCreate(Target *parent, const QString &id) const; - RunConfiguration *create(Target *parent, const QString &id); - - bool canRestore(Target *parent, const QVariantMap &map) const; - RunConfiguration *restore(Target *parent, const QVariantMap &map); - - bool canClone(Target *parent, RunConfiguration *source) const; - RunConfiguration *clone(Target *parent, RunConfiguration *source); -}; - -class MaemoRunControlFactory : public IRunControlFactory -{ - Q_OBJECT -public: - explicit MaemoRunControlFactory(QObject *parent = 0); - ~MaemoRunControlFactory(); - - QString displayName() const; - RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); - - bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; - RunControl *create(RunConfiguration *runConfiguration, const QString &mode); -}; - - } // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMORUNFACTORIES_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.cpp deleted file mode 100644 index 0b68a0da3f..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemosettingspages.h" - -#include "maemoconstants.h" -#include "maemodeviceconfigurationssettingswidget.h" -#include "maemoqemusettings.h" -#include "maemoqemusettingswidget.h" - -#include <coreplugin/icore.h> - -#include <QtCore/QCoreApplication> -#include <QtGui/QDialog> -#include <QtGui/QDialogButtonBox> -#include <QtGui/QFrame> -#include <QtGui/QLabel> -#include <QtGui/QVBoxLayout> -#include <QtGui/QIcon> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeviceConfigurationsSettingsPage::MaemoDeviceConfigurationsSettingsPage(QObject *parent) - : Core::IOptionsPage(parent) -{ -} - -MaemoDeviceConfigurationsSettingsPage::~MaemoDeviceConfigurationsSettingsPage() -{ -} - -QString MaemoDeviceConfigurationsSettingsPage::id() const -{ - return QLatin1String("ZZ.Maemo Device Configurations"); -} - -QString MaemoDeviceConfigurationsSettingsPage::displayName() const -{ - return tr("Maemo Device Configurations"); -} - -QString MaemoDeviceConfigurationsSettingsPage::category() const -{ - return QLatin1String(Constants::MAEMO_SETTINGS_CATEGORY); -} - -QString MaemoDeviceConfigurationsSettingsPage::displayCategory() const -{ - return QCoreApplication::translate("Qt4ProjectManager", - Constants::MAEMO_SETTINGS_TR_CATEGORY); -} - -QIcon MaemoDeviceConfigurationsSettingsPage::categoryIcon() const -{ - return QIcon(QLatin1String(Constants::MAEMO_SETTINGS_CATEGORY_ICON)); -} - -bool MaemoDeviceConfigurationsSettingsPage::matches(const QString &searchKeyWord) const -{ - return m_keywords.contains(searchKeyWord, Qt::CaseInsensitive); -} - -QWidget *MaemoDeviceConfigurationsSettingsPage::createPage(QWidget *parent) -{ - m_widget = new MaemoDeviceConfigurationsSettingsWidget(parent); - if (m_keywords.isEmpty()) - m_keywords = m_widget->searchKeywords(); - return m_widget; -} - -void MaemoDeviceConfigurationsSettingsPage::apply() -{ - m_widget->saveSettings(); -} - -void MaemoDeviceConfigurationsSettingsPage::finish() -{ -} - - -MaemoQemuSettingsPage::MaemoQemuSettingsPage(QObject *parent) - : Core::IOptionsPage(parent) -{ -} - -MaemoQemuSettingsPage::~MaemoQemuSettingsPage() -{ -} - -QString MaemoQemuSettingsPage::id() const -{ - return QLatin1String("ZZ.Qemu Settings"); -} - -QString MaemoQemuSettingsPage::displayName() const -{ - return tr("Qemu Settings"); -} - -QString MaemoQemuSettingsPage::category() const -{ - return QLatin1String(Constants::MAEMO_SETTINGS_CATEGORY); -} - -QString MaemoQemuSettingsPage::displayCategory() const -{ - return QCoreApplication::translate("Qt4ProjectManager", - Constants::MAEMO_SETTINGS_TR_CATEGORY); -} - -QIcon MaemoQemuSettingsPage::categoryIcon() const -{ - return QIcon(QLatin1String(Constants::MAEMO_SETTINGS_CATEGORY_ICON)); -} - -bool MaemoQemuSettingsPage::matches(const QString &searchKeyWord) const -{ - return m_widget->keywords().contains(searchKeyWord, Qt::CaseInsensitive); -} - -QWidget *MaemoQemuSettingsPage::createPage(QWidget *parent) -{ - m_widget = new MaemoQemuSettingsWidget(parent); - return m_widget; -} - -void MaemoQemuSettingsPage::apply() -{ - m_widget->saveSettings(); -} - -void MaemoQemuSettingsPage::finish() -{ -} - - -class MaemoQemuCrashDialog : public QDialog -{ - Q_OBJECT -public: - MaemoQemuCrashDialog(MaemoQemuSettingsPage *settingsPage) - : m_settingsPage(settingsPage) - { - setWindowTitle(tr("Qemu error")); - QString message = tr("Qemu crashed.") + QLatin1String(" <p>"); - const MaemoQemuSettings::OpenGlMode openGlMode - = MaemoQemuSettings::openGlMode(); - const QString linkString = QLatin1String("</p><a href=\"dummy\">") - + tr("Click here to change the OpenGL mode.") - + QLatin1String("</a>"); - if (openGlMode == MaemoQemuSettings::HardwareAcceleration) { - message += tr("You have configured Qemu to use OpenGL " - "hardware acceleration, which might not be supported by " - "your system. You could try using software rendering instead."); - message += linkString; - } else if (openGlMode == MaemoQemuSettings::AutoDetect) { - message += tr("Qemu is currently configured to auto-detect the " - "OpenGL mode, which is known to not work in some cases. " - "You might want to use software rendering instead."); - message += linkString; - } - QLabel * const messageLabel = new QLabel(message, this); - messageLabel->setWordWrap(true); - messageLabel->setTextFormat(Qt::RichText); - connect(messageLabel, SIGNAL(linkActivated(QString)), - SLOT(showSettingsPage())); - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->addWidget(messageLabel); - QFrame * const separator = new QFrame; - separator->setFrameShape(QFrame::HLine); - separator->setFrameShadow(QFrame::Sunken); - mainLayout->addWidget(separator); - QDialogButtonBox * const buttonBox = new QDialogButtonBox; - buttonBox->addButton(QDialogButtonBox::Ok); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - mainLayout->addWidget(buttonBox); - } - -private: - Q_SLOT void showSettingsPage() - { - Core::ICore::instance()->showOptionsDialog(m_settingsPage->category(), - m_settingsPage->id()); - accept(); - } - - MaemoQemuSettingsPage * const m_settingsPage; -}; - - -void MaemoQemuSettingsPage::showQemuCrashDialog() -{ - MaemoQemuCrashDialog dlg(this); - dlg.exec(); -} - -} // namespace Internal -} // namespace Qt4ProjectManager - -#include "maemosettingspages.moc" diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.h b/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.h deleted file mode 100644 index db37141332..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosettingspages.h +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOSETTINGSPAGES_H -#define MAEMOSETTINGSPAGES_H - -#include <coreplugin/dialogs/ioptionspage.h> - -namespace Qt4ProjectManager{ -namespace Internal { - -class MaemoDeviceConfigurationsSettingsWidget; -class MaemoQemuSettingsWidget; - -class MaemoDeviceConfigurationsSettingsPage : public Core::IOptionsPage -{ - Q_OBJECT -public: - MaemoDeviceConfigurationsSettingsPage(QObject *parent); - ~MaemoDeviceConfigurationsSettingsPage(); - - virtual QString id() const; - virtual QString displayName() const; - virtual QString category() const; - virtual QString displayCategory() const; - virtual QIcon categoryIcon() const; - virtual bool matches(const QString &searchKeyWord) const; - virtual QWidget *createPage(QWidget *parent); - virtual void apply(); - virtual void finish(); - -private: - QString m_keywords; - MaemoDeviceConfigurationsSettingsWidget *m_widget; -}; - -class MaemoQemuSettingsPage : public Core::IOptionsPage -{ - Q_OBJECT -public: - MaemoQemuSettingsPage(QObject *parent); - ~MaemoQemuSettingsPage(); - - virtual QString id() const; - virtual QString displayName() const; - virtual QString category() const; - virtual QString displayCategory() const; - virtual QIcon categoryIcon() const; - virtual bool matches(const QString &searchKeyWord) const; - virtual QWidget *createPage(QWidget *parent); - virtual void apply(); - virtual void finish(); - - void showQemuCrashDialog(); - -private: - QString m_keywords; - MaemoQemuSettingsWidget *m_widget; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOSETTINGSPAGES_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.cpp deleted file mode 100644 index 6eda014e58..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemosshconfigdialog.h" - -#include "maemodeviceconfigurations.h" - -#include <utils/ssh/sshkeygenerator.h> -#include <utils/fileutils.h> - -#include <QtCore/QDir> -#include <QtGui/QApplication> -#include <QtGui/QDesktopServices> -#include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> -#include <QtNetwork/QHostInfo> - -using namespace Utils; -using namespace Qt4ProjectManager::Internal; - -MaemoSshConfigDialog::MaemoSshConfigDialog(QWidget *parent) - : QDialog(parent) - , home(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)) - , m_keyGenerator(new SshKeyGenerator) -{ - m_ui.setupUi(this); - - connect(m_ui.rsa, SIGNAL(toggled(bool)), this, SLOT(slotToggled())); - connect(m_ui.dsa, SIGNAL(toggled(bool)), this, SLOT(slotToggled())); - - connect(m_ui.generateButton, SIGNAL(clicked()), this, SLOT(generateSshKey())); - connect(m_ui.savePublicKey, SIGNAL(clicked()), this, SLOT(savePublicKey())); - connect(m_ui.savePrivateKey, SIGNAL(clicked()), this, SLOT(savePrivateKey())); -} - -MaemoSshConfigDialog::~MaemoSshConfigDialog() -{ -} - -void MaemoSshConfigDialog::slotToggled() -{ - m_ui.comboBox->setCurrentIndex(0); - m_ui.comboBox->setEnabled(m_ui.rsa->isChecked()); -} - -void MaemoSshConfigDialog::generateSshKey() -{ - const SshKeyGenerator::KeyType keyType = m_ui.rsa->isChecked() - ? SshKeyGenerator::Rsa - : SshKeyGenerator::Dsa; - - QByteArray userId = QString(home.mid(home.lastIndexOf(QLatin1Char('/')) + 1) - + QLatin1Char('@') + QHostInfo::localHostName()).toUtf8(); - - QApplication::setOverrideCursor(Qt::BusyCursor); - - if (m_keyGenerator->generateKeys(keyType, SshKeyGenerator::OpenSsl, - m_ui.comboBox->currentText().toUShort())) { - m_ui.plainTextEdit->setPlainText(m_keyGenerator->publicKey()); - m_ui.savePublicKey->setEnabled(true); - m_ui.savePrivateKey->setEnabled(true); - } else { - m_ui.plainTextEdit->setPlainText(m_keyGenerator->error()); - } - - QApplication::restoreOverrideCursor(); -} - -void MaemoSshConfigDialog::savePublicKey() -{ - saveKey(true); -} - -void MaemoSshConfigDialog::savePrivateKey() -{ - saveKey(false); -} - -void MaemoSshConfigDialog::checkSshDir() -{ - QDir dir(home + QString::fromLatin1("/.ssh")); - if (!dir.exists()) - dir.mkpath(home + QString::fromLatin1("/.ssh")); -} - -void MaemoSshConfigDialog::saveKey(bool publicKey) -{ - checkSshDir(); - const QString suggestedTypeSuffix = - m_keyGenerator->type() == SshKeyGenerator::Rsa ? "rsa" : "dsa"; - const QString suggestedName = home + QString::fromLatin1("/.ssh/id_%1%2") - .arg(suggestedTypeSuffix).arg(publicKey ? ".pub" : ""); - const QString dlgTitle - = publicKey ? tr("Save Public Key File") : tr("Save Private Key File"); - const QString fileName - = QFileDialog::getSaveFileName(this, dlgTitle, suggestedName); - if (fileName.isEmpty()) - return; - - Utils::FileSaver saver(fileName); - saver.write(publicKey - ? m_keyGenerator->publicKey() - : m_keyGenerator->privateKey()); - if (saver.finalize(this) && !publicKey) - emit privateKeyGenerated(fileName); - if (!publicKey) - QFile::setPermissions(fileName, QFile::ReadOwner | QFile::WriteOwner); -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.h b/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.h deleted file mode 100644 index 47e67c6613..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOSSHCONFIGDIALOG_H -#define MAEMOSSHCONFIGDIALOG_H - -#include "ui_maemosshconfigdialog.h" - -#include <QtCore/QScopedPointer> -#include <QtGui/QDialog> - -namespace Utils { - class SshKeyGenerator; -} - -namespace Qt4ProjectManager { - namespace Internal { - -class MaemoSshConfigDialog : public QDialog -{ - Q_OBJECT -public: - MaemoSshConfigDialog(QWidget *parent = 0); - ~MaemoSshConfigDialog(); - -signals: - void privateKeyGenerated(const QString &path); - -private slots: - void slotToggled(); - void generateSshKey(); - void savePublicKey(); - void savePrivateKey(); - -private: - void checkSshDir(); - void saveKey(bool publicKey); - -private: - QString home; - QScopedPointer<Utils::SshKeyGenerator> m_keyGenerator; - Ui::MaemoSshConfigDialog m_ui; -}; - - } // Qt4ProjectManager -} // Internal - -#endif // MAEMOSSHCONFIGDIALOG_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.ui deleted file mode 100644 index d3acf09585..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshconfigdialog.ui +++ /dev/null @@ -1,271 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoSshConfigDialog</class> - <widget class="QDialog" name="MaemoSshConfigDialog"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>500</width> - <height>275</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>500</width> - <height>275</height> - </size> - </property> - <property name="windowTitle"> - <string>SSH Key Configuration</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Options</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="keySize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Key &size:</string> - </property> - <property name="buddy"> - <cstring>comboBox</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="comboBox"> - <item> - <property name="text"> - <string notr="true">1024</string> - </property> - </item> - <item> - <property name="text"> - <string notr="true">2048</string> - </property> - </item> - <item> - <property name="text"> - <string notr="true">4096</string> - </property> - </item> - </widget> - </item> - <item row="0" column="2"> - <spacer name="horizontalSpacer_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>328</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="keyAlgo"> - <property name="text"> - <string>Key algorithm:</string> - </property> - </widget> - </item> - <item row="1" column="1" colspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QRadioButton" name="rsa"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>&RSA</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="dsa"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>&DSA</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <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="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Key</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QPlainTextEdit" name="plainTextEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string notr="true"/> - </property> - <property name="undoRedoEnabled"> - <bool>false</bool> - </property> - <property name="plainText"> - <string/> - </property> - <property name="textInteractionFlags"> - <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="generateButton"> - <property name="text"> - <string>&Generate SSH Key</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> - <item> - <widget class="QPushButton" name="savePublicKey"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Save P&ublic Key...</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="savePrivateKey"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Save Pr&ivate Key...</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <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> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="text"> - <string>&Close</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <tabstops> - <tabstop>closeButton</tabstop> - </tabstops> - <resources/> - <connections> - <connection> - <sender>closeButton</sender> - <signal>clicked()</signal> - <receiver>MaemoSshConfigDialog</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel"> - <x>351</x> - <y>96</y> - </hint> - <hint type="destinationlabel"> - <x>381</x> - <y>107</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp deleted file mode 100644 index 750890c487..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemosshrunner.h" - -#include "maemoglobal.h" -#include "maemoqemumanager.h" -#include "maemoremotemounter.h" -#include "maemoremotemountsmodel.h" -#include "maemorunconfiguration.h" -#include "maemousedportsgatherer.h" - -#include <utils/ssh/sshconnection.h> -#include <utils/ssh/sshconnectionmanager.h> -#include <utils/ssh/sshremoteprocess.h> - -#include <QtCore/QFileInfo> - -#include <limits> - -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoSshRunner::MaemoSshRunner(QObject *parent, - MaemoRunConfiguration *runConfig, bool debugging) - : QObject(parent), - m_mounter(new MaemoRemoteMounter(this)), - m_portsGatherer(new MaemoUsedPortsGatherer(this)), - m_devConfig(runConfig->deviceConfig()), - m_remoteExecutable(runConfig->remoteExecutableFilePath()), - m_appArguments(runConfig->arguments()), - m_userEnvChanges(runConfig->userEnvironmentChanges()), - m_initialFreePorts(runConfig->freePorts()), - m_mountSpecs(runConfig->remoteMounts()->mountSpecs()), - m_state(Inactive) -{ - m_mounter->setBuildConfiguration(runConfig->activeQt4BuildConfiguration()); - if (debugging && runConfig->useRemoteGdb()) { - m_mountSpecs << MaemoMountSpecification(runConfig->localDirToMountForRemoteGdb(), - runConfig->remoteProjectSourcesMountPoint()); - } - - m_procsToKill << QFileInfo(m_remoteExecutable).fileName(); - connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted())); - connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted())); - connect(m_mounter, SIGNAL(error(QString)), this, - SLOT(handleMounterError(QString))); - connect(m_mounter, SIGNAL(reportProgress(QString)), this, - SIGNAL(reportProgress(QString))); - connect(m_mounter, SIGNAL(debugOutput(QString)), this, - SIGNAL(mountDebugOutput(QString))); - connect(m_portsGatherer, SIGNAL(error(QString)), this, - SLOT(handlePortsGathererError(QString))); - connect(m_portsGatherer, SIGNAL(portListReady()), this, - SLOT(handleUsedPortsAvailable())); -} - -MaemoSshRunner::~MaemoSshRunner() {} - -void MaemoSshRunner::start() -{ - ASSERT_STATE(QList<State>() << Inactive << StopRequested); - - if (m_remoteExecutable.isEmpty()) { - emitError(tr("Cannot run: No remote executable set."), true); - return; - } - if (!m_devConfig) { - emitError(tr("Cannot run: No device configuration set."), true); - return; - } - - if (m_devConfig->type() == MaemoDeviceConfig::Emulator - && !MaemoQemuManager::instance().qemuIsRunning()) { - MaemoQemuManager::instance().startRuntime(); - emitError(tr("Cannot run: Qemu was not running. " - "It has now been started up for you, but it will take " - "a bit of time until it is ready."), true); - return; - } - - m_connection = SshConnectionManager::instance().acquireConnection(m_devConfig->sshParameters()); - setState(Connecting); - m_exitStatus = -1; - m_freePorts = m_initialFreePorts; - connect(m_connection.data(), SIGNAL(connected()), this, - SLOT(handleConnected())); - connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this, - SLOT(handleConnectionFailure())); - if (isConnectionUsable()) { - handleConnected(); - } else { - emit reportProgress(tr("Connecting to device...")); - m_connection->connectToHost(); - } -} - -void MaemoSshRunner::stop() -{ - if (m_state == PostRunCleaning || m_state == StopRequested - || m_state == Inactive) - return; - if (m_state == Connecting) { - setState(Inactive); - emit remoteProcessFinished(InvalidExitCode); - return; - } - - setState(StopRequested); - cleanup(); -} - -void MaemoSshRunner::handleConnected() -{ - ASSERT_STATE(QList<State>() << Connecting << StopRequested); - if (m_state == StopRequested) { - setState(Inactive); - } else { - setState(PreRunCleaning); - cleanup(); - } -} - -void MaemoSshRunner::handleConnectionFailure() -{ - if (m_state == Inactive) - qWarning("Unexpected state %d in %s.", m_state, Q_FUNC_INFO); - - const QString errorMsg = m_state == Connecting - ? MaemoGlobal::failedToConnectToServerMessage(m_connection, m_devConfig) - : tr("Connection error: %1").arg(m_connection->errorString()); - emitError(errorMsg); -} - -void MaemoSshRunner::cleanup() -{ - ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning - << StopRequested); - - emit reportProgress(tr("Killing remote process(es)...")); - - // pkill behaves differently on Fremantle and Harmattan. - const char *const killTemplate = "pkill -%2 '^%1$'; pkill -%2 '/%1$';"; - QString niceKill; - QString brutalKill; - foreach (const QString &proc, m_procsToKill) { - niceKill += QString::fromLocal8Bit(killTemplate).arg(proc).arg("SIGTERM"); - brutalKill += QString::fromLocal8Bit(killTemplate).arg(proc).arg("SIGKILL"); - } - QString remoteCall = niceKill + QLatin1String("sleep 1; ") + brutalKill; - remoteCall.remove(remoteCall.count() - 1, 1); // Get rid of trailing semicolon. - - m_cleaner = m_connection->createRemoteProcess(remoteCall.toUtf8()); - connect(m_cleaner.data(), SIGNAL(closed(int)), this, - SLOT(handleCleanupFinished(int))); - m_cleaner->start(); -} - -void MaemoSshRunner::handleCleanupFinished(int exitStatus) -{ - Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart - || exitStatus == SshRemoteProcess::KilledBySignal - || exitStatus == SshRemoteProcess::ExitedNormally); - - ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning - << StopRequested << Inactive); - - if (m_state == Inactive) - return; - if (m_state == StopRequested || m_state == PostRunCleaning) { - unmount(); - return; - } - - if (exitStatus != SshRemoteProcess::ExitedNormally) { - emitError(tr("Initial cleanup failed: %1") - .arg(m_cleaner->errorString())); - } else { - m_mounter->setConnection(m_connection, m_devConfig); - unmount(); - } -} - -void MaemoSshRunner::handleUnmounted() -{ - ASSERT_STATE(QList<State>() << PreRunCleaning << PreMountUnmounting - << PostRunCleaning << StopRequested); - - switch (m_state) { - case PreRunCleaning: { - for (int i = 0; i < m_mountSpecs.count(); ++i) - m_mounter->addMountSpecification(m_mountSpecs.at(i), false); - setState(PreMountUnmounting); - unmount(); - break; - } - case PreMountUnmounting: - setState(GatheringPorts); - m_portsGatherer->start(m_connection, m_devConfig); - break; - case PostRunCleaning: - case StopRequested: { - m_mounter->resetMountSpecifications(); - const bool stopRequested = m_state == StopRequested; - setState(Inactive); - if (stopRequested) { - emit remoteProcessFinished(InvalidExitCode); - } else if (m_exitStatus == SshRemoteProcess::ExitedNormally) { - emit remoteProcessFinished(m_runner->exitCode()); - } else { - emit error(tr("Error running remote process: %1") - .arg(m_runner->errorString())); - } - break; - } - default: ; - } -} - -void MaemoSshRunner::handleMounted() -{ - ASSERT_STATE(QList<State>() << Mounting << StopRequested); - - if (m_state == Mounting) { - setState(ReadyForExecution); - emit readyForExecution(); - } -} - -void MaemoSshRunner::handleMounterError(const QString &errorMsg) -{ - ASSERT_STATE(QList<State>() << PreRunCleaning << PostRunCleaning - << PreMountUnmounting << Mounting << StopRequested << Inactive); - - emitError(errorMsg); -} - -void MaemoSshRunner::startExecution(const QByteArray &remoteCall) -{ - ASSERT_STATE(ReadyForExecution); - - m_runner = m_connection->createRemoteProcess(remoteCall); - connect(m_runner.data(), SIGNAL(started()), this, - SIGNAL(remoteProcessStarted())); - connect(m_runner.data(), SIGNAL(closed(int)), this, - SLOT(handleRemoteProcessFinished(int))); - connect(m_runner.data(), SIGNAL(outputAvailable(QByteArray)), this, - SIGNAL(remoteOutput(QByteArray))); - connect(m_runner.data(), SIGNAL(errorOutputAvailable(QByteArray)), this, - SIGNAL(remoteErrorOutput(QByteArray))); - setState(ProcessStarting); - m_runner->start(); -} - -void MaemoSshRunner::handleRemoteProcessFinished(int exitStatus) -{ - Q_ASSERT(exitStatus == SshRemoteProcess::FailedToStart - || exitStatus == SshRemoteProcess::KilledBySignal - || exitStatus == SshRemoteProcess::ExitedNormally); - ASSERT_STATE(QList<State>() << ProcessStarting << StopRequested << Inactive); - - m_exitStatus = exitStatus; - if (m_state != StopRequested && m_state != Inactive) { - setState(PostRunCleaning); - cleanup(); - } -} - -bool MaemoSshRunner::isConnectionUsable() const -{ - return m_connection && m_connection->state() == SshConnection::Connected - && m_connection->connectionParameters() == m_devConfig->sshParameters(); -} - -void MaemoSshRunner::setState(State newState) -{ - if (newState == Inactive) { - m_mounter->setConnection(SshConnection::Ptr(), m_devConfig); - m_portsGatherer->stop(); - if (m_connection) { - disconnect(m_connection.data(), 0, this, 0); - SshConnectionManager::instance().releaseConnection(m_connection); - m_connection = SshConnection::Ptr(); - } - if (m_cleaner) - disconnect(m_cleaner.data(), 0, this, 0); - } - m_state = newState; -} - -void MaemoSshRunner::emitError(const QString &errorMsg, bool force) -{ - if (m_state != Inactive) { - setState(Inactive); - emit error(errorMsg); - } else if (force) { - emit error(errorMsg); - } -} - -void MaemoSshRunner::mount() -{ - setState(Mounting); - if (m_mounter->hasValidMountSpecifications()) { - emit reportProgress(tr("Mounting host directories...")); - m_mounter->mount(freePorts(), m_portsGatherer); - } else { - handleMounted(); - } -} - -void MaemoSshRunner::unmount() -{ - ASSERT_STATE(QList<State>() << PreRunCleaning << PreMountUnmounting - << PostRunCleaning << StopRequested); - if (m_mounter->hasValidMountSpecifications()) { - QString message; - switch (m_state) { - case PreRunCleaning: - message = tr("Unmounting left-over host directory mounts..."); - break; - case PreMountUnmounting: - message = tr("Potentially unmounting left-over host directory mounts..."); - case StopRequested: case PostRunCleaning: - message = tr("Unmounting host directories..."); - break; - default: - break; - } - emit reportProgress(message); - m_mounter->unmount(); - } else { - handleUnmounted(); - } -} - -void MaemoSshRunner::handlePortsGathererError(const QString &errorMsg) -{ - emitError(errorMsg); -} - -void MaemoSshRunner::handleUsedPortsAvailable() -{ - ASSERT_STATE(QList<State>() << GatheringPorts << StopRequested); - - if (m_state == StopRequested) { - setState(Inactive); - } else { - mount(); - } -} - -const qint64 MaemoSshRunner::InvalidExitCode - = std::numeric_limits<qint64>::min(); - -} // namespace Internal -} // namespace Qt4ProjectManager - diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h deleted file mode 100644 index a4f52a75f5..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOSSHRUNNER_H -#define MAEMOSSHRUNNER_H - -#include "maemodeviceconfigurations.h" -#include "maemomountspecification.h" - -#include <utils/environment.h> - -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QStringList> - -namespace Utils { - class SshConnection; - class SshRemoteProcess; -} - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoRemoteMounter; -class MaemoRunConfiguration; -class MaemoUsedPortsGatherer; - -class MaemoSshRunner : public QObject -{ - Q_OBJECT -public: - MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig, - bool debugging); - ~MaemoSshRunner(); - - void start(); - void stop(); - - void startExecution(const QByteArray &remoteCall); - - QSharedPointer<Utils::SshConnection> connection() const { return m_connection; } - const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; } - MaemoPortList *freePorts() { return &m_freePorts; } - QString remoteExecutable() const { return m_remoteExecutable; } - QString arguments() const { return m_appArguments; } - QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; } - const QSharedPointer<const MaemoDeviceConfig> devConfig() const { return m_devConfig; } - - static const qint64 InvalidExitCode; - -signals: - void error(const QString &error); - void mountDebugOutput(const QString &output); - void readyForExecution(); - void remoteOutput(const QByteArray &output); - void remoteErrorOutput(const QByteArray &output); - void reportProgress(const QString &progressOutput); - void remoteProcessStarted(); - void remoteProcessFinished(qint64 exitCode); - -private slots: - void handleConnected(); - void handleConnectionFailure(); - void handleCleanupFinished(int exitStatus); - void handleRemoteProcessFinished(int exitStatus); - void handleMounted(); - void handleUnmounted(); - void handleMounterError(const QString &errorMsg); - void handlePortsGathererError(const QString &errorMsg); - void handleUsedPortsAvailable(); - -private: - enum State { Inactive, Connecting, PreRunCleaning, PostRunCleaning, - PreMountUnmounting, Mounting, ReadyForExecution, - ProcessStarting, StopRequested, GatheringPorts - }; - - void setState(State newState); - void emitError(const QString &errorMsg, bool force = false); - - void cleanup(); - bool isConnectionUsable() const; - void mount(); - void unmount(); - - MaemoRemoteMounter * const m_mounter; - MaemoUsedPortsGatherer * const m_portsGatherer; - const QSharedPointer<const MaemoDeviceConfig> m_devConfig; - const QString m_remoteExecutable; - const QString m_appArguments; - const QList<Utils::EnvironmentItem> m_userEnvChanges; - const MaemoPortList m_initialFreePorts; - QList<MaemoMountSpecification> m_mountSpecs; - - QSharedPointer<Utils::SshConnection> m_connection; - QSharedPointer<Utils::SshRemoteProcess> m_runner; - QSharedPointer<Utils::SshRemoteProcess> m_cleaner; - QStringList m_procsToKill; - MaemoPortList m_freePorts; - - int m_exitStatus; - State m_state; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOSSHRUNNER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.cpp deleted file mode 100644 index 114fcabf06..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemotoolchain.h" - -#include "maemoglobal.h" -#include "maemomanager.h" -#include "maemoqtversion.h" -#include "qt4projectmanagerconstants.h" - -#include <projectexplorer/gccparser.h> -#include <projectexplorer/headerpath.h> -#include <projectexplorer/toolchainmanager.h> -#include <utils/environment.h> -#include <qtsupport/qtversionmanager.h> - -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtGui/QLabel> -#include <QtGui/QVBoxLayout> - -namespace Qt4ProjectManager { -namespace Internal { - -static const char *const MAEMO_QT_VERSION_KEY = "Qt4ProjectManager.Maemo.QtVersion"; - -// -------------------------------------------------------------------------- -// MaemoToolChain -// -------------------------------------------------------------------------- - -MaemoToolChain::MaemoToolChain(bool autodetected) : - ProjectExplorer::GccToolChain(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID), autodetected), - m_qtVersionId(-1) -{ - updateId(); -} - -MaemoToolChain::MaemoToolChain(const MaemoToolChain &tc) : - ProjectExplorer::GccToolChain(tc), - m_qtVersionId(tc.m_qtVersionId) -{ } - -MaemoToolChain::~MaemoToolChain() -{ } - -QString MaemoToolChain::typeName() const -{ - return MaemoToolChainFactory::tr("Maemo GCC"); -} - -ProjectExplorer::Abi MaemoToolChain::targetAbi() const -{ - return m_targetAbi; -} - -QString MaemoToolChain::mkspec() const -{ - return QString(); // always use default -} - -bool MaemoToolChain::isValid() const -{ - return GccToolChain::isValid() && m_qtVersionId >= 0 && m_targetAbi.isValid(); -} - -bool MaemoToolChain::canClone() const -{ - return false; -} - -void MaemoToolChain::addToEnvironment(Utils::Environment &env) const -{ - QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(m_qtVersionId); - if (!v) - return; - const QString maddeRoot = MaemoGlobal::maddeRoot(v->qmakeCommand()); - - // put this into environment to make pkg-config stuff work - env.prependOrSet(QLatin1String("SYSROOT_DIR"), QDir::toNativeSeparators(sysroot())); - env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madbin") - .arg(maddeRoot))); - env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madlib") - .arg(maddeRoot))); - env.prependOrSet(QLatin1String("PERL5LIB"), - QDir::toNativeSeparators(QString("%1/madlib/perl5").arg(maddeRoot))); - - env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin").arg(maddeRoot))); - env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin") - .arg(MaemoGlobal::targetRoot(v->qmakeCommand())))); - - const QString manglePathsKey = QLatin1String("GCCWRAPPER_PATHMANGLE"); - if (!env.hasKey(manglePathsKey)) { - const QStringList pathsToMangle = QStringList() << QLatin1String("/lib") - << QLatin1String("/opt") << QLatin1String("/usr"); - env.set(manglePathsKey, QString()); - foreach (const QString &path, pathsToMangle) - env.appendOrSet(manglePathsKey, path, QLatin1String(":")); - } -} - -QString MaemoToolChain::sysroot() const -{ - QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(m_qtVersionId); - if (!v) - return QString(); - - if (m_sysroot.isEmpty()) { - QFile file(QDir::cleanPath(MaemoGlobal::targetRoot(v->qmakeCommand())) + QLatin1String("/information")); - if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream stream(&file); - while (!stream.atEnd()) { - const QString &line = stream.readLine().trimmed(); - const QStringList &list = line.split(QLatin1Char(' ')); - if (list.count() > 1 && list.at(0) == QLatin1String("sysroot")) - m_sysroot = MaemoGlobal::maddeRoot(v->qmakeCommand()) + QLatin1String("/sysroots/") + list.at(1); - } - } - } - return m_sysroot; -} - -bool MaemoToolChain::operator ==(const ProjectExplorer::ToolChain &tc) const -{ - if (!ToolChain::operator ==(tc)) - return false; - - const MaemoToolChain *tcPtr = static_cast<const MaemoToolChain *>(&tc); - return m_qtVersionId == tcPtr->m_qtVersionId; -} - -ProjectExplorer::ToolChainConfigWidget *MaemoToolChain::configurationWidget() -{ - return new MaemoToolChainConfigWidget(this); -} - -QVariantMap MaemoToolChain::toMap() const -{ - QVariantMap result = GccToolChain::toMap(); - result.insert(QLatin1String(MAEMO_QT_VERSION_KEY), m_qtVersionId); - return result; -} - -bool MaemoToolChain::fromMap(const QVariantMap &data) -{ - if (!GccToolChain::fromMap(data)) - return false; - - m_qtVersionId = data.value(QLatin1String(MAEMO_QT_VERSION_KEY), -1).toInt(); - - return isValid(); -} - -void MaemoToolChain::setQtVersionId(int id) -{ - if (id < 0) { - m_targetAbi = ProjectExplorer::Abi(); - m_qtVersionId = -1; - updateId(); // Will trigger toolChainUpdated()! - return; - } - - MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(QtSupport::QtVersionManager::instance()->version(id)); - Q_ASSERT(version); - ProjectExplorer::Abi::OSFlavor flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor; - if (version->osVersion() == MaemoDeviceConfig::Maemo5) - flavour = ProjectExplorer::Abi::MaemoLinuxFlavor; - else if (version->osVersion() == MaemoDeviceConfig::Maemo6) - flavour = ProjectExplorer::Abi::HarmattanLinuxFlavor; - else if (version->osVersion() == MaemoDeviceConfig::Meego) - flavour = ProjectExplorer::Abi::MeegoLinuxFlavor; - else - return; - - m_qtVersionId = id; - - Q_ASSERT(version->qtAbis().count() == 1); - m_targetAbi = version->qtAbis().at(0); - - updateId(); // Will trigger toolChainUpdated()! - setDisplayName(MaemoToolChainFactory::tr("Maemo GCC for %1").arg(version->displayName())); -} - -int MaemoToolChain::qtVersionId() const -{ - return m_qtVersionId; -} - -void MaemoToolChain::updateId() -{ - setId(QString::fromLatin1("%1:%2.%3").arg(Constants::MAEMO_TOOLCHAIN_ID) - .arg(m_qtVersionId).arg(debuggerCommand())); -} - -// -------------------------------------------------------------------------- -// MaemoToolChainConfigWidget -// -------------------------------------------------------------------------- - -MaemoToolChainConfigWidget::MaemoToolChainConfigWidget(MaemoToolChain *tc) : - ProjectExplorer::ToolChainConfigWidget(tc) -{ - QVBoxLayout *layout = new QVBoxLayout(this); - QLabel *label = new QLabel; - QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(tc->qtVersionId()); - Q_ASSERT(v); - label->setText(tr("<html><head/><body><table>" - "<tr><td>Path to MADDE:</td><td>%1</td></tr>" - "<tr><td>Path to MADDE target:</td><td>%2</td></tr>" - "<tr><td>Debugger:</td/><td>%3</td></tr></body></html>") - .arg(QDir::toNativeSeparators(MaemoGlobal::maddeRoot(v->qmakeCommand())), - QDir::toNativeSeparators(MaemoGlobal::targetRoot(v->qmakeCommand())), - QDir::toNativeSeparators(tc->debuggerCommand()))); - layout->addWidget(label); -} - -void MaemoToolChainConfigWidget::apply() -{ - // nothing to do! -} - -void MaemoToolChainConfigWidget::discard() -{ - // nothing to do! -} - -bool MaemoToolChainConfigWidget::isDirty() const -{ - return false; -} - -// -------------------------------------------------------------------------- -// MaemoToolChainFactory -// -------------------------------------------------------------------------- - -MaemoToolChainFactory::MaemoToolChainFactory() : - ProjectExplorer::ToolChainFactory() -{ } - -QString MaemoToolChainFactory::displayName() const -{ - return tr("Maemo GCC"); -} - -QString MaemoToolChainFactory::id() const -{ - return QLatin1String(Constants::MAEMO_TOOLCHAIN_ID); -} - -QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::autoDetect() -{ - QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); - connect(vm, SIGNAL(qtVersionsChanged(QList<int>)), - this, SLOT(handleQtVersionChanges(QList<int>))); - - QList<int> versionList; - foreach (QtSupport::BaseQtVersion *v, vm->versions()) - versionList.append(v->uniqueId()); - - return createToolChainList(versionList); -} - -void MaemoToolChainFactory::handleQtVersionChanges(const QList<int> &changes) -{ - ProjectExplorer::ToolChainManager *tcm = ProjectExplorer::ToolChainManager::instance(); - QList<ProjectExplorer::ToolChain *> tcList = createToolChainList(changes); - foreach (ProjectExplorer::ToolChain *tc, tcList) - tcm->registerToolChain(tc); -} - -QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(const QList<int> &changes) -{ - ProjectExplorer::ToolChainManager *tcm = ProjectExplorer::ToolChainManager::instance(); - QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); - QList<ProjectExplorer::ToolChain *> result; - - foreach (int i, changes) { - QtSupport::BaseQtVersion *v = vm->version(i); - if (!v || !v->isValid()) { - // remove tool chain: - QList<ProjectExplorer::ToolChain *> toRemove; - foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) { - if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID))) - continue; - MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc); - if (mTc->qtVersionId() == i) - toRemove.append(mTc); - } - foreach (ProjectExplorer::ToolChain *tc, toRemove) - tcm->deregisterToolChain(tc); - } else if (MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(v)) { - // add tool chain: - MaemoToolChain *mTc = new MaemoToolChain(true); - mTc->setQtVersionId(i); - QString target = "Maemo 5"; - if (v->supportsTargetId(Constants::HARMATTAN_DEVICE_TARGET_ID)) - target = "Maemo 6"; - else if (v->supportsTargetId(Constants::MEEGO_DEVICE_TARGET_ID)) - target = "Meego"; - mTc->setDisplayName(tr("%1 GCC (%2)").arg(target).arg(MaemoGlobal::maddeRoot(mqv->qmakeCommand()))); - mTc->setCompilerPath(MaemoGlobal::targetRoot(mqv->qmakeCommand()) + QLatin1String("/bin/gcc")); - mTc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(mqv->qtAbis().at(0))); - if (mTc->debuggerCommand().isEmpty()) - mTc->setDebuggerCommand(MaemoGlobal::targetRoot(mqv->qmakeCommand()) + QLatin1String("/bin/gdb")); - result.append(mTc); - } - } - return result; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h b/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h deleted file mode 100644 index 23c66cb69b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotoolchain.h +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOTOOLCHAIN_H -#define MAEMOTOOLCHAIN_H - -#include <projectexplorer/gcctoolchain.h> -#include <projectexplorer/toolchainconfigwidget.h> - -namespace Qt4ProjectManager { - -namespace Internal { - -// -------------------------------------------------------------------------- -// MaemoToolChain -// -------------------------------------------------------------------------- - -class MaemoToolChain : public ProjectExplorer::GccToolChain -{ -public: - ~MaemoToolChain(); - - QString typeName() const; - ProjectExplorer::Abi targetAbi() const; - QString mkspec() const; - - bool isValid() const; - bool canClone() const; - - void addToEnvironment(Utils::Environment &env) const; - QString sysroot() const; - - bool operator ==(const ProjectExplorer::ToolChain &) const; - - ProjectExplorer::ToolChainConfigWidget *configurationWidget(); - - - QVariantMap toMap() const; - bool fromMap(const QVariantMap &data); - - void setQtVersionId(int); - int qtVersionId() const; - -private: - void updateId(); - - explicit MaemoToolChain(bool); - MaemoToolChain(const MaemoToolChain &); - - int m_qtVersionId; - mutable QString m_sysroot; - ProjectExplorer::Abi m_targetAbi; - - friend class MaemoToolChainFactory; -}; - -// -------------------------------------------------------------------------- -// MaemoToolChainConfigWidget -// -------------------------------------------------------------------------- - -class MaemoToolChainConfigWidget : public ProjectExplorer::ToolChainConfigWidget -{ - Q_OBJECT - -public: - MaemoToolChainConfigWidget(MaemoToolChain *); - - void apply(); - void discard(); - bool isDirty() const; -}; - -// -------------------------------------------------------------------------- -// MaemoToolChainFactory -// -------------------------------------------------------------------------- - -class MaemoToolChainFactory : public ProjectExplorer::ToolChainFactory -{ - Q_OBJECT - -public: - MaemoToolChainFactory(); - - QString displayName() const; - QString id() const; - - QList<ProjectExplorer::ToolChain *> autoDetect(); - -private slots: - void handleQtVersionChanges(const QList<int> &); - QList<ProjectExplorer::ToolChain *> createToolChainList(const QList<int> &); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOTOOLCHAIN_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.cpp deleted file mode 100644 index 2ae24003be..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemouploadandinstalldeploystep.h" - -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemopackageinstaller.h" -#include "maemopackageuploader.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <qt4projectmanager/qt4buildconfiguration.h> - -#include <QtCore/QFileInfo> - -#define ASSERT_BASE_STATE(state) ASSERT_STATE_GENERIC(BaseState, state, baseState()) -#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(ExtendedState, state, m_extendedState) - -using namespace ProjectExplorer; -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -AbstractMaemoUploadAndInstallStep::AbstractMaemoUploadAndInstallStep(BuildStepList *parent, const QString &id) - : AbstractMaemoDeployStep(parent, id) -{ -} - -AbstractMaemoUploadAndInstallStep::AbstractMaemoUploadAndInstallStep(BuildStepList *parent, - AbstractMaemoUploadAndInstallStep *other) - : AbstractMaemoDeployStep(parent, other) -{ -} - -void AbstractMaemoUploadAndInstallStep::finishInitialization(const QString &displayName, - AbstractMaemoPackageInstaller *installer) -{ - setDefaultDisplayName(displayName); - m_installer = installer; - m_extendedState = Inactive; - - m_uploader = new MaemoPackageUploader(this); - connect(m_uploader, SIGNAL(progress(QString)), - SLOT(handleProgressReport(QString))); - connect(m_uploader, SIGNAL(uploadFinished(QString)), - SLOT(handleUploadFinished(QString))); - connect(m_installer, SIGNAL(stdoutData(QString)), - SLOT(handleRemoteStdout(QString))); - connect(m_installer, SIGNAL(stderrData(QString)), - SLOT(handleRemoteStderr(QString))); - connect(m_installer, SIGNAL(finished(QString)), - SLOT(handleInstallationFinished(QString))); -} - -bool AbstractMaemoUploadAndInstallStep::isDeploymentPossibleInternal(QString &whyNot) const -{ - if (!packagingStep()) { - whyNot = tr("No matching packaging step found."); - return false; - } - return true; -} - -bool AbstractMaemoUploadAndInstallStep::isDeploymentNeeded(const QString &hostName) const -{ - const AbstractMaemoPackageCreationStep * const pStep = packagingStep(); - Q_ASSERT(pStep); - const MaemoDeployable d(pStep->packageFilePath(), QString()); - return currentlyNeedsDeployment(hostName, d); -} - -void AbstractMaemoUploadAndInstallStep::startInternal() -{ - Q_ASSERT(m_extendedState == Inactive); - - upload(); -} - -void AbstractMaemoUploadAndInstallStep::stopInternal() -{ - ASSERT_BASE_STATE(StopRequested); - ASSERT_STATE(QList<ExtendedState>() << Uploading << Installing); - - switch (m_extendedState) { - case Uploading: - m_uploader->cancelUpload(); - break; - case Installing: - m_installer->cancelInstallation(); - break; - case Inactive: - break; - default: - qFatal("Missing switch case in %s.", Q_FUNC_INFO); - - } - setFinished(); -} - -void AbstractMaemoUploadAndInstallStep::upload() -{ - m_extendedState = Uploading; - const QString localFilePath = packagingStep()->packageFilePath(); - const QString fileName = QFileInfo(localFilePath).fileName(); - const QString remoteFilePath = uploadDir() + QLatin1Char('/') + fileName; - m_uploader->uploadPackage(connection(), localFilePath, remoteFilePath); -} - -void AbstractMaemoUploadAndInstallStep::handleUploadFinished(const QString &errorMsg) -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - ASSERT_STATE(QList<ExtendedState>() << Uploading << Inactive); - - if (m_extendedState == Inactive) - return; - - if (!errorMsg.isEmpty()) { - raiseError(errorMsg); - setFinished(); - } else { - writeOutput(tr("Successfully uploaded package file.")); - const QString remoteFilePath = uploadDir() + QLatin1Char('/') - + QFileInfo(packagingStep()->packageFilePath()).fileName(); - m_extendedState = Installing; - writeOutput(tr("Installing package to device...")); - m_installer->installPackage(connection(), helper().cachedDeviceConfig(), - remoteFilePath, true); - } -} - -void AbstractMaemoUploadAndInstallStep::handleInstallationFinished(const QString &errorMsg) -{ - ASSERT_BASE_STATE(QList<BaseState>() << Deploying << StopRequested); - ASSERT_STATE(QList<ExtendedState>() << Installing << Inactive); - - if (m_extendedState == Inactive) - return; - - if (errorMsg.isEmpty()) { - setDeployed(connection()->connectionParameters().host, - MaemoDeployable(packagingStep()->packageFilePath(), QString())); - writeOutput(tr("Package installed.")); - } else { - raiseError(errorMsg); - } - setFinished(); -} - -void AbstractMaemoUploadAndInstallStep::setFinished() -{ - m_extendedState = Inactive; - setDeploymentFinished(); -} - -QString AbstractMaemoUploadAndInstallStep::uploadDir() const -{ - return MaemoGlobal::homeDirOnDevice(connection()->connectionParameters().userName); -} - - -MaemoUploadAndInstallDpkgPackageStep::MaemoUploadAndInstallDpkgPackageStep(ProjectExplorer::BuildStepList *bc) - : AbstractMaemoUploadAndInstallStep(bc, Id) -{ - ctor(); -} - -MaemoUploadAndInstallDpkgPackageStep::MaemoUploadAndInstallDpkgPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallDpkgPackageStep *other) - : AbstractMaemoUploadAndInstallStep(bc, other) -{ - ctor(); -} - -void MaemoUploadAndInstallDpkgPackageStep::ctor() -{ - finishInitialization(DisplayName, new MaemoDebianPackageInstaller(this)); -} - - -const AbstractMaemoPackageCreationStep *MaemoUploadAndInstallDpkgPackageStep::packagingStep() const -{ - return MaemoGlobal::earlierBuildStep<MaemoDebianPackageCreationStep>(maemoDeployConfig(), this); -} - -const QString MaemoUploadAndInstallDpkgPackageStep::Id("MaemoUploadAndInstallDpkgPackageStep"); -const QString MaemoUploadAndInstallDpkgPackageStep::DisplayName - = tr("Deploy Debian package via SFTP upload"); - - -MaemoUploadAndInstallRpmPackageStep::MaemoUploadAndInstallRpmPackageStep(ProjectExplorer::BuildStepList *bc) - : AbstractMaemoUploadAndInstallStep(bc, Id) -{ - ctor(); -} - -MaemoUploadAndInstallRpmPackageStep::MaemoUploadAndInstallRpmPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallRpmPackageStep *other) - : AbstractMaemoUploadAndInstallStep(bc, other) -{ - ctor(); -} - -void MaemoUploadAndInstallRpmPackageStep::ctor() -{ - finishInitialization(DisplayName, new MaemoRpmPackageInstaller(this)); -} - -const AbstractMaemoPackageCreationStep *MaemoUploadAndInstallRpmPackageStep::packagingStep() const -{ - return MaemoGlobal::earlierBuildStep<MaemoRpmPackageCreationStep>(maemoDeployConfig(), this); -} - -const QString MaemoUploadAndInstallRpmPackageStep::Id("MaemoUploadAndInstallRpmPackageStep"); -const QString MaemoUploadAndInstallRpmPackageStep::DisplayName - = tr("Deploy RPM package via SFTP upload"); - - -MaemoUploadAndInstallTarPackageStep::MaemoUploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bc) - : AbstractMaemoUploadAndInstallStep(bc, Id) -{ - ctor(); -} - -MaemoUploadAndInstallTarPackageStep::MaemoUploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallTarPackageStep *other) - : AbstractMaemoUploadAndInstallStep(bc, other) -{ - ctor(); -} - -const AbstractMaemoPackageCreationStep *MaemoUploadAndInstallTarPackageStep::packagingStep() const -{ - return MaemoGlobal::earlierBuildStep<MaemoTarPackageCreationStep>(maemoDeployConfig(), this); -} - -void MaemoUploadAndInstallTarPackageStep::ctor() -{ - finishInitialization(DisplayName, new MaemoTarPackageInstaller(this)); -} - -const QString MaemoUploadAndInstallTarPackageStep::Id("MaemoUploadAndInstallTarPackageStep"); -const QString MaemoUploadAndInstallTarPackageStep::DisplayName - = tr("Deploy tar package via SFTP upload"); - - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.h b/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.h deleted file mode 100644 index 94da40c013..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemouploadandinstalldeploystep.h +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMODEPLOYSTEP_H -#define MAEMODEPLOYSTEP_H - -#include "abstractmaemodeploystep.h" - -namespace Qt4ProjectManager { -namespace Internal { -class AbstractMaemoPackageInstaller; -class MaemoPackageUploader; - -class AbstractMaemoUploadAndInstallStep : public AbstractMaemoDeployStep -{ - Q_OBJECT -protected: - AbstractMaemoUploadAndInstallStep(ProjectExplorer::BuildStepList *bc, - const QString &id); - AbstractMaemoUploadAndInstallStep(ProjectExplorer::BuildStepList *bc, - AbstractMaemoUploadAndInstallStep *other); - - void finishInitialization(const QString &displayName, - AbstractMaemoPackageInstaller *installer); - -private slots: - void handleUploadFinished(const QString &errorMsg); - void handleInstallationFinished(const QString &errorMsg); - -private: - enum ExtendedState { Inactive, Uploading, Installing }; - - virtual bool isDeploymentPossibleInternal(QString &whynot) const; - virtual bool isDeploymentNeeded(const QString &hostName) const; - virtual void startInternal(); - virtual void stopInternal(); - - void upload(); - void setFinished(); - QString uploadDir() const; - - MaemoPackageUploader *m_uploader; - AbstractMaemoPackageInstaller *m_installer; - ExtendedState m_extendedState; -}; - - -class MaemoUploadAndInstallDpkgPackageStep : public AbstractMaemoUploadAndInstallStep -{ - Q_OBJECT -public: - MaemoUploadAndInstallDpkgPackageStep(ProjectExplorer::BuildStepList *bc); - MaemoUploadAndInstallDpkgPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallDpkgPackageStep *other); - - static const QString Id; - static const QString DisplayName; - -private: - void ctor(); - - virtual const AbstractMaemoPackageCreationStep *packagingStep() const; -}; - -class MaemoUploadAndInstallRpmPackageStep : public AbstractMaemoUploadAndInstallStep -{ - Q_OBJECT -public: - MaemoUploadAndInstallRpmPackageStep(ProjectExplorer::BuildStepList *bc); - MaemoUploadAndInstallRpmPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallRpmPackageStep *other); - - static const QString Id; - static const QString DisplayName; - -private: - void ctor(); - - virtual const AbstractMaemoPackageCreationStep *packagingStep() const; -}; - -class MaemoUploadAndInstallTarPackageStep : public AbstractMaemoUploadAndInstallStep -{ - Q_OBJECT -public: - MaemoUploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bc); - MaemoUploadAndInstallTarPackageStep(ProjectExplorer::BuildStepList *bc, - MaemoUploadAndInstallTarPackageStep *other); - - static const QString Id; - static const QString DisplayName; - -private: - void ctor(); - - virtual const AbstractMaemoPackageCreationStep *packagingStep() const; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYSTEP_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp deleted file mode 100644 index c06a49e5bf..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "maemousedportsgatherer.h" - -#include "maemoglobal.h" - -#include <utils/ssh/sshremoteprocessrunner.h> - -using namespace Utils; - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoUsedPortsGatherer::MaemoUsedPortsGatherer(QObject *parent) : - QObject(parent), m_running(false) -{ -} - -MaemoUsedPortsGatherer::~MaemoUsedPortsGatherer() {} - -void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, - const MaemoDeviceConfig::ConstPtr &devConf) -{ - if (m_running) - qWarning("Unexpected call of %s in running state", Q_FUNC_INFO); - m_usedPorts.clear(); - m_remoteStdout.clear(); - m_remoteStderr.clear(); - m_procRunner = SshRemoteProcessRunner::create(connection); - connect(m_procRunner.data(), SIGNAL(connectionError(Utils::SshError)), - SLOT(handleConnectionError())); - connect(m_procRunner.data(), SIGNAL(processClosed(int)), - SLOT(handleProcessClosed(int))); - connect(m_procRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), - SLOT(handleRemoteStdOut(QByteArray))); - connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), - SLOT(handleRemoteStdErr(QByteArray))); - const QString command = MaemoGlobal::remoteSudo(devConf->osVersion(), - m_procRunner->connection()->connectionParameters().userName) - + QLatin1String(" lsof -nPi4tcp:") + devConf->freePorts().toString() - + QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq"); - m_procRunner->run(command.toUtf8()); - m_running = true; -} - -void MaemoUsedPortsGatherer::stop() -{ - if (!m_running) - return; - m_running = false; - disconnect(m_procRunner->connection().data(), 0, this, 0); - if (m_procRunner->process()) - m_procRunner->process()->closeChannel(); -} - -int MaemoUsedPortsGatherer::getNextFreePort(MaemoPortList *freePorts) const -{ - while (freePorts->hasMore()) { - const int port = freePorts->getNext(); - if (!m_usedPorts.contains(port)) - return port; - } - return -1; -} - -void MaemoUsedPortsGatherer::setupUsedPorts() -{ - const QList<QByteArray> &portStrings = m_remoteStdout.split('\n'); - foreach (const QByteArray &portString, portStrings) { - if (portString.isEmpty()) - continue; - bool ok; - const int port = portString.toInt(&ok); - if (ok) { - m_usedPorts << port; - } else { - qWarning("%s: Unexpected string '%s' is not a port.", - Q_FUNC_INFO, portString.data()); - } - } - emit portListReady(); -} - -void MaemoUsedPortsGatherer::handleConnectionError() -{ - if (!m_running) - return; - emit error(tr("Connection error: %1"). - arg(m_procRunner->connection()->errorString())); - stop(); -} - -void MaemoUsedPortsGatherer::handleProcessClosed(int exitStatus) -{ - if (!m_running) - return; - QString errMsg; - switch (exitStatus) { - case SshRemoteProcess::FailedToStart: - errMsg = tr("Could not start remote process: %1") - .arg(m_procRunner->process()->errorString()); - break; - case SshRemoteProcess::KilledBySignal: - errMsg = tr("Remote process crashed: %1") - .arg(m_procRunner->process()->errorString()); - break; - case SshRemoteProcess::ExitedNormally: - if (m_procRunner->process()->exitCode() == 0) { - setupUsedPorts(); - } else { - errMsg = tr("Remote process failed: %1") - .arg(m_procRunner->process()->errorString()); - } - break; - default: - Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid exit status"); - } - - if (!errMsg.isEmpty()) { - if (!m_remoteStderr.isEmpty()) { - errMsg += tr("\nRemote error output was: %1") - .arg(QString::fromUtf8(m_remoteStderr)); - } - emit error(errMsg); - } - stop(); -} - -void MaemoUsedPortsGatherer::handleRemoteStdOut(const QByteArray &output) -{ - m_remoteStdout += output; -} - -void MaemoUsedPortsGatherer::handleRemoteStdErr(const QByteArray &output) -{ - m_remoteStderr += output; -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.h b/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.h deleted file mode 100644 index dc1ad3101b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.h +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef MAEMOUSEDPORTSGATHERER_H -#define MAEMOUSEDPORTSGATHERER_H - -#include "maemodeviceconfigurations.h" - -#include <QtCore/QList> -#include <QtCore/QObject> -#include <QtCore/QSharedPointer> -#include <QtCore/QString> - -namespace Utils { -class SshConnection; -class SshRemoteProcessRunner; -} - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeviceConfig; - -class MaemoUsedPortsGatherer : public QObject -{ - Q_OBJECT -public: - explicit MaemoUsedPortsGatherer(QObject *parent = 0); - ~MaemoUsedPortsGatherer(); - void start(const QSharedPointer<Utils::SshConnection> &connection, - const QSharedPointer<const MaemoDeviceConfig> &devConf); - void stop(); - int getNextFreePort(MaemoPortList *freePorts) const; // returns -1 if no more are left - QList<int> usedPorts() const { return m_usedPorts; } - -signals: - void error(const QString &errMsg); - void portListReady(); - -private slots: - void handleConnectionError(); - void handleProcessClosed(int exitStatus); - void handleRemoteStdOut(const QByteArray &output); - void handleRemoteStdErr(const QByteArray &output); - -private: - void setupUsedPorts(); - - QSharedPointer<Utils::SshRemoteProcessRunner> m_procRunner; - QList<int> m_usedPorts; - QByteArray m_remoteStdout; - QByteArray m_remoteStderr; - bool m_running; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMOUSEDPORTSGATHERER_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri deleted file mode 100644 index 66a552bc87..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ /dev/null @@ -1,151 +0,0 @@ -HEADERS += \ - $$PWD/maemoconfigtestdialog.h \ - $$PWD/maemoconstants.h \ - $$PWD/maemodeviceconfigurations.h \ - $$PWD/maemomanager.h \ - $$PWD/maemorunconfiguration.h \ - $$PWD/maemorunconfigurationwidget.h \ - $$PWD/maemoruncontrol.h \ - $$PWD/maemorunfactories.h \ - $$PWD/maemosettingspages.h \ - $$PWD/maemodeviceconfigurationssettingswidget.h \ - $$PWD/maemosshconfigdialog.h \ - $$PWD/maemotoolchain.h \ - $$PWD/maemopackagecreationstep.h \ - $$PWD/maemopackagecreationfactory.h \ - $$PWD/maemopackagecreationwidget.h \ - $$PWD/maemodeployablelistmodel.h \ - $$PWD/maemoqemumanager.h \ - $$PWD/maemodeployables.h \ - $$PWD/maemodeployable.h \ - $$PWD/maemodeploystepwidget.h \ - $$PWD/maemodeploystepfactory.h \ - $$PWD/maemoglobal.h \ - $$PWD/maemosshrunner.h \ - $$PWD/maemodebugsupport.h \ - $$PWD/maemoanalyzersupport.h \ - $$PWD/maemoremotemountsmodel.h \ - $$PWD/maemodeviceenvreader.h \ - $$PWD/maemomountspecification.h \ - $$PWD/maemoremotemounter.h \ - $$PWD/maemoprofilesupdatedialog.h \ - $$PWD/maemousedportsgatherer.h \ - $$PWD/maemoremoteprocesslist.h \ - $$PWD/maemoremoteprocessesdialog.h \ - $$PWD/maemopublishingwizardfactories.h \ - $$PWD/maemopublishingbuildsettingspagefremantlefree.h \ - $$PWD/maemopublishingfileselectiondialog.h \ - $$PWD/maemopublishedprojectmodel.h \ - $$PWD/maemopublishinguploadsettingspagefremantlefree.h \ - $$PWD/maemopublishingwizardfremantlefree.h \ - $$PWD/maemopublishingresultpagefremantlefree.h \ - $$PWD/maemopublisherfremantlefree.h \ - $$PWD/maemoqemuruntime.h \ - $$PWD/maemoqemuruntimeparser.h \ - $$PWD/maemoqemusettingswidget.h \ - $$PWD/maemoqemusettings.h \ - $$PWD/qt4maemotargetfactory.h \ - $$PWD/qt4maemotarget.h \ - $$PWD/qt4maemodeployconfiguration.h \ - $$PWD/maemodeviceconfigwizard.h \ - $$PWD/maemokeydeployer.h \ - $$PWD/maemopertargetdeviceconfigurationlistmodel.h \ - $$PWD/maemodeployconfigurationwidget.h \ - $$PWD/maemoinstalltosysrootstep.h \ - $$PWD/maemodeploymentmounter.h \ - $$PWD/maemopackageuploader.h \ - $$PWD/maemopackageinstaller.h \ - $$PWD/maemoremotecopyfacility.h \ - $$PWD/abstractmaemodeploystep.h \ - $$PWD/maemodeploybymountstep.h \ - $$PWD/maemouploadandinstalldeploystep.h \ - $$PWD/maemodirectdeviceuploadstep.h \ - $$PWD/abstractlinuxdevicedeploystep.h \ - $$PWD/maemoqtversionfactory.h \ - $$PWD/maemoqtversion.h - -SOURCES += \ - $$PWD/maemoconfigtestdialog.cpp \ - $$PWD/maemodeviceconfigurations.cpp \ - $$PWD/maemomanager.cpp \ - $$PWD/maemorunconfiguration.cpp \ - $$PWD/maemorunconfigurationwidget.cpp \ - $$PWD/maemoruncontrol.cpp \ - $$PWD/maemorunfactories.cpp \ - $$PWD/maemosettingspages.cpp \ - $$PWD/maemodeviceconfigurationssettingswidget.cpp \ - $$PWD/maemosshconfigdialog.cpp \ - $$PWD/maemotoolchain.cpp \ - $$PWD/maemopackagecreationstep.cpp \ - $$PWD/maemopackagecreationfactory.cpp \ - $$PWD/maemopackagecreationwidget.cpp \ - $$PWD/maemodeployablelistmodel.cpp \ - $$PWD/maemoqemumanager.cpp \ - $$PWD/maemodeployables.cpp \ - $$PWD/maemodeploystepwidget.cpp \ - $$PWD/maemodeploystepfactory.cpp \ - $$PWD/maemoglobal.cpp \ - $$PWD/maemosshrunner.cpp \ - $$PWD/maemodebugsupport.cpp \ - $$PWD/maemoanalyzersupport.cpp \ - $$PWD/maemoremotemountsmodel.cpp \ - $$PWD/maemodeviceenvreader.cpp \ - $$PWD/maemomountspecification.cpp \ - $$PWD/maemoremotemounter.cpp \ - $$PWD/maemoprofilesupdatedialog.cpp \ - $$PWD/maemousedportsgatherer.cpp \ - $$PWD/maemoremoteprocesslist.cpp \ - $$PWD/maemoremoteprocessesdialog.cpp \ - $$PWD/maemopublishingwizardfactories.cpp \ - $$PWD/maemopublishingbuildsettingspagefremantlefree.cpp \ - $$PWD/maemopublishingfileselectiondialog.cpp \ - $$PWD/maemopublishedprojectmodel.cpp \ - $$PWD/maemopublishinguploadsettingspagefremantlefree.cpp \ - $$PWD/maemopublishingwizardfremantlefree.cpp \ - $$PWD/maemopublishingresultpagefremantlefree.cpp \ - $$PWD/maemopublisherfremantlefree.cpp \ - $$PWD/maemoqemuruntimeparser.cpp \ - $$PWD/maemoqemusettingswidget.cpp \ - $$PWD/maemoqemusettings.cpp \ - $$PWD/qt4maemotargetfactory.cpp \ - $$PWD/qt4maemotarget.cpp \ - $$PWD/qt4maemodeployconfiguration.cpp \ - $$PWD/maemodeviceconfigwizard.cpp \ - $$PWD/maemokeydeployer.cpp \ - $$PWD/maemopertargetdeviceconfigurationlistmodel.cpp \ - $$PWD/maemodeployconfigurationwidget.cpp \ - $$PWD/maemoinstalltosysrootstep.cpp \ - $$PWD/maemodeploymentmounter.cpp \ - $$PWD/maemopackageuploader.cpp \ - $$PWD/maemopackageinstaller.cpp \ - $$PWD/maemoremotecopyfacility.cpp \ - $$PWD/abstractmaemodeploystep.cpp \ - $$PWD/maemodeploybymountstep.cpp \ - $$PWD/maemouploadandinstalldeploystep.cpp \ - $$PWD/maemodirectdeviceuploadstep.cpp \ - $$PWD/abstractlinuxdevicedeploystep.cpp \ - $$PWD/maemoqtversionfactory.cpp \ - $$PWD/maemoqtversion.cpp - -FORMS += \ - $$PWD/maemoconfigtestdialog.ui \ - $$PWD/maemodeviceconfigurationssettingswidget.ui \ - $$PWD/maemosshconfigdialog.ui \ - $$PWD/maemopackagecreationwidget.ui \ - $$PWD/maemodeploystepwidget.ui \ - $$PWD/maemoprofilesupdatedialog.ui \ - $$PWD/maemoremoteprocessesdialog.ui \ - $$PWD/maemopublishingbuildsettingspagefremantlefree.ui \ - $$PWD/maemopublishingfileselectiondialog.ui \ - $$PWD/maemopublishinguploadsettingspagefremantlefree.ui \ - $$PWD/maemopublishingresultpagefremantlefree.ui \ - $$PWD/maemoqemusettingswidget.ui \ - $$PWD/maemodeviceconfigwizardstartpage.ui \ - $$PWD/maemodeviceconfigwizardpreviouskeysetupcheckpage.ui \ - $$PWD/maemodeviceconfigwizardreusekeyscheckpage.ui \ - $$PWD/maemodeviceconfigwizardkeycreationpage.ui \ - $$PWD/maemodeviceconfigwizardkeydeploymentpage.ui \ - $$PWD/maemodeployconfigurationwidget.ui \ - $$PWD/maemodeviceconfigwizardlogindatapage.ui - -RESOURCES += $$PWD/qt-maemo.qrc diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.qrc b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.qrc deleted file mode 100644 index 354fe64d1b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/qt-maemo"> - <file>images/qemu-run.png</file> - <file>images/qemu-stop.png</file> - </qresource> -</RCC> diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.cpp deleted file mode 100644 index d3da3916fe..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qt4maemodeployconfiguration.h" - -#include "maemodeploybymountstep.h" -#include "maemodeployconfigurationwidget.h" -#include "maemodeployables.h" -#include "maemoinstalltosysrootstep.h" -#include "maemopackagecreationstep.h" -#include "maemouploadandinstalldeploystep.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/projectexplorerconstants.h> - -#include <qt4projectmanager/qt4projectmanagerconstants.h> -#include <qt4projectmanager/qt4target.h> - -using namespace ProjectExplorer; - -namespace Qt4ProjectManager { -namespace Internal { -namespace { -const QString OldDeployConfigId = QLatin1String("2.2MaemoDeployConfig"); -} // namespace - -Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(Target *target, - const QString &id) : DeployConfiguration(target, id) -{ - // A MaemoDeployables object is only dependent on the active build - // configuration and therefore can (and should) be shared among all - // deploy steps. The per-target device configurations model is - // similarly only dependent on the target. - const QList<DeployConfiguration *> &deployConfigs - = this->target()->deployConfigurations(); - foreach (const DeployConfiguration * const dc, deployConfigs) { - const Qt4MaemoDeployConfiguration * const mdc - = qobject_cast<const Qt4MaemoDeployConfiguration *>(dc); - if (mdc) { - m_deployables = mdc->deployables(); - m_devConfModel = mdc->m_devConfModel; - break; - } - } - if (!m_deployables) { - m_deployables = QSharedPointer<MaemoDeployables>(new MaemoDeployables(qobject_cast<Qt4BaseTarget *>(target))); - m_devConfModel = QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> - (new MaemoPerTargetDeviceConfigurationListModel(0, target)); - } -} - -Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, - DeployConfiguration *source) : DeployConfiguration(target, source) -{ - m_deployables = qobject_cast<Qt4MaemoDeployConfiguration *>(source)->deployables(); -} - -Qt4MaemoDeployConfiguration::~Qt4MaemoDeployConfiguration() {} - -DeployConfigurationWidget *Qt4MaemoDeployConfiguration::configurationWidget() const -{ - return new MaemoDeployConfigurationWidget; -} - -const QString Qt4MaemoDeployConfiguration::FremantleWithPackagingId - = QLatin1String("DeployToFremantleWithPackaging"); -const QString Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId - = QLatin1String("DeployToFremantleWithoutPackaging"); -const QString Qt4MaemoDeployConfiguration::HarmattanId - = QLatin1String("DeployToHarmattan"); -const QString Qt4MaemoDeployConfiguration::MeegoId - = QLatin1String("DeployToMeego"); -const QString Qt4MaemoDeployConfiguration::GenericLinuxId - = QLatin1String("DeployToGenericLinux"); - - -Qt4MaemoDeployConfigurationFactory::Qt4MaemoDeployConfigurationFactory(QObject *parent) - : DeployConfigurationFactory(parent) -{ } - -QStringList Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *parent) const -{ - QStringList ids; - if (qobject_cast<Qt4Maemo5Target *>(parent)) { - ids << Qt4MaemoDeployConfiguration::FremantleWithPackagingId - << Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId; - } else if (qobject_cast<Qt4HarmattanTarget *>(parent)) { - ids << Qt4MaemoDeployConfiguration::HarmattanId; - } else if (qobject_cast<Qt4MeegoTarget *>(parent)) { - ids << Qt4MaemoDeployConfiguration::MeegoId; - } else if (MaemoGlobal::hasLinuxQt(parent)) { - ids << Qt4MaemoDeployConfiguration::GenericLinuxId; - } - - return ids; -} - -QString Qt4MaemoDeployConfigurationFactory::displayNameForId(const QString &id) const -{ - if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId) - return tr("Copy files to Maemo5 device"); - else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId) - return tr("Build Debian package and install to Maemo5 device"); - else if (id == Qt4MaemoDeployConfiguration::HarmattanId) - return tr("Build Debian package and install to Harmattan device"); - else if (id == Qt4MaemoDeployConfiguration::MeegoId) - return tr("Build RPM package and install to Meego device"); - else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId) - return tr("Build tarball and install to Linux host"); - return QString(); -} - -bool Qt4MaemoDeployConfigurationFactory::canCreate(Target *parent, - const QString &id) const -{ - return availableCreationIds(parent).contains(id); -} - -DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent, - const QString &id) -{ - Q_ASSERT(canCreate(parent, id)); - - DeployConfiguration * const dc - = new Qt4MaemoDeployConfiguration(parent, id); - dc->setDefaultDisplayName(displayNameForId(id)); - - if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId) { - dc->stepList()->insertStep(0, new MaemoMakeInstallToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(1, new MaemoMountAndCopyDeployStep(dc->stepList())); - } else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId) { - dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList())); - dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(2, new MaemoMountAndInstallDeployStep(dc->stepList())); - } else if (id == Qt4MaemoDeployConfiguration::HarmattanId) { - dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList())); - dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(2, new MaemoUploadAndInstallDpkgPackageStep(dc->stepList())); - } else if (id == Qt4MaemoDeployConfiguration::MeegoId) { - dc->stepList()->insertStep(0, new MaemoRpmPackageCreationStep(dc->stepList())); - dc->stepList()->insertStep(1, new MaemoInstallRpmPackageToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(2, new MaemoUploadAndInstallRpmPackageStep(dc->stepList())); - } else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId) { - dc->stepList()->insertStep(0, new MaemoTarPackageCreationStep(dc->stepList())); - dc->stepList()->insertStep(1, new MaemoUploadAndInstallTarPackageStep(dc->stepList())); - } - return dc; -} - -bool Qt4MaemoDeployConfigurationFactory::canRestore(Target *parent, - const QVariantMap &map) const -{ - return canCreate(parent, idFromMap(map)) - || (idFromMap(map) == OldDeployConfigId - && qobject_cast<AbstractQt4MaemoTarget *>(parent)); -} - -DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent, - const QVariantMap &map) -{ - if (!canRestore(parent, map)) - return 0; - QString id = idFromMap(map); - if (id == OldDeployConfigId) { - if (qobject_cast<Qt4Maemo5Target *>(parent)) - id = Qt4MaemoDeployConfiguration::FremantleWithPackagingId; - else if (qobject_cast<Qt4HarmattanTarget *>(parent)) - id = Qt4MaemoDeployConfiguration::HarmattanId; - else if (qobject_cast<Qt4MeegoTarget *>(parent)) - id = Qt4MaemoDeployConfiguration::MeegoId; - } - Qt4MaemoDeployConfiguration * const dc - = new Qt4MaemoDeployConfiguration(parent, id); - if (!dc->fromMap(map)) { - delete dc; - return 0; - } - return dc; -} - -DeployConfiguration *Qt4MaemoDeployConfigurationFactory::clone(Target *parent, - DeployConfiguration *product) -{ - if (!canClone(parent, product)) - return 0; - return new Qt4MaemoDeployConfiguration(parent, product); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.h deleted file mode 100644 index 3fc573e422..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemodeployconfiguration.h +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H -#define QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H - -#include"maemodeployables.h" -#include "maemopertargetdeviceconfigurationlistmodel.h" - -#include <projectexplorer/deployconfiguration.h> - -#include <QtCore/QSharedPointer> - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoPerTargetDeviceConfigurationListModel; - -class Qt4MaemoDeployConfiguration : public ProjectExplorer::DeployConfiguration -{ - Q_OBJECT - -public: - virtual ~Qt4MaemoDeployConfiguration(); - - virtual ProjectExplorer::DeployConfigurationWidget *configurationWidget() const; - - QSharedPointer<MaemoDeployables> deployables() const { return m_deployables; } - QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> deviceConfigModel() const { return m_devConfModel; } - - static const QString FremantleWithPackagingId; - static const QString FremantleWithoutPackagingId; - static const QString HarmattanId; - static const QString MeegoId; - static const QString GenericLinuxId; - -private: - friend class Qt4MaemoDeployConfigurationFactory; - - Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, - const QString &id); - Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, - ProjectExplorer::DeployConfiguration *source); - - QSharedPointer<MaemoDeployables> m_deployables; - QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> m_devConfModel; -}; - - -class Qt4MaemoDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory -{ - Q_OBJECT - -public: - explicit Qt4MaemoDeployConfigurationFactory(QObject *parent = 0); - - virtual QStringList availableCreationIds(ProjectExplorer::Target *parent) const; - virtual QString displayNameForId(const QString &id) const; - virtual bool canCreate(ProjectExplorer::Target *parent, const QString &id) const; - virtual ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id); - virtual bool canRestore(ProjectExplorer::Target *parent, - const QVariantMap &map) const; - virtual ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, - const QVariantMap &map); - virtual ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent, - ProjectExplorer::DeployConfiguration *product); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp deleted file mode 100644 index b7de6ef659..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.cpp +++ /dev/null @@ -1,1123 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qt4maemotarget.h" - -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemorunconfiguration.h" -#include "maemotoolchain.h" -#include "qt4maemodeployconfiguration.h" - -#include <coreplugin/filemanager.h> -#include <coreplugin/icore.h> -#include <coreplugin/iversioncontrol.h> -#include <coreplugin/vcsmanager.h> -#include <projectexplorer/abi.h> -#include <projectexplorer/customexecutablerunconfiguration.h> -#include <projectexplorer/projectexplorer.h> -#include <projectexplorer/projectnodes.h> -#include <projectexplorer/toolchain.h> -#include <qt4projectmanager/qt4project.h> -#include <utils/fileutils.h> -#include <utils/filesystemwatcher.h> -#include <qtsupport/baseqtversion.h> - - -#include <QtGui/QApplication> -#include <QtGui/QMainWindow> -#include <QtCore/QBuffer> -#include <QtCore/QRegExp> -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtCore/QFileInfo> -#include <QtCore/QProcess> -#include <QtCore/QStringList> -#include <QtGui/QIcon> -#include <QtGui/QMessageBox> - -#include <cctype> - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; - -namespace { -const QByteArray NameFieldName("Package"); -const QByteArray IconFieldName("XB-Maemo-Icon-26"); -const QByteArray ShortDescriptionFieldName("Description"); -const QByteArray PackageFieldName("Package"); -const QLatin1String PackagingDirName("qtc_packaging"); -const QByteArray NameTag("Name"); -const QByteArray SummaryTag("Summary"); -const QByteArray VersionTag("Version"); -const QByteArray ReleaseTag("Release"); - -bool adaptTagValue(QByteArray &document, const QByteArray &fieldName, - const QByteArray &newFieldValue, bool caseSensitive) -{ - QByteArray adaptedLine = fieldName + ": " + newFieldValue; - const QByteArray completeTag = fieldName + ':'; - const int lineOffset = caseSensitive ? document.indexOf(completeTag) - : document.toLower().indexOf(completeTag.toLower()); - if (lineOffset == -1) { - document.append(adaptedLine).append('\n'); - return true; - } - - int newlineOffset = document.indexOf('\n', lineOffset); - bool updated = false; - if (newlineOffset == -1) { - newlineOffset = document.length(); - adaptedLine += '\n'; - updated = true; - } - const int replaceCount = newlineOffset - lineOffset; - if (!updated && document.mid(lineOffset, replaceCount) != adaptedLine) - updated = true; - if (updated) - document.replace(lineOffset, replaceCount, adaptedLine); - return updated; -} - - -} // anonymous namespace - - -AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id) : - Qt4BaseTarget(parent, id), - m_filesWatcher(new Utils::FileSystemWatcher(this)), - m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)), - m_isInitialized(false) -{ - m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget")); - setIcon(QIcon(":/projectexplorer/images/MaemoDevice.png")); - connect(parent, SIGNAL(addedTarget(ProjectExplorer::Target*)), - this, SLOT(handleTargetAdded(ProjectExplorer::Target*))); - connect(parent, SIGNAL(fromMapFinished()), - this, SLOT(handleFromMapFinished())); -} - -AbstractQt4MaemoTarget::~AbstractQt4MaemoTarget() -{ } - -QList<ProjectExplorer::ToolChain *> AbstractQt4MaemoTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const -{ - QList<ProjectExplorer::ToolChain *> result; - - Qt4BuildConfiguration *qt4Bc = qobject_cast<Qt4BuildConfiguration *>(bc); - if (!qt4Bc) - return result; - - QList<ProjectExplorer::ToolChain *> candidates = Qt4BaseTarget::possibleToolChains(bc); - foreach (ProjectExplorer::ToolChain *i, candidates) { - MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(i); - if (!tc || !qt4Bc->qtVersion()) - continue; - if (tc->qtVersionId() == qt4Bc->qtVersion()->uniqueId()) - result.append(tc); - } - - return result; -} - - -Qt4BuildConfigurationFactory *AbstractQt4MaemoTarget::buildConfigurationFactory() const -{ - return m_buildConfigurationFactory; -} - -void AbstractQt4MaemoTarget::createApplicationProFiles() -{ - removeUnconfiguredCustomExectutableRunConfigurations(); - - QList<Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles(); - QSet<QString> paths; - foreach (Qt4ProFileNode *pro, profiles) - paths << pro->path(); - - foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) - if (MaemoRunConfiguration *qt4rc = qobject_cast<MaemoRunConfiguration *>(rc)) - paths.remove(qt4rc->proFilePath()); - - // Only add new runconfigurations if there are none. - foreach (const QString &path, paths) - addRunConfiguration(new MaemoRunConfiguration(this, path)); - - // Oh still none? Add a custom executable runconfiguration - if (runConfigurations().isEmpty()) { - addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this)); - } -} - -QList<ProjectExplorer::RunConfiguration *> AbstractQt4MaemoTarget::runConfigurationsForNode(ProjectExplorer::Node *n) -{ - QList<ProjectExplorer::RunConfiguration *> result; - foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) - if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc)) - if (mrc->proFilePath() == n->path()) - result << rc; - return result; -} - -bool AbstractQt4MaemoTarget::setProjectVersion(const QString &version, - QString *error) -{ - bool success = true; - foreach (Target * const target, project()->targets()) { - AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(target); - if (maemoTarget) { - if (!maemoTarget->setProjectVersionInternal(version, error)) - success = false; - } - } - return success; -} - -bool AbstractQt4MaemoTarget::setPackageName(const QString &name) -{ - bool success = true; - foreach (Target * const target, project()->targets()) { - AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(target); - if (maemoTarget) { - if (!maemoTarget->setPackageNameInternal(name)) - success = false; - } - } - return success; -} - -bool AbstractQt4MaemoTarget::setShortDescription(const QString &description) -{ - bool success = true; - foreach (Target * const target, project()->targets()) { - AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<AbstractQt4MaemoTarget *>(target); - if (maemoTarget) { - if (!maemoTarget->setShortDescriptionInternal(description)) - success = false; - } - } - return success; -} - -QSharedPointer<QFile> AbstractQt4MaemoTarget::openFile(const QString &filePath, - QIODevice::OpenMode mode, QString *error) const -{ - const QString nativePath = QDir::toNativeSeparators(filePath); - QSharedPointer<QFile> file(new QFile(filePath)); - if (!file->open(mode)) { - if (error) { - *error = tr("Cannot open file '%1': %2") - .arg(nativePath, file->errorString()); - } - file.clear(); - } - return file; -} - -void AbstractQt4MaemoTarget::handleFromMapFinished() -{ - handleTargetAdded(this); -} - -void AbstractQt4MaemoTarget::handleTargetAdded(ProjectExplorer::Target *target) -{ - if (target != this) - return; - - if (!project()->rootProjectNode()) { - // Project is not fully setup yet, happens on new project - // we wait for the fromMapFinished that comes afterwards - return; - } - - disconnect(project(), SIGNAL(fromMapFinished()), - this, SLOT(handleFromMapFinished())); - disconnect(project(), SIGNAL(addedTarget(ProjectExplorer::Target*)), - this, SLOT(handleTargetAdded(ProjectExplorer::Target*))); - connect(project(), SIGNAL(aboutToRemoveTarget(ProjectExplorer::Target*)), - SLOT(handleTargetToBeRemoved(ProjectExplorer::Target*))); - const ActionStatus status = createTemplates(); - if (status == ActionFailed) - return; - if (status == ActionSuccessful) // Don't do this when the packaging data already exists. - initPackagingSettingsFromOtherTarget(); - handleTargetAddedSpecial(); - m_isInitialized = true; -} - -void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *target) -{ - if (target != this) - return; - if (!targetCanBeRemoved()) - return; - - Core::ICore * const core = Core::ICore::instance(); - const int answer = QMessageBox::warning(core->mainWindow(), - tr("Qt Creator"), tr("Do you want to remove the packaging file(s) " - "associated with the target '%1'?").arg(displayName()), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); - if (answer == QMessageBox::No) - return; - const QStringList pkgFilePaths = packagingFilePaths(); - if (!pkgFilePaths.isEmpty()) { - project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType, - pkgFilePaths); - Core::IVersionControl * const vcs = core->vcsManager() - ->findVersionControlForDirectory(QFileInfo(pkgFilePaths.first()).dir().path()); - if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) { - foreach (const QString &filePath, pkgFilePaths) - vcs->vcsDelete(filePath); - } - } - delete m_filesWatcher; - removeTarget(); - QString error; - const QString packagingPath = project()->projectDirectory() - + QLatin1Char('/') + PackagingDirName; - const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs - | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot); - if (otherContents.isEmpty()) { - if (!MaemoGlobal::removeRecursively(packagingPath, error)) - qDebug("%s", qPrintable(error)); - } -} - -AbstractQt4MaemoTarget::ActionStatus AbstractQt4MaemoTarget::createTemplates() -{ - QDir projectDir(project()->projectDirectory()); - if (!projectDir.exists(PackagingDirName) - && !projectDir.mkdir(PackagingDirName)) { - raiseError(tr("Error creating Maemo packaging directory '%1'.") - .arg(PackagingDirName)); - return ActionFailed; - } - - const ActionStatus actionStatus = createSpecialTemplates(); - if (actionStatus == ActionFailed) - return ActionFailed; - if (actionStatus == ActionSuccessful) { - const QStringList &files = packagingFilePaths(); - QMessageBox::StandardButton button - = QMessageBox::question(Core::ICore::instance()->mainWindow(), - tr("Add Packaging Files to Project"), - tr("Qt Creator has set up the following files to enable " - "packaging:\n %1\nDo you want to add them to the project?") - .arg(files.join(QLatin1String("\n "))), - QMessageBox::Yes | QMessageBox::No); - if (button == QMessageBox::Yes) - ProjectExplorer::ProjectExplorerPlugin::instance()->addExistingFiles(project()->rootProjectNode(), files); - } - return actionStatus; -} - -bool AbstractQt4MaemoTarget::initPackagingSettingsFromOtherTarget() -{ - bool success = true; - foreach (const Target * const target, project()->targets()) { - const AbstractQt4MaemoTarget * const maemoTarget - = qobject_cast<const AbstractQt4MaemoTarget *>(target); - if (maemoTarget && maemoTarget != this && maemoTarget->m_isInitialized) { - if (!setProjectVersionInternal(maemoTarget->projectVersion())) - success = false; - if (!setPackageNameInternal(maemoTarget->packageName())) - success = false; - if (!setShortDescriptionInternal(maemoTarget->shortDescription())) - success = false; - break; - } - } - return initAdditionalPackagingSettingsFromOtherTarget(); -} - -void AbstractQt4MaemoTarget::raiseError(const QString &reason) -{ - QMessageBox::critical(0, tr("Error creating Maemo templates"), reason); -} - -AbstractDebBasedQt4MaemoTarget::AbstractDebBasedQt4MaemoTarget(Qt4Project *parent, - const QString &id) : AbstractQt4MaemoTarget(parent, id) -{ -} - -AbstractDebBasedQt4MaemoTarget::~AbstractDebBasedQt4MaemoTarget() {} - -QString AbstractDebBasedQt4MaemoTarget::projectVersion(QString *error) const -{ - QSharedPointer<QFile> changeLog = openFile(changeLogFilePath(), - QIODevice::ReadOnly, error); - if (!changeLog) - return QString(); - const QByteArray &firstLine = changeLog->readLine(); - const int openParenPos = firstLine.indexOf('('); - if (openParenPos == -1) { - if (error) { - *error = tr("Debian changelog file '%1' has unexpected format.") - .arg(QDir::toNativeSeparators(changeLog->fileName())); - } - return QString(); - } - const int closeParenPos = firstLine.indexOf(')', openParenPos); - if (closeParenPos == -1) { - if (error) { - *error = tr("Debian changelog file '%1' has unexpected format.") - .arg(QDir::toNativeSeparators(changeLog->fileName())); - } - return QString(); - } - return QString::fromUtf8(firstLine.mid(openParenPos + 1, - closeParenPos - openParenPos - 1).data()); -} - -bool AbstractDebBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version, - QString *error) -{ - const QString filePath = changeLogFilePath(); - Utils::FileReader reader; - if (!reader.fetch(filePath, error)) - return false; - QString content = QString::fromUtf8(reader.data()); - content.replace(QRegExp(QLatin1String("\\([a-zA-Z0-9_\\.]+\\)")), - QLatin1Char('(') + version + QLatin1Char(')')); - Core::FileChangeBlocker update(filePath); - Utils::FileSaver saver(filePath); - saver.write(content.toUtf8()); - return saver.finalize(error); -} - -QIcon AbstractDebBasedQt4MaemoTarget::packageManagerIcon(QString *error) const -{ - const QByteArray &base64Icon = controlFileFieldValue(IconFieldName, true); - if (base64Icon.isEmpty()) - return QIcon(); - QPixmap pixmap; - if (!pixmap.loadFromData(QByteArray::fromBase64(base64Icon))) { - if (error) - *error = tr("Invalid icon data in Debian control file."); - return QIcon(); - } - return QIcon(pixmap); -} - -bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIconInternal(const QString &iconFilePath, - QString *error) -{ - const QString filePath = controlFilePath(); - Utils::FileReader reader; - if (!reader.fetch(filePath, error)) - return false; - const QPixmap pixmap(iconFilePath); - if (pixmap.isNull()) { - if (error) - *error = tr("Could not read image file '%1'.").arg(iconFilePath); - return false; - } - - QByteArray iconAsBase64; - QBuffer buffer(&iconAsBase64); - buffer.open(QIODevice::WriteOnly); - if (!pixmap.scaled(48, 48).save(&buffer, - QFileInfo(iconFilePath).suffix().toAscii())) { - if (error) - *error = tr("Could not export image file '%1'.").arg(iconFilePath); - return false; - } - buffer.close(); - iconAsBase64 = iconAsBase64.toBase64(); - QByteArray contents = reader.data(); - const QByteArray iconFieldNameWithColon = IconFieldName + ':'; - const int iconFieldPos = contents.startsWith(iconFieldNameWithColon) - ? 0 : contents.indexOf('\n' + iconFieldNameWithColon); - if (iconFieldPos == -1) { - if (!contents.endsWith('\n')) - contents += '\n'; - contents.append(iconFieldNameWithColon).append(' ').append(iconAsBase64) - .append('\n'); - } else { - const int oldIconStartPos = (iconFieldPos != 0) + iconFieldPos - + iconFieldNameWithColon.length(); - int nextEolPos = contents.indexOf('\n', oldIconStartPos); - while (nextEolPos != -1 && nextEolPos != contents.length() - 1 - && contents.at(nextEolPos + 1) != '\n' - && (contents.at(nextEolPos + 1) == '#' - || std::isspace(contents.at(nextEolPos + 1)))) - nextEolPos = contents.indexOf('\n', nextEolPos + 1); - if (nextEolPos == -1) - nextEolPos = contents.length(); - contents.replace(oldIconStartPos, nextEolPos - oldIconStartPos, - ' ' + iconAsBase64); - } - Core::FileChangeBlocker update(filePath); - Utils::FileSaver saver(filePath); - saver.write(contents); - return saver.finalize(error); -} - -QString AbstractDebBasedQt4MaemoTarget::packageName() const -{ - return QString::fromUtf8(controlFileFieldValue(NameFieldName, false)); -} - -bool AbstractDebBasedQt4MaemoTarget::setPackageNameInternal(const QString &packageName) -{ - const QString oldPackageName = this->packageName(); - - if (!setControlFieldValue(NameFieldName, packageName.toUtf8())) - return false; - if (!setControlFieldValue("Source", packageName.toUtf8())) - return false; - - Utils::FileReader reader; - if (!reader.fetch(changeLogFilePath())) - return false; - QString changelogContents = QString::fromUtf8(reader.data()); - QRegExp pattern(QLatin1String("[^\\s]+( \\(\\d\\.\\d\\.\\d\\))")); - changelogContents.replace(pattern, packageName + QLatin1String("\\1")); - Utils::FileSaver saver(changeLogFilePath()); - saver.write(changelogContents.toUtf8()); - if (!saver.finalize()) - return false; - - if (!reader.fetch(rulesFilePath())) - return false; - QByteArray rulesContents = reader.data(); - const QString oldString = QLatin1String("debian/") + oldPackageName; - const QString newString = QLatin1String("debian/") + packageName; - rulesContents.replace(oldString.toUtf8(), newString.toUtf8()); - Utils::FileSaver rulesSaver(rulesFilePath()); - rulesSaver.write(rulesContents); - return rulesSaver.finalize(); -} - -QString AbstractDebBasedQt4MaemoTarget::packageManagerName() const -{ - return QString::fromUtf8(controlFileFieldValue(packageManagerNameFieldName(), false)); -} - -bool AbstractDebBasedQt4MaemoTarget::setPackageManagerName(const QString &name, - QString *error) -{ - bool success = true; - foreach (Target * const t, project()->targets()) { - AbstractDebBasedQt4MaemoTarget * const target - = qobject_cast<AbstractDebBasedQt4MaemoTarget *>(t); - if (target) { - if (!target->setPackageManagerNameInternal(name, error)) - success = false; - } - } - return success; -} - -bool AbstractDebBasedQt4MaemoTarget::setPackageManagerNameInternal(const QString &name, - QString *error) -{ - Q_UNUSED(error); - return setControlFieldValue(packageManagerNameFieldName(), name.toUtf8()); -} - -QString AbstractDebBasedQt4MaemoTarget::shortDescription() const -{ - return QString::fromUtf8(controlFileFieldValue(ShortDescriptionFieldName, false)); -} - -QString AbstractDebBasedQt4MaemoTarget::packageFileName() const -{ - return QString::fromUtf8(controlFileFieldValue(PackageFieldName, false)) - + QLatin1Char('_') + projectVersion() + QLatin1String("_armel.deb"); -} - -bool AbstractDebBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description) -{ - return setControlFieldValue(ShortDescriptionFieldName, description.toUtf8()); -} - -QString AbstractDebBasedQt4MaemoTarget::debianDirPath() const -{ - return project()->projectDirectory() + QLatin1Char('/') + PackagingDirName - + QLatin1Char('/') + debianDirName(); -} - -QStringList AbstractDebBasedQt4MaemoTarget::debianFiles() const -{ - return QDir(debianDirPath()) - .entryList(QDir::Files, QDir::Name | QDir::IgnoreCase); -} - -QString AbstractDebBasedQt4MaemoTarget::changeLogFilePath() const -{ - return debianDirPath() + QLatin1String("/changelog"); -} - -QString AbstractDebBasedQt4MaemoTarget::controlFilePath() const -{ - return debianDirPath() + QLatin1String("/control"); -} - -QString AbstractDebBasedQt4MaemoTarget::rulesFilePath() const -{ - return debianDirPath() + QLatin1String("/rules"); -} - -QByteArray AbstractDebBasedQt4MaemoTarget::controlFileFieldValue(const QString &key, - bool multiLine) const -{ - QByteArray value; - Utils::FileReader reader; - if (!reader.fetch(controlFilePath())) - return value; - const QByteArray &contents = reader.data(); - const int keyPos = contents.indexOf(key.toUtf8() + ':'); - if (keyPos == -1) - return value; - int valueStartPos = keyPos + key.length() + 1; - int valueEndPos = contents.indexOf('\n', keyPos); - if (valueEndPos == -1) - valueEndPos = contents.count(); - value = contents.mid(valueStartPos, valueEndPos - valueStartPos).trimmed(); - if (multiLine) { - Q_FOREVER { - valueStartPos = valueEndPos + 1; - if (valueStartPos >= contents.count()) - break; - const char firstChar = contents.at(valueStartPos); - if (firstChar == '#' || isspace(firstChar)) { - valueEndPos = contents.indexOf('\n', valueStartPos); - if (valueEndPos == -1) - valueEndPos = contents.count(); - if (firstChar != '#') { - value += contents.mid(valueStartPos, - valueEndPos - valueStartPos).trimmed(); - } - } else { - break; - } - } - } - return value; -} - -bool AbstractDebBasedQt4MaemoTarget::setControlFieldValue(const QByteArray &fieldName, - const QByteArray &fieldValue) -{ - Utils::FileReader reader; - if (!reader.fetch(controlFilePath())) - return false; - QByteArray contents = reader.data(); - if (adaptControlFileField(contents, fieldName, fieldValue)) { - Core::FileChangeBlocker update(controlFilePath()); - Utils::FileSaver saver(controlFilePath()); - saver.write(contents); - return saver.finalize(); - } - return true; -} - -bool AbstractDebBasedQt4MaemoTarget::adaptControlFileField(QByteArray &document, - const QByteArray &fieldName, const QByteArray &newFieldValue) -{ - return adaptTagValue(document, fieldName, newFieldValue, true); -} - -void AbstractDebBasedQt4MaemoTarget::handleTargetAddedSpecial() -{ - if (controlFileFieldValue(IconFieldName, true).isEmpty()) { - // Such a file is created by the mobile wizards. - const QString iconPath = project()->projectDirectory() - + QLatin1Char('/') + project()->displayName() - + QLatin1String(".png"); - if (QFileInfo(iconPath).exists()) - setPackageManagerIcon(iconPath); - } - m_filesWatcher->addDirectory(debianDirPath(), Utils::FileSystemWatcher::WatchAllChanges); - m_controlFile = new WatchableFile(controlFilePath(), this); - connect(m_controlFile, SIGNAL(modified()), SIGNAL(controlChanged())); - m_changeLogFile = new WatchableFile(changeLogFilePath(), this); - connect(m_changeLogFile, SIGNAL(modified()), SIGNAL(changeLogChanged())); - Core::FileManager::instance()->addFiles(QList<Core::IFile *>() - << m_controlFile << m_changeLogFile); - connect(m_filesWatcher, SIGNAL(directoryChanged(QString)), this, - SLOT(handleDebianDirContentsChanged())); - handleDebianDirContentsChanged(); - emit controlChanged(); - emit changeLogChanged(); -} - -bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const -{ - return QFileInfo(debianDirPath()).exists(); -} - -void AbstractDebBasedQt4MaemoTarget::removeTarget() -{ - QString error; - if (!MaemoGlobal::removeRecursively(debianDirPath(), error)) - qDebug("%s", qPrintable(error)); -} - -void AbstractDebBasedQt4MaemoTarget::handleDebianDirContentsChanged() -{ - emit debianDirContentsChanged(); -} - -AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpecialTemplates() -{ - if (QFileInfo(debianDirPath()).exists()) - return NoActionRequired; - QDir projectDir(project()->projectDirectory()); - QProcess dh_makeProc; - QString error; - const Qt4BuildConfiguration * const bc = activeBuildConfiguration(); - AbstractMaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, bc, - projectDir.path() + QLatin1Char('/') + PackagingDirName); - const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/') - + PackagingDirName + QLatin1String("/debian"); - MaemoGlobal::removeRecursively(dhMakeDebianDir, error); - const QStringList dh_makeArgs = QStringList() << QLatin1String("dh_make") - << QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p") - << (defaultPackageFileName() + QLatin1Char('_') - + AbstractMaemoPackageCreationStep::DefaultVersionNumber); - QtSupport::BaseQtVersion *lqt = activeBuildConfiguration()->qtVersion(); - if (!lqt) { - raiseError(tr("Unable to create Debian templates: No qt version set")); - return ActionFailed; - } - if (!MaemoGlobal::callMad(dh_makeProc, dh_makeArgs, lqt->qmakeCommand(), true) - || !dh_makeProc.waitForStarted()) { - raiseError(tr("Unable to create Debian templates: dh_make failed (%1)") - .arg(dh_makeProc.errorString())); - return ActionFailed; - } - dh_makeProc.write("\n"); // Needs user input. - dh_makeProc.waitForFinished(-1); - if (dh_makeProc.error() != QProcess::UnknownError - || dh_makeProc.exitCode() != 0) { - raiseError(tr("Unable to create debian templates: dh_make failed (%1)") - .arg(dh_makeProc.errorString())); - return ActionFailed; - } - - if (!QFile::rename(dhMakeDebianDir, debianDirPath())) { - raiseError(tr("Unable to move new debian directory to '%1'.") - .arg(QDir::toNativeSeparators(debianDirPath()))); - MaemoGlobal::removeRecursively(dhMakeDebianDir, error); - return ActionFailed; - } - - QDir debianDir(debianDirPath()); - const QStringList &files = debianDir.entryList(QDir::Files); - foreach (const QString &fileName, files) { - if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive) - || fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0 - || fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0 - || fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) { - debianDir.remove(fileName); - } - } - - return adaptRulesFile() && adaptControlFile() - ? ActionSuccessful : ActionFailed; -} - -bool AbstractDebBasedQt4MaemoTarget::adaptRulesFile() -{ - Utils::FileReader reader; - if (!reader.fetch(rulesFilePath())) { - raiseError(reader.errorString()); - return false; - } - QByteArray rulesContents = reader.data(); - const QByteArray comment("# Uncomment this line for use without Qt Creator"); - rulesContents.replace("DESTDIR", "INSTALL_ROOT"); - rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps " + comment); - rulesContents.replace("# Add here commands to configure the package.", - "# qmake PREFIX=/usr" + comment); - rulesContents.replace("$(MAKE)\n", "# $(MAKE) " + comment + '\n'); - - // Would be the right solution, but does not work (on Windows), - // because dpkg-genchanges doesn't know about it (and can't be told). - // rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=."); - - Utils::FileSaver saver(rulesFilePath()); - saver.write(rulesContents); - if (!saver.finalize()) { - raiseError(saver.errorString()); - return false; - } - return true; -} - -bool AbstractDebBasedQt4MaemoTarget::adaptControlFile() -{ - Utils::FileReader reader; - if (!reader.fetch(controlFilePath())) { - raiseError(reader.errorString()); - return false; - } - QByteArray controlContents = reader.data(); - - adaptControlFileField(controlContents, "Section", defaultSection()); - adaptControlFileField(controlContents, "Priority", "optional"); - adaptControlFileField(controlContents, packageManagerNameFieldName(), - project()->displayName().toUtf8()); - const int buildDependsOffset = controlContents.indexOf("Build-Depends:"); - if (buildDependsOffset == -1) { - qDebug("Unexpected: no Build-Depends field in debian control file."); - } else { - int buildDependsNewlineOffset - = controlContents.indexOf('\n', buildDependsOffset); - if (buildDependsNewlineOffset == -1) { - controlContents += '\n'; - buildDependsNewlineOffset = controlContents.length() - 1; - } - controlContents.insert(buildDependsNewlineOffset, - ", libqt4-dev"); - } - - addAdditionalControlFileFields(controlContents); - Utils::FileSaver saver(controlFilePath()); - saver.write(controlContents); - if (!saver.finalize()) { - raiseError(saver.errorString()); - return false; - } - return true; -} - -bool AbstractDebBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget() -{ - foreach (const Target * const t, project()->targets()) { - const AbstractDebBasedQt4MaemoTarget *target - = qobject_cast<const AbstractDebBasedQt4MaemoTarget *>(t); - if (target && target != this) { - return setControlFieldValue(IconFieldName, - target->controlFileFieldValue(IconFieldName, true)); - } - } - return true; -} - -QStringList AbstractDebBasedQt4MaemoTarget::packagingFilePaths() const -{ - QStringList filePaths; - const QString parentDir = debianDirPath(); - foreach (const QString &fileName, debianFiles()) - filePaths << parentDir + QLatin1Char('/') + fileName; - return filePaths; -} - -QString AbstractDebBasedQt4MaemoTarget::defaultPackageFileName() const -{ - QString packageName = project()->displayName().toLower(); - - // We also replace dots, because OVI store chokes on them. - const QRegExp legalLetter(QLatin1String("[a-z0-9+-]"), Qt::CaseSensitive, - QRegExp::WildcardUnix); - - for (int i = 0; i < packageName.length(); ++i) { - if (!legalLetter.exactMatch(packageName.mid(i, 1))) - packageName[i] = QLatin1Char('-'); - } - return packageName; -} - -bool AbstractDebBasedQt4MaemoTarget::setPackageManagerIcon(const QString &iconFilePath, - QString *error) -{ - bool success = true; - foreach (Target * const target, project()->targets()) { - AbstractDebBasedQt4MaemoTarget* const maemoTarget - = qobject_cast<AbstractDebBasedQt4MaemoTarget*>(target); - if (maemoTarget) { - if (!maemoTarget->setPackageManagerIconInternal(iconFilePath, error)) - success = false; - } - } - return success; -} - - -AbstractRpmBasedQt4MaemoTarget::AbstractRpmBasedQt4MaemoTarget(Qt4Project *parent, - const QString &id) : AbstractQt4MaemoTarget(parent, id) -{ -} - -AbstractRpmBasedQt4MaemoTarget::~AbstractRpmBasedQt4MaemoTarget() -{ -} - -QString AbstractRpmBasedQt4MaemoTarget::specFilePath() const -{ - const QLatin1Char sep('/'); - return project()->projectDirectory() + sep + PackagingDirName + sep - + specFileName(); -} - -QString AbstractRpmBasedQt4MaemoTarget::projectVersion(QString *error) const -{ - return QString::fromUtf8(getValueForTag(VersionTag, error)); -} - -bool AbstractRpmBasedQt4MaemoTarget::setProjectVersionInternal(const QString &version, - QString *error) -{ - return setValueForTag(VersionTag, version.toUtf8(), error); -} - -QString AbstractRpmBasedQt4MaemoTarget::packageName() const -{ - return QString::fromUtf8(getValueForTag(NameTag, 0)); -} - -bool AbstractRpmBasedQt4MaemoTarget::setPackageNameInternal(const QString &name) -{ - return setValueForTag(NameTag, name.toUtf8(), 0); -} - -QString AbstractRpmBasedQt4MaemoTarget::shortDescription() const -{ - return QString::fromUtf8(getValueForTag(SummaryTag, 0)); -} - -QString AbstractRpmBasedQt4MaemoTarget::packageFileName() const -{ - QtSupport::BaseQtVersion *lqt = activeBuildConfiguration()->qtVersion(); - if (!lqt) - return QString(); - return packageName() + QLatin1Char('-') + projectVersion() + QLatin1Char('-') - + QString::fromUtf8(getValueForTag(ReleaseTag, 0)) + QLatin1Char('.') - + MaemoGlobal::architecture(lqt->qmakeCommand()) - + QLatin1String(".rpm"); -} - -bool AbstractRpmBasedQt4MaemoTarget::setShortDescriptionInternal(const QString &description) -{ - return setValueForTag(SummaryTag, description.toUtf8(), 0); -} - -AbstractQt4MaemoTarget::ActionStatus AbstractRpmBasedQt4MaemoTarget::createSpecialTemplates() -{ - if (QFileInfo(specFilePath()).exists()) - return NoActionRequired; - QByteArray initialContent( - "Name: %%name%%\n" - "Summary: <insert short description here>\n" - "Version: 0.0.1\n" - "Release: 1\n" - "License: <Enter your application's license here>\n" - "Group: <Set your application's group here>\n" - "%description\n" - "<Insert longer, multi-line description\n" - "here.>\n" - "\n" - "%prep\n" - "%setup -q\n" - "\n" - "%build\n" - "# You can leave this empty for use with Qt Creator." - "\n" - "%install\n" - "rm -rf %{buildroot}\n" - "make INSTALL_ROOT=%{buildroot} install\n" - "\n" - "%clean\n" - "rm -rf %{buildroot}\n" - "\n" - "BuildRequires: \n" - "# %define _unpackaged_files_terminate_build 0\n" - "%files\n" - "%defattr(-,root,root,-)" - "/usr\n" - "/opt\n" - "# Add additional files to be included in the package here.\n" - "%pre\n" - "# Add pre-install scripts here." - "%post\n" - "/sbin/ldconfig # For shared libraries\n" - "%preun\n" - "# Add pre-uninstall scripts here." - "%postun\n" - "# Add post-uninstall scripts here." - ); - initialContent.replace("%%name%%", project()->displayName().toUtf8()); - Utils::FileSaver saver(specFilePath()); - saver.write(initialContent); - return saver.finalize() ? ActionSuccessful : ActionFailed; -} - -void AbstractRpmBasedQt4MaemoTarget::handleTargetAddedSpecial() -{ - m_specFile = new WatchableFile(specFilePath(), this); - connect(m_specFile, SIGNAL(modified()), SIGNAL(specFileChanged())); - Core::FileManager::instance()->addFile(m_specFile); - emit specFileChanged(); -} - -bool AbstractRpmBasedQt4MaemoTarget::targetCanBeRemoved() const -{ - return QFileInfo(specFilePath()).exists(); -} - -void AbstractRpmBasedQt4MaemoTarget::removeTarget() -{ - QFile::remove(specFilePath()); -} - -bool AbstractRpmBasedQt4MaemoTarget::initAdditionalPackagingSettingsFromOtherTarget() -{ - // Nothing to do here for now. - return true; -} - -QByteArray AbstractRpmBasedQt4MaemoTarget::getValueForTag(const QByteArray &tag, - QString *error) const -{ - Utils::FileReader reader; - if (!reader.fetch(specFilePath(), error)) - return QByteArray(); - const QByteArray &content = reader.data(); - const QByteArray completeTag = tag.toLower() + ':'; - int index = content.toLower().indexOf(completeTag); - if (index == -1) - return QByteArray(); - index += completeTag.count(); - int endIndex = content.indexOf('\n', index); - if (endIndex == -1) - endIndex = content.count(); - return content.mid(index, endIndex - index).trimmed(); -} - -bool AbstractRpmBasedQt4MaemoTarget::setValueForTag(const QByteArray &tag, - const QByteArray &value, QString *error) -{ - Utils::FileReader reader; - if (!reader.fetch(specFilePath(), error)) - return false; - QByteArray content = reader.data(); - if (adaptTagValue(content, tag, value, false)) { - Utils::FileSaver saver(specFilePath()); - saver.write(content); - return saver.finalize(error); - } - return true; -} - -Qt4Maemo5Target::Qt4Maemo5Target(Qt4Project *parent, const QString &id) - : AbstractDebBasedQt4MaemoTarget(parent, id) -{ - setDisplayName(defaultDisplayName()); -} - -Qt4Maemo5Target::~Qt4Maemo5Target() {} - -QString Qt4Maemo5Target::defaultDisplayName() -{ - return QApplication::translate("Qt4ProjectManager::Qt4Target", "Maemo5", - "Qt4 Maemo5 target display name"); -} - -void Qt4Maemo5Target::addAdditionalControlFileFields(QByteArray &controlContents) -{ - Q_UNUSED(controlContents); -} - -QString Qt4Maemo5Target::debianDirName() const -{ - return QLatin1String("debian_fremantle"); -} - -QByteArray Qt4Maemo5Target::packageManagerNameFieldName() const -{ - return "XB-Maemo-Display-Name"; -} - -QByteArray Qt4Maemo5Target::defaultSection() const -{ - return "user/hidden"; -} - -Qt4HarmattanTarget::Qt4HarmattanTarget(Qt4Project *parent, const QString &id) - : AbstractDebBasedQt4MaemoTarget(parent, id) -{ - setDisplayName(defaultDisplayName()); -} - -Qt4HarmattanTarget::~Qt4HarmattanTarget() {} - -QString Qt4HarmattanTarget::defaultDisplayName() -{ - return QApplication::translate("Qt4ProjectManager::Qt4Target", "Harmattan", - "Qt4 Harmattan target display name"); -} - -void Qt4HarmattanTarget::addAdditionalControlFileFields(QByteArray &controlContents) -{ - Q_UNUSED(controlContents); -} - -QString Qt4HarmattanTarget::debianDirName() const -{ - return QLatin1String("debian_harmattan"); -} - -QByteArray Qt4HarmattanTarget::packageManagerNameFieldName() const -{ - return "XSBC-Maemo-Display-Name"; -} - -QByteArray Qt4HarmattanTarget::defaultSection() const -{ - return "user/other"; -} - - -Qt4MeegoTarget::Qt4MeegoTarget(Qt4Project *parent, const QString &id) - : AbstractRpmBasedQt4MaemoTarget(parent, id) -{ - setDisplayName(defaultDisplayName()); -} - -Qt4MeegoTarget::~Qt4MeegoTarget() {} - -QString Qt4MeegoTarget::defaultDisplayName() -{ - return QApplication::translate("Qt4ProjectManager::Qt4Target", - "Meego", "Qt4 Meego target display name"); -} - -QString Qt4MeegoTarget::specFileName() const -{ - return QLatin1String("meego.spec"); -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.h b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.h deleted file mode 100644 index 81dd1ea010..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotarget.h +++ /dev/null @@ -1,280 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QT4MAEMOTARGET_H -#define QT4MAEMOTARGET_H - -#include "qt4target.h" - -#include <QtCore/QIODevice> -#include <QtCore/QSharedPointer> -#include <QtGui/QIcon> - -QT_FORWARD_DECLARE_CLASS(QFile) - -namespace Utils { -class FileSystemWatcher; -} -namespace Qt4ProjectManager { -class Qt4Project; -namespace Internal { -class Qt4MaemoDeployConfigurationFactory; -class WatchableFile; - -class AbstractQt4MaemoTarget : public Qt4BaseTarget -{ - friend class Qt4MaemoTargetFactory; - Q_OBJECT -public: - explicit AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id); - virtual ~AbstractQt4MaemoTarget(); - - Qt4BuildConfigurationFactory *buildConfigurationFactory() const; - void createApplicationProFiles(); - QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); - QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const; - - virtual bool allowsRemoteMounts() const=0; - virtual bool allowsPackagingDisabling() const=0; - virtual bool allowsQmlDebugging() const=0; - - virtual QString projectVersion(QString *error = 0) const=0; - virtual QString packageName() const=0; - virtual QString shortDescription() const=0; - virtual QString packageFileName() const=0; - - bool setProjectVersion(const QString &version, QString *error = 0); - bool setPackageName(const QString &packageName); - bool setShortDescription(const QString &description); - -protected: - enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed }; - - void raiseError(const QString &reason); - QSharedPointer<QFile> openFile(const QString &filePath, - QIODevice::OpenMode mode, QString *error) const; - - Utils::FileSystemWatcher* const m_filesWatcher; - -private slots: - void handleTargetAdded(ProjectExplorer::Target *target); - void handleFromMapFinished(); - void handleTargetToBeRemoved(ProjectExplorer::Target *target); - -private: - virtual bool setProjectVersionInternal(const QString &version, - QString *error = 0)=0; - virtual bool setPackageNameInternal(const QString &packageName)=0; - virtual bool setShortDescriptionInternal(const QString &description)=0; - virtual ActionStatus createSpecialTemplates()=0; - virtual void handleTargetAddedSpecial()=0; - virtual bool targetCanBeRemoved() const=0; - virtual void removeTarget()=0; - virtual QStringList packagingFilePaths() const=0; - - ActionStatus createTemplates(); - bool initPackagingSettingsFromOtherTarget(); - virtual bool initAdditionalPackagingSettingsFromOtherTarget()=0; - - Qt4BuildConfigurationFactory *m_buildConfigurationFactory; - bool m_isInitialized; -}; - - -class AbstractDebBasedQt4MaemoTarget : public AbstractQt4MaemoTarget -{ - Q_OBJECT -public: - AbstractDebBasedQt4MaemoTarget(Qt4Project *parent, const QString &id); - ~AbstractDebBasedQt4MaemoTarget(); - - QString debianDirPath() const; - QStringList debianFiles() const; - - virtual QString debianDirName() const=0; - virtual QString projectVersion(QString *error = 0) const; - virtual QString packageName() const; - virtual QString shortDescription() const; - virtual QString packageFileName() const; - - bool setPackageManagerIcon(const QString &iconFilePath, QString *error = 0); - QIcon packageManagerIcon(QString *error = 0) const; - bool setPackageManagerName(const QString &name, QString *error = 0); - QString packageManagerName() const; - -signals: - void debianDirContentsChanged(); - void changeLogChanged(); - void controlChanged(); - -protected: - bool adaptControlFileField(QByteArray &document, const QByteArray &fieldName, - const QByteArray &newFieldValue); - -private slots: - void handleDebianDirContentsChanged(); - -private: - virtual bool setProjectVersionInternal(const QString &version, - QString *error = 0); - virtual bool setPackageNameInternal(const QString &packageName); - virtual bool setShortDescriptionInternal(const QString &description); - - virtual ActionStatus createSpecialTemplates(); - virtual void handleTargetAddedSpecial(); - virtual bool targetCanBeRemoved() const; - virtual void removeTarget(); - virtual bool initAdditionalPackagingSettingsFromOtherTarget(); - virtual QStringList packagingFilePaths() const; - - virtual void addAdditionalControlFileFields(QByteArray &controlContents)=0; - virtual QByteArray packageManagerNameFieldName() const=0; - virtual QByteArray defaultSection() const=0; - - QString changeLogFilePath() const; - QString controlFilePath() const; - QString rulesFilePath() const; - QByteArray controlFileFieldValue(const QString &key, bool multiLine) const; - bool setControlFieldValue(const QByteArray &fieldName, - const QByteArray &fieldValue); - bool adaptRulesFile(); - bool adaptControlFile(); - bool setPackageManagerIconInternal(const QString &iconFilePath, - QString *error = 0); - QString defaultPackageFileName() const; - bool setPackageManagerNameInternal(const QString &name, QString *error = 0); - - WatchableFile *m_controlFile; - WatchableFile *m_changeLogFile; -}; - - -class AbstractRpmBasedQt4MaemoTarget : public AbstractQt4MaemoTarget -{ - Q_OBJECT -public: - AbstractRpmBasedQt4MaemoTarget(Qt4Project *parent, const QString &id); - ~AbstractRpmBasedQt4MaemoTarget(); - - virtual bool allowsRemoteMounts() const { return false; } - virtual bool allowsPackagingDisabling() const { return false; } - virtual bool allowsQmlDebugging() const { return false; } - - virtual QString projectVersion(QString *error = 0) const; - virtual QString packageName() const; - virtual QString shortDescription() const; - virtual QString packageFileName() const; - - QString specFilePath() const; - -signals: - void specFileChanged(); - -private: - virtual bool setProjectVersionInternal(const QString &version, - QString *error = 0); - virtual bool setPackageNameInternal(const QString &packageName); - virtual bool setShortDescriptionInternal(const QString &description); - virtual ActionStatus createSpecialTemplates(); - virtual void handleTargetAddedSpecial(); - virtual bool targetCanBeRemoved() const; - virtual void removeTarget(); - virtual bool initAdditionalPackagingSettingsFromOtherTarget(); - virtual QStringList packagingFilePaths() const { return QStringList(specFilePath()); } - - virtual QString specFileName() const=0; - - QByteArray getValueForTag(const QByteArray &tag, QString *error) const; - bool setValueForTag(const QByteArray &tag, const QByteArray &value, - QString *error); - - WatchableFile *m_specFile; -}; - - -class Qt4Maemo5Target : public AbstractDebBasedQt4MaemoTarget -{ - Q_OBJECT -public: - explicit Qt4Maemo5Target(Qt4Project *parent, const QString &id); - virtual ~Qt4Maemo5Target(); - - virtual bool allowsRemoteMounts() const { return true; } - virtual bool allowsPackagingDisabling() const { return true; } - virtual bool allowsQmlDebugging() const { return false; } - - static QString defaultDisplayName(); - -private: - virtual void addAdditionalControlFileFields(QByteArray &controlContents); - virtual QString debianDirName() const; - virtual QByteArray packageManagerNameFieldName() const; - virtual QByteArray defaultSection() const; -}; - - -class Qt4HarmattanTarget : public AbstractDebBasedQt4MaemoTarget -{ - Q_OBJECT -public: - explicit Qt4HarmattanTarget(Qt4Project *parent, const QString &id); - virtual ~Qt4HarmattanTarget(); - - virtual bool allowsRemoteMounts() const { return false; } - virtual bool allowsPackagingDisabling() const { return false; } - virtual bool allowsQmlDebugging() const { return false; } - - static QString defaultDisplayName(); - -private: - virtual void addAdditionalControlFileFields(QByteArray &controlContents); - virtual QString debianDirName() const; - virtual QByteArray packageManagerNameFieldName() const; - virtual QByteArray defaultSection() const; -}; - - -class Qt4MeegoTarget : public AbstractRpmBasedQt4MaemoTarget -{ - Q_OBJECT -public: - explicit Qt4MeegoTarget(Qt4Project *parent, const QString &id); - virtual ~Qt4MeegoTarget(); - static QString defaultDisplayName(); -private: - virtual QString specFileName() const; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // QT4MAEMOTARGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp deleted file mode 100644 index 588d4fc1a7..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qt4maemotargetfactory.h" -#include "buildconfigurationinfo.h" -#include "qt4project.h" -#include "qt4projectmanagerconstants.h" -#include "maemoglobal.h" -#include "maemopackagecreationstep.h" -#include "maemorunconfiguration.h" -#include "qt4maemodeployconfiguration.h" -#include "qt4maemotarget.h" - -#include <projectexplorer/deployconfiguration.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/customexecutablerunconfiguration.h> -#include <utils/qtcassert.h> - -using namespace Qt4ProjectManager; -using namespace Qt4ProjectManager::Internal; -using ProjectExplorer::idFromMap; - -// ------------------------------------------------------------------------- -// Qt4MaemoTargetFactory -// ------------------------------------------------------------------------- -Qt4MaemoTargetFactory::Qt4MaemoTargetFactory(QObject *parent) : - Qt4BaseTargetFactory(parent) -{ - connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>)), - this, SIGNAL(supportedTargetIdsChanged())); -} - -Qt4MaemoTargetFactory::~Qt4MaemoTargetFactory() -{ -} - -bool Qt4MaemoTargetFactory::supportsTargetId(const QString &id) const -{ - return MaemoGlobal::isMaemoTargetId(id); -} - -QStringList Qt4MaemoTargetFactory::supportedTargetIds(ProjectExplorer::Project *parent) const -{ - QStringList targetIds; - if (parent && !qobject_cast<Qt4Project *>(parent)) - return targetIds; - if (!QtSupport::QtVersionManager::instance()->versionsForTargetId(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)).isEmpty()) - targetIds << QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID); - if (!QtSupport::QtVersionManager::instance()->versionsForTargetId(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)).isEmpty()) - targetIds << QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID); - if (!QtSupport::QtVersionManager::instance()->versionsForTargetId(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)).isEmpty()) - targetIds << QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID); - return targetIds; -} - -QString Qt4MaemoTargetFactory::displayNameForId(const QString &id) const -{ - if (id == QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) - return Qt4Maemo5Target::defaultDisplayName(); - else if (id == QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)) - return Qt4HarmattanTarget::defaultDisplayName(); - else if (id == QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)) - return Qt4MeegoTarget::defaultDisplayName(); - return QString(); -} - -QIcon Qt4MaemoTargetFactory::iconForId(const QString &id) const -{ - Q_UNUSED(id) - return QIcon(":/projectexplorer/images/MaemoDevice.png"); -} - -bool Qt4MaemoTargetFactory::canCreate(ProjectExplorer::Project *parent, const QString &id) const -{ - if (!qobject_cast<Qt4Project *>(parent)) - return false; - return supportsTargetId(id); -} - -bool Qt4MaemoTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const -{ - return canCreate(parent, idFromMap(map)); -} - -ProjectExplorer::Target *Qt4MaemoTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map) -{ - if (!canRestore(parent, map)) - return 0; - - const QString id = idFromMap(map); - AbstractQt4MaemoTarget *target = 0; - Qt4Project *qt4project = static_cast<Qt4Project *>(parent); - if (id == QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) - target = new Qt4Maemo5Target(qt4project, QLatin1String("transient ID")); - else if (id == QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)) - target = new Qt4HarmattanTarget(qt4project, QLatin1String("transient ID")); - else if (id == QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)) - target = new Qt4MeegoTarget(qt4project, QLatin1String("transient ID")); - if (target->fromMap(map)) - return target; - delete target; - return 0; -} - -QString Qt4MaemoTargetFactory::buildNameForId(const QString &id) const -{ - if (id == QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) - return QLatin1String("maemo"); - else if (id == QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)) - return QLatin1String("harmattan"); - else if (id == QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)) - return QLatin1String("meego"); - else - return QString(); -} - -QString Qt4MaemoTargetFactory::shadowBuildDirectory(const QString &profilePath, const QString &id, const QString &suffix) -{ -#if defined(Q_OS_WIN) - // No shadowbuilding for windows! - Q_UNUSED(id); - Q_UNUSED(suffix); - return QFileInfo(profilePath).absolutePath(); -#else - return Qt4BaseTargetFactory::shadowBuildDirectory(profilePath, id, suffix); -#endif -} - -bool Qt4MaemoTargetFactory::isMobileTarget(const QString &id) -{ - Q_UNUSED(id) - return true; -} - -bool Qt4MaemoTargetFactory::supportsShadowBuilds(const QString &id) -{ - Q_UNUSED(id); -#ifdef Q_OS_WIN - return false; -#else - return true; -#endif -} - -ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project *parent, const QString &id) -{ - if (!canCreate(parent, id)) - return 0; - - QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id); - if (knownVersions.isEmpty()) - return 0; - - QtSupport::BaseQtVersion *qtVersion = knownVersions.first(); - QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig(); - - QList<BuildConfigurationInfo> infos; - infos.append(BuildConfigurationInfo(qtVersion, config, QString(), QString())); - infos.append(BuildConfigurationInfo(qtVersion, config ^ QtSupport::BaseQtVersion::DebugBuild, QString(), QString())); - - return create(parent, id, infos); -} - -ProjectExplorer::Target *Qt4MaemoTargetFactory::create(ProjectExplorer::Project *parent, - const QString &id, const QList<BuildConfigurationInfo> &infos) -{ - if (!canCreate(parent, id)) - return 0; - - AbstractQt4MaemoTarget *target = 0; - QStringList deployConfigIds; - if (id == QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID)) { - target = new Qt4Maemo5Target(static_cast<Qt4Project *>(parent), id); - deployConfigIds << Qt4MaemoDeployConfiguration::FremantleWithPackagingId - << Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId; - } else if (id == QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID)) { - target = new Qt4HarmattanTarget(static_cast<Qt4Project *>(parent), id); - deployConfigIds << Qt4MaemoDeployConfiguration::HarmattanId; - } else if (id == QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID)) { - target = new Qt4MeegoTarget(static_cast<Qt4Project *>(parent), id); - deployConfigIds << Qt4MaemoDeployConfiguration::MeegoId; - } - Q_ASSERT(target); - - foreach (const BuildConfigurationInfo &info, infos) - target->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(), - info.version, info.buildConfig, - info.additionalArguments, info.directory); - - foreach (const QString &deployConfigId, deployConfigIds) { - target->addDeployConfiguration(target->createDeployConfiguration(deployConfigId)); - } - target->createApplicationProFiles(); - if (target->runConfigurations().isEmpty()) - target->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(target)); - return target; -} diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h b/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h deleted file mode 100644 index 653a1a663b..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/qt4maemotargetfactory.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QT4MAEMOTARGETFACTORY_H -#define QT4MAEMOTARGETFACTORY_H - -#include "qt4basetargetfactory.h" - -namespace Qt4ProjectManager { -namespace Internal { - -class Qt4MaemoTargetFactory : public Qt4BaseTargetFactory -{ - Q_OBJECT -public: - Qt4MaemoTargetFactory(QObject *parent = 0); - ~Qt4MaemoTargetFactory(); - - QStringList supportedTargetIds(ProjectExplorer::Project *parent) const; - QString displayNameForId(const QString &id) const; - QIcon iconForId(const QString &id) const; - - bool canCreate(ProjectExplorer::Project *parent, const QString &id) const; - bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const; - ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map); - - QString shadowBuildDirectory(const QString &profilePath, const QString &id, const QString &suffix); - QString buildNameForId(const QString &id) const; - - bool supportsTargetId(const QString &id) const; - - ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id); - ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos); - - bool isMobileTarget(const QString &id); - bool supportsShadowBuilds(const QString &id); -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // QT4MAEMOTARGETFACTORY_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp index f984e15552..d082c8095e 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp @@ -117,9 +117,9 @@ void S60DeployConfiguration::ctor() setDefaultDisplayName(defaultDisplayName()); // TODO disable S60 Deploy Configuration while parsing // requires keeping track of the parsing state of the project -// connect(qt4Target()->qt4Project(), SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), +// connect(qt4Target()->qt4Project(), SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*)), // this, SLOT(targetInformationInvalidated())); - connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), + connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool)), this, SIGNAL(targetInformationChanged())); connect(qt4Target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), this, SLOT(updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*))); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h index 130fb395f9..b092d6a76f 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h @@ -46,10 +46,10 @@ class BaseQtVersion; } namespace Qt4ProjectManager { +class Qt4ProFileNode; namespace Internal { class Qt4SymbianTarget; -class Qt4ProFileNode; class S60DeployConfigurationFactory; class S60DeviceRunConfiguration; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index e1c342dcee..1c62ea7a45 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -118,10 +118,10 @@ void S60DeviceRunConfiguration::ctor() setDefaultDisplayName(tr("Run on Symbian device")); Qt4Project *pro = qt4Target()->qt4Project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool))); - connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *)), - this, SLOT(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *))); + connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool)), + this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool))); + connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *)), + this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *))); } void S60DeviceRunConfiguration::handleParserState(bool success) @@ -132,14 +132,14 @@ void S60DeviceRunConfiguration::handleParserState(bool success) emit isEnabledChanged(!enabled); } -void S60DeviceRunConfiguration::proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro) +void S60DeviceRunConfiguration::proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro) { if (m_proFilePath != pro->path()) return; handleParserState(false); } -void S60DeviceRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success) +void S60DeviceRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success) { if (m_proFilePath != pro->path()) return; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index 9484e156ea..0b72c5a8fa 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -47,11 +47,11 @@ QT_END_NAMESPACE namespace Qt4ProjectManager { class Qt4BaseTarget; +class Qt4ProFileNode; namespace Internal { class SymbianQtVersion; class Qt4SymbianTarget; -class Qt4ProFileNode; class S60DeviceRunConfigurationFactory; class CodaRunControl; @@ -97,8 +97,8 @@ protected: QString defaultDisplayName() const; virtual bool fromMap(const QVariantMap &map); private slots: - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro); - void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success); + void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro); + void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success); private: void ctor(); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp index f856e6feea..888b5f5524 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp @@ -100,10 +100,10 @@ void S60EmulatorRunConfiguration::ctor() //: S60 emulator run configuration default display name (no pro-file name) setDefaultDisplayName(tr("Run on Symbian Emulator")); Qt4Project *pro = qt4Target()->qt4Project(); - connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool))); - connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *)), - this, SLOT(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *))); + connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool)), + this, SLOT(proFileUpdate(Qt4ProjectManager::Qt4ProFileNode*,bool))); + connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *)), + this, SLOT(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *))); } @@ -120,14 +120,14 @@ void S60EmulatorRunConfiguration::handleParserState(bool success) } } -void S60EmulatorRunConfiguration::proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro) +void S60EmulatorRunConfiguration::proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro) { if (m_proFilePath != pro->path()) return; handleParserState(false); } -void S60EmulatorRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success) +void S60EmulatorRunConfiguration::proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success) { if (m_proFilePath != pro->path()) return; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h index 72cd160f22..616462d125 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.h @@ -51,10 +51,10 @@ class DetailsWidget; namespace Qt4ProjectManager { class Qt4Project; class Qt4BaseTarget; +class Qt4ProFileNode; namespace Internal { class Qt4SymbianTarget; -class Qt4ProFileNode; class S60EmulatorRunConfigurationFactory; class S60EmulatorRunConfiguration : public ProjectExplorer::RunConfiguration @@ -84,8 +84,8 @@ signals: void targetInformationChanged(); private slots: - void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success); - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro); + void proFileUpdate(Qt4ProjectManager::Qt4ProFileNode *pro, bool success); + void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *pro); protected: S60EmulatorRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60EmulatorRunConfiguration *source); diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index 8ecdbcac14..a287c15536 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -249,7 +249,7 @@ QString Qt4BuildConfiguration::buildDirectory() const /// If only a sub tree should be build this function returns which sub node /// should be build /// \see Qt4BuildConfiguration::setSubNodeBuild -Qt4ProjectManager::Internal::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const +Qt4ProjectManager::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild() const { return m_subNodeBuild; } @@ -260,7 +260,7 @@ Qt4ProjectManager::Internal::Qt4ProFileNode *Qt4BuildConfiguration::subNodeBuild /// calling BuildManager::buildProject( BuildConfiguration * ) /// and reset immediately afterwards /// That is m_subNodesBuild is set only temporarly -void Qt4BuildConfiguration::setSubNodeBuild(Qt4ProjectManager::Internal::Qt4ProFileNode *node) +void Qt4BuildConfiguration::setSubNodeBuild(Qt4ProjectManager::Qt4ProFileNode *node) { m_subNodeBuild = node; } diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.h b/src/plugins/qt4projectmanager/qt4buildconfiguration.h index f092771907..9e57e61501 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.h @@ -48,10 +48,7 @@ class QMakeStep; class MakeStep; class Qt4BaseTarget; class Qt4BuildConfigurationFactory; - -namespace Internal { class Qt4ProFileNode; -} class QT4PROJECTMANAGER_EXPORT Qt4BuildConfiguration : public ProjectExplorer::BuildConfiguration { @@ -71,8 +68,8 @@ public: QString shadowBuildDirectory() const; void setShadowBuildAndDirectory(bool shadowBuild, const QString &buildDirectory); - void setSubNodeBuild(Qt4ProjectManager::Internal::Qt4ProFileNode *node); - Qt4ProjectManager::Internal::Qt4ProFileNode *subNodeBuild() const; + void setSubNodeBuild(Qt4ProjectManager::Qt4ProFileNode *node); + Qt4ProjectManager::Qt4ProFileNode *subNodeBuild() const; // returns the qtVersion QtSupport::BaseQtVersion *qtVersion() const; @@ -166,7 +163,7 @@ private: QString m_lastEmmitedBuildDirectory; int m_qtVersionId; QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration; - Qt4ProjectManager::Internal::Qt4ProFileNode *m_subNodeBuild; + Qt4ProjectManager::Qt4ProFileNode *m_subNodeBuild; }; class QT4PROJECTMANAGER_EXPORT Qt4BuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 076d59e669..6ce6a3ee7e 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -464,7 +464,7 @@ struct InternalNode filesToRemove << *existingNodeIter; ++existingNodeIter; } else if ((*existingNodeIter)->path() > *newPathIter) { - filesToAdd << new FileNode(*newPathIter, type, false); + filesToAdd << new ProjectExplorer::FileNode(*newPathIter, type, false); ++newPathIter; } else { // *existingNodeIter->path() == *newPathIter ++existingNodeIter; @@ -476,7 +476,7 @@ struct InternalNode ++existingNodeIter; } while (newPathIter != files.constEnd()) { - filesToAdd << new FileNode(*newPathIter, type, false); + filesToAdd << new ProjectExplorer::FileNode(*newPathIter, type, false); ++newPathIter; } @@ -538,7 +538,7 @@ void Qt4PriFileNode::update(ProFile *includeFileExact, QtSupport::ProFileReader { // add project file node if (m_fileNodes.isEmpty()) - addFileNodes(QList<FileNode*>() << new FileNode(m_projectFilePath, ProjectFileType, false), this); + addFileNodes(QList<FileNode*>() << new ProjectExplorer::FileNode(m_projectFilePath, ProjectExplorer::ProjectFileType, false), this); const QString &projectDir = m_qt4ProFileNode->m_projectDir; @@ -825,7 +825,7 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c break; } - FileNode *fileNode = qobject_cast<FileNode *>(node); + ProjectExplorer::FileNode *fileNode = qobject_cast<FileNode *>(node); if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType) actions << Rename; @@ -1251,6 +1251,51 @@ QSet<QString> Qt4PriFileNode::filterFiles(ProjectExplorer::FileType fileType, co return result; } +static Qt4ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateType type) +{ + switch (type) { + case ProFileEvaluator::TT_Unknown: + case ProFileEvaluator::TT_Application: + return ApplicationTemplate; + case ProFileEvaluator::TT_Library: + return LibraryTemplate; + case ProFileEvaluator::TT_Script: + return ScriptTemplate; + case ProFileEvaluator::TT_Aux: + return AuxTemplate; + case ProFileEvaluator::TT_Subdirs: + return SubDirsTemplate; + default: + return InvalidProject; + } +} + +namespace { + // find all ui files in project + class FindUiFileNodesVisitor : public ProjectExplorer::NodesVisitor { + public: + void visitProjectNode(ProjectNode *projectNode) + { + visitFolderNode(projectNode); + } + void visitFolderNode(FolderNode *folderNode) + { + foreach (FileNode *fileNode, folderNode->fileNodes()) { + if (fileNode->fileType() == ProjectExplorer::FormType) + uiFileNodes << fileNode; + } + } + QList<FileNode*> uiFileNodes; + }; +} + +Qt4NodesWatcher::Qt4NodesWatcher(QObject *parent) + : NodesWatcher(parent) +{ +} + +} // namespace Internal + const Qt4ProFileNode *Qt4ProFileNode::findProFileFor(const QString &fileName) const { @@ -1355,7 +1400,7 @@ Qt4ProFileNode::~Qt4ProFileNode() { CPlusPlus::CppModelManagerInterface *modelManager = CPlusPlus::CppModelManagerInterface::instance(); - QMap<QString, Qt4UiCodeModelSupport *>::const_iterator it, end; + QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it, end; end = m_uiCodeModelSupport.constEnd(); for (it = m_uiCodeModelSupport.constBegin(); it != end; ++it) { modelManager->removeEditorSupport(it.value()); @@ -1408,8 +1453,8 @@ QStringList Qt4ProFileNode::variableValue(const Qt4Variable var) const void Qt4ProFileNode::emitProFileUpdated() { - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->proFileUpdated(this, m_validParse); foreach (ProjectNode *subNode, subProjectNodes()) { @@ -1421,8 +1466,8 @@ void Qt4ProFileNode::emitProFileUpdated() void Qt4ProFileNode::emitProFileInvalidated() { - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->proFileInvalidated(this); foreach (ProjectNode *subNode, subProjectNodes()) { @@ -1459,8 +1504,8 @@ void Qt4ProFileNode::update() { if (m_validParse) { m_validParse = false; - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->proFileInvalidated(this); } @@ -1507,25 +1552,6 @@ void Qt4ProFileNode::applyAsyncEvaluate() m_project->decrementPendingEvaluateFutures(); } -static Qt4ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateType type) -{ - switch (type) { - case ProFileEvaluator::TT_Unknown: - case ProFileEvaluator::TT_Application: - return ApplicationTemplate; - case ProFileEvaluator::TT_Library: - return LibraryTemplate; - case ProFileEvaluator::TT_Script: - return ScriptTemplate; - case ProFileEvaluator::TT_Aux: - return AuxTemplate; - case ProFileEvaluator::TT_Subdirs: - return SubDirsTemplate; - default: - return InvalidProject; - } -} - void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) { if (!m_readerExact) @@ -1538,8 +1564,8 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) m_project->proFileParseError(tr("Error while parsing file %1. Giving up.").arg(m_projectFilePath)); invalidate(); } - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->proFileUpdated(this, false); return; } @@ -1547,7 +1573,7 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) if (debug) qDebug() << "Qt4ProFileNode - updating files for file " << m_projectFilePath; - Qt4ProjectType projectType = proFileTemplateTypeToProjectType( + Qt4ProjectType projectType = Internal::proFileTemplateTypeToProjectType( (evalResult == EvalOk ? m_readerExact : m_readerCumulative)->templateType()); if (projectType != m_projectType) { Qt4ProjectType oldType = m_projectType; @@ -1565,8 +1591,8 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) // really emit here? or at the end? Nobody is connected to this signal at the moment // so we kind of can ignore that question for now - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->projectTypeChanged(this, oldType, projectType); } @@ -1777,8 +1803,8 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) Qt4VariablesHash oldValues = m_varValues; m_varValues = newVarValues; - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->variablesChanged(this, oldValues, m_varValues); } @@ -1789,8 +1815,8 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) m_validParse = true; - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->proFileUpdated(this, true); m_project->destroyProFileReader(m_readerExact); @@ -1800,25 +1826,6 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) m_readerCumulative = 0; } -namespace { - // find all ui files in project - class FindUiFileNodesVisitor : public ProjectExplorer::NodesVisitor { - public: - void visitProjectNode(ProjectNode *projectNode) - { - visitFolderNode(projectNode); - } - void visitFolderNode(FolderNode *folderNode) - { - foreach (FileNode *fileNode, folderNode->fileNodes()) { - if (fileNode->fileType() == ProjectExplorer::FormType) - uiFileNodes << fileNode; - } - } - QList<FileNode*> uiFileNodes; - }; -} - // This function is triggered after a build, and updates the state ui files // It does so by storing a modification time for each ui file we know about. @@ -1832,9 +1839,9 @@ QStringList Qt4ProFileNode::updateUiFiles() return QStringList(); // Find all ui files - FindUiFileNodesVisitor uiFilesVisitor; + Internal::FindUiFileNodesVisitor uiFilesVisitor; this->accept(&uiFilesVisitor); - const QList<FileNode*> uiFiles = uiFilesVisitor.uiFileNodes; + const QList<ProjectExplorer::FileNode*> uiFiles = uiFilesVisitor.uiFileNodes; // Find the UiDir, there can only ever be one QString uiDir = buildDir(); @@ -1843,8 +1850,8 @@ QStringList Qt4ProFileNode::updateUiFiles() uiDir = tmp.first(); // Collect all existing generated files - QList<FileNode*> existingFileNodes; - foreach (FileNode *file, fileNodes()) { + QList<ProjectExplorer::FileNode*> existingFileNodes; + foreach (ProjectExplorer::FileNode *file, fileNodes()) { if (file->isGenerated()) existingFileNodes << file; } @@ -1852,7 +1859,7 @@ QStringList Qt4ProFileNode::updateUiFiles() // Convert uiFile to uiHeaderFilePath, find all headers that correspond // and try to find them in uiDir QStringList newFilePaths; - foreach (FileNode *uiFile, uiFiles) { + foreach (ProjectExplorer::FileNode *uiFile, uiFiles) { const QString uiHeaderFilePath = QString("%1/ui_%2.h").arg(uiDir, QFileInfo(uiFile->path()).completeBaseName()); if (QFileInfo(uiHeaderFilePath).exists()) @@ -1860,15 +1867,15 @@ QStringList Qt4ProFileNode::updateUiFiles() } // Create a diff between those lists - QList<FileNode*> toRemove; - QList<FileNode*> toAdd; + QList<ProjectExplorer::FileNode*> toRemove; + QList<ProjectExplorer::FileNode*> toAdd; // The list of files for which we call updateSourceFile QStringList toUpdate; qSort(newFilePaths); qSort(existingFileNodes.begin(), existingFileNodes.end(), ProjectNode::sortNodesByPath); - QList<FileNode*>::const_iterator existingNodeIter = existingFileNodes.constBegin(); + QList<ProjectExplorer::FileNode*>::const_iterator existingNodeIter = existingFileNodes.constBegin(); QList<QString>::const_iterator newPathIter = newFilePaths.constBegin(); while (existingNodeIter != existingFileNodes.constEnd() && newPathIter != newFilePaths.constEnd()) { @@ -1876,7 +1883,7 @@ QStringList Qt4ProFileNode::updateUiFiles() toRemove << *existingNodeIter; ++existingNodeIter; } else if ((*existingNodeIter)->path() > *newPathIter) { - toAdd << new FileNode(*newPathIter, ProjectExplorer::HeaderType, true); + toAdd << new ProjectExplorer::FileNode(*newPathIter, ProjectExplorer::HeaderType, true); ++newPathIter; } else { // *existingNodeIter->path() == *newPathIter QString fileName = (*existingNodeIter)->path(); @@ -1895,13 +1902,13 @@ QStringList Qt4ProFileNode::updateUiFiles() ++existingNodeIter; } while (newPathIter != newFilePaths.constEnd()) { - toAdd << new FileNode(*newPathIter, ProjectExplorer::HeaderType, true); + toAdd << new ProjectExplorer::FileNode(*newPathIter, ProjectExplorer::HeaderType, true); ++newPathIter; } // Update project tree if (!toRemove.isEmpty()) { - foreach (FileNode *file, toRemove) + foreach (ProjectExplorer::FileNode *file, toRemove) m_uitimestamps.remove(file->path()); removeFileNodes(toRemove, this); } @@ -1910,7 +1917,7 @@ QStringList Qt4ProFileNode::updateUiFiles() CPlusPlus::CppModelManagerInterface::instance(); if (!toAdd.isEmpty()) { - foreach (FileNode *file, toAdd) { + foreach (ProjectExplorer::FileNode *file, toAdd) { m_uitimestamps.insert(file->path(), QFileInfo(file->path()).lastModified()); toUpdate << file->path(); @@ -2216,15 +2223,15 @@ void Qt4ProFileNode::invalidate() m_projectType = InvalidProject; - foreach (NodesWatcher *watcher, watchers()) - if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher)) + foreach (ProjectExplorer::NodesWatcher *watcher, watchers()) + if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher)) emit qt4Watcher->projectTypeChanged(this, oldType, InvalidProject); } void Qt4ProFileNode::updateCodeModelSupportFromBuild(const QStringList &files) { foreach (const QString &file, files) { - QMap<QString, Qt4UiCodeModelSupport *>::const_iterator it, end; + QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it, end; end = m_uiCodeModelSupport.constEnd(); for (it = m_uiCodeModelSupport.constBegin(); it != end; ++it) { if (it.value()->fileName() == file) @@ -2236,7 +2243,7 @@ void Qt4ProFileNode::updateCodeModelSupportFromBuild(const QStringList &files) void Qt4ProFileNode::updateCodeModelSupportFromEditor(const QString &uiFileName, const QString &contents) { - const QMap<QString, Qt4UiCodeModelSupport *>::const_iterator it = + const QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it = m_uiCodeModelSupport.constFind(uiFileName); if (it != m_uiCodeModelSupport.constEnd()) it.value()->updateFromEditor(contents); @@ -2269,39 +2276,39 @@ void Qt4ProFileNode::createUiCodeModelSupport() = CPlusPlus::CppModelManagerInterface::instance(); // First move all to - QMap<QString, Qt4UiCodeModelSupport *> oldCodeModelSupport; + QMap<QString, Internal::Qt4UiCodeModelSupport *> oldCodeModelSupport; oldCodeModelSupport = m_uiCodeModelSupport; m_uiCodeModelSupport.clear(); // Only those two project types can have ui files for us if (m_projectType == ApplicationTemplate || m_projectType == LibraryTemplate) { // Find all ui files - FindUiFileNodesVisitor uiFilesVisitor; + Internal::FindUiFileNodesVisitor uiFilesVisitor; this->accept(&uiFilesVisitor); - const QList<FileNode*> uiFiles = uiFilesVisitor.uiFileNodes; + const QList<ProjectExplorer::FileNode*> uiFiles = uiFilesVisitor.uiFileNodes; // Find the UiDir, there can only ever be one const QString uiDir = uiDirectory(); - foreach (const FileNode *uiFile, uiFiles) { + foreach (const ProjectExplorer::FileNode *uiFile, uiFiles) { const QString uiHeaderFilePath = uiHeaderFile(uiDir, uiFile->path()); // qDebug()<<"code model support for "<<uiFile->path()<<" "<<uiHeaderFilePath; - QMap<QString, Qt4UiCodeModelSupport *>::iterator it = oldCodeModelSupport.find(uiFile->path()); + QMap<QString, Internal::Qt4UiCodeModelSupport *>::iterator it = oldCodeModelSupport.find(uiFile->path()); if (it != oldCodeModelSupport.end()) { // qDebug()<<"updated old codemodelsupport"; - Qt4UiCodeModelSupport *cms = it.value(); + Internal::Qt4UiCodeModelSupport *cms = it.value(); cms->setFileName(uiHeaderFilePath); m_uiCodeModelSupport.insert(it.key(), cms); oldCodeModelSupport.erase(it); } else { // qDebug()<<"adding new codemodelsupport"; - Qt4UiCodeModelSupport *cms = new Qt4UiCodeModelSupport(modelManager, m_project, uiFile->path(), uiHeaderFilePath); + Internal::Qt4UiCodeModelSupport *cms = new Internal::Qt4UiCodeModelSupport(modelManager, m_project, uiFile->path(), uiHeaderFilePath); m_uiCodeModelSupport.insert(uiFile->path(), cms); modelManager->addEditorSupport(cms); } } } // Remove old - QMap<QString, Qt4UiCodeModelSupport *>::const_iterator it, end; + QMap<QString, Internal::Qt4UiCodeModelSupport *>::const_iterator it, end; end = oldCodeModelSupport.constEnd(); for (it = oldCodeModelSupport.constBegin(); it!=end; ++it) { modelManager->removeEditorSupport(it.value()); @@ -2309,10 +2316,4 @@ void Qt4ProFileNode::createUiCodeModelSupport() } } -Qt4NodesWatcher::Qt4NodesWatcher(QObject *parent) - : NodesWatcher(parent) -{ -} - -} // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index d49452a05e..492b38eb0c 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -62,29 +62,9 @@ class ProFileReader; namespace Qt4ProjectManager { -// Import base classes into namespace -using ProjectExplorer::Node; -using ProjectExplorer::FileNode; -using ProjectExplorer::FolderNode; -using ProjectExplorer::ProjectNode; -using ProjectExplorer::NodesWatcher; - -// Import enums into namespace -using ProjectExplorer::NodeType; -using ProjectExplorer::FileNodeType; -using ProjectExplorer::FolderNodeType; -using ProjectExplorer::ProjectNodeType; - -using ProjectExplorer::UnknownFileType; -using ProjectExplorer::ProjectFileType; - +class Qt4ProFileNode; class Qt4Project; -namespace Internal { - -using ProjectExplorer::FileType; -class Qt4UiCodeModelSupport; - // Type of projects enum Qt4ProjectType { InvalidProject = 0, @@ -110,32 +90,29 @@ enum Qt4Variable { SymbianCapabilities }; -class Qt4PriFileNode; -class Qt4ProFileNode; +namespace Internal { -class Qt4PriFile : public Core::IFile -{ - Q_OBJECT -public: - Qt4PriFile(Qt4PriFileNode *qt4PriFile); - virtual bool save(QString *errorString, const QString &fileName, bool autoSave); - virtual QString fileName() const; - virtual void rename(const QString &newName); +// Import base classes into namespace +using ProjectExplorer::Node; +using ProjectExplorer::FileNode; +using ProjectExplorer::FolderNode; +using ProjectExplorer::ProjectNode; +using ProjectExplorer::NodesWatcher; - virtual QString defaultPath() const; - virtual QString suggestedFileName() const; - virtual QString mimeType() const; +// Import enums into namespace +using ProjectExplorer::NodeType; +using ProjectExplorer::FileNodeType; +using ProjectExplorer::FolderNodeType; +using ProjectExplorer::ProjectNodeType; - virtual bool isModified() const; - virtual bool isReadOnly() const; - virtual bool isSaveAsAllowed() const; +using ProjectExplorer::UnknownFileType; +using ProjectExplorer::ProjectFileType; - ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; - bool reload(QString *errorString, ReloadFlag flag, ChangeType type); +using ProjectExplorer::FileType; -private: - Qt4PriFileNode *m_priFile; -}; +class Qt4UiCodeModelSupport; +class ProFileReader; +class Qt4PriFile; // Implements ProjectNode for qt4 pro files class Qt4PriFileNode : public ProjectExplorer::ProjectNode @@ -210,7 +187,7 @@ private: QString m_projectDir; QMap<QString, Qt4UiCodeModelSupport *> m_uiCodeModelSupport; - Qt4PriFile *m_qt4PriFile; + Internal::Qt4PriFile *m_qt4PriFile; // Memory is cheap... // TODO (really that cheap?) @@ -219,13 +196,64 @@ private: QSet<QString> m_watchedFolders; // managed by Qt4ProFileNode - friend class Qt4ProFileNode; + friend class Qt4ProjectManager::Qt4ProFileNode; friend class Qt4PriFile; // for scheduling updates on modified // internal temporary subtree representation friend struct InternalNode; }; -struct TargetInformation +class Qt4PriFile : public Core::IFile +{ + Q_OBJECT +public: + Qt4PriFile(Qt4PriFileNode *qt4PriFile); + virtual bool save(QString *errorString, const QString &fileName, bool autoSave); + virtual QString fileName() const; + virtual void rename(const QString &newName); + + virtual QString defaultPath() const; + virtual QString suggestedFileName() const; + virtual QString mimeType() const; + + virtual bool isModified() const; + virtual bool isReadOnly() const; + virtual bool isSaveAsAllowed() const; + + ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; + bool reload(QString *errorString, ReloadFlag flag, ChangeType type); + +private: + Qt4PriFileNode *m_priFile; +}; + +class Qt4NodesWatcher : public ProjectExplorer::NodesWatcher +{ + Q_OBJECT + Q_DISABLE_COPY(Qt4NodesWatcher) +public: + Qt4NodesWatcher(QObject *parent = 0); + +signals: + void projectTypeChanged(Qt4ProjectManager::Qt4ProFileNode *projectNode, + const Qt4ProjectManager::Qt4ProjectType oldType, + const Qt4ProjectManager::Qt4ProjectType newType); + + void variablesChanged(Qt4ProFileNode *projectNode, + const QHash<Qt4Variable, QStringList> &oldValues, + const QHash<Qt4Variable, QStringList> &newValues); + + void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *projectNode, bool success); + void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *projectNode); + +private: + // let them emit signals + friend class Qt4ProjectManager::Qt4ProFileNode; + friend class Qt4PriFileNode; +}; + +} // namespace Internal + +struct QT4PROJECTMANAGER_EXPORT TargetInformation { bool valid; QString workingDir; @@ -260,26 +288,26 @@ struct TargetInformation }; -struct InstallsItem { +struct QT4PROJECTMANAGER_EXPORT InstallsItem { InstallsItem(QString p, QStringList f) : path(p), files(f) {} QString path; QStringList files; }; -struct InstallsList { +struct QT4PROJECTMANAGER_EXPORT InstallsList { void clear() { targetPath.clear(); items.clear(); } QString targetPath; QList<InstallsItem> items; }; -struct ProjectVersion { +struct QT4PROJECTMANAGER_EXPORT ProjectVersion { int major; int minor; int patch; }; // Implements ProjectNode for qt4 pro files -class Qt4ProFileNode : public Qt4PriFileNode +class QT4PROJECTMANAGER_EXPORT Qt4ProFileNode : public Internal::Qt4PriFileNode { Q_OBJECT Q_DISABLE_COPY(Qt4ProFileNode) @@ -375,32 +403,6 @@ private: QtSupport::ProFileReader *m_readerCumulative; }; -class Qt4NodesWatcher : public ProjectExplorer::NodesWatcher -{ - Q_OBJECT - Q_DISABLE_COPY(Qt4NodesWatcher) -public: - Qt4NodesWatcher(QObject *parent = 0); - -signals: - void projectTypeChanged(Qt4ProjectManager::Internal::Qt4ProFileNode *projectNode, - const Qt4ProjectManager::Internal::Qt4ProjectType oldType, - const Qt4ProjectManager::Internal::Qt4ProjectType newType); - - void variablesChanged(Qt4ProFileNode *projectNode, - const QHash<Qt4Variable, QStringList> &oldValues, - const QHash<Qt4Variable, QStringList> &newValues); - - void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *projectNode, bool success); - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *projectNode); - -private: - // let them emit signals - friend class Qt4ProFileNode; - friend class Qt4PriFileNode; -}; - -} // namespace Internal } // namespace Qt4ProjectManager #endif // QT4NODES_H diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 99500ee7d5..f4f68ba9a8 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -338,11 +338,11 @@ bool Qt4Project::fromMap(const QVariantMap &map) foreach (Target *t, targets()) onAddedTarget(t); - connect(m_nodesWatcher, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)), - this, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *,bool))); + connect(m_nodesWatcher, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode*,bool)), + this, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *,bool))); - connect(m_nodesWatcher, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), - this, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode*))); + connect(m_nodesWatcher, SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*)), + this, SIGNAL(proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode*))); // Now we emit update once :) m_rootProjectNode->emitProFileUpdated(); @@ -616,7 +616,7 @@ void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node) // Add the node m_asyncUpdateState = AsyncPartialUpdatePending; - QList<Internal::Qt4ProFileNode *>::iterator it; + QList<Qt4ProFileNode *>::iterator it; bool add = true; if (debug) qDebug()<<"scheduleAsyncUpdate();"<<m_partialEvaluate.size()<<"nodes"; @@ -954,8 +954,8 @@ void Qt4Project::collectAllfProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNo void Qt4Project::collectApplicationProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node) { - if (node->projectType() == Internal::ApplicationTemplate - || node->projectType() == Internal::ScriptTemplate) { + if (node->projectType() == ApplicationTemplate + || node->projectType() == ScriptTemplate) { list.append(node); } foreach (ProjectNode *n, node->subProjectNodes()) { diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index b68489e9c6..c9a5f02036 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -56,11 +56,11 @@ class ProFileReader; } namespace Qt4ProjectManager { +class Qt4ProFileNode; namespace Internal { class DeployHelperRunStep; class FileItem; - class Qt4ProFileNode; class Qt4PriFileNode; class GCCPreprocessor; struct Qt4ProjectFiles; @@ -153,7 +153,7 @@ public: QList<Core::IFile *> dependencies(); //NBS remove QList<ProjectExplorer::Project *>dependsOn(); - Internal::Qt4ProFileNode *rootProjectNode() const; + Qt4ProFileNode *rootProjectNode() const; bool validParse(const QString &proFilePath) const; virtual QStringList files(FilesMode fileMode) const; @@ -161,20 +161,20 @@ public: QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); - QList<Internal::Qt4ProFileNode *> allProFiles() const; - QList<Internal::Qt4ProFileNode *> applicationProFiles() const; + QList<Qt4ProFileNode *> allProFiles() const; + QList<Qt4ProFileNode *> applicationProFiles() const; bool hasApplicationProFile(const QString &path) const; QStringList applicationProFilePathes(const QString &prepend = QString()) const; void notifyChanged(const QString &name); /// \internal - QtSupport::ProFileReader *createProFileReader(Internal::Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0); + QtSupport::ProFileReader *createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0); /// \internal void destroyProFileReader(QtSupport::ProFileReader *reader); /// \internal - void scheduleAsyncUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *node); + void scheduleAsyncUpdate(Qt4ProjectManager::Qt4ProFileNode *node); /// \internal void incrementPendingEvaluateFutures(); /// \internal @@ -188,8 +188,8 @@ public: void updateFileList(); signals: - void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *node, bool); - void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *node); + void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool); + void proFileInvalidated(Qt4ProjectManager::Qt4ProFileNode *node); void buildDirectoryInitialized(); void fromMapFinished(); @@ -216,9 +216,9 @@ private: void updateQmlJSCodeModel(); - static void collectAllfProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node); - static void collectApplicationProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node); - static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list); + static void collectAllfProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node); + static void collectApplicationProFiles(QList<Qt4ProFileNode *> &list, Qt4ProFileNode *node); + static void findProFile(const QString& fileName, Qt4ProFileNode *root, QList<Qt4ProFileNode *> &list); static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path); static bool equalFileList(const QStringList &a, const QStringList &b); @@ -228,7 +228,7 @@ private: static QString qmakeVarName(ProjectExplorer::FileType type); Qt4Manager *m_manager; - Internal::Qt4ProFileNode *m_rootProjectNode; + Qt4ProFileNode *m_rootProjectNode; Internal::Qt4NodesWatcher *m_nodesWatcher; Qt4ProjectFile *m_fileInfo; @@ -250,7 +250,7 @@ private: enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown }; AsyncUpdateState m_asyncUpdateState; bool m_cancelEvaluate; - QList<Internal::Qt4ProFileNode *> m_partialEvaluate; + QList<Qt4ProFileNode *> m_partialEvaluate; QFuture<void> m_codeModelFuture; diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index d024c25456..7ddf9058c7 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -148,7 +148,6 @@ RESOURCES += qt4projectmanager.qrc \ wizards/wizards.qrc include(qt-s60/qt-s60.pri) -include(qt-maemo/qt-maemo.pri) include(qt-desktop/qt-desktop.pri) include(customwidgetwizard/customwidgetwizard.pri) diff --git a/src/plugins/qt4projectmanager/qt4projectmanager_dependencies.pri b/src/plugins/qt4projectmanager/qt4projectmanager_dependencies.pri index c8d67d0716..377b45fee9 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager_dependencies.pri +++ b/src/plugins/qt4projectmanager/qt4projectmanager_dependencies.pri @@ -2,6 +2,5 @@ include(../../plugins/projectexplorer/projectexplorer.pri) include(../../plugins/qtsupport/qtsupport.pri) include(../../plugins/cpptools/cpptools.pri) include(../../plugins/debugger/debugger.pri) -include(../../plugins/analyzerbase/analyzerbase.pri) include(../../libs/symbianutils/symbianutils.pri) include(../../libs/qmljs/qmljs.pri) diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index ecf90f46da..83ea47b64c 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -53,7 +53,6 @@ #include "gettingstartedwelcomepage.h" #include "profilecompletionassist.h" -#include "qt-maemo/maemomanager.h" #include "qt-s60/s60manager.h" #include "qt-desktop/qt4desktoptargetfactory.h" #include "qt-desktop/qt4simulatortargetfactory.h" @@ -160,7 +159,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * addAutoReleasedObject(new LinguistExternalEditor); addAutoReleasedObject(new S60Manager); - addAutoReleasedObject(new MaemoManager); addAutoReleasedObject(new Qt4DesktopTargetFactory); addAutoReleasedObject(new Qt4SimulatorTargetFactory); diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 413f4beee6..630d962af1 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -52,11 +52,15 @@ #include <utils/pathchooser.h> #include <utils/detailswidget.h> +#include <QtCore/QCoreApplication> #include <QtGui/QPushButton> #include <QtGui/QMessageBox> #include <QtGui/QCheckBox> #include <QtGui/QComboBox> +#include <QtGui/QHBoxLayout> +#include <QtGui/QLabel> #include <QtGui/QMainWindow> +#include <QtGui/QVBoxLayout> #include <algorithm> diff --git a/src/plugins/qt4projectmanager/qt4target.h b/src/plugins/qt4projectmanager/qt4target.h index 5ff753d548..545593b1d3 100644 --- a/src/plugins/qt4projectmanager/qt4target.h +++ b/src/plugins/qt4projectmanager/qt4target.h @@ -58,10 +58,7 @@ QT_END_NAMESPACE namespace Qt4ProjectManager { class Qt4Project; class Qt4BaseTargetFactory; - -namespace Internal { class Qt4ProFileNode; -} class QT4PROJECTMANAGER_EXPORT Qt4BaseTarget : public ProjectExplorer::Target { |