Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package haruna for openSUSE:Factory checked in at 2022-10-08 01:24:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/haruna (Old) and /work/SRC/openSUSE:Factory/.haruna.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "haruna" Sat Oct 8 01:24:53 2022 rev:15 rq:1008650 version:0.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/haruna/haruna.changes 2022-08-25 15:09:06.121216102 +0200 +++ /work/SRC/openSUSE:Factory/.haruna.new.2275/haruna.changes 2022-10-08 01:24:56.718191164 +0200 @@ -1,0 +2,29 @@ +Fri Oct 7 05:07:46 UTC 2022 - Luigi Baldoni <[email protected]> + +- Update to version 0.9.2 + * actionsmodel: change text of togglePlaylistAction action to + just Playlist + * recentfilesmodel: use custom implementation instead of + KRecentFilesAction + * window: use Kirigami gridUnit for width and height + * mpv: move mpris connections to cpp + * Settings: improve right to left behaviour + * footer: fix play next/previous button icons in right to left + mode + * footer: fix seek bar and volume bar right to left behaviour + * playlistmodel: use a QUrl to determine the mimetype + * mpv: fix includes and call methods from MpvCore instead of + MpvItem + * Footer: improve font scaling + * SubtitlesFolders: fix model name + * settings: use qmlRegisterSingletonInstance instead of + qmlRegisterSingletonType + * Add a menu item in the Subtitles header button and menubar + to open a subtitle file + * CustomCommands: use `Kirigami.PlaceholderMessage` when there + are no commands + * Remove explicit use of ECM_KDE_MODULE_DIR, is part of + ECM_MODULE_PATH + * mpvitem: remove duplicated property + +------------------------------------------------------------------- Old: ---- haruna-v0.9.1.tar.gz New: ---- haruna-v0.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ haruna.spec ++++++ --- /var/tmp/diff_new_pack.zrWMON/_old 2022-10-08 01:24:57.850193760 +0200 +++ /var/tmp/diff_new_pack.zrWMON/_new 2022-10-08 01:24:57.850193760 +0200 @@ -17,7 +17,7 @@ Name: haruna -Version: 0.9.1 +Version: 0.9.2 Release: 0 Summary: Video player built with Qt/QML on top of libmpv License: CC-BY-4.0 AND GPL-3.0-or-later AND WTFPL @@ -45,6 +45,7 @@ BuildRequires: cmake(KF5Kirigami2) BuildRequires: cmake(KF5XmlGui) BuildRequires: cmake(Qt5Core) +BuildRequires: cmake(Qt5Qml) >= 5.14 BuildRequires: cmake(Qt5Quick) BuildRequires: cmake(Qt5QuickControls2) BuildRequires: cmake(Qt5X11Extras) ++++++ haruna-v0.9.1.tar.gz -> haruna-v0.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/CMakeLists.txt new/haruna-v0.9.2/CMakeLists.txt --- old/haruna-v0.9.1/CMakeLists.txt 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/CMakeLists.txt 2022-09-30 14:53:48.000000000 +0200 @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0048 NEW) -project(haruna VERSION 0.9.1 LANGUAGES CXX) +project(haruna VERSION 0.9.2 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) @@ -16,7 +16,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(ECM 5.66 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(KDEInstallDirs) include(ECMInstallIcons) @@ -36,9 +36,6 @@ find_package(Qt5Core) set_package_properties(Qt5Core PROPERTIES TYPE REQUIRED) -find_package(Qt5DBus) -set_package_properties(Qt5DBus PROPERTIES TYPE REQUIRED) - find_package(Qt5Gui) set_package_properties(Qt5Gui PROPERTIES TYPE REQUIRED) @@ -52,6 +49,9 @@ set_package_properties(Qt5QuickControls2 PROPERTIES TYPE REQUIRED) if (CMAKE_SYSTEM_NAME IN_LIST X11_PLATFORMS) + find_package(Qt5DBus) + set_package_properties(Qt5DBus PROPERTIES TYPE REQUIRED) + find_package(Qt5X11Extras) set_package_properties(Qt5X11Extras PROPERTIES TYPE REQUIRED) endif () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/data/org.kde.haruna.metainfo.xml new/haruna-v0.9.2/data/org.kde.haruna.metainfo.xml --- old/haruna-v0.9.1/data/org.kde.haruna.metainfo.xml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/data/org.kde.haruna.metainfo.xml 2022-09-30 14:53:48.000000000 +0200 @@ -279,6 +279,24 @@ </ul> </description> <releases> + <release version="0.9.2" date="2022-09-30"> + <description> + <p>Features:</p> + <ul> + <li>Added action to load a subtitle from a file dialog</li> + </ul> + <p>Bugfixes:</p> + <ul> + <li>Improved right to left layout</li> + <li>The window now scales when changing the system font size</li> + <li>Fixed a crash when changing the maximum recent files setting to 0</li> + <li>Fixed subtitles folders setting (these folders are used to search for subtitles)</li> + <li>Improved duration info font size scaling in footer, now its size should be closer to that of other components in the footer</li> + <li>Fixed an issue with determining mime types, which caused .ts video files to be treated as text files</li> + <li>Fixed not being able to click the add custom command button when there are no custom commands</li> + </ul> + </description> + </release> <release version="0.9.1" date="2022-08-24"> <description> <p>Bugfixes:</p> @@ -482,7 +500,7 @@ <caption xml:lang="fi">Harunan p????ikkuna</caption> <caption xml:lang="fr">Fen??tre principale de Haruna</caption> <caption xml:lang="hi">?????????????????? ??????????????? ???????????????</caption> - <caption xml:lang="id">Window utama Haruna</caption> + <caption xml:lang="id">Jendela utama Haruna</caption> <caption xml:lang="it">Finestra principale di Haruna</caption> <caption xml:lang="ko">Haruna ??? ???</caption> <caption xml:lang="nl">Hoofdvenster van Haruna</caption> @@ -508,7 +526,7 @@ <caption xml:lang="eu">Harunaren leiho nagusia, breeze iluna kolore-antolaera</caption> <caption xml:lang="fi">Harunan p????ikkuna tummalla Breeze-v??riteemalla</caption> <caption xml:lang="fr">Fen??tre principale de Haruna, th??me ????Breeze???? de couleur sombre</caption> - <caption xml:lang="id">Window utama Haruna, skema warna breeze gelap</caption> + <caption xml:lang="id">Jendela utama Haruna, skema warna breeze gelap</caption> <caption xml:lang="it">Finestra principale di Haruna, schema colori Brezza scura</caption> <caption xml:lang="ko">Haruna ??? ???, ????????? Breeze ??? ??????</caption> <caption xml:lang="nl">Hoofdvenster van Haruna, donker kleurenschema van breeze</caption> @@ -564,7 +582,7 @@ <caption xml:lang="fi">Harunan asetusikkuna</caption> <caption xml:lang="fr">Fen??tre de configuration de Haruna</caption> <caption xml:lang="hi">?????????????????? ????????????????????? ???????????????</caption> - <caption xml:lang="id">Window pengaturan Haruna</caption> + <caption xml:lang="id">Jendela pengaturan Haruna</caption> <caption xml:lang="it">Finestra delle impostazioni di Haruna</caption> <caption xml:lang="ko">Haruna ?????? ???</caption> <caption xml:lang="nl">Instellingenvenster van Haruna</caption> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/CMakeLists.txt new/haruna-v0.9.2/src/CMakeLists.txt --- old/haruna-v0.9.1/src/CMakeLists.txt 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/CMakeLists.txt 2022-09-30 14:53:48.000000000 +0200 @@ -4,8 +4,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -qt5_add_dbus_interface(haruna_screensaver_inhibit_SRCS ../org.freedesktop.ScreenSaver.xml screensaverdbusinterface) - # DATA_ICONS is defined in data/CMakeLists.txt ecm_add_app_icon(ICONS_SRCS ICONS ${DATA_ICONS}) @@ -16,7 +14,6 @@ application.h application.cpp framedecoder.h framedecoder.cpp global.h global.cpp - lockmanager.h lockmanager.cpp main.cpp models/actionsmodel.h models/actionsmodel.cpp models/customcommandsmodel.h models/customcommandsmodel.cpp @@ -24,8 +21,6 @@ models/subtitlesfoldersmodel.h models/subtitlesfoldersmodel.cpp models/tracksmodel.h models/tracksmodel.cpp models/playlistmodel.h models/playlistmodel.cpp - mpris2/mediaplayer2.h mpris2/mediaplayer2.cpp - mpris2/mediaplayer2player.h mpris2/mediaplayer2player.cpp mpv/mpvcore.h mpv/mpvcore.cpp mpv/mpvitem.h mpv/mpvitem.cpp mpv/mpvrenderer.h mpv/mpvrenderer.cpp @@ -35,10 +30,21 @@ worker.h worker.cpp qml.qrc ../help/help.qrc - ${haruna_screensaver_inhibit_SRCS} ${ICONS_SRCS} ) +if (CMAKE_SYSTEM_NAME IN_LIST X11_PLATFORMS) + qt5_add_dbus_interface(haruna_screensaver_inhibit_SRCS ../org.freedesktop.ScreenSaver.xml screensaverdbusinterface) + target_sources(haruna + PRIVATE + lockmanager.h lockmanager.cpp + mpris2/mediaplayer2.h mpris2/mediaplayer2.cpp + mpris2/mediaplayer2player.h mpris2/mediaplayer2player.cpp + ${haruna_screensaver_inhibit_SRCS} + ) + target_include_directories(haruna PRIVATE mpris2) +endif() + kconfig_add_kcfg_files(haruna GENERATE_MOC settings/audiosettings.kcfgc) kconfig_add_kcfg_files(haruna GENERATE_MOC settings/generalsettings.kcfgc) kconfig_add_kcfg_files(haruna GENERATE_MOC settings/mousesettings.kcfgc) @@ -47,13 +53,12 @@ kconfig_add_kcfg_files(haruna GENERATE_MOC settings/subtitlessettings.kcfgc) kconfig_add_kcfg_files(haruna GENERATE_MOC settings/videosettings.kcfgc) -target_include_directories(haruna PRIVATE models mpris2 mpv ${FFMPEG_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) +target_include_directories(haruna PRIVATE models mpv ${FFMPEG_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) target_compile_definitions(haruna PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(haruna PRIVATE Qt5::Core - Qt5::DBus Qt5::Gui Qt5::Qml Qt5::Quick @@ -82,6 +87,9 @@ ) if (CMAKE_SYSTEM_NAME IN_LIST X11_PLATFORMS) - target_link_libraries(haruna PRIVATE Qt5::X11Extras) + target_link_libraries(haruna PRIVATE + Qt5::DBus + Qt5::X11Extras + ) endif () install(TARGETS haruna DESTINATION ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/application.cpp new/haruna-v0.9.2/src/application.cpp --- old/haruna-v0.9.1/src/application.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/application.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -11,9 +11,6 @@ #include "generalsettings.h" #include "global.h" #include "haruna-version.h" -#include "lockmanager.h" -#include "mediaplayer2.h" -#include "mediaplayer2player.h" #include "mousesettings.h" #include "mpvitem.h" #include "playbacksettings.h" @@ -32,7 +29,6 @@ #include <QCoreApplication> #include <QDesktopServices> #include <QDir> -#include <QDBusConnection> #include <QFileInfo> #include <QFontDatabase> #include <QGuiApplication> @@ -98,14 +94,6 @@ QObject::connect(appEventFilter, &ApplicationEventFilter::applicationMouseLeave, this, &Application::qmlApplicationMouseLeave); - // register mpris dbus service - QString mspris2Name(QStringLiteral("org.mpris.MediaPlayer2.haruna")); - QDBusConnection::sessionBus().registerService(mspris2Name); - QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), - this, QDBusConnection::ExportAdaptors); - // org.mpris.MediaPlayer2 mpris2 interface - new MediaPlayer2(this); - if (GeneralSettings::guiStyle() != QStringLiteral("System")) { QApplication::setStyle(GeneralSettings::guiStyle()); } @@ -207,34 +195,18 @@ void Application::setupQmlSettingsTypes() { - auto audioProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return AudioSettings::self(); }; - qmlRegisterSingletonType<AudioSettings>("org.kde.haruna", 1, 0, "AudioSettings", audioProvider); - - auto generalProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return GeneralSettings::self(); }; - qmlRegisterSingletonType<GeneralSettings>("org.kde.haruna", 1, 0, "GeneralSettings", generalProvider); - - auto mouseProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return MouseSettings::self(); }; - qmlRegisterSingletonType<MouseSettings>("org.kde.haruna", 1, 0, "MouseSettings", mouseProvider); - - auto playbackProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return PlaybackSettings::self(); }; - qmlRegisterSingletonType<PlaybackSettings>("org.kde.haruna", 1, 0, "PlaybackSettings", playbackProvider); - - auto playlistProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return PlaylistSettings::self(); }; - qmlRegisterSingletonType<PlaylistSettings>("org.kde.haruna", 1, 0, "PlaylistSettings", playlistProvider); - - auto subtitlesProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return SubtitlesSettings::self(); }; - qmlRegisterSingletonType<SubtitlesSettings>("org.kde.haruna", 1, 0, "SubtitlesSettings", subtitlesProvider); - - auto videoProvider = [](QQmlEngine *, QJSEngine *) -> QObject * { return VideoSettings::self(); }; - qmlRegisterSingletonType<VideoSettings>("org.kde.haruna", 1, 0, "VideoSettings", videoProvider); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "AudioSettings", AudioSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "GeneralSettings", GeneralSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "MouseSettings", MouseSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "PlaybackSettings", PlaybackSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "PlaylistSettings", PlaylistSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "SubtitlesSettings", SubtitlesSettings::self()); + qmlRegisterSingletonInstance("org.kde.haruna", 1, 0, "VideoSettings", VideoSettings::self()); } void Application::setupQmlContextProperties() { - std::unique_ptr<LockManager> lockManager = std::make_unique<LockManager>(); - m_engine->rootContext()->setContextProperty("lockManager", lockManager.release()); m_engine->rootContext()->setContextProperty("app", this); - m_engine->rootContext()->setContextProperty("mediaPlayer2Player", new MediaPlayer2Player(this)); m_engine->rootContext()->setContextProperty("appActions", new QQmlPropertyMap); m_engine->rootContext()->setContextObject(new KLocalizedContext(this)); m_engine->rootContext()->setContextProperty("harunaAboutData", @@ -370,16 +342,10 @@ return content; } -QString Application::mimeType(const QString &file) +QString Application::mimeType(const QUrl &url) { - QMimeDatabase db; - QMimeType mimeType; - if(KFileItem(file).isSlow()) { - mimeType = db.mimeTypeForFile(file, QMimeDatabase::MatchExtension); - } else { - mimeType = db.mimeTypeForFile(file); - } - return mimeType.name(); + KFileItem fileItem(url, KFileItem::NormalMimeTypeDetermination); + return fileItem.mimetype(); } QStringList Application::availableGuiStyles() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/application.h new/haruna-v0.9.2/src/application.h --- old/haruna-v0.9.1/src/application.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/application.h 2022-09-30 14:53:48.000000000 +0200 @@ -73,7 +73,7 @@ Q_INVOKABLE static QString youtubeDlExecutable(); Q_INVOKABLE static bool isYoutubePlaylist(const QString &path); Q_INVOKABLE static QString formatTime(const double time); - Q_INVOKABLE static QString mimeType(const QString &file); + Q_INVOKABLE static QString mimeType(const QUrl &url); signals: void qmlApplicationMouseLeave(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/models/actionsmodel.cpp new/haruna-v0.9.2/src/models/actionsmodel.cpp --- old/haruna-v0.9.1/src/models/actionsmodel.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/models/actionsmodel.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -106,6 +106,13 @@ action.shortcut = getShortcut(action.name, action.defaultShortcut); m_actions << action; + action.name = QStringLiteral("openSubtitlesFileAction"); + action.text = i18n("Add external subtitle???"); + action.iconName = QStringLiteral("add-subtitle"); + action.defaultShortcut = Qt::ALT + Qt::Key_S; + action.shortcut = getShortcut(action.name, action.defaultShortcut); + m_actions << action; + action.name = QStringLiteral("openUrlAction"); action.text = i18n("Open Url"); action.iconName = QStringLiteral("internet-services"); @@ -352,7 +359,7 @@ m_actions << action; action.name = QStringLiteral("togglePlaylistAction"); - action.text = i18n("Toggle Playlist"); + action.text = i18n("Playlist"); action.iconName = QStringLiteral("view-media-playlist"); action.defaultShortcut = Qt::Key_P; action.shortcut = getShortcut(action.name, action.defaultShortcut); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/models/actionsmodel.h new/haruna-v0.9.2/src/models/actionsmodel.h --- old/haruna-v0.9.1/src/models/actionsmodel.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/models/actionsmodel.h 2022-09-30 14:53:48.000000000 +0200 @@ -86,6 +86,7 @@ void muteAction(); void openContextMenuAction(); void openFileAction(); + void openSubtitlesFileAction(); void openUrlAction(); void playbackSpeedIncreaseAction(); void playbackSpeedDecreaseAction(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/models/playlistmodel.cpp new/haruna-v0.9.2/src/models/playlistmodel.cpp --- old/haruna-v0.9.1/src/models/playlistmodel.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/models/playlistmodel.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -84,36 +84,37 @@ void PlayListModel::getVideos(QString path) { clear(); - path = QUrl(path).toLocalFile().isEmpty() ? path : QUrl(path).toLocalFile(); - QFileInfo pathInfo(path); - QStringList videoFiles; - if (pathInfo.exists() && pathInfo.isFile()) { - QDirIterator it(pathInfo.absolutePath(), QDir::Files, QDirIterator::NoIteratorFlags); + QUrl openedUrl(path); + QFileInfo openedFileInfo(openedUrl.toLocalFile()); + QStringList siblingFiles; + if (openedFileInfo.exists() && openedFileInfo.isFile()) { + QDirIterator it(openedFileInfo.absolutePath(), QDir::Files, QDirIterator::NoIteratorFlags); while (it.hasNext()) { - QString file = it.next(); - QFileInfo fileInfo(file); - QString mimeType = Application::mimeType(file); - if (fileInfo.exists() && (mimeType.startsWith("video/") || mimeType.startsWith("audio/"))) { - videoFiles.append(fileInfo.absoluteFilePath()); + QString siblingFile = it.next(); + QFileInfo siblingFileInfo(siblingFile); + QUrl siblingUrl(siblingFile); + siblingUrl.setScheme(openedUrl.scheme()); + QString mimeType = Application::mimeType(siblingUrl); + if (siblingFileInfo.exists() && (mimeType.startsWith("video/") || mimeType.startsWith("audio/"))) { + siblingFiles.append(siblingFileInfo.absoluteFilePath()); } } - } - QCollator collator; - collator.setNumericMode(true); - std::sort(videoFiles.begin(), videoFiles.end(), collator); - beginInsertRows(QModelIndex(), 0, videoFiles.count() - 1); + QCollator collator; + collator.setNumericMode(true); + std::sort(siblingFiles.begin(), siblingFiles.end(), collator); - for (int i = 0; i < videoFiles.count(); ++i) { - auto video = new PlayListItem(videoFiles.at(i), i, this); - m_playList.append(video); - if (path == videoFiles.at(i)) { - setPlayingVideo(i); + beginInsertRows(QModelIndex(), 0, siblingFiles.count() - 1); + for (int i = 0; i < siblingFiles.count(); ++i) { + auto video = new PlayListItem(siblingFiles.at(i), i, this); + m_playList.append(video); + if (path == siblingFiles.at(i)) { + setPlayingVideo(i); + } + Q_EMIT videoAdded(i, video->filePath()); } - Q_EMIT videoAdded(i, video->filePath()); + endInsertRows(); } - - endInsertRows(); } void PlayListModel::appendVideo(QString videoPath) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/models/recentfilesmodel.cpp new/haruna-v0.9.2/src/models/recentfilesmodel.cpp --- old/haruna-v0.9.1/src/models/recentfilesmodel.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/models/recentfilesmodel.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -12,7 +12,6 @@ #include <QDebug> #include <QMenu> -#include <KRecentFilesAction> #include <KSharedConfig> RecentFilesModel::RecentFilesModel(QObject *parent) @@ -20,10 +19,7 @@ { auto config = KSharedConfig::openConfig(Global::instance()->appConfigFilePath()); m_recentFilesConfigGroup = config->group(QStringLiteral("RecentFiles")); - m_recentFilesAction = new KRecentFilesAction(this); - m_recentFilesAction->setMaxItems(GeneralSettings::maxRecentFiles()); - m_recentFilesAction->loadEntries(m_recentFilesConfigGroup); - + setMaxRecentFiles(GeneralSettings::maxRecentFiles()); populate(); } @@ -63,21 +59,19 @@ void RecentFilesModel::populate() { - beginResetModel(); - m_urls.clear(); - endResetModel(); + clear(); + setMaxRecentFiles(GeneralSettings::maxRecentFiles()); - m_recentFilesAction->setMaxItems(GeneralSettings::maxRecentFiles()); - for (int i = 0; i < m_recentFilesAction->maxItems(); i++) { + for (int i = 0; i < maxRecentFiles(); i++) { auto file = m_recentFilesConfigGroup.readPathEntry(QStringLiteral("File%1").arg(i + 1), QString()); auto name = m_recentFilesConfigGroup.readPathEntry(QStringLiteral("Name%1").arg(i + 1), QString()); if (file.isEmpty()) { break; } - beginInsertRows(QModelIndex(), 0, 0); RecentFile recentFile; recentFile.url = QUrl(file); recentFile.name = name; + beginInsertRows(QModelIndex(), 0, 0); m_urls.prepend(recentFile); endInsertRows(); } @@ -92,21 +86,32 @@ } auto _name = name == QString() ? url.fileName() : name; - m_recentFilesAction->addUrl(url, _name); - m_recentFilesAction->saveEntries(m_recentFilesConfigGroup); + RecentFile recentFile; + recentFile.url = url; + recentFile.name = _name; + beginInsertRows(QModelIndex(), 0, 0); + m_urls.prepend(recentFile); + endInsertRows(); + + m_recentFilesConfigGroup.writePathEntry(QStringLiteral("File%1").arg(m_urls.count()), + url.toDisplayString(QUrl::PreferLocalFile)); + m_recentFilesConfigGroup.writePathEntry(QStringLiteral("Name%1").arg(m_urls.count()), _name); m_recentFilesConfigGroup.sync(); - - populate(); } void RecentFilesModel::clear() { beginResetModel(); - for (const auto &url : m_recentFilesAction->urls()) { - m_recentFilesAction->removeUrl(url); - } - m_recentFilesAction->saveEntries(m_recentFilesConfigGroup); - m_recentFilesConfigGroup.sync(); m_urls.clear(); endResetModel(); } + +int RecentFilesModel::maxRecentFiles() const +{ + return m_maxRecentFiles; +} + +void RecentFilesModel::setMaxRecentFiles(int _maxRecentFiles) +{ + m_maxRecentFiles = _maxRecentFiles; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/models/recentfilesmodel.h new/haruna-v0.9.2/src/models/recentfilesmodel.h --- old/haruna-v0.9.1/src/models/recentfilesmodel.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/models/recentfilesmodel.h 2022-09-30 14:53:48.000000000 +0200 @@ -36,10 +36,13 @@ Q_INVOKABLE void clear(); Q_INVOKABLE void populate(); + int maxRecentFiles() const; + void setMaxRecentFiles(int _maxRecentFiles); + private: - KRecentFilesAction *m_recentFilesAction; QList<RecentFile> m_urls; KConfigGroup m_recentFilesConfigGroup; + int m_maxRecentFiles {10}; }; #endif // RECENTFILESMODEL_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpris2/mediaplayer2player.h new/haruna-v0.9.2/src/mpris2/mediaplayer2player.h --- old/haruna-v0.9.1/src/mpris2/mediaplayer2player.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpris2/mediaplayer2player.h 2022-09-30 14:53:48.000000000 +0200 @@ -58,6 +58,8 @@ bool CanControl(); void setPosition(int pos); void setVolume(double vol); + MpvItem *mpv() const; + void setMpv(MpvItem *mpv); Q_SIGNALS: void next(); @@ -74,9 +76,6 @@ void mpvChanged(); private: - MpvItem *mpv() const; - void setMpv(MpvItem *mpv); - MpvItem *m_mpv; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpv/mpvcore.cpp new/haruna-v0.9.2/src/mpv/mpvcore.cpp --- old/haruna-v0.9.1/src/mpv/mpvcore.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpv/mpvcore.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -23,7 +23,7 @@ if (mpv_initialize(m_mpv) < 0) { qFatal("could not initialize mpv context"); } - mpv_set_wakeup_callback(m_mpv, MpvItem::mpvEvents, this); + mpv_set_wakeup_callback(m_mpv, MpvCore::mpvEvents, this); } MpvCore::~MpvCore() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpv/mpvitem.cpp new/haruna-v0.9.2/src/mpv/mpvitem.cpp --- old/haruna-v0.9.1/src/mpv/mpvitem.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpv/mpvitem.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -30,6 +30,13 @@ #include <KLocalizedString> #include <KShell> +#if defined(Q_OS_UNIX) +#include <QDBusConnection> +#include "lockmanager.h" +#include "mediaplayer2.h" +#include "mediaplayer2player.h" +#endif + MpvItem::MpvItem(QQuickItem * parent) : MpvCore(parent) , m_audioTracksModel(new TracksModel) @@ -78,6 +85,54 @@ } }); +#if defined(Q_OS_UNIX) + // register mpris dbus service + QString mspris2Name(QStringLiteral("org.mpris.MediaPlayer2.haruna")); + QDBusConnection::sessionBus().registerService(mspris2Name); + QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), + this, QDBusConnection::ExportAdaptors); + // org.mpris.MediaPlayer2 mpris2 interface + new MediaPlayer2(this); + auto mp2Player = new MediaPlayer2Player(this); + mp2Player->setMpv(this); + connect(mp2Player, &MediaPlayer2Player::playpause, this, [=]() { + setPause(!pause()); + }); + connect(mp2Player, &MediaPlayer2Player::play, this, [=]() { + setPause(false); + }); + connect(mp2Player, &MediaPlayer2Player::pause, this, [=]() { + setPause(true); + }); + connect(mp2Player, &MediaPlayer2Player::stop, this, [=]() { + setPosition(0); + setPause(true); + }); + connect(mp2Player, &MediaPlayer2Player::next, this, [=]() { + Q_EMIT playNext(); + }); + connect(mp2Player, &MediaPlayer2Player::previous, this, [=]() { + Q_EMIT playPrevious(); + }); + connect(mp2Player, &MediaPlayer2Player::seek, this, [=](int offset) { + command(QStringList() << "add" << "time-pos" << QString::number(offset)); + }); + connect(mp2Player, &MediaPlayer2Player::openUri, this, [=](const QString &uri) { + Q_EMIT openUri(uri); + }); +#endif + +#if defined(Q_OS_UNIX) + auto lockManager = new LockManager(this); + connect(this, &MpvItem::pauseChanged, this, [=]() { + if (pause()) { + lockManager->setInhibitionOff(); + } else { + lockManager->setInhibitionOn(); + } + }); +#endif + connect(this, &MpvItem::syncConfigValue, Worker::instance(), &Worker::syncConfigValue); } @@ -88,7 +143,6 @@ QString hwdec = PlaybackSettings::useHWDecoding() ? PlaybackSettings::hWDecoding() : "no"; setProperty("hwdec", hwdec); - setProperty("screenshot-template", VideoSettings::screenshotTemplate()); setProperty("sub-auto", "exact"); setProperty("volume-max", "100"); // set ytdl_path to yt-dlp or fallback to youtube-dl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpv/mpvitem.h new/haruna-v0.9.2/src/mpv/mpvitem.h --- old/haruna-v0.9.1/src/mpv/mpvitem.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpv/mpvitem.h 2022-09-30 14:53:48.000000000 +0200 @@ -7,8 +7,6 @@ #ifndef MPVOBJECT_H #define MPVOBJECT_H -#include <QtQuick/QQuickFramebufferObject> - #include "mpvcore.h" #include "playlistmodel.h" #include "tracksmodel.h" @@ -141,6 +139,11 @@ void youtubePlaylistLoaded(); void syncConfigValue(QString path, QString group, QString key, QVariant value); + // signals used for mpris + void playNext(); + void playPrevious(); + void openUri(const QString &uri); + private: TracksModel *audioTracksModel() const; TracksModel *subtitleTracksModel() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpv/mpvrenderer.cpp new/haruna-v0.9.2/src/mpv/mpvrenderer.cpp --- old/haruna-v0.9.1/src/mpv/mpvrenderer.cpp 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpv/mpvrenderer.cpp 2022-09-30 14:53:48.000000000 +0200 @@ -28,7 +28,7 @@ void on_mpv_redraw(void *ctx) { - QMetaObject::invokeMethod(static_cast<MpvItem*>(ctx), &MpvItem::update, Qt::QueuedConnection); + QMetaObject::invokeMethod(static_cast<MpvCore*>(ctx), &MpvCore::update, Qt::QueuedConnection); } MpvRenderer::MpvRenderer(MpvCore *new_obj) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/mpv/mpvrenderer.h new/haruna-v0.9.2/src/mpv/mpvrenderer.h --- old/haruna-v0.9.1/src/mpv/mpvrenderer.h 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/mpv/mpvrenderer.h 2022-09-30 14:53:48.000000000 +0200 @@ -7,7 +7,9 @@ #ifndef MPVRENDERER_H #define MPVRENDERER_H -#include "mpvitem.h" +#include <QtQuick/QQuickFramebufferObject> + +#include "mpvcore.h" class MpvRenderer : public QQuickFramebufferObject::Renderer { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Actions.qml new/haruna-v0.9.2/src/qml/Actions.qml --- old/haruna-v0.9.1/src/qml/Actions.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Actions.qml 2022-09-30 14:53:48.000000000 +0200 @@ -116,6 +116,8 @@ onOpenFileAction: fileDialog.open() + onOpenSubtitlesFileAction: subtitlesFileDialog.open() + onOpenUrlAction: { if (openUrlPopup.visible) { openUrlPopup.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Footer.qml new/haruna-v0.9.2/src/qml/Footer.qml --- old/haruna-v0.9.1/src/qml/Footer.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Footer.qml 2022-09-30 14:53:48.000000000 +0200 @@ -71,6 +71,7 @@ ToolButton { id: playPreviousFile action: appActions.playPreviousAction + icon.name: root.LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward" text: "" focusPolicy: Qt.NoFocus enabled: playList.playlistView.count > 1 @@ -83,6 +84,7 @@ ToolButton { id: playNextFile action: appActions.playNextAction + icon.name: root.LayoutMirroring.enabled ? "media-skip-backward" : "media-skip-forward" text: "" focusPolicy: Qt.NoFocus enabled: playList.playlistView.count > 1 @@ -101,7 +103,7 @@ id: timeInfo text: app.formatTime(mpv.position) + " / " + app.formatTime(mpv.duration) - font.pointSize: Kirigami.Units.gridUnit - 4 + font.pointSize: Math.round(Kirigami.Units.gridUnit * 0.7) toolTipText: i18n("Remaining: %1", app.formatTime(mpv.remaining)) alwaysShowToolTip: true horizontalAlignment: Qt.AlignHCenter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/HProgressBar.qml new/haruna-v0.9.2/src/qml/HProgressBar.qml --- old/haruna-v0.9.1/src/qml/HProgressBar.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/HProgressBar.qml 2022-09-30 14:53:48.000000000 +0200 @@ -30,23 +30,24 @@ handle: Item { visible: false } background: Rectangle { - id: progressBarBackground + id: progressBarBG color: Kirigami.Theme.alternateBackgroundColor + scale: root.mirrored ? -1 : 1 Rectangle { id: loopIndicator property double startPosition: -1 property double endPosition: -1 - width: endPosition === -1 ? 1 : (endPosition / mpv.duration * progressBarBackground.width) - x + width: endPosition === -1 ? 1 : (endPosition / mpv.duration * progressBarBG.width) - x height: parent.height color: Qt.hsla(0, 0, 0, 0.4) visible: startPosition !== -1 - x: startPosition / mpv.duration * progressBarBackground.width + x: startPosition / mpv.duration * progressBarBG.width z: 110 } Rectangle { - width: visualPosition * parent.width + width: root.position * parent.width height: parent.height color: Kirigami.Theme.highlightColor } @@ -72,7 +73,7 @@ return } - const time = mouseX * 100 / progressBarBackground.width * root.to / 100 + const time = mouseX * 100 / progressBarBG.width * root.to / 100 const chapters = mpv.getProperty("chapter-list") const nextChapter = chapters.findIndex(chapter => chapter.time > time) mpv.chapter = nextChapter @@ -87,7 +88,7 @@ onMouseXChanged: { progressBarToolTip.x = mouseX - (progressBarToolTip.width * 0.5) - const time = mouseX * 100 / progressBarBackground.width * root.to / 100 + const time = mouseX * 100 / progressBarBG.width * root.to / 100 progressBarToolTip.text = app.formatTime(time) } @@ -114,7 +115,9 @@ id: chapterMarkerShape // where the chapter marker shoud be positioned on the progress bar - property int position: modelData.time / mpv.duration * progressBarBackground.width + property int position: root.mirrored + ? progressBarBG.width - (modelData.time / mpv.duration * progressBarBG.width) + : modelData.time / mpv.duration * progressBarBG.width antialiasing: true ShapePath { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Haruna/Components/SubtitlesFolders.qml new/haruna-v0.9.2/src/qml/Haruna/Components/SubtitlesFolders.qml --- old/haruna-v0.9.1/src/qml/Haruna/Components/SubtitlesFolders.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Haruna/Components/SubtitlesFolders.qml 2022-09-30 14:53:48.000000000 +0200 @@ -40,7 +40,7 @@ : count * sfListView.sfDelegateHeight + (sfListView.spacing * (count - 1)) spacing: 5 clip: true - model: subsFoldersModel + model: subtitlesFoldersModel Layout.fillWidth: true ScrollBar.vertical: ScrollBar { id: scrollBar } delegate: Rectangle { @@ -107,7 +107,7 @@ if (model.row === sfListView.count - 1) { root.canAddFolder = true } - subsFoldersModel.deleteFolder(model.row) + subtitlesFoldersModel.deleteFolder(model.row) const rows = sfListView.count sfListView.implicitHeight = rows > 5 ? 5 * sfListView.sfDelegateHeight + (sfListView.spacing * 4) @@ -124,7 +124,7 @@ flat: true enabled: editField.text !== "" ? true : false onClicked: { - subsFoldersModel.updateFolder(editField.text, model.row) + subtitlesFoldersModel.updateFolder(editField.text, model.row) sfLoader.sourceComponent = sfDisplayComponent if (model.row === sfListView.count - 1) { root.canAddFolder = true @@ -149,12 +149,14 @@ Button { id: sfAddFolder + + anchors.left: parent.left anchors.top: spacer.bottom icon.name: "list-add" text: i18n("Add new folder") enabled: root.canAddFolder onClicked: { - subsFoldersModel.addFolder() + subtitlesFoldersModel.addFolder() const rows = sfListView.count sfListView.implicitHeight = rows > 5 ? 5 * sfListView.sfDelegateHeight + (sfListView.spacing * 4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Header.qml new/haruna-v0.9.2/src/qml/Header.qml --- old/haruna-v0.9.1/src/qml/Header.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Header.qml 2022-09-30 14:53:48.000000000 +0200 @@ -84,6 +84,8 @@ y: parent.height closePolicy: Popup.CloseOnReleaseOutsideParent + MenuItem { action: appActions.openSubtitlesFileAction } + Instantiator { id: primarySubtitleMenuInstantiator model: mpv.subtitleTracksModel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Menus/Global/GlobalSubtitlesMenu.qml new/haruna-v0.9.2/src/qml/Menus/Global/GlobalSubtitlesMenu.qml --- old/haruna-v0.9.1/src/qml/Menus/Global/GlobalSubtitlesMenu.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Menus/Global/GlobalSubtitlesMenu.qml 2022-09-30 14:53:48.000000000 +0200 @@ -59,6 +59,12 @@ Labs.MenuSeparator {} Labs.MenuItem { + icon.name: appActions.openSubtitlesFileAction.icon.name + text: appActions.openSubtitlesFileAction.text + onTriggered: appActions.openSubtitlesFileAction.trigger() + } + + Labs.MenuItem { icon.name: appActions.subtitleIncreaseFontSizeAction.icon.name text: appActions.subtitleIncreaseFontSizeAction.text onTriggered: appActions.subtitleIncreaseFontSizeAction.trigger() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Menus/SubtitlesMenu.qml new/haruna-v0.9.2/src/qml/Menus/SubtitlesMenu.qml --- old/haruna-v0.9.1/src/qml/Menus/SubtitlesMenu.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Menus/SubtitlesMenu.qml 2022-09-30 14:53:48.000000000 +0200 @@ -55,6 +55,7 @@ MenuSeparator {} + MenuItem { action: appActions.openSubtitlesFileAction } MenuItem { action: appActions.subtitleIncreaseFontSizeAction } MenuItem { action: appActions.subtitleDecreaseFontSizeAction } MenuItem { action: appActions.subtitleMoveUpAction } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/MpvVideo.qml new/haruna-v0.9.2/src/qml/MpvVideo.qml --- old/haruna-v0.9.1/src/qml/MpvVideo.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/MpvVideo.qml 2022-09-30 14:53:48.000000000 +0200 @@ -170,13 +170,9 @@ } } - onPauseChanged: { - if (pause) { - lockManager.setInhibitionOff() - } else { - lockManager.setInhibitionOn() - } - } + onPlayNext: { appActions.playNextAction.trigger() } + onPlayPrevious: { appActions.playPreviousAction.trigger() } + onOpenUri: { window.openFile(uri) } Timer { id: saveWatchLaterFileTimer @@ -278,8 +274,6 @@ DropArea { id: dropArea - property var acceptedSubtitleTypes: ["application/x-subrip", "text/x-ssa"] - anchors.fill: parent keys: ["text/uri-list"] @@ -295,22 +289,6 @@ } } - Connections { - target: mediaPlayer2Player - - onPlaypause: appActions.playPauseAction.trigger() - onPlay: root.pause = false - onPause: root.pause = true - onStop: { - root.position = 0 - root.pause = true - } - onNext: appActions.playNextAction.trigger() - onPrevious: appActions.playPreviousAction.trigger() - onSeek: root.command(["add", "time-pos", offset]) - onOpenUri: openFile(uri, false, false) - } - Rectangle { id: loadingIndicatorParent @@ -345,10 +323,6 @@ } } - Component.onCompleted: { - mediaPlayer2Player.mpv = root - } - function handleTimePosition() { // need to check duration > 0 for youtube videos if (mpv.duration > 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Settings/AudioSettings.qml new/haruna-v0.9.2/src/qml/Settings/AudioSettings.qml --- old/haruna-v0.9.1/src/qml/Settings/AudioSettings.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Settings/AudioSettings.qml 2022-09-30 14:53:48.000000000 +0200 @@ -70,22 +70,18 @@ Layout.alignment: Qt.AlignRight } - Item { - height: volumeStep.height - SpinBox { - id: volumeStep - editable: true - from: 0 - to: 100 - value: GeneralSettings.volumeStep - onValueChanged: { - if (root.visible) { - GeneralSettings.volumeStep = volumeStep.value - GeneralSettings.save() - } + SpinBox { + id: volumeStep + editable: true + from: 0 + to: 100 + value: GeneralSettings.volumeStep + onValueChanged: { + if (root.visible) { + GeneralSettings.volumeStep = volumeStep.value + GeneralSettings.save() } } - Layout.fillWidth: true } Item { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Settings/CustomCommandsSettings.qml new/haruna-v0.9.2/src/qml/Settings/CustomCommandsSettings.qml --- old/haruna-v0.9.1/src/qml/Settings/CustomCommandsSettings.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Settings/CustomCommandsSettings.qml 2022-09-30 14:53:48.000000000 +0200 @@ -8,7 +8,7 @@ import QtQuick.Layouts 1.12 import QtQuick.Controls 2.12 -import org.kde.kirigami 2.11 as Kirigami +import org.kde.kirigami 2.12 as Kirigami import org.kde.kquickcontrols 2.0 import org.kde.haruna 1.0 import Haruna.Components 1.0 @@ -20,21 +20,22 @@ helpFile: ":/CustomCommandsSettings.html" docPage: "help:/haruna/CustomCommandsSettings.html" - ColumnLayout { - id: centerLayout - - visible: customCommandsView.count === 0 - anchors.centerIn: parent + ListView { + id: customCommandsView - Label { - text: i18n("No custom commands yet") - Layout.alignment: Qt.AlignCenter + model: customCommandsModel + delegate: Kirigami.DelegateRecycler { + width: customCommandsView.width + sourceComponent: customCommandDelegate } - - Button { - text: i18n("&Add command") - onClicked: applicationWindow().pageStack.replace("qrc:/EditCustomCommand.qml") - Layout.alignment: Qt.AlignCenter + Kirigami.PlaceholderMessage { + anchors.centerIn: parent + visible: customCommandsView.count === 0 + text: i18n("No custom commands yet") + helpfulAction: Action { + text: i18n("&Add command") + onTriggered: applicationWindow().pageStack.replace("qrc:/EditCustomCommand.qml") + } } } @@ -142,16 +143,6 @@ } } - ListView { - id: customCommandsView - - model: customCommandsModel - delegate: Kirigami.DelegateRecycler { - width: customCommandsView.width - sourceComponent: customCommandDelegate - } - } - footer: ToolBar { visible: customCommandsView.count > 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Settings/GeneralSettings.qml new/haruna-v0.9.2/src/qml/Settings/GeneralSettings.qml --- old/haruna-v0.9.1/src/qml/Settings/GeneralSettings.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Settings/GeneralSettings.qml 2022-09-30 14:53:48.000000000 +0200 @@ -31,29 +31,25 @@ Layout.alignment: Qt.AlignRight } - Item { - height: osdFontSize.height - SpinBox { - id: osdFontSize - - // used to prevent osd showing when opening the page - property bool completed: false - - editable: true - from: 0 - to: 100 - value: GeneralSettings.osdFontSize - onValueChanged: { - if (completed) { - osd.label.font.pointSize = osdFontSize.value - osd.message("Test osd font size") - GeneralSettings.osdFontSize = osdFontSize.value - GeneralSettings.save() - } + SpinBox { + id: osdFontSize + + // used to prevent osd showing when opening the page + property bool completed: false + + editable: true + from: 0 + to: 100 + value: GeneralSettings.osdFontSize + onValueChanged: { + if (completed) { + osd.label.font.pointSize = osdFontSize.value + osd.message("Test osd font size") + GeneralSettings.osdFontSize = osdFontSize.value + GeneralSettings.save() } - Component.onCompleted: completed = true } - Layout.fillWidth: true + Component.onCompleted: completed = true } Label { @@ -61,22 +57,18 @@ Layout.alignment: Qt.AlignRight } - Item { - height: fileDialogLocation.height - Layout.fillWidth: true + TextField { + id: fileDialogLocation - TextField { - id: fileDialogLocation - - text: GeneralSettings.fileDialogLocation - onEditingFinished: { - GeneralSettings.fileDialogLocation = fileDialogLocation.text - GeneralSettings.save() - } + text: GeneralSettings.fileDialogLocation + Layout.fillWidth: true + onEditingFinished: { + GeneralSettings.fileDialogLocation = fileDialogLocation.text + GeneralSettings.save() + } - ToolTip { - text: i18n("If empty the file dialog will remember the last opened location.") - } + ToolTip { + text: i18n("If empty the file dialog will remember the last opened location.") } } @@ -85,25 +77,20 @@ Layout.alignment: Qt.AlignRight } - Item { - height: maxRecentFiles.height - Layout.fillWidth: true - - SpinBox { - id: maxRecentFiles + SpinBox { + id: maxRecentFiles - from: 0 - to: 100 - value: GeneralSettings.maxRecentFiles - onValueChanged: { - GeneralSettings.maxRecentFiles = maxRecentFiles.value - GeneralSettings.save() - recentFilesModel.populate() - } + from: 0 + to: 100 + value: GeneralSettings.maxRecentFiles + onValueChanged: { + GeneralSettings.maxRecentFiles = maxRecentFiles.value + GeneralSettings.save() + recentFilesModel.populate() + } - ToolTip { - text: i18n("How many recent files to store. Enter 0 (zero) to disable.") - } + ToolTip { + text: i18n("How many recent files to store. Enter 0 (zero) to disable.") } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Settings/PlaybackSettings.qml new/haruna-v0.9.2/src/qml/Settings/PlaybackSettings.qml --- old/haruna-v0.9.1/src/qml/Settings/PlaybackSettings.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Settings/PlaybackSettings.qml 2022-09-30 14:53:48.000000000 +0200 @@ -30,20 +30,16 @@ Layout.alignment: Qt.AlignRight } - Item { - height: seekSmallStep.height - SpinBox { - id: seekSmallStep - editable: true - from: 0 - to: 100 - value: GeneralSettings.seekSmallStep - onValueChanged: { - GeneralSettings.seekSmallStep = seekSmallStep.value - GeneralSettings.save() - } + SpinBox { + id: seekSmallStep + editable: true + from: 0 + to: 100 + value: GeneralSettings.seekSmallStep + onValueChanged: { + GeneralSettings.seekSmallStep = seekSmallStep.value + GeneralSettings.save() } - Layout.fillWidth: true } // Seek Medium Step @@ -52,40 +48,35 @@ Layout.alignment: Qt.AlignRight } - Item { - height: seekMediumStep.height - RowLayout { - - SpinBox { - id: seekMediumStep - editable: true - from: 0 - to: 100 - value: GeneralSettings.seekMediumStep - onValueChanged: { - GeneralSettings.seekMediumStep = seekMediumStep.value - GeneralSettings.save() - } - } + RowLayout { - ToolButton { - icon.name: "documentinfo" - checkable: true - checked: false - - Layout.preferredHeight: seekMediumStep.height - - ToolTip { - text: i18n("This is also used for mouse wheel seeking, when mouse is over the progress bar") - visible: parent.checked - delay: 0 - timeout: -1 - closePolicy: Popup.NoAutoClose - } + SpinBox { + id: seekMediumStep + editable: true + from: 0 + to: 100 + value: GeneralSettings.seekMediumStep + onValueChanged: { + GeneralSettings.seekMediumStep = seekMediumStep.value + GeneralSettings.save() } } - Layout.fillWidth: true + ToolButton { + icon.name: "documentinfo" + checkable: true + checked: false + + Layout.preferredHeight: seekMediumStep.height + + ToolTip { + text: i18n("This is also used for mouse wheel seeking, when mouse is over the progress bar") + visible: parent.checked + delay: 0 + timeout: -1 + closePolicy: Popup.NoAutoClose + } + } } // Seek Big Step @@ -94,20 +85,16 @@ Layout.alignment: Qt.AlignRight } - Item { - height: seekBigStep.height - SpinBox { - id: seekBigStep - editable: true - from: 0 - to: 100 - value: GeneralSettings.seekBigStep - onValueChanged: { - GeneralSettings.seekBigStep = seekBigStep.value - GeneralSettings.save() - } + SpinBox { + id: seekBigStep + editable: true + from: 0 + to: 100 + value: GeneralSettings.seekBigStep + onValueChanged: { + GeneralSettings.seekBigStep = seekBigStep.value + GeneralSettings.save() } - Layout.fillWidth: true } Item { width: 1 } @@ -364,64 +351,60 @@ Layout.alignment: Qt.AlignRight } - Item { - height: ytdlFormatComboBox.height - ComboBox { - id: ytdlFormatComboBox - property string hCurrentvalue: "" - textRole: "key" - model: ListModel { - id: leftButtonModel - ListElement { key: "Custom"; value: "" } - ListElement { key: "Default"; value: "bestvideo+bestaudio/best" } - ListElement { key: "2160"; value: "bestvideo[height<=2160]+bestaudio/best" } - ListElement { key: "1440"; value: "bestvideo[height<=1440]+bestaudio/best" } - ListElement { key: "1080"; value: "bestvideo[height<=1080]+bestaudio/best" } - ListElement { key: "720"; value: "bestvideo[height<=720]+bestaudio/best" } - ListElement { key: "480"; value: "bestvideo[height<=480]+bestaudio/best" } - } - ToolTip { - text: i18n("Selects the best video with a height lower than or equal to the selected value.") - } + ComboBox { + id: ytdlFormatComboBox + property string hCurrentvalue: "" + textRole: "key" + model: ListModel { + id: leftButtonModel + ListElement { key: "Custom"; value: "" } + ListElement { key: "Default"; value: "bestvideo+bestaudio/best" } + ListElement { key: "2160"; value: "bestvideo[height<=2160]+bestaudio/best" } + ListElement { key: "1440"; value: "bestvideo[height<=1440]+bestaudio/best" } + ListElement { key: "1080"; value: "bestvideo[height<=1080]+bestaudio/best" } + ListElement { key: "720"; value: "bestvideo[height<=720]+bestaudio/best" } + ListElement { key: "480"; value: "bestvideo[height<=480]+bestaudio/best" } + } + ToolTip { + text: i18n("Selects the best video with a height lower than or equal to the selected value.") + } - onActivated: { - hCurrentvalue = model.get(index).value - if (index === 0) { - ytdlFormatField.text = PlaybackSettings.ytdlFormat - } - if(index > 0) { - ytdlFormatField.focus = true - ytdlFormatField.text = model.get(index).value - } - PlaybackSettings.ytdlFormat = ytdlFormatField.text - PlaybackSettings.save() - mpv.setProperty("ytdl-format", PlaybackSettings.ytdlFormat) + onActivated: { + hCurrentvalue = model.get(index).value + if (index === 0) { + ytdlFormatField.text = PlaybackSettings.ytdlFormat + } + if(index > 0) { + ytdlFormatField.focus = true + ytdlFormatField.text = model.get(index).value } + PlaybackSettings.ytdlFormat = ytdlFormatField.text + PlaybackSettings.save() + mpv.setProperty("ytdl-format", PlaybackSettings.ytdlFormat) + } - Component.onCompleted: { - let i = hIndexOfValue(PlaybackSettings.ytdlFormat) - currentIndex = (i === -1) ? 0 : i - } + Component.onCompleted: { + let i = hIndexOfValue(PlaybackSettings.ytdlFormat) + currentIndex = (i === -1) ? 0 : i + } - function hIndexOfValue(value) { - switch(value) { - case "bestvideo+bestaudio/best": - return 1 - case "bestvideo[height<=2160]+bestaudio/best": - return 2 - case "bestvideo[height<=1440]+bestaudio/best": - return 3 - case "bestvideo[height<=1080]+bestaudio/best": - return 4 - case "bestvideo[height<=720]+bestaudio/best": - return 5 - case "bestvideo[height<=480]+bestaudio/best": - return 6 - } - return 0 + function hIndexOfValue(value) { + switch(value) { + case "bestvideo+bestaudio/best": + return 1 + case "bestvideo[height<=2160]+bestaudio/best": + return 2 + case "bestvideo[height<=1440]+bestaudio/best": + return 3 + case "bestvideo[height<=1080]+bestaudio/best": + return 4 + case "bestvideo[height<=720]+bestaudio/best": + return 5 + case "bestvideo[height<=480]+bestaudio/best": + return 6 } + return 0 } - Layout.fillWidth: true } Item { width: 1 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/Settings/VideoSettings.qml new/haruna-v0.9.2/src/qml/Settings/VideoSettings.qml --- old/haruna-v0.9.1/src/qml/Settings/VideoSettings.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/Settings/VideoSettings.qml 2022-09-30 14:53:48.000000000 +0200 @@ -39,36 +39,32 @@ Layout.alignment: Qt.AlignRight } - Item { - height: screenshotFormat.height - ComboBox { - id: screenshotFormat - textRole: "key" - model: ListModel { - ListElement { key: "PNG"; } - ListElement { key: "JPG"; } - ListElement { key: "WebP"; } - } + ComboBox { + id: screenshotFormat + textRole: "key" + model: ListModel { + ListElement { key: "PNG"; } + ListElement { key: "JPG"; } + ListElement { key: "WebP"; } + } - onActivated: { - VideoSettings.screenshotFormat = model.get(index).key - VideoSettings.save() - mpv.setProperty("screenshot-format", VideoSettings.screenshotFormat) - } + onActivated: { + VideoSettings.screenshotFormat = model.get(index).key + VideoSettings.save() + mpv.setProperty("screenshot-format", VideoSettings.screenshotFormat) + } - Component.onCompleted: { - if (VideoSettings.screenshotFormat === "PNG") { - currentIndex = 0 - } - if (VideoSettings.screenshotFormat === "JPG") { - currentIndex = 1 - } - if (VideoSettings.screenshotFormat === "WebP") { - currentIndex = 2 - } + Component.onCompleted: { + if (VideoSettings.screenshotFormat === "PNG") { + currentIndex = 0 + } + if (VideoSettings.screenshotFormat === "JPG") { + currentIndex = 1 + } + if (VideoSettings.screenshotFormat === "WebP") { + currentIndex = 2 } } - Layout.fillWidth: true } // ------------------------------------ @@ -79,19 +75,15 @@ Layout.alignment: Qt.AlignRight } - Item { - height: screenshotTemplate.height - TextField { - id: screenshotTemplate - text: VideoSettings.screenshotTemplate - width: parent.width - onEditingFinished: { - VideoSettings.screenshotTemplate = text - VideoSettings.save() - mpv.setProperty("screenshot-template", VideoSettings.screenshotTemplate) - } - } + TextField { + id: screenshotTemplate + text: VideoSettings.screenshotTemplate Layout.fillWidth: true + onEditingFinished: { + VideoSettings.screenshotTemplate = text + VideoSettings.save() + mpv.setProperty("screenshot-template", VideoSettings.screenshotTemplate) + } } SettingsHeader { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/VolumeSlider.qml new/haruna-v0.9.2/src/qml/VolumeSlider.qml --- old/haruna-v0.9.1/src/qml/VolumeSlider.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/VolumeSlider.qml 2022-09-30 14:53:48.000000000 +0200 @@ -28,16 +28,14 @@ rightPadding: 0 handle: Item { visible: false } - background: Rectangle { - id: harunaSliderBG color: Kirigami.Theme.alternateBackgroundColor + scale: root.mirrored ? -1 : 1 Rectangle { - width: visualPosition * parent.width + width: root.position * parent.width height: parent.height color: Kirigami.Theme.highlightColor - radius: 0 } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haruna-v0.9.1/src/qml/main.qml new/haruna-v0.9.2/src/qml/main.qml --- old/haruna-v0.9.1/src/qml/main.qml 2022-08-24 18:15:54.000000000 +0200 +++ new/haruna-v0.9.2/src/qml/main.qml 2022-09-30 14:53:48.000000000 +0200 @@ -24,13 +24,14 @@ id: window property int previousVisibility: Window.Windowed + property var acceptedSubtitleTypes: ["application/x-subrip", "text/x-ssa"] visible: true title: mpv.mediaTitle || i18n("Haruna") - width: 1200 - minimumWidth: 700 - height: 720 - minimumHeight: 450 + width: Kirigami.Units.gridUnit * 66 + minimumWidth: Kirigami.Units.gridUnit * 36 + height: Kirigami.Units.gridUnit * 40 + minimumHeight: Kirigami.Units.gridUnit * 22 color: Kirigami.Theme.backgroundColor onClosing: app.saveWindowGeometry(window) @@ -210,6 +211,33 @@ } onRejected: mpv.focus = true } + + Platform.FileDialog { + id: subtitlesFileDialog + + property url location: { + if (mpv.playlistModel.length > 0) { + const item = mpv.playlistModel.getItem(mpv.playlistModel.getPlayingVideo()) + return app.pathToUrl(item.folderPath()) + } else { + return (GeneralSettings.fileDialogLocation + ? app.pathToUrl(GeneralSettings.fileDialogLocation) + : app.pathToUrl(GeneralSettings.fileDialogLastLocation)) + } + } + + folder: location + title: i18n("Select subtitles file") + fileMode: Platform.FileDialog.OpenFile + nameFilters: ["Subtitles (*.srt *.ssa *.ass)"] + + onAccepted: { + if (acceptedSubtitleTypes.includes(app.mimeType(subtitlesFileDialog.file))) { + mpv.command(["sub-add", subtitlesFileDialog.file.toString(), "select"]) + } + } + onRejected: mpv.focus = true + } Popup { id: openUrlPopup
