diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index 70693b3c1..b5cc3265b 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -311,6 +311,7 @@ void Image::load() req.setExecuteConcurrently(true); req.setCaller(&this->object_); req.setUseQuickLoadCache(true); + req.onSuccess([that = this, weak = weakOf(this)](auto result) -> Outcome { auto shared = weak.lock(); if (!shared) @@ -331,6 +332,7 @@ void Image::load() return Success; }); + req.onError([weak = weakOf(this)](auto result) -> bool { auto shared = weak.lock(); if (!shared) diff --git a/src/messages/ImageSet.cpp b/src/messages/ImageSet.cpp index b6ef9e2ce..629bbcc9c 100644 --- a/src/messages/ImageSet.cpp +++ b/src/messages/ImageSet.cpp @@ -58,26 +58,43 @@ const ImagePtr &ImageSet::getImage3() const const ImagePtr &ImageSet::getImage(float scale) const { - scale *= getSettings()->emoteScale; + // get best image based on scale + auto &&result = [&]() -> const std::shared_ptr & { + scale *= getSettings()->emoteScale; - int quality = 1; + int quality = 1; - if (scale > 2.001f) - quality = 3; - else if (scale > 1.001f) - quality = 2; + if (scale > 2.001f) + quality = 3; + else if (scale > 1.001f) + quality = 2; - if (!this->imageX3_->isEmpty() && quality == 3) - { - return this->imageX3_; - } + if (!this->imageX3_->isEmpty() && quality == 3) + { + return this->imageX3_; + } - if (!this->imageX2_->isEmpty() && quality == 2) - { + if (!this->imageX2_->isEmpty() && quality == 2) + { + return this->imageX2_; + } + + return this->imageX1_; + }(); + + // prefere other image if selected image is not loaded yet + if (result->pixmap()) + return result; + else if (this->imageX1_->pixmap()) + return this->imageX1_; + else if (this->imageX2_ && !this->imageX2_->isEmpty() && + this->imageX2_->pixmap()) return this->imageX2_; - } - - return this->imageX1_; + else if (this->imageX3_ && !this->imageX3_->isEmpty() && + this->imageX3_->pixmap()) + return this->imageX3_; + else + return result; } bool ImageSet::operator==(const ImageSet &other) const diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 2843d93a4..a5def4028 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -273,6 +273,17 @@ void ChannelView::themeChangedEvent() this->queueLayout(); } +void ChannelView::scaleChangedEvent(float scale) +{ + BaseWidget::scaleChangedEvent(scale); + + if (this->goToBottom_) + { + this->goToBottom_->getLabel().setFont( + getFonts()->getFont(FontStyle::UiMedium, this->qtFontScale())); + } +} + void ChannelView::queueUpdate() { // if (this->updateTimer.isActive()) { @@ -716,7 +727,8 @@ void ChannelView::resizeEvent(QResizeEvent *) this->scrollBar_->setGeometry(this->width() - this->scrollBar_->width(), 0, this->scrollBar_->width(), this->height()); - this->goToBottom_->setGeometry(0, this->height() - 32, this->width(), 32); + this->goToBottom_->setGeometry(0, this->height() - int(this->scale() * 26), + this->width(), int(this->scale() * 26)); this->scrollBar_->raise(); diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index 33a69f02b..8c2c2f133 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -88,6 +88,7 @@ public: protected: void themeChangedEvent() override; + void scaleChangedEvent(float scale) override; void resizeEvent(QResizeEvent *) override;