2 * Copyright (C) 2015 Canonical, Ltd.
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.
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.
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/>.
19#include <QDBusConnection>
23Platform::Platform(QObject *parent)
24 : QObject(parent), m_isPC(true), m_isMultiSession(true)
26 QMetaObject::invokeMethod(this, "init");
31 QDBusInterface iface("org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
32 QDBusConnection::systemBus(), this);
33 QDBusInterface seatIface("org.freedesktop.login1", "/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat",
34 QDBusConnection::systemBus(), this);
36 // From the source at https://cgit.freedesktop.org/systemd/systemd/tree/src/hostname/hostnamed.c#n130
46 m_chassis = iface.property("Chassis").toString();
48 // A PC is not a handset, tablet or watch.
49 m_isPC = !QSet<QString>{"handset", "tablet", "watch"}.contains(m_chassis);
50 m_isMultiSession = seatIface.property("CanMultiSession").toBool() && seatIface.property("CanGraphical").toBool();
53QString Platform::chassis() const
58bool Platform::isPC() const
63bool Platform::isMultiSession() const
65 return m_isMultiSession;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list