removed red stripes and connected tape cut visuals

This commit is contained in:
fourtf
2019-04-17 17:02:13 +02:00
parent 0c7807d400
commit 9be0d7d458
9 changed files with 408 additions and 597 deletions
@@ -1,10 +0,0 @@
#pragma once
namespace chatterino {
enum HistoricMessageAppearance {
Crossed = (1 << 0),
Greyed = (1 << 1),
};
} // namespace chatterino
+2 -38
View File
@@ -103,9 +103,6 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
{
this->layoutCount_++;
const auto addTest = this->message_->flags.hasAny(
{MessageFlag::DisconnectedMessage, MessageFlag::ConnectedMessage});
auto messageFlags = this->message_->flags;
if (this->flags.has(MessageLayoutFlag::Expanded) ||
@@ -117,14 +114,6 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
this->container_->begin(width, this->scale_, messageFlags);
if (addTest)
{
this->container_->addElementNoLineBreak(new TestLayoutElement(
EmptyElement::instance(), QSize(width, this->scale_ * 6),
getTheme()->messages.backgrounds.regular, false));
this->container_->breakLine();
}
for (const auto &element : this->message_->elements)
{
if (getSettings()->hideModerated &&
@@ -135,14 +124,6 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags _flags)
element->addToContainer(*this->container_, _flags);
}
if (addTest)
{
this->container_->breakLine();
this->container_->addElement(new TestLayoutElement(
EmptyElement::instance(), QSize(width, this->scale_ * 6),
getTheme()->messages.backgrounds.regular, true));
}
if (this->height_ != this->container_->getHeight())
{
this->deleteBuffer();
@@ -205,29 +186,12 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
app->themes->messages.disabled);
// painter.fillRect(0, y, pixmap->width(), pixmap->height(),
// QBrush(QColor(64, 64, 64, 64)));
if (getSettings()->redDisabledMessages)
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
QBrush(QColor(255, 0, 0, 63), Qt::BDiagPattern));
// app->themes->messages.disabled);
}
}
if (this->message_->flags.has(MessageFlag::RecentMessage))
{
const auto &historicMessageAppearance =
getSettings()->historicMessagesAppearance.getValue();
if (historicMessageAppearance & HistoricMessageAppearance::Crossed)
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
QBrush(QColor(255, 0, 0, 63), Qt::BDiagPattern));
}
if (historicMessageAppearance & HistoricMessageAppearance::Greyed)
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
app->themes->messages.disabled);
}
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
app->themes->messages.disabled);
}
// draw selection
@@ -368,72 +368,4 @@ int TextIconLayoutElement::getXFromIndex(int index)
}
}
// TestLayoutElement
TestLayoutElement::TestLayoutElement(MessageElement &element, const QSize &size,
const QColor &background, bool end)
: MessageLayoutElement(element, size)
, size_(size)
, background_(background)
, end_(end)
{
}
void TestLayoutElement::addCopyTextToString(QString &str, int from,
int to) const
{
}
int TestLayoutElement::getSelectionIndexCount() const
{
return 0;
}
void TestLayoutElement::paint(QPainter &painter)
{
const auto dy = this->getRect().y();
const auto color = end_ ? background_ : QColor(0, 0, 0, 127);
// make zig zag
auto polygon = QPolygon();
for (auto x = size_.height() / -2; x < size_.width() + 16;
x += size_.height())
{
polygon.push_back({x, dy + 0});
polygon.push_back({x + size_.height(), dy + size_.height()});
x += size_.height();
polygon.push_back({x, dy + size_.height()});
polygon.push_back({x + size_.height(), dy + 0});
}
// finish polygon
polygon.push_back({size_.width(), 1000});
polygon.push_back({0, 1000});
// finish polygon
polygon.push_back({size_.width(), 1000});
polygon.push_back({0, 1000});
// turn into path
auto path = QPainterPath();
path.addPolygon(polygon);
// draw
painter.fillPath(path, color);
painter.strokePath(path, QColor(127, 127, 127, 127));
}
void TestLayoutElement::paintAnimated(QPainter &painter, int yOffset)
{
}
int TestLayoutElement::getMouseOverIndex(const QPoint &abs) const
{
return 0;
}
int TestLayoutElement::getXFromIndex(int index)
{
return 0;
}
} // namespace chatterino
@@ -125,25 +125,4 @@ private:
QString line2;
};
class TestLayoutElement : public MessageLayoutElement
{
public:
TestLayoutElement(MessageElement &creator, const QSize &size,
const QColor &background, bool end);
protected:
void addCopyTextToString(QString &str, int from = 0,
int to = INT_MAX) const override;
int getSelectionIndexCount() const override;
void paint(QPainter &painter) override;
void paintAnimated(QPainter &painter, int yOffset) override;
int getMouseOverIndex(const QPoint &abs) const override;
int getXFromIndex(int index) override;
private:
QSize size_;
QColor background_;
bool end_;
};
} // namespace chatterino