From 50f30655e234402d0bb113c5f0372d038518480b Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Wed, 4 Aug 2010 16:38:37 +0200 Subject: [PATCH] Maemo: Watch Debian files and update packaging GUI accordingly. Reviewed-by: kh1 --- .../qt-maemo/maemopackagecreationwidget.cpp | 44 ++++++++++++++----- .../qt-maemo/maemopackagecreationwidget.h | 2 + .../qt-maemo/maemorunconfigurationwidget.cpp | 15 +++++-- .../qt-maemo/maemorunconfigurationwidget.h | 3 +- .../qt-maemo/maemotemplatesmanager.cpp | 26 ++++++++++- .../qt-maemo/maemotemplatesmanager.h | 9 ++++ 6 files changed, 84 insertions(+), 15 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp index 801855f59ad..87a6446132e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp @@ -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 diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h index 1bbc429333c..cbdd3db260f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h @@ -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; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp index 2a632bfc417..b9ce46e288b 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp @@ -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) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h index 8026cb2084e..b2b8619a4a0 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h @@ -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; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp index b171ba2a6f0..410b62d4e02 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp @@ -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 diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.h index 857ecbfdda3..ffc356c9378 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.h @@ -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 -- GitLab