2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-08-01 16:44:59 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-08-01 16:44:59 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-08-01 16:44:59 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-08-01 16:44:59 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-08-01 16:44:59 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2016-01-15 14:57:40 +01:00
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
#include "deploymentdataview.h"
|
|
|
|
|
#include "ui_deploymentdataview.h"
|
2011-08-01 16:44:59 +02:00
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
#include "deploymentdatamodel.h"
|
|
|
|
|
#include "target.h"
|
2011-08-01 16:44:59 +02:00
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
namespace ProjectExplorer {
|
2011-08-01 16:44:59 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
class DeploymentDataViewPrivate
|
2011-08-01 16:44:59 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2014-03-27 18:00:55 +01:00
|
|
|
Ui::DeploymentDataView ui;
|
|
|
|
|
Target *target;
|
|
|
|
|
DeploymentDataModel deploymentDataModel;
|
2011-08-01 16:44:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
DeploymentDataView::DeploymentDataView(Target *target, QWidget *parent) : NamedWidget(parent),
|
|
|
|
|
d(new DeploymentDataViewPrivate)
|
2011-08-01 16:44:59 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->ui.setupUi(this);
|
2012-08-22 16:52:38 +02:00
|
|
|
d->ui.deploymentDataView->setTextElideMode(Qt::ElideMiddle);
|
|
|
|
|
d->ui.deploymentDataView->setWordWrap(false);
|
|
|
|
|
d->ui.deploymentDataView->setUniformRowHeights(true);
|
|
|
|
|
d->ui.deploymentDataView->setModel(&d->deploymentDataModel);
|
2012-11-08 15:21:34 +01:00
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
d->target = target;
|
2012-11-08 15:21:34 +01:00
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(target, &Target::deploymentDataChanged,
|
|
|
|
|
this, &DeploymentDataView::updateDeploymentDataModel);
|
2012-11-08 15:21:34 +01:00
|
|
|
updateDeploymentDataModel();
|
2011-08-01 16:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
DeploymentDataView::~DeploymentDataView()
|
2011-08-01 16:44:59 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
delete d;
|
2011-08-01 16:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
void DeploymentDataView::updateDeploymentDataModel()
|
2011-08-01 16:44:59 +02:00
|
|
|
{
|
2014-03-27 18:00:55 +01:00
|
|
|
d->deploymentDataModel.setDeploymentData(d->target->deploymentData());
|
2014-09-02 13:06:02 +02:00
|
|
|
QHeaderView *header = d->ui.deploymentDataView->header();
|
|
|
|
|
header->setSectionResizeMode(0, QHeaderView::Interactive);
|
|
|
|
|
header->setSectionResizeMode(1, QHeaderView::Interactive);
|
2012-08-22 16:52:38 +02:00
|
|
|
d->ui.deploymentDataView->resizeColumnToContents(0);
|
2014-09-02 13:06:02 +02:00
|
|
|
d->ui.deploymentDataView->resizeColumnToContents(1);
|
|
|
|
|
if (header->sectionSize(0) + header->sectionSize(1)
|
|
|
|
|
< d->ui.deploymentDataView->header()->width()) {
|
|
|
|
|
d->ui.deploymentDataView->header()->setSectionResizeMode(1, QHeaderView::Stretch);
|
|
|
|
|
}
|
2011-08-01 16:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-27 18:00:55 +01:00
|
|
|
} // namespace ProjectExplorer
|