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