comunicmessages/widgets/conversationslistwidget.h

78 lines
2.0 KiB
C
Raw Normal View History

2018-12-02 20:26:49 +00:00
#ifndef CONVERSATIONSLISTWIDGET_H
#define CONVERSATIONSLISTWIDGET_H
#include <QWidget>
#include "../data/conversationslist.h"
2018-12-07 10:31:42 +00:00
#include "../data/userslist.h"
#include "../data/user.h"
2018-12-02 20:26:49 +00:00
class ConversationsListHelper;
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();
/**
* This method is used to update the currently active conversation
*
* @param currentConversation The current conversation
*/
void setCurrentConversation(const Conversation &currentConversation);
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)
*/
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
/**
* Triggered when a conversation item request a conversation to opened
*/
void onRequestOpenConversation();
2018-12-02 20:26:49 +00:00
private:
ConversationsListHelper *mConversationsList;
UsersHelper *mUsersHelper;
//Current conversations list in cache
ConversationsList mCurrList;
//Current opened conversation
Conversation mCurrentConversation;
2018-12-02 20:26:49 +00:00
};
#endif // CONVERSATIONSLISTWIDGET_H