fixing more of the VideoEditor
This commit is contained in:
parent
c5ed583522
commit
433ccf345b
5 changed files with 60 additions and 24 deletions
|
@ -43,9 +43,9 @@ set_package_properties(FFmpeg PROPERTIES TYPE REQUIRED)
|
||||||
# find_package(Libmpv)
|
# find_package(Libmpv)
|
||||||
# set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
# set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
||||||
|
|
||||||
# find_package(MpvQt)
|
find_package(MpvQt)
|
||||||
# set_package_properties(MpvQt PROPERTIES TYPE REQUIRED
|
set_package_properties(MpvQt PROPERTIES TYPE REQUIRED
|
||||||
# URL "https://invent.kde.org/libraries/mpvqt")
|
URL "https://invent.kde.org/libraries/mpvqt")
|
||||||
|
|
||||||
find_package(YouTubeDl)
|
find_package(YouTubeDl)
|
||||||
set_package_properties(YouTubeDl PROPERTIES TYPE RUNTIME)
|
set_package_properties(YouTubeDl PROPERTIES TYPE RUNTIME)
|
||||||
|
@ -108,7 +108,7 @@ target_link_libraries(${APP_NAME}_lib INTERFACE
|
||||||
KF6::I18n
|
KF6::I18n
|
||||||
KF6::CoreAddons
|
KF6::CoreAddons
|
||||||
# KF6::FileMetaData
|
# KF6::FileMetaData
|
||||||
# MpvQt::MpvQt
|
MpvQt::MpvQt
|
||||||
# mpv
|
# mpv
|
||||||
ssl
|
ssl
|
||||||
crypto
|
crypto
|
||||||
|
|
|
@ -36,6 +36,7 @@ mkShell rec {
|
||||||
qt6.qtwebengine
|
qt6.qtwebengine
|
||||||
qt6.qtimageformats
|
qt6.qtimageformats
|
||||||
kdePackages.kirigami
|
kdePackages.kirigami
|
||||||
|
kdePackages.mpvqt
|
||||||
# kdePackages.kfilemetadata
|
# kdePackages.kfilemetadata
|
||||||
# libsForQt5.breeze-icons
|
# libsForQt5.breeze-icons
|
||||||
# libsForQt5.breeze-qt5
|
# libsForQt5.breeze-qt5
|
||||||
|
|
|
@ -14,8 +14,8 @@ target_sources(lumina
|
||||||
# cpp/imagesqlmodel.cpp cpp/imagesqlmodel.h
|
# cpp/imagesqlmodel.cpp cpp/imagesqlmodel.h
|
||||||
# cpp/filemanager.cpp cpp/filemanager.h
|
# cpp/filemanager.cpp cpp/filemanager.h
|
||||||
# cpp/presentationsqlmodel.cpp cpp/presentationsqlmodel.h
|
# cpp/presentationsqlmodel.cpp cpp/presentationsqlmodel.h
|
||||||
# cpp/mpv/mpvitem.h cpp/mpv/mpvitem.cpp
|
cpp/mpv/mpvitem.h cpp/mpv/mpvitem.cpp
|
||||||
# cpp/mpv/mpvproperties.h
|
cpp/mpv/mpvproperties.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options (lumina PUBLIC -fexceptions)
|
target_compile_options (lumina PUBLIC -fexceptions)
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -37,9 +37,9 @@
|
||||||
#include <qsqldatabase.h>
|
#include <qsqldatabase.h>
|
||||||
#include <qsqlquery.h>
|
#include <qsqlquery.h>
|
||||||
#include <qstringliteral.h>
|
#include <qstringliteral.h>
|
||||||
|
#include <MpvAbstractItem>
|
||||||
// #include "cpp/mpv/mpvitem.h"
|
#include "cpp/mpv/mpvitem.h"
|
||||||
// #include "cpp/mpv/mpvproperties.h"
|
#include "cpp/mpv/mpvproperties.h"
|
||||||
// #include "cpp/serviceitemmodel.h"
|
// #include "cpp/serviceitemmodel.h"
|
||||||
// #include "cpp/slidemodel.h"
|
// #include "cpp/slidemodel.h"
|
||||||
// #include "cpp/songsqlmodel.h"
|
// #include "cpp/songsqlmodel.h"
|
||||||
|
@ -197,8 +197,12 @@ int main(int argc, char *argv[])
|
||||||
// qmlRegisterType<PresentationSqlModel>("org.presenter", 1, 0, "PresentationSqlModel");
|
// qmlRegisterType<PresentationSqlModel>("org.presenter", 1, 0, "PresentationSqlModel");
|
||||||
qmlRegisterType<FileHelper>("org.presenter", 1, 0, "FileHelper");
|
qmlRegisterType<FileHelper>("org.presenter", 1, 0, "FileHelper");
|
||||||
qmlRegisterType<Ytdl>("org.presenter", 1, 0, "Ytdl");
|
qmlRegisterType<Ytdl>("org.presenter", 1, 0, "Ytdl");
|
||||||
// qmlRegisterType<ServiceThing>("org.presenter", 1, 0, "ServiceThing");
|
qmlRegisterType<ServiceThing>("org.presenter", 1, 0, "ServiceThing");
|
||||||
qmlRegisterType<SlideHelper>("org.presenter", 1, 0, "SlideHelper");
|
// qmlRegisterType<SlideHelper>("org.presenter", 1, 0, "SlideHelper");
|
||||||
|
qmlRegisterType<MpvItem>("mpv", 1, 0, "MpvItem");
|
||||||
|
qmlRegisterSingletonInstance("mpv", 1, 0, "MpvProperties", MpvProperties::self());
|
||||||
|
|
||||||
|
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0,
|
qmlRegisterSingletonInstance("org.presenter", 1, 0,
|
||||||
"ServiceItemModel", serviceItemModel.get());
|
"ServiceItemModel", serviceItemModel.get());
|
||||||
// qmlRegisterSingletonInstance("org.presenter", 1, 0,
|
// qmlRegisterSingletonInstance("org.presenter", 1, 0,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.kde.kirigami 2.13 as Kirigami
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
import org.presenter 1.0
|
import org.presenter 1.0
|
||||||
|
import mpv 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -89,10 +90,20 @@ Item {
|
||||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
source: video.filePath.toString()
|
||||||
|
// Need to create the thumbnail for videos as in the library
|
||||||
|
// and then save them for having a thumbnail here
|
||||||
|
}
|
||||||
|
|
||||||
Video {
|
Video {
|
||||||
id: videoPreview
|
id: videoPreview
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
source: root.video.filePath.toString()
|
||||||
|
loops: video.loop ? MediaPlayer.Infinite : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -107,7 +118,7 @@ Item {
|
||||||
color: Kirigami.Theme.textColor
|
color: Kirigami.Theme.textColor
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressed: videoPreview.playPause()
|
onPressed: videoPreview.playbackState == MediaPlayer.PlayingState ? videoPreview.pause() : videoPreview.play()
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +135,16 @@ Item {
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
id: videoTime
|
id: videoTime
|
||||||
text: new Date(videoPreview.position * 1000).toISOString().slice(11, 19);
|
text: {
|
||||||
|
let mil = Math.floor(videoPreview.position);
|
||||||
|
let sec = Math.floor((mil / 1000) % 60);
|
||||||
|
let min = Math.floor((mil / (1000 * 60)) % 60);
|
||||||
|
let hour = Math.floor((mil / (1000 * 60 * 60)) % 24);
|
||||||
|
sec = (sec < 10) ? "0" + sec : sec;
|
||||||
|
min = (min < 10) ? "0" + min : min;
|
||||||
|
hour = (hour < 10) ? "0" + hour : hour;
|
||||||
|
return hour + ":" + min + ":" + sec
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +237,17 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: endTimeField
|
id: endTimeField
|
||||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 6
|
Layout.preferredWidth: Kirigami.Units.gridUnit * 6
|
||||||
text: new Date(videoLengthSlider.secondVisualPosition * 1000).toISOString().slice(11, 19);
|
text: {
|
||||||
|
let mil = Math.floor(videoLengthSlider.secondVisualPosition);
|
||||||
|
let sec = Math.floor((mil / 1000) % 60);
|
||||||
|
let min = Math.floor((mil / (1000 * 60)) % 60);
|
||||||
|
let hour = Math.floor((mil / (1000 * 60 * 60)) % 24);
|
||||||
|
sec = (sec < 10) ? "0" + sec : sec;
|
||||||
|
min = (min < 10) ? "0" + min : min;
|
||||||
|
hour = (hour < 10) ? "0" + hour : hour;
|
||||||
|
return hour + ":" + min + ":" + sec
|
||||||
|
}
|
||||||
|
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
background: Presenter.TextBackground {
|
background: Presenter.TextBackground {
|
||||||
control: endTimeField
|
control: endTimeField
|
||||||
|
@ -236,19 +266,20 @@ Item {
|
||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
id: mpvLoadingTimer
|
id: mpvLoadingTimer
|
||||||
interval: 100
|
interval: 500
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
videoPreview.loadFile(video.filePath.toString());
|
videoPreview.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeVideo(index) {
|
function changeVideo(index) {
|
||||||
let vid = videoProxyModel.getVideo(index);
|
let vid = videoModel.getItem(index);
|
||||||
root.video = vid;
|
root.video = vid;
|
||||||
console.log(video.startTime);
|
console.log(vid.startTime);
|
||||||
console.log(video.endTime);
|
console.log(vid.endTime);
|
||||||
|
/* videoPreview.play(); */
|
||||||
mpvLoadingTimer.restart();
|
mpvLoadingTimer.restart();
|
||||||
footerSecondText = video.filePath;
|
footerSecondText = vid.filePath;
|
||||||
footerFirstText = "File path: ";
|
footerFirstText = "File path: ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,24 +290,24 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateEndTime(value) {
|
function updateEndTime(value) {
|
||||||
videoProxyModel.videoModel.updateEndTime(video.id, Math.min(value, videoPreview.duration));
|
|
||||||
video.endTime = value;
|
video.endTime = value;
|
||||||
|
videoModel.updateEndTime(video.id, Math.min(value, videoPreview.duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStartTime(value) {
|
function updateStartTime(value) {
|
||||||
videoProxyModel.videoModel.updateStartTime(video.id, Math.max(value, 0));
|
|
||||||
video.startTime = value;
|
video.startTime = value;
|
||||||
|
videoModel.updateStartTime(video.id, Math.max(value, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTitle(text) {
|
function updateTitle(text) {
|
||||||
changeTitle(text, false);
|
changeTitle(text, false);
|
||||||
videoProxyModel.videoModel.updateTitle(video.id, text);
|
videoModel.updateTitle(video.id, text);
|
||||||
/* showPassiveNotification(video.title); */
|
/* showPassiveNotification(video.title); */
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLoop(value) {
|
function updateLoop(value) {
|
||||||
/* changeStartTime(value, false); */
|
/* changeStartTime(value, false); */
|
||||||
let bool = videoProxyModel.videoModel.updateLoop(video.id, value);
|
let bool = videoModel.updateLoop(video.id, value);
|
||||||
if (bool)
|
if (bool)
|
||||||
video.loop = value;
|
video.loop = value;
|
||||||
/* showPassiveNotification("Loop changed to: " + video.loop); */
|
/* showPassiveNotification("Loop changed to: " + video.loop); */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue