#include <QtCore/QStringBuilder>
#include <QtGui/QWidget>
-namespace { const QLatin1String PackagingEnabledKey("Packaging Enabled"); }
+namespace {
+ const QLatin1String PackagingEnabledKey("Packaging Enabled");
+ const QLatin1String DefaultVersionNumber("0.0.1");
+ const QLatin1String VersionNumberKey("Version Number");
+}
using namespace ProjectExplorer::Constants;
using ProjectExplorer::BuildConfiguration;
MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig)
: ProjectExplorer::BuildStep(buildConfig, CreatePackageId),
m_packageContents(new MaemoPackageContents(this)),
- m_packagingEnabled(true)
+ m_packagingEnabled(true),
+ m_versionString(DefaultVersionNumber)
{
}
MaemoPackageCreationStep *other)
: BuildStep(buildConfig, other),
m_packageContents(new MaemoPackageContents(this)),
- m_packagingEnabled(other->m_packagingEnabled)
-
+ m_packagingEnabled(other->m_packagingEnabled),
+ m_versionString(other->m_versionString)
{
-
}
bool MaemoPackageCreationStep::init()
{
QVariantMap map(ProjectExplorer::BuildStep::toMap());
map.insert(PackagingEnabledKey, m_packagingEnabled);
+ map.insert(VersionNumberKey, m_versionString);
return map.unite(m_packageContents->toMap());
}
{
m_packageContents->fromMap(map);
m_packagingEnabled = map.value(PackagingEnabledKey, true).toBool();
+ m_versionString = map.value(VersionNumberKey, DefaultVersionNumber).toString();
return ProjectExplorer::BuildStep::fromMap(map);
}
if (!QFileInfo(buildDir + QLatin1String("/debian")).exists()) {
const QString command = QLatin1String("dh_make -s -n -p ")
- % executableFileName().toLower() % versionString();
+ % executableFileName().toLower() % QLatin1Char('_') % versionString();
if (!runCommand(buildProc, command))
return false;
+
QFile rulesFile(buildDir + QLatin1String("/debian/rules"));
if (!rulesFile.open(QIODevice::ReadWrite)) {
raiseError(tr("Packaging Error: Cannot open file '%1'.")
}
}
+ {
+ QFile changeLog(buildDir + QLatin1String("/debian/changelog"));
+ if (changeLog.open(QIODevice::ReadWrite)) {
+ QString content = QString::fromUtf8(changeLog.readAll());
+ content.replace(QRegExp("\\([a-zA-Z0-9_\\.]+\\)"),
+ QLatin1Char('(') % versionString() % QLatin1Char(')'));
+ changeLog.resize(0);
+ changeLog.write(content.toUtf8());
+ }
+ }
+
if (!runCommand(buildProc, QLatin1String("dh_installdirs")))
return false;
{
QFileInfo execInfo(localExecutableFilePath());
return execInfo.path() % QDir::separator() % execInfo.fileName().toLower()
- % versionString() % QLatin1String("_armel.deb");
+ % QLatin1Char('_') % versionString() % QLatin1String("_armel.deb");
}
QString MaemoPackageCreationStep::versionString() const
{
- return QLatin1String("_0.1");
+ return m_versionString;
+}
+
+void MaemoPackageCreationStep::setVersionString(const QString &version)
+{
+ m_versionString = version;
}
QString MaemoPackageCreationStep::nativePath(const QFile &file) const
<rect>
<x>0</x>
<y>0</y>
- <width>741</width>
- <height>574</height>
+ <width>470</width>
+ <height>325</height>
</rect>
</property>
<property name="sizePolicy">
<verstretch>1</verstretch>
</sizepolicy>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>6</number>
- </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="skipCheckBox">
<property name="toolTip">
</widget>
</item>
<item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>5</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Version number:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Major:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="major">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Minor:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="minor">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Patch:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="patch">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <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>
+ </layout>
+ </item>
+ <item>
<widget class="QLabel" name="contentsLabel">
<property name="font">
<font>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<widget class="QTableView" name="packageContentsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<slot>addFile()</slot>
<hints>
<hint type="sourcelabel">
- <x>729</x>
- <y>88</y>
+ <x>458</x>
+ <y>134</y>
</hint>
<hint type="destinationlabel">
<x>732</x>
<slot>removeFile()</slot>
<hints>
<hint type="sourcelabel">
- <x>729</x>
- <y>124</y>
+ <x>458</x>
+ <y>162</y>
</hint>
<hint type="destinationlabel">
<x>735</x>
</hint>
</hints>
</connection>
+ <connection>
+ <sender>major</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MaemoPackageCreationWidget</receiver>
+ <slot>versionInfoChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>83</x>
+ <y>73</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>461</x>
+ <y>32</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>minor</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MaemoPackageCreationWidget</receiver>
+ <slot>versionInfoChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>154</x>
+ <y>68</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>5</x>
+ <y>15</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>patch</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MaemoPackageCreationWidget</receiver>
+ <slot>versionInfoChanged()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>249</x>
+ <y>68</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>466</x>
+ <y>-7</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>addFile()</slot>
<slot>removeFile()</slot>
<slot>handleSkipButtonToggled(bool)</slot>
+ <slot>versionInfoChanged()</slot>
</slots>
</ui>