Remove unused TypeSpecificDeviceConfigurationListModel class

Change-Id: I658e447d49bfd78b76c32f635f284eba859a0e94
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2020-11-25 14:24:55 +01:00
parent a10a1acd23
commit e83a6f6610
5 changed files with 0 additions and 196 deletions

View File

@@ -43,6 +43,5 @@ add_qtc_plugin(RemoteLinux
rsyncdeploystep.cpp rsyncdeploystep.h
sshkeydeployer.cpp sshkeydeployer.h
tarpackagecreationstep.cpp tarpackagecreationstep.h
typespecificdeviceconfigurationlistmodel.cpp typespecificdeviceconfigurationlistmodel.h
uploadandinstalltarpackagestep.cpp uploadandinstalltarpackagestep.h
)

View File

@@ -29,7 +29,6 @@ HEADERS += \
remotelinux_constants.h \
remotelinuxenvironmentreader.h \
sshkeydeployer.h \
typespecificdeviceconfigurationlistmodel.h \
remotelinuxcustomcommanddeployservice.h \
remotelinuxcustomcommanddeploymentstep.h \
genericlinuxdeviceconfigurationwidget.h \
@@ -70,7 +69,6 @@ SOURCES += \
linuxdevicetester.cpp \
remotelinuxenvironmentreader.cpp \
sshkeydeployer.cpp \
typespecificdeviceconfigurationlistmodel.cpp \
remotelinuxcustomcommanddeployservice.cpp \
remotelinuxcustomcommanddeploymentstep.cpp \
genericlinuxdeviceconfigurationwidget.cpp \

View File

@@ -95,8 +95,6 @@ Project {
"sshkeydeployer.h",
"tarpackagecreationstep.cpp",
"tarpackagecreationstep.h",
"typespecificdeviceconfigurationlistmodel.cpp",
"typespecificdeviceconfigurationlistmodel.h",
"uploadandinstalltarpackagestep.cpp",
"uploadandinstalltarpackagestep.h",
"images/embeddedtarget.png",

View File

@@ -1,134 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** 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
** 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.
**
** 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.
**
****************************************************************************/
#include "typespecificdeviceconfigurationlistmodel.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
TypeSpecificDeviceConfigurationListModel::TypeSpecificDeviceConfigurationListModel(Target *target)
: QAbstractListModel(target)
{
const DeviceManager * const devConfs = DeviceManager::instance();
connect(devConfs, SIGNAL(updated()), this, SIGNAL(modelReset()));
connect(target, SIGNAL(kitChanged()), this, SIGNAL(modelReset()));
}
int TypeSpecificDeviceConfigurationListModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
int count = 0;
const DeviceManager * const devConfs = DeviceManager::instance();
const int devConfsCount = devConfs->deviceCount();
for (int i = 0; i < devConfsCount; ++i) {
if (deviceMatches(devConfs->deviceAt(i)))
++count;
}
return count;
}
QVariant TypeSpecificDeviceConfigurationListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
return QVariant();
const IDevice::ConstPtr &device = deviceAt(index.row());
Q_ASSERT(device);
QString displayedName = device->displayName();
if (deviceMatches(device)
&& DeviceManager::instance()->defaultDevice(device->type()) == device) {
displayedName = tr("%1 (default)").arg(displayedName);
}
return displayedName;
}
IDevice::ConstPtr TypeSpecificDeviceConfigurationListModel::deviceAt(int idx) const
{
int currentRow = -1;
const DeviceManager * const devConfs = DeviceManager::instance();
const int devConfsCount = devConfs->deviceCount();
for (int i = 0; i < devConfsCount; ++i) {
const IDevice::ConstPtr device = devConfs->deviceAt(i);
if (deviceMatches(device) && ++currentRow == idx)
return device;
}
QTC_CHECK(false);
return IDevice::ConstPtr();
}
IDevice::ConstPtr TypeSpecificDeviceConfigurationListModel::defaultDeviceConfig() const
{
const DeviceManager * const deviceManager = DeviceManager::instance();
const int deviceCount = deviceManager->deviceCount();
for (int i = 0; i < deviceCount; ++i) {
const IDevice::ConstPtr device = deviceManager->deviceAt(i);
if (deviceMatches(device)
&& deviceManager->defaultDevice(device->type()) == device) {
return device;
}
}
return IDevice::ConstPtr();
}
IDevice::ConstPtr TypeSpecificDeviceConfigurationListModel::find(Utils::Id id) const
{
const IDevice::ConstPtr &device = DeviceManager::instance()->find(id);
if (deviceMatches(device))
return device;
return defaultDeviceConfig();
}
int TypeSpecificDeviceConfigurationListModel::indexForId(Utils::Id id) const
{
const int count = rowCount();
for (int i = 0; i < count; ++i) {
if (deviceAt(i)->id() == id)
return i;
}
return -1;
}
Target *TypeSpecificDeviceConfigurationListModel::target() const
{
return qobject_cast<Target *>(QObject::parent());
}
bool TypeSpecificDeviceConfigurationListModel::deviceMatches(IDevice::ConstPtr dev) const
{
if (dev.isNull())
return false;
Utils::Id typeId = DeviceTypeKitAspect::deviceTypeId(target()->kit());
return dev->type() == typeId;
}
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -1,57 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** 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
** 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.
**
** 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.
**
****************************************************************************/
#pragma once
#include <projectexplorer/devicesupport/idevice.h>
#include <QAbstractListModel>
namespace ProjectExplorer { class Target; }
namespace RemoteLinux {
namespace Internal {
class TypeSpecificDeviceConfigurationListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit TypeSpecificDeviceConfigurationListModel(ProjectExplorer::Target *target);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
private:
int indexForId(Utils::Id id) const;
ProjectExplorer::IDevice::ConstPtr deviceAt(int idx) const;
ProjectExplorer::IDevice::ConstPtr defaultDeviceConfig() const;
ProjectExplorer::IDevice::ConstPtr find(Utils::Id id) const;
ProjectExplorer::Target *target() const;
bool deviceMatches(ProjectExplorer::IDevice::ConstPtr dev) const;
};
} // namespace Internal
} // namespace RemoteLinux