remove local feedbackWindow

This commit is contained in:
Marco Martin 2020-02-11 13:57:34 +01:00
parent d2f196e0c3
commit 91c92f8fa1
3 changed files with 18 additions and 138 deletions

View file

@ -1,128 +0,0 @@
/*
* Copyright 2015 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.0
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import QtGraphicalEffects 1.12
import org.kde.phone.homescreen 1.0
Window {
id: window
property alias state: background.state
property alias icon: icon.source
width: Screen.width
height: Screen.height
color: "transparent"
onVisibleChanged: {
if (!visible) {
background.state = "closed";
}
}
onActiveChanged: {
if (!active) {
background.state = "closed";
}
}
Item {
id: background
anchors.fill: parent
//colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
width: window.width
height: window.height
state: "closed"
Rectangle {
anchors.fill: parent
color: PlasmaCore.Theme.backgroundColor
Rectangle {
id: rect
anchors.fill: parent
}
PlasmaCore.IconItem {
anchors.centerIn: parent
id: icon
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
width: units.iconSizes.enormous
height: width
}
DropShadow {
anchors.fill: icon
horizontalOffset: 0
verticalOffset: 0
radius: 8.0
samples: 17
color: "#80000000"
source: icon
}
}
states: [
State {
name: "closed"
PropertyChanges {
target: background
scale: 0
}
PropertyChanges {
target: window
visible: false
}
},
State {
name: "open"
PropertyChanges {
target: background
scale: 1
}
PropertyChanges {
target: window
visible: true
}
}
]
transitions: [
Transition {
from: "closed"
SequentialAnimation {
ScriptAction {
script: {
window.visible = true;
icon.grabToImage((img) => {
rect.color = ColourAverage.averageColour(img.image)
})
}
}
PropertyAnimation {
target: background
duration: units.longDuration
easing.type: Easing.InOutQuad
properties: "scale"
}
}
}
]
}
}

View file

@ -24,9 +24,11 @@ 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.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.10 as Kirigami
import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.phone.homescreen 1.0
LauncherContainer {
@ -70,14 +72,23 @@ LauncherContainer {
to: 3
duration: 200
}
ScriptAction {
script: {
effect.grabToImage((img) => {
NanoShell.StartupFeedback.open(
effect.source,
effect.title,
ColourAverage.averageColour(img.image),
effect.Kirigami.ScenePosition.x,
effect.Kirigami.ScenePosition.y,
effect.width,
effect.height);
})
}
}
}
ScriptAction {
script: {
feedbackWindow.title = effect.title
feedbackWindow.icon = effect.source
feedbackWindow.state = "open"
effect.visible = false
}
script: effect.visible = false
}
}

View file

@ -101,9 +101,6 @@ Item {
}
}
FeedbackWindow {
id: feedbackWindow
}
SequentialAnimation {
id: clickFedbackAnimation
property Item target