2024-02-28 12:19:14 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import AppLayouts.Profile.panels 1.0
|
|
|
|
import AppLayouts.Profile.controls 1.0
|
2024-03-04 22:07:09 +00:00
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2024-02-28 12:19:14 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
|
|
|
|
SplitView {
|
2024-03-04 22:07:09 +00:00
|
|
|
id: root
|
2024-02-28 12:19:14 +00:00
|
|
|
|
|
|
|
property int inShowcaseModelCount: inShowcaseCounter.value
|
|
|
|
property int hiddenModelCount: hiddenCounter.value
|
|
|
|
|
|
|
|
orientation: Qt.Vertical
|
|
|
|
|
|
|
|
Logs { id: logs }
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: inShowcaseModelItem
|
|
|
|
ListElement {
|
2024-03-04 22:07:09 +00:00
|
|
|
showcaseKey: 1
|
2024-02-28 12:19:14 +00:00
|
|
|
title: "Item 1"
|
|
|
|
secondaryTitle: "Description 1"
|
|
|
|
hasImage: true
|
|
|
|
image: "https://picsum.photos/200/300?random=1"
|
|
|
|
iconName: "https://picsum.photos/40/40?random=1"
|
2024-03-04 22:07:09 +00:00
|
|
|
showcaseVisibility: 1
|
2024-02-28 12:19:14 +00:00
|
|
|
name: "Test community"
|
|
|
|
joined: true
|
|
|
|
isControlNode: true
|
|
|
|
color: "yellow"
|
|
|
|
hasTag: true
|
|
|
|
tagText: "New"
|
|
|
|
tagAsset: "https://picsum.photos/40/40?random=1"
|
|
|
|
tagLoading: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: hiddenModelItem
|
|
|
|
ListElement {
|
2024-03-04 22:07:09 +00:00
|
|
|
showcaseKey: 2
|
2024-02-28 12:19:14 +00:00
|
|
|
title: "Item 1"
|
|
|
|
secondaryTitle: "Description 1"
|
|
|
|
hasImage: true
|
|
|
|
image: "https://picsum.photos/200/300?random=1"
|
|
|
|
iconName: "https://picsum.photos/40/40?random=1"
|
2024-03-04 22:07:09 +00:00
|
|
|
showcaseVisibility: 0
|
2024-02-28 12:19:14 +00:00
|
|
|
name: "Test community"
|
|
|
|
joined: true
|
|
|
|
isControlNode: true
|
|
|
|
color: "yellow"
|
|
|
|
tagVisible: true
|
|
|
|
tagText: "New"
|
|
|
|
tagAsset: "https://picsum.photos/40/40?random=1"
|
|
|
|
tagLoading: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-03 16:34:08 +00:00
|
|
|
Item {
|
2024-02-28 12:19:14 +00:00
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
2024-03-03 16:34:08 +00:00
|
|
|
|
|
|
|
ProfileShowcasePanel {
|
|
|
|
id: panel
|
|
|
|
|
|
|
|
inShowcaseModel: inShowcaseModelItem
|
|
|
|
hiddenModel: hiddenModelItem
|
|
|
|
anchors.centerIn: parent
|
|
|
|
width: parent.width - 16
|
|
|
|
height: parent.height - 16
|
|
|
|
emptyInShowcasePlaceholderText: "No items in showcase"
|
|
|
|
emptyHiddenPlaceholderText: "No hidden items"
|
|
|
|
showcaseLimit: limitCounter.value
|
|
|
|
searchPlaceholderText: qsTr("Search not available in storybook")
|
|
|
|
|
|
|
|
onChangePositionRequested: function (from, to) {
|
|
|
|
inShowcaseModelItem.move(from, to, 1)
|
|
|
|
}
|
|
|
|
onSetVisibilityRequested: function (key, toVisibility) {
|
|
|
|
for (var i = 0; i < inShowcaseModelItem.count; i++) {
|
|
|
|
if (inShowcaseModelItem.get(i).showcaseKey === key) {
|
|
|
|
inShowcaseModelItem.setProperty(i, "showcaseVisibility", toVisibility)
|
|
|
|
if(toVisibility === 0) {
|
|
|
|
let item = inShowcaseModelItem.get(i)
|
|
|
|
hiddenModelItem.append(item)
|
|
|
|
inShowcaseModelItem.remove(i, 1)
|
|
|
|
}
|
|
|
|
return
|
2024-02-28 12:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-03 16:34:08 +00:00
|
|
|
for (var i = 0; i < hiddenModelItem.count; i++) {
|
|
|
|
if (hiddenModelItem.get(i).showcaseKey === key) {
|
|
|
|
hiddenModelItem.setProperty(i, "showcaseVisibility", toVisibility)
|
|
|
|
if(toVisibility !== 0) {
|
|
|
|
let item = hiddenModelItem.get(i)
|
|
|
|
inShowcaseModelItem.append(item)
|
|
|
|
hiddenModelItem.remove(i, 1)
|
|
|
|
}
|
|
|
|
return
|
2024-02-28 12:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-03 16:34:08 +00:00
|
|
|
delegate: ProfileShowcasePanelDelegate {
|
|
|
|
id: delegate
|
|
|
|
|
|
|
|
title: model ? model.title : ""
|
|
|
|
secondaryTitle: model ? model.secondaryTitle : ""
|
|
|
|
hasImage: model ? model.hasImage : false
|
|
|
|
icon.name: model ? model.iconName : ""
|
|
|
|
icon.source: model ? model.image : ""
|
|
|
|
icon.color: model ? model.color : ""
|
|
|
|
|
|
|
|
actionComponent: model && model.hasTag ? manageTokensCommunityTag : null
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: manageTokensCommunityTag
|
|
|
|
ManageTokensCommunityTag {
|
|
|
|
Layout.maximumWidth: delegate.width *.4
|
2024-02-13 11:12:01 +00:00
|
|
|
communityName: model ? model.tagText : ""
|
|
|
|
communityId: ""
|
|
|
|
communityImage: model ? model.tagAsset : ""
|
2024-03-03 16:34:08 +00:00
|
|
|
loading: model ? model.tagLoading : false
|
|
|
|
}
|
2024-03-04 22:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-28 12:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
id: logsAndControlsPanel
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.preferredHeight: 200
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Label {
|
|
|
|
text: "In showcase: " + inShowcaseCounter.value
|
|
|
|
}
|
|
|
|
Slider {
|
|
|
|
id: inShowcaseCounter
|
|
|
|
from: 0
|
2024-03-03 11:02:30 +00:00
|
|
|
to: limitCounter.value
|
2024-02-28 12:19:14 +00:00
|
|
|
stepSize: 1
|
2024-03-03 11:02:30 +00:00
|
|
|
value: limitCounter.value > 0 ? limitCounter.value - 1 : 0
|
2024-02-28 12:19:14 +00:00
|
|
|
}
|
2024-03-03 11:02:30 +00:00
|
|
|
}
|
2024-02-28 12:19:14 +00:00
|
|
|
|
2024-03-03 11:02:30 +00:00
|
|
|
ColumnLayout {
|
2024-02-28 12:19:14 +00:00
|
|
|
Label {
|
|
|
|
text: "Hidden: " + hiddenCounter.value
|
|
|
|
}
|
|
|
|
Slider {
|
|
|
|
id: hiddenCounter
|
|
|
|
from: 0
|
|
|
|
to: 200
|
|
|
|
stepSize: 1
|
|
|
|
value: 25
|
|
|
|
}
|
|
|
|
}
|
2024-03-03 11:02:30 +00:00
|
|
|
ColumnLayout {
|
|
|
|
Label {
|
|
|
|
text: "Showcase limit: " + limitCounter.value
|
|
|
|
}
|
|
|
|
Slider {
|
|
|
|
id: limitCounter
|
|
|
|
from: 0
|
|
|
|
to: 200
|
|
|
|
stepSize: 1
|
|
|
|
value: 5
|
|
|
|
}
|
|
|
|
}
|
2024-02-28 12:19:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onInShowcaseModelCountChanged: {
|
|
|
|
let count = inShowcaseModelCount - inShowcaseModelItem.count;
|
|
|
|
let operation = count > 0 ? (i) =>{
|
2024-03-03 11:02:30 +00:00
|
|
|
inShowcaseModelItem.append({
|
|
|
|
showcaseKey: Math.random() * Math.random() * Math.random() * 1000,
|
|
|
|
title: "Item " + i,
|
|
|
|
secondaryTitle: "Description " + i,
|
|
|
|
hasImage: true,
|
|
|
|
image: "https://picsum.photos/200/300?random=" + i,
|
|
|
|
iconName: "https://picsum.photos/40/40?random=" + i,
|
|
|
|
showcaseVisibility: Math.ceil(Math.random() * 3),
|
|
|
|
name: "Test community",
|
|
|
|
joined: true,
|
|
|
|
isControlNode: true,
|
|
|
|
color: "yellow",
|
|
|
|
hasTag: Math.random() > 0.5,
|
|
|
|
tagText: "New " + 1,
|
|
|
|
tagAsset: "https://picsum.photos/40/40?random=" + i,
|
|
|
|
tagLoading: Math.random() > 0.5
|
|
|
|
})} : (i) => {
|
|
|
|
inShowcaseModelItem.remove(inShowcaseModelItem.count - 1);
|
|
|
|
}
|
2024-02-28 12:19:14 +00:00
|
|
|
|
|
|
|
for (var i = 0; i < Math.abs(count); i++) {
|
|
|
|
operation(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onHiddenModelCountChanged: {
|
|
|
|
let count = hiddenModelCount - hiddenModelItem.count;
|
|
|
|
let operation = count > 0 ? (i) =>{
|
2024-03-03 11:02:30 +00:00
|
|
|
hiddenModelItem.append({
|
|
|
|
showcaseKey: Math.random() * Math.random() * Math.random() * 1000,
|
|
|
|
title: "Item " + i,
|
|
|
|
secondaryTitle: "Description " + i,
|
|
|
|
hasImage: true,
|
|
|
|
image: "https://picsum.photos/200/300?random=" + i,
|
|
|
|
iconName: "https://picsum.photos/40/40?random=" + i,
|
|
|
|
showcaseVisibility: 0,
|
|
|
|
name: "Test community",
|
|
|
|
joined: true,
|
|
|
|
memberRole: Constants.memberRole.owner,
|
|
|
|
isControlNode: true,
|
|
|
|
color: "yellow",
|
|
|
|
hasTag: Math.random() > 0.5,
|
|
|
|
tagText: "New " + i,
|
|
|
|
tagAsset: "https://picsum.photos/40/40?random=" + i,
|
|
|
|
tagLoading: Math.random() > 0.8
|
|
|
|
})} : (i) => {
|
|
|
|
hiddenModelItem.remove(hiddenModelItem.count - 1);
|
|
|
|
}
|
2024-02-28 12:19:14 +00:00
|
|
|
|
|
|
|
for (var i = 0; i < Math.abs(count); i++) {
|
|
|
|
operation(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// category: Panels
|