2009-10-16 17:33:12 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-10-16 17:33:12 +02:00
|
|
|
**
|
2010-03-04 18:42:07 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-10-16 17:33:12 +02:00
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at qt-sales@nokia.com.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "maemomanager.h"
|
|
|
|
|
|
2010-05-20 15:47:42 +02:00
|
|
|
#include "maemoconstants.h"
|
2009-12-01 14:04:25 +01:00
|
|
|
#include "maemodeviceconfigurations.h"
|
2010-04-06 16:56:47 +02:00
|
|
|
#include "maemopackagecreationfactory.h"
|
2010-02-23 16:17:04 +01:00
|
|
|
#include "maemorunfactories.h"
|
2009-11-27 16:40:07 +01:00
|
|
|
#include "maemosettingspage.h"
|
2009-10-16 17:33:12 +02:00
|
|
|
#include "maemotoolchain.h"
|
2010-05-20 15:47:42 +02:00
|
|
|
#include "qemuruntimemanager.h"
|
2009-10-16 17:33:12 +02:00
|
|
|
|
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2010-05-20 15:47:42 +02:00
|
|
|
#include <qt4projectmanager/qtversionmanager.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2010-01-21 12:06:03 +01:00
|
|
|
#include <QtCore/QDir>
|
|
|
|
|
#include <QtCore/QFile>
|
|
|
|
|
#include <QtCore/QTextStream>
|
2009-10-16 17:33:12 +02:00
|
|
|
|
2010-05-25 13:43:16 +02:00
|
|
|
using namespace ExtensionSystem;
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2009-10-16 17:33:12 +02:00
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
MaemoManager *MaemoManager::m_instance = 0;
|
|
|
|
|
|
|
|
|
|
MaemoManager::MaemoManager()
|
|
|
|
|
: QObject(0)
|
|
|
|
|
, m_runControlFactory(new MaemoRunControlFactory(this))
|
|
|
|
|
, m_runConfigurationFactory(new MaemoRunConfigurationFactory(this))
|
2010-04-06 16:56:47 +02:00
|
|
|
, m_packageCreationFactory(new MaemoPackageCreationFactory(this))
|
2009-11-27 16:40:07 +01:00
|
|
|
, m_settingsPage(new MaemoSettingsPage(this))
|
2009-10-16 17:33:12 +02:00
|
|
|
{
|
2010-02-25 17:32:30 +01:00
|
|
|
Q_ASSERT(!m_instance);
|
|
|
|
|
|
2010-02-23 16:22:25 +01:00
|
|
|
m_instance = this;
|
2010-05-25 13:43:16 +02:00
|
|
|
QemuRuntimeManager::instance(this);
|
2010-02-25 17:32:30 +01:00
|
|
|
MaemoDeviceConfigurations::instance(this);
|
|
|
|
|
|
2010-05-25 13:43:16 +02:00
|
|
|
PluginManager *pluginManager = PluginManager::instance();
|
2010-04-06 16:56:47 +02:00
|
|
|
pluginManager->addObject(m_runControlFactory);
|
|
|
|
|
pluginManager->addObject(m_runConfigurationFactory);
|
|
|
|
|
pluginManager->addObject(m_packageCreationFactory);
|
|
|
|
|
pluginManager->addObject(m_settingsPage);
|
2009-10-16 17:33:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoManager::~MaemoManager()
|
|
|
|
|
{
|
2010-05-25 13:43:16 +02:00
|
|
|
PluginManager *pluginManager = PluginManager::instance();
|
2010-04-06 16:56:47 +02:00
|
|
|
pluginManager->removeObject(m_runControlFactory);
|
|
|
|
|
pluginManager->removeObject(m_runConfigurationFactory);
|
|
|
|
|
pluginManager->removeObject(m_packageCreationFactory);
|
|
|
|
|
pluginManager->removeObject(m_settingsPage);
|
2010-02-25 17:32:30 +01:00
|
|
|
|
|
|
|
|
m_instance = 0;
|
2009-10-16 17:33:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-02-23 16:22:25 +01:00
|
|
|
MaemoManager &MaemoManager::instance()
|
2009-10-16 17:33:12 +02:00
|
|
|
{
|
2010-02-25 17:32:30 +01:00
|
|
|
Q_ASSERT(m_instance);
|
2010-02-23 16:22:25 +01:00
|
|
|
return *m_instance;
|
2009-10-16 17:33:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-05-25 13:43:16 +02:00
|
|
|
bool MaemoManager::isValidMaemoQtVersion(const QtVersion *version) const
|
2010-01-21 12:06:03 +01:00
|
|
|
{
|
|
|
|
|
QString path = QDir::cleanPath(version->qmakeCommand());
|
|
|
|
|
path = path.remove(QLatin1String("/bin/qmake" EXEC_SUFFIX));
|
|
|
|
|
|
|
|
|
|
QDir dir(path);
|
|
|
|
|
dir.cdUp(); dir.cdUp();
|
|
|
|
|
|
|
|
|
|
QFile file(dir.absolutePath() + QLatin1String("/cache/madde.conf"));
|
|
|
|
|
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
|
const QString &target = path.mid(path.lastIndexOf(QLatin1Char('/')) + 1);
|
|
|
|
|
QTextStream stream(&file);
|
|
|
|
|
while (!stream.atEnd()) {
|
|
|
|
|
const QString &line = stream.readLine().trimmed();
|
|
|
|
|
if (line.startsWith(QLatin1String("target"))
|
|
|
|
|
&& line.endsWith(target)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 13:43:16 +02:00
|
|
|
ToolChain* MaemoManager::maemoToolChain(const QtVersion *version) const
|
2009-10-16 17:33:12 +02:00
|
|
|
{
|
2010-03-10 12:18:13 +01:00
|
|
|
QString targetRoot = QDir::cleanPath(version->qmakeCommand());
|
|
|
|
|
targetRoot.remove(QLatin1String("/bin/qmake" EXEC_SUFFIX));
|
|
|
|
|
return new MaemoToolChain(targetRoot);
|
2009-10-16 17:33:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-05-20 15:47:42 +02:00
|
|
|
} // namespace Internal
|
2009-10-16 17:33:12 +02:00
|
|
|
} // namespace Qt4ProjectManager
|