forked from qt-creator/qt-creator
Maemo: Let user edit Debian files via the packaging widget.
This will give an additional hint to users that they can and should adapt the Debian template files. Reviewed-by: kh1
This commit is contained in:
@@ -43,11 +43,13 @@
|
|||||||
#include "ui_maemopackagecreationwidget.h"
|
#include "ui_maemopackagecreationwidget.h"
|
||||||
|
|
||||||
#include "maemopackagecreationstep.h"
|
#include "maemopackagecreationstep.h"
|
||||||
|
#include "maemotemplatesmanager.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
@@ -63,14 +65,14 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
|
|||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
|
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
QTimer::singleShot(0, this, SLOT(initVersion()));
|
QTimer::singleShot(0, this, SLOT(initGui()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoPackageCreationWidget::init()
|
void MaemoPackageCreationWidget::init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoPackageCreationWidget::initVersion()
|
void MaemoPackageCreationWidget::initGui()
|
||||||
{
|
{
|
||||||
QString error;
|
QString error;
|
||||||
QString versionString = m_step->versionString(&error);
|
QString versionString = m_step->versionString(&error);
|
||||||
@@ -86,6 +88,13 @@ void MaemoPackageCreationWidget::initVersion()
|
|||||||
connect(m_step, SIGNAL(packageFilePathChanged()), this,
|
connect(m_step, SIGNAL(packageFilePathChanged()), this,
|
||||||
SIGNAL(updateSummary()));
|
SIGNAL(updateSummary()));
|
||||||
versionInfoChanged();
|
versionInfoChanged();
|
||||||
|
|
||||||
|
const QStringList &debianFiles = MaemoTemplatesManager::instance()
|
||||||
|
->debianFiles(m_step->buildConfiguration()->target()->project());
|
||||||
|
foreach (const QString &fileName, debianFiles) {
|
||||||
|
if (fileName != QLatin1String("compat"))
|
||||||
|
m_ui->debianFilesComboBox->addItem(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoPackageCreationWidget::summaryText() const
|
QString MaemoPackageCreationWidget::summaryText() const
|
||||||
@@ -103,6 +112,8 @@ void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked)
|
|||||||
m_ui->major->setEnabled(!checked);
|
m_ui->major->setEnabled(!checked);
|
||||||
m_ui->minor->setEnabled(!checked);
|
m_ui->minor->setEnabled(!checked);
|
||||||
m_ui->patch->setEnabled(!checked);
|
m_ui->patch->setEnabled(!checked);
|
||||||
|
m_ui->debianFilesComboBox->setEnabled(!checked);
|
||||||
|
m_ui->editDebianFileButton->setEnabled(!checked);
|
||||||
m_step->setPackagingEnabled(!checked);
|
m_step->setPackagingEnabled(!checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,5 +127,13 @@ void MaemoPackageCreationWidget::versionInfoChanged()
|
|||||||
QMessageBox::critical(this, tr("Could not set version number"), error);
|
QMessageBox::critical(this, tr("Could not set version number"), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoPackageCreationWidget::editDebianFile()
|
||||||
|
{
|
||||||
|
const QString debianFilePath = MaemoTemplatesManager::instance()
|
||||||
|
->debianDirPath(m_step->buildConfiguration()->target()->project())
|
||||||
|
+ QLatin1Char('/') + m_ui->debianFilesComboBox->currentText();
|
||||||
|
Core::EditorManager::instance()->openEditor(debianFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleSkipButtonToggled(bool checked);
|
void handleSkipButtonToggled(bool checked);
|
||||||
|
void editDebianFile();
|
||||||
void versionInfoChanged();
|
void versionInfoChanged();
|
||||||
void initVersion();
|
void initGui();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MaemoPackageCreationStep * const m_step;
|
MaemoPackageCreationStep * const m_step;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<verstretch>1</verstretch>
|
<verstretch>1</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="skipCheckBox">
|
<widget class="QCheckBox" name="skipCheckBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -28,27 +28,27 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>5</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item>
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -60,28 +60,12 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Version number:</string>
|
<string><b>Version number:</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<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>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -175,21 +159,42 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="editDebianFileLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Adapt Debian file:</b></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="debianFilesComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editDebianFileButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
@@ -217,8 +222,8 @@
|
|||||||
<slot>versionInfoChanged()</slot>
|
<slot>versionInfoChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>83</x>
|
<x>241</x>
|
||||||
<y>73</y>
|
<y>70</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>461</x>
|
<x>461</x>
|
||||||
@@ -233,8 +238,8 @@
|
|||||||
<slot>versionInfoChanged()</slot>
|
<slot>versionInfoChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>233</x>
|
<x>338</x>
|
||||||
<y>94</y>
|
<y>70</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>5</x>
|
<x>5</x>
|
||||||
@@ -249,8 +254,8 @@
|
|||||||
<slot>versionInfoChanged()</slot>
|
<slot>versionInfoChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>339</x>
|
<x>435</x>
|
||||||
<y>94</y>
|
<y>70</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>466</x>
|
<x>466</x>
|
||||||
@@ -258,11 +263,28 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>editDebianFileButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>MaemoPackageCreationWidget</receiver>
|
||||||
|
<slot>editDebianFile()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>293</x>
|
||||||
|
<y>94</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>8</x>
|
||||||
|
<y>86</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>addFile()</slot>
|
<slot>addFile()</slot>
|
||||||
<slot>removeFile()</slot>
|
<slot>removeFile()</slot>
|
||||||
<slot>handleSkipButtonToggled(bool)</slot>
|
<slot>handleSkipButtonToggled(bool)</slot>
|
||||||
<slot>versionInfoChanged()</slot>
|
<slot>versionInfoChanged()</slot>
|
||||||
|
<slot>editDebianFile()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -146,7 +146,10 @@ void MaemoTemplatesManager::createTemplatesIfNecessary(ProjectExplorer::Target *
|
|||||||
const QStringList &files = debianDir.entryList(QDir::Files);
|
const QStringList &files = debianDir.entryList(QDir::Files);
|
||||||
QStringList filesToAddToProject;
|
QStringList filesToAddToProject;
|
||||||
foreach (const QString &fileName, files) {
|
foreach (const QString &fileName, files) {
|
||||||
if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive)) {
|
if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive)
|
||||||
|
|| fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0
|
||||||
|
|| fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0
|
||||||
|
|| fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) {
|
||||||
debianDir.remove(fileName);
|
debianDir.remove(fileName);
|
||||||
} else
|
} else
|
||||||
filesToAddToProject << debianDir.absolutePath()
|
filesToAddToProject << debianDir.absolutePath()
|
||||||
@@ -185,8 +188,7 @@ QString MaemoTemplatesManager::version(const Project *project,
|
|||||||
QString *error) const
|
QString *error) const
|
||||||
{
|
{
|
||||||
const QString changeLogFilePath
|
const QString changeLogFilePath
|
||||||
= project->projectDirectory() + QLatin1Char('/') + PackagingDirName
|
= debianDirPath(project) + QLatin1String("/changelog");
|
||||||
+ QLatin1String("/debian/changelog");
|
|
||||||
const QString nativePath = QDir::toNativeSeparators(changeLogFilePath);
|
const QString nativePath = QDir::toNativeSeparators(changeLogFilePath);
|
||||||
QFile changeLog(changeLogFilePath);
|
QFile changeLog(changeLogFilePath);
|
||||||
if (!changeLog.exists()) {
|
if (!changeLog.exists()) {
|
||||||
@@ -218,9 +220,8 @@ QString MaemoTemplatesManager::version(const Project *project,
|
|||||||
bool MaemoTemplatesManager::setVersion(const Project *project,
|
bool MaemoTemplatesManager::setVersion(const Project *project,
|
||||||
const QString &version, QString *error) const
|
const QString &version, QString *error) const
|
||||||
{
|
{
|
||||||
const QString debianDir = project->projectDirectory() + QLatin1Char('/')
|
const QString changeLogFilePath
|
||||||
+ PackagingDirName + QLatin1String("/debian/");
|
= debianDirPath(project) + QLatin1String("/changelog");
|
||||||
const QString changeLogFilePath = debianDir + QLatin1String("changelog");
|
|
||||||
const QString nativePath = QDir::toNativeSeparators(changeLogFilePath);
|
const QString nativePath = QDir::toNativeSeparators(changeLogFilePath);
|
||||||
QFile changeLog(changeLogFilePath);
|
QFile changeLog(changeLogFilePath);
|
||||||
if (!changeLog.exists()) {
|
if (!changeLog.exists()) {
|
||||||
@@ -247,6 +248,18 @@ bool MaemoTemplatesManager::setVersion(const Project *project,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList MaemoTemplatesManager::debianFiles(const Project *project) const
|
||||||
|
{
|
||||||
|
return QDir(debianDirPath(project))
|
||||||
|
.entryList(QDir::Files, QDir::Name | QDir::IgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MaemoTemplatesManager::debianDirPath(const Project *project) const
|
||||||
|
{
|
||||||
|
return project->projectDirectory() + QLatin1Char('/')
|
||||||
|
+ PackagingDirName + QLatin1String("/debian");
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoTemplatesManager::raiseError(const QString &reason)
|
void MaemoTemplatesManager::raiseError(const QString &reason)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(0, tr("Error creating Maemo templates"), reason);
|
QMessageBox::critical(0, tr("Error creating Maemo templates"), reason);
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ public:
|
|||||||
bool setVersion(const ProjectExplorer::Project *project,
|
bool setVersion(const ProjectExplorer::Project *project,
|
||||||
const QString &version, QString *error) const;
|
const QString &version, QString *error) const;
|
||||||
|
|
||||||
|
QString debianDirPath(const ProjectExplorer::Project *project) const;
|
||||||
|
QStringList debianFiles(const ProjectExplorer::Project *project) const;
|
||||||
|
|
||||||
static const QLatin1String PackagingDirName;
|
static const QLatin1String PackagingDirName;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
Reference in New Issue
Block a user