diff --git a/autotests/kded/tabletbackendmock.cpp b/autotests/kded/tabletbackendmock.cpp
index 9be673f..a76279c 100644
--- a/autotests/kded/tabletbackendmock.cpp
+++ b/autotests/kded/tabletbackendmock.cpp
@@ -1,109 +1,113 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "tabletbackendmock.h"
using namespace Wacom;
TabletBackendMock::TabletBackendMock()
{
m_propertyAdaptor = nullptr;
}
TabletBackendMock::~TabletBackendMock()
{
if (m_propertyAdaptor) {
delete m_propertyAdaptor;
}
QMap< QString,PropertyAdaptorMock* >::iterator it = m_properties.begin();
while (it != m_properties.end()) {
delete it.value();
it = m_properties.erase(it);
}
}
void TabletBackendMock::addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor)
{
if (m_propertyAdaptor) {
delete m_propertyAdaptor;
}
m_propertyAdaptor = adaptor;
m_propertyAdaptorType = deviceType.key();
}
const TabletInformation& TabletBackendMock::getInformation() const
{
return m_tabletInformation;
}
const QString TabletBackendMock::getProperty(const DeviceType& type, const Property& property) const
{
QMap< QString,PropertyAdaptorMock* >::const_iterator it = m_properties.find(type.key());
if (it == m_properties.end()) {
return QString();
}
return it.value()->getProperty(property);
}
void TabletBackendMock::setProfile(const TabletProfile& profile)
{
m_tabletProfile = profile;
}
void TabletBackendMock::setProfile(const DeviceType& deviceType, const DeviceProfile& profile)
{
m_deviceProfile = profile;
m_deviceProfileType = deviceType.key();
}
void TabletBackendMock::setStatusLED(int led) {
// doing nothing right now
Q_UNUSED(led)
}
+void TabletBackendMock::setStatusLEDBrightness(int brightness) {
+ // doing nothing right now
+ Q_UNUSED(brightness)
+}
bool TabletBackendMock::setProperty(const DeviceType& type, const Property& property, const QString& value)
{
QMap< QString,PropertyAdaptorMock* >::iterator it = m_properties.find(type.key());
if (it == m_properties.end()) {
m_properties.insert(type.key(), new PropertyAdaptorMock());
it = m_properties.find(type.key());
}
return it.value()->setProperty(property, value);
}
diff --git a/autotests/kded/tabletbackendmock.h b/autotests/kded/tabletbackendmock.h
index 5840feb..0d1843d 100644
--- a/autotests/kded/tabletbackendmock.h
+++ b/autotests/kded/tabletbackendmock.h
@@ -1,69 +1,71 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef TABLETBACKENDMOCK_H
#define TABLETBACKENDMOCK_H
#include "tabletbackendinterface.h"
#include "deviceproperty.h"
#include "propertyadaptormock.h"
#include
#include
namespace Wacom
{
class TabletBackendMock : public TabletBackendInterface
{
public:
TabletBackendMock();
virtual ~TabletBackendMock();
void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor);
const TabletInformation& getInformation() const;
const QString getProperty(const DeviceType& type, const Property& property) const;
void setProfile(const TabletProfile& profile);
void setProfile(const DeviceType& deviceType, const DeviceProfile& profile);
void setStatusLED(int led);
+ void setStatusLEDBrightness(int brightness);
+
bool setProperty(const DeviceType& type, const Property& property, const QString& value);
QString m_propertyAdaptorType; //!< The device type of the property adaptor.
PropertyAdaptor* m_propertyAdaptor; //!< The property adaptor which was set by addAdaptor()
TabletInformation m_tabletInformation; //!< The information returned by getInformation()
TabletProfile m_tabletProfile; //!< The last tablet profile which was set.
DeviceProfile m_deviceProfile; //!< The last device profile which was set.
QString m_deviceProfileType; //!< The last device profile type which was set.
QMap* > m_properties; //!< Properties which were set.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/data/wacom_devicelist b/data/wacom_devicelist
index ef5f8da..24adbde 100644
--- a/data/wacom_devicelist
+++ b/data/wacom_devicelist
@@ -1,1603 +1,1604 @@
[default]
model=unknown
layout=unknown
name=unknown device
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0000]
model=MODEL_PP_0405
layout=unknown
name=Wacom PenPartner
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0003]
model=PTU-600
layout=bl_3
name=Wacom Cintiq Partner
padbuttons=10
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
hwbutton10=14
[0010]
model=ET_0405
layout=unknown
name=Wacom Graphire
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0011]
model=ET_0405
layout=unknown
name=Wacom Graphire2 4x5
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0012]
model=ET_0507
layout=unknown
name=Wacom Graphire2 5x7
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0013]
model=ET_0405
layout=unknown
name=Wacom Graphire3 4x5
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0014]
model=ET_0608
layout=unknown
name=Wacom Graphire3 6x8
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0015]
model=CTE_440
layout=bl_10
name=Wacom Graphire4 4x5
padbuttons=2
wheel=yes
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
[0016]
model=CTE_640
layout=bl_10
name=Wacom Graphire4 6x8
padbuttons=2
wheel=yes
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
[0017]
model=CTE_450
layout=bl_5
name=Wacom BambooFun 4x5
padbuttons=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[0018]
model=CTE_650
layout=bl_5
name=Wacom BambooFun 6x8
padbuttons=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[0019]
model=CTE_631
layout=bl_6
name=Wacom Bamboo1 Medium
padbuttons=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[0020]
model=GD_0405-U
layout=bl_1
name=Wacom Intuos 4x5
padbuttons=4
wheel=no
touchring=no
touchstripl=yes
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[0021]
model=GD_0608-U
layout=bl_2
name=Wacom Intuos 6x8
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[0022]
model=GD_0912-U
layout=bl_2
name=Wacom Intuos 9x12
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[0023]
model=GD_1212-U
layout=bl_2
name=Wacom Intuos 12x12
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[0024]
model=GD_1218-U
layout=unknown
name=Wacom Intuos 12x18
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0026]
model=PTH-450
layout=bl_7
name=Wacom Intuos5 touch S 0x26
padbuttons=7
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
[0027]
model=PTH-650/K
layout=bl_4
name=Wacom Intuos5 touch M
padbuttons=9
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[0028]
layout=bl_4
name=Wacom Intuos5 touch L
padbuttons=9
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[0029]
layout=bl_7
name=Wacom Intuos5 S
padbuttons=7
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
[002A]
model=PTH650
layout=bl_4
name=Wacom Intuos5 M Pen pad
padbuttons=9
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[0030]
model=MODEL_PL400
layout=unknown
name=Wacom PL400
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0031]
model=MODEL_PL500
layout=unknown
name=Wacom PL500
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0032]
model=MODEL_PL600
layout=unknown
name=Wacom PL600
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0033]
model=MODEL_PL600SX
layout=unknown
name=Wacom PL600SX
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0034]
model=MODEL_PL550
layout=unknown
name=Wacom PL550
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0035]
model=MODEL_PL800
layout=unknown
name=Wacom PL800
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0037]
model=MODEL_PL700
layout=unknown
name=Wacom PL700
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0038]
model=MODEL_PL510
layout=unknown
name=Wacom PL510
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0039]
model=MODEL_DTU710
layout=unknown
name=Wacom PL710
padbuttons=0
wheel=no
touchring=no
touchstripl=no
[003A]
layout=unknown
name=Wacom DTI520UB/L
padbuttons=10
wheel=no
touchring=no
touchstripl=no
[003F]
model=DTZ-21ux
layout=unknown
name=Wacom Cintiq 21UX
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[0041]
model=XD-0405-U
layout=unknown
name=Wacom Intuos2 4x5
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0042]
model=XD-0608-U
layout=unknown
name=Wacom Intuos2 6x8
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0043]
model=XD-0912-U
layout=unknown
name=Wacom Intuos2 9x12
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0044]
model=XD-1212-U
layout=unknown
name=Wacom Intuos2 12x12
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0045]
model=XD-1218-U
layout=unknown
name=Wacom Intuos2 12x18
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0047]
model=XD-0608-U
layout=unknown
name=Wacom Intuos2 6x8
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0060]
model=MODEL-VOL
layout=unknown
name=Wacom Volito
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0061]
model=FT-0203-U
layout=unknown
name=Wacom PenStation
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0062]
model=CTF-420-U
layout=unknown
name=Wacom Volito2 4x5
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0063]
model=CTF-220-U
layout=unknown
name=Wacom Volito2 2x3
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0064]
model=CTF-421-U
layout=unknown
name=Wacom PenPartner2
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0065]
model=MTE_450
layout=bl_6
name=Wacom Bamboo
padbuttons=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=8
hwbutton2=1
hwbutton3=9
hwbutton4=3
[0069]
model=CTF_430-U
layout=unknown
name=Wacom Bamboo one
padbuttons=o
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
[0081]
model=PTH-650/K Wireless
layout=unknown
name=Wacom Graphire Wireless
padbuttons=2
wheel=no
touchring=false
touchstripl=no
touchstripr=no
[0084]
model=PTH-650/K Wireless
layout=bl_4
name=Wacom Intuos5 touch M with Wacom Wireless Receiver
padbuttons=9
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[0090]
model=TPC-090
layout=unknown
name=Wacom Tablet PC90
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0093]
model=TPC-093
layout=unknown
name=Wacom Tablet PC93
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[009A]
model=TPC-09A
layout=unknown
name=Wacom Tablet PC9A
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[009F]
model=unknown
layout=unknown
name=Wacom CapPlus
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00B0]
model=PTZ-430
layout=bl_1
name=Wacom Intuos3 4x5
padbuttons=4
wheel=no
touchring=no
touchstripl=yes
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[00B1]
model=PTZ-630
layout=bl_2
name=Wacom Intuos3 6x8
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00B2]
model=PTZ-930
layout=bl_2
name=Wacom Intuos3 9x12
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00B3]
model=PTZ-1230
layout=bl_2
name=Wacom Intuos3 12x12
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00B4]
model=PTZ-1231W
layout=bl_2
name=Wacom Intuos3 12x19
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00B5]
model=PTZ-631W
layout=bl_2
name=Wacom Intuos3 6x11
padbuttons=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00B7]
model=PTZ-431W
layout=unknown
name=Wacom Intuos3 4x6
padbuttons=4
wheel=no
touchring=no
touchstripl=yes
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
[00B8]
model=PTK-440
layout=bl_7
name=Wacom Intuos4 4x6
padbuttons=7
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
[00B9]
model=PTK-640
layout=bl_4
name=Wacom Intuos4 6x9
padbuttons=9
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[00BA]
model=unknwon
layout=bl_4
name=Wacom Intuos4 8x13
padbuttons=9
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[00BB]
model=unknwon
layout=bl_4
name=Wacom Intuos4 12x19
padbuttons=9
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[00BC]
model=PTK-540WL
layout=bl_4
name=Wacom Intuos4 WL USB
padbuttons=8
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00BD]
model=unknwon
layout=bl_4
name=Wacom Intuos4 WL Bluetooth
padbuttons=8
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
[00C0]
model=MODEL_DTF720
layout=unknown
name=Wacom DTF720
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00C2]
model=unknwon
layout=unknown
name=Wacom DTF720a
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00C4]
model=MODEL_DTF521
layout=unknown
name=Wacom DTF521
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00C5]
model=DTZ-20wsx
layout=unknown
name=Wacom Cintiq 20WSX
padbuttons=14
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
[00C6]
model=DTZ-12wx
layout=unknown
name=Wacom Cintiq 12WX
padbuttons=10
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
hwbutton10=14
[00C7]
model=MODEL_DTU1931
layout=unknown
name=Wacom DTU1931
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00CC]
model=unknown
layout=unknown
name=Wacom Cintiq 21UX2
padbuttons=18
statusleds=8
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
hwbutton10=14
[00CE]
model=unknown
layout=unknown
name=Wacom DTU2231
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00D0]
model=CTT-460
layout=bl_8
name=Wacom Bamboo 2FG
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D1]
model=CTH-460
layout=bl_8
name=Bamboo Pen & Touch
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D2]
model=CTH-461
layout=bl_8
name=Bamboo Craft
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D3]
model=CTH-661
layout=bl_8
name=Wacom Bamboo 2FG 6x8
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D4]
model=CTL-460
layout=unknown
name=Wacom Bamboo Pen
padbuttons=0
wheel=no
touchring=no
touchstrip1=no
touchstripr=no
[00D5]
model=CTH-660/K
layout=unknown
name=Bamboo Pen Medium
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00D6]
model=CTH-460/K
layout=bl_8
name=Wacom Bamboo Pen & Touch
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D7]
model=CTH-461/S
layout=bl_8
name=Bamboo Fun Small
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00D8]
model=CTH-661/S1
layout=bl_8
name=Bamboo Comic Medium
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00DA]
model=CTH-461/L
layout=bl_8
name=Bamboo P & T Special Edition Small
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00DB]
model=CTH-661/L
layout=bl_8
name=Bamboo P & T Special Edition Medium
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00DD]
model=CTH-470/K
layout=unknown
name=Bamboo Connect (Pen)
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00DE]
model=CTH-470/K
layout=bl_8
name=Wacom Bamboo Pen & Touch
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[00DF]
model=CTH-670/K
layout=bl_8
name=Bamboo Create
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=9
hwbutton3=8
hwbutton4=3
[00E2]
model=unknown
layout=unknown
name=Serial Wacom Tablet (Lenovo X201)
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00E3]
model=unknown
layout=unknown
name=Serial Wacom Tablet (Lenovo X201)
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00E5]
model=unknown
layout=unknown
name=Wacom ISDv4 E5
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00E6]
model=unknown
layout=unknown
name=Serial Wacom Tablet (Lenovo X220)
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00EC]
model=unknown
layout=unknown
name=Wacom ISDv4 EC
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=2
hwbutton2=1
[00ED]
model=unknown
layout=unknown
name=Wacom ISDv4 ED
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00EF]
model=unknown
layout=unknown
name=Wacom ISDv4 ED
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00F0]
model=unknown
layout=unknown
name=DTU1631
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[00F4]
model=unknown
layout=unknown
name=Wacom Cintiq 24HD
padbuttons=16
statusleds=8
wheel=no
touchring=yes
touchstripl=yes
touchstripr=yes
[00F8]
model=unknown
layout=unknown
name=Wacom Cintiq 22HD touch
padbuttons=16
wheel=no
touchring=yes
touchstripl=yes
touchstripr=yes
hwbutton1=2
hwbutton2=3
hwbutton3=8
hwbutton4=9
hwbutton5=1
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
hwbutton10=15
hwbutton11=16
hwbutton12=17
hwbutton13=18
hwbutton14=14
hwbutton15=19
hwbutton16=20
[00FA]
model=dtk-2200
layout=unknown
name=Wacom Cintiq 22HD
padbuttons=18
wheel=no
touchring=no
touchstripl=yes
touchstripr=yes
hwbutton1=2
hwbutton2=3
hwbutton3=8
hwbutton4=9
hwbutton5=1
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
hwbutton10=15
hwbutton11=16
hwbutton12=17
hwbutton13=18
hwbutton14=14
hwbutton15=19
hwbutton16=20
hwbutton17=21
hwbutton18=22
[0100]
model=unknown
layout=unknown
name=Wacom ISDv4 100
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0101]
model=unknown
layout=unknown
name=Wacom ISDv4 101
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[010D]
model=unknown
layout=unknown
name=Wacom ISDv4 10D
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0300]
model=CTL-471
layout=unknown
name=Wacom One S
padbuttons=0
statusleds=0
touchring=false
touchstripl=false
touchstripr=false
wheel=false
[0301]
model=CTL-671
layout=unknown
name=Wacom Bamboo One M
padbuttons=0
wheel=no
touchring=no
touchstripl=no
touchstripr=no
[0302]
model=CTH-480
layout=bl_6
name=Wacom Intuos PT S Finger touch
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=1
hwbutton3=9
hwbutton4=8
[0303]
model=CTH-680S-ENES
layout=unknown
name=Wacom Intuos PT M
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=8
hwbutton3=9
hwbutton4=1
[0304]
model=DTK-1300
layout=bl_9
name=Wacom Cintiq 13HD
padbuttons=9
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=2
hwbutton2=3
hwbutton3=1
hwbutton4=11
hwbutton5=12
hwbutton6=10
hwbutton7=13
hwbutton8=8
hwbutton9=9
[0305]
model=DTK-1300
layout=unknown
name=Wacom Cintiq 13HD
padbuttons=9
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=2
hwbutton2=3
hwbutton3=1
hwbutton4=11
hwbutton5=12
hwbutton6=10
hwbutton7=13
hwbutton8=8
hwbutton9=9
[0307]
model=DTH-A1300
layout=bl_9
name=Wacom Cintiq Hybrid 13HD
padbuttons=9
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=2
hwbutton2=3
hwbutton3=1
hwbutton4=11
hwbutton5=12
hwbutton6=10
hwbutton7=13
hwbutton8=8
hwbutton9=9
[0309]
model=DTH-A1300
layout=unknown
name=Wacom Cintiq Hybrid 13HD
padbuttons=9
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=2
hwbutton2=3
hwbutton3=1
hwbutton4=11
hwbutton5=12
hwbutton6=10
hwbutton7=13
hwbutton8=8
hwbutton9=9
[030E]
model=CTH-480
layout=unknown
name=Wacom INTUOS Pen Small
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=1
hwbutton3=9
hwbutton4=8
[0314]
model=PTH-451/S
layout=bl_7
name=Wacom Intuos Pro S
padbuttons=7
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
[0315]
model=PTH-651
layout=bl_4
name=Wacom Intuos Pro M
padbuttons=9
statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[0317]
model=PTH-851
layout=bl_4
name=Wacom Intuos Pro L
padbuttons=9
+statusleds=4
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=1
hwbutton2=2
hwbutton3=3
hwbutton4=8
hwbutton5=9
hwbutton6=10
hwbutton7=11
hwbutton8=12
hwbutton9=13
[033C]
model=CTH-490
layout=bl_5
name=Intuos Art/Photo/Comic Small
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=1
hwbutton3=9
hwbutton4=8
[033E]
model=CTH-690
layout=bl_5
name=Intuos Art Medium
padbuttons=4
wheel=no
touchring=no
touchstripl=no
touchstripr=no
hwbutton1=3
hwbutton2=1
hwbutton3=9
hwbutton4=8
[0358]
model=PTH-860
layout=bl_4
name=Wacom Intuos Pro L
padbuttons=9
statusleds=0
wheel=no
touchring=yes
touchstripl=no
touchstripr=no
hwbutton1=13
hwbutton2=1
hwbutton3=2
hwbutton4=3
hwbutton5=8
hwbutton6=9
hwbutton7=10
hwbutton8=11
hwbutton9=12
[504C]
layout=unknown
model=unknown
name=Wacom (Lenovo Yoga 460)
padbuttons=0
statusleds=0
touchring=false
touchstripl=false
touchstripr=false
wheel=false
[50DB]
layout=unknown
model=unknown
name=Wacom HID (Lenovo Yoga 520)
padbuttons=0
statusleds=0
touchring=false
touchstripl=false
touchstripr=false
wheel=false
diff --git a/src/common/property.cpp b/src/common/property.cpp
index 0d1a4ae..1d44077 100644
--- a/src/common/property.cpp
+++ b/src/common/property.cpp
@@ -1,88 +1,89 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include "property.h"
using namespace Wacom;
/*
* Instanciate static instances-container of the Property template specialization.
* This has to be done here obviously before any instance is created.
*/
template<>
PropertyTemplateSpecialization::Container PropertyTemplateSpecialization::instances = PropertyTemplateSpecialization::Container();
/*
* Instanciate Properties.
*/
const Property Property::AbsWheel2Down ( QLatin1String("AbsWheel2Down") );
const Property Property::AbsWheel2Up ( QLatin1String("AbsWheel2Up") );
const Property Property::AbsWheelDown ( QLatin1String("AbsWheelDown") );
const Property Property::AbsWheelUp ( QLatin1String("AbsWheelUp") );
const Property Property::Area ( QLatin1String("Area") );
const Property Property::Button1 ( QLatin1String("Button1") );
const Property Property::Button2 ( QLatin1String("Button2") );
const Property Property::Button3 ( QLatin1String("Button3") );
const Property Property::Button4 ( QLatin1String("Button4") );
const Property Property::Button5 ( QLatin1String("Button5") );
const Property Property::Button6 ( QLatin1String("Button6") );
const Property Property::Button7 ( QLatin1String("Button7") );
const Property Property::Button8 ( QLatin1String("Button8") );
const Property Property::Button9 ( QLatin1String("Button9") );
const Property Property::Button10 ( QLatin1String("Button10") );
const Property Property::Button11 ( QLatin1String("Button11") );
const Property Property::Button12 ( QLatin1String("Button12") );
const Property Property::Button13 ( QLatin1String("Button13") );
const Property Property::Button14 ( QLatin1String("Button14") );
const Property Property::Button15 ( QLatin1String("Button15") );
const Property Property::Button16 ( QLatin1String("Button16") );
const Property Property::Button17 ( QLatin1String("Button17") );
const Property Property::Button18 ( QLatin1String("Button18") );
const Property Property::CursorAccelProfile ( QLatin1String("CursorAccelProfile") );
const Property Property::CursorAccelConstantDeceleration ( QLatin1String("CursorAccelConstantDeceleration") );
const Property Property::CursorAccelAdaptiveDeceleration ( QLatin1String("CursorAccelAdaptiveDeceleration") );
const Property Property::CursorAccelVelocityScaling ( QLatin1String("CursorAccelVelocityScaling") );
const Property Property::CursorProximity ( QLatin1String("CursorProximity") );
const Property Property::Gesture ( QLatin1String("Gesture") );
const Property Property::InvertScroll ( QLatin1String("InvertScroll") );
const Property Property::MapToOutput ( QLatin1String("MapToOutput") );
const Property Property::Mode ( QLatin1String("Mode") );
const Property Property::PressureCurve ( QLatin1String("PressureCurve") );
const Property Property::RawSample ( QLatin1String("RawSample") );
const Property Property::RelWheelDown ( QLatin1String("RelWheelDown") );
const Property Property::RelWheelUp ( QLatin1String("RelWheelUp") );
const Property Property::ResetArea ( QLatin1String("ResetArea") );
const Property Property::Rotate ( QLatin1String("Rotate") );
const Property Property::ScreenMap ( QLatin1String("ScreenMap") );
const Property Property::ScreenSpace ( QLatin1String("ScreenSpace") );
const Property Property::ScrollDistance ( QLatin1String("ScrollDistance") );
const Property Property::StatusLEDs ( QLatin1String("StatusLEDs") );
+const Property Property::StatusLEDsBrightness ( QLatin1String("StatusLEDsBrightness") );
const Property Property::StripLeftDown ( QLatin1String("StripLeftDown") );
const Property Property::StripLeftUp ( QLatin1String("StripLeftUp") );
const Property Property::StripRightDown ( QLatin1String("StripRightDown") );
const Property Property::StripRightUp ( QLatin1String("StripRightUp") );
const Property Property::Suppress ( QLatin1String("Suppress") );
const Property Property::TabletPcButton ( QLatin1String("TabletPcButton") );
const Property Property::TapTime ( QLatin1String("TapTime") );
const Property Property::Threshold ( QLatin1String("Threshold") );
const Property Property::Touch ( QLatin1String("Touch") );
const Property Property::ZoomDistance ( QLatin1String("ZoomDistance") );
diff --git a/src/common/property.h b/src/common/property.h
index 92463ec..1f75881 100644
--- a/src/common/property.h
+++ b/src/common/property.h
@@ -1,326 +1,328 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef PROPERTY_H
#define PROPERTY_H
#include
#include "enum.h"
#include "logging.h"
namespace Wacom {
// forward declaration
class Property;
struct PropertyTemplateSpecializationLessFunctor;
struct PropertyKeyEqualsFunctor;
/**
* Do not use this typedef!
*
* It is a helper typedef to ease maintenance of template parameters.
*/
typedef Enum PropertyTemplateSpecialization;
/**
* Do not use this functor!
*
* It is required by the Property class and can only be used to sort instances
* of type PropertyTemplateSpecialization.
*/
struct PropertyTemplateSpecializationLessFunctor
{
bool operator()(const PropertyTemplateSpecialization* p1, const PropertyTemplateSpecialization* p2)
{
return (p1->key() < p2->key());
}
};
/**
* A functor which is used to compare two Property keys from type QString.
* The keys are compared case insensitive. This functor should be used by
* all property enumerations.
*
* @return True if both keys are equal, else false;
*/
struct PropertyKeyEqualsFunctor
{
bool operator()(const QString& k1, const QString& k2)
{
return (k1.compare(k2, Qt::CaseInsensitive) == 0);
}
};
/**
* An enum of all supported properties.
*
* Different subsystems support different sets of properties, which in
* turn can be mapped to different key values. This class serves as a
* global list of supported properties to allow property mapping
* between subsystems.
*/
class Property : public PropertyTemplateSpecialization {
public:
/**
* The action to which absolute wheel up/down should be mapped.
* See any button property for the list of valid values.
*
* @sa Property::Button1
*/
static const Property AbsWheel2Down;
static const Property AbsWheel2Up;
static const Property AbsWheelDown;
static const Property AbsWheelUp;
/**
* The tablet area to which the screen space gets mapped to.
* Valid values: A string as returned by TabletArea::toString()
*/
static const Property Area;
/**
* The button shortcut action assigned to this button.
* This property supports quite a lot of values. Use the \a ButtonShortcut class to parse them.
* Valid values are:
*
* - "key [shortcut]" : A keyboard shortcut. [shortcut] are some key combinations.
* - "button [number]" : A mouse button shortcut. [number] is a mouse button number.
* - "[number]" : A mouse button shortcut. [number] is a mouse button number.
* - and a few others : Qt shortcuts and others.
*
* @sa ButtonShortcut
*/
static const Property Button1;
static const Property Button2;
static const Property Button3;
static const Property Button4;
static const Property Button5;
static const Property Button6;
static const Property Button7;
static const Property Button8;
static const Property Button9;
static const Property Button10;
static const Property Button11;
static const Property Button12;
static const Property Button13;
static const Property Button14;
static const Property Button15;
static const Property Button16;
static const Property Button17;
static const Property Button18;
/**
* Mouse cursor settings, not yet used.
*/
static const Property CursorAccelProfile;
static const Property CursorAccelConstantDeceleration;
static const Property CursorAccelAdaptiveDeceleration;
static const Property CursorAccelVelocityScaling;
/**
* The cursor distance for proximity-out in distance from the tablet.
* Valid values are numbers > 0.
*
* We do not use this property but it is supported by xsetwacom and
* can be set manually in our profile configuration file.
*/
static const Property CursorProximity;
/**
* Enables/disables gesture support.
* Valid values are "on" or "off".
*/
static const Property Gesture;
/**
* Invert the scroll direction of the touch device.
* Does not work atm.
*/
static const Property InvertScroll;
/**
* @deprecated Use Property::ScreenSpace instead.
*
* Maps the tablet/touch to a monitor. Accepts any values which are
* accepted by xsetwacom.
*
* We do not use this property but it is here so the user can add an
* entry to his tablet profile configuration file which will then be set
* automatically with xsetwacom. However our configuration dialog
* ignores this property and we might even override it with
* our \a ScreenSpace property.
*
* @sa Property::ScreenSpace
*/
static const Property MapToOutput;
/**
* The stylus/eraser/touch tracking mode.
* Valid values are:
*
* - "absolute" : Absolute tracking mode.
* - "relative" : Relative tracking mode.
*/
static const Property Mode;
/**
* Bezier curve for pressure.
* A string consisting of 4 integer values from 0-100.
*/
static const Property PressureCurve;
/**
* Number of raw data used to filter the points.
* Valid values are numbers > 0.
*/
static const Property RawSample;
/**
* The action to which relative wheel up/down should be mapped.
* See any button property for the list of valid values.
*
* @sa Property::Button1
*/
static const Property RelWheelDown;
static const Property RelWheelUp;
/**
* Resets the tablet area to the default calibration.
* This property does not have a value.
*/
static const Property ResetArea;
/**
* Determines if the tablet should get rotated.
* Valid values are:
*
* - "none" : The tablet does not get rotated.
* - "cw" : The tablet is rotated clockwise.
* - "ccw" : The tablet is rotated counterclockwise.
* - "half" : The tablet is rotated upside down.
* - "auto" : The tablet is auto rotated with the screen.
* - "auto-inverted" : The tablet is auto rotated with the screen and clockwise/counterclockwise rotation is inverted.
*/
static const Property Rotate;
/**
* Maps the screen spaces to the tablet.
*
* Format is:
*
* "SP:x1 y1 x2 y2" (SP = ScreenSpace returned by ScreenSpace::toString()).
*
* Multiple of these values can be separated by '|'.
*/
static const Property ScreenMap;
/**
* The current screen space which is being used to map the tablet.
* Valid values are screen space strings returned by ScreenSpace::toString().
*/
static const Property ScreenSpace;
/**
* Minimum motion before sending a scroll gesture.
* Valid values are numbers >= 0;
*/
static const Property ScrollDistance;
/**
* Intuos4/5 tablets have 4 LED's that are used to show a "current Mode"
* Cintiq 21UX2 and Cintiq 24HD have 8 of them (2x4)
*
* We use it to switch profiles and show which of the profiles is activated.
* In the TabletDatabase the number of LEDs must be specified.
- * They will be used via the proc system
+ * They will be used via the sys filesystem. The leds also support four
+ * brightness levels: off, min, mid, high
*/
static const Property StatusLEDs;
+ static const Property StatusLEDsBrightness;
/**
* The action to which left/right strip up/down should be mapped.
* See any button property for the list of valid values.
*
* @sa Property::Button1
*/
static const Property StripLeftDown;
static const Property StripLeftUp;
static const Property StripRightDown;
static const Property StripRightUp;
/**
* Number of points trimmed.
* Valid values are numbers >= 0.
*/
static const Property Suppress;
/**
* Tap to Click. Valid values are "on" or "off".
* If on, the stylus must be in contact with the screen for a stylus side button to work.
* If off, stylus buttons will work once the stylus is in proximity of the tablet.
*/
static const Property TabletPcButton;
/**
* Minimum time between taps for a right click.
* Valid values are numbers >= 0.
*/
static const Property TapTime;
/**
* Sets tip/eraser pressure threshold.
* Valid values are numbers >= 0.
*/
static const Property Threshold;
/**
* Enables/disables touch support.
* Valid values are either "on" or "off".
*/
static const Property Touch;
/**
* Minimum distance for a zoom gesture.
* Valid values are numbers > 0.
*/
static const Property ZoomDistance;
private:
Property(const QString& key) : PropertyTemplateSpecialization(this, key) {}
}; // CLASS
/*
* Declare static instances-container of the Property template specialization.
*/
template<>
PropertyTemplateSpecialization::Container PropertyTemplateSpecialization::instances;
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/common/tabletinfo.cpp b/src/common/tabletinfo.cpp
index baccdb3..a7b3873 100644
--- a/src/common/tabletinfo.cpp
+++ b/src/common/tabletinfo.cpp
@@ -1,50 +1,50 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include "tabletinfo.h"
using namespace Wacom;
/*
* Instanciate static instances-container of the TabletInfo template specialization.
* This has to be done here obviously before any instance is created.
*/
template<>
TabletInfoTemplateSpecialization::Container TabletInfoTemplateSpecialization::instances = TabletInfoTemplateSpecialization::Container();
/*
- * Instanciate Properties.
+ * Instantiate Properties.
*/
const TabletInfo TabletInfo::ButtonLayout ( QLatin1String("ButtonLayout") );
const TabletInfo TabletInfo::CompanyId ( QLatin1String("CompanyId") );
const TabletInfo TabletInfo::CompanyName ( QLatin1String("CompanyName") );
const TabletInfo TabletInfo::HasLeftTouchStrip ( QLatin1String("HasLeftTouchStrip"));
const TabletInfo TabletInfo::HasRightTouchStrip ( QLatin1String("HasRightTouchStrip"));
const TabletInfo TabletInfo::HasTouchRing ( QLatin1String("HasTouchRing"));
const TabletInfo TabletInfo::HasWheel ( QLatin1String("HasWheel"));
const TabletInfo TabletInfo::NumPadButtons ( QLatin1String("NumPadButtons"));
const TabletInfo TabletInfo::StatusLEDs ( QLatin1String("StatusLEDs"));
const TabletInfo TabletInfo::TabletId ( QLatin1String("TabletId") );
const TabletInfo TabletInfo::TabletModel ( QLatin1String("TabletModel") );
const TabletInfo TabletInfo::TabletName ( QLatin1String("TabletName") );
const TabletInfo TabletInfo::TabletSerial ( QLatin1String("TabletSerial") );
diff --git a/src/kded/procsystemadaptor.cpp b/src/kded/procsystemadaptor.cpp
index a2eae57..1c33c76 100644
--- a/src/kded/procsystemadaptor.cpp
+++ b/src/kded/procsystemadaptor.cpp
@@ -1,110 +1,127 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "procsystemadaptor.h"
#include "logging.h"
#include "procsystemproperty.h"
#include
using namespace Wacom;
namespace Wacom {
class ProcSystemAdaptorPrivate
{
public:
QString deviceName;
}; // CLASS
} // NAMESPACE
ProcSystemAdaptor::ProcSystemAdaptor(const QString& deviceName)
: PropertyAdaptor(nullptr), d_ptr(new ProcSystemAdaptorPrivate)
{
Q_D(ProcSystemAdaptor);
d->deviceName = deviceName;
}
ProcSystemAdaptor::~ProcSystemAdaptor()
{
delete this->d_ptr;
}
const QList< Property > ProcSystemAdaptor::getProperties() const
{
return ProcSystemProperty::ids();
}
const QString ProcSystemAdaptor::getProperty(const Property& property) const
{
Q_D(const ProcSystemAdaptor);
qCWarning(KDED) << QString::fromLatin1("Can not get unsupported property '%1' from device '%2' using proc system!").arg(property.key()).arg(d->deviceName);
return QString();
}
bool ProcSystemAdaptor::setProperty(const Property& property, const QString& value)
{
qCDebug(KDED) << QString::fromLatin1("Setting property '%1' to '%2'.").arg(property.key()).arg(value);
// https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-driver-wacom
/* /sys/bus/hid/devices/::./wacom_led/status0_luminance
Writing to this file sets the status LED luminance (1..127)
when the stylus does not touch the tablet surface, and no
button is pressed on the stylus. This luminance level is
normally lower than the level when a button is pressed.
*/
/* /sys/bus/hid/devices/::./wacom_led/status1_luminance
Writing to this file sets the status LED luminance (1..127)
when the stylus touches the tablet surface, or any button is
pressed on the stylus.
*/
// https://www.kernel.org/doc/Documentation/leds/leds-class.txt
- int statusLed = value.toInt();
+
QString cmd;
- if(statusLed < 4 && statusLed >= 0) {
- cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status_led0_select\"").arg(statusLed);
- }
- else if(statusLed < 8 && statusLed >= 4) {
- statusLed -= 4;
- cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status_led1_select\"").arg(statusLed);
- }
- else {
- return false;
+ if (property == Property::StatusLEDs) {
+ int statusLed = value.toInt();
+ if(statusLed < 4 && statusLed >= 0) {
+ cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status_led0_select\"").arg(statusLed);
+ }
+ else if(statusLed < 8 && statusLed >= 4) {
+ statusLed -= 4;
+ cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status_led1_select\"").arg(statusLed);
+ }
+ else {
+ return false;
+ }
+ } else if (property == Property::StatusLEDsBrightness) {
+ int statusLedBrightness = value.toInt();
+ if(statusLedBrightness < 128 && statusLedBrightness >= 0) {
+ cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status0_luminance\"").arg(statusLedBrightness);
+ }
+ else if(statusLedBrightness < 256 && statusLedBrightness >= 128) {
+ statusLedBrightness -= 128;
+ cmd = QString::fromLatin1("bash -c \"echo %1 > /sys/bus/hid/devices/*/wacom_led/status1_luminance\"").arg(statusLedBrightness);
+ }
+ else {
+ return false;
+ }
+ } else {
+ qCWarning(KDED) << "Unknown Property: " << property.key();
}
int ret = QProcess::execute(cmd);
return ret == 0;
}
bool ProcSystemAdaptor::supportsProperty(const Property& property) const
{
return (ProcSystemProperty::map(property));
}
diff --git a/src/kded/procsystemproperty.cpp b/src/kded/procsystemproperty.cpp
index 8792689..0e5dd9a 100644
--- a/src/kded/procsystemproperty.cpp
+++ b/src/kded/procsystemproperty.cpp
@@ -1,31 +1,32 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "procsystemproperty.h"
using namespace Wacom;
// instances container specialization instanciation
template<>
ProcSystemPropertyTemplateSpecialization::PropertySetTemplateSpecialization::Container ProcSystemPropertyTemplateSpecialization::PropertySetTemplateSpecialization::instances = ProcSystemPropertyTemplateSpecialization::PropertySetTemplateSpecialization::Container();
// KEEP THIS LIST IN AN ORDER WHICH CAN BE SET DIRECTLY!
// SOME PROPERTIES NEED TO BE SET BEFORE OTHERS!
//
const ProcSystemProperty ProcSystemProperty::StatusLEDs ( Property::StatusLEDs, QLatin1String("Status LEDs for Intuos4/5 and Cintiq") );
+const ProcSystemProperty ProcSystemProperty::StatusLEDsBrightness ( Property::StatusLEDsBrightness, QLatin1String("Status LED Brighness for Intuos4/5 and Cintiq") );
diff --git a/src/kded/procsystemproperty.h b/src/kded/procsystemproperty.h
index 7f719be..0c34e6c 100644
--- a/src/kded/procsystemproperty.h
+++ b/src/kded/procsystemproperty.h
@@ -1,53 +1,54 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef PROCSYSTEMPROPERTY_H
#define PROCSYSTEMPROPERTY_H
#include
#include "property.h"
#include "propertyset.h"
namespace Wacom {
// forward declarations & typedefs
class ProcSystemProperty;
typedef PropertySet ProcSystemPropertyTemplateSpecialization;
/**
* Properties supported by the ProcSystemPropertyAdaptor.
*/
class ProcSystemProperty : public ProcSystemPropertyTemplateSpecialization
{
public:
static const ProcSystemProperty StatusLEDs;
+ static const ProcSystemProperty StatusLEDsBrightness;
private:
ProcSystemProperty(const Property& id, const QString& key) : ProcSystemPropertyTemplateSpecialization(this, id, key) {}
}; // CLASS
// instances container specialization declaration
template<>
ProcSystemPropertyTemplateSpecialization::PropertySetTemplateSpecialization::Container ProcSystemPropertyTemplateSpecialization::PropertySetTemplateSpecialization::instances;
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tabletbackend.cpp b/src/kded/tabletbackend.cpp
index f820801..d911e55 100644
--- a/src/kded/tabletbackend.cpp
+++ b/src/kded/tabletbackend.cpp
@@ -1,189 +1,197 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "tabletbackend.h"
#include "logging.h"
#include "procsystemadaptor.h"
#include "procsystemproperty.h"
#include "property.h"
#include "propertyset.h"
namespace Wacom
{
class TabletBackendPrivate
{
public:
TabletBackend::DeviceMap deviceAdaptors;
PropertyAdaptor* statusLEDAdaptor;
TabletInformation tabletInformation;
};
}
using namespace Wacom;
TabletBackend::TabletBackend(const Wacom::TabletInformation& tabletInformation) : d_ptr(new TabletBackendPrivate)
{
Q_D(TabletBackend);
d->tabletInformation = tabletInformation;
d_ptr->statusLEDAdaptor = new ProcSystemAdaptor(d->tabletInformation.getDeviceName(DeviceType::Pad));
}
TabletBackend::~TabletBackend()
{
// delete all property adaptors
DeviceMap::iterator deviceIter;
for (deviceIter = d_ptr->deviceAdaptors.begin() ; deviceIter != d_ptr->deviceAdaptors.end() ; ++deviceIter) {
AdaptorList::iterator adaptorIter = deviceIter.value().begin();
while (adaptorIter != deviceIter.value().end()) {
delete (*adaptorIter);
adaptorIter = deviceIter.value().erase(adaptorIter);
}
}
delete d_ptr->statusLEDAdaptor;
// delete private class
delete d_ptr;
}
void TabletBackend::addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor)
{
Q_D(TabletBackend);
d->deviceAdaptors[deviceType].append(adaptor);
}
const TabletInformation& TabletBackend::getInformation() const
{
Q_D(const TabletBackend);
return d->tabletInformation;
}
const QString TabletBackend::getProperty(const DeviceType& type, const Property& property) const
{
Q_D(const TabletBackend);
DeviceMap::const_iterator adaptors = d->deviceAdaptors.constFind(type);
if (adaptors == d->deviceAdaptors.constEnd()) {
qCWarning(KDED) << QString::fromLatin1("Could not get property '%1' from unsupported device type '%2'!").arg(property.key()).arg(type.key());
return QString();
}
foreach(const PropertyAdaptor* adaptor, adaptors.value()) {
if (adaptor->supportsProperty(property)) {
return adaptor->getProperty(property);
}
}
return QString();
}
void TabletBackend::setProfile(const TabletProfile& profile)
{
Q_D(TabletBackend);
foreach(const DeviceType& deviceType, DeviceType::list()) {
if (d->tabletInformation.hasDevice(deviceType)) {
if (profile.hasDevice(deviceType)) {
qCDebug(KDED) << QString::fromLatin1("Setting profile '%1' on tablet '%2', device '%3'").arg(profile.getName()).arg(d->tabletInformation.get(TabletInfo::TabletName)).arg(deviceType.key());
DeviceProfile deviceProfile = profile.getDevice(deviceType);
setProfile(deviceType, deviceProfile);
} else {
qCDebug(KDED) << QString::fromLatin1("Skipping '%1' settings as the current profile does not contain any settings for this device...").arg(deviceType.key());
}
} else {
qCDebug(KDED) << QString::fromLatin1("Skipping '%1' settings as the device does not support it...").arg(deviceType.key());
}
}
}
void TabletBackend::setProfile(const DeviceType& deviceType, const DeviceProfile& profile)
{
Q_D(TabletBackend);
DeviceMap::iterator adaptors = d->deviceAdaptors.find(deviceType);
if (adaptors == d->deviceAdaptors.end()) {
qCWarning(KDED) << QString::fromLatin1("Could not set profile on unsupported device type '%1'!").arg(deviceType.key());
return;
}
QString value;
// set properties on all adaptors
foreach(PropertyAdaptor* adaptor, adaptors.value()) {
// ask adaptor which properties it supports
// this will also ensure that the properties are set in the correct order
foreach(const Property& property, adaptor->getProperties()) {
// set property value if it is supported by the profile and not empty
if (profile.supportsProperty(property)) {
value = profile.getProperty(property);
if (!value.isEmpty()) {
adaptor->setProperty(property, value);
}
}
}
}
}
void TabletBackend::setStatusLED(int led)
{
Q_D(TabletBackend);
if (d->tabletInformation.statusLEDs() > 0) {
d_ptr->statusLEDAdaptor->setProperty(Property::StatusLEDs, QString::number(led));
}
}
+void TabletBackend::setStatusLEDBrightness(int brightness)
+{
+ Q_D(TabletBackend);
+ if (d->tabletInformation.statusLEDs() > 0) {
+ d_ptr->statusLEDAdaptor->setProperty(Property::StatusLEDsBrightness, QString::number(brightness));
+ }
+}
+
bool TabletBackend::setProperty(const DeviceType& type, const Property& property, const QString& value)
{
Q_D(TabletBackend);
DeviceMap::iterator adaptors = d->deviceAdaptors.find(type);
if (adaptors == d->deviceAdaptors.end()) {
qCWarning(KDED) << QString::fromLatin1("Could not set property '%1' to '%2' on unsupported device type '%3'!").arg(property.key()).arg(value).arg(type.key());
return false;
}
bool returnValue = false;
foreach (PropertyAdaptor* adaptor, adaptors.value()) {
if (adaptor->supportsProperty(property)) {
if (adaptor->setProperty(property, value)) {
returnValue = true;
}
}
}
return returnValue;
}
diff --git a/src/kded/tabletbackend.h b/src/kded/tabletbackend.h
index b3671ae..cf163fd 100644
--- a/src/kded/tabletbackend.h
+++ b/src/kded/tabletbackend.h
@@ -1,91 +1,96 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef TABLETBACKEND_H
#define TABLETBACKEND_H
#include "tabletbackendinterface.h"
#include
#include
namespace Wacom
{
// forward declaration
class TabletBackendPrivate;
/**
* The tablet backend which is used to set properties on a tablet.
* The properties which are available depend on the property adapters
* which were addded to the backend.
*/
class TabletBackend : public TabletBackendInterface
{
public:
explicit TabletBackend(const TabletInformation& tabletInformation);
virtual ~TabletBackend();
/**
* @see TabletBackendInterface::addAdaptor(const DeviceType&, PropertyAdaptor*)
*/
void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor);
/**
* @see TabletBackendInterface::getInformation() const;
*/
const TabletInformation& getInformation() const;
/**
* @see TabletBackendInterface::getProperty(const DeviceType&, const Property&) const
*/
const QString getProperty(const DeviceType& type, const Property& property) const;
/**
* @see TabletBackendInterface::setProfile(const TabletProfile&)
*/
void setProfile(const TabletProfile& profile);
/**
* @see TabletBackendInterface::setProfile(const DeviceType&, const DeviceProfile&)
*/
void setProfile(const DeviceType& deviceType, const DeviceProfile& profile);
/**
* @see TabletBackendInterface::setStatusLED(int led)
*/
void setStatusLED(int led);
+ /**
+ * @see TabletBackendInterface::setStatusLEDBrightness(int brightness)
+ */
+ void setStatusLEDBrightness(int brightness);
+
/**
* @see TabletBackendInterface::setProperty(const DeviceType&, const Property&, const QString&)
*/
bool setProperty(const DeviceType& type, const Property& property, const QString& value);
private:
typedef QList AdaptorList;
typedef QMap DeviceMap;
Q_DECLARE_PRIVATE(TabletBackend);
TabletBackendPrivate *const d_ptr; //!< D-Pointer which gives access to private members.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tabletbackendinterface.h b/src/kded/tabletbackendinterface.h
index d865cb1..6b4c860 100644
--- a/src/kded/tabletbackendinterface.h
+++ b/src/kded/tabletbackendinterface.h
@@ -1,107 +1,114 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef TABLETBACKENDINTERFACE_H
#define TABLETBACKENDINTERFACE_H
#include "deviceprofile.h"
#include "devicetype.h"
#include "property.h"
#include "propertyadaptor.h"
#include "tabletprofile.h"
#include "tabletinformation.h"
#include
namespace Wacom
{
/**
* This interface only exists so we can create a mock object for unit testing.
*/
class TabletBackendInterface
{
public:
virtual ~TabletBackendInterface() {}
/**
* Adds a property adaptor for the given device type. The property adaptor
* will be deleted once this class is destroyed.
*
* @param deviceType The device type to add the property adaptor for.
* @param adaptor The property adaptor to add.
*/
virtual void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor) = 0;
/**
* Returns tablet information about the tablet handled by this backend.
*
* @return TabletInformation
*/
virtual const TabletInformation& getInformation() const = 0;
/**
* Gets a tablet property. If the property is not supported by any of the
* adaptors which were added to this tablet, an empty string is returned.
*
* @param type The device to read the property from.
* @param property The property to get.
*
* @return The property value or an empty string.
*/
virtual const QString getProperty(const DeviceType& type, const Property& property) const = 0;
/**
* Applies a profile to the tablet managed by this backend.
*
* @param profile The profile to apply.
*/
virtual void setProfile(const TabletProfile& profile) = 0;
/**
* Applies a profile to a device.
*
* @param deviceType The device to apply the profile to.
* @param profile The profile to apply.
*/
virtual void setProfile(const DeviceType& deviceType, const DeviceProfile& profile) = 0;
/**
* Set the status LEDs for the Intuos4/5 and Cintiq tablets
*
* @param led led number that should be set 0-3 or 0-7
*/
virtual void setStatusLED(int led) = 0;
+ /**
+ * Set the status LED brightness for the Intuos4/5 and Cintiq tablets
+ *
+ * @param brightness brightness gets a value of 0 or 128(off), 32 or 160(low), 64 or 192(mid), 96 or 224(high)
+ */
+ virtual void setStatusLEDBrightness(int brightness) = 0;
+
/**
* Sets a property on a device.
*
* @param type The device to set the property on.
* @param property The property to set on the device.
* @param value The property value to set.
*/
virtual bool setProperty(const DeviceType& type, const Property& property, const QString& value) = 0;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tablethandler.cpp b/src/kded/tablethandler.cpp
index 734a2bd..de8b302 100644
--- a/src/kded/tablethandler.cpp
+++ b/src/kded/tablethandler.cpp
@@ -1,692 +1,693 @@
/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "tablethandler.h"
#include "tabletbackendinterface.h"
#include "tabletbackendfactory.h"
#include "tabletinfo.h"
#include "devicetype.h"
#include "screenmap.h"
#include "screenspace.h"
#include "stringutils.h"
// common includes
#include "logging.h"
#include "deviceprofile.h"
#include "tabletdatabase.h"
#include "mainconfig.h"
#include "profilemanager.h"
#include "profilemanagement.h"
#include "tabletprofile.h"
#include "x11info.h"
#include
#include
#include
#include
#include
namespace Wacom
{
class TabletHandlerPrivate
{
public:
MainConfig mainConfig; //!< Main config file which stores general parameters.
QString profileFile; //!< Save which profile we should use
QHash profileManagerList; //!< Profile manager which reads profile configuration from file.
QHash tabletBackendList; //!< Tablet backend of all currently connected tablets.
QHash tabletInformationList; //!< Information of all currently connected tablets.
QHash currentProfileList; //!< Currently active profile for each tablet.
}; // CLASS
} // NAMESPACE
using namespace Wacom;
TabletHandler::TabletHandler()
: TabletHandlerInterface(nullptr), d_ptr(new TabletHandlerPrivate)
{
Q_D( TabletHandler );
d->profileFile = QLatin1String("tabletprofilesrc");
d->mainConfig.open(QLatin1String("wacomtablet-kderc"));
}
TabletHandler::TabletHandler(const QString& profileFile, const QString configFile)
: TabletHandlerInterface(nullptr), d_ptr(new TabletHandlerPrivate)
{
Q_D( TabletHandler );
d->profileFile = profileFile;
d->mainConfig.open(configFile);
}
TabletHandler::~TabletHandler()
{
qDeleteAll(d_ptr->tabletBackendList);
qDeleteAll(d_ptr->profileManagerList);
delete d_ptr;
}
QString TabletHandler::getProperty(const QString &tabletId, const DeviceType& deviceType, const Property& property) const
{
Q_D( const TabletHandler );
if( !d->tabletBackendList.contains(tabletId) || d->tabletBackendList.value(tabletId) == nullptr) {
qCWarning(KDED) << QString::fromLatin1("Unable to get property '%1' from device '%2' as no device is currently available!").arg(property.key()).arg(deviceType.key());
return QString();
}
return d->tabletBackendList.value(tabletId)->getProperty( deviceType, property );
}
void TabletHandler::onTabletAdded( const TabletInformation& info )
{
Q_D( TabletHandler );
// if we already have a device ... skip this step
QString tabletId = info.get(TabletInfo::TabletId);
if(d->tabletBackendList.contains(tabletId)) {
qCDebug(KDED) << QString::fromLatin1("Ignoring tablet '%1' as another one with same name is already connected.")
.arg(info.get(TabletInfo::TabletId));
return;
}
qCDebug(KDED) << "Taking control of new tablet" << info.get(TabletInfo::TabletName)
<< "(" << info.get(TabletInfo::TabletId) << ") ["
<< (info.hasDevice(DeviceType::Stylus) ? "stylus" : "")
<< (info.hasDevice(DeviceType::Eraser) ? "eraser" : "")
<< (info.hasDevice(DeviceType::Pad) ? "pad" : "")
<< (info.hasDevice(DeviceType::Touch) ? "touch" : "")
<< (info.hasDevice(DeviceType::Cursor) ? "cursor" : "")
<< "]";
// create tablet backend
TabletBackendInterface *tbi = TabletBackendFactory::createBackend(info);
if (!tbi) {
qCWarning(KDED) << "Could not create tablet backend interface. Ignoring Tablet";
return; // no valid backend found
}
d->tabletBackendList.insert(tabletId, tbi);
// update tablet information
d->profileManagerList.insert(tabletId, new ProfileManager(d->profileFile));
d->tabletInformationList.insert(tabletId, info);
// if we found something notify about it and set the default profile to it
emit notify( QLatin1String("tabletAdded"),
i18n("Tablet Connected"),
i18n("New tablet '%1' connected.",
info.get(TabletInfo::TabletName) ));
// set profile which was last used
auto lastProfile = d->mainConfig.getLastProfile(info.getUniqueDeviceId());
if (lastProfile.isEmpty()) {
// try reading profile using device name for compatibility with older config
lastProfile = d->mainConfig.getLastProfile(info.getLegacyUniqueDeviceId());
if (!lastProfile.isEmpty()) {
qCDebug(KDED) << "Found legacy profile setting for" << tabletId;
}
}
setProfile(tabletId, lastProfile);
// notify everyone else about the new tablet
emit tabletAdded(info);
}
void TabletHandler::onTabletRemoved( const TabletInformation& info )
{
Q_D( TabletHandler );
TabletBackendInterface *tbi = d->tabletBackendList.value(info.get(TabletInfo::TabletId));
TabletInformation ti = d->tabletInformationList.value(info.get(TabletInfo::TabletId));
if ( tbi && ti.getTabletSerial() == info.getTabletSerial() ) {
emit notify( QLatin1String("tabletRemoved"),
i18n("Tablet removed"),
i18n("Tablet %1 removed",
ti.get(TabletInfo::TabletName) ));
QString tabletId = info.get(TabletInfo::TabletId);
d->tabletBackendList.remove(tabletId);
d->tabletInformationList.remove(tabletId);
delete tbi;
ProfileManager *pm = d->profileManagerList.take(tabletId);
delete pm;
emit tabletRemoved(tabletId);
}
}
void TabletHandler::onScreenRotated(QString output, const Qt::ScreenOrientation &newScreenRotation)
{
Q_D( TabletHandler );
qCDebug(KDED) << "Screen" << output << "rotation has changed to" << newScreenRotation;
//for each connected tablet, do the rotation
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
ScreenRotation screenRotation = ScreenRotation::NONE;
switch (newScreenRotation)
{
case Qt::PrimaryOrientation:
case Qt::LandscapeOrientation:
screenRotation = ScreenRotation::NONE;
break;
case Qt::PortraitOrientation:
screenRotation = ScreenRotation::CW;
break;
case Qt::InvertedLandscapeOrientation:
screenRotation = ScreenRotation::HALF;
break;
case Qt::InvertedPortraitOrientation:
screenRotation = ScreenRotation::CCW;
break;
}
// rotation has to be applied before screen mapping
autoRotateTablet(tabletId, tabletProfile, output, screenRotation);
// when the rotation changes, the screen mapping has to be applied again
mapTabletToCurrentScreenSpace(tabletId, tabletProfile);
}
}
void TabletHandler::onScreenAddedRemoved(QScreen *screen)
{
Q_D( TabletHandler );
Q_UNUSED(screen)
qCDebug(KDED) << "Number of screens has changed";
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
mapTabletToCurrentScreenSpace(tabletId, tabletProfile);
}
}
void TabletHandler::onScreenGeometryChanged()
{
Q_D( TabletHandler );
qCDebug(KDED) << "Screen geometry has changed";
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
mapTabletToCurrentScreenSpace(tabletId, tabletProfile);
}
}
void TabletHandler::onTogglePenMode()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
if( !hasTablet(tabletId) || !hasDevice(tabletId, DeviceType::Stylus)) {
continue;
}
// read current mode and screen space from profile
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
DeviceProfile stylusProfile = tabletProfile.getDevice(DeviceType::Stylus);
QString trackingMode = stylusProfile.getProperty(Property::Mode);
ScreenSpace screenSpace(stylusProfile.getProperty(Property::ScreenSpace));
// toggle tracking mode
if (trackingMode.contains(QLatin1String("relative"), Qt::CaseInsensitive)) {
trackingMode = QLatin1String("absolute");
} else {
// if the new mode is "relative" we have to switch to full desktop
// as screen mappings are not supported in absolute mode
trackingMode = QLatin1String("relative");
screenSpace = ScreenSpace::desktop();
}
// map tablet to output which will also save the current mode in the profile
mapDeviceToOutput(tabletId, DeviceType::Stylus, screenSpace, trackingMode, tabletProfile);
mapDeviceToOutput(tabletId, DeviceType::Eraser, screenSpace, trackingMode, tabletProfile);
d->profileManagerList.value(tabletId)->saveProfile(tabletProfile);
}
}
void TabletHandler::onToggleTouch()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
if( !hasDevice(tabletId, DeviceType::Touch) ) {
continue;
}
QString touchMode = getProperty(tabletId, DeviceType::Touch, Property::Touch);
// also save the touch on/off into the profile to remember the user selection after
// the tablet was reconnected
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
DeviceProfile touchProfile = tabletProfile.getDevice(DeviceType::Touch);
if( touchMode.compare( QLatin1String( "off" ), Qt::CaseInsensitive) == 0 ) {
setProperty(tabletId, DeviceType::Touch, Property::Touch, QLatin1String("on"));
touchProfile.setProperty( Property::Touch, QLatin1String("on" ) );
} else {
setProperty(tabletId, DeviceType::Touch, Property::Touch, QLatin1String("off"));
touchProfile.setProperty( Property::Touch, QLatin1String("off") );
}
tabletProfile.setDevice(touchProfile);
d->profileManagerList.value(tabletId)->saveProfile(tabletProfile);
}
}
void TabletHandler::onToggleScreenMapping()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
if (!hasTablet(tabletId)) {
continue;
}
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
DeviceProfile stylusProfile = tabletProfile.getDevice(DeviceType::Stylus);
ScreenSpace screenSpace = ScreenSpace(stylusProfile.getProperty(Property::ScreenSpace));
mapPenToScreenSpace(tabletId, screenSpace.next());
}
}
void TabletHandler::onMapToFullScreen()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
mapPenToScreenSpace(tabletId, ScreenSpace::desktop().toString());
}
}
void TabletHandler::onMapToScreen1()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
mapPenToScreenSpace(tabletId, ScreenSpace::monitor(X11Info::getPrimaryScreenName()));
}
}
void TabletHandler::onMapToScreen2()
{
Q_D( TabletHandler );
if (QGuiApplication::screens().count() > 1) {
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
mapPenToScreenSpace(tabletId, ScreenSpace::monitor(X11Info::getPrimaryScreenName()).next());
}
}
}
void TabletHandler::onNextProfile()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
if(d->profileManagerList.value(tabletId)->profileRotationList().empty()) {
qCDebug(KDED) << "No items in the rotation list. Nothing to rotate";
}
else {
QString nextProfile = d->profileManagerList.value(tabletId)->nextProfile();
setProfile(tabletId, nextProfile);
}
}
}
void TabletHandler::onPreviousProfile()
{
Q_D( TabletHandler );
foreach(const QString &tabletId, d->tabletInformationList.keys()) {
if(d->profileManagerList.value(tabletId)->profileRotationList().empty()) {
qCDebug(KDED) << "No items in the rotation list. Nothing to rotate";
}
else {
QString previousProfile = d->profileManagerList.value(tabletId)->previousProfile();
setProfile(tabletId, previousProfile);
}
}
}
QStringList TabletHandler::listProfiles( const QString &tabletId )
{
Q_D( TabletHandler );
ProfileManager *pm = d->profileManagerList.value(tabletId);
if(!pm) {
qCWarning(KDED) << "Could not retrieve ProfileManager for tablet" << tabletId;
return QStringList();
}
const TabletInformation ti = d->tabletInformationList.value(tabletId);
pm->readProfiles(ti.getUniqueDeviceId());
return pm->listProfiles();
}
void TabletHandler::setProfile( const QString &tabletId, const QString &profile )
{
Q_D( TabletHandler );
qCDebug(KDED) << QString::fromLatin1("Loading tablet profile '%1'...").arg(profile);
if (!hasTablet(tabletId)) {
qCWarning(KDED) << QString::fromLatin1("Can not set tablet profile to '%1' as no backend is available!").arg(profile);
return;
}
ProfileManager *profileManager = d->profileManagerList.value(tabletId);
if(!profileManager) {
qCWarning(KDED) << "Could not retrieve ProfileManager for tablet" << tabletId;
return;
}
TabletInformation tabletInformation = d->tabletInformationList.value(tabletId);
profileManager->readProfiles(tabletInformation.getUniqueDeviceId(),
tabletInformation.getLegacyUniqueDeviceId());
TabletProfile tabletProfile = profileManager->loadProfile(profile);
if (tabletProfile.listDevices().isEmpty()) {
//may happen also if "last selected profile" was deleted.
//thus we check if any profile exist and take the first one
// or create a new empty profile and apply this instead
QStringList pList = profileManager->listProfiles();
if(pList.isEmpty()) {
// create a new default profile
ProfileManagement* profileManagement =
&ProfileManagement::instance(tabletId,
tabletInformation.hasDevice(DeviceType::Touch));
profileManagement->createNewProfile(i18nc( "Name of the default profile that will be created if none exists.","Default" ));
if(!profileManagement->availableProfiles().empty()) {
d->currentProfileList.insert(tabletId, profileManagement->availableProfiles().first());
}
else {
qCWarning(KDED) << "Could not create new default profile. There seems to be an error on device detection";
}
}
else {
qCWarning(KDED) << QString::fromLatin1("Tablet profile '%1' does not exist!").arg(profile);
emit notify( QLatin1String( "tabletError" ),
i18n( "Graphic Tablet error" ),
i18n( "Profile %1 does not exist. Apply %2 instead", profile, pList.first() ) );
// set first known profile instead
d->currentProfileList.insert(tabletId, pList.first());
}
tabletProfile = profileManager->loadProfile(d->currentProfileList.value(tabletId));
}
else {
// set profile
d->currentProfileList.insert(tabletId, profile);
}
// Handle auto-rotation.
// This has to be done before screen mapping!
autoRotateTablet(tabletId, tabletProfile);
// Map tablet to screen.
// This is necessary to ensure the correct area map is used. Somone might have changed
// the ScreenSpace property without updating the Area property.
mapTabletToCurrentScreenSpace(tabletId, tabletProfile);
// set profile on tablet
QString currentProfile = d->currentProfileList.value(tabletId);
d->tabletBackendList.value(tabletId)->setProfile(tabletProfile);
d->mainConfig.setLastProfile(tabletInformation.getUniqueDeviceId(), currentProfile);
// check profile rotation values and LEDs
profileManager->updateCurrentProfileNumber(currentProfile);
d->tabletBackendList.value(tabletId)->setStatusLED( profileManager->profileNumber( currentProfile ));
+ d->tabletBackendList.value(tabletId)->setStatusLEDBrightness( 32 ); // TODO: Read the brightness from the settings. Add support to the kcmodule GUI for that.
emit profileChanged( tabletId, currentProfile );
}
void TabletHandler::setProperty(const QString &tabletId, const DeviceType& deviceType,
const Property& property, const QString& value)
{
Q_D( TabletHandler );
if (!hasTablet(tabletId)) {
qCWarning(KDED) << QString::fromLatin1("Unable to set property '%1' on device '%2' to '%3' as no device is currently available!").arg(property.key()).arg(deviceType.key()).arg(value);
return;
}
d->tabletBackendList.value(tabletId)->setProperty(deviceType, property, value);
}
QStringList TabletHandler::getProfileRotationList(const QString &tabletId)
{
Q_D( TabletHandler );
if (!hasTablet(tabletId)) {
qCWarning(KDED) << QString::fromLatin1("Unable to get profile rotation list as no device is currently available!");
return QStringList();
}
return d->profileManagerList.value(tabletId)->profileRotationList();
}
void TabletHandler::setProfileRotationList(const QString &tabletId, const QStringList &rotationList)
{
Q_D( TabletHandler );
if (!hasTablet(tabletId)) {
qCWarning(KDED) << QString::fromLatin1("Unable to set profile rotation list as no device is currently available!");
return;
}
d->profileManagerList.value(tabletId)->setProfileRotationList(rotationList);
}
void TabletHandler::autoRotateTablet(const QString &tabletId,
const TabletProfile &tabletProfile,
QString output,
ScreenRotation screenRotation)
{
// determine auto-rotation configuration
DeviceProfile stylusProfile = tabletProfile.getDevice(DeviceType::Stylus);
QString rotateProperty = stylusProfile.getProperty(Property::Rotate);
const ScreenRotation* lookupRotation = ScreenRotation::find(rotateProperty);
ScreenRotation tabletRotation = (lookupRotation != nullptr) ?
*lookupRotation : ScreenRotation::NONE;
bool doAutoInvert = (tabletRotation == ScreenRotation::AUTO_INVERTED);
bool doAutoRotation = (doAutoInvert || tabletRotation == ScreenRotation::AUTO);
if (!doAutoRotation) {
qCDebug(KDED) << "Auto-rotation is disabled in profile settings";
return;
}
ScreenSpace stylusSpace = ScreenSpace(stylusProfile.getProperty(Property::ScreenSpace));
if (!stylusSpace.isMonitor() && QGuiApplication::screens().count() > 1) {
qCDebug(KDED) << "We're not mapped to a specific display, can't determine auto-rotation";
return;
}
if (output.isEmpty()) {
screenRotation = X11Info::getScreenRotation(stylusSpace.toString());
} else if (output != stylusSpace.toString() && QGuiApplication::screens().count() > 1) {
qCDebug(KDED) << "Tablet is mapped to a different screen";
return;
}
// determine new rotation and set it
ScreenRotation newRotation = (doAutoInvert) ? screenRotation.invert() : screenRotation;
qCDebug(KDED) << "Rotate tablet :: " << newRotation.key();
setProperty( tabletId, DeviceType::Stylus, Property::Rotate, newRotation.key() );
setProperty( tabletId, DeviceType::Eraser, Property::Rotate, newRotation.key() );
if(hasDevice(tabletId, DeviceType::Touch)) {
setProperty( tabletId, DeviceType::Touch, Property::Rotate, newRotation.key() );
}
}
bool TabletHandler::hasDevice(const QString &tabletId, const DeviceType& type) const
{
Q_D( const TabletHandler );
return (hasTablet(tabletId) &&
d->tabletInformationList.value(tabletId).hasDevice(type));
}
bool TabletHandler::hasTablet(const QString &tabletId) const
{
Q_D( const TabletHandler );
return (d->tabletBackendList.contains(tabletId) &&
d->tabletBackendList.value(tabletId) != nullptr);
}
void TabletHandler::mapDeviceToOutput(const QString &tabletId,
const DeviceType& device,
const ScreenSpace& screenSpace,
const QString& trackingMode,
TabletProfile& tabletProfile)
{
if (!hasTablet(tabletId) || !hasDevice(tabletId, device)) {
return; // we do not have a tablet or the requested device
}
ScreenSpace screen(screenSpace);
if (screen.isMonitor() &&
(!X11Info::getScreenGeometries().contains(screen.toString())
|| QGuiApplication::screens().count() == 1)) {
/**
* If we we have only one screen, or if the screen number is invalid,
* map to whole desktop.
*/
screen = ScreenSpace::desktop();
}
DeviceProfile deviceProfile = tabletProfile.getDevice(device);
ScreenMap screenMap(deviceProfile.getProperty(Property::ScreenMap));
QString tabletArea = screenMap.getMappingAsString(screen);
setProperty(tabletId, device, Property::Mode, trackingMode);
setProperty(tabletId, device, Property::ScreenSpace, screen.toString());
setProperty(tabletId, device, Property::Area, tabletArea);
deviceProfile.setProperty(Property::Mode, trackingMode);
deviceProfile.setProperty(Property::ScreenSpace, screen.toString());
deviceProfile.setProperty(Property::Area, tabletArea);
tabletProfile.setDevice(deviceProfile);
}
void TabletHandler::mapPenToScreenSpace(const QString &tabletId,
const ScreenSpace& screenSpace,
const QString& trackingMode)
{
Q_D( TabletHandler );
if (!hasTablet(tabletId)) {
return; // we do not have a tablet
}
QString curProfile = d->currentProfileList.value(tabletId);
TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile);
mapDeviceToOutput(tabletId, DeviceType::Stylus, screenSpace, trackingMode, tabletProfile);
mapDeviceToOutput(tabletId, DeviceType::Eraser, screenSpace, trackingMode, tabletProfile);
d->profileManagerList.value(tabletId)->saveProfile(tabletProfile);
}
void TabletHandler::mapTabletToCurrentScreenSpace(const QString &tabletId,
TabletProfile& tabletProfile)
{
Q_D( TabletHandler );
DeviceProfile stylusProfile = tabletProfile.getDevice(DeviceType::Stylus);
DeviceProfile touchProfile = tabletProfile.getDevice(DeviceType::Touch);
QString stylusMode = stylusProfile.getProperty(Property::Mode);
ScreenSpace stylusSpace = ScreenSpace(stylusProfile.getProperty(Property::ScreenSpace));
QString touchMode = touchProfile.getProperty(Property::Mode);
ScreenSpace touchSpace = ScreenSpace(touchProfile.getProperty(Property::ScreenSpace));
mapDeviceToOutput(tabletId, DeviceType::Stylus, stylusSpace, stylusMode, tabletProfile);
mapDeviceToOutput(tabletId, DeviceType::Eraser, stylusSpace, stylusMode, tabletProfile);
mapDeviceToOutput(tabletId, DeviceType::Touch, touchSpace, touchMode, tabletProfile);
d->profileManagerList.value(tabletId)->saveProfile(tabletProfile);
}