2020-02-28 02:12:18 +01:00
|
|
|
#ifndef FEDIPOTATO_GUI_WIDGET_POST_HPP
|
|
|
|
#define FEDIPOTATO_GUI_WIDGET_POST_HPP
|
|
|
|
|
|
|
|
#include "../ui/ui_widget_post.h"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
namespace FediPotato
|
|
|
|
{
|
|
|
|
|
|
|
|
class PostWidget : public QWidget, private Ui::PostWidget
|
|
|
|
{
|
2020-02-28 04:36:42 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2020-02-28 02:12:18 +01:00
|
|
|
public:
|
|
|
|
//! Default constructor
|
|
|
|
explicit PostWidget(QWidget *parent = nullptr)
|
|
|
|
: QWidget{parent}
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Copy constructor
|
|
|
|
PostWidget(const PostWidget &other) = delete;
|
|
|
|
|
|
|
|
//! Move constructor
|
|
|
|
PostWidget(PostWidget &&other) noexcept = delete;
|
|
|
|
|
|
|
|
//! Destructor
|
|
|
|
~PostWidget() noexcept override = default;
|
|
|
|
|
|
|
|
//! Copy assignment operator
|
|
|
|
PostWidget& operator=(const PostWidget &other) = delete;
|
|
|
|
|
|
|
|
//! Move assignment operator
|
|
|
|
PostWidget& operator=(PostWidget &&other) noexcept = delete;
|
|
|
|
|
|
|
|
public:
|
|
|
|
inline void set_user(const QString &user)
|
|
|
|
{
|
|
|
|
label_user->setText(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void set_avatar(const QString &avatar)
|
|
|
|
{
|
|
|
|
label_avatar->setPixmap(QIcon(avatar).pixmap(QSize(50, 50)));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void set_subject(const QString &subject)
|
|
|
|
{
|
|
|
|
label_subject->setText(subject);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void set_content(const QString &content)
|
|
|
|
{
|
|
|
|
label_content->setText(content);
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_hide_elements();
|
2020-02-28 04:36:42 +01:00
|
|
|
|
|
|
|
private slots:
|
2020-03-02 00:01:05 +01:00
|
|
|
void toggled_button_show_more(const bool &toggled);
|
2020-02-28 02:12:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace FediPotato
|
|
|
|
|
|
|
|
#endif // FEDIPOTATO_GUI_WIDGET_POST_HPP
|