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

# Form implementation generated from reading ui file 'lanzou-gui/lanzou.ui'
#
# Created by: PyQt5 UI code generator 5.13.2, and I have edited
#
from PyQt5 import QtCore, QtGui, QtWidgets
from dialogs import MyLineEdit

class MyTableView(QtWidgets.QTableView):
    """加入拖拽功能的表格显示器"""
    drop_files = QtCore.pyqtSignal(object)

    def __init__(self, parent):
        super(MyTableView, self).__init__(parent)
        self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
        self.setDragEnabled(True)
        self.setAcceptDrops(True)
        self.setDropIndicatorShown(True)

    def dragEnterEvent(self, event):
        m = event.mimeData()
        if m.hasUrls():
            for url in m.urls():
                if url.isLocalFile():
                    event.accept()
                    return
        event.ignore()

    def dropEvent(self, event):
        if event.source():
            QtWidgets.QListView.dropEvent(self, event)
        else:
            m = event.mimeData()
            if m.hasUrls():
                urls = [url.toLocalFile() for url in m.urls() if url.isLocalFile()]
                if urls:
                    self.drop_files.emit(urls)
                    event.acceptProposedAction()


class Ui_MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui_MainWindow, self).__init__()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(1000, 650)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.share_tab = QtWidgets.QWidget()
        self.share_tab.setObjectName("share_tab")
        self.share_vlayout = QtWidgets.QVBoxLayout(self.share_tab)
        self.share_vlayout.setObjectName("share_vlayout")
        self.share_hlayout_top = QtWidgets.QHBoxLayout()
        self.share_hlayout_top.setObjectName("share_hlayout_top")
        self.label_share_url = QtWidgets.QLabel(self.share_tab)
        self.label_share_url.setObjectName("label_share_url")
        self.share_hlayout_top.addWidget(self.label_share_url)
        self.line_share_url = QtWidgets.QLineEdit(self.share_tab)
        self.line_share_url.setObjectName("line_share_url")
        self.share_hlayout_top.addWidget(self.line_share_url)
        self.btn_extract = QtWidgets.QPushButton(self.share_tab)
        self.btn_extract.setObjectName("btn_extract")
        self.share_hlayout_top.addWidget(self.btn_extract)
        self.share_vlayout.addLayout(self.share_hlayout_top)
        self.table_share = QtWidgets.QTableView(self.share_tab)
        self.table_share.setObjectName("table_share")
        self.share_vlayout.addWidget(self.table_share)
        self.share_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.share_hlayout_bottom.setObjectName("share_hlayout_bottom")
        self.btn_share_select_all = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_select_all.setObjectName("btn_share_select_all")
        self.share_hlayout_bottom.addWidget(self.btn_share_select_all)
        self.label_dl_path = QtWidgets.QLabel(self.share_tab)
        self.label_dl_path.setObjectName("label_dl_path")
        self.share_hlayout_bottom.addWidget(self.label_dl_path)
        self.share_set_dl_path = MyLineEdit(self.share_tab)
        self.share_set_dl_path.setObjectName("share_set_dl_path")
        self.share_hlayout_bottom.addWidget(self.share_set_dl_path)
        self.btn_share_dl = QtWidgets.QPushButton(self.share_tab)
        self.btn_share_dl.setObjectName("btn_share_dl")
        self.share_hlayout_bottom.addWidget(self.btn_share_dl)
        self.share_vlayout.addLayout(self.share_hlayout_bottom)
        self.tabWidget.addTab(self.share_tab, "")
        self.disk_tab = QtWidgets.QWidget()
        self.disk_tab.setEnabled(True)
        self.disk_tab.setMinimumSize(QtCore.QSize(620, 0))
        self.disk_tab.setObjectName("disk_tab")
        self.disk_vlayout = QtWidgets.QVBoxLayout(self.disk_tab)
        self.disk_vlayout.setObjectName("disk_vlayout")
        self.disk_hlayout_top = QtWidgets.QHBoxLayout()
        self.disk_hlayout_top.setObjectName("disk_hlayout_top")
        self.disk_loc_hbox = QtWidgets.QHBoxLayout()
        self.disk_loc_hbox.setObjectName("disk_loc")
        self.label_disk_loc = QtWidgets.QLabel(self.disk_tab)
        self.label_disk_loc.setObjectName("label_disk_loc")
        self.disk_loc_hbox.addWidget(self.label_disk_loc)
        self.disk_hlayout_top.addLayout(self.disk_loc_hbox)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_top.addItem(spacerItem)
        self.btn_disk_mkdir = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_mkdir.setObjectName("btn_disk_mkdir")
        self.disk_hlayout_top.addWidget(self.btn_disk_mkdir)
        self.disk_vlayout.addLayout(self.disk_hlayout_top)
        self.table_disk = MyTableView(self.disk_tab)
        self.table_disk.setObjectName("table_disk")
        self.disk_vlayout.addWidget(self.table_disk)
        self.disk_hlayout_bottom = QtWidgets.QHBoxLayout()
        self.disk_hlayout_bottom.setObjectName("disk_hlayout_bottom")
        self.btn_disk_select_all = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_select_all.setObjectName("btn_disk_select_all")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_select_all)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.disk_hlayout_bottom.addItem(spacerItem1)
        self.btn_disk_delete = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_delete.setObjectName("btn_disk_delete")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_delete)
        self.btn_disk_dl = QtWidgets.QPushButton(self.disk_tab)
        self.btn_disk_dl.setObjectName("btn_disk_dl")
        self.disk_hlayout_bottom.addWidget(self.btn_disk_dl)
        self.disk_vlayout.addLayout(self.disk_hlayout_bottom)
        self.tabWidget.addTab(self.disk_tab, "")

        self.rec_tab = QtWidgets.QWidget()
        self.rec_tab.setObjectName("rec_tab")
        self.rec_verticalLayout = QtWidgets.QVBoxLayout(self.rec_tab)
        self.rec_verticalLayout.setObjectName("rec_verticalLayout")
        self.rec_horizontalLayout = QtWidgets.QHBoxLayout()
        self.rec_horizontalLayout.setObjectName("rec_horizontalLayout")
        self.btn_rec_select_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_select_all.setObjectName("btn_rec_select_all")
        self.rec_horizontalLayout.addWidget(self.btn_rec_select_all)
        self.btn_recovery = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery.setObjectName("btn_recovery")
        self.rec_horizontalLayout.addWidget(self.btn_recovery)
        self.btn_rec_delete = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_delete.setObjectName("btn_rec_delete")
        self.rec_horizontalLayout.addWidget(self.btn_rec_delete)
        self.rec_horizontalLayout.addStretch(1)
        self.btn_rec_clean = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_clean.setObjectName("btn_rec_clean")
        self.rec_horizontalLayout.addWidget(self.btn_rec_clean)
        self.btn_recovery_all = QtWidgets.QPushButton(self.rec_tab)
        self.btn_recovery_all.setObjectName("btn_recovery_all")
        self.rec_horizontalLayout.addWidget(self.btn_recovery_all)
        self.btn_rec_expire_files = QtWidgets.QPushButton(self.rec_tab)
        self.btn_rec_expire_files.setObjectName("btn_rec_expire_files")
        self.rec_horizontalLayout.addWidget(self.btn_rec_expire_files)
        self.rec_verticalLayout.addLayout(self.rec_horizontalLayout)
        self.table_rec = QtWidgets.QTableView(self.rec_tab)
        self.table_rec.setObjectName("table_rec")
        self.rec_verticalLayout.addWidget(self.table_rec)
        self.tabWidget.addTab(self.rec_tab, "")

        self.jobs_tab = QtWidgets.QWidget()
        self.jobs_tab.setObjectName("jobs_tab")
        self.jobs_verticalLayout = QtWidgets.QVBoxLayout(self.jobs_tab)
        self.jobs_verticalLayout.setObjectName("jobs_verticalLayout")
        self.jobs_horizontalLayout = QtWidgets.QHBoxLayout()
        self.jobs_horizontalLayout.setObjectName("jobs_horizontalLayout")
        self.btn_jobs_start_all = QtWidgets.QPushButton(self.jobs_tab)
        self.btn_jobs_clean_all = QtWidgets.QPushButton(self.jobs_tab)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_start_all)
        self.jobs_horizontalLayout.addStretch(1)
        self.jobs_horizontalLayout.addWidget(self.btn_jobs_clean_all)
        self.table_jobs = MyTableView(self.jobs_tab)
        self.table_jobs.setObjectName("table_jobs")
        self.jobs_verticalLayout.addLayout(self.jobs_horizontalLayout)
        self.jobs_verticalLayout.addWidget(self.table_jobs)
        self.tabWidget.addTab(self.jobs_tab, "")

        self.verticalLayout.addWidget(self.tabWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 30))
        self.menubar.setObjectName("menubar")
        self.acount = QtWidgets.QMenu(self.menubar)
        self.acount.setObjectName("acount")
        self.files = QtWidgets.QMenu(self.menubar)
        self.files.setObjectName("files")
        self.help = QtWidgets.QMenu(self.menubar)
        self.help.setObjectName("help")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.toolbar = QtWidgets.QToolBar(MainWindow)
        self.toolbar.setObjectName("toolbar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar)
        self.login = QtWidgets.QAction(MainWindow)
        self.login.setObjectName("login")
        self.logout = QtWidgets.QAction(MainWindow)
        self.logout.setObjectName("logout")
        self.upload = QtWidgets.QAction(MainWindow)
        self.upload.setObjectName("upload")
        self.download = QtWidgets.QAction(MainWindow)
        self.download.setObjectName("download")
        self.delete = QtWidgets.QAction(MainWindow)
        self.delete.setObjectName("delete")
        self.how = QtWidgets.QAction(MainWindow)
        self.how.setObjectName("how")
        self.about = QtWidgets.QAction(MainWindow)
        self.about.setObjectName("about")
        self.acount.addSeparator()
        self.acount.addAction(self.login)
        self.acount.addAction(self.logout)
        self.files.addAction(self.upload)
        self.files.addAction(self.download)
        self.files.addAction(self.delete)
        self.help.addAction(self.how)
        self.help.addAction(self.about)
        self.menubar.addAction(self.acount.menuAction())
        self.menubar.addAction(self.files.menuAction())
        self.menubar.addAction(self.help.menuAction())

        # 状态栏
        self.statusbar_msg_label = QtWidgets.QLabel()
        self.statusbar_load_lb = QtWidgets.QLabel()
        self.statusbar_load_movie = QtGui.QMovie("src/loading_more.gif")
        self.statusbar_load_movie.setScaledSize(QtCore.QSize(24, 24))
        self.statusbar_load_lb.setMovie(self.statusbar_load_movie)
        self.statusbar_msg_label.setObjectName("msg_label")
        self.statusbar_load_lb.setObjectName("msg_movie_lb")
        self.statusbar.addWidget(self.statusbar_load_lb)
        self.statusbar.addWidget(self.statusbar_msg_label)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_share_url.setText(_translate("MainWindow", "蓝奏链接"))
        self.btn_extract.setText(_translate("MainWindow", "提取"))
        self.btn_share_select_all.setText(_translate("MainWindow", "全选"))
        self.label_dl_path.setText(_translate("MainWindow", "文件下载路径"))
        self.btn_share_dl.setText(_translate("MainWindow", "下载选中文件"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.share_tab), _translate("MainWindow", "蓝奏云链接提取"))
        self.label_disk_loc.setText(_translate("MainWindow", "位置"))
        self.btn_disk_mkdir.setText(_translate("MainWindow", "新建文件夹"))
        self.btn_disk_select_all.setText(_translate("MainWindow", "全选"))
        self.btn_disk_delete.setText(_translate("MainWindow", "删除"))
        self.btn_disk_dl.setText(_translate("MainWindow", "下载"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.disk_tab), _translate("MainWindow", "我的蓝奏云"))
        self.btn_rec_select_all.setText(_translate("MainWindow", "全选"))
        self.btn_recovery.setText(_translate("MainWindow", "还原"))
        self.btn_rec_delete.setText(_translate("MainWindow", "彻底删除"))
        self.btn_rec_clean.setText(_translate("MainWindow", "清空回收站"))
        self.btn_recovery_all.setText(_translate("MainWindow", "全部还原"))
        self.btn_rec_expire_files.setText(_translate("MainWindow", "过期文件"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.rec_tab), _translate("MainWindow", "回收站"))
        self.btn_jobs_start_all.setText(_translate("MainWindow", "开始所有任务"))
        self.btn_jobs_clean_all.setText(_translate("MainWindow", "删除已完成任务"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.jobs_tab), _translate("MainWindow", "任务管理"))
        self.acount.setTitle(_translate("MainWindow", "登录"))
        self.files.setTitle(_translate("MainWindow", "文件"))
        self.help.setTitle(_translate("MainWindow", "帮助"))
        self.toolbar.setWindowTitle(_translate("MainWindow", "toolBar"))
        self.login.setText(_translate("MainWindow", "登录"))
        self.logout.setText(_translate("MainWindow", "登出"))
        self.upload.setText(_translate("MainWindow", "上传"))
        self.download.setText(_translate("MainWindow", "下载"))
        self.delete.setText(_translate("MainWindow", "删除"))
        self.how.setText(_translate("MainWindow", "使用说明"))
        self.about.setText(_translate("MainWindow", "关于"))
