GIFs shared media section

Mostly taken from TDesktop-x64/tdesktop.
This commit is contained in:
Eric Kotato 2020-07-02 10:42:39 +03:00
parent 24b459f941
commit 67fc24a36b
12 changed files with 38 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -2559,4 +2559,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_too_many_accounts_warning" = "Warning! Using too many accounts at the same time is not recommended due to higher memory comsumption and possible crashes because of it.\n\nYou sure you want to add a new account?";
"ktg_account_add_anyway" = "Add anyway";
"ktg_media_selected_gif#one" = "{count} GIF";
"ktg_media_selected_gif#other" = "{count} GIFs";
"ktg_media_type_gif" = "GIFs";
"ktg_profile_gif#one" = "{count} GIF";
"ktg_profile_gif#other" = "{count} GIFs";
"ktg_media_gif_empty" = "No GIFs here yet";
// Keys finished

View file

@ -149,5 +149,19 @@
"ktg_group_status_owner": "вы владелец",
"ktg_group_status_admin": "вы админ",
"ktg_too_many_accounts_warning": "Внимание! Использование слишком большого количества аккаунтов одновременно не рекомендуется из-за высокого потребления памяти, а также возможных вылетов из-за этого.\n\nВы точно хотите добавить новый аккаунт?",
"ktg_account_add_anyway": "Всё равно добавить"
"ktg_account_add_anyway": "Всё равно добавить",
"ktg_media_selected_gif": {
"one": "{count} GIF",
"few": "{count} GIF",
"many": "{count} GIF",
"other": "{count} GIF"
},
"ktg_media_type_gif": "GIF",
"ktg_profile_gif": {
"one": "{count} GIF",
"few": "{count} GIF",
"many": "{count} GIF",
"other": "{count} GIF"
},
"ktg_media_gif_empty": "Здесь пока нет GIF"
}

View file

@ -354,6 +354,7 @@ infoIconActions: icon {{ "info_actions", infoIconFg }};
//infoIconFeed: icon {{ "info_feed", 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

@ -487,6 +487,7 @@ Ui::StringWithNumbers TopBar::generateSelectedText() const {
switch (_selectedItems.type) {
case Type::Photo: return tr::lng_media_selected_photo;
case Type::Video: return tr::lng_media_selected_video;
case Type::GIF: return tr::ktg_media_selected_gif;
case Type::File: return tr::lng_media_selected_file;
case Type::MusicFile: return tr::lng_media_selected_song;
case Type::Link: return tr::lng_media_selected_link;
@ -583,6 +584,8 @@ rpl::producer<QString> TitleValue(
return tr::lng_media_type_photos();
case Section::MediaType::Video:
return tr::lng_media_type_videos();
case Section::MediaType::GIF:
return tr::ktg_media_type_gif();
case Section::MediaType::MusicFile:
return tr::lng_media_type_songs();
case Section::MediaType::File:

View file

@ -31,6 +31,7 @@ inline tr::phrase<lngtag_count> MediaTextPhrase(Type type) {
switch (type) {
case Type::Photo: return tr::lng_profile_photos;
case Type::Video: return tr::lng_profile_videos;
case Type::GIF: return tr::ktg_profile_gif;
case Type::File: return tr::lng_profile_files;
case Type::MusicFile: return tr::lng_profile_songs;
case Type::Link: return tr::lng_profile_shared_links;

View file

@ -38,6 +38,7 @@ void EmptyWidget::setType(Type type) {
switch (_type) {
case Type::Photo: return &st::infoEmptyPhoto;
case Type::Video: return &st::infoEmptyVideo;
case Type::GIF: return &st::infoEmptyVideo;
case Type::MusicFile: return &st::infoEmptyAudio;
case Type::File: return &st::infoEmptyFile;
case Type::Link: return &st::infoEmptyLink;
@ -55,6 +56,8 @@ void EmptyWidget::setSearchQuery(const QString &query) {
return tr::lng_media_photo_empty(tr::now);
case Type::Video:
return tr::lng_media_video_empty(tr::now);
case Type::GIF:
return tr::ktg_media_gif_empty(tr::now);
case Type::MusicFile:
return query.isEmpty()
? tr::lng_media_song_empty(tr::now)

View file

@ -121,6 +121,7 @@ void InnerWidget::createTypeButtons() {
addMediaButton(Type::Photo, st::infoIconMediaPhoto);
addMediaButton(Type::Video, st::infoIconMediaVideo);
addMediaButton(Type::GIF, st::infoIconMediaGif);
addMediaButton(Type::File, st::infoIconMediaFile);
addMediaButton(Type::MusicFile, st::infoIconMediaAudio);
addMediaButton(Type::Link, st::infoIconMediaLink);

View file

@ -213,6 +213,7 @@ void ListWidget::Section::setHeader(not_null<BaseLayout*> item) {
switch (_type) {
case Type::Photo:
case Type::Video:
case Type::GIF:
case Type::RoundFile:
case Type::RoundVoiceFile:
case Type::File:
@ -239,6 +240,7 @@ bool ListWidget::Section::belongsHere(
switch (_type) {
case Type::Photo:
case Type::Video:
case Type::GIF:
case Type::RoundFile:
case Type::RoundVoiceFile:
case Type::File:
@ -464,6 +466,7 @@ void ListWidget::Section::resizeToWidth(int newWidth) {
switch (_type) {
case Type::Photo:
case Type::Video:
case Type::GIF:
case Type::RoundFile: {
_itemsLeft = st::infoMediaSkip;
_itemsTop = st::infoMediaSkip;
@ -496,6 +499,7 @@ int ListWidget::Section::MinItemHeight(Type type, int width) {
switch (type) {
case Type::Photo:
case Type::Video:
case Type::GIF:
case Type::RoundFile: {
auto itemsLeft = st::infoMediaSkip;
auto itemsInRow = (width - itemsLeft)
@ -521,6 +525,7 @@ int ListWidget::Section::recountHeight() const {
switch (_type) {
case Type::Photo:
case Type::Video:
case Type::GIF:
case Type::RoundFile: {
auto itemHeight = _itemWidth + st::infoMediaSkip;
auto index = 0;
@ -905,6 +910,7 @@ std::unique_ptr<BaseLayout> ListWidget::createLayout(
}
return nullptr;
case Type::Video:
case Type::GIF:
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::Photo, st::infoIconMediaPhoto);
addMediaButton(MediaType::Video, st::infoIconMediaVideo);
addMediaButton(MediaType::GIF, st::infoIconMediaGif);
addMediaButton(MediaType::File, st::infoIconMediaFile);
addMediaButton(MediaType::MusicFile, st::infoIconMediaAudio);
addMediaButton(MediaType::Link, st::infoIconMediaLink);