refactor(ActivityCenterTopBar): make use of StatusQ components

This commit is contained in:
Pascal Precht 2021-10-18 14:01:09 +02:00 committed by Iuri Matias
parent 845640bd13
commit 7f1b62fe32
1 changed files with 63 additions and 67 deletions

View File

@ -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,63 +87,61 @@ 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 width: 32
icon.width: 24 height: 32
icon.height: 24 onClicked: markAllReadClicked()
width: 32
height: 32
onClicked: markAllReadClicked()
StatusToolTip { StatusToolTip {
visible: markAllReadBtn.hovered visible: markAllReadBtn.hovered
//% "Mark all as Read" //% "Mark all as Read"
text: qsTrId("mark-all-as-read") text: qsTrId("mark-all-as-read")
} }
} }
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 text: hideReadNotifications ?
icon.height: 16 //% "Show read notifications"
text: hideReadNotifications ? qsTrId("show-read-notifications") :
//% "Show read notifications" //% "Hide read notifications"
qsTrId("show-read-notifications") : qsTrId("hide-read-notifications")
//% "Hide read notifications" onTriggered: hideReadNotifications = !hideReadNotifications
qsTrId("hide-read-notifications") }
onTriggered: hideReadNotifications = !hideReadNotifications
} StatusMenuItem {
Action { icon.name: "notification"
icon.source: Style.svg("bell") //% "Notification settings"
icon.width: 16 text: qsTrId("chat-notification-preferences")
icon.height: 16 onTriggered: {
//% "Notification settings" root.preferencesClicked();
text: qsTrId("chat-notification-preferences") }
onTriggered: { }
root.preferencesClicked(); }
} }
}
}
}
} }
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
} }
} }