Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a random verse on home view at application launch #16

Merged
merged 7 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/verses/Verses/bible_verses.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
"data": "Is/55"
},
{
"verse": "If thou turn away thy foot from the sabbath, from doing thypleasure on my holy day; and call the sabbath a delight, the holy of Yahweh, honourable; and shalt honour him, not doing thine own ways, nor finding thine own pleasure, nor speaking thine own words: Then shalt thou delight thyself in Yahweh; and I will cause thee to ride upon the high places of the earth, and feed thee with the heritage of Jacob thy father: for the mouth of Yahweh hath spoken it.",
"verse": "If thou turn away thy foot from the sabbath, from doing thy pleasure on my holy day; and call the sabbath a delight, the holy of Yahweh, honourable; and shalt honour him, not doing thine own ways, nor finding thine own pleasure, nor speaking thine own words: Then shalt thou delight thyself in Yahweh; and I will cause thee to ride upon the high places of the earth, and feed thee with the heritage of Jacob thy father: for the mouth of Yahweh hath spoken it.",
"place": "Isaiah 58:13-14",
"data": "Is/58"
},
Expand Down
61 changes: 45 additions & 16 deletions src/biblenotify/ui/BibleNotify/Views/HomeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,65 @@ Item {
id: root

property var setTimeView
property string verseText
property string verseReference
Correct-Syntax marked this conversation as resolved.
Show resolved Hide resolved

signal sendNotification

ColumnLayout {
anchors.fill: parent

Image {
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
source: "qrc:/illustration-with_text.svg"
antialiasing: true

BNLabel {
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 600
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 30
Correct-Syntax marked this conversation as resolved.
Show resolved Hide resolved
color: "#24292f"
text: verseText
}

Item {
height: 10
}

BNLabel {
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: root.width - root.anchors.leftMargin - root.anchors.rightMargin
horizontalAlignment: Text.AlignHCenter
font {
pixelSize: 20;
italic: true;
Correct-Syntax marked this conversation as resolved.
Show resolved Hide resolved
}
color: "#616161"
text: verseReference
}
}

Item {
height: 20
height: 10
}

BNButton {
id: toggleNotificationsButton
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
isAccented: true
text: toggleNotificationsButton.toggled ? qsTr("Stop Sending Notifications") : qsTr("Start Sending Notifications")
icon: toggleNotificationsButton.toggled ? "pause-circle" : "play-circle"
onClicked: Notifications.setNotificationsEnabled(toggled)
}

BNButton {
id: changeTimeButton
Layout.alignment: Qt.AlignHCenter
text: qsTr("Change Notification Time")
onClicked: root.StackView.view.push(setTimeView)
BNButton {
id: toggleNotificationsButton
Layout.alignment: Qt.AlignHCenter
isAccented: true
text: toggleNotificationsButton.toggled ? qsTr("Stop Sending Notifications") : qsTr("Start Sending Notifications")
icon: toggleNotificationsButton.toggled ? "pause-circle" : "play-circle"
onClicked: Notifications.setNotificationsEnabled(toggled)
}

BNButton {
id: changeTimeButton
Layout.alignment: Qt.AlignHCenter
text: qsTr("Change Notification Time")
onClicked: root.StackView.view.push(setTimeView)
}
}

Item {
Expand Down
25 changes: 9 additions & 16 deletions src/biblenotify/ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Window {
color: "transparent"

property var resizeMargins: 8
property var verse: Notifications.loadVerses()

function focusWindow() {
root.show()
Expand Down Expand Up @@ -229,8 +230,7 @@ Window {
icon: "book"
onClicked: {
if (readerView.chapterLocation == "") {
var verse = Notifications.loadVerses()
readerView.chapterLocation = verse[2]
readerView.chapterLocation = root.verse[2]
}

stackView.push(readerView)
Expand Down Expand Up @@ -283,17 +283,19 @@ Window {
HomeView {
id: homeView
setTimeView: setTimeView

Component.onCompleted: {
// TODO: Why doesn't this work?
// Loader.printHello()
Correct-Syntax marked this conversation as resolved.
Show resolved Hide resolved
}
verseText: root.verse[0]
verseReference: root.verse[1]

onSendNotification: {
var verse = Notifications.loadVerses()
readerView.chapterLocation = verse[2]
systemTray.showMessage(verse[1], verse[0])
}

Component.onCompleted: {
// TODO: Why doesn't this work?
// Loader.printHello()
}
}

ReaderView {
Expand All @@ -307,15 +309,6 @@ Window {
visible: false
}

BNLabel {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
text: qsTr("Bible Notify © 2022 Bible Notify Contributors")
font.pixelSize: 10
color: "#757575"
}

AboutDialog {
id: aboutDialog
}
Expand Down