File indexing completed on 2025-01-26 05:09:26

0001 /*
0002  * This file is part of the KDE wacomtablet project. For copyright
0003  * information and license terms see the AUTHORS and COPYING files
0004  * in the top-level directory of this distribution.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef TABLETHANDLERMOCK_H
0021 #define TABLETHANDLERMOCK_H
0022 
0023 #include "tablethandlerinterface.h"
0024 #include "tabletinformation.h"
0025 
0026 #include <QObject>
0027 #include <QString>
0028 #include <QStringList>
0029 
0030 namespace Wacom
0031 {
0032 class TabletHandlerMock : public TabletHandlerInterface
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     TabletHandlerMock();
0038     ~TabletHandlerMock() override;
0039 
0040     //! Emits a profileChanged signal with the given parameter.
0041     void emitProfileChanged(const QString &tabletId, const QString &profile);
0042 
0043     //! Emits a tabletAdded signal with the given parameter.
0044     void emitTabletAdded(const TabletInformation &info);
0045 
0046     //! Emits a tabletRemoved signal.
0047     void emitTabletRemoved(const QString &tabletId);
0048 
0049     //! Gets the current mock property value no matter which property or device is requested.
0050     QString getProperty(const QString &tabletId, const DeviceType &deviceType, const Property &property) const override;
0051 
0052     //! Returns the mock's profile list.
0053     QStringList listProfiles(const QString &tabletId) override;
0054 
0055     //! Sets the given profile on the mock and emits a profileChanged signal.
0056     void setProfile(const QString &tabletId, const QString &profile) override;
0057 
0058     //! Sets the given property value on the mock no matter which device or property is set.
0059     void setProperty(const QString &tabletId, const DeviceType &deviceType, const Property &property, const QString &value) override;
0060 
0061     //! return mock rotation list
0062     QStringList getProfileRotationList(const QString &tabletId) override;
0063 
0064     //! set mock rotation list
0065     void setProfileRotationList(const QString &tabletId, const QStringList &rotationList) override;
0066 
0067 Q_SIGNALS:
0068 
0069     void profileChanged(const QString &tabletId, const QString &profile);
0070 
0071     void tabletAdded(const TabletInformation &info);
0072 
0073     void tabletRemoved(const QString &tabletId);
0074 
0075 public:
0076     QString m_deviceType; //!< The device type a property was set on and the device type a property is returned for.
0077     QString m_property; //!< The property which was set and the property which can be get.
0078     QString m_propertyValue; //!< The property value returned by this mock, no matter which property is requested.
0079     QStringList m_profiles; //!< The list of profiles returned by this mock.
0080     QString m_profile; //!< The profile name returned by this mock.
0081     QStringList m_rotationList; //!< The mock rotation list (only one not one per device)
0082 
0083 }; // CLASS
0084 } // NAMESPACE
0085 #endif // HEADER PROTECTION