122 lines
3.0 KiB
QML
122 lines
3.0 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import Asteria
|
|
|
|
Rectangle {
|
|
id: sidebar
|
|
width: sidebarOpen ? ThemeManager.sidebarWidth : 0
|
|
clip: true
|
|
color: ThemeManager.currentTheme.surface
|
|
|
|
property bool sidebarOpen: false
|
|
|
|
signal closeDrawer()
|
|
signal navigateTo(string page)
|
|
signal openFile()
|
|
signal closeBook()
|
|
|
|
Behavior on width {
|
|
NumberAnimation {
|
|
duration: sidebarOpen ? ThemeManager.animDurationOpen : ThemeManager.animDurationClose
|
|
easing.type: Easing.OutQuad
|
|
}
|
|
}
|
|
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 16
|
|
y: ThemeManager.headerHeight / 2 - height / 2
|
|
text: "Asteria"
|
|
font.pixelSize: 18
|
|
font.bold: true
|
|
color: ThemeManager.currentTheme.uiText
|
|
}
|
|
|
|
// Close button aligned with main header row
|
|
FlatIconButton {
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 12
|
|
y: ThemeManager.headerHeight / 2 - height / 2
|
|
z: 1
|
|
iconText: "\ue5cb"
|
|
iconSize: 24
|
|
iconColor: ThemeManager.currentTheme.sidebarButtonText
|
|
onClicked: sidebar.closeDrawer()
|
|
}
|
|
|
|
Column {
|
|
id: navColumn
|
|
y: ThemeManager.headerHeight
|
|
width: ThemeManager.sidebarWidth
|
|
|
|
SideBarButton {
|
|
visible: book.hasBook
|
|
iconText: "\ue86d"
|
|
title: "Book"
|
|
onClicked: sidebar.navigateTo("reader")
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue02f"
|
|
title: "History"
|
|
onClicked: sidebar.navigateTo("history")
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue30a"
|
|
title: "Files"
|
|
onClicked: sidebar.openFile()
|
|
}
|
|
|
|
SideBarButton {
|
|
visible: book.hasBook
|
|
iconText: "\ue5cd"
|
|
title: "Close Book"
|
|
onClicked: sidebar.closeBook()
|
|
}
|
|
|
|
// Divider
|
|
Rectangle {
|
|
width: parent.width
|
|
height: 1
|
|
color: ThemeManager.currentTheme.divider
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue3a9"
|
|
title: "Dark Theme"
|
|
onClicked: ThemeManager.setDarkTheme()
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue3a6"
|
|
title: "Light Theme"
|
|
onClicked: ThemeManager.setLightTheme()
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue40a"
|
|
title: "Custom Theme"
|
|
rightIconText: "\ue3c9"
|
|
onClicked: ThemeManager.setCustomTheme()
|
|
onRightIconClicked: {
|
|
ThemeManager.setCustomTheme()
|
|
sidebar.navigateTo("customTheme")
|
|
}
|
|
}
|
|
|
|
// Divider
|
|
Rectangle {
|
|
width: parent.width
|
|
height: 1
|
|
color: ThemeManager.currentTheme.divider
|
|
}
|
|
|
|
SideBarButton {
|
|
iconText: "\ue8b8"
|
|
title: "Settings"
|
|
onClicked: sidebar.navigateTo("settings")
|
|
}
|
|
}
|
|
}
|