forked from blue/squawk
Client node now displays in all participants and presences, some additional checkups before querying empty clients, refactoring
This commit is contained in:
parent
76a9c5da0c
commit
21b40a9ccb
19 changed files with 407 additions and 317 deletions
|
@ -26,52 +26,46 @@ Models::Participant::Participant(const QMap<QString, QVariant>& data, Models::It
|
|||
role(Shared::Role::unspecified)
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator itr = data.find("affiliation");
|
||||
if (itr != data.end()) {
|
||||
if (itr != data.end())
|
||||
setAffiliation(itr.value().toUInt());
|
||||
}
|
||||
|
||||
|
||||
itr = data.find("role");
|
||||
if (itr != data.end()) {
|
||||
if (itr != data.end())
|
||||
setRole(itr.value().toUInt());
|
||||
}
|
||||
|
||||
|
||||
itr = data.find("avatarState");
|
||||
if (itr != data.end()) {
|
||||
if (itr != data.end())
|
||||
setAvatarState(itr.value().toUInt());
|
||||
}
|
||||
|
||||
itr = data.find("avatarPath");
|
||||
if (itr != data.end()) {
|
||||
if (itr != data.end())
|
||||
setAvatarPath(itr.value().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Models::Participant::~Participant()
|
||||
{
|
||||
{}
|
||||
|
||||
int Models::Participant::columnCount() const {
|
||||
return 9;
|
||||
}
|
||||
|
||||
int Models::Participant::columnCount() const
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
QVariant Models::Participant::data(int column) const
|
||||
{
|
||||
QVariant Models::Participant::data(int column) const {
|
||||
switch (column) {
|
||||
case 4:
|
||||
return QVariant::fromValue(affiliation);
|
||||
case 5:
|
||||
return QVariant::fromValue(role);
|
||||
return QVariant::fromValue(affiliation);
|
||||
case 6:
|
||||
return QVariant::fromValue(getAvatarState());
|
||||
return QVariant::fromValue(role);
|
||||
case 7:
|
||||
return QVariant::fromValue(getAvatarState());
|
||||
case 8:
|
||||
return getAvatarPath();
|
||||
default:
|
||||
return AbstractParticipant::data(column);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::update(const QString& key, const QVariant& value)
|
||||
{
|
||||
void Models::Participant::update(const QString& key, const QVariant& value) {
|
||||
if (key == "affiliation") {
|
||||
setAffiliation(value.toUInt());
|
||||
} else if (key == "role") {
|
||||
|
@ -85,67 +79,58 @@ void Models::Participant::update(const QString& key, const QVariant& value)
|
|||
}
|
||||
}
|
||||
|
||||
Shared::Affiliation Models::Participant::getAffiliation() const
|
||||
{
|
||||
Shared::Affiliation Models::Participant::getAffiliation() const {
|
||||
return affiliation;
|
||||
}
|
||||
|
||||
void Models::Participant::setAffiliation(Shared::Affiliation p_aff)
|
||||
{
|
||||
void Models::Participant::setAffiliation(Shared::Affiliation p_aff) {
|
||||
if (p_aff != affiliation) {
|
||||
affiliation = p_aff;
|
||||
changed(4);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setAffiliation(unsigned int aff)
|
||||
{
|
||||
setAffiliation(Shared::Global::fromInt<Shared::Affiliation>(aff));
|
||||
}
|
||||
|
||||
Shared::Role Models::Participant::getRole() const
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
void Models::Participant::setRole(Shared::Role p_role)
|
||||
{
|
||||
if (p_role != role) {
|
||||
role = p_role;
|
||||
changed(5);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setRole(unsigned int p_role)
|
||||
{
|
||||
setRole(Shared::Global::fromInt<Shared::Role>(p_role));
|
||||
void Models::Participant::setAffiliation(unsigned int aff) {
|
||||
setAffiliation(Shared::Global::fromInt<Shared::Affiliation>(aff));
|
||||
}
|
||||
|
||||
QString Models::Participant::getAvatarPath() const
|
||||
{
|
||||
return avatarPath;
|
||||
Shared::Role Models::Participant::getRole() const {
|
||||
return role;
|
||||
}
|
||||
|
||||
Shared::Avatar Models::Participant::getAvatarState() const
|
||||
{
|
||||
return avatarState;
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarPath(const QString& path)
|
||||
{
|
||||
if (avatarPath != path) {
|
||||
avatarPath = path;
|
||||
changed(7);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarState(Shared::Avatar p_state)
|
||||
{
|
||||
if (avatarState != p_state) {
|
||||
avatarState = p_state;
|
||||
void Models::Participant::setRole(Shared::Role p_role) {
|
||||
if (p_role != role) {
|
||||
role = p_role;
|
||||
changed(6);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarState(unsigned int p_state)
|
||||
{setAvatarState(Shared::Global::fromInt<Shared::Avatar>(p_state));}
|
||||
void Models::Participant::setRole(unsigned int p_role) {
|
||||
setRole(Shared::Global::fromInt<Shared::Role>(p_role));
|
||||
}
|
||||
|
||||
QString Models::Participant::getAvatarPath() const {
|
||||
return avatarPath;
|
||||
}
|
||||
|
||||
Shared::Avatar Models::Participant::getAvatarState() const {
|
||||
return avatarState;
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarPath(const QString& path) {
|
||||
if (avatarPath != path) {
|
||||
avatarPath = path;
|
||||
changed(8);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarState(Shared::Avatar p_state) {
|
||||
if (avatarState != p_state) {
|
||||
avatarState = p_state;
|
||||
changed(7);
|
||||
}
|
||||
}
|
||||
|
||||
void Models::Participant::setAvatarState(unsigned int p_state) {
|
||||
setAvatarState(Shared::Global::fromInt<Shared::Avatar>(p_state));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue