2018-06-06 13:35:06 +02:00
|
|
|
#pragma once
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
#include "widgets/DraggablePopup.hpp"
|
2023-12-09 13:21:00 +01:00
|
|
|
#include "widgets/helper/EffectLabel.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
#include <pajlada/signals/scoped-connection.hpp>
|
2018-06-06 13:35:06 +02:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-01-16 12:31:48 +01:00
|
|
|
#include <chrono>
|
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
class QCheckBox;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
class Channel;
|
|
|
|
using ChannelPtr = std::shared_ptr<Channel>;
|
2018-06-11 21:57:17 +02:00
|
|
|
class Label;
|
2022-12-31 15:41:01 +01:00
|
|
|
class ChannelView;
|
|
|
|
class Split;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
class UserInfoPopup final : public DraggablePopup
|
2018-06-06 13:35:06 +02:00
|
|
|
{
|
2018-06-06 15:54:14 +02:00
|
|
|
Q_OBJECT
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
public:
|
2023-12-17 12:53:06 +01:00
|
|
|
/**
|
|
|
|
* @param closeAutomatically Decides whether the popup should close when it loses focus
|
|
|
|
* @param split Will be used as the popup's parent. Must not be null
|
|
|
|
*/
|
|
|
|
UserInfoPopup(bool closeAutomatically, Split *split);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
void setData(const QString &name, const ChannelPtr &channel);
|
2022-04-09 13:27:21 +02:00
|
|
|
void setData(const QString &name, const ChannelPtr &contextChannel,
|
|
|
|
const ChannelPtr &openingChannel);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-07 17:43:21 +02:00
|
|
|
protected:
|
2023-10-25 18:13:48 +02:00
|
|
|
void themeChangedEvent() override;
|
|
|
|
void scaleChangedEvent(float scale) override;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
private:
|
2018-07-06 19:23:47 +02:00
|
|
|
void installEvents();
|
|
|
|
void updateUserData();
|
2020-06-21 14:15:14 +02:00
|
|
|
void updateLatestMessages();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
void loadAvatar(const QUrl &url);
|
2023-09-09 13:11:19 +02:00
|
|
|
bool isMod_{};
|
|
|
|
bool isBroadcaster_{};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
Split *split_;
|
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
QString userName_;
|
2018-06-06 15:54:14 +02:00
|
|
|
QString userId_;
|
2021-03-14 15:09:16 +01:00
|
|
|
QString avatarUrl_;
|
2022-11-12 13:21:43 +01:00
|
|
|
|
2022-04-09 13:27:21 +02:00
|
|
|
// The channel the popup was opened from (e.g. /mentions or #forsen). Can be a special channel.
|
2018-06-06 13:35:06 +02:00
|
|
|
ChannelPtr channel_;
|
2022-11-12 13:21:43 +01:00
|
|
|
|
2022-04-09 13:27:21 +02:00
|
|
|
// The channel the messages are rendered from (e.g. #forsen). Can be a special channel, but will try to not be where possible.
|
|
|
|
ChannelPtr underlyingChannel_;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
pajlada::Signals::NoArgSignal userStateChanged_;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
std::unique_ptr<pajlada::Signals::ScopedConnection> refreshConnection_;
|
2020-09-26 16:59:40 +02:00
|
|
|
|
2022-11-12 13:21:43 +01:00
|
|
|
// If we should close the dialog automatically if the user clicks out
|
2023-07-01 18:38:55 +02:00
|
|
|
// Set based on the "Automatically close usercard when it loses focus" setting
|
|
|
|
// Pinned status is tracked in DraggablePopup::isPinned_.
|
|
|
|
const bool closeAutomatically_;
|
2022-11-12 13:21:43 +01:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
struct {
|
2018-08-08 15:35:54 +02:00
|
|
|
Button *avatarButton = nullptr;
|
2021-11-06 13:44:27 +01:00
|
|
|
Button *localizedNameCopyButton = nullptr;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-11 21:57:17 +02:00
|
|
|
Label *nameLabel = nullptr;
|
2021-11-06 13:44:27 +01:00
|
|
|
Label *localizedNameLabel = nullptr;
|
2018-06-11 21:57:17 +02:00
|
|
|
Label *followerCountLabel = nullptr;
|
|
|
|
Label *createdDateLabel = nullptr;
|
2019-08-31 17:58:28 +02:00
|
|
|
Label *userIDLabel = nullptr;
|
2020-10-21 17:02:24 +02:00
|
|
|
Label *followageLabel = nullptr;
|
|
|
|
Label *subageLabel = nullptr;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2021-02-14 14:01:13 +01:00
|
|
|
QCheckBox *block = nullptr;
|
2018-06-06 13:35:06 +02:00
|
|
|
QCheckBox *ignoreHighlights = nullptr;
|
2020-06-21 14:15:14 +02:00
|
|
|
|
|
|
|
Label *noMessagesLabel = nullptr;
|
|
|
|
ChannelView *latestMessages = nullptr;
|
2023-12-09 13:21:00 +01:00
|
|
|
|
|
|
|
EffectLabel2 *usercardLabel = nullptr;
|
2018-06-06 13:35:06 +02:00
|
|
|
} ui_;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
class TimeoutWidget : public BaseWidget
|
|
|
|
{
|
|
|
|
public:
|
2018-06-06 16:17:34 +02:00
|
|
|
enum Action { Ban, Unban, Timeout };
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
TimeoutWidget();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 16:17:34 +02:00
|
|
|
pajlada::Signals::Signal<std::pair<Action, int>> buttonClicked;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
};
|
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-06 13:35:06 +02:00
|
|
|
} // namespace chatterino
|