2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
#include "widgets/DraggablePopup.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
#include <pajlada/signals/scoped-connection.hpp>
|
2019-09-08 22:27:57 +02:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
|
2022-01-16 12:31:48 +01:00
|
|
|
#include <chrono>
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
class QCheckBox;
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Channel;
|
|
|
|
using ChannelPtr = std::shared_ptr<Channel>;
|
|
|
|
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
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-07-31 12:45:25 +02:00
|
|
|
UserInfoPopup(bool closeAutomatically, QWidget *parent,
|
|
|
|
Split *split = nullptr);
|
2019-09-08 22:27:57 +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
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void themeChangedEvent() override;
|
|
|
|
virtual void scaleChangedEvent(float scale) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void installEvents();
|
|
|
|
void updateUserData();
|
2020-06-21 14:15:14 +02:00
|
|
|
void updateLatestMessages();
|
2022-11-12 13:21:43 +01:00
|
|
|
void updateFocusLoss();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
void loadAvatar(const QUrl &url);
|
|
|
|
bool isMod_;
|
|
|
|
bool isBroadcaster_;
|
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
Split *split_;
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
QString userName_;
|
|
|
|
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.
|
2019-09-08 22:27:57 +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
|
|
|
|
|
|
|
pajlada::Signals::NoArgSignal userStateChanged_;
|
|
|
|
|
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
|
|
|
|
// Initially set based on the "Automatically close usercard when it loses focus" setting
|
|
|
|
// If that setting is enabled, this can be toggled on and off using the pin in the top-right corner
|
|
|
|
bool closeAutomatically_;
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
struct {
|
|
|
|
Button *avatarButton = nullptr;
|
2021-11-06 13:44:27 +01:00
|
|
|
Button *localizedNameCopyButton = nullptr;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
Label *nameLabel = nullptr;
|
2021-11-06 13:44:27 +01:00
|
|
|
Label *localizedNameLabel = nullptr;
|
2019-09-08 22:27:57 +02:00
|
|
|
Label *followerCountLabel = nullptr;
|
|
|
|
Label *createdDateLabel = nullptr;
|
|
|
|
Label *userIDLabel = nullptr;
|
2022-11-12 13:21:43 +01:00
|
|
|
// Can be uninitialized if usercard is not configured to close on focus loss
|
|
|
|
Button *pinButton = 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;
|
2019-09-08 22:27:57 +02:00
|
|
|
QCheckBox *ignoreHighlights = nullptr;
|
2020-06-21 14:15:14 +02:00
|
|
|
|
|
|
|
Label *noMessagesLabel = nullptr;
|
|
|
|
ChannelView *latestMessages = nullptr;
|
2019-09-08 22:27:57 +02:00
|
|
|
} ui_;
|
|
|
|
|
|
|
|
class TimeoutWidget : public BaseWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Action { Ban, Unban, Timeout };
|
|
|
|
|
|
|
|
TimeoutWidget();
|
|
|
|
|
|
|
|
pajlada::Signals::Signal<std::pair<Action, int>> buttonClicked;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|