aboutsummaryrefslogtreecommitdiffstats
path: root/launcher/qml/IconItem.qml
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/qml/IconItem.qml')
-rw-r--r--launcher/qml/IconItem.qml179
1 files changed, 100 insertions, 79 deletions
diff --git a/launcher/qml/IconItem.qml b/launcher/qml/IconItem.qml
index c15a3da..4faa3ea 100644
--- a/launcher/qml/IconItem.qml
+++ b/launcher/qml/IconItem.qml
@@ -17,104 +17,125 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
+import "ChangeItemPosition.js" as Cip
Item {
id: main
- width: 320
- height: 320
+ width: 300
+ height: 485
property string icon: model.icon
+ property int pid: -1
+ property bool isBlank: false
+ property bool isPressing: false
+
+ Timer {
+ id: launchTimer
+ interval: 650
+ repeat: false
+ onTriggered: {
+ launchApp()
+ }
+ }
Item {
id: container
- parent: loc
- x: main.x
- y: main.y
width: main.width
height: main.height
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if(main.state === "pos14") {
+ launchApp()
+ } else if(main.state === "pos4") {
+ Cip.prev()
+ launchTimer.start()
+ } else if(main.state === "pos3") {
+ Cip.prev()
+ Cip.prev()
+ launchTimer.start()
+ } else if(main.state === "pos2") {
+ Cip.prev()
+ Cip.prev()
+ Cip.prev()
+ launchTimer.start()
+ } else if(main.state === "pos1") {
+ Cip.prev()
+ Cip.prev()
+ Cip.prev()
+ Cip.prev()
+ launchTimer.start()
+ } else if(main.state === "pos6") {
+ Cip.next()
+ launchTimer.start()
+ } else if(main.state === "pos7") {
+ Cip.next()
+ Cip.next()
+ launchTimer.start()
+ } else if(main.state === "pos8") {
+ Cip.next()
+ Cip.next()
+ Cip.next()
+ launchTimer.start()
+ } else if(main.state === "pos9") {
+ Cip.next()
+ Cip.next()
+ Cip.next()
+ Cip.next()
+ launchTimer.start()
+ }
+ }
+ }
Image {
id: item
anchors.top: parent.top
- anchors.topMargin: 20
+ anchors.topMargin: 230
anchors.horizontalCenter: parent.horizontalCenter
- width: 220
- height: width
- source: './images/%1_%2.svg'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'active' : 'inactive')
- antialiasing: item.state !== ''
-
+ width: 300
+ height: 300
+ source: './images/%1_active.png'.arg(model.icon)
property string initial: model.name.substring(0,1).toUpperCase()
+ property bool hasIcon: model.icon !== 'blank'
- Item {
- id: title
- width: 125
- height: 125
+ Label {
+ style: Text.Outline
+ styleColor: 'white'
+ color: 'transparent'
+ font.pixelSize: 225
anchors.centerIn: parent
- Repeater {
- delegate: Label {
- style: Text.Outline
- styleColor: 'red'
- color: 'transparent'
- font.pixelSize: 125
- anchors.centerIn: parent
- anchors.horizontalCenterOffset: model.index / 3 - 1
- anchors.verticalCenterOffset: model.index % 3 - 1
- text: item.initial
- }
- model: main.icon === 'blank' ? 9 : 0
- }
- layer.enabled: true
- layer.effect: LinearGradient {
- gradient: Gradient {
- GradientStop { position: -0.5; color: "#6BFBFF" }
- GradientStop { position: +1.5; color: "#00ADDC" }
- }
- }
+ anchors.verticalCenterOffset: -50
+ text: item.initial
+ visible: item.hasIcon ? false : true
}
- }
- Label {
- id: name
- anchors.top: item.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.margins: 20
- font.pixelSize: 25
- font.letterSpacing: 5
- wrapMode: Text.WordWrap
- horizontalAlignment: Text.AlignHCenter
- color: "white"
- text: qsTr(model.name.toUpperCase())
- }
- Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
- Behavior on y { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
- SequentialAnimation on rotation {
- NumberAnimation { to: 5; duration: 100 }
- NumberAnimation { to: -5; duration: 200 }
- NumberAnimation { to: 0; duration: 100 }
- running: loc.currentId !== '' && item.state !== 'active'
- loops: Animation.Infinite; alwaysRunToEnd: true
- }
- states: [
- State {
- name: 'active'
- when: loc.currentId == model.id
- PropertyChanges {
- target: container
- x: loc.mouseX - width/2
- y: loc.mouseY - height/2
- scale: 1.15
- z: 10
- }
- },
- State {
- when: loc.currentId !== ''
- PropertyChanges {
- target: container
- scale: 0.85
- opacity: 0.75
- }
+ Label {
+ id: name
+ anchors.bottom: item.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 20
+ font.pixelSize: 25
+ font.letterSpacing: 5
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ color: "white"
+ text: qsTr(model.name.toUpperCase())
}
- ]
- transitions: Transition { NumberAnimation { properties: 'scale, opacity, x, y'; duration: 150; easing.type: Easing.OutCubic} }
+
+ }
+ }
+ function iconPressed() {
+ item.source = './images/%1_inactive.png'.arg(model.icon)
+ }
+ function iconReleased() {
+ item.source = './images/%1_active.png'.arg(model.icon)
+ }
+ function launchApp() {
+ pid = launcher.launch(model.id)
+ if (1 < pid) {
+ } else {
+ console.warn("app cannot be launched!")
+ }
+ homescreenHandler.tapShortcut(model.name)
}
}