2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Implement "Save Power on Low Battery" function.

This commit is contained in:
John Preston
2023-02-27 18:09:12 +04:00
parent 388541a3fb
commit ce0e07d332
16 changed files with 218 additions and 50 deletions

View File

@@ -13,6 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
class History;
namespace base {
class BatterySaving;
} // namespace base
namespace Platform {
class Integration;
} // namespace Platform
@@ -127,15 +131,14 @@ public:
Application &operator=(const Application &other) = delete;
~Application();
void run();
[[nodiscard]] Launcher &launcher() const {
return *_launcher;
}
[[nodiscard]] Platform::Integration &platformIntegration() const {
return *_platformIntegration;
}
void run();
[[nodiscard]] Ui::Animations::Manager &animationManager() const {
return *_animationsManager;
}
@@ -150,6 +153,9 @@ public:
[[nodiscard]] Tray &tray() const {
return *_tray;
}
[[nodiscard]] base::BatterySaving &batterySaving() const {
return *_batterySaving;
}
// Windows interface.
bool hasActiveWindow(not_null<Main::Session*> session) const;
@@ -191,6 +197,7 @@ public:
void startSettingsAndBackground();
[[nodiscard]] Settings &settings();
[[nodiscard]] const Settings &settings() const;
void saveSettingsDelayed(crl::time delay = kDefaultSaveDelay);
void saveSettings();
@@ -373,6 +380,7 @@ private:
struct Private;
const std::unique_ptr<Private> _private;
const std::unique_ptr<Platform::Integration> _platformIntegration;
const std::unique_ptr<base::BatterySaving> _batterySaving;
const std::unique_ptr<Storage::Databases> _databases;
const std::unique_ptr<Ui::Animations::Manager> _animationsManager;