2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

MTP global state moved to MTP::Instance class.

Now there will be ability to start multiple mtproto instances.
This commit is contained in:
John Preston
2017-02-24 20:15:41 +03:00
parent c3b3819d9f
commit dd933cf61c
23 changed files with 1868 additions and 1341 deletions

View File

@@ -82,7 +82,9 @@ MainWidget::MainWidget(QWidget *parent) : TWidget(parent)
, _playerPanel(this, Media::Player::Panel::Layout::Full)
, _mediaType(this, st::defaultDropdownMenu)
, _api(new ApiWrap(this)) {
MTP::setGlobalDoneHandler(rpcDone(&MainWidget::updateReceived));
Messenger::Instance().mtp()->setUpdatesHandler(rpcDone(&MainWidget::updateReceived));
Messenger::Instance().mtp()->setGlobalFailHandler(rpcFail(&MainWidget::updateFail));
_ptsWaiter.setRequesting(true);
updateScrollColors();
@@ -174,8 +176,6 @@ MainWidget::MainWidget(QWidget *parent) : TWidget(parent)
orderWidgets();
MTP::setGlobalFailHandler(rpcFail(&MainWidget::updateFail));
_mediaType->hide();
_mediaType->setOrigin(Ui::PanelAnimation::Origin::TopRight);
_topBar->mediaTypeButton()->installEventFilter(_mediaType);
@@ -4279,7 +4279,7 @@ MainWidget::~MainWidget() {
_hider = nullptr;
delete hider;
}
MTP::clearGlobalHandlers();
Messenger::Instance().mtp()->clearGlobalHandlers();
if (App::wnd()) App::wnd()->noMain(this);
}