added select channel dialog
This commit is contained in:
@@ -22,9 +22,6 @@ MessageLayout::MessageLayout(MessagePtr _message)
|
||||
: message(_message)
|
||||
, buffer(nullptr)
|
||||
{
|
||||
if (_message->flags & Message::Collapsed) {
|
||||
this->flags &= MessageLayout::Collapsed;
|
||||
}
|
||||
util::DebugCount::increase("message layout");
|
||||
}
|
||||
|
||||
@@ -90,11 +87,11 @@ bool MessageLayout::layout(int width, float scale, MessageElement::Flags flags)
|
||||
// update word sizes if needed
|
||||
if (imagesChanged) {
|
||||
// this->container.updateImages();
|
||||
this->flags &= MessageLayout::RequiresBufferUpdate;
|
||||
this->flags |= MessageLayout::RequiresBufferUpdate;
|
||||
}
|
||||
if (textChanged) {
|
||||
// this->container.updateText();
|
||||
this->flags &= MessageLayout::RequiresBufferUpdate;
|
||||
this->flags |= MessageLayout::RequiresBufferUpdate;
|
||||
}
|
||||
if (widthChanged || wordMaskChanged) {
|
||||
this->deleteBuffer();
|
||||
@@ -229,6 +226,15 @@ void MessageLayout::deleteBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
void MessageLayout::deleteCache()
|
||||
{
|
||||
this->deleteBuffer();
|
||||
|
||||
#ifdef XD
|
||||
this->container.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Elements
|
||||
// assert(QThread::currentThread() == QApplication::instance()->thread());
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace layouts {
|
||||
class MessageLayout : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
enum Flags : uint8_t { Collapsed, RequiresBufferUpdate, RequiresLayout };
|
||||
enum Flags : uint8_t { RequiresBufferUpdate = 1 << 1, RequiresLayout = 1 << 2 };
|
||||
|
||||
MessageLayout(MessagePtr message);
|
||||
~MessageLayout();
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
bool isLastReadMessage, bool isWindowFocused);
|
||||
void invalidateBuffer();
|
||||
void deleteBuffer();
|
||||
void deleteCache();
|
||||
|
||||
// Elements
|
||||
const MessageLayoutElement *getElementAt(QPoint point);
|
||||
|
||||
@@ -65,8 +65,18 @@ void MessageLayoutContainer::addElementNoLineBreak(MessageLayoutElement *element
|
||||
this->_addElement(element);
|
||||
}
|
||||
|
||||
bool MessageLayoutContainer::canAddElements()
|
||||
{
|
||||
return !(this->flags & Message::MessageFlags::Collapsed && line >= 3);
|
||||
}
|
||||
|
||||
void MessageLayoutContainer::_addElement(MessageLayoutElement *element)
|
||||
{
|
||||
if (!this->canAddElements()) {
|
||||
delete element;
|
||||
return;
|
||||
}
|
||||
|
||||
// top margin
|
||||
if (this->elements.size() == 0) {
|
||||
this->currentY = this->margin.top * this->scale;
|
||||
@@ -139,6 +149,7 @@ void MessageLayoutContainer::breakLine()
|
||||
this->currentY += this->lineHeight;
|
||||
this->height = this->currentY + (this->margin.bottom * this->scale);
|
||||
this->lineHeight = 0;
|
||||
this->line++;
|
||||
}
|
||||
|
||||
bool MessageLayoutContainer::atStartOfLine()
|
||||
|
||||
@@ -58,6 +58,7 @@ struct MessageLayoutContainer {
|
||||
void end();
|
||||
|
||||
void clear();
|
||||
bool canAddElements();
|
||||
void addElement(MessageLayoutElement *element);
|
||||
void addElementNoLineBreak(MessageLayoutElement *element);
|
||||
void breakLine();
|
||||
|
||||
Reference in New Issue
Block a user