<commit_before>/* GStreamer
 *
 * Copyright (C) 2015 <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

import QtQuick 2.4
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1
import Player 1.0
import org.freedesktop.gstreamer.GLVideoItem 1.0

import "fontawesome.js" as FontAwesome

ApplicationWindow {
    id: window
    visible: true
    width: 640
    height: 480
    x: 30
    y: 30
    color: "black"
//    title : player.mediaInfo.title

    Player {
        id: player
        objectName: "player"
        volume: 0.5
        positionUpdateInterval: 100
        onStateChanged: {
            if (state === Player.STOPPED) {
                playbutton.state = "play"
            }
        }
        onResolutionChanged: {
            if (player.videoAvailable) {
                window.width = resolution.width
                window.height = resolution.height
            }
        }
    }

    GstGLVideoItem {
        id: video
        objectName: "videoItem"
        anchors.centerIn: parent
        width: parent.width
        height: parent.height
    }

    FileDialog {
        id: fileDialog
        //nameFilters: [TODO globs from mime types]
        onAccepted: player.source = fileUrl
    }

    Action {
        id: fileOpenAction
        text: "Open"
        onTriggered: fileDialog.open()
    }

    Item {
        anchors.fill: parent
        FontLoader {
            source: "fonts/fontawesome-webfont.ttf"
        }

        Rectangle {
            id : playbar
            color: Qt.rgba(1, 1, 1, 0.7)
            border.width: 1
            border.color: "white"
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 15
            anchors.horizontalCenter: parent.horizontalCenter
            width : grid.width + 20
            height: 40//childrenRect.height + 20
            radius: 5

            MouseArea {
                id: mousearea
                anchors.fill: parent
                hoverEnabled: true
                onEntered: {
                    parent.opacity = 1.0
                    hidetimer.start()
                }
            }

            Timer {
                id: hidetimer
                interval: 10000
                onTriggered: {
                    parent.opacity = 0.0
                    settings.visible = false
                    stop()
                }
            }

            Rectangle {
                id: settings
                width: 150; height: settingsView.contentHeight
                color: Qt.rgba(1, 1, 1, 0.7)
                anchors.right: parent.right
                anchors.bottom: parent.top
                anchors.bottomMargin: 3
                border.width: 1
                border.color: "white"
                radius: 5
                visible: false

                ListModel {
                    id: settingsModel
                    ListElement {
                        name: "Video"
                    }
                    ListElement {
                        name: "Audio"
                    }
                    ListElement {
                        name: "Subtitle"
                    }
                }

                Component {
                    id: settingsDelegate<commit_msg>qt: hide playbar properly<commit_after>/* GStreamer
 *
 * Copyright (C) 2015 <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

import QtQuick 2.4
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1
import Player 1.0
import org.freedesktop.gstreamer.GLVideoItem 1.0

import "fontawesome.js" as FontAwesome

ApplicationWindow {
    id: window
    visible: true
    width: 640
    height: 480
    x: 30
    y: 30
    color: "black"
//    title : player.mediaInfo.title

    Player {
        id: player
        objectName: "player"
        volume: 0.5
        positionUpdateInterval: 100
        onStateChanged: {
            if (state === Player.STOPPED) {
                playbutton.state = "play"
            }
        }
        onResolutionChanged: {
            if (player.videoAvailable) {
                window.width = resolution.width
                window.height = resolution.height
            }
        }
    }

    GstGLVideoItem {
        id: video
        objectName: "videoItem"
        anchors.centerIn: parent
        width: parent.width
        height: parent.height
    }

    MouseArea {
        anchors.fill: parent
        hoverEnabled: true
        onPositionChanged: {
            playbar.opacity = 1.0
            hidetimer.start()
        }
    }

    Timer {
        id: hidetimer
        interval: 5000
        onTriggered: {
            playbar.opacity = 0.0
            settings.visible = false
            stop()
        }
    }

    FileDialog {
        id: fileDialog
        //nameFilters: [TODO globs from mime types]
        onAccepted: player.source = fileUrl
    }

    Action {
        id: fileOpenAction
        text: "Open"
        onTriggered: fileDialog.open()
    }

    Item {
        anchors.fill: parent
        FontLoader {
            source: "fonts/fontawesome-webfont.ttf"
        }

        Rectangle {
            id : playbar
            color: Qt.rgba(1, 1, 1, 0.7)
            border.width: 1
            border.color: "white"
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 15
            anchors.horizontalCenter: parent.horizontalCenter
            width : grid.width + 20
            height: 40//childrenRect.height + 20
            radius: 5

            Rectangle {
                id: settings
                width: 150; height: settingsView.contentHeight
                color: Qt.rgba(1, 1, 1, 0.7)
                anchors.right: parent.right
                anchors.bottom: parent.top
                anchors.bottomMargin: 3
                border.width: 1
                border.color: "white"
                radius: 5
                visible: false

                ListModel {
                    id: settingsModel
                    ListElement {
                        name: "Video"
                    }
                    ListElement {
                        name: "Audio"
                    }
                    ListElement {
                        name: "Subtitle"
                    }
                }

                Component {
                    id: settingsDelegate
{'fraction_non_alphanumeric': 0.07138320843388797, 'fraction_numerical': 0.020195605233075068, 'mean_word_length': 1.3991468616697136, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6145007', 'n_tokens_mistral': 2197, 'n_tokens_neox': 1983, 'n_words': 624}