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)
|
||||
# set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
||||
|
||||
# find_package(MpvQt)
|
||||
# set_package_properties(MpvQt PROPERTIES TYPE REQUIRED
|
||||
# URL "https://invent.kde.org/libraries/mpvqt")
|
||||
find_package(MpvQt)
|
||||
set_package_properties(MpvQt PROPERTIES TYPE REQUIRED
|
||||
URL "https://invent.kde.org/libraries/mpvqt")
|
||||
|
||||
find_package(YouTubeDl)
|
||||
set_package_properties(YouTubeDl PROPERTIES TYPE RUNTIME)
|
||||
|
@ -108,7 +108,7 @@ target_link_libraries(${APP_NAME}_lib INTERFACE
|
|||
KF6::I18n
|
||||
KF6::CoreAddons
|
||||
# KF6::FileMetaData
|
||||
# MpvQt::MpvQt
|
||||
MpvQt::MpvQt
|
||||
# mpv
|
||||
ssl
|
||||
crypto
|
||||
|
|
|
@ -36,6 +36,7 @@ mkShell rec {
|
|||
qt6.qtwebengine
|
||||
qt6.qtimageformats
|
||||
kdePackages.kirigami
|
||||
kdePackages.mpvqt
|
||||
# kdePackages.kfilemetadata
|
||||
# libsForQt5.breeze-icons
|
||||
# libsForQt5.breeze-qt5
|
||||
|
|
|
@ -14,8 +14,8 @@ target_sources(lumina
|
|||
# cpp/imagesqlmodel.cpp cpp/imagesqlmodel.h
|
||||
# cpp/filemanager.cpp cpp/filemanager.h
|
||||
# cpp/presentationsqlmodel.cpp cpp/presentationsqlmodel.h
|
||||
# cpp/mpv/mpvitem.h cpp/mpv/mpvitem.cpp
|
||||
# cpp/mpv/mpvproperties.h
|
||||
cpp/mpv/mpvitem.h cpp/mpv/mpvitem.cpp
|
||||
cpp/mpv/mpvproperties.h
|
||||
)
|
||||
|
||||
target_compile_options (lumina PUBLIC -fexceptions)
|
||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -37,9 +37,9 @@
|
|||
#include <qsqldatabase.h>
|
||||
#include <qsqlquery.h>
|
||||
#include <qstringliteral.h>
|
||||
|
||||
// #include "cpp/mpv/mpvitem.h"
|
||||
// #include "cpp/mpv/mpvproperties.h"
|
||||
#include <MpvAbstractItem>
|
||||
#include "cpp/mpv/mpvitem.h"
|
||||
#include "cpp/mpv/mpvproperties.h"
|
||||
// #include "cpp/serviceitemmodel.h"
|
||||
// #include "cpp/slidemodel.h"
|
||||
// #include "cpp/songsqlmodel.h"
|
||||
|
@ -197,8 +197,12 @@ int main(int argc, char *argv[])
|
|||
// qmlRegisterType<PresentationSqlModel>("org.presenter", 1, 0, "PresentationSqlModel");
|
||||
qmlRegisterType<FileHelper>("org.presenter", 1, 0, "FileHelper");
|
||||
qmlRegisterType<Ytdl>("org.presenter", 1, 0, "Ytdl");
|
||||
// qmlRegisterType<ServiceThing>("org.presenter", 1, 0, "ServiceThing");
|
||||
qmlRegisterType<SlideHelper>("org.presenter", 1, 0, "SlideHelper");
|
||||
qmlRegisterType<ServiceThing>("org.presenter", 1, 0, "ServiceThing");
|
||||
// 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,
|
||||
"ServiceItemModel", serviceItemModel.get());
|
||||
// qmlRegisterSingletonInstance("org.presenter", 1, 0,
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.kde.kirigami 2.13 as Kirigami
|
|||
import QtMultimedia
|
||||
import "./" as Presenter
|
||||
import org.presenter 1.0
|
||||
import mpv 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -89,10 +90,20 @@ Item {
|
|||
Layout.leftMargin: 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 {
|
||||
id: videoPreview
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
source: root.video.filePath.toString()
|
||||
loops: video.loop ? MediaPlayer.Infinite : 1
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
@ -107,7 +118,7 @@ Item {
|
|||
color: Kirigami.Theme.textColor
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: videoPreview.playPause()
|
||||
onPressed: videoPreview.playbackState == MediaPlayer.PlayingState ? videoPreview.pause() : videoPreview.play()
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +135,16 @@ Item {
|
|||
|
||||
Controls.Label {
|
||||
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 {
|
||||
id: endTimeField
|
||||
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
|
||||
background: Presenter.TextBackground {
|
||||
control: endTimeField
|
||||
|
@ -236,19 +266,20 @@ Item {
|
|||
}
|
||||
Timer {
|
||||
id: mpvLoadingTimer
|
||||
interval: 100
|
||||
interval: 500
|
||||
onTriggered: {
|
||||
videoPreview.loadFile(video.filePath.toString());
|
||||
videoPreview.pause();
|
||||
}
|
||||
}
|
||||
|
||||
function changeVideo(index) {
|
||||
let vid = videoProxyModel.getVideo(index);
|
||||
let vid = videoModel.getItem(index);
|
||||
root.video = vid;
|
||||
console.log(video.startTime);
|
||||
console.log(video.endTime);
|
||||
console.log(vid.startTime);
|
||||
console.log(vid.endTime);
|
||||
/* videoPreview.play(); */
|
||||
mpvLoadingTimer.restart();
|
||||
footerSecondText = video.filePath;
|
||||
footerSecondText = vid.filePath;
|
||||
footerFirstText = "File path: ";
|
||||
}
|
||||
|
||||
|
@ -259,24 +290,24 @@ Item {
|
|||
}
|
||||
|
||||
function updateEndTime(value) {
|
||||
videoProxyModel.videoModel.updateEndTime(video.id, Math.min(value, videoPreview.duration));
|
||||
video.endTime = value;
|
||||
videoModel.updateEndTime(video.id, Math.min(value, videoPreview.duration));
|
||||
}
|
||||
|
||||
function updateStartTime(value) {
|
||||
videoProxyModel.videoModel.updateStartTime(video.id, Math.max(value, 0));
|
||||
video.startTime = value;
|
||||
videoModel.updateStartTime(video.id, Math.max(value, 0));
|
||||
}
|
||||
|
||||
function updateTitle(text) {
|
||||
changeTitle(text, false);
|
||||
videoProxyModel.videoModel.updateTitle(video.id, text);
|
||||
videoModel.updateTitle(video.id, text);
|
||||
/* showPassiveNotification(video.title); */
|
||||
}
|
||||
|
||||
function updateLoop(value) {
|
||||
/* changeStartTime(value, false); */
|
||||
let bool = videoProxyModel.videoModel.updateLoop(video.id, value);
|
||||
let bool = videoModel.updateLoop(video.id, value);
|
||||
if (bool)
|
||||
video.loop = value;
|
||||
/* showPassiveNotification("Loop changed to: " + video.loop); */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue