refactor(ActivityCenterTopBar): make use of StatusQ components
This commit is contained in:
parent
845640bd13
commit
7f1b62fe32
|
@ -2,10 +2,12 @@ import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import "../../../../shared"
|
|
||||||
import "../../../../shared/popups"
|
import StatusQ.Core 0.1
|
||||||
import "../../../../shared/panels"
|
import StatusQ.Core.Theme 0.1
|
||||||
import "../../../../shared/status"
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Popups 0.1
|
||||||
|
|
||||||
import ".."
|
import ".."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -33,49 +35,45 @@ Item {
|
||||||
height: allBtn.height
|
height: allBtn.height
|
||||||
spacing: Style.current.padding
|
spacing: Style.current.padding
|
||||||
|
|
||||||
StatusButton {
|
StatusFlatButton {
|
||||||
id: allBtn
|
id: allBtn
|
||||||
//% "All"
|
//% "All"
|
||||||
text: qsTrId("all")
|
text: qsTrId("all")
|
||||||
type: "secondary"
|
size: StatusBaseButton.Size.Small
|
||||||
size: "small"
|
|
||||||
highlighted: root.allBtnHighlighted
|
highlighted: root.allBtnHighlighted
|
||||||
onClicked: {
|
onClicked: root.allBtnClicked();
|
||||||
root.allBtnClicked();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
StatusFlatButton {
|
||||||
id: mentionsBtn
|
id: mentionsBtn
|
||||||
//% "Mentions"
|
//% "Mentions"
|
||||||
text: qsTrId("mentions")
|
text: qsTrId("mentions")
|
||||||
type: "secondary"
|
enabled: hasMentions
|
||||||
size: "small"
|
size: StatusBaseButton.Size.Small
|
||||||
highlighted: root.mentionsBtnHighlighted
|
highlighted: root.mentionsBtnHighlighted
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.mentionsBtnClicked();
|
root.mentionsBtnClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
StatusFlatButton {
|
||||||
id: repliesbtn
|
id: repliesbtn
|
||||||
//% "Replies"
|
//% "Replies"
|
||||||
text: qsTrId("replies")
|
text: qsTrId("replies")
|
||||||
type: "secondary"
|
enabled: hasReplies
|
||||||
size: "small"
|
size: StatusBaseButton.Size.Small
|
||||||
highlighted: root.repliesBtnHighlighted
|
highlighted: root.repliesBtnHighlighted
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.repliesBtnClicked();
|
root.repliesBtnClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusButton {
|
// StatusFlatButton {
|
||||||
// id: contactRequestsBtn
|
// id: contactRequestsBtn
|
||||||
// //% "Contact requests"
|
// //% "Contact requests"
|
||||||
// text: qsTrId("contact-requests")
|
// text: qsTrId("contact-requests")
|
||||||
// enabled: hasContactRequests
|
// enabled: hasContactRequests
|
||||||
// type: "secondary"
|
// size: StatusBaseButton.Size.Small
|
||||||
// size: "small"
|
|
||||||
// highlighted: activityCenter.currentFilter === ActivityCenter.Filter.ContactRequests
|
// highlighted: activityCenter.currentFilter === ActivityCenter.Filter.ContactRequests
|
||||||
// onClicked: activityCenter.currentFilter = ActivityCenter.Filter.ContactRequests
|
// onClicked: activityCenter.currentFilter = ActivityCenter.Filter.ContactRequests
|
||||||
// }
|
// }
|
||||||
|
@ -89,12 +87,9 @@ Item {
|
||||||
height: markAllReadBtn.height
|
height: markAllReadBtn.height
|
||||||
spacing: Style.current.padding
|
spacing: Style.current.padding
|
||||||
|
|
||||||
StatusIconButton {
|
StatusFlatRoundButton {
|
||||||
id: markAllReadBtn
|
id: markAllReadBtn
|
||||||
icon.name: "double-check"
|
icon.name: "double-checkmark"
|
||||||
iconColor: Style.current.primary
|
|
||||||
icon.width: 24
|
|
||||||
icon.height: 24
|
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
onClicked: markAllReadClicked()
|
onClicked: markAllReadClicked()
|
||||||
|
@ -106,20 +101,22 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusContextMenuButton {
|
StatusFlatRoundButton {
|
||||||
id: moreActionsBtn
|
id: moreActionsBtn
|
||||||
onClicked: moreActionsMenu.open()
|
icon.name: "more"
|
||||||
|
width: 32
|
||||||
|
height: 32
|
||||||
|
type: StatusFlatRoundButton.Type.Secondary
|
||||||
|
onClicked: {
|
||||||
|
let p = moreActionsBtn.mapToItem(otherButtons, moreActionsBtn.x, moreActionsMenu.y)
|
||||||
|
moreActionsMenu.popup(moreActionsBtn.width - moreActionsMenu.width, p.y + moreActionsBtn.height + 4)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: replace with StatusPopupMenu
|
StatusPopupMenu {
|
||||||
PopupMenu {
|
|
||||||
id: moreActionsMenu
|
id: moreActionsMenu
|
||||||
x: moreActionsBtn.width - moreActionsMenu.width
|
|
||||||
y: moreActionsBtn.height + 4
|
|
||||||
|
|
||||||
Action {
|
StatusMenuItem {
|
||||||
icon.source: hideReadNotifications ? Style.svg("eye") : Style.svg("eye-barred")
|
icon.name: "hide"
|
||||||
icon.width: 16
|
|
||||||
icon.height: 16
|
|
||||||
text: hideReadNotifications ?
|
text: hideReadNotifications ?
|
||||||
//% "Show read notifications"
|
//% "Show read notifications"
|
||||||
qsTrId("show-read-notifications") :
|
qsTrId("show-read-notifications") :
|
||||||
|
@ -127,10 +124,9 @@ Item {
|
||||||
qsTrId("hide-read-notifications")
|
qsTrId("hide-read-notifications")
|
||||||
onTriggered: hideReadNotifications = !hideReadNotifications
|
onTriggered: hideReadNotifications = !hideReadNotifications
|
||||||
}
|
}
|
||||||
Action {
|
|
||||||
icon.source: Style.svg("bell")
|
StatusMenuItem {
|
||||||
icon.width: 16
|
icon.name: "notification"
|
||||||
icon.height: 16
|
|
||||||
//% "Notification settings"
|
//% "Notification settings"
|
||||||
text: qsTrId("chat-notification-preferences")
|
text: qsTrId("chat-notification-preferences")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -141,11 +137,11 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StatusBaseText {
|
||||||
id: errorText
|
id: errorText
|
||||||
visible: !!text
|
visible: !!text
|
||||||
anchors.top: filterButtons.bottom
|
anchors.top: filterButtons.bottom
|
||||||
anchors.topMargin: Style.current.smallPadding
|
anchors.topMargin: Style.current.smallPadding
|
||||||
color: Style.current.danger
|
color: Theme.palette.dangerColor1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue