filemanager/qml/main.qml

106 lines
3.2 KiB
QML
Raw Normal View History

2021-03-16 00:02:20 -07:00
import QtQuick 2.12
2021-03-29 01:51:34 -07:00
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
2021-03-16 00:02:20 -07:00
import QtQuick.Window 2.12
2021-04-09 07:49:19 -07:00
import FishUI 1.0 as FishUI
2021-03-16 00:02:20 -07:00
2021-03-29 01:51:34 -07:00
import "./Controls"
2021-04-09 07:49:19 -07:00
FishUI.Window {
2021-03-16 00:02:20 -07:00
id: root
width: settings.width
height: settings.height
minimumWidth: 900
2021-03-29 01:51:34 -07:00
minimumHeight: 580
2021-03-16 00:02:20 -07:00
visible: true
title: qsTr("File Manager")
2021-04-13 10:09:01 -07:00
headerBarHeight: 35 + FishUI.Units.smallSpacing * 3
2021-04-09 07:49:19 -07:00
backgroundColor: FishUI.Theme.secondBackgroundColor
2021-03-16 00:02:20 -07:00
property QtObject settings: GlobalSettings { }
onClosing: {
2021-03-29 01:51:34 -07:00
if (root.visibility !== Window.Maximized &&
root.visibility !== Window.FullScreen) {
settings.width = root.width
settings.height = root.height
}
2021-03-16 00:02:20 -07:00
}
headerBar: Item {
RowLayout {
anchors.fill: parent
2021-04-13 10:09:01 -07:00
anchors.leftMargin: FishUI.Units.smallSpacing * 1.5
anchors.rightMargin: FishUI.Units.smallSpacing * 1.5
anchors.topMargin: FishUI.Units.smallSpacing * 1.5
anchors.bottomMargin: FishUI.Units.smallSpacing * 1.5
2021-03-29 01:51:34 -07:00
2021-04-09 07:49:19 -07:00
spacing: FishUI.Units.smallSpacing
2021-03-16 00:02:20 -07:00
IconButton {
Layout.fillHeight: true
implicitWidth: height
2021-04-09 07:49:19 -07:00
source: FishUI.Theme.darkMode ? "qrc:/images/dark/go-previous.svg"
2021-03-29 01:51:34 -07:00
: "qrc:/images/light/go-previous.svg"
onClicked: _folderPage.goBack()
2021-03-16 00:02:20 -07:00
}
IconButton {
Layout.fillHeight: true
implicitWidth: height
2021-04-09 07:49:19 -07:00
source: FishUI.Theme.darkMode ? "qrc:/images/dark/go-next.svg"
2021-03-29 01:51:34 -07:00
: "qrc:/images/light/go-next.svg"
onClicked: _folderPage.goForward()
2021-03-16 00:02:20 -07:00
}
PathBar {
2021-03-29 01:51:34 -07:00
id: _pathBar
2021-03-16 00:02:20 -07:00
Layout.fillWidth: true
Layout.fillHeight: true
2021-03-29 01:51:34 -07:00
onItemClicked: _folderPage.openUrl(path)
onEditorAccepted: _folderPage.openUrl(path)
2021-03-16 00:02:20 -07:00
}
IconButton {
Layout.fillHeight: true
implicitWidth: height
2021-04-09 07:49:19 -07:00
property var gridSource: FishUI.Theme.darkMode ? "qrc:/images/dark/grid.svg" : "qrc:/images/light/grid.svg"
property var listSource: FishUI.Theme.darkMode ? "qrc:/images/dark/list.svg" : "qrc:/images/light/list.svg"
2021-03-29 01:51:34 -07:00
source: settings.viewMethod === 0 ? listSource : gridSource
onClicked: {
2021-04-05 09:20:56 -07:00
settings.viewMethod ^= 1 // reverse settings.viewMethod
2021-03-29 01:51:34 -07:00
}
2021-03-16 00:02:20 -07:00
}
}
}
2021-03-29 01:51:34 -07:00
RowLayout {
2021-03-16 00:02:20 -07:00
anchors.fill: parent
2021-03-29 01:51:34 -07:00
spacing: 0
2021-03-16 00:02:20 -07:00
2021-03-29 01:51:34 -07:00
SideBar {
id: _sideBar
2021-03-16 00:02:20 -07:00
Layout.fillHeight: true
2021-04-14 08:40:22 -07:00
width: 180 + FishUI.Units.largeSpacing
2021-03-29 01:51:34 -07:00
onClicked: _folderPage.openUrl(path)
}
2021-03-16 00:02:20 -07:00
2021-03-29 01:51:34 -07:00
FolderPage {
id: _folderPage
Layout.fillWidth: true
Layout.fillHeight: true
onCurrentUrlChanged: {
_sideBar.updateSelection(currentUrl)
_pathBar.updateUrl(currentUrl)
}
onRequestPathEditor: {
_pathBar.openEditor()
2021-03-16 00:02:20 -07:00
}
}
}
}