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;
}
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;

View file

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

View file

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

View file

@ -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()
}

View file

@ -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())
}
}
}
}

View file

@ -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 {

View file

@ -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",

View file

@ -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: "]"