Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to Qt 6 #599

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
544a22c
build on qt6
sevenrats Feb 11, 2023
0daccea
inject scripts normally
sevenrats Feb 12, 2023
b5ac942
fix script injection
sevenrats Feb 13, 2023
65601ee
fix gnome title bar
sevenrats Feb 13, 2023
a2ec29c
Merge branch 'jellyfin:master' into qt6
sevenrats Feb 13, 2023
dd10d4a
Merge branch 'jellyfin:master' into qt6
sevenrats Feb 17, 2023
90d0748
Stay logged in between application sessions.
iwalton3 Feb 22, 2023
ddc6310
WIP try fixing rendering
iwalton3 Feb 22, 2023
14331e9
WIP try fixing rendering checkpoint 2
iwalton3 Mar 1, 2023
14ec760
Merge remote-tracking branch 'origin/master' into qt6
iwalton3 Mar 9, 2023
938b316
Merge remote-tracking branch 'origin/master' into qt6
iwalton3 Mar 9, 2023
7ffb243
qt6: fixed build errors & warnings
zjeffer Jun 1, 2023
3fce903
fix window not closing because closingWindow() was getting called rec…
zjeffer Jun 2, 2023
24c2bd8
Merge pull request #452 from zjeffer/qt6
iwalton3 Jun 4, 2023
86589f7
Qt6: fixed some deprecation warnings
zjeffer Jun 7, 2023
2890687
Merge pull request #455 from zjeffer/qt6
iwalton3 Jun 15, 2023
75635aa
Add qt6 packages needed for QT6 build on ubuntu 23.04 to README.md
satmandu Jun 30, 2023
b7b042c
changes to allow qt6 build to complete on ubuntu 23.04
satmandu Jun 30, 2023
bd9aed5
The python package is replaced by python3 in ubuntu.
satmandu Jun 30, 2023
0c5fde9
meson needs to be in the packages list for building...
satmandu Jun 30, 2023
5997ce8
Add more required packages for build.
satmandu Jun 30, 2023
743651b
Use nproc for build parallelism variable
satmandu Jun 30, 2023
3190904
Merge pull request #463 from satmandu/patch-1
iwalton3 Jul 1, 2023
5e45768
Implement QT 6 UI rendering workaround option 1.
iwalton3 Oct 3, 2023
0716fad
Merge branch 'qt6' of github.com:jellyfin/jellyfin-media-player into qt6
iwalton3 Oct 3, 2023
04ce81d
Fix build on Qt 6.5+
zjeffer Dec 31, 2023
8b507eb
Merge pull request #539 from zjeffer/qt6
iwalton3 Jan 21, 2024
d81cd4c
Fix compatibility with mpv 0.38.0
nvllsvm Apr 18, 2024
53cbda5
Merge branch 'master' into qt6
nvllsvm Apr 19, 2024
cdb9e17
Delegate image format selection to mpv by default
nvllsvm Apr 19, 2024
8080e5b
Fix demuxer cache size
nvllsvm Apr 19, 2024
6bb1d62
Fix OSD when zoomed
nvllsvm Apr 19, 2024
9bdd19b
Hide mouse cursor when OSD is hidden
nvllsvm Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set_policy(CMP0020 NEW)
set_policy(CMP0017 NEW)
set_policy(CMP0058 NEW)
set_policy(CMP0026 OLD)
set_policy(CMP0071 NEW)

include(utils)
include(CompilerFlags)
Expand Down
14 changes: 13 additions & 1 deletion CMakeModules/QtConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ foreach(COMP ${components})
set(${mod}_DIR ${QTCONFIGROOT}${COMP})

# look for the actual package
find_package(${mod} ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt6 COMPONENTS Core5Compat REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Network)
find_package(Qt6 REQUIRED COMPONENTS Xml)
find_package(Qt6 REQUIRED COMPONENTS Qml)
find_package(Qt6 REQUIRED COMPONENTS WebChannel)
find_package(Qt6 REQUIRED COMPONENTS Gui)
find_package(Qt6 REQUIRED COMPONENTS Quick)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS WebEngineQuick)
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
find_package(Qt6 REQUIRED COMPONENTS OpenGL)
find_package(Qt6 REQUIRED COMPONENTS DBus)

include_directories(${${mod}_INCLUDE_DIRS})
if(OPENELEC)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
echo -Dlibmpv=true > mpv_options
echo -Dpipewire=disabled >> mpv_options # hopefully temporary
./rebuild -j4
./rebuild -j`nproc`
sudo ./install
sudo ln -s /usr/local/lib/x86_64-linux-gnu/libmpv.so /usr/local/lib/x86_64-linux-gnu/libmpv.so.1
sudo ln -sf /usr/local/lib/x86_64-linux-gnu/libmpv.so /usr/local/lib/libmpv.so.2
Expand All @@ -52,7 +52,7 @@ cd jellyfin-media-player
./download_webclient.sh
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
make -j4
make -j`nproc`
sudo make install
rm -rf ~/jmp/
```
Expand Down
5 changes: 5 additions & 0 deletions external/plistparser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ add_library(plistparser STATIC
plistserializer.h
)
std_target_properties(plistparser)
target_link_libraries(plistparser
Qt6::Core
Qt6::Core5Compat
Qt6::Xml
)
44 changes: 33 additions & 11 deletions native/mpvVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
this.globalize = globalize;
this.appHost = appHost;
this.appSettings = appSettings;

// this can be removed after 10.9
this.setTransparency = (dashboard && dashboard.setBackdropTransparency)
? dashboard.setBackdropTransparency.bind(dashboard)
: appRouter.setTransparency.bind(appRouter);
this.osdObserver = null;

/**
* @type {string}
Expand All @@ -39,7 +35,7 @@
* @type {boolean}
*/
this.isFetching = false;

/**
* @type {HTMLDivElement | null | undefined}
*/
Expand Down Expand Up @@ -141,6 +137,29 @@
if (dlg) {
dlg.style.zIndex = 'unset';
}

document.body.parentElement.classList.remove('transparentDocument');

// no direct way to know when OSD is hidden
if (this.osdObserver) {
this.osdObserver.disconnect();
this.osdObserver = null;
}

const target = document.querySelector('.videoOsdBottom');
this.osdObserver = new MutationObserver(function(mutations) {
if (target.classList.contains('videoOsdBottom-hidden')) {
console.log('OSD hidden');
document.body.style.cursor = 'none';
window.api.player.setVideoRectangle(0, 0, 0, 0);
} else {
console.log('OSD shown');
document.body.style.cursor = 'default';
window.api.player.setVideoRectangle(0, 68 * window.devicePixelRatio, 0, -100 * window.devicePixelRatio);
}
});

this.osdObserver.observe(target, { attributes: true });
};

/**
Expand All @@ -160,12 +179,10 @@
if (this._currentPlayOptions.fullscreen) {
this.appRouter.showVideoOsd().then(this.onNavigatedToOsd);
} else {
this.setTransparency('backdrop');
this._videoDialog.dlg.style.zIndex = 'unset';
}

// Need to override default style.
this._videoDialog.style.setProperty('background', 'transparent', 'important');
window.api.player.setVideoRectangle(0, 68 * window.devicePixelRatio, 0, -100 * window.devicePixelRatio);
}

if (this._paused) {
Expand Down Expand Up @@ -471,7 +488,12 @@
window.api.player.stop();
window.api.power.setScreensaverEnabled(true);

this.setTransparency('none');
window.api.player.setVideoRectangle(-1, 0, 0, 0);

if (this.osdObserver) {
this.osdObserver.disconnect();
this.osdObserver = null;
}

document.body.classList.remove('hide-scroll');

Expand Down Expand Up @@ -539,7 +561,7 @@
player.finished.connect(this.onEnded);
player.updateDuration.connect(this.onDuration);
player.error.connect(this.onError);
player.paused.connect(this.onPause);
player.paused.connect(this.onPause);
}

if (options.fullscreen) {
Expand Down
15 changes: 12 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include_directories(
)

set(CMAKE_AUTOMOC ON)

set(Qt6Core_RCC_EXECUTABLE Qt6::rcc)
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")

add_subdirectory(shared)
Expand Down Expand Up @@ -66,7 +66,7 @@ add_custom_command(OUTPUT resources.qrc
)
set_source_files_properties(resources.qrc PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT qrc_resources.cpp
COMMAND ${Qt5Core_RCC_EXECUTABLE} -name resources -o qrc_resources.cpp resources.qrc
COMMAND ${Qt6Core_RCC_EXECUTABLE} -name resources -o qrc_resources.cpp resources.qrc
DEPENDS resources.qrc ${CMAKE_SOURCE_DIR}/src/ui/webview.qml ${RESOURCE_FILES}
)
set_source_files_properties(qrc_resources.cpp PROPERTIES GENERATED TRUE)
Expand Down Expand Up @@ -183,8 +183,17 @@ target_link_libraries(${MAIN_TARGET}
${CMAKE_THREAD_LIBS_INIT}
${RPI_LIBS}
${MINIZIP_LIBS}
Qt6::Core
Qt6::Core5Compat
Qt6::Quick
Qt6::Widgets
Qt6::WebEngineQuick
Qt6::WebEngineCore
Qt6::OpenGL
Qt6::Xml
Qt6::Gui
Qt6::DBus
)

install(TARGETS ${MAIN_TARGET} DESTINATION ${INSTALL_BIN_DIR})

set(EXE "${MAIN_NAME}.app")
Expand Down
1 change: 1 addition & 0 deletions src/display/DisplayManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef _DISPLAYMANAGER_H_
#define _DISPLAYMANAGER_H_

#include <QObject>
#include <QMap>
#include <QPoint>
#include <QString>
Expand Down
2 changes: 1 addition & 1 deletion src/display/rpi/DisplayManagerRPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void DisplayManagerRPI::resetRendering()
qInfo() << "Recreating Qt UI renderer";

// destroy the window to reset OpenGL context
window->setPersistentOpenGLContext(false);
window->setPersistentGraphics(false);
window->setPersistentSceneGraph(false);
window->destroy();

Expand Down
14 changes: 9 additions & 5 deletions src/input/InputComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ void InputComponent::handleAction(const QString& action)
else
{
qDebug() << "Invoking slot" << qPrintable(recvSlot->m_slot.data());
QGenericArgument arg0 = QGenericArgument();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
QMetaMethodArgument arg0;
#else
QGenericArgument arg0;
#endif

if (recvSlot->m_hasArguments)
arg0 = Q_ARG(const QString&, hostArguments);
Expand Down Expand Up @@ -186,14 +190,14 @@ void InputComponent::remapInput(const QString &source, const QString &keycode, I
m_autoRepeatActions.clear();

auto actions = m_mappings->mapToAction(source, keycode);
for (auto action : actions)
for (const auto& action : actions)
{
if (action.type() == QVariant::String)
if (action.typeId() == QMetaType::QString)
{
queuedActions.append(action.toString());
m_autoRepeatActions.append(action.toString());
}
else if (action.type() == QVariant::Map)
else if (action.typeId() == QMetaType::QVariantMap)
{
QVariantMap map = action.toMap();
if (map.contains("long"))
Expand All @@ -211,7 +215,7 @@ void InputComponent::remapInput(const QString &source, const QString &keycode, I
queuedActions.append(map.value("short").toString());
}
}
else if (action.type() == QVariant::List)
else if (action.typeId() == QMetaType::QStringList)
{
queuedActions.append(action.toStringList());
}
Expand Down
2 changes: 1 addition & 1 deletion src/input/InputLIRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void InputLIRC::read(int handle)

while ((input = socket->readLine()) != "")
{
QStringList cmdList = input.split(' ', QString::KeepEmptyParts);
QStringList cmdList = input.split(' ', Qt::KeepEmptyParts);
if (cmdList.size() == 4)
{
// grab the input data
Expand Down
2 changes: 1 addition & 1 deletion src/input/InputMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QMap>
#include <QObject>
#include <QFileSystemWatcher>
#include <QRegExp>
#include <QRegularExpression>
#include <QVariantMap>
#include <QMutex>
#include <utils/CachedRegexMatcher.h>
Expand Down
21 changes: 16 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#include <QFileInfo>
#include <QIcon>
#include <QtQml>
#include <QtWebEngine/qtwebengineglobal.h>
#include <Qt>
#include <QtWebEngineQuick>
#include <qtwebenginecoreglobal.h>
#include <QErrorMessage>
#include <QWebEngineScript>
#include <QCommandLineOption>
#include <QDebug>

#include "shared/Names.h"
#include "system/SystemComponent.h"
#include <QDebug>
#include "Paths.h"
#include "player/CodecsComponent.h"
#include "player/PlayerComponent.h"
Expand Down Expand Up @@ -76,7 +78,7 @@ void ShowLicenseInfo()
QFile licenses(":/misc/licenses.txt");
licenses.open(QIODevice::ReadOnly | QIODevice::Text);
QByteArray contents = licenses.readAll();
printf("%.*s\n", contents.size(), contents.data());
printf("%.*s\n", static_cast<int>(contents.size()), contents.data());
}

/////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -130,6 +132,8 @@ int main(int argc, char *argv[])

preinitQt();
detectOpenGLEarly();
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);

QStringList arguments;
for (int i = 0; i < argc; i++)
Expand Down Expand Up @@ -157,16 +161,23 @@ int main(int argc, char *argv[])

auto scale = parser.value("scale-factor");
if (scale.isEmpty() || scale == "auto")
{
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
}
else if (scale != "none")
{
qputenv("QT_SCALE_FACTOR", scale.toUtf8());
}

auto platform = parser.value("platform");
if (!(platform.isEmpty() || platform == "default"))
{
qputenv("QT_QPA_PLATFORM", platform.toUtf8());
}

QtWebEngineQuick::initialize();
QApplication app(newArgc, newArgv);
app.setApplicationName("Jellyfin Media Player");

Expand Down Expand Up @@ -211,7 +222,7 @@ int main(int argc, char *argv[])

SettingsComponent::Get().setCommandLineValues(parser.optionNames());

QtWebEngine::initialize();


// load QtWebChannel so that we can register our components with it.
QQmlApplicationEngine *engine = Globals::Engine();
Expand Down
2 changes: 1 addition & 1 deletion src/player/OpenGLDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static QString probeHwdecInterop()
auto mpv = mpv::qt::Handle::FromRawHandle(mpv_create());
if (!mpv)
return "";
mpv::qt::set_property(mpv, "hwdec-preload", "auto");
mpv::qt::set_property(mpv, "gpu-hwdec-interop", "auto");
// Actually creating a window is required. There is currently no way to keep
// this window hidden or invisible.
mpv::qt::set_property(mpv, "force-window", true);
Expand Down
Loading