2016-08-28 19:16:23 +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.
|
2016-08-28 19:16:23 +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
|
2016-08-28 19:16:23 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
2016-08-28 19:16:23 +00:00
|
|
|
|
2016-11-11 13:46:04 +00:00
|
|
|
namespace Ui {
|
2016-08-28 19:16:23 +00:00
|
|
|
class LinkButton;
|
2016-11-11 13:46:04 +00:00
|
|
|
} // namespace Ui
|
2016-08-28 19:16:23 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
class LocalStorageBox : public BoxContent {
|
2016-08-28 19:16:23 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-12-13 17:07:56 +00:00
|
|
|
LocalStorageBox(QWidget*);
|
2016-08-28 19:16:23 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onTempDirCleared(int task);
|
|
|
|
void onTempDirClearFailed(int task);
|
|
|
|
|
|
|
|
protected:
|
2016-12-13 17:07:56 +00:00
|
|
|
void prepare() override;
|
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
2016-12-13 17:07:56 +00:00
|
|
|
void clearStorage();
|
2016-08-28 19:16:23 +00:00
|
|
|
void updateControls();
|
|
|
|
void checkLocalStoredCounts();
|
|
|
|
|
|
|
|
enum class State {
|
|
|
|
Normal,
|
|
|
|
Clearing,
|
|
|
|
Cleared,
|
|
|
|
ClearFailed,
|
|
|
|
};
|
|
|
|
State _state = State::Normal;
|
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _clear;
|
2016-08-28 19:16:23 +00:00
|
|
|
|
|
|
|
int _imagesCount = -1;
|
|
|
|
int _audiosCount = -1;
|
|
|
|
|
|
|
|
};
|