Initial UI

This commit is contained in:
Agel committed 2026-03-15 20:33:36 +01:00
1 parent 4d52c8cc60
commit 3c0037cfc9
29 files changed
+1367 -2

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
import QtQuick
import QtQuick.Controls
import Asteria
Rectangle {
id: overlay
color: Theme.overlayBg
visible: bookController.errorMessage !== ""
MouseArea {
anchors.fill: parent
onClicked: {} // Block clicks through overlay
}
Column {
anchors.centerIn: parent
spacing: 20
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: bookController.errorMessage
font.pixelSize: 15
color: Theme.readingText
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
width: Math.min(overlay.width * 0.6, 400)
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Ok"
contentItem: Text {
text: parent.text
font.pixelSize: 14
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
}
background: Rectangle {
implicitWidth: 80
implicitHeight: 36
radius: 4
color: parent.hovered ? Qt.lighter(Theme.primaryAccent, 1.15) : Theme.primaryAccent
}
onClicked: bookController.errorMessage = ""
}
}
}
+25
View File
@@ -0,0 +1,25 @@
import QtQuick
import Asteria
Rectangle {
height: Theme.footerHeight
color: Theme.footerBg
Rectangle {
width: parent.width
height: 1
color: Theme.divider
anchors.top: parent.top
}
Text {
anchors.verticalCenter: parent.verticalCenter
x: parent.width * 0.5
text: bookController.hasBook
? "Chapter " + (readingModel.currentChapter + 1) + " / " + readingModel.totalChapters
: ""
font.pixelSize: 11
font.bold: true
color: Theme.dimText
}
}
+85
View File
@@ -0,0 +1,85 @@
import QtQuick
import QtQuick.Controls
import Asteria
Rectangle {
id: header
height: Theme.headerHeight
color: Theme.surface
property bool sidebarOpen: false
property string currentPage: "starter"
signal menuClicked()
Button {
id: menuButton
anchors.left: parent.left
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
visible: !header.sidebarOpen
flat: true
contentItem: Text {
text: "\u2630"
font.pixelSize: 24
color: Theme.buttonAccent
}
background: Item {}
onClicked: header.menuClicked()
}
Text {
anchors.centerIn: parent
text: {
switch (header.currentPage) {
case "settings": return "Settings"
case "reader": return bookController.bookTitle || ""
default: return ""
}
}
font.pixelSize: 16
color: Theme.headerText
}
Row {
anchors.right: parent.right
anchors.rightMargin: parent.width * 0.02
anchors.verticalCenter: parent.verticalCenter
spacing: 8
Text {
id: clockText
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 16
font.bold: true
color: Theme.dimText
Timer {
running: true
repeat: true
interval: 1000
triggeredOnStart: true
onTriggered: {
var d = new Date()
var h = d.getHours() % 12
if (h === 0) h = 12
var m = d.getMinutes().toString().padStart(2, '0')
var s = d.getSeconds().toString().padStart(2, '0')
var ampm = d.getHours() >= 12 ? "PM" : "AM"
clockText.text = h + ":" + m + ":" + s + " " + ampm
}
}
}
Text {
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 12
font.bold: true
color: Theme.counterText
visible: header.currentPage === "reader" && bookController.hasBook
text: bookController.hasBook
? (readingModel.currentChapter + 1) + "/" + readingModel.totalChapters
: ""
}
}
}
+41
View File
@@ -0,0 +1,41 @@
import QtQuick
import QtQuick.Controls
import Asteria
Rectangle {
gradient: Gradient {
GradientStop { position: 0.0; color: Theme.gradientTop }
GradientStop { position: 1.0; color: Theme.gradientBottom }
}
Flickable {
anchors.fill: parent
anchors.margins: 12
contentHeight: contentText.implicitHeight
clip: true
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
contentItem: Rectangle {
implicitWidth: 18
radius: 3
color: Theme.scrollbarThumb
}
background: Rectangle {
implicitWidth: 18
color: Theme.scrollbarTrack
}
}
Text {
id: contentText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
textFormat: Text.RichText
font.pixelSize: 16
lineHeight: 1.6
color: Theme.readingText
text: bookController.hasBook ? readingModel.chapterContent : "Open a book to start reading"
}
}
}
+99
View File
@@ -0,0 +1,99 @@
import QtQuick
import QtQuick.Controls
import Asteria
Rectangle {
id: sidebar
width: sidebarOpen ? Theme.sidebarWidth : 0
clip: true
color: Theme.surface
property bool sidebarOpen: false
signal closeDrawer()
signal navigateTo(string page)
signal openFile()
Behavior on width {
NumberAnimation {
duration: sidebarOpen ? Theme.animDurationOpen : Theme.animDurationClose
easing.type: Easing.OutQuad
}
}
Text {
anchors.left: parent.left
anchors.leftMargin: 16
y: Theme.headerHeight / 2 - height / 2
text: "Asteria"
font.pixelSize: 18
font.bold: true
color: Theme.uiText
}
// Close button aligned with main header row
Button {
anchors.right: parent.right
anchors.rightMargin: 12
y: Theme.headerHeight / 2 - height / 2
z: 1
flat: true
contentItem: Text {
text: "\ue5cb"
font.family: "Material Icons Outlined"
font.pixelSize: 24
color: Theme.sidebarButtonText
}
background: Item {}
onClicked: sidebar.closeDrawer()
}
Column {
y: Theme.headerHeight
width: Theme.sidebarWidth
SideBarButton {
iconText: "\ue86d"
title: "Book"
onClicked: sidebar.navigateTo("reader")
}
SideBarButton {
iconText: "\ue30a"
title: "Files"
onClicked: sidebar.openFile()
}
// Divider
Rectangle {
width: parent.width
height: 1
color: Theme.divider
}
SideBarButton {
iconText: "\ue3a9"
title: "Dark Theme"
onClicked: {} // Non-functional
}
SideBarButton {
iconText: "\ue3a6"
title: "Light Theme"
onClicked: {} // Non-functional
}
// Divider
Rectangle {
width: parent.width
height: 1
color: Theme.divider
}
SideBarButton {
iconText: "\ue8b8"
title: "Settings"
onClicked: sidebar.navigateTo("settings")
}
}
}
+43
View File
@@ -0,0 +1,43 @@
import QtQuick
import QtQuick.Controls
import Asteria
Rectangle {
id: root
height: 48
width: parent ? parent.width : 240
color: mouseArea.containsMouse ? Qt.lighter(Theme.headerBg, 1.3) : "transparent"
property string iconText: ""
property string title: ""
signal clicked()
Row {
anchors.fill: parent
anchors.leftMargin: 16
spacing: 16
Text {
anchors.verticalCenter: parent.verticalCenter
text: root.iconText
font.family: "Material Icons Outlined"
font.pixelSize: 24
color: Theme.sidebarButtonText
}
Text {
anchors.verticalCenter: parent.verticalCenter
text: root.title
font.pixelSize: 14
color: Theme.sidebarButtonText
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
}
}