Move model and view for deployment data into ProjectExplorer.

These classes currently live in the RemoteLinux plugin, but there is
nothing Linux-specific about them. Adapt the class and file names
accordingly.

Change-Id: If1936265cf83afaef9e14bbb0f54ede5e054e76a
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Christian Kandeler
2014-03-27 18:00:55 +01:00
parent 579f7e390b
commit 9d1124cb45
10 changed files with 64 additions and 73 deletions

View File

@@ -27,35 +27,33 @@
** **
****************************************************************************/ ****************************************************************************/
#include "remotelinuxdeploymentdatamodel.h" #include "deploymentdatamodel.h"
using namespace ProjectExplorer; namespace ProjectExplorer {
namespace RemoteLinux { DeploymentDataModel::DeploymentDataModel(QObject *parent)
RemoteLinuxDeploymentDataModel::RemoteLinuxDeploymentDataModel(QObject *parent)
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
{ {
} }
void RemoteLinuxDeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData) void DeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData)
{ {
beginResetModel(); beginResetModel();
m_deploymentData = deploymentData; m_deploymentData = deploymentData;
endResetModel(); endResetModel();
} }
int RemoteLinuxDeploymentDataModel::rowCount(const QModelIndex &parent) const int DeploymentDataModel::rowCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : m_deploymentData.fileCount(); return parent.isValid() ? 0 : m_deploymentData.fileCount();
} }
int RemoteLinuxDeploymentDataModel::columnCount(const QModelIndex &parent) const int DeploymentDataModel::columnCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : 2; return parent.isValid() ? 0 : 2;
} }
QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation orientation, QVariant DeploymentDataModel::headerData(int section, Qt::Orientation orientation,
int role) const int role) const
{ {
if (orientation == Qt::Vertical || role != Qt::DisplayRole) if (orientation == Qt::Vertical || role != Qt::DisplayRole)
@@ -63,7 +61,7 @@ QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation
return section == 0 ? tr("Local File Path") : tr("Remote Directory"); return section == 0 ? tr("Local File Path") : tr("Remote Directory");
} }
QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role) const QVariant DeploymentDataModel::data(const QModelIndex &index, int role) const
{ {
if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount()) if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount())
return QVariant(); return QVariant();
@@ -76,4 +74,4 @@ QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role
return QVariant(); return QVariant();
} }
} // namespace RemoteLinux } // namespace ProjectExplorer

View File

@@ -26,22 +26,23 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
****************************************************************************/ ****************************************************************************/
#ifndef REMOTELINUXDEPLOYMENTDATAMODEL_H #ifndef DEPLOYMENTDATAMODEL_H
#define REMOTELINUXDEPLOYMENTDATAMODEL_H #define DEPLOYMENTDATAMODEL_H
#include <projectexplorer/deploymentdata.h> #include "deploymentdata.h"
#include "projectexplorer_export.h"
#include <QAbstractTableModel> #include <QAbstractTableModel>
namespace RemoteLinux { namespace ProjectExplorer {
class RemoteLinuxDeploymentDataModel : public QAbstractTableModel class PROJECTEXPLORER_EXPORT DeploymentDataModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RemoteLinuxDeploymentDataModel(QObject *parent = 0); explicit DeploymentDataModel(QObject *parent = 0);
void setDeploymentData(const ProjectExplorer::DeploymentData &deploymentData); void setDeploymentData(const DeploymentData &deploymentData);
private: private:
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -49,9 +50,9 @@ private:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
ProjectExplorer::DeploymentData m_deploymentData; DeploymentData m_deploymentData;
}; };
} // namespace RemoteLinux } // namespace ProjectExplorer
#endif // REMOTELINUXDEPLOYMENTDATAMODEL_H #endif // Include guard

View File

@@ -26,34 +26,29 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
****************************************************************************/ ****************************************************************************/
#include "remotelinuxdeployconfigurationwidget.h" #include "deploymentdataview.h"
#include "ui_remotelinuxdeployconfigurationwidget.h" #include "ui_deploymentdataview.h"
#include "remotelinuxdeployconfiguration.h" #include "deploymentdatamodel.h"
#include "remotelinuxdeploymentdatamodel.h" #include "target.h"
#include <projectexplorer/target.h> namespace ProjectExplorer {
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal { namespace Internal {
class RemoteLinuxDeployConfigurationWidgetPrivate class DeploymentDataViewPrivate
{ {
public: public:
Ui::RemoteLinuxDeployConfigurationWidget ui; Ui::DeploymentDataView ui;
RemoteLinuxDeployConfiguration *deployConfiguration; Target *target;
RemoteLinuxDeploymentDataModel deploymentDataModel; DeploymentDataModel deploymentDataModel;
}; };
} // namespace Internal } // namespace Internal
using namespace Internal; using namespace Internal;
RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(RemoteLinuxDeployConfiguration *dc, DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) :
QWidget *parent) : NamedWidget(parent), d(new DeploymentDataViewPrivate)
NamedWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
{ {
d->ui.setupUi(this); d->ui.setupUi(this);
d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle); d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle);
@@ -61,21 +56,21 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(Remot
d->ui.deploymentDataView->setUniformRowHeights(true); d->ui.deploymentDataView->setUniformRowHeights(true);
d->ui.deploymentDataView->setModel(&d->deploymentDataModel); d->ui.deploymentDataView->setModel(&d->deploymentDataModel);
d->deployConfiguration = dc; d->target = target;
connect(dc->target(), SIGNAL(deploymentDataChanged()), SLOT(updateDeploymentDataModel())); connect(target, SIGNAL(deploymentDataChanged()), SLOT(updateDeploymentDataModel()));
updateDeploymentDataModel(); updateDeploymentDataModel();
} }
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget() DeploymentDataView::~DeploymentDataView()
{ {
delete d; delete d;
} }
void RemoteLinuxDeployConfigurationWidget::updateDeploymentDataModel() void DeploymentDataView::updateDeploymentDataModel()
{ {
d->deploymentDataModel.setDeploymentData(d->deployConfiguration->target()->deploymentData()); d->deploymentDataModel.setDeploymentData(d->target->deploymentData());
d->ui.deploymentDataView->resizeColumnToContents(0); d->ui.deploymentDataView->resizeColumnToContents(0);
} }
} // namespace RemoteLinux } // namespace ProjectExplorer

View File

@@ -26,35 +26,32 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
****************************************************************************/ ****************************************************************************/
#ifndef REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H #ifndef DEPLOYMENTDATAVIEW_H
#define REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H #define DEPLOYMENTDATAVIEW_H
#include "remotelinux_export.h" #include "namedwidget.h"
#include "projectexplorer_export.h"
#include <projectexplorer/namedwidget.h> namespace ProjectExplorer {
class Target;
namespace RemoteLinux { namespace Internal { class DeploymentDataViewPrivate; }
class RemoteLinuxDeployConfiguration;
namespace Internal { class RemoteLinuxDeployConfigurationWidgetPrivate; } class PROJECTEXPLORER_EXPORT DeploymentDataView : public NamedWidget
class REMOTELINUX_EXPORT RemoteLinuxDeployConfigurationWidget
: public ProjectExplorer::NamedWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RemoteLinuxDeployConfigurationWidget(RemoteLinux::RemoteLinuxDeployConfiguration *dc, explicit DeploymentDataView(Target *target, QWidget *parent = 0);
QWidget *parent = 0); ~DeploymentDataView();
~RemoteLinuxDeployConfigurationWidget();
private slots: private slots:
void updateDeploymentDataModel(); void updateDeploymentDataModel();
private: private:
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d; Internal::DeploymentDataViewPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace ProjectExplorer
#endif // REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H #endif // Include guard

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>RemoteLinux::Internal::RemoteLinuxDeployConfigurationWidget</class> <class>ProjectExplorer::DeploymentDataView</class>
<widget class="QWidget" name="RemoteLinux::Internal::RemoteLinuxDeployConfigurationWidget"> <widget class="QWidget" name="ProjectExplorer::DeploymentDataView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -137,6 +137,8 @@ HEADERS += projectexplorer.h \
devicesupport/desktopdeviceconfigurationwidget.h \ devicesupport/desktopdeviceconfigurationwidget.h \
devicesupport/desktopprocesssignaloperation.h \ devicesupport/desktopprocesssignaloperation.h \
deploymentdata.h \ deploymentdata.h \
deploymentdatamodel.h \
deploymentdataview.h \
buildtargetinfo.h \ buildtargetinfo.h \
customtoolchain.h \ customtoolchain.h \
projectmacroexpander.h \ projectmacroexpander.h \
@@ -268,6 +270,8 @@ SOURCES += projectexplorer.cpp \
devicesupport/desktopdeviceconfigurationwidget.cpp \ devicesupport/desktopdeviceconfigurationwidget.cpp \
devicesupport/desktopprocesssignaloperation.cpp \ devicesupport/desktopprocesssignaloperation.cpp \
deployablefile.cpp \ deployablefile.cpp \
deploymentdatamodel.cpp \
deploymentdataview.cpp \
customtoolchain.cpp \ customtoolchain.cpp \
projectmacroexpander.cpp \ projectmacroexpander.cpp \
customparser.cpp \ customparser.cpp \
@@ -282,6 +286,7 @@ FORMS += processstep.ui \
projectexplorersettingspage.ui \ projectexplorersettingspage.ui \
targetsettingswidget.ui \ targetsettingswidget.ui \
doubletabwidget.ui \ doubletabwidget.ui \
deploymentdataview.ui \
codestylesettingspropertiespage.ui \ codestylesettingspropertiespage.ui \
devicesupport/devicefactoryselectiondialog.ui \ devicesupport/devicefactoryselectiondialog.ui \
devicesupport/devicesettingswidget.ui \ devicesupport/devicesettingswidget.ui \

View File

@@ -60,6 +60,11 @@ QtcPlugin {
"deployconfiguration.cpp", "deployconfiguration.h", "deployconfiguration.cpp", "deployconfiguration.h",
"deployconfigurationmodel.cpp", "deployconfigurationmodel.h", "deployconfigurationmodel.cpp", "deployconfigurationmodel.h",
"deploymentdata.h", "deploymentdata.h",
"deploymentdataview.cpp",
"deploymentdataview.h",
"deploymentdataview.ui",
"deploymentdatamodel.cpp",
"deploymentdatamodel.h",
"doubletabwidget.cpp", "doubletabwidget.h", "doubletabwidget.ui", "doubletabwidget.cpp", "doubletabwidget.h", "doubletabwidget.ui",
"editorconfiguration.cpp", "editorconfiguration.h", "editorconfiguration.cpp", "editorconfiguration.h",
"editorsettingspropertiespage.cpp", "editorsettingspropertiespage.h", "editorsettingspropertiespage.ui", "editorsettingspropertiespage.cpp", "editorsettingspropertiespage.h", "editorsettingspropertiespage.ui",

View File

@@ -39,13 +39,11 @@ HEADERS += \
sshkeydeployer.h \ sshkeydeployer.h \
typespecificdeviceconfigurationlistmodel.h \ typespecificdeviceconfigurationlistmodel.h \
remotelinuxutils.h \ remotelinuxutils.h \
remotelinuxdeployconfigurationwidget.h \
remotelinuxcustomcommanddeployservice.h \ remotelinuxcustomcommanddeployservice.h \
remotelinuxcustomcommanddeploymentstep.h \ remotelinuxcustomcommanddeploymentstep.h \
genericlinuxdeviceconfigurationwidget.h \ genericlinuxdeviceconfigurationwidget.h \
remotelinuxcheckforfreediskspaceservice.h \ remotelinuxcheckforfreediskspaceservice.h \
remotelinuxcheckforfreediskspacestep.h \ remotelinuxcheckforfreediskspacestep.h \
remotelinuxdeploymentdatamodel.h \
remotelinuxanalyzesupport.h \ remotelinuxanalyzesupport.h \
abstractremotelinuxrunsupport.h \ abstractremotelinuxrunsupport.h \
linuxdeviceprocess.h \ linuxdeviceprocess.h \
@@ -86,13 +84,11 @@ SOURCES += \
sshkeydeployer.cpp \ sshkeydeployer.cpp \
typespecificdeviceconfigurationlistmodel.cpp \ typespecificdeviceconfigurationlistmodel.cpp \
remotelinuxutils.cpp \ remotelinuxutils.cpp \
remotelinuxdeployconfigurationwidget.cpp \
remotelinuxcustomcommanddeployservice.cpp \ remotelinuxcustomcommanddeployservice.cpp \
remotelinuxcustomcommanddeploymentstep.cpp \ remotelinuxcustomcommanddeploymentstep.cpp \
genericlinuxdeviceconfigurationwidget.cpp \ genericlinuxdeviceconfigurationwidget.cpp \
remotelinuxcheckforfreediskspaceservice.cpp \ remotelinuxcheckforfreediskspaceservice.cpp \
remotelinuxcheckforfreediskspacestep.cpp \ remotelinuxcheckforfreediskspacestep.cpp \
remotelinuxdeploymentdatamodel.cpp \
remotelinuxanalyzesupport.cpp \ remotelinuxanalyzesupport.cpp \
abstractremotelinuxrunsupport.cpp \ abstractremotelinuxrunsupport.cpp \
linuxdeviceprocess.cpp \ linuxdeviceprocess.cpp \
@@ -100,7 +96,6 @@ SOURCES += \
FORMS += \ FORMS += \
genericlinuxdeviceconfigurationwizardsetuppage.ui \ genericlinuxdeviceconfigurationwizardsetuppage.ui \
remotelinuxdeployconfigurationwidget.ui \
genericlinuxdeviceconfigurationwidget.ui \ genericlinuxdeviceconfigurationwidget.ui \
remotelinuxcheckforfreediskspacestepwidget.ui remotelinuxcheckforfreediskspacestepwidget.ui

View File

@@ -77,11 +77,6 @@ QtcPlugin {
"remotelinuxdeployconfiguration.h", "remotelinuxdeployconfiguration.h",
"remotelinuxdeployconfigurationfactory.cpp", "remotelinuxdeployconfigurationfactory.cpp",
"remotelinuxdeployconfigurationfactory.h", "remotelinuxdeployconfigurationfactory.h",
"remotelinuxdeployconfigurationwidget.cpp",
"remotelinuxdeployconfigurationwidget.h",
"remotelinuxdeployconfigurationwidget.ui",
"remotelinuxdeploymentdatamodel.cpp",
"remotelinuxdeploymentdatamodel.h",
"remotelinuxenvironmentaspect.cpp", "remotelinuxenvironmentaspect.cpp",
"remotelinuxenvironmentaspect.h", "remotelinuxenvironmentaspect.h",
"remotelinuxenvironmentaspectwidget.cpp", "remotelinuxenvironmentaspectwidget.cpp",

View File

@@ -28,7 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "remotelinuxdeployconfiguration.h" #include "remotelinuxdeployconfiguration.h"
#include "remotelinuxdeployconfigurationwidget.h" #include <projectexplorer/deploymentdataview.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -50,7 +50,7 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget() NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget()
{ {
return new RemoteLinuxDeployConfigurationWidget(this); return new DeploymentDataView(target());
} }
} // namespace RemoteLinux } // namespace RemoteLinux