1/*
2 * SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import QtQml 2.12
8import QtQuick 2.12
9import QtQuick.Controls 2.12
10
11Menu {
12    id: root
13
14    title: i18n("&Subtitles")
15
16    Menu {
17        id: primarySubtitleMenu
18
19        title: i18n("Primary Subtitle")
20        onOpened: primarySubtitleMenuInstantiator.model = mpv.subtitleTracksModel
21
22        Instantiator {
23            id: primarySubtitleMenuInstantiator
24            model: 0
25            onObjectAdded: primarySubtitleMenu.insertItem( index, object )
26            onObjectRemoved: primarySubtitleMenu.removeItem( object )
27            delegate: MenuItem {
28                enabled: model.id !== mpv.secondarySubtitleId || model.id === 0
29                checkable: true
30                checked: model.id === mpv.subtitleId
31                text: model.text
32                onTriggered: mpv.subtitleId = model.id
33            }
34        }
35    }
36
37    Menu {
38        id: secondarySubtitleMenu
39
40        title: i18n("Secondary Subtitle")
41        onOpened: secondarySubtitleMenuInstantiator.model = mpv.subtitleTracksModel
42
43        Instantiator {
44            id: secondarySubtitleMenuInstantiator
45            model: 0
46            onObjectAdded: secondarySubtitleMenu.insertItem( index, object )
47            onObjectRemoved: secondarySubtitleMenu.removeItem( object )
48            delegate: MenuItem {
49                enabled: model.id !== mpv.subtitleId || model.id === 0
50                checkable: true
51                checked: model.id === mpv.secondarySubtitleId
52                text: model.text
53                onTriggered: mpv.secondarySubtitleId = model.id
54            }
55        }
56    }
57
58    MenuSeparator {}
59
60    MenuItem { action: actions["subtitleQuickenAction"] }
61    MenuItem { action: actions["subtitleDelayAction"] }
62    MenuItem { action: actions["subtitleToggleAction"] }
63}
64