"""This file was generated by pyuic6 from the .ui file provided from Qt's physical source code.

This file should be considered a template and should be modified to fit the needs of the project.

"""

from __future__ import annotations

from typing import TYPE_CHECKING, Callable

from qtpy import QtCore
from qtpy.QtWidgets import (
    QApplication,
    QComboBox,
    QDialogButtonBox,
    QFrame,
    QGridLayout,
    QHBoxLayout,
    QLabel,
    QSizePolicy,
    QSplitter,
    QStackedWidget,
    QToolButton,
    QVBoxLayout,
    QWidget,
)

from utility.gui.qt.adapters.filesystem.qfiledialog.private.qfiledialog_p import (
    QFileDialogComboBox,
    QFileDialogLineEdit,
    QFileDialogListView,
    QFileDialogTreeView,
)
from utility.gui.qt.adapters.filesystem.qfiledialog.private.qsidebar_p import QSidebar

if TYPE_CHECKING:
    from qtpy.QtWidgets import QFileDialog


class Ui_QFileDialog:  # noqa: N801
    def setupUi(self, QFileDialog: QFileDialog):  # noqa: N803, PLR0915
        QFileDialog.setObjectName("QFileDialog")
        QFileDialog.resize(521, 316)
        QFileDialog.setSizeGripEnabled(True)

        # Main layout
        self.gridlayout: QGridLayout = QGridLayout(QFileDialog)
        self.gridlayout.setObjectName("gridlayout")

        # Look In label
        self.lookInLabel: QLabel = QLabel(parent=QFileDialog)
        self.lookInLabel.setObjectName("lookInLabel")
        self.gridlayout.addWidget(self.lookInLabel, 0, 0, 1, 1)

        # Toolbar layout
        self.hboxlayout: QHBoxLayout = QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")

        # Look In combo box
        self.lookInCombo: QFileDialogComboBox = QFileDialogComboBox(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.lookInCombo.sizePolicy().hasHeightForWidth())
        self.lookInCombo.setSizePolicy(sizePolicy)
        self.lookInCombo.setMinimumSize(QtCore.QSize(50, 0))
        self.lookInCombo.setObjectName("lookInCombo")
        self.hboxlayout.addWidget(self.lookInCombo)

        # Toolbar buttons
        self.backButton: QToolButton = QToolButton(parent=QFileDialog)
        self.backButton.setObjectName("backButton")
        self.hboxlayout.addWidget(self.backButton)

        self.forwardButton: QToolButton = QToolButton(parent=QFileDialog)
        self.forwardButton.setObjectName("forwardButton")
        self.hboxlayout.addWidget(self.forwardButton)

        self.toParentButton: QToolButton = QToolButton(parent=QFileDialog)
        self.toParentButton.setObjectName("toParentButton")
        self.hboxlayout.addWidget(self.toParentButton)

        self.newFolderButton: QToolButton = QToolButton(parent=QFileDialog)
        self.newFolderButton.setObjectName("newFolderButton")
        self.hboxlayout.addWidget(self.newFolderButton)

        self.listModeButton: QToolButton = QToolButton(parent=QFileDialog)
        self.listModeButton.setObjectName("listModeButton")
        self.hboxlayout.addWidget(self.listModeButton)

        self.detailModeButton: QToolButton = QToolButton(parent=QFileDialog)
        self.detailModeButton.setObjectName("detailModeButton")
        self.hboxlayout.addWidget(self.detailModeButton)

        self.gridlayout.addLayout(self.hboxlayout, 0, 1, 1, 2)

        # Splitter
        self.splitter: QSplitter = QSplitter(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth())
        self.splitter.setSizePolicy(sizePolicy)
        self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
        self.splitter.setChildrenCollapsible(False)
        self.splitter.setObjectName("splitter")

        # Sidebar
        self.sidebar: QSidebar = QSidebar(parent=self.splitter)
        self.sidebar.setObjectName("sidebar")

        # Main frame
        self.frame: QFrame = QFrame(parent=self.splitter)
        self.frame.setFrameShape(QFrame.Shape.NoFrame)
        self.frame.setFrameShadow(QFrame.Shadow.Raised)
        self.frame.setObjectName("frame")

        self.vboxlayout: QVBoxLayout = QVBoxLayout(self.frame)
        self.vboxlayout.setContentsMargins(0, 0, 0, 0)
        self.vboxlayout.setSpacing(0)
        self.vboxlayout.setObjectName("vboxlayout")

        # Stacked widget for list and tree views
        self.stackedWidget: QStackedWidget = QStackedWidget(parent=self.frame)
        self.stackedWidget.setObjectName("stackedWidget")

        # List view page
        self.page: QWidget = QWidget()
        self.page.setObjectName("page")
        self.vboxlayout1: QVBoxLayout = QVBoxLayout(self.page)
        self.vboxlayout1.setContentsMargins(0, 0, 0, 0)
        self.vboxlayout1.setSpacing(0)
        self.vboxlayout1.setObjectName("vboxlayout1")
        self.listView: QFileDialogListView = QFileDialogListView(parent=self.page)
        self.listView.setObjectName("listView")
        self.vboxlayout1.addWidget(self.listView)
        self.stackedWidget.addWidget(self.page)

        # Tree view page
        self.page_2: QWidget = QWidget()
        self.page_2.setObjectName("page_2")
        self.vboxlayout2: QVBoxLayout = QVBoxLayout(self.page_2)
        self.vboxlayout2.setContentsMargins(0, 0, 0, 0)
        self.vboxlayout2.setSpacing(0)
        self.vboxlayout2.setObjectName("vboxlayout2")
        self.treeView: QFileDialogTreeView = QFileDialogTreeView(parent=self.page_2)
        self.treeView.setObjectName("treeView")
        self.vboxlayout2.addWidget(self.treeView)
        self.stackedWidget.addWidget(self.page_2)

        self.vboxlayout.addWidget(self.stackedWidget)
        self.gridlayout.addWidget(self.splitter, 1, 0, 1, 3)

        # File name label and edit
        self.fileNameLabel: QLabel = QLabel(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fileNameLabel.sizePolicy().hasHeightForWidth())
        self.fileNameLabel.setSizePolicy(sizePolicy)
        self.fileNameLabel.setMinimumSize(QtCore.QSize(0, 0))
        self.fileNameLabel.setObjectName("fileNameLabel")
        self.gridlayout.addWidget(self.fileNameLabel, 2, 0, 1, 1)

        self.fileNameEdit: QFileDialogLineEdit = QFileDialogLineEdit(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fileNameEdit.sizePolicy().hasHeightForWidth())
        self.fileNameEdit.setSizePolicy(sizePolicy)
        self.fileNameEdit.setObjectName("fileNameEdit")
        self.gridlayout.addWidget(self.fileNameEdit, 2, 1, 1, 1)

        # Button box
        self.buttonBox: QDialogButtonBox = QDialogButtonBox(parent=QFileDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Orientation.Vertical)
        self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel | QDialogButtonBox.StandardButton.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridlayout.addWidget(self.buttonBox, 2, 2, 2, 1)

        # File type label and combo
        self.fileTypeLabel: QLabel = QLabel(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fileTypeLabel.sizePolicy().hasHeightForWidth())
        self.fileTypeLabel.setSizePolicy(sizePolicy)
        self.fileTypeLabel.setObjectName("fileTypeLabel")
        self.gridlayout.addWidget(self.fileTypeLabel, 3, 0, 1, 1)

        self.fileTypeCombo: QComboBox = QComboBox(parent=QFileDialog)
        sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fileTypeCombo.sizePolicy().hasHeightForWidth())
        self.fileTypeCombo.setSizePolicy(sizePolicy)
        self.fileTypeCombo.setObjectName("fileTypeCombo")
        self.gridlayout.addWidget(self.fileTypeCombo, 3, 1, 1, 1)

        self.retranslateUi(QFileDialog)
        self.stackedWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(QFileDialog)
        QFileDialog.setTabOrder(self.lookInCombo, self.backButton)
        QFileDialog.setTabOrder(self.backButton, self.forwardButton)
        QFileDialog.setTabOrder(self.forwardButton, self.toParentButton)
        QFileDialog.setTabOrder(self.toParentButton, self.newFolderButton)
        QFileDialog.setTabOrder(self.newFolderButton, self.listModeButton)
        QFileDialog.setTabOrder(self.listModeButton, self.detailModeButton)
        QFileDialog.setTabOrder(self.detailModeButton, self.sidebar)
        QFileDialog.setTabOrder(self.sidebar, self.treeView)
        QFileDialog.setTabOrder(self.treeView, self.listView)
        QFileDialog.setTabOrder(self.listView, self.fileNameEdit)
        QFileDialog.setTabOrder(self.fileNameEdit, self.buttonBox)
        QFileDialog.setTabOrder(self.buttonBox, self.fileTypeCombo)

    def retranslateUi(self, QFileDialog: QFileDialog):  # noqa: N803
        _translate: Callable[[str, str], str] = QApplication.instance().translate  # pyright: ignore[reportOptionalMemberAccess]
        self.lookInLabel.setText(_translate("QFileDialog", "Look in:"))

        self.backButton.setToolTip(_translate("QFileDialog", "Back"))
        self.backButton.setAccessibleName(_translate("QFileDialog", "Back"))
        self.backButton.setAccessibleDescription(_translate("QFileDialog", "Go back"))
        self.backButton.setShortcut(_translate("QFileDialog", "Alt+Left"))

        self.forwardButton.setToolTip(_translate("QFileDialog", "Forward"))
        self.forwardButton.setAccessibleName(_translate("QFileDialog", "Forward"))
        self.forwardButton.setAccessibleDescription(_translate("QFileDialog", "Go forward"))
        self.forwardButton.setShortcut(_translate("QFileDialog", "Alt+Right"))

        self.toParentButton.setToolTip(_translate("QFileDialog", "Parent Directory"))
        self.toParentButton.setAccessibleName(_translate("QFileDialog", "Parent Directory"))
        self.toParentButton.setAccessibleDescription(_translate("QFileDialog", "Go to the parent directory"))
        self.toParentButton.setShortcut(_translate("QFileDialog", "Alt+Up"))

        self.newFolderButton.setToolTip(_translate("QFileDialog", "Create New Folder"))
        self.newFolderButton.setAccessibleName(_translate("QFileDialog", "Create New Folder"))
        self.newFolderButton.setAccessibleDescription(_translate("QFileDialog", "Create a New Folder"))

        self.listModeButton.setToolTip(_translate("QFileDialog", "List View"))
        self.listModeButton.setAccessibleName(_translate("QFileDialog", "List View"))
        self.listModeButton.setAccessibleDescription(_translate("QFileDialog", "Change to list view mode"))

        self.detailModeButton.setToolTip(_translate("QFileDialog", "Detail View"))
        self.detailModeButton.setAccessibleName(_translate("QFileDialog", "Detail View"))
        self.detailModeButton.setAccessibleDescription(_translate("QFileDialog", "Change to detail view mode"))

        self.sidebar.setAccessibleName(_translate("QFileDialog", "Sidebar"))
        self.sidebar.setAccessibleDescription(_translate("QFileDialog", "List of places and bookmarks"))

        self.listView.setAccessibleName(_translate("QFileDialog", "Files"))
        self.treeView.setAccessibleName(_translate("QFileDialog", "Files"))
        self.fileTypeLabel.setText(_translate("QFileDialog", "Files of type:"))
