|
|
|
@ -94,6 +94,7 @@ UserSettings::load(std::optional<QString> profile) |
|
|
|
|
settings.value(QStringLiteral("user/decrypt_notifications"), true).toBool(); |
|
|
|
|
spaceNotifications_ = settings.value(QStringLiteral("user/space_notifications"), true).toBool(); |
|
|
|
|
fancyEffects_ = settings.value(QStringLiteral("user/fancy_effects"), true).toBool(); |
|
|
|
|
reducedMotion_ = settings.value(QStringLiteral("user/reduced_motion"), false).toBool(); |
|
|
|
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool(); |
|
|
|
|
privacyScreenTimeout_ = |
|
|
|
|
settings.value(QStringLiteral("user/privacy_screen_timeout"), 0).toInt(); |
|
|
|
@ -471,6 +472,22 @@ UserSettings::setFancyEffects(bool state) |
|
|
|
|
save(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
UserSettings::setReducedMotion(bool state) |
|
|
|
|
{ |
|
|
|
|
if (state == reducedMotion_) |
|
|
|
|
return; |
|
|
|
|
reducedMotion_ = state; |
|
|
|
|
emit reducedMotionChanged(state); |
|
|
|
|
save(); |
|
|
|
|
|
|
|
|
|
// Also toggle other motion related settings
|
|
|
|
|
if (reducedMotion_) { |
|
|
|
|
setFancyEffects(false); |
|
|
|
|
setAnimateImagesOnHover(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
UserSettings::setPrivacyScreen(bool state) |
|
|
|
|
{ |
|
|
|
@ -835,6 +852,7 @@ UserSettings::save() |
|
|
|
|
settings.setValue(QStringLiteral("decrypt_notificatons"), decryptNotifications_); |
|
|
|
|
settings.setValue(QStringLiteral("space_notifications"), spaceNotifications_); |
|
|
|
|
settings.setValue(QStringLiteral("fancy_effects"), fancyEffects_); |
|
|
|
|
settings.setValue(QStringLiteral("reduced_motion"), reducedMotion_); |
|
|
|
|
settings.setValue(QStringLiteral("privacy_screen"), privacyScreen_); |
|
|
|
|
settings.setValue(QStringLiteral("privacy_screen_timeout"), privacyScreenTimeout_); |
|
|
|
|
settings.setValue(QStringLiteral("mobile_mode"), mobileMode_); |
|
|
|
@ -991,6 +1009,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
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"); |
|
|
|
|
case PrivacyScreen: |
|
|
|
|
return tr("Privacy Screen"); |
|
|
|
|
case PrivacyScreenTimeout: |
|
|
|
@ -1039,6 +1059,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
return tr("Platform"); |
|
|
|
|
case GeneralSection: |
|
|
|
|
return tr("GENERAL"); |
|
|
|
|
case AccessibilitySection: |
|
|
|
|
return tr("ACCESSIBILITY"); |
|
|
|
|
case TimelineSection: |
|
|
|
|
return tr("TIMELINE"); |
|
|
|
|
case SidebarSection: |
|
|
|
@ -1129,6 +1151,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
return i->spaceNotifications(); |
|
|
|
|
case FancyEffects: |
|
|
|
|
return i->fancyEffects(); |
|
|
|
|
case ReducedMotion: |
|
|
|
|
return i->reducedMotion(); |
|
|
|
|
case PrivacyScreen: |
|
|
|
|
return i->privacyScreen(); |
|
|
|
|
case PrivacyScreenTimeout: |
|
|
|
@ -1296,6 +1320,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
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: |
|
|
|
@ -1326,6 +1353,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
case Version: |
|
|
|
|
case Platform: |
|
|
|
|
case GeneralSection: |
|
|
|
|
case AccessibilitySection: |
|
|
|
|
case TimelineSection: |
|
|
|
|
case SidebarSection: |
|
|
|
|
case TraySection: |
|
|
|
@ -1409,6 +1437,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
case ExposeDBusApi: |
|
|
|
|
case SpaceNotifications: |
|
|
|
|
case FancyEffects: |
|
|
|
|
case ReducedMotion: |
|
|
|
|
return Toggle; |
|
|
|
|
case Profile: |
|
|
|
|
case UserId: |
|
|
|
@ -1420,6 +1449,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const |
|
|
|
|
case Platform: |
|
|
|
|
return ReadOnlyText; |
|
|
|
|
case GeneralSection: |
|
|
|
|
case AccessibilitySection: |
|
|
|
|
case TimelineSection: |
|
|
|
|
case SidebarSection: |
|
|
|
|
case TraySection: |
|
|
|
@ -1744,6 +1774,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int |
|
|
|
|
} 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()); |
|
|
|
@ -2068,6 +2105,9 @@ UserSettingsModel::UserSettingsModel(QObject *p) |
|
|
|
|
connect(s.get(), &UserSettings::fancyEffectsChanged, this, [this]() { |
|
|
|
|
emit dataChanged(index(FancyEffects), index(FancyEffects), {Value}); |
|
|
|
|
}); |
|
|
|
|
connect(s.get(), &UserSettings::reducedMotionChanged, this, [this]() { |
|
|
|
|
emit dataChanged(index(ReducedMotion), index(ReducedMotion), {Value}); |
|
|
|
|
}); |
|
|
|
|
connect(s.get(), &UserSettings::trayChanged, this, [this]() { |
|
|
|
|
emit dataChanged(index(Tray), index(Tray), {Value}); |
|
|
|
|
emit dataChanged(index(StartInTray), index(StartInTray), {Enabled}); |
|
|
|
|