2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Remove non-UI calls to App::main.

This commit is contained in:
John Preston
2020-06-12 18:09:04 +04:00
parent 3c4e959468
commit f450f81215
36 changed files with 768 additions and 675 deletions

View File

@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_peer_values.h"
#include "data/data_drafts.h"
#include "data/data_session.h"
#include "data/data_changes.h"
#include "data/data_media_types.h"
#include "data/data_folder.h"
#include "data/data_channel.h"
@@ -281,8 +282,10 @@ MainWidget::MainWidget(
[this] { updateControlsGeometry(); },
lifetime());
session().data().newMessageSent(
) | rpl::start_with_next([=](not_null<History*> history) {
session().changes().historyUpdates(
Data::HistoryUpdate::Flag::MessageSent
) | rpl::start_with_next([=](const Data::HistoryUpdate &update) {
const auto history = update.history;
history->forgetScrollState();
if (const auto from = history->peer->migrateFrom()) {
if (const auto migrated = history->owner().historyLoaded(from)) {
@@ -758,10 +761,6 @@ bool MainWidget::selectingPeer() const {
return _hider ? true : false;
}
void MainWidget::removeDialog(Dialogs::Key key) {
_dialogs->removeDialog(key);
}
void MainWidget::cacheBackground() {
if (Window::Theme::Background()->colorForFill()) {
return;
@@ -850,13 +849,6 @@ void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
}
}
void MainWidget::itemEdited(not_null<HistoryItem*> item) {
if (_history->peer() == item->history()->peer
|| (_history->peer() && _history->peer() == item->history()->peer->migrateTo())) {
_history->itemEdited(item);
}
}
void MainWidget::handleAudioUpdate(const Media::Player::TrackState &state) {
using State = Media::Player::State;
const auto document = state.id.audio();
@@ -1087,12 +1079,6 @@ void MainWidget::inlineResultLoadFailed(FileLoader *loader, bool started) {
//Ui::repaintInlineItem();
}
void MainWidget::onSendFileConfirm(
const std::shared_ptr<FileLoadResult> &file,
const std::optional<FullMsgId> &oldId) {
_history->sendFileConfirmed(file, oldId);
}
bool MainWidget::sendExistingDocument(not_null<DocumentData*> document) {
return _history->sendExistingDocument(document);
}
@@ -1234,10 +1220,6 @@ Image *MainWidget::newBackgroundThumb() {
: nullptr;
}
void MainWidget::updateBotKeyboard(History *h) {
_history->updateBotKeyboard(h);
}
void MainWidget::pushReplyReturn(not_null<HistoryItem*> item) {
_history->pushReplyReturn(item);
}
@@ -1339,10 +1321,6 @@ void MainWidget::viewsIncrementFail(const RPCError &error, mtpRequestId requestI
}
}
void MainWidget::refreshDialog(Dialogs::Key key) {
_dialogs->refreshDialog(key);
}
void MainWidget::choosePeer(PeerId peerId, MsgId showAtMsgId) {
if (selectingPeer()) {
_hider->offerPeer(peerId);
@@ -1956,20 +1934,6 @@ QPixmap MainWidget::grabForShowAnimation(const Window::SectionSlideParams &param
return result;
}
void MainWidget::repaintDialogRow(
FilterId filterId,
not_null<Dialogs::Row*> row) {
_dialogs->repaintDialogRow(filterId, row);
}
void MainWidget::repaintDialogRow(Dialogs::RowDescriptor row) {
_dialogs->repaintDialogRow(row);
}
void MainWidget::refreshDialogRow(Dialogs::RowDescriptor row) {
_dialogs->refreshDialogRow(row);
}
void MainWidget::windowShown() {
_history->windowShown();
}
@@ -2801,10 +2765,6 @@ int32 MainWidget::dlgsWidth() const {
return _dialogs->width();
}
void MainWidget::applyCloudDraft(History *history) {
_history->applyCloudDraft(history);
}
void MainWidget::saveFieldToHistoryLocalDraft() {
_history->saveFieldToHistoryLocalDraft();
}