diff --git a/applets/timer/package/contents/ui/TimerDigit.qml b/applets/timer/package/contents/ui/TimerDigit.qml --- a/applets/timer/package/contents/ui/TimerDigit.qml +++ b/applets/timer/package/contents/ui/TimerDigit.qml @@ -40,13 +40,13 @@ if (root.seconds + meaning < 360000) { root.seconds += meaning; } - main.digitChanged(); + root.digitHasChanged(); }else if (wheel.angleDelta.y < 0) { if (root.seconds - meaning >= 0) { root.seconds -= meaning; } - main.digitChanged(); + root.digitHasChanged(); } } } diff --git a/applets/timer/package/contents/ui/TimerView.qml b/applets/timer/package/contents/ui/TimerView.qml --- a/applets/timer/package/contents/ui/TimerView.qml +++ b/applets/timer/package/contents/ui/TimerView.qml @@ -23,6 +23,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 as QtExtra +import QtQuick.Layouts 1.1 Item { id: main @@ -40,6 +41,44 @@ id: timerSvg imagePath: "widgets/timer" } + + states: [ + State { + name: "verticalPanel" + when: plasmoid.formFactor == PlasmaCore.Types.Vertical + PropertyChanges { + target: main + Layout.fillHeight: false + Layout.fillWidth: true + Layout.maximumHeight: (2 * width / digits) * (root.showTitle ? 2 : 1) + height: Layout.maximumHeight + Layout.minimumHeight: Layout.maximumHeight + } + }, + State { + name: "horizontalPanel" + when: plasmoid.formFactor == PlasmaCore.Types.Horizontal + PropertyChanges { + target: main + Layout.fillHeight: true + Layout.fillWidth: false + /* The value 0.86 is chosen to make digit size equal to font size of + * clock widget. + * Clock itself uses 0.71, but it renders digits using text, and the + * timer widget renders digits using SVGs, so the coefficients are + * different. + * Clock uses the following formula for calculating text height: + * + * height: Math.min(main.height * 0.71, + * 3 * theme.defaultFont.pixelSize) + * + * We need to scale this formula proportionally. + */ + Layout.minimumWidth: Math.min(height, 3 * theme.defaultFont.pixelSize / 0.71) / 2 * digits * 0.86 + Layout.maximumWidth: Layout.minimumWidth + } + } + ] Column { anchors.centerIn: parent; diff --git a/applets/timer/package/contents/ui/main.qml b/applets/timer/package/contents/ui/main.qml --- a/applets/timer/package/contents/ui/main.qml +++ b/applets/timer/package/contents/ui/main.qml @@ -114,7 +114,7 @@ operation["appIcon"] = "chronometer"; operation.summary = notificationText || i18n("Timer finished") operation["body"] = ""; - operation["timeout"] = 2000; + operation["expireTimeout"] = 5000; service.startOperationCall(operation); }