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

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

Reviewed-by: kh1
This commit is contained in:
ck
2010-07-14 12:21:35 +02:00
parent d0cbac9032
commit 8a3c1cc0d4
15 changed files with 109 additions and 82 deletions

View File

@@ -42,9 +42,9 @@
#include "maemodeployables.h" #include "maemodeployables.h"
#include "maemodeployablelistmodel.h" #include "maemodeployablelistmodel.h"
#include "maemopackagecreationstep.h"
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include <projectexplorer/buildstep.h>
#include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h> #include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h> #include <qt4projectmanager/qt4project.h>
@@ -55,8 +55,8 @@
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
MaemoDeployables::MaemoDeployables(MaemoPackageCreationStep *packagingStep) MaemoDeployables::MaemoDeployables(const ProjectExplorer::BuildStep *buildStep)
: m_packagingStep(packagingStep), m_proFilesWatcher(0) : m_buildStep(buildStep), m_proFilesWatcher(0)
{ {
QTimer::singleShot(0, this, SLOT(createModels())); QTimer::singleShot(0, this, SLOT(createModels()));
} }
@@ -64,8 +64,8 @@ MaemoDeployables::MaemoDeployables(MaemoPackageCreationStep *packagingStep)
void MaemoDeployables::createModels() void MaemoDeployables::createModels()
{ {
m_listModels.clear(); m_listModels.clear();
Qt4ProFileNode *rootNode = m_packagingStep->qt4BuildConfiguration() Qt4ProFileNode *rootNode
->qt4Target()->qt4Project()->rootProjectNode(); = qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
createModels(rootNode); createModels(rootNode);
if (!m_proFilesWatcher) { if (!m_proFilesWatcher) {
m_proFilesWatcher = new Qt4NodesWatcher(this); m_proFilesWatcher = new Qt4NodesWatcher(this);
@@ -84,7 +84,10 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
case ApplicationTemplate: case ApplicationTemplate:
case LibraryTemplate: case LibraryTemplate:
case ScriptTemplate: { 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"); + QLatin1String("/usr/share/qt/mkspecs/qconfig.pri");
m_listModels << new MaemoDeployableListModel(proFileNode, qConfigFile, this); m_listModels << new MaemoDeployableListModel(proFileNode, qConfigFile, this);
break; break;
@@ -151,5 +154,13 @@ QString MaemoDeployables::remoteExecutableFilePath(const QString &localExecutabl
return QString(); 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 Qt4ProjectManager
} // namespace Internal } // namespace Internal

View File

@@ -47,10 +47,13 @@
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QObject> #include <QtCore/QObject>
namespace ProjectExplorer { class BuildStep; }
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
class MaemoDeployableListModel; class MaemoDeployableListModel;
class MaemoPackageCreationStep; class Qt4BuildConfiguration;
class Qt4NodesWatcher; class Qt4NodesWatcher;
class Qt4ProFileNode; class Qt4ProFileNode;
@@ -58,7 +61,7 @@ class MaemoDeployables : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
MaemoDeployables(MaemoPackageCreationStep *packagingStep); MaemoDeployables(const ProjectExplorer::BuildStep *buildStep);
void setUnmodified(); void setUnmodified();
bool isModified() const; bool isModified() const;
int deployableCount() const; int deployableCount() const;
@@ -73,9 +76,10 @@ signals:
private: private:
Q_SLOT void createModels(); Q_SLOT void createModels();
void createModels(const Qt4ProFileNode *proFileNode); void createModels(const Qt4ProFileNode *proFileNode);
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
QList<MaemoDeployableListModel *> m_listModels; QList<MaemoDeployableListModel *> m_listModels;
MaemoPackageCreationStep * const m_packagingStep; const ProjectExplorer::BuildStep * const m_buildStep;
Qt4NodesWatcher *m_proFilesWatcher; Qt4NodesWatcher *m_proFilesWatcher;
}; };

View File

@@ -59,19 +59,23 @@ const QLatin1String MaemoDeployStep::Id("Qt4ProjectManager.MaemoDeployStep");
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc) MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc)
: BuildStep(bc, Id) : BuildStep(bc, Id), m_deployables(new MaemoDeployables(this))
{ {
ctor(); ctor();
} }
MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc, MaemoDeployStep::MaemoDeployStep(ProjectExplorer::BuildConfiguration *bc,
MaemoDeployStep *other) MaemoDeployStep *other)
: BuildStep(bc, other), m_lastDeployed(other->m_lastDeployed) : BuildStep(bc, other), m_deployables(new MaemoDeployables(this)),
m_lastDeployed(other->m_lastDeployed)
{ {
ctor(); ctor();
} }
MaemoDeployStep::~MaemoDeployStep() {} MaemoDeployStep::~MaemoDeployStep()
{
delete m_deployables;
}
void MaemoDeployStep::ctor() void MaemoDeployStep::ctor()
{ {
@@ -152,7 +156,8 @@ const MaemoPackageCreationStep *MaemoDeployStep::packagingStep() const
{ {
const MaemoPackageCreationStep * const step const MaemoPackageCreationStep * const step
= MaemoGlobal::buildStep<MaemoPackageCreationStep>(buildConfiguration()); = 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; return step;
} }
@@ -283,10 +288,9 @@ void MaemoDeployStep::handleSftpChannelInitialized()
m_needsInstall = false; m_needsInstall = false;
} }
} else { } else {
const MaemoDeployables * const deployables = pStep->deployables(); const int deployableCount = m_deployables->deployableCount();
const int deployableCount = deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) { for (int i = 0; i < deployableCount; ++i) {
const MaemoDeployable &d = deployables->deployableAt(i); const MaemoDeployable &d = m_deployables->deployableAt(i);
if (currentlyNeedsDeployment(hostName, d) if (currentlyNeedsDeployment(hostName, d)
&& !deploy(MaemoDeployable(d))) && !deploy(MaemoDeployable(d)))
return; return;

View File

@@ -54,6 +54,7 @@ class SshRemoteProcess;
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
class MaemoDeployables;
class MaemoPackageCreationStep; class MaemoPackageCreationStep;
class MaemoDeployStep : public ProjectExplorer::BuildStep class MaemoDeployStep : public ProjectExplorer::BuildStep
@@ -67,6 +68,7 @@ public:
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);
MaemoDeployables *deployables() const { return m_deployables; }
signals: signals:
void done(); void done();
@@ -107,6 +109,7 @@ private:
static const QLatin1String Id; static const QLatin1String Id;
MaemoDeployables * const m_deployables;
QSharedPointer<Core::SshConnection> m_connection; QSharedPointer<Core::SshConnection> m_connection;
QSharedPointer<Core::SftpChannel> m_uploader; QSharedPointer<Core::SftpChannel> m_uploader;
QSharedPointer<Core::SshRemoteProcess> m_installer; QSharedPointer<Core::SshRemoteProcess> m_installer;

View File

@@ -2,6 +2,9 @@
#include "ui_maemodeploystepwidget.h" #include "ui_maemodeploystepwidget.h"
#include "maemodeploystep.h" #include "maemodeploystep.h"
#include "maemodeployablelistmodel.h"
#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemorunconfiguration.h" #include "maemorunconfiguration.h"
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
@@ -16,6 +19,10 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) :
m_step(step) m_step(step)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
SLOT(handleModelsCreated()));
handleModelsCreated();
} }
MaemoDeployStepWidget::~MaemoDeployStepWidget() MaemoDeployStepWidget::~MaemoDeployStepWidget()
@@ -49,5 +56,17 @@ QString MaemoDeployStepWidget::displayName() const
return QString(); 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 Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -22,6 +22,7 @@ public:
~MaemoDeployStepWidget(); ~MaemoDeployStepWidget();
private: private:
Q_SLOT void handleModelsCreated();
virtual void init(); virtual void init();
virtual QString summaryText() const; virtual QString summaryText() const;
virtual QString displayName() const; virtual QString displayName() const;

View File

@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>MaemoDeployStepWidget</class> <class>MaemoDeployStepWidget</class>
<widget class="QWidget" name="MaemoDeployStepWidget"> <widget class="QWidget" name="MaemoDeployStepWidget">
<property name="geometry"> <property name="geometry">
@@ -15,7 +13,22 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </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> </widget>
<pixmapfunction/> </item>
<item>
<widget class="QTabWidget" name="tabWidget"/>
</item>
</layout>
</widget>
<resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -42,8 +42,10 @@
#include "maemopackagecreationstep.h" #include "maemopackagecreationstep.h"
#include "maemoconstants.h" #include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemopackagecreationwidget.h" #include "maemopackagecreationwidget.h"
#include "maemodeployables.h" #include "maemodeployables.h"
#include "maemodeploystep.h"
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include "profilewrapper.h" #include "profilewrapper.h"
@@ -73,7 +75,6 @@ namespace Internal {
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig) MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig)
: ProjectExplorer::BuildStep(buildConfig, CreatePackageId), : ProjectExplorer::BuildStep(buildConfig, CreatePackageId),
m_deployables(new MaemoDeployables(this)),
m_packagingEnabled(true), m_packagingEnabled(true),
m_versionString(DefaultVersionNumber) m_versionString(DefaultVersionNumber)
{ {
@@ -82,7 +83,6 @@ MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConf
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig, MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig,
MaemoPackageCreationStep *other) MaemoPackageCreationStep *other)
: BuildStep(buildConfig, other), : BuildStep(buildConfig, other),
m_deployables(new MaemoDeployables(this)),
m_packagingEnabled(other->m_packagingEnabled), m_packagingEnabled(other->m_packagingEnabled),
m_versionString(other->m_versionString) m_versionString(other->m_versionString)
{ {
@@ -90,7 +90,6 @@ MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConf
MaemoPackageCreationStep::~MaemoPackageCreationStep() MaemoPackageCreationStep::~MaemoPackageCreationStep()
{ {
delete m_deployables;
} }
bool MaemoPackageCreationStep::init() bool MaemoPackageCreationStep::init()
@@ -245,7 +244,7 @@ bool MaemoPackageCreationStep::createPackage()
} }
emit addOutput(tr("Package created."), textCharFormat); emit addOutput(tr("Package created."), textCharFormat);
m_deployables->setUnmodified(); deployStep()->deployables()->setUnmodified();
return true; return true;
} }
@@ -313,6 +312,15 @@ const MaemoToolChain *MaemoPackageCreationStep::maemoToolChain() const
return static_cast<MaemoToolChain *>(qt4BuildConfiguration()->toolChain()); 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 QString MaemoPackageCreationStep::maddeRoot() const
{ {
return maemoToolChain()->maddeRoot(); return maemoToolChain()->maddeRoot();
@@ -325,14 +333,15 @@ QString MaemoPackageCreationStep::targetRoot() const
bool MaemoPackageCreationStep::packagingNeeded() const bool MaemoPackageCreationStep::packagingNeeded() const
{ {
const MaemoDeployables * const deployables = deployStep()->deployables();
QFileInfo packageInfo(packageFilePath()); QFileInfo packageInfo(packageFilePath());
if (!packageInfo.exists() || m_deployables->isModified()) if (!packageInfo.exists() || deployables->isModified())
return true; return true;
const int deployableCount = m_deployables->deployableCount(); const int deployableCount = deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) { for (int i = 0; i < deployableCount; ++i) {
if (packageInfo.lastModified() if (packageInfo.lastModified()
<= QFileInfo(m_deployables->deployableAt(i).localFilePath) <= QFileInfo(deployables->deployableAt(i).localFilePath)
.lastModified()) .lastModified())
return true; return true;
} }

View File

@@ -54,7 +54,7 @@ QT_END_NAMESPACE
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
class MaemoDeployables; class MaemoDeployStep;
class MaemoToolChain; class MaemoToolChain;
class ProFileWrapper; class ProFileWrapper;
class Qt4BuildConfiguration; class Qt4BuildConfiguration;
@@ -68,9 +68,6 @@ public:
~MaemoPackageCreationStep(); ~MaemoPackageCreationStep();
QString packageFilePath() const; QString packageFilePath() const;
MaemoDeployables *deployables() const { return m_deployables; }
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
bool isPackagingEnabled() const { return m_packagingEnabled; } bool isPackagingEnabled() const { return m_packagingEnabled; }
void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; } void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
@@ -102,10 +99,12 @@ private:
const QString &detailedMsg = QString()); const QString &detailedMsg = QString());
QString buildDirectory() const; QString buildDirectory() const;
QString projectName() const; QString projectName() const;
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
MaemoDeployStep * deployStep() const;
static const QLatin1String CreatePackageId; static const QLatin1String CreatePackageId;
MaemoDeployables * const m_deployables;
bool m_packagingEnabled; bool m_packagingEnabled;
QString m_versionString; QString m_versionString;
QScopedPointer<QProcess> m_buildProc; QScopedPointer<QProcess> m_buildProc;

View File

@@ -42,11 +42,7 @@
#include "maemopackagecreationwidget.h" #include "maemopackagecreationwidget.h"
#include "ui_maemopackagecreationwidget.h" #include "ui_maemopackagecreationwidget.h"
#include "maemodeployablelistmodel.h"
#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemopackagecreationstep.h" #include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
@@ -70,10 +66,6 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt()); m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt());
m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt()); m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt());
versionInfoChanged(); versionInfoChanged();
connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
SLOT(handleModelsCreated()));
handleModelsCreated();
} }
void MaemoPackageCreationWidget::init() void MaemoPackageCreationWidget::init()
@@ -105,16 +97,5 @@ void MaemoPackageCreationWidget::versionInfoChanged()
emit updateSummary(); 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 Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -66,7 +66,6 @@ public:
private slots: private slots:
void handleSkipButtonToggled(bool checked); void handleSkipButtonToggled(bool checked);
void versionInfoChanged(); void versionInfoChanged();
void handleModelsCreated();
private: private:
MaemoPackageCreationStep * const m_step; MaemoPackageCreationStep * const m_step;

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>478</width> <width>453</width>
<height>335</height> <height>116</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -178,24 +178,17 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QLabel" name="contentsLabel"> <spacer name="verticalSpacer">
<property name="font"> <property name="orientation">
<font> <enum>Qt::Vertical</enum>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="text"> <property name="sizeHint" stdset="0">
<string>Files to deploy:</string> <size>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</widget> </spacer>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@@ -170,19 +170,12 @@ const QString MaemoRunConfiguration::gdbCmd() const
return QString(); 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 *MaemoRunConfiguration::deployStep() const
{ {
MaemoDeployStep * const step MaemoDeployStep * const step
= MaemoGlobal::buildStep<MaemoDeployStep>(activeQt4BuildConfiguration()); = 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; return step;
} }

View File

@@ -71,7 +71,6 @@ public:
Qt4Target *qt4Target() const; Qt4Target *qt4Target() const;
Qt4BuildConfiguration *activeQt4BuildConfiguration() const; Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
const MaemoPackageCreationStep *packageStep() const;
MaemoDeployStep *deployStep() const; MaemoDeployStep *deployStep() const;
QString maddeRoot() const; QString maddeRoot() const;

View File

@@ -37,7 +37,6 @@
#include "maemodeployables.h" #include "maemodeployables.h"
#include "maemodeploystep.h" #include "maemodeploystep.h"
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemorunconfiguration.h" #include "maemorunconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -143,7 +142,7 @@ void AbstractMaemoRunControl::stop()
QString AbstractMaemoRunControl::executableFilePathOnTarget() const QString AbstractMaemoRunControl::executableFilePathOnTarget() const
{ {
const MaemoDeployables * const deployables const MaemoDeployables * const deployables
= m_runConfig->packageStep()->deployables(); = m_runConfig->deployStep()->deployables();
return deployables->remoteExecutableFilePath(m_runConfig->executable()); return deployables->remoteExecutableFilePath(m_runConfig->executable());
} }