flexible Tasks page

--introduce android clicke animation for Plasma
style
pull/5/head
Michail Vourlakos 6 years ago
parent 63b32a6331
commit af65e8ab48

@ -88,14 +88,4 @@ Item{
//! grouped options //! grouped options
readonly property Item shared: indicators readonly property Item shared: indicators
readonly property QtObject configuration: indicators.configuration readonly property QtObject configuration: indicators.configuration
Connections {
target: appletIsValid /*&& indicators.info.needsMouseEventCoordinates*/ ? appletItem : null
onMousePressed: {
console.log(x + " _ " + y);
var fixedPos = level.mapFromItem(appletItem, x, y);
console.log("f: " + fixedPos.x + " _ " + fixedPos.y);
level.mousePressed(fixedPos.x, fixedPos.y);
}
}
} }

@ -28,9 +28,10 @@ PlasmaCore.FrameSvgItem {
property string basePrefix: "normal" property string basePrefix: "normal"
imagePath: indicator.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks" imagePath: indicator.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
rotation: indicator.shared.reversed ? 180 : 0 rotation: indicator.shared.reversed ? 180 : 0
opacity: state === "hovered" ? 0.5 : 1
prefix: { prefix: {
if (indicator.usePlasmaTabsStyle) { if (indicator.usePlasmaTabsStyle) {
if (!indicator.isActive) { if (!indicator.isActive) {

@ -26,78 +26,143 @@ import org.kde.latte 0.2 as Latte
Item { Item {
anchors.fill: parent anchors.fill: parent
PlasmaCore.Svg {
id: taskSvg
imagePath: "widgets/tasks"
}
Item { Item {
id: iconBox anchors.fill: parent
anchors.centerIn: parent clip: true
width: indicator.currentIconSize
height: width Item{
id: clickedCenter
}
Rectangle {
id: clickedRectangle
anchors.centerIn: clickedCenter
opacity: 0
radius: width/2
height: width
color: indicator.palette.buttonFocusColor
}
} }
SequentialAnimation {
id: clickedAnimation
ScriptAction{
script: {
clickedRectangle.width = 0;
clickedRectangle.opacity = 0.85;
}
}
PlasmaCore.SvgItem { ParallelAnimation{
id: arrow PropertyAnimation {
target: clickedRectangle
implicitWidth: 0.25 * iconBox.width property: "width"
implicitHeight: implicitWidth to: indicator.currentIconSize * 3
duration: 700
svg: taskSvg easing.type: Easing.OutQuad
elementId: elementForLocation(plasmoid.location) }
PropertyAnimation {
function elementForLocation(location) { target: clickedRectangle
switch (location) { property: "opacity"
case PlasmaCore.Types.LeftEdge: to: 0
return "group-expander-left"; duration: 700
case PlasmaCore.Types.TopEdge: easing.type: Easing.OutQuad
return "group-expander-top";
case PlasmaCore.Types.RightEdge:
return "group-expander-right";
case PlasmaCore.Types.BottomEdge:
default:
return "group-expander-bottom";
} }
} }
} }
states: [ Connections {
State { target: level
name: "bottom" onMousePressed: {
when: plasmoid.location === PlasmaCore.Types.BottomEdge clickedCenter.x = x;
AnchorChanges { clickedCenter.y = y;
target: arrow clickedAnimation.start();
anchors.top: undefined; anchors.left: undefined; anchors.right: undefined; anchors.bottom: arrow.parent.bottom; }
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined; }
}
},
State { Loader {
name: "top" anchors.fill: parent
when: plasmoid.location === PlasmaCore.Types.TopEdge visible: !indicator.isApplet && indicator.isGroup
AnchorChanges { sourceComponent: Item{
target: arrow anchors.fill: parent
anchors.top: arrow.parent.top; anchors.left: undefined; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined; PlasmaCore.Svg {
id: taskSvg
imagePath: "widgets/tasks"
} }
},
State { Item {
name: "left" id: iconBox
when: plasmoid.location === PlasmaCore.Types.LeftEdge anchors.centerIn: parent
AnchorChanges { width: indicator.currentIconSize
target: arrow height: width
anchors.top: undefined; anchors.left: arrow.parent.left; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter;
} }
},
State { PlasmaCore.SvgItem {
name: "right" id: arrow
when: plasmoid.location === PlasmaCore.Types.RightEdge
AnchorChanges { implicitWidth: 0.25 * iconBox.width
target: arrow implicitHeight: implicitWidth
anchors.top: undefined; anchors.left: undefined; anchors.right: arrow.parent.right; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter; svg: taskSvg
elementId: elementForLocation(plasmoid.location)
function elementForLocation(location) {
switch (location) {
case PlasmaCore.Types.LeftEdge:
return "group-expander-left";
case PlasmaCore.Types.TopEdge:
return "group-expander-top";
case PlasmaCore.Types.RightEdge:
return "group-expander-right";
case PlasmaCore.Types.BottomEdge:
default:
return "group-expander-bottom";
}
}
} }
states: [
State {
name: "bottom"
when: plasmoid.location === PlasmaCore.Types.BottomEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: undefined; anchors.right: undefined; anchors.bottom: arrow.parent.bottom;
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined;
}
},
State {
name: "top"
when: plasmoid.location === PlasmaCore.Types.TopEdge
AnchorChanges {
target: arrow
anchors.top: arrow.parent.top; anchors.left: undefined; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined;
}
},
State {
name: "left"
when: plasmoid.location === PlasmaCore.Types.LeftEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: arrow.parent.left; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter;
}
},
State {
name: "right"
when: plasmoid.location === PlasmaCore.Types.RightEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: undefined; anchors.right: arrow.parent.right; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter;
}
}
]
} }
] }
} }

@ -25,6 +25,11 @@ import org.kde.latte 0.2 as Latte
import org.kde.latte.components 1.0 as LatteComponents import org.kde.latte.components 1.0 as LatteComponents
LatteComponents.IndicatorItem { LatteComponents.IndicatorItem {
id: root
readonly property bool needsMouseEventCoordinates: true
readonly property bool providesClickedAnimation: true
readonly property bool providesHoveredAnimation: true
readonly property bool providesFrontLayer: true readonly property bool providesFrontLayer: true
//! Background Layer //! Background Layer
@ -40,7 +45,7 @@ LatteComponents.IndicatorItem {
Loader{ Loader{
id: frontLayer id: frontLayer
anchors.fill: parent anchors.fill: parent
active: level.isForeground && !indicator.isApplet && indicator.isGroup active: level.isForeground //&& !indicator.isApplet && indicator.isGroup
sourceComponent: FrontLayer{} sourceComponent: FrontLayer{}
} }

@ -68,7 +68,7 @@ FocusScope {
property int chosenWidth: userScaleWidth !== 1 ? userScaleWidth * proposedWidth : proposedWidth property int chosenWidth: userScaleWidth !== 1 ? userScaleWidth * proposedWidth : proposedWidth
property int chosenHeight: userScaleHeight !== 1 ? userScaleHeight * heightLevel * proposedHeight : heightLevel * proposedHeight property int chosenHeight: userScaleHeight !== 1 ? userScaleHeight * heightLevel * proposedHeight : heightLevel * proposedHeight
readonly property int optionsWidth: appliedWidth - units.smallSpacing * 9 readonly property int optionsWidth: appliedWidth - units.smallSpacing * 10
//! user set scales based on its preference, e.g. 96% of the proposed size //! user set scales based on its preference, e.g. 96% of the proposed size
property real userScaleWidth: 1 property real userScaleWidth: 1

@ -60,7 +60,8 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 2
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Unread messages from tasks") text: i18n("Unread messages from tasks")
checked: plasmoid.configuration.showInfoBadge checked: plasmoid.configuration.showInfoBadge
tooltip: i18n("Show unread messages or information from tasks") tooltip: i18n("Show unread messages or information from tasks")
@ -70,7 +71,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Progress information for tasks") text: i18n("Progress information for tasks")
checked: plasmoid.configuration.showProgressBadge checked: plasmoid.configuration.showProgressBadge
tooltip: i18n("Show a progress animation for tasks e.g. when copying files with Dolphin") tooltip: i18n("Show a progress animation for tasks e.g. when copying files with Dolphin")
@ -80,7 +82,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Audio playing from tasks") text: i18n("Audio playing from tasks")
checked: plasmoid.configuration.showAudioBadge checked: plasmoid.configuration.showAudioBadge
tooltip: i18n("Show audio playing from tasks") tooltip: i18n("Show audio playing from tasks")
@ -90,7 +93,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Change volume when scrolling audio badge") text: i18n("Change volume when scrolling audio badge")
checked: plasmoid.configuration.audioBadgeActionsEnabled checked: plasmoid.configuration.audioBadgeActionsEnabled
enabled: plasmoid.configuration.showAudioBadge enabled: plasmoid.configuration.showAudioBadge
@ -117,8 +121,8 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 2
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Add launchers only in the Tasks Area") text: i18n("Add launchers only in the Tasks Area")
checked: plasmoid.configuration.addLaunchersInTaskManager checked: plasmoid.configuration.addLaunchersInTaskManager
tooltip: i18n("Launchers are added only in the taskmanager and not as plasma applets") tooltip: i18n("Launchers are added only in the taskmanager and not as plasma applets")
@ -128,8 +132,9 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: windowActionsChk id: windowActionsChk
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show window actions in the context menu") text: i18n("Show window actions in the context menu")
checked: plasmoid.configuration.showWindowActions checked: plasmoid.configuration.showWindowActions
visible: dialog.highLevel visible: dialog.highLevel
@ -140,8 +145,9 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: unifyGlobalShortcutsChk id: unifyGlobalShortcutsChk
Layout.maximumWidth: dialog.optionsWidth
text: i18n("🅰 Based on position shortcuts apply only for tasks") text: i18n("🅰 Based on position shortcuts apply only for tasks")
checked: !plasmoid.configuration.unifiedGlobalShortcuts checked: !plasmoid.configuration.unifiedGlobalShortcuts
tooltip: i18n("Based on position global shortcuts are enabled only for tasks and not for applets") tooltip: i18n("Based on position global shortcuts are enabled only for tasks and not for applets")
@ -169,9 +175,8 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 2
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: showOnlyCurrentScreen Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show only tasks from the current screen") text: i18n("Show only tasks from the current screen")
checked: plasmoid.configuration.showOnlyCurrentScreen checked: plasmoid.configuration.showOnlyCurrentScreen
@ -180,8 +185,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: showOnlyCurrentDesktop Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show only tasks from the current desktop") text: i18n("Show only tasks from the current desktop")
checked: plasmoid.configuration.showOnlyCurrentDesktop checked: plasmoid.configuration.showOnlyCurrentDesktop
@ -190,8 +195,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: showOnlyCurrentActivity Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show only tasks from the current activity") text: i18n("Show only tasks from the current activity")
checked: plasmoid.configuration.showOnlyCurrentActivity checked: plasmoid.configuration.showOnlyCurrentActivity
@ -200,8 +205,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: showWindowsOnlyFromLaunchersChk Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show only tasks from launchers") text: i18n("Show only tasks from launchers")
checked: plasmoid.configuration.showWindowsOnlyFromLaunchers checked: plasmoid.configuration.showWindowsOnlyFromLaunchers
visible: dialog.highLevel visible: dialog.highLevel
@ -211,8 +216,8 @@ PlasmaComponents.Page {
} }
} }
PlasmaComponents.CheckBox { LatteComponents.CheckBox {
id: groupTasksChk Layout.maximumWidth: dialog.optionsWidth
text: i18n("Group tasks of the same application") text: i18n("Group tasks of the same application")
checked: plasmoid.configuration.groupTasksByDefault checked: plasmoid.configuration.groupTasksByDefault
tooltip: i18n("By default group tasks of the same application") tooltip: i18n("By default group tasks of the same application")
@ -252,6 +257,9 @@ PlasmaComponents.Page {
property int group: plasmoid.configuration.launchersGroup property int group: plasmoid.configuration.launchersGroup
readonly property int buttonsCount: layoutGroupButton.visible ? 3 : 2
readonly property int buttonSize: (dialog.optionsWidth - (spacing * buttonsCount-1)) / buttonsCount
ExclusiveGroup { ExclusiveGroup {
id: launchersGroup id: launchersGroup
onCurrentChanged: { onCurrentChanged: {
@ -263,7 +271,8 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.fillWidth: true Layout.minimumWidth: parent.buttonSize
Layout.maximumWidth: Layout.minimumWidth
text: i18nc("unique launchers group","Unique") text: i18nc("unique launchers group","Unique")
checked: parent.group === group checked: parent.group === group
checkable: true checkable: true
@ -274,7 +283,9 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.fillWidth: true id: layoutGroupButton
Layout.minimumWidth: parent.buttonSize
Layout.maximumWidth: Layout.minimumWidth
text: i18nc("layout launchers group","Layout") text: i18nc("layout launchers group","Layout")
checked: parent.group === group checked: parent.group === group
checkable: true checkable: true
@ -287,7 +298,8 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.fillWidth: true Layout.minimumWidth: parent.buttonSize
Layout.maximumWidth: Layout.minimumWidth
text: i18nc("global launchers group","Global") text: i18nc("global launchers group","Global")
checked: parent.group === group checked: parent.group === group
checkable: true checkable: true
@ -317,6 +329,8 @@ PlasmaComponents.Page {
GridLayout { GridLayout {
columns: 2 columns: 2
Layout.minimumWidth: dialog.optionsWidth
Layout.maximumWidth: Layout.minimumWidth
Layout.topMargin: units.smallSpacing Layout.topMargin: units.smallSpacing
enabled: !disableAllWindowsFunctionality enabled: !disableAllWindowsFunctionality
@ -361,6 +375,7 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Label { PlasmaComponents.Label {
id: middleClickText
text: i18n("Middle Click") text: i18n("Middle Click")
} }
@ -426,49 +441,68 @@ PlasmaComponents.Page {
} }
} }
} }
}
RowLayout { RowLayout {
Layout.topMargin: units.smallSpacing spacing: units.smallSpacing
spacing: units.smallSpacing enabled: !disableAllWindowsFunctionality
enabled: !disableAllWindowsFunctionality
LatteComponents.ComboBox { Layout.minimumWidth: middleClickText.width
id: modifier Layout.maximumWidth: middleClickText.width
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 5
model: ["Shift", "Ctrl", "Alt", "Meta"]
currentIndex: plasmoid.configuration.modifier LatteComponents.ComboBox {
onCurrentIndexChanged: plasmoid.configuration.modifier = currentIndex id: modifier
} Layout.fillWidth: true
model: ["Shift", "Ctrl", "Alt", "Meta"]
PlasmaComponents.Label { currentIndex: plasmoid.configuration.modifier
text: "+" onCurrentIndexChanged: plasmoid.configuration.modifier = currentIndex
}
PlasmaComponents.Label {
text: "+"
}
} }
LatteComponents.ComboBox { RowLayout {
id: modifierClick spacing: units.smallSpacing
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 10 enabled: !disableAllWindowsFunctionality
model: [i18n("Left Click"), i18n("Middle Click"), i18n("Right Click")]
currentIndex: plasmoid.configuration.modifierClick readonly property int maxSize: 0.4 * dialog.optionsWidth
onCurrentIndexChanged: plasmoid.configuration.modifierClick = currentIndex
}
PlasmaComponents.Label { LatteComponents.ComboBox {
text: "=" id: modifierClick
} Layout.preferredWidth: 0.7 * parent.maxSize
Layout.maximumWidth: parent.maxSize
model: [i18n("Left Click"), i18n("Middle Click"), i18n("Right Click")]
LatteComponents.ComboBox { currentIndex: plasmoid.configuration.modifierClick
id: modifierClickAction onCurrentIndexChanged: plasmoid.configuration.modifierClick = currentIndex
Layout.fillWidth: true }
model: [i18nc("The click action", "None"), i18n("Close Window or Group"),
i18n("New Instance"), i18n("Minimize/Restore Window or Group"), i18n("Cycle Through Tasks"), i18n("Toggle Task Grouping")] PlasmaComponents.Label {
text: "="
}
LatteComponents.ComboBox {
id: modifierClickAction
Layout.fillWidth: true
model: [i18nc("The click action", "None"), i18n("Close Window or Group"),
i18n("New Instance"), i18n("Minimize/Restore Window or Group"), i18n("Cycle Through Tasks"), i18n("Toggle Task Grouping")]
currentIndex: plasmoid.configuration.modifierClickAction currentIndex: plasmoid.configuration.modifierClickAction
onCurrentIndexChanged: plasmoid.configuration.modifierClickAction = currentIndex onCurrentIndexChanged: plasmoid.configuration.modifierClickAction = currentIndex
}
} }
} }
RowLayout {
Layout.minimumWidth: dialog.optionsWidth
Layout.maximumWidth: Layout.minimumWidth
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
enabled: !disableAllWindowsFunctionality
}
} }
} }
//! END: Actions //! END: Actions
@ -483,10 +517,11 @@ PlasmaComponents.Page {
} }
PlasmaComponents.Button { PlasmaComponents.Button {
Layout.minimumWidth: dialog.optionsWidth
Layout.maximumWidth: Layout.minimumWidth
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 2
Layout.topMargin: units.smallSpacing Layout.topMargin: units.smallSpacing
Layout.fillWidth: true
text: i18n("Remove Latte Tasks Applet") text: i18n("Remove Latte Tasks Applet")
enabled: latteView.latteTasksArePresent enabled: latteView.latteTasksArePresent

Loading…
Cancel
Save