~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/input/logitechmouse.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * logitechmouse.h
 
3
 *
 
4
 * Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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.
 
19
 */
 
20
 
 
21
 
 
22
#ifndef __LOGITECHMOUSE_H__
 
23
#define __LOGITECHMOUSE_H__
 
24
 
 
25
#include <QPushButton>
 
26
 
 
27
#include <kconfig.h>
 
28
 
 
29
#include <config-workspace.h>
 
30
 
 
31
#include "ui_logitechmouse_base.h"
 
32
 
 
33
#include <usb.h>
 
34
 
 
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 */
 
41
 
 
42
class LogitechMouseBase : public QWidget, public Ui::LogitechMouseBase
 
43
{
 
44
public:
 
45
  LogitechMouseBase( QWidget *parent ) : QWidget( parent ) {
 
46
    setupUi( this );
 
47
  }
 
48
};
 
49
 
 
50
 
 
51
 
 
52
class LogitechMouse : public LogitechMouseBase
 
53
{
 
54
    Q_OBJECT
 
55
 
 
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);
 
61
 
 
62
protected Q_SLOTS:
 
63
    void setChannel1();
 
64
    void setChannel2();
 
65
    void updateGUI();
 
66
    void stopTimerForNow();
 
67
 
 
68
private:
 
69
    void initCordlessStatusReporting();
 
70
    void updateCordlessStatus();
 
71
 
 
72
    void setLogitechTo400();
 
73
    void setLogitechTo800();
 
74
 
 
75
    QString cordlessName() const ;
 
76
    quint8 resolution();
 
77
    void updateResolution();
 
78
    quint8 batteryLevel() const;
 
79
    quint8 channel() const;
 
80
    bool isDualChannelCapable() const;
 
81
 
 
82
    QTimer *doUpdate;
 
83
 
 
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;
 
104
};
 
105
 
 
106
#endif
 
107