RemoteLinux: Introduce abstract base class for remote Linux targets.

More stuff (e.g. deployment information) will move into that
class shortly.

Change-Id: I9ad785533d54859e72079b54796710707f716469
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2012-02-06 16:22:42 +01:00
parent 584df4d8db
commit 9a9fb759f4
8 changed files with 131 additions and 46 deletions

View File

@@ -119,9 +119,8 @@ bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id) : AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id) :
Qt4BaseTarget(parent, id), AbstractEmbeddedLinuxTarget(parent, id),
m_filesWatcher(new Utils::FileSystemWatcher(this)), m_filesWatcher(new Utils::FileSystemWatcher(this)),
m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this)),
m_isInitialized(false) m_isInitialized(false)
{ {
m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget")); m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget"));
@@ -155,11 +154,6 @@ QList<ProjectExplorer::ToolChain *> AbstractQt4MaemoTarget::possibleToolChains(P
return result; return result;
} }
ProjectExplorer::IBuildConfigurationFactory *AbstractQt4MaemoTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
void AbstractQt4MaemoTarget::createApplicationProFiles(bool reparse) void AbstractQt4MaemoTarget::createApplicationProFiles(bool reparse)
{ {
if (!reparse) if (!reparse)

View File

@@ -33,7 +33,7 @@
#ifndef QT4MAEMOTARGET_H #ifndef QT4MAEMOTARGET_H
#define QT4MAEMOTARGET_H #define QT4MAEMOTARGET_H
#include <qt4projectmanager/qt4target.h> #include <remotelinux/abstractembeddedlinuxtarget.h>
#include <QtCore/QIODevice> #include <QtCore/QIODevice>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
@@ -53,7 +53,7 @@ namespace Internal {
class Qt4MaemoDeployConfigurationFactory; class Qt4MaemoDeployConfigurationFactory;
class WatchableFile; class WatchableFile;
class AbstractQt4MaemoTarget : public Qt4ProjectManager::Qt4BaseTarget class AbstractQt4MaemoTarget : public RemoteLinux::AbstractEmbeddedLinuxTarget
{ {
friend class Qt4MaemoTargetFactory; friend class Qt4MaemoTargetFactory;
Q_OBJECT Q_OBJECT
@@ -62,7 +62,6 @@ public:
const QString &id); const QString &id);
virtual ~AbstractQt4MaemoTarget(); virtual ~AbstractQt4MaemoTarget();
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles(bool reparse); void createApplicationProFiles(bool reparse);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const; QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
@@ -109,7 +108,6 @@ private:
bool initPackagingSettingsFromOtherTarget(); bool initPackagingSettingsFromOtherTarget();
virtual bool initAdditionalPackagingSettingsFromOtherTarget() = 0; virtual bool initAdditionalPackagingSettingsFromOtherTarget() = 0;
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
bool m_isInitialized; bool m_isInitialized;
}; };

View File

@@ -0,0 +1,51 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "abstractembeddedlinuxtarget.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
namespace RemoteLinux {
AbstractEmbeddedLinuxTarget::AbstractEmbeddedLinuxTarget(Qt4Project *parent, const QString &id) :
Qt4BaseTarget(parent, id), m_buildConfigurationFactory(new Qt4BuildConfigurationFactory(this))
{
}
IBuildConfigurationFactory *AbstractEmbeddedLinuxTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
} // namespace RemoteLinux

View File

@@ -0,0 +1,59 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef ABSTRACTEMBEDDEDLINUXTARGET_H
#define ABSTRACTEMBEDDEDLINUXTARGET_H
#include "remotelinux_export.h"
#include <qt4projectmanager/qt4target.h>
namespace ProjectExplorer { class IBuildConfigurationFactory; }
namespace Qt4ProjectManager { class Qt4BuildConfigurationFactory; }
namespace RemoteLinux {
class REMOTELINUX_EXPORT AbstractEmbeddedLinuxTarget : public Qt4ProjectManager::Qt4BaseTarget
{
Q_OBJECT
public:
AbstractEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id);
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
private:
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
};
} // namespace RemoteLinux
#endif // ABSTRACTEMBEDDEDLINUXTARGET_H

View File

@@ -34,7 +34,7 @@
#include "remotelinuxdeployconfiguration.h" #include "remotelinuxdeployconfiguration.h"
#include "remotelinuxdeployconfigurationfactory.h" #include "remotelinuxdeployconfigurationfactory.h"
#include "embeddedlinuxtarget.h" #include "genericembeddedlinuxtarget.h"
#include "remotelinux_constants.h" #include "remotelinux_constants.h"
#include <projectexplorer/customexecutablerunconfiguration.h> #include <projectexplorer/customexecutablerunconfiguration.h>
@@ -109,7 +109,7 @@ ProjectExplorer::Target *EmbeddedLinuxTargetFactory::restore(ProjectExplorer::Pr
{ {
Q_ASSERT(canRestore(parent, map)); Q_ASSERT(canRestore(parent, map));
EmbeddedLinuxTarget *t = new EmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), GenericEmbeddedLinuxTarget *t = new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent),
Constants::EMBEDDED_LINUX_TARGET_ID); Constants::EMBEDDED_LINUX_TARGET_ID);
if (t->fromMap(map)) if (t->fromMap(map))
return t; return t;
@@ -154,7 +154,7 @@ ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Pro
if (!canCreate(parent, id) || infos.isEmpty()) if (!canCreate(parent, id) || infos.isEmpty())
return 0; return 0;
EmbeddedLinuxTarget *t = new EmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), id); GenericEmbeddedLinuxTarget *t = new GenericEmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), id);
foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos) foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos)
t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(), t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),

View File

@@ -30,7 +30,7 @@
** **
**************************************************************************/ **************************************************************************/
#include "embeddedlinuxtarget.h" #include "genericembeddedlinuxtarget.h"
#include "remotelinux_constants.h" #include "remotelinux_constants.h"
#include "remotelinuxrunconfiguration.h" #include "remotelinuxrunconfiguration.h"
@@ -46,24 +46,13 @@
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
EmbeddedLinuxTarget::EmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id) : GenericEmbeddedLinuxTarget::GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent,
Qt4ProjectManager::Qt4BaseTarget(parent, id), const QString &id) : AbstractEmbeddedLinuxTarget(parent, id)
m_buildConfigurationFactory(new Qt4ProjectManager::Qt4BuildConfigurationFactory)
{ {
setDisplayName(tr("Embedded Linux")); setDisplayName(tr("Embedded Linux"));
} }
EmbeddedLinuxTarget::~EmbeddedLinuxTarget() QList<ProjectExplorer::RunConfiguration *> GenericEmbeddedLinuxTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
{
delete m_buildConfigurationFactory;
}
ProjectExplorer::IBuildConfigurationFactory *EmbeddedLinuxTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
QList<ProjectExplorer::RunConfiguration *> EmbeddedLinuxTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
{ {
QList<ProjectExplorer::RunConfiguration *> result; QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
@@ -73,7 +62,7 @@ QList<ProjectExplorer::RunConfiguration *> EmbeddedLinuxTarget::runConfiguration
return result; return result;
} }
Utils::FileName EmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const Utils::FileName GenericEmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const
{ {
QtSupport::BaseQtVersion *version = bc->qtVersion(); QtSupport::BaseQtVersion *version = bc->qtVersion();
if (!version) if (!version)
@@ -81,7 +70,7 @@ Utils::FileName EmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildCon
return version->mkspec(); return version->mkspec();
} }
void EmbeddedLinuxTarget::createApplicationProFiles(bool reparse) void GenericEmbeddedLinuxTarget::createApplicationProFiles(bool reparse)
{ {
if (!reparse) if (!reparse)
removeUnconfiguredCustomExectutableRunConfigurations(); removeUnconfiguredCustomExectutableRunConfigurations();

View File

@@ -33,33 +33,25 @@
#ifndef EMBEDDEDLINUXTARGET_H #ifndef EMBEDDEDLINUXTARGET_H
#define EMBEDDEDLINUXTARGET_H #define EMBEDDEDLINUXTARGET_H
#include <qt4projectmanager/qt4target.h> #include "abstractembeddedlinuxtarget.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class EmbeddedLinuxTargetFactory; class EmbeddedLinuxTargetFactory;
class EmbeddedLinuxTarget : public Qt4ProjectManager::Qt4BaseTarget class GenericEmbeddedLinuxTarget : public AbstractEmbeddedLinuxTarget
{ {
Q_OBJECT Q_OBJECT
public: public:
EmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id); GenericEmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id);
~EmbeddedLinuxTarget();
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles(bool reparse); void createApplicationProFiles(bool reparse);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n); QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
Utils::FileName mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const; Utils::FileName mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const;
private: private:
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
friend class EmbeddedLinuxTargetFactory; friend class EmbeddedLinuxTargetFactory;
}; };

View File

@@ -5,7 +5,7 @@ include(../../qtcreatorplugin.pri)
include(remotelinux_dependencies.pri) include(remotelinux_dependencies.pri)
HEADERS += \ HEADERS += \
embeddedlinuxtarget.h \ genericembeddedlinuxtarget.h \
embeddedlinuxtargetfactory.h \ embeddedlinuxtargetfactory.h \
embeddedlinuxqtversion.h \ embeddedlinuxqtversion.h \
embeddedlinuxqtversionfactory.h \ embeddedlinuxqtversionfactory.h \
@@ -60,10 +60,11 @@ HEADERS += \
profilesupdatedialog.h \ profilesupdatedialog.h \
startgdbserverdialog.h \ startgdbserverdialog.h \
remotelinuxcustomcommanddeployservice.h \ remotelinuxcustomcommanddeployservice.h \
remotelinuxcustomcommanddeploymentstep.h remotelinuxcustomcommanddeploymentstep.h \
abstractembeddedlinuxtarget.h
SOURCES += \ SOURCES += \
embeddedlinuxtarget.cpp \ genericembeddedlinuxtarget.cpp \
embeddedlinuxtargetfactory.cpp \ embeddedlinuxtargetfactory.cpp \
embeddedlinuxqtversion.cpp \ embeddedlinuxqtversion.cpp \
embeddedlinuxqtversionfactory.cpp \ embeddedlinuxqtversionfactory.cpp \
@@ -115,7 +116,8 @@ SOURCES += \
profilesupdatedialog.cpp \ profilesupdatedialog.cpp \
startgdbserverdialog.cpp \ startgdbserverdialog.cpp \
remotelinuxcustomcommanddeployservice.cpp \ remotelinuxcustomcommanddeployservice.cpp \
remotelinuxcustomcommanddeploymentstep.cpp remotelinuxcustomcommanddeploymentstep.cpp \
abstractembeddedlinuxtarget.cpp
FORMS += \ FORMS += \
linuxdevicefactoryselectiondialog.ui \ linuxdevicefactoryselectiondialog.ui \