Fix SendFilesWay radiobuttons when adding media.

Also add /LTCG flag for static libraries Release builds on Windows.
This commit is contained in:
John Preston 2017-12-30 00:06:43 +03:00
parent ea51f976f2
commit 6236590ca4
3 changed files with 25 additions and 9 deletions

View File

@ -1329,6 +1329,7 @@ SendFilesBox::SendFilesBox(
Storage::PreparedList &&list, Storage::PreparedList &&list,
CompressConfirm compressed) CompressConfirm compressed)
: _list(std::move(list)) : _list(std::move(list))
, _compressConfirmInitial(compressed)
, _compressConfirm(compressed) { , _compressConfirm(compressed) {
} }
@ -1434,15 +1435,7 @@ void SendFilesBox::prepare() {
} }
void SendFilesBox::initSendWay() { void SendFilesBox::initSendWay() {
_albumVideosCount = _list.albumIsPossible refreshAlbumMediaCount();
? ranges::count(
_list.files,
Storage::PreparedFile::AlbumType::Video,
[](const Storage::PreparedFile &file) { return file.type; })
: 0;
_albumPhotosCount = _list.albumIsPossible
? (_list.files.size() - _albumVideosCount)
: 0;
const auto value = [&] { const auto value = [&] {
if (_compressConfirm == CompressConfirm::None) { if (_compressConfirm == CompressConfirm::None) {
return SendFilesWay::Files; return SendFilesWay::Files;
@ -1475,6 +1468,18 @@ void SendFilesBox::initSendWay() {
}); });
} }
void SendFilesBox::refreshAlbumMediaCount() {
_albumVideosCount = _list.albumIsPossible
? ranges::count(
_list.files,
Storage::PreparedFile::AlbumType::Video,
[](const Storage::PreparedFile &file) { return file.type; })
: 0;
_albumPhotosCount = _list.albumIsPossible
? (_list.files.size() - _albumVideosCount)
: 0;
}
void SendFilesBox::preparePreview() { void SendFilesBox::preparePreview() {
if (_list.files.size() == 1) { if (_list.files.size() == 1) {
prepareSingleFilePreview(); prepareSingleFilePreview();
@ -1636,6 +1641,9 @@ bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
return false; return false;
} else if (_list.files.size() > 1 && !_albumPreview) { } else if (_list.files.size() > 1 && !_albumPreview) {
return false; return false;
} else if (_list.files.front().type
== Storage::PreparedFile::AlbumType::None) {
return false;
} }
applyAlbumOrder(); applyAlbumOrder();
delete base::take(_preview); delete base::take(_preview);
@ -1646,6 +1654,9 @@ bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
_sendWay->setValue(SendFilesWay::Album); _sendWay->setValue(SendFilesWay::Album);
} }
_list.mergeToEnd(std::move(list)); _list.mergeToEnd(std::move(list));
_compressConfirm = _compressConfirmInitial;
refreshAlbumMediaCount();
preparePreview(); preparePreview();
updateControlsGeometry(); updateControlsGeometry();
return true; return true;

View File

@ -83,6 +83,7 @@ private:
not_null<Ui::ScrollArea*> wrap, not_null<Ui::ScrollArea*> wrap,
not_null<AlbumPreview*> content); not_null<AlbumPreview*> content);
void refreshAlbumMediaCount();
void preparePreview(); void preparePreview();
void prepareSingleFilePreview(); void prepareSingleFilePreview();
void prepareAlbumPreview(); void prepareAlbumPreview();
@ -103,6 +104,7 @@ private:
Storage::PreparedList _list; Storage::PreparedList _list;
CompressConfirm _compressConfirmInitial = CompressConfirm::None;
CompressConfirm _compressConfirm = CompressConfirm::None; CompressConfirm _compressConfirm = CompressConfirm::None;
base::lambda<void( base::lambda<void(

View File

@ -109,6 +109,9 @@
'OptimizeReferences': '2', 'OptimizeReferences': '2',
'LinkTimeCodeGeneration': '1', # /LTCG 'LinkTimeCodeGeneration': '1', # /LTCG
}, },
'VCLibrarianTool': {
'LinkTimeCodeGeneration': 'true', # /LTCG
},
}, },
}, },
}, },