mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(Style): Move fonts storage from array to std::map
Strongly enforces ordering instead of being based off comments, and logically represents the relation better.
This commit is contained in:
parent
b9c4b0075c
commit
cf5be40511
|
@ -219,17 +219,17 @@ QFont Style::getFont(Font font)
|
||||||
|
|
||||||
static int defSize = QFontInfo(QFont()).pixelSize();
|
static int defSize = QFontInfo(QFont()).pixelSize();
|
||||||
|
|
||||||
static QFont fonts[] = {
|
static const std::map<Font, QFont> fonts = {
|
||||||
appFont(defSize + 3, QFont::Bold), // extra big
|
{Font::ExtraBig, appFont(defSize + 3, QFont::Bold)},
|
||||||
appFont(defSize + 1, QFont::Normal), // big
|
{Font::Big, appFont(defSize + 1, QFont::Normal)},
|
||||||
appFont(defSize + 1, QFont::Bold), // big bold
|
{Font::BigBold, appFont(defSize + 1, QFont::Bold)},
|
||||||
appFont(defSize, QFont::Normal), // medium
|
{Font::Medium, appFont(defSize, QFont::Normal)},
|
||||||
appFont(defSize, QFont::Bold), // medium bold
|
{Font::MediumBold, appFont(defSize, QFont::Bold)},
|
||||||
appFont(defSize - 1, QFont::Normal), // small
|
{Font::Small, appFont(defSize - 1, QFont::Normal)},
|
||||||
appFont(defSize - 1, QFont::Light), // small light
|
{Font::SmallLight, appFont(defSize - 1, QFont::Light)},
|
||||||
};
|
};
|
||||||
|
|
||||||
return fonts[static_cast<int>(font)];
|
return fonts.at(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString Style::resolve(const QString& filename, Settings& settings, const QFont& baseFont)
|
const QString Style::resolve(const QString& filename, Settings& settings, const QFont& baseFont)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user