mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Rename some methods in DocumentData.
Also fix voice message mark as read when autoplaying after previous. Also show play icon and don't show playlist for audio files that do not have shared music files attributes but have audio file mime type.
This commit is contained in:
@@ -163,7 +163,7 @@ public:
|
||||
}
|
||||
}
|
||||
SongData *song() {
|
||||
return (type == SongDocument)
|
||||
return isSong()
|
||||
? static_cast<SongData*>(_additional.get())
|
||||
: nullptr;
|
||||
}
|
||||
@@ -171,55 +171,24 @@ public:
|
||||
return const_cast<DocumentData*>(this)->song();
|
||||
}
|
||||
VoiceData *voice() {
|
||||
return (type == VoiceDocument)
|
||||
return isVoiceMessage()
|
||||
? static_cast<VoiceData*>(_additional.get())
|
||||
: nullptr;
|
||||
}
|
||||
const VoiceData *voice() const {
|
||||
return const_cast<DocumentData*>(this)->voice();
|
||||
}
|
||||
bool isRoundVideo() const {
|
||||
return (type == RoundVideoDocument);
|
||||
}
|
||||
bool isAnimation() const {
|
||||
return (type == AnimatedDocument)
|
||||
|| isRoundVideo()
|
||||
|| hasMimeType(qstr("image/gif"));
|
||||
}
|
||||
bool isGifv() const {
|
||||
return (type == AnimatedDocument)
|
||||
&& hasMimeType(qstr("video/mp4"));
|
||||
}
|
||||
bool isTheme() const {
|
||||
return
|
||||
_filename.endsWith(
|
||||
qstr(".tdesktop-theme"),
|
||||
Qt::CaseInsensitive)
|
||||
|| _filename.endsWith(
|
||||
qstr(".tdesktop-palette"),
|
||||
Qt::CaseInsensitive);
|
||||
}
|
||||
bool tryPlaySong() const {
|
||||
return (song() != nullptr)
|
||||
|| _mimeString.startsWith(
|
||||
qstr("audio/"),
|
||||
Qt::CaseInsensitive);
|
||||
}
|
||||
bool isMusic() const {
|
||||
if (auto s = song()) {
|
||||
return (s->duration > 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isVideo() const {
|
||||
return (type == VideoDocument);
|
||||
}
|
||||
int32 duration() const {
|
||||
return (isAnimation() || isVideo()) ? _duration : -1;
|
||||
}
|
||||
bool isImage() const {
|
||||
return !isAnimation() && !isVideo() && (_duration > 0);
|
||||
}
|
||||
bool isVoiceMessage() const;
|
||||
bool isVideoMessage() const;
|
||||
bool isSong() const;
|
||||
bool isAudioFile() const;
|
||||
bool isVideoFile() const;
|
||||
bool isAnimation() const;
|
||||
bool isGifv() const;
|
||||
bool isTheme() const;
|
||||
bool isSharedMediaMusic() const;
|
||||
int32 duration() const;
|
||||
bool isImage() const;
|
||||
void recountIsImage();
|
||||
void setData(const QByteArray &data) {
|
||||
_data = data;
|
||||
@@ -306,9 +275,9 @@ private:
|
||||
friend class Serialize::Document;
|
||||
|
||||
LocationType locationType() const {
|
||||
return voice()
|
||||
return isVoiceMessage()
|
||||
? AudioFileLocation
|
||||
: isVideo()
|
||||
: isVideoFile()
|
||||
? VideoFileLocation
|
||||
: DocumentFileLocation;
|
||||
}
|
||||
|
Reference in New Issue
Block a user