made some things scale
This commit is contained in:
@@ -311,6 +311,7 @@ void Image::load()
|
|||||||
req.setExecuteConcurrently(true);
|
req.setExecuteConcurrently(true);
|
||||||
req.setCaller(&this->object_);
|
req.setCaller(&this->object_);
|
||||||
req.setUseQuickLoadCache(true);
|
req.setUseQuickLoadCache(true);
|
||||||
|
|
||||||
req.onSuccess([that = this, weak = weakOf(this)](auto result) -> Outcome {
|
req.onSuccess([that = this, weak = weakOf(this)](auto result) -> Outcome {
|
||||||
auto shared = weak.lock();
|
auto shared = weak.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
@@ -331,6 +332,7 @@ void Image::load()
|
|||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
});
|
});
|
||||||
|
|
||||||
req.onError([weak = weakOf(this)](auto result) -> bool {
|
req.onError([weak = weakOf(this)](auto result) -> bool {
|
||||||
auto shared = weak.lock();
|
auto shared = weak.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
|
|||||||
+32
-15
@@ -58,26 +58,43 @@ const ImagePtr &ImageSet::getImage3() const
|
|||||||
|
|
||||||
const ImagePtr &ImageSet::getImage(float scale) 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)
|
if (scale > 2.001f)
|
||||||
quality = 3;
|
quality = 3;
|
||||||
else if (scale > 1.001f)
|
else if (scale > 1.001f)
|
||||||
quality = 2;
|
quality = 2;
|
||||||
|
|
||||||
if (!this->imageX3_->isEmpty() && quality == 3)
|
if (!this->imageX3_->isEmpty() && quality == 3)
|
||||||
{
|
{
|
||||||
return this->imageX3_;
|
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->imageX2_;
|
||||||
}
|
else if (this->imageX3_ && !this->imageX3_->isEmpty() &&
|
||||||
|
this->imageX3_->pixmap())
|
||||||
return this->imageX1_;
|
return this->imageX3_;
|
||||||
|
else
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImageSet::operator==(const ImageSet &other) const
|
bool ImageSet::operator==(const ImageSet &other) const
|
||||||
|
|||||||
@@ -273,6 +273,17 @@ void ChannelView::themeChangedEvent()
|
|||||||
this->queueLayout();
|
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()
|
void ChannelView::queueUpdate()
|
||||||
{
|
{
|
||||||
// if (this->updateTimer.isActive()) {
|
// if (this->updateTimer.isActive()) {
|
||||||
@@ -716,7 +727,8 @@ void ChannelView::resizeEvent(QResizeEvent *)
|
|||||||
this->scrollBar_->setGeometry(this->width() - this->scrollBar_->width(), 0,
|
this->scrollBar_->setGeometry(this->width() - this->scrollBar_->width(), 0,
|
||||||
this->scrollBar_->width(), this->height());
|
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();
|
this->scrollBar_->raise();
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void themeChangedEvent() override;
|
void themeChangedEvent() override;
|
||||||
|
void scaleChangedEvent(float scale) override;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *) override;
|
void resizeEvent(QResizeEvent *) override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user