2
* Copyright 2013 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#include "bottombarvisibilitycommunicator.h"
20
#include <QDBusInterface>
22
static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
23
static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_INTERFACE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
24
static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
29
BottomBarVisibilityCommunicator controller is used to communicate with the Shell BottomBarVisibilityCommunicator.
30
This class allows for the bottom edge interaction to happen
32
The shell can control the bottom bar behaviour:
33
* forceHidden: If set to true, the bottom bar has to be forced to be hidden
36
BottomBarVisibilityCommunicator::BottomBarVisibilityCommunicator()
37
: m_shellDbusIface(NULL),
41
m_shellDbusIface = new QDBusInterface(DBUS_SERVICE, BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_INTERFACE, QDBusConnection::sessionBus(), this);
42
if (m_shellDbusIface->isValid()) {
43
connect(m_shellDbusIface, SIGNAL(forceHiddenChanged(bool)), SLOT(onShellForceHiddenChanged(bool)));
45
const bool forceHidden = m_shellDbusIface->property("forceHidden").toDouble();
46
onShellForceHiddenChanged(forceHidden);
50
bool BottomBarVisibilityCommunicator::forceHidden() const
55
double BottomBarVisibilityCommunicator::position() const
60
void BottomBarVisibilityCommunicator::setPosition(double position)
62
if (position != m_position) {
63
m_position = position;
64
m_shellDbusIface->setProperty("position", position);
65
Q_EMIT positionChanged(position);
69
void BottomBarVisibilityCommunicator::onShellForceHiddenChanged(bool forceHidden)
71
if (forceHidden != m_forceHidden) {
72
m_forceHidden = forceHidden;
73
Q_EMIT forceHiddenChanged(forceHidden);