Reset some settings on full logout.

This commit is contained in:
John Preston 2020-06-19 19:51:51 +04:00
parent 2635ca33f8
commit 0824d2da20
4 changed files with 62 additions and 5 deletions

View File

@ -289,4 +289,55 @@ QString Settings::getSoundPath(const QString &key) const {
return qsl(":/sounds/") + key + qsl(".mp3");
}
void Settings::resetOnLastLogout() {
_adaptiveForWide = true;
_moderateModeEnabled = false;
_songVolume = kDefaultVolume;
_videoVolume = kDefaultVolume;
_askDownloadPath = false;
_downloadPath = QString();
_downloadPathBookmark = QByteArray();
_voiceMsgPlaybackDoubled = false;
_soundNotify = true;
_desktopNotify = true;
_flashBounceNotify = true;
_notifyView = dbinvShowPreview;
//_nativeNotifications = false;
//_notificationsCount = 3;
//_notificationsCorner = ScreenCorner::BottomRight;
_includeMutedCounter = true;
_countUnreadMessages = true;
_notifyAboutPinned = true;
//_autoLock = 3600;
//_callOutputDeviceID = u"default"_q;
//_callInputDeviceID = u"default"_q;
//_callOutputVolume = 100;
//_callInputVolume = 100;
//_callAudioDuckingEnabled = true;
//_themesAccentColors = Window::Theme::AccentColors();
_lastSeenWarningSeen = false;
_sendFilesWay = SendFilesWay::Album;
//_sendSubmitWay = Ui::InputSubmitSettings::Enter;
_soundOverrides = {};
_exeLaunchWarning = true;
_loopAnimatedStickers = true;
_largeEmoji = true;
_replaceEmoji = true;
_suggestEmoji = true;
_suggestStickersByEmoji = true;
_spellcheckerEnabled = true;
_videoPlaybackSpeed = 1.;
//_videoPipGeometry = QByteArray();
_dictionariesEnabled = std::vector<int>();
_autoDownloadDictionaries = true;
}
} // namespace Core

View File

@ -357,6 +357,8 @@ public:
return (std::clamp(speed, 0, 6) + 2) / 4.;
}
void resetOnLastLogout();
private:
bool _adaptiveForWide = true;
bool _moderateModeEnabled = false;

View File

@ -137,11 +137,6 @@ void applyReadContext(ReadSettingsContext &&context) {
_useGlobalBackgroundKeys = context.backgroundKeysRead;
_langPackKey = context.langPackKey;
_languagesKey = context.languagesKey;
if (context.tileRead && _useGlobalBackgroundKeys) {
Window::Theme::Background()->setTileDayValue(context.tileDay);
Window::Theme::Background()->setTileNightValue(context.tileNight);
}
}
bool _readOldSettings(bool remove, ReadSettingsContext &context) {
@ -411,6 +406,12 @@ void start() {
applyReadContext(std::move(context));
InitialLoadTheme();
if (context.tileRead && _useGlobalBackgroundKeys) {
Window::Theme::Background()->setTileDayValue(context.tileDay);
Window::Theme::Background()->setTileNightValue(context.tileNight);
}
readLangPack();
}
@ -795,6 +796,8 @@ void reset() {
Window::Theme::Background()->reset();
_oldSettingsVersion = 0;
Core::App().settings().resetOnLastLogout();
writeSettings();
}
int32 oldSettingsVersion() {

View File

@ -913,6 +913,7 @@ void ChatBackground::reset() {
notify(BackgroundUpdate(BackgroundUpdate::Type::TestingTheme, tile()), true);
notify(BackgroundUpdate(BackgroundUpdate::Type::ApplyingTheme, tile()), true);
}
writeNewBackgroundSettings();
}
void ChatBackground::saveForRevert() {