started to refactor Application

This commit is contained in:
fourtf
2018-07-07 11:41:01 +02:00
parent 6a418e6e59
commit c609a9fd37
32 changed files with 195 additions and 147 deletions
+29 -28
View File
@@ -26,37 +26,38 @@ Fonts::Fonts()
: chatFontFamily("/appearance/currentFontFamily", DEFAULT_FONT_FAMILY)
, chatFontSize("/appearance/currentFontSize", DEFAULT_FONT_SIZE)
{
qDebug() << "init FontManager";
this->chatFontFamily.connect([this](const std::string &, auto) {
assertInGuiThread();
if (getApp()->windows) {
getApp()->windows->incGeneration();
}
for (auto &map : this->fontsByType_) {
map.clear();
}
this->fontChanged.invoke();
});
this->chatFontSize.connect([this](const int &, auto) {
assertInGuiThread();
if (getApp()->windows) {
getApp()->windows->incGeneration();
}
for (auto &map : this->fontsByType_) {
map.clear();
}
this->fontChanged.invoke();
});
this->fontsByType_.resize(size_t(EndType));
}
void Fonts::initialize(Application &app)
{
this->chatFontFamily.connect([this, &app](const std::string &, auto) {
assertInGuiThread();
if (app.windows) {
app.windows->incGeneration();
}
for (auto &map : this->fontsByType_) {
map.clear();
}
this->fontChanged.invoke();
});
this->chatFontSize.connect([this, &app](const int &, auto) {
assertInGuiThread();
if (app.windows) {
app.windows->incGeneration();
}
for (auto &map : this->fontsByType_) {
map.clear();
}
this->fontChanged.invoke();
});
}
QFont Fonts::getFont(Fonts::Type type, float scale)
{
return this->getOrCreateFontData(type, scale).font;