Commit 8cadee7b authored by con's avatar con
Browse files

Make port selectable.

parent 3419c256
......@@ -26,7 +26,6 @@
* auto-create run configurations the first time s60 qt is selected.
* Run on device
* Finish runner when application exits
* passphrase for signing
* time stamp of copied sisx is ridiculous
* maybe don't copy the sisx all the time
......
......@@ -52,6 +52,7 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Project *project, const QSt
: RunConfiguration(project),
m_proFilePath(proFilePath),
m_cachedTargetInformationValid(false),
m_serialPortName("COM5"),
m_signingMode(SignSelf)
{
if (!m_proFilePath.isEmpty())
......@@ -95,6 +96,7 @@ void S60DeviceRunConfiguration::save(PersistentSettingsWriter &writer) const
writer.saveValue("SigningMode", (int)m_signingMode);
writer.saveValue("CustomSignaturePath", m_customSignaturePath);
writer.saveValue("CustomKeyPath", m_customKeyPath);
writer.saveValue("SerialPortName", m_serialPortName);
RunConfiguration::save(writer);
}
......@@ -106,6 +108,17 @@ void S60DeviceRunConfiguration::restore(const PersistentSettingsReader &reader)
m_signingMode = (SigningMode)reader.restoreValue("SigningMode").toInt();
m_customSignaturePath = reader.restoreValue("CustomSignaturePath").toString();
m_customKeyPath = reader.restoreValue("CustomKeyPath").toString();
m_serialPortName = reader.restoreValue("SerialPortName").toString().trimmed();
}
QString S60DeviceRunConfiguration::serialPortName() const
{
return m_serialPortName;
}
void S60DeviceRunConfiguration::setSerialPortName(const QString &name)
{
m_serialPortName = name.trimmed();
}
QString S60DeviceRunConfiguration::targetName() const
......@@ -251,6 +264,12 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunCon
m_sisxFileLabel = new QLabel(m_runConfiguration->basePackageFilePath() + ".sisx");
formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
QComboBox *serialPorts = new QComboBox;
serialPorts->addItems(QStringList() << "COM1" << "COM2" << "COM3" << "COM4" << "COM5" << "COM6" << "COM7" << "COM8" << "COM9");
serialPorts->setCurrentIndex(m_runConfiguration->serialPortName().mid(3).toInt()-1);
connect(serialPorts, SIGNAL(activated(QString)), this, SLOT(setSerialPort(QString)));
formLayout->addRow(tr("Device on Serial Port:"), serialPorts);
QWidget *signatureWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
signatureWidget->setLayout(layout);
......@@ -312,6 +331,11 @@ void S60DeviceRunConfigurationWidget::updateTargetInformation()
m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + ".sisx");
}
void S60DeviceRunConfigurationWidget::setSerialPort(const QString &portName)
{
m_runConfiguration->setSerialPortName(portName.trimmed());
}
void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
{
if (toggle)
......@@ -440,6 +464,7 @@ void S60DeviceRunControl::start()
Qt4Project *project = qobject_cast<Qt4Project *>(rc->project());
m_serialPortName = rc->serialPortName();
m_targetName = rc->targetName();
m_baseFileName = rc->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
......@@ -541,15 +566,21 @@ void S60DeviceRunControl::signsisProcessFinished()
connect(m_adapter, SIGNAL(startingApplication()), this, SLOT(printStartingNotice()));
connect(m_adapter, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint)));
//TODO com selection, sisx destination and file path user definable
m_adapter->setTrkServerName("COM5");
//TODO sisx destination and file path user definable
m_adapter->setTrkServerName(m_serialPortName);
const QString copySrc(m_baseFileName + ".sisx");
const QString copyDst = QString("C:\\Data\\%1.sisx").arg(QFileInfo(m_baseFileName).fileName());
const QString runFileName = QString("C:\\sys\\bin\\%1.exe").arg(m_targetName);
m_adapter->setCopyFileName(copySrc, copyDst);
m_adapter->setInstallFileName(copyDst);
m_adapter->setFileName(runFileName);
m_adapter->startServer();
if (!m_adapter->startServer()) {
delete m_adapter;
m_adapter = 0;
error(this, tr("Could not connect to phone on port %1. "
"Check if the phone is connected and if it runs the TRK application.").arg(m_serialPortName));
emit finished();
}
}
void S60DeviceRunControl::printCopyingNotice()
......@@ -594,4 +625,5 @@ void S60DeviceRunControl::processFailed(const QString &program, QProcess::Proces
errorString = tr("Some error has occurred while running %1.");
}
error(this, errorString.arg(program));
emit finished();
}
......@@ -60,6 +60,8 @@ public:
void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
void restore(const ProjectExplorer::PersistentSettingsReader &reader);
QString serialPortName() const;
void setSerialPortName(const QString &name);
QString targetName() const;
QString basePackageFilePath() const;
SigningMode signingMode() const;
......@@ -82,6 +84,7 @@ private:
QString m_targetName;
QString m_baseFileName;
bool m_cachedTargetInformationValid;
QString m_serialPortName;
SigningMode m_signingMode;
QString m_customSignaturePath;
QString m_customKeyPath;
......@@ -97,6 +100,7 @@ public:
private slots:
void nameEdited(const QString &text);
void updateTargetInformation();
void setSerialPort(const QString &portName);
void selfSignToggled(bool toggle);
void customSignatureToggled(bool toggle);
void signaturePathChanged(const QString &path);
......@@ -158,6 +162,7 @@ private slots:
private:
void processFailed(const QString &program, QProcess::ProcessError errorCode);
QString m_serialPortName;
QString m_targetName;
QString m_baseFileName;
QString m_workingDirectory;
......
......@@ -88,11 +88,10 @@ Adapter::~Adapter()
bool Adapter::startServer()
{
if (!openTrkPort(m_trkServerName)) {
qDebug("Unable to connect to TRK server");
logMessage("Unable to connect to TRK server");
return false;
}
m_timerId = startTimer(100);
qDebug("Connecting");
sendTrkInitialPing();
sendTrkMessage(TrkConnect); // Connect
sendTrkMessage(TrkSupported, CB(handleSupportMask));
......
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