diff --git a/autotests/kded/propertyadaptormock.h b/autotests/kded/propertyadaptormock.h
index 92adcbf..e855c62 100644
--- a/autotests/kded/propertyadaptormock.h
+++ b/autotests/kded/propertyadaptormock.h
@@ -1,73 +1,73 @@
/*
* 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 PROPERTYADAPTORMOCK_H
#define PROPERTYADAPTORMOCK_H
#include "propertyadaptor.h"
#include
namespace Wacom
{
/**
* A property adaptor mock template class which can be used for
* any kind of property that uses QString as its key type.
*/
template
class PropertyAdaptorMock : public PropertyAdaptor
{
public:
PropertyAdaptorMock() : PropertyAdaptor() {}
- virtual const QList getProperties() const
+ const QList getProperties() const override
{
return T::ids();
}
- virtual const QString getProperty(const Property& property) const
+ const QString getProperty(const Property& property) const override
{
if (!supportsProperty(property)) {
return QString();
}
return m_properties.value(property.key());
}
- virtual bool setProperty(const Wacom::Property& property, const QString& value)
+ bool setProperty(const Wacom::Property& property, const QString& value) override
{
if (!supportsProperty(property)) {
return false;
}
m_properties.insert(property.key(), value);
return true;
}
- virtual bool supportsProperty(const Property& property) const
+ bool supportsProperty(const Property& property) const override
{
return (T::map(property) != NULL);
}
QMap m_properties;
};
}
#endif
diff --git a/autotests/kded/tabletbackendmock.h b/autotests/kded/tabletbackendmock.h
index 0d1843d..1b16d7c 100644
--- a/autotests/kded/tabletbackendmock.h
+++ b/autotests/kded/tabletbackendmock.h
@@ -1,71 +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();
+ ~TabletBackendMock() override;
- void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor);
+ void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor) override;
- const TabletInformation& getInformation() const;
+ const TabletInformation& getInformation() const override;
- const QString getProperty(const DeviceType& type, const Property& property) const;
+ const QString getProperty(const DeviceType& type, const Property& property) const override;
- void setProfile(const TabletProfile& profile);
+ void setProfile(const TabletProfile& profile) override;
- void setProfile(const DeviceType& deviceType, const DeviceProfile& profile);
+ void setProfile(const DeviceType& deviceType, const DeviceProfile& profile) override;
- void setStatusLED(int led);
+ void setStatusLED(int led) override;
- void setStatusLEDBrightness(int brightness);
+ void setStatusLEDBrightness(int brightness) override;
- bool setProperty(const DeviceType& type, const Property& property, const QString& value);
+ bool setProperty(const DeviceType& type, const Property& property, const QString& value) override;
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/autotests/kded/tablethandlermock.h b/autotests/kded/tablethandlermock.h
index ca54054..73ee263 100644
--- a/autotests/kded/tablethandlermock.h
+++ b/autotests/kded/tablethandlermock.h
@@ -1,90 +1,90 @@
/*
* 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 TABLETHANDLERMOCK_H
#define TABLETHANDLERMOCK_H
#include "tablethandlerinterface.h"
#include "tabletinformation.h"
#include
#include
#include
namespace Wacom
{
class TabletHandlerMock : public TabletHandlerInterface
{
Q_OBJECT
public:
TabletHandlerMock();
- virtual ~TabletHandlerMock();
+ ~TabletHandlerMock() override;
//! Emits a profileChanged signal with the given parameter.
void emitProfileChanged(const QString &tabletId, const QString& profile);
//! Emits a tabletAdded signal with the given parameter.
void emitTabletAdded(const TabletInformation& info);
//! Emits a tabletRemoved signal.
void emitTabletRemoved(const QString &tabletId);
//! Gets the current mock property value no matter which property or device is requested.
- QString getProperty(const QString& tabletId, const DeviceType& deviceType, const Property& property) const;
+ QString getProperty(const QString& tabletId, const DeviceType& deviceType, const Property& property) const override;
//! Returns the mock's profile list.
- QStringList listProfiles(const QString& tabletId);
+ QStringList listProfiles(const QString& tabletId) override;
//! Sets the given profile on the mock and emits a profileChanged signal.
- void setProfile(const QString& tabletId, const QString& profile);
+ void setProfile(const QString& tabletId, const QString& profile) override;
//! Sets the given property value on the mock no matter which device or property is set.
- void setProperty(const QString& tabletId, const DeviceType& deviceType, const Property & property, const QString& value);
+ void setProperty(const QString& tabletId, const DeviceType& deviceType, const Property & property, const QString& value) override;
//! return mock rotation list
- QStringList getProfileRotationList(const QString& tabletId);
+ QStringList getProfileRotationList(const QString& tabletId) override;
//! set mock rotation list
- void setProfileRotationList(const QString& tabletId, const QStringList &rotationList);
+ void setProfileRotationList(const QString& tabletId, const QStringList &rotationList) override;
Q_SIGNALS:
void profileChanged(const QString &tabletId, const QString& profile);
void tabletAdded(const TabletInformation& info);
void tabletRemoved(const QString &tabletId);
public:
QString m_deviceType; //!< The device type a property was set on and the device type a property is returned for.
QString m_property; //!< The property which was set and the property which can be get.
QString m_propertyValue; //!< The property value returned by this mock, no matter which property is requested.
QStringList m_profiles; //!< The list of profiles returned by this mock.
QString m_profile; //!< The profile name returned by this mock.
QStringList m_rotationList; //!< The mock rotation list (only one not one per device)
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/autotests/kded/xinputadaptor/testxinputadaptor.cpp b/autotests/kded/xinputadaptor/testxinputadaptor.cpp
index e7fa1c1..ab2fea9 100644
--- a/autotests/kded/xinputadaptor/testxinputadaptor.cpp
+++ b/autotests/kded/xinputadaptor/testxinputadaptor.cpp
@@ -1,89 +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 "kded/xinputadaptor.h"
#include "kded/xinputproperty.h"
#include "../tabletdependenttest.h"
#include
using namespace Wacom;
/**
* @file testxinputadaptor.cpp
*
* @test UnitTest for ...
*/
class TestXinputAdaptor: public TabletDependentTest
{
Q_OBJECT
protected:
- void initTestCaseDependent();
+ void initTestCaseDependent() override;
private slots:
void testSetProperty();
};
QTEST_MAIN(TestXinputAdaptor)
void TestXinputAdaptor::initTestCaseDependent()
{
TabletInformation info = getTabletInformation();
// check prerequisites
bool isValid = true;
if (info.getDeviceName(DeviceType::Stylus).isEmpty()) {
isValid = false;
}
if (!isValid) {
QSKIP("Can not run test! The currently connected device does not have all prerequisites!", SkipAll);
return;
}
}
void TestXinputAdaptor::testSetProperty()
{
TabletInformation info = getTabletInformation();
QVERIFY(!info.getDeviceName(DeviceType::Stylus).isEmpty());
XinputAdaptor adaptor(info.getDeviceName(DeviceType::Stylus));
QVERIFY(!adaptor.getProperty(Property::CursorAccelProfile).isEmpty());
QVERIFY(!adaptor.getProperty(Property::CursorAccelAdaptiveDeceleration).isEmpty());
QVERIFY(!adaptor.getProperty(Property::CursorAccelConstantDeceleration).isEmpty());
QVERIFY(!adaptor.getProperty(Property::CursorAccelVelocityScaling).isEmpty());
adaptor.setProperty(Property::CursorAccelProfile, QLatin1String("2"));
adaptor.setProperty(Property::CursorAccelAdaptiveDeceleration, QLatin1String("5.1"));
adaptor.setProperty(Property::CursorAccelConstantDeceleration, QLatin1String("5.2"));
adaptor.setProperty(Property::CursorAccelVelocityScaling, QLatin1String("5.3"));
QCOMPARE(adaptor.getProperty(Property::CursorAccelProfile), QLatin1String("2"));
QCOMPARE(adaptor.getProperty(Property::CursorAccelAdaptiveDeceleration), QLatin1String("5.1"));
QCOMPARE(adaptor.getProperty(Property::CursorAccelConstantDeceleration), QLatin1String("5.2"));
QCOMPARE(adaptor.getProperty(Property::CursorAccelVelocityScaling), QLatin1String("5.3"));
}
#include "testxinputadaptor.moc"
diff --git a/autotests/kded/xsetwacomadaptor/testxsetwacomadaptor.cpp b/autotests/kded/xsetwacomadaptor/testxsetwacomadaptor.cpp
index 38023cc..d9fe05c 100644
--- a/autotests/kded/xsetwacomadaptor/testxsetwacomadaptor.cpp
+++ b/autotests/kded/xsetwacomadaptor/testxsetwacomadaptor.cpp
@@ -1,82 +1,82 @@
/*
* 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 "kded/xsetwacomadaptor.h"
#include "kded/xsetwacomproperty.h"
#include "../tabletdependenttest.h"
#include
using namespace Wacom;
/**
* @file testxsetwacomadaptor.cpp
*
* @test UnitTest for ...
*/
class TestXsetWacomAdaptor: public TabletDependentTest
{
Q_OBJECT
protected:
- void initTestCaseDependent();
+ void initTestCaseDependent() override;
private slots:
void testSetProperty();
};
QTEST_MAIN(TestXsetWacomAdaptor)
void TestXsetWacomAdaptor::initTestCaseDependent()
{
TabletInformation info = getTabletInformation();
// check prerequisites
bool isValid = true;
if (info.getDeviceName(DeviceType::Stylus).isEmpty()) {
isValid = false;
}
if (!isValid) {
QSKIP("Can not run test! The currently connected device does not have all prerequisites!", SkipAll);
return;
}
}
void TestXsetWacomAdaptor::testSetProperty()
{
XsetwacomAdaptor adaptor(getTabletInformation().getDeviceName(DeviceType::Stylus));
adaptor.setProperty(Property::Button2, QLatin1String("3"));
adaptor.setProperty(Property::Button3, QLatin1String("2"));
QCOMPARE(adaptor.getProperty(Property::Button2), QLatin1String("3"));
QCOMPARE(adaptor.getProperty(Property::Button3), QLatin1String("2"));
adaptor.setProperty(Property::Button2, QLatin1String("2"));
adaptor.setProperty(Property::Button3, QLatin1String("3"));
QCOMPARE(adaptor.getProperty(Property::Button2), QLatin1String("2"));
QCOMPARE(adaptor.getProperty(Property::Button3), QLatin1String("3"));
}
#include "testxsetwacomadaptor.moc"
diff --git a/src/common/configadaptor.h b/src/common/configadaptor.h
index ed26e21..56f0f2b 100644
--- a/src/common/configadaptor.h
+++ b/src/common/configadaptor.h
@@ -1,77 +1,77 @@
/*
* 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 CONFIGADAPTOR_H
#define CONFIGADAPTOR_H
#include "propertyadaptor.h"
#include
namespace Wacom {
/**
* The interface for configuration adapters.
*
* These adapters support direct reading and writing of KDE config groups as
* well as property mapping between configuration file keys and config or
* system properties. In case of a general adapter, an adaptee can be provided
* where all configuration properties will be read from.
*/
class ConfigAdaptor : public PropertyAdaptor {
public:
/**
* Default constructor.
*
* @param adaptee The property adapter where all properties are read from (possibly NULL).
*/
explicit ConfigAdaptor(PropertyAdaptor* adaptee) : PropertyAdaptor(adaptee) {}
/**
* Default destructor
*/
- virtual ~ConfigAdaptor() {}
+ ~ConfigAdaptor() override {}
/**
* Loads a config from the given config group. The default implementation
* does nothing and always returns false.
*
* @param config The configuration group to load the configuration from.
*
* @return True on success, false on error.
*/
virtual bool loadConfig( const KConfigGroup& config ) = 0;
/**
* Save the configuration to a config group. The default implementation
* does nothing and always returns false.
*
* @param config The configuration group to save to configuration in.
*
* @return True on success, false on error.
*/
virtual bool saveConfig( KConfigGroup& config ) const = 0;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/common/deviceprofile.h b/src/common/deviceprofile.h
index 10a837d..82cfed5 100644
--- a/src/common/deviceprofile.h
+++ b/src/common/deviceprofile.h
@@ -1,132 +1,132 @@
/*
* 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 DEVICEPROFILE_H
#define DEVICEPROFILE_H
#include
#include
#include "devicetype.h"
#include "property.h"
#include "propertyadaptor.h"
namespace Wacom {
class DeviceProfilePrivate;
/**
* This class implements the profile of a single device (stylus/eraser/cursor/pad/touch)
*/
class DeviceProfile : public PropertyAdaptor {
public:
/**
* Default constructor
*/
DeviceProfile();
/**
* @param type The type of the device.
*/
explicit DeviceProfile( const DeviceType& type );
/**
* Copy constructor.
*/
DeviceProfile( const DeviceProfile& profile );
/**
* Default destructor
*/
- ~DeviceProfile();
+ ~DeviceProfile() override;
/**
* Copy operator.
*
* @param that The instance to copy.
*
* @return A reference to this instance.
*/
DeviceProfile& operator=(const DeviceProfile& that);
/**
* @return X11 event to which the given button should be mapped.
*/
const QString getButton(int number) const;
Wacom::DeviceType getDeviceType() const;
/**
* Gets the name of this device profile.
* This is the same as getDeviceType().
*
* @return The name of this profile.
*/
const QString& getName() const;
/**
* @return The value of the given property or an empty string.
*/
- const QString getProperty(const Property& key) const;
+ const QString getProperty(const Property& key) const override;
/**
* @return A list of properties supported by this profile.
*/
- const QList getProperties() const;
+ const QList getProperties() const override;
/**
* Sets the button shortcut by button number.
*
* @param number The button number.
* @param shortcut The new button shortcut.
*/
bool setButton(int number, const QString& shortcut);
/**
* Sets the device type of this profile.
*
* @param type The new device type.
*/
void setDeviceType(const DeviceType& type);
/**
* Sets a property.
*
* @param key The property to set.
* @param value The property's value.
*/
- bool setProperty(const Property& key, const QString& value);
+ bool setProperty(const Property& key, const QString& value) override;
/**
* Checks if the given property is supported.
* This does not mean that the property does have a value.
*
* @param property The property to check for.
*/
- bool supportsProperty(const Property& property) const;
+ bool supportsProperty(const Property& property) const override;
private:
Q_DECLARE_PRIVATE( DeviceProfile )
DeviceProfilePrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/common/deviceprofileconfigadaptor.h b/src/common/deviceprofileconfigadaptor.h
index 31e9203..7eac0d2 100644
--- a/src/common/deviceprofileconfigadaptor.h
+++ b/src/common/deviceprofileconfigadaptor.h
@@ -1,71 +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 DEVICEPROFILECONFIGADAPTOR_H
#define DEVICEPROFILECONFIGADAPTOR_H
#include "configadaptor.h"
#include "deviceprofile.h"
#include
namespace Wacom {
/**
* A configuration adapter which can read and write device profiles.
*/
class DeviceProfileConfigAdaptor : public ConfigAdaptor{
public:
/**
* Default constructor
*/
explicit DeviceProfileConfigAdaptor(DeviceProfile& profile);
/**
* Default destructor
*/
- virtual ~DeviceProfileConfigAdaptor();
+ ~DeviceProfileConfigAdaptor() override;
/**
* Loads the device configuration from the given config group and sets
* it on the managed device profile. The name of the device profile
* will not be changed nor will the old properties be cleared before
* setting the new ones.
*
* @param config The config group to read from.
*
* @return True on success, false on error.
*/
- bool loadConfig( const KConfigGroup& config );
+ bool loadConfig( const KConfigGroup& config ) override;
/**
* Saves the device configuration of the currently managed device profile
* to the given config group. The name of the config group will not be
* changed and it will not be cleared before setting the new values.
*
* @param config The config group to write to.
*
* @return True on success, false on error.
*/
- bool saveConfig( KConfigGroup& config ) const;
+ bool saveConfig( KConfigGroup& config ) const override;
};
}
#endif // HEADER PROTECTION
diff --git a/src/common/profilemanagement.h b/src/common/profilemanagement.h
index 379a233..86850e8 100644
--- a/src/common/profilemanagement.h
+++ b/src/common/profilemanagement.h
@@ -1,158 +1,158 @@
/*
* 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 PROFILEMANAGEMENT_H
#define PROFILEMANAGEMENT_H
#include "profilemanagementinterface.h"
#include "profilemanager.h"
#include "deviceprofile.h"
//Qt includes
#include
#include
class KConfigGroup;
class QDBusInterface;
namespace Wacom
{
/**
* The profilemanagement is used as general tablet independent backend to store all parameters per profile
* The KConfig approach is used to store the user data. To apply the profiles the deviceinterface has to
* interpret the profile information into whatever the device backends expect.
* Profiles are saved by tablet name and thus it is possible to have the same profile names for different tablets
*/
class ProfileManagement : public ProfileManagementInterface
{
public:
/**
* Returns the instance of this singleton class.
*
* Asks DBus for the currently active device names
*/
static ProfileManagement& instance();
/**
* @brief Returns a singleton of this class without asking DBus for devicename
*/
static ProfileManagement& instance(const QString &deviceName, bool hasTouch);
- void setTabletId(const QString &tabletId);
+ void setTabletId(const QString &tabletId) override;
/**
* Creates a new profile for the currently detected device and saves it back to the KConfig file
*
* @param profilename name of the profile that will be created
*/
- void createNewProfile(const QString & profilename);
+ void createNewProfile(const QString & profilename) override;
/**
* Returns the KConfigGroup with all available profiles for the current tablet device
*
* This is used to fill the combobox with the profile names, create/delete profiles
* and to update the configuration if something changed.
*
* @return the profile group object that holds all profile information.
*/
- const QStringList availableProfiles();
+ const QStringList availableProfiles() override;
/**
* Deletes the profile from the current connected device.
*
* Should no profile be left a default profile will be created and selected.
*/
- void deleteProfile();
+ void deleteProfile() override;
/**
* Returns a device profile of the currently active tablet profile.
*
* Always returns a device profile of the currently connected tablet. The
* parameter @c device can be one of stylus/pad/eraser/touch or cursor.
*
* @param device The device profile to get.
*
* @return The device profile of the requested device.
*/
- DeviceProfile loadDeviceProfile(const DeviceType& device);
+ DeviceProfile loadDeviceProfile(const DeviceType& device) override;
/**
* Saves the given profile as a device profile of the currently
* active tablet profile.
*
* @param profile The profile to save.
* @return True on success, false on error.
*/
- bool saveDeviceProfile (const DeviceProfile& profile);
+ bool saveDeviceProfile (const DeviceProfile& profile) override;
/**
* Sets the used profile.
*
* If the kcmodule changes the profile the name here should change as well to obtain the
* right config values
*
* @param name Name of the new profile
*/
- void setProfileName(const QString & name);
+ void setProfileName(const QString & name) override;
/**
* Returns the current used profile name.
*
* @return name of the profile in use
*/
- QString profileName() const;
+ QString profileName() const override;
/**
* Reloads the profiles
*
* If the tablet is removed/connected/changed during runtime, this function updates its internal status
*/
- void reload();
+ void reload() override;
private:
/**
* Default constructor.
* This is a singleton class, do not use this constructor, use \a instance() instead.
*/
ProfileManagement();
/**
* Overloaded constructor.
* This is a singleton class, do not use this constructor, use \a instance(deviceName, hasTouch) instead.
*/
ProfileManagement(const QString &deviceName, bool hasTouch);
/**
* This is a singleton, no copying allowed
*/
ProfileManagement(const ProfileManagement&) = delete;
ProfileManagement &operator=(const ProfileManagement&) = delete;
QString m_tabletId;
QString m_vendorId;
QString m_sensorId; /** Stores usb id for child device **/
QString m_deviceName; /**< Cached name of the device so. So we don't have to ask via Dbus every time */
bool m_hasTouch = false;
QString m_profileName; /**< Current selected profile. */
ProfileManager m_profileManager; /**< Manages the profile configuration file */
}; // CLASS
} // NAMESPACE
#endif // PROFILEMANAGEMENT_H
diff --git a/src/common/tabletprofileconfigadaptor.h b/src/common/tabletprofileconfigadaptor.h
index 0d513d9..e8df967 100644
--- a/src/common/tabletprofileconfigadaptor.h
+++ b/src/common/tabletprofileconfigadaptor.h
@@ -1,80 +1,80 @@
/*
* 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 TABLETPROFILECONFIGADAPTOR_H
#define TABLETPROFILECONFIGADAPTOR_H
#include "configadaptor.h"
#include "tabletprofile.h"
namespace Wacom {
class TabletProfileConfigAdaptorPrivate;
/**
* A configuration adapter which can read and write tablet profiles.
*/
class TabletProfileConfigAdaptor : public ConfigAdaptor
{
public:
/**
* Default constructor
*/
explicit TabletProfileConfigAdaptor(TabletProfile& profile);
/**
* Default destructor
*/
- virtual ~TabletProfileConfigAdaptor();
+ ~TabletProfileConfigAdaptor() override;
/**
* Loads a tablet profile from the given config group into the tablet
* profile managed by this adaptor. This will also update the name of
* the managed profile and clear all devices before reading the new data.
*
* The given config group should directly contain all device config
* groups from that tablet.
*
* @param config The config group to read from.
*
* @return True on success, false on error.
*/
- virtual bool loadConfig (const KConfigGroup& config);
+ bool loadConfig (const KConfigGroup& config) override;
/**
* Saves the configuration of the managed tablet profile to the given
* config group. This will clear out all subgroups of the config group
* first. The name of the given config group will not be updated.
*
* @param config The config group to write to.
*
* @return True on success, false on error.
*/
- virtual bool saveConfig (KConfigGroup& config) const;
+ bool saveConfig (KConfigGroup& config) const override;
private:
Q_DECLARE_PRIVATE( TabletProfileConfigAdaptor )
TabletProfileConfigAdaptorPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/dataengine/wacomtabletservice.cpp b/src/dataengine/wacomtabletservice.cpp
index cf9be76..497b2de 100644
--- a/src/dataengine/wacomtabletservice.cpp
+++ b/src/dataengine/wacomtabletservice.cpp
@@ -1,111 +1,111 @@
/*
* Copyright (C) 2015 Weng Xuetian
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "wacomtabletservice.h"
#include "dbustabletinterface.h"
#include "screenrotation.h"
#include
#include
using namespace Wacom;
class WacomTabletJob : public Plasma::ServiceJob
{
Q_OBJECT
public:
- WacomTabletJob(const QString& destination, const QString& operation, const QMap< QString, QVariant >& parameters, QObject* parent = 0) : ServiceJob(destination, operation, parameters, parent) {
+ WacomTabletJob(const QString& destination, const QString& operation, const QMap< QString, QVariant >& parameters, QObject* parent = nullptr) : ServiceJob(destination, operation, parameters, parent) {
}
- virtual void start() {
+ virtual void start() override {
if (!DBusTabletInterface::instance().isValid()) {
return;
}
const auto op = operationName();
if (op == QLatin1Literal("RunKCM")) {
QProcess::startDetached(QLatin1Literal("kcmshell5"), QStringList() << QLatin1Literal("wacomtablet"));
return;
}
const auto param = parameters();
if (!param.contains(QLatin1Literal("tabletId"))) {
return;
}
const auto tabletId = param[QLatin1Literal("tabletId")].toString();
if (op == QLatin1Literal("SetProfile")) {
if (param.contains(QLatin1Literal("profile"))) {
DBusTabletInterface::instance().setProfile(tabletId, param[QLatin1Literal("profile")].toString());
}
} else if (op == QLatin1Literal("SetStylusMode")) {
if (param.contains(QLatin1Literal("mode"))) {
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Stylus.key(), Property::Mode.key(), param[QLatin1Literal("mode")].toString());
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Eraser.key(), Property::Mode.key(), param[QLatin1Literal("mode")].toString());
}
} else if (op == QLatin1Literal("SetRotation")) {
if (param.contains(QLatin1Literal("rotation"))) {
const auto rotationName = param[QLatin1Literal("rotation")].toString();
const ScreenRotation* rotation = nullptr;
if (rotationName == QLatin1Literal("none")) {
rotation = &ScreenRotation::NONE;
} else if (rotationName == QLatin1Literal("cw")) {
rotation = &ScreenRotation::CW;
} else if (rotationName == QLatin1Literal("ccw")) {
rotation = &ScreenRotation::CCW;
} else if (rotationName == QLatin1Literal("half")) {
rotation = &ScreenRotation::HALF;
}
if (rotation) {
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Stylus.key(), Property::Rotate.key(), rotation->key());
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Eraser.key(), Property::Rotate.key(), rotation->key());
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Touch.key(), Property::Rotate.key(), rotation->key());
}
}
} else if (op == QLatin1Literal("SetTouchMode")) {
if (param.contains(QLatin1Literal("enable"))) {
DBusTabletInterface::instance().setProperty(tabletId, DeviceType::Touch.key(), Property::Touch.key(), param[QLatin1Literal("enable")].toBool() ? QLatin1String( "on" ) : QLatin1String( "off" ));
}
}
}
};
WacomTabletService::WacomTabletService(const QString& destination, QObject* parent): Service(parent)
{
setName(QLatin1Literal("wacomtablet"));
setObjectName(destination);
setDestination(destination);
setOperationEnabled(QLatin1Literal("SetProfile"), true);
setOperationEnabled(QLatin1Literal("SetStylusMode"), true);
setOperationEnabled(QLatin1Literal("SetRotation"), true);
setOperationEnabled(QLatin1Literal("SetTouchMode"), true);
}
WacomTabletService::~WacomTabletService()
{
}
Plasma::ServiceJob* WacomTabletService::createJob(const QString& operation, QMap< QString, QVariant >& parameters)
{
return new WacomTabletJob(destination(), operation, parameters, this);
}
#include "wacomtabletservice.moc"
diff --git a/src/dataengine/wacomtabletservice.h b/src/dataengine/wacomtabletservice.h
index cb0b3d1..38897d5 100644
--- a/src/dataengine/wacomtabletservice.h
+++ b/src/dataengine/wacomtabletservice.h
@@ -1,36 +1,36 @@
/*
* Copyright (C) 2015 Weng Xuetian
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef WACOMTABLETSERVICE_H
#define WACOMTABLETSERVICE_H
#include
class WacomTabletService : public Plasma::Service
{
Q_OBJECT
public:
WacomTabletService(const QString &destination,
QObject *parent = 0);
- ~WacomTabletService();
+ ~WacomTabletService() override;
protected:
Plasma::ServiceJob *createJob(const QString &operation,
QMap ¶meters) Q_DECL_OVERRIDE;
};
#endif // WACOMTABLETSERVICE_H
diff --git a/src/kcmodule/areaselectionwidget.h b/src/kcmodule/areaselectionwidget.h
index a8af27d..40c7d0f 100644
--- a/src/kcmodule/areaselectionwidget.h
+++ b/src/kcmodule/areaselectionwidget.h
@@ -1,431 +1,431 @@
/*
* 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 AREASELECTIONWIDGET_H
#define AREASELECTIONWIDGET_H
#include
#include
#include
#include
#include
class QBrush;
class QPainter;
namespace Wacom
{
class AreaSelectionWidgetPrivate;
class AreaSelectionWidget : public QWidget
{
Q_OBJECT
public:
bool paintBelow{false};
explicit AreaSelectionWidget(QWidget* parent = 0);
- virtual ~AreaSelectionWidget();
+ ~AreaSelectionWidget() override;
/**
* Resets the selection back to the full size.
*/
void clearSelection();
/**
* Gets the currently selected area.
*
* @return The currently selected area.
*/
const QRect getSelection() const;
/**
* Returns the current selection as string.
* Format is: "x y width height"
*
* @return The current selection as string.
*/
const QString getSelectionAsString() const;
/**
* @return The virtual area rectangle which is the union of all areas currently set.
*/
const QRect& getVirtualArea() const;
/**
* Sets the area which should be scaled and displayed to the user.
*
* @param area The area to scale and present to the user.
* @param caption An optional caption which is drawn in the center of the area.
*/
void setArea(const QRect& area, const QString& caption);
/**
* Sets the areas which should be scaled and displayed to the user.
* All areas will be united and displayed as one big area to the user.
* Therefore the areas should be adjacent or overlapping.
*
* @param areas The areas to display to the user.
* @param areaCaptions Optional captions to draw in the center of each area.
*/
void setAreas(const QMap &areas, const QStringList& areaCaptions);
/**
* Enables or disables drawing of area captions.
*
* @param value True to draw area captions, false to not draw them.
*/
void setDrawAreaCaptions(bool value);
/**
* Enables or disables drawing of the selection area caption.
*
* @param value True to draw caption, false to not draw it.
*/
void setDrawSelectionCaption(bool value);
/**
* Sets the font used to draw all captions.
*
* @param font The font used for captions.
*/
void setFont(const QFont& font);
/**
* Sets the out of bounds margin in pixels or as a percentage.
* The out of bounds margin is the amount of pixels, the user is
* allowed to drag the selected area outside the bounds of the
* displayed area. The margin has to be given as a percentage value
* or as a positive value in real size pixels.
*
* @param margin A percentage (0. - 1.0) or a positive value in pixels.
*/
void setOutOfBoundsMargin(qreal margin);
/**
* Selects an area.
*
* @param selection The area to select.
* @param emitUpdate Whether to emit the update signal.
*/
void setSelection(const QRect& selection, bool emitUpdate);
/**
* Selects an area by area index. This is the index from the list
* the widget was initialized with.
*
* @param output The list index of the sub-area to select.
*/
void setSelection(QString output);
/**
* Sets the widget's target size. This is only a hint for the widget
* to determine the approximate size it should target for when scaling the
* areas. As long as the ratio does not fit to the ratio of the displayed
* area, only one value will be used. The other value will be scaled up
* or down to fit the ratio of the displayed area.
*
* @param size The widget's target size (Default: 400x400)
*/
void setWidgetTargetSize(const QSize& size);
void lockProportions(bool enable);
signals:
/**
* Emitted whenever the selected area changes.
*/
void selectionChanged();
protected:
/**
* Overridden QWidget method which captures mouse movements.
*/
- virtual void mouseMoveEvent ( QMouseEvent * event );
+ void mouseMoveEvent ( QMouseEvent * event ) override;
/**
* Overridden QWidget method which captures mouse button press events.
*/
- virtual void mousePressEvent ( QMouseEvent * event );
+ void mousePressEvent ( QMouseEvent * event ) override;
/**
* Overridden QWidget method which captures mouse button release events.
*/
- virtual void mouseReleaseEvent ( QMouseEvent * event );
+ void mouseReleaseEvent ( QMouseEvent * event ) override;
/**
* Overridden QWidget method which paints the widget.
*/
- virtual void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
private:
/**
* The current dragging mode which determines if the
* user is dragging one of the border handles or the
* whole area with the mouse.
*/
enum class DragMode {
DragNone, //!< The user is currently not dragging.
DragSelectedArea, //!< The user drags the whole selection area.
DragTopHandle, //!< The user drags the top border handle.
DragRightHandle, //!< The user drags the right border handle.
DragBottomHandle, //!< The user drags the bottom border handle.
DragLeftHandle //!< The user drags the left border handle.
};
/**
* Calculates the size and position of the area which is displayed
* to the user according to the given virtual area, a scale factor
* and an optional margin.
*
* @param virtualArea The virtual area to calculate the display area for.
* @param scaleFactor The scale factor which is applied to the virtual area.
* @param totalDisplayAreaMargin The total display area margin.
*/
const QRectF calculateDisplayArea(const QRect& virtualArea, qreal scaleFactor, qreal totalDisplayAreaMargin) const;
/**
* Calculates the size and position of the display sub-areas which
* make up the whole display area.
*
* @param areas The display sub-areas.
* @param scaleFactor The scale factor which is applied to the areas.
* @param totalDisplayAreaMargin The total display area margin.
*/
const QList< QRectF > calculateDisplayAreas(const QMap areas, qreal scaleFactor, qreal totalDisplayAreaMargin) const;
/**
* Calculates the out of bounds margin for the virtual area.
*
* @param virtualArea The virtual area to calculate the oob margin for.
* @param outOfBoundMargin A percentage (0-1.0) or a value in pixels (>1).
*
* @return The out ouf bounds margin in virtual area pixels.
*/
qreal calculateOutOfBoundsVirtualAreaMargin(const QRect& virtualArea, qreal outOfBoundsMargin) const;
/**
* Calculates a scaling factor based on a widget target size and the
* given virtual area.
*
* @param targetSize The target size of this widget.
* @param virtualArea The virtual area to calculate the scaling factor for.
* @param virtualAreaOutOfBoundsMargin The out of bounds margin of the virtual area.
* @param displayAreaExtraMargin An extra margin for the display area.
*
* @return The scaling factor for the given target size.
*/
qreal calculateScaleFactor(const QSize& targetSize, const QRect& virtualArea, qreal virtualAreaOutOfBoundsMargin, qreal displayAreaExtraMargin) const;
/**
* Calculates a scaled version of the given area.
*
* @param area The area to scale.
* @param scaleFactor The scale factor which is applied to the area.
* @param margin An optional margin around the display area.
*
* @return The scaled area.
*/
const QRectF calculateScaledArea(const QRect& area, qreal scaleFactor, qreal totalDisplayAreaMargin) const;
/**
* Unscales a scaled area.
*
* @param area The area to unscale.
* @param scaleFactor The scale factor which was applied to the area.
* @param margin An optional margin around the display area.
*
* @return The unscaled area.
*/
const QRect calculateUnscaledArea(const QRectF& area, qreal scaleFactor, qreal totalDisplayAreaMargin) const;
/**
* Calculates the size of the virtual area.
*
* @param areas A list of areas to calculate the virtual area for.
*
* @return The size of the virtual area as rectangle.
*/
const QRect calculateVirtualArea(const QMap &areas) const;
/**
* Returns the total margin of the display area. This is the out of bounds
* margin plus any additional margin which might be applied around the widget.
*
* @return The total display area margin.
*/
qreal getTotalDisplayAreaMargin() const;
/**
* Determines if the user is currently dragging a handle or
* the selected area with the mouse.
*
* @return True if user is dragging, else false.
*/
bool isUserDragging() const;
/**
* Paints the captions of the display areas.
*
* @param painter The painter to use.
*/
void paintDisplayAreaCaptions(QPainter& painter);
/**
* Paints the display area and all of its sub-areas.
*
* @param painter The painter to use.
* @param outlineOnly A flag if only the outline should be painted.
*/
void paintDisplayAreas(QPainter& painter, bool outlineOnly);
/**
* Paints the drag handles.
*
* @param painter The painter to use.
*/
void paintDragHandles(QPainter& painter);
/**
* Paints the selected area.
*
* @param painter The painter to use.
*/
void paintSelectedArea(QPainter& painter, bool outlineOnly);
/**
* Paints the size of the selected area as string.
*
* @param painter The painter to sue.
*/
void paintSelectedAreaCaption(QPainter& painter);
/**
* Sets up the widget. Can be called anytime to recalculate the display area size.
*/
void setupWidget();
/**
* Recalculates the positions of the drag handles.
*/
void updateDragHandles();
/**
* Updates the mouse cursor according to the mouse's position.
*
* @param mousePosition The current position of the mouse.
*/
void updateMouseCursor(const QPoint& mousePosition);
/**
* Updates the selected area when the user drags it.
*/
void updateSelectedAreaOnDrag(const QPoint& mousePosition);
/**
* Updates the selected area when the user is moving it.
*
* @param mousePosition The current mouse position where the user wants to move the selection to.
*/
void updateSelectedAreaOnDragArea(const QPoint& mousePosition);
/**
* Updates the selected area when the user is dragging with the bottom handle.
*
* @param mousePosition The current mouse position where the user wants to have the new border set.
*/
void updateSelectedAreaOnDragBottom(const QPoint& mousePosition);
/**
* Updates the selected area when the user is dragging with the left handle.
*
* @param mousePosition The current mouse position where the user wants to have the new border set.
*/
void updateSelectedAreaOnDragLeft(const QPoint& mousePosition);
/**
* Updates the selected area when the user is dragging with the right handle.
*
* @param mousePosition The current mouse position where the user wants to have the new border set.
*/
void updateSelectedAreaOnDragRight(const QPoint& mousePosition);
/**
* Updates the selected area when the user is dragging with the top handle.
*
* @param mousePosition The current mouse position where the user wants to have the new border set.
*/
void updateSelectedAreaOnDragTop(const QPoint& mousePosition);
/**
* Asserts that the selected area is not wider or higher than the display area.
* Updates the selected area accordingly.
*
* @param fixPositionInsteadOfSize Fix x and y value instead of the width and height of the selection.
*/
void updateSelectedAreaSize(bool fixPositionInsteadOfSize = false);
Q_DECLARE_PRIVATE(AreaSelectionWidget)
AreaSelectionWidgetPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/buttonactiondisplaywidget.h b/src/kcmodule/buttonactiondisplaywidget.h
index 1e92489..cdc9520 100644
--- a/src/kcmodule/buttonactiondisplaywidget.h
+++ b/src/kcmodule/buttonactiondisplaywidget.h
@@ -1,51 +1,51 @@
/*
* 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 BUTTONACTIONDISPLAYWIDGET_H
#define BUTTONACTIONDISPLAYWIDGET_H
#include
class QFocusEvent;
class QMouseEvent;
namespace Wacom {
class ButtonActionDisplayWidget : public QLineEdit {
Q_OBJECT
public:
explicit ButtonActionDisplayWidget(QWidget* parent = 0);
- virtual ~ButtonActionDisplayWidget();
+ ~ButtonActionDisplayWidget() override;
signals:
void mousePressed();
protected:
- virtual void focusInEvent ( QFocusEvent* e );
+ void focusInEvent ( QFocusEvent* e ) override;
- virtual void mousePressEvent ( QMouseEvent* e );
+ void mousePressEvent ( QMouseEvent* e ) override;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/buttonactionselectiondialog.h b/src/kcmodule/buttonactionselectiondialog.h
index 63f55fc..2898b08 100644
--- a/src/kcmodule/buttonactionselectiondialog.h
+++ b/src/kcmodule/buttonactionselectiondialog.h
@@ -1,73 +1,73 @@
/*
* 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 BUTTONACTIONSELECTIONDIALOG_H
#define BUTTONACTIONSELECTIONDIALOG_H
#include
namespace Wacom {
class ButtonShortcut;
class ButtonActionSelectionDialogPrivate;
/**
* A dialog which displays the button action selection widget.
*/
class ButtonActionSelectionDialog : public QDialog
{
Q_OBJECT
public:
explicit ButtonActionSelectionDialog(QWidget* parent = 0);
- virtual ~ButtonActionSelectionDialog();
+ ~ButtonActionSelectionDialog() override;
/**
* Gets the shortcut which was selected by the user. If the
* user canceled the dialog, the last shortcut which was set
* using \a setShortcut(const ButtonShortcut&) will be returned.
*
* @return The selected button shortcut.
*/
const ButtonShortcut& getShortcut() const;
/**
* Sets a button shortcut.
*
* @param shortcut The shortcut to set.
*/
void setShortcut(const ButtonShortcut& shortcut);
private slots:
/**
* Called when the user confirms the dialog with the OK button.
*/
void onOkClicked();
private:
Q_DECLARE_PRIVATE(ButtonActionSelectionDialog)
ButtonActionSelectionDialogPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/buttonactionselectionwidget.h b/src/kcmodule/buttonactionselectionwidget.h
index a0ab568..70da9c1 100644
--- a/src/kcmodule/buttonactionselectionwidget.h
+++ b/src/kcmodule/buttonactionselectionwidget.h
@@ -1,142 +1,142 @@
/*
* 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 BUTTONACTIONSELECTIONWIDGET_H
#define BUTTONACTIONSELECTIONWIDGET_H
#include
class QCheckBox;
class QKeySequence;
namespace Ui {
class ButtonActionSelectionWidget;
}
namespace Wacom {
class ButtonShortcut;
class ButtonActionSelectionWidgetPrivate;
class ButtonActionSelectionWidget : public QWidget
{
Q_OBJECT
public:
explicit ButtonActionSelectionWidget(QWidget* parent = 0);
- virtual ~ButtonActionSelectionWidget();
+ ~ButtonActionSelectionWidget() override;
/**
* @return The currently selected shortcut.
*/
const ButtonShortcut& getShortcut() const;
/**
* Sets a shortcut.
*
* @param shortcut The shortcut to set.
*/
void setShortcut (const ButtonShortcut& shortcut);
private slots:
/**
* Called when one of the clear buttons is clicked.
*/
void onClearButtonClicked (bool checked);
/**
* Called when the keyboard shortcut sequence is modified.
*/
void onShortcutChanged (QKeySequence sequence);
/**
* Called when the user tries to select the action text.
*/
void onActionLineEditSelectionChanged();
/**
* Called when the state of a modifier checkbox changes.
*/
void onModifierChanged (int state);
/**
* Called when the mouse button selection was changed.
*/
void onMouseSelectionChanged (int index);
private:
/**
* Sets up the user interface. This should only be called once by the constructor.
*/
void setupUi();
/**
* Determines a name for the current shortcut and updates the
* name widget. This will also take into account global shortcuts.
*
* @param shortcut The current shortcut.
*/
void updateCurrentActionName (const ButtonShortcut& shortcut);
/**
* Updates the modifier selection widgets for the current shortcut.
* While the update is in progress all signals will be blocked.
*
* @param shortcut The current shortcut.
*/
void updateModifierWidgets (const ButtonShortcut& shortcut);
/**
* Updates the mouse button selection for the current shortcut.
* While the update is in progress all signals will be blocked.
*
* @param shortcut The current shortcut.
*/
void updateMouseButtonSeletion (const ButtonShortcut& shortcut);
/**
* Updates the checked state of a QCheckBox. While the
* update is in progress all signals will be blocked.
*
* @param checkbox The checkbox to update.
* @param isChecked A flag to signal if the checkbox is checked.
*/
void updateQCheckBox (QCheckBox& checkbox, bool isChecked) const;
/**
* Updates the keyboard shortcut widget according to the current shortcut.
* While the update is in progress all shortcut widgets will be blocked.
*
* @param shortcut The current shortcut.
*/
void updateShortcutWidgets (const ButtonShortcut& shortcut);
Q_DECLARE_PRIVATE(ButtonActionSelectionWidget)
ButtonActionSelectionWidgetPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/buttonactionselectorwidget.h b/src/kcmodule/buttonactionselectorwidget.h
index b8523e8..143af6e 100644
--- a/src/kcmodule/buttonactionselectorwidget.h
+++ b/src/kcmodule/buttonactionselectorwidget.h
@@ -1,73 +1,73 @@
/*
* 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 BUTTONACTIONSELECTORWIDGET_H
#define BUTTONACTIONSELECTORWIDGET_H
#include
#include "buttonshortcut.h"
namespace Wacom {
class ButtonActionSelectorWidgetPrivate;
class ButtonActionSelectorWidget : public QWidget
{
Q_OBJECT
public:
explicit ButtonActionSelectorWidget( QWidget *parent = 0 );
- virtual ~ButtonActionSelectorWidget();
+ ~ButtonActionSelectorWidget() override;
const ButtonShortcut& getShortcut() const;
void setShortcut (const ButtonShortcut& shortcut);
signals:
void buttonActionChanged (const ButtonShortcut& shortcut);
private slots:
void onButtonActionSelectorClicked();
void onLineEditSelectionChanged();
private:
void setupUi();
void updateActionName (const ButtonShortcut& shortcut);
void updateSelectorButton (const ButtonShortcut& shortcut);
Q_DECLARE_PRIVATE( ButtonActionSelectorWidget )
ButtonActionSelectorWidgetPrivate *const d_ptr; //!< The D-Pointer of this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/buttonpagewidget.h b/src/kcmodule/buttonpagewidget.h
index df511d6..1747746 100644
--- a/src/kcmodule/buttonpagewidget.h
+++ b/src/kcmodule/buttonpagewidget.h
@@ -1,110 +1,110 @@
/*
* 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 BUTTONPAGEWIDGET_H
#define BUTTONPAGEWIDGET_H
//Qt includes
#include
namespace Ui
{
class ButtonPageWidget;
}
class KComboBox;
class QLabel;
namespace Wacom
{
class ButtonShortcut;
class ProfileManagementInterface;
/**
* The PadButton widget contains all settings to assign the buttons on the tablet pad
*
* The available number of buttons as well as the availability of vertical/horizontal strip
* or TouchRing is defined by the wacom_devicelist settings file in the data folder.
*/
class ButtonPageWidget : public QWidget
{
Q_OBJECT
public:
/**
* default constructor
*
* @param parent parent Widget
*/
explicit ButtonPageWidget(QWidget *parent = 0);
/**
* default destructor
*/
- ~ButtonPageWidget();
+ ~ButtonPageWidget() override;
void setTabletId(const QString &tabletId);
/**
* Saves all values to the current profile
*/
void saveToProfile(ProfileManagementInterface &profileManagement);
/**
* Reloads the widget when the status of the tablet device changes (connects/disconnects)
*
*/
void reloadWidget();
public slots:
/**
* Called whenever the profile is switched or the widget needs to be reinitialized.
*
* Updates all values on the widget to the values from the profile.
*/
void loadFromProfile(ProfileManagementInterface &profileManagement);
signals:
/**
* Used to inform the main widget that unsaved changes in the current profile are available
*/
void changed();
private slots:
/**
* Called when a button action changed.
*/
void onButtonActionChanged();
private:
/**
* Sets up the UI. Should only be called once by the constructor.
*/
void setupUi();
private:
Ui::ButtonPageWidget *ui = nullptr;
QString _tabletId;
}; // CLASS
} // NAMESPACE
#endif /*BUTTONPAGEWIDGET_H*/
diff --git a/src/kcmodule/calibrationdialog.h b/src/kcmodule/calibrationdialog.h
index 08399a4..ba73567 100644
--- a/src/kcmodule/calibrationdialog.h
+++ b/src/kcmodule/calibrationdialog.h
@@ -1,87 +1,87 @@
/*
* 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 CALIBRATIONDIALOG_H
#define CALIBRATIONDIALOG_H
#include
namespace Wacom {
/**
* @brief
*
*/
class CalibrationDialog : public QDialog {
Q_OBJECT
public:
/**
* @brief Constructs the fullscreen window for the calibration process
*
* @param toolname name of the tool to calibrate (stylus or touch name)
* @param targetScreen screen which is going to be used for calibration
*/
CalibrationDialog(const QString &toolname, const QString &targetScreen);
/**
* @brief Returns the new tablet area
*
* @return Tablet area after calibration
*/
QRect calibratedArea();
protected:
/**
* @brief Draws the cross for the calibration
*
* The user has to hit the center of the cross for the calibration
*
* @param event some additional event details
*/
- void paintEvent( QPaintEvent *event );
+ void paintEvent( QPaintEvent *event ) override;
/**
* @brief Catch mousepress events
*
* Only events inside the calibration cross are recognized. All other are ignored.
*
* @param event mouse press details
*/
- void mousePressEvent( QMouseEvent *event );
+ void mousePressEvent( QMouseEvent *event ) override;
private:
/**
* @brief calculates the new tablet area from all 4 calibration points
*/
void calculateNewArea();
int m_drawCross; /**< Which cross should be drawn? 0=topleft, 1=bottomleft, and so on */
int m_shiftLeft; /**< Where to start the cross from the left */
int m_shiftTop; /**< Where to start the cross from the top */
QString m_toolName; /**< Name of the tool to calibrate (stylus name or touch name) */
QRectF m_originaltabletArea; /**< Original tablet area before calibration */
QRectF m_newtabletArea; /**< Calibrated tablet area */
QPointF m_topLeft; /**< Top left clicked point for calibration */
QPointF m_bottomLeft; /**< Bottom left clicked point for calibration */
QPointF m_topRight; /**< Top right clicked point for calibration */
QPointF m_bottomRight; /**< Bottom right clicked point for calibration */
};
}
#endif // CALIBRATIONDIALOG_H
diff --git a/src/kcmodule/generalpagewidget.h b/src/kcmodule/generalpagewidget.h
index 83d25d3..6ae7774 100644
--- a/src/kcmodule/generalpagewidget.h
+++ b/src/kcmodule/generalpagewidget.h
@@ -1,108 +1,108 @@
/*
* 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 GENERALPAGEWIDGET_H
#define GENERALPAGEWIDGET_H
#include
namespace Ui
{
class GeneralPageWidget;
}
class QDBusInterface;
class KShortcutsEditor;
namespace Wacom
{
class ProfileManagement;
class GlobalActions;
/**
* This class shows some general information about the detected tablet device.
*
* Shows an image and the name plus all detected input devices (pad/stylus/eraser and so on).
* Mainly used as debug output and to help the user to realize that his tablet
* was detected correctly.
*/
class GeneralPageWidget : public QWidget
{
Q_OBJECT
public:
/**
* Default constructor
*
* @param parent the parent widget
*/
explicit GeneralPageWidget(QWidget* parent = 0);
/**
* default destructor
*/
- ~GeneralPageWidget();
+ ~GeneralPageWidget() override;
void setTabletId(const QString &tabletId);
/**
* Saves all values to the current profile
*/
void saveToProfile();
public slots:
/**
* When called the widget information will be refreshed
*/
void reloadWidget();
/**
* Called whenever the profile is switched or the widget needs to be reinitialized.
*
* Updates all values on the widget to the values from the profile.
*/
void loadFromProfile();
/**
* Called whenever a value is changed.
* Fires the changed() signal afterwards to inform the main widget that unsaved changes are available.
*/
void profileChanged();
signals:
/**
* Used to inform the main widget that unsaved changes in the current profile are available.
*/
void changed();
private slots:
void profileUp();
void profileDown();
void profileAdd();
void profileRemove();
private:
Ui::GeneralPageWidget *ui = nullptr;
GlobalActions *_actionCollection = nullptr;
KShortcutsEditor *_shortcutEditor = nullptr;
QString _tabletId;
}; // CLASS
} // NAMESPACE
#endif // GENERALPAGEWIDGET_H
diff --git a/src/kcmodule/kcmwacomtablet.h b/src/kcmodule/kcmwacomtablet.h
index 7170b9f..bccfb0a 100644
--- a/src/kcmodule/kcmwacomtablet.h
+++ b/src/kcmodule/kcmwacomtablet.h
@@ -1,77 +1,77 @@
/*
* 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 KCMWACOMTABLET_H
#define KCMWACOMTABLET_H
// KDE includes
#include
//Qt includes
#include
#include
class QVBoxLayout;
namespace Wacom
{
class AboutData;
class KCMWacomTabletWidget;
/**
* This class is the starting point for the tablet KCModule
* Here everything is initialized and set up in the right way
*/
class KCMWacomTablet : public KCModule
{
Q_OBJECT
public:
/**
* default constructor
*
* @param parent parent widget
* @param args arguments
*/
KCMWacomTablet(QWidget *parent, const QVariantList &);
- virtual ~KCMWacomTablet();
+ ~KCMWacomTablet() override;
/**
* Called when the user hits the default button to reload the saved values from the config file
*/
- void load();
+ void load() override;
/**
* Called when the user hits apply/ok to save the current profile changes
*/
- void save();
+ void save() override;
private slots:
/**
* Initializes the module's user interface.
*/
void initUi();
private:
QPointer m_layout; /**< Basic layout for the module */
QPointer m_tabletWidget; /**< Main widget that holds all other tabs */
bool m_changed; /**< Saves if the profiles are changed or not */
};
}
#endif // KCMWACOMTABLET_H
diff --git a/src/kcmodule/kcmwacomtabletwidget.h b/src/kcmodule/kcmwacomtabletwidget.h
index 0624371..6f70459 100644
--- a/src/kcmodule/kcmwacomtabletwidget.h
+++ b/src/kcmodule/kcmwacomtabletwidget.h
@@ -1,188 +1,188 @@
/*
* 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 KCMWACOMTABLETWIDGET_H
#define KCMWACOMTABLETWIDGET_H
#include
namespace Wacom
{
class KCMWacomTabletWidgetPrivate;
/**
* This class implements the tabletwidget.ui designer file
* It is the skeleton for the tablet settings widget and able to show the used tablet
* as image as well as some basic information. Furthermore this widget holds the KConfig profile
* selector and handles all profiles.
* The subgroup setting widgets for the pad/stylus/eraser are grouped together in an KTabWidget
*/
class KCMWacomTabletWidget : public QWidget
{
Q_OBJECT
public:
/**
* default constructor
*
* @param parent Parent widget
*/
explicit KCMWacomTabletWidget(QWidget *parent = 0);
/**
* default destructor
*/
- ~KCMWacomTabletWidget();
+ ~KCMWacomTabletWidget() override;
/**
* Reloads the profile to its saved values from the config file
* Resets all made changes so far
*/
void reloadProfile();
/**
* Saves the current active profile
* Takes the values from each widget and saves them
*/
void saveProfile();
signals:
/**
* Will be emitted whenever the status of the widget changes to inform the KCModule about it
*
* @param change @c true if config changed @c false if not
*/
void changed(bool change);
public slots:
/**
* Check if dbus service is running and tablets are connected
*
* Shows either error message or the configuration for a selected tablet
*/
void showHideConfig();
void onTabletAdded(const QString &tabletId);
void onTabletRemoved(const QString &tabletId);
void onTabletSelectionChanged();
/**
* Slot that opens up a dialogue to create a new profile for the connected tablet.
* Starting parameter of the profile will be the default params as detected by xsetwacom.
*/
void addProfile();
/**
* Deletes the currently selected profile.
* If the last profile was deleted a new default profile will automatically created.
*/
void delProfile();
/**
* Switch from one profile to another and updates all other widgets.
* This slot will be called from the profile selector combobox.
*
* @param profile The profile name the widget should switch to as written in the KConfig file
*/
void switchProfile(const QString &profile);
/**
* Will be called whenever a parameter of the currently selected profile changed.
* This ensures that changes in the profile will be saved back to the configuration file before
* the program is closed or the profile switched.
* The user is asked if the changes should be saved or thrown away.
*/
void profileChanged();
private:
/**
* Load all connected tablets on startup
*
* Later on use ontanletAdded and onTabletRemoved
*/
void loadTabletInformation();
/**
* Activates the current profile for all connected devices (pen/stylus/eraser)
* Happens when the profile is saved/switched/loaded
*/
void applyProfile();
/**
* Disables the profile selector and hides all configuration tabs.
*/
void hideConfig();
/**
* Hides an error message which was previously shown using showError().
* If no error message is active, nothing is done.
*/
void hideError();
/**
* Initialize the widget
* creates all necessary setting widgets and connects their signals
*/
void setupUi();
/**
* Reloads profiles from the profile manager and loads them into the profile
* selector. If a profile name is given, it will be selected. If no profile
* is given the default widget selection method applies.
*
* @param profile The profile to select (possibly empty)
*
* @return True if a profile was given and it could be set, else false.
*/
bool refreshProfileSelector(const QString& profile = QString());
/**
* Activates the profile selector and show all configuration tabs depending
* on the currently loaded profile. If an error message is currently active,
* it will be hidden.
*/
void showConfig();
/**
* If an error occurs a widget with some additional text is shown instead of the config widget.
* Happens if no tablet device can be found or the kded daemon is not working.
*
* @param errMsg the message that describes the error in more detail
*/
void showError(const QString& errorTitle, const QString & errorMsg, bool showTabletFinderButton = false);
/**
* Shows a dialog which allows the user to save his changes if the currently
* active configuration was changed.
*/
void showSaveChanges();
void showTabletFinder();
void addTabletToSelector(const QString &tabletId);
Q_DECLARE_PRIVATE( KCMWacomTabletWidget )
KCMWacomTabletWidgetPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif /*KCMWACOMTABLETWIDGET_H*/
diff --git a/src/kcmodule/keysequenceinputbutton.h b/src/kcmodule/keysequenceinputbutton.h
index c67ec99..2f87d65 100644
--- a/src/kcmodule/keysequenceinputbutton.h
+++ b/src/kcmodule/keysequenceinputbutton.h
@@ -1,123 +1,123 @@
/*
* 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 KEYSEQUENCEINPUTBUTTON_H
#define KEYSEQUENCEINPUTBUTTON_H
#include
#include
#include
// forward declarations
class QKeySequence;
namespace Wacom
{
// forward declarations
class KeySequenceInputButtonPrivate;
/**
* @class KeySequenceInputButton
*
* @brief A copy of KKeySequenceWidget which returns all modifiers.
*
* This code is mostly copied from KKeySequenceWidget but it allows us to store
* all key codes of the sequence. While the original implementation would convert
* "Shift+1" to "!", this implementation will actually return "Shift+!". The wacom
* driver can not convert shifted keys back to its original key sequence as it
* treats every key as a keycode. Therefore we have to make sure we return every
* key which was pressed.
*/
class KeySequenceInputButton : public QPushButton
{
Q_OBJECT
public:
//! Default Constructor
KeySequenceInputButton(QWidget *parent = 0);
//! Destructor
- virtual ~KeySequenceInputButton();
+ ~KeySequenceInputButton() override;
//! Clears the current sequence.
void clearSequence();
//! Gets the current sequence.
const QKeySequence& getSequence() const;
//! Sets the current sequence.
void setSequence(const QKeySequence& sequence);
Q_SIGNALS:
//! Emitted when the key sequences changes.
void keySequenceChanged(const QKeySequence& sequence);
protected:
//! Cancels shortcut recording.
void cancelRecording();
// overloaded from QPushButton
- virtual bool event (QEvent *event);
+ bool event (QEvent *event) override;
// overloaded from QPushButton
- virtual void keyPressEvent (QKeyEvent *event);
+ void keyPressEvent (QKeyEvent *event) override;
// overloaded from QPushButton
- virtual void keyReleaseEvent (QKeyEvent *event);
+ void keyReleaseEvent (QKeyEvent *event) override;
//! Starts shortcut recording.
void startRecording();
//! Finish shortcut recording.
void stopRecording();
private Q_SLOTS:
void onButtonClicked();
private:
//! Hidden Copy Constructor
KeySequenceInputButton(const KeySequenceInputButton& other) = delete;
//! Hidden Copy Operator
KeySequenceInputButton& operator= (const KeySequenceInputButton& other) = delete;
void recordKey(uint modifierKeys, int keyQt);
void setupUi();
void updateShortcutDisplay();
Q_DECLARE_PRIVATE(KeySequenceInputButton)
const QScopedPointer d_ptr; //!< D-Pointer to private members.
}; // CLASS KeySequenceInputButton
} // NAMESPACE Wacom
#endif // KEYSEQUENCEINPUTBUTTON_H
diff --git a/src/kcmodule/keysequenceinputwidget.h b/src/kcmodule/keysequenceinputwidget.h
index 96e52f3..fd9180e 100644
--- a/src/kcmodule/keysequenceinputwidget.h
+++ b/src/kcmodule/keysequenceinputwidget.h
@@ -1,100 +1,100 @@
/*
* 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 KEYSEQUENCEINPUTWIDGET_H
#define KEYSEQUENCEINPUTWIDGET_H
#include
#include
#include
// forward declarations
class QKeySequence;
namespace Wacom
{
// forward declarations
class KeySequenceInputWidgetPrivate;
/**
* @class KeySequenceInputWidget
*
* @brief A keyboard shortcut input widget similar to KKeySequence.
*
* This class is mostly copied from KKeySequence. However this implementation
* only supports one shortcut and it will not suppress the shift modifier.
* To set a key sequence on a wacom tablet the full sequence is required. The
* original KKeySequence implementation suppresses the shift modifier which
* makes the shortcut useless for xsetwacom.
*/
class KeySequenceInputWidget : public QWidget
{
Q_OBJECT
public:
//! Default Constructor
KeySequenceInputWidget( QWidget *parent = nullptr );
//! Destructor
- virtual ~KeySequenceInputWidget();
+ ~KeySequenceInputWidget() override;
//! Returns the current key sequence.
const QKeySequence& keySequence() const;
public Q_SLOTS:
//! Clears the current key sequence.
void clearKeySequence();
//! Sets the key sequence.
void setKeySequence(const QKeySequence& sequence);
Q_SIGNALS:
//! Emitted when the key sequence changes.
void keySequenceChanged(const QKeySequence& sequence);
private Q_SLOTS:
void onKeySequenceChanged(const QKeySequence& sequence);
private:
//! Copy Constructor
KeySequenceInputWidget(const KeySequenceInputWidget& other) = delete;
//! Copy Operator
KeySequenceInputWidget& operator= (const KeySequenceInputWidget& other) = delete;
Q_DECLARE_PRIVATE(KeySequenceInputWidget)
const QScopedPointer d_ptr; //!< D-Pointer to private members.
}; // CLASS KeySequenceInputWidget
} // NAMESPACE Wacom
#endif // KEYSEQUENCEINPUTWIDGET_H
diff --git a/src/kcmodule/pressurecurvedialog.h b/src/kcmodule/pressurecurvedialog.h
index 779ffed..49d96e1 100644
--- a/src/kcmodule/pressurecurvedialog.h
+++ b/src/kcmodule/pressurecurvedialog.h
@@ -1,106 +1,106 @@
/*
* 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 PRESSURECURVEDIALOG_H
#define PRESSURECURVEDIALOG_H
#include "devicetype.h"
#include
namespace Ui
{
class PressureCurveDialog;
}
class QDBusInterface;
namespace Wacom
{
class PressureCurveWidget;
/**
* This dialog shows the PressureCurveWidget and lets the uses change it on the fly
* The pressure is animated when the suer uses his pen inside the widget
*/
class PressureCurveDialog : public QDialog
{
Q_OBJECT
public:
/**
* default constructor
*
* @param initialValue initial value of the pressure
* @param tabletId tablet identifier
* @param deviceType device type, @see DeviceType
* @param parent parent widget
*/
PressureCurveDialog(const QString &initialValue,
const QString &tabletId,
const DeviceType& deviceType,
QWidget *parent = 0);
/**
* default destructor
*/
- ~PressureCurveDialog();
+ ~PressureCurveDialog() override;
/**
* Returns the changed presscurve control points in the format needed by the xsetwacom settings
*
* @return string version of both control points separated by spaces
*/
QString getControllPoints();
public slots:
/**
* Updates the pen presscurve via the xsetwacom settings and shows the values in the dialog
*
* @param points string version of both control points separated by spaces
*/
void updateControlPoints(const QString & points);
/**
* called when the user accept his changes
*/
- void accept();
+ void accept() override;
/**
* called when the user discards his changes
*/
- void reject();
+ void reject() override;
private:
/**
* Sets the controllpoints to some starting values
*
* @param points starting values in the format as expected by the xssetwacom settings
*/
void setControllPoints(const QString & points);
private:
Ui::PressureCurveDialog *m_ui = nullptr; /**< Handler to the presscurvedialog.ui file */
PressureCurveWidget *m_pressCurve = nullptr; /**< Widget that shows the presscurve and lets him change it */
QString _initialValue;
QString _tabletId;
QString _deviceType;
};
}
#endif // PRESSURECURVEDIALOG_H
diff --git a/src/kcmodule/pressurecurvewidget.h b/src/kcmodule/pressurecurvewidget.h
index 51a10b3..6db46a9 100644
--- a/src/kcmodule/pressurecurvewidget.h
+++ b/src/kcmodule/pressurecurvewidget.h
@@ -1,165 +1,165 @@
/*
* 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 PRESSURECURVEWIDGET_H
#define PRESSURECURVEWIDGET_H
//Qt includes
#include
#include
#include
#include
class QMouseEvent;
class QPaintEvent;
namespace Wacom
{
/**
* This widget implements a visual way to adjust the press curve for wacom tablets
* It shows the beziercurve and two control points to adjust the curve
* Furthermore if Qt detects the tablet device the pressure is animated
* as filled area below the curve to give a better feel what the changes to the press curve mean
* This step is not necessary to change the press curve settings, but a nice visual help.
* Qt relies on the xorg.conf to detect the tablet correctly because it use hardcoded names for it
* name them "stylus", "pen", "eraser" to get it working.
*
* @see http://doc.trolltech.com/4.5/qtabletevent.html
*/
class PressureCurveWidget : public QWidget
{
Q_OBJECT
public:
/**
* default constructor
*
* @param parent the parent widget that holds this one
*/
explicit PressureCurveWidget(QWidget *parent = 0);
/**
* Sets the start values for the bezier presscurve via this control points
*
* @bug if this widget has no fixed size, the width()/height() return the
* the values as specified in the .ui file or when the widget is created
* The automatic layout changes took place before somehow and thus
* leads to a wrong placement of the control points
* @param p1 x value of the first point
* @param p2 y value of the first point
* @param p3 x value of the second point
* @param p4 y value of the second point
*/
void setControlPoints(qreal p1, qreal p2, qreal p3, qreal p4);
protected:
/**
* Called whenever the mouse is pressed in the widget
* Selects the control point if the mouse click was on it
*
* @param event the mouse event
*/
- void mousePressEvent(QMouseEvent * event);
+ void mousePressEvent(QMouseEvent * event) override;
/**
* Drags the control points around
* based on the active selected control point specified in the mousePressEvent
* the selected control point is moved around and changes the presscurve directly
*
* @param event the mouse event
*/
- void mouseMoveEvent(QMouseEvent * event);
+ void mouseMoveEvent(QMouseEvent * event) override;
/**
* Dragging the controlpoint stopped
* Resets the selection of the active control point to move around
*
* @param event the mouse event
*/
- void mouseReleaseEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event) override;
/**
* Changes the position of the controlpoints with the same ratio than the widget resize
* This way the presscurve stays the same all the time
*
* @param event the resize event
*/
- void resizeEvent(QResizeEvent * event);
+ void resizeEvent(QResizeEvent * event) override;
/**
* If the tablet was detected by Qt this animates the pressure as filled area below the presscurve
* Qt detects the tablet only if it was configured via the xorg.conf. Otherwise it does not know about it
* Furthermore the tablet input devices must have the standard names "stylus" and "eraser"
*
* @param event the Tablet event
*/
- void tabletEvent(QTabletEvent * event);
+ void tabletEvent(QTabletEvent * event) override;
/**
* Draws the background grid, controlpoints and the presscurve on the widget
* Does it with antialias support
*
* @param event the paint event
*/
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
/**
* Finds the nearest controlpoint the uses clicks on
* Will be called for mouse and tabletevent and sets m_activePoint
* with the number of the clicked point.
*
* @param pos the position of the mouse/pen click
*/
void setNearestPoint(const QPointF & pos);
/**
* Moves both control points according to the user interaction
* Both points will be changed even if only one is selected
* The reason lies deep in the Linux Wacom driver that expect the beziercurve
* to be this way. So point 2 is always point 1 with mirrored x/y coordinates
*
* @param pos the new position
*/
void moveControlPoint(const QPointF & pos);
signals:
/**
* This signal will be fired if the position of the control points change
* Used to inform the parent widget of this change to be able to display the new values
* Furthermore the changed presscurve will be set via the xsetwacom driver immediatly thus
* allow the user to see the changes in action right now
*
* @param points the presscurve points in a format expected by the xsetwacom driver (like "0 100 0 100")
*/
void controlPointsChanged(const QString & points);
private:
QPointF m_cP1; /**< Control point 1 */
QPointF m_cP2; /**< Control point 2 */
int m_pointSize = 10; /**< Size of the control point */
int m_activePoint = 0; /**< The point that is dragged around */
QColor m_pointColor = Qt::red; /**< Color of the points */
QColor m_curveColor = Qt::black; /**< Color of the curve */
qreal m_pressure = 0; /**< Buffers the current stylus pressure. (0.0 - 1.0) used to animate the pressure */
QColor m_pressAreaColor = Qt::blue; /**< Color of the press indication area */
};
}
#endif // PRESSURECURVEWIDGET_H
diff --git a/src/kcmodule/styluspagewidget.h b/src/kcmodule/styluspagewidget.h
index 9dcc630..b4c80e5 100644
--- a/src/kcmodule/styluspagewidget.h
+++ b/src/kcmodule/styluspagewidget.h
@@ -1,135 +1,135 @@
/*
* 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 STYLUSPAGEWIDGET_H
#define STYLUSPAGEWIDGET_H
#include
namespace Ui {
class StylusPageWidget;
}
namespace Wacom
{
class StylusPageWidgetPrivate;
class ButtonShortcut;
class DeviceProfile;
class DeviceType;
class Property;
class ProfileManagementInterface;
/**
* @brief Provides interface to all settings for the stylus/eraser pen.
*/
class StylusPageWidget : public QWidget
{
Q_OBJECT
public:
explicit StylusPageWidget(QWidget *parent = 0);
- ~StylusPageWidget();
+ ~StylusPageWidget() override;
void setTabletId(const QString &tabletId);
/**
* Called whenever the profile is switched or the widget needs to be reinitialized.
*
* Updates all values on the widget to the values from the profile.
*/
void loadFromProfile(ProfileManagementInterface &profileManagement);
/**
* Reloads the widget when the status of the tablet device changes (connects/disconnects)
*/
void reloadWidget();
/**
* Saves all values to the current profile
*/
void saveToProfile(ProfileManagementInterface &profileManagement);
public slots:
/**
* Opens a dialogue that allows the visual selection of the presscurve
* If Qt detects the tablet (through the xorg.conf file) the changes can be tested
* directly in the dialogue as well
*/
void onChangeEraserPressureCurve();
/**
* Opens a dialogue that allows the visual selection of the presscurve
* If Qt detects the tablet (through the xorg.conf file) the changes can be tested
* directly in the dialogue as well
*/
void onChangeTipPressureCurve();
/**
* Called whenever a value other than the pen buttons is changed.
* Fires the changed() signal afterwards to inform the main widget that unsaved changes are available
*/
void onProfileChanged();
signals:
/**
* Used to inform the main widget that unsaved changes in the current profile are available
*/
void changed();
protected:
const QString getButtonShortcut (const Property& button) const;
const QString getPressureCurve ( const DeviceType& device ) const;
const QString getPressureFeel ( const DeviceType& device ) const;
const QString getTabletPcButton() const;
void setButtonShortcut (const Property& button, const QString& shortcut);
void setPressureCurve (const DeviceType& device, const QString& value);
void setPressureFeel (const DeviceType& device, const QString& value);
void setTabletPcButton (const QString& value);
private:
void savePropertiesToDeviceProfile(DeviceProfile &profile) const;
void openPressureCurveDialog (const DeviceType& deviceType);
/**
* Sets up the user interface widgets. Should only be called once by a constructor.
*/
void setupUi();
private:
QString _tabletId;
Ui::StylusPageWidget *ui = nullptr;
}; // CLASS
} // NAMESPACE
#endif /*STYLUSPAGEWIDGET_H*/
diff --git a/src/kcmodule/tabletareaselectioncontroller.h b/src/kcmodule/tabletareaselectioncontroller.h
index d61957e..e1aa87e 100644
--- a/src/kcmodule/tabletareaselectioncontroller.h
+++ b/src/kcmodule/tabletareaselectioncontroller.h
@@ -1,148 +1,148 @@
/*
* 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 TABLETAREASELECTIONCONTROLLER_H
#define TABLETAREASELECTIONCONTROLLER_H
#include "screenmap.h"
#include "screenrotation.h"
#include "screenspace.h"
#include "tabletarea.h"
#include
#include
namespace Wacom
{
class TabletAreaSelectionControllerPrivate;
class TabletAreaSelectionView;
class TabletAreaSelectionController : public QObject
{
Q_OBJECT
public:
TabletAreaSelectionController();
- virtual ~TabletAreaSelectionController();
+ ~TabletAreaSelectionController() override;
/**
* Get the screen space mapping.
*
* @return The current screen space mapping.
*/
const ScreenMap& getScreenMap();
/**
* @return The current screen space which was selected.
*/
const ScreenSpace getScreenSpace() const;
/**
* Shows the selection for the given screen space.
*/
void select(const ScreenSpace& screenSpace);
/**
* Sets the view. When a view has been set, the controller
* needs to be set up again.
*
* @param view The view to control.
*/
void setView(TabletAreaSelectionView* view);
/**
* Initializes the controller. This method has to be called before the widget
* can be used.
*
* @param mappings The screen mappings of the device we are handling.
* @param deviceName The X11 xinput device name of the device we ware handling.
* @param rotation The currently selected tablet rotation.
*/
void setupController(const ScreenMap& mappings, const QString& deviceName, const ScreenRotation& rotation);
public slots:
/**
* Called by the view when the user wants to calibrate the tablet.
*/
void onCalibrateClicked();
/**
* Called by the view when the user selected the full tablet area.
*/
void onFullTabletSelected();
/**
* Called by the view when the user wants to toggle the screen.
*/
void onScreenToggle();
/**
* Called by the view when the user wants to set screen proportions on his tablet.
*/
void onSetScreenProportions();
/**
* Called by the view when the user selected a tablet area.
*/
void onTabletAreaSelected();
private:
void checkConfigurationForTrackingModeProblems();
const TabletArea convertAreaFromRotation(const TabletArea& tablet, const TabletArea& area, const ScreenRotation& rotation) const;
const TabletArea convertAreaToRotation(const TabletArea& tablet, const TabletArea& area, const ScreenRotation& rotation) const;
const QRect getScreenGeometry(QString output) const;
const TabletArea getMapping(ScreenSpace screenSpace) const;
void setMapping(ScreenSpace screenSpace, const TabletArea& mapping);
/**
* @return True if this controller has a view, else false.
*/
bool hasView() const;
/**
* Sets a selection on the view. This also checks for invalid selections
* and automatically determines if the selection is a full tablet selection
* or a part of the tablet.
*
* @param selection The selection to set.
*/
void setSelection(const TabletArea& selection);
Q_DECLARE_PRIVATE(TabletAreaSelectionController)
TabletAreaSelectionControllerPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/tabletareaselectiondialog.h b/src/kcmodule/tabletareaselectiondialog.h
index 6e4be57..98e1450 100644
--- a/src/kcmodule/tabletareaselectiondialog.h
+++ b/src/kcmodule/tabletareaselectiondialog.h
@@ -1,79 +1,79 @@
/*
* 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 TABLETAREASELECTIONDIALOG_H
#define TABLETAREASELECTIONDIALOG_H
#include "screenmap.h"
#include "screenspace.h"
#include "screenrotation.h"
#include
#include
#include
namespace Wacom
{
class TabletAreaSelectionDialogPrivate;
/**
* A dialog which displays the current screen area selection and lets
* the user map this selection to a tablet area.
*/
class TabletAreaSelectionDialog : public QDialog
{
Q_OBJECT
public:
explicit TabletAreaSelectionDialog();
- virtual ~TabletAreaSelectionDialog();
+ ~TabletAreaSelectionDialog() override;
/**
* Gets the current selection in profile format.
* See TabletAreaSelectionWidget::getSelection() for a list of possible return values.
*
* @return The current selection in profile format.
*/
const ScreenMap& getScreenMap();
const ScreenSpace getScreenSpace() const;
void select(QString output);
void select(const ScreenSpace& screenSpace);
void setupWidget( const ScreenMap& mappings, const QString& deviceName, const ScreenRotation& rotation );
private:
/**
* Sets up the dialog. Must only be called once by a constructor.
*/
void setupUi();
Q_DECLARE_PRIVATE(TabletAreaSelectionDialog)
TabletAreaSelectionDialogPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/tabletareaselectionview.h b/src/kcmodule/tabletareaselectionview.h
index 934138b..57801d1 100644
--- a/src/kcmodule/tabletareaselectionview.h
+++ b/src/kcmodule/tabletareaselectionview.h
@@ -1,224 +1,224 @@
/*
* 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 TABLETAREASELECTIONVIEW_H
#define TABLETAREASELECTIONVIEW_H
#include "tabletarea.h"
#include
#include
#include
#include
namespace Wacom
{
class TabletAreaSelectionViewPrivate;
/**
* A widget which displays the current screen area selection and lets
* the user map this selection to a tablet area.
*/
class TabletAreaSelectionView : public QWidget
{
Q_OBJECT
public:
explicit TabletAreaSelectionView( QWidget* parent = 0 );
- virtual ~TabletAreaSelectionView();
+ ~TabletAreaSelectionView() override;
/**
* @return The current selection as rectangle.
*/
const TabletArea getSelection() const;
/**
* Selects all of the tablet.
*/
void selectFullTablet();
/**
* Selects part of the tablet.
*
* @param selection The part to select, may not be empty.
*/
void selectPartOfTablet(const TabletArea& selection);
/**
* Switches to the given screen and selects the given tablet region.
*
* @param output The name of the screen to switch to.
* @param isDesktop Whether the screen is a desktop screen.
* @param tabletSelection The selection to set on the tablet.
*/
void select(QString output, bool isDesktop, const TabletArea &tabletSelection);
/**
* Shows or hides a warning that the current selection is only
* available in absolute tracking mode.
*
* @param doShow If true the warning is displayed, else it is hidden.
*/
void setTrackingModeWarning(bool doShow);
/**
* Sets up the screen area widget.
*
* @param screenGeometries The X11 geometries of the connected screens.
* @param widgetTargetSize The target size of the screen area widget.
*/
void setupScreens(const QMap &screenGeometries, const QSize &widgetTargetSize);
/**
* Sets up the tablet area widget.
*
* @param geometry The geometry of the tablet.
* @param widgetTargetSize The target size of the tablet area widget.
*/
void setupTablet( const TabletArea& geometry, const QSize& widgetTargetSize );
public slots:
/**
* Called by the UI when the user wants to calibrate the current device.
*/
void onCalibrateClicked();
/**
* Called by the UI when the user wants to adjust the selection to the screen proportions.
*/
void onForceProportionsClicked();
/**
* Called by the UI when the user wants to select the full tablet area.
*/
void onFullTabletSelected(bool checked);
/**
* Called by the UI when the user wants to toggle the screen.
*/
void onScreenToggle();
/**
* Called by the UI when the user wants to select an area of the tablet.
*/
void onTabletAreaSelected(bool checked);
/**
* @brief onLockProportionsToggled
* @param enabled
*/
void onLockProportionsToggled(bool enabled);
void onSelectionChanged();
void onFineTuneValuesChanged(QString);
signals:
/**
* Signals the controller that the user wants to calibrate the tablet.
*/
void signalCalibrateClicked();
/**
* Signals the controller that the user selected the full tablet area.
*/
void signalFullTabletSelection();
/**
* Signals the controller that the user wants to toggle the screen.
*/
void signalScreenToggle();
/**
* Signals the controller that the user wants to set screen proportions.
*/
void signalSetScreenProportions();
/**
* Signals the controller that the user selected a tablet area.
*/
void signalTabletAreaSelection();
protected:
/**
* The available mapping types for the tablet.
*/
enum TabletAreaType {
FullTabletArea, //!< Enables full desktop selection.
PartialTabletArea //!< Enables area selection.
};
/**
* Sets a selection on the tablet based on the given geometry.
* This does not update any other widgets. It only tells the
* area widget to select the specified area. However a check
* is done if the selection is valid. If it is invalid, the full
* area will be selected.
*
* @param selection The geometry of the new selection.
*/
void setSelection(const TabletArea& selection);
/**
* Sets the given mapping type and updates the widgets
* and the selection.
*
* @param type The new mapping type.
*/
void setTabletAreaType(TabletAreaType type);
private:
/**
* Checks if the given selection selects the full tablet area.
*
* @param selection The selection to check.
*
* @return True if the given selection selects the full tablet area, else false.
*/
bool isFullAreaSelection(const TabletArea& selection) const;
/**
* Sets up this widget. Must only be called once by the constructor.
*/
void setupUi();
Q_DECLARE_PRIVATE(TabletAreaSelectionView)
TabletAreaSelectionViewPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/tabletareaselectionwidget.h b/src/kcmodule/tabletareaselectionwidget.h
index b314eba..06ed34e 100644
--- a/src/kcmodule/tabletareaselectionwidget.h
+++ b/src/kcmodule/tabletareaselectionwidget.h
@@ -1,62 +1,62 @@
/*
* 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 TABLETAREASELECTIONWIDGET_H
#define TABLETAREASELECTIONWIDGET_H
#include "screenmap.h"
#include "screenspace.h"
#include "screenrotation.h"
#include
#include
namespace Wacom
{
class TabletAreaSelectionWidgetPrivate;
class TabletAreaSelectionWidget : public QWidget
{
Q_OBJECT
public:
explicit TabletAreaSelectionWidget(QWidget* parent = 0);
- virtual ~TabletAreaSelectionWidget();
+ ~TabletAreaSelectionWidget() override;
const ScreenMap& getScreenMap();
const ScreenSpace getScreenSpace() const;
void select(const ScreenSpace& screenSpace);
void setupWidget( const ScreenMap& mappings, const QString& deviceName, const ScreenRotation& rotation );
private:
void setupUi();
Q_DECLARE_PRIVATE(TabletAreaSelectionWidget)
TabletAreaSelectionWidgetPrivate *const d_ptr; //!< D-Pointer for this class.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/tabletpagewidget.h b/src/kcmodule/tabletpagewidget.h
index 30d2480..8a4cb73 100644
--- a/src/kcmodule/tabletpagewidget.h
+++ b/src/kcmodule/tabletpagewidget.h
@@ -1,258 +1,258 @@
/*
* 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 TABLETPAGEWIDGET_H
#define TABLETPAGEWIDGET_H
#include "screenmap.h"
#include "screenspace.h"
#include "screenrotation.h"
#include
#include
namespace Ui {
class TabletPageWidget;
}
namespace Wacom
{
class ProfileManagementInterface;
/**
* The "Tablet" tab of the main KCM widget.
*/
class TabletPageWidget : public QWidget
{
Q_OBJECT
public:
explicit TabletPageWidget( QWidget *parent = 0 );
- virtual ~TabletPageWidget();
+ ~TabletPageWidget() override;
void setTabletId(const QString &tabletId);
/**
* Loads settings from the current profile and updates the widget accordingly.
*/
void loadFromProfile(ProfileManagementInterface &profileManagement);
/**
* Reinitializes the widget when a new tablet gets connected.
*/
void reloadWidget();
/**
* Saves the current settings to the current profile.
*/
void saveToProfile(ProfileManagementInterface &profileManagement);
public slots:
/**
* Called when the user enables/disables the auto-rotation checkbox.
*/
void onAutoRotateChanged (int state);
/**
* Called when any profile property value changes.
*/
void onProfileChanged();
/**
* Called when the user changes the rotation settings.
*/
void onRotationChanged();
/**
* Called when the user presses the pad tablet mapping button.
*/
void onTabletMappingClicked();
/**
* Called when the state of the absolute tracking mode changes.
*/
void onTrackingModeAbsolute(bool activated);
/**
* Called when the state of the relative tracking mode changes.
*/
void onTrackingModeRelative(bool activated);
signals:
/**
* Emitted when the user changes configuration settings.
*/
void changed();
/**
* Emitted when the rotation changes to inform our other widgets about it.
*/
void rotationChanged(const ScreenRotation& rotation);
protected:
/**
* Gets the current rotation in profile format.
* These are the values returned by ScreenRotation.key().
*
* @return The current rotation in profile format.
*/
const QString getRotation() const;
/**
* @return The current tablet to screen mapping.
*/
const ScreenMap& getScreenMap() const;
/**
* Gets the current tablet area mapping in profile format as
* returned by ScreenMap::toString().
*
* @return The current tablet mapping in profile format.
*/
const QString getScreenMapAsString() const;
/**
* @return The current screen space selection.
*/
const ScreenSpace& getScreenSpace() const;
/**
* Gets the current screen area mapping in profile format.
*
* @return A screen mapping as returned by ScreenSpace::toString().
*/
const QString getScreenSpaceAsString() const;
/**
* Gets the current tracking mode selection.
*
* @return Either "absolute" or "relative".
*/
const QString getTrackingMode() const;
/**
* Checks if auto-rotation or inverted auto-rotation is enabled.
*
* @return True if auto-rotation is enabled, else false.
*/
bool isAutoRotationEnabled() const;
/**
* Check if inverted auto-rotation is enabled.
*
* @return True if inverted auto-rotation is active, else false.
*/
bool isAutoRotateInversionEnabled() const;
/**
* Changes the auto-rotation configuration and updates the widgets.
*
* @param value True to enable auto-rotation, false to disable it.
*/
void setAutoRotationEnabled (bool value);
/**
* Changes the inverted-auto rotation configuration. This will not
* update the auto-rotation flag.
*
* @param value True to enable inverted auto-rotation, false to disable it.
*/
void setAutoRotateInversionEnabled(bool value);
/**
* Sets the auto-rotation settings based on a string in profile format
* and updates all widgets accordingly. Valid values for the parameter
* are all values returned by ScreenRotation::key().
*
* @param value The new rotation in profile format.
*/
void setRotation(const QString& value);
/**
* Sets a new tablet area mapping and updates all widgets accordingly.
*
* @param screenMap The new tablet to screen mapping.
*/
void setScreenMap(const ScreenMap& screenMap);
/**
* Sets a new tablet area mapping and updates all widgets accordingly.
* The given value has to be in profile format as returned by ScreenMap::toString().
*
* @param value The new tablet area mapping in profile format.
*/
void setScreenMap(const QString& value);
/**
* Sets a new screen area mapping and updates all widgets accordingly.
*
* @param screenSpace The new screen space mapping selection.
*/
void setScreenSpace(const ScreenSpace& screenSpace);
/**
* Sets a new screen area mapping and updates all widgets accordingly.
* The given value has to be in profile format as returned by ScreenSpace::toString()
*
* @param value The new screen area mapping selection.
*/
void setScreenSpace(const QString& value);
/**
* Sets the tracking mode and updates all widgets accordingly.
*
* @param value Either "absolute" or "relative"
*/
void setTrackingMode(const QString& value);
private:
/**
* Checks if the current tablet mapping is available for the currently selected
* tracking mode. If it is not available, a warning is displayed to the user.
*/
void assertValidTabletMapping();
/**
* Initializes this widget. Must only be called once by the constructor.
*/
void setupUi();
private:
Ui::TabletPageWidget *ui;
QString _tabletId;
TabletArea _tabletGeometry; // The full tablet area as rectangle.
ScreenMap _screenMap; // The current tablet to screen mapping of the pad.
ScreenSpace _screenSpace; // The current screen mapping of the pad.
QString _deviceNameStylus; // The Xinput name of the stylus device of the current tablet.
QString _deviceNameTouch; // The Xinput name of the touch device of the current tablet.
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kcmodule/touchpagewidget.h b/src/kcmodule/touchpagewidget.h
index 569873a..82279b7 100644
--- a/src/kcmodule/touchpagewidget.h
+++ b/src/kcmodule/touchpagewidget.h
@@ -1,309 +1,309 @@
/*
* 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 TOUCHPAGEWIDGET_H
#define TOUCHPAGEWIDGET_H
#include "screenmap.h"
#include "screenspace.h"
#include "screenrotation.h"
#include
#include
namespace Ui {
class TouchPageWidget;
}
namespace Wacom
{
class ProfileManagementInterface;
/**
* The "Touch" tab of the main KCM widget.
*/
class TouchPageWidget : public QWidget
{
Q_OBJECT
public:
explicit TouchPageWidget(QWidget* parent = 0);
- virtual ~TouchPageWidget();
+ ~TouchPageWidget() override;
void setTabletId(const QString &tabletId);
/**
* Loads settings from the current profile and updates the widget accordingly.
*/
void loadFromProfile(Wacom::ProfileManagementInterface &profileManagement);
/**
* Reinitializes the widget when a new tablet gets connected.
*/
void reloadWidget();
/**
* Saves the current settings to the current profile.
*/
void saveToProfile(ProfileManagementInterface &profileManagement);
public slots:
/**
* Called when the user enables/disables gesture support.
*/
void onGesturesModeChanged(int state);
/**
* Called when any profile property value changes.
*/
void onProfileChanged();
/**
* Called by our TabletPageWidget to inform us that the user changed the rotation settings.
*/
void onRotationChanged(const ScreenRotation& rotation);
/**
* Called when the user presses the touch tablet mapping button.
*/
void onTabletMappingClicked();
/**
* Called when the user enables/disables touch support.
*/
void onTouchModeChanged(int state);
/**
* Called when the state of the absolute tracking mode changes.
*/
void onTrackingModeAbsolute(bool activated);
/**
* Called when the state of the relative tracking mode changes.
*/
void onTrackingModeRelative(bool activated);
signals:
/**
* Emitted when the user changes configuration settings.
*/
void changed();
protected:
/**
* Gets the current value for the gesture support configuration.
*
* @return Either "on" or "off".
*/
const QString getGestureSupportEnabled() const;
/**
* @return The current screen mapping of the touch device.
*/
const ScreenMap& getScreenMap() const;
/**
* Gets the current tablet area mapping in profile format as
* returned by ScreenMap::toString().
*
* @return The current tablet mapping in profile format.
*/
const QString getScreenMapAsString() const;
/**
* @return The current screen space mapping.
*/
const ScreenSpace& getScreenSpace() const;
/**
* Gets the current screen space mapping in profile format.
*
* @return The current screen mapping as returned by ScreenSpace::toString().
*/
const QString getScreenSpaceAsString() const;
/**
* Gets the minimum motion before sending a scroll gesture.
*
* @return A value >= 0 as string.
*/
const QString getScrollDistance() const;
/**
* Gets the current state of the scroll inversion checkbox as string.
*
* @return Either "on" or "off".
*/
const QString getScrollInversion() const;
/**
* Gets the minimum time between taps for a right click.
*
* @return A value >= 0 as string.
*/
const QString getTapTime() const;
/**
* Gets the current value of the touch support configuration.
*
* @return Either "on" or "off".
*/
const QString getTouchSupportEnabled() const;
/**
* Returns the current tracking mode configuration.
*
* @return Either "absolute" or "relative".
*/
const QString getTrackingMode() const;
/**
* Gets the minimum distance for a zoom gesture.
*
* @return A value >= 0 as string.
*/
const QString getZoomDistance() const;
/**
* Checks if gesture support is selected.
*
* @return True if gesture support is enabled, else false.
*/
bool isGesturesSupportEnabled() const;
/**
* Checks if touch support is selected.
*
* @return True if touch support is enabled, else false.
*/
bool isTouchSupportEnabled() const;
/**
* Sets a new value for gesture support and updates all widgets accordingly.
*
* @param value Either true or false.
*/
void setGesturesSupportEnabled(bool value);
void setScreenMap(const ScreenMap& screenMap);
/**
* Sets a new tablet area mapping and updates all widgets accordingly.
* The given value has to be in profile format as returned by ScreenMap::toString().
*
* @param value The new tablet area mapping in profile format.
*/
void setScreenMap(const QString& value);
/**
* Sets a new screen space mapping and updates all widgets accordingly.
*
* @param screenSpace The new screen space mapping selection.
*/
void setScreenSpace(const ScreenSpace& screenSpace);
/**
* Sets a new screen space mapping and updates all widgets accordingly.
* The given value has to be in profile format as returned by ScreenSpace::toString()
*
* @param value The new screen area mapping selection.
*/
void setScreenSpace(const QString& value);
/**
* Sets the minimum motion before sending a scroll gesture and updates
* all widgets accordingly.
*
* @param value A value >= 0 as string.
*/
void setScrollDistance(const QString& value);
/**
* Sets the value of the scroll inversion checkbox.
*
* @param value Either "on" or "off" or empty string.
*/
void setScrollInversion(const QString& value);
/**
* Sets the minimum time between taps for a right click and updates
* all widgets accordingly.
*
* @param value A value >= 0 as string.
*/
void setTapTime(const QString& value);
/**
* Sets the tracking mode and updates all widgets accordingly.
*
* @param value Either "absolute" or "relative"
*/
void setTrackingMode(const QString& value);
/**
* Sets a new value for touch support and updates all widgets accordingly.
*
* @param value Either true or false.
*/
void setTouchSupportEnabled(bool value);
/**
* Sets the minimum distance for a zoom gesture and updates all widgets accordingly.
*
* @param value A value >= 0 as string.
*/
void setZoomDistance(const QString& value);
private:
/**
* Checks if the current tablet mapping is available for the currently selected
* tracking mode. If it is not available, a warning is displayed to the user.
*/
void assertValidTabletMapping();
/**
* Initializes this widget. Must only be called once by a constructor.
*/
void setupUi();
private:
Ui::TouchPageWidget *ui = nullptr;
ScreenRotation _tabletRotation = ScreenRotation::NONE; // The currently selected tablet rotation.
TabletArea _tabletGeometry; // The full touch area as rectangle.
ScreenMap _screenMap; // The current tablet to screen mapping of the touch device.
ScreenSpace _screenSpace; // The current screen mapping of the touch device.
QString _touchDeviceName; // The Xinput name of the touch device of the current tablet.
QString _tabletId;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/dbustabletservice.h b/src/kded/dbustabletservice.h
index 350c1d4..c1f7186 100644
--- a/src/kded/dbustabletservice.h
+++ b/src/kded/dbustabletservice.h
@@ -1,253 +1,253 @@
/*
* 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 DBUSTABLETSERVICE_H
#define DBUSTABLETSERVICE_H
#include "tablethandlerinterface.h"
#include "tabletinformation.h"
#include
#include
#include
namespace Wacom
{
class DBusTabletServicePrivate;
/**
* @brief The D-Bus tablet service.
*
* Handles all D-Bus requests to the tablet daemon and passes them to the
* tablet handler. All work is done by other modules, this class only
* exists to separate the d-bus interface from the business logic and to
* facilitate unit testing.
*/
class DBusTabletService : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.Wacom")
public:
explicit DBusTabletService (TabletHandlerInterface& tabletHandler);
- ~DBusTabletService ();
+ ~DBusTabletService () override;
// d-bus slots
public Q_SLOTS:
/**
* List all connected tablets (by tabletid)
*
* @return StringList of the connected tablets with their id
*/
Q_SCRIPTABLE const QStringList getTabletList() const;
/**
* List of the internal device names (pad/stylus/eraser) as used by xsetwacom command
*
* @param tabletId the ID of the Tablet to check
* @return StringList of the connected input devices
*/
Q_SCRIPTABLE const QStringList getDeviceList(const QString &tabletId) const;
/**
* Gets the name of a device (pad/stylus/...).
*
* @param tabletId the ID of the Tablet to check
* @param device A device as returned by DeviceType::key()
*
* @return The name of the device.
*/
Q_SCRIPTABLE QString getDeviceName(const QString &tabletId, const QString& device) const;
/**
* Gets information from the tablet.
*
* @param tabletId the ID of the Tablet to check
* @param info The type of information.
*
* @return The information value.
*/
Q_SCRIPTABLE QString getInformation(const QString &tabletId, const QString& info) const;
/**
* Returns the current active profile for this tablet.
*
* This is not necessary the real configuration in case some other program changed the tablet
* behaviour. But this is the name of the profile that was used last.
* Can be used to show in the applet as information or as beginning selection in the kcmodule.
*
* @param tabletId the ID of the Tablet to check
* @return name of the last used profile
*/
Q_SCRIPTABLE QString getProfile(const QString &tabletId) const;
/**
* Returns the current value for a specific tablet device (stylus/eraser/pad/...).
*
* @param tabletId the ID of the Tablet to check
* @param deviceType Type of device (stylus/eraser/...) to get the value from.
* @param property The property we are looking for.
*
* @return the value as string
*/
Q_SCRIPTABLE QString getProperty(const QString &tabletId, const QString& deviceType,
const QString& property) const;
/**
* Tells you if the detected tablet has configurable pushbuttons or not
*
* @param tabletId the ID of the Tablet to check
*
* @return @c true if pushbuttons are available and thus the conf dialogue can be shown
* @c false if nothing is available
*/
Q_SCRIPTABLE bool hasPadButtons(const QString &tabletId) const;
/**
* Checks if a tablet is detected and available for further usage
*
* @param tabletId the ID of the Tablet to check
*
* @return @c true if tablet is available, @c false otherwise
*/
Q_SCRIPTABLE bool isAvailable(const QString &tabletId) const;
/**
* Returns a list of all available profiles
*
* This way around the plasma applet does not check the local KConfig file itself
* and can be used as a remote applet.
*
* @param tabletId the ID of the Tablet to check
*
* @return the list of all available profiles
*/
Q_SCRIPTABLE QStringList listProfiles(const QString &tabletId);
/**
* Applies a profile to the tablet device
*
* The profile must exist in the tabletprofilerc file and thus created by the kcmodule.
* Otherwise a notification error is send and shown.
*
* @param tabletId the ID of the Tablet to check
*
* @param profile name of the profile as specified in the tabletprofilesrc file.
*/
Q_SCRIPTABLE void setProfile(const QString &tabletId, const QString& profile);
/**
* Sets the configuration of @p property from @p deviceType to @p value.
*
* @param tabletId the ID of the Tablet to check
* @param deviceType The device type to set the value on.
* @param property The property to set.
* @param value The new value of the property.
*/
Q_SCRIPTABLE void setProperty(const QString &tabletId, const QString & deviceType,
const QString & property, const QString & value);
/**
* Returns the list for the device profile rotation
*
* This list will define which profile will be loaded
* via the global next/prev profile shortcut
*
* @param tabletId the ID of the Tablet to check
*
* @return stringlist with profile names in the rotation
*/
Q_SCRIPTABLE QStringList getProfileRotationList(const QString &tabletId);
/**
* Set the Profile rotation list for this Device
*
* @param tabletId the ID of the Tablet to check
* @param rotationList stringlist with profilenames in the right order
*/
Q_SCRIPTABLE void setProfileRotationList(const QString &tabletId, const QStringList &rotationList);
/**
* @brief Get touch sensor device USB ID
*
* Some tablets report devices with multiple USB IDs (e.g. Cintiq Companion Hybrid)
* Primary device (usually the one containing stylus sensor) should have this set
* to the USB ID of the corresponding secondary device (touch sensor)
*
* @param tabletId of the device to check
* @return tabletId of the touch device
*/
Q_SCRIPTABLE QString getTouchSensorId(const QString &tabletId);
/**
* @brief Reports if this device is a secondary touch sensor
*
* Touch sensor devices shouldn't be visible in the KCM
*
* @param tabletId of the device to check
* @return true if it's a touch sensor
*/
Q_SCRIPTABLE bool isTouchSensor(const QString &tabletId);
// d-bus signals
Q_SIGNALS:
/**
* Emitted if a new tablet is connected and detected
*
* This signal is send via DBus to inform other about the recently added device
*/
Q_SCRIPTABLE void tabletAdded(const QString &tabletId);
/**
* Emitted if a known tablet is removed
*
* This signal is send via DBus to inform other about the recently removed device
*/
Q_SCRIPTABLE void tabletRemoved(const QString &tabletId);
/**
* Emitted when the profile of the device is changed
*
* This signal is send via DBus to inform other about the change
*/
Q_SCRIPTABLE void profileChanged(const QString &tabletId, const QString& profile);
// normal Qt slots
public slots:
//! Has to be called when the current profile was changed.
void onProfileChanged (const QString &tabletId, const QString& profile);
//! Has to be called when a new tablet is added.
void onTabletAdded (const TabletInformation& info);
//! Has to be called when the current tablet is removed.
void onTabletRemoved (const QString &tabletId);
private:
Q_DECLARE_PRIVATE(DBusTabletService)
DBusTabletServicePrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/eventnotifier.h b/src/kded/eventnotifier.h
index dda92d4..4871025 100644
--- a/src/kded/eventnotifier.h
+++ b/src/kded/eventnotifier.h
@@ -1,79 +1,79 @@
/*
* 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 EVENTNOTIFIER_H
#define EVENTNOTIFIER_H
#include "screenrotation.h"
#include
namespace Wacom
{
/**
* Event notifier which registers with the window system and sends
* events when tablets are connected/removed or the screen is
* rotated.
*
* This interface only exists so we can create a mock object for unit testing.
*/
class EventNotifier : public QWidget
{
Q_OBJECT
public:
- virtual ~EventNotifier();
+ ~EventNotifier() override;
//! Registers the notifier with the window system.
virtual void start() = 0;
//! Unregisters the notifier from the window system.
virtual void stop() = 0;
Q_SIGNALS:
/**
* Emitted when a new tablet is connected.
*
* @param deviceId The tablet identifier gathered from the window system.
*/
void tabletAdded (int deviceId);
/**
* Emitted when a tablet is removed.
*
* @param deviceId The device that was removed by identifier.
*/
void tabletRemoved (int deviceId);
/**
* Emitted when the screen is rotated.
*
* @param screenRotation The rotation direction.
*/
void screenRotated (const ScreenRotation& screenRotation);
protected:
explicit EventNotifier(QWidget *parent = 0);
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/procsystemadaptor.h b/src/kded/procsystemadaptor.h
index e2d918e..a9fb817 100644
--- a/src/kded/procsystemadaptor.h
+++ b/src/kded/procsystemadaptor.h
@@ -1,73 +1,73 @@
/*
* 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 PROCSYSTEMADAPTOR_H
#define PROCSYSTEMADAPTOR_H
#include
#include
#include "propertyadaptor.h"
namespace Wacom {
// Forward Declarations
class ProcSystemProperty;
class ProcSystemAdaptorPrivate;
/**
* A property adaptor which uses the proc system to set LED properties on a device.
*/
class ProcSystemAdaptor : public PropertyAdaptor
{
public:
//! Default constructor.
explicit ProcSystemAdaptor(const QString& deviceName);
//! Destructor
- virtual ~ProcSystemAdaptor();
+ ~ProcSystemAdaptor() override;
/**
* @sa PropertyAdaptor::getProperties()
*/
- const QList getProperties() const;
+ const QList getProperties() const override;
/**
* @sa PropertyAdaptor::getProperty(const Property&)
*/
- const QString getProperty(const Property& property) const;
+ const QString getProperty(const Property& property) const override;
/**
* @sa PropertyAdaptor::setProperty(const Property&, const QString&)
*/
- bool setProperty(const Wacom::Property& property, const QString& value);
+ bool setProperty(const Wacom::Property& property, const QString& value) override;
/**
* @sa PropertyAdaptor::supportsProperty(const Property&)
*/
- bool supportsProperty(const Property& property) const;
+ bool supportsProperty(const Property& property) const override;
private:
Q_DECLARE_PRIVATE( ProcSystemAdaptor )
ProcSystemAdaptorPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tabletbackend.h b/src/kded/tabletbackend.h
index abfcd21..ef2b9f8 100644
--- a/src/kded/tabletbackend.h
+++ b/src/kded/tabletbackend.h
@@ -1,96 +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 added to the backend.
*/
class TabletBackend : public TabletBackendInterface
{
public:
explicit TabletBackend(const TabletInformation& tabletInformation);
- virtual ~TabletBackend();
+ ~TabletBackend() override;
/**
* @see TabletBackendInterface::addAdaptor(const DeviceType&, PropertyAdaptor*)
*/
- void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor);
+ void addAdaptor(const DeviceType& deviceType, PropertyAdaptor* adaptor) override;
/**
* @see TabletBackendInterface::getInformation() const;
*/
- const TabletInformation& getInformation() const;
+ const TabletInformation& getInformation() const override;
/**
* @see TabletBackendInterface::getProperty(const DeviceType&, const Property&) const
*/
- const QString getProperty(const DeviceType& type, const Property& property) const;
+ const QString getProperty(const DeviceType& type, const Property& property) const override;
/**
* @see TabletBackendInterface::setProfile(const TabletProfile&)
*/
- void setProfile(const TabletProfile& profile);
+ void setProfile(const TabletProfile& profile) override;
/**
* @see TabletBackendInterface::setProfile(const DeviceType&, const DeviceProfile&)
*/
- void setProfile(const DeviceType& deviceType, const DeviceProfile& profile);
+ void setProfile(const DeviceType& deviceType, const DeviceProfile& profile) override;
/**
* @see TabletBackendInterface::setStatusLED(int led)
*/
- void setStatusLED(int led);
+ void setStatusLED(int led) override;
/**
* @see TabletBackendInterface::setStatusLEDBrightness(int brightness)
*/
- void setStatusLEDBrightness(int brightness);
+ void setStatusLEDBrightness(int brightness) override;
/**
* @see TabletBackendInterface::setProperty(const DeviceType&, const Property&, const QString&)
*/
- bool setProperty(const DeviceType& type, const Property& property, const QString& value);
+ bool setProperty(const DeviceType& type, const Property& property, const QString& value) override;
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/tabletdaemon.h b/src/kded/tabletdaemon.h
index 1c1eaf5..0b9d35a 100644
--- a/src/kded/tabletdaemon.h
+++ b/src/kded/tabletdaemon.h
@@ -1,142 +1,142 @@
/*
* 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 TABLETDAEMON_H
#define TABLETDAEMON_H
#include
#include
class QScreen;
/**
* The wacom namespace holds all classes regarding the tablet daemon / kcmodule and applet.
*/
namespace Wacom
{
class TabletDaemonPrivate;
/**
* This module manages the tablet device and exports a convenient DBus API
* for tablet configuration and management.
*
* Its task is to monitor Hotpluging devices via solid and the detection of the tablet connected.
* Once a tablet is recognised a default profile will be applied via the wacom::DeviceHandler.
*
* Profiles can be changed with the kcmodule.
* In addition a plasma applet allows easy switching of different profiles.
*
* It registers the service @c "org.kde.Wacom" and exports the following objects on this service:
*
* @li @c /Tablet - this object. Allows one to check if a tablet is available and applies the profile
* @li @c /Device - tablet information. Basic information about the detected tablet
*/
class TabletDaemon : public KDEDModule
{
Q_OBJECT
public:
/**
* Creates a new daemon module.
*
* @param parent The parent object.
* @param args Ignored, required by KPlugin signature.
*/
explicit TabletDaemon(QObject *parent = 0, const QVariantList &args = QVariantList());
/**
* Destroys this module
*/
- virtual ~TabletDaemon();
+ ~TabletDaemon() override;
public Q_SLOTS:
/**
* Uses the KDE notification system to display a notification to the user.
*
* @param eventId The event identifier.
* @param title The notification title.
* @param message The notification message.
* @param suggestConfigure Defines whether to suggest configuration.
*/
void onNotify(const QString& eventId, const QString& title, const QString& message, bool suggestConfigure) const;
/**
* Called when the profile was changed.
*
* @param tabletId The identifier of the tablet.
* @param profile The name of the new profile.
*/
void onProfileChanged(const QString &tabletId, const QString& profile);
/**
* @brief Called when user presses "Configure" button on the notification popup
*/
void onOpenConfiguration() const;
private:
/**
* Sets up the global shortcut actions.
* This method should only be called by a constructor.
*/
void setupActions();
/**
* Sets up KDE application data, like i18n and the about dialog.
* This method should only be called by a constructor.
*/
void setupApplication();
/**
* Sets up the dbus interfaces.
* This method should only be called by a constructor.
*/
void setupDBus();
/**
* Sets up the X event notifier.
* This method should only be called by a constructor.
*/
void setupEventNotifier();
/**
* Helper function that sets up signals
* monitoring screen rotations and geometry changes
* for every existing and future screens.
*/
void monitorAllScreensGeometry();
private Q_SLOTS:
/**
* Sets up signals for rotation and geometry changes
* for a specific screen
* @param screen Screen to monitor
*/
void monitorScreenGeometry(QScreen *screen);
private:
Q_DECLARE_PRIVATE(TabletDaemon)
TabletDaemonPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tabletfinder.h b/src/kded/tabletfinder.h
index 75c8c32..a8b7cc6 100644
--- a/src/kded/tabletfinder.h
+++ b/src/kded/tabletfinder.h
@@ -1,111 +1,111 @@
/*
* 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 TABLETFINDER_H
#define TABLETFINDER_H
#include "tabletinformation.h"
#include
namespace Wacom
{
class TabletFinderPrivate;
/**
* Uses the underlying window system and other sources to detect tablets.
* This class needs the help of an event notifier which signals adding
* and removal of tablet devices.
*/
class TabletFinder : public QObject
{
Q_OBJECT
public:
- virtual ~TabletFinder();
+ ~TabletFinder() override;
static TabletFinder& instance();
/**
* Scan for devices and emit a signal for each tablet found.
*/
bool scan();
public Q_SLOTS:
/**
* This slot has to be connected to the event notifier.
*/
void onX11TabletAdded (int deviceId);
/**
* This slot has to be connected to the event notifier.
*/
void onX11TabletRemoved (int deviceId);
Q_SIGNALS:
/**
* Emitted when a tablet is add.
*/
void tabletAdded (TabletInformation tabletInformation);
/**
* Emitted when a tablet is removed.
*/
void tabletRemoved (TabletInformation tabletInformation);
protected:
/**
* Protected default constructor as this class is a singleton.
*/
TabletFinder();
/**
* Looks up tablet information and button mapping from the device database.
*
* @param info The tablet information which will be filled with the information from the database.
*
* @return True on success, false on error.
*/
bool lookupInformation (TabletInformation& info);
private:
/**
* Copy constructor which does nothing as this class is a singleton.
*/
explicit TabletFinder(const TabletFinder& finder) = delete;
/**
* Copy operator which does nothing as this class is a singleton.
*/
TabletFinder& operator= (const TabletFinder& finder) = delete;
Q_DECLARE_PRIVATE(TabletFinder)
TabletFinderPrivate *const d_ptr;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/tablethandler.h b/src/kded/tablethandler.h
index e368239..3140b06 100644
--- a/src/kded/tablethandler.h
+++ b/src/kded/tablethandler.h
@@ -1,320 +1,320 @@
/*
* 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 TABLETHANDLER_H
#define TABLETHANDLER_H
#include "property.h"
#include "tablethandlerinterface.h"
#include "tabletinformation.h"
#include "screenrotation.h"
#include
#include
#include
class QScreen;
namespace Wacom
{
class ScreenSpace;
class TabletProfile;
class TabletHandlerPrivate;
class TabletHandler : public TabletHandlerInterface
{
Q_OBJECT
public:
TabletHandler();
/**
* A constructor used for unit testing.
*
* @param profileFile The full path to the profiles configuration file.
* @param configFile The full path to the main configuration file.
*/
TabletHandler(const QString& profileFile, const QString configFile);
- virtual ~TabletHandler();
+ ~TabletHandler() override;
/**
* returns the current value for a specific tablet setting
* This is forwarded to the right backend specified by m_curDevice
*
* @param tabletId The id of the tablet where the property should be fetched from
* @param deviceType name of the tablet device we set. Internal name of the pad/stylus/eraser/cursor
* @param property the property we are looking for
*
* @return the value as string
*/
- QString getProperty(const QString &tabletId, const DeviceType& deviceType, const Property& property) const;
+ QString getProperty(const QString &tabletId, const DeviceType& deviceType, const Property& property) const override;
/**
* @brief Reads a list of all available profiles from the profile manager.
*
* @param tabletId The id of the tablet which shall be queried
* @return the list of all available profiles
*/
- QStringList listProfiles(const QString &tabletId);
+ QStringList listProfiles(const QString &tabletId) override;
/**
* @brief Applies a profile to the tablet device
*
* The profile must be known to the profile manager, otherwise a
* notification error is displayed.
*
* @param tabletId The id of the tablet for which the profile shall be set
* @param profile The name of the profile to apply.
*/
- void setProfile(const QString &tabletId, const QString& profile);
+ void setProfile(const QString &tabletId, const QString& profile) override;
/**
* Sets the configuration of @p param from @p device with @p value
* This is forwarded to the right backend specified by m_curDevice
*
* @param tabletId The identifier of the device to set the property on.
* @param deviceType The type of the device to set the property on.
* @param property The property to set.
* @param value New value of the parameter
*/
- void setProperty(const QString &tabletId, const DeviceType& deviceType, const Property & property, const QString& value);
+ void setProperty(const QString &tabletId, const DeviceType& deviceType, const Property & property, const QString& value) override;
- QStringList getProfileRotationList(const QString &tabletId);
+ QStringList getProfileRotationList(const QString &tabletId) override;
- void setProfileRotationList(const QString &tabletId, const QStringList &rotationList);
+ void setProfileRotationList(const QString &tabletId, const QStringList &rotationList) override;
public Q_SLOTS:
/**
* @brief Handles the connection of a new tablet device.
*
* This slot has to be connected to the X device event notifier and
* executed when a new tablet device is plugged in.
*
* @param info The device info as reported by X11.
*/
void onTabletAdded(const TabletInformation& info);
/**
* @brief Handles the removal of a tablet device.
*
* This slot has to be connected to the X device event notifier and
* executed when a tablet is disconnected from the system.
*
* @param info The device info as reported by X11.
*/
void onTabletRemoved(const TabletInformation& info);
/**
* @brief Handles rotating the tablet.
*
* This slot has to be connected to the X event notifier and executed
* when the screen is rotated.
*
* @param output Name of the screen that has been rotated.
* @param newScreenRotation The screen rotation.
*/
void onScreenRotated(QString output, const Qt::ScreenOrientation &newScreenRotation);
/**
* @brief Handles screens being connected and disconnected
* @param screen Screen being connected or disconnected
*/
void onScreenAddedRemoved(QScreen *screen);
/**
* @brief Handles changes in existing screen's geometry
*/
void onScreenGeometryChanged();
/**
* Toggles the stylus/eraser to absolute/relative mode
*/
void onTogglePenMode();
/**
* Toggles the touch tool on/off
*/
void onToggleTouch();
/**
* @brief Toggles to which screen the stylus/eraser/touch will be mapped
*
* the order is
* @li full
* @li screen1
* @li screen2
*/
void onToggleScreenMapping();
/**
* @brief Maps stylus/eraser/touch to the full available screen space
*
* in xsetwacom file
* @li copies AreaMapFull to Area
* @li sets ScreenSpace=full
*/
void onMapToFullScreen();
/**
* @brief Maps stylus/eraser/touch to the second screen
*
* in xsetwacom file
* @li copies AreaMap0 to Area in
* @li sets MapToOutput=0
* @li sets ScreenSpace=map0
*/
void onMapToScreen1();
/**
* @brief Maps stylus/eraser/touch to the second screen
*
* in xsetwacom file
* @li copies AreaMap1 to Area in
* @li sets MapToOutput=1
* @li sets ScreenSpace=map1
*/
void onMapToScreen2();
/**
* @brief Switch to the next profile in the rotation list
*/
void onNextProfile();
/**
* @brief Switch to the previous profile in the rotation list
*/
void onPreviousProfile();
Q_SIGNALS:
/**
* Emitted if the user should be notified.
*/
void notify(const QString &eventId, const QString &title, const QString &message, bool suggestConfigure);
/**
* Emitted when the profile of the current tablet is changed.
*
* @param tabletId The identifier of the tablet.
* @param profile The name of the new active profile.
*/
void profileChanged(const QString &tabletId, const QString& profile);
/**
* Emitted when a new tablet is connected or if the currently active tablet changes.
*/
void tabletAdded(const TabletInformation& info);
/**
* Emitted when the currently active tablet is removed.
*/
void tabletRemoved(const QString &tabletId);
private:
/**
* Auto rotates the tablet if auto-rotation is enabled. If auto-rotation
* is disabled, the tablet's rotation settings will be left untouched.
*
* @param tabletId The id of the Tablet that will be used
* @param tabletProfile The tablet profile to read the rotation settings from.
* @param output Name of the screen that has been rotated. Empty string means scan all devices.
* @param screenRotation Rotation of the screen specified by screenIndex.
*/
void autoRotateTablet(const QString &tabletId, const TabletProfile& tabletProfile,
QString output = QString(),
ScreenRotation screenRotations = ScreenRotation::NONE);
/**
* Checks if the current tablet supports the given device type.
*
* @param tabletId The id of the Tablet that will be checked
* @param type The device type to check for.
*
* @return True if the tablet supports the given device, else false.
*/
bool hasDevice( const QString &tabletId, const DeviceType& type) const;
/**
* Checks if there currently is a tablet available.
*
* @param tabletId The id of the Tablet that will be checked
* @return True if a tablet is available, else false.
*/
bool hasTablet(const QString &tabletId) const;
/**
* Maps a tablet device to a screen and updated its profile.
* However the profile will not be saved, only updated with
* the new settings.
*
* @param tabletId The id of the Tablet that will be altered
* @param device The device to map.
* @param screepSpace The screen space to map the device to.
* @param trackingMode The tracking mode to apply.
* @param tabletProfile The profile to update.
*/
void mapDeviceToOutput(const QString &tabletId, const Wacom::DeviceType& device,
const ScreenSpace& screenSpace, const QString& trackingMode,
TabletProfile& tabletProfile);
/**
* Maps the stylus, eraser and touch device to the given output and
* updates the profiles accordingly. If no mapping is configured the
* device is mapped to the full desktop.
*
* @param tabletId The id of the Tablet that will be altered
* @param output A string returned by ScreenSpace::toString()
*/
void mapPenToScreenSpace(const QString &tabletId, const ScreenSpace& screenSpace,
const QString& trackingMode = QLatin1String("absolute"));
/**
* Maps stylus/eraser/touch to their current screen space.
* The tablet profile will be saved after the operation is complete.
*
* @param tabletId The id of the Tablet that will be altered
* @param tabletProfile The tablet profile to use.
*/
void mapTabletToCurrentScreenSpace(const QString &tabletId, TabletProfile& tabletProfile);
Q_DECLARE_PRIVATE(TabletHandler)
TabletHandlerPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/x11eventnotifier.h b/src/kded/x11eventnotifier.h
index d372278..e98f425 100644
--- a/src/kded/x11eventnotifier.h
+++ b/src/kded/x11eventnotifier.h
@@ -1,89 +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 .
*/
#ifndef X11EVENTNOTIFIER_H
#define X11EVENTNOTIFIER_H
#include "eventnotifier.h"
#include
#include
namespace Wacom
{
class X11EventNotifierPrivate;
/**
* @brief Singleton that listens to X11 events, mainly tablet plug/unplug events
*/
class X11EventNotifier : public EventNotifier, public QAbstractNativeEventFilter
{
Q_OBJECT
public:
- virtual ~X11EventNotifier();
+ ~X11EventNotifier() override;
/**
* Returns an instance of this class.
*/
static X11EventNotifier& instance();
/**
* @see EventNotifier::start()
*/
void start() final;
/**
* @see EventNotifier::stop()
*/
void stop() final;
protected:
/**
* Called by Qt when a new X11 event is detected.
*/
- virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) Q_DECL_OVERRIDE;
+ bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) Q_DECL_OVERRIDE;
private:
X11EventNotifier();
explicit X11EventNotifier(const X11EventNotifier& notifier) = delete;
X11EventNotifier& operator= (const X11EventNotifier& notifier) = delete;
/**
* Handles X11 input events which signal adding or removal of a device.
* This method should not be called directly, but only by our X11 event
* handler method.
*/
void handleX11InputEvent(xcb_ge_generic_event_t* event);
/**
* Register the eventhandler with the X11 system
*/
int registerForNewDeviceEvent(xcb_connection_t* display);
Q_DECLARE_PRIVATE( X11EventNotifier )
X11EventNotifierPrivate *const d_ptr;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/x11tabletfinder.h b/src/kded/x11tabletfinder.h
index 97fdc59..36cf21e 100644
--- a/src/kded/x11tabletfinder.h
+++ b/src/kded/x11tabletfinder.h
@@ -1,136 +1,136 @@
/*
* 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 X11TABLETFINDER_H
#define X11TABLETFINDER_H
#include
#include
#include "x11inputvisitor.h"
#include "tabletinformation.h"
namespace Wacom
{
class X11Input;
// Forward Declarations
class DeviceInformation;
class X11TabletFinderPrivate;
/**
* A tablet finder which uses the X11 window system to find connected tablets.
*/
class X11TabletFinder : public X11InputVisitor
{
public:
X11TabletFinder();
- virtual ~X11TabletFinder();
+ ~X11TabletFinder() override;
/**
* Returns the devices which were found from a previous run of scanDevices().
*
* @return A list of devices found.
*/
const QList& getTablets() const;
/**
* Scans for available devices.
*
* @return True if devices were found, else false.
*/
bool scanDevices();
/**
* @see X11InputVisitor::visit(X11InputDevice&)
*/
- bool visit (X11InputDevice& device);
+ bool visit (X11InputDevice& device) override;
private:
/**
* Adds the given device information to the internal tablet map.
* If no tablet exists with the serial number of the device, a new one is created.
*/
void addDeviceInformation (Wacom::DeviceInformation& deviceInformation);
/**
* Gather all information about the given x11 device and write the data
* into the device information structure.
*
* @param device The device to gather information about.
* @param deviceInformation The device information structure which will contain all data.
*/
void gatherDeviceInformation (X11InputDevice& device, DeviceInformation& deviceInformation) const;
/**
* Gets the device node of the given device.
*
* @return The device node or an empty string if not set.
*/
const QString getDeviceNode (Wacom::X11InputDevice& device) const;
/**
* Determines the device type base on the given toolTyple.
*
* @return A pointer to the device type if it could be determined, else NULL.
*/
const DeviceType* getDeviceType (const QString& toolType) const;
/**
* Gets the product and vendor id if set. These are usually the company and
* product id of the USB device. However the information is optional and might
* not be set.
*
* @param device The device to get the information from.
* @param vendorId A reference to a long value which will contain the vendor id.
* @param productId A reference to a long value which will contain the product id.
*
* @return True if it least one value was set, else false.
*/
bool getProductId (X11InputDevice& device, long& vendorId, long& productId) const;
/**
* Gets the tablet id of this device.
*
* @return The tablet id or 0 on error.
*/
long getTabletSerial (X11InputDevice& device) const;
/**
* Gets the tool type name from the wacom tool type property.
*
* @return The tool type name on success, an empty string on error.
*/
const QString getToolType (X11InputDevice& device) const;
private:
Q_DECLARE_PRIVATE(X11TabletFinder)
X11TabletFinderPrivate *const d_ptr;
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/xinputadaptor.h b/src/kded/xinputadaptor.h
index 9cc5499..928c255 100644
--- a/src/kded/xinputadaptor.h
+++ b/src/kded/xinputadaptor.h
@@ -1,88 +1,88 @@
/*
* 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 XINPUTADAPTOR_H
#define XINPUTADAPTOR_H
#include
#include
#include "propertyadaptor.h"
namespace Wacom {
// Forward Declarations
class XinputProperty;
class XinputAdaptorPrivate;
/**
* A property adaptor which uses XInput to set properties on a device.
*/
class XinputAdaptor : public PropertyAdaptor
{
public:
//! Default constructor.
explicit XinputAdaptor(const QString& deviceName);
//! Destructor
- virtual ~XinputAdaptor();
+ ~XinputAdaptor() override;
/**
* @sa PropertyAdaptor::getProperties()
*/
- const QList getProperties() const;
+ const QList getProperties() const override;
/**
* @sa PropertyAdaptor::getProperty(const Property&)
*/
- const QString getProperty(const Property& property) const;
+ const QString getProperty(const Property& property) const override;
/**
* @sa PropertyAdaptor::setProperty(const Property&, const QString&)
*/
- bool setProperty(const Wacom::Property& property, const QString& value);
+ bool setProperty(const Wacom::Property& property, const QString& value) override;
/**
* @sa PropertyAdaptor::supportsProperty(const Property&)
*/
- bool supportsProperty(const Property& property) const;
+ bool supportsProperty(const Property& property) const override;
private:
const QString getProperty(const XinputProperty& property) const;
const QString getFloatProperty(const XinputProperty& property, long nelements = 1) const;
const QString getLongProperty(const XinputProperty& property, long nelements = 1) const;
bool mapTabletToScreen(const QString& screenArea) const;
template
const QString numbersToString(const QList& values) const;
bool setProperty(const XinputProperty& property, const QString& value) const;
Q_DECLARE_PRIVATE( XinputAdaptor )
XinputAdaptorPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/kded/xsetwacomadaptor.h b/src/kded/xsetwacomadaptor.h
index ccab0c9..4e7de40 100644
--- a/src/kded/xsetwacomadaptor.h
+++ b/src/kded/xsetwacomadaptor.h
@@ -1,142 +1,142 @@
/*
* 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 XSETWACOMADAPTOR_H
#define XSETWACOMADAPTOR_H
#include
#include
#include "propertyadaptor.h"
namespace Wacom {
// Forward Declarations
class XsetwacomProperty;
class XsetwacomAdaptorPrivate;
/**
* A property adaptor which uses xsetwacom to set properties on a tablet.
*/
class XsetwacomAdaptor : public PropertyAdaptor
{
public:
//! Default constructor.
explicit XsetwacomAdaptor(const QString& deviceName);
XsetwacomAdaptor(const QString& deviceName, const QMap& buttonMap);
//! Destructor
- virtual ~XsetwacomAdaptor();
+ ~XsetwacomAdaptor() override;
/**
* @sa PropertyAdaptor::getProperties()
*/
- const QList getProperties() const;
+ const QList getProperties() const override;
/**
* @sa PropertyAdaptor::getProperty(const Property&)
*/
- const QString getProperty(const Property& property) const;
+ const QString getProperty(const Property& property) const override;
/**
* @sa PropertyAdaptor::setProperty(const Property&, const QString&)
*/
- bool setProperty(const Wacom::Property& property, const QString& value);
+ bool setProperty(const Wacom::Property& property, const QString& value) override;
/**
* @sa PropertyAdaptor::supportsProperty(const Property&)
*/
- bool supportsProperty(const Property& property) const;
+ bool supportsProperty(const Property& property) const override;
private:
/**
* Does any necessary conversion of the xsetwacom parameter.
*
* @param param The parameter to convert.
*
* @return The converted parameter.
*/
const QString convertParameter (const XsetwacomProperty& param) const;
/**
* Makes sure a button shortcut is in the correct format. The result of the
* conversion will be stored in the \a value parameter. If the property is
* not a button shortcut, the value is left untouched.
*
* @param value The shortcut to validate.
*/
void convertButtonShortcut (const XsetwacomProperty& property, QString& value) const;
/**
* Converts a value from xsetwacom format to internal format.
*
* @param property The property this value belongs to.
* @param value The value of the property. This will also contain the result of the conversion.
*/
void convertFromXsetwacomValue (const XsetwacomProperty& property, QString& value) const;
/**
* Converts a value from internal format to xsetwacom format.
*
* @param property The property the value belongs to.
* @param value The value of the property. This will also contain the result of the conversion.
*/
void convertToXsetwacomValue (const XsetwacomProperty& property, QString& value) const;
/**
* Gets a parameter using the xsetwacom command line tool. All parameters to this
* method as well as the device name have to be in a format which is understood
* by xsetwacom.
*
* @param device The device to get the parameter from.
* @param param The parameter to get.
*/
const QString getParameter(const QString& device, const QString& param) const;
/**
* Sets the usable tablet area.
*/
bool setArea(const QString& value);
/**
* Sets the tablet rotation.
*/
bool setRotation(const QString& value);
/**
* Sets a parameter using the xsetwacom command line tool. All parameters, values and
* device names passed to this method have to be in a format which is understood by
* xsetwacom.
*
* @param device The device to set the parameter for.
* @param param The parameter to set.
* @param value The new value of the parameter.
*/
bool setParameter(const QString& device, const QString& param, const QString& value) const;
Q_DECLARE_PRIVATE( XsetwacomAdaptor )
XsetwacomAdaptorPrivate *const d_ptr; /**< d-pointer for this class */
}; // CLASS
} // NAMESPACE
#endif // HEADER PROTECTION
diff --git a/src/tabletfinder/dialog.h b/src/tabletfinder/dialog.h
index 45c8e5e..40e6e72 100644
--- a/src/tabletfinder/dialog.h
+++ b/src/tabletfinder/dialog.h
@@ -1,108 +1,108 @@
/*
* 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 DIALOG_H
#define DIALOG_H
#include
#include "tabletinformation.h"
namespace Ui {
class Dialog;
}
class QAbstractButton;
namespace Wacom
{
class HWButtonDialog;
/**
* @brief Main dialog windows that allows the user to detect and specify the tablet
*/
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
- ~Dialog();
+ ~Dialog() override;
private slots:
// tablet detection and user selection
void refreshTabletList();
void changeTabletSelection(int index);
// update internal representation on user changes
void onHasStatusLEDsLeftChanged(bool toggled);
void onhasStatusLEDsRightChanged(bool toggled);
void onhasTouchRingChanged(bool toggled);
void onhasTouchStripLeftChanged(bool toggled);
void onhasTouchStripRightChanged(bool toggled);
void onhasWheelChanged(bool toggled);
void onExpressKeyNumbersChanged(int buttons);
void buttonBoxClicked(QAbstractButton *button);
void onPairedIdChanged(int index);
void onNormalTabletSet(bool enabled);
void onParentTabletSet(bool enabled);
void onTouchSensorSet(bool enabled);
/**
* @brief Open the dialog that allows the user to detect hardware key mappings
*/
void onMapButtons();
private:
bool validIndex();
void showHWButtonMap();
Ui::Dialog *m_ui = nullptr;
struct Tablet {
int serialID = 0;
QString company;
QString name;
QString layout = QString::fromLatin1("unknown");
QString model = QString::fromLatin1("unknown");
QStringList devices;
bool hasWheel = false;
bool hasTouchRing = false;
bool hasTouchStripLeft = false;
bool hasTouchStripRight = false;
bool hasStatusLEDsLeft = false;
bool hasStatusLEDsRight = false;
int buttonNumber = 0;
QList hwMapping;
QString pairedID;
bool hasPairedID = false;
bool isTouchSensor = false;
};
void saveTabletInfo(const Tablet &t);
QList m_tabletInformation;
QList m_tabletList;
Wacom::HWButtonDialog *m_hwbDialog;
};
}
#endif // DIALOG_H
diff --git a/src/tabletfinder/hwbuttondialog.h b/src/tabletfinder/hwbuttondialog.h
index 9e7efdf..8e98f6a 100644
--- a/src/tabletfinder/hwbuttondialog.h
+++ b/src/tabletfinder/hwbuttondialog.h
@@ -1,68 +1,68 @@
/*
* 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 HWBUTTONDIALOG_H
#define HWBUTTONDIALOG_H
#include
namespace Ui {
class HWButtonDialog;
}
namespace Wacom
{
/**
* @brief Dialog that allows the user to press the buttons on the tablet for correct mapping
*
* The Tablet buttons 1-x are not directly mapped to the X11 buttons 1-x.
* Button 4-7 are used for wheel events for example.
*
* Also button 1 is not always Button 1 but sometimes 9 and so on
* This dialog lets the user press the logical tablet buttons and captures the X11 events
* for the real X11 button connected to it.
*
*/
class HWButtonDialog : public QDialog
{
Q_OBJECT
public:
explicit HWButtonDialog(int maxButtons, QWidget *parent = nullptr);
- ~HWButtonDialog();
+ ~HWButtonDialog() override;
QList buttonMap() const;
protected:
void mousePressEvent(QMouseEvent *event) final;
private:
void hwKey(unsigned int button);
void nextButton();
Ui::HWButtonDialog *ui = nullptr;
int m_maxButtons;
int m_nextButton;
QList m_buttonMap;
};
}
#endif // HWBUTTONDIALOG_H