on xenial help sign in
Revert r767, it wasn't ready yet.
commitccf24a25e8950cb700df3a306dd9383c875377fa authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 17 Mar 2014, 16:50 (13 years ago) parentdf0623c
5 files changed+168−3
plugins/Utils/CMakeLists.txt+1 plugins/Utils/bottombarvisibilitycommunicatorshell.cpp+49 plugins/Utils/bottombarvisibilitycommunicatorshell.h+59 plugins/Utils/plugin.cpp+10 qml/Shell.qml+49−3
plugins/Utils/CMakeLists.txt+1
@@ -12,6 +12,7 @@ include_directories(
1212
1313set(QMLPLUGIN_SRC
1414 albumartprovider.cpp
15+ bottombarvisibilitycommunicatorshell.cpp
1516 mediaartcache.cpp
1617 qlimitproxymodelqml.cpp
1718 qsortfilterproxymodelqml.cpp
plugins/Utils/bottombarvisibilitycommunicatorshell.cppnew file+49
@@ -0,0 +1,49 @@
1+/*
2+ * Copyright (C) 2012 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+ */
16+
17+#include "bottombarvisibilitycommunicatorshell.h"
18+
19+BottomBarVisibilityCommunicatorShell::BottomBarVisibilityCommunicatorShell()
20+ : m_forceHidden(false),
21+ m_position(0)
22+{
23+}
24+
25+bool BottomBarVisibilityCommunicatorShell::forceHidden() const
26+{
27+ return m_forceHidden;
28+}
29+
30+double BottomBarVisibilityCommunicatorShell::position() const
31+{
32+ return m_position;
33+}
34+
35+void BottomBarVisibilityCommunicatorShell::setForceHidden(bool forceHidden)
36+{
37+ if (forceHidden != m_forceHidden) {
38+ m_forceHidden = forceHidden;
39+ Q_EMIT forceHiddenChanged(forceHidden);
40+ }
41+}
42+
43+void BottomBarVisibilityCommunicatorShell::setPosition(double position)
44+{
45+ if (position != m_position) {
46+ m_position = position;
47+ Q_EMIT positionChanged(position);
48+ }
49+}
plugins/Utils/bottombarvisibilitycommunicatorshell.hnew file+59
@@ -0,0 +1,59 @@
1+/*
2+ * Copyright (C) 2012 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+ */
16+
17+#ifndef BOTTOMBARVISIBILITYCOMMUNICATORSHELL_H
18+#define BOTTOMBARVISIBILITYCOMMUNICATORSHELL_H
19+
20+#include <QObject>
21+
22+class QDBusInterface;
23+
24+/** This is an internal class used to talk with the bottom bar used by either
25+ * applications or the SDK.
26+ * There is a method to force the bottom bar to be hidden or otherwise behave as usual
27+ */
28+
29+class BottomBarVisibilityCommunicatorShell : public QObject
30+{
31+ Q_OBJECT
32+ Q_PROPERTY(bool forceHidden READ forceHidden WRITE setForceHidden NOTIFY forceHiddenChanged)
33+ Q_PROPERTY(double position READ position WRITE setPosition NOTIFY positionChanged)
34+
35+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Shell.BottomBarVisibilityCommunicator")
36+public:
37+ static BottomBarVisibilityCommunicatorShell& instance() {
38+ static BottomBarVisibilityCommunicatorShell instance;
39+ return instance;
40+ }
41+
42+ bool forceHidden() const;
43+ void setForceHidden(bool forceHidden);
44+
45+ double position() const;
46+ void setPosition(double position);
47+
48+Q_SIGNALS:
49+ void forceHiddenChanged(bool forceHidden);
50+ void positionChanged(double position);
51+
52+private:
53+ BottomBarVisibilityCommunicatorShell();
54+
55+ bool m_forceHidden;
56+ double m_position;
57+};
58+
59+#endif
plugins/Utils/plugin.cpp+10
@@ -27,11 +27,15 @@
2727
2828// local
2929#include "albumartprovider.h"
30+#include "bottombarvisibilitycommunicatorshell.h"
3031#include "qlimitproxymodelqml.h"
3132#include "qsortfilterproxymodelqml.h"
3233#include "timeformatter.h"
3334#include "unitymenumodelpaths.h"
3435
36+static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
37+static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
38+
3539void UtilsPlugin::registerTypes(const char *uri)
3640{
3741 Q_ASSERT(uri == QLatin1String("Utils"));
@@ -41,6 +45,7 @@ void UtilsPlugin::registerTypes(const char *uri)
4145 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
4246 qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
4347 qmlRegisterType<GDateTimeFormatter>(uri, 0, 1, "GDateTimeFormatter");
48+ qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
4449}
4550
4651void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -59,4 +64,9 @@ void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
5964 {
6065 qWarning() << "Failed to register image provider for albumart (unknown error)";
6166 }
67+
68+ QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
69+ BottomBarVisibilityCommunicatorShell *bottomBarVisibilityCommunicator = &BottomBarVisibilityCommunicatorShell::instance();
70+ QDBusConnection::sessionBus().registerObject(BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, bottomBarVisibilityCommunicator, QDBusConnection::ExportAllContents);
71+ engine->rootContext()->setContextProperty("bottomBarVisibilityCommunicatorShell", bottomBarVisibilityCommunicator);
6272}
qml/Shell.qml+49−3
@@ -28,7 +28,9 @@ import "Dash"
2828import "Greeter"
2929import "Launcher"
3030import "Panel"
31+import "Hud"
3132import "Components"
33+import "Bottombar"
3234import "SideStage"
3335import "Notifications"
3436import Unity.Notifications 1.0 as NotificationBackend
@@ -401,7 +403,7 @@ FocusScope {
401403
402404 readonly property int backgroundTopMargin: -panel.panelHeight
403405
404− hides: [launcher, panel.indicators]
406+ hides: [launcher, panel.indicators, hud]
405407 shown: false
406408 enabled: true
407409 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
@@ -456,7 +458,7 @@ FocusScope {
456458 objectName: "greeter"
457459
458460 available: true
459− hides: [launcher, panel.indicators]
461+ hides: [launcher, panel.indicators, hud]
460462 shown: true
461463
462464 defaultBackground: shell.background
@@ -543,7 +545,7 @@ FocusScope {
543545 InputFilterArea {
544546 anchors.fill: parent
545547 blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
546− || panel.indicators.shown
548+ || panel.indicators.shown || hud.shown
547549 }
548550
549551 Connections {
@@ -605,6 +607,48 @@ FocusScope {
605607 }
606608 }
607609
610+ Hud {
611+ id: hud
612+
613+ width: parent.width > units.gu(60) ? units.gu(40) : parent.width
614+ height: parent.height
615+
616+ available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
617+ shown: false
618+ showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
619+ hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
620+
621+ Connections {
622+ target: shell.applicationManager
623+ onMainStageFocusedApplicationChanged: hud.hide()
624+ onSideStageFocusedApplicationChanged: hud.hide()
625+ }
626+ }
627+
628+ Revealer {
629+ id: hudRevealer
630+
631+ enabled: hud.shown
632+ width: hud.width
633+ anchors.left: hud.left
634+ height: parent.height
635+ target: hud.revealerTarget
636+ closedValue: height
637+ openedValue: 0
638+ direction: Qt.RightToLeft
639+ orientation: Qt.Vertical
640+ handleSize: hud.handleHeight
641+ onCloseClicked: target.hide()
642+ }
643+
644+ Bottombar {
645+ id: bottombar
646+ theHud: hud
647+ anchors.fill: parent
648+ enabled: hud.available
649+ applicationIsOnForeground: applicationFocused
650+ }
651+
608652 InputFilterArea {
609653 blockInput: launcher.shown
610654 anchors {
@@ -649,6 +693,8 @@ FocusScope {
649693 onShownChanged: {
650694 if (shown) {
651695 panel.indicators.hide()
696+ hud.hide()
697+ bottombar.hide()
652698 }
653699 }
654700 }