Commit f1aa3d33 authored by Marco Martin's avatar Marco Martin
Browse files

move launcher in standalone component

parent 20c14e93
......@@ -49,20 +49,18 @@ Window {
margins: Kirigami.Units.largeSpacing
topMargin: Kirigami.Units.largeSpacing + plasmoid.availableScreenRect.y
}
onStateChanged: {
if (state != "idle") {
skillView.open = true;
}
}
}
Mycroft.SkillView {
id: skillView
anchors.fill: parent
open: false
Keys.onEscapePressed: window.visible = false;
onOpenChanged: {
if (open) {
window.showMaximized();
} else {
window.visible = false;
}
}
}
......
/*
Copyright 2019 MArco MArtni <mart@kde.org>
Copyright 2013-2017 Jan Grulich <jgrulich@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
PlasmaCore.IconItem {
id: connectionIcon
source: connectionIconProvider.connectionIcon
colorGroup: PlasmaCore.ColorScope.colorGroup
Layout.fillHeight: true
Layout.preferredWidth: height
PlasmaComponents.BusyIndicator {
id: connectingIndicator
anchors.fill: parent
running: connectionIconProvider.connecting
visible: running
}
PlasmaNM.NetworkStatus {
id: networkStatus
}
PlasmaNM.ConnectionIcon {
id: connectionIconProvider
}
}
/*
* Copyright 2019 Aditya Mehra <aix.m@outlook.com>
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3 as Controls
import QtQuick.Window 2.3
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.private.biglauncher 1.0 as Launcher
import org.kde.kirigami 2.5 as Kirigami
PlasmaCore.ColorScope {
id: root
readonly property int reservedSpaceForLabel: metrics.height
property var appsModel: applicationListModel
property var voiceAppsModel: voiceAppListModel
signal activateAppView
signal activateTopNavBar
signal activateSettingsView
Launcher.ApplicationListModel {
id: applicationListModel
}
Launcher.VoiceAppListModel {
id: voiceAppListModel
}
Component.onCompleted: {
root.forceActiveFocus();
applicationListModel.loadApplications();
voiceAppListModel.loadApplications();
root.activateAppView();
}
Connections {
target: applicationListModel
onAppOrderChanged: {
root.activateAppView()
}
}
Connections {
target: root
onActivateTopNavBar: {
topButtonBar.focus = true
}
}
Controls.Label {
id: metrics
text: "M\nM"
visible: false
}
ColumnLayout {
anchors.fill: parent
RowLayout {
id: topButtonBar
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
PlasmaComponents3.Button {
text: "Home"
Layout.fillWidth: true
focus: false
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
flat: topBarLoader.currentIndex !== 0 ? 1 : 0
onClicked: {
topBarLoader.currentIndex = 0
root.activateAppView()
}
Rectangle {
id: homeBtnHighLighter
visible: topButtonBar.focus && topBarLoader.currentIndex == 0 ? 1 : 0
color: Kirigami.Theme.linkColor
height: Kirigami.Units.smallSpacing * 0.5
anchors.left: parent.left
anchors.leftMargin: Kirigami.Units.smallSpacing
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.bottom: parent.bottom
anchors.bottomMargin: Kirigami.Units.smallSpacing
}
}
PlasmaComponents3.Button {
text: "Settings"
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
focus: false
flat: topBarLoader.currentIndex !== 1 ? 1 : 0
onClicked: {
topBarLoader.currentIndex = 1
}
Rectangle {
id: settingsBtnHighLighter
visible: topButtonBar.focus && topBarLoader.currentIndex == 1 ? 1 : 0
color: Kirigami.Theme.linkColor
height: Kirigami.Units.smallSpacing * 0.5
anchors.left: parent.left
anchors.leftMargin: Kirigami.Units.smallSpacing
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.bottom: parent.bottom
anchors.bottomMargin: Kirigami.Units.smallSpacing
}
}
Keys.onRightPressed: {
topBarLoader.currentIndex = 1
}
Keys.onLeftPressed: {
topBarLoader.currentIndex = 0
}
Keys.onDownPressed: {
if(topBarLoader.currentIndex == 0) {
root.activateAppView();
} else if (topBarLoader.currentIndex == 1) {
root.activateSettingsView();
}
}
}
StackLayout {
id: topBarLoader
Layout.fillWidth: true
Layout.preferredHeight: parent.height - (topButtonBar.height + Kirigami.Units.largeSpacing)
currentIndex: 0
clip: true
Item {
LauncherHome{}
}
Item {
PlaceHolderPage{}
}
Component.onCompleted: {
root.activateAppView();
}
}
}
}
......@@ -22,155 +22,109 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3 as Controls
import QtQuick.Window 2.3
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0
import org.kde.private.biglauncher 1.0 as Launcher
import org.kde.kirigami 2.5 as Kirigami
import Mycroft 1.0 as Mycroft
import "launcher"
import "indicators" as Indicators
PlasmaCore.ColorScope {
Item {
id: root
Layout.minimumWidth: Screen.desktopAvailableWidth
Layout.minimumHeight: Screen.desktopAvailableHeight * 0.6
Plasmoid.backgroundHints: "NoBackground"
readonly property int reservedSpaceForLabel: metrics.height
property var appsModel: applicationListModel
property var voiceAppsModel: voiceAppListModel
signal activateAppView
signal activateTopNavBar
signal activateSettingsView
MycroftWindow {}
Launcher.ApplicationListModel {
id: applicationListModel
MycroftWindow {
id: mycroftWindow
}
Launcher.VoiceAppListModel {
id: voiceAppListModel
}
Component.onCompleted: {
root.forceActiveFocus();
applicationListModel.loadApplications();
voiceAppListModel.loadApplications();
root.activateAppView();
}
Rectangle {
anchors {
left: parent.left
top: parent.top
right: parent.right
}
height: units.iconSizes.medium + units.smallSpacing * 2
opacity: !mycroftWindow.visible
Connections {
target: applicationListModel
onAppOrderChanged: {
root.activateAppView()
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, 0.6) }
GradientStop { position: 1; color: "transparent" }
}
}
Connections {
target: root
onActivateTopNavBar: {
topButtonBar.focus = true
Behavior on opacity {
OpacityAnimator {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
Controls.Label {
id: metrics
text: "M\nM"
visible: false
}
ColumnLayout {
anchors.fill: parent
RowLayout {
id: topButtonBar
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
PlasmaComponents3.Button {
text: "Home"
Layout.fillWidth: true
focus: false
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
flat: topBarLoader.currentIndex !== 0 ? 1 : 0
onClicked: {
topBarLoader.currentIndex = 0
root.activateAppView()
}
Rectangle {
id: homeBtnHighLighter
visible: topButtonBar.focus && topBarLoader.currentIndex == 0 ? 1 : 0
color: Kirigami.Theme.linkColor
height: Kirigami.Units.smallSpacing * 0.5
anchors.left: parent.left
anchors.leftMargin: Kirigami.Units.smallSpacing
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.bottom: parent.bottom
anchors.bottomMargin: Kirigami.Units.smallSpacing
}
}
PlasmaComponents3.Button {
text: "Settings"
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
focus: false
flat: topBarLoader.currentIndex !== 1 ? 1 : 0
onClicked: {
topBarLoader.currentIndex = 1
}
Rectangle {
id: settingsBtnHighLighter
visible: topButtonBar.focus && topBarLoader.currentIndex == 1 ? 1 : 0
color: Kirigami.Theme.linkColor
height: Kirigami.Units.smallSpacing * 0.5
anchors.left: parent.left
anchors.leftMargin: Kirigami.Units.smallSpacing
anchors.right: parent.right
anchors.rightMargin: Kirigami.Units.smallSpacing
anchors.bottom: parent.bottom
anchors.bottomMargin: Kirigami.Units.smallSpacing
}
}
Keys.onRightPressed: {
topBarLoader.currentIndex = 1
anchors {
right: parent.right
top: parent.top
bottom: parent.bottom
margins: units.smallSpacing
}
Keys.onLeftPressed: {
topBarLoader.currentIndex = 0
}
Keys.onDownPressed: {
if(topBarLoader.currentIndex == 0) {
root.activateAppView();
} else if (topBarLoader.currentIndex == 1) {
root.activateSettingsView();
}
Indicators.Wifi {
Layout.fillHeight: true
implicitWidth: height
anchors.centerIn: mycroftIndicator
}
}
}
StackLayout {
id: topBarLoader
Layout.fillWidth: true
Layout.preferredHeight: parent.height - (topButtonBar.height + Kirigami.Units.largeSpacing)
currentIndex: 0
clip: true
LauncherMenu {
id: launcher
width: parent.width
height: parent.height
Item {
LauncherHome{}
states: [
State {
when: !mycroftWindow.visible
PropertyChanges {
target: launcher
opacity: 1
y: 0
}
},
State {
when: mycroftWindow.visible
PropertyChanges {
target: launcher
opacity: 0
y: root.height / 4
}
}
]
Item {
PlaceHolderPage{}
transitions: [
Transition {
ParallelAnimation {
OpacityAnimator {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
YAnimator {
duration: units.longDuration
easing.type: Easing.InOutQuad
}
}
}
]
}
Component.onCompleted: {
root.activateAppView();
}
Mycroft.StatusIndicator {
id: mycroftIndicator
z: 2
visible: !mycroftWindow.visible
anchors {
right: parent.right
top: parent.top
margins: Kirigami.Units.largeSpacing
topMargin: Kirigami.Units.largeSpacing + plasmoid.availableScreenRect.y
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment