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:
ck
2010-08-04 12:22:48 +02:00
parent 597ceed2c4
commit 28247894bd
5 changed files with 114 additions and 56 deletions

View File

@@ -43,11 +43,13 @@
#include "ui_maemopackagecreationwidget.h"
#include "maemopackagecreationstep.h"
#include "maemotemplatesmanager.h"
#include <utils/qtcassert.h>
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <utils/qtcassert.h>
#include <QtCore/QTimer>
#include <QtGui/QMessageBox>
@@ -63,14 +65,14 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
m_ui->setupUi(this);
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QTimer::singleShot(0, this, SLOT(initVersion()));
QTimer::singleShot(0, this, SLOT(initGui()));
}
void MaemoPackageCreationWidget::init()
{
}
void MaemoPackageCreationWidget::initVersion()
void MaemoPackageCreationWidget::initGui()
{
QString error;
QString versionString = m_step->versionString(&error);
@@ -86,6 +88,13 @@ void MaemoPackageCreationWidget::initVersion()
connect(m_step, SIGNAL(packageFilePathChanged()), this,
SIGNAL(updateSummary()));
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
@@ -103,6 +112,8 @@ void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked)
m_ui->major->setEnabled(!checked);
m_ui->minor->setEnabled(!checked);
m_ui->patch->setEnabled(!checked);
m_ui->debianFilesComboBox->setEnabled(!checked);
m_ui->editDebianFileButton->setEnabled(!checked);
m_step->setPackagingEnabled(!checked);
}
@@ -116,5 +127,13 @@ void MaemoPackageCreationWidget::versionInfoChanged()
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 Qt4ProjectManager