mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added initial ability to show documents in OverlayWidget from Controller.
This commit is contained in:
parent
0e89c93993
commit
6d0d399250
1 changed files with 51 additions and 0 deletions
|
@ -2316,6 +2316,57 @@ void OverlayWidget::showDocument(
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::show(OpenRequest request) {
|
void OverlayWidget::show(OpenRequest request) {
|
||||||
|
const auto document = request.document();
|
||||||
|
const auto photo = request.photo();
|
||||||
|
const auto contextItem = request.item();
|
||||||
|
const auto contextPeer = request.peer();
|
||||||
|
if (photo) {
|
||||||
|
if (contextItem && contextPeer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSession(&photo->session());
|
||||||
|
|
||||||
|
if (contextPeer) {
|
||||||
|
setContext(contextPeer);
|
||||||
|
} else if (contextItem) {
|
||||||
|
setContext(contextItem);
|
||||||
|
} else {
|
||||||
|
setContext(v::null);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearControlsState();
|
||||||
|
if (contextPeer) {
|
||||||
|
_firstOpenedPeerPhoto = true;
|
||||||
|
}
|
||||||
|
assignMediaPointer(photo);
|
||||||
|
|
||||||
|
displayPhoto(photo, contextPeer ? nullptr : contextItem);
|
||||||
|
preloadData(0);
|
||||||
|
activateControls();
|
||||||
|
} else if (document) {
|
||||||
|
setSession(&document->session());
|
||||||
|
|
||||||
|
if (contextItem) {
|
||||||
|
setContext(contextItem);
|
||||||
|
} else {
|
||||||
|
setContext(v::null);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearControlsState();
|
||||||
|
|
||||||
|
_streamingStartPaused = false;
|
||||||
|
displayDocument(
|
||||||
|
document,
|
||||||
|
contextItem,
|
||||||
|
request.cloudTheme()
|
||||||
|
? *request.cloudTheme()
|
||||||
|
: Data::CloudTheme(),
|
||||||
|
false);
|
||||||
|
if (!isHidden()) {
|
||||||
|
preloadData(0);
|
||||||
|
activateControls();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::displayPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
|
void OverlayWidget::displayPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue