add more spacing
[personal-kdebase.git] / workspace / kcontrol / input / logitechmouse.h
blob0c4f4d117788eb51ea7f668ed8e1b8f8169f6f51
1 /*
2 * logitechmouse.h
4 * Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __LOGITECHMOUSE_H__
23 #define __LOGITECHMOUSE_H__
25 #include <QPushButton>
27 #include <kconfig.h>
29 #include <config-workspace.h>
31 #include "ui_logitechmouse_base.h"
33 #include <usb.h>
35 #define VENDOR_LOGITECH 0x046D
36 #define HAS_RES 0x01 /* mouse supports variable resolution */
37 #define HAS_SS 0x02 /* mouse supports smart scroll control */
38 #define HAS_CSR 0x04 /* mouse supports cordless status reporting and control */
39 #define HAS_SSR 0x08 /* mouse supports smart scroll reporting */
40 #define USE_CH2 0x10 /* mouse needs to use the second channel */
42 class LogitechMouseBase : public QWidget, public Ui::LogitechMouseBase
44 public:
45 LogitechMouseBase( QWidget *parent ) : QWidget( parent ) {
46 setupUi( this );
52 class LogitechMouse : public LogitechMouseBase
54 Q_OBJECT
56 public:
57 LogitechMouse( struct usb_device *usbDev, int mouseCapabilityFlags, QWidget* parent = 0, const char* name=0);
58 ~LogitechMouse();
59 void applyChanges();
60 void save(KConfig *config);
62 protected Q_SLOTS:
63 void setChannel1();
64 void setChannel2();
65 void updateGUI();
66 void stopTimerForNow();
68 private:
69 void initCordlessStatusReporting();
70 void updateCordlessStatus();
72 void setLogitechTo400();
73 void setLogitechTo800();
75 QString cordlessName();
76 quint8 resolution();
77 void updateResolution();
78 quint8 batteryLevel();
79 quint8 channel();
80 bool isDualChannelCapable();
82 QTimer *doUpdate;
84 struct usb_dev_handle *m_usbDeviceHandle;
85 bool m_connectStatus; // true if the CONNECT button on the mouse is pressed
86 bool m_mousePowerup; // true if we are doing "just out of the box" auto-locking
87 bool m_receiverUnlock; // true if mouse has been disconnected by a long press
88 // of the receiver's CONNECT button
89 bool m_waitLock; // true if receiver searching for new mouse because the
90 // CONNECT button on the receiver was pressed
91 quint8 m_batteryLevel;
92 quint8 m_channel;
93 quint8 m_cordlessNameIndex; // this gets convered into a QString in cordlessName()
94 quint16 m_cordlessSecurity;
95 quint16 m_useSecondChannel;
96 quint8 m_caseShape;
97 quint8 m_numberOfButtons;
98 quint8 m_resolution;
99 bool m_twoChannelCapable; // true if the mouse supports dual channels
100 bool m_verticalRoller; // true if the mouse has a vertical roller (wheel)
101 bool m_horizontalRoller; // true if the mouse has a horizontal roller (wheel)
102 bool m_has800cpi; // true if the mouse does 800cpi resolution
103 int m_mouseCapabilityFlags;
106 #endif