File indexing completed on 2024-04-14 15:31:34

0001 /*
0002  *   SPDX-FileCopyrightText: 2022 Bart Ribbers <bribbers@disroot.org>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #include "device.h"
0008 
0009 #include <QDebug>
0010 
0011 Device::Device(DeviceType deviceType, QString name, QString uniqueIdentifier)
0012     : m_uniqueIdentifier(uniqueIdentifier)
0013     , m_name(name)
0014     , m_deviceType(deviceType)
0015 {
0016 }
0017 
0018 void Device::setIndex(int index)
0019 {
0020     if (m_index < 0) {
0021         m_index = index;
0022     }
0023 }
0024 
0025 QString Device::getUniqueIdentifier()
0026 {
0027     return m_uniqueIdentifier;
0028 }
0029 
0030 QString Device::getName()
0031 {
0032     return m_name;
0033 }
0034 
0035 DeviceType Device::getDeviceType()
0036 {
0037     return m_deviceType;
0038 }
0039 
0040 QString Device::iconName() const
0041 {
0042     return m_deviceType == DeviceCEC ? "" : "input-gamepad";
0043 }
0044 
0045 Device::~Device() = default;