Remove getApp and getSettings calls from Message-Rendering (#4535)
* refactor: remove singletons from message rendering
* chore: add changelog entry
* Disable the `cppcoreguidelines-avoid-const-or-ref-data-members` clang-tidy check
* auto *app
* Selection is a struct, not a class
* Use ChannelView's `signalHolder_` instead of `channelConnections_`
* Remove `applySettings` step, instead just connect & set each setting individually
* rename & constify some context values
* Handle empty "last message color" setting value better (as it was
originally in this pr before I removed that change :-)
* unrelated mini refactor cleanup
* let painSelection handle size_t instead of int
* Add some more comments to the MessageLayoutContext structs
---------
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -18,6 +18,7 @@ using MessagePtr = std::shared_ptr<const Message>;
|
||||
struct Selection;
|
||||
struct MessageLayoutContainer;
|
||||
class MessageLayoutElement;
|
||||
struct MessagePaintContext;
|
||||
|
||||
enum class MessageElementFlag : int64_t;
|
||||
using MessageElementFlags = FlagsEnum<MessageElementFlag>;
|
||||
@@ -49,9 +50,7 @@ public:
|
||||
bool layout(int width, float scale_, MessageElementFlags flags);
|
||||
|
||||
// Painting
|
||||
void paint(QPainter &painter, int width, int y, int messageIndex,
|
||||
Selection &selection, bool isLastReadMessage,
|
||||
bool isWindowFocused, bool isMentions);
|
||||
void paint(const MessagePaintContext &ctx);
|
||||
void invalidateBuffer();
|
||||
void deleteBuffer();
|
||||
void deleteCache();
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
private:
|
||||
// methods
|
||||
void actuallyLayout(int width, MessageElementFlags flags);
|
||||
void updateBuffer(QPixmap *pixmap, int messageIndex, Selection &selection);
|
||||
void updateBuffer(QPixmap *buffer, const MessagePaintContext &ctx);
|
||||
|
||||
// Create new buffer if required, returning the buffer
|
||||
QPixmap *ensureBuffer(QPainter &painter, int width);
|
||||
|
||||
Reference in New Issue
Block a user