2009-05-26 15:31:29 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2009-05-26 15:31:29 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-26 15:31:29 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2009-05-26 15:31:29 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-05-26 15:31:29 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "s60manager.h"
|
2011-03-08 12:57:12 +01:00
|
|
|
//#include "qtversionmanager.h"
|
2009-05-26 15:31:29 +02:00
|
|
|
|
2011-03-08 12:57:12 +01:00
|
|
|
//#include "s60devicespreferencepane.h"
|
2009-06-16 15:11:47 +02:00
|
|
|
#include "s60emulatorrunconfiguration.h"
|
2009-08-17 11:47:17 +02:00
|
|
|
#include "s60devicerunconfiguration.h"
|
2010-02-25 16:51:27 +01:00
|
|
|
#include "s60createpackagestep.h"
|
2011-03-09 12:07:35 +01:00
|
|
|
#include "s60deployconfiguration.h"
|
2010-07-15 13:58:18 +02:00
|
|
|
#include "s60deploystep.h"
|
2011-01-18 16:45:42 +01:00
|
|
|
#include "s60runcontrolfactory.h"
|
2011-06-09 12:39:39 +02:00
|
|
|
#include "s60devicedebugruncontrol.h"
|
2011-01-18 16:45:42 +01:00
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
#include "qt4symbiantargetfactory.h"
|
2011-01-21 15:37:05 +01:00
|
|
|
#include "s60publishingwizardfactories.h"
|
2009-05-26 15:31:29 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
#include "gccetoolchain.h"
|
|
|
|
|
#include "rvcttoolchain.h"
|
|
|
|
|
#include "winscwtoolchain.h"
|
2011-05-04 13:14:46 +02:00
|
|
|
#include "symbianqtversionfactory.h"
|
2011-02-01 18:36:00 +01:00
|
|
|
|
2010-11-03 10:03:48 +01:00
|
|
|
#include <symbianutils/symbiandevicemanager.h>
|
|
|
|
|
|
2009-07-31 16:49:26 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2009-05-26 15:31:29 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2009-09-28 17:17:11 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2011-01-10 10:14:23 +01:00
|
|
|
#include <debugger/debuggerconstants.h>
|
2009-09-28 17:17:11 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2009-05-26 15:31:29 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMainWindow>
|
2009-07-31 16:49:26 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2009-09-28 17:17:11 +02:00
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
2009-05-26 15:31:29 +02:00
|
|
|
|
2009-05-28 18:36:52 +02:00
|
|
|
S60Manager *S60Manager::m_instance = 0;
|
|
|
|
|
|
2009-09-28 17:17:11 +02:00
|
|
|
// ======== Parametrizable Factory for RunControls, depending on the configuration
|
|
|
|
|
// class and mode.
|
|
|
|
|
|
|
|
|
|
template <class RunControl, class RunConfiguration>
|
|
|
|
|
class RunControlFactory : public ProjectExplorer::IRunControlFactory
|
|
|
|
|
{
|
|
|
|
|
public:
|
2012-01-10 19:17:24 +01:00
|
|
|
RunControlFactory(ProjectExplorer::RunMode mode, const QString &name, QObject *parent = 0) :
|
2009-09-28 17:17:11 +02:00
|
|
|
IRunControlFactory(parent), m_mode(mode), m_name(name) {}
|
|
|
|
|
|
2012-01-10 19:17:24 +01:00
|
|
|
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const
|
|
|
|
|
{
|
|
|
|
|
return mode == m_mode && qobject_cast<RunConfiguration *>(runConfiguration);
|
2009-09-28 17:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
2012-01-10 19:17:24 +01:00
|
|
|
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration,
|
|
|
|
|
ProjectExplorer::RunMode mode)
|
|
|
|
|
{
|
2009-10-08 18:37:18 +02:00
|
|
|
RunConfiguration *rc = qobject_cast<RunConfiguration *>(runConfiguration);
|
|
|
|
|
QTC_ASSERT(rc && mode == m_mode, return 0);
|
2010-04-30 13:19:31 +02:00
|
|
|
return new RunControl(rc, mode);
|
2009-09-28 17:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString displayName() const {
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-28 12:23:12 +01:00
|
|
|
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *) {
|
2009-09-28 17:17:11 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2012-01-10 19:17:24 +01:00
|
|
|
const ProjectExplorer::RunMode m_mode;
|
2009-09-28 17:17:11 +02:00
|
|
|
const QString m_name;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ======== S60Manager
|
|
|
|
|
|
2009-05-28 18:36:52 +02:00
|
|
|
S60Manager *S60Manager::instance() { return m_instance; }
|
|
|
|
|
|
2011-03-08 12:57:12 +01:00
|
|
|
S60Manager::S60Manager(QObject *parent) : QObject(parent)
|
2009-05-26 15:31:29 +02:00
|
|
|
{
|
2009-05-28 18:36:52 +02:00
|
|
|
m_instance = this;
|
2010-04-14 15:53:35 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
addAutoReleasedObject(new GcceToolChainFactory);
|
|
|
|
|
addAutoReleasedObject(new RvctToolChainFactory);
|
|
|
|
|
addAutoReleasedObject(new WinscwToolChainFactory);
|
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
addAutoReleasedObject(new S60EmulatorRunConfigurationFactory);
|
2011-02-01 18:36:00 +01:00
|
|
|
addAutoReleasedObject(new RunControlFactory<S60EmulatorRunControl, S60EmulatorRunConfiguration>
|
2012-01-10 19:17:24 +01:00
|
|
|
(ProjectExplorer::NormalRunMode, tr("Run in Emulator"), parent));
|
2010-01-19 13:41:02 +01:00
|
|
|
addAutoReleasedObject(new S60DeviceRunConfigurationFactory);
|
2012-01-10 19:17:24 +01:00
|
|
|
addAutoReleasedObject(new S60RunControlFactory(ProjectExplorer::NormalRunMode,
|
2009-09-28 17:17:11 +02:00
|
|
|
tr("Run on Device"), parent));
|
2010-02-25 16:51:27 +01:00
|
|
|
addAutoReleasedObject(new S60CreatePackageStepFactory);
|
2010-07-15 13:58:18 +02:00
|
|
|
addAutoReleasedObject(new S60DeployStepFactory);
|
2009-09-28 17:17:11 +02:00
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
addAutoReleasedObject(new S60DeviceDebugRunControlFactory);
|
2010-12-10 19:02:19 +01:00
|
|
|
addAutoReleasedObject(new Qt4SymbianTargetFactory);
|
2011-03-09 12:07:35 +01:00
|
|
|
addAutoReleasedObject(new S60DeployConfigurationFactory);
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2011-01-21 15:37:05 +01:00
|
|
|
addAutoReleasedObject(new S60PublishingWizardFactoryOvi);
|
2011-05-04 13:14:46 +02:00
|
|
|
addAutoReleasedObject(new SymbianQtVersionFactory);
|
2011-01-21 15:37:05 +01:00
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
connect(Core::ICore::mainWindow(), SIGNAL(deviceChange()),
|
2010-02-05 17:34:02 +01:00
|
|
|
SymbianUtils::SymbianDeviceManager::instance(), SLOT(update()));
|
2009-05-26 15:31:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
S60Manager::~S60Manager()
|
|
|
|
|
{
|
2009-09-28 17:17:11 +02:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
2009-11-04 17:11:35 +01:00
|
|
|
for (int i = m_pluginObjects.size() - 1; i >= 0; i--) {
|
2009-09-28 17:17:11 +02:00
|
|
|
pm->removeObject(m_pluginObjects.at(i));
|
2009-11-04 17:11:35 +01:00
|
|
|
delete m_pluginObjects.at(i);
|
|
|
|
|
}
|
2009-09-28 17:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QString S60Manager::platform(const ProjectExplorer::ToolChain *tc)
|
2010-11-26 12:17:14 +01:00
|
|
|
{
|
2011-02-28 11:25:40 +01:00
|
|
|
if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::SymbianOS)
|
2011-02-01 18:36:00 +01:00
|
|
|
return QString();
|
|
|
|
|
QString target = tc->defaultMakeTarget();
|
|
|
|
|
return target.right(target.lastIndexOf(QLatin1Char('-')));
|
2010-02-17 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
|
2009-09-28 17:17:11 +02:00
|
|
|
void S60Manager::addAutoReleasedObject(QObject *o)
|
|
|
|
|
{
|
|
|
|
|
ExtensionSystem::PluginManager::instance()->addObject(o);
|
|
|
|
|
m_pluginObjects.push_back(o);
|
2009-05-26 15:31:29 +02:00
|
|
|
}
|
2009-05-28 13:22:23 +02:00
|
|
|
|
2009-10-29 12:19:56 +01:00
|
|
|
} // namespace internal
|
|
|
|
|
} // namespace qt4projectmanager
|