Loading editor/qml/PropertyPanel.qml +90 −1 Changes for editor/qml/PropertyPanel.qml: 90 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -268,7 +268,7 @@ ColumnLayout { /* text / number */ TextField { visible: !["richtext","select","checkbox","color","color_var","textarea","image","media_browse","survey_select","section_select"].includes(field.type) visible: !["richtext","select","checkbox","color","color_var","textarea","image","media_browse","survey_select","section_select","video_poster"].includes(field.type) && !field.key.endsWith("_src") && field.key !== "media_id" Layout.fillWidth: true text: val Loading Loading @@ -537,6 +537,95 @@ ColumnLayout { } } /* video_poster — select a frame from the video as poster/thumbnail */ ColumnLayout { visible: field.type === "video_poster" Layout.fillWidth: true spacing: 6 property string videoMediaId: propPanel.currentProps["media_id"] || "" property double currentTime: { var v = parseFloat(val) return isNaN(v) ? -1.0 : v } RowLayout { Layout.fillWidth: true spacing: 4 SpinBox { id: posterTimeSpin from: 0 to: 36000 // 10h in tenths stepSize: 5 value: { var v = parseFloat(val) return isNaN(v) || v < 0 ? 0 : Math.round(v * 10) } editable: true property double realValue: value / 10.0 textFromValue: function(value, locale) { return (value / 10.0).toFixed(1) + " s" } valueFromText: function(text, locale) { return Math.round(parseFloat(text) * 10) } implicitWidth: 110 background: Rectangle { implicitHeight: 32; color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } onValueModified: { propPanel.debounceSave(eKey, realValue) } } Button { text: qsTr("Vorschau") implicitHeight: 28 enabled: videoMediaId !== "" background: Rectangle { color: parent.hovered ? Theme.bgHover : Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } contentItem: Text { text: parent.text; color: Theme.textPrimary; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter } onClicked: { posterPreview.source = "" var surl = localApi.serverUrl() var origin = surl try { var u = new URL(surl); origin = u.origin } catch(e) {} var t = posterTimeSpin.realValue posterPreview.source = "image://auth/" + origin + "/media/" + videoMediaId + "/preview?fmt=webp&w=320&t=" + t } } Button { text: qsTr("Entfernen") implicitHeight: 28 background: Rectangle { color: parent.hovered ? Theme.bgHover : Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } contentItem: Text { text: parent.text; color: Theme.textSecondary; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter } onClicked: { posterPreview.source = "" propPanel.debounceSave(eKey, -1.0) } } } Image { id: posterPreview Layout.fillWidth: true Layout.preferredHeight: sourceSize.height > 0 ? (width * sourceSize.height / sourceSize.width) : 0 fillMode: Image.PreserveAspectFit visible: source != "" cache: false source: { if (videoMediaId === "" || currentTime < 0) return "" var surl = localApi.serverUrl() var origin = surl try { var u = new URL(surl); origin = u.origin } catch(e) {} return "image://auth/" + origin + "/media/" + videoMediaId + "/preview?fmt=webp&w=320&t=" + currentTime } } } /* survey_select — fetch list from server and pick */ ColumnLayout { visible: field.type === "survey_select" Loading editor/widgets/video/video.cpp +19 −0 Changes for editor/widgets/video/video.cpp: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Poster (thumbnail from video frame via MediaDB) double posterTime = -1.0; // Time offset in seconds (-1 = no poster) // Custom CSS std::string customCss = ""; Loading Loading @@ -261,6 +264,7 @@ extern "C" { json_object_object_add(obj, "media_ext", json_object_new_string(mediaExt.c_str())); json_object_object_add(obj, "controls", json_object_new_boolean(controls)); json_object_object_add(obj, "play_on_hover", json_object_new_boolean(playOnHover)); json_object_object_add(obj, "poster_time", json_object_new_double(posterTime)); json_object_object_add(obj, "m_width", json_object_new_string(m_width.c_str())); json_object_object_add(obj, "m_height", json_object_new_string(m_height.c_str())); json_object_object_add(obj, "hidden", json_object_new_boolean(hidden)); Loading Loading @@ -293,6 +297,9 @@ extern "C" { if (json_object_object_get_ex(obj, "media_ext", &val_obj)) { val = json_object_get_string(val_obj); if (val && val[0]) mediaExt = val; } if (json_object_object_get_ex(obj, "poster_time", &val_obj)) { posterTime = json_object_get_double(val_obj); } if (json_object_object_get_ex(obj, "controls", &val_obj)) { if (json_object_is_type(val_obj, json_type_string)) { const char *s = json_object_get_string(val_obj); Loading Loading @@ -366,6 +373,7 @@ extern "C" { addField("height", "CSS Height", "text", "auto", "desktop"); addField("controls", "Show Play Controls", "checkbox"); addField("play_on_hover", "Play on Mouse Over", "checkbox"); addField("poster_time", "Vorschaubild Zeitpunkt (Sek.)", "video_poster"); addField("hidden", "Hidden", "checkbox", nullptr, "desktop"); { json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1); Loading Loading @@ -393,6 +401,17 @@ extern "C" { video.setAttribute("src", renderSrc.c_str()); video.setAttribute("class", responsiveClass.c_str()); // Poster/thumbnail extracted from video by MediaDB if (posterTime >= 0.0 && !mediaId.empty()) { std::ostringstream posterUrl; posterUrl << "/media/" << mediaId << "/preview?fmt=webp&w=1280&t=" << posterTime; std::string pUrl = posterUrl.str(); if (!pfx.empty() && pfx != "/") { pUrl = pfx + pUrl; } video.setAttribute("poster", pUrl.c_str()); } if (controls) { video.setAttribute("controls", "controls"); } else if (playOnHover) { Loading Loading
editor/qml/PropertyPanel.qml +90 −1 Changes for editor/qml/PropertyPanel.qml: 90 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -268,7 +268,7 @@ ColumnLayout { /* text / number */ TextField { visible: !["richtext","select","checkbox","color","color_var","textarea","image","media_browse","survey_select","section_select"].includes(field.type) visible: !["richtext","select","checkbox","color","color_var","textarea","image","media_browse","survey_select","section_select","video_poster"].includes(field.type) && !field.key.endsWith("_src") && field.key !== "media_id" Layout.fillWidth: true text: val Loading Loading @@ -537,6 +537,95 @@ ColumnLayout { } } /* video_poster — select a frame from the video as poster/thumbnail */ ColumnLayout { visible: field.type === "video_poster" Layout.fillWidth: true spacing: 6 property string videoMediaId: propPanel.currentProps["media_id"] || "" property double currentTime: { var v = parseFloat(val) return isNaN(v) ? -1.0 : v } RowLayout { Layout.fillWidth: true spacing: 4 SpinBox { id: posterTimeSpin from: 0 to: 36000 // 10h in tenths stepSize: 5 value: { var v = parseFloat(val) return isNaN(v) || v < 0 ? 0 : Math.round(v * 10) } editable: true property double realValue: value / 10.0 textFromValue: function(value, locale) { return (value / 10.0).toFixed(1) + " s" } valueFromText: function(text, locale) { return Math.round(parseFloat(text) * 10) } implicitWidth: 110 background: Rectangle { implicitHeight: 32; color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } onValueModified: { propPanel.debounceSave(eKey, realValue) } } Button { text: qsTr("Vorschau") implicitHeight: 28 enabled: videoMediaId !== "" background: Rectangle { color: parent.hovered ? Theme.bgHover : Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } contentItem: Text { text: parent.text; color: Theme.textPrimary; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter } onClicked: { posterPreview.source = "" var surl = localApi.serverUrl() var origin = surl try { var u = new URL(surl); origin = u.origin } catch(e) {} var t = posterTimeSpin.realValue posterPreview.source = "image://auth/" + origin + "/media/" + videoMediaId + "/preview?fmt=webp&w=320&t=" + t } } Button { text: qsTr("Entfernen") implicitHeight: 28 background: Rectangle { color: parent.hovered ? Theme.bgHover : Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } contentItem: Text { text: parent.text; color: Theme.textSecondary; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter } onClicked: { posterPreview.source = "" propPanel.debounceSave(eKey, -1.0) } } } Image { id: posterPreview Layout.fillWidth: true Layout.preferredHeight: sourceSize.height > 0 ? (width * sourceSize.height / sourceSize.width) : 0 fillMode: Image.PreserveAspectFit visible: source != "" cache: false source: { if (videoMediaId === "" || currentTime < 0) return "" var surl = localApi.serverUrl() var origin = surl try { var u = new URL(surl); origin = u.origin } catch(e) {} return "image://auth/" + origin + "/media/" + videoMediaId + "/preview?fmt=webp&w=320&t=" + currentTime } } } /* survey_select — fetch list from server and pick */ ColumnLayout { visible: field.type === "survey_select" Loading
editor/widgets/video/video.cpp +19 −0 Changes for editor/widgets/video/video.cpp: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Poster (thumbnail from video frame via MediaDB) double posterTime = -1.0; // Time offset in seconds (-1 = no poster) // Custom CSS std::string customCss = ""; Loading Loading @@ -261,6 +264,7 @@ extern "C" { json_object_object_add(obj, "media_ext", json_object_new_string(mediaExt.c_str())); json_object_object_add(obj, "controls", json_object_new_boolean(controls)); json_object_object_add(obj, "play_on_hover", json_object_new_boolean(playOnHover)); json_object_object_add(obj, "poster_time", json_object_new_double(posterTime)); json_object_object_add(obj, "m_width", json_object_new_string(m_width.c_str())); json_object_object_add(obj, "m_height", json_object_new_string(m_height.c_str())); json_object_object_add(obj, "hidden", json_object_new_boolean(hidden)); Loading Loading @@ -293,6 +297,9 @@ extern "C" { if (json_object_object_get_ex(obj, "media_ext", &val_obj)) { val = json_object_get_string(val_obj); if (val && val[0]) mediaExt = val; } if (json_object_object_get_ex(obj, "poster_time", &val_obj)) { posterTime = json_object_get_double(val_obj); } if (json_object_object_get_ex(obj, "controls", &val_obj)) { if (json_object_is_type(val_obj, json_type_string)) { const char *s = json_object_get_string(val_obj); Loading Loading @@ -366,6 +373,7 @@ extern "C" { addField("height", "CSS Height", "text", "auto", "desktop"); addField("controls", "Show Play Controls", "checkbox"); addField("play_on_hover", "Play on Mouse Over", "checkbox"); addField("poster_time", "Vorschaubild Zeitpunkt (Sek.)", "video_poster"); addField("hidden", "Hidden", "checkbox", nullptr, "desktop"); { json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1); Loading Loading @@ -393,6 +401,17 @@ extern "C" { video.setAttribute("src", renderSrc.c_str()); video.setAttribute("class", responsiveClass.c_str()); // Poster/thumbnail extracted from video by MediaDB if (posterTime >= 0.0 && !mediaId.empty()) { std::ostringstream posterUrl; posterUrl << "/media/" << mediaId << "/preview?fmt=webp&w=1280&t=" << posterTime; std::string pUrl = posterUrl.str(); if (!pfx.empty() && pfx != "/") { pUrl = pfx + pUrl; } video.setAttribute("poster", pUrl.c_str()); } if (controls) { video.setAttribute("controls", "controls"); } else if (playOnHover) { Loading