refactor: Remove most raw accesses into Application (#5104)

This commit is contained in:
pajlada
2024-01-19 17:59:55 +01:00
committed by GitHub
parent 326a402710
commit 4380ef8c5f
82 changed files with 552 additions and 452 deletions
+6 -6
View File
@@ -522,14 +522,14 @@ void TextElement::addToContainer(MessageLayoutContainer &container,
if (flags.hasAny(this->getFlags()))
{
QFontMetrics metrics =
app->fonts->getFontMetrics(this->style_, container.getScale());
app->getFonts()->getFontMetrics(this->style_, container.getScale());
for (Word &word : this->words_)
{
auto getTextLayoutElement = [&](QString text, int width,
bool hasTrailingSpace) {
auto color = this->color_.getColor(*app->themes);
app->themes->normalizeColor(color);
auto color = this->color_.getColor(*app->getThemes());
app->getThemes()->normalizeColor(color);
auto *e = (new TextLayoutElement(
*this, text, QSize(width, metrics.height()),
@@ -642,12 +642,12 @@ void SingleLineTextElement::addToContainer(MessageLayoutContainer &container,
if (flags.hasAny(this->getFlags()))
{
QFontMetrics metrics =
app->fonts->getFontMetrics(this->style_, container.getScale());
app->getFonts()->getFontMetrics(this->style_, container.getScale());
auto getTextLayoutElement = [&](QString text, int width,
bool hasTrailingSpace) {
auto color = this->color_.getColor(*app->themes);
app->themes->normalizeColor(color);
auto color = this->color_.getColor(*app->getThemes());
app->getThemes()->normalizeColor(color);
auto *e = (new TextLayoutElement(
*this, text, QSize(width, metrics.height()), color,