2014-11-22 09:45:04 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-11-22 09:45:04 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
#include "storage/file_download.h"
|
2018-08-27 11:35:58 +00:00
|
|
|
#include "storage/localimageloader.h"
|
2019-07-24 11:45:24 +00:00
|
|
|
#include "main/main_session.h"
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2019-09-13 06:06:02 +00:00
|
|
|
#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;
|
2020-04-09 12:27:53 +00:00
|
|
|
class DocumentMedia;
|
2019-01-16 17:26:26 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2018-10-30 11:23:54 +00:00
|
|
|
namespace Lang {
|
|
|
|
struct Language;
|
|
|
|
} // namespace Lang
|
|
|
|
|
2018-08-27 11:35:58 +00:00
|
|
|
namespace Storage {
|
2020-06-09 16:57:05 +00:00
|
|
|
namespace details {
|
|
|
|
struct ReadSettingsContext;
|
|
|
|
} // namespace details
|
2018-08-27 11:35:58 +00:00
|
|
|
class EncryptionKey;
|
|
|
|
} // namespace Storage
|
|
|
|
|
2016-10-28 12:44:28 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Theme {
|
2019-09-05 20:21:44 +00:00
|
|
|
struct Object;
|
2018-07-19 14:58:40 +00:00
|
|
|
struct Saved;
|
2016-10-28 12:44:28 +00:00
|
|
|
} // 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 {
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
void start();
|
|
|
|
void finish();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
void writeSettings();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
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();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
enum ClearManagerTask {
|
|
|
|
ClearManagerAll = 0xFFFF,
|
|
|
|
ClearManagerDownloads = 0x01,
|
|
|
|
};
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
struct ClearManagerData;
|
|
|
|
class ClearManager : public QObject {
|
|
|
|
Q_OBJECT
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
public:
|
|
|
|
ClearManager();
|
|
|
|
bool addTask(int task);
|
|
|
|
bool hasTask(ClearManagerTask task);
|
|
|
|
void start();
|
|
|
|
void stop();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
signals:
|
|
|
|
void succeed(int task, void *manager);
|
|
|
|
void failed(int task, void *manager);
|
2014-12-05 13:44:27 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
private slots:
|
|
|
|
void onStart();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
private:
|
|
|
|
~ClearManager();
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
ClearManagerData *data;
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-09-15 19:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int32 oldSettingsVersion();
|
|
|
|
|
2020-04-09 12:27:53 +00:00
|
|
|
void countVoiceWaveform(not_null<Data::DocumentMedia*> media);
|
2016-09-15 19:15:49 +00:00
|
|
|
|
|
|
|
void cancelTask(TaskId id);
|
|
|
|
|
2018-07-19 14:58:40 +00:00
|
|
|
void writeTheme(const Window::Theme::Saved &saved);
|
2016-12-20 13:03:51 +00:00
|
|
|
void clearTheme();
|
2019-09-05 20:21:44 +00:00
|
|
|
[[nodiscard]] Window::Theme::Saved readThemeAfterSwitch();
|
|
|
|
|
|
|
|
[[nodiscard]] Window::Theme::Object ReadThemeContent();
|
2016-10-28 12:44:28 +00:00
|
|
|
|
2017-04-13 17:59:05 +00:00
|
|
|
void writeLangPack();
|
2018-10-30 11:23:54 +00:00
|
|
|
void pushRecentLanguage(const Lang::Language &language);
|
2018-11-01 07:10:15 +00:00
|
|
|
std::vector<Lang::Language> readRecentLanguages();
|
|
|
|
void saveRecentLanguages(const std::vector<Lang::Language> &list);
|
|
|
|
void removeRecentLanguage(const QString &id);
|
2020-06-09 16:57:05 +00:00
|
|
|
void incrementRecentHashtag(RecentHashtagPack &recent, const QString &tag);
|
2017-04-13 17:59:05 +00:00
|
|
|
|
2020-06-09 16:57:05 +00:00
|
|
|
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 {
|
|
|
|
|
2020-06-09 16:57:05 +00:00
|
|
|
class Manager final : public QObject {
|
2016-09-15 19:15:49 +00:00
|
|
|
public:
|
|
|
|
Manager();
|
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
void finish();
|
2015-03-02 12:34:16 +00:00
|
|
|
|
2014-11-22 09:45:04 +00:00
|
|
|
};
|
2016-09-15 19:15:49 +00:00
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace Local
|