forked from qt-creator/qt-creator
Symbian: Only list Symbian device if Symbian Qt is found
Hide it otherwise. Change-Id: Iae81a04862b14b2a06db4bea6c5311fcee12cd03 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <debugger/debuggerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -157,10 +159,11 @@ QString S60Manager::platform(const ProjectExplorer::ToolChain *tc)
|
||||
return target.right(target.lastIndexOf(QLatin1Char('-')));
|
||||
}
|
||||
|
||||
void S60Manager::addDevice()
|
||||
void S60Manager::delayedInitialize()
|
||||
{
|
||||
ProjectExplorer::IDevice::Ptr dev(new SymbianIDevice);
|
||||
ProjectExplorer::DeviceManager::instance()->addDevice(dev);
|
||||
handleQtVersionChanges();
|
||||
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
this, SLOT(handleQtVersionChanges()));
|
||||
}
|
||||
|
||||
void S60Manager::symbianDeviceRemoved(const SymbianUtils::SymbianDevice &d)
|
||||
@@ -173,6 +176,35 @@ void S60Manager::symbianDeviceAdded(const SymbianUtils::SymbianDevice &d)
|
||||
handleSymbianDeviceStateChange(d, ProjectExplorer::IDevice::DeviceAvailable);
|
||||
}
|
||||
|
||||
void S60Manager::handleQtVersionChanges()
|
||||
{
|
||||
bool symbianQtFound = false;
|
||||
Core::Id symbianDeviceId;
|
||||
QList<QtSupport::BaseQtVersion *> versionList = QtSupport::QtVersionManager::instance()->versions();
|
||||
foreach (QtSupport::BaseQtVersion *v, versionList) {
|
||||
if (v->platformName() != QLatin1String(QtSupport::Constants::SYMBIAN_PLATFORM))
|
||||
continue;
|
||||
|
||||
symbianQtFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
for (int i = 0; i < dm->deviceCount(); ++i) {
|
||||
ProjectExplorer::IDevice::ConstPtr dev = dm->deviceAt(i);
|
||||
if (dev->type() != SymbianIDeviceFactory::deviceType())
|
||||
continue;
|
||||
|
||||
symbianDeviceId = dev->id();
|
||||
break;
|
||||
}
|
||||
|
||||
if (symbianQtFound && !symbianDeviceId.isValid())
|
||||
dm->addDevice(ProjectExplorer::IDevice::Ptr(new SymbianIDevice));
|
||||
if (!symbianQtFound && symbianDeviceId.isValid())
|
||||
dm->removeDevice(symbianDeviceId);
|
||||
}
|
||||
|
||||
void S60Manager::handleSymbianDeviceStateChange(const SymbianUtils::SymbianDevice &d, ProjectExplorer::IDevice::AvailabilityState s)
|
||||
{
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
|
||||
@@ -53,12 +53,14 @@ public:
|
||||
|
||||
static QString platform(const ProjectExplorer::ToolChain *tc);
|
||||
|
||||
void addDevice();
|
||||
void delayedInitialize();
|
||||
|
||||
private slots:
|
||||
void symbianDeviceRemoved(const SymbianUtils::SymbianDevice &d);
|
||||
void symbianDeviceAdded(const SymbianUtils::SymbianDevice &d);
|
||||
|
||||
void handleQtVersionChanges();
|
||||
|
||||
private:
|
||||
void handleSymbianDeviceStateChange(const SymbianUtils::SymbianDevice &d,
|
||||
ProjectExplorer::IDevice::AvailabilityState s);
|
||||
|
||||
@@ -298,7 +298,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
||||
|
||||
bool Qt4ProjectManagerPlugin::delayedInitialize()
|
||||
{
|
||||
S60Manager::instance()->addDevice();
|
||||
S60Manager::instance()->delayedInitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user