diff --git a/src/ui/Avatar.cpp b/src/ui/Avatar.cpp
index 6a87e002..df649e1b 100644
--- a/src/ui/Avatar.cpp
+++ b/src/ui/Avatar.cpp
@@ -1,17 +1,15 @@
#include <QPainter>
+#include <QSettings>
#include "Utils.h"
#include "ui/Avatar.h"
-#define AVATAR_RECT_ROUND 5
-
Avatar::Avatar(QWidget *parent)
: QWidget(parent)
{
size_ = ui::AvatarSize;
type_ = ui::AvatarType::Letter;
letter_ = "A";
- rounded_ = true;
QFont _font(font());
_font.setPointSizeF(ui::FontSize);
@@ -104,14 +102,11 @@ Avatar::setIcon(const QIcon &icon)
}
void
-Avatar::setRounded(bool setting)
-{
- rounded_ = setting;
-}
-
-void
Avatar::paintEvent(QPaintEvent *)
{
+
+ bool rounded = QSettings().value("user/avatar/circles", true).toBool();
+
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
@@ -125,11 +120,9 @@ Avatar::paintEvent(QPaintEvent *)
painter.setPen(Qt::NoPen);
painter.setBrush(brush);
- rounded_ ?
+ rounded ?
painter.drawEllipse(r.center(), hs, hs) :
- painter.drawRoundedRect( r,
- AVATAR_RECT_ROUND,
- AVATAR_RECT_ROUND);
+ painter.drawRoundedRect(r, 3, 3);
}
switch (type_) {
@@ -143,11 +136,9 @@ Avatar::paintEvent(QPaintEvent *)
case ui::AvatarType::Image: {
QPainterPath ppath;
- rounded_ ?
+ rounded ?
ppath.addEllipse(width() / 2 - hs, height() / 2 - hs, size_, size_) :
- ppath.addRoundedRect( r,
- AVATAR_RECT_ROUND,
- AVATAR_RECT_ROUND);
+ ppath.addRoundedRect(r, 3, 3);
painter.setClipPath(ppath);
painter.drawPixmap(QRect(width() / 2 - hs, height() / 2 - hs, size_, size_),
diff --git a/src/ui/Avatar.h b/src/ui/Avatar.h
index 5732da27..41967af5 100644
--- a/src/ui/Avatar.h
+++ b/src/ui/Avatar.h
@@ -23,7 +23,6 @@ public:
void setLetter(const QString &letter);
void setSize(int size);
void setTextColor(const QColor &color);
- void setRounded(bool setting);
QColor backgroundColor() const;
QColor textColor() const;
@@ -45,5 +44,4 @@ private:
QImage image_;
QPixmap pixmap_;
int size_;
- bool rounded_ = true;
};
|