~etherpulse/podbird/bottom_edge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright 2015-2016 Podbird Team
 *
 * This file is part of Podbird.
 *
 * Podbird is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * Podbird is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import QtQuick 2.4
import QtMultimedia 5.6
import Ubuntu.Components 1.3
import QtQuick.LocalStorage 2.0
import "../podcasts.js" as Podcasts
import "../components"

Page {
    id: nowPlayingPage

    visible: false

    property bool isNowPlayingPage: true

    signal closeBottomEdge()

    header: PageHeader {
        title: i18n.tr("Now Playing")

        StyleHints {
            backgroundColor: podbird.appTheme.background
        }

        leadingActionBar.actions: Action {
            iconName: nowPlayingPageSections.selectedIndex === 1 && currentViewLoader.item.ViewItems.dragMode ? "back" : "go-down"
            text: i18n.tr("Back")
            onTriggered: {
                if (nowPlayingPageSections.selectedIndex === 1 && currentViewLoader.item.ViewItems.dragMode) {
                    currentViewLoader.item.ViewItems.dragMode = !currentViewLoader.item.ViewItems.dragMode
                } else {
                    closeBottomEdge()
                }
            }
        }

        trailingActionBar.actions: Action {
            iconName: "delete"
            visible: nowPlayingPageSections.selectedIndex === 1
            onTriggered: {
                Podcasts.clearQueue()
                player.playlist.clear()
                 closeBottomEdge()
            }
        }

        extension: Sections {
            id: nowPlayingPageSections

            anchors {
                left: parent.left
                bottom: parent.bottom
            }

            StyleHints {
                selectedSectionColor: podbird.appTheme.focusText
            }
            model: [i18n.tr("Full view"), i18n.tr("Queue")]
        }
    }

    Loader {
        id: currentViewLoader
        anchors { fill: parent; topMargin: nowPlayingPage.header.height }
        source: nowPlayingPageSections.selectedIndex === 0 ? Qt.resolvedUrl("FullPlayingView.qml") : Qt.resolvedUrl("Queue.qml")
    }
}