tdesktop/Telegram/SourceFiles/storage/localstorage.h

125 lines
2.4 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "storage/file_download.h"
#include "storage/localimageloader.h"
2019-07-24 11:45:24 +00:00
#include "main/main_session.h"
#include <QtCore/QTimer>
class History;
2019-01-16 17:26:26 +00:00
namespace Data {
2019-01-28 13:59:49 +00:00
class WallPaper;
class DocumentMedia;
2019-01-16 17:26:26 +00:00
} // namespace Data
namespace Lang {
struct Language;
} // namespace Lang
namespace Storage {
namespace details {
struct ReadSettingsContext;
} // namespace details
class EncryptionKey;
} // namespace Storage
namespace Window {
namespace Theme {
struct Object;
struct Saved;
} // namespace Theme
} // namespace Window
2018-06-22 21:32:00 +00:00
namespace Export {
struct Settings;
} // namespace Export
2016-09-15 19:15:49 +00:00
namespace Local {
2016-09-15 19:15:49 +00:00
void start();
void finish();
2016-09-15 19:15:49 +00:00
void writeSettings();
2018-05-03 06:39:10 +00:00
void writeAutoupdatePrefix(const QString &prefix);
QString readAutoupdatePrefix();
2016-09-15 19:15:49 +00:00
void reset();
2016-09-15 19:15:49 +00:00
enum ClearManagerTask {
ClearManagerAll = 0xFFFF,
ClearManagerDownloads = 0x01,
};
2016-09-15 19:15:49 +00:00
struct ClearManagerData;
class ClearManager : public QObject {
Q_OBJECT
2016-09-15 19:15:49 +00:00
public:
ClearManager();
bool addTask(int task);
bool hasTask(ClearManagerTask task);
void start();
void stop();
2016-09-15 19:15:49 +00:00
signals:
void succeed(int task, void *manager);
void failed(int task, void *manager);
2016-09-15 19:15:49 +00:00
private slots:
void onStart();
2016-09-15 19:15:49 +00:00
private:
~ClearManager();
2016-09-15 19:15:49 +00:00
ClearManagerData *data;
2016-09-15 19:15:49 +00:00
};
int32 oldSettingsVersion();
void countVoiceWaveform(not_null<Data::DocumentMedia*> media);
2016-09-15 19:15:49 +00:00
void cancelTask(TaskId id);
void writeTheme(const Window::Theme::Saved &saved);
void clearTheme();
[[nodiscard]] Window::Theme::Saved readThemeAfterSwitch();
[[nodiscard]] Window::Theme::Object ReadThemeContent();
void writeLangPack();
void pushRecentLanguage(const Lang::Language &language);
std::vector<Lang::Language> readRecentLanguages();
void saveRecentLanguages(const std::vector<Lang::Language> &list);
void removeRecentLanguage(const QString &id);
void incrementRecentHashtag(RecentHashtagPack &recent, const QString &tag);
bool readOldMtpData(
bool remove,
Storage::details::ReadSettingsContext &context);
bool readOldUserSettings(
bool remove,
Storage::details::ReadSettingsContext &context);
2016-09-15 19:15:49 +00:00
namespace internal {
class Manager final : public QObject {
2016-09-15 19:15:49 +00:00
public:
Manager();
void finish();
};
2016-09-15 19:15:49 +00:00
} // namespace internal
} // namespace Local