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 utils 1.0
|
||||
import "../../../../shared"
|
||||
import "../../../../shared/popups"
|
||||
import "../../../../shared/panels"
|
||||
import "../../../../shared/status"
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Popups 0.1
|
||||
|
||||
import ".."
|
||||
|
||||
Item {
|
||||
|
@ -33,49 +35,45 @@ Item {
|
|||
height: allBtn.height
|
||||
spacing: Style.current.padding
|
||||
|
||||
StatusButton {
|
||||
StatusFlatButton {
|
||||
id: allBtn
|
||||
//% "All"
|
||||
text: qsTrId("all")
|
||||
type: "secondary"
|
||||
size: "small"
|
||||
size: StatusBaseButton.Size.Small
|
||||
highlighted: root.allBtnHighlighted
|
||||
onClicked: {
|
||||
root.allBtnClicked();
|
||||
}
|
||||
onClicked: root.allBtnClicked();
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
StatusFlatButton {
|
||||
id: mentionsBtn
|
||||
//% "Mentions"
|
||||
text: qsTrId("mentions")
|
||||
type: "secondary"
|
||||
size: "small"
|
||||
enabled: hasMentions
|
||||
size: StatusBaseButton.Size.Small
|
||||
highlighted: root.mentionsBtnHighlighted
|
||||
onClicked: {
|
||||
root.mentionsBtnClicked();
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
StatusFlatButton {
|
||||
id: repliesbtn
|
||||
//% "Replies"
|
||||
text: qsTrId("replies")
|
||||
type: "secondary"
|
||||
size: "small"
|
||||
enabled: hasReplies
|
||||
size: StatusBaseButton.Size.Small
|
||||
highlighted: root.repliesBtnHighlighted
|
||||
onClicked: {
|
||||
root.repliesBtnClicked();
|
||||
}
|
||||
}
|
||||
|
||||
// StatusButton {
|
||||
// StatusFlatButton {
|
||||
// id: contactRequestsBtn
|
||||
// //% "Contact requests"
|
||||
// text: qsTrId("contact-requests")
|
||||
// enabled: hasContactRequests
|
||||
// type: "secondary"
|
||||
// size: "small"
|
||||
// size: StatusBaseButton.Size.Small
|
||||
// highlighted: activityCenter.currentFilter === ActivityCenter.Filter.ContactRequests
|
||||
// onClicked: activityCenter.currentFilter = ActivityCenter.Filter.ContactRequests
|
||||
// }
|
||||
|
@ -89,63 +87,61 @@ Item {
|
|||
height: markAllReadBtn.height
|
||||
spacing: Style.current.padding
|
||||
|
||||
StatusIconButton {
|
||||
id: markAllReadBtn
|
||||
icon.name: "double-check"
|
||||
iconColor: Style.current.primary
|
||||
icon.width: 24
|
||||
icon.height: 24
|
||||
width: 32
|
||||
height: 32
|
||||
onClicked: markAllReadClicked()
|
||||
StatusFlatRoundButton {
|
||||
id: markAllReadBtn
|
||||
icon.name: "double-checkmark"
|
||||
width: 32
|
||||
height: 32
|
||||
onClicked: markAllReadClicked()
|
||||
|
||||
StatusToolTip {
|
||||
visible: markAllReadBtn.hovered
|
||||
//% "Mark all as Read"
|
||||
text: qsTrId("mark-all-as-read")
|
||||
}
|
||||
}
|
||||
StatusToolTip {
|
||||
visible: markAllReadBtn.hovered
|
||||
//% "Mark all as Read"
|
||||
text: qsTrId("mark-all-as-read")
|
||||
}
|
||||
}
|
||||
|
||||
StatusContextMenuButton {
|
||||
id: moreActionsBtn
|
||||
onClicked: moreActionsMenu.open()
|
||||
StatusFlatRoundButton {
|
||||
id: moreActionsBtn
|
||||
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
|
||||
PopupMenu {
|
||||
id: moreActionsMenu
|
||||
x: moreActionsBtn.width - moreActionsMenu.width
|
||||
y: moreActionsBtn.height + 4
|
||||
StatusPopupMenu {
|
||||
id: moreActionsMenu
|
||||
|
||||
Action {
|
||||
icon.source: hideReadNotifications ? Style.svg("eye") : Style.svg("eye-barred")
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
text: hideReadNotifications ?
|
||||
//% "Show read notifications"
|
||||
qsTrId("show-read-notifications") :
|
||||
//% "Hide read notifications"
|
||||
qsTrId("hide-read-notifications")
|
||||
onTriggered: hideReadNotifications = !hideReadNotifications
|
||||
}
|
||||
Action {
|
||||
icon.source: Style.svg("bell")
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
//% "Notification settings"
|
||||
text: qsTrId("chat-notification-preferences")
|
||||
onTriggered: {
|
||||
root.preferencesClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
StatusMenuItem {
|
||||
icon.name: "hide"
|
||||
text: hideReadNotifications ?
|
||||
//% "Show read notifications"
|
||||
qsTrId("show-read-notifications") :
|
||||
//% "Hide read notifications"
|
||||
qsTrId("hide-read-notifications")
|
||||
onTriggered: hideReadNotifications = !hideReadNotifications
|
||||
}
|
||||
|
||||
StatusMenuItem {
|
||||
icon.name: "notification"
|
||||
//% "Notification settings"
|
||||
text: qsTrId("chat-notification-preferences")
|
||||
onTriggered: {
|
||||
root.preferencesClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
StatusBaseText {
|
||||
id: errorText
|
||||
visible: !!text
|
||||
anchors.top: filterButtons.bottom
|
||||
anchors.topMargin: Style.current.smallPadding
|
||||
color: Style.current.danger
|
||||
color: Theme.palette.dangerColor1
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue