2021-05-04 18:31:15 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Window 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
Window {
|
|
|
|
id: rootWindow
|
2021-05-17 10:18:41 +00:00
|
|
|
width: 1024
|
|
|
|
height: 840
|
2021-05-04 18:31:15 +00:00
|
|
|
visible: true
|
|
|
|
title: qsTr("Status App Sandbox")
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
property ThemePalette lightTheme: StatusLightTheme {}
|
|
|
|
property ThemePalette darkTheme: StatusDarkTheme { }
|
|
|
|
|
2021-05-04 18:31:15 +00:00
|
|
|
ButtonGroup {
|
|
|
|
id: topicsGroup
|
|
|
|
buttons: tabs.children
|
|
|
|
}
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
ButtonGroup {
|
|
|
|
buttons: switchRow.children
|
|
|
|
}
|
|
|
|
|
2021-05-04 18:31:15 +00:00
|
|
|
Flow {
|
|
|
|
id: tabs
|
2021-05-17 10:18:41 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 100
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
2021-05-04 18:31:15 +00:00
|
|
|
Button {
|
|
|
|
text: "Reload QML"
|
|
|
|
onClicked: app.restartQml()
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
id: iconsTab
|
|
|
|
checkable: true
|
|
|
|
text: "Icons"
|
|
|
|
}
|
2021-05-06 09:20:50 +00:00
|
|
|
Button {
|
|
|
|
id: controlsTab
|
|
|
|
checkable: true
|
|
|
|
text: "Controls"
|
|
|
|
}
|
feat(Layout): introduce StatusAppNavBar
This commit introduces a new `StatusAppNavBar` component that can be used
to create a Status application's tab bar for dedicated tab sections such as
chat, profile, wallet etc.
The component is build in a way that it support declarative and imperative usage
where necessary.
In its most simple form, a `StatusAppNavBar` comes with a single tab button
for the chat section. Such button has to be of type `StatusNavBarTabButton`:
```qml
import StatusQ.Layout 0.1
StatusAppNavBar {
navBarChatButton: StatusNavBarTabButton {
icon.name: "chat"
badge.value: 33
badge.visible: true
tooltip.text: "Chat"
}
}
```
In addition, it's possible to specify a list of `StatusNavBarTabButton` for
other sections of the application using the `navBarTabButtons` property:
```qml
StatusAppNavBar {
...
navBarTabButtons: [
StatusNavBarTabButton {
icon.name: "wallet"
tooltip.text: "Wallet"
},
StatusNavBarTabButton {
icon.name: "browser"
tooltip.text: "Browser"
},
StatusNavBarTabButton {
icon.name: "status-update"
tooltip.text: "Timeline"
}
]
}
```
Lastly, when desired to render tabs for Status community, which can grow
in size, `StatusAppNavBar` exposes a list via the `navBarCommunityTabButtons`
property that can have a `model` and a `delegate`. The `delegate` should also
be a `StatusNavBarTabButton`:
```qml
StatusAppNavBar {
...
navBarCommunityTabButtons.model: someModel.communities
navBarCommunityTabButtons.delegate: StatusNavBarTabButton {
name: model.name
tooltip.text: model.name
anchors.horizontalCenter: parent.horizontalCenter
}
}
```
The amount of community tab buttons can grow as they need until their dedicated
area becomes scrollable, at which point all `navBarTabButtons` will stick to the
bottom of `StatusAppNavBar`.
Closes #18
2021-05-11 14:25:46 +00:00
|
|
|
Button {
|
|
|
|
id: layoutTab
|
|
|
|
checkable: true
|
|
|
|
text: "Layout"
|
|
|
|
}
|
2021-05-05 07:37:01 +00:00
|
|
|
Button {
|
|
|
|
id: otherTab
|
|
|
|
checkable: true
|
|
|
|
text: "Other"
|
|
|
|
}
|
2021-05-17 10:18:41 +00:00
|
|
|
|
|
|
|
Button {
|
|
|
|
id: buttonsTab
|
|
|
|
checkable: true
|
|
|
|
text: "Buttons"
|
|
|
|
}
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
|
|
|
|
|
2021-05-04 18:31:15 +00:00
|
|
|
ScrollView {
|
|
|
|
width: parent.width
|
|
|
|
anchors.top: tabs.bottom
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
contentHeight: rootWindow.height * rootWindow.factor
|
|
|
|
contentWidth: rootWindow.width * rootWindow.factor
|
|
|
|
clip: true
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: lightThemeBg
|
|
|
|
|
|
|
|
width: rootWindow.width
|
|
|
|
height: parent.height
|
|
|
|
color: Theme.palette.baseColor5
|
|
|
|
clip: true
|
2021-05-04 18:31:15 +00:00
|
|
|
scale: rootWindow.factor
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
switch(topicsGroup.checkedButton) {
|
|
|
|
case iconsTab:
|
|
|
|
return iconsComponent;
|
|
|
|
case controlsTab:
|
|
|
|
return controlsComponent;
|
feat(Layout): introduce StatusAppNavBar
This commit introduces a new `StatusAppNavBar` component that can be used
to create a Status application's tab bar for dedicated tab sections such as
chat, profile, wallet etc.
The component is build in a way that it support declarative and imperative usage
where necessary.
In its most simple form, a `StatusAppNavBar` comes with a single tab button
for the chat section. Such button has to be of type `StatusNavBarTabButton`:
```qml
import StatusQ.Layout 0.1
StatusAppNavBar {
navBarChatButton: StatusNavBarTabButton {
icon.name: "chat"
badge.value: 33
badge.visible: true
tooltip.text: "Chat"
}
}
```
In addition, it's possible to specify a list of `StatusNavBarTabButton` for
other sections of the application using the `navBarTabButtons` property:
```qml
StatusAppNavBar {
...
navBarTabButtons: [
StatusNavBarTabButton {
icon.name: "wallet"
tooltip.text: "Wallet"
},
StatusNavBarTabButton {
icon.name: "browser"
tooltip.text: "Browser"
},
StatusNavBarTabButton {
icon.name: "status-update"
tooltip.text: "Timeline"
}
]
}
```
Lastly, when desired to render tabs for Status community, which can grow
in size, `StatusAppNavBar` exposes a list via the `navBarCommunityTabButtons`
property that can have a `model` and a `delegate`. The `delegate` should also
be a `StatusNavBarTabButton`:
```qml
StatusAppNavBar {
...
navBarCommunityTabButtons.model: someModel.communities
navBarCommunityTabButtons.delegate: StatusNavBarTabButton {
name: model.name
tooltip.text: model.name
anchors.horizontalCenter: parent.horizontalCenter
}
}
```
The amount of community tab buttons can grow as they need until their dedicated
area becomes scrollable, at which point all `navBarTabButtons` will stick to the
bottom of `StatusAppNavBar`.
Closes #18
2021-05-11 14:25:46 +00:00
|
|
|
case layoutTab:
|
|
|
|
return layoutComponent;
|
2021-05-17 10:18:41 +00:00
|
|
|
case otherTab:
|
|
|
|
return othersComponent;
|
|
|
|
case buttonsTab:
|
|
|
|
return buttonsComponent;
|
|
|
|
default:
|
|
|
|
return null;
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
feat(Layout): introduce StatusAppNavBar
This commit introduces a new `StatusAppNavBar` component that can be used
to create a Status application's tab bar for dedicated tab sections such as
chat, profile, wallet etc.
The component is build in a way that it support declarative and imperative usage
where necessary.
In its most simple form, a `StatusAppNavBar` comes with a single tab button
for the chat section. Such button has to be of type `StatusNavBarTabButton`:
```qml
import StatusQ.Layout 0.1
StatusAppNavBar {
navBarChatButton: StatusNavBarTabButton {
icon.name: "chat"
badge.value: 33
badge.visible: true
tooltip.text: "Chat"
}
}
```
In addition, it's possible to specify a list of `StatusNavBarTabButton` for
other sections of the application using the `navBarTabButtons` property:
```qml
StatusAppNavBar {
...
navBarTabButtons: [
StatusNavBarTabButton {
icon.name: "wallet"
tooltip.text: "Wallet"
},
StatusNavBarTabButton {
icon.name: "browser"
tooltip.text: "Browser"
},
StatusNavBarTabButton {
icon.name: "status-update"
tooltip.text: "Timeline"
}
]
}
```
Lastly, when desired to render tabs for Status community, which can grow
in size, `StatusAppNavBar` exposes a list via the `navBarCommunityTabButtons`
property that can have a `model` and a `delegate`. The `delegate` should also
be a `StatusNavBarTabButton`:
```qml
StatusAppNavBar {
...
navBarCommunityTabButtons.model: someModel.communities
navBarCommunityTabButtons.delegate: StatusNavBarTabButton {
name: model.name
tooltip.text: model.name
anchors.horizontalCenter: parent.horizontalCenter
}
}
```
The amount of community tab buttons can grow as they need until their dedicated
area becomes scrollable, at which point all `navBarTabButtons` will stick to the
bottom of `StatusAppNavBar`.
Closes #18
2021-05-11 14:25:46 +00:00
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
Row {
|
|
|
|
id: switchRow
|
|
|
|
scale: 0.8
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
|
|
|
Button {
|
|
|
|
checkable: true
|
|
|
|
checked: true
|
|
|
|
text: "Light Theme"
|
|
|
|
onCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
Theme.setTheme(lightTheme)
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-17 10:18:41 +00:00
|
|
|
Button {
|
|
|
|
checkable: true
|
|
|
|
text: "Dark Theme"
|
|
|
|
onCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
Theme.setTheme(darkTheme)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property real maxFactor: 2.0
|
|
|
|
readonly property real minFactor: 0.5
|
|
|
|
|
|
|
|
property real factor: 1.0
|
|
|
|
Action {
|
|
|
|
shortcut: "CTRL+="
|
|
|
|
onTriggered: {
|
|
|
|
if (rootWindow.factor < 2.0)
|
|
|
|
rootWindow.factor += 0.2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
shortcut: "CTRL+-"
|
|
|
|
onTriggered: {
|
|
|
|
if (rootWindow.factor > 0.5)
|
|
|
|
rootWindow.factor -= 0.2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
shortcut: "CTRL+0"
|
|
|
|
onTriggered: {
|
|
|
|
rootWindow.factor = 1.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: iconsComponent
|
|
|
|
Icons {
|
|
|
|
anchors.centerIn: parent
|
2021-05-17 10:18:41 +00:00
|
|
|
iconColor: Theme.palette.primaryColor1
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-05 07:37:01 +00:00
|
|
|
|
2021-05-06 09:20:50 +00:00
|
|
|
Component {
|
|
|
|
id: controlsComponent
|
|
|
|
Controls {
|
|
|
|
anchors.centerIn: parent
|
2021-05-17 10:18:41 +00:00
|
|
|
theme: Theme.palette
|
2021-05-06 09:20:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
feat(Layout): introduce StatusAppNavBar
This commit introduces a new `StatusAppNavBar` component that can be used
to create a Status application's tab bar for dedicated tab sections such as
chat, profile, wallet etc.
The component is build in a way that it support declarative and imperative usage
where necessary.
In its most simple form, a `StatusAppNavBar` comes with a single tab button
for the chat section. Such button has to be of type `StatusNavBarTabButton`:
```qml
import StatusQ.Layout 0.1
StatusAppNavBar {
navBarChatButton: StatusNavBarTabButton {
icon.name: "chat"
badge.value: 33
badge.visible: true
tooltip.text: "Chat"
}
}
```
In addition, it's possible to specify a list of `StatusNavBarTabButton` for
other sections of the application using the `navBarTabButtons` property:
```qml
StatusAppNavBar {
...
navBarTabButtons: [
StatusNavBarTabButton {
icon.name: "wallet"
tooltip.text: "Wallet"
},
StatusNavBarTabButton {
icon.name: "browser"
tooltip.text: "Browser"
},
StatusNavBarTabButton {
icon.name: "status-update"
tooltip.text: "Timeline"
}
]
}
```
Lastly, when desired to render tabs for Status community, which can grow
in size, `StatusAppNavBar` exposes a list via the `navBarCommunityTabButtons`
property that can have a `model` and a `delegate`. The `delegate` should also
be a `StatusNavBarTabButton`:
```qml
StatusAppNavBar {
...
navBarCommunityTabButtons.model: someModel.communities
navBarCommunityTabButtons.delegate: StatusNavBarTabButton {
name: model.name
tooltip.text: model.name
anchors.horizontalCenter: parent.horizontalCenter
}
}
```
The amount of community tab buttons can grow as they need until their dedicated
area becomes scrollable, at which point all `navBarTabButtons` will stick to the
bottom of `StatusAppNavBar`.
Closes #18
2021-05-11 14:25:46 +00:00
|
|
|
Component {
|
|
|
|
id: layoutComponent
|
|
|
|
Layout {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
theme: Theme.palette
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-05 07:37:01 +00:00
|
|
|
Component {
|
|
|
|
id: othersComponent
|
|
|
|
Others {
|
|
|
|
anchors.centerIn: parent
|
2021-05-17 10:18:41 +00:00
|
|
|
theme: Theme.palette
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: buttonsComponent
|
|
|
|
Buttons {
|
|
|
|
anchors.centerIn: parent
|
2021-05-05 07:37:01 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-04 18:31:15 +00:00
|
|
|
}
|