fix: emote button is now rendered smoothlier (#6080)
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
- Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011)
|
- Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011)
|
||||||
- Bugfix: Fixed a thick border on Windows 11. (#5836)
|
- Bugfix: Fixed a thick border on Windows 11. (#5836)
|
||||||
- Bugfix: Fixed some windows not immediately closing. (#6054)
|
- Bugfix: Fixed some windows not immediately closing. (#6054)
|
||||||
|
- Bugfix: The emote button no longer looks crunchy. (#6080)
|
||||||
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
|
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
|
||||||
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048, #6058, #6059, #6078, #6079)
|
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048, #6058, #6059, #6078, #6079)
|
||||||
- Dev: Remove unneeded platform specifier for toasts. (#5914)
|
- Dev: Remove unneeded platform specifier for toasts. (#5914)
|
||||||
|
|||||||
@@ -76,6 +76,20 @@ void Button::setPixmap(const QPixmap &_pixmap)
|
|||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Button::setSvgResource(const QString &resourcePath)
|
||||||
|
{
|
||||||
|
if (resourcePath == this->svgResourcePath)
|
||||||
|
{
|
||||||
|
// Same resource path as before - nothing changed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->svgRenderer = new QSvgRenderer(resourcePath, this);
|
||||||
|
this->svgResourcePath = resourcePath;
|
||||||
|
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
const QPixmap &Button::getPixmap() const
|
const QPixmap &Button::getPixmap() const
|
||||||
{
|
{
|
||||||
return this->pixmap_;
|
return this->pixmap_;
|
||||||
@@ -176,7 +190,13 @@ void Button::paintButton(QPainter &painter)
|
|||||||
{
|
{
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
|
||||||
if (!this->pixmap_.isNull())
|
if (this->svgRenderer != nullptr)
|
||||||
|
{
|
||||||
|
painter.setOpacity(this->getCurrentDimAmount());
|
||||||
|
|
||||||
|
this->svgRenderer->render(&painter);
|
||||||
|
}
|
||||||
|
else if (!this->pixmap_.isNull())
|
||||||
{
|
{
|
||||||
painter.setOpacity(this->getCurrentDimAmount());
|
painter.setOpacity(this->getCurrentDimAmount());
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
#include <QSvgRenderer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ public:
|
|||||||
|
|
||||||
void setMouseEffectColor(std::optional<QColor> color);
|
void setMouseEffectColor(std::optional<QColor> color);
|
||||||
void setPixmap(const QPixmap &pixmap_);
|
void setPixmap(const QPixmap &pixmap_);
|
||||||
|
void setSvgResource(const QString &resourcePath);
|
||||||
const QPixmap &getPixmap() const;
|
const QPixmap &getPixmap() const;
|
||||||
|
|
||||||
void setDim(Dim value);
|
void setDim(Dim value);
|
||||||
@@ -88,6 +90,8 @@ private:
|
|||||||
|
|
||||||
QColor borderColor_{};
|
QColor borderColor_{};
|
||||||
QPixmap pixmap_{};
|
QPixmap pixmap_{};
|
||||||
|
QSvgRenderer *svgRenderer{};
|
||||||
|
QString svgResourcePath;
|
||||||
QPixmap resizedPixmap_{};
|
QPixmap resizedPixmap_{};
|
||||||
Dim dimPixmap_{Dim::Some};
|
Dim dimPixmap_{Dim::Some};
|
||||||
bool enableMargin_{true};
|
bool enableMargin_{true};
|
||||||
|
|||||||
@@ -165,11 +165,9 @@ void SplitInput::initLayout()
|
|||||||
textEditLength->setAlignment(Qt::AlignRight);
|
textEditLength->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
box->addStretch(1);
|
box->addStretch(1);
|
||||||
box.emplace<EffectLabel>().assign(&this->ui_.emoteButton);
|
box.emplace<Button>().assign(&this->ui_.emoteButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ui_.emoteButton->getLabel().setTextFormat(Qt::RichText);
|
|
||||||
|
|
||||||
// ---- misc
|
// ---- misc
|
||||||
|
|
||||||
// set edit font
|
// set edit font
|
||||||
@@ -266,8 +264,6 @@ void SplitInput::themeChangedEvent()
|
|||||||
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
|
this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet);
|
||||||
this->ui_.textEdit->setPalette(placeholderPalette);
|
this->ui_.textEdit->setPalette(placeholderPalette);
|
||||||
|
|
||||||
this->ui_.emoteButton->getLabel().setStyleSheet("color: #000");
|
|
||||||
|
|
||||||
if (this->theme->isLightTheme())
|
if (this->theme->isLightTheme())
|
||||||
{
|
{
|
||||||
this->ui_.replyLabel->setStyleSheet("color: #333");
|
this->ui_.replyLabel->setStyleSheet("color: #333");
|
||||||
@@ -289,13 +285,17 @@ void SplitInput::updateEmoteButton()
|
|||||||
{
|
{
|
||||||
auto scale = this->scale();
|
auto scale = this->scale();
|
||||||
|
|
||||||
auto text =
|
if (this->theme->isLightTheme())
|
||||||
QStringLiteral("<img src=':/buttons/%1.svg' width='%2' height='%2' />")
|
{
|
||||||
.arg(this->theme->isLightTheme() ? "emoteDark" : "emote")
|
this->ui_.emoteButton->setSvgResource(":/buttons/emoteDark.svg");
|
||||||
.arg(int(12 * scale));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->ui_.emoteButton->setSvgResource(":/buttons/emote.svg");
|
||||||
|
}
|
||||||
|
|
||||||
this->ui_.emoteButton->getLabel().setText(text);
|
|
||||||
this->ui_.emoteButton->setFixedHeight(int(18 * scale));
|
this->ui_.emoteButton->setFixedHeight(int(18 * scale));
|
||||||
|
this->ui_.emoteButton->setFixedWidth(int(18 * scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitInput::updateCancelReplyButton()
|
void SplitInput::updateCancelReplyButton()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "messages/Message.hpp"
|
#include "messages/Message.hpp"
|
||||||
#include "widgets/BaseWidget.hpp"
|
#include "widgets/BaseWidget.hpp"
|
||||||
|
#include "widgets/helper/Button.hpp"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -151,7 +152,7 @@ protected:
|
|||||||
ResizingTextEdit *textEdit;
|
ResizingTextEdit *textEdit;
|
||||||
QLabel *textEditLength;
|
QLabel *textEditLength;
|
||||||
EffectLabel *sendButton;
|
EffectLabel *sendButton;
|
||||||
EffectLabel *emoteButton;
|
Button *emoteButton;
|
||||||
} ui_;
|
} ui_;
|
||||||
|
|
||||||
MessagePtr replyTarget_ = nullptr;
|
MessagePtr replyTarget_ = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user