2018-12-02 20:26:49 +00:00
|
|
|
#ifndef CONVERSATIONSLISTWIDGET_H
|
|
|
|
#define CONVERSATIONSLISTWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2018-12-03 20:18:12 +00:00
|
|
|
#include "../data/conversationslist.h"
|
2018-12-07 10:31:42 +00:00
|
|
|
#include "../data/userslist.h"
|
2018-12-03 20:18:12 +00:00
|
|
|
#include "../data/user.h"
|
2018-12-02 20:26:49 +00:00
|
|
|
|
|
|
|
class ConversationsListHelper;
|
2018-12-03 20:18:12 +00:00
|
|
|
class UsersHelper;
|
2018-12-02 20:26:49 +00:00
|
|
|
|
|
|
|
class ConversationsListWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConversationsListWidget(QWidget *parent = nullptr);
|
|
|
|
~ConversationsListWidget();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Refresh the list of conversations of the user
|
|
|
|
*/
|
|
|
|
void refresh();
|
|
|
|
|
2018-12-09 20:25:01 +00:00
|
|
|
/**
|
|
|
|
* This method is used to update the currently active conversation
|
|
|
|
*
|
|
|
|
* @param currentConversation The current conversation
|
|
|
|
*/
|
|
|
|
void setCurrentConversation(const Conversation ¤tConversation);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signal emitted when a conversation is requested to be opened
|
|
|
|
*
|
|
|
|
* @param conversation The conversation to open
|
|
|
|
* @param list Information about potential required users
|
|
|
|
*/
|
|
|
|
void openConversation(Conversation conversation, UsersList list);
|
|
|
|
|
2018-12-02 20:26:49 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This slot is triggered once we have got a new list of conversations
|
|
|
|
*
|
|
|
|
* @param success TRUE for a success / FALSE else
|
|
|
|
* @param list The list of conversation (empty list in case of failure)
|
|
|
|
*/
|
2018-12-03 20:18:12 +00:00
|
|
|
void onGotConversationsList(bool success, const ConversationsList &list);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This slot is triggered once we have information about the users
|
|
|
|
*
|
|
|
|
* @param success TRUE in case of success / FALSE else
|
|
|
|
* @param users The list of suers (empty list in case of failure)
|
|
|
|
*/
|
2018-12-07 10:31:42 +00:00
|
|
|
void onGotUsersInfo(bool success, const UsersList &users);
|
2018-12-02 20:26:49 +00:00
|
|
|
|
2018-12-09 20:25:01 +00:00
|
|
|
/**
|
|
|
|
* Triggered when a conversation item request a conversation to opened
|
|
|
|
*/
|
|
|
|
void onRequestOpenConversation();
|
|
|
|
|
2018-12-02 20:26:49 +00:00
|
|
|
private:
|
|
|
|
ConversationsListHelper *mConversationsList;
|
2018-12-03 20:18:12 +00:00
|
|
|
UsersHelper *mUsersHelper;
|
|
|
|
|
2018-12-09 20:25:01 +00:00
|
|
|
//Current conversations list in cache
|
2018-12-03 20:18:12 +00:00
|
|
|
ConversationsList mCurrList;
|
2018-12-09 20:25:01 +00:00
|
|
|
|
|
|
|
//Current opened conversation
|
|
|
|
Conversation mCurrentConversation;
|
2018-12-02 20:26:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONVERSATIONSLISTWIDGET_H
|