mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
make plamo shell inherit from plasma nano
This commit is contained in:
parent
6dd77469a1
commit
e1d7844b82
19 changed files with 5 additions and 1764 deletions
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
Layout.minimumWidth: units.gridUnit * 20
|
||||
Layout.minimumHeight: units.gridUnit * 8
|
||||
|
||||
property alias reason: messageText.text
|
||||
|
||||
clip: true
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.minimumWidth: units.iconSizes.huge
|
||||
Layout.minimumHeight: units.iconSizes.huge
|
||||
source: "dialog-error"
|
||||
}
|
||||
|
||||
PlasmaComponents.TextArea {
|
||||
id: messageText
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
verticalAlignment: TextEdit.AlignVCenter
|
||||
backgroundVisible: false
|
||||
readOnly: true
|
||||
width: parent.width - icon.width
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
|
||||
import org.kde.plasma.private.mobileshell 2.0 as MobileShell
|
||||
|
||||
Item {
|
||||
id: root
|
||||
objectName: "org.kde.desktop-CompactApplet"
|
||||
anchors.fill: parent
|
||||
|
||||
property Item fullRepresentation
|
||||
property Item compactRepresentation
|
||||
property Item expandedFeedback: null
|
||||
|
||||
property Item rootItem: {
|
||||
var item = root
|
||||
while (item.parent) {
|
||||
item = item.parent;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
onCompactRepresentationChanged: {
|
||||
if (compactRepresentation) {
|
||||
compactRepresentation.parent = root;
|
||||
compactRepresentation.anchors.fill = root;
|
||||
compactRepresentation.visible = true;
|
||||
}
|
||||
root.visible = true;
|
||||
}
|
||||
|
||||
onFullRepresentationChanged: {
|
||||
|
||||
if (!fullRepresentation) {
|
||||
return;
|
||||
}
|
||||
|
||||
fullRepresentation.parent = appletParent;
|
||||
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
||||
fullRepresentation.anchors.margins = appletParent.margins.top;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: plasmoid
|
||||
onExpandedChanged: {
|
||||
if (plasmoid.expanded) {
|
||||
expandedOverlay.showFullScreen()
|
||||
} else {
|
||||
expandedOverlay.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MobileShell.FullScreenPanel {
|
||||
id: expandedOverlay
|
||||
color: Qt.rgba(0, 0, 0, 0.5)
|
||||
visible: plasmoid.expanded
|
||||
width: Screen.width
|
||||
height: Screen.height
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: plasmoid.expanded = false
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: appletParent
|
||||
imagePath: "widgets/background"
|
||||
//used only indesktop mode, not panel
|
||||
|
||||
property bool wideMode: expandedOverlay.width > width * 2
|
||||
|
||||
x: wideMode
|
||||
? Math.min(parent.width - width - units.largeSpacing, Math.max(units.largeSpacing, root.mapToItem(root.rootItem, 0, 0).x + root.width / 2 - width / 2))
|
||||
: expandedOverlay.width/2 - width/2
|
||||
y: wideMode
|
||||
? Math.min(parent.height - height - units.largeSpacing, Math.max(units.largeSpacing, root.mapToItem(root.rootItem, 0, 0).y + root.height / 2 - height / 2))
|
||||
: units.largeSpacing
|
||||
width: Math.min(expandedOverlay.width - units.largeSpacing * 2, Math.max(Math.max(root.fullRepresentation.implicitWidth, units.gridUnit * 15), plasmoid.switchWidth) * 1.5)
|
||||
height: Math.min(expandedOverlay.height - units.largeSpacing * 2, Math.max(Math.max(root.fullRepresentation.implicitHeight, units.gridUnit * 15), plasmoid.switchHeight) * 1.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
Item {
|
||||
id: main
|
||||
|
||||
Layout.minimumWidth: {
|
||||
switch (plasmoid.formFactor) {
|
||||
case PlasmaCore.Types.Vertical:
|
||||
return 0;
|
||||
case PlasmaCore.Types.Horizontal:
|
||||
return height;
|
||||
default:
|
||||
return units.gridUnit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
Layout.minimumHeight: {
|
||||
switch (plasmoid.formFactor) {
|
||||
case PlasmaCore.Types.Vertical:
|
||||
return width;
|
||||
case PlasmaCore.Types.Horizontal:
|
||||
return 0;
|
||||
default:
|
||||
return units.gridUnit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
source: plasmoid.icon ? plasmoid.icon : "plasma"
|
||||
active: mouseArea.containsMouse
|
||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
property bool wasExpanded: false
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: wasExpanded = plasmoid.expanded
|
||||
onClicked: plasmoid.expanded = !wasExpanded
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Text {
|
||||
width: parent.width / parent.columns
|
||||
height: parent.buttonHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
color: dialer.textColor
|
||||
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||
property alias sub: longHold.text
|
||||
property var callback
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (longHold.visible) {
|
||||
addNumber(longHold.text);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: longHold
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
visible: text.length > 0
|
||||
opacity: 0.7
|
||||
|
||||
font.pixelSize: parent.pixelSize * .8
|
||||
color: parent.color
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
width: parent.width / parent.columns
|
||||
height: parent.buttonHeight
|
||||
property var callback
|
||||
property string text
|
||||
property string sub
|
||||
property alias source: icon.source
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (parent.sub.length > 0) {
|
||||
addNumber(parent.sub);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
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: applications.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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
|
||||
|
||||
height: units.gridUnit * 2
|
||||
width: parent.width
|
||||
anchors.bottomMargin: 10
|
||||
drag.axis: Drag.XAxis
|
||||
drag.target: root
|
||||
|
||||
property bool expanded: false
|
||||
property var textGradient: Gradient {
|
||||
GradientStop { position: 1.0; color: "#FF00000C" }
|
||||
GradientStop { position: 0.0; color: "#00000C00" }
|
||||
}
|
||||
property color textGradientOverlay: "#9900000C"
|
||||
|
||||
Behavior on x {
|
||||
SpringAnimation { spring: 2; damping: 0.2 }
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
SpringAnimation { spring: 5; damping: 0.3 }
|
||||
}
|
||||
|
||||
onExpandedChanged: {
|
||||
if (expanded && body) {
|
||||
height = units.gridUnit * 4;
|
||||
} else {
|
||||
height = units.gridUnit * 2;
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
if (drag.active) {
|
||||
if (x > width / 4 || x < width / -4) {
|
||||
notificationsModel.remove(index);
|
||||
} else {
|
||||
x = 0;
|
||||
}
|
||||
} else if (body) {
|
||||
expanded = !expanded;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
visible: !root.expanded
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: units.largeSpacing
|
||||
y: 0
|
||||
source: appIcon && appIcon.length > 0 ? appIcon : "im-user"
|
||||
}
|
||||
|
||||
Item {
|
||||
id: rounded
|
||||
clip: true
|
||||
height: parent.height
|
||||
width: height / 2
|
||||
visible: !root.expanded
|
||||
anchors {
|
||||
left: icon.right
|
||||
leftMargin: units.largeSpacing
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: roundedRect
|
||||
height: parent.height
|
||||
width: parent.width * 2
|
||||
radius: height //Math.max(height, units.gridUnit)
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
gradient: root.textGradient
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: height / 2
|
||||
color: textGradientOverlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: summaryArea
|
||||
width: parent.width - icon.width - rounded.width - (units.largeSpacing * 2)
|
||||
height: parent.height
|
||||
anchors {
|
||||
left: root.expanded ? root.left : rounded.right
|
||||
right: root.right
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
gradient: root.textGradient
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: textGradientOverlay
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: summaryText
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
horizontalAlignment: root.expanded ? Qt.AlignHCenter : Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
text: summary + (root.expanded ? (body ? "\n" + body : '') :
|
||||
(body ? '...' : ''))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: extraArea
|
||||
width: parent.width
|
||||
height: parent.width
|
||||
anchors {
|
||||
left: summaryArea.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
gradient: root.textGradient
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: textGradientOverlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
|
@ -1,388 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Controls 1.0 as QtControls
|
||||
import QtQuick.Layouts 1.0
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
|
||||
//TODO: all of this will be done with desktop components
|
||||
Rectangle {
|
||||
id: root
|
||||
Layout.minimumWidth: units.gridUnit * 20
|
||||
Layout.minimumHeight: units.gridUnit * 20
|
||||
|
||||
//BEGIN properties
|
||||
color: Qt.rgba(0, 0, 0, (1 - Math.abs(panel.x / (panel.width/2))) * 0.8)
|
||||
width: units.gridUnit * 40
|
||||
height: units.gridUnit * 30
|
||||
|
||||
property bool isContainment: false
|
||||
//END properties
|
||||
|
||||
//BEGIN model
|
||||
property ConfigModel globalConfigModel: globalAppletConfigModel
|
||||
|
||||
ConfigModel {
|
||||
id: globalAppletConfigModel
|
||||
}
|
||||
//END model
|
||||
|
||||
//BEGIN functions
|
||||
function saveConfig() {
|
||||
if (main.currentItem.saveConfig) {
|
||||
main.currentItem.saveConfig()
|
||||
} else {
|
||||
for (var key in plasmoid.configuration) {
|
||||
if (main.currentItem["cfg_"+key] !== undefined) {
|
||||
plasmoid.configuration[key] = main.currentItem["cfg_"+key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restoreConfig() {
|
||||
for (var key in plasmoid.configuration) {
|
||||
if (main.currentItem["cfg_"+key] !== undefined) {
|
||||
main.currentItem["cfg_"+key] = plasmoid.configuration[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function configurationHasChanged() {
|
||||
for (var key in plasmoid.configuration) {
|
||||
if (main.currentItem["cfg_"+key] !== undefined) {
|
||||
//for objects == doesn't work
|
||||
if (typeof plasmoid.configuration[key] == 'object') {
|
||||
for (var i in plasmoid.configuration[key]) {
|
||||
if (plasmoid.configuration[key][i] != main.currentItem["cfg_"+key][i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (main.currentItem["cfg_"+key] != plasmoid.configuration[key]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function settingValueChanged() {
|
||||
if (main.currentItem.saveConfig !== undefined) {
|
||||
main.currentItem.saveConfig();
|
||||
} else {
|
||||
root.saveConfig();
|
||||
}
|
||||
}
|
||||
//END functions
|
||||
|
||||
|
||||
//BEGIN connections
|
||||
Component.onCompleted: {
|
||||
if (!isContainment && configDialog.configModel && configDialog.configModel.count > 0) {
|
||||
main.sourceFile = configDialog.configModel.get(0).source
|
||||
main.title = configDialog.configModel.get(0).name
|
||||
} else {
|
||||
main.sourceFile = globalConfigModel.get(0).source
|
||||
main.title = globalConfigModel.get(0).name
|
||||
}
|
||||
}
|
||||
//END connections
|
||||
|
||||
//BEGIN UI components
|
||||
SystemPalette {id: syspal}
|
||||
|
||||
NumberAnimation {
|
||||
id: openAnim
|
||||
running: true
|
||||
target: panel
|
||||
properties: "x"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
to: 0
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: closeAnim
|
||||
NumberAnimation {
|
||||
target: panel
|
||||
properties: "x"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
to: -panel.width
|
||||
}
|
||||
ScriptAction {
|
||||
script: cancelAction.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
running: true
|
||||
interval: 250
|
||||
onTriggered: {
|
||||
openAnim.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: messageDialog
|
||||
icon: StandardIcon.Warning
|
||||
property Item delegate
|
||||
title: i18nd("plasma_shell_org.kde.plasma.desktop", "Apply Settings")
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "The settings of the current module have changed. Do you want to apply the changes or discard them?")
|
||||
standardButtons: StandardButton.Apply | StandardButton.Discard | StandardButton.Cancel
|
||||
onApply: {
|
||||
applyAction.trigger()
|
||||
delegate.openCategory()
|
||||
}
|
||||
onDiscard: {
|
||||
delegate.openCategory()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.filterChildren: true
|
||||
drag.target: panel
|
||||
drag.axis: Drag.XAxis
|
||||
drag.maximumX: 0
|
||||
onReleased: {
|
||||
if (panel.x < -panel.width/3) {
|
||||
closeAnim.running = true;
|
||||
} else {
|
||||
openAnim.running = true;
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (mouse.x > main.width) {
|
||||
closeAnim.running = true;
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: panel
|
||||
x: -width
|
||||
width: parent.width - parent.width/6
|
||||
height: root.height
|
||||
color: syspal.window
|
||||
ColumnLayout {
|
||||
id: mainColumn
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: mainColumn.spacing //margins are hardcoded in QStyle we should match that here
|
||||
}
|
||||
property int implicitWidth: Math.max(contentRow.implicitWidth, buttonsRow.implicitWidth) + 8
|
||||
property int implicitHeight: contentRow.implicitHeight + buttonsRow.implicitHeight + 8
|
||||
|
||||
RowLayout {
|
||||
id: contentRow
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
spacing: units.largeSpacing
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredHeight: parent.height - buttonsRow.height
|
||||
|
||||
QtControls.ScrollView {
|
||||
id: categoriesScroll
|
||||
frameVisible: true
|
||||
Layout.fillHeight: true
|
||||
visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1
|
||||
width: visible ? units.gridUnit * 7 : 0
|
||||
implicitWidth: width
|
||||
flickableItem.interactive: false
|
||||
|
||||
Rectangle {
|
||||
width: categoriesScroll.viewport.width
|
||||
height: Math.max(categoriesScroll.viewport.height, categories.height)
|
||||
color: syspal.base
|
||||
|
||||
Column {
|
||||
id: categories
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
property Item currentItem: children[1]
|
||||
|
||||
Repeater {
|
||||
model: root.isContainment ? globalConfigModel : undefined
|
||||
delegate: ConfigCategoryDelegate {}
|
||||
}
|
||||
Repeater {
|
||||
model: configDialog.configModel
|
||||
delegate: ConfigCategoryDelegate {}
|
||||
}
|
||||
Repeater {
|
||||
model: !root.isContainment ? globalConfigModel : undefined
|
||||
delegate: ConfigCategoryDelegate {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.ScrollView {
|
||||
id: scroll
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Column {
|
||||
spacing: units.largeSpacing / 2
|
||||
|
||||
QtControls.Label {
|
||||
id: pageTitle
|
||||
width: scroll.viewport.width
|
||||
font.pointSize: theme.defaultFont.pointSize*2
|
||||
font.weight: Font.Light
|
||||
text: main.title
|
||||
}
|
||||
|
||||
QtControls.StackView {
|
||||
id: main
|
||||
property string title: ""
|
||||
property bool invertAnimations: false
|
||||
|
||||
height: Math.max((scroll.viewport.height - pageTitle.height - parent.spacing), (main.currentItem ? (main.currentItem.implicitHeight ? main.currentItem.implicitHeight : main.currentItem.childrenRect.height) : 0))
|
||||
width: scroll.viewport.width
|
||||
|
||||
property string sourceFile
|
||||
|
||||
onSourceFileChanged: {
|
||||
// print("Source file changed in flickable" + sourceFile);
|
||||
replace(Qt.resolvedUrl(sourceFile));
|
||||
root.restoreConfig()
|
||||
for (var prop in currentItem) {
|
||||
if (prop.indexOf("cfg_") === 0 && prop.indexOf("Changed") > 0 ) {
|
||||
currentItem[prop].connect(root.settingValueChanged)
|
||||
}
|
||||
}
|
||||
if (currentItem["configurationChanged"]) {
|
||||
currentItem["configurationChanged"].connect(root.settingValueChanged)
|
||||
}
|
||||
/*
|
||||
* This is not needed on a desktop shell that has ok/apply/cancel buttons, i'll leave it here only for future reference until we have a prototype for the active shell.
|
||||
* root.pageChanged will start a timer, that in turn will call saveConfig() when triggered
|
||||
|
||||
for (var prop in currentItem) {
|
||||
if (prop.indexOf("cfg_") === 0) {
|
||||
currentItem[prop+"Changed"].connect(root.pageChanged)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
delegate: QtControls.StackViewDelegate {
|
||||
function transitionFinished(properties)
|
||||
{
|
||||
properties.exitItem.opacity = 1
|
||||
}
|
||||
|
||||
pushTransition: QtControls.StackViewTransition {
|
||||
PropertyAnimation {
|
||||
target: enterItem
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: enterItem
|
||||
property: "x"
|
||||
from: main.invertAnimations ? -target.width/3: target.width/3
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: exitItem
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: exitItem
|
||||
property: "x"
|
||||
from: 0
|
||||
to: main.invertAnimations ? target.width/3 : -target.width/3
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Action {
|
||||
id: acceptAction
|
||||
onTriggered: {
|
||||
applyAction.trigger();
|
||||
configDialog.close();
|
||||
}
|
||||
shortcut: "Return"
|
||||
}
|
||||
|
||||
QtControls.Action {
|
||||
id: applyAction
|
||||
onTriggered: {
|
||||
if (main.currentItem.saveConfig !== undefined) {
|
||||
main.currentItem.saveConfig();
|
||||
} else {
|
||||
root.saveConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Action {
|
||||
id: cancelAction
|
||||
onTriggered: configDialog.close();
|
||||
shortcut: "Escape"
|
||||
}
|
||||
}
|
||||
LinearGradient {
|
||||
width: units.gridUnit/2
|
||||
anchors {
|
||||
left: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
rightMargin: -1
|
||||
}
|
||||
start: Qt.point(0, 0)
|
||||
end: Qt.point(units.gridUnit/2, 0)
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.3
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.0
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//END UI components
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import QtQuick.Controls 1.0 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
MouseArea {
|
||||
id: delegate
|
||||
|
||||
//BEGIN properties
|
||||
y: units.smallSpacing *2
|
||||
width: parent.width
|
||||
height: delegateContents.height + units.smallSpacing * 4
|
||||
hoverEnabled: true
|
||||
property bool current: model.source == main.sourceFile
|
||||
property string name: model.name
|
||||
//END properties
|
||||
|
||||
//BEGIN functions
|
||||
function openCategory() {
|
||||
if (typeof(categories.currentItem) !== "undefined") {
|
||||
main.invertAnimations = (categories.currentItem.y > delegate.y);
|
||||
categories.currentItem = delegate;
|
||||
}
|
||||
main.sourceFile = model.source
|
||||
main.title = model.name
|
||||
}
|
||||
//END functions
|
||||
|
||||
//BEGIN connections
|
||||
onClicked: {
|
||||
print("model source: " + model.source + " " + main.sourceFile);
|
||||
if (root.configurationHasChanged()) {
|
||||
messageDialog.delegate = delegate
|
||||
messageDialog.open();
|
||||
return;
|
||||
}
|
||||
if (delegate.current) {
|
||||
return;
|
||||
} else {
|
||||
openCategory();
|
||||
}
|
||||
}
|
||||
onCurrentChanged: {
|
||||
if (current) {
|
||||
categories.currentItem = delegate;
|
||||
}
|
||||
}
|
||||
//END connections
|
||||
|
||||
//BEGIN UI components
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: syspal.highlight
|
||||
opacity: {
|
||||
if (categories.currentItem == delegate) {
|
||||
return 1
|
||||
} else if (delegate.containsMouse) {
|
||||
return 0.3 // there's no "hover" color in SystemPalette
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: delegateContents
|
||||
spacing: units.smallSpacing
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: theme.IconSizeHuge
|
||||
height: width
|
||||
source: model.icon
|
||||
}
|
||||
QtControls.Label {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
text: model.name
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: current ? syspal.highlightedText : syspal.text
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: units.longDuration
|
||||
easing.type: "InOutQuad"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//END UI components
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import org.kde.plasma.configuration 2.0
|
||||
import QtQuick.Controls 1.0 as QtControls
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
property string currentWallpaper: "org.kde.image"
|
||||
property string containmentPlugin: ""
|
||||
signal configurationChanged
|
||||
|
||||
//BEGIN functions
|
||||
function saveConfig() {
|
||||
for (var key in configDialog.wallpaperConfiguration) {
|
||||
if (main.currentItem["cfg_"+key] !== undefined) {
|
||||
configDialog.wallpaperConfiguration[key] = main.currentItem["cfg_"+key]
|
||||
}
|
||||
}
|
||||
configDialog.currentWallpaper = root.currentWallpaper;
|
||||
configDialog.applyWallpaper()
|
||||
}
|
||||
|
||||
function restoreConfig() {
|
||||
for (var key in configDialog.wallpaperConfiguration) {
|
||||
if (main.currentItem["cfg_"+key] !== undefined) {
|
||||
main.currentItem["cfg_"+key] = configDialog.wallpaperConfiguration[key]
|
||||
}
|
||||
|
||||
if (main.currentItem["cfg_"+key+"Changed"]) {
|
||||
main.currentItem["cfg_"+key+"Changed"].connect(root.configurationChanged)
|
||||
}
|
||||
}
|
||||
}
|
||||
//END functions
|
||||
|
||||
Item {
|
||||
id: emptyConfig
|
||||
}
|
||||
|
||||
QtControls.StackView {
|
||||
id: main
|
||||
Layout.fillHeight: true;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
property string sourceFile
|
||||
onSourceFileChanged: {
|
||||
if (sourceFile != "") {
|
||||
replace(Qt.resolvedUrl(sourceFile))
|
||||
} else {
|
||||
replace(emptyConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < configDialog.wallpaperConfigModel.count; ++i) {
|
||||
var data = configDialog.wallpaperConfigModel.get(i);
|
||||
if (configDialog.currentWallpaper == data.pluginName) {
|
||||
main.sourceFile = data.source;
|
||||
break;
|
||||
}
|
||||
}
|
||||
root.restoreConfig()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 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.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
|
||||
AppletConfiguration {
|
||||
id: root
|
||||
isContainment: true
|
||||
Layout.minimumWidth: Math.min(plasmoid.availableScreenRect.width, units.gridUnit * 32)
|
||||
Layout.minimumHeight: Math.min(plasmoid.availableScreenRect.height, units.gridUnit * 36)
|
||||
|
||||
//BEGIN model
|
||||
globalConfigModel: globalContainmentConfigModel
|
||||
|
||||
ConfigModel {
|
||||
id: globalContainmentConfigModel
|
||||
ConfigCategory {
|
||||
name: i18nd("plasma_shell_org.kde.plasma.desktop", "Wallpaper")
|
||||
icon: "preferences-desktop-wallpaper"
|
||||
source: "ConfigurationContainmentAppearance.qml"
|
||||
}
|
||||
}
|
||||
//END model
|
||||
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
LookAndFeelPackage=org.kde.plasma.phone
|
||||
|
||||
[Desktop]
|
||||
Containment=org.kde.phone.homescreen
|
||||
ToolBox=
|
||||
Containment=org.kde.phone.homescreen2
|
||||
ToolBox=org.kde.plasma.nano.desktoptoolbox
|
||||
|
||||
[Desktop][ContainmentActions]
|
||||
|
||||
[plasmarc][Theme]
|
||||
name=breeze-dark
|
||||
name=breeze
|
||||
|
|
|
|||
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 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 Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.draganddrop 2.0
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
|
||||
Item {
|
||||
id: delegate
|
||||
|
||||
readonly property string pluginName: model.pluginName
|
||||
|
||||
width: list.cellWidth
|
||||
height: list.cellHeight
|
||||
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
spacing: units.smallSpacing
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
//bottom: parent.bottom
|
||||
margins: units.smallSpacing * 2
|
||||
rightMargin: units.smallSpacing * 2 // don't cram the text to the border too much
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
Item {
|
||||
id: iconContainer
|
||||
width: units.iconSizes.huge
|
||||
height: width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Item {
|
||||
id: iconWidget
|
||||
anchors.fill: parent
|
||||
QIconItem {
|
||||
anchors.fill: parent
|
||||
icon: model.decoration
|
||||
visible: model.screenshot == ""
|
||||
}
|
||||
Image {
|
||||
width: units.iconSizes.huge
|
||||
height: width
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: model.screenshot
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
id: badgeMask
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
x: Math.round(-units.smallSpacing * 1.5 / 2)
|
||||
y: x
|
||||
width: runningBadge.width + Math.round(units.smallSpacing * 1.5)
|
||||
height: width
|
||||
radius: height
|
||||
visible: running
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: runningBadge
|
||||
width: height
|
||||
height: Math.round(theme.mSize(countLabel.font).height * 1.3)
|
||||
radius: height
|
||||
color: theme.highlightColor
|
||||
visible: running
|
||||
onVisibleChanged: maskShaderSource.scheduleUpdate()
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: countLabel
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: running
|
||||
}
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
property var source: ShaderEffectSource {
|
||||
sourceItem: iconWidget
|
||||
hideSource: true
|
||||
live: false
|
||||
}
|
||||
property var mask: ShaderEffectSource {
|
||||
id: maskShaderSource
|
||||
sourceItem: badgeMask
|
||||
hideSource: true
|
||||
live: false
|
||||
}
|
||||
|
||||
supportsAtlasTextures: true
|
||||
|
||||
fragmentShader: "
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform lowp sampler2D source;
|
||||
uniform lowp sampler2D mask;
|
||||
void main() {
|
||||
gl_FragColor = texture2D(source, qt_TexCoord0.st) * (1.0 - (texture2D(mask, qt_TexCoord0.st).a)) * qt_Opacity;
|
||||
}
|
||||
"
|
||||
}
|
||||
}
|
||||
PlasmaExtras.Heading {
|
||||
id: heading
|
||||
Layout.fillWidth: true
|
||||
level: 4
|
||||
text: model.name
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 2
|
||||
lineHeight: 0.95
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
Layout.fillWidth: true
|
||||
// otherwise causes binding loop due to the way the Plasma sets the height
|
||||
height: implicitHeight
|
||||
text: model.description
|
||||
font.pointSize: theme.smallestFont.pointSize
|
||||
wrapMode: Text.WordWrap
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: heading.lineCount === 1 ? 3 : 2
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
widgetExplorer.addApplet(pluginName);
|
||||
root.closed()
|
||||
}
|
||||
onEntered: list.currentIndex = index
|
||||
onExited: list.currentIndex = -1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,306 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 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 Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import org.kde.kirigami 2.2 as Kirigami
|
||||
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.private.shell 2.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: Qt.rgba(0, 0, 0, (1 - Math.abs(main.x / (main.width/2))) * 0.8)
|
||||
signal closed()
|
||||
property alias containment: widgetExplorer.containment
|
||||
|
||||
Component.onCompleted: splitDrawer.contentX = typeSelector.width
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.filterChildren: true
|
||||
drag.target: splitDrawer.open ? null : main
|
||||
drag.axis: Drag.XAxis
|
||||
drag.maximumX: 0
|
||||
onReleased: {
|
||||
if (main.x < -main.width/3) {
|
||||
removeAnim.running = true;
|
||||
} else {
|
||||
openAnim.running = true;
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (mouse.x > main.width) {
|
||||
removeAnim.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: openAnim
|
||||
running: true
|
||||
target: main
|
||||
properties: "x"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
to: 0
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: removeAnim
|
||||
NumberAnimation {
|
||||
target: main
|
||||
properties: "x"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
to: -main.width
|
||||
}
|
||||
ScriptAction {
|
||||
script: root.closed();
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: main
|
||||
|
||||
x: -width
|
||||
width: parent.width - parent.width/6
|
||||
height: parent.height
|
||||
color: theme.backgroundColor
|
||||
|
||||
//external drop events can cause a raise event causing us to lose focus and
|
||||
//therefore get deleted whilst we are still in a drag exec()
|
||||
//this is a clue to the owning dialog that hideOnWindowDeactivate should be deleted
|
||||
//See https://bugs.kde.org/show_bug.cgi?id=332733
|
||||
property bool preventWindowHide: false
|
||||
|
||||
property Item getWidgetsButton
|
||||
property Item categoryButton
|
||||
|
||||
|
||||
function addCurrentApplet() {
|
||||
var pluginName = list.currentItem ? list.currentItem.pluginName : ""
|
||||
if (pluginName) {
|
||||
widgetExplorer.addApplet(pluginName)
|
||||
}
|
||||
}
|
||||
|
||||
LinearGradient {
|
||||
width: units.gridUnit/2
|
||||
anchors {
|
||||
left: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
rightMargin: -1
|
||||
}
|
||||
start: Qt.point(0, 0)
|
||||
end: Qt.point(units.gridUnit/2, 0)
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.3
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.0
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WidgetExplorer {
|
||||
id: widgetExplorer
|
||||
//view: desktop
|
||||
onShouldClose: removeAnim.running = true;
|
||||
}
|
||||
Flickable {
|
||||
id: splitDrawer
|
||||
visible: true
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentWidth: mainRow.width
|
||||
contentHeight: height
|
||||
Row {
|
||||
id: mainRow
|
||||
height: splitDrawer.height
|
||||
PlasmaExtras.ScrollArea {
|
||||
id: typeSelector
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: units.gridUnit * 10
|
||||
ListView {
|
||||
model: widgetExplorer.filterModel
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
enabled: true
|
||||
visible: !model.separator
|
||||
height: model.separator ? 0 : implicitHeight
|
||||
PlasmaComponents.Label {
|
||||
text: model.display
|
||||
}
|
||||
onClicked: {
|
||||
list.contentX = 0
|
||||
list.contentY = 0
|
||||
heading.text = model.display
|
||||
widgetExplorer.widgetsModel.filterQuery = model.filterData
|
||||
widgetExplorer.widgetsModel.filterType = model.filterType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: splitDrawer.width
|
||||
|
||||
spacing: units.smallSpacing
|
||||
|
||||
PlasmaExtras.Title {
|
||||
id: heading
|
||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets")
|
||||
Layout.fillWidth: true
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: closeButton
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: heading.verticalCenter
|
||||
}
|
||||
iconSource: "window-close"
|
||||
onClicked: removeAnim.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.TextField {
|
||||
id: searchInput
|
||||
clearButtonShown: true
|
||||
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...")
|
||||
onTextChanged: {
|
||||
list.positionViewAtBeginning()
|
||||
list.currentIndex = -1
|
||||
widgetExplorer.widgetsModel.searchTerm = text
|
||||
}
|
||||
|
||||
Component.onCompleted: forceActiveFocus()
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
|
||||
PlasmaExtras.ScrollArea {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
GridView {
|
||||
id: list
|
||||
|
||||
model: widgetExplorer.widgetsModel
|
||||
activeFocusOnTab: true
|
||||
currentIndex: -1
|
||||
keyNavigationWraps: true
|
||||
cellWidth: units.iconSizes.huge + units.smallSpacing * 2
|
||||
cellHeight: cellWidth + units.gridUnit * 4 + units.smallSpacing * 2
|
||||
|
||||
|
||||
delegate: AppletDelegate {}
|
||||
|
||||
//slide in to view from the left
|
||||
add: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
from: -list.width
|
||||
to: 0
|
||||
duration: units.shortDuration * 3
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//slide out of view to the right
|
||||
remove: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
to: list.width
|
||||
duration: units.shortDuration * 3
|
||||
}
|
||||
}
|
||||
|
||||
//if we are adding other items into the view use the same animation as normal adding
|
||||
//this makes everything slide in together
|
||||
//if we make it move everything ends up weird
|
||||
addDisplaced: list.add
|
||||
|
||||
//moved due to filtering
|
||||
displaced: Transition {
|
||||
NumberAnimation {
|
||||
properties: "y"
|
||||
duration: units.shortDuration * 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: bottomBar
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
leftMargin: units.smallSpacing
|
||||
rightMargin: units.smallSpacing
|
||||
bottomMargin: units.smallSpacing
|
||||
}
|
||||
|
||||
spacing: units.smallSpacing
|
||||
|
||||
Repeater {
|
||||
model: widgetExplorer.extraActions.length
|
||||
PlasmaComponents.Button {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
iconSource: widgetExplorer.extraActions[modelData].icon
|
||||
text: widgetExplorer.extraActions[modelData].text
|
||||
onClicked: {
|
||||
widgetExplorer.extraActions[modelData].trigger()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
main.getWidgetsButton = getWidgetsButton
|
||||
main.categoryButton = categoryButton
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2017 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: handle
|
||||
z: 999
|
||||
|
||||
property bool mirrored: false
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
right: handle.mirrored ? parent.right : undefined
|
||||
left: handle.mirrored ? undefined : parent.left
|
||||
}
|
||||
property Item frame: nextActivityLabel
|
||||
width: units.gridUnit
|
||||
drag.target: nextActivityLabel
|
||||
drag.axis: Drag.XAxis
|
||||
property real position: (mirrored ? -1 : 1) * (nextActivityLabel.x + nextActivityLabel.width/2) / (parent.width/2)
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: nextActivityLabel
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: handle.mirrored ? handle.width : -width
|
||||
opacity: parent.position
|
||||
imagePath: "widgets/background"
|
||||
width: childrenRect.width + units.gridUnit*2
|
||||
height: childrenRect.height + units.gridUnit*2
|
||||
PlasmaComponents.Label {
|
||||
anchors.centerIn: parent
|
||||
text: handle.mirrored ? i18n("Go To Next Activity") : i18n("Go To Previous Activity")
|
||||
}
|
||||
}
|
||||
onPressed: {
|
||||
nextActivityLabel.x = handle.mirrored ? handle.width : -nextActivityLabel.width
|
||||
}
|
||||
onReleased: {
|
||||
if (position > 0.5) {
|
||||
if (handle.mirrored) {
|
||||
root.containmentsEnterFromRight = true;
|
||||
activitiesRepresentation.incrementCurrentIndex();
|
||||
} else {
|
||||
root.containmentsEnterFromRight = false;
|
||||
activitiesRepresentation.decrementCurrentIndex();
|
||||
}
|
||||
acceptAnim.running = true;
|
||||
} else {
|
||||
dismissAnim.running = true;
|
||||
}
|
||||
}
|
||||
OpacityAnimator {
|
||||
id: acceptAnim
|
||||
target: nextActivityLabel
|
||||
from: nextActivityLabel.opacity
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
XAnimator {
|
||||
id: dismissAnim
|
||||
target: nextActivityLabel
|
||||
from: nextActivityLabel.x
|
||||
to: handle.mirrored ? 0 : -nextActivityLabel.width
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
|
|||
import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import org.kde.activities 0.1 as Activities
|
||||
import "../components"
|
||||
//import "../components"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ X-KDE-PluginInfo-Category=
|
|||
X-KDE-PluginInfo-Email=aseigo@kde.org
|
||||
X-KDE-PluginInfo-License=GPLv2+
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.phone
|
||||
X-Plasma-FallbackPackage=org.kde.plasma.nano
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://plasma-mobile.org
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue