~unity-2d-team/unity-2d/shortcut-hint-overlay

« back to all changes in this revision

Viewing changes to shell/app/shelldeclarativeview.h

  • Committer: Tiago Salem Herrmann
  • Date: 2012-03-19 15:28:41 UTC
  • mfrom: (771.40.182 unity-2d)
  • Revision ID: tiago.herrmann@canonical.com-20120319152841-2hfflo67muks7gca
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <QTimer>
26
26
 
27
27
class LauncherClient;
28
 
class DashDBus;
 
28
class ShellDBus;
29
29
class ScreenInfo;
 
30
class Hotkey;
 
31
class ShellManager;
30
32
 
31
33
class ShellDeclarativeView : public Unity2DDeclarativeView, public AbstractX11EventFilter
32
34
{
33
35
    Q_OBJECT
34
 
    Q_ENUMS(DashMode)
35
36
 
36
 
    Q_PROPERTY(bool dashActive READ dashActive WRITE setDashActive NOTIFY dashActiveChanged)
37
 
    Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged)
38
 
    Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged)
39
 
    Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
40
37
    Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
41
 
    Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
42
 
    Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
43
38
 
44
39
    /* These two properties and mouse movement tracking on the widget are added here only because
45
40
       we need to detect when the mouse is inside the area occupied by the lancher. This should
52
47
                                               NOTIFY monitoredAreaContainsMouseChanged)
53
48
 
54
49
public:
55
 
    enum DashMode {
56
 
        DesktopMode,
57
 
        FullScreenMode
58
 
    };
59
 
    explicit ShellDeclarativeView();
 
50
    ShellDeclarativeView(ShellManager *manager, const QUrl &sourceFileUrl, int screen);
60
51
 
61
52
    /* getters */
62
 
    bool dashActive() const;
63
 
    bool haveCustomHomeShortcuts() const;
64
 
    DashMode dashMode() const;
65
 
    const QString& activeLens() const;
66
 
    bool expanded() const;
67
 
    bool superKeyHeld() const { return m_superKeyHeld; }
68
53
    QRect monitoredArea() const;
69
54
    bool monitoredAreaContainsMouse() const;
70
55
 
71
56
    /* setters */
72
 
    Q_SLOT void setDashActive(bool active);
73
 
    Q_INVOKABLE void setDashMode(DashMode);
74
 
    Q_INVOKABLE void setActiveLens(const QString& activeLens);
75
 
    Q_INVOKABLE void setExpanded(bool);
76
57
    void setMonitoredArea(QRect monitoredArea);
77
58
 
78
59
    virtual bool x11EventFilter(XEvent* event);
79
60
 
 
61
    void toggleLauncher();
 
62
 
 
63
    Q_INVOKABLE void forceActivateWindow();
 
64
    Q_INVOKABLE void forceDeactivateWindow();
 
65
 
80
66
Q_SIGNALS:
81
 
    void dashActiveChanged(bool);
82
 
    void dashModeChanged(DashMode);
83
 
    void expandedChanged(bool);
84
 
    void activeLensChanged(const QString&);
85
 
    void activateLens(const QString& lensId);
86
 
    void activateHome();
87
67
    void focusChanged();
88
68
    void monitoredAreaChanged();
89
69
    void monitoredAreaContainsMouseChanged();
90
70
 
91
 
    void addWebFavoriteRequested(const QUrl& url);
92
 
    void superKeyHeldChanged(bool superKeyHeld);
93
 
    void superKeyTapped();
94
71
    void activateShortcutPressed(int itemIndex);
95
72
    void newInstanceShortcutPressed(int itemIndex);
96
73
    void launcherFocusRequested();
97
74
 
98
 
private Q_SLOTS:
99
 
    void updateSuperKeyMonitoring();
100
 
    void updateSuperKeyHoldState();
101
 
    void setHotkeysForModifiers(Qt::KeyboardModifiers modifiers);
102
 
    void forwardNumericHotkey();
103
 
    void ignoreSuperPress();
104
 
 
105
 
    void toggleDash();
106
 
    void showCommandsLens();
107
 
    void onAltF1Pressed();
108
 
 
109
75
protected:
110
76
    virtual void showEvent(QShowEvent *event);
111
77
    virtual void mouseMoveEvent(QMouseEvent *event);
121
87
    void setWMFlags();
122
88
    void updateInputShape();
123
89
 
124
 
    DashMode m_mode;
125
 
    bool m_expanded;
126
 
    QString m_activeLens; /* Lens id of the active lens */
127
 
    bool m_active;
128
 
 
129
 
    bool m_superKeyPressed;
130
 
    bool m_superKeyHeld;
131
 
    bool m_superPressIgnored;
132
 
    QTimer m_superKeyHoldTimer;
133
90
    QRect m_monitoredArea;
134
91
    bool m_monitoredAreaContainsMouse;
 
92
    QUrl m_sourceFileUrl;
 
93
    ShellManager *m_manager;
135
94
 
136
 
    friend class DashDBus;
137
 
    friend class LauncherDBus;
 
95
    friend class ShellManager;
138
96
};
139
97
 
140
98
Q_DECLARE_METATYPE(ShellDeclarativeView*)