Commit 29c304bd authored by ck's avatar ck

Maemo: Determine host address from device automatically.

Reviewed-by: kh1
parent 3aa3c568
......@@ -69,7 +69,6 @@ static const QLatin1String ProFileKey(PREFIX ".ProFile");
static const QLatin1String ExportedLocalDirsKey(PREFIX ".ExportedLocalDirs");
static const QLatin1String RemoteMountPointsKey(PREFIX ".RemoteMountPoints");
static const QLatin1String MountPortsKey(PREFIX ".MountPorts");
static const QLatin1String HostAddressFromDeviceKey(PREFIX ".HostAddressFromDevice");
static const QLatin1String BaseEnvironmentBaseKey(PREFIX ".BaseEnvironmentBase");
static const QLatin1String UserEnvironmentChangesKey(PREFIX ".UserEnvironmentChanges");
static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb");
......
......@@ -56,7 +56,6 @@ namespace Qt4ProjectManager {
namespace Internal {
namespace {
const QLatin1String DefaultHostAddress("192.168.2.14");
const bool DefaultUseRemoteGdbValue = false; // TODO: Make true once utfs-server works on Windows.
const int DefaultGdbMountPort = 10100;
} // anonymous namespace
......@@ -67,7 +66,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
const QString &proFilePath)
: RunConfiguration(parent, QLatin1String(MAEMO_RC_ID))
, m_proFilePath(proFilePath)
, m_hostAddressFromDevice(DefaultHostAddress)
, m_useRemoteGdb(DefaultUseRemoteGdbValue)
, m_gdbMountPort(DefaultGdbMountPort)
, m_baseEnvironmentBase(SystemEnvironmentBase)
......@@ -81,7 +79,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
, m_proFilePath(source->m_proFilePath)
, m_gdbPath(source->m_gdbPath)
, m_arguments(source->m_arguments)
, m_hostAddressFromDevice(source->localHostAddressFromDevice())
, m_useRemoteGdb(source->useRemoteGdb())
, m_gdbMountPort(source->gdbMountPort())
, m_baseEnvironmentBase(source->m_baseEnvironmentBase)
......@@ -152,7 +149,6 @@ QVariantMap MaemoRunConfiguration::toMap() const
map.insert(ArgumentsKey, m_arguments);
const QDir dir = QDir(target()->project()->projectDirectory());
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
map.insert(HostAddressFromDeviceKey, m_hostAddressFromDevice);
map.insert(UseRemoteGdbKey, useRemoteGdb());
map.insert(GdbMountPortKey, gdbMountPort());
map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase);
......@@ -171,8 +167,6 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
m_arguments = map.value(ArgumentsKey).toStringList();
const QDir dir = QDir(target()->project()->projectDirectory());
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
m_hostAddressFromDevice = map.value(HostAddressFromDeviceKey,
DefaultHostAddress).toString();
m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
m_gdbMountPort = map.value(GdbMountPortKey, DefaultGdbMountPort).toInt();
m_userEnvironmentChanges =
......@@ -221,16 +215,6 @@ MaemoDeployStep *MaemoRunConfiguration::deployStep() const
return step;
}
QString MaemoRunConfiguration::localHostAddressFromDevice() const
{
return m_hostAddressFromDevice;
}
void MaemoRunConfiguration::setLocalHostAddressFromDevice(const QString &address)
{
m_hostAddressFromDevice = address;
}
QString MaemoRunConfiguration::maddeRoot() const
{
if (const MaemoToolChain *tc = toolchain())
......
......@@ -82,8 +82,6 @@ public:
MaemoDeployStep *deployStep() const;
MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
QString localHostAddressFromDevice() const;
void setLocalHostAddressFromDevice(const QString &address);
const MaemoToolChain *toolchain() const;
QString maddeRoot() const;
......@@ -145,7 +143,6 @@ private:
MaemoDeviceConfigListModel *m_devConfigModel;
MaemoRemoteMountsModel *m_remoteMounts;
QStringList m_arguments;
QString m_hostAddressFromDevice;
bool m_useRemoteGdb;
int m_gdbMountPort;
......
......@@ -143,17 +143,8 @@ void MaemoRunConfigurationWidget::addDebuggingWidgets(QVBoxLayout *mainLayout)
debugRadioButtonsLayout->addWidget(gdbButton);
debugRadioButtonsLayout->addWidget(gdbServerButton);
debugRadioButtonsLayout->addStretch(1);
QHBoxLayout *debugHostAddressLayout = new QHBoxLayout;
m_hostAddressLineEdit2 = new QLineEdit;
debugHostAddressLayout->addWidget(m_hostAddressLineEdit2);
debugHostAddressLayout->addStretch(1);
debugLayout->addRow(tr("This host's address from the device:"),
debugHostAddressLayout);
m_hostAddressLineEdit2->setText(m_runConfiguration->localHostAddressFromDevice());
gdbButton->setChecked(m_runConfiguration->useRemoteGdb());
gdbServerButton->setChecked(!gdbButton->isChecked());
connect(m_hostAddressLineEdit2, SIGNAL(textEdited(QString)), this,
SLOT(handleHostAddressChanged(QString)));
connect(gdbButton, SIGNAL(toggled(bool)), this,
SLOT(handleDebuggingTypeChanged(bool)));
QHBoxLayout *spinBoxLayout = new QHBoxLayout;
......@@ -180,17 +171,6 @@ void MaemoRunConfigurationWidget::addMountWidgets(QVBoxLayout *mainLayout)
mainLayout->addWidget(m_mountDetailsContainer);
#endif
QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewWidget);
QHBoxLayout *hostAddressLayout = new QHBoxLayout;
mountViewLayout->addLayout(hostAddressLayout);
QLabel *hostNameLabel
= new QLabel(tr("This host's address from the device:"));
m_hostAddressLineEdit1 = new QLineEdit;
m_hostAddressLineEdit1->setText(m_runConfiguration->localHostAddressFromDevice());
connect(m_hostAddressLineEdit1, SIGNAL(textEdited(QString)), this,
SLOT(handleHostAddressChanged(QString)));
hostAddressLayout->addWidget(hostNameLabel);
hostAddressLayout->addWidget(m_hostAddressLineEdit1);
hostAddressLayout->addStretch(1);
QHBoxLayout *tableLayout = new QHBoxLayout;
mountViewLayout->addLayout(tableLayout);
m_mountView = new QTableView;
......@@ -353,20 +333,12 @@ void MaemoRunConfigurationWidget::changeLocalMountDir(const QModelIndex &index)
}
}
void MaemoRunConfigurationWidget::handleHostAddressChanged(const QString &newAddress)
{
m_hostAddressLineEdit1->setText(newAddress);
m_hostAddressLineEdit2->setText(newAddress);
m_runConfiguration->setLocalHostAddressFromDevice(newAddress);
}
void MaemoRunConfigurationWidget::handleDebuggingTypeChanged(bool useGdb)
{
m_runConfiguration->setUseRemoteGdb(useGdb);
const QString detailsText = useGdb ? tr("Use gdb") : tr("Use gdbserver");
m_debugDetailsContainer->setSummaryText(tr("<b>Debugging details:</b> ")
+ detailsText);
m_hostAddressLineEdit2->setEnabled(useGdb);
m_gdbMountPortSpinBox->setEnabled(useGdb);
}
......
......@@ -80,7 +80,6 @@ private slots:
void removeMount();
void changeLocalMountDir(const QModelIndex &index);
void enableOrDisableRemoveMountSpecButton();
void handleHostAddressChanged(const QString &newAddress);
void handleDebuggingTypeChanged(bool useGdb);
void handleGdbMountPortChanged(int port);
void fetchEnvironment();
......@@ -102,8 +101,6 @@ private:
QLineEdit *m_argsLineEdit;
QLabel *m_executableLabel;
QComboBox *m_devConfBox;
QLineEdit *m_hostAddressLineEdit1;
QLineEdit *m_hostAddressLineEdit2;
QSpinBox *m_gdbMountPortSpinBox;
QTableView *m_mountView;
QToolButton *m_removeMountButton;
......
......@@ -288,9 +288,8 @@ void MaemoSshRunner::mount()
const QString chmod = QString::fromLocal8Bit("%1 chmod a+r+w+x %2")
.arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint);
const QString utfsClient
= QString::fromLocal8Bit("%1 -l %2 -r %2 -c %3:%2 %4")
= QString::fromLocal8Bit("%1 -l %2 -r %2 -c `echo $SSH_CLIENT|cut -d ' ' -f 1`:%2 %4")
.arg(utfsClientOnDevice()).arg(port)
.arg(m_runConfig->localHostAddressFromDevice())
.arg(mountSpec.remoteMountPoint);
remoteCall += andOp + mkdir + andOp + chmod + andOp + utfsClient;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment