Added animation for swipe sensor.
[KFingerManager.git] / src / FingerManagerDevicesModel.cpp
blob0151a5ec1b7ec73f1b19862e26ec531d6d4d18d0
1 #include "FingerManagerDevicesModel.h"
3 FingerManagerDevicesModel::FingerManagerDevicesModel(QObject *parent) :
4 QAbstractListModel(parent) {
7 FingerManagerDevicesModel::~FingerManagerDevicesModel() {
8 devices.clear();
11 void FingerManagerDevicesModel::setDefault(QString dev) {
12 for (int i = 0; i < devices.size(); i++) {
13 if (devices.at(i).device == dev) {
14 default_ = i;
15 return;
20 int FingerManagerDevicesModel::getDefault() {
21 return(default_);
24 void FingerManagerDevicesModel::addDevice(QString device, QString name) {
25 DeviceModel d;
26 d.name = name;
27 d.device = device;
28 devices.push_back(d);
31 int FingerManagerDevicesModel::rowCount(const QModelIndex& parent) const {
32 Q_UNUSED(parent);
33 return(devices.size());
36 QVariant FingerManagerDevicesModel::data(const QModelIndex& index, int role) const {
37 QVariant result;
38 if (role == Qt::DisplayRole) {
39 result = devices.at(index.row()).name;
41 return(result);
44 QString FingerManagerDevicesModel::getDeviceName(int row) {
45 return(devices.at(row).name);
48 QString FingerManagerDevicesModel::getDevicePath(int row) {
49 return(devices.at(row).device);
52 DeviceModel FingerManagerDevicesModel::getDeviceModel(int row) {
53 return(devices.at(row));