2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Implement some power saving options.

This commit is contained in:
John Preston
2023-02-21 16:31:55 +04:00
parent 02bc950b57
commit 2a4c39b9d7
53 changed files with 446 additions and 108 deletions

View File

@@ -13,9 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "core/core_settings.h"
#include "mtproto/mtproto_config.h"
#include "ui/effects/animation_value.h"
#include "ui/widgets/input_fields.h"
#include "ui/chat/attach/attach_send_files_way.h"
#include "ui/power_saving.h"
#include "window/themes/window_theme.h"
#include "core/update_checker.h"
#include "platform/platform_specific.h"
@@ -232,14 +232,14 @@ bool ReadSetting(
context.cacheBigFileTotalTimeLimit = NoTimeLimit(timeBig) ? 0 : timeBig;
} break;
case dbiAnimationsDisabled: {
qint32 disabled;
stream >> disabled;
case dbiPowerSaving: {
qint32 settings;
stream >> settings;
if (!CheckStreamStatus(stream)) {
return false;
}
anim::SetDisabled(disabled == 1);
PowerSaving::Set(PowerSaving::Flags::from_raw(settings));
} break;
case dbiSoundFlashBounceNotifyOld: {

View File

@@ -154,7 +154,7 @@ enum {
dbiThemeKey = 0x54,
dbiTileBackground = 0x55,
dbiCacheSettingsOld = 0x56,
dbiAnimationsDisabled = 0x57,
dbiPowerSaving = 0x57,
dbiScalePercent = 0x58,
dbiPlaybackSpeedOld = 0x59,
dbiLanguagesKey = 0x5a,

View File

@@ -6,7 +6,7 @@ For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "storage/localstorage.h"
//
#include "storage/serialize_common.h"
#include "storage/storage_account.h"
#include "storage/details/storage_file_utilities.h"
@@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document_media.h"
#include "base/platform/base_platform_info.h"
#include "base/random.h"
#include "ui/effects/animation_value.h"
#include "ui/power_saving.h"
#include "core/update_checker.h"
#include "core/file_location.h"
#include "core/application.h"
@@ -473,6 +473,8 @@ void writeSettings() {
}
size += sizeof(quint32) + sizeof(qint32) * 8;
const auto powerSaving = PowerSaving::Current().value();
EncryptedDescriptor data(size);
data.stream << quint32(dbiAutoStart) << qint32(cAutoStart());
data.stream << quint32(dbiStartMinimized) << qint32(cStartMinimized());
@@ -484,7 +486,7 @@ void writeSettings() {
data.stream << quint32(dbiFallbackProductionConfig) << configSerialized;
data.stream << quint32(dbiApplicationSettings) << applicationSettings;
data.stream << quint32(dbiDialogLastPath) << cDialogLastPath();
data.stream << quint32(dbiAnimationsDisabled) << qint32(anim::Disabled() ? 1 : 0);
data.stream << quint32(dbiPowerSaving) << qint32(powerSaving);
data.stream
<< quint32(dbiThemeKey)