diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 739da5f0..c42cd6e9 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -88,6 +88,7 @@ Page {
anchors.centerIn: parent
text: qsTr("No room open")
font.pointSize: 24
+ color: colors.text
}
BusyIndicator {
@@ -275,6 +276,7 @@ Page {
anchors.leftMargin: 10
anchors.rightMargin: 10
+ color: colors.text
text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : ""
textFormat: Text.RichText
}
diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp
index 11818649..13c7b54d 100644
--- a/src/RoomInfoListItem.cpp
+++ b/src/RoomInfoListItem.cpp
@@ -151,7 +151,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
auto wm = getMetrics(QFont{});
- QPixmap pixmap(avatar_->size());
+ QPixmap pixmap(avatar_->size() * p.device()->devicePixelRatioF());
+ pixmap.setDevicePixelRatio(p.device()->devicePixelRatioF());
if (isPressed_) {
p.fillRect(rect(), highlightedBackgroundColor_);
titlePen.setColor(highlightedTitleColor_);
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 4db883f5..54bce52c 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -121,7 +121,7 @@ UserSettings::applyTheme()
lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color());
lightActive.setColor(QPalette::ToolTipText, lightActive.text().color());
lightActive.setColor(QPalette::Link, QColor("#0077b5"));
- lightActive.setColor(QPalette::ButtonText, QColor("gray"));
+ lightActive.setColor(QPalette::ButtonText, QColor(Qt::gray));
QApplication::setPalette(lightActive);
} else if (this->theme() == "dark") {
stylefile.setFileName(":/styles/styles/nheko-dark.qss");
@@ -130,7 +130,7 @@ UserSettings::applyTheme()
/*button*/ QColor(0xff, 0xff, 0xff),
/*light*/ QColor("#caccd1"),
/*dark*/ QColor("#2d3139"),
- /*mid*/ QColor(110, 110, 110), // not used anywhere, this is for debugging
+ /*mid*/ QColor(110, 110, 110),
/*text*/ QColor("#caccd1"),
/*bright_text*/ QColor(0xff, 0xff, 0xff),
/*base*/ QColor("#2d3139"),
@@ -139,7 +139,7 @@ UserSettings::applyTheme()
darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color());
darkActive.setColor(QPalette::ToolTipText, darkActive.text().color());
darkActive.setColor(QPalette::Link, QColor("#38a3d8"));
- darkActive.setColor(QPalette::ButtonText, QColor(77, 77, 77));
+ darkActive.setColor(QPalette::ButtonText, QColor(0x90, 0x90, 0x90));
QApplication::setPalette(darkActive);
} else {
stylefile.setFileName(":/styles/styles/system.qss");
diff --git a/src/ui/Avatar.cpp b/src/ui/Avatar.cpp
index b8703e87..cb77d1a8 100644
--- a/src/ui/Avatar.cpp
+++ b/src/ui/Avatar.cpp
@@ -71,11 +71,12 @@ Avatar::setImage(const QString &avatar_url)
AvatarProvider::resolve(avatar_url,
static_cast<int>(size_ * pixmap_.devicePixelRatio()),
this,
- [this](QPixmap pm) {
+ [this, requestedRatio = pixmap_.devicePixelRatio()](QPixmap pm) {
if (pm.isNull())
return;
type_ = ui::AvatarType::Image;
pixmap_ = pm;
+ pixmap_.setDevicePixelRatio(requestedRatio);
update();
});
}
@@ -89,16 +90,31 @@ Avatar::setImage(const QString &room, const QString &user)
user,
static_cast<int>(size_ * pixmap_.devicePixelRatio()),
this,
- [this](QPixmap pm) {
+ [this, requestedRatio = pixmap_.devicePixelRatio()](QPixmap pm) {
if (pm.isNull())
return;
type_ = ui::AvatarType::Image;
pixmap_ = pm;
+ pixmap_.setDevicePixelRatio(requestedRatio);
update();
});
}
void
+Avatar::setDevicePixelRatio(double ratio)
+{
+ if (type_ == ui::AvatarType::Image && abs(pixmap_.devicePixelRatio() - ratio) > 0.01) {
+ pixmap_ = pixmap_.scaled(QSize(size_, size_) * ratio);
+ pixmap_.setDevicePixelRatio(ratio);
+
+ if (!avatar_url_.isEmpty())
+ setImage(avatar_url_);
+ else
+ setImage(room_, user_);
+ }
+}
+
+void
Avatar::paintEvent(QPaintEvent *)
{
bool rounded = QSettings().value("user/avatar_circles", true).toBool();
@@ -106,7 +122,7 @@ Avatar::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
- QRect r = rect();
+ QRectF r = rect();
const int hs = size_ / 2;
if (type_ != ui::AvatarType::Image) {
@@ -116,18 +132,9 @@ Avatar::paintEvent(QPaintEvent *)
painter.setPen(Qt::NoPen);
painter.setBrush(brush);
- rounded ? painter.drawEllipse(r.center(), hs, hs)
- : painter.drawRoundedRect(r, 3, 3);
- } else if (painter.isActive() &&
- abs(pixmap_.devicePixelRatio() - painter.device()->devicePixelRatioF()) > 0.01) {
- pixmap_ =
- pixmap_.scaled(QSize(size_, size_) * painter.device()->devicePixelRatioF());
- pixmap_.setDevicePixelRatio(painter.device()->devicePixelRatioF());
-
- if (!avatar_url_.isEmpty())
- setImage(avatar_url_);
- else
- setImage(room_, user_);
+ rounded ? painter.drawEllipse(r) : painter.drawRoundedRect(r, 3, 3);
+ } else if (painter.isActive()) {
+ setDevicePixelRatio(painter.device()->devicePixelRatioF());
}
switch (type_) {
diff --git a/src/ui/Avatar.h b/src/ui/Avatar.h
index da8a57ed..229a980d 100644
--- a/src/ui/Avatar.h
+++ b/src/ui/Avatar.h
@@ -21,6 +21,7 @@ public:
void setImage(const QString &room, const QString &user);
void setLetter(const QString &letter);
void setTextColor(const QColor &color);
+ void setDevicePixelRatio(double ratio);
QColor backgroundColor() const;
QColor textColor() const;
|