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