mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
made some things scale
This commit is contained in:
parent
0e242202a4
commit
2e68852768
|
@ -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)
|
||||
|
|
|
@ -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<Image> & {
|
||||
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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
|
||||
protected:
|
||||
void themeChangedEvent() override;
|
||||
void scaleChangedEvent(float scale) override;
|
||||
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue