Commit 2cad027d authored by kh1's avatar kh1
Browse files

Remove superfluous code to handle user settable simulator path.

Reviewed-by: ck
parent ae0ee18a
......@@ -164,8 +164,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Project *project,
, m_simulatorSshPort(source->m_simulatorSshPort)
, m_simulatorGdbServerPort(source->m_simulatorGdbServerPort)
, m_cachedSimulatorInformationValid(false)
, m_isUserSetSimulator(source->m_isUserSetSimulator)
, m_userSimulatorPath(source->m_userSimulatorPath)
, m_gdbPath(source->m_gdbPath)
, m_devConfig(source->m_devConfig)
, m_arguments(source->m_arguments)
......@@ -396,27 +394,38 @@ QString MaemoRunConfiguration::simulatorPath() const
qDebug("MaemoRunConfiguration::simulatorPath() called, %s",
qPrintable(m_simulatorPath));
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
if (!m_cachedSimulatorInformationValid)
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
return m_simulatorPath;
}
QString MaemoRunConfiguration::visibleSimulatorParameter() const
{
qDebug("MaemoRunConfiguration::visibleSimulatorParameter() called");
qDebug("MaemoRunConfiguration::visibleSimulatorParameter() called, %s",
qPrintable(m_visibleSimulatorParameter));
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
if (!m_cachedSimulatorInformationValid)
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
return m_visibleSimulatorParameter;
}
QString MaemoRunConfiguration::simulator() const
{
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
qDebug("MaemoRunConfiguration::simulator() called, %s",
qPrintable(m_simulator));
if (!m_cachedSimulatorInformationValid)
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
return m_simulator;
}
QString MaemoRunConfiguration::simulatorArgs() const
{
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
qDebug("MaemoRunConfiguration::simulatorArgs() called, %s",
qPrintable(m_simulatorArgs));
if (!m_cachedSimulatorInformationValid)
const_cast<MaemoRunConfiguration*> (this)->updateSimulatorInformation();
return m_simulatorArgs;
}
......@@ -425,7 +434,6 @@ void MaemoRunConfiguration::setArguments(const QStringList &args)
m_arguments = args;
}
bool MaemoRunConfiguration::isQemuRunning() const
{
return (qemu && qemu->state() != QProcess::NotRunning);
......@@ -437,38 +445,6 @@ void MaemoRunConfiguration::invalidateCachedTargetInformation()
emit targetInformationChanged();
}
void MaemoRunConfiguration::setUserSimulatorPath(const QString &path)
{
qDebug("MaemoRunConfiguration::setUserSimulatorPath() called, "
"m_simulatorPath: %s, new path: %s", qPrintable(m_simulatorPath),
qPrintable(path));
m_isUserSetSimulator = true;
if (m_userSimulatorPath != path)
m_cachedSimulatorInformationValid = false;
m_userSimulatorPath = path;
emit cachedSimulatorInformationChanged();
}
void MaemoRunConfiguration::invalidateCachedSimulatorInformation()
{
qDebug("MaemoRunConfiguration::invalidateCachedSimulatorInformation() "
"called");
m_cachedSimulatorInformationValid = false;
emit cachedSimulatorInformationChanged();
}
void MaemoRunConfiguration::resetCachedSimulatorInformation()
{
m_userSimulatorPath.clear();
m_isUserSetSimulator = false;
m_cachedSimulatorInformationValid = false;
emit cachedSimulatorInformationChanged();
}
void MaemoRunConfiguration::updateTarget()
{
if (m_cachedTargetInformationValid)
......@@ -502,20 +478,17 @@ void MaemoRunConfiguration::updateSimulatorInformation()
return;
m_simulator.clear();
m_simulatorPath.clear();
m_simulatorArgs.clear();
m_visibleSimulatorParameter.clear();
m_cachedSimulatorInformationValid = true;
m_simulatorPath = QDir::toNativeSeparators(m_userSimulatorPath);
m_visibleSimulatorParameter = tr("Could not autodetect target simulator, "
"please choose one on your own.");
if (!m_isUserSetSimulator) {
if (const MaemoToolChain *tc = toolchain())
m_simulatorPath = QDir::toNativeSeparators(tc->simulatorRoot());
}
if (const MaemoToolChain *tc = toolchain())
m_simulatorPath = QDir::toNativeSeparators(tc->simulatorRoot());
if (!m_simulatorPath.isEmpty()) {
m_visibleSimulatorParameter = tr("'%1' is not a valid Maemo simulator.")
.arg(m_simulatorPath);
m_visibleSimulatorParameter = tr("'%1' does not contain a valid Maemo "
"simulator image.").arg(m_simulatorPath);
}
QDir dir(m_simulatorPath);
......@@ -555,8 +528,8 @@ void MaemoRunConfiguration::updateSimulatorInformation()
}
}
} else {
m_visibleSimulatorParameter = tr("'%1' could not be found. Please "
"choose a simulator on your own.").arg(m_simulatorPath);
m_visibleSimulatorParameter = tr("'%1' could not be found. Do you have "
"already installed a Maemo simulator image?").arg(m_simulatorPath);
}
emit cachedSimulatorInformationChanged();
......
......@@ -123,10 +123,6 @@ private slots:
void updateDeviceConfigurations();
void invalidateCachedTargetInformation();
void setUserSimulatorPath(const QString &path);
void invalidateCachedSimulatorInformation();
void resetCachedSimulatorInformation();
void startStopQemu();
void qemuProcessFinished();
......@@ -153,9 +149,6 @@ private:
QString m_simulatorGdbServerPort;
bool m_cachedSimulatorInformationValid;
bool m_isUserSetSimulator;
QString m_userSimulatorPath;
QString m_gdbPath;
MaemoDeviceConfig m_devConfig;
......
......@@ -82,9 +82,9 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
m_debuggerLabel = new QLabel(m_runConfiguration->gdbCmd());
mainLayout->addRow(tr("Debugger:"), m_debuggerLabel);
mainLayout->addItem(new QSpacerItem(10, 10));
m_simPathNameLabel = new QLabel(tr("Simulator Path:"));
m_simPathValueLabel = new QLabel(m_runConfiguration->simulatorPath());
mainLayout->addRow(m_simPathNameLabel, m_simPathValueLabel);
m_simNameLabel = new QLabel(tr("Simulator:"));
m_simValueLabel = new QLabel(m_runConfiguration->visibleSimulatorParameter());
mainLayout->addRow(m_simNameLabel, m_simValueLabel);
resetDeviceConfigurations();
connect(m_runConfiguration, SIGNAL(cachedSimulatorInformationChanged()),
......@@ -121,7 +121,7 @@ void MaemoRunConfigurationWidget::updateTargetInformation()
void MaemoRunConfigurationWidget::updateSimulatorPath()
{
m_simPathValueLabel->setText(m_runConfiguration->simulatorPath());
m_simValueLabel->setText(m_runConfiguration->visibleSimulatorParameter());
}
void MaemoRunConfigurationWidget::deviceConfigurationChanged(const QString &name)
......@@ -135,8 +135,8 @@ void MaemoRunConfigurationWidget::deviceConfigurationChanged(const QString &name
void MaemoRunConfigurationWidget::setSimInfoVisible(const MaemoDeviceConfig &devConf)
{
const bool isSimulator = devConf.type == MaemoDeviceConfig::Simulator;
m_simPathNameLabel->setVisible(isSimulator);
m_simPathValueLabel->setVisible(isSimulator);
m_simNameLabel->setVisible(isSimulator);
m_simValueLabel->setVisible(isSimulator);
}
void MaemoRunConfigurationWidget::resetDeviceConfigurations()
......
......@@ -74,8 +74,8 @@ private:
QLabel *m_executableLabel;
QLabel *m_debuggerLabel;
QComboBox *m_devConfBox;
QLabel *m_simPathNameLabel;
QLabel *m_simPathValueLabel;
QLabel *m_simNameLabel;
QLabel *m_simValueLabel;
MaemoRunConfiguration *m_runConfiguration;
};
......
Supports Markdown
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