forked from qt-creator/qt-creator
Fill in default qemu simulator path but keep the user option to choose.
This commit is contained in:
@@ -55,6 +55,7 @@
|
|||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QRadioButton>
|
#include <QtGui/QRadioButton>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -82,6 +83,8 @@ private slots:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void updateTargetInformation();
|
void updateTargetInformation();
|
||||||
|
|
||||||
|
void updateSimulatorPath();
|
||||||
void updateVisibleSimulatorParameter();
|
void updateVisibleSimulatorParameter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -250,6 +253,9 @@ static const QLatin1String LastDeployedKey("LastDeployed");
|
|||||||
static const QLatin1String DebuggingHelpersLastDeployedKey(
|
static const QLatin1String DebuggingHelpersLastDeployedKey(
|
||||||
"DebuggingHelpersLastDeployed");
|
"DebuggingHelpersLastDeployed");
|
||||||
|
|
||||||
|
static const QLatin1String SimulatorPath("SimulatorPath");
|
||||||
|
static const QLatin1String IsUserSetSimulator("IsUserSetSimulator");
|
||||||
|
|
||||||
#if USE_SSL_PASSWORD
|
#if USE_SSL_PASSWORD
|
||||||
static const QLatinString RemoteUserPasswordKey("RemoteUserPassword");
|
static const QLatinString RemoteUserPasswordKey("RemoteUserPassword");
|
||||||
static const QLatinString RemoteHostRequiresPasswordKey(
|
static const QLatinString RemoteHostRequiresPasswordKey(
|
||||||
@@ -262,6 +268,7 @@ MaemoRunConfiguration::MaemoRunConfiguration(Project *project,
|
|||||||
, m_proFilePath(proFilePath)
|
, m_proFilePath(proFilePath)
|
||||||
, m_cachedTargetInformationValid(false)
|
, m_cachedTargetInformationValid(false)
|
||||||
, m_cachedSimulatorInformationValid(false)
|
, m_cachedSimulatorInformationValid(false)
|
||||||
|
, m_isUserSetSimulator(false)
|
||||||
, m_remotePortSim(22)
|
, m_remotePortSim(22)
|
||||||
, m_remotePortDevice(22)
|
, m_remotePortDevice(22)
|
||||||
, qemu(0)
|
, qemu(0)
|
||||||
@@ -348,7 +355,9 @@ void MaemoRunConfiguration::save(PersistentSettingsWriter &writer) const
|
|||||||
writer.saveValue(DebuggingHelpersLastDeployedKey,
|
writer.saveValue(DebuggingHelpersLastDeployedKey,
|
||||||
m_debuggingHelpersLastDeployed);
|
m_debuggingHelpersLastDeployed);
|
||||||
|
|
||||||
writer.saveValue("Runtime", m_simulatorPath);
|
writer.saveValue(SimulatorPath, m_simulatorPath);
|
||||||
|
writer.saveValue(IsUserSetSimulator, m_isUserSetSimulator);
|
||||||
|
|
||||||
const QDir &dir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
const QDir &dir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||||
writer.saveValue("ProFile", dir.relativeFilePath(m_proFilePath));
|
writer.saveValue("ProFile", dir.relativeFilePath(m_proFilePath));
|
||||||
|
|
||||||
@@ -383,7 +392,9 @@ void MaemoRunConfiguration::restore(const PersistentSettingsReader &reader)
|
|||||||
m_debuggingHelpersLastDeployed =
|
m_debuggingHelpersLastDeployed =
|
||||||
reader.restoreValue(DebuggingHelpersLastDeployedKey).toDateTime();
|
reader.restoreValue(DebuggingHelpersLastDeployedKey).toDateTime();
|
||||||
|
|
||||||
m_simulatorPath = reader.restoreValue("Runtime").toString();
|
m_simulatorPath = reader.restoreValue(SimulatorPath).toString();
|
||||||
|
m_isUserSetSimulator = reader.restoreValue(IsUserSetSimulator).toBool();
|
||||||
|
|
||||||
const QDir &dir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
const QDir &dir = QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||||
m_proFilePath = dir.filePath(reader.restoreValue("ProFile").toString());
|
m_proFilePath = dir.filePath(reader.restoreValue("ProFile").toString());
|
||||||
}
|
}
|
||||||
@@ -611,16 +622,17 @@ void MaemoRunConfiguration::invalidateCachedTargetInformation()
|
|||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::setSimulatorPath(const QString &path)
|
void MaemoRunConfiguration::setUserSimulatorPath(const QString &path)
|
||||||
{
|
{
|
||||||
qDebug("MaemoRunConfiguration::setSimulatorPath() called, "
|
qDebug("MaemoRunConfiguration::setUserSimulatorPath() called, "
|
||||||
"m_simulatorPath: %s, new path: %s", qPrintable(m_simulatorPath),
|
"m_simulatorPath: %s, new path: %s", qPrintable(m_simulatorPath),
|
||||||
qPrintable(path));
|
qPrintable(path));
|
||||||
|
|
||||||
if (m_simulatorPath != path)
|
m_isUserSetSimulator = true;
|
||||||
|
if (m_userSimulatorPath != path)
|
||||||
m_cachedSimulatorInformationValid = false;
|
m_cachedSimulatorInformationValid = false;
|
||||||
|
|
||||||
m_simulatorPath = path;
|
m_userSimulatorPath = path;
|
||||||
emit cachedSimulatorInformationChanged();
|
emit cachedSimulatorInformationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,6 +645,15 @@ void MaemoRunConfiguration::invalidateCachedSimulatorInformation()
|
|||||||
emit cachedSimulatorInformationChanged();
|
emit cachedSimulatorInformationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoRunConfiguration::resetCachedSimulatorInformation()
|
||||||
|
{
|
||||||
|
m_userSimulatorPath.clear();
|
||||||
|
m_isUserSetSimulator = false;
|
||||||
|
|
||||||
|
m_cachedSimulatorInformationValid = false;
|
||||||
|
emit cachedSimulatorInformationChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::updateTarget()
|
void MaemoRunConfiguration::updateTarget()
|
||||||
{
|
{
|
||||||
if (m_cachedTargetInformationValid)
|
if (m_cachedTargetInformationValid)
|
||||||
@@ -732,47 +753,56 @@ void MaemoRunConfiguration::updateTarget()
|
|||||||
|
|
||||||
void MaemoRunConfiguration::updateSimulatorInformation()
|
void MaemoRunConfiguration::updateSimulatorInformation()
|
||||||
{
|
{
|
||||||
qDebug("MaemoRunConfiguration::updateSimulatorInformation() called");
|
|
||||||
|
|
||||||
if (m_cachedSimulatorInformationValid)
|
if (m_cachedSimulatorInformationValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_simulator = QString::null;
|
m_simulator = QString::null;
|
||||||
m_simulatorArgs == QString::null;
|
m_simulatorArgs == QString::null;
|
||||||
m_cachedSimulatorInformationValid = true;
|
m_cachedSimulatorInformationValid = true;
|
||||||
m_visibleSimulatorParameter = tr("Please select a Maemo simulator.");
|
m_simulatorPath = QDir::toNativeSeparators(m_userSimulatorPath);
|
||||||
|
m_visibleSimulatorParameter = tr("Could not autodetect target simulator, "
|
||||||
|
"please choose one on your own.");
|
||||||
|
|
||||||
|
if (!m_isUserSetSimulator)
|
||||||
|
m_simulatorPath = QDir::toNativeSeparators(toolchain()->simulatorRoot());
|
||||||
|
|
||||||
if (!m_simulatorPath.isEmpty()) {
|
if (!m_simulatorPath.isEmpty()) {
|
||||||
m_visibleSimulatorParameter = tr("'%1' is not a valid Maemo simulator.")
|
m_visibleSimulatorParameter = tr("'%1' is not a valid Maemo simulator.")
|
||||||
.arg(m_simulatorPath);
|
.arg(m_simulatorPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &files = QDir(m_simulatorPath).entryList(QDir::Files
|
QDir dir(m_simulatorPath);
|
||||||
| QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
if (dir.exists(m_simulatorPath)) {
|
||||||
if (files.count() >= 2) {
|
const QStringList &files = dir.entryList(QDir::Files | QDir::NoSymLinks
|
||||||
const QLatin1String info("information");
|
| QDir::NoDotAndDotDot);
|
||||||
if (files.contains(info)) {
|
if (files.count() >= 2) {
|
||||||
QFile file(m_simulatorPath + QLatin1Char('/') + info);
|
const QLatin1String info("information");
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (files.contains(info)) {
|
||||||
QMap<QString, QString> map;
|
QFile file(m_simulatorPath + QLatin1Char('/') + info);
|
||||||
QTextStream stream(&file);
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
while (!stream.atEnd()) {
|
QMap<QString, QString> map;
|
||||||
const QString &line = stream.readLine().trimmed();
|
QTextStream stream(&file);
|
||||||
const int index = line.indexOf(QLatin1Char('='));
|
while (!stream.atEnd()) {
|
||||||
map.insert(line.mid(0, index).remove(QLatin1Char('\'')),
|
const QString &line = stream.readLine().trimmed();
|
||||||
line.mid(index + 1).remove(QLatin1Char('\'')));
|
const int index = line.indexOf(QLatin1Char('='));
|
||||||
}
|
map.insert(line.mid(0, index).remove(QLatin1Char('\'')),
|
||||||
|
line.mid(index + 1).remove(QLatin1Char('\'')));
|
||||||
|
}
|
||||||
|
|
||||||
m_simulator = map.value(QLatin1String("runcommand"));
|
m_simulator = map.value(QLatin1String("runcommand"));
|
||||||
m_simulatorArgs = map.value(QLatin1String("runcommand_args"));
|
m_simulatorArgs = map.value(QLatin1String("runcommand_args"));
|
||||||
|
|
||||||
m_visibleSimulatorParameter = m_simulator
|
m_visibleSimulatorParameter = m_simulator
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
+ QLatin1String(".exe")
|
+ QLatin1String(".exe")
|
||||||
#endif
|
#endif
|
||||||
+ QLatin1Char(' ') + m_simulatorArgs;
|
+ QLatin1Char(' ') + m_simulatorArgs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_visibleSimulatorParameter = tr("'%1' could not be found. Please "
|
||||||
|
"choose a simulator on your own.").arg(m_simulatorPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit cachedSimulatorInformationChanged();
|
emit cachedSimulatorInformationChanged();
|
||||||
@@ -856,11 +886,29 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
|
|||||||
m_chooseSimPathLabel = new QLabel(tr("Choose simulator:"));
|
m_chooseSimPathLabel = new QLabel(tr("Choose simulator:"));
|
||||||
m_simPathChooser = new Utils::PathChooser;
|
m_simPathChooser = new Utils::PathChooser;
|
||||||
m_simPathChooser->setPath(m_runConfiguration->simulatorPath());
|
m_simPathChooser->setPath(m_runConfiguration->simulatorPath());
|
||||||
mainLayout->addRow(m_chooseSimPathLabel, m_simPathChooser);
|
|
||||||
|
QHBoxLayout *pathLayout = new QHBoxLayout;
|
||||||
|
pathLayout->addWidget(m_simPathChooser);
|
||||||
|
|
||||||
|
QToolButton *resetButton = new QToolButton();
|
||||||
|
resetButton->setToolTip(tr("Reset to default"));
|
||||||
|
resetButton->setIcon(QIcon(":/core/images/reset.png"));
|
||||||
|
pathLayout->addWidget(resetButton);
|
||||||
|
|
||||||
|
mainLayout->addRow(m_chooseSimPathLabel, pathLayout);
|
||||||
m_simParamsNameLabel = new QLabel(tr("Simulator command line:"));
|
m_simParamsNameLabel = new QLabel(tr("Simulator command line:"));
|
||||||
m_simParamsValueLabel= new QLabel(m_runConfiguration->visibleSimulatorParameter());
|
m_simParamsValueLabel= new QLabel(m_runConfiguration->visibleSimulatorParameter());
|
||||||
mainLayout->addRow(m_simParamsNameLabel, m_simParamsValueLabel);
|
mainLayout->addRow(m_simParamsNameLabel, m_simParamsValueLabel);
|
||||||
|
|
||||||
|
connect(m_simPathChooser, SIGNAL(changed(QString)), m_runConfiguration,
|
||||||
|
SLOT(setUserSimulatorPath(QString)));
|
||||||
|
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
|
||||||
|
this, SLOT(updateSimulatorPath()));
|
||||||
|
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
|
||||||
|
this, SLOT(updateVisibleSimulatorParameter()));
|
||||||
|
connect(resetButton, SIGNAL(clicked()), m_runConfiguration,
|
||||||
|
SLOT(resetCachedSimulatorInformation()));
|
||||||
|
|
||||||
m_hostNameLineEdit = new QLineEdit(m_runConfiguration->remoteHostName());
|
m_hostNameLineEdit = new QLineEdit(m_runConfiguration->remoteHostName());
|
||||||
mainLayout->addRow(tr("Remote host name:"), m_hostNameLineEdit);
|
mainLayout->addRow(tr("Remote host name:"), m_hostNameLineEdit);
|
||||||
m_userLineEdit = new QLineEdit(m_runConfiguration->remoteUserName());
|
m_userLineEdit = new QLineEdit(m_runConfiguration->remoteUserName());
|
||||||
@@ -878,6 +926,11 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
|
|||||||
m_passwordLineEdit->setEchoMode(QLineEdit::Password);
|
m_passwordLineEdit->setEchoMode(QLineEdit::Password);
|
||||||
m_passwordLineEdit->setEnabled(m_passwordCheckBox->isChecked());
|
m_passwordLineEdit->setEnabled(m_passwordCheckBox->isChecked());
|
||||||
mainLayout->addRow(m_passwordCheckBox, m_passwordLineEdit);
|
mainLayout->addRow(m_passwordCheckBox, m_passwordLineEdit);
|
||||||
|
|
||||||
|
connect(m_passwordCheckBox, SIGNAL(stateChanged(int)), this,
|
||||||
|
SLOT(passwordUseChanged()));
|
||||||
|
connect(m_passwordLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
|
SLOT(passwordEdited(QString)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
|
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
@@ -892,18 +945,8 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
|
|||||||
SLOT(hostNameEdited(QString)));
|
SLOT(hostNameEdited(QString)));
|
||||||
connect(m_userLineEdit, SIGNAL(textEdited(QString)), this,
|
connect(m_userLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
SLOT(userNameEdited(QString)));
|
SLOT(userNameEdited(QString)));
|
||||||
#if USE_SSL_PASSWORD
|
|
||||||
connect(m_passwordCheckBox, SIGNAL(stateChanged(int)), this,
|
|
||||||
SLOT(passwordUseChanged()));
|
|
||||||
connect(m_passwordLineEdit, SIGNAL(textEdited(QString)), this,
|
|
||||||
SLOT(passwordEdited(QString)));
|
|
||||||
#endif
|
|
||||||
connect(m_portLineEdit, SIGNAL(textEdited(QString)), this,
|
connect(m_portLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
SLOT(portEdited(QString)));
|
SLOT(portEdited(QString)));
|
||||||
connect(m_simPathChooser, SIGNAL(changed(QString)), m_runConfiguration,
|
|
||||||
SLOT(setSimulatorPath(QString)));
|
|
||||||
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
|
|
||||||
this, SLOT(updateVisibleSimulatorParameter()));
|
|
||||||
if (m_runConfiguration->remoteHostIsSimulator())
|
if (m_runConfiguration->remoteHostIsSimulator())
|
||||||
m_simButton->setChecked(true);
|
m_simButton->setChecked(true);
|
||||||
else
|
else
|
||||||
@@ -925,6 +968,11 @@ void MaemoRunConfigurationWidget::updateTargetInformation()
|
|||||||
m_executableLabel->setText(m_runConfiguration->executable());
|
m_executableLabel->setText(m_runConfiguration->executable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoRunConfigurationWidget::updateSimulatorPath()
|
||||||
|
{
|
||||||
|
m_simPathChooser->setPath(m_runConfiguration->simulatorPath());
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoRunConfigurationWidget::updateVisibleSimulatorParameter()
|
void MaemoRunConfigurationWidget::updateVisibleSimulatorParameter()
|
||||||
{
|
{
|
||||||
m_simParamsValueLabel->setText(m_runConfiguration->visibleSimulatorParameter());
|
m_simParamsValueLabel->setText(m_runConfiguration->visibleSimulatorParameter());
|
||||||
@@ -1017,7 +1065,7 @@ QString MaemoRunConfigurationFactory::displayNameForType(
|
|||||||
const QString &type) const
|
const QString &type) const
|
||||||
{
|
{
|
||||||
const int size = QString::fromLocal8Bit("MaemoRunConfiguration.").size();
|
const int size = QString::fromLocal8Bit("MaemoRunConfiguration.").size();
|
||||||
return tr("%1 on Maemo device").arg(QFileInfo(type.mid(size))
|
return tr("%1 on Maemo Device").arg(QFileInfo(type.mid(size))
|
||||||
.completeBaseName());
|
.completeBaseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,8 +129,9 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void invalidateCachedTargetInformation();
|
void invalidateCachedTargetInformation();
|
||||||
|
|
||||||
void setSimulatorPath(const QString &path);
|
void setUserSimulatorPath(const QString &path);
|
||||||
void invalidateCachedSimulatorInformation();
|
void invalidateCachedSimulatorInformation();
|
||||||
|
void resetCachedSimulatorInformation();
|
||||||
|
|
||||||
void startStopQemu();
|
void startStopQemu();
|
||||||
void qemuProcessFinished();
|
void qemuProcessFinished();
|
||||||
@@ -156,6 +157,9 @@ private:
|
|||||||
QString m_visibleSimulatorParameter;
|
QString m_visibleSimulatorParameter;
|
||||||
bool m_cachedSimulatorInformationValid;
|
bool m_cachedSimulatorInformationValid;
|
||||||
|
|
||||||
|
bool m_isUserSetSimulator;
|
||||||
|
QString m_userSimulatorPath;
|
||||||
|
|
||||||
QString m_gdbPath;
|
QString m_gdbPath;
|
||||||
|
|
||||||
// Information about the remote host.
|
// Information about the remote host.
|
||||||
|
|||||||
Reference in New Issue
Block a user