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

« back to all changes in this revision

Viewing changes to shell/app/huddbus.cpp

  • 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:
 
1
/*
 
2
 * Copyright (C) 2011 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
#include "huddbus.h"
 
21
#include "hudadaptor.h"
 
22
 
 
23
// Local
 
24
#include <shellmanager.h>
 
25
 
 
26
// Qt
 
27
#include <QtDBus/QDBusConnection>
 
28
#include <QGraphicsObject>
 
29
 
 
30
HUDDBus::HUDDBus(ShellManager* manager, QObject* parent)
 
31
: QObject(parent)
 
32
, m_manager(manager)
 
33
{
 
34
    connect(m_manager, SIGNAL(hudActiveChanged()), SLOT(onHudActiveChanged()));
 
35
    connect(m_manager, SIGNAL(hudScreenChanged(int)), SIGNAL(screenChanged(int)));
 
36
 
 
37
    new HUDAdaptor(this);
 
38
}
 
39
 
 
40
bool
 
41
HUDDBus::active() const
 
42
{
 
43
    return m_manager->hudActive();
 
44
}
 
45
 
 
46
void
 
47
HUDDBus::onHudActiveChanged()
 
48
{
 
49
    Q_EMIT activeChanged(active());
 
50
}
 
51
 
 
52
void
 
53
HUDDBus::setActive(bool hudActive)
 
54
{
 
55
    if (hudActive != active()) {
 
56
        m_manager->setHudActive(hudActive);
 
57
        Q_EMIT activeChanged(hudActive);
 
58
    }
 
59
}
 
60
 
 
61
int
 
62
HUDDBus::screen() const
 
63
{
 
64
    return m_manager->hudScreen();
 
65
}