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

Merge branch 'master' into video

Conflicts:
	Telegram/SourceFiles/mainwidget.cpp
	Telegram/SourceFiles/structs.cpp
This commit is contained in:
John Preston
2016-07-05 20:42:47 +03:00
46 changed files with 448 additions and 150 deletions

View File

@@ -497,6 +497,28 @@ void MediaView::step_radial(uint64 ms, bool timer) {
}
}
void MediaView::clearData() {
if (!isHidden()) {
hide();
}
if (!_animations.isEmpty()) {
_animations.clear();
_a_state.stop();
}
if (!_animOpacities.isEmpty()) _animOpacities.clear();
delete _gif;
_gif = nullptr;
delete _menu;
_menu = nullptr;
_history = _migrated = nullptr;
_peer = _from = nullptr;
_user = nullptr;
_photo = _additionalChatPhoto = nullptr;
_doc = nullptr;
_saveMsgText.clear();
_caption.clear();
}
MediaView::~MediaView() {
deleteAndMark(_gif);
deleteAndMark(_menu);
@@ -818,6 +840,7 @@ void MediaView::onCopy() {
void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) {
_history = context ? context->history() : nullptr;
_migrated = nullptr;
if (_history) {
if (_history->peer->migrateFrom()) {
_migrated = App::history(_history->peer->migrateFrom()->id);
@@ -825,8 +848,6 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) {
_migrated = _history;
_history = App::history(_history->peer->migrateTo()->id);
}
} else {
_migrated = nullptr;
}
_additionalChatPhoto = nullptr;
_firstOpenedPeerPhoto = false;
@@ -937,6 +958,7 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) {
void MediaView::showDocument(DocumentData *doc, HistoryItem *context) {
_photo = 0;
_history = context ? context->history() : nullptr;
_migrated = nullptr;
if (_history) {
if (_history->peer->migrateFrom()) {
_migrated = App::history(_history->peer->migrateFrom()->id);
@@ -944,8 +966,6 @@ void MediaView::showDocument(DocumentData *doc, HistoryItem *context) {
_migrated = _history;
_history = App::history(_history->peer->migrateTo()->id);
}
} else {
_migrated = 0;
}
_additionalChatPhoto = nullptr;
_saveMsgStarted = 0;
@@ -1679,7 +1699,7 @@ void MediaView::preloadData(int32 delta) {
int indexInOverview = _index;
bool indexOfMigratedItem = _msgmigrated;
if (_index < 0) {
if (_overview != OverviewChatPhotos) return;
if (_overview != OverviewChatPhotos || !_history) return;
indexInOverview = _history->overview[OverviewChatPhotos].size();
indexOfMigratedItem = false;
}