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"
|
||||
|
||||
// std
|
||||
#include <mpv/render.h>
|
||||
#include <qdir.h>
|
||||
#include <qvariant.h>
|
||||
#include <stdexcept>
|
||||
|
@ -271,7 +272,7 @@ void MpvObject::command(const QVariant& params)
|
|||
|
||||
void MpvObject::commandAsync(const QVariant& params)
|
||||
{
|
||||
qDebug() << params;
|
||||
// qDebug() << params;
|
||||
mpv::qt::command_async(mpv, params);
|
||||
}
|
||||
|
||||
|
@ -505,6 +506,12 @@ void MpvObject::stop()
|
|||
command(QVariantList() << "stop");
|
||||
}
|
||||
|
||||
void MpvObject::quit()
|
||||
{
|
||||
command(QVariantList() << "quit");
|
||||
qDebug() << "We quit mpv";
|
||||
}
|
||||
|
||||
void MpvObject::stepBackward()
|
||||
{
|
||||
command(QVariantList() << "frame-back-step");
|
||||
|
|
|
@ -131,6 +131,7 @@ public slots:
|
|||
void play();
|
||||
void pause();
|
||||
void stop();
|
||||
void quit();
|
||||
void stepBackward();
|
||||
void stepForward();
|
||||
void seek(double pos);
|
||||
|
|
|
@ -653,12 +653,19 @@ Item {
|
|||
anchors.fill: parent
|
||||
onDropped: drop => {
|
||||
overlay = false;
|
||||
showPassiveNotification("dropped");
|
||||
print("dropped");
|
||||
print(drop.urls);
|
||||
/* thumbnailer.loadFile(drop.urls[0]); */
|
||||
addVideo(drop.urls[0]);
|
||||
if (drop.urls.length !== 0){
|
||||
print("dropping a real file!!")
|
||||
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
|
||||
|
||||
function addVideo(url) {
|
||||
|
@ -673,6 +680,17 @@ Item {
|
|||
editSwitch("video", video);
|
||||
}
|
||||
|
||||
function isDragFile(item) {
|
||||
var extension = item.split('.').pop();
|
||||
var valid = false;
|
||||
|
||||
if(extension) {
|
||||
print(extension);
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
|
@ -30,6 +30,8 @@ Controls.Page {
|
|||
property var song
|
||||
property var draggedLibraryItem
|
||||
|
||||
property Item editStackItem
|
||||
|
||||
Item {
|
||||
id: mainItem
|
||||
anchors.fill: parent
|
||||
|
@ -60,7 +62,7 @@ Controls.Page {
|
|||
Controls.SplitView.fillWidth: true
|
||||
Controls.SplitView.preferredWidth: 500
|
||||
Controls.SplitView.minimumWidth: 200
|
||||
initialItem: Presenter.Presentation { id: presentation }
|
||||
initialItem: Presenter.Presentation {id: presentation}
|
||||
}
|
||||
|
||||
Presenter.Library {
|
||||
|
@ -73,6 +75,13 @@ Controls.Page {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: presentationComp
|
||||
Presenter.Presentation {
|
||||
id: presentation
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: songEditorComp
|
||||
Presenter.SongEditor {
|
||||
|
@ -84,7 +93,6 @@ Controls.Page {
|
|||
id: videoEditorComp
|
||||
Presenter.VideoEditor {
|
||||
id: videoEditor
|
||||
Controls.StackView.onDeactivating: prePop()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,11 +106,11 @@ Controls.Page {
|
|||
Loader {
|
||||
id: presentLoader
|
||||
active: presenting
|
||||
sourceComponent: presentationComponent
|
||||
sourceComponent: presentWindowComp
|
||||
}
|
||||
|
||||
Component {
|
||||
id: presentationComponent
|
||||
id: presentWindowComp
|
||||
Window {
|
||||
id: presentationWindow
|
||||
title: "presentation-window"
|
||||
|
@ -173,6 +181,12 @@ Controls.Page {
|
|||
id: videosqlmodel
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: popTimer
|
||||
interval: 800
|
||||
onTriggered: mainPageArea.push(presentationComp, Controls.StackView.Immediate)
|
||||
}
|
||||
|
||||
function changeSlideType(type) {
|
||||
/* showPassiveNotification("used to be: " + presentation.text); */
|
||||
presentation.itemType = type;
|
||||
|
@ -231,19 +245,40 @@ Controls.Page {
|
|||
mainPageArea.push(songEditorComp, Controls.StackView.Immediate);
|
||||
break;
|
||||
case "video" :
|
||||
mainPageArea.pop(Controls.StackView.Immediate);
|
||||
mainPageArea.push(videoEditorComp, {"video": item}, Controls.StackView.Immediate);
|
||||
if (mainPageArea.currentItem.type === "video") {
|
||||
print(mainPageArea.currentItem.type);
|
||||
mainPageArea.currentItem.changeVideo(item);
|
||||
} else {
|
||||
print(mainPageArea.depth);
|
||||
mainPageArea.pop(Controls.StackView.Immediate);
|
||||
print(mainPageArea.depth);
|
||||
mainPageArea.push(videoEditorComp, {"video": item}, Controls.StackView.Immediate);
|
||||
}
|
||||
break;
|
||||
case "image" :
|
||||
mainPageArea.pop(Controls.StackView.Immediate);
|
||||
mainPageArea.push(imageEditorComp, Controls.StackView.Immediate);
|
||||
break;
|
||||
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
|
||||
mainPageArea.pop(Controls.StackView.Immediate);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
function present(present) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import mpv 1.0
|
|||
Item {
|
||||
id: root
|
||||
|
||||
property string type: "video"
|
||||
property var video
|
||||
property bool audioOn: true
|
||||
|
||||
|
@ -169,7 +170,7 @@ Item {
|
|||
Component.onCompleted: mpvLoadingTimer.start()
|
||||
onPositionChanged: videoSlider.value = position
|
||||
onFileLoaded: {
|
||||
showPassiveNotification(video.title + " has been loaded");
|
||||
showPassiveNotification(video[0] + " has been loaded");
|
||||
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