Commit a81b79fe authored by con's avatar con
Browse files

Add Qt versions detected from Symbian SDKs

parent 55d58f4a
......@@ -31,11 +31,16 @@
#include "s60devices.h"
#include "s60devicespreferencepane.h"
#include "qtversionmanager.h"
#include <extensionsystem/pluginmanager.h>
using namespace Qt4ProjectManager::Internal;
namespace {
static const char *S60_AUTODETECTION_SOURCE = "QTS60";
}
S60Manager::S60Manager(QObject *parent)
: QObject(parent),
m_devices(new S60Devices(this)),
......@@ -44,6 +49,7 @@ S60Manager::S60Manager(QObject *parent)
m_devices->detectQtForDevices();
ExtensionSystem::PluginManager::instance()
->addObject(m_devicesPreferencePane);
updateQtVersions();
}
S60Manager::~S60Manager()
......@@ -51,3 +57,49 @@ S60Manager::~S60Manager()
ExtensionSystem::PluginManager::instance()
->removeObject(m_devicesPreferencePane);
}
void S60Manager::updateQtVersions()
{
// This assumes that the QtVersionManager has already read
// the Qt versions from the settings
QtVersionManager *versionManager = QtVersionManager::instance();
QList<QtVersion *> versions = versionManager->versions();
QList<QtVersion *> handledVersions;
QList<QtVersion *> versionsToAdd;
foreach (const S60Devices::Device &device, m_devices->devices()) {
if (device.qt.isEmpty()) // no Qt version found for this sdk
continue;
QtVersion *deviceVersion = 0;
// look if we have a respective Qt version already
foreach (QtVersion *version, versions) {
if (version->isAutodetected()
&& version->autodetectionSource().startsWith(S60_AUTODETECTION_SOURCE)
&& version->autodetectionSource().mid(QString(S60_AUTODETECTION_SOURCE).length()+1) == device.id) {
deviceVersion = version;
break;
}
}
if (deviceVersion) {
deviceVersion->setName(QString("%1 (Qt %2)").arg(device.id, deviceVersion->qtVersionString()));
deviceVersion->setPath(device.qt);
handledVersions.append(deviceVersion);
} else {
deviceVersion = new QtVersion(QString("%1 (Qt %2)").arg(device.id), device.qt,
true, QString("%1.%2").arg(S60_AUTODETECTION_SOURCE, device.id));
deviceVersion->setName(deviceVersion->name().arg(deviceVersion->qtVersionString()));
versionsToAdd.append(deviceVersion);
}
}
// remove old autodetected versions
foreach (QtVersion *version, versions) {
if (version->isAutodetected()
&& version->autodetectionSource().startsWith(S60_AUTODETECTION_SOURCE)
&& !handledVersions.contains(version)) {
versionManager->removeVersion(version);
}
}
// add new versions
foreach (QtVersion *version, versionsToAdd) {
versionManager->addVersion(version);
}
}
......@@ -46,8 +46,7 @@ class S60Manager : public QObject
public:
S60Manager(QObject *parent = 0);
~S60Manager();
S60Devices *devices() const { return m_devices; }
void updateQtVersions();
private:
S60Devices *m_devices;
......
......@@ -143,6 +143,14 @@ void QtVersionManager::addVersion(QtVersion *version)
writeVersionsIntoSettings();
}
void QtVersionManager::removeVersion(QtVersion *version)
{
m_versions.removeAll(version);
emit qtVersionsChanged();
writeVersionsIntoSettings();
delete version;
}
void QtVersionManager::updateDocumentation()
{
Help::HelpManager *helpManager
......@@ -387,9 +395,11 @@ QtVersion::QtVersion(const QString &name, const QString &path, int id,
setPath(path);
}
QtVersion::QtVersion(const QString &name, const QString &path)
QtVersion::QtVersion(const QString &name, const QString &path,
bool isAutodetected, const QString &autodetectionSource)
: m_name(name),
m_isAutodetected(false),
m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false),
......
......@@ -46,10 +46,10 @@ class Qt4ProjectManagerPlugin;
class QtVersion
{
friend class Internal::QtOptionsPageWidget; //for changing name and path
friend class QtVersionManager;
public:
QtVersion(const QString &name, const QString &path);
QtVersion(const QString &name, const QString &path,
bool isAutodetected = false, const QString &autodetectionSource = QString());
QtVersion(const QString &name, const QString &path, int id,
bool isAutodetected = false, const QString &autodetectionSource = QString());
QtVersion()
......@@ -74,6 +74,9 @@ public:
QString qmakeCXX() const;
ProjectExplorer::ToolChain *toolChain() const;
void setName(const QString &name);
void setPath(const QString &path);
QString qtVersionString() const;
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
QHash<QString,QString> versionInfo() const;
......@@ -117,8 +120,6 @@ public:
private:
static int getUniqueId();
// Also used by QtOptionsPageWidget
void setName(const QString &name);
void setPath(const QString &path);
void updateSourcePath();
void updateMkSpec() const;
void updateVersionInfo() const;
......@@ -180,6 +181,7 @@ public:
QtVersion *qtVersionForDirectory(const QString &directory);
// Used by the projectloadwizard
void addVersion(QtVersion *version);
void removeVersion(QtVersion *version);
// Static Methods
static QtVersion::QmakeBuildConfig scanMakefileForQmakeConfig(const QString &directory, QtVersion::QmakeBuildConfig defaultBuildConfig);
......
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