X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtuistyle.cpp;h=fd10e24a886b667b69ff606c087fd4b9f2398916;hp=60d858ae36698979303b5baec1a413367b135bec;hb=c194ed5fb3d15e14b9364f9796d3521910dc72fe;hpb=53861faa5551606eea31588b65ba501b24fb2e1a diff --git a/src/qtui/qtuistyle.cpp b/src/qtui/qtuistyle.cpp index 60d858ae..fd10e24a 100644 --- a/src/qtui/qtuistyle.cpp +++ b/src/qtui/qtuistyle.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -32,8 +32,8 @@ QtUiStyle::QtUiStyle(QObject *parent) : UiStyle(parent) updateUseCustomTimestampFormat(); s.notify("TimestampFormat", this, SLOT(updateTimestampFormatString())); updateTimestampFormatString(); - s.notify("ShowSenderPrefixes", this, SLOT(updateShowSenderPrefixes())); - updateShowSenderPrefixes(); + s.notify("SenderPrefixMode", this, SLOT(updateSenderPrefixDisplay())); + updateSenderPrefixDisplay(); s.notify("ShowSenderBrackets", this, SLOT(updateShowSenderBrackets())); updateShowSenderBrackets(); @@ -42,8 +42,6 @@ QtUiStyle::QtUiStyle(QObject *parent) : UiStyle(parent) } -QtUiStyle::~QtUiStyle() {} - void QtUiStyle::updateUseCustomTimestampFormat() { ChatViewSettings s; @@ -56,10 +54,10 @@ void QtUiStyle::updateTimestampFormatString() setTimestampFormatString(s.timestampFormatString()); } -void QtUiStyle::updateShowSenderPrefixes() +void QtUiStyle::updateSenderPrefixDisplay() { ChatViewSettings s; - enableSenderPrefixes(s.showSenderPrefixes()); + setSenderPrefixDisplay(s.SenderPrefixDisplay()); } void QtUiStyle::updateShowSenderBrackets() @@ -215,15 +213,16 @@ QString QtUiStyle::color(const QString &key, UiSettings &settings, const QColor QString QtUiStyle::fontDescription(const QFont &font) const { - QString desc = "font: "; - if (font.italic()) - desc += "italic "; - if (font.bold()) - desc += "bold "; - if (!font.italic() && !font.bold()) - desc += "normal "; - desc += QString("%1pt \"%2\"").arg(font.pointSize()).arg(font.family()); - return desc; + QFont::Style style = font.style(); + int weight = font.weight(); + + return QString("font: %1 %2 %3pt \"%4\"") + .arg(style == QFont::StyleItalic ? "italic" : + style == QFont::StyleOblique ? "oblique" : + "normal") + .arg(100 * qBound(1, (weight * 8 + 50) / 100, 9)) + .arg(font.pointSize()) + .arg(font.family()); }