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

Fix grouping of music files / just files.

This commit is contained in:
John Preston
2020-10-19 13:25:28 +03:00
parent 0d37949e74
commit 012ebdd15e
7 changed files with 52 additions and 30 deletions

View File

@@ -603,9 +603,10 @@ void EditCaptionBox::createEditMediaButton() {
if (Core::IsMimeSticker(mime)) {
showError(tr::lng_edit_media_invalid_file);
return false;
} else if (_isAlbum) { // #TODO edit in file-albums
} else if (_isAlbum) { // #TODO files edit in file-albums
if (!Core::IsMimeAcceptedForAlbum(mime)
|| file.type == Ui::PreparedFile::AlbumType::File
|| file.type == Ui::PreparedFile::AlbumType::Music
|| file.type == Ui::PreparedFile::AlbumType::None) {
showError(tr::lng_edit_media_album_error);
return false;
@@ -710,7 +711,9 @@ bool EditCaptionBox::fileFromClipboard(not_null<const QMimeData*> data) {
}
const auto file = &list.files.front();
if (_isAlbum && (file->type == AlbumType::File || file->type == AlbumType::None)) {
if (_isAlbum && (file->type == AlbumType::File
|| file->type == AlbumType::None
|| file->type == AlbumType::Music)) {
const auto imageAsDoc = [&] {
using Info = Ui::PreparedFileInformation;
const auto fileMedia = &file->information->media;

View File

@@ -118,8 +118,7 @@ SendFilesBox::Block::Block(
const auto count = till - from;
const auto my = gsl::make_span(*items).subspan(from, count);
const auto &first = my.front();
_isAlbum = (my.size() > 1)
|| (first.type == Ui::PreparedFile::AlbumType::Photo);
_isAlbum = (my.size() > 1);
if (_isAlbum) {
const auto preview = Ui::CreateChild<Ui::AlbumPreview>(
parent.get(),
@@ -492,6 +491,7 @@ void SendFilesBox::generatePreviewFrom(int fromBlock) {
const auto albumCount = (i - albumStart);
if ((type == Type::File)
|| (type == Type::None)
|| (type == Type::Music)
|| (albumCount == Ui::MaxAlbumItems())) {
pushBlock(std::exchange(albumStart, -1), i);
} else {