mirror of
https://gitlab.com/comunic/comunicmessages
synced 2025-06-20 08:55:17 +00:00
Display the list of conversations.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#include "conversation.h"
|
||||
#include "userslist.h"
|
||||
|
||||
Conversation::Conversation()
|
||||
{
|
||||
|
@ -15,3 +15,13 @@ QList<int> ConversationsList::getAllMembersId() const
|
||||
}
|
||||
return members;
|
||||
}
|
||||
|
||||
UsersList ConversationsList::getMembersInformation() const
|
||||
{
|
||||
return mMembersInformation;
|
||||
}
|
||||
|
||||
void ConversationsList::setMembersInformation(const UsersList &membersInformation)
|
||||
{
|
||||
mMembersInformation = membersInformation;
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <QList>
|
||||
|
||||
#include "conversation.h"
|
||||
#include "user.h"
|
||||
#include "userslist.h"
|
||||
|
||||
class ConversationsList : public QList<Conversation>
|
||||
{
|
||||
@ -23,6 +25,14 @@ public:
|
||||
* @return The IDs of the conversations
|
||||
*/
|
||||
QList<int> getAllMembersId() const;
|
||||
|
||||
UsersList getMembersInformation() const;
|
||||
void setMembersInformation(const UsersList &membersInformation);
|
||||
|
||||
private:
|
||||
|
||||
//Private fields
|
||||
UsersList mMembersInformation;
|
||||
};
|
||||
|
||||
#endif // CONVERSATIONSLIST_H
|
||||
|
@ -35,6 +35,11 @@ void User::setLastName(const QString &lastName)
|
||||
mLastName = lastName;
|
||||
}
|
||||
|
||||
QString User::displayName() const
|
||||
{
|
||||
return firstName() + " " + lastName();
|
||||
}
|
||||
|
||||
QString User::accountImage() const
|
||||
{
|
||||
return mAccountImage;
|
||||
|
@ -23,6 +23,11 @@ public:
|
||||
QString lastName() const;
|
||||
void setLastName(const QString &lastName);
|
||||
|
||||
/**
|
||||
* Get and return display name of the user
|
||||
*/
|
||||
QString displayName() const;
|
||||
|
||||
QString accountImage() const;
|
||||
void setAccountImage(const QString &accountImage);
|
||||
|
||||
|
16
data/userslist.cpp
Normal file
16
data/userslist.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "userslist.h"
|
||||
|
||||
UsersList::UsersList() : QList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
User UsersList::get(int userID) const
|
||||
{
|
||||
for(User user : *this)
|
||||
if(user.iD() == userID)
|
||||
return user;
|
||||
|
||||
//User not found
|
||||
return User();
|
||||
}
|
31
data/userslist.h
Normal file
31
data/userslist.h
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* A list of users
|
||||
*
|
||||
* Provides methods to fetch users
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
#ifndef USERSLISTS_H
|
||||
#define USERSLISTS_H
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include "user.h"
|
||||
|
||||
class UsersList : public QList<User>
|
||||
{
|
||||
public:
|
||||
UsersList();
|
||||
|
||||
/**
|
||||
* Find and return information about a user specified
|
||||
* by its ID
|
||||
*
|
||||
* @param userID The ID of the target user
|
||||
* @return Information about the user
|
||||
*/
|
||||
User get(int userID) const;
|
||||
};
|
||||
|
||||
#endif // USERSLISTS_H
|
Reference in New Issue
Block a user