diff --git a/src/Backends/MPVCommon/MPVCommon.cpp b/src/Backends/MPVCommon/MPVCommon.cpp index f5c889a..2112fc9 100644 --- a/src/Backends/MPVCommon/MPVCommon.cpp +++ b/src/Backends/MPVCommon/MPVCommon.cpp @@ -363,12 +363,7 @@ QVariant playerCommand(BackendInterface* b, const Enums::Commands& cmd, const QV break; } - case Enums::Commands::SeekAbsolute: { - b->command(QVariantList() << "seek" << args << "absolute"); - - break; - } case Enums::Commands::ForwardFrame: { b->command(QVariantList() << "frame-step"); @@ -406,6 +401,20 @@ QVariant playerCommand(BackendInterface* b, const Enums::Commands& cmd, const QV break; } + case Enums::Commands::PreviousChapter: { + + b->command(QVariantList() << "add" << "chapter" << "-1"); + + break; + } + + case Enums::Commands::NextChapter: { + + b->command(QVariantList() << "add" << "chapter" << "1"); + + break; + } + default: { //qDebug() << "Command not found: " << cmd; break; diff --git a/src/enums.hpp b/src/enums.hpp index 6dc99c2..9a72e30 100644 --- a/src/enums.hpp +++ b/src/enums.hpp @@ -42,6 +42,8 @@ enum class Commands : int { SetTrack = 21, SetPlaylistPos = 22, ForcePause = 23, + PreviousChapter = 24, + NextChapter = 25, }; Q_ENUM_NS(Commands) diff --git a/src/qml/Items/AudioDeviceItem.qml b/src/qml/Items/AudioDeviceItem.qml index 5efdbe1..7721fc5 100644 --- a/src/qml/Items/AudioDeviceItem.qml +++ b/src/qml/Items/AudioDeviceItem.qml @@ -2,7 +2,6 @@ import QtQuick.Controls 2.3 import player 1.0 Action { - id: audioDeviceItem property string deviceID: "none" checkable: false checked: false diff --git a/src/qml/Items/ChapterMarkerItem.qml b/src/qml/Items/ChapterMarkerItem.qml index 74a0e60..eac18d9 100644 --- a/src/qml/Items/ChapterMarkerItem.qml +++ b/src/qml/Items/ChapterMarkerItem.qml @@ -7,7 +7,7 @@ Rectangle { width: 4 height: parent.height x: progressBar.background.width / progressBar.to * time - z: 9000 + z: 90000 anchors { top: parent.top bottom: parent.bottom @@ -15,7 +15,6 @@ Rectangle { Connections { target: player - enabled: true onChaptersChanged: { chapterMarker.destroy() } diff --git a/src/qml/UIComponents/Controls/VideoProgress.qml b/src/qml/UIComponents/Controls/VideoProgress.qml index ef6e4af..4d59de8 100644 --- a/src/qml/UIComponents/Controls/VideoProgress.qml +++ b/src/qml/UIComponents/Controls/VideoProgress.qml @@ -140,14 +140,19 @@ Slider { Item { anchors.fill: parent id: chapterMarkers + z: 60 Connections { target: player onChaptersChanged: function (chapters) { for (var i = 0, len = chapters.length; i < len; i++) { - var component = Qt.createComponent("ChapterMarker.qml") + var component = Qt.createComponent("ChapterMarkerItem.qml") + var marker = component.createObject(chapterMarkers, { "time": chapters[i]["time"] }) + if (marker == null) { + console.error(component.errorString()) + } } } } diff --git a/src/qml/UIComponents/MenuBar/MainMenu.qml b/src/qml/UIComponents/MenuBar/MainMenu.qml index 2dca35f..9f1c5c1 100644 --- a/src/qml/UIComponents/MenuBar/MainMenu.qml +++ b/src/qml/UIComponents/MenuBar/MainMenu.qml @@ -269,6 +269,20 @@ MenuBar { } shortcut: keybinds.backwardFrame } + Action { + text: translate.getTranslation("PREVIOUS_CHAPTER", i18n.language) + onTriggered: { + player.playerCommand(Enums.Commands.PreviousChapter) + } + shortcut: keybinds.previousChapter + } + Action { + text: translate.getTranslation("NEXT_CHAPTER", i18n.language) + onTriggered: { + player.playerCommand(Enums.Commands.NextChapter) + } + shortcut: keybinds.nextChapter + } } CustomMenu { diff --git a/src/qml/Utils/translations.js b/src/qml/Utils/translations.js index b2099d7..d816e1a 100644 --- a/src/qml/Utils/translations.js +++ b/src/qml/Utils/translations.js @@ -61,7 +61,9 @@ var translations = { FONT: "Font", SUBTITLES_FONT_SIZE: "Subtitles Font Size", UI_FADE_TIME: "UI Fade Time (ms)", - UPDATE_APPIMAGE: "Update (AppImage Only)" + UPDATE_APPIMAGE: "Update (AppImage Only)", + PREVIOUS_CHAPTER: "Previous Chapter", + NEXT_CHAPTER: "Next Chapter" }, spanish: { OPEN_FILE: "Abrir archivo", diff --git a/src/qml/main.qml b/src/qml/main.qml index cd3c46e..974b931 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -146,9 +146,8 @@ Window { property string cycleAudio: "A" property string cycleVideo: "V" property string cycleVideoAspect: "Shift+A" - property string screenshot: "S" - property string screenshotWithoutSubtitles: "Shift+S" - property string fullScreenshot: "Ctrl+S" + property string previousChapter: "Ctrl+Left" + property string nextChapter: "Ctrl+Right" property string nyanCat: "Ctrl+N" property string decreaseSpeedByPointOne: "[" property string increaseSpeedByPointOne: "]"