Commit e5d3e04c authored by con's avatar con
Browse files

Also handle EPOCROOT and default device settings for Symbian devs.

parent 1e5140b3
......@@ -300,6 +300,16 @@ S60Devices::Device S60Devices::deviceForEpocRoot(const QString &root) const
return Device();
}
S60Devices::Device S60Devices::defaultDevice() const
{
foreach (const S60Devices::Device &i, m_devices) {
if (i.isDefault) {
return i;
}
}
return Device();
}
QString S60Devices::cleanedRootPath(const QString &deviceRoot)
{
QString path = deviceRoot;
......
......@@ -66,6 +66,7 @@ public:
bool detectQtForDevices();
Device deviceForId(const QString &id) const;
Device deviceForEpocRoot(const QString &root) const;
Device defaultDevice() const;
static QString cleanedRootPath(const QString &deviceRoot);
signals:
......
......@@ -245,18 +245,31 @@ S60Devices::Device S60Manager::deviceForQtVersion(const Qt4ProjectManager::QtVer
if (deviceId.isEmpty()) { // it's not an s60 autodetected version
// try to find a device entry belonging to the root given in Qt prefs
QString sdkRoot = version->s60SDKDirectory();
device = m_devices->deviceForEpocRoot(sdkRoot);
if (sdkRoot.isEmpty()) { // no sdk explicitly set in the preferences
// check if EPOCROOT is set and use that
QString epocRootEnv = QProcessEnvironment::systemEnvironment()
.value(QLatin1String("EPOCROOT"));
if (!epocRootEnv.isEmpty())
sdkRoot = QDir::fromNativeSeparators(epocRootEnv);
}
if (sdkRoot.isEmpty()) { // no sdk set via preference or EPOCROOT
// try default device
device = m_devices->defaultDevice();
} else {
device = m_devices->deviceForEpocRoot(sdkRoot);
}
if (device.epocRoot.isEmpty()) { // no device found
// check if we can construct a dummy one
if (QFile::exists(QString::fromLatin1("%1/epoc32").arg(sdkRoot))) {
device.epocRoot = sdkRoot;
device.toolsRoot = device.epocRoot;
device.qt = QFileInfo(QFileInfo(version->qmakeCommand()).path()).path();
device.isDefault = false;
device.name = QString::fromLatin1("Manual");
device.id = QString::fromLatin1("Manual");
}
}
// override any Qt version that might be still autodetected
device.qt = QFileInfo(QFileInfo(version->qmakeCommand()).path()).path();
} else {
device = m_devices->deviceForId(deviceId);
}
......
......@@ -492,9 +492,9 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
makeMSVCVisible(false);
makeMingwVisible(false);
makeS60Visible(true);
m_ui->mwcPath->setPath(m_versions.at(index)->mwcDirectory());
m_ui->s60SDKPath->setPath(m_versions.at(index)->s60SDKDirectory());
m_ui->gccePath->setPath(m_versions.at(index)->gcceDirectory());
m_ui->mwcPath->setPath(QDir::toNativeSeparators(m_versions.at(index)->mwcDirectory()));
m_ui->s60SDKPath->setPath(QDir::toNativeSeparators(m_versions.at(index)->s60SDKDirectory()));
m_ui->gccePath->setPath(QDir::toNativeSeparators(m_versions.at(index)->gcceDirectory()));
} else { //ProjectExplorer::ToolChain::GCC
makeMSVCVisible(false);
makeMingwVisible(false);
......@@ -689,7 +689,8 @@ void QtOptionsPageWidget::updateCurrentMwcDirectory()
int currentItemIndex = indexForTreeItem(currentItem);
if (currentItemIndex < 0)
return;
m_versions[currentItemIndex]->setMwcDirectory(m_ui->mwcPath->path());
m_versions[currentItemIndex]->setMwcDirectory(
QDir::fromNativeSeparators(m_ui->mwcPath->path()));
}
void QtOptionsPageWidget::updateCurrentS60SDKDirectory()
{
......@@ -698,7 +699,8 @@ void QtOptionsPageWidget::updateCurrentS60SDKDirectory()
int currentItemIndex = indexForTreeItem(currentItem);
if (currentItemIndex < 0)
return;
m_versions[currentItemIndex]->setS60SDKDirectory(m_ui->s60SDKPath->path());
m_versions[currentItemIndex]->setS60SDKDirectory(
QDir::fromNativeSeparators(m_ui->s60SDKPath->path()));
}
void QtOptionsPageWidget::updateCurrentGcceDirectory()
{
......@@ -707,7 +709,8 @@ void QtOptionsPageWidget::updateCurrentGcceDirectory()
int currentItemIndex = indexForTreeItem(currentItem);
if (currentItemIndex < 0)
return;
m_versions[currentItemIndex]->setGcceDirectory(m_ui->gccePath->path());
m_versions[currentItemIndex]->setGcceDirectory(
QDir::fromNativeSeparators(m_ui->gccePath->path()));
}
QList<QSharedPointerQtVersion> QtOptionsPageWidget::versions() const
......
......@@ -337,11 +337,11 @@ void QtVersionManager::addNewVersionsFromInstaller()
if (newVersionData.count() >= 3)
version->setMingwDirectory(newVersionData[2]);
if (newVersionData.count() >= 4)
version->setS60SDKDirectory(newVersionData[3]);
version->setS60SDKDirectory(QDir::fromNativeSeparators(newVersionData[3]));
if (newVersionData.count() >= 5)
version->setGcceDirectory(newVersionData[4]);
version->setGcceDirectory(QDir::fromNativeSeparators(newVersionData[4]));
if (newVersionData.count() >= 6)
version->setMwcDirectory(newVersionData[5]);
version->setMwcDirectory(QDir::fromNativeSeparators(newVersionData[5]));
bool versionWasAlreadyInList = false;
foreach(const QtVersion * const it, m_versions) {
......
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