Commit 745345e3 authored by kh1's avatar kh1
Browse files

There is no dependency, so make the runtime manager an real singelton.

Reviewed-by: ck
parent 070f4df4
......@@ -44,6 +44,9 @@
#include <QtCore/QFile>
#include <QtCore/QTextStream>
using namespace ExtensionSystem;
using namespace ProjectExplorer;
namespace Qt4ProjectManager {
namespace Internal {
......@@ -59,10 +62,10 @@ MaemoManager::MaemoManager()
Q_ASSERT(!m_instance);
m_instance = this;
QemuRuntimeManager::instance(this);
MaemoDeviceConfigurations::instance(this);
ExtensionSystem::PluginManager *pluginManager
= ExtensionSystem::PluginManager::instance();
PluginManager *pluginManager = PluginManager::instance();
pluginManager->addObject(m_runControlFactory);
pluginManager->addObject(m_runConfigurationFactory);
pluginManager->addObject(m_packageCreationFactory);
......@@ -71,8 +74,7 @@ MaemoManager::MaemoManager()
MaemoManager::~MaemoManager()
{
ExtensionSystem::PluginManager *pluginManager
= ExtensionSystem::PluginManager::instance();
PluginManager *pluginManager = PluginManager::instance();
pluginManager->removeObject(m_runControlFactory);
pluginManager->removeObject(m_runConfigurationFactory);
pluginManager->removeObject(m_packageCreationFactory);
......@@ -87,13 +89,7 @@ MaemoManager &MaemoManager::instance()
return *m_instance;
}
void MaemoManager::init()
{
m_qemuRuntimeManager = new QemuRuntimeManager(this);
}
bool
MaemoManager::isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *version) const
bool MaemoManager::isValidMaemoQtVersion(const QtVersion *version) const
{
QString path = QDir::cleanPath(version->qmakeCommand());
path = path.remove(QLatin1String("/bin/qmake" EXEC_SUFFIX));
......@@ -116,8 +112,7 @@ MaemoManager::isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *version)
return false;
}
ProjectExplorer::ToolChain*
MaemoManager::maemoToolChain(const QtVersion *version) const
ToolChain* MaemoManager::maemoToolChain(const QtVersion *version) const
{
QString targetRoot = QDir::cleanPath(version->qmakeCommand());
targetRoot.remove(QLatin1String("/bin/qmake" EXEC_SUFFIX));
......
......@@ -56,8 +56,6 @@ public:
~MaemoManager();
static MaemoManager &instance();
void init();
bool isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *version) const;
ToolChain *maemoToolChain(const Qt4ProjectManager::QtVersion *version) const;
......
......@@ -69,9 +69,6 @@ QemuRuntimeManager::QemuRuntimeManager(QObject *parent)
, m_needsSetup(true)
, m_userTerminated(false)
{
Q_ASSERT(!m_instance);
m_instance = this;
m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize,
QIcon::Normal, QIcon::On);
......@@ -117,11 +114,13 @@ QemuRuntimeManager::QemuRuntimeManager(QObject *parent)
QemuRuntimeManager::~QemuRuntimeManager()
{
terminateRuntime();
m_instance = 0;
}
QemuRuntimeManager &QemuRuntimeManager::instance()
QemuRuntimeManager &QemuRuntimeManager::instance(QObject *parent)
{
Q_ASSERT(m_instance);
if (m_instance == 0)
m_instance = new QemuRuntimeManager(parent);
return *m_instance;
}
......
......@@ -71,10 +71,7 @@ class QemuRuntimeManager : public QObject
Q_OBJECT
public:
QemuRuntimeManager(QObject *parent = 0);
~QemuRuntimeManager();
static QemuRuntimeManager& instance();
static QemuRuntimeManager& instance(QObject *parent = 0);
bool runtimeForQtVersion(int uniqueId, Runtime *rt) const;
......@@ -111,6 +108,9 @@ private slots:
void qemuStatusChanged(QemuStatus status, const QString &error);
private:
QemuRuntimeManager(QObject *parent);
~QemuRuntimeManager();
void setupRuntimes();
bool sessionHasMaemoTarget() const;
......
......@@ -153,7 +153,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new LinguistExternalEditor);
addAutoReleasedObject(new S60Manager);
addAutoReleasedObject(m_maemoManager = new MaemoManager);
addAutoReleasedObject(new MaemoManager);
new ProFileCacheManager(this);
......@@ -228,7 +228,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
void Qt4ProjectManagerPlugin::extensionsInitialized()
{
m_qt4ProjectManager->init();
m_maemoManager->init(); // depends on the Qt4ProjectManager
}
void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
......
......@@ -56,7 +56,6 @@ class QMakeStepFactory;
class MakeStepFactory;
class EmbeddedPropertiesPage;
class GettingStartedWelcomePage;
class MaemoManager;
class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
{
......@@ -86,7 +85,6 @@ private:
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProFileEditorFactory *m_proFileEditorFactory;
Qt4Manager *m_qt4ProjectManager;
MaemoManager *m_maemoManager;
int m_projectContext;
......
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