mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Add explicit default font option
This commit is contained in:
parent
6926db6af4
commit
a7de77333f
1 changed files with 29 additions and 10 deletions
|
@ -1221,10 +1221,18 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return i->mobileMode();
|
return i->mobileMode();
|
||||||
case FontSize:
|
case FontSize:
|
||||||
return i->fontSize();
|
return i->fontSize();
|
||||||
case Font:
|
case Font: {
|
||||||
return data(index, Values).toStringList().indexOf(i->font());
|
if (i->font().isEmpty())
|
||||||
case EmojiFont:
|
return 0;
|
||||||
return data(index, Values).toStringList().indexOf(i->emojiFont());
|
else
|
||||||
|
return data(index, Values).toStringList().indexOf(i->font());
|
||||||
|
}
|
||||||
|
case EmojiFont: {
|
||||||
|
if (i->emojiFont().isEmpty())
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return data(index, Values).toStringList().indexOf(i->emojiFont());
|
||||||
|
}
|
||||||
case Ringtone: {
|
case Ringtone: {
|
||||||
auto v = i->ringtone();
|
auto v = i->ringtone();
|
||||||
if (v == QStringView(u"Mute"))
|
if (v == QStringView(u"Mute"))
|
||||||
|
@ -1612,10 +1620,16 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return vecToList(CallDevices::instance().frameRates(
|
return vecToList(CallDevices::instance().frameRates(
|
||||||
i->camera().toStdString(), i->cameraResolution().toStdString()));
|
i->camera().toStdString(), i->cameraResolution().toStdString()));
|
||||||
|
|
||||||
case Font:
|
case Font: {
|
||||||
return QFontDatabase::families();
|
auto fonts = QFontDatabase::families();
|
||||||
case EmojiFont:
|
fonts.prepend(tr("System font"));
|
||||||
return QFontDatabase::families(QFontDatabase::WritingSystem::Symbol);
|
return fonts;
|
||||||
|
}
|
||||||
|
case EmojiFont: {
|
||||||
|
auto fonts = QFontDatabase::families(QFontDatabase::WritingSystem::Symbol);
|
||||||
|
fonts.prepend(tr("System emoji font"));
|
||||||
|
return fonts;
|
||||||
|
}
|
||||||
case Ringtone: {
|
case Ringtone: {
|
||||||
QStringList l{
|
QStringList l{
|
||||||
QStringLiteral("Mute"),
|
QStringLiteral("Mute"),
|
||||||
|
@ -1908,15 +1922,20 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
}
|
}
|
||||||
case Font: {
|
case Font: {
|
||||||
if (value.userType() == QMetaType::Int) {
|
if (value.userType() == QMetaType::Int) {
|
||||||
i->setFontFamily(QFontDatabase::families().at(value.toInt()));
|
// Special handling to grab our injected system font option
|
||||||
|
auto v = value.toInt();
|
||||||
|
i->setFontFamily(v == 0 ? QString{} : QFontDatabase::families().at(v - 1));
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EmojiFont: {
|
case EmojiFont: {
|
||||||
if (value.userType() == QMetaType::Int) {
|
if (value.userType() == QMetaType::Int) {
|
||||||
|
// More special handling for the default font option
|
||||||
|
auto v = value.toInt();
|
||||||
i->setEmojiFontFamily(
|
i->setEmojiFontFamily(
|
||||||
QFontDatabase::families(QFontDatabase::WritingSystem::Symbol).at(value.toInt()));
|
v == 0 ? QStringLiteral("emoji")
|
||||||
|
: QFontDatabase::families(QFontDatabase::WritingSystem::Symbol).at(v - 1));
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue