From c1a81588d914f84e58f09038934dfe2df077b701 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 1 Mar 2024 19:20:25 +0100 Subject: [PATCH] Add time values Remove auto close when no content is active --- ScreenPlay/qml/Components/LineHandle.qml | 23 ++++++++++++-- ScreenPlay/qml/Components/LineIndicator.qml | 19 +++++------- ScreenPlay/qml/Components/Timeline.qml | 33 +++++++++++++++++++-- ScreenPlay/qml/Monitors/MonitorsView.qml | 9 ++---- ScreenPlay/qml/Navigation/Navigation.qml | 1 - 5 files changed, 63 insertions(+), 22 deletions(-) diff --git a/ScreenPlay/qml/Components/LineHandle.qml b/ScreenPlay/qml/Components/LineHandle.qml index 703b6517..08dc3884 100644 --- a/ScreenPlay/qml/Components/LineHandle.qml +++ b/ScreenPlay/qml/Components/LineHandle.qml @@ -24,9 +24,28 @@ Item { Text { id: txt - text: root.linePosition + "-"+ (root.linePosition * root.lineWidth).toFixed(2) + "\n" + Math.floor( dragHandler.xAxis.minimum) + " - "+ Math.floor(dragHandler.xAxis.maximum) + //text: root.linePosition + "-"+ (root.linePosition * root.lineWidth).toFixed(2) + "\n" + Math.floor( dragHandler.xAxis.minimum) + " - "+ Math.floor(dragHandler.xAxis.maximum) + text: { + const normalized = root.x / root.lineWidth; // Your existing normalization + let totalHours = normalized * 24; + let hours = Math.floor(totalHours); // Gets the whole hour part + let minutes = Math.round((totalHours - hours) * 60); // Calculates the minutes + // Check if minutes rolled over to 60, adjust hours and minutes accordingly + if (minutes === 60) { + hours += 1; // Increment hours by 1 + minutes = 0; // Reset minutes to 0 + } + + // Ensure hours wrap correctly at 24 + if (hours === 24) { + hours = 0; + } + + return hours + ":" + minutes.toString().padStart(2, '0') + } + color: "white" - visible: false + visible: !root.isLast anchors{ horizontalCenter: parent.horizontalCenter top: parent.top diff --git a/ScreenPlay/qml/Components/LineIndicator.qml b/ScreenPlay/qml/Components/LineIndicator.qml index 8a1d3120..033463aa 100644 --- a/ScreenPlay/qml/Components/LineIndicator.qml +++ b/ScreenPlay/qml/Components/LineIndicator.qml @@ -11,14 +11,6 @@ Rectangle { signal remove(var index) signal lineSelected(var index) - border.width: root.selected ? 2 : 0 - border.color: "gold" - Behavior on color { - id: colorBehavior - ColorAnimation { - duration: 400 - } - } Text { id: text color: "white" @@ -30,13 +22,18 @@ Rectangle { } } + Rectangle { + color: "gold" + anchors.fill: parent + visible: root.selected + + } + Rectangle { id: indicatorLineVertical width: 5 height: 30 - color: parent.color - border.width: root.selected ? 2 : 0 - border.color: "gold" + color: root.selected ? "gold" : parent.color anchors{ horizontalCenter: parent.horizontalCenter top: parent.bottom diff --git a/ScreenPlay/qml/Components/Timeline.qml b/ScreenPlay/qml/Components/Timeline.qml index 1c42fdd8..395e73c5 100644 --- a/ScreenPlay/qml/Components/Timeline.qml +++ b/ScreenPlay/qml/Components/Timeline.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts Control { id: root - height: 250 + height: 220 implicitWidth: 800 topPadding: 40 leftPadding: 40 @@ -61,8 +61,8 @@ Control { function createSection(index, stopPosition, section) { console.log("Adding at:", index, stopPosition) - //console.assert(isFloat(stopPosition)) + //console.assert(isFloat(stopPosition)) let haComponent = Qt.createComponent("LineHandle.qml") if (haComponent.status === Component.Error) { console.assert(haComponent.errorString()) @@ -224,6 +224,35 @@ Control { enabled: true } + RowLayout { + anchors.fill: parent + Repeater { + model: 24 + Item { + width: 20 + height: 40 + required property int index + Text { + color: "gray" + text: index + anchors { + horizontalCenter: parent.horizontalCenter + } + } + + Rectangle { + color: "gray" + width: 1 + height: 5 + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + } + } + } + } + } + ToolButton { text: "➕" onClicked: { diff --git a/ScreenPlay/qml/Monitors/MonitorsView.qml b/ScreenPlay/qml/Monitors/MonitorsView.qml index 2ea74621..2235b760 100644 --- a/ScreenPlay/qml/Monitors/MonitorsView.qml +++ b/ScreenPlay/qml/Monitors/MonitorsView.qml @@ -50,14 +50,14 @@ Util.Popup { border.width: 1 radius: 3 Layout.fillWidth: true - Layout.preferredHeight: 280 + Layout.preferredHeight: 240 ColumnLayout { - spacing: 20 + spacing: 10 anchors { fill: parent - margins: 40 + margins: 20 } Text { @@ -66,7 +66,6 @@ Util.Popup { color: Material.primaryTextColor font.family: App.settings.font font.weight: Font.Light - width: 400 Layout.fillWidth: true Layout.preferredHeight: 30 } @@ -200,7 +199,6 @@ Util.Popup { if (!App.screenPlayManager.removeAllWallpapers( true)) print("Unable to close all wallpaper!") - root.close() } } @@ -218,7 +216,6 @@ Util.Popup { onClicked: { if (!App.screenPlayManager.removeAllWidgets()) print("Unable to close all widgets!") - root.close() } } } diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index a1efd5b5..c86f33b3 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -303,7 +303,6 @@ Rectangle { } ToolButton { id: miConfig - enabled: quickActionRow.contentActive Layout.alignment: Qt.AlignVCenter icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_video_settings.svg" icon.width: root.iconWidth