on fdd4adc help sign in
54 lines 1.8 kB history raw
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#include "platform.h"
19#include <QDBusConnection>
20#include <QDebug>
22Platform::Platform(QObject *parent)
23 : QObject(parent)
25 QMetaObject::invokeMethod(this, "init");
28void Platform::init()
30 m_iface = new QDBusInterface("org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
31 QDBusConnection::systemBus(), this);
32 m_seatIface = new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat",
33 QDBusConnection::systemBus(), this);
35 m_chassis = m_iface->property("Chassis").toString();
36 m_isPC = (m_chassis == "desktop" || m_chassis == "laptop" || m_chassis == "server");
37 m_isMultiSession = m_seatIface->property("CanMultiSession").toBool() && m_seatIface->property("CanGraphical").toBool();
38 qDebug() << "Unity8 platform initialized, form factor" << m_chassis << ", multisession capable:" << m_isMultiSession;
41QString Platform::chassis() const
43 return m_chassis;
46bool Platform::isPC() const
48 return m_isPC;
51bool Platform::isMultiSession() const
53 return m_isMultiSession;