forked from qt-creator/qt-creator
Maemo: Refactor device configurations list.
This commit is contained in:
@@ -49,7 +49,8 @@ using namespace Core;
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig &config, QWidget *parent)
|
||||
MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig::ConstPtr &config,
|
||||
QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui_MaemoConfigTestDialog)
|
||||
, m_config(config)
|
||||
@@ -82,7 +83,7 @@ void MaemoConfigTestDialog::startConfigTest()
|
||||
m_currentTest = GeneralTest;
|
||||
m_ui->testResultEdit->setPlainText(tr("Testing configuration..."));
|
||||
m_closeButton->setText(tr("Stop Test"));
|
||||
m_testProcessRunner = SshRemoteProcessRunner::create(m_config.server);
|
||||
m_testProcessRunner = SshRemoteProcessRunner::create(m_config->sshParameters());
|
||||
connect(m_testProcessRunner.data(), SIGNAL(connectionError(Core::SshError)),
|
||||
this, SLOT(handleConnectionError()));
|
||||
connect(m_testProcessRunner.data(), SIGNAL(processClosed(int)), this,
|
||||
@@ -103,7 +104,7 @@ void MaemoConfigTestDialog::handleConnectionError()
|
||||
return;
|
||||
QString output = tr("Could not connect to host: %1")
|
||||
.arg(m_testProcessRunner->connection()->errorString());
|
||||
if (m_config.type == MaemoDeviceConfig::Simulator)
|
||||
if (m_config->type() == MaemoDeviceConfig::Simulator)
|
||||
output += tr("\nDid you start Qemu?");
|
||||
m_ui->testResultEdit->setPlainText(output);
|
||||
stopConfigTest();
|
||||
@@ -157,9 +158,9 @@ void MaemoConfigTestDialog::handleMadDeveloperTestResult(int exitStatus)
|
||||
+ QLatin1String("<br>") + tr("Mad Developer is not installed.<br>"
|
||||
"You will not be able to deploy to this device."));
|
||||
}
|
||||
if (m_config.freePorts().hasMore())
|
||||
if (m_config->freePorts().hasMore())
|
||||
m_portsGatherer->start(m_testProcessRunner->connection(),
|
||||
m_config.freePorts());
|
||||
m_config->freePorts());
|
||||
else
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ class MaemoConfigTestDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MaemoConfigTestDialog(const MaemoDeviceConfig &config, QWidget *parent = 0);
|
||||
explicit MaemoConfigTestDialog(const QSharedPointer<const MaemoDeviceConfig> &config,
|
||||
QWidget *parent = 0);
|
||||
~MaemoConfigTestDialog();
|
||||
|
||||
private slots:
|
||||
@@ -81,7 +82,7 @@ private:
|
||||
Ui_MaemoConfigTestDialog *m_ui;
|
||||
QPushButton *m_closeButton;
|
||||
|
||||
const MaemoDeviceConfig &m_config;
|
||||
const QSharedPointer<const MaemoDeviceConfig> m_config;
|
||||
QSharedPointer<Core::SshRemoteProcessRunner> m_testProcessRunner;
|
||||
QString m_deviceTestOutput;
|
||||
bool m_qtVersionOk;
|
||||
|
||||
@@ -63,12 +63,12 @@ namespace Internal {
|
||||
RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runConfig)
|
||||
{
|
||||
DebuggerStartParameters params;
|
||||
const MaemoDeviceConfig &devConf = runConfig->deviceConfig();
|
||||
const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig();
|
||||
|
||||
const MaemoRunConfiguration::DebuggingType debuggingType
|
||||
= runConfig->debuggingType();
|
||||
if (debuggingType != MaemoRunConfiguration::DebugCppOnly) {
|
||||
params.qmlServerAddress = runConfig->deviceConfig().server.host;
|
||||
params.qmlServerAddress = runConfig->deviceConfig()->sshParameters().host;
|
||||
params.qmlServerPort = -1;
|
||||
}
|
||||
if (debuggingType != MaemoRunConfiguration::DebugQmlOnly) {
|
||||
@@ -85,7 +85,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
||||
= MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
|
||||
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges())
|
||||
+ QLatin1String(" /usr/bin/gdb");
|
||||
params.connParams = devConf.server;
|
||||
params.connParams = devConf->sshParameters();
|
||||
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
|
||||
params.remoteMountPoint
|
||||
= runConfig->remoteProjectSourcesMountPoint();
|
||||
@@ -99,7 +99,8 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
||||
params.startMode = AttachToRemote;
|
||||
params.executable = runConfig->localExecutableFilePath();
|
||||
params.debuggerCommand = runConfig->gdbCmd();
|
||||
params.remoteChannel = devConf.server.host + QLatin1String(":-1");
|
||||
params.remoteChannel
|
||||
= devConf->sshParameters().host + QLatin1String(":-1");
|
||||
params.useServerStartScript = true;
|
||||
params.remoteArchitecture = QLatin1String("arm");
|
||||
params.gnuTarget = QLatin1String("arm-none-linux-gnueabi");
|
||||
@@ -122,6 +123,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
||||
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_dumperLib(runConfig->dumperLib()),
|
||||
@@ -189,8 +191,8 @@ void MaemoDebugSupport::startExecution()
|
||||
if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly
|
||||
&& !m_dumperLib.isEmpty()
|
||||
&& m_runConfig
|
||||
&& m_runConfig->deployStep()->currentlyNeedsDeployment(m_runner->deviceConfig().server.host,
|
||||
MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig())))) {
|
||||
&& m_runConfig->deployStep()->currentlyNeedsDeployment(m_deviceConfig->sshParameters().host,
|
||||
MaemoDeployable(m_dumperLib, uploadDir(m_deviceConfig)))) {
|
||||
setState(InitializingUploader);
|
||||
m_uploader = m_runner->connection()->createSftpChannel();
|
||||
connect(m_uploader.data(), SIGNAL(initialized()), this,
|
||||
@@ -214,8 +216,8 @@ void MaemoDebugSupport::handleSftpChannelInitialized()
|
||||
ASSERT_STATE(InitializingUploader);
|
||||
|
||||
const QString fileName = QFileInfo(m_dumperLib).fileName();
|
||||
const QString remoteFilePath
|
||||
= uploadDir(m_runner->deviceConfig()) + '/' + fileName;
|
||||
const QString remoteFilePath = uploadDir(m_deviceConfig)
|
||||
+ QLatin1Char('/') + fileName;
|
||||
m_uploadJob = m_uploader->uploadFile(m_dumperLib, remoteFilePath,
|
||||
SftpOverwriteExisting);
|
||||
if (m_uploadJob == SftpInvalidJob) {
|
||||
@@ -255,8 +257,8 @@ void MaemoDebugSupport::handleSftpJobFinished(Core::SftpJobId job,
|
||||
} else {
|
||||
setState(DumpersUploaded);
|
||||
if (m_runConfig) {
|
||||
m_runConfig->deployStep()->setDeployed(m_runner->deviceConfig().server.host,
|
||||
MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig())));
|
||||
m_runConfig->deployStep()->setDeployed(m_deviceConfig->sshParameters().host,
|
||||
MaemoDeployable(m_dumperLib, uploadDir(m_deviceConfig)));
|
||||
}
|
||||
showMessage(tr("Finished uploading debugging helpers."), AppStuff);
|
||||
startDebugging();
|
||||
@@ -356,9 +358,9 @@ void MaemoDebugSupport::setState(State newState)
|
||||
}
|
||||
}
|
||||
|
||||
QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig &devConf)
|
||||
QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig::ConstPtr &devConf)
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(devConf.server.uname);
|
||||
return MaemoGlobal::homeDirOnDevice(devConf->sshParameters().uname);
|
||||
}
|
||||
|
||||
bool MaemoDebugSupport::useGdb() const
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace ProjectExplorer { class RunControl; }
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class MaemoDeviceConfig;
|
||||
class MaemoRunConfiguration;
|
||||
class MaemoSshRunner;
|
||||
|
||||
@@ -68,7 +69,7 @@ public:
|
||||
Debugger::DebuggerEngine *engine, bool useGdb);
|
||||
~MaemoDebugSupport();
|
||||
|
||||
static QString uploadDir(const MaemoDeviceConfig &devConf);
|
||||
static QString uploadDir(const QSharedPointer<const MaemoDeviceConfig> &devConf);
|
||||
|
||||
private slots:
|
||||
void handleAdapterSetupRequested();
|
||||
@@ -98,6 +99,7 @@ private:
|
||||
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 QString m_dumperLib;
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "maemoconstants.h"
|
||||
#include "maemodeploystepwidget.h"
|
||||
#include "maemodeviceconfiglistmodel.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemopackagecreationstep.h"
|
||||
#include "maemoremotemounter.h"
|
||||
@@ -108,7 +107,6 @@ void MaemoDeployStep::ctor()
|
||||
|
||||
m_state = Inactive;
|
||||
m_needsInstall = false;
|
||||
m_deviceConfigModel = new MaemoDeviceConfigListModel(this);
|
||||
m_sysrootInstaller = new QProcess(this);
|
||||
connect(m_sysrootInstaller, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(handleSysrootInstallerFinished()));
|
||||
@@ -130,6 +128,8 @@ void MaemoDeployStep::ctor()
|
||||
SLOT(handlePortsGathererError(QString)));
|
||||
connect(m_portsGatherer, SIGNAL(portListReady()), this,
|
||||
SLOT(handlePortListReady()));
|
||||
connect(MaemoDeviceConfigurations::instance(), SIGNAL(updated()),
|
||||
SLOT(handleDeviceConfigurationsUpdated()));
|
||||
}
|
||||
|
||||
bool MaemoDeployStep::init()
|
||||
@@ -155,7 +155,8 @@ QVariantMap MaemoDeployStep::toMap() const
|
||||
QVariantMap map(BuildStep::toMap());
|
||||
addDeployTimesToMap(map);
|
||||
map.insert(DeployToSysrootKey, m_deployToSysroot);
|
||||
map.unite(m_deviceConfigModel->toMap());
|
||||
map.insert(DeviceIdKey,
|
||||
MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ bool MaemoDeployStep::fromMap(const QVariantMap &map)
|
||||
if (!BuildStep::fromMap(map))
|
||||
return false;
|
||||
getDeployTimesFromMap(map);
|
||||
m_deviceConfigModel->fromMap(map);
|
||||
setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong());
|
||||
m_deployToSysroot = map.value(DeployToSysrootKey, true).toBool();
|
||||
return true;
|
||||
}
|
||||
@@ -292,9 +293,23 @@ void MaemoDeployStep::setDeployed(const QString &host,
|
||||
QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
MaemoDeviceConfig MaemoDeployStep::deviceConfig() const
|
||||
void MaemoDeployStep::handleDeviceConfigurationsUpdated()
|
||||
{
|
||||
return deviceConfigModel()->current();
|
||||
setDeviceConfig(MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
||||
}
|
||||
|
||||
void MaemoDeployStep::setDeviceConfig(MaemoDeviceConfig::Id internalId)
|
||||
{
|
||||
m_deviceConfig = MaemoDeviceConfigurations::instance()->find(internalId);
|
||||
if (!m_deviceConfig && MaemoDeviceConfigurations::instance()->rowCount() > 0)
|
||||
m_deviceConfig = MaemoDeviceConfigurations::instance()->deviceAt(0);
|
||||
emit deviceConfigChanged();
|
||||
}
|
||||
|
||||
void MaemoDeployStep::setDeviceConfig(int i)
|
||||
{
|
||||
m_deviceConfig = MaemoDeviceConfigurations::instance()->deviceAt(i);
|
||||
emit deviceConfigChanged();
|
||||
}
|
||||
|
||||
void MaemoDeployStep::start()
|
||||
@@ -305,7 +320,8 @@ void MaemoDeployStep::start()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!deviceConfig().isValid()) {
|
||||
m_cachedDeviceConfig = m_deviceConfig;
|
||||
if (!m_cachedDeviceConfig) {
|
||||
raiseError(tr("Deployment failed: No valid device set."));
|
||||
emit done();
|
||||
return;
|
||||
@@ -315,7 +331,7 @@ void MaemoDeployStep::start()
|
||||
Q_ASSERT(!m_needsInstall);
|
||||
Q_ASSERT(m_filesToCopy.isEmpty());
|
||||
const MaemoPackageCreationStep * const pStep = packagingStep();
|
||||
const QString hostName = deviceConfig().server.host;
|
||||
const QString hostName = m_cachedDeviceConfig->sshParameters().host;
|
||||
if (pStep->isPackagingEnabled()) {
|
||||
const MaemoDeployable d(pStep->packageFilePath(), QString());
|
||||
if (currentlyNeedsDeployment(hostName, d))
|
||||
@@ -346,7 +362,7 @@ void MaemoDeployStep::handleConnectionFailure()
|
||||
return;
|
||||
|
||||
const QString errorMsg = m_state == Connecting
|
||||
? MaemoGlobal::failedToConnectToServerMessage(m_connection, deviceConfig())
|
||||
? MaemoGlobal::failedToConnectToServerMessage(m_connection, m_cachedDeviceConfig)
|
||||
: tr("Connection error: %1").arg(m_connection->errorString());
|
||||
raiseError(errorMsg);
|
||||
setState(Inactive);
|
||||
@@ -469,7 +485,7 @@ void MaemoDeployStep::handleUnmounted()
|
||||
}
|
||||
case UnmountingCurrentDirs:
|
||||
setState(GatheringPorts);
|
||||
m_portsGatherer->start(m_connection, deviceConfig().freePorts());
|
||||
m_portsGatherer->start(m_connection, m_cachedDeviceConfig->freePorts());
|
||||
break;
|
||||
case UnmountingCurrentMounts:
|
||||
writeOutput(tr("Deployment finished."));
|
||||
@@ -648,7 +664,7 @@ void MaemoDeployStep::connectToDevice()
|
||||
|
||||
const bool canReUse = m_connection
|
||||
&& m_connection->state() == SshConnection::Connected
|
||||
&& m_connection->connectionParameters() == deviceConfig().server;
|
||||
&& m_connection->connectionParameters() == m_cachedDeviceConfig->sshParameters();
|
||||
if (!canReUse)
|
||||
m_connection = SshConnection::create();
|
||||
connect(m_connection.data(), SIGNAL(connected()), this,
|
||||
@@ -659,7 +675,7 @@ void MaemoDeployStep::connectToDevice()
|
||||
handleConnected();
|
||||
} else {
|
||||
writeOutput(tr("Connecting to device..."));
|
||||
m_connection->connectToHost(deviceConfig().server);
|
||||
m_connection->connectToHost(m_cachedDeviceConfig->sshParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,7 +805,7 @@ void MaemoDeployStep::handleCopyProcessFinished(int exitStatus)
|
||||
|
||||
QString MaemoDeployStep::deployMountPoint() const
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname)
|
||||
return MaemoGlobal::homeDirOnDevice(m_cachedDeviceConfig->sshParameters().uname)
|
||||
+ QLatin1String("/deployMountPoint_") + packagingStep()->projectName();
|
||||
}
|
||||
|
||||
@@ -874,7 +890,7 @@ void MaemoDeployStep::handlePortListReady()
|
||||
|
||||
if (m_state == GatheringPorts) {
|
||||
setState(Mounting);
|
||||
m_freePorts = deviceConfig().freePorts();
|
||||
m_freePorts = m_cachedDeviceConfig->freePorts();
|
||||
m_mounter->mount(&m_freePorts, m_portsGatherer);
|
||||
} else {
|
||||
setState(Inactive);
|
||||
|
||||
@@ -63,7 +63,7 @@ class SshRemoteProcess;
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
class MaemoRemoteMounter;
|
||||
class MaemoDeviceConfigListModel;
|
||||
class MaemoDeviceConfig;
|
||||
class MaemoPackageCreationStep;
|
||||
class MaemoToolChain;
|
||||
class MaemoUsedPortsGatherer;
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
MaemoDeployStep(ProjectExplorer::BuildStepList *bc);
|
||||
|
||||
virtual ~MaemoDeployStep();
|
||||
MaemoDeviceConfig deviceConfig() const;
|
||||
MaemoDeviceConfigListModel *deviceConfigModel() const { return m_deviceConfigModel; }
|
||||
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; }
|
||||
void setDeviceConfig(int i);
|
||||
bool currentlyNeedsDeployment(const QString &host,
|
||||
const MaemoDeployable &deployable) const;
|
||||
void setDeployed(const QString &host, const MaemoDeployable &deployable);
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
signals:
|
||||
void done();
|
||||
void error();
|
||||
void deviceConfigChanged();
|
||||
|
||||
private slots:
|
||||
void start();
|
||||
@@ -115,6 +116,7 @@ private slots:
|
||||
void handleDeviceInstallerErrorOutput(const QByteArray &output);
|
||||
void handlePortsGathererError(const QString &errorMsg);
|
||||
void handlePortListReady();
|
||||
void handleDeviceConfigurationsUpdated();
|
||||
|
||||
private:
|
||||
enum State {
|
||||
@@ -151,6 +153,7 @@ private:
|
||||
void runDpkg(const QString &packageFilePath);
|
||||
void setState(State newState);
|
||||
void unmount();
|
||||
void setDeviceConfig(MaemoDeviceConfig::Id internalId);
|
||||
|
||||
static const QLatin1String Id;
|
||||
|
||||
@@ -168,7 +171,8 @@ private:
|
||||
bool m_needsInstall;
|
||||
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
||||
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||
MaemoDeviceConfigListModel *m_deviceConfigModel;
|
||||
QSharedPointer<const MaemoDeviceConfig> m_deviceConfig;
|
||||
QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig;
|
||||
MaemoUsedPortsGatherer *m_portsGatherer;
|
||||
MaemoPortList m_freePorts;
|
||||
State m_state;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "maemodeploystep.h"
|
||||
#include "maemodeployablelistmodel.h"
|
||||
#include "maemodeployables.h"
|
||||
#include "maemodeviceconfiglistmodel.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemorunconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
@@ -39,6 +39,7 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) :
|
||||
SLOT(addDesktopFile()));
|
||||
connect(ui->addIconButton, SIGNAL(clicked()), SLOT(addIcon()));
|
||||
handleModelListReset();
|
||||
|
||||
}
|
||||
|
||||
MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
||||
@@ -48,43 +49,30 @@ MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
||||
|
||||
void MaemoDeployStepWidget::init()
|
||||
{
|
||||
handleDeviceConfigModelChanged();
|
||||
connect(m_step->buildConfiguration()->target(),
|
||||
SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
||||
this, SLOT(handleDeviceConfigModelChanged()));
|
||||
ui->deviceConfigComboBox->setModel(MaemoDeviceConfigurations::instance());
|
||||
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
||||
handleDeviceUpdate();
|
||||
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
||||
SLOT(setCurrentDeviceConfig(int)));
|
||||
ui->deployToSysrootCheckBox->setChecked(m_step->isDeployToSysrootEnabled());
|
||||
connect(ui->deployToSysrootCheckBox, SIGNAL(toggled(bool)), this,
|
||||
SLOT(setDeployToSysroot(bool)));
|
||||
handleDeviceConfigModelChanged();
|
||||
}
|
||||
|
||||
void MaemoDeployStepWidget::handleDeviceConfigModelChanged()
|
||||
{
|
||||
const MaemoDeviceConfigListModel * const oldModel
|
||||
= qobject_cast<MaemoDeviceConfigListModel *>(ui->deviceConfigComboBox->model());
|
||||
if (oldModel)
|
||||
disconnect(oldModel, 0, this, 0);
|
||||
MaemoDeviceConfigListModel * const devModel = m_step->deviceConfigModel();
|
||||
ui->deviceConfigComboBox->setModel(devModel);
|
||||
connect(devModel, SIGNAL(currentChanged()), this,
|
||||
SLOT(handleDeviceUpdate()));
|
||||
connect(devModel, SIGNAL(modelReset()), this,
|
||||
SLOT(handleDeviceUpdate()));
|
||||
handleDeviceUpdate();
|
||||
}
|
||||
|
||||
void MaemoDeployStepWidget::handleDeviceUpdate()
|
||||
{
|
||||
ui->deviceConfigComboBox->setCurrentIndex(m_step->deviceConfigModel()
|
||||
->currentIndex());
|
||||
const MaemoDeviceConfig::ConstPtr &devConf = m_step->deviceConfig();
|
||||
const MaemoDeviceConfigurations * const devConfigs
|
||||
= MaemoDeviceConfigurations::instance();
|
||||
ui->deviceConfigComboBox->setCurrentIndex(
|
||||
devConfigs->indexForInternalId(devConfigs->internalId(devConf)));
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
QString MaemoDeployStepWidget::summaryText() const
|
||||
{
|
||||
return tr("<b>Deploy to device</b>: %1").arg(m_step->deviceConfig().name);
|
||||
return tr("<b>Deploy to device</b>: %1")
|
||||
.arg(MaemoGlobal::deviceConfigurationName(m_step->deviceConfig()));
|
||||
}
|
||||
|
||||
QString MaemoDeployStepWidget::displayName() const
|
||||
@@ -94,7 +82,10 @@ QString MaemoDeployStepWidget::displayName() const
|
||||
|
||||
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
||||
{
|
||||
m_step->deviceConfigModel()->setCurrentIndex(index);
|
||||
disconnect(m_step, SIGNAL(deviceConfigChanged()), this,
|
||||
SLOT(handleDeviceUpdate()));
|
||||
m_step->setDeviceConfig(index);
|
||||
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
||||
}
|
||||
|
||||
void MaemoDeployStepWidget::setDeployToSysroot(bool doDeploy)
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
|
||||
private:
|
||||
Q_SLOT void handleDeviceUpdate();
|
||||
Q_SLOT void handleDeviceConfigModelChanged();
|
||||
Q_SLOT void setCurrentDeviceConfig(int index);
|
||||
Q_SLOT void setDeployToSysroot(bool doDeloy);
|
||||
Q_SLOT void setModel(int row);
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Creator.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "maemodeviceconfiglistmodel.h"
|
||||
|
||||
#include "maemoconstants.h"
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
MaemoDeviceConfigListModel::MaemoDeviceConfigListModel(QObject *parent)
|
||||
: QAbstractListModel(parent), m_currentIndex(-1)
|
||||
{
|
||||
setupList();
|
||||
const MaemoDeviceConfigurations &devConfs
|
||||
= MaemoDeviceConfigurations::instance();
|
||||
if (m_devConfigs.isEmpty())
|
||||
setInvalid();
|
||||
else
|
||||
setCurrentIndex(0);
|
||||
connect(&devConfs, SIGNAL(updated()), this,
|
||||
SLOT(handleDeviceConfigListChange()));
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::setupList()
|
||||
{
|
||||
m_devConfigs.clear();
|
||||
const MaemoDeviceConfigurations &devConfs
|
||||
= MaemoDeviceConfigurations::instance();
|
||||
foreach (const MaemoDeviceConfig &devConfig, devConfs.devConfigs()) {
|
||||
if (devConfig.freePorts().hasMore())
|
||||
m_devConfigs << devConfig;
|
||||
}
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::setCurrentIndex(int index)
|
||||
{
|
||||
m_currentIndex = index;
|
||||
m_currentId = m_devConfigs.at(m_currentIndex).internalId;
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::resetCurrentIndex()
|
||||
{
|
||||
if (m_devConfigs.isEmpty()) {
|
||||
setInvalid();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
||||
if (m_devConfigs.at(i).internalId == m_currentId) {
|
||||
setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::setInvalid()
|
||||
{
|
||||
m_currentIndex = -1;
|
||||
m_currentId = MaemoDeviceConfig::InvalidId;
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
MaemoDeviceConfig MaemoDeviceConfigListModel::current() const
|
||||
{
|
||||
return MaemoDeviceConfigurations::instance().find(m_currentId);
|
||||
}
|
||||
|
||||
QVariantMap MaemoDeviceConfigListModel::toMap() const
|
||||
{
|
||||
QVariantMap map;
|
||||
map.insert(DeviceIdKey, current().internalId);
|
||||
return map;
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::fromMap(const QVariantMap &map)
|
||||
{
|
||||
const quint64 oldId = m_currentId;
|
||||
m_currentId = map.value(DeviceIdKey, 0).toULongLong();
|
||||
resetCurrentIndex();
|
||||
if (oldId != m_currentId)
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigListModel::handleDeviceConfigListChange()
|
||||
{
|
||||
setupList();
|
||||
resetCurrentIndex();
|
||||
reset();
|
||||
emit currentChanged();
|
||||
}
|
||||
|
||||
int MaemoDeviceConfigListModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : m_devConfigs.count();
|
||||
}
|
||||
|
||||
QVariant MaemoDeviceConfigListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || index.row() >= rowCount()
|
||||
|| role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
return m_devConfigs.at(index.row()).name;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
@@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Creator.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAEMODEVICECONFIGLISTMODEL_H
|
||||
#define MAEMODEVICECONFIGLISTMODEL_H
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class MaemoDeviceConfigListModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MaemoDeviceConfigListModel(QObject *parent = 0);
|
||||
void setCurrentIndex(int index);
|
||||
MaemoDeviceConfig current() const;
|
||||
int currentIndex() const { return m_currentIndex; }
|
||||
|
||||
QVariantMap toMap() const;
|
||||
void fromMap(const QVariantMap &map);
|
||||
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex &index,
|
||||
int role = Qt::DisplayRole) const;
|
||||
|
||||
signals:
|
||||
void currentChanged();
|
||||
|
||||
private:
|
||||
Q_SLOT void handleDeviceConfigListChange();
|
||||
void resetCurrentIndex();
|
||||
void setInvalid();
|
||||
void setupList();
|
||||
|
||||
QList<MaemoDeviceConfig> m_devConfigs;
|
||||
quint64 m_currentId;
|
||||
int m_currentIndex;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // MAEMODEVICECONFIGLISTMODEL_H
|
||||
@@ -81,16 +81,16 @@ namespace {
|
||||
const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical);
|
||||
}
|
||||
|
||||
class DevConfIdMatcher
|
||||
class DevConfNameMatcher
|
||||
{
|
||||
public:
|
||||
DevConfIdMatcher(quint64 id) : m_id(id) {}
|
||||
bool operator()(const MaemoDeviceConfig &devConfig)
|
||||
DevConfNameMatcher(const QString &name) : m_name(name) {}
|
||||
bool operator()(const MaemoDeviceConfig::ConstPtr &devConfig)
|
||||
{
|
||||
return devConfig.internalId == m_id;
|
||||
return devConfig->name() == m_name;
|
||||
}
|
||||
private:
|
||||
const quint64 m_id;
|
||||
const QString m_name;
|
||||
};
|
||||
|
||||
class PortsSpecParser
|
||||
@@ -175,48 +175,56 @@ private:
|
||||
const QString &m_portsSpec;
|
||||
};
|
||||
|
||||
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, MaemoDeviceConfig::DeviceType devType)
|
||||
: server(Core::SshConnectionParameters::NoProxy),
|
||||
name(name),
|
||||
type(devType),
|
||||
portsSpec(defaultPortsSpec(type)),
|
||||
internalId(MaemoDeviceConfigurations::instance().m_nextId++)
|
||||
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QString &name,
|
||||
DeviceType type, Id &nextId)
|
||||
{
|
||||
server.host = defaultHost(type);
|
||||
server.port = defaultSshPort(type);
|
||||
server.uname = DefaultUserName;
|
||||
server.authType = DefaultAuthType;
|
||||
server.privateKeyFile
|
||||
= MaemoDeviceConfigurations::instance().defaultSshKeyFilePath();
|
||||
server.timeout = DefaultTimeout;
|
||||
return MaemoDeviceConfig::Ptr(new MaemoDeviceConfig(name, type, nextId));
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings,
|
||||
Id &nextId)
|
||||
{
|
||||
return MaemoDeviceConfig::Ptr(new MaemoDeviceConfig(settings, nextId));
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name, DeviceType devType,
|
||||
Id &nextId)
|
||||
: m_sshParameters(Core::SshConnectionParameters::NoProxy),
|
||||
m_name(name),
|
||||
m_type(devType),
|
||||
m_portsSpec(defaultPortsSpec(m_type)),
|
||||
m_internalId(nextId++),
|
||||
m_isDefault(false)
|
||||
{
|
||||
m_sshParameters.host = defaultHost(m_type);
|
||||
m_sshParameters.port = defaultSshPort(m_type);
|
||||
m_sshParameters.uname = DefaultUserName;
|
||||
m_sshParameters.authType = DefaultAuthType;
|
||||
m_sshParameters.privateKeyFile
|
||||
= MaemoDeviceConfigurations::instance()->defaultSshKeyFilePath();
|
||||
m_sshParameters.timeout = DefaultTimeout;
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings,
|
||||
quint64 &nextId)
|
||||
: server(Core::SshConnectionParameters::NoProxy),
|
||||
name(settings.value(NameKey).toString()),
|
||||
type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())),
|
||||
portsSpec(settings.value(PortsSpecKey, defaultPortsSpec(type)).toString()),
|
||||
internalId(settings.value(InternalIdKey, nextId).toULongLong())
|
||||
Id &nextId)
|
||||
: m_sshParameters(Core::SshConnectionParameters::NoProxy),
|
||||
m_name(settings.value(NameKey).toString()),
|
||||
m_type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())),
|
||||
m_portsSpec(settings.value(PortsSpecKey, defaultPortsSpec(m_type)).toString()),
|
||||
m_internalId(settings.value(InternalIdKey, nextId).toULongLong()),
|
||||
m_isDefault(false)
|
||||
{
|
||||
if (internalId == nextId)
|
||||
if (m_internalId == nextId)
|
||||
++nextId;
|
||||
server.host = settings.value(HostKey, defaultHost(type)).toString();
|
||||
server.port = settings.value(SshPortKey, defaultSshPort(type)).toInt();
|
||||
server.uname = settings.value(UserNameKey, DefaultUserName).toString();
|
||||
server.authType
|
||||
m_sshParameters.host = settings.value(HostKey, defaultHost(m_type)).toString();
|
||||
m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt();
|
||||
m_sshParameters.uname = settings.value(UserNameKey, DefaultUserName).toString();
|
||||
m_sshParameters.authType
|
||||
= static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt());
|
||||
server.pwd = settings.value(PasswordKey).toString();
|
||||
server.privateKeyFile
|
||||
m_sshParameters.pwd = settings.value(PasswordKey).toString();
|
||||
m_sshParameters.privateKeyFile
|
||||
= settings.value(KeyFileKey, DefaultKeyFile).toString();
|
||||
server.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt();
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::MaemoDeviceConfig()
|
||||
: server(Core::SshConnectionParameters::NoProxy),
|
||||
name(QCoreApplication::translate("MaemoDeviceConfig", "(Invalid device)")),
|
||||
internalId(InvalidId)
|
||||
{
|
||||
m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt();
|
||||
}
|
||||
|
||||
QString MaemoDeviceConfig::portsRegExpr()
|
||||
@@ -241,43 +249,59 @@ QString MaemoDeviceConfig::defaultHost(DeviceType type) const
|
||||
return type == Physical ? DefaultHostNameHW : DefaultHostNameSim;
|
||||
}
|
||||
|
||||
bool MaemoDeviceConfig::isValid() const
|
||||
{
|
||||
return internalId != InvalidId;
|
||||
}
|
||||
|
||||
MaemoPortList MaemoDeviceConfig::freePorts() const
|
||||
{
|
||||
return PortsSpecParser(portsSpec).parse();
|
||||
return PortsSpecParser(m_portsSpec).parse();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfig::save(QSettings &settings) const
|
||||
{
|
||||
settings.setValue(NameKey, name);
|
||||
settings.setValue(TypeKey, type);
|
||||
settings.setValue(HostKey, server.host);
|
||||
settings.setValue(SshPortKey, server.port);
|
||||
settings.setValue(PortsSpecKey, portsSpec);
|
||||
settings.setValue(UserNameKey, server.uname);
|
||||
settings.setValue(AuthKey, server.authType);
|
||||
settings.setValue(PasswordKey, server.pwd);
|
||||
settings.setValue(KeyFileKey, server.privateKeyFile);
|
||||
settings.setValue(TimeoutKey, server.timeout);
|
||||
settings.setValue(InternalIdKey, internalId);
|
||||
settings.setValue(NameKey, m_name);
|
||||
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.uname);
|
||||
settings.setValue(AuthKey, m_sshParameters.authType);
|
||||
settings.setValue(PasswordKey, m_sshParameters.pwd);
|
||||
settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile);
|
||||
settings.setValue(TimeoutKey, m_sshParameters.timeout);
|
||||
settings.setValue(InternalIdKey, m_internalId);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::setDevConfigs(const QList<MaemoDeviceConfig> &devConfigs)
|
||||
MaemoDeviceConfigurations *MaemoDeviceConfigurations::instance(QObject *parent)
|
||||
{
|
||||
m_devConfigs = devConfigs;
|
||||
save();
|
||||
emit updated();
|
||||
}
|
||||
|
||||
MaemoDeviceConfigurations &MaemoDeviceConfigurations::instance(QObject *parent)
|
||||
{
|
||||
if (m_instance == 0)
|
||||
if (m_instance == 0) {
|
||||
m_instance = new MaemoDeviceConfigurations(parent);
|
||||
return *m_instance;
|
||||
m_instance->load();
|
||||
}
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::replaceInstance(const MaemoDeviceConfigurations *other)
|
||||
{
|
||||
Q_ASSERT(m_instance);
|
||||
m_instance->beginResetModel();
|
||||
copy(other, m_instance);
|
||||
m_instance->save();
|
||||
m_instance->endResetModel();
|
||||
emit m_instance->updated();
|
||||
}
|
||||
|
||||
MaemoDeviceConfigurations *MaemoDeviceConfigurations::cloneInstance()
|
||||
{
|
||||
MaemoDeviceConfigurations * const other = new MaemoDeviceConfigurations(0);
|
||||
copy(m_instance, other);
|
||||
return other;
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::copy(const MaemoDeviceConfigurations *source,
|
||||
MaemoDeviceConfigurations *target)
|
||||
{
|
||||
target->m_devConfigs = source->m_devConfigs;
|
||||
target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath;
|
||||
target->m_nextId = source->m_nextId;
|
||||
target->initShadowDevConfs();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::save()
|
||||
@@ -289,16 +313,95 @@ void MaemoDeviceConfigurations::save()
|
||||
settings->beginWriteArray(ConfigListKey, m_devConfigs.count());
|
||||
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
||||
settings->setArrayIndex(i);
|
||||
m_devConfigs.at(i).save(*settings);
|
||||
m_devConfigs.at(i)->save(*settings);
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
MaemoDeviceConfigurations::MaemoDeviceConfigurations(QObject *parent)
|
||||
: QObject(parent)
|
||||
void MaemoDeviceConfigurations::initShadowDevConfs()
|
||||
{
|
||||
m_shadowDevConfigs.clear();
|
||||
for (int i = 0; i < m_devConfigs.count(); ++i)
|
||||
m_shadowDevConfigs.push_back(MaemoDeviceConfig::Ptr());
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::setupShadowDevConf(int i)
|
||||
{
|
||||
MaemoDeviceConfig::Ptr shadowConf = m_shadowDevConfigs.at(i);
|
||||
if (shadowConf)
|
||||
return;
|
||||
|
||||
const MaemoDeviceConfig::Ptr devConf = m_devConfigs.at(i);
|
||||
const MaemoDeviceConfig::DeviceType shadowType
|
||||
= devConf->type() == MaemoDeviceConfig::Physical
|
||||
? MaemoDeviceConfig::Simulator : MaemoDeviceConfig::Physical;
|
||||
shadowConf = MaemoDeviceConfig::create(devConf->name(), shadowType, m_nextId);
|
||||
shadowConf->m_sshParameters.authType = devConf->m_sshParameters.authType;
|
||||
shadowConf->m_sshParameters.timeout = devConf->m_sshParameters.timeout;
|
||||
shadowConf->m_sshParameters.pwd = devConf->m_sshParameters.pwd;
|
||||
shadowConf->m_sshParameters.privateKeyFile
|
||||
= devConf->m_sshParameters.privateKeyFile;
|
||||
shadowConf->m_internalId = devConf->m_internalId;
|
||||
m_shadowDevConfigs[i] = shadowConf;
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::addConfiguration(const QString &name,
|
||||
MaemoDeviceConfig::DeviceType type)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
m_devConfigs << MaemoDeviceConfig::create(name, type, m_nextId);
|
||||
m_shadowDevConfigs << MaemoDeviceConfig::Ptr();
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::removeConfiguration(int i)
|
||||
{
|
||||
Q_ASSERT(i >= 0 && i < rowCount());
|
||||
beginRemoveRows(QModelIndex(), i, i);
|
||||
m_devConfigs.removeAt(i);
|
||||
m_shadowDevConfigs.removeAt(i);
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::setConfigurationName(int i, const QString &name)
|
||||
{
|
||||
Q_ASSERT(i >= 0 && i < rowCount());
|
||||
m_devConfigs.at(i)->m_name = name;
|
||||
const MaemoDeviceConfig::Ptr shadowConfig = m_shadowDevConfigs.at(i);
|
||||
if (shadowConfig)
|
||||
shadowConfig->m_name = name;
|
||||
const QModelIndex changedIndex = index(i, 0);
|
||||
emit dataChanged(changedIndex, changedIndex);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::setDeviceType(int i,
|
||||
const MaemoDeviceConfig::DeviceType type)
|
||||
{
|
||||
Q_ASSERT(i >= 0 && i < rowCount());
|
||||
MaemoDeviceConfig::Ptr ¤t = m_devConfigs[i];
|
||||
if (current->type() == type)
|
||||
return;
|
||||
setupShadowDevConf(i);
|
||||
std::swap(current, m_shadowDevConfigs[i]);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::setSshParameters(int i,
|
||||
const Core::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;
|
||||
}
|
||||
|
||||
MaemoDeviceConfigurations::MaemoDeviceConfigurations(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurations::load()
|
||||
@@ -311,26 +414,62 @@ void MaemoDeviceConfigurations::load()
|
||||
int count = settings->beginReadArray(ConfigListKey);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
settings->setArrayIndex(i);
|
||||
m_devConfigs.append(MaemoDeviceConfig(*settings, m_nextId));
|
||||
m_devConfigs.append(MaemoDeviceConfig::create(*settings, m_nextId));
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
initShadowDevConfs();
|
||||
}
|
||||
|
||||
MaemoDeviceConfig MaemoDeviceConfigurations::find(const QString &name) const
|
||||
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int i) const
|
||||
{
|
||||
QList<MaemoDeviceConfig>::ConstIterator resultIt =
|
||||
Q_ASSERT(i >= 0 && i < rowCount());
|
||||
return m_devConfigs.at(i);
|
||||
}
|
||||
|
||||
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() : *resultIt;
|
||||
return resultIt != m_devConfigs.constEnd();
|
||||
}
|
||||
|
||||
MaemoDeviceConfig MaemoDeviceConfigurations::find(quint64 id) const
|
||||
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::find(MaemoDeviceConfig::Id id) const
|
||||
{
|
||||
QList<MaemoDeviceConfig>::ConstIterator resultIt =
|
||||
std::find_if(m_devConfigs.constBegin(), m_devConfigs.constEnd(),
|
||||
DevConfIdMatcher(id));
|
||||
return resultIt == m_devConfigs.constEnd() ? MaemoDeviceConfig() : *resultIt;
|
||||
const int index = indexForInternalId(id);
|
||||
return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index);
|
||||
}
|
||||
|
||||
int MaemoDeviceConfigurations::indexForInternalId(MaemoDeviceConfig::Id internalId) const
|
||||
{
|
||||
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
||||
if (deviceAt(i)->internalId() == internalId)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::Id MaemoDeviceConfigurations::internalId(MaemoDeviceConfig::ConstPtr devConf) const
|
||||
{
|
||||
return devConf ? devConf->internalId() : MaemoDeviceConfig::InvalidId;
|
||||
}
|
||||
|
||||
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 += tr(" (default)");
|
||||
return name;
|
||||
}
|
||||
|
||||
MaemoDeviceConfigurations *MaemoDeviceConfigurations::m_instance = 0;
|
||||
|
||||
@@ -37,9 +37,10 @@
|
||||
|
||||
#include <coreplugin/ssh/sshconnection.h>
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QString>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -92,61 +93,79 @@ private:
|
||||
|
||||
class MaemoDeviceConfig
|
||||
{
|
||||
friend class MaemoDeviceConfigurations;
|
||||
public:
|
||||
typedef QSharedPointer<const MaemoDeviceConfig> ConstPtr;
|
||||
typedef quint64 Id;
|
||||
enum DeviceType { Physical, Simulator };
|
||||
MaemoDeviceConfig();
|
||||
MaemoDeviceConfig(const QString &name, DeviceType type);
|
||||
MaemoDeviceConfig(const QSettings &settings, quint64 &nextId);
|
||||
void save(QSettings &settings) const;
|
||||
bool isValid() const;
|
||||
|
||||
MaemoPortList freePorts() const;
|
||||
Core::SshConnectionParameters sshParameters() const { return m_sshParameters; }
|
||||
QString name() const { return m_name; }
|
||||
DeviceType type() const { return m_type; }
|
||||
QString portsSpec() const { return m_portsSpec; }
|
||||
Id internalId() const { return m_internalId; }
|
||||
static QString portsRegExpr();
|
||||
|
||||
static const quint64 InvalidId = 0;
|
||||
|
||||
Core::SshConnectionParameters server;
|
||||
QString name;
|
||||
DeviceType type;
|
||||
QString portsSpec;
|
||||
quint64 internalId;
|
||||
static const Id InvalidId = 0;
|
||||
|
||||
private:
|
||||
typedef QSharedPointer<MaemoDeviceConfig> Ptr;
|
||||
|
||||
MaemoDeviceConfig(const QString &name, DeviceType type, Id &nextId);
|
||||
MaemoDeviceConfig(const QSettings &settings, Id &nextId);
|
||||
|
||||
MaemoDeviceConfig(const MaemoDeviceConfig &);
|
||||
MaemoDeviceConfig &operator=(const MaemoDeviceConfig &);
|
||||
|
||||
static Ptr create(const QString &name, DeviceType type, Id &nextId);
|
||||
static Ptr create(const QSettings &settings, Id &nextId);
|
||||
|
||||
void save(QSettings &settings) const;
|
||||
int defaultSshPort(DeviceType type) const;
|
||||
QString defaultPortsSpec(DeviceType type) const;
|
||||
QString defaultHost(DeviceType type) const;
|
||||
|
||||
};
|
||||
|
||||
class DevConfNameMatcher
|
||||
{
|
||||
public:
|
||||
DevConfNameMatcher(const QString &name) : m_name(name) {}
|
||||
bool operator()(const MaemoDeviceConfig &devConfig)
|
||||
{
|
||||
return devConfig.name == m_name;
|
||||
}
|
||||
private:
|
||||
const QString m_name;
|
||||
Core::SshConnectionParameters m_sshParameters;
|
||||
QString m_name;
|
||||
DeviceType m_type;
|
||||
QString m_portsSpec;
|
||||
Id m_internalId;
|
||||
bool m_isDefault;
|
||||
};
|
||||
|
||||
|
||||
class MaemoDeviceConfigurations : public QObject
|
||||
class MaemoDeviceConfigurations : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(MaemoDeviceConfigurations)
|
||||
public:
|
||||
static MaemoDeviceConfigurations *instance(QObject *parent = 0);
|
||||
|
||||
static MaemoDeviceConfigurations &instance(QObject *parent = 0);
|
||||
static void replaceInstance(const MaemoDeviceConfigurations *other);
|
||||
static MaemoDeviceConfigurations *cloneInstance();
|
||||
|
||||
QList<MaemoDeviceConfig> devConfigs() const { return m_devConfigs; }
|
||||
void setDevConfigs(const QList<MaemoDeviceConfig> &devConfigs);
|
||||
|
||||
MaemoDeviceConfig find(const QString &name) const;
|
||||
MaemoDeviceConfig find(quint64 id) const;
|
||||
MaemoDeviceConfig::ConstPtr deviceAt(int i) const;
|
||||
MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) 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 addConfiguration(const QString &name,
|
||||
MaemoDeviceConfig::DeviceType type);
|
||||
void removeConfiguration(int i);
|
||||
void setConfigurationName(int i, const QString &name);
|
||||
void setDeviceType(int i, const MaemoDeviceConfig::DeviceType type);
|
||||
void setSshParameters(int i, const Core::SshConnectionParameters ¶ms);
|
||||
void setPortsSpec(int i, const QString &portsSpec);
|
||||
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex &index,
|
||||
int role = Qt::DisplayRole) const;
|
||||
|
||||
signals:
|
||||
void updated();
|
||||
|
||||
@@ -154,12 +173,16 @@ private:
|
||||
MaemoDeviceConfigurations(QObject *parent);
|
||||
void load();
|
||||
void save();
|
||||
void initShadowDevConfs();
|
||||
static void copy(const MaemoDeviceConfigurations *source,
|
||||
MaemoDeviceConfigurations *target);
|
||||
void setupShadowDevConf(int i);
|
||||
|
||||
static MaemoDeviceConfigurations *m_instance;
|
||||
QList<MaemoDeviceConfig> m_devConfigs;
|
||||
quint64 m_nextId;
|
||||
MaemoDeviceConfig::Id m_nextId;
|
||||
QList<MaemoDeviceConfig::Ptr> m_devConfigs;
|
||||
QList<MaemoDeviceConfig::Ptr> m_shadowDevConfigs;
|
||||
QString m_defaultSshKeyFilePath;
|
||||
friend class MaemoDeviceConfig;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -64,18 +64,13 @@ namespace {
|
||||
const QLatin1String LastDeviceConfigIndexKey("LastDisplayedMaemoDeviceConfig");
|
||||
} // anonymous namespace
|
||||
|
||||
bool configNameExists(const QList<MaemoDeviceConfig> &devConfs,
|
||||
const QString &name)
|
||||
{
|
||||
return std::find_if(devConfs.constBegin(), devConfs.constEnd(),
|
||||
DevConfNameMatcher(name)) != devConfs.constEnd();
|
||||
}
|
||||
|
||||
class NameValidator : public QValidator
|
||||
{
|
||||
public:
|
||||
NameValidator(const QList<MaemoDeviceConfig> &devConfs, QWidget *parent = 0)
|
||||
: QValidator(parent), m_devConfs(devConfs)
|
||||
NameValidator(const MaemoDeviceConfigurations *devConfigs,
|
||||
QWidget *parent = 0)
|
||||
: QValidator(parent), m_devConfigs(devConfigs)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -84,7 +79,7 @@ public:
|
||||
virtual State validate(QString &input, int & /* pos */) const
|
||||
{
|
||||
if (input.trimmed().isEmpty()
|
||||
|| (input != m_oldName && configNameExists(m_devConfs, input)))
|
||||
|| (input != m_oldName && m_devConfigs->hasConfig(input)))
|
||||
return Intermediate;
|
||||
return Acceptable;
|
||||
}
|
||||
@@ -98,15 +93,15 @@ public:
|
||||
|
||||
private:
|
||||
QString m_oldName;
|
||||
const QList<MaemoDeviceConfig> &m_devConfs;
|
||||
const MaemoDeviceConfigurations * const m_devConfigs;
|
||||
};
|
||||
|
||||
|
||||
MaemoDeviceConfigurationsSettingsWidget::MaemoDeviceConfigurationsSettingsWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_ui(new Ui_MaemoDeviceConfigurationsSettingsWidget),
|
||||
m_devConfs(MaemoDeviceConfigurations::instance().devConfigs()),
|
||||
m_nameValidator(new NameValidator(m_devConfs, this)),
|
||||
m_devConfigs(MaemoDeviceConfigurations::cloneInstance()),
|
||||
m_nameValidator(new NameValidator(m_devConfigs.data(), this)),
|
||||
m_saveSettingsRequested(false)
|
||||
{
|
||||
initGui();
|
||||
@@ -116,8 +111,8 @@ MaemoDeviceConfigurationsSettingsWidget::~MaemoDeviceConfigurationsSettingsWidge
|
||||
{
|
||||
if (m_saveSettingsRequested) {
|
||||
Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey,
|
||||
m_ui->configurationComboBox->currentIndex());
|
||||
MaemoDeviceConfigurations::instance().setDevConfigs(m_devConfs);
|
||||
currentIndex());
|
||||
MaemoDeviceConfigurations::replaceInstance(m_devConfigs.data());
|
||||
}
|
||||
delete m_ui;
|
||||
}
|
||||
@@ -152,6 +147,7 @@ QString MaemoDeviceConfigurationsSettingsWidget::searchKeywords() const
|
||||
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
|
||||
@@ -159,15 +155,15 @@ void MaemoDeviceConfigurationsSettingsWidget::initGui()
|
||||
m_ui->portsLineEdit->setValidator(portsValidator);
|
||||
connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()),
|
||||
SLOT(setDefaultKeyFilePath()));
|
||||
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
||||
m_ui->configurationComboBox->addItem(devConf.name);
|
||||
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
SLOT(currentConfigChanged(int)));
|
||||
const int lastIndex = Core::ICore::instance()->settings()
|
||||
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);
|
||||
currentConfigChanged(m_ui->configurationComboBox->currentIndex());
|
||||
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
SLOT(currentConfigChanged(int)));
|
||||
currentConfigChanged(currentIndex());
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::addConfig()
|
||||
@@ -179,11 +175,10 @@ void MaemoDeviceConfigurationsSettingsWidget::addConfig()
|
||||
bool isUnique = false;
|
||||
do {
|
||||
newName = prefix.arg(QString::number(suffix++));
|
||||
isUnique = !configNameExists(m_devConfs, newName);
|
||||
isUnique = !m_devConfigs->hasConfig(newName);
|
||||
} while (!isUnique);
|
||||
|
||||
m_devConfs.append(MaemoDeviceConfig(newName, MaemoDeviceConfig::Physical));
|
||||
m_ui->configurationComboBox->addItem(newName);
|
||||
m_devConfigs->addConfiguration(newName, MaemoDeviceConfig::Physical);
|
||||
m_ui->removeConfigButton->setEnabled(true);
|
||||
m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1);
|
||||
m_ui->configurationComboBox->setFocus();
|
||||
@@ -191,58 +186,44 @@ void MaemoDeviceConfigurationsSettingsWidget::addConfig()
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::deleteConfig()
|
||||
{
|
||||
const int selectedItem = m_ui->configurationComboBox->currentIndex();
|
||||
m_devConfs.removeAt(selectedItem);
|
||||
m_ui->configurationComboBox->removeItem(selectedItem);
|
||||
Q_ASSERT(m_ui->configurationComboBox->count() == m_devConfs.count());
|
||||
m_devConfigs->removeConfiguration(currentIndex());
|
||||
if (m_devConfigs->rowCount() == 0)
|
||||
currentConfigChanged(-1);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::display(const MaemoDeviceConfig &devConfig)
|
||||
void MaemoDeviceConfigurationsSettingsWidget::displayCurrent()
|
||||
{
|
||||
MaemoDeviceConfig *otherConfig;
|
||||
if (devConfig.type == MaemoDeviceConfig::Physical) {
|
||||
m_lastConfigHW = devConfig;
|
||||
m_lastConfigSim
|
||||
= MaemoDeviceConfig(devConfig.name, MaemoDeviceConfig::Simulator);
|
||||
otherConfig = &m_lastConfigSim;
|
||||
const MaemoDeviceConfig::ConstPtr ¤t = currentConfig();
|
||||
const SshConnectionParameters &sshParams = current->sshParameters();
|
||||
if (current->type() == MaemoDeviceConfig::Physical)
|
||||
m_ui->deviceButton->setChecked(true);
|
||||
} else {
|
||||
m_lastConfigSim = devConfig;
|
||||
m_lastConfigHW
|
||||
= MaemoDeviceConfig(devConfig.name, MaemoDeviceConfig::Physical);
|
||||
otherConfig = &m_lastConfigHW;
|
||||
else
|
||||
m_ui->simulatorButton->setChecked(true);
|
||||
}
|
||||
otherConfig->server.authType = devConfig.server.authType;
|
||||
otherConfig->server.timeout = devConfig.server.timeout;
|
||||
otherConfig->server.pwd = devConfig.server.pwd;
|
||||
otherConfig->server.privateKeyFile = devConfig.server.privateKeyFile;
|
||||
otherConfig->internalId = devConfig.internalId;
|
||||
|
||||
if (devConfig.server.authType == Core::SshConnectionParameters::AuthByPwd)
|
||||
if (sshParams.authType == Core::SshConnectionParameters::AuthByPwd)
|
||||
m_ui->passwordButton->setChecked(true);
|
||||
else
|
||||
m_ui->keyButton->setChecked(true);
|
||||
m_ui->detailsWidget->setEnabled(true);
|
||||
m_nameValidator->setDisplayName(devConfig.name);
|
||||
m_ui->timeoutSpinBox->setValue(devConfig.server.timeout);
|
||||
m_nameValidator->setDisplayName(current->name());
|
||||
m_ui->timeoutSpinBox->setValue(sshParams.timeout);
|
||||
fillInValues();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::fillInValues()
|
||||
{
|
||||
m_ui->nameLineEdit->setText(currentConfig().name);
|
||||
m_ui->hostLineEdit->setText(currentConfig().server.host);
|
||||
m_ui->sshPortSpinBox->setValue(currentConfig().server.port);
|
||||
m_ui->portsLineEdit->setText(currentConfig().portsSpec);
|
||||
m_ui->timeoutSpinBox->setValue(currentConfig().server.timeout);
|
||||
m_ui->userLineEdit->setText(currentConfig().server.uname);
|
||||
m_ui->pwdLineEdit->setText(currentConfig().server.pwd);
|
||||
m_ui->keyFileLineEdit->setPath(currentConfig().server.privateKeyFile);
|
||||
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.uname);
|
||||
m_ui->pwdLineEdit->setText(sshParams.pwd);
|
||||
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
||||
m_ui->showPasswordCheckBox->setChecked(false);
|
||||
updatePortsWarningLabel();
|
||||
const bool isSimulator
|
||||
= currentConfig().type == MaemoDeviceConfig::Simulator;
|
||||
const bool isSimulator = current->type() == MaemoDeviceConfig::Simulator;
|
||||
m_ui->hostLineEdit->setReadOnly(isSimulator);
|
||||
m_ui->sshPortSpinBox->setReadOnly(isSimulator);
|
||||
}
|
||||
@@ -253,13 +234,15 @@ void MaemoDeviceConfigurationsSettingsWidget::saveSettings()
|
||||
m_saveSettingsRequested = true;
|
||||
}
|
||||
|
||||
MaemoDeviceConfig &MaemoDeviceConfigurationsSettingsWidget::currentConfig()
|
||||
int MaemoDeviceConfigurationsSettingsWidget::currentIndex() const
|
||||
{
|
||||
Q_ASSERT(m_ui->configurationComboBox->count() == m_devConfs.count());
|
||||
const int currenIndex = m_ui->configurationComboBox->currentIndex();
|
||||
Q_ASSERT(currenIndex != -1);
|
||||
Q_ASSERT(currenIndex < m_devConfs.count());
|
||||
return m_devConfs[currenIndex];
|
||||
return m_ui->configurationComboBox->currentIndex();
|
||||
}
|
||||
|
||||
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurationsSettingsWidget::currentConfig() const
|
||||
{
|
||||
Q_ASSERT(currentIndex() != -1);
|
||||
return m_devConfigs->deviceAt(currentIndex());
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::configNameEditingFinished()
|
||||
@@ -268,38 +251,27 @@ void MaemoDeviceConfigurationsSettingsWidget::configNameEditingFinished()
|
||||
return;
|
||||
|
||||
const QString &newName = m_ui->nameLineEdit->text();
|
||||
const int currentIndex = m_ui->configurationComboBox->currentIndex();
|
||||
m_ui->configurationComboBox->setItemData(currentIndex, newName, Qt::DisplayRole);
|
||||
currentConfig().name = newName;
|
||||
m_devConfigs->setConfigurationName(currentIndex(), newName);
|
||||
m_nameValidator->setDisplayName(newName);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::deviceTypeChanged()
|
||||
{
|
||||
const MaemoDeviceConfig::DeviceType devType =
|
||||
m_ui->deviceButton->isChecked()
|
||||
? MaemoDeviceConfig::Physical
|
||||
: MaemoDeviceConfig::Simulator;
|
||||
if (currentConfig().type == devType)
|
||||
return;
|
||||
|
||||
const QString name = currentConfig().name;
|
||||
if (devType == MaemoDeviceConfig::Simulator) {
|
||||
m_lastConfigHW = currentConfig();
|
||||
currentConfig() = m_lastConfigSim;
|
||||
} else {
|
||||
m_lastConfigSim = currentConfig();
|
||||
currentConfig() = m_lastConfigHW;
|
||||
}
|
||||
currentConfig().name = name;
|
||||
const MaemoDeviceConfig::DeviceType devType
|
||||
= m_ui->deviceButton->isChecked()
|
||||
? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Simulator;
|
||||
m_devConfigs->setDeviceType(currentIndex(), devType);
|
||||
fillInValues();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::authenticationTypeChanged()
|
||||
{
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
const bool usePassword = m_ui->passwordButton->isChecked();
|
||||
currentConfig().server.authType
|
||||
= usePassword ? Core::SshConnectionParameters::AuthByPwd : Core::SshConnectionParameters::AuthByKey;
|
||||
sshParams.authType = usePassword
|
||||
? SshConnectionParameters::AuthByPwd
|
||||
: SshConnectionParameters::AuthByKey;
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
m_ui->pwdLineEdit->setEnabled(usePassword);
|
||||
m_ui->passwordLabel->setEnabled(usePassword);
|
||||
m_ui->keyFileLineEdit->setEnabled(!usePassword);
|
||||
@@ -309,38 +281,50 @@ void MaemoDeviceConfigurationsSettingsWidget::authenticationTypeChanged()
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::hostNameEditingFinished()
|
||||
{
|
||||
currentConfig().server.host = m_ui->hostLineEdit->text();
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.host = m_ui->hostLineEdit->text();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::sshPortEditingFinished()
|
||||
{
|
||||
currentConfig().server.port = m_ui->sshPortSpinBox->value();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::handleFreePortsChanged()
|
||||
{
|
||||
currentConfig().portsSpec = m_ui->portsLineEdit->text();
|
||||
updatePortsWarningLabel();
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.port = m_ui->sshPortSpinBox->value();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::timeoutEditingFinished()
|
||||
{
|
||||
currentConfig().server.timeout = m_ui->timeoutSpinBox->value();
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.timeout = m_ui->timeoutSpinBox->value();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::userNameEditingFinished()
|
||||
{
|
||||
currentConfig().server.uname = m_ui->userLineEdit->text();
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.uname = m_ui->userLineEdit->text();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::passwordEditingFinished()
|
||||
{
|
||||
currentConfig().server.pwd = m_ui->pwdLineEdit->text();
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.pwd = m_ui->pwdLineEdit->text();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::keyFileEditingFinished()
|
||||
{
|
||||
currentConfig().server.privateKeyFile = m_ui->keyFileLineEdit->path();
|
||||
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)
|
||||
@@ -363,14 +347,13 @@ void MaemoDeviceConfigurationsSettingsWidget::showGenerateSshKeyDialog()
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::showRemoteProcesses()
|
||||
{
|
||||
MaemoRemoteProcessesDialog dlg(currentConfig().server, this);
|
||||
MaemoRemoteProcessesDialog dlg(currentConfig()->sshParameters(), this);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::setDefaultKeyFilePath()
|
||||
{
|
||||
MaemoDeviceConfigurations::instance()
|
||||
.setDefaultSshKeyFilePath(m_ui->keyFileLineEdit->path());
|
||||
m_devConfigs->setDefaultSshKeyFilePath(m_ui->keyFileLineEdit->path());
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::setPrivateKey(const QString &path)
|
||||
@@ -384,8 +367,8 @@ void MaemoDeviceConfigurationsSettingsWidget::deployKey()
|
||||
if (m_keyDeployer)
|
||||
return;
|
||||
|
||||
const QString &dir
|
||||
= QFileInfo(currentConfig().server.privateKeyFile).path();
|
||||
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 (*)"));
|
||||
@@ -408,7 +391,7 @@ void MaemoDeviceConfigurationsSettingsWidget::deployKey()
|
||||
connect(m_ui->deployKeyButton, SIGNAL(clicked()), this,
|
||||
SLOT(stopDeploying()));
|
||||
|
||||
m_keyDeployer = SshRemoteProcessRunner::create(currentConfig().server);
|
||||
m_keyDeployer = SshRemoteProcessRunner::create(sshParams);
|
||||
connect(m_keyDeployer.data(), SIGNAL(connectionError(Core::SshError)), this,
|
||||
SLOT(handleConnectionFailure()));
|
||||
connect(m_keyDeployer.data(), SIGNAL(processClosed(int)), this,
|
||||
@@ -480,12 +463,13 @@ void MaemoDeviceConfigurationsSettingsWidget::currentConfigChanged(int index)
|
||||
m_ui->deployKeyButton->setEnabled(true);
|
||||
m_ui->remoteProcessesButton->setEnabled(true);
|
||||
m_ui->configurationComboBox->setCurrentIndex(index);
|
||||
display(currentConfig());
|
||||
displayCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::clearDetails()
|
||||
{
|
||||
m_ui->nameLineEdit->clear();
|
||||
m_ui->hostLineEdit->clear();
|
||||
m_ui->sshPortSpinBox->clear();
|
||||
m_ui->timeoutSpinBox->clear();
|
||||
@@ -493,11 +477,12 @@ void MaemoDeviceConfigurationsSettingsWidget::clearDetails()
|
||||
m_ui->pwdLineEdit->clear();
|
||||
m_ui->portsLineEdit->clear();
|
||||
m_ui->portsWarningLabel->clear();
|
||||
m_ui->keyFileLineEdit->lineEdit()->clear();
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::updatePortsWarningLabel()
|
||||
{
|
||||
if (currentConfig().freePorts().hasMore()) {
|
||||
if (currentConfig()->freePorts().hasMore()) {
|
||||
m_ui->portsWarningLabel->clear();
|
||||
} else {
|
||||
m_ui->portsWarningLabel->setText(QLatin1String("<font color=\"red\">")
|
||||
|
||||
@@ -35,9 +35,8 @@
|
||||
#ifndef MAEMODEVICECONFIGURATIONSSETTINGSWIDGET_H
|
||||
#define MAEMODEVICECONFIGURATIONSSETTINGSWIDGET_H
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QWidget>
|
||||
@@ -56,6 +55,8 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class NameValidator;
|
||||
class MaemoDeviceConfig;
|
||||
class MaemoDeviceConfigurations;
|
||||
|
||||
class MaemoDeviceConfigurationsSettingsWidget : public QWidget
|
||||
{
|
||||
@@ -99,19 +100,18 @@ private slots:
|
||||
|
||||
private:
|
||||
void initGui();
|
||||
void display(const MaemoDeviceConfig &devConfig);
|
||||
MaemoDeviceConfig ¤tConfig();
|
||||
void displayCurrent();
|
||||
QSharedPointer<const MaemoDeviceConfig> currentConfig() const;
|
||||
int currentIndex() const;
|
||||
void clearDetails();
|
||||
QString parseTestOutput();
|
||||
void fillInValues();
|
||||
void updatePortsWarningLabel();
|
||||
|
||||
Ui_MaemoDeviceConfigurationsSettingsWidget *m_ui;
|
||||
QList<MaemoDeviceConfig> m_devConfs;
|
||||
MaemoDeviceConfig m_lastConfigHW;
|
||||
MaemoDeviceConfig m_lastConfigSim;
|
||||
NameValidator * const m_nameValidator;
|
||||
QSharedPointer<Core::SshRemoteProcessRunner> m_keyDeployer;
|
||||
const QScopedPointer<MaemoDeviceConfigurations> m_devConfigs;
|
||||
NameValidator * const m_nameValidator;
|
||||
bool m_saveSettingsRequested;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "maemodeviceenvreader.h"
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemorunconfiguration.h"
|
||||
|
||||
@@ -58,12 +59,14 @@ MaemoDeviceEnvReader::~MaemoDeviceEnvReader()
|
||||
|
||||
void MaemoDeviceEnvReader::start()
|
||||
{
|
||||
if (!m_devConfig)
|
||||
return;
|
||||
m_stop = false;
|
||||
if (!m_remoteProcessRunner
|
||||
|| m_remoteProcessRunner->connection()->state() != Core::SshConnection::Connected
|
||||
|| m_remoteProcessRunner->connection()->connectionParameters() != m_devConfig.server) {
|
||||
|| m_remoteProcessRunner->connection()->connectionParameters() != m_devConfig->sshParameters()) {
|
||||
m_remoteProcessRunner
|
||||
= Core::SshRemoteProcessRunner::create(m_devConfig.server);
|
||||
= Core::SshRemoteProcessRunner::create(m_devConfig->sshParameters());
|
||||
}
|
||||
connect(m_remoteProcessRunner.data(),
|
||||
SIGNAL(connectionError(Core::SshError)), this,
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
#ifndef DEVICEENVREADER_H
|
||||
#define DEVICEENVREADER_H
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
|
||||
namespace Core {
|
||||
class SshRemoteProcessRunner;
|
||||
@@ -48,6 +47,7 @@ namespace Core {
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class MaemoDeviceConfig;
|
||||
class MaemoRunConfiguration;
|
||||
|
||||
class MaemoDeviceEnvReader : public QObject
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
QString m_remoteOutput;
|
||||
QByteArray m_remoteErrorOutput;
|
||||
Utils::Environment m_env;
|
||||
MaemoDeviceConfig m_devConfig;
|
||||
QSharedPointer<const MaemoDeviceConfig> m_devConfig;
|
||||
MaemoRunConfiguration *m_runConfig;
|
||||
QSharedPointer<Core::SshRemoteProcessRunner> m_remoteProcessRunner;
|
||||
};
|
||||
|
||||
@@ -93,12 +93,12 @@ QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list
|
||||
}
|
||||
|
||||
QString MaemoGlobal::failedToConnectToServerMessage(const Core::SshConnection::Ptr &connection,
|
||||
const MaemoDeviceConfig &deviceConfig)
|
||||
const MaemoDeviceConfig::ConstPtr &deviceConfig)
|
||||
{
|
||||
QString errorMsg = TR("Could not connect to host: %1")
|
||||
.arg(connection->errorString());
|
||||
|
||||
if (deviceConfig.type == MaemoDeviceConfig::Simulator) {
|
||||
if (deviceConfig->type() == MaemoDeviceConfig::Simulator) {
|
||||
if (connection->errorState() == Core::SshTimeoutError
|
||||
|| connection->errorState() == Core::SshSocketError) {
|
||||
errorMsg += TR("\nDid you start Qemu?");
|
||||
@@ -109,6 +109,11 @@ QString MaemoGlobal::failedToConnectToServerMessage(const Core::SshConnection::P
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
QString MaemoGlobal::deviceConfigurationName(const MaemoDeviceConfig::ConstPtr &devConf)
|
||||
{
|
||||
return devConf ? devConf->name() : TR("(No device)");
|
||||
}
|
||||
|
||||
QString MaemoGlobal::maddeRoot(const QtVersion *qtVersion)
|
||||
{
|
||||
QDir dir(targetRoot(qtVersion));
|
||||
|
||||
@@ -77,7 +77,8 @@ public:
|
||||
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
|
||||
static QString remoteSourceProfilesCommand();
|
||||
static QString failedToConnectToServerMessage(const QSharedPointer<Core::SshConnection> &connection,
|
||||
const MaemoDeviceConfig &deviceConfig);
|
||||
const QSharedPointer<const MaemoDeviceConfig> &deviceConfig);
|
||||
static QString deviceConfigurationName(const QSharedPointer<const MaemoDeviceConfig> &devConf);
|
||||
|
||||
static QString maddeRoot(const QtVersion *qtVersion);
|
||||
static QString targetRoot(const QtVersion *qtVersion);
|
||||
|
||||
@@ -556,8 +556,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
|
||||
|
||||
if (qtVersion)
|
||||
*qtVersion = version;
|
||||
const MaemoDeviceConfig &config = mrc->deviceConfig();
|
||||
return config.isValid() && config.type == MaemoDeviceConfig::Simulator;
|
||||
const MaemoDeviceConfig::ConstPtr &config = mrc->deviceConfig();
|
||||
return config && config->type() == MaemoDeviceConfig::Simulator;
|
||||
}
|
||||
|
||||
void MaemoQemuManager::notify(const QList<int> uniqueIds)
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "maemodeployables.h"
|
||||
#include "maemodeploystep.h"
|
||||
#include "maemodeviceconfiglistmodel.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemoqemumanager.h"
|
||||
#include "maemoremotemountsmodel.h"
|
||||
@@ -211,10 +210,10 @@ QString MaemoRunConfiguration::defaultDisplayName()
|
||||
return tr("Run on Maemo device");
|
||||
}
|
||||
|
||||
MaemoDeviceConfig MaemoRunConfiguration::deviceConfig() const
|
||||
MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const
|
||||
{
|
||||
const MaemoDeployStep * const step = deployStep();
|
||||
return step ? step->deviceConfigModel()->current() : MaemoDeviceConfig();
|
||||
return step ? step->deviceConfig() : MaemoDeviceConfig::ConstPtr();
|
||||
}
|
||||
|
||||
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
||||
@@ -282,7 +281,7 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
|
||||
|
||||
QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(deviceConfig().server.uname)
|
||||
return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().uname)
|
||||
+ QLatin1String("/gdbSourcesDir_")
|
||||
+ QFileInfo(localExecutableFilePath()).fileName();
|
||||
}
|
||||
@@ -307,15 +306,16 @@ QString MaemoRunConfiguration::remoteExecutableFilePath() const
|
||||
|
||||
MaemoPortList MaemoRunConfiguration::freePorts() const
|
||||
{
|
||||
const MaemoDeviceConfig &devConfig = deviceConfig();
|
||||
const Qt4BuildConfiguration * const qt4bc = activeQt4BuildConfiguration();
|
||||
if (devConfig.type == MaemoDeviceConfig::Simulator && qt4bc) {
|
||||
if (!deviceConfig())
|
||||
return MaemoPortList();
|
||||
if (deviceConfig()->type() == MaemoDeviceConfig::Simulator && qt4bc) {
|
||||
MaemoQemuRuntime rt;
|
||||
const int id = qt4bc->qtVersion()->uniqueId();
|
||||
if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
|
||||
return rt.m_freePorts;
|
||||
}
|
||||
return devConfig.freePorts();
|
||||
return deviceConfig()->freePorts();
|
||||
}
|
||||
|
||||
bool MaemoRunConfiguration::useRemoteGdb() const
|
||||
@@ -367,15 +367,13 @@ void MaemoRunConfiguration::handleDeployConfigChanged()
|
||||
for (int i = 0; i < deployConfigs.count(); ++i) {
|
||||
MaemoDeployStep * const step
|
||||
= MaemoGlobal::buildStep<MaemoDeployStep>(deployConfigs.at(i));
|
||||
MaemoDeviceConfigListModel * const devConfigModel
|
||||
= step->deviceConfigModel();
|
||||
if (!step)
|
||||
continue;
|
||||
if (deployConfigs.at(i) == activeDeployConf) {
|
||||
connect(devConfigModel, SIGNAL(currentChanged()), this,
|
||||
SLOT(updateDeviceConfigurations()));
|
||||
connect(devConfigModel, SIGNAL(modelReset()), this,
|
||||
connect(step, SIGNAL(deviceConfigChanged()),
|
||||
SLOT(updateDeviceConfigurations()));
|
||||
} else {
|
||||
disconnect(devConfigModel, 0, this,
|
||||
disconnect(step, 0, this,
|
||||
SLOT(updateDeviceConfigurations()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
const QString targetRoot() const;
|
||||
const QString arguments() const;
|
||||
void setArguments(const QString &args);
|
||||
MaemoDeviceConfig deviceConfig() const;
|
||||
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const;
|
||||
MaemoPortList freePorts() const;
|
||||
bool useRemoteGdb() const;
|
||||
void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; }
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "maemodeployables.h"
|
||||
#include "maemodeploystep.h"
|
||||
#include "maemodeviceconfiglistmodel.h"
|
||||
#include "maemodeviceenvreader.h"
|
||||
#include "maemomanager.h"
|
||||
#include "maemoglobal.h"
|
||||
@@ -374,7 +373,7 @@ void MaemoRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &
|
||||
|
||||
void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged()
|
||||
{
|
||||
m_devConfLabel->setText(m_runConfiguration->deviceConfig().name);
|
||||
m_devConfLabel->setText(MaemoGlobal::deviceConfigurationName(m_runConfiguration->deviceConfig()));
|
||||
updateMountWarning();
|
||||
}
|
||||
|
||||
@@ -534,7 +533,6 @@ void MaemoRunConfigurationWidget::updateMountWarning()
|
||||
{
|
||||
QString mountWarning;
|
||||
const MaemoPortList &portList = m_runConfiguration->freePorts();
|
||||
if (portList.hasMore()) {
|
||||
const int availablePortCount = portList.count();
|
||||
const int mountDirCount
|
||||
= m_runConfiguration->remoteMounts()->validMountSpecificationCount();
|
||||
@@ -550,9 +548,8 @@ void MaemoRunConfigurationWidget::updateMountWarning()
|
||||
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);
|
||||
}
|
||||
"application with this configuration.", 0, portsLeftByDebuggers)
|
||||
.arg(mountDirCount);
|
||||
}
|
||||
}
|
||||
if (mountWarning.isEmpty()) {
|
||||
|
||||
@@ -164,8 +164,7 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
const MaemoRunConfiguration * const maemoRunConfig
|
||||
= qobject_cast<MaemoRunConfiguration *>(runConfiguration);
|
||||
if (!maemoRunConfig
|
||||
|| !maemoRunConfig->deviceConfig().isValid()
|
||||
|| !maemoRunConfig->toolchain()
|
||||
|| !maemoRunConfig->deviceConfig() || !maemoRunConfig->toolchain()
|
||||
|| maemoRunConfig->remoteExecutableFilePath().isEmpty())
|
||||
return false;
|
||||
const int freePortCount = maemoRunConfig->freePorts().count();
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "maemosshrunner.h"
|
||||
|
||||
#include "maemodeploystep.h"
|
||||
#include "maemodeviceconfigurations.h"
|
||||
#include "maemoglobal.h"
|
||||
#include "maemoremotemounter.h"
|
||||
#include "maemoremotemountsmodel.h"
|
||||
@@ -101,7 +100,7 @@ void MaemoSshRunner::start()
|
||||
emitError(tr("Cannot run: No remote executable set."));
|
||||
return;
|
||||
}
|
||||
if (!m_devConfig.isValid()) {
|
||||
if (!m_devConfig) {
|
||||
emitError(tr("Cannot run: No device configuration set."));
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +121,7 @@ void MaemoSshRunner::start()
|
||||
handleConnected();
|
||||
} else {
|
||||
emit reportProgress(tr("Connecting to device..."));
|
||||
m_connection->connectToHost(m_devConfig.server);
|
||||
m_connection->connectToHost(m_devConfig->sshParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +299,7 @@ void MaemoSshRunner::handleRemoteProcessFinished(int exitStatus)
|
||||
bool MaemoSshRunner::isConnectionUsable() const
|
||||
{
|
||||
return m_connection && m_connection->state() == SshConnection::Connected
|
||||
&& m_connection->connectionParameters() == m_devConfig.server;
|
||||
&& m_connection->connectionParameters() == m_devConfig->sshParameters();
|
||||
}
|
||||
|
||||
void MaemoSshRunner::setState(State newState)
|
||||
|
||||
@@ -69,10 +69,8 @@ public:
|
||||
void startExecution(const QByteArray &remoteCall);
|
||||
|
||||
QSharedPointer<Core::SshConnection> connection() const { return m_connection; }
|
||||
|
||||
const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; }
|
||||
MaemoPortList *freePorts() { return &m_freePorts; }
|
||||
MaemoDeviceConfig deviceConfig() const { return m_devConfig; }
|
||||
QString remoteExecutable() const { return m_remoteExecutable; }
|
||||
QString arguments() const { return m_appArguments; }
|
||||
QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; }
|
||||
@@ -116,7 +114,7 @@ private:
|
||||
|
||||
MaemoRemoteMounter * const m_mounter;
|
||||
MaemoUsedPortsGatherer * const m_portsGatherer;
|
||||
const MaemoDeviceConfig m_devConfig;
|
||||
const QSharedPointer<const MaemoDeviceConfig> m_devConfig;
|
||||
const QString m_remoteExecutable;
|
||||
const QString m_appArguments;
|
||||
const QList<Utils::EnvironmentItem> m_userEnvChanges;
|
||||
|
||||
@@ -24,7 +24,6 @@ HEADERS += \
|
||||
$$PWD/maemoglobal.h \
|
||||
$$PWD/maemosshrunner.h \
|
||||
$$PWD/maemodebugsupport.h \
|
||||
$$PWD/maemodeviceconfiglistmodel.h \
|
||||
$$PWD/maemoremotemountsmodel.h \
|
||||
$$PWD/maemodeviceenvreader.h \
|
||||
$$PWD/maemotemplatesmanager.h \
|
||||
@@ -71,7 +70,6 @@ SOURCES += \
|
||||
$$PWD/maemoglobal.cpp \
|
||||
$$PWD/maemosshrunner.cpp \
|
||||
$$PWD/maemodebugsupport.cpp \
|
||||
$$PWD/maemodeviceconfiglistmodel.cpp \
|
||||
$$PWD/maemoremotemountsmodel.cpp \
|
||||
$$PWD/maemodeviceenvreader.cpp \
|
||||
$$PWD/maemotemplatesmanager.cpp \
|
||||
|
||||
Reference in New Issue
Block a user