2017-06-06 17:18:23 +02:00
|
|
|
#pragma once
|
2017-01-01 02:30:42 +01:00
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "common/FlagsEnum.hpp"
|
|
|
|
#include "messages/LimitedQueue.hpp"
|
|
|
|
#include "messages/LimitedQueueSnapshot.hpp"
|
|
|
|
#include "messages/Selection.hpp"
|
2022-12-24 11:32:08 +01:00
|
|
|
#include "util/ThreadGuard.hpp"
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
|
|
|
|
|
|
|
#include <pajlada/signals/signal.hpp>
|
2022-12-31 15:41:01 +01:00
|
|
|
#include <QMenu>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QPaintEvent>
|
2017-01-26 04:26:40 +01:00
|
|
|
#include <QScroller>
|
2017-10-11 10:34:04 +02:00
|
|
|
#include <QTimer>
|
2022-09-11 16:37:13 +02:00
|
|
|
#include <QVariantAnimation>
|
2017-01-26 04:26:40 +01:00
|
|
|
#include <QWheelEvent>
|
2017-01-18 04:33:30 +01:00
|
|
|
#include <QWidget>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
|
2018-11-03 21:26:57 +01:00
|
|
|
#include <unordered_map>
|
2017-12-26 18:24:02 +01:00
|
|
|
#include <unordered_set>
|
2017-09-16 00:05:06 +02:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
2018-08-11 22:23:06 +02:00
|
|
|
enum class HighlightState;
|
2017-06-11 11:36:42 +02:00
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
class Channel;
|
|
|
|
using ChannelPtr = std::shared_ptr<Channel>;
|
|
|
|
|
2018-11-03 21:26:57 +01:00
|
|
|
struct Message;
|
|
|
|
using MessagePtr = std::shared_ptr<const Message>;
|
|
|
|
|
2022-10-03 20:55:46 +02:00
|
|
|
enum class MessageFlag : int64_t;
|
2018-11-03 21:26:57 +01:00
|
|
|
using MessageFlags = FlagsEnum<MessageFlag>;
|
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
class MessageLayout;
|
|
|
|
using MessageLayoutPtr = std::shared_ptr<MessageLayout>;
|
|
|
|
|
2020-10-25 10:36:00 +01:00
|
|
|
enum class MessageElementFlag : int64_t;
|
2018-08-11 22:23:06 +02:00
|
|
|
using MessageElementFlags = FlagsEnum<MessageElementFlag>;
|
|
|
|
|
|
|
|
class Scrollbar;
|
|
|
|
class EffectLabel;
|
|
|
|
struct Link;
|
|
|
|
class MessageLayoutElement;
|
2022-07-31 12:45:25 +02:00
|
|
|
class Split;
|
2022-12-31 15:41:01 +01:00
|
|
|
class FilterSet;
|
|
|
|
using FilterSetPtr = std::shared_ptr<FilterSet>;
|
2018-08-11 22:23:06 +02:00
|
|
|
|
2018-11-03 21:26:57 +01:00
|
|
|
enum class PauseReason {
|
|
|
|
Mouse,
|
|
|
|
Selection,
|
|
|
|
DoubleClick,
|
2019-09-16 10:40:02 +02:00
|
|
|
KeyboardModifier,
|
2018-11-03 21:26:57 +01:00
|
|
|
};
|
|
|
|
|
2021-07-11 13:54:19 +02:00
|
|
|
enum class FromTwitchLinkOpenChannelIn {
|
|
|
|
Split,
|
|
|
|
Tab,
|
|
|
|
BrowserPlayer,
|
|
|
|
Streamlink,
|
|
|
|
};
|
|
|
|
|
2018-11-03 21:26:57 +01:00
|
|
|
using SteadyClock = std::chrono::steady_clock;
|
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
class ChannelView final : public BaseWidget
|
2017-01-01 02:30:42 +01:00
|
|
|
{
|
2017-09-16 00:05:06 +02:00
|
|
|
Q_OBJECT
|
2017-09-12 19:06:16 +02:00
|
|
|
|
2017-01-01 02:30:42 +01:00
|
|
|
public:
|
2022-07-31 12:45:25 +02:00
|
|
|
enum class Context {
|
|
|
|
None,
|
|
|
|
UserCard,
|
|
|
|
ReplyThread,
|
|
|
|
Search,
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit ChannelView(BaseWidget *parent = nullptr, Split *split = nullptr,
|
2022-11-12 16:53:42 +01:00
|
|
|
Context context = Context::None,
|
|
|
|
size_t messagesLimit = 1000);
|
2017-01-16 03:15:07 +01:00
|
|
|
|
2017-10-11 10:34:04 +02:00
|
|
|
void queueUpdate();
|
2018-01-06 03:48:56 +01:00
|
|
|
Scrollbar &getScrollBar();
|
2022-12-03 14:02:39 +01:00
|
|
|
|
2017-09-16 00:05:06 +02:00
|
|
|
QString getSelectedText();
|
2017-09-21 02:20:02 +02:00
|
|
|
bool hasSelection();
|
|
|
|
void clearSelection();
|
2022-12-03 14:02:39 +01:00
|
|
|
/**
|
|
|
|
* Copies the currently selected text to the users clipboard.
|
|
|
|
*
|
|
|
|
* @see ::getSelectedText()
|
|
|
|
*/
|
|
|
|
void copySelectedText();
|
|
|
|
|
2017-12-28 00:48:21 +01:00
|
|
|
void setEnableScrollingToBottom(bool);
|
|
|
|
bool getEnableScrollingToBottom() const;
|
2018-08-07 07:55:31 +02:00
|
|
|
void setOverrideFlags(boost::optional<MessageElementFlags> value);
|
|
|
|
const boost::optional<MessageElementFlags> &getOverrideFlags() const;
|
2018-01-23 22:48:33 +01:00
|
|
|
void updateLastReadMessage();
|
2017-09-16 00:05:06 +02:00
|
|
|
|
2022-09-11 16:37:13 +02:00
|
|
|
/**
|
|
|
|
* Attempts to scroll to a message in this channel.
|
|
|
|
* @return <code>true</code> if the message was found and highlighted.
|
|
|
|
*/
|
|
|
|
bool scrollToMessage(const MessagePtr &message);
|
|
|
|
/**
|
|
|
|
* Attempts to scroll to a message id in this channel.
|
|
|
|
* @return <code>true</code> if the message was found and highlighted.
|
|
|
|
*/
|
|
|
|
bool scrollToMessageId(const QString &id);
|
|
|
|
|
2018-11-14 17:26:08 +01:00
|
|
|
/// Pausing
|
2018-12-02 18:37:51 +01:00
|
|
|
bool pausable() const;
|
|
|
|
void setPausable(bool value);
|
2018-11-03 21:26:57 +01:00
|
|
|
bool paused() const;
|
|
|
|
void pause(PauseReason reason, boost::optional<uint> msecs = boost::none);
|
|
|
|
void unpause(PauseReason reason);
|
|
|
|
|
2022-05-23 02:47:16 +02:00
|
|
|
MessageElementFlags getFlags() const;
|
|
|
|
|
2018-11-14 17:26:08 +01:00
|
|
|
ChannelPtr channel();
|
2018-06-13 13:27:10 +02:00
|
|
|
void setChannel(ChannelPtr channel_);
|
2018-11-14 17:26:08 +01:00
|
|
|
|
2020-10-18 15:16:56 +02:00
|
|
|
void setFilters(const QList<QUuid> &ids);
|
|
|
|
const QList<QUuid> getFilterIds() const;
|
|
|
|
FilterSetPtr getFilterSet() const;
|
|
|
|
|
2020-06-21 14:15:14 +02:00
|
|
|
ChannelPtr sourceChannel() const;
|
|
|
|
void setSourceChannel(ChannelPtr sourceChannel);
|
|
|
|
bool hasSourceChannel() const;
|
|
|
|
|
2022-06-18 12:44:48 +02:00
|
|
|
LimitedQueueSnapshot<MessageLayoutPtr> &getMessagesSnapshot();
|
2018-11-03 21:26:57 +01:00
|
|
|
void queueLayout();
|
2017-09-16 00:05:06 +02:00
|
|
|
|
|
|
|
void clearMessages();
|
2022-04-09 13:27:21 +02:00
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
Context getContext() const;
|
|
|
|
|
2022-04-09 13:27:21 +02:00
|
|
|
/**
|
|
|
|
* @brief Creates and shows a UserInfoPopup dialog
|
|
|
|
*
|
|
|
|
* @param userName The login name of the user
|
|
|
|
* @param alternativePopoutChannel Optional parameter containing the channel name to use for context
|
|
|
|
**/
|
|
|
|
void showUserInfoPopup(const QString &userName,
|
|
|
|
QString alternativePopoutChannel = QString());
|
2017-02-07 00:03:15 +01:00
|
|
|
|
2022-09-11 16:37:13 +02:00
|
|
|
/**
|
|
|
|
* @brief This method is meant to be used when filtering out channels.
|
|
|
|
* It <b>must</b> return true if a message belongs in this channel.
|
|
|
|
* It <b>might</b> return true if a message doesn't belong in this channel.
|
|
|
|
*/
|
|
|
|
bool mayContainMessage(const MessagePtr &message);
|
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
|
|
|
pajlada::Signals::NoArgSignal selectionChanged;
|
2018-04-10 16:53:40 +02:00
|
|
|
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
|
2018-10-13 14:20:06 +02:00
|
|
|
pajlada::Signals::NoArgSignal liveStatusChanged;
|
2018-06-28 19:38:57 +02:00
|
|
|
pajlada::Signals::Signal<const Link &> linkClicked;
|
2021-07-11 13:54:19 +02:00
|
|
|
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>
|
|
|
|
openChannelIn;
|
2017-09-16 16:49:52 +02:00
|
|
|
|
2017-01-03 21:19:33 +01:00
|
|
|
protected:
|
2018-07-06 17:11:37 +02:00
|
|
|
void themeChangedEvent() override;
|
2018-12-02 18:26:21 +01:00
|
|
|
void scaleChangedEvent(float scale) override;
|
2018-01-24 20:35:26 +01:00
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
void resizeEvent(QResizeEvent *) override;
|
2017-01-03 21:19:33 +01:00
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
void paintEvent(QPaintEvent *) override;
|
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2017-01-26 04:26:40 +01:00
|
|
|
|
2023-02-11 18:13:29 +01:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
void enterEvent(QEnterEvent * /*event*/) override;
|
|
|
|
#else
|
|
|
|
void enterEvent(QEvent * /*event*/) override;
|
|
|
|
#endif
|
2018-04-03 02:55:32 +02:00
|
|
|
void leaveEvent(QEvent *) override;
|
2018-01-05 11:22:51 +01:00
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2018-01-24 21:44:31 +01:00
|
|
|
|
2018-04-18 09:12:29 +02:00
|
|
|
void hideEvent(QHideEvent *) override;
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
void handleLinkClick(QMouseEvent *event, const Link &link,
|
|
|
|
MessageLayout *layout);
|
2017-02-17 23:51:35 +01:00
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
bool tryGetMessageAt(QPoint p, std::shared_ptr<MessageLayout> &message,
|
|
|
|
QPoint &relativePos, int &index);
|
2017-02-17 23:51:35 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
private:
|
2018-08-08 20:06:20 +02:00
|
|
|
void initializeLayout();
|
|
|
|
void initializeScrollbar();
|
|
|
|
void initializeSignals();
|
|
|
|
|
2018-11-03 21:26:57 +01:00
|
|
|
void messageAppended(MessagePtr &message,
|
|
|
|
boost::optional<MessageFlags> overridingFlags);
|
|
|
|
void messageAddedAtStart(std::vector<MessagePtr> &messages);
|
|
|
|
void messageRemoveFromStart(MessagePtr &message);
|
|
|
|
void messageReplaced(size_t index, MessagePtr &replacement);
|
2022-08-06 18:18:34 +02:00
|
|
|
void messagesUpdated();
|
2018-08-08 20:06:20 +02:00
|
|
|
|
2022-11-16 00:32:15 +01:00
|
|
|
void performLayout(bool causedByScrollbar = false);
|
2018-11-03 21:26:57 +01:00
|
|
|
void layoutVisibleMessages(
|
2022-12-07 20:40:15 +01:00
|
|
|
const LimitedQueueSnapshot<MessageLayoutPtr> &messages);
|
|
|
|
void updateScrollbar(const LimitedQueueSnapshot<MessageLayoutPtr> &messages,
|
2018-11-03 21:26:57 +01:00
|
|
|
bool causedByScrollbar);
|
2018-07-06 19:23:47 +02:00
|
|
|
|
|
|
|
void drawMessages(QPainter &painter);
|
|
|
|
void setSelection(const SelectionItem &start, const SelectionItem &end);
|
2018-10-02 13:41:34 +02:00
|
|
|
void selectWholeMessage(MessageLayout *layout, int &messageIndex);
|
2018-10-06 13:43:21 +02:00
|
|
|
void getWordBounds(MessageLayout *layout,
|
|
|
|
const MessageLayoutElement *element,
|
|
|
|
const QPoint &relativePos, int &wordStart, int &wordEnd);
|
2018-07-06 19:23:47 +02:00
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
void handleMouseClick(QMouseEvent *event,
|
2022-02-13 01:46:39 +01:00
|
|
|
const MessageLayoutElement *hoveredElement,
|
2020-07-05 13:52:24 +02:00
|
|
|
MessageLayoutPtr layout);
|
2018-08-06 21:17:03 +02:00
|
|
|
void addContextMenuItems(const MessageLayoutElement *hoveredElement,
|
2022-01-16 14:35:00 +01:00
|
|
|
MessageLayoutPtr layout, QMouseEvent *event);
|
2022-02-13 01:46:39 +01:00
|
|
|
void addImageContextMenuItems(const MessageLayoutElement *hoveredElement,
|
|
|
|
MessageLayoutPtr layout, QMouseEvent *event,
|
|
|
|
QMenu &menu);
|
|
|
|
void addLinkContextMenuItems(const MessageLayoutElement *hoveredElement,
|
|
|
|
MessageLayoutPtr layout, QMouseEvent *event,
|
|
|
|
QMenu &menu);
|
|
|
|
void addMessageContextMenuItems(const MessageLayoutElement *hoveredElement,
|
|
|
|
MessageLayoutPtr layout, QMouseEvent *event,
|
|
|
|
QMenu &menu);
|
|
|
|
void addTwitchLinkContextMenuItems(
|
|
|
|
const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout,
|
|
|
|
QMouseEvent *event, QMenu &menu);
|
|
|
|
void addHiddenContextMenuItems(const MessageLayoutElement *hoveredElement,
|
|
|
|
MessageLayoutPtr layout, QMouseEvent *event,
|
|
|
|
QMenu &menu);
|
2022-05-22 16:45:54 +02:00
|
|
|
void addCommandExecutionContextMenuItems(
|
|
|
|
const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout,
|
|
|
|
QMouseEvent *event, QMenu &menu);
|
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
int getLayoutWidth() const;
|
2019-09-25 23:47:13 +02:00
|
|
|
void updatePauses();
|
|
|
|
void unpaused();
|
2018-07-06 19:23:47 +02:00
|
|
|
|
2020-04-18 11:09:22 +02:00
|
|
|
void enableScrolling(const QPointF &scrollStart);
|
|
|
|
void disableScrolling();
|
|
|
|
|
2022-09-11 16:37:13 +02:00
|
|
|
/**
|
|
|
|
* Scrolls to a message layout that must be from this view.
|
|
|
|
*
|
|
|
|
* @param layout Must be from this channel.
|
|
|
|
* @param messageIdx Must be an index into this channel.
|
|
|
|
*/
|
|
|
|
void scrollToMessageLayout(MessageLayout *layout, size_t messageIdx);
|
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
void setInputReply(const MessagePtr &message);
|
|
|
|
void showReplyThreadPopup(const MessagePtr &message);
|
|
|
|
bool canReplyToMessages() const;
|
|
|
|
|
2018-06-13 13:27:10 +02:00
|
|
|
QTimer *layoutCooldown_;
|
|
|
|
bool layoutQueued_;
|
2018-04-06 18:27:49 +02:00
|
|
|
|
2018-06-13 13:27:10 +02:00
|
|
|
QTimer updateTimer_;
|
|
|
|
bool updateQueued_ = false;
|
|
|
|
bool messageWasAdded_ = false;
|
|
|
|
bool lastMessageHasAlternateBackground_ = false;
|
2018-11-03 21:40:48 +01:00
|
|
|
bool lastMessageHasAlternateBackgroundReverse_ = true;
|
2018-05-17 17:27:20 +02:00
|
|
|
|
2018-12-02 18:37:51 +01:00
|
|
|
bool pausable_ = false;
|
2018-11-03 21:26:57 +01:00
|
|
|
QTimer pauseTimer_;
|
|
|
|
std::unordered_map<PauseReason, boost::optional<SteadyClock::time_point>>
|
|
|
|
pauses_;
|
2018-12-04 08:56:07 +01:00
|
|
|
boost::optional<SteadyClock::time_point> pauseEnd_;
|
|
|
|
int pauseScrollOffset_ = 0;
|
2022-11-16 00:32:15 +01:00
|
|
|
// Keeps track how many message indices we need to offset the selection when we resume scrolling
|
|
|
|
uint32_t pauseSelectionOffset_ = 0;
|
2018-05-17 17:27:20 +02:00
|
|
|
|
2018-08-07 07:55:31 +02:00
|
|
|
boost::optional<MessageElementFlags> overrideFlags_;
|
2018-06-28 19:38:57 +02:00
|
|
|
MessageLayoutPtr lastReadMessage_;
|
2018-01-05 11:22:51 +01:00
|
|
|
|
2022-12-24 11:32:08 +01:00
|
|
|
ThreadGuard snapshotGuard_;
|
2018-06-28 19:38:57 +02:00
|
|
|
LimitedQueueSnapshot<MessageLayoutPtr> snapshot_;
|
2017-09-17 02:13:57 +02:00
|
|
|
|
2020-11-01 15:23:58 +01:00
|
|
|
ChannelPtr channel_ = nullptr;
|
|
|
|
ChannelPtr underlyingChannel_ = nullptr;
|
|
|
|
ChannelPtr sourceChannel_ = nullptr;
|
2022-07-31 12:45:25 +02:00
|
|
|
Split *split_ = nullptr;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
Scrollbar *scrollBar_;
|
2018-08-08 15:35:54 +02:00
|
|
|
EffectLabel *goToBottom_;
|
2022-09-11 16:37:13 +02:00
|
|
|
bool showScrollBar_ = false;
|
2017-02-07 00:03:15 +01:00
|
|
|
|
2020-10-18 15:16:56 +02:00
|
|
|
FilterSetPtr channelFilters_;
|
|
|
|
|
|
|
|
// Returns true if message should be included
|
|
|
|
bool shouldIncludeMessage(const MessagePtr &m) const;
|
|
|
|
|
|
|
|
// Returns whether the scrollbar should have highlights
|
|
|
|
bool showScrollbarHighlights() const;
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
// This variable can be used to decide whether or not we should render the
|
|
|
|
// "Show latest messages" button
|
2018-06-13 13:27:10 +02:00
|
|
|
bool showingLatestMessages_ = true;
|
|
|
|
bool enableScrollingToBottom_ = true;
|
2017-06-06 17:22:16 +02:00
|
|
|
|
2018-06-13 13:27:10 +02:00
|
|
|
bool onlyUpdateEmotes_ = false;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
// Mouse event variables
|
2020-04-18 11:09:22 +02:00
|
|
|
bool isLeftMouseDown_ = false;
|
2018-06-13 13:27:10 +02:00
|
|
|
bool isRightMouseDown_ = false;
|
2018-10-06 13:43:21 +02:00
|
|
|
bool isDoubleClick_ = false;
|
2018-11-14 17:26:08 +01:00
|
|
|
DoubleClickSelection doubleClickSelection_;
|
2020-04-18 11:09:22 +02:00
|
|
|
QPointF lastLeftPressPosition_;
|
2018-06-13 13:27:10 +02:00
|
|
|
QPointF lastRightPressPosition_;
|
2018-10-06 14:56:15 +02:00
|
|
|
QPointF lastDClickPosition_;
|
2018-10-02 12:56:10 +02:00
|
|
|
QTimer *clickTimer_;
|
2017-01-22 12:46:35 +01:00
|
|
|
|
2020-04-18 11:09:22 +02:00
|
|
|
bool isScrolling_ = false;
|
|
|
|
QPointF lastMiddlePressPosition_;
|
|
|
|
QPointF currentMousePosition_;
|
|
|
|
QTimer scrollTimer_;
|
|
|
|
|
2022-09-11 16:37:13 +02:00
|
|
|
// We're only interested in the pointer, not the contents
|
2022-11-04 19:59:03 +01:00
|
|
|
MessageLayout *highlightedMessage_ = nullptr;
|
2022-09-11 16:37:13 +02:00
|
|
|
QVariantAnimation highlightAnimation_;
|
|
|
|
void setupHighlightAnimationColors();
|
|
|
|
|
2020-04-18 11:09:22 +02:00
|
|
|
struct {
|
|
|
|
QCursor neutral;
|
|
|
|
QCursor up;
|
|
|
|
QCursor down;
|
|
|
|
} cursors_;
|
|
|
|
|
2018-06-28 19:38:57 +02:00
|
|
|
Selection selection_;
|
2018-06-13 13:27:10 +02:00
|
|
|
bool selecting_ = false;
|
2017-08-18 15:12:07 +02:00
|
|
|
|
2022-07-31 12:45:25 +02:00
|
|
|
const Context context_;
|
|
|
|
|
2018-11-14 17:26:08 +01:00
|
|
|
LimitedQueue<MessageLayoutPtr> messages_;
|
2017-09-16 00:05:06 +02:00
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
pajlada::Signals::SignalHolder signalHolder_;
|
|
|
|
|
|
|
|
// channelConnections_ will be cleared when the underlying channel of the channelview changes
|
|
|
|
pajlada::Signals::SignalHolder channelConnections_;
|
2017-12-26 18:24:02 +01:00
|
|
|
|
2018-06-28 19:38:57 +02:00
|
|
|
std::unordered_set<std::shared_ptr<MessageLayout>> messagesOnScreen_;
|
2017-12-26 18:24:02 +01:00
|
|
|
|
2018-12-02 17:49:15 +01:00
|
|
|
static constexpr int leftPadding = 8;
|
|
|
|
static constexpr int scrollbarPadding = 8;
|
|
|
|
|
2017-01-22 12:46:35 +01:00
|
|
|
private slots:
|
2018-01-17 17:02:34 +01:00
|
|
|
void wordFlagsChanged()
|
2017-01-22 12:46:35 +01:00
|
|
|
{
|
2018-11-03 21:26:57 +01:00
|
|
|
queueLayout();
|
2017-02-07 00:03:15 +01:00
|
|
|
update();
|
2017-01-22 12:46:35 +01:00
|
|
|
}
|
2020-04-18 11:09:22 +02:00
|
|
|
|
|
|
|
void scrollUpdateRequested();
|
2017-01-01 02:30:42 +01:00
|
|
|
};
|
2017-06-06 17:18:23 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|