mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
add a containment
it will replace most of the logic of Desktop.qml
This commit is contained in:
parent
5b39069d98
commit
62ff6312db
7 changed files with 258 additions and 0 deletions
|
|
@ -42,3 +42,4 @@ add_subdirectory(bin)
|
|||
add_subdirectory(qmlcomponents)
|
||||
add_subdirectory(services)
|
||||
add_subdirectory(settingsmodules)
|
||||
add_subdirectory(containments)
|
||||
|
|
|
|||
2
containments/CMakeLists.txt
Normal file
2
containments/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
plasma_install_package(homescreen org.kde.phone.homescreen)
|
||||
40
containments/homescreen/contents/ui/HomeLauncher.qml
Normal file
40
containments/homescreen/contents/ui/HomeLauncher.qml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kio 1.0 as Kio
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
width: applicationsView.cellWidth
|
||||
height: width
|
||||
onClicked: {
|
||||
console.log("Clicked: " + model.ApplicationStorageIdRole)
|
||||
appListModel.runApplication(model.ApplicationStorageIdRole)
|
||||
}
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
anchors.centerIn: parent
|
||||
width: units.iconSizes.large
|
||||
height: width
|
||||
source: model.ApplicationIconRole
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
visible: text.length > 0
|
||||
|
||||
anchors {
|
||||
top: icon.bottom
|
||||
left: icon.left
|
||||
right: icon.right
|
||||
}
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
|
||||
text: model.ApplicationNameRole
|
||||
font.pixelSize: theme.smallestFont.pixelSize
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
}
|
||||
}
|
||||
33
containments/homescreen/contents/ui/HomeLauncherSvg.qml
Normal file
33
containments/homescreen/contents/ui/HomeLauncherSvg.qml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: parent.width / parent.columns
|
||||
height: parent.buttonHeight
|
||||
property var callback
|
||||
property string text
|
||||
property string sub
|
||||
property alias svg: icon.svg
|
||||
property alias elementId: icon.elementId
|
||||
|
||||
PlasmaCore.SvgItem{
|
||||
id: icon
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
containments/homescreen/contents/ui/SatelliteStripe.qml
Normal file
21
containments/homescreen/contents/ui/SatelliteStripe.qml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
PlasmaCore.FrameSvgItem {
|
||||
z: -1
|
||||
imagePath: "widgets/background"
|
||||
enabledBorders: PlasmaCore.FrameSvgItem.TopBorder | PlasmaCore.FrameSvgItem.BottomBorder
|
||||
anchors {
|
||||
fill: parent
|
||||
topMargin: -margins.top
|
||||
bottomMargin: -margins.bottom
|
||||
}
|
||||
}
|
||||
|
||||
opacity: 0.6
|
||||
height: Math.max(100, units.gridUnit * 2.5)
|
||||
width: parent.width
|
||||
y: parent.height / 2 - height / 2
|
||||
x: 0
|
||||
}
|
||||
144
containments/homescreen/contents/ui/main.qml
Normal file
144
containments/homescreen/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* 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.1
|
||||
|
||||
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.satellite.components 0.1 as SatelliteComponents
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
property Item toolBox
|
||||
property alias appletsSpace: applicationsView.headerItem
|
||||
property int buttonHeight: width/4
|
||||
|
||||
Containment.onAppletAdded: {
|
||||
var container = appletContainerComponent.createObject(appletsSpace)
|
||||
container.visible = true
|
||||
print("Applet added: " + applet)
|
||||
applet.parent = container
|
||||
container.applet = applet
|
||||
applet.anchors.fill = applet.parent
|
||||
applet.visible = true
|
||||
container.width = 500
|
||||
container.height = 500
|
||||
}
|
||||
|
||||
Component {
|
||||
id: appletContainerComponent
|
||||
Item {
|
||||
property Item applet
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: Qt.rgba(0, 0, 0, 0.9 * (Math.min(applicationsView.contentY + root.height, root.height) / root.height))
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
PlasmaCore.ColorScope {
|
||||
anchors.fill: parent
|
||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
GridView {
|
||||
id: applicationsView
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
z: 1
|
||||
cellWidth: root.buttonHeight
|
||||
cellHeight: cellWidth
|
||||
model: SatelliteComponents.ApplicationListModel {
|
||||
id: appListModel
|
||||
}
|
||||
snapMode: GridView.SnapToRow
|
||||
//clip: true
|
||||
delegate: HomeLauncher {}
|
||||
header: MouseArea {
|
||||
z: 999
|
||||
width: root.width
|
||||
height: root.height - units.iconSizes.medium
|
||||
|
||||
onPressAndHold: {
|
||||
containment.action("configure").trigger();
|
||||
}
|
||||
|
||||
/*SatelliteStripe {
|
||||
id: stripe
|
||||
z: 99
|
||||
y: Math.max(applications.contentY + parent.height, parent.height - height)
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: stripeIcons
|
||||
imagePath: Qt.resolvedUrl("../images/homescreenicons.svg")
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
property int columns: 4
|
||||
property alias buttonHeight: stripe.height
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: phoneIcon
|
||||
svg: stripeIcons
|
||||
elementId: "phone"
|
||||
callback: function() {
|
||||
dialerOverlay.open()
|
||||
}
|
||||
}
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: messagingIcon
|
||||
svg: stripeIcons
|
||||
elementId: "messaging"
|
||||
callback: function() { console.log("Start messaging") }
|
||||
}
|
||||
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: emailIcon
|
||||
svg: stripeIcons
|
||||
elementId: "email"
|
||||
callback: function() { console.log("Start email") }
|
||||
}
|
||||
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: webIcon
|
||||
svg: stripeIcons
|
||||
elementId: "web"
|
||||
callback: function() { console.log("Start web") }
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("root Containment loaded")
|
||||
}
|
||||
}
|
||||
17
containments/homescreen/metadata.desktop
Normal file
17
containments/homescreen/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Phone Homescreen
|
||||
Type=Service
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Category=
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPLv2+
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.homescreen
|
||||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
Loading…
Reference in a new issue