mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed Ui::show from LocalStorageBox.
This commit is contained in:
parent
fe7c06bc84
commit
18d9484ab1
3 changed files with 12 additions and 11 deletions
|
@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "boxes/local_storage_box.h"
|
#include "boxes/local_storage_box.h"
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
@ -21,8 +20,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/cache/storage_cache_database.h"
|
#include "storage/cache/storage_cache_database.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "window/window_session_controller.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
|
@ -282,19 +281,19 @@ LocalStorageBox::LocalStorageBox(
|
||||||
_timeLimit = settings.totalTimeLimit;
|
_timeLimit = settings.totalTimeLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalStorageBox::Show(not_null<::Main::Session*> session) {
|
void LocalStorageBox::Show(not_null<Window::SessionController*> controller) {
|
||||||
auto shared = std::make_shared<object_ptr<LocalStorageBox>>(
|
auto shared = std::make_shared<object_ptr<LocalStorageBox>>(
|
||||||
Box<LocalStorageBox>(session, CreateTag()));
|
Box<LocalStorageBox>(&controller->session(), CreateTag()));
|
||||||
const auto weak = shared->data();
|
const auto weak = shared->data();
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
session->data().cache().statsOnMain(),
|
controller->session().data().cache().statsOnMain(),
|
||||||
session->data().cacheBigFile().statsOnMain()
|
controller->session().data().cacheBigFile().statsOnMain()
|
||||||
) | rpl::start_with_next([=](
|
) | rpl::start_with_next([=](
|
||||||
Database::Stats &&stats,
|
Database::Stats &&stats,
|
||||||
Database::Stats &&statsBig) {
|
Database::Stats &&statsBig) {
|
||||||
weak->update(std::move(stats), std::move(statsBig));
|
weak->update(std::move(stats), std::move(statsBig));
|
||||||
if (auto &strong = *shared) {
|
if (auto &strong = *shared) {
|
||||||
Ui::show(std::move(strong));
|
controller->uiShow()->show(std::move(strong));
|
||||||
}
|
}
|
||||||
}, weak->lifetime());
|
}, weak->lifetime());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@ namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class SessionController;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
namespace Cache {
|
namespace Cache {
|
||||||
class Database;
|
class Database;
|
||||||
|
@ -40,7 +44,7 @@ public:
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
CreateTag);
|
CreateTag);
|
||||||
|
|
||||||
static void Show(not_null<Main::Session*> session);
|
static void Show(not_null<Window::SessionController*> controller);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
|
|
@ -1058,9 +1058,7 @@ void SetupLocalStorage(
|
||||||
tr::lng_settings_manage_local_storage(),
|
tr::lng_settings_manage_local_storage(),
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{ &st::menuIconStorage }
|
{ &st::menuIconStorage }
|
||||||
)->addClickHandler([=] {
|
)->addClickHandler([=] { LocalStorageBox::Show(controller); });
|
||||||
LocalStorageBox::Show(&controller->session());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDataStorage(
|
void SetupDataStorage(
|
||||||
|
|
Loading…
Add table
Reference in a new issue