Maemo: Make packaging step optional.

Reviewed-by: kh1
This commit is contained in:
ck
2010-06-11 11:58:12 +02:00
parent 2592e6eed0
commit 5221e8eff9
5 changed files with 57 additions and 7 deletions

View File

@@ -59,6 +59,8 @@
#include <QtCore/QStringBuilder> #include <QtCore/QStringBuilder>
#include <QtGui/QWidget> #include <QtGui/QWidget>
namespace { const QLatin1String PackagingEnabledKey("Packaging Enabled"); }
using namespace ProjectExplorer::Constants; using namespace ProjectExplorer::Constants;
using ProjectExplorer::BuildConfiguration; using ProjectExplorer::BuildConfiguration;
using ProjectExplorer::BuildStepConfigWidget; using ProjectExplorer::BuildStepConfigWidget;
@@ -69,14 +71,16 @@ namespace Internal {
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig) MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig)
: ProjectExplorer::BuildStep(buildConfig, CreatePackageId), : ProjectExplorer::BuildStep(buildConfig, CreatePackageId),
m_packageContents(new MaemoPackageContents(this)) m_packageContents(new MaemoPackageContents(this)),
m_packagingEnabled(true)
{ {
} }
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig, MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig,
MaemoPackageCreationStep *other) MaemoPackageCreationStep *other)
: BuildStep(buildConfig, other), : BuildStep(buildConfig, other),
m_packageContents(new MaemoPackageContents(this)) m_packageContents(new MaemoPackageContents(this)),
m_packagingEnabled(other->m_packagingEnabled)
{ {
@@ -90,18 +94,20 @@ bool MaemoPackageCreationStep::init()
QVariantMap MaemoPackageCreationStep::toMap() const QVariantMap MaemoPackageCreationStep::toMap() const
{ {
QVariantMap map(ProjectExplorer::BuildStep::toMap()); QVariantMap map(ProjectExplorer::BuildStep::toMap());
map.insert(PackagingEnabledKey, m_packagingEnabled);
return map.unite(m_packageContents->toMap()); return map.unite(m_packageContents->toMap());
} }
bool MaemoPackageCreationStep::fromMap(const QVariantMap &map) bool MaemoPackageCreationStep::fromMap(const QVariantMap &map)
{ {
m_packageContents->fromMap(map); m_packageContents->fromMap(map);
m_packagingEnabled = map.value(PackagingEnabledKey, true).toBool();
return ProjectExplorer::BuildStep::fromMap(map); return ProjectExplorer::BuildStep::fromMap(map);
} }
void MaemoPackageCreationStep::run(QFutureInterface<bool> &fi) void MaemoPackageCreationStep::run(QFutureInterface<bool> &fi)
{ {
fi.reportResult(createPackage()); fi.reportResult(m_packagingEnabled ? createPackage() : true);
} }
BuildStepConfigWidget *MaemoPackageCreationStep::createConfigWidget() BuildStepConfigWidget *MaemoPackageCreationStep::createConfigWidget()

View File

@@ -68,6 +68,9 @@ public:
QString executableFileName() const; QString executableFileName() const;
MaemoPackageContents *packageContents() const { return m_packageContents; } MaemoPackageContents *packageContents() const { return m_packageContents; }
bool isPackagingEnabled() const { return m_packagingEnabled; }
void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
private: private:
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig, MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig,
MaemoPackageCreationStep *other); MaemoPackageCreationStep *other);
@@ -94,6 +97,7 @@ private:
static const QLatin1String CreatePackageId; static const QLatin1String CreatePackageId;
MaemoPackageContents *const m_packageContents; MaemoPackageContents *const m_packageContents;
bool m_packagingEnabled;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -64,6 +64,8 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
m_ui(new Ui::MaemoPackageCreationWidget) m_ui(new Ui::MaemoPackageCreationWidget)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
m_ui->packageContentsView->setEnabled(m_step->isPackagingEnabled());
m_ui->packageContentsView->setModel(step->packageContents()); m_ui->packageContentsView->setModel(step->packageContents());
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(step->packageContents(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), connect(step->packageContents(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
@@ -136,5 +138,11 @@ void MaemoPackageCreationWidget::enableOrDisableRemoveButton()
&& selectedRows.first().row() != 0); && selectedRows.first().row() != 0);
} }
void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked)
{
m_step->setPackagingEnabled(!checked);
m_ui->packageContentsView->setEnabled(m_step->isPackagingEnabled());
}
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -67,6 +67,7 @@ private slots:
void addFile(); void addFile();
void removeFile(); void removeFile();
void enableOrDisableRemoveButton(); void enableOrDisableRemoveButton();
void handleSkipButtonToggled(bool checked);
private: private:
MaemoPackageCreationStep * const m_step; MaemoPackageCreationStep * const m_step;

View File

@@ -17,6 +17,20 @@
</sizepolicy> </sizepolicy>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="skipCheckBox">
<property name="toolTip">
<string>Check this if you build the package externally. It still needs to be at the location listed above
and the remote executable is assumed to be in the directory mentioned below.</string>
</property>
<property name="text">
<string>Skip Packaging Step</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="contentsLabel"> <widget class="QLabel" name="contentsLabel">
<property name="font"> <property name="font">
@@ -126,8 +140,8 @@
<slot>addFile()</slot> <slot>addFile()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>712</x> <x>729</x>
<y>44</y> <y>88</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>732</x> <x>732</x>
@@ -142,8 +156,8 @@
<slot>removeFile()</slot> <slot>removeFile()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>723</x> <x>729</x>
<y>77</y> <y>124</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>735</x> <x>735</x>
@@ -151,9 +165,26 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>skipCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>MaemoPackageCreationWidget</receiver>
<slot>handleSkipButtonToggled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>129</x>
<y>18</y>
</hint>
<hint type="destinationlabel">
<x>240</x>
<y>31</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>addFile()</slot> <slot>addFile()</slot>
<slot>removeFile()</slot> <slot>removeFile()</slot>
<slot>handleSkipButtonToggled(bool)</slot>
</slots> </slots>
</ui> </ui>