Initial UI
This commit is contained in:
1 parent
4d52c8cc60
commit
3c0037cfc9
29 files changed
+1367
-2
No files matched your search
@@ -0,0 +1,107 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Dialogs
|
||||
import Asteria
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
width: 1024
|
||||
height: 768
|
||||
visible: true
|
||||
title: "Asteria"
|
||||
color: Theme.backgroundDeepest
|
||||
|
||||
FontLoader {
|
||||
id: materialIcons
|
||||
source: "qrc:/Asteria/src/assets/MaterialIconsOutlined-Regular.otf"
|
||||
}
|
||||
|
||||
property bool sidebarOpen: false
|
||||
property string currentPage: "starter"
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
|
||||
SideBar {
|
||||
id: sidebar
|
||||
height: parent.height
|
||||
sidebarOpen: window.sidebarOpen
|
||||
onCloseDrawer: window.sidebarOpen = false
|
||||
onNavigateTo: function(page) {
|
||||
window.currentPage = page
|
||||
window.sidebarOpen = false
|
||||
}
|
||||
onOpenFile: {
|
||||
fileDialog.open()
|
||||
window.sidebarOpen = false
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - sidebar.width
|
||||
height: parent.height
|
||||
|
||||
Header {
|
||||
id: header
|
||||
width: parent.width
|
||||
sidebarOpen: window.sidebarOpen
|
||||
currentPage: window.currentPage
|
||||
onMenuClicked: window.sidebarOpen = true
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
width: parent.width
|
||||
height: parent.height - header.height - (footerLoader.active ? Theme.footerHeight : 0)
|
||||
sourceComponent: {
|
||||
switch (window.currentPage) {
|
||||
case "reader": return readerComponent
|
||||
case "settings": return settingsComponent
|
||||
default: return starterComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: footerLoader
|
||||
width: parent.width
|
||||
active: window.currentPage === "reader"
|
||||
sourceComponent: Footer {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: starterComponent
|
||||
StarterPage {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: readerComponent
|
||||
ReaderPage {}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: settingsComponent
|
||||
SettingsPage {}
|
||||
}
|
||||
|
||||
ErrorPopup {
|
||||
anchors.fill: parent
|
||||
z: 3000
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
title: "Open Book"
|
||||
nameFilters: ["Book files (*.txt *.fb2 *.epub *.pdf *.doc *.rtf *.html *.htm *.docx *.djvu *.odt *.chm)", "All files (*)"]
|
||||
onAccepted: bookController.openBook(selectedFile)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: bookController
|
||||
function onBookReady() {
|
||||
window.currentPage = "reader"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user