|
|
@ -88,14 +88,7 @@ UserSettings::load(std::optional<QString> profile) |
|
|
|
openImageExternal_ = settings.value(QStringLiteral("user/open_image_external"), false).toBool(); |
|
|
|
openImageExternal_ = settings.value(QStringLiteral("user/open_image_external"), false).toBool(); |
|
|
|
openVideoExternal_ = settings.value(QStringLiteral("user/open_video_external"), false).toBool(); |
|
|
|
openVideoExternal_ = settings.value(QStringLiteral("user/open_video_external"), false).toBool(); |
|
|
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool(); |
|
|
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool(); |
|
|
|
auto tempSpaceNotifs = settings.value(QStringLiteral("user/space_notifications"), QString{}) |
|
|
|
spaceNotifications_ = settings.value(QStringLiteral("user/space_notifications"), true).toBool(); |
|
|
|
.toString() |
|
|
|
|
|
|
|
.toStdString(); |
|
|
|
|
|
|
|
auto spaceNotifsValue = |
|
|
|
|
|
|
|
QMetaEnum::fromType<SpaceNotificationOptions>().keyToValue(tempSpaceNotifs.c_str()); |
|
|
|
|
|
|
|
if (spaceNotifsValue < 0) |
|
|
|
|
|
|
|
spaceNotifsValue = 0; |
|
|
|
|
|
|
|
spaceNotifications_ = static_cast<SpaceNotificationOptions>(spaceNotifsValue); |
|
|
|
|
|
|
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).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(); |
|
|
@ -433,7 +426,7 @@ UserSettings::setDecryptSidebar(bool state) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
UserSettings::setSpaceNotifications(SpaceNotificationOptions state) |
|
|
|
UserSettings::setSpaceNotifications(bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (state == spaceNotifications_) |
|
|
|
if (state == spaceNotifications_) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -803,9 +796,7 @@ UserSettings::save() |
|
|
|
|
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("avatar_circles"), avatarCircles_); |
|
|
|
settings.setValue(QStringLiteral("avatar_circles"), avatarCircles_); |
|
|
|
settings.setValue(QStringLiteral("decrypt_sidebar"), decryptSidebar_); |
|
|
|
settings.setValue(QStringLiteral("decrypt_sidebar"), decryptSidebar_); |
|
|
|
settings.setValue(QStringLiteral("space_notifications"), |
|
|
|
settings.setValue(QStringLiteral("space_notifications"), spaceNotifications_); |
|
|
|
QString::fromUtf8(QMetaEnum::fromType<SpaceNotificationOptions>().valueToKey( |
|
|
|
|
|
|
|
static_cast<int>(spaceNotifications_)))); |
|
|
|
|
|
|
|
settings.setValue(QStringLiteral("privacy_screen"), privacyScreen_); |
|
|
|
settings.setValue(QStringLiteral("privacy_screen"), privacyScreen_); |
|
|
|
settings.setValue(QStringLiteral("privacy_screen_timeout"), privacyScreenTimeout_); |
|
|
|
settings.setValue(QStringLiteral("privacy_screen_timeout"), privacyScreenTimeout_); |
|
|
|
settings.setValue(QStringLiteral("mobile_mode"), mobileMode_); |
|
|
|
settings.setValue(QStringLiteral("mobile_mode"), mobileMode_); |
|
|
@ -1086,7 +1077,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case DecryptSidebar: |
|
|
|
case DecryptSidebar: |
|
|
|
return i->decryptSidebar(); |
|
|
|
return i->decryptSidebar(); |
|
|
|
case SpaceNotifications: |
|
|
|
case SpaceNotifications: |
|
|
|
return static_cast<int>(i->spaceNotifications()); |
|
|
|
return i->spaceNotifications(); |
|
|
|
case PrivacyScreen: |
|
|
|
case PrivacyScreen: |
|
|
|
return i->privacyScreen(); |
|
|
|
return i->privacyScreen(); |
|
|
|
case PrivacyScreenTimeout: |
|
|
|
case PrivacyScreenTimeout: |
|
|
@ -1320,7 +1311,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case CameraResolution: |
|
|
|
case CameraResolution: |
|
|
|
case CameraFrameRate: |
|
|
|
case CameraFrameRate: |
|
|
|
case Ringtone: |
|
|
|
case Ringtone: |
|
|
|
case SpaceNotifications: |
|
|
|
|
|
|
|
return Options; |
|
|
|
return Options; |
|
|
|
case TimelineMaxWidth: |
|
|
|
case TimelineMaxWidth: |
|
|
|
case PrivacyScreenTimeout: |
|
|
|
case PrivacyScreenTimeout: |
|
|
@ -1355,6 +1345,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
case ShareKeysWithTrustedUsers: |
|
|
|
case ShareKeysWithTrustedUsers: |
|
|
|
case UseOnlineKeyBackup: |
|
|
|
case UseOnlineKeyBackup: |
|
|
|
case ExposeDBusApi: |
|
|
|
case ExposeDBusApi: |
|
|
|
|
|
|
|
case SpaceNotifications: |
|
|
|
return Toggle; |
|
|
|
return Toggle; |
|
|
|
case Profile: |
|
|
|
case Profile: |
|
|
|
case UserId: |
|
|
|
case UserId: |
|
|
@ -1457,11 +1448,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
l.push_back(i->ringtone()); |
|
|
|
l.push_back(i->ringtone()); |
|
|
|
return l; |
|
|
|
return l; |
|
|
|
} |
|
|
|
} |
|
|
|
case SpaceNotifications: |
|
|
|
|
|
|
|
return QStringList{QStringLiteral("Sidebar and room list"), |
|
|
|
|
|
|
|
QStringLiteral("Sidebar"), |
|
|
|
|
|
|
|
QStringLiteral("Sidebar (hidden spaces and tags only)"), |
|
|
|
|
|
|
|
QStringLiteral("Off")}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else if (role == Good) { |
|
|
|
} else if (role == Good) { |
|
|
|
switch (index.row()) { |
|
|
|
switch (index.row()) { |
|
|
@ -1669,13 +1655,11 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int |
|
|
|
} |
|
|
|
} |
|
|
|
return i->decryptSidebar(); |
|
|
|
return i->decryptSidebar(); |
|
|
|
case SpaceNotifications: { |
|
|
|
case SpaceNotifications: { |
|
|
|
if (value.toInt() > |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
static_cast<int>(UserSettings::SpaceNotificationOptions::SpaceNotificationsOff) || |
|
|
|
i->setSpaceNotifications(value.toBool()); |
|
|
|
value.toInt() < 0) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i->setSpaceNotifications(value.value<UserSettings::SpaceNotificationOptions>()); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
case PrivacyScreen: { |
|
|
|
case PrivacyScreen: { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|
if (value.userType() == QMetaType::Bool) { |
|
|
|