UserListModel::UserListModel(const MumbleProto::UserList& userList, QObject *parent) : QAbstractTableModel(parent) , m_legacyMode(false) { m_userList.reserve(userList.users_size()); for (int i = 0; i < userList.users_size(); ++i) { m_userList.append(userList.users(i)); } if (!m_userList.empty()) { const MumbleProto::UserList_User& user = m_userList.back(); m_legacyMode = !user.has_last_seen() || !user.has_last_channel(); } }
UserEdit::UserEdit(const MumbleProto::UserList &msg, QWidget *p) : QDialog(p) { setupUi(this); qlwUserList->setContextMenuPolicy(Qt::CustomContextMenu); for (int i=0;i<msg.users_size(); ++i) { const MumbleProto::UserList_User &u = msg.users(i); int id = u.user_id(); const QString &name = u8(u.name()); UserEditListItem *ueli = new UserEditListItem(name, id); qlwUserList->addItem(ueli); qmUsers.insert(id, name); } }
UserEdit::UserEdit(const MumbleProto::UserList &msg, QWidget *p) : QDialog(p) { setupUi(this); qlwUserList->setContextMenuPolicy(Qt::CustomContextMenu); for (int i=0;i<msg.users_size(); ++i) { const MumbleProto::UserList_User &u = msg.users(i); int id = u.user_id(); const QString &name = u8(u.name()); QListWidgetItem *qlwi = new QListWidgetItem(name); qlwi->setFlags(qlwi->flags() | Qt::ItemIsEditable); qlwi->setData(Qt::UserRole, id); qlwUserList->addItem(qlwi); qmUsers.insert(id, name); } }