Commit 20e749df authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Move "mad info" parsing for Qemu specs into dedicated classes.

parent 0f15f419
......@@ -29,6 +29,7 @@
#include "maemoglobal.h"
#include "maemoconstants.h"
#include "maemodeviceconfigurations.h"
#include <coreplugin/ssh/sshconnection.h>
......@@ -44,6 +45,9 @@
namespace Qt4ProjectManager {
namespace Internal {
namespace {
static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX);
}
QString MaemoGlobal::homeDirOnDevice(const QString &uname)
{
......@@ -99,6 +103,19 @@ QString MaemoGlobal::failedToConnectToServerMessage(const Core::SshConnection::P
return errorMsg;
}
QString MaemoGlobal::maddeRoot(const QString &qmakePath)
{
QDir dir(QDir::cleanPath(qmakePath).remove(binQmake));
dir.cdUp(); dir.cdUp();
return dir.absolutePath();
}
QString MaemoGlobal::targetName(const QString &qmakePath)
{
const QString target = QDir::cleanPath(qmakePath).remove(binQmake);
return target.mid(target.lastIndexOf(QLatin1Char('/')) + 1);
}
bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error)
{
QFileInfo fileInfo(filePath);
......
......@@ -63,6 +63,8 @@ public:
static QString remoteSourceProfilesCommand();
static QString failedToConnectToServerMessage(const QSharedPointer<Core::SshConnection> &connection,
const MaemoDeviceConfig &deviceConfig);
static QString maddeRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath);
static bool removeRecursively(const QString &filePath, QString &error);
static void callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
......
......@@ -42,7 +42,6 @@
QT_FORWARD_DECLARE_CLASS(QAction);
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
QT_FORWARD_DECLARE_CLASS(QStringList);
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader);
namespace ProjectExplorer {
class BuildConfiguration;
......@@ -113,24 +112,6 @@ private:
bool targetUsesMatchingRuntimeConfig(ProjectExplorer::Target *target,
QtVersion **qtVersion = 0);
QString maddeRoot(const QString &qmake) const;
QString targetRoot(const QString &qmake) const;
bool fillRuntimeInformationForOldMadInfo(MaemoQemuRuntime *runtime) const;
void setEnvironment(MaemoQemuRuntime *runTime, const QString &envSpec) const;
MaemoQemuRuntime createRuntime(const QtVersion *qtVersion) const;
MaemoQemuRuntime parseRuntimeFromMadInfo(const QByteArray &output,
const QString &targetName) const;
MaemoQemuRuntime parseRuntimeFromOldMadInfo(const QString &output,
const QString &maddeRootPath, const QString &targetName) const;
void handleMadInfoTargetTag(QXmlStreamReader &infoReader,
QString &runtimeName, const QString &targetName) const;
MaemoQemuRuntime handleMadInfoRuntimeTag(QXmlStreamReader &infoReader) const;
QHash<QString, QString> handleMadInfoEnvironmentTag(QXmlStreamReader &infoReader) const;
QPair<QString, QString> handleMadInfoVariableTag(QXmlStreamReader &infoReader) const;
MaemoPortList handleMadInfoTcpPortListTag(QXmlStreamReader &infoReader) const;
int handleMadInfoPortTag(QXmlStreamReader &infoReader) const;
void notify(const QList<int> uniqueIds);
void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect);
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** 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.
**
**************************************************************************/
#ifndef MAEMOQEMURUNTIMEPARSER_H
#define MAEMOQEMURUNTIMEPARSER_H
#include "maemoqemuruntime.h"
#include <QtCore/QString>
#include <QtXml/QXmlStreamReader>
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoQemuRuntimeParser
{
public:
static MaemoQemuRuntime parseRuntime(const QtVersion *qtVersion);
protected:
MaemoQemuRuntimeParser(const QString &madInfoOutput,
const QString &targetName);
const QString &targetName() const { return m_targetName; }
QXmlStreamReader m_madInfoReader;
private:
const QString m_targetName;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMOQEMURUNTIMEPARSER_H
......@@ -42,7 +42,8 @@ HEADERS += \
$$PWD/maemopublishingwizardfremantlefree.h \
$$PWD/maemopublishingresultpagefremantlefree.h \
$$PWD/maemopublisherfremantlefree.h \
$$PWD/maemoqemuruntime.h
$$PWD/maemoqemuruntime.h \
qt-maemo/maemoqemuruntimeparser.h
SOURCES += \
$$PWD/maemoconfigtestdialog.cpp \
......@@ -85,7 +86,8 @@ SOURCES += \
$$PWD/maemopublishinguploadsettingspagefremantlefree.cpp \
$$PWD/maemopublishingwizardfremantlefree.cpp \
$$PWD/maemopublishingresultpagefremantlefree.cpp \
$$PWD/maemopublisherfremantlefree.cpp
$$PWD/maemopublisherfremantlefree.cpp \
qt-maemo/maemoqemuruntimeparser.cpp
FORMS += \
$$PWD/maemoconfigtestdialog.ui \
......
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