Rework some things, fix deps.
This commit is contained in:
parent
bc13e08241
commit
59fecddc0a
|
@ -31,7 +31,7 @@ A video player based on Qt, QML and libmpv with themes for many online video pla
|
|||
#### Dependencies
|
||||
##### Arch Linux
|
||||
```
|
||||
pacman -S git cmake qt5-svg qt5-declarative qt5-quickcontrols qt5-quickcontrols2 mpv
|
||||
pacman -S git cmake qt5-svg qt5-declarative qt5-quickcontrols qt5-quickcontrols2 qt5-graphicaleffects mpv
|
||||
```
|
||||
##### Ubuntu Xenial
|
||||
```
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <qcbormap.h> // IWYU pragma: keep
|
||||
#include <qcoreapplication.h>
|
||||
#include <qglobal.h>
|
||||
#include <qjsonvalue.h> // IWYU pragma: keep
|
||||
#include <qjsonarray.h> // IWYU pragma: keep
|
||||
#include <qjsonobject.h> // IWYU pragma: keep
|
||||
#include <qlist.h>
|
||||
|
@ -22,7 +23,7 @@
|
|||
|
||||
auto mpvLogger = initLogger("mpv");
|
||||
|
||||
static inline QVariant node_to_variant(const mpv_node *node)
|
||||
static inline QVariant mpvnode_to_variant(const mpv_node *node)
|
||||
{
|
||||
if (!node) {
|
||||
return QVariant();
|
||||
|
@ -41,7 +42,7 @@ static inline QVariant node_to_variant(const mpv_node *node)
|
|||
mpv_node_list *list = node->u.list;
|
||||
QVariantList qlist;
|
||||
for (int n = 0; n < list->num; n++)
|
||||
qlist.append(node_to_variant(&list->values[n]));
|
||||
qlist.append(mpvnode_to_variant(&list->values[n]));
|
||||
return QVariant(qlist);
|
||||
}
|
||||
case MPV_FORMAT_NODE_MAP: {
|
||||
|
@ -49,7 +50,7 @@ static inline QVariant node_to_variant(const mpv_node *node)
|
|||
QVariantMap qmap;
|
||||
for (int n = 0; n < list->num; n++) {
|
||||
qmap.insert(QString::fromUtf8(list->keys[n]),
|
||||
node_to_variant(&list->values[n]));
|
||||
mpvnode_to_variant(&list->values[n]));
|
||||
}
|
||||
return QVariant(qmap);
|
||||
}
|
||||
|
@ -489,7 +490,7 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
|
|||
}
|
||||
} else if (strcmp(prop->name, "pause") == 0) {
|
||||
mpv_node* nod = (mpv_node*)prop->data;
|
||||
if (node_to_variant(nod).toBool()) {
|
||||
if (mpvnode_to_variant(nod).toBool()) {
|
||||
emit b->playStatusChanged(Enums::PlayStatus::Paused);
|
||||
// Utils::SetScreensaver(window()->winId(), true);
|
||||
} else {
|
||||
|
@ -498,16 +499,16 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
|
|||
}
|
||||
} else if (strcmp(prop->name, "track-list") == 0) {
|
||||
mpv_node* nod = (mpv_node*)prop->data;
|
||||
emit b->tracksChanged(node_to_variant(nod).toList());
|
||||
emit b->tracksChanged(mpvnode_to_variant(nod).toList());
|
||||
} else if (strcmp(prop->name, "audio-device-list") == 0) {
|
||||
mpv_node* nod = (mpv_node*)prop->data;
|
||||
emit b->audioDevicesChanged(b->getAudioDevices(node_to_variant(nod)));
|
||||
emit b->audioDevicesChanged(b->getAudioDevices(mpvnode_to_variant(nod)));
|
||||
} else if (strcmp(prop->name, "playlist") == 0) {
|
||||
mpv_node* nod = (mpv_node*)prop->data;
|
||||
emit b->playlistChanged(node_to_variant(nod).toList());
|
||||
emit b->playlistChanged(mpvnode_to_variant(nod).toList());
|
||||
} else if (strcmp(prop->name, "chapter-list") == 0) {
|
||||
mpv_node* nod = (mpv_node*)prop->data;
|
||||
emit b->chaptersChanged(node_to_variant(nod).toList());
|
||||
emit b->chaptersChanged(mpvnode_to_variant(nod).toList());
|
||||
} else if (strcmp(prop->name, "speed") == 0) {
|
||||
double speed = *(double*)prop->data;
|
||||
emit b->speedChanged(speed);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
void
|
||||
wakeup(void* ctx)
|
||||
nofbowakeup(void* ctx)
|
||||
{
|
||||
QCoreApplication::postEvent((MPVNoFBOBackend*)ctx, new QEvent(QEvent::User));
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ MPVNoFBOBackend::MPVNoFBOBackend(QQuickItem* parent)
|
|||
mpv_observe_property(mpv, 0, "pause", MPV_FORMAT_NODE);
|
||||
mpv_observe_property(mpv, 0, "playlist", MPV_FORMAT_NODE);
|
||||
mpv_observe_property(mpv, 0, "speed", MPV_FORMAT_DOUBLE);
|
||||
mpv_set_wakeup_callback(mpv, wakeup, this);
|
||||
mpv_set_wakeup_callback(mpv, nofbowakeup, this);
|
||||
|
||||
if (mpv_initialize(mpv) < 0)
|
||||
throw std::runtime_error("could not initialize mpv context");
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#ifndef Process_H
|
||||
#define Process_H
|
||||
|
||||
#include <qmetatype.h>
|
||||
#include <qobjectdefs.h>
|
||||
#include <qprocess.h>
|
||||
|
@ -15,3 +18,4 @@ public:
|
|||
|
||||
Q_INVOKABLE QString getOutput();
|
||||
};
|
||||
#endif
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef ThumbnailCache_H
|
||||
#define ThumbnailCache_H
|
||||
#include <qdir.h>
|
||||
#include <qobject.h>
|
||||
#include <qobjectdefs.h>
|
||||
|
@ -23,3 +25,4 @@ private:
|
|||
QNetworkAccessManager* manager;
|
||||
QDir cacheFolder;
|
||||
};
|
||||
#endif
|
|
@ -114,7 +114,7 @@ main(int argc, char* argv[])
|
|||
if (! settings.value("Backend/disableSunxiCheck", false).toBool()) {
|
||||
FILE *fd = popen("grep sunxi /proc/modules", "r");
|
||||
char buf[16];
|
||||
if (fread(buf, 1, sizeof (buf), fd) > 0)
|
||||
if (fread(buf, 1, sizeof (buf), fd) > 0) {
|
||||
launcherLogger->info("Running on sunxi, switching to NoFBO.");
|
||||
settings.setValue("Backend/fbo", false);
|
||||
settings.setValue("Appearance/clickToPause", false);
|
||||
|
@ -123,6 +123,7 @@ main(int argc, char* argv[])
|
|||
settings.setValue("Appearance/subtitlesFontSize", 38);
|
||||
settings.setValue("Appearance/uiFadeTimer", 2000);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,10 +13,7 @@ Item {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
property var background: controlsBackground
|
||||
property var combinedHeight: progressBar.height + controlsBackground.height
|
||||
property var controls: controlsBar
|
||||
property var duration: progressBar.to
|
||||
property bool controlsShowing: true
|
||||
|
||||
Connections {
|
||||
|
|
|
@ -474,10 +474,21 @@ MenuBar {
|
|||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: skipToNinthDuration
|
||||
property var duration: 0
|
||||
Connections {
|
||||
target: player
|
||||
onDurationChanged: function (duration) {
|
||||
skipToNinthDuration.duration = duration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function skipToNinth(val) {
|
||||
var skipto = 0
|
||||
if (val != 0) {
|
||||
skipto = Math.floor(controlsBar.duration / 9 * val)
|
||||
skipto = Math.floor(skipToNinthDuration.duration / 9 * val)
|
||||
}
|
||||
player.playerCommand(Enums.Commands.SeekAbsolute, skipto)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ Control {
|
|||
property alias iconHeight: icon.iconHeight
|
||||
property alias iconWidth: icon.iconWidth
|
||||
|
||||
property alias containsMouse: mouseArea.containsMouse
|
||||
|
||||
background: Item {}
|
||||
property bool iconRight: false
|
||||
|
||||
|
@ -32,6 +34,7 @@ Control {
|
|||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ Item {
|
|||
MouseArea {
|
||||
id: mouseAreaVolumeArea
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: volumeButton.left
|
||||
anchors.right: volumeSlider.right
|
||||
anchors.top: parent.top
|
||||
width: volumeButton.width + (volumeSlider.visible ? volumeSlider.width : 0)
|
||||
anchors.left: volumeSlider.left
|
||||
anchors.right: volumeSlider.right
|
||||
width: volumeSlider.width
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
z: 500
|
||||
z: 100
|
||||
}
|
||||
|
||||
VolumeButton {
|
||||
|
@ -60,6 +60,7 @@ Item {
|
|||
anchors.bottom: parent.bottom
|
||||
iconHeight: parent.height / 1.25
|
||||
iconWidth: parent.height / 1.25
|
||||
z: 50
|
||||
}
|
||||
VolumeSlider {
|
||||
id: volumeSlider
|
||||
|
|
|
@ -75,6 +75,7 @@ Window {
|
|||
property int uiFadeTimer: 1000
|
||||
property bool doubleTapToSeek: true
|
||||
property double doubleTapToSeekBy: 5
|
||||
property bool swipeToResize: true
|
||||
// Can fix some screen tearing on some devices.
|
||||
property bool maximizeInsteadOfFullscreen: false
|
||||
}
|
||||
|
@ -309,6 +310,7 @@ Window {
|
|||
anchors.fill: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
enabled: appearance.swipeToResize
|
||||
property real velocity: 0.0
|
||||
property int xStart: 0
|
||||
property int xPrev: 0
|
||||
|
@ -331,8 +333,6 @@ Window {
|
|||
appearance.scaleFactor += 0.2
|
||||
} else if (velocity < -2 && mouse.x > parent.width * 0.2) {
|
||||
appearance.scaleFactor -= 0.2
|
||||
} else {
|
||||
console.info(velocity, mouse.x)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ Window {
|
|||
|
||||
MouseArea {
|
||||
id: mouseAreaPlayer
|
||||
z: 1000
|
||||
z: 10
|
||||
focus: true
|
||||
width: parent.width
|
||||
anchors.bottom: mouseAreaBar.top
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <X11/Xutil.h> // IWYU pragma: keep
|
||||
#include <qx11info_x11.h> // IWYU pragma: keep
|
||||
#include <QX11Info> // IWYU pragma: keep
|
||||
#undef Bool
|
||||
#endif
|
||||
|
||||
auto utilsLogger = initLogger("utils");
|
||||
|
@ -134,3 +135,4 @@ AlwaysOnTop(WId wid, bool on)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue