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

Removed App::wnd from classes that have pointer to Window::Controller.

This commit is contained in:
23rd
2021-02-03 06:31:11 +03:00
committed by John Preston
parent 0783a682dc
commit 0b4d0b83c2
12 changed files with 71 additions and 79 deletions

View File

@@ -1280,11 +1280,9 @@ void FieldAutocomplete::Inner::selectByMouse(QPoint globalPosition) {
if (_down >= 0 && _sel >= 0 && _down != _sel) {
_down = _sel;
if (_down >= 0 && _down < _srows->size()) {
if (const auto w = App::wnd()) {
w->showMediaPreview(
(*_srows)[_down].document->stickerSetOrigin(),
(*_srows)[_down].document);
}
_controller->widget()->showMediaPreview(
(*_srows)[_down].document->stickerSetOrigin(),
(*_srows)[_down].document);
}
}
}
@@ -1302,12 +1300,10 @@ void FieldAutocomplete::Inner::onParentGeometryChanged() {
void FieldAutocomplete::Inner::showPreview() {
if (_down >= 0 && _down < _srows->size()) {
if (const auto w = App::wnd()) {
w->showMediaPreview(
(*_srows)[_down].document->stickerSetOrigin(),
(*_srows)[_down].document);
_previewShown = true;
}
_controller->widget()->showMediaPreview(
(*_srows)[_down].document->stickerSetOrigin(),
(*_srows)[_down].document);
_previewShown = true;
}
}

View File

@@ -1078,16 +1078,14 @@ void GifsListWidget::updateSelected() {
_pressed = _selected;
if (row >= 0 && col >= 0) {
auto layout = _rows[row].items[col];
if (const auto w = App::wnd()) {
if (const auto previewDocument = layout->getPreviewDocument()) {
w->showMediaPreview(
Data::FileOriginSavedGifs(),
previewDocument);
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
w->showMediaPreview(
Data::FileOrigin(),
previewPhoto);
}
if (const auto previewDocument = layout->getPreviewDocument()) {
controller()->widget()->showMediaPreview(
Data::FileOriginSavedGifs(),
previewDocument);
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
controller()->widget()->showMediaPreview(
Data::FileOrigin(),
previewPhoto);
}
}
}
@@ -1104,16 +1102,14 @@ void GifsListWidget::showPreview() {
int row = _pressed / MatrixRowShift, col = _pressed % MatrixRowShift;
if (row < _rows.size() && col < _rows[row].items.size()) {
auto layout = _rows[row].items[col];
if (const auto w = App::wnd()) {
if (const auto previewDocument = layout->getPreviewDocument()) {
_previewShown = w->showMediaPreview(
Data::FileOriginSavedGifs(),
previewDocument);
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
_previewShown = w->showMediaPreview(
Data::FileOrigin(),
previewPhoto);
}
if (const auto previewDocument = layout->getPreviewDocument()) {
_previewShown = controller()->widget()->showMediaPreview(
Data::FileOriginSavedGifs(),
previewDocument);
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
_previewShown = controller()->widget()->showMediaPreview(
Data::FileOrigin(),
previewPhoto);
}
}
}

View File

@@ -2883,9 +2883,9 @@ void StickersListWidget::setSelected(OverState newSelected) {
const auto &set = sets[sticker->section];
Assert(sticker->index >= 0 && sticker->index < set.stickers.size());
const auto document = set.stickers[sticker->index].document;
if (const auto w = App::wnd()) {
w->showMediaPreview(document->stickerSetOrigin(), document);
}
controller()->widget()->showMediaPreview(
document->stickerSetOrigin(),
document);
}
}
}
@@ -2898,10 +2898,10 @@ void StickersListWidget::showPreview() {
const auto &set = sets[sticker->section];
Assert(sticker->index >= 0 && sticker->index < set.stickers.size());
const auto document = set.stickers[sticker->index].document;
if (const auto w = App::wnd()) {
w->showMediaPreview(document->stickerSetOrigin(), document);
_previewShown = true;
}
controller()->widget()->showMediaPreview(
document->stickerSetOrigin(),
document);
_previewShown = true;
}
}