From 13b4b53e9dc699b749fffd5438753502126b816a Mon Sep 17 00:00:00 2001 From: NamedKitten Date: Sat, 24 Nov 2018 15:43:48 +0000 Subject: [PATCH] [UI+Backend] Fixed playlist menu pausing and added minor improvements. --- src/MpvPlayerBackend.cpp | 14 +++++++++++++- src/main.cpp | 3 --- src/qml/PlaylistDialog.qml | 4 +--- src/qml/main.qml | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/MpvPlayerBackend.cpp b/src/MpvPlayerBackend.cpp index e4beff8..7b008d9 100644 --- a/src/MpvPlayerBackend.cpp +++ b/src/MpvPlayerBackend.cpp @@ -16,6 +16,12 @@ #include "discord_rpc.h" #endif +#ifdef __linux__ +#include +#include +#include +#endif + namespace { void @@ -90,13 +96,19 @@ public: .h = fbo->height(), .internal_format = 0 }; int flip_y{ 0 }; - +#ifdef __linux__ + Display* dpy = QX11Info::display(); +#endif mpv_render_param params[] = { // Specify the default framebuffer (0) as target. This will // render onto the entire screen. If you want to show the video // in a smaller rectangle or apply fancy transformations, you'll // need to render into a separate FBO and draw it manually. { MPV_RENDER_PARAM_OPENGL_FBO, &mpfbo }, +#ifdef __linux__ + { MPV_RENDER_PARAM_X11_DISPLAY, dpy }, +#endif + // Flip rendering (needed due to flipped GL coordinate system). { MPV_RENDER_PARAM_FLIP_Y, &flip_y }, { MPV_RENDER_PARAM_INVALID, nullptr } diff --git a/src/main.cpp b/src/main.cpp index 20a088d..9606827 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,9 +116,6 @@ main(int argc, char* argv[]) "/usr/bin:" + QProcessEnvironment::systemEnvironment().value("PATH", ""); setenv("PATH", newpath.toUtf8().constData(), 1); - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_NativeWindows); - qmlRegisterUncreatableMetaObject( Enums::staticMetaObject, // static meta object "player", // import statement (can be any string) diff --git a/src/qml/PlaylistDialog.qml b/src/qml/PlaylistDialog.qml index 1744424..ac244f4 100644 --- a/src/qml/PlaylistDialog.qml +++ b/src/qml/PlaylistDialog.qml @@ -13,11 +13,9 @@ Dialog { width: 720 modality: Qt.NonModal Component.onCompleted: { - player.titleChanged.connect(updatePlaylistMenu) player.playlistChanged.connect(updatePlaylistMenu) } - function updatePlaylistMenu() { - var playlist = player.playerCommand(Enums.Commands.GetPlaylist) + function updatePlaylistMenu(playlist) { playlistModel.clear() for (var thing in playlist) { var item = playlist[thing] diff --git a/src/qml/main.qml b/src/qml/main.qml index d93fc47..e4e9992 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -9,12 +9,13 @@ import player 1.0 import "codes.js" as LanguageCodes -ApplicationWindow { +Window { id: mainWindow title: titleLabel.text visible: true width: 720 height: 480 + Translator { id: translate }