Commit 69ebf668 authored by kh1's avatar kh1
Browse files

Return a reference to the object, changed from pointer.

Since we use addAutoReleasedObject we would rather unclean call the
class destructor.
parent 399ad59f
......@@ -65,7 +65,7 @@ MaemoManager::MaemoManager()
, m_settingsPage(new MaemoSettingsPage(this))
, m_qemuCommand(0)
{
m_instance = this;
icon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
icon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize, QIcon::Normal,
QIcon::On);
......@@ -83,14 +83,14 @@ MaemoManager::~MaemoManager()
ExtensionSystem::PluginManager::instance()->removeObject(m_settingsPage);
}
MaemoManager *MaemoManager::instance()
MaemoManager &MaemoManager::instance()
{
if (!m_instance) {
QMutexLocker _(&m_mutex);
if (!m_instance)
m_instance = new MaemoManager;
new MaemoManager;
}
return m_instance;
return *m_instance;
}
bool
......
......@@ -62,9 +62,10 @@ class MaemoSettingsPage;
class MaemoManager : public QObject
{
Q_OBJECT
public:
static MaemoManager *instance();
MaemoManager();
~MaemoManager();
static MaemoManager &instance();
bool isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *version) const;
void addVersion(const Qt4ProjectManager::QtVersion *version) { Q_UNUSED(version); }
......@@ -84,10 +85,6 @@ public slots:
signals:
void startStopQemu();
private:
MaemoManager();
~MaemoManager();
private:
static QMutex m_mutex;
static MaemoManager *m_instance;
......
......@@ -493,7 +493,7 @@ void MaemoRunConfiguration::qemuProcessFinished()
void MaemoRunConfiguration::enabledStateChanged()
{
MaemoManager::instance()->setQemuSimulatorStarterEnabled(isEnabled());
MaemoManager::instance().setQemuSimulatorStarterEnabled(isEnabled());
}
void MaemoRunConfiguration::updateDeviceConfigurations()
......
......@@ -154,9 +154,9 @@ void MaemoRunConfigurationWidget::resetDeviceConfigurations()
void MaemoRunConfigurationWidget::showSettingsDialog()
{
MaemoSettingsPage *settingsPage = MaemoManager::instance()->settingsPage();
MaemoSettingsPage *settingsPage = MaemoManager::instance().settingsPage();
Core::ICore::instance()->showOptionsDialog(settingsPage->category(),
settingsPage->id());
settingsPage->id());
}
} // namespace Internal
......
......@@ -164,9 +164,9 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
void MaemoRunConfigurationFactory::setupRunConfiguration(MaemoRunConfiguration *rc)
{
if (rc) {
connect(MaemoManager::instance(), SIGNAL(startStopQemu()), rc,
connect(&MaemoManager::instance(), SIGNAL(startStopQemu()), rc,
SLOT(startStopQemu()));
connect(rc, SIGNAL(qemuProcessStatus(bool)), MaemoManager::instance(),
connect(rc, SIGNAL(qemuProcessStatus(bool)), &MaemoManager::instance(),
SLOT(updateQemuSimulatorStarter(bool)));
}
}
......@@ -201,7 +201,7 @@ void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target)
&& target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
return;
MaemoManager::instance()->addQemuSimulatorStarter(target->project());
MaemoManager::instance().addQemuSimulatorStarter(target->project());
}
void MaemoRunConfigurationFactory::targetRemoved(ProjectExplorer::Target *target)
......@@ -210,7 +210,7 @@ void MaemoRunConfigurationFactory::targetRemoved(ProjectExplorer::Target *target
&& target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
return;
MaemoManager::instance()->removeQemuSimulatorStarter(target->project());
MaemoManager::instance().removeQemuSimulatorStarter(target->project());
}
void MaemoRunConfigurationFactory::currentProjectChanged(
......@@ -222,7 +222,7 @@ void MaemoRunConfigurationFactory::currentProjectChanged(
Target *maemoTarget(project->target(QLatin1String(MAEMO_EMULATOR_TARGET_ID)));
if (!maemoTarget)
maemoTarget = project->target(QLatin1String(MAEMO_DEVICE_TARGET_ID));
MaemoManager::instance()->setQemuSimulatorStarterEnabled(maemoTarget != 0);
MaemoManager::instance().setQemuSimulatorStarterEnabled(maemoTarget != 0);
bool isRunning = false;
if (maemoTarget
......@@ -233,7 +233,7 @@ void MaemoRunConfigurationFactory::currentProjectChanged(
if (mrc)
isRunning = mrc->isQemuRunning();
}
MaemoManager::instance()->updateQemuSimulatorStarter(isRunning);
MaemoManager::instance().updateQemuSimulatorStarter(isRunning);
}
......
......@@ -146,7 +146,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new LinguistExternalEditor);
addAutoReleasedObject(new S60Manager);
addAutoReleasedObject(MaemoManager::instance());
addAutoReleasedObject(new MaemoManager);
new ProFileCacheManager(this);
......
......@@ -1256,8 +1256,8 @@ void QtVersion::updateToolChainAndMkspec() const
# endif
}
} else if (qt_arch == "arm"
&& MaemoManager::instance()->isValidMaemoQtVersion(this)) {
m_toolChains << ToolChainPtr(MaemoManager::instance()->maemoToolChain(this));
&& MaemoManager::instance().isValidMaemoQtVersion(this)) {
m_toolChains << ToolChainPtr(MaemoManager::instance().maemoToolChain(this));
m_targetIds.insert(QLatin1String(MAEMO_EMULATOR_TARGET_ID));
m_targetIds.insert(QLatin1String(MAEMO_DEVICE_TARGET_ID));
} else if (qmakeCXX == "cl" || qmakeCXX == "icl") {
......
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