Allow ChannelViews without a Split (#4747)

This commit is contained in:
nerix
2023-12-17 21:49:37 +01:00
committed by GitHub
parent 269e7a07b4
commit d105a68dba
4 changed files with 69 additions and 9 deletions
+24 -2
View File
@@ -75,7 +75,23 @@ public:
Search,
};
explicit ChannelView(BaseWidget *parent = nullptr, Split *split = nullptr,
/// Creates a channel view without a split.
/// In such a view, usercards and reply-threads can't be opened.
///
/// @param parent The parent of this widget. Can be `nullptr`.
/// @param context The context in which this view is shown (e.g. as a usercard).
/// @param messagesLimit The maximum amount of messages this view will display.
explicit ChannelView(QWidget *parent, Context context = Context::None,
size_t messagesLimit = 1000);
/// Creates a channel view in a split.
///
/// @param parent The parent of this widget.
/// @param split The split containing this widget.
/// @a split must be in the widget tree of @a parent.
/// @param context The context in which this view is shown (e.g. as a usercard).
/// @param messagesLimit The maximum amount of messages this view will display.
explicit ChannelView(QWidget *parent, Split *split,
Context context = Context::None,
size_t messagesLimit = 1000);
@@ -192,6 +208,12 @@ protected:
QPoint &relativePos, int &index);
private:
struct InternalCtor {
};
ChannelView(InternalCtor tag, QWidget *parent, Split *split,
Context context, size_t messagesLimit);
void initializeLayout();
void initializeScrollbar();
void initializeSignals();
@@ -270,7 +292,7 @@ private:
ChannelPtr channel_ = nullptr;
ChannelPtr underlyingChannel_ = nullptr;
ChannelPtr sourceChannel_ = nullptr;
Split *split_ = nullptr;
Split *split_;
Scrollbar *scrollBar_;
EffectLabel *goToBottom_{};