# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'file.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.
import os

from PyQt5 import QtCore, QtGui, QtWidgets

import ui.media as media
import ui.media_file_browser as media_file_browser


class Ui_widget(object):
    def setupUi(self, widget, owner, filename, media_player):
        self.owner = owner
        self.filename = filename
        self.media_player = media_player
        widget.setObjectName("widget")
        widget.resize(600, 45)
        widget.setStyleSheet("#widget {\n"
                             "    background: black;\n"
                             "    border-bottom: 1px solid #CCC\n"
                             "}\n"
                             "\n"
                             "* {\n"
                             "    color: white\n"
                             "}")
        self.label_number = QtWidgets.QLabel(widget)
        self.label_number.setGeometry(QtCore.QRect(15, 15, 15, 15))
        font = QtGui.QFont()
        font.setFamily("Montserrat Light")
        font.setPointSize(13)
        self.label_number.setFont(font)
        self.label_number.setStyleSheet("color: #CCC")
        self.label_number.setAlignment(QtCore.Qt.AlignCenter)
        self.label_number.setObjectName("label_number")
        self.label_title = QtWidgets.QLabel(widget)
        self.label_title.setGeometry(QtCore.QRect(70, 10, 300, 25))
        font = QtGui.QFont()
        font.setFamily("Montserrat Light")
        font.setPointSize(13)
        self.label_title.setFont(font)
        self.label_title.setStyleSheet("")
        self.label_title.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.label_title.setObjectName("label_title")
        self.label_length = QtWidgets.QLabel(widget)
        self.label_length.setGeometry(QtCore.QRect(430, 15, 45, 15))
        font = QtGui.QFont()
        font.setFamily("Montserrat Light")
        font.setPointSize(13)
        self.label_length.setFont(font)
        self.label_length.setStyleSheet("")
        self.label_length.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        self.label_length.setObjectName("label_length")
        self.btn_play = QtWidgets.QWidget(widget)
        self.btn_play.setEnabled(True)
        self.btn_play.setGeometry(QtCore.QRect(515, 7, 30, 30))
        self.btn_play.setStyleSheet("#btn_play {\n"
                                    "    background: #252525; color: white\n"
                                    "}\n"
                                    "\n"
                                    "#btn_play::hover {\n"
                                    "    background: #303030;\n"
                                    "}\n"
                                    "\n"
                                    "#btn_play::!enabled {\n"
                                    "    background: #595959;\n"
                                    "    border-bottom: 3px solid #E00000;\n"
                                    "}")
        self.btn_play.setObjectName("btn_play")
        self.btn_play.mouseReleaseEvent = self.playFile
        self.label_btn_play = QtWidgets.QLabel(self.btn_play)
        self.label_btn_play.setGeometry(QtCore.QRect(3, 3, 24, 24))
        self.label_btn_play.setText("")
        self.label_btn_play.setPixmap(QtGui.QPixmap(":/images/play.svg"))
        self.label_btn_play.setScaledContents(True)
        self.label_btn_play.setObjectName("label_btn_play")
        self.btn_queue = QtWidgets.QWidget(widget)
        self.btn_queue.setEnabled(True)
        self.btn_queue.setGeometry(QtCore.QRect(555, 7, 30, 30))
        self.btn_queue.setStyleSheet("#btn_queue {\n"
                                     "    background: #252525; color: white\n"
                                     "}\n"
                                     "\n"
                                     "#btn_queue::hover {\n"
                                     "    background: #303030;\n"
                                     "}\n"
                                     "\n"
                                     "#btn_queue::!enabled {\n"
                                     "    background: #595959;\n"
                                     "    border-bottom: 3px solid #E00000;\n"
                                     "}")
        self.btn_queue.setObjectName("btn_queue")
        self.btn_queue.mouseReleaseEvent = self.queueFile
        self.label_btn_queue = QtWidgets.QLabel(self.btn_queue)
        self.label_btn_queue.setGeometry(QtCore.QRect(3, 3, 24, 24))
        self.label_btn_queue.setText("")
        self.label_btn_queue.setPixmap(QtGui.QPixmap(":/images/queue.svg"))
        self.label_btn_queue.setScaledContents(True)
        self.label_btn_queue.setObjectName("label_btn_queue")

        self.retranslateUi(widget)
        QtCore.QMetaObject.connectSlotsByName(widget)

    def retranslateUi(self, widget):
        _translate = QtCore.QCoreApplication.translate
        widget.setWindowTitle(_translate("widget", "Form"))
        self.label_number.setText(_translate("widget", "1"))
        self.label_title.setText(_translate("widget", "Title text"))
        self.label_length.setText(_translate("widget", "x:xx"))

    def playFile(self, event):
        self.media_player.current_dir = self.owner.current_path
        self.media_player.current_file = os.path.join(self.owner.current_path, self.filename)
        self.media_player.play()

    def queueFile(self, event):
        self.media_player.queue.append(os.path.join(self.owner.current_path, self.filename))
