forked from qt-creator/qt-creator
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:
@@ -27,35 +27,33 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "remotelinuxdeploymentdatamodel.h"
|
||||
#include "deploymentdatamodel.h"
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace RemoteLinux {
|
||||
|
||||
RemoteLinuxDeploymentDataModel::RemoteLinuxDeploymentDataModel(QObject *parent)
|
||||
DeploymentDataModel::DeploymentDataModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void RemoteLinuxDeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData)
|
||||
void DeploymentDataModel::setDeploymentData(const DeploymentData &deploymentData)
|
||||
{
|
||||
beginResetModel();
|
||||
m_deploymentData = deploymentData;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
int RemoteLinuxDeploymentDataModel::rowCount(const QModelIndex &parent) const
|
||||
int DeploymentDataModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
QVariant RemoteLinuxDeploymentDataModel::headerData(int section, Qt::Orientation orientation,
|
||||
QVariant DeploymentDataModel::headerData(int section, Qt::Orientation orientation,
|
||||
int role) const
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
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())
|
||||
return QVariant();
|
||||
@@ -76,4 +74,4 @@ QVariant RemoteLinuxDeploymentDataModel::data(const QModelIndex &index, int role
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
} // namespace ProjectExplorer
|
||||
@@ -26,22 +26,23 @@
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef REMOTELINUXDEPLOYMENTDATAMODEL_H
|
||||
#define REMOTELINUXDEPLOYMENTDATAMODEL_H
|
||||
#ifndef DEPLOYMENTDATAMODEL_H
|
||||
#define DEPLOYMENTDATAMODEL_H
|
||||
|
||||
#include <projectexplorer/deploymentdata.h>
|
||||
#include "deploymentdata.h"
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class RemoteLinuxDeploymentDataModel : public QAbstractTableModel
|
||||
class PROJECTEXPLORER_EXPORT DeploymentDataModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RemoteLinuxDeploymentDataModel(QObject *parent = 0);
|
||||
explicit DeploymentDataModel(QObject *parent = 0);
|
||||
|
||||
void setDeploymentData(const ProjectExplorer::DeploymentData &deploymentData);
|
||||
void setDeploymentData(const DeploymentData &deploymentData);
|
||||
|
||||
private:
|
||||
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 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
|
||||
@@ -26,34 +26,29 @@
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "remotelinuxdeployconfigurationwidget.h"
|
||||
#include "ui_remotelinuxdeployconfigurationwidget.h"
|
||||
#include "deploymentdataview.h"
|
||||
#include "ui_deploymentdataview.h"
|
||||
|
||||
#include "remotelinuxdeployconfiguration.h"
|
||||
#include "remotelinuxdeploymentdatamodel.h"
|
||||
#include "deploymentdatamodel.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class RemoteLinuxDeployConfigurationWidgetPrivate
|
||||
class DeploymentDataViewPrivate
|
||||
{
|
||||
public:
|
||||
Ui::RemoteLinuxDeployConfigurationWidget ui;
|
||||
RemoteLinuxDeployConfiguration *deployConfiguration;
|
||||
RemoteLinuxDeploymentDataModel deploymentDataModel;
|
||||
Ui::DeploymentDataView ui;
|
||||
Target *target;
|
||||
DeploymentDataModel deploymentDataModel;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(RemoteLinuxDeployConfiguration *dc,
|
||||
QWidget *parent) :
|
||||
NamedWidget(parent), d(new RemoteLinuxDeployConfigurationWidgetPrivate)
|
||||
DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) :
|
||||
NamedWidget(parent), d(new DeploymentDataViewPrivate)
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle);
|
||||
@@ -61,21 +56,21 @@ RemoteLinuxDeployConfigurationWidget::RemoteLinuxDeployConfigurationWidget(Remot
|
||||
d->ui.deploymentDataView->setUniformRowHeights(true);
|
||||
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();
|
||||
}
|
||||
|
||||
RemoteLinuxDeployConfigurationWidget::~RemoteLinuxDeployConfigurationWidget()
|
||||
DeploymentDataView::~DeploymentDataView()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
} // namespace ProjectExplorer
|
||||
@@ -26,35 +26,32 @@
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H
|
||||
#define REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H
|
||||
#ifndef DEPLOYMENTDATAVIEW_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 {
|
||||
class RemoteLinuxDeployConfiguration;
|
||||
namespace Internal { class DeploymentDataViewPrivate; }
|
||||
|
||||
namespace Internal { class RemoteLinuxDeployConfigurationWidgetPrivate; }
|
||||
|
||||
class REMOTELINUX_EXPORT RemoteLinuxDeployConfigurationWidget
|
||||
: public ProjectExplorer::NamedWidget
|
||||
class PROJECTEXPLORER_EXPORT DeploymentDataView : public NamedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RemoteLinuxDeployConfigurationWidget(RemoteLinux::RemoteLinuxDeployConfiguration *dc,
|
||||
QWidget *parent = 0);
|
||||
~RemoteLinuxDeployConfigurationWidget();
|
||||
explicit DeploymentDataView(Target *target, QWidget *parent = 0);
|
||||
~DeploymentDataView();
|
||||
|
||||
private slots:
|
||||
void updateDeploymentDataModel();
|
||||
|
||||
private:
|
||||
Internal::RemoteLinuxDeployConfigurationWidgetPrivate * const d;
|
||||
Internal::DeploymentDataViewPrivate * const d;
|
||||
};
|
||||
|
||||
} // namespace RemoteLinux
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // REMOTELINUXDEPLOYCONFIGURATIONWIDGET_H
|
||||
#endif // Include guard
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RemoteLinux::Internal::RemoteLinuxDeployConfigurationWidget</class>
|
||||
<widget class="QWidget" name="RemoteLinux::Internal::RemoteLinuxDeployConfigurationWidget">
|
||||
<class>ProjectExplorer::DeploymentDataView</class>
|
||||
<widget class="QWidget" name="ProjectExplorer::DeploymentDataView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -137,6 +137,8 @@ HEADERS += projectexplorer.h \
|
||||
devicesupport/desktopdeviceconfigurationwidget.h \
|
||||
devicesupport/desktopprocesssignaloperation.h \
|
||||
deploymentdata.h \
|
||||
deploymentdatamodel.h \
|
||||
deploymentdataview.h \
|
||||
buildtargetinfo.h \
|
||||
customtoolchain.h \
|
||||
projectmacroexpander.h \
|
||||
@@ -268,6 +270,8 @@ SOURCES += projectexplorer.cpp \
|
||||
devicesupport/desktopdeviceconfigurationwidget.cpp \
|
||||
devicesupport/desktopprocesssignaloperation.cpp \
|
||||
deployablefile.cpp \
|
||||
deploymentdatamodel.cpp \
|
||||
deploymentdataview.cpp \
|
||||
customtoolchain.cpp \
|
||||
projectmacroexpander.cpp \
|
||||
customparser.cpp \
|
||||
@@ -282,6 +286,7 @@ FORMS += processstep.ui \
|
||||
projectexplorersettingspage.ui \
|
||||
targetsettingswidget.ui \
|
||||
doubletabwidget.ui \
|
||||
deploymentdataview.ui \
|
||||
codestylesettingspropertiespage.ui \
|
||||
devicesupport/devicefactoryselectiondialog.ui \
|
||||
devicesupport/devicesettingswidget.ui \
|
||||
|
||||
@@ -60,6 +60,11 @@ QtcPlugin {
|
||||
"deployconfiguration.cpp", "deployconfiguration.h",
|
||||
"deployconfigurationmodel.cpp", "deployconfigurationmodel.h",
|
||||
"deploymentdata.h",
|
||||
"deploymentdataview.cpp",
|
||||
"deploymentdataview.h",
|
||||
"deploymentdataview.ui",
|
||||
"deploymentdatamodel.cpp",
|
||||
"deploymentdatamodel.h",
|
||||
"doubletabwidget.cpp", "doubletabwidget.h", "doubletabwidget.ui",
|
||||
"editorconfiguration.cpp", "editorconfiguration.h",
|
||||
"editorsettingspropertiespage.cpp", "editorsettingspropertiespage.h", "editorsettingspropertiespage.ui",
|
||||
|
||||
@@ -39,13 +39,11 @@ HEADERS += \
|
||||
sshkeydeployer.h \
|
||||
typespecificdeviceconfigurationlistmodel.h \
|
||||
remotelinuxutils.h \
|
||||
remotelinuxdeployconfigurationwidget.h \
|
||||
remotelinuxcustomcommanddeployservice.h \
|
||||
remotelinuxcustomcommanddeploymentstep.h \
|
||||
genericlinuxdeviceconfigurationwidget.h \
|
||||
remotelinuxcheckforfreediskspaceservice.h \
|
||||
remotelinuxcheckforfreediskspacestep.h \
|
||||
remotelinuxdeploymentdatamodel.h \
|
||||
remotelinuxanalyzesupport.h \
|
||||
abstractremotelinuxrunsupport.h \
|
||||
linuxdeviceprocess.h \
|
||||
@@ -86,13 +84,11 @@ SOURCES += \
|
||||
sshkeydeployer.cpp \
|
||||
typespecificdeviceconfigurationlistmodel.cpp \
|
||||
remotelinuxutils.cpp \
|
||||
remotelinuxdeployconfigurationwidget.cpp \
|
||||
remotelinuxcustomcommanddeployservice.cpp \
|
||||
remotelinuxcustomcommanddeploymentstep.cpp \
|
||||
genericlinuxdeviceconfigurationwidget.cpp \
|
||||
remotelinuxcheckforfreediskspaceservice.cpp \
|
||||
remotelinuxcheckforfreediskspacestep.cpp \
|
||||
remotelinuxdeploymentdatamodel.cpp \
|
||||
remotelinuxanalyzesupport.cpp \
|
||||
abstractremotelinuxrunsupport.cpp \
|
||||
linuxdeviceprocess.cpp \
|
||||
@@ -100,7 +96,6 @@ SOURCES += \
|
||||
|
||||
FORMS += \
|
||||
genericlinuxdeviceconfigurationwizardsetuppage.ui \
|
||||
remotelinuxdeployconfigurationwidget.ui \
|
||||
genericlinuxdeviceconfigurationwidget.ui \
|
||||
remotelinuxcheckforfreediskspacestepwidget.ui
|
||||
|
||||
|
||||
@@ -77,11 +77,6 @@ QtcPlugin {
|
||||
"remotelinuxdeployconfiguration.h",
|
||||
"remotelinuxdeployconfigurationfactory.cpp",
|
||||
"remotelinuxdeployconfigurationfactory.h",
|
||||
"remotelinuxdeployconfigurationwidget.cpp",
|
||||
"remotelinuxdeployconfigurationwidget.h",
|
||||
"remotelinuxdeployconfigurationwidget.ui",
|
||||
"remotelinuxdeploymentdatamodel.cpp",
|
||||
"remotelinuxdeploymentdatamodel.h",
|
||||
"remotelinuxenvironmentaspect.cpp",
|
||||
"remotelinuxenvironmentaspect.h",
|
||||
"remotelinuxenvironmentaspectwidget.cpp",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
****************************************************************************/
|
||||
#include "remotelinuxdeployconfiguration.h"
|
||||
|
||||
#include "remotelinuxdeployconfigurationwidget.h"
|
||||
#include <projectexplorer/deploymentdataview.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -50,7 +50,7 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
|
||||
|
||||
NamedWidget *RemoteLinuxDeployConfiguration::createConfigWidget()
|
||||
{
|
||||
return new RemoteLinuxDeployConfigurationWidget(this);
|
||||
return new DeploymentDataView(target());
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
Reference in New Issue
Block a user