fix: code review

This commit is contained in:
Richard Ramos 2021-07-06 13:58:19 -04:00 committed by Iuri Matias
parent 2fcbe4ac16
commit c5cc001ee1
4 changed files with 66 additions and 49 deletions

View File

@ -50,15 +50,15 @@ QtObject:
if index.row < 0 or index.row >= self.users.len:
return
let user = self.users[index.row]
let pubkey = self.users[index.row]
case role.UserListRoles:
of UserListRoles.UserName: result = newQVariant(self.userDetails[user].userName)
of UserListRoles.LastSeen: result = newQVariant(self.userDetails[user].lastSeen)
of UserListRoles.Alias: result = newQVariant(self.userDetails[user].alias)
of UserListRoles.LocalName: result = newQVariant(self.userDetails[user].localName)
of UserListRoles.PublicKey: result = newQVariant(user)
of UserListRoles.Identicon: result = newQVariant(self.userdetails[user].identicon)
of UserListRoles.UserName: result = newQVariant(self.userDetails[pubkey].userName)
of UserListRoles.LastSeen: result = newQVariant(self.userDetails[pubkey].lastSeen)
of UserListRoles.Alias: result = newQVariant(self.userDetails[pubkey].alias)
of UserListRoles.LocalName: result = newQVariant(self.userDetails[pubkey].localName)
of UserListRoles.PublicKey: result = newQVariant(pubkey)
of UserListRoles.Identicon: result = newQVariant(self.userdetails[pubkey].identicon)
method roleNames(self: UserListView): Table[int, string] =
{

View File

@ -1,4 +1,4 @@
import ens, wallet, permissions
import ens, wallet, permissions, utils
import ../eventemitter
import types
import utils

View File

@ -363,48 +363,8 @@ SplitView {
}
}
Rectangle {
UserList {
id: userList
visible: showUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne
property int defaultWidth: 250
SplitView.preferredWidth: visible ? defaultWidth : 0
SplitView.minimumWidth: 50
color: Style.current.secondaryMenuBackground
anchors.top: parent.top
anchors.bottom: parent.bottom
height: childrenRect.height
ListView {
id: userListView
anchors.fill: parent
anchors.bottomMargin: Style.current.bigPadding
spacing: 0
boundsBehavior: Flickable.StopAtBounds
model: userListDelegate
}
DelegateModelGeneralized {
id: userListDelegate
lessThan: [
function(left, right) {
return left.lastSeen > right.lastSeen
}
]
model: messageList.userList
delegate: User {
publicKey: model.publicKey
name: model.userName
identicon: model.identicon
lastSeen: model.lastSeen
currentTime: svRoot.currentTime
}
}
}
}

View File

@ -0,0 +1,57 @@
import QtQuick 2.13
import Qt.labs.platform 1.1
import QtQuick.Controls 2.13
import QtQuick.Window 2.13
import QtQuick.Layouts 1.13
import QtQml.Models 2.13
import QtGraphicalEffects 1.13
import QtQuick.Dialogs 1.3
import "../../../../shared"
import "../../../../shared/status"
import "../../../../imports"
import "../components"
import "./samples/"
import "./MessageComponents"
import "../ContactsColumn"
Rectangle {
id: userList
visible: showUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne
property int defaultWidth: 250
SplitView.preferredWidth: visible ? defaultWidth : 0
SplitView.minimumWidth: 50
color: Style.current.secondaryMenuBackground
anchors.top: parent.top
anchors.bottom: parent.bottom
ListView {
id: userListView
anchors.fill: parent
anchors.bottomMargin: Style.current.bigPadding
spacing: 0
boundsBehavior: Flickable.StopAtBounds
model: userListDelegate
}
DelegateModelGeneralized {
id: userListDelegate
lessThan: [
function(left, right) {
return left.lastSeen > right.lastSeen
}
]
model: messageList.userList
delegate: User {
publicKey: model.publicKey
name: model.userName
identicon: model.identicon
lastSeen: model.lastSeen
currentTime: svRoot.currentTime
}
}
}