Newer
Older
if (!i)
return {};
if (role == Name) {
switch (index.row()) {
case Theme:
return tr("Theme");
case ScaleFactor:
return tr("Scale factor");
case MessageHoverHighlight:
return tr("Highlight message on hover");
case EnlargeEmojiOnlyMessages:
return tr("Large Emoji in timeline");
case Tray:
return tr("Minimize to tray");
case StartInTray:
return tr("Start in tray");
case GroupView:
case ScrollbarsInRoomlist:
return tr("Scrollbars in room list");
case Markdown:
return tr("Send messages as Markdown");
case InvertEnterKey:
return tr("Use shift+enter to send and enter to start a new line");
case SmallAvatars:
return tr("Enable small Avatars");
case AnimateImagesOnHover:
return tr("Play animated images only on hover");
case TypingNotifications:
return tr("Typing notifications");
case SortByImportance:
return tr("Sort rooms by unreads");
return tr("Sort rooms alphabetically");
case ButtonsInTimeline:
return tr("Show buttons in timeline");
case TimelineMaxWidth:
return tr("Limit width of timeline");
case ReadReceipts:
return tr("Read receipts");
case HiddenTimelineEvents:
return tr("Hidden events");
case IgnoredUsers:
return tr("Ignored users");
case DesktopNotifications:
return tr("Desktop notifications");
case AlertOnNotification:
return tr("Alert on notification");
case AvatarCircles:
return tr("Circular Avatars");
case UseIdenticon:
return tr("Use identicons");
case OpenImageExternal:
return tr("Open images with external program");
case OpenVideoExternal:
return tr("Open videos with external program");
case DecryptSidebar:
return tr("Decrypt messages in sidebar");
case DecryptNotifications:
return tr("Decrypt notifications");
return tr("Show message counts for communities and tags");
case FancyEffects:
return tr("Display fancy effects such as confetti");
case ReducedMotion:
return tr("Reduce or disable animations");
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
case PrivacyScreen:
return tr("Privacy Screen");
case PrivacyScreenTimeout:
return tr("Privacy screen timeout (in seconds [0 - 3600])");
case MobileMode:
return tr("Touchscreen mode");
case FontSize:
return tr("Font size");
case Font:
return tr("Font Family");
case EmojiFont:
return tr("Emoji Font Family");
case Ringtone:
return tr("Ringtone");
case Microphone:
return tr("Microphone");
case Camera:
return tr("Camera");
case CameraResolution:
return tr("Camera resolution");
case CameraFrameRate:
return tr("Camera frame rate");
case UseStunServer:
return tr("Allow fallback call assist server");
case OnlyShareKeysWithVerifiedUsers:
return tr("Send encrypted messages to verified users only");
case ShareKeysWithTrustedUsers:
return tr("Share keys with verified users and devices");
case UseOnlineKeyBackup:
return tr("Online Key Backup");
case Profile:
return tr("Profile");
case UserId:
return tr("User ID");
case AccessToken:
return tr("Accesstoken");
case DeviceId:
return tr("Device ID");
case DeviceFingerprint:
return tr("Device Fingerprint");
case Homeserver:
return tr("Homeserver");
case Version:
return tr("Version");
case Platform:
return tr("Platform");
case GeneralSection:
return tr("GENERAL");
case AccessibilitySection:
return tr("ACCESSIBILITY");
case TimelineSection:
return tr("TIMELINE");
case SidebarSection:
return tr("SIDEBAR");
case TraySection:
return tr("TRAY");
case MessageVisibilitySection:
return tr("GLOBAL MESSAGE VISIBILITY");
case NotificationsSection:
return tr("NOTIFICATIONS");
case VoipSection:
return tr("CALLS");
case EncryptionSection:
return tr("ENCRYPTION");
case LoginInfoSection:
return tr("INFO");
case SessionKeys:
return tr("Session Keys");
case CrossSigningSecrets:
return tr("Cross Signing Secrets");
case OnlineBackupKey:
return tr("Online backup key");
case SelfSigningKey:
return tr("Self signing key");
case UserSigningKey:
return tr("User signing key");
case MasterKey:
return tr("Master signing key");
case ExposeDBusApi:
return tr("Expose room information via D-Bus");
case UpdateSpaceVias:
return tr("Periodically update community routing information");
case ExpireEvents:
return tr("Periodically delete expired events");
} else if (role == Value) {
switch (index.row()) {
case Theme:
return QStringList{
QStringLiteral("light"),
QStringLiteral("dark"),
QStringLiteral("system"),
.indexOf(i->theme());
case ScaleFactor:
return utils::scaleFactor();
case MessageHoverHighlight:
return i->messageHoverHighlight();
case EnlargeEmojiOnlyMessages:
return i->enlargeEmojiOnlyMessages();
case Tray:
return i->tray();
case StartInTray:
return i->startInTray();
case GroupView:
return i->groupView();
case ScrollbarsInRoomlist:
return i->scrollbarsInRoomlist();
case InvertEnterKey:
return i->invertEnterKey();
case SmallAvatars:
return i->smallAvatars();
case AnimateImagesOnHover:
return i->animateImagesOnHover();
case TypingNotifications:
return i->typingNotifications();
case SortByImportance:
return i->sortByImportance();
case SortByAlphabet:
return i->sortByAlphabet();
case ButtonsInTimeline:
return i->buttonsInTimeline();
case TimelineMaxWidth:
return i->timelineMaxWidth();
case ReadReceipts:
return i->readReceipts();
case DesktopNotifications:
return i->hasDesktopNotifications();
case AlertOnNotification:
return i->hasAlertOnNotification();
case AvatarCircles:
return i->avatarCircles();
case UseIdenticon:
return i->useIdenticon();
case OpenImageExternal:
return i->openImageExternal();
case OpenVideoExternal:
return i->openVideoExternal();
case DecryptSidebar:
return i->decryptSidebar();
case DecryptNotifications:
return i->decryptNotifications();
case ReducedMotion:
return i->reducedMotion();
case PrivacyScreen:
return i->privacyScreen();
case PrivacyScreenTimeout:
return i->privacyScreenTimeout();
case MobileMode:
return i->mobileMode();
case FontSize:
return i->fontSize();
case Font: {
if (i->font().isEmpty())
return 0;
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: {
auto v = i->ringtone();
if (v == QStringView(u"Mute"))
return 0;
else if (v == QStringView(u"Default"))
return 1;
else if (v == QStringView(u"Other"))
return 2;
else
return 3;
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
case Microphone:
return data(index, Values).toStringList().indexOf(i->microphone());
case Camera:
return data(index, Values).toStringList().indexOf(i->camera());
case CameraResolution:
return data(index, Values).toStringList().indexOf(i->cameraResolution());
case CameraFrameRate:
return data(index, Values).toStringList().indexOf(i->cameraFrameRate());
case UseStunServer:
return i->useStunServer();
case OnlyShareKeysWithVerifiedUsers:
return i->onlyShareKeysWithVerifiedUsers();
case ShareKeysWithTrustedUsers:
return i->shareKeysWithTrustedUsers();
case UseOnlineKeyBackup:
return i->useOnlineKeyBackup();
case Profile:
return i->profile().isEmpty() ? tr("Default") : i->profile();
case UserId:
return i->userId();
case AccessToken:
return i->accessToken();
case DeviceId:
return i->deviceId();
case DeviceFingerprint:
return utils::humanReadableFingerprint(olm::client()->identity_keys().ed25519);
case Homeserver:
return i->homeserver();
case Version:
return QString::fromStdString(nheko::version);
case Platform:
return QString::fromStdString(nheko::build_os);
case OnlineBackupKey:
return cache::secret(mtx::secret_storage::secrets::megolm_backup_v1).has_value();
case SelfSigningKey:
return cache::secret(mtx::secret_storage::secrets::cross_signing_self_signing)
.has_value();
case UserSigningKey:
return cache::secret(mtx::secret_storage::secrets::cross_signing_user_signing)
.has_value();
case MasterKey:
return cache::secret(mtx::secret_storage::secrets::cross_signing_master).has_value();
case ExposeDBusApi:
return i->exposeDBusApi();
case UpdateSpaceVias:
return i->updateSpaceVias();
case ExpireEvents:
return i->expireEvents();
}
} else if (role == Description) {
switch (index.row()) {
case Theme:
case Font:
case EmojiFont:
return {};
case Microphone:
return tr("Set the notification sound to play when a call invite arrives");
case Camera:
case CameraResolution:
case CameraFrameRate:
case Ringtone:
return {};
case TimelineMaxWidth:
return tr("Set the max width of messages in the timeline (in pixels). This can help "
"readability on wide screen when Nheko is maximized");
case PrivacyScreenTimeout:
return tr(
"Set timeout (in seconds) for how long after window loses\nfocus before the screen"
" will be blurred.\nSet to 0 to blur immediately after focus loss. Max value of 1 "
"hour (3600 seconds)");
case FontSize:
return {};
case MessageHoverHighlight:
return tr("Change the background color of messages when you hover over them.");
case EnlargeEmojiOnlyMessages:
return tr("Make font size larger if messages with only a few emojis are displayed.");
case Tray:
return tr(
"Keep the application running in the background after closing the client window.");
case StartInTray:
return tr("Start the application in the background without showing the client window.");
case GroupView:
return tr("Show a column containing communities and tags next to the room list.");
case ScrollbarsInRoomlist:
return tr("Shows scrollbars in the room list and communities list.");
case Markdown:
return tr(
"Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
"text.");
case InvertEnterKey:
return tr(
"Invert the behavior of the enter key in the text input, making it send the message "
"when shift+enter is pressed and starting a new line when enter is pressed.");
return tr(
"Messages get a bubble background. This also triggers some layout changes (WIP).");
return tr("Avatars are resized to fit above the message.");
case AnimateImagesOnHover:
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them.");
case TypingNotifications:
return tr(
"Show who is typing in a room.\nThis will also enable or disable sending typing "
"notifications to others.");
case SortByImportance:
return tr(
"Display rooms with new messages first.\nIf this is off, the list of rooms will only "
"be sorted by the preferred sorting order.\nIf this is on, rooms "
"which "
"have active notifications (the small circle with a number in it) will be sorted on "
"top. Rooms that you have muted will still be sorted by the preferred sorting order, "
"since you don't "
"seem to consider them as important as the other rooms.");
case SortByAlphabet:
return tr(
"Sort rooms alphabetically.\nIf this is off, the list of rooms will be sorted by the "
"timestamp of the last message in a room.\nIf this is on, rooms that come first "
"alphabetically "
"will be sorted earlier than ones that come later.");
case ButtonsInTimeline:
return tr(
"Show buttons to quickly reply, react or access additional options next to each "
"message.");
case ReadReceipts:
return tr(
"Show if your message was read.\nStatus is displayed next to timestamps.\nWarning: "
"If your homeserver does not support this, your rooms will never be marked as read!");
case HiddenTimelineEvents:
return tr("Configure whether to show or hide certain events like room joins.");
return tr("Notify about received messages when the client is not currently focused.");
case AlertOnNotification:
return tr(
"Show an alert when a message is received.\nThis usually causes the application "
"icon in the task bar to animate in some fashion.");
case AvatarCircles:
return tr(
"Change the appearance of user avatars in chats.\nOFF - square, ON - circle.");
case UseIdenticon:
return tr("Display an identicon instead of a letter when no avatar is set.");
case OpenImageExternal:
return tr("Opens images with an external program when tapping the image.\nNote that "
"when this option is ON, opened files are left unencrypted on disk and must "
"be manually deleted.");
case OpenVideoExternal:
return tr("Opens videos with an external program when tapping the video.\nNote that "
"when this option is ON, opened files are left unencrypted on disk and must "
"be manually deleted.");
case DecryptSidebar:
return tr("Decrypt the messages shown in the sidebar.\nOnly affects messages in "
"encrypted chats.");
case DecryptNotifications:
return tr("Decrypt messages shown in notifications for encrypted chats.");
return tr("Choose where to show the total number of notifications contained within a "
"community or tag.");
case FancyEffects:
return tr("Some messages can be sent with fancy effects. For example, messages sent "
"with '/confetti' will show confetti on screen.");
case ReducedMotion:
return tr("Nheko uses animations in several places to make stuff pretty. This allows "
"you to turn those off if they make you feel unwell.");
case PrivacyScreen:
return tr("When the window loses focus, the timeline will\nbe blurred.");
case MobileMode:
return tr(
"Will prevent text selection in the timeline to make touch scrolling easier.");
case ScaleFactor:
return tr("Change the scale factor of the whole user interface.");
case UseStunServer:
return tr(
"Will use turn.matrix.org as assist when your home server does not offer one.");
case OnlyShareKeysWithVerifiedUsers:
return tr("Requires a user to be verified to send encrypted messages to them. This "
"improves safety but makes E2EE more tedious.");
case ShareKeysWithTrustedUsers:
return tr(
"Automatically replies to key requests from other users if they are verified, "
"even if that device shouldn't have access to those keys otherwise.");
case UseOnlineKeyBackup:
return tr(
"Download message encryption keys from and upload to the encrypted online key "
"backup.");
case Profile:
case UserId:
case AccessToken:
case DeviceId:
case DeviceFingerprint:
case Homeserver:
case Version:
case Platform:
case GeneralSection:
case TimelineSection:
case SidebarSection:
case TraySection:
case MessageVisibilitySection:
case NotificationsSection:
case VoipSection:
case EncryptionSection:
case LoginInfoSection:
case SessionKeys:
case CrossSigningSecrets:
return {};
case OnlineBackupKey:
return tr(
"The key to decrypt online key backups. If it is cached, you can enable online "
"key backup to store encryption keys securely encrypted on the server.");
case SelfSigningKey:
return tr(
"The key to verify your own devices. If it is cached, verifying one of your devices "
"will mark it verified for all your other devices and for users that have verified "
"you.");
case UserSigningKey:
return tr(
"The key to verify other users. If it is cached, verifying a user will verify "
"all their devices.");
case MasterKey:
return tr(
"Your most important key. You don't need to have it cached, since not caching "
"it makes it less likely it can be stolen and it is only needed to rotate your "
"other signing keys.");
case ExposeDBusApi:
return tr("Allow third-party plugins and applications to load information about rooms "
"you are in via D-Bus. "
"This can have useful applications, but it also could be used for nefarious "
"purposes. Enable at your own risk.\n\n"
"This setting will take effect upon restart.");
case UpdateSpaceVias:
return tr(
"To allow new users to join a community, the community needs to expose some "
"information about what servers participate in a room to community members. Since "
"the room participants can change over time, this needs to be updated from time to "
"time. This setting enables a background job to do that automatically.");
case ExpireEvents:
return tr("Regularly redact expired events as specified in the event expiration "
"configuration. Since this is currently not executed server side, you need "
"to have one client running this regularly.");
case IgnoredUsers:
return tr("Manage your ignored users.");
}
} else if (role == Type) {
switch (index.row()) {
case Theme:
case Font:
case EmojiFont:
case Microphone:
case Camera:
case CameraResolution:
case CameraFrameRate:
case Ringtone:
return Options;
case TimelineMaxWidth:
case PrivacyScreenTimeout:
case MessageHoverHighlight:
case EnlargeEmojiOnlyMessages:
case Tray:
case StartInTray:
case GroupView:
case ScrollbarsInRoomlist:
case AnimateImagesOnHover:
case TypingNotifications:
case SortByImportance:
case ButtonsInTimeline:
case ReadReceipts:
case DesktopNotifications:
case AlertOnNotification:
case AvatarCircles:
case UseIdenticon:
case OpenImageExternal:
case OpenVideoExternal:
case DecryptNotifications:
case PrivacyScreen:
case MobileMode:
case UseStunServer:
case OnlyShareKeysWithVerifiedUsers:
case ShareKeysWithTrustedUsers:
case UseOnlineKeyBackup:
case UpdateSpaceVias:
return Toggle;
case Profile:
case UserId:
case AccessToken:
case DeviceId:
case DeviceFingerprint:
case Homeserver:
case Version:
case Platform:
return ReadOnlyText;
case GeneralSection:
case TimelineSection:
case SidebarSection:
case TraySection:
case MessageVisibilitySection:
case NotificationsSection:
case VoipSection:
case EncryptionSection:
case LoginInfoSection:
return SectionTitle;
case SessionKeys:
return SessionKeyImportExport;
case CrossSigningSecrets:
return XSignKeysRequestDownload;
case OnlineBackupKey:
case SelfSigningKey:
case UserSigningKey:
case MasterKey:
return KeyStatus;
case HiddenTimelineEvents:
return ConfigureHiddenEvents;
case IgnoredUsers:
return ManageIgnoredUsers;
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
}
} else if (role == ValueLowerBound) {
switch (index.row()) {
case TimelineMaxWidth:
return 0;
case PrivacyScreenTimeout:
return 0;
case FontSize:
return 8.0;
case ScaleFactor:
return 1.0;
}
} else if (role == ValueUpperBound) {
switch (index.row()) {
case TimelineMaxWidth:
return 20000;
case PrivacyScreenTimeout:
return 3600;
case FontSize:
return 24.0;
case ScaleFactor:
return 3.0;
}
} else if (role == ValueStep) {
switch (index.row()) {
case TimelineMaxWidth:
return 20;
case PrivacyScreenTimeout:
return 10;
case FontSize:
return 0.5;
case ScaleFactor:
return .25;
}
} else if (role == Values) {
auto vecToList = [](const std::vector<std::string> &vec) {
QStringList l;
for (const auto &d : vec)
l.push_back(QString::fromStdString(d));
return l;
};
switch (index.row()) {
case Theme:
return QStringList{
QStringLiteral("Light"),
QStringLiteral("Dark"),
QStringLiteral("System"),
};
case Microphone:
return vecToList(CallDevices::instance().names(false, i->microphone().toStdString()));
case Camera:
return vecToList(CallDevices::instance().names(true, i->camera().toStdString()));
case CameraResolution:
return vecToList(CallDevices::instance().resolutions(i->camera().toStdString()));
case CameraFrameRate:
return vecToList(CallDevices::instance().frameRates(
i->camera().toStdString(), i->cameraResolution().toStdString()));
case Font: {
auto fonts = QFontDatabase::families();
fonts.prepend(tr("System font"));
return fonts;
}
case EmojiFont: {
auto fonts = QFontDatabase::families(QFontDatabase::WritingSystem::Symbol);
fonts.prepend(tr("System emoji font"));
return fonts;
}
QStringList l{
QStringLiteral("Mute"),
QStringLiteral("Default"),
QStringLiteral("Other"),
};
if (!l.contains(i->ringtone()))
l.push_back(i->ringtone());
return l;
}
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
} else if (role == Good) {
switch (index.row()) {
case OnlineBackupKey:
return cache::secret(mtx::secret_storage::secrets::megolm_backup_v1).has_value();
case SelfSigningKey:
return cache::secret(mtx::secret_storage::secrets::cross_signing_self_signing)
.has_value();
case UserSigningKey:
return cache::secret(mtx::secret_storage::secrets::cross_signing_user_signing)
.has_value();
case MasterKey:
return true;
}
} else if (role == Enabled) {
switch (index.row()) {
case StartInTray:
return i->tray();
case PrivacyScreenTimeout:
return i->privacyScreen();
case UseIdenticon:
return JdenticonProvider::isAvailable();
default:
return true;
}
}
bool
UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int role)
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
auto i = UserSettings::instance();
if (role == Value) {
switch (index.row()) {
case Theme: {
if (value == 0) {
i->setTheme("light");
return true;
} else if (value == 1) {
i->setTheme("dark");
return true;
} else if (value == 2) {
i->setTheme("system");
return true;
} else
return false;
}
case MessageHoverHighlight: {
if (value.userType() == QMetaType::Bool) {
i->setMessageHoverHighlight(value.toBool());
return true;
} else
return false;
}
case ScaleFactor: {
if (value.canConvert(QMetaType::fromType<double>())) {
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
utils::setScaleFactor(static_cast<float>(value.toDouble()));
return true;
} else
return false;
}
case EnlargeEmojiOnlyMessages: {
if (value.userType() == QMetaType::Bool) {
i->setEnlargeEmojiOnlyMessages(value.toBool());
return true;
} else
return false;
}
case Tray: {
if (value.userType() == QMetaType::Bool) {
i->setTray(value.toBool());
return true;
} else
return false;
}
case StartInTray: {
if (value.userType() == QMetaType::Bool) {
i->setStartInTray(value.toBool());
return true;
} else
return false;
}
case GroupView: {
if (value.userType() == QMetaType::Bool) {
i->setGroupView(value.toBool());
return true;
} else
return false;
}
case ScrollbarsInRoomlist: {
if (value.userType() == QMetaType::Bool) {
i->setScrollbarsInRoomlist(value.toBool());
return true;
} else
return false;
}
case Markdown: {
if (value.userType() == QMetaType::Bool) {
i->setMarkdown(value.toBool());
return true;
} else
return false;
}
if (value.userType() == QMetaType::Bool) {
return true;
} else
return false;
}
return true;
} else
return false;
}
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
case AnimateImagesOnHover: {
if (value.userType() == QMetaType::Bool) {
i->setAnimateImagesOnHover(value.toBool());
return true;
} else
return false;
}
case TypingNotifications: {
if (value.userType() == QMetaType::Bool) {
i->setTypingNotifications(value.toBool());
return true;
} else
return false;
}
case SortByImportance: {
if (value.userType() == QMetaType::Bool) {
i->setSortByImportance(value.toBool());
return true;
} else
return false;
}
case SortByAlphabet: {
if (value.userType() == QMetaType::Bool) {
i->setSortByAlphabet(value.toBool());
return true;
} else
return false;
}
case ButtonsInTimeline: {
if (value.userType() == QMetaType::Bool) {
i->setButtonsInTimeline(value.toBool());
return true;
} else
return false;
}
case TimelineMaxWidth: {
if (value.canConvert(QMetaType::fromType<int>())) {
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
i->setTimelineMaxWidth(value.toInt());
return true;
} else
return false;
}
case ReadReceipts: {
if (value.userType() == QMetaType::Bool) {
i->setReadReceipts(value.toBool());
return true;
} else
return false;
}
case DesktopNotifications: {
if (value.userType() == QMetaType::Bool) {
i->setDesktopNotifications(value.toBool());
return true;
} else
return false;
}
case AlertOnNotification: {
if (value.userType() == QMetaType::Bool) {
i->setAlertOnNotification(value.toBool());
return true;
} else
return false;
}
case AvatarCircles: {
if (value.userType() == QMetaType::Bool) {
i->setAvatarCircles(value.toBool());
return true;
} else
return false;
}
case UseIdenticon: {
if (value.userType() == QMetaType::Bool) {
i->setUseIdenticon(value.toBool());
return true;
} else
return false;
}
case OpenImageExternal: {
if (value.userType() == QMetaType::Bool) {
i->setOpenImageExternal(value.toBool());
return true;
} else
return false;
}
case OpenVideoExternal: {
if (value.userType() == QMetaType::Bool) {
i->setOpenVideoExternal(value.toBool());
return true;
} else
return false;
}
case DecryptSidebar: {
if (value.userType() == QMetaType::Bool) {
i->setDecryptSidebar(value.toBool());
return true;
} else
return false;
}
case DecryptNotifications: {
if (value.userType() == QMetaType::Bool) {
i->setDecryptNotifications(value.toBool());
return true;
} else
return false;
}
if (value.userType() == QMetaType::Bool) {
i->setSpaceNotifications(value.toBool());
return true;
} else
case FancyEffects: {
if (value.userType() == QMetaType::Bool) {
i->setFancyEffects(value.toBool());
return true;
} else
return false;
}
case ReducedMotion: {
if (value.userType() == QMetaType::Bool) {
i->setReducedMotion(value.toBool());
return true;
} else
return false;
}
case PrivacyScreen: {
if (value.userType() == QMetaType::Bool) {
i->setPrivacyScreen(value.toBool());
return true;
} else
return false;
}
case PrivacyScreenTimeout: {
if (value.canConvert(QMetaType::fromType<int>())) {
i->setPrivacyScreenTimeout(value.toInt());
return true;
} else
return false;
}
case MobileMode: {
if (value.userType() == QMetaType::Bool) {
i->setMobileMode(value.toBool());
return true;
} else
return false;
}
case FontSize: {
if (value.canConvert(QMetaType::fromType<double>())) {
i->setFontSize(value.toDouble());
return true;
} else
return false;
}
case Font: {
if (value.userType() == QMetaType::Int) {
// 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;
} else
return false;
}
case EmojiFont: {
// More special handling for the default font option
auto v = value.toInt();
v == 0 ? QStringLiteral("emoji")
: QFontDatabase::families(QFontDatabase::WritingSystem::Symbol).at(v - 1));
return true;
} else
return false;
}
case Ringtone: {
if (value.userType() == QMetaType::Int) {
int ringtone = value.toInt();
// setRingtone is called twice, because updating the list breaks the set value,
// because it does not exist yet!
if (ringtone == 2) {
QString homeFolder =
QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
auto filepath = QFileDialog::getOpenFileName(
nullptr, tr("Select a file"), homeFolder, tr("All Files (*)"));
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
if (!filepath.isEmpty()) {
i->setRingtone(filepath);
i->setRingtone(filepath);
}
} else if (ringtone == 0) {
i->setRingtone(QStringLiteral("Mute"));
i->setRingtone(QStringLiteral("Mute"));
} else if (ringtone == 1) {
i->setRingtone(QStringLiteral("Default"));
i->setRingtone(QStringLiteral("Default"));
}
return true;
}
return false;
}
case Microphone: {
if (value.userType() == QMetaType::Int) {
i->setMicrophone(data(index, Values).toStringList().at(value.toInt()));
return true;
} else
return false;
}
case Camera: {
if (value.userType() == QMetaType::Int) {
i->setCamera(data(index, Values).toStringList().at(value.toInt()));
return true;
} else
return false;
}
case CameraResolution: {
if (value.userType() == QMetaType::Int) {