forked from qt-creator/qt-creator
Maemo: Make device configuration settable from deploy widget.
This is necessary in case there is no run configuration (e.g. for library projects).
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
#include "maemodeploystepwidget.h"
|
#include "maemodeploystepwidget.h"
|
||||||
|
#include "maemodeviceconfiglistmodel.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemopackagecreationstep.h"
|
#include "maemopackagecreationstep.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
@@ -79,6 +80,7 @@ MaemoDeployStep::~MaemoDeployStep()
|
|||||||
|
|
||||||
void MaemoDeployStep::ctor()
|
void MaemoDeployStep::ctor()
|
||||||
{
|
{
|
||||||
|
m_deviceConfigModel = new MaemoDeviceConfigListModel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoDeployStep::init()
|
bool MaemoDeployStep::init()
|
||||||
@@ -104,6 +106,7 @@ QVariantMap MaemoDeployStep::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map(BuildStep::toMap());
|
QVariantMap map(BuildStep::toMap());
|
||||||
addDeployTimesToMap(map);
|
addDeployTimesToMap(map);
|
||||||
|
map.unite(m_deviceConfigModel->toMap());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +134,7 @@ bool MaemoDeployStep::fromMap(const QVariantMap &map)
|
|||||||
if (!BuildStep::fromMap(map))
|
if (!BuildStep::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
getDeployTimesFromMap(map);
|
getDeployTimesFromMap(map);
|
||||||
|
m_deviceConfigModel->fromMap(map);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,11 +217,15 @@ void MaemoDeployStep::setDeployed(const QString &host,
|
|||||||
|
|
||||||
MaemoDeviceConfig MaemoDeployStep::deviceConfig() const
|
MaemoDeviceConfig MaemoDeployStep::deviceConfig() const
|
||||||
{
|
{
|
||||||
// TODO: For lib template, get info from config widget
|
return deviceConfigModel()->current();
|
||||||
const RunConfiguration * const rc =
|
}
|
||||||
buildConfiguration()->target()->activeRunConfiguration();
|
|
||||||
return rc ? qobject_cast<const MaemoRunConfiguration *>(rc)->deviceConfig()
|
MaemoDeviceConfigListModel *MaemoDeployStep::deviceConfigModel() const
|
||||||
: MaemoDeviceConfig();
|
{
|
||||||
|
const MaemoRunConfiguration * const rc =
|
||||||
|
qobject_cast<const MaemoRunConfiguration *>(buildConfiguration()
|
||||||
|
->target()->activeRunConfiguration());
|
||||||
|
return rc ? rc->deviceConfigModel() : m_deviceConfigModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStep::start()
|
void MaemoDeployStep::start()
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class SshRemoteProcess;
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class MaemoDeployables;
|
class MaemoDeployables;
|
||||||
|
class MaemoDeviceConfigListModel;
|
||||||
class MaemoPackageCreationStep;
|
class MaemoPackageCreationStep;
|
||||||
|
|
||||||
class MaemoDeployStep : public ProjectExplorer::BuildStep
|
class MaemoDeployStep : public ProjectExplorer::BuildStep
|
||||||
@@ -65,6 +66,7 @@ public:
|
|||||||
MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc);
|
MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc);
|
||||||
virtual ~MaemoDeployStep();
|
virtual ~MaemoDeployStep();
|
||||||
MaemoDeviceConfig deviceConfig() const;
|
MaemoDeviceConfig deviceConfig() const;
|
||||||
|
MaemoDeviceConfigListModel *deviceConfigModel() const;
|
||||||
bool currentlyNeedsDeployment(const QString &host,
|
bool currentlyNeedsDeployment(const QString &host,
|
||||||
const MaemoDeployable &deployable) const;
|
const MaemoDeployable &deployable) const;
|
||||||
void setDeployed(const QString &host, const MaemoDeployable &deployable);
|
void setDeployed(const QString &host, const MaemoDeployable &deployable);
|
||||||
@@ -119,6 +121,7 @@ private:
|
|||||||
bool m_stopped;
|
bool m_stopped;
|
||||||
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
||||||
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||||
|
MaemoDeviceConfigListModel *m_deviceConfigModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MaemoDeployEventHandler : public QObject
|
class MaemoDeployEventHandler : public QObject
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "maemodeployablelistmodel.h"
|
#include "maemodeployablelistmodel.h"
|
||||||
#include "maemodeployablelistwidget.h"
|
#include "maemodeployablelistwidget.h"
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
|
#include "maemodeviceconfiglistmodel.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
@@ -32,17 +33,33 @@ MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
|||||||
|
|
||||||
void MaemoDeployStepWidget::init()
|
void MaemoDeployStepWidget::init()
|
||||||
{
|
{
|
||||||
const ProjectExplorer::RunConfiguration * const rc =
|
connectDeviceConfigModel();
|
||||||
m_step->buildConfiguration()->target()->activeRunConfiguration();
|
connect(m_step->buildConfiguration()->target(),
|
||||||
if (rc) {
|
SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
||||||
connect(qobject_cast<const MaemoRunConfiguration *>(rc),
|
this, SLOT(connectDeviceConfigModel()));
|
||||||
SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target *)),
|
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
||||||
this, SLOT(handleDeviceUpdate()));
|
SLOT(setCurrentDeviceConfig(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoDeployStepWidget::connectDeviceConfigModel()
|
||||||
|
{
|
||||||
|
const MaemoDeviceConfigListModel * const oldModel
|
||||||
|
= qobject_cast<MaemoDeviceConfigListModel *>(ui->deviceConfigComboBox->model());
|
||||||
|
if (oldModel)
|
||||||
|
disconnect(oldModel, 0, this, 0);
|
||||||
|
MaemoDeviceConfigListModel * const devModel = m_step->deviceConfigModel();
|
||||||
|
ui->deviceConfigComboBox->setModel(devModel);
|
||||||
|
connect(devModel, SIGNAL(currentChanged()), this,
|
||||||
|
SLOT(handleDeviceUpdate()));
|
||||||
|
connect(devModel, SIGNAL(modelReset()), this,
|
||||||
|
SLOT(handleDeviceUpdate()));
|
||||||
|
handleDeviceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStepWidget::handleDeviceUpdate()
|
void MaemoDeployStepWidget::handleDeviceUpdate()
|
||||||
{
|
{
|
||||||
|
ui->deviceConfigComboBox->setCurrentIndex(m_step->deviceConfigModel()
|
||||||
|
->currentIndex());
|
||||||
emit updateSummary();
|
emit updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,5 +85,10 @@ void MaemoDeployStepWidget::handleModelsCreated()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
||||||
|
{
|
||||||
|
m_step->deviceConfigModel()->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ public:
|
|||||||
~MaemoDeployStepWidget();
|
~MaemoDeployStepWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Q_SLOT void handleDeviceUpdate();
|
||||||
Q_SLOT void handleModelsCreated();
|
Q_SLOT void handleModelsCreated();
|
||||||
|
Q_SLOT void handleDeviceConfigModelChanged();
|
||||||
|
Q_SLOT void setCurrentDeviceConfig(int index);
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual QString summaryText() const;
|
virtual QString summaryText() const;
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
Q_SLOT void handleDeviceUpdate();
|
|
||||||
|
|
||||||
Ui::MaemoDeployStepWidget *ui;
|
Ui::MaemoDeployStepWidget *ui;
|
||||||
MaemoDeployStep * const m_step;
|
MaemoDeployStep * const m_step;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>469</width>
|
||||||
<height>300</height>
|
<height>330</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -15,7 +15,34 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="deviceConfigLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Device configuration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="deviceConfigComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="installLabel">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>These show the INSTALLS settings from the project file(s).</string>
|
<string>These show the INSTALLS settings from the project file(s).</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Creator.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** No Commercial Usage
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "maemodeviceconfiglistmodel.h"
|
||||||
|
|
||||||
|
#include "maemoconstants.h"
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
MaemoDeviceConfigListModel::MaemoDeviceConfigListModel(QObject *parent)
|
||||||
|
: QAbstractListModel(parent), m_currentIndex(-1)
|
||||||
|
{
|
||||||
|
const MaemoDeviceConfigurations &devConfs
|
||||||
|
= MaemoDeviceConfigurations::instance();
|
||||||
|
if (devConfs.devConfigs().isEmpty())
|
||||||
|
setInvalid();
|
||||||
|
else
|
||||||
|
setCurrentIndex(0);
|
||||||
|
connect(&devConfs, SIGNAL(updated()), this,
|
||||||
|
SLOT(handleDeviceConfigListChange()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigListModel::setCurrentIndex(int index)
|
||||||
|
{
|
||||||
|
if (index != m_currentIndex) {
|
||||||
|
m_currentIndex = index;
|
||||||
|
m_currentId = MaemoDeviceConfigurations::instance().devConfigs()
|
||||||
|
.at(m_currentIndex).internalId;
|
||||||
|
emit currentChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigListModel::resetCurrentIndex()
|
||||||
|
{
|
||||||
|
const QList<MaemoDeviceConfig> &devConfigs
|
||||||
|
= MaemoDeviceConfigurations::instance().devConfigs();
|
||||||
|
if (devConfigs.isEmpty()) {
|
||||||
|
setInvalid();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < devConfigs.count(); ++i) {
|
||||||
|
if (devConfigs.at(i).internalId == m_currentId) {
|
||||||
|
setCurrentIndex(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigListModel::setInvalid()
|
||||||
|
{
|
||||||
|
m_currentIndex = -1;
|
||||||
|
m_currentId = MaemoDeviceConfig::InvalidId;
|
||||||
|
emit currentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig MaemoDeviceConfigListModel::current() const
|
||||||
|
{
|
||||||
|
return MaemoDeviceConfigurations::instance().find(m_currentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap MaemoDeviceConfigListModel::toMap() const
|
||||||
|
{
|
||||||
|
QVariantMap map;
|
||||||
|
map.insert(DeviceIdKey, current().internalId);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigListModel::fromMap(const QVariantMap &map)
|
||||||
|
{
|
||||||
|
const quint64 oldId = m_currentId;
|
||||||
|
m_currentId = map.value(DeviceIdKey, 0).toULongLong();
|
||||||
|
resetCurrentIndex();
|
||||||
|
if (oldId != m_currentId)
|
||||||
|
emit currentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigListModel::handleDeviceConfigListChange()
|
||||||
|
{
|
||||||
|
resetCurrentIndex();
|
||||||
|
reset();
|
||||||
|
emit currentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
int MaemoDeviceConfigListModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return parent.isValid() ? 0
|
||||||
|
: MaemoDeviceConfigurations::instance().devConfigs().count();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant MaemoDeviceConfigListModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if (!index.isValid() || index.row() >= rowCount()
|
||||||
|
|| role != Qt::DisplayRole)
|
||||||
|
return QString();
|
||||||
|
return MaemoDeviceConfigurations::instance().devConfigs().at(index.row()).name;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Creator.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** No Commercial Usage
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAEMODEVICECONFIGLISTMODEL_H
|
||||||
|
#define MAEMODEVICECONFIGLISTMODEL_H
|
||||||
|
|
||||||
|
#include "maemodeviceconfigurations.h"
|
||||||
|
|
||||||
|
#include <QtCore/QAbstractListModel>
|
||||||
|
#include <QtCore/QVariantMap>
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class MaemoDeviceConfigListModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MaemoDeviceConfigListModel(QObject *parent = 0);
|
||||||
|
void setCurrentIndex(int index);
|
||||||
|
MaemoDeviceConfig current() const;
|
||||||
|
int currentIndex() const { return m_currentIndex; }
|
||||||
|
|
||||||
|
QVariantMap toMap() const;
|
||||||
|
void fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void currentChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_SLOT void handleDeviceConfigListChange();
|
||||||
|
void resetCurrentIndex();
|
||||||
|
void setInvalid();
|
||||||
|
|
||||||
|
quint64 m_currentId;
|
||||||
|
int m_currentIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // MAEMODEVICECONFIGLISTMODEL_H
|
||||||
@@ -58,6 +58,8 @@ public:
|
|||||||
void save(QSettings &settings) const;
|
void save(QSettings &settings) const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
|
static const quint64 InvalidId = 0;
|
||||||
|
|
||||||
Core::SshConnectionParameters server;
|
Core::SshConnectionParameters server;
|
||||||
QString name;
|
QString name;
|
||||||
DeviceType type;
|
DeviceType type;
|
||||||
@@ -69,7 +71,6 @@ private:
|
|||||||
int defaultGdbServerPort(DeviceType type) const;
|
int defaultGdbServerPort(DeviceType type) const;
|
||||||
QString defaultHost(DeviceType type) const;
|
QString defaultHost(DeviceType type) const;
|
||||||
|
|
||||||
static const quint64 InvalidId = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DevConfNameMatcher
|
class DevConfNameMatcher
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
#include "maemodeploystep.h"
|
#include "maemodeploystep.h"
|
||||||
|
#include "maemodeviceconfiglistmodel.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemorunconfigurationwidget.h"
|
#include "maemorunconfigurationwidget.h"
|
||||||
#include "maemotoolchain.h"
|
#include "maemotoolchain.h"
|
||||||
@@ -68,7 +69,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
|
|||||||
: RunConfiguration(parent, source)
|
: RunConfiguration(parent, source)
|
||||||
, m_proFilePath(source->m_proFilePath)
|
, m_proFilePath(source->m_proFilePath)
|
||||||
, m_gdbPath(source->m_gdbPath)
|
, m_gdbPath(source->m_gdbPath)
|
||||||
, m_devConfig(source->m_devConfig)
|
|
||||||
, m_arguments(source->m_arguments)
|
, m_arguments(source->m_arguments)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -76,10 +76,13 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
|
|||||||
|
|
||||||
void MaemoRunConfiguration::init()
|
void MaemoRunConfiguration::init()
|
||||||
{
|
{
|
||||||
|
m_devConfigModel = new MaemoDeviceConfigListModel(this);
|
||||||
setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
|
setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
|
||||||
|
|
||||||
updateDeviceConfigurations();
|
updateDeviceConfigurations();
|
||||||
connect(&MaemoDeviceConfigurations::instance(), SIGNAL(updated()), this,
|
connect(m_devConfigModel, SIGNAL(currentChanged()), this,
|
||||||
|
SLOT(updateDeviceConfigurations()));
|
||||||
|
connect(m_devConfigModel, SIGNAL(modelReset()), this,
|
||||||
SLOT(updateDeviceConfigurations()));
|
SLOT(updateDeviceConfigurations()));
|
||||||
|
|
||||||
connect(qt4Target()->qt4Project(),
|
connect(qt4Target()->qt4Project(),
|
||||||
@@ -128,10 +131,10 @@ void MaemoRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFil
|
|||||||
QVariantMap MaemoRunConfiguration::toMap() const
|
QVariantMap MaemoRunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(RunConfiguration::toMap());
|
QVariantMap map(RunConfiguration::toMap());
|
||||||
map.insert(DeviceIdKey, m_devConfig.internalId);
|
|
||||||
map.insert(ArgumentsKey, m_arguments);
|
map.insert(ArgumentsKey, m_arguments);
|
||||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||||
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
|
map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
|
||||||
|
map.unite(m_devConfigModel->toMap());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,24 +143,22 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!RunConfiguration::fromMap(map))
|
if (!RunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setDeviceConfig(MaemoDeviceConfigurations::instance().
|
|
||||||
find(map.value(DeviceIdKey, 0).toInt()));
|
|
||||||
m_arguments = map.value(ArgumentsKey).toStringList();
|
m_arguments = map.value(ArgumentsKey).toStringList();
|
||||||
const QDir dir = QDir(target()->project()->projectDirectory());
|
const QDir dir = QDir(target()->project()->projectDirectory());
|
||||||
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
|
m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
|
||||||
|
m_devConfigModel->fromMap(map);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::setDeviceConfig(const MaemoDeviceConfig &devConf)
|
|
||||||
{
|
|
||||||
m_devConfig = devConf;
|
|
||||||
emit deviceConfigurationChanged(target());
|
|
||||||
}
|
|
||||||
|
|
||||||
MaemoDeviceConfig MaemoRunConfiguration::deviceConfig() const
|
MaemoDeviceConfig MaemoRunConfiguration::deviceConfig() const
|
||||||
{
|
{
|
||||||
return m_devConfig;
|
return m_devConfigModel->current();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfigListModel *MaemoRunConfiguration::deviceConfigModel() const
|
||||||
|
{
|
||||||
|
return m_devConfigModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
||||||
@@ -251,16 +252,7 @@ void MaemoRunConfiguration::setArguments(const QStringList &args)
|
|||||||
|
|
||||||
void MaemoRunConfiguration::updateDeviceConfigurations()
|
void MaemoRunConfiguration::updateDeviceConfigurations()
|
||||||
{
|
{
|
||||||
const MaemoDeviceConfigurations &configManager
|
emit deviceConfigurationChanged(target());
|
||||||
= MaemoDeviceConfigurations::instance();
|
|
||||||
if (!m_devConfig.isValid()) {
|
|
||||||
const QList<MaemoDeviceConfig> &configList = configManager.devConfigs();
|
|
||||||
if (!configList.isEmpty())
|
|
||||||
m_devConfig = configList.first();
|
|
||||||
} else {
|
|
||||||
m_devConfig = configManager.find(m_devConfig.internalId);
|
|
||||||
}
|
|
||||||
emit deviceConfigurationsUpdated(target());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -47,15 +47,16 @@ class Qt4Project;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MaemoManager;
|
|
||||||
class MaemoToolChain;
|
|
||||||
class Qt4BuildConfiguration;
|
class Qt4BuildConfiguration;
|
||||||
class Qt4ProFileNode;
|
class Qt4ProFileNode;
|
||||||
class Qt4Target;
|
class Qt4Target;
|
||||||
|
|
||||||
|
class MaemoDeviceConfigListModel;
|
||||||
class MaemoDeployStep;
|
class MaemoDeployStep;
|
||||||
|
class MaemoManager;
|
||||||
class MaemoPackageCreationStep;
|
class MaemoPackageCreationStep;
|
||||||
class MaemoRunConfigurationFactory;
|
class MaemoRunConfigurationFactory;
|
||||||
|
class MaemoToolChain;
|
||||||
|
|
||||||
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
|
class MaemoRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
@@ -81,8 +82,8 @@ public:
|
|||||||
const QString targetRoot() const;
|
const QString targetRoot() const;
|
||||||
const QStringList arguments() const;
|
const QStringList arguments() const;
|
||||||
void setArguments(const QStringList &args);
|
void setArguments(const QStringList &args);
|
||||||
void setDeviceConfig(const MaemoDeviceConfig &deviceConfig);
|
|
||||||
MaemoDeviceConfig deviceConfig() const;
|
MaemoDeviceConfig deviceConfig() const;
|
||||||
|
MaemoDeviceConfigListModel *deviceConfigModel() const;
|
||||||
QString runtimeGdbServerPort() const;
|
QString runtimeGdbServerPort() const;
|
||||||
|
|
||||||
const QString gdbCmd() const;
|
const QString gdbCmd() const;
|
||||||
@@ -91,7 +92,6 @@ public:
|
|||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void deviceConfigurationsUpdated(ProjectExplorer::Target *target);
|
|
||||||
void deviceConfigurationChanged(ProjectExplorer::Target *target);
|
void deviceConfigurationChanged(ProjectExplorer::Target *target);
|
||||||
void targetInformationChanged() const;
|
void targetInformationChanged() const;
|
||||||
|
|
||||||
@@ -109,8 +109,7 @@ private:
|
|||||||
|
|
||||||
QString m_proFilePath;
|
QString m_proFilePath;
|
||||||
mutable QString m_gdbPath;
|
mutable QString m_gdbPath;
|
||||||
|
MaemoDeviceConfigListModel *m_devConfigModel;
|
||||||
MaemoDeviceConfig m_devConfig;
|
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "maemorunconfigurationwidget.h"
|
#include "maemorunconfigurationwidget.h"
|
||||||
|
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfiglistmodel.h"
|
||||||
#include "maemomanager.h"
|
#include "maemomanager.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
#include "maemosettingspage.h"
|
#include "maemosettingspage.h"
|
||||||
@@ -70,6 +70,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
|
|||||||
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
|
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
|
||||||
m_devConfBox = new QComboBox;
|
m_devConfBox = new QComboBox;
|
||||||
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
m_devConfBox->setModel(runConfiguration->deviceConfigModel());
|
||||||
devConfLayout->setMargin(0);
|
devConfLayout->setMargin(0);
|
||||||
devConfLayout->addWidget(m_devConfBox);
|
devConfLayout->addWidget(m_devConfBox);
|
||||||
QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
|
QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
|
||||||
@@ -88,16 +89,15 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
|
|||||||
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
|
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
|
||||||
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
|
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
|
||||||
|
|
||||||
resetDeviceConfigurations();
|
handleCurrentDeviceConfigChanged();
|
||||||
connect(m_runConfiguration, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target *)),
|
|
||||||
this, SLOT(resetDeviceConfigurations()));
|
|
||||||
|
|
||||||
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
|
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
SLOT(configNameEdited(QString)));
|
SLOT(configNameEdited(QString)));
|
||||||
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
|
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
|
||||||
SLOT(argumentsEdited(QString)));
|
SLOT(argumentsEdited(QString)));
|
||||||
connect(m_devConfBox, SIGNAL(activated(QString)), this,
|
connect(m_devConfBox, SIGNAL(activated(int)), this,
|
||||||
SLOT(deviceConfigurationChanged(QString)));
|
SLOT(setCurrentDeviceConfig(int)));
|
||||||
|
connect(runConfiguration->deviceConfigModel(), SIGNAL(currentChanged()),
|
||||||
|
this, SLOT(handleCurrentDeviceConfigChanged()));
|
||||||
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
|
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
|
||||||
SLOT(updateTargetInformation()));
|
SLOT(updateTargetInformation()));
|
||||||
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
|
connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
|
||||||
@@ -121,25 +121,6 @@ void MaemoRunConfigurationWidget::updateTargetInformation()
|
|||||||
m_executableLabel->setText(m_runConfiguration->localExecutableFilePath());
|
m_executableLabel->setText(m_runConfiguration->localExecutableFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfigurationWidget::deviceConfigurationChanged(const QString &name)
|
|
||||||
{
|
|
||||||
const MaemoDeviceConfig &devConfig
|
|
||||||
= MaemoDeviceConfigurations::instance().find(name);
|
|
||||||
m_runConfiguration->setDeviceConfig(devConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoRunConfigurationWidget::resetDeviceConfigurations()
|
|
||||||
{
|
|
||||||
m_devConfBox->clear();
|
|
||||||
const QList<MaemoDeviceConfig> &devConfs =
|
|
||||||
MaemoDeviceConfigurations::instance().devConfigs();
|
|
||||||
foreach (const MaemoDeviceConfig &devConf, devConfs)
|
|
||||||
m_devConfBox->addItem(devConf.name);
|
|
||||||
m_devConfBox->addItem(MaemoDeviceConfig().name);
|
|
||||||
const MaemoDeviceConfig &devConf = m_runConfiguration->deviceConfig();
|
|
||||||
m_devConfBox->setCurrentIndex(m_devConfBox->findText(devConf.name));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
|
void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
|
||||||
{
|
{
|
||||||
if (link == QLatin1String("deviceconfig")) {
|
if (link == QLatin1String("deviceconfig")) {
|
||||||
@@ -151,5 +132,16 @@ void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged()
|
||||||
|
{
|
||||||
|
m_devConfBox->setCurrentIndex(m_runConfiguration->deviceConfigModel()
|
||||||
|
->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoRunConfigurationWidget::setCurrentDeviceConfig(int index)
|
||||||
|
{
|
||||||
|
m_runConfiguration->deviceConfigModel()->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ QT_END_NAMESPACE
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MaemoDeviceConfig;
|
|
||||||
class MaemoRunConfiguration;
|
class MaemoRunConfiguration;
|
||||||
|
|
||||||
class MaemoRunConfigurationWidget : public QWidget
|
class MaemoRunConfigurationWidget : public QWidget
|
||||||
@@ -59,10 +58,10 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void configNameEdited(const QString &text);
|
void configNameEdited(const QString &text);
|
||||||
void argumentsEdited(const QString &args);
|
void argumentsEdited(const QString &args);
|
||||||
void deviceConfigurationChanged(const QString &name);
|
|
||||||
void resetDeviceConfigurations();
|
|
||||||
void showSettingsDialog(const QString &link);
|
void showSettingsDialog(const QString &link);
|
||||||
void updateTargetInformation();
|
void updateTargetInformation();
|
||||||
|
void handleCurrentDeviceConfigChanged();
|
||||||
|
void setCurrentDeviceConfig(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit *m_configNameLineEdit;
|
QLineEdit *m_configNameLineEdit;
|
||||||
|
|||||||
@@ -199,8 +199,10 @@ void QemuRuntimeManager::projectRemoved(ProjectExplorer::Project *project)
|
|||||||
|
|
||||||
void QemuRuntimeManager::projectChanged(ProjectExplorer::Project *project)
|
void QemuRuntimeManager::projectChanged(ProjectExplorer::Project *project)
|
||||||
{
|
{
|
||||||
if (project)
|
if (project) {
|
||||||
toggleStarterButton(project->activeTarget());
|
toggleStarterButton(project->activeTarget());
|
||||||
|
deviceConfigurationChanged(project->activeTarget());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool targetIsMaemo(const QString &id)
|
bool targetIsMaemo(const QString &id)
|
||||||
@@ -265,8 +267,10 @@ void QemuRuntimeManager::targetRemoved(ProjectExplorer::Target *target)
|
|||||||
|
|
||||||
void QemuRuntimeManager::targetChanged(ProjectExplorer::Target *target)
|
void QemuRuntimeManager::targetChanged(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
if (target)
|
if (target) {
|
||||||
toggleStarterButton(target);
|
toggleStarterButton(target);
|
||||||
|
deviceConfigurationChanged(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QemuRuntimeManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *rc)
|
void QemuRuntimeManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *rc)
|
||||||
@@ -610,12 +614,8 @@ void QemuRuntimeManager::toggleDeviceConnections(MaemoRunConfiguration *mrc,
|
|||||||
if (_connect) { // handle device configuration changes
|
if (_connect) { // handle device configuration changes
|
||||||
connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
||||||
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
||||||
connect(mrc, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target*)),
|
|
||||||
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
|
||||||
} else {
|
} else {
|
||||||
disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
|
||||||
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
||||||
disconnect(mrc, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target*)),
|
|
||||||
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ HEADERS += \
|
|||||||
$$PWD/maemodeploystepfactory.h \
|
$$PWD/maemodeploystepfactory.h \
|
||||||
$$PWD/maemoglobal.h \
|
$$PWD/maemoglobal.h \
|
||||||
$$PWD/maemosshrunner.h \
|
$$PWD/maemosshrunner.h \
|
||||||
$$PWD/maemodebugsupport.h
|
$$PWD/maemodebugsupport.h \
|
||||||
|
$$PWD/maemodeviceconfiglistmodel.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/maemoconfigtestdialog.cpp \
|
$$PWD/maemoconfigtestdialog.cpp \
|
||||||
@@ -52,7 +53,8 @@ SOURCES += \
|
|||||||
$$PWD/maemodeploystepfactory.cpp \
|
$$PWD/maemodeploystepfactory.cpp \
|
||||||
$$PWD/maemoglobal.cpp \
|
$$PWD/maemoglobal.cpp \
|
||||||
$$PWD/maemosshrunner.cpp \
|
$$PWD/maemosshrunner.cpp \
|
||||||
$$PWD/maemodebugsupport.cpp
|
$$PWD/maemodebugsupport.cpp \
|
||||||
|
$$PWD/maemodeviceconfiglistmodel.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/maemoconfigtestdialog.ui \
|
$$PWD/maemoconfigtestdialog.ui \
|
||||||
|
|||||||
Reference in New Issue
Block a user