Add GIFs shared media section

This commit is contained in:
c0re100 2020-08-24 03:42:28 +08:00 committed by John Preston
parent 565877630f
commit 842a89d2c7
11 changed files with 25 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -862,6 +862,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_photos#one" = "{count} photo";
"lng_profile_photos#other" = "{count} photos";
"lng_profile_photos_header" = "Photos";
"lng_profile_gifs#one" = "{count} GIF";
"lng_profile_gifs#other" = "{count} GIFs";
"lng_profile_gifs_header" = "GIFs";
"lng_profile_videos#one" = "{count} video";
"lng_profile_videos#other" = "{count} videos";
"lng_profile_videos_header" = "Videos";
@ -904,6 +907,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_info_add_as_contact" = "Add to contacts";
"lng_profile_shared_media" = "Shared media";
"lng_media_type_photos" = "Photos";
"lng_media_type_gifs" = "GIFs";
"lng_media_type_videos" = "Videos";
"lng_media_type_songs" = "Audio files";
"lng_media_type_files" = "Files";
@ -923,6 +927,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_export_channel" = "Export channel history";
"lng_media_selected_photo#one" = "{count} Photo";
"lng_media_selected_photo#other" = "{count} Photos";
"lng_media_selected_gif#one" = "{count} GIF";
"lng_media_selected_gif#other" = "{count} GIFs";
"lng_media_selected_video#one" = "{count} Video";
"lng_media_selected_video#other" = "{count} Videos";
"lng_media_selected_song#one" = "{count} Audio file";
@ -936,6 +942,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_media_selected_link#one" = "{count} Shared link";
"lng_media_selected_link#other" = "{count} Shared links";
"lng_media_photo_empty" = "No photos here yet";
"lng_media_gif_empty" = "No GIFs here yet";
"lng_media_video_empty" = "No videos here yet";
"lng_media_song_empty" = "No music files here yet";
"lng_media_file_empty" = "No files here yet";

View File

@ -349,6 +349,7 @@ infoIconNotifications: icon {{ "info_notifications", infoIconFg }};
infoIconActions: icon {{ "info_actions", infoIconFg }};
infoIconMediaPhoto: icon {{ "info_media_photo", infoIconFg }};
infoIconMediaVideo: icon {{ "info_media_video", infoIconFg }};
infoIconMediaGif: icon {{ "info_media_gif", infoIconFg }};
infoIconMediaFile: icon {{ "info_media_file", infoIconFg }};
infoIconMediaAudio: icon {{ "info_media_audio", infoIconFg }};
infoIconMediaLink: icon {{ "info_media_link", infoIconFg }};

View File

@ -486,6 +486,7 @@ Ui::StringWithNumbers TopBar::generateSelectedText() const {
const auto phrase = [&] {
switch (_selectedItems.type) {
case Type::Photo: return tr::lng_media_selected_photo;
case Type::GIF: return tr::lng_media_selected_gif;
case Type::Video: return tr::lng_media_selected_video;
case Type::File: return tr::lng_media_selected_file;
case Type::MusicFile: return tr::lng_media_selected_song;
@ -580,6 +581,8 @@ rpl::producer<QString> TitleValue(
switch (section.mediaType()) {
case Section::MediaType::Photo:
return tr::lng_media_type_photos();
case Section::MediaType::GIF:
return tr::lng_media_type_gifs();
case Section::MediaType::Video:
return tr::lng_media_type_videos();
case Section::MediaType::MusicFile:

View File

@ -30,6 +30,7 @@ using Type = Storage::SharedMediaType;
inline tr::phrase<lngtag_count> MediaTextPhrase(Type type) {
switch (type) {
case Type::Photo: return tr::lng_profile_photos;
case Type::GIF: return tr::lng_profile_gifs;
case Type::Video: return tr::lng_profile_videos;
case Type::File: return tr::lng_profile_files;
case Type::MusicFile: return tr::lng_profile_songs;

View File

@ -36,7 +36,8 @@ void EmptyWidget::setType(Type type) {
_type = type;
_icon = [&] {
switch (_type) {
case Type::Photo: return &st::infoEmptyPhoto;
case Type::Photo:
case Type::GIF: return &st::infoEmptyPhoto;
case Type::Video: return &st::infoEmptyVideo;
case Type::MusicFile: return &st::infoEmptyAudio;
case Type::File: return &st::infoEmptyFile;
@ -53,6 +54,8 @@ void EmptyWidget::setSearchQuery(const QString &query) {
switch (_type) {
case Type::Photo:
return tr::lng_media_photo_empty(tr::now);
case Type::GIF:
return tr::lng_media_gif_empty(tr::now);
case Type::Video:
return tr::lng_media_video_empty(tr::now);
case Type::MusicFile:

View File

@ -125,6 +125,7 @@ void InnerWidget::createTypeButtons() {
addMediaButton(Type::MusicFile, st::infoIconMediaAudio);
addMediaButton(Type::Link, st::infoIconMediaLink);
addMediaButton(Type::RoundVoiceFile, st::infoIconMediaVoice);
addMediaButton(Type::GIF, st::infoIconMediaGif);
// if (auto user = _controller->key().peer()->asUser()) {
// addCommonGroupsButton(user, st::infoIconMediaGroup);
// }

View File

@ -71,6 +71,7 @@ UniversalMsgId GetUniversalId(not_null<const BaseLayout*> layout) {
bool HasFloatingHeader(Type type) {
switch (type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile:
case Type::RoundVoiceFile:
@ -235,6 +236,7 @@ void ListWidget::Section::setHeader(not_null<BaseLayout*> item) {
auto date = item->dateTime().date();
switch (_type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile:
case Type::RoundVoiceFile:
@ -261,6 +263,7 @@ bool ListWidget::Section::belongsHere(
switch (_type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile:
case Type::RoundVoiceFile:
@ -505,6 +508,7 @@ void ListWidget::Section::resizeToWidth(int newWidth) {
};
switch (_type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile: {
_itemsLeft = st::infoMediaSkip;
@ -537,6 +541,7 @@ int ListWidget::Section::MinItemHeight(Type type, int width) {
auto &songSt = st::overviewFileLayout;
switch (type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile: {
auto itemsLeft = st::infoMediaSkip;
@ -562,6 +567,7 @@ int ListWidget::Section::recountHeight() const {
switch (_type) {
case Type::Photo:
case Type::GIF:
case Type::Video:
case Type::RoundFile: {
auto itemHeight = _itemWidth + st::infoMediaSkip;
@ -966,6 +972,7 @@ std::unique_ptr<BaseLayout> ListWidget::createLayout(
return std::make_unique<Photo>(this, item, photo);
}
return nullptr;
case Type::GIF:
case Type::Video:
if (const auto file = getFile()) {
return std::make_unique<Video>(this, item, file);

View File

@ -170,6 +170,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
addMediaButton(MediaType::MusicFile, st::infoIconMediaAudio);
addMediaButton(MediaType::Link, st::infoIconMediaLink);
addMediaButton(MediaType::RoundVoiceFile, st::infoIconMediaVoice);
addMediaButton(MediaType::GIF, st::infoIconMediaGif);
if (auto user = _peer->asUser()) {
addCommonGroupsButton(user, st::infoIconMediaGroup);
}