filemanager/qml/main.qml

124 lines
3.8 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
import MeuiKit 1.0 as Meui
2021-03-29 01:51:34 -07:00
import "./Controls"
2021-03-16 00:02:20 -07:00
Meui.Window {
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")
headerBarHeight: 35 + Meui.Units.largeSpacing
backgroundColor: Meui.Theme.secondBackgroundColor
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-03-29 01:51:34 -07:00
anchors.leftMargin: Meui.Units.smallSpacing
2021-03-16 00:02:20 -07:00
anchors.rightMargin: Meui.Units.smallSpacing
2021-03-29 01:51:34 -07:00
anchors.topMargin: Meui.Units.smallSpacing
anchors.bottomMargin: Meui.Units.smallSpacing
2021-03-16 00:02:20 -07:00
spacing: Meui.Units.smallSpacing
IconButton {
Layout.fillHeight: true
implicitWidth: height
2021-03-29 01:51:34 -07:00
source: Meui.Theme.darkMode ? "qrc:/images/dark/go-previous.svg"
: "qrc:/images/light/go-previous.svg"
onClicked: _folderPage.goBack()
2021-03-16 00:02:20 -07:00
}
IconButton {
Layout.fillHeight: true
implicitWidth: height
2021-03-29 01:51:34 -07:00
source: Meui.Theme.darkMode ? "qrc:/images/dark/go-next.svg"
: "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-03-29 01:51:34 -07:00
property var gridSource: Meui.Theme.darkMode ? "qrc:/images/dark/grid.svg" : "qrc:/images/light/grid.svg"
property var listSource: Meui.Theme.darkMode ? "qrc:/images/dark/list.svg" : "qrc:/images/light/list.svg"
source: settings.viewMethod === 0 ? listSource : gridSource
onClicked: {
if (settings.viewMethod === 1)
settings.viewMethod = 0
else
settings.viewMethod = 1
}
2021-03-16 00:02:20 -07:00
}
2021-03-29 01:51:34 -07:00
// IconButton {
// Layout.fillHeight: true
// implicitWidth: height
// source: Meui.Theme.darkMode ? "qrc:/images/dark/grid.svg" : "qrc:/images/light/grid.svg"
// onClicked: settings.viewMethod = 1
// }
// IconButton {
// Layout.fillHeight: true
// implicitWidth: height
// source: Meui.Theme.darkMode ? "qrc:/images/dark/list.svg" : "qrc:/images/light/list.svg"
// onClicked: settings.viewMethod = 0
// }
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
anchors.topMargin: 2
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-03-29 01:51:34 -07:00
width: 200 + Meui.Units.largeSpacing
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
}
}
}
}