diff options
author | Christian Kandeler <[email protected]> | 2012-08-22 16:52:38 +0200 |
---|---|---|
committer | Christian Kandeler <[email protected]> | 2012-08-24 15:44:03 +0200 |
commit | c7ebfd47a49c8cc2cfb8cb34ada73e32a8611bb0 (patch) | |
tree | 6045564559d9cb0a485016997616bd1a1ba14e0f /src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp | |
parent | b80205c592cd3ecc768baba246b5e8df9a34c995 (diff) |
RemoteLinux: Remove dependency on Qt4ProjectManager.
Instead use the newly added abstractions from ProjectExplorer.
This makes the plugin qmake-independent in principle; any build system
can be used as long as the respective QtCreator plugin provides a way to
set up the required deployment information.
As a side effect of this patch, two features are lost:
(1) The ability to add a remote directory automatically for a
RemoteLinux based target. This was rarely ever useful, because any non-
trivial project requires more files to be deployed than just one binary.
(2) The ability to add Desktop files and icons for Fremantle and
Harmattan projects. Similar points as above apply here as well; such
projects should be set up via QtCreator's wizards or manually by users
who know what they are doing.
Change-Id: I2d7e621256f01143aafe3b191b04a120f053e672
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp')
-rw-r--r-- | src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp | 116 |
1 files changed, 14 insertions, 102 deletions
diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp index f7afcc2cb46..d5c951c529d 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp @@ -29,51 +29,24 @@ #include "remotelinuxdeployconfigurationwidget.h" #include "ui_remotelinuxdeployconfigurationwidget.h" -#include "deployablefilesperprofile.h" -#include "deploymentinfo.h" #include "remotelinuxdeployconfiguration.h" -#include "typespecificdeviceconfigurationlistmodel.h" +#include "remotelinuxdeploymentdatamodel.h" -#include <coreplugin/editormanager/editormanager.h> -#include <coreplugin/icore.h> -#include <coreplugin/id.h> -#include <projectexplorer/devicesupport/devicemanager.h> -#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> -#include <QTreeView> - using namespace ProjectExplorer; namespace RemoteLinux { namespace Internal { -namespace { -class MyTreeView : public QTreeView -{ - Q_OBJECT -public: - MyTreeView(QWidget *parent = 0) : QTreeView(parent) {} - -signals: - void doubleClicked(); - -private: - void mouseDoubleClickEvent(QMouseEvent *event) - { - emit doubleClicked(); - QTreeView::mouseDoubleClickEvent(event); - } -}; - -} // anonymous namespace class RemoteLinuxDeployConfigurationWidgetPrivate { public: Ui::RemoteLinuxDeployConfigurationWidget ui; - MyTreeView treeView; RemoteLinuxDeployConfiguration *deployConfiguration; + RemoteLinuxDeploymentDataModel deploymentDataModel; }; } // namespace Internal @@ -84,10 +57,10 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(QWidg DeployConfigurationWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate) { d->ui.setupUi(this); - d->treeView.setTextElideMode(Qt::ElideMiddle); - d->treeView.setWordWrap(false); - d->treeView.setUniformRowHeights(true); - layout()->addWidget(&d->treeView); + d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle); + d->ui.deploymentDataView->setWordWrap(false); + d->ui.deploymentDataView->setUniformRowHeights(true); + d->ui.deploymentDataView->setModel(&d->deploymentDataModel); } RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() @@ -98,78 +71,17 @@ RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() void RemoteLinuxDeployConfigurationWidget::init(DeployConfiguration *dc) { d->deployConfiguration = qobject_cast<RemoteLinuxDeployConfiguration *>(dc); - Q_ASSERT(d->deployConfiguration); + QTC_ASSERT(d->deployConfiguration, return); - connect(&d->treeView, SIGNAL(doubleClicked()), SLOT(openProjectFile())); - - d->ui.projectsComboBox->setModel(d->deployConfiguration->deploymentInfo()); - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelAboutToBeReset()), - SLOT(handleModelListToBeReset())); - - // Queued connection because of race condition with combo box's reaction - // to modelReset(). - connect(d->deployConfiguration->deploymentInfo(), SIGNAL(modelReset()), - SLOT(handleModelListReset()), Qt::QueuedConnection); - - connect(d->ui.projectsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(setModel(int))); - handleModelListReset(); + connect(dc->target()->project(), SIGNAL(buildSystemEvaluated()), + SLOT(updateDeploymentDataModel())); + updateDeploymentDataModel(); } -RemoteLinuxDeployConfiguration *RemoteLinuxDeployConfigurationWidget::deployConfiguration() const +void RemoteLinuxDeployConfigurationWidget::updateDeploymentDataModel() { - return d->deployConfiguration; -} - -DeployableFilesPerProFile *RemoteLinuxDeployConfigurationWidget::currentModel() const -{ - const int modelRow = d->ui.projectsComboBox->currentIndex(); - if (modelRow == -1) - return 0; - return d->deployConfiguration->deploymentInfo()->modelAt(modelRow); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListToBeReset() -{ - d->treeView.setModel(0); -} - -void RemoteLinuxDeployConfigurationWidget::handleModelListReset() -{ - QTC_ASSERT(d->deployConfiguration->deploymentInfo()->modelCount() - == d->ui.projectsComboBox->count(), return); - - if (d->deployConfiguration->deploymentInfo()->modelCount() > 0) { - d->treeView.setToolTip(tr("Double-click to edit the project file")); - if (d->ui.projectsComboBox->currentIndex() == -1) - d->ui.projectsComboBox->setCurrentIndex(0); - else - setModel(d->ui.projectsComboBox->currentIndex()); - } else { - d->treeView.setToolTip(QString()); - } -} - -void RemoteLinuxDeployConfigurationWidget::setModel(int row) -{ - DeployableFilesPerProFile * const proFileInfo = row == -1 - ? 0 : d->deployConfiguration->deploymentInfo()->modelAt(row); - d->treeView.setModel(proFileInfo); - if (proFileInfo) - d->treeView.resizeColumnToContents(0); - emit currentModelChanged(proFileInfo); -} - -void RemoteLinuxDeployConfigurationWidget::openProjectFile() -{ - const int row = d->ui.projectsComboBox->currentIndex(); - if (row == -1) - return; - const DeployableFilesPerProFile * const proFileInfo = - d->deployConfiguration->deploymentInfo()->modelAt(row); - Core::EditorManager::openEditor(proFileInfo->proFilePath(), Core::Id(), - Core::EditorManager::ModeSwitch); + d->deploymentDataModel.setDeploymentData(d->deployConfiguration->target()->deploymentData()); + d->ui.deploymentDataView->resizeColumnToContents(0); } } // namespace RemoteLinux - -#include "remotelinuxdeployconfigurationwidget.moc" |