2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Slightly refactored display of media preview.

- Removed showMediaPreview from facades.
This commit is contained in:
23rd
2019-06-29 13:29:04 +03:00
committed by John Preston
parent da6baeb1a7
commit 7c98f64cdb
9 changed files with 71 additions and 70 deletions

View File

@@ -683,12 +683,14 @@ void Inner::updateSelected() {
_pressed = _selected;
if (row >= 0 && col >= 0) {
auto layout = _rows.at(row).items.at(col);
if (const auto previewDocument = layout->getPreviewDocument()) {
Ui::showMediaPreview(
Data::FileOrigin(),
previewDocument);
} else if (auto previewPhoto = layout->getPreviewPhoto()) {
Ui::showMediaPreview(Data::FileOrigin(), previewPhoto);
if (const auto w = App::wnd()) {
if (const auto previewDocument = layout->getPreviewDocument()) {
w->showMediaPreview(
Data::FileOrigin(),
previewDocument);
} else if (auto previewPhoto = layout->getPreviewPhoto()) {
w->showMediaPreview(Data::FileOrigin(), previewPhoto);
}
}
}
}
@@ -708,12 +710,14 @@ void Inner::showPreview() {
int row = _pressed / MatrixRowShift, col = _pressed % MatrixRowShift;
if (row < _rows.size() && col < _rows.at(row).items.size()) {
auto layout = _rows.at(row).items.at(col);
if (const auto previewDocument = layout->getPreviewDocument()) {
Ui::showMediaPreview(Data::FileOrigin(), previewDocument);
_previewShown = true;
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
Ui::showMediaPreview(Data::FileOrigin(), previewPhoto);
_previewShown = true;
if (const auto w = App::wnd()) {
if (const auto previewDocument = layout->getPreviewDocument()) {
w->showMediaPreview(Data::FileOrigin(), previewDocument);
_previewShown = true;
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
w->showMediaPreview(Data::FileOrigin(), previewPhoto);
_previewShown = true;
}
}
}
}