Commit 8a3c1cc0 authored by ck's avatar ck
Browse files

Maemo: Move INSTALLS information from package step to deploy step.

... because the files are installed even when packaging is disabled.

Reviewed-by: kh1
parent d0cbac90
......@@ -42,9 +42,9 @@
#include "maemodeployables.h"
#include "maemodeployablelistmodel.h"
#include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include <projectexplorer/buildstep.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
......@@ -55,8 +55,8 @@
namespace Qt4ProjectManager {
namespace Internal {
MaemoDeployables::MaemoDeployables(MaemoPackageCreationStep *packagingStep)
: m_packagingStep(packagingStep), m_proFilesWatcher(0)
MaemoDeployables::MaemoDeployables(const ProjectExplorer::BuildStep *buildStep)
: m_buildStep(buildStep), m_proFilesWatcher(0)
{
QTimer::singleShot(0, this, SLOT(createModels()));
}
......@@ -64,8 +64,8 @@ MaemoDeployables::MaemoDeployables(MaemoPackageCreationStep *packagingStep)
void MaemoDeployables::createModels()
{
m_listModels.clear();
Qt4ProFileNode *rootNode = m_packagingStep->qt4BuildConfiguration()
->qt4Target()->qt4Project()->rootProjectNode();
Qt4ProFileNode *rootNode
= qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
createModels(rootNode);
if (!m_proFilesWatcher) {
m_proFilesWatcher = new Qt4NodesWatcher(this);
......@@ -84,7 +84,10 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
case ApplicationTemplate:
case LibraryTemplate:
case ScriptTemplate: {
const QString qConfigFile = m_packagingStep->maemoToolChain()->sysrootRoot()
const MaemoToolChain * const tc
= dynamic_cast<MaemoToolChain *>(qt4BuildConfiguration()->toolChain());
Q_ASSERT(tc);
const QString qConfigFile = tc->sysrootRoot()
+ QLatin1String("/usr/share/qt/mkspecs/qconfig.pri");
m_listModels << new MaemoDeployableListModel(proFileNode, qConfigFile, this);
break;
......@@ -151,5 +154,13 @@ QString MaemoDeployables::remoteExecutableFilePath(const QString &localExecutabl
return QString();
}
const Qt4BuildConfiguration *MaemoDeployables::qt4BuildConfiguration() const
{
const Qt4BuildConfiguration * const bc
= qobject_cast<Qt4BuildConfiguration *>(m_buildStep->buildConfiguration());
Q_ASSERT(bc);
return bc;
}
} // namespace Qt4ProjectManager
} // namespace Internal
......@@ -47,10 +47,13 @@
#include <QtCore/QList>
#include <QtCore/QObject>
namespace ProjectExplorer { class BuildStep; }
namespace Qt4ProjectManager {
namespace Internal {
class MaemoDeployableListModel;
class MaemoPackageCreationStep;
class Qt4BuildConfiguration;
class Qt4NodesWatcher;
class Qt4ProFileNode;
......@@ -58,7 +61,7 @@ class MaemoDeployables : public QObject
{
Q_OBJECT
public:
MaemoDeployables(MaemoPackageCreationStep *packagingStep);
MaemoDeployables(const ProjectExplorer::BuildStep *buildStep);
void setUnmodified();
bool isModified() const;
int deployableCount() const;
......@@ -73,9 +76,10 @@ signals:
private:
Q_SLOT void createModels();
void createModels(const Qt4ProFileNode *proFileNode);
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
QList<MaemoDeployableListModel *> m_listModels;
MaemoPackageCreationStep * const m_packagingStep;
const ProjectExplorer::BuildStep * const m_buildStep;
Qt4NodesWatcher *m_proFilesWatcher;
};
......
......@@ -59,19 +59,23 @@ const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep");
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc)
: BuildStep(bc, Id)
: BuildStep(bc, Id), m_deployables(new MaemoDeployables(this))
{
ctor();
}
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc,
MaemoDeployStep *other)
: BuildStep(bc, other), m_lastDeployed(other->m_lastDeployed)
: BuildStep(bc, other), m_deployables(new MaemoDeployables(this)),
m_lastDeployed(other->m_lastDeployed)
{
ctor();
}
MaemoDeployStep::~MaemoDeployStep() {}
MaemoDeployStep::~MaemoDeployStep()
{
delete m_deployables;
}
void MaemoDeployStep::ctor()
{
......@@ -152,7 +156,8 @@ const MaemoPackageCreationStep *MaemoDeployStep::packagingStep() const
{
const MaemoPackageCreationStep * const step
= MaemoGlobal::buildStep<MaemoPackageCreationStep>(buildConfiguration());
Q_ASSERT(step && "Impossible: Maemo build configuration without packaging step.");
Q_ASSERT_X(step, Q_FUNC_INFO,
"Impossible: Maemo build configuration without packaging step.");
return step;
}
......@@ -283,10 +288,9 @@ void MaemoDeployStep::handleSftpChannelInitialized()
m_needsInstall = false;
}
} else {
const MaemoDeployables * const deployables = pStep->deployables();
const int deployableCount = deployables->deployableCount();
const int deployableCount = m_deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) {
const MaemoDeployable &d = deployables->deployableAt(i);
const MaemoDeployable &d = m_deployables->deployableAt(i);
if (currentlyNeedsDeployment(hostName, d)
&& !deploy(MaemoDeployable(d)))
return;
......
......@@ -54,6 +54,7 @@ class SshRemoteProcess;
namespace Qt4ProjectManager {
namespace Internal {
class MaemoDeployables;
class MaemoPackageCreationStep;
class MaemoDeployStep : public ProjectExplorer::BuildStep
......@@ -67,6 +68,7 @@ public:
bool currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const;
void setDeployed(const QString &host, const MaemoDeployable &deployable);
MaemoDeployables *deployables() const { return m_deployables; }
signals:
void done();
......@@ -107,6 +109,7 @@ private:
static const QLatin1String Id;
MaemoDeployables * const m_deployables;
QSharedPointer<Core::SshConnection> m_connection;
QSharedPointer<Core::SftpChannel> m_uploader;
QSharedPointer<Core::SshRemoteProcess> m_installer;
......
......@@ -2,6 +2,9 @@
#include "ui_maemodeploystepwidget.h"
#include "maemodeploystep.h"
#include "maemodeployablelistmodel.h"
#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemorunconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
......@@ -16,6 +19,10 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) :
m_step(step)
{
ui->setupUi(this);
connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
SLOT(handleModelsCreated()));
handleModelsCreated();
}
MaemoDeployStepWidget::~MaemoDeployStepWidget()
......@@ -49,5 +56,17 @@ QString MaemoDeployStepWidget::displayName() const
return QString();
}
void MaemoDeployStepWidget::handleModelsCreated()
{
ui->tabWidget->clear();
for (int i = 0; i < m_step->deployables()->modelCount(); ++i) {
MaemoDeployableListModel * const model
= m_step->deployables()->modelAt(i);
ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model),
model->projectName());
}
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -22,6 +22,7 @@ public:
~MaemoDeployStepWidget();
private:
Q_SLOT void handleModelsCreated();
virtual void init();
virtual QString summaryText() const;
virtual QString displayName() const;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>MaemoDeployStepWidget</class>
<widget class="QWidget" name="MaemoDeployStepWidget">
<property name="geometry">
......@@ -15,7 +13,22 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
<string>These show the INSTALLS settings from the project file(s).</string>
</property>
<property name="text">
<string>&lt;b&gt;Files to install:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget"/>
</item>
</layout>
</widget>
<pixmapfunction/>
<resources/>
<connections/>
</ui>
......@@ -42,8 +42,10 @@
#include "maemopackagecreationstep.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemopackagecreationwidget.h"
#include "maemodeployables.h"
#include "maemodeploystep.h"
#include "maemotoolchain.h"
#include "profilewrapper.h"
......@@ -73,7 +75,6 @@ namespace Internal {
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig)
: ProjectExplorer::BuildStep(buildConfig, CreatePackageId),
m_deployables(new MaemoDeployables(this)),
m_packagingEnabled(true),
m_versionString(DefaultVersionNumber)
{
......@@ -82,7 +83,6 @@ MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConf
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig,
MaemoPackageCreationStep *other)
: BuildStep(buildConfig, other),
m_deployables(new MaemoDeployables(this)),
m_packagingEnabled(other->m_packagingEnabled),
m_versionString(other->m_versionString)
{
......@@ -90,7 +90,6 @@ MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConf
MaemoPackageCreationStep::~MaemoPackageCreationStep()
{
delete m_deployables;
}
bool MaemoPackageCreationStep::init()
......@@ -245,7 +244,7 @@ bool MaemoPackageCreationStep::createPackage()
}
emit addOutput(tr("Package created."), textCharFormat);
m_deployables->setUnmodified();
deployStep()->deployables()->setUnmodified();
return true;
}
......@@ -313,6 +312,15 @@ const MaemoToolChain *MaemoPackageCreationStep::maemoToolChain() const
return static_cast<MaemoToolChain *>(qt4BuildConfiguration()->toolChain());
}
MaemoDeployStep *MaemoPackageCreationStep::deployStep() const
{
MaemoDeployStep * const deployStep
= MaemoGlobal::buildStep<MaemoDeployStep>(buildConfiguration());
Q_ASSERT(deployStep &&
"Fatal error: Maemo build configuration without deploy step.");
return deployStep;
}
QString MaemoPackageCreationStep::maddeRoot() const
{
return maemoToolChain()->maddeRoot();
......@@ -325,14 +333,15 @@ QString MaemoPackageCreationStep::targetRoot() const
bool MaemoPackageCreationStep::packagingNeeded() const
{
const MaemoDeployables * const deployables = deployStep()->deployables();
QFileInfo packageInfo(packageFilePath());
if (!packageInfo.exists() || m_deployables->isModified())
if (!packageInfo.exists() || deployables->isModified())
return true;
const int deployableCount = m_deployables->deployableCount();
const int deployableCount = deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) {
if (packageInfo.lastModified()
<= QFileInfo(m_deployables->deployableAt(i).localFilePath)
<= QFileInfo(deployables->deployableAt(i).localFilePath)
.lastModified())
return true;
}
......
......@@ -54,7 +54,7 @@ QT_END_NAMESPACE
namespace Qt4ProjectManager {
namespace Internal {
class MaemoDeployables;
class MaemoDeployStep;
class MaemoToolChain;
class ProFileWrapper;
class Qt4BuildConfiguration;
......@@ -68,9 +68,6 @@ public:
~MaemoPackageCreationStep();
QString packageFilePath() const;
MaemoDeployables *deployables() const { return m_deployables; }
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
bool isPackagingEnabled() const { return m_packagingEnabled; }
void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
......@@ -102,10 +99,12 @@ private:
const QString &detailedMsg = QString());
QString buildDirectory() const;
QString projectName() const;
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
MaemoDeployStep * deployStep() const;
static const QLatin1String CreatePackageId;
MaemoDeployables * const m_deployables;
bool m_packagingEnabled;
QString m_versionString;
QScopedPointer<QProcess> m_buildProc;
......
......@@ -42,11 +42,7 @@
#include "maemopackagecreationwidget.h"
#include "ui_maemopackagecreationwidget.h"
#include "maemodeployablelistmodel.h"
#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include <utils/qtcassert.h>
#include <projectexplorer/project.h>
......@@ -70,10 +66,6 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt());
m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt());
versionInfoChanged();
connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
SLOT(handleModelsCreated()));
handleModelsCreated();
}
void MaemoPackageCreationWidget::init()
......@@ -105,16 +97,5 @@ void MaemoPackageCreationWidget::versionInfoChanged()
emit updateSummary();
}
void MaemoPackageCreationWidget::handleModelsCreated()
{
m_ui->tabWidget->clear();
for (int i = 0; i < m_step->deployables()->modelCount(); ++i) {
MaemoDeployableListModel * const model
= m_step->deployables()->modelAt(i);
m_ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model),
model->projectName());
}
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -66,7 +66,6 @@ public:
private slots:
void handleSkipButtonToggled(bool checked);
void versionInfoChanged();
void handleModelsCreated();
private:
MaemoPackageCreationStep * const m_step;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>478</width>
<height>335</height>
<width>453</width>
<height>116</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -178,24 +178,17 @@
</layout>
</item>
<item>
<widget class="QLabel" name="contentsLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Files to deploy:</string>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>
......
......@@ -170,19 +170,12 @@ const QString MaemoRunConfiguration::gdbCmd() const
return QString();
}
const MaemoPackageCreationStep *MaemoRunConfiguration::packageStep() const
{
const MaemoPackageCreationStep * const step
= MaemoGlobal::buildStep<MaemoPackageCreationStep>(activeQt4BuildConfiguration());
Q_ASSERT(step && "Impossible: Maemo build configuration without packaging step.");
return step;
}
MaemoDeployStep *MaemoRunConfiguration::deployStep() const
{
MaemoDeployStep * const step
= MaemoGlobal::buildStep<MaemoDeployStep>(activeQt4BuildConfiguration());
Q_ASSERT(step && !"Impossible: Maemo build configuration without deploy step.");
Q_ASSERT_X(step, Q_FUNC_INFO,
"Impossible: Maemo build configuration without deploy step.");
return step;
}
......
......@@ -71,7 +71,6 @@ public:
Qt4Target *qt4Target() const;
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
const MaemoPackageCreationStep *packageStep() const;
MaemoDeployStep *deployStep() const;
QString maddeRoot() const;
......
......@@ -37,7 +37,6 @@
#include "maemodeployables.h"
#include "maemodeploystep.h"
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemorunconfiguration.h"
#include <coreplugin/icore.h>
......@@ -143,7 +142,7 @@ void AbstractMaemoRunControl::stop()
QString AbstractMaemoRunControl::executableFilePathOnTarget() const
{
const MaemoDeployables * const deployables
= m_runConfig->packageStep()->deployables();
= m_runConfig->deployStep()->deployables();
return deployables->remoteExecutableFilePath(m_runConfig->executable());
}
......
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