feat(ProfileShowcase): Integrate profile perspective selector
This commit is contained in:
parent
77933cc732
commit
1d45243bc1
|
@ -1,10 +1,13 @@
|
|||
import QtQuick 2.14
|
||||
import QtGraphicalEffects 1.14
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import shared.views 1.0 as SharedViews
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import shared.controls 1.0
|
||||
|
||||
Item {
|
||||
property alias profileStore: profilePreview.profileStore
|
||||
property alias contactsStore: profilePreview.contactsStore
|
||||
|
@ -20,27 +23,42 @@ Item {
|
|||
|
||||
|
||||
implicitHeight: profilePreview.implicitHeight
|
||||
+ profilePreview.anchors.topMargin
|
||||
+ profilePreview.anchors.bottomMargin
|
||||
+ layout.anchors.topMargin
|
||||
+ layout.anchors.bottomMargin
|
||||
|
||||
implicitWidth: profilePreview.implicitWidth
|
||||
+ profilePreview.anchors.leftMargin
|
||||
+ profilePreview.anchors.rightMargin
|
||||
+ layout.anchors.leftMargin
|
||||
+ layout.anchors.rightMargin
|
||||
|
||||
function reload() {
|
||||
profilePreview.reload()
|
||||
}
|
||||
|
||||
SharedViews.ProfileDialogView {
|
||||
id: profilePreview
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
anchors.fill: parent
|
||||
anchors.margins: 64
|
||||
spacing: 20
|
||||
ProfilePerspectiveSelector {
|
||||
id: selector
|
||||
showcaseVisibility: profilePreview.showcaseMaxVisibility
|
||||
onVisibilitySelected: (visibility) => profilePreview.showcaseMaxVisibility = visibility
|
||||
}
|
||||
|
||||
SharedViews.ProfileDialogView {
|
||||
id: profilePreview
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.maximumHeight: implicitHeight
|
||||
readOnly: true
|
||||
}
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
id: shadow
|
||||
anchors.fill: profilePreview
|
||||
anchors.fill: layout
|
||||
anchors.topMargin: profilePreview.y
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 4
|
||||
radius: 16
|
||||
|
|
|
@ -65,7 +65,7 @@ StatusButton {
|
|||
id: menuItem
|
||||
required property int showcaseVisibility
|
||||
|
||||
readonly property string selectedText: d.buttonTextFormat.arg(text)
|
||||
readonly property string selectedText: qsTr("Preview as %1").arg(text)
|
||||
readonly property alias selectedTextWidth: textMetricsMaxWidth.width
|
||||
|
||||
ButtonGroup.group: showcaseVisibilityGroup
|
||||
|
@ -82,9 +82,6 @@ StatusButton {
|
|||
|
||||
QtObject {
|
||||
id: d
|
||||
|
||||
readonly property string buttonTextFormat: "%1%2".arg(qsTr("Preview as "))
|
||||
|
||||
property real maxTextWidth: {
|
||||
let max = 0
|
||||
for (var i = 0; i < showcaseVisibilityGroup.buttons.length; i++) {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import StatusQ.Popups.Dialog 0.1
|
||||
|
||||
import shared.views 1.0
|
||||
import shared.controls 1.0
|
||||
|
||||
StatusDialog {
|
||||
id: root
|
||||
|
@ -24,11 +26,29 @@ StatusDialog {
|
|||
property alias dirtyValues: profileView.dirtyValues
|
||||
property alias dirty: profileView.dirty
|
||||
|
||||
implicitHeight: implicitContentHeight + (header.visible ? header.height : 0)
|
||||
width: 640
|
||||
padding: 0
|
||||
|
||||
header: null
|
||||
footer: null
|
||||
background: null
|
||||
header: Item {
|
||||
id: headerItem
|
||||
height: selector.height + 20
|
||||
visible: profileView.isCurrentUser
|
||||
|
||||
TapHandler {
|
||||
enabled: root.closePolicy != Popup.NoAutoClose
|
||||
onTapped: {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
ProfilePerspectiveSelector {
|
||||
id: selector
|
||||
showcaseVisibility: profileView.showcaseMaxVisibility
|
||||
onVisibilitySelected: (visibility) => profileView.showcaseMaxVisibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: ProfileDialogView {
|
||||
id: profileView
|
||||
|
|
|
@ -29,6 +29,7 @@ Pane {
|
|||
property bool readOnly // inside settings/profile/preview
|
||||
|
||||
property string publicKey: contactsStore.myPublicKey
|
||||
readonly property alias isCurrentUser: d.isCurrentUser
|
||||
|
||||
property var profileStore
|
||||
property var contactsStore
|
||||
|
@ -44,6 +45,8 @@ Pane {
|
|||
property var showcaseSocialLinksModel
|
||||
property var showcaseAssetsModel
|
||||
|
||||
property alias showcaseMaxVisibility: showcaseView.maxVisibility
|
||||
|
||||
signal closeRequested()
|
||||
|
||||
padding: 0
|
||||
|
|
|
@ -20,6 +20,8 @@ Control {
|
|||
|
||||
property alias currentTabIndex: stackLayout.currentIndex
|
||||
|
||||
property int maxVisibility: Constants.ShowcaseVisibility.Everyone
|
||||
|
||||
property alias communitiesModel: communitiesProxyModel.sourceModel
|
||||
property alias accountsModel: accountsProxyModel.sourceModel
|
||||
property alias collectiblesModel: collectiblesProxyModel.sourceModel
|
||||
|
@ -48,7 +50,8 @@ Control {
|
|||
roleName: "showcasePosition"
|
||||
}
|
||||
]
|
||||
filters: AnyOf {
|
||||
filters: [
|
||||
AnyOf {
|
||||
inverted: true
|
||||
UndefinedFilter {
|
||||
roleName: "showcaseVisibility"
|
||||
|
@ -58,7 +61,12 @@ Control {
|
|||
roleName: "showcaseVisibility"
|
||||
value: Constants.ShowcaseVisibility.NoOne
|
||||
}
|
||||
},
|
||||
FastExpressionFilter {
|
||||
expression: model.showcaseVisibility >= root.maxVisibility
|
||||
expectedRoles: ["showcaseVisibility"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
PositionSFPM {
|
||||
|
|
Loading…
Reference in New Issue