trying to fix seg fault
This commit is contained in:
parent
5a1fa3fc75
commit
24106c2c3c
5 changed files with 90 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "mpvobject.h"
|
#include "mpvobject.h"
|
||||||
|
|
||||||
// std
|
// std
|
||||||
|
#include <mpv/render.h>
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -271,7 +272,7 @@ void MpvObject::command(const QVariant& params)
|
||||||
|
|
||||||
void MpvObject::commandAsync(const QVariant& params)
|
void MpvObject::commandAsync(const QVariant& params)
|
||||||
{
|
{
|
||||||
qDebug() << params;
|
// qDebug() << params;
|
||||||
mpv::qt::command_async(mpv, params);
|
mpv::qt::command_async(mpv, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,6 +506,12 @@ void MpvObject::stop()
|
||||||
command(QVariantList() << "stop");
|
command(QVariantList() << "stop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MpvObject::quit()
|
||||||
|
{
|
||||||
|
command(QVariantList() << "quit");
|
||||||
|
qDebug() << "We quit mpv";
|
||||||
|
}
|
||||||
|
|
||||||
void MpvObject::stepBackward()
|
void MpvObject::stepBackward()
|
||||||
{
|
{
|
||||||
command(QVariantList() << "frame-back-step");
|
command(QVariantList() << "frame-back-step");
|
||||||
|
|
|
@ -131,6 +131,7 @@ public slots:
|
||||||
void play();
|
void play();
|
||||||
void pause();
|
void pause();
|
||||||
void stop();
|
void stop();
|
||||||
|
void quit();
|
||||||
void stepBackward();
|
void stepBackward();
|
||||||
void stepForward();
|
void stepForward();
|
||||||
void seek(double pos);
|
void seek(double pos);
|
||||||
|
|
|
@ -653,12 +653,19 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onDropped: drop => {
|
onDropped: drop => {
|
||||||
overlay = false;
|
overlay = false;
|
||||||
showPassiveNotification("dropped");
|
print("dropped");
|
||||||
print(drop.urls);
|
print(drop.urls);
|
||||||
/* thumbnailer.loadFile(drop.urls[0]); */
|
/* thumbnailer.loadFile(drop.urls[0]); */
|
||||||
|
if (drop.urls.length !== 0){
|
||||||
|
print("dropping a real file!!")
|
||||||
addVideo(drop.urls[0]);
|
addVideo(drop.urls[0]);
|
||||||
|
} else
|
||||||
|
print("this is not a real file!")
|
||||||
|
}
|
||||||
|
onEntered: {
|
||||||
|
if (isDragFile(drag.urls[0]))
|
||||||
|
overlay = true;
|
||||||
}
|
}
|
||||||
onEntered: overlay = true
|
|
||||||
onExited: overlay = false
|
onExited: overlay = false
|
||||||
|
|
||||||
function addVideo(url) {
|
function addVideo(url) {
|
||||||
|
@ -673,6 +680,17 @@ Item {
|
||||||
editSwitch("video", video);
|
editSwitch("video", video);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDragFile(item) {
|
||||||
|
var extension = item.split('.').pop();
|
||||||
|
var valid = false;
|
||||||
|
|
||||||
|
if(extension) {
|
||||||
|
print(extension);
|
||||||
|
valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -30,6 +30,8 @@ Controls.Page {
|
||||||
property var song
|
property var song
|
||||||
property var draggedLibraryItem
|
property var draggedLibraryItem
|
||||||
|
|
||||||
|
property Item editStackItem
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -73,6 +75,13 @@ Controls.Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: presentationComp
|
||||||
|
Presenter.Presentation {
|
||||||
|
id: presentation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: songEditorComp
|
id: songEditorComp
|
||||||
Presenter.SongEditor {
|
Presenter.SongEditor {
|
||||||
|
@ -84,7 +93,6 @@ Controls.Page {
|
||||||
id: videoEditorComp
|
id: videoEditorComp
|
||||||
Presenter.VideoEditor {
|
Presenter.VideoEditor {
|
||||||
id: videoEditor
|
id: videoEditor
|
||||||
Controls.StackView.onDeactivating: prePop()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +106,11 @@ Controls.Page {
|
||||||
Loader {
|
Loader {
|
||||||
id: presentLoader
|
id: presentLoader
|
||||||
active: presenting
|
active: presenting
|
||||||
sourceComponent: presentationComponent
|
sourceComponent: presentWindowComp
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: presentationComponent
|
id: presentWindowComp
|
||||||
Window {
|
Window {
|
||||||
id: presentationWindow
|
id: presentationWindow
|
||||||
title: "presentation-window"
|
title: "presentation-window"
|
||||||
|
@ -173,6 +181,12 @@ Controls.Page {
|
||||||
id: videosqlmodel
|
id: videosqlmodel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: popTimer
|
||||||
|
interval: 800
|
||||||
|
onTriggered: mainPageArea.push(presentationComp, Controls.StackView.Immediate)
|
||||||
|
}
|
||||||
|
|
||||||
function changeSlideType(type) {
|
function changeSlideType(type) {
|
||||||
/* showPassiveNotification("used to be: " + presentation.text); */
|
/* showPassiveNotification("used to be: " + presentation.text); */
|
||||||
presentation.itemType = type;
|
presentation.itemType = type;
|
||||||
|
@ -231,19 +245,40 @@ Controls.Page {
|
||||||
mainPageArea.push(songEditorComp, Controls.StackView.Immediate);
|
mainPageArea.push(songEditorComp, Controls.StackView.Immediate);
|
||||||
break;
|
break;
|
||||||
case "video" :
|
case "video" :
|
||||||
|
if (mainPageArea.currentItem.type === "video") {
|
||||||
|
print(mainPageArea.currentItem.type);
|
||||||
|
mainPageArea.currentItem.changeVideo(item);
|
||||||
|
} else {
|
||||||
|
print(mainPageArea.depth);
|
||||||
mainPageArea.pop(Controls.StackView.Immediate);
|
mainPageArea.pop(Controls.StackView.Immediate);
|
||||||
|
print(mainPageArea.depth);
|
||||||
mainPageArea.push(videoEditorComp, {"video": item}, Controls.StackView.Immediate);
|
mainPageArea.push(videoEditorComp, {"video": item}, Controls.StackView.Immediate);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "image" :
|
case "image" :
|
||||||
mainPageArea.pop(Controls.StackView.Immediate);
|
mainPageArea.pop(Controls.StackView.Immediate);
|
||||||
mainPageArea.push(imageEditorComp, Controls.StackView.Immediate);
|
mainPageArea.push(imageEditorComp, Controls.StackView.Immediate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mainPageArea.pop(Controls.StackView.Immediate);
|
if (mainPageArea.currentItem.type === "video") {
|
||||||
|
print(mainPageArea.currentItem.type);
|
||||||
|
mainPageArea.currentItem.prePop();
|
||||||
|
}
|
||||||
|
popTimer.restart();
|
||||||
|
print(mainPageArea.depth);
|
||||||
|
editMode = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mainPageArea.currentItem.type === "video") {
|
||||||
|
print(mainPageArea.currentItem.type);
|
||||||
|
mainPageArea.currentItem.prePop();
|
||||||
|
}
|
||||||
|
editStackItem = mainPageArea.currentItem;
|
||||||
|
print(mainPageArea.depth);
|
||||||
|
popTimer.restart();
|
||||||
|
print(mainPageArea.depth);
|
||||||
editMode = false;
|
editMode = false;
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
mainPageArea.pop(Controls.StackView.Immediate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function present(present) {
|
function present(present) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import mpv 1.0
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string type: "video"
|
||||||
property var video
|
property var video
|
||||||
property bool audioOn: true
|
property bool audioOn: true
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ Item {
|
||||||
Component.onCompleted: mpvLoadingTimer.start()
|
Component.onCompleted: mpvLoadingTimer.start()
|
||||||
onPositionChanged: videoSlider.value = position
|
onPositionChanged: videoSlider.value = position
|
||||||
onFileLoaded: {
|
onFileLoaded: {
|
||||||
showPassiveNotification(video.title + " has been loaded");
|
showPassiveNotification(video[0] + " has been loaded");
|
||||||
videoPreview.pause();
|
videoPreview.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,5 +225,18 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prePop() { videoPreview.stop() }
|
function changeVideo(video) {
|
||||||
|
root.video = video;
|
||||||
|
mpvLoadingTimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
function prePop() {
|
||||||
|
print("stopping video");
|
||||||
|
videoSlider.to = 0;
|
||||||
|
/* videoSlider.position = 0; */
|
||||||
|
/* videoSlider.onMoved = null; */
|
||||||
|
videoPreview.quit();
|
||||||
|
print("quit mpv");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue