diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp index 1667ed4294bd5f66e90b8ecedc96f6b8f0d6bb09..a9bcc354e0f5c7b9606912b573c068bf1f8d76b4 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.cpp @@ -214,6 +214,16 @@ S60Devices::Device S60Devices::deviceForId(const QString &id) const return Device(); } +S60Devices::Device S60Devices::deviceForEpocRoot(const QString &root) const +{ + foreach (const S60Devices::Device &i, m_devices) { + if (i.epocRoot == root) { + return i; + } + } + return Device(); +} + QString S60Devices::cleanedRootPath(const QString &deviceRoot) { QString path = deviceRoot; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devices.h b/src/plugins/qt4projectmanager/qt-s60/s60devices.h index 839fd32967a8896ec5714ba1e18f81e8d900ff41..01173d979af3e7ce131b14002b618642fc4f0e56 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devices.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devices.h @@ -63,6 +63,7 @@ public: QList<Device> devices() const; bool detectQtForDevices(); Device deviceForId(const QString &id) const; + Device deviceForEpocRoot(const QString &root) const; static QString cleanedRootPath(const QString &deviceRoot); signals: diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp index 4b16410e61b9a74458e3cc1a59d58060d3de0854..0c9084c88ddd84c75e6b07448627111eab5c006f 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp @@ -177,6 +177,7 @@ void S60Manager::updateQtVersions() deviceVersion->setName(deviceVersion->name().arg(deviceVersion->qtVersionString())); versionsToAdd.append(deviceVersion); } + deviceVersion->setS60SDKDirectory(device.epocRoot); } // remove old autodetected versions foreach (QtVersion *version, versions) { @@ -202,8 +203,9 @@ ProjectExplorer::ToolChain *S60Manager::createGCCEToolChain(const Qt4ProjectMana return new GCCEToolChain(deviceForQtVersion(version)); } -ProjectExplorer::ToolChain *S60Manager::createRVCTToolChain(const Qt4ProjectManager::QtVersion *version, - ProjectExplorer::ToolChain::ToolChainType type) const +ProjectExplorer::ToolChain *S60Manager::createRVCTToolChain( + const Qt4ProjectManager::QtVersion *version, + ProjectExplorer::ToolChain::ToolChainType type) const { return new RVCTToolChain(deviceForQtVersion(version), type); } @@ -215,15 +217,19 @@ S60Devices::Device S60Manager::deviceForQtVersion(const Qt4ProjectManager::QtVer if (version->isAutodetected()) deviceId = deviceIdFromDetectionSource(version->autodetectionSource()); if (deviceId.isEmpty()) { // it's not an s60 autodetected version - // have a look if we find the device root anyhow - QString qtPath = version->versionInfo().value("QT_INSTALL_DATA"); - if (QFile::exists(QString::fromLatin1("%1/epoc32").arg(qtPath))) { - device.epocRoot = qtPath; - device.toolsRoot = device.epocRoot; - device.qt = device.epocRoot; - device.isDefault = false; - device.name = QString::fromLatin1("SDK"); - device.id = QString::fromLatin1("SDK"); + // try to find a device entry belonging to the root given in Qt prefs + QString sdkRoot = version->s60SDKDirectory(); + 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"); + } } } else { device = m_devices->deviceForId(deviceId); diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index 48e39d27e4228bb0667ae6022af160d6d684c4f4..da0f1346f2a4cabb7e2601da6c16f0d8ab6fcdb2 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -122,6 +122,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver m_ui->mingwPath->setPromptDialogTitle(tr("Select the MinGW Directory")); m_ui->mwcPath->setExpectedKind(Utils::PathChooser::Directory); m_ui->mwcPath->setPromptDialogTitle(tr("Select Carbide Install Directory")); + m_ui->s60SDKPath->setExpectedKind(Utils::PathChooser::Directory); + m_ui->s60SDKPath->setPromptDialogTitle(tr("Select S60 SDK Root")); m_ui->addButton->setIcon(QIcon(Core::Constants::ICON_PLUS)); m_ui->delButton->setIcon(QIcon(Core::Constants::ICON_MINUS)); @@ -167,6 +169,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver #ifdef QTCREATOR_WITH_S60 connect(m_ui->mwcPath, SIGNAL(changed(QString)), this, SLOT(updateCurrentMwcDirectory())); + connect(m_ui->s60SDKPath, SIGNAL(changed(QString)), + this, SLOT(updateCurrentS60SDKDirectory())); #endif connect(m_ui->addButton, SIGNAL(clicked()), @@ -367,6 +371,8 @@ void QtOptionsPageWidget::updateState() m_ui->nameEdit->setEnabled(enabled && !isAutodetected); m_ui->qmakePath->setEnabled(enabled && !isAutodetected); m_ui->mingwPath->setEnabled(enabled); + m_ui->mwcPath->setEnabled(enabled); + m_ui->s60SDKPath->setEnabled(enabled && !isAutodetected); const bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty(); m_ui->showLogButton->setEnabled(hasLog); @@ -388,10 +394,12 @@ void QtOptionsPageWidget::makeMSVCVisible(bool visible) m_ui->msvcNotFoundLabel->setVisible(false); } -void QtOptionsPageWidget::makeMWCVisible(bool visible) +void QtOptionsPageWidget::makeS60Visible(bool visible) { m_ui->mwcLabel->setVisible(visible); m_ui->mwcPath->setVisible(visible); + m_ui->s60SDKLabel->setVisible(visible); + m_ui->s60SDKPath->setVisible(visible); } void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) @@ -401,7 +409,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) if (index < 0) { makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(false); + makeS60Visible(false); return; } m_ui->errorLabel->setText(""); @@ -409,12 +417,12 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) if (types.contains(ProjectExplorer::ToolChain::MinGW)) { makeMSVCVisible(false); makeMingwVisible(true); - makeMWCVisible(false); + makeS60Visible(false); m_ui->mingwPath->setPath(m_versions.at(index)->mingwDirectory()); } else if (types.contains(ProjectExplorer::ToolChain::MSVC) || types.contains(ProjectExplorer::ToolChain::WINCE)){ makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(false); + makeS60Visible(false); QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions(); if (msvcEnvironments.count() == 0) { m_ui->msvcLabel->setVisible(true); @@ -432,16 +440,20 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) m_ui->msvcComboBox->blockSignals(block); } #ifdef QTCREATOR_WITH_S60 - } else if (types.contains(ProjectExplorer::ToolChain::WINSCW)) { + } else if (types.contains(ProjectExplorer::ToolChain::WINSCW) + || types.contains(ProjectExplorer::ToolChain::RVCT_ARMV5) + || types.contains(ProjectExplorer::ToolChain::RVCT_ARMV6) + || types.contains(ProjectExplorer::ToolChain::GCCE)) { makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(true); + makeS60Visible(true); m_ui->mwcPath->setPath(m_versions.at(index)->mwcDirectory()); + m_ui->s60SDKPath->setPath(m_versions.at(index)->s60SDKDirectory()); #endif } else if (types.contains(ProjectExplorer::ToolChain::INVALID)) { makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(false); + makeS60Visible(false); if (!m_versions.at(index)->isInstalled()) m_ui->errorLabel->setText(tr("The Qt Version identified by %1 is not installed. Run make install") .arg(QDir::toNativeSeparators(m_versions.at(index)->qmakeCommand()))); @@ -450,7 +462,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) } else { //ProjectExplorer::ToolChain::GCC makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(false); + makeS60Visible(false); m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2") .arg(m_versions.at(index)->qtVersionString(), m_versions.at(index)->mkspec())); @@ -458,7 +470,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item) } else { makeMSVCVisible(false); makeMingwVisible(false); - makeMWCVisible(false); + makeS60Visible(false); } } @@ -654,6 +666,15 @@ void QtOptionsPageWidget::updateCurrentMwcDirectory() return; m_versions[currentItemIndex]->setMwcDirectory(m_ui->mwcPath->path()); } +void QtOptionsPageWidget::updateCurrentS60SDKDirectory() +{ + QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); + Q_ASSERT(currentItem); + int currentItemIndex = indexForTreeItem(currentItem); + if (currentItemIndex < 0) + return; + m_versions[currentItemIndex]->setS60SDKDirectory(m_ui->s60SDKPath->path()); +} #endif QList<QSharedPointerQtVersion> QtOptionsPageWidget::versions() const diff --git a/src/plugins/qt4projectmanager/qtoptionspage.h b/src/plugins/qt4projectmanager/qtoptionspage.h index 9581f37d425351f125c01792a27cde94b84ac9b7..c4778d36cda2632f930eba6fe58ee27b7e492e36 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.h +++ b/src/plugins/qt4projectmanager/qtoptionspage.h @@ -109,7 +109,7 @@ private slots: void updateState(); void makeMingwVisible(bool visible); void makeMSVCVisible(bool visible); - void makeMWCVisible(bool visible); + void makeS60Visible(bool visible); void onQtBrowsed(); void onMingwBrowsed(); void defaultChanged(int index); @@ -118,6 +118,7 @@ private slots: void updateCurrentMingwDirectory(); #ifdef QTCREATOR_WITH_S60 void updateCurrentMwcDirectory(); + void updateCurrentS60SDKDirectory(); #endif void msvcVersionChanged(); void buildDebuggingHelper(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 22f5663cc577cd4382889aeaeee6f53c8868eb2d..b9de0fbaa081d682dd2c68e13303bbe20b827984 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -126,6 +126,7 @@ QtVersionManager::QtVersionManager() version->setMsvcVersion(s->value("msvcVersion").toString()); #ifdef QTCREATOR_WITH_S60 version->setMwcDirectory(s->value("MwcDirectory").toString()); + version->setS60SDKDirectory(s->value("S60SDKDirectory").toString()); #endif m_versions.append(version); } @@ -245,6 +246,7 @@ void QtVersionManager::writeVersionsIntoSettings() s->setValue("autodetectionSource", version->autodetectionSource()); #ifdef QTCREATOR_WITH_S60 s->setValue("MwcDirectory", version->mwcDirectory()); + s->setValue("S60SDKDirectory", version->s60SDKDirectory()); #endif } s->endArray(); @@ -1170,6 +1172,15 @@ void QtVersion::setMwcDirectory(const QString &directory) { m_mwcDirectory = directory; } +QString QtVersion::s60SDKDirectory() const +{ + return m_s60SDKDirectory; +} + +void QtVersion::setS60SDKDirectory(const QString &directory) +{ + m_s60SDKDirectory = directory; +} #endif QString QtVersion::mingwDirectory() const diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index 3e96ab5344b79493baea37477327f7200ea1c0f5..545fcc8c2cfa23e9402005b63e8f19068647ea25 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -86,6 +86,8 @@ public: #ifdef QTCREATOR_WITH_S60 QString mwcDirectory() const; void setMwcDirectory(const QString &directory); + QString s60SDKDirectory() const; + void setS60SDKDirectory(const QString &directory); #endif QString mingwDirectory() const; void setMingwDirectory(const QString &directory); @@ -141,6 +143,7 @@ private: bool m_hasDebuggingHelper; #ifdef QTCREATOR_WITH_S60 QString m_mwcDirectory; + QString m_s60SDKDirectory; #endif mutable bool m_mkspecUpToDate; diff --git a/src/plugins/qt4projectmanager/qtversionmanager.ui b/src/plugins/qt4projectmanager/qtversionmanager.ui index 2f3d39e7f02ff9c0c313cebaae97ece3c1d1ea1b..2f0a1dc840fd6986353016cf002763e9850b89f2 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.ui +++ b/src/plugins/qt4projectmanager/qtversionmanager.ui @@ -100,7 +100,7 @@ p, li { white-space: pre-wrap; } </item> </layout> </item> - <item row="6" column="1"> + <item row="7" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QLabel" name="debuggingHelperStateLabel"> @@ -193,30 +193,40 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="debuggingHelperLabel"> + <item row="5" column="0"> + <widget class="QLabel" name="s60SDKLabel"> <property name="text"> - <string>Debugging Helper:</string> + <string>S60 SDK:</string> </property> </widget> </item> - <item row="7" column="1"> - <widget class="QLabel" name="errorLabel"> - <property name="text"> - <string/> - </property> - </widget> + <item row="5" column="1"> + <widget class="Utils::PathChooser" name="s60SDKPath" native="true"/> </item> - <item row="5" column="0"> + <item row="6" column="0"> <widget class="QLabel" name="mwcLabel"> <property name="text"> <string>Carbide Directory:</string> </property> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <widget class="Utils::PathChooser" name="mwcPath" native="true"/> </item> + <item row="7" column="0"> + <widget class="QLabel" name="debuggingHelperLabel"> + <property name="text"> + <string>Debugging Helper:</string> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QLabel" name="errorLabel"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </widget> </item>