Remove unused variables, Refactor in MessageLayout (#4520)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Daniel Sage
2023-04-08 06:25:43 -04:00
committed by GitHub
parent 4e3433e966
commit 73435b4cf4
2 changed files with 72 additions and 60 deletions
+22 -18
View File
@@ -2,6 +2,7 @@
#include "common/Common.hpp"
#include "common/FlagsEnum.hpp"
#include "messages/layouts/MessageLayoutContainer.hpp"
#include <boost/noncopyable.hpp>
#include <QPixmap>
@@ -69,27 +70,30 @@ public:
bool isReplyable() const;
private:
// variables
MessagePtr message_;
std::shared_ptr<MessageLayoutContainer> container_;
std::shared_ptr<QPixmap> buffer_{};
bool bufferValid_ = false;
int height_ = 0;
int currentLayoutWidth_ = -1;
int layoutState_ = -1;
float scale_ = -1;
unsigned int layoutCount_ = 0;
unsigned int bufferUpdatedCount_ = 0;
MessageElementFlags currentWordFlags_;
int collapsedHeight_ = 32;
// methods
void actuallyLayout(int width, MessageElementFlags flags);
void updateBuffer(QPixmap *pixmap, int messageIndex, Selection &selection);
// Create new buffer if required, returning the buffer
QPixmap *ensureBuffer(QPainter &painter, int width);
// variables
MessagePtr message_;
MessageLayoutContainer container_;
std::unique_ptr<QPixmap> buffer_{};
bool bufferValid_ = false;
int height_ = 0;
int currentLayoutWidth_ = -1;
int layoutState_ = -1;
float scale_ = -1;
MessageElementFlags currentWordFlags_;
#ifdef FOURTF
// Debug counters
unsigned int layoutCount_ = 0;
unsigned int bufferUpdatedCount_ = 0;
#endif
};
using MessageLayoutPtr = std::shared_ptr<MessageLayout>;