1
0
Fork 0

Add keyboard chapter changing.

This commit is contained in:
namedkitten 2020-05-12 15:34:00 +01:00
parent 94fb63de53
commit e7484349a5
8 changed files with 42 additions and 13 deletions

View file

@ -363,12 +363,7 @@ QVariant playerCommand(BackendInterface* b, const Enums::Commands& cmd, const QV
break; break;
} }
case Enums::Commands::SeekAbsolute: {
b->command(QVariantList() << "seek" << args << "absolute");
break;
}
case Enums::Commands::ForwardFrame: { case Enums::Commands::ForwardFrame: {
b->command(QVariantList() << "frame-step"); b->command(QVariantList() << "frame-step");
@ -406,6 +401,20 @@ QVariant playerCommand(BackendInterface* b, const Enums::Commands& cmd, const QV
break; break;
} }
case Enums::Commands::PreviousChapter: {
b->command(QVariantList() << "add" << "chapter" << "-1");
break;
}
case Enums::Commands::NextChapter: {
b->command(QVariantList() << "add" << "chapter" << "1");
break;
}
default: { default: {
//qDebug() << "Command not found: " << cmd; //qDebug() << "Command not found: " << cmd;
break; break;

View file

@ -42,6 +42,8 @@ enum class Commands : int {
SetTrack = 21, SetTrack = 21,
SetPlaylistPos = 22, SetPlaylistPos = 22,
ForcePause = 23, ForcePause = 23,
PreviousChapter = 24,
NextChapter = 25,
}; };
Q_ENUM_NS(Commands) Q_ENUM_NS(Commands)

View file

@ -2,7 +2,6 @@ import QtQuick.Controls 2.3
import player 1.0 import player 1.0
Action { Action {
id: audioDeviceItem
property string deviceID: "none" property string deviceID: "none"
checkable: false checkable: false
checked: false checked: false

View file

@ -7,7 +7,7 @@ Rectangle {
width: 4 width: 4
height: parent.height height: parent.height
x: progressBar.background.width / progressBar.to * time x: progressBar.background.width / progressBar.to * time
z: 9000 z: 90000
anchors { anchors {
top: parent.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
@ -15,7 +15,6 @@ Rectangle {
Connections { Connections {
target: player target: player
enabled: true
onChaptersChanged: { onChaptersChanged: {
chapterMarker.destroy() chapterMarker.destroy()
} }

View file

@ -140,14 +140,19 @@ Slider {
Item { Item {
anchors.fill: parent anchors.fill: parent
id: chapterMarkers id: chapterMarkers
z: 60
Connections { Connections {
target: player target: player
onChaptersChanged: function (chapters) { onChaptersChanged: function (chapters) {
for (var i = 0, len = chapters.length; i < len; i++) { 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, { var marker = component.createObject(chapterMarkers, {
"time": chapters[i]["time"] "time": chapters[i]["time"]
}) })
if (marker == null) {
console.error(component.errorString())
}
} }
} }
} }

View file

@ -269,6 +269,20 @@ MenuBar {
} }
shortcut: keybinds.backwardFrame 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 { CustomMenu {

View file

@ -61,7 +61,9 @@ var translations = {
FONT: "Font", FONT: "Font",
SUBTITLES_FONT_SIZE: "Subtitles Font Size", SUBTITLES_FONT_SIZE: "Subtitles Font Size",
UI_FADE_TIME: "UI Fade Time (ms)", 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: { spanish: {
OPEN_FILE: "Abrir archivo", OPEN_FILE: "Abrir archivo",

View file

@ -146,9 +146,8 @@ Window {
property string cycleAudio: "A" property string cycleAudio: "A"
property string cycleVideo: "V" property string cycleVideo: "V"
property string cycleVideoAspect: "Shift+A" property string cycleVideoAspect: "Shift+A"
property string screenshot: "S" property string previousChapter: "Ctrl+Left"
property string screenshotWithoutSubtitles: "Shift+S" property string nextChapter: "Ctrl+Right"
property string fullScreenshot: "Ctrl+S"
property string nyanCat: "Ctrl+N" property string nyanCat: "Ctrl+N"
property string decreaseSpeedByPointOne: "[" property string decreaseSpeedByPointOne: "["
property string increaseSpeedByPointOne: "]" property string increaseSpeedByPointOne: "]"