|
|
@ -82,10 +82,12 @@ UserSettings::load(std::optional<QString> profile) |
|
|
|
|
|
|
|
|
|
|
|
font_ = settings.value(QStringLiteral("user/font_family"), "").toString(); |
|
|
|
font_ = settings.value(QStringLiteral("user/font_family"), "").toString(); |
|
|
|
|
|
|
|
|
|
|
|
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool(); |
|
|
|
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool(); |
|
|
|
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool(); |
|
|
|
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool(); |
|
|
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool(); |
|
|
|
openImageExternal_ = settings.value(QStringLiteral("user/open_image_external"), false).toBool(); |
|
|
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool(); |
|
|
|
openVideoExternal_ = settings.value(QStringLiteral("user/open_video_external"), false).toBool(); |
|
|
|
|
|
|
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool(); |
|
|
|
|
|
|
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool(); |
|
|
|
privacyScreenTimeout_ = |
|
|
|
privacyScreenTimeout_ = |
|
|
|
settings.value(QStringLiteral("user/privacy_screen_timeout"), 0).toInt(); |
|
|
|
settings.value(QStringLiteral("user/privacy_screen_timeout"), 0).toInt(); |
|
|
|
mobileMode_ = settings.value(QStringLiteral("user/mobile_mode"), false).toBool(); |
|
|
|
mobileMode_ = settings.value(QStringLiteral("user/mobile_mode"), false).toBool(); |
|
|
@ -687,6 +689,26 @@ UserSettings::setUseIdenticon(bool state) |
|
|
|
save(); |
|
|
|
save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
UserSettings::setOpenImageExternal(bool state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (state == openImageExternal_) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
openImageExternal_ = state; |
|
|
|
|
|
|
|
emit openImageExternalChanged(openImageExternal_); |
|
|
|
|
|
|
|
save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
UserSettings::setOpenVideoExternal(bool state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (state == openVideoExternal_) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
openVideoExternal_ = state; |
|
|
|
|
|
|
|
emit openVideoExternalChanged(openVideoExternal_); |
|
|
|
|
|
|
|
save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
UserSettings::applyTheme() |
|
|
|
UserSettings::applyTheme() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -764,6 +786,8 @@ UserSettings::save() |
|
|
|
settings.setValue(QStringLiteral("use_stun_server"), useStunServer_); |
|
|
|
settings.setValue(QStringLiteral("use_stun_server"), useStunServer_); |
|
|
|
settings.setValue(QStringLiteral("currentProfile"), profile_); |
|
|
|
settings.setValue(QStringLiteral("currentProfile"), profile_); |
|
|
|
settings.setValue(QStringLiteral("use_identicon"), useIdenticon_); |
|
|
|
settings.setValue(QStringLiteral("use_identicon"), useIdenticon_); |
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("open_image_external"), openImageExternal_); |
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("open_video_external"), openVideoExternal_); |
|
|
|
|
|
|
|
|
|
|
|
settings.endGroup(); // user
|
|
|
|
settings.endGroup(); // user
|
|
|
|
|
|
|
|
|
|
|
@ -868,6 +892,10 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return tr("Circular Avatars"); |
|
|
|
return tr("Circular Avatars"); |
|
|
|
case UseIdenticon: |
|
|
|
case UseIdenticon: |
|
|
|
return tr("Use identicons"); |
|
|
|
return tr("Use identicons"); |
|
|
|
|
|
|
|
case OpenImageExternal: |
|
|
|
|
|
|
|
return tr("Open images with external program"); |
|
|
|
|
|
|
|
case OpenVideoExternal: |
|
|
|
|
|
|
|
return tr("Open videos with external program"); |
|
|
|
case DecryptSidebar: |
|
|
|
case DecryptSidebar: |
|
|
|
return tr("Decrypt messages in sidebar"); |
|
|
|
return tr("Decrypt messages in sidebar"); |
|
|
|
case PrivacyScreen: |
|
|
|
case PrivacyScreen: |
|
|
@ -992,6 +1020,10 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
return i->avatarCircles(); |
|
|
|
return i->avatarCircles(); |
|
|
|
case UseIdenticon: |
|
|
|
case UseIdenticon: |
|
|
|
return i->useIdenticon(); |
|
|
|
return i->useIdenticon(); |
|
|
|
|
|
|
|
case OpenImageExternal: |
|
|
|
|
|
|
|
return i->openImageExternal(); |
|
|
|
|
|
|
|
case OpenVideoExternal: |
|
|
|
|
|
|
|
return i->openVideoExternal(); |
|
|
|
case DecryptSidebar: |
|
|
|
case DecryptSidebar: |
|
|
|
return i->decryptSidebar(); |
|
|
|
return i->decryptSidebar(); |
|
|
|
case PrivacyScreen: |
|
|
|
case PrivacyScreen: |
|
|
@ -1134,6 +1166,14 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
"Change the appearance of user avatars in chats.\nOFF - square, ON - circle."); |
|
|
|
"Change the appearance of user avatars in chats.\nOFF - square, ON - circle."); |
|
|
|
case UseIdenticon: |
|
|
|
case UseIdenticon: |
|
|
|
return tr("Display an identicon instead of a letter when no avatar is set."); |
|
|
|
return tr("Display an identicon instead of a letter when no avatar is set."); |
|
|
|
|
|
|
|
case OpenImageExternal: |
|
|
|
|
|
|
|
return tr("Toggles the behavior of \"Right-Click>Open with 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("Toggles the behavior of \"Right-Click>Open with 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: |
|
|
|
case DecryptSidebar: |
|
|
|
return tr("Decrypt the messages shown in the sidebar.\nOnly affects messages in " |
|
|
|
return tr("Decrypt the messages shown in the sidebar.\nOnly affects messages in " |
|
|
|
"encrypted chats."); |
|
|
|
"encrypted chats."); |
|
|
@ -1230,6 +1270,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case AlertOnNotification: |
|
|
|
case AlertOnNotification: |
|
|
|
case AvatarCircles: |
|
|
|
case AvatarCircles: |
|
|
|
case UseIdenticon: |
|
|
|
case UseIdenticon: |
|
|
|
|
|
|
|
case OpenImageExternal: |
|
|
|
|
|
|
|
case OpenVideoExternal: |
|
|
|
case DecryptSidebar: |
|
|
|
case DecryptSidebar: |
|
|
|
case PrivacyScreen: |
|
|
|
case PrivacyScreen: |
|
|
|
case MobileMode: |
|
|
|
case MobileMode: |
|
|
@ -1522,6 +1564,20 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int |
|
|
|
} else |
|
|
|
} else |
|
|
|
return false; |
|
|
|
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: { |
|
|
|
case DecryptSidebar: { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
i->setDecryptSidebar(value.toBool()); |
|
|
|
i->setDecryptSidebar(value.toBool()); |
|
|
@ -1782,6 +1838,12 @@ UserSettingsModel::UserSettingsModel(QObject *p) |
|
|
|
connect(s.get(), &UserSettings::useIdenticonChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::useIdenticonChanged, this, [this]() { |
|
|
|
emit dataChanged(index(UseIdenticon), index(UseIdenticon), {Value}); |
|
|
|
emit dataChanged(index(UseIdenticon), index(UseIdenticon), {Value}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
connect(s.get(), &UserSettings::openImageExternalChanged, this, [this]() { |
|
|
|
|
|
|
|
emit dataChanged(index(OpenImageExternal), index(OpenImageExternal), {Value}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
connect(s.get(), &UserSettings::openVideoExternalChanged, this, [this]() { |
|
|
|
|
|
|
|
emit dataChanged(index(OpenVideoExternal), index(OpenVideoExternal), {Value}); |
|
|
|
|
|
|
|
}); |
|
|
|
connect(s.get(), &UserSettings::privacyScreenChanged, this, [this]() { |
|
|
|
connect(s.get(), &UserSettings::privacyScreenChanged, this, [this]() { |
|
|
|
emit dataChanged(index(PrivacyScreen), index(PrivacyScreen), {Value}); |
|
|
|
emit dataChanged(index(PrivacyScreen), index(PrivacyScreen), {Value}); |
|
|
|
emit dataChanged(index(PrivacyScreenTimeout), index(PrivacyScreenTimeout), {Enabled}); |
|
|
|
emit dataChanged(index(PrivacyScreenTimeout), index(PrivacyScreenTimeout), {Enabled}); |
|
|
|