2
* This file is part of system-settings
4
* Copyright (C) 2016 Canonical Ltd.
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 3, as published
8
* by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranties of
12
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
* PURPOSE. See the GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "launcher_impl.h"
21
#include "launcher-plugin.h"
23
#include <SystemSettings/ItemBase>
25
#include <QProcessEnvironment>
26
#include <QQmlComponent>
28
#include <QScopedPointer>
31
using namespace SystemSettings;
33
class LauncherItem: public ItemBase
38
explicit LauncherItem(const QVariantMap &staticData, QObject *parent = 0);
39
void setVisibility(bool visible);
42
LauncherItem::LauncherItem(const QVariantMap &staticData, QObject *parent):
43
ItemBase(staticData, parent)
45
// Unconditionally show if USS_SHOW_ALL_UI is set.
46
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
47
if (env.contains(QLatin1String("USS_SHOW_ALL_UI"))) {
48
QString showAllS = env.value("USS_SHOW_ALL_UI", QString());
50
if(!showAllS.isEmpty()) {
56
// Show only if some screen is larger than the threshold.
58
LauncherPanelPluginImpl panel;
59
QString folder(env.value("SNAP", QString()) + LAUNCHER_PLUGIN_QML_DIR);
60
QQmlComponent guAccessorComponent(
61
&engine, QUrl::fromLocalFile(folder + "/GuAccessor.qml")
63
QScopedPointer<QObject> guAccessor(guAccessorComponent.create());
64
int largeScreenThreshold = guAccessor->property("largeScreenThreshold").toInt();
65
for (int i = 0; i < panel.screens(); i++) {
66
if (panel.screenGeometry(i).width() > largeScreenThreshold) {
75
void LauncherItem::setVisibility(bool visible)
80
ItemBase *LauncherPlugin::createItem(const QVariantMap &staticData,
83
return new LauncherItem(staticData, parent);
86
#include "launcher-plugin.moc"