Commit 50f30655 authored by ck's avatar ck
Browse files

Maemo: Watch Debian files and update packaging GUI accordingly.

Reviewed-by: kh1
parent fc48f53b
......@@ -74,6 +74,40 @@ void MaemoPackageCreationWidget::init()
void MaemoPackageCreationWidget::initGui()
{
const ProjectExplorer::Project * const project
= m_step->buildConfiguration()->target()->project();
updateDebianFileList(project);
updateVersionInfo(project);
connect(m_step, SIGNAL(packageFilePathChanged()), this,
SIGNAL(updateSummary()));
versionInfoChanged();
connect(MaemoTemplatesManager::instance(),
SIGNAL(debianDirContentsChanged(const ProjectExplorer::Project*)),
this, SLOT(updateDebianFileList(const ProjectExplorer::Project*)));
connect(MaemoTemplatesManager::instance(),
SIGNAL(changeLogChanged(const ProjectExplorer::Project*)), this,
SLOT(updateVersionInfo(const ProjectExplorer::Project*)));
}
void MaemoPackageCreationWidget::updateDebianFileList(const ProjectExplorer::Project *project)
{
const ProjectExplorer::Project * const ourProject
= m_step->buildConfiguration()->target()->project();
if (ourProject == project)
m_ui->debianFilesComboBox->clear();
const QStringList &debianFiles = MaemoTemplatesManager::instance()
->debianFiles(project);
foreach (const QString &fileName, debianFiles) {
if (fileName != QLatin1String("compat"))
m_ui->debianFilesComboBox->addItem(fileName);
}
}
void MaemoPackageCreationWidget::updateVersionInfo(const ProjectExplorer::Project *project)
{
if (project != m_step->buildConfiguration()->target()->project())
return;
QString error;
QString versionString = m_step->versionString(&error);
if (versionString.isEmpty()) {
......@@ -85,16 +119,6 @@ void MaemoPackageCreationWidget::initGui()
m_ui->major->setValue(list.value(0, QLatin1String("0")).toInt());
m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt());
m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt());
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
......
......@@ -68,6 +68,8 @@ private slots:
void editDebianFile();
void versionInfoChanged();
void initGui();
void updateDebianFileList(const ProjectExplorer::Project *project);
void updateVersionInfo(const ProjectExplorer::Project *project);
private:
MaemoPackageCreationStep * const m_step;
......
......@@ -34,6 +34,8 @@
#include "maemorunconfigurationwidget.h"
#include "maemodeployables.h"
#include "maemodeploystep.h"
#include "maemodeviceconfiglistmodel.h"
#include "maemodeviceenvreader.h"
#include "maemomanager.h"
......@@ -104,8 +106,12 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
devConfLayout->addWidget(debuggerConfLabel);
formLayout->addRow(new QLabel(tr("Device configuration:")), devConfWidget);
m_executableLabel = new QLabel(m_runConfiguration->localExecutableFilePath());
formLayout->addRow(tr("Executable:"), m_executableLabel);
m_localExecutableLabel
= new QLabel(m_runConfiguration->localExecutableFilePath());
formLayout->addRow(tr("Executable on host:"), m_localExecutableLabel);
m_remoteExecutableLabel
= new QLabel(m_runConfiguration->remoteExecutableFilePath());
formLayout->addRow(tr("Executable on device:"), m_remoteExecutableLabel);
m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
formLayout->addRow(tr("Arguments:"), m_argsLineEdit);
......@@ -123,6 +129,8 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
this, SLOT(handleCurrentDeviceConfigChanged()));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(m_runConfiguration->deployStep()->deployables(),
SIGNAL(modelsCreated()), this, SLOT(updateTargetInformation()));
handleCurrentDeviceConfigChanged();
}
......@@ -248,7 +256,8 @@ void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
void MaemoRunConfigurationWidget::updateTargetInformation()
{
m_executableLabel->setText(m_runConfiguration->localExecutableFilePath());
m_localExecutableLabel->setText(m_runConfiguration->localExecutableFilePath());
m_remoteExecutableLabel->setText(m_runConfiguration->remoteExecutableFilePath());
}
void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
......
......@@ -97,7 +97,8 @@ private:
QLineEdit *m_configNameLineEdit;
QLineEdit *m_argsLineEdit;
QLabel *m_executableLabel;
QLabel *m_localExecutableLabel;
QLabel *m_remoteExecutableLabel;
QComboBox *m_devConfBox;
QTableView *m_mountView;
QToolButton *m_removeMountButton;
......
......@@ -43,6 +43,7 @@
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileSystemWatcher>
#include <QtCore/QList>
#include <QtCore/QProcess>
#include <QtGui/QMessageBox>
......@@ -65,7 +66,7 @@ MaemoTemplatesManager *MaemoTemplatesManager::instance(QObject *parent)
}
MaemoTemplatesManager::MaemoTemplatesManager(QObject *parent) :
QObject(parent), m_activeProject(0)
QObject(parent), m_activeProject(0), m_fsWatcher(0)
{
SessionManager * const session
= ProjectExplorerPlugin::instance()->session();
......@@ -78,6 +79,8 @@ void MaemoTemplatesManager::handleActiveProjectChanged(ProjectExplorer::Project
{
if (m_activeProject)
disconnect(m_activeProject, 0, this, 0);
delete m_fsWatcher;
m_fsWatcher = 0;
m_activeProject= project;
if (m_activeProject) {
connect(m_activeProject, SIGNAL(addedTarget(ProjectExplorer::Target*)),
......@@ -88,6 +91,17 @@ void MaemoTemplatesManager::handleActiveProjectChanged(ProjectExplorer::Project
const QList<Target *> &targets = m_activeProject->targets();
foreach (Target * const target, targets)
createTemplatesIfNecessary(target);
m_fsWatcher = new QFileSystemWatcher(this);
const QString &debianPath = debianDirPath(m_activeProject);
const QString changeLogPath = debianPath + QLatin1String("/changelog");
m_fsWatcher->addPath(debianPath);
m_fsWatcher->addPath(changeLogPath);
connect(m_fsWatcher, SIGNAL(directoryChanged(QString)), this,
SLOT(handleDebianDirContentsChanged()));
connect(m_fsWatcher, SIGNAL(fileChanged(QString)), this,
SLOT(handleChangeLogChanged()));
handleDebianDirContentsChanged();
handleChangeLogChanged();
}
}
......@@ -265,5 +279,15 @@ void MaemoTemplatesManager::raiseError(const QString &reason)
QMessageBox::critical(0, tr("Error creating Maemo templates"), reason);
}
void MaemoTemplatesManager::handleChangeLogChanged()
{
emit changeLogChanged(m_activeProject);
}
void MaemoTemplatesManager::handleDebianDirContentsChanged()
{
emit debianDirContentsChanged(m_activeProject);
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -32,6 +32,8 @@
#include <QtCore/QObject>
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher);
namespace ProjectExplorer {
class Project;
class Target;
......@@ -57,9 +59,15 @@ public:
static const QLatin1String PackagingDirName;
signals:
void debianDirContentsChanged(const ProjectExplorer::Project *project);
void changeLogChanged(const ProjectExplorer::Project *project);
private slots:
void handleActiveProjectChanged(ProjectExplorer::Project *project);
void createTemplatesIfNecessary(ProjectExplorer::Target *target);
void handleDebianDirContentsChanged();
void handleChangeLogChanged();
private:
explicit MaemoTemplatesManager(QObject *parent);
......@@ -67,6 +75,7 @@ private:
static MaemoTemplatesManager *m_instance;
ProjectExplorer::Project *m_activeProject;
QFileSystemWatcher *m_fsWatcher;
};
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment