2023-04-24 18:35:34 +00:00
|
|
|
import QtQuick 2.15
|
2022-03-18 14:47:51 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-06-27 13:41:47 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-03-18 14:47:51 +00:00
|
|
|
|
2023-05-22 15:55:47 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-03-18 14:47:51 +00:00
|
|
|
import "../controls"
|
|
|
|
|
2023-04-24 18:35:34 +00:00
|
|
|
StatusComboBox {
|
2022-11-11 09:24:26 +00:00
|
|
|
id: root
|
2022-03-18 14:47:51 +00:00
|
|
|
|
2022-06-27 13:41:47 +00:00
|
|
|
property var selectedAccount
|
2023-07-21 08:41:24 +00:00
|
|
|
property var getNetworkShortNames: function(chainIds){}
|
2023-04-24 18:35:34 +00:00
|
|
|
property int selectedIndex: -1
|
2022-03-18 14:47:51 +00:00
|
|
|
|
2023-04-24 18:35:34 +00:00
|
|
|
control.padding: 0
|
|
|
|
control.spacing: 0
|
|
|
|
control.leftPadding: 8
|
|
|
|
control.rightPadding: 8
|
|
|
|
control.topPadding: 10
|
2022-05-19 08:53:57 +00:00
|
|
|
|
2023-04-24 18:35:34 +00:00
|
|
|
control.popup.width: 430
|
|
|
|
control.indicator: null
|
|
|
|
|
|
|
|
control.background: Rectangle {
|
|
|
|
width: contentItem.childrenRect.width + control.leftPadding + control.rightPadding
|
|
|
|
height: 32
|
2022-06-27 13:41:47 +00:00
|
|
|
radius: 8
|
2023-05-22 15:55:47 +00:00
|
|
|
color: !!selectedAccount ? hoverHandler.hovered ?
|
|
|
|
Utils.getHoveredColor(selectedAccount.colorId) :
|
|
|
|
Utils.getColorForId(selectedAccount.colorId) : "transparent"
|
2023-04-24 18:35:34 +00:00
|
|
|
HoverHandler {
|
|
|
|
id: hoverHandler
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Row {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: childrenRect.width
|
|
|
|
spacing: 8
|
|
|
|
StatusEmoji {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
emojiId: StatusQUtils.Emoji.iconId(selectedAccount.emoji ?? "", StatusQUtils.Emoji.size.verySmall) || ""
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: selectedAccount.name ?? ""
|
|
|
|
font.pixelSize: 15
|
2023-05-22 15:55:47 +00:00
|
|
|
color: Theme.palette.indirectColor1
|
2023-04-24 18:35:34 +00:00
|
|
|
}
|
|
|
|
StatusIcon {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 16
|
|
|
|
height: width
|
|
|
|
icon: "chevron-down"
|
2023-05-22 15:55:47 +00:00
|
|
|
color: Theme.palette.indirectColor1
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
2022-06-27 13:41:47 +00:00
|
|
|
}
|
2023-04-24 18:35:34 +00:00
|
|
|
|
|
|
|
delegate: WalletAccountListItem {
|
|
|
|
width: ListView.view.width
|
|
|
|
modelData: model
|
2023-07-21 08:41:24 +00:00
|
|
|
getNetworkShortNames: root.getNetworkShortNames
|
2023-04-24 18:35:34 +00:00
|
|
|
color: sensor.containsMouse || highlighted ?
|
|
|
|
Theme.palette.baseColor2 :
|
|
|
|
selectedAccount.name === model.name ? Theme.palette.statusListItem.highlightColor : "transparent"
|
2022-06-27 13:41:47 +00:00
|
|
|
onClicked: {
|
2023-04-24 18:35:34 +00:00
|
|
|
selectedIndex = index
|
|
|
|
control.popup.close()
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
2023-05-04 12:55:39 +00:00
|
|
|
Component.onCompleted:{
|
|
|
|
if(selectedAccount.address === model.address)
|
|
|
|
selectedIndex = index
|
|
|
|
}
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|