2018-12-07 10:31:42 +00:00
|
|
|
/**
|
|
|
|
* Conversation item widget
|
|
|
|
*
|
|
|
|
* Contains information about a single conversation
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
#ifndef CONVERSATIONITEMWIDGET_H
|
|
|
|
#define CONVERSATIONITEMWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2018-12-09 20:25:01 +00:00
|
|
|
#include "../data/conversation.h"
|
|
|
|
|
2018-12-07 10:31:42 +00:00
|
|
|
namespace Ui {
|
|
|
|
class ConversationItemWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class User;
|
|
|
|
class UsersList;
|
|
|
|
|
|
|
|
class ConversationItemWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConversationItemWidget(QWidget *parent = nullptr);
|
2018-12-09 20:25:01 +00:00
|
|
|
~ConversationItemWidget() override;
|
2018-12-07 10:31:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Apply a conversation to the widget
|
|
|
|
*
|
|
|
|
* @param conv Information about the conversation to apply
|
|
|
|
* @param list Information about potential users of the conversation
|
|
|
|
*/
|
|
|
|
void setConversation(const Conversation &conv, const UsersList &list);
|
|
|
|
|
2018-12-09 20:25:01 +00:00
|
|
|
/**
|
|
|
|
* Get the current conversation represented by this widget
|
|
|
|
*
|
|
|
|
* @return The current conversation of this widget
|
|
|
|
*/
|
|
|
|
Conversation currentConversation() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark the current conversation as active or not
|
|
|
|
*
|
|
|
|
* @param active TRUE to mark the conversation as active /
|
|
|
|
* FALSE else
|
|
|
|
*/
|
|
|
|
void setActive(bool active);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent *) override;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request the conversation represented by this widget to be opened
|
|
|
|
*/
|
|
|
|
void openConversation();
|
|
|
|
|
2018-12-07 10:31:42 +00:00
|
|
|
private:
|
|
|
|
Ui::ConversationItemWidget *ui;
|
2018-12-09 20:25:01 +00:00
|
|
|
Conversation mCurrentConversation;
|
2018-12-07 10:31:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONVERSATIONITEMWIDGET_H
|