localstorage.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "storage/file_download.h"
  9. #include "storage/localimageloader.h"
  10. #include <QtCore/QTimer>
  11. class History;
  12. namespace Data {
  13. class WallPaper;
  14. class DocumentMedia;
  15. } // namespace Data
  16. namespace Lang {
  17. struct Language;
  18. } // namespace Lang
  19. namespace Storage {
  20. namespace details {
  21. struct ReadSettingsContext;
  22. } // namespace details
  23. class EncryptionKey;
  24. } // namespace Storage
  25. namespace Window {
  26. namespace Theme {
  27. struct Object;
  28. struct Saved;
  29. } // namespace Theme
  30. } // namespace Window
  31. namespace Export {
  32. struct Settings;
  33. } // namespace Export
  34. namespace MTP {
  35. class AuthKey;
  36. using AuthKeyPtr = std::shared_ptr<AuthKey>;
  37. } // namespace MTP
  38. namespace Local {
  39. void start();
  40. void sync();
  41. void finish();
  42. void writeSettings();
  43. void rewriteSettingsIfNeeded();
  44. void writeAutoupdatePrefix(const QString &prefix);
  45. QString readAutoupdatePrefix();
  46. void writeBackground(const Data::WallPaper &paper, const QImage &image);
  47. bool readBackground();
  48. void moveLegacyBackground(
  49. const QString &fromBasePath,
  50. const MTP::AuthKeyPtr &fromLocalKey,
  51. uint64 legacyBackgroundKeyDay,
  52. uint64 legacyBackgroundKeyNight);
  53. void reset();
  54. int32 oldSettingsVersion();
  55. void countVoiceWaveform(not_null<Data::DocumentMedia*> media);
  56. void cancelTask(TaskId id);
  57. void writeTheme(const Window::Theme::Saved &saved);
  58. void clearTheme();
  59. [[nodiscard]] Window::Theme::Saved readThemeAfterSwitch();
  60. [[nodiscard]] Window::Theme::Object ReadThemeContent();
  61. void writeLangPack();
  62. void pushRecentLanguage(const Lang::Language &language);
  63. std::vector<Lang::Language> readRecentLanguages();
  64. void saveRecentLanguages(const std::vector<Lang::Language> &list);
  65. void removeRecentLanguage(const QString &id);
  66. void incrementRecentHashtag(RecentHashtagPack &recent, const QString &tag);
  67. bool readOldMtpData(
  68. bool remove,
  69. Storage::details::ReadSettingsContext &context);
  70. bool readOldUserSettings(
  71. bool remove,
  72. Storage::details::ReadSettingsContext &context);
  73. } // namespace Local