~ubuntu-branches/ubuntu/precise/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/hotmodifier.h

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2012-03-05 09:52:30 UTC
  • mfrom: (1.1.28)
  • Revision ID: package-import@ubuntu.com-20120305095230-alpmktmmfnjs2t4b
Tags: 5.6.0-0ubuntu1
* New upstream release
  - [dash] [hud] If no active window, shell processes crashes (LP: #944724)
  - Long delay on session logout (LP: #812104)
  - apps/docs are not launched when performing a search on the home lens
    (LP: #932092)
  - [unity-2d] FF exception to add HUD to Unity2d (LP: #942045)
  - There's a gap between the launcher and the upper panel (LP: #942031)
  - Dash - Genre filter category in the Music Lens should use a 3 column
    layout (LP: #841902)
  - selected lens arrow should be on top instead of bottom (LP: #932291)
  - [launcher] pixel-perfection fixes, new assets, tile & pip position,
    border line & context menu position (LP: #936881)
  - Workspace switcher icon should not generate background from icon
    (LP: #939586)
  - No glow assets still needed X Y Z (LP: #934059)
* Revert an upstream commit to ensure that there is not regression with
  libunity-core 5.4 (change will be introduced again when unity 5.6 released)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Michał Sawicz <michal.sawicz@canonical.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
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, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef HOTMODIFIER_H
 
21
#define HOTMODIFIER_H
 
22
 
 
23
// Qt
 
24
#include <QObject>
 
25
#include <QTimer>
 
26
 
 
27
class HotModifier : public QObject
 
28
{
 
29
    Q_OBJECT
 
30
    Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers)
 
31
    Q_PROPERTY(bool held READ held NOTIFY heldChanged)
 
32
 
 
33
public:
 
34
    HotModifier(Qt::KeyboardModifiers modifiers, QObject *parent = 0);
 
35
 
 
36
    void onModifiersChanged(Qt::KeyboardModifiers modifiers);
 
37
    void disable();
 
38
 
 
39
    // getters
 
40
    bool held() const;
 
41
    Qt::KeyboardModifiers modifiers() const;
 
42
 
 
43
Q_SIGNALS:
 
44
    void tapped();
 
45
    void heldChanged(bool modifierHeld);
 
46
 
 
47
private Q_SLOTS:
 
48
    void ignoreCurrentPress();
 
49
    void updateHoldState();
 
50
 
 
51
private:
 
52
    QTimer m_holdTimer;
 
53
    Qt::KeyboardModifiers m_modifiers;
 
54
    bool m_pressed;
 
55
    bool m_held;
 
56
    bool m_ignored;
 
57
    bool m_otherModifierPressed;
 
58
};
 
59
 
 
60
#endif // HOTMODIFIER_H