mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Save send way (album, photos, files) to settings.
This commit is contained in:
parent
a6c15217c0
commit
a8ac18e4fd
9 changed files with 104 additions and 61 deletions
|
@ -33,6 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
#include "chat_helpers/tabbed_selector.h"
|
#include "chat_helpers/tabbed_selector.h"
|
||||||
|
#include "boxes/send_files_box.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -41,7 +42,8 @@ constexpr auto kAutoLockTimeoutLateMs = TimeMs(3000);
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AuthSessionData::Variables::Variables()
|
AuthSessionData::Variables::Variables()
|
||||||
: selectorTab(ChatHelpers::SelectorTab::Emoji)
|
: sendFilesWay(SendFilesWay::Album)
|
||||||
|
, selectorTab(ChatHelpers::SelectorTab::Emoji)
|
||||||
, floatPlayerColumn(Window::Column::Second)
|
, floatPlayerColumn(Window::Column::Second)
|
||||||
, floatPlayerCorner(RectPart::TopRight) {
|
, floatPlayerCorner(RectPart::TopRight) {
|
||||||
}
|
}
|
||||||
|
@ -80,6 +82,7 @@ QByteArray AuthSessionData::serialize() const {
|
||||||
1000000));
|
1000000));
|
||||||
stream << qint32(_variables.thirdColumnWidth.current());
|
stream << qint32(_variables.thirdColumnWidth.current());
|
||||||
stream << qint32(_variables.thirdSectionExtendedBy);
|
stream << qint32(_variables.thirdSectionExtendedBy);
|
||||||
|
stream << qint32(_variables.sendFilesWay);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +107,7 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
|
||||||
float64 dialogsWidthRatio = _variables.dialogsWidthRatio.current();
|
float64 dialogsWidthRatio = _variables.dialogsWidthRatio.current();
|
||||||
int thirdColumnWidth = _variables.thirdColumnWidth.current();
|
int thirdColumnWidth = _variables.thirdColumnWidth.current();
|
||||||
int thirdSectionExtendedBy = _variables.thirdSectionExtendedBy;
|
int thirdSectionExtendedBy = _variables.thirdSectionExtendedBy;
|
||||||
|
qint32 sendFilesWay = static_cast<qint32>(_variables.sendFilesWay);
|
||||||
stream >> selectorTab;
|
stream >> selectorTab;
|
||||||
stream >> lastSeenWarningSeen;
|
stream >> lastSeenWarningSeen;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -189,6 +193,12 @@ void AuthSessionData::constructFromSerialized(const QByteArray &serialized) {
|
||||||
if (_variables.thirdSectionInfoEnabled) {
|
if (_variables.thirdSectionInfoEnabled) {
|
||||||
_variables.tabbedSelectorSectionEnabled = false;
|
_variables.tabbedSelectorSectionEnabled = false;
|
||||||
}
|
}
|
||||||
|
auto uncheckedSendFilesWay = static_cast<SendFilesWay>(sendFilesWay);
|
||||||
|
switch (uncheckedSendFilesWay) {
|
||||||
|
case SendFilesWay::Album:
|
||||||
|
case SendFilesWay::Photos:
|
||||||
|
case SendFilesWay::Files: _variables.sendFilesWay = uncheckedSendFilesWay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthSessionData::markItemLayoutChanged(not_null<const HistoryItem*> item) {
|
void AuthSessionData::markItemLayoutChanged(not_null<const HistoryItem*> item) {
|
||||||
|
|
|
@ -26,6 +26,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "chat_helpers/stickers.h"
|
#include "chat_helpers/stickers.h"
|
||||||
|
|
||||||
|
class ApiWrap;
|
||||||
|
enum class SendFilesWay;
|
||||||
|
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
class Downloader;
|
class Downloader;
|
||||||
class Uploader;
|
class Uploader;
|
||||||
|
@ -47,8 +50,6 @@ namespace ChatHelpers {
|
||||||
enum class SelectorTab;
|
enum class SelectorTab;
|
||||||
} // namespace ChatHelpers
|
} // namespace ChatHelpers
|
||||||
|
|
||||||
class ApiWrap;
|
|
||||||
|
|
||||||
class AuthSessionData final {
|
class AuthSessionData final {
|
||||||
public:
|
public:
|
||||||
base::Variable<bool> &contactsLoaded() {
|
base::Variable<bool> &contactsLoaded() {
|
||||||
|
@ -108,6 +109,12 @@ public:
|
||||||
void setLastSeenWarningSeen(bool lastSeenWarningSeen) {
|
void setLastSeenWarningSeen(bool lastSeenWarningSeen) {
|
||||||
_variables.lastSeenWarningSeen = lastSeenWarningSeen;
|
_variables.lastSeenWarningSeen = lastSeenWarningSeen;
|
||||||
}
|
}
|
||||||
|
void setSendFilesWay(SendFilesWay way) {
|
||||||
|
_variables.sendFilesWay = way;
|
||||||
|
}
|
||||||
|
SendFilesWay sendFilesWay() const {
|
||||||
|
return _variables.sendFilesWay;
|
||||||
|
}
|
||||||
ChatHelpers::SelectorTab selectorTab() const {
|
ChatHelpers::SelectorTab selectorTab() const {
|
||||||
return _variables.selectorTab;
|
return _variables.selectorTab;
|
||||||
}
|
}
|
||||||
|
@ -273,6 +280,7 @@ private:
|
||||||
static constexpr auto kDefaultThirdColumnWidth = 0;
|
static constexpr auto kDefaultThirdColumnWidth = 0;
|
||||||
|
|
||||||
bool lastSeenWarningSeen = false;
|
bool lastSeenWarningSeen = false;
|
||||||
|
SendFilesWay sendFilesWay;
|
||||||
ChatHelpers::SelectorTab selectorTab; // per-window
|
ChatHelpers::SelectorTab selectorTab; // per-window
|
||||||
bool tabbedSelectorSectionEnabled = false; // per-window
|
bool tabbedSelectorSectionEnabled = false; // per-window
|
||||||
int tabbedSelectorSectionTooltipShown = 0;
|
int tabbedSelectorSectionTooltipShown = 0;
|
||||||
|
|
|
@ -455,9 +455,9 @@ public:
|
||||||
AlbumPreview(
|
AlbumPreview(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const Storage::PreparedList &list,
|
const Storage::PreparedList &list,
|
||||||
SendWay way);
|
SendFilesWay way);
|
||||||
|
|
||||||
void setSendWay(SendWay way);
|
void setSendWay(SendFilesWay way);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
@ -474,7 +474,7 @@ private:
|
||||||
void paintFiles(Painter &p, QRect clip) const;
|
void paintFiles(Painter &p, QRect clip) const;
|
||||||
|
|
||||||
const Storage::PreparedList &_list;
|
const Storage::PreparedList &_list;
|
||||||
SendWay _sendWay = SendWay::Files;
|
SendFilesWay _sendWay = SendFilesWay::Files;
|
||||||
std::vector<AlbumThumb> _thumbs;
|
std::vector<AlbumThumb> _thumbs;
|
||||||
int _thumbsHeight = 0;
|
int _thumbsHeight = 0;
|
||||||
int _photosHeight = 0;
|
int _photosHeight = 0;
|
||||||
|
@ -485,7 +485,7 @@ private:
|
||||||
SendFilesBox::AlbumPreview::AlbumPreview(
|
SendFilesBox::AlbumPreview::AlbumPreview(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const Storage::PreparedList &list,
|
const Storage::PreparedList &list,
|
||||||
SendWay way)
|
SendFilesWay way)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _list(list)
|
, _list(list)
|
||||||
, _sendWay(way) {
|
, _sendWay(way) {
|
||||||
|
@ -493,7 +493,7 @@ SendFilesBox::AlbumPreview::AlbumPreview(
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::AlbumPreview::setSendWay(SendWay way) {
|
void SendFilesBox::AlbumPreview::setSendWay(SendFilesWay way) {
|
||||||
_sendWay = way;
|
_sendWay = way;
|
||||||
updateSize();
|
updateSize();
|
||||||
update();
|
update();
|
||||||
|
@ -615,9 +615,9 @@ SendFilesBox::AlbumThumb SendFilesBox::AlbumPreview::prepareThumb(
|
||||||
void SendFilesBox::AlbumPreview::updateSize() {
|
void SendFilesBox::AlbumPreview::updateSize() {
|
||||||
const auto height = [&] {
|
const auto height = [&] {
|
||||||
switch (_sendWay) {
|
switch (_sendWay) {
|
||||||
case SendWay::Album: return _thumbsHeight;
|
case SendFilesWay::Album: return _thumbsHeight;
|
||||||
case SendWay::Photos: return _photosHeight;
|
case SendFilesWay::Photos: return _photosHeight;
|
||||||
case SendWay::Files: return _filesHeight;
|
case SendFilesWay::Files: return _filesHeight;
|
||||||
}
|
}
|
||||||
Unexpected("Send way in SendFilesBox::AlbumPreview::updateSize");
|
Unexpected("Send way in SendFilesBox::AlbumPreview::updateSize");
|
||||||
}();
|
}();
|
||||||
|
@ -628,9 +628,9 @@ void SendFilesBox::AlbumPreview::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
|
||||||
switch (_sendWay) {
|
switch (_sendWay) {
|
||||||
case SendWay::Album: paintAlbum(p); break;
|
case SendFilesWay::Album: paintAlbum(p); break;
|
||||||
case SendWay::Photos: paintPhotos(p, e->rect()); break;
|
case SendFilesWay::Photos: paintPhotos(p, e->rect()); break;
|
||||||
case SendWay::Files: paintFiles(p, e->rect()); break;
|
case SendFilesWay::Files: paintFiles(p, e->rect()); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,26 +832,39 @@ void SendFilesBox::prepare() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::initSendWay() {
|
void SendFilesBox::initSendWay() {
|
||||||
const auto value = (_compressConfirm == CompressConfirm::None)
|
_albumVideosCount = ranges::count(
|
||||||
? SendWay::Files
|
|
||||||
: (_compressConfirm == CompressConfirm::Auto)
|
|
||||||
? (cCompressPastedImage()
|
|
||||||
? (_list.albumIsPossible ? SendWay::Album : SendWay::Photos)
|
|
||||||
: SendWay::Files)
|
|
||||||
: (_compressConfirm == CompressConfirm::Yes
|
|
||||||
? (_list.albumIsPossible ? SendWay::Album : SendWay::Photos)
|
|
||||||
: SendWay::Files);
|
|
||||||
_sendWay = std::make_shared<Ui::RadioenumGroup<SendWay>>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendFilesBox::setupControls() {
|
|
||||||
_albumVideosCount = ranges::v3::count(
|
|
||||||
_list.files,
|
_list.files,
|
||||||
Storage::PreparedFile::AlbumType::Video,
|
Storage::PreparedFile::AlbumType::Video,
|
||||||
[](const Storage::PreparedFile &file) { return file.type; });
|
[](const Storage::PreparedFile &file) { return file.type; });
|
||||||
_albumPhotosCount = _list.albumIsPossible
|
_albumPhotosCount = _list.albumIsPossible
|
||||||
? (_list.files.size() - _albumVideosCount)
|
? (_list.files.size() - _albumVideosCount)
|
||||||
: 0;
|
: 0;
|
||||||
|
const auto value = [&] {
|
||||||
|
if (_compressConfirm == CompressConfirm::None) {
|
||||||
|
return SendFilesWay::Files;
|
||||||
|
} else if (_compressConfirm == CompressConfirm::No) {
|
||||||
|
return SendFilesWay::Files;
|
||||||
|
} else if (_compressConfirm == CompressConfirm::Yes) {
|
||||||
|
return _list.albumIsPossible
|
||||||
|
? SendFilesWay::Album
|
||||||
|
: SendFilesWay::Photos;
|
||||||
|
}
|
||||||
|
const auto currentWay = Auth().data().sendFilesWay();
|
||||||
|
if (currentWay == SendFilesWay::Files) {
|
||||||
|
return currentWay;
|
||||||
|
} else if (currentWay == SendFilesWay::Album) {
|
||||||
|
return _list.albumIsPossible
|
||||||
|
? SendFilesWay::Album
|
||||||
|
: SendFilesWay::Photos;
|
||||||
|
}
|
||||||
|
return (_list.albumIsPossible && !_albumPhotosCount)
|
||||||
|
? SendFilesWay::Album
|
||||||
|
: SendFilesWay::Photos;
|
||||||
|
}();
|
||||||
|
_sendWay = std::make_shared<Ui::RadioenumGroup<SendFilesWay>>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::setupControls() {
|
||||||
setupTitleText();
|
setupTitleText();
|
||||||
setupSendWayControls();
|
setupSendWayControls();
|
||||||
setupCaption();
|
setupCaption();
|
||||||
|
@ -862,17 +875,17 @@ void SendFilesBox::setupSendWayControls() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto addRadio = [&](
|
const auto addRadio = [&](
|
||||||
object_ptr<Ui::Radioenum<SendWay>> &button,
|
object_ptr<Ui::Radioenum<SendFilesWay>> &button,
|
||||||
SendWay value,
|
SendFilesWay value,
|
||||||
const QString &text) {
|
const QString &text) {
|
||||||
const auto &style = st::defaultBoxCheckbox;
|
const auto &style = st::defaultBoxCheckbox;
|
||||||
button.create(this, _sendWay, value, text, style);
|
button.create(this, _sendWay, value, text, style);
|
||||||
};
|
};
|
||||||
if (_list.albumIsPossible) {
|
if (_list.albumIsPossible) {
|
||||||
addRadio(_sendAlbum, SendWay::Album, lang(lng_send_album));
|
addRadio(_sendAlbum, SendFilesWay::Album, lang(lng_send_album));
|
||||||
}
|
}
|
||||||
if (!_list.albumIsPossible || _albumPhotosCount > 0) {
|
if (!_list.albumIsPossible || _albumPhotosCount > 0) {
|
||||||
addRadio(_sendPhotos, SendWay::Photos, (_list.files.size() == 1)
|
addRadio(_sendPhotos, SendFilesWay::Photos, (_list.files.size() == 1)
|
||||||
? lang(lng_send_photo)
|
? lang(lng_send_photo)
|
||||||
: (_albumVideosCount > 0)
|
: (_albumVideosCount > 0)
|
||||||
? (_list.albumIsPossible
|
? (_list.albumIsPossible
|
||||||
|
@ -882,10 +895,10 @@ void SendFilesBox::setupSendWayControls() {
|
||||||
? lang(lng_send_separate_photos)
|
? lang(lng_send_separate_photos)
|
||||||
: lng_send_photos(lt_count, _list.files.size())));
|
: lng_send_photos(lt_count, _list.files.size())));
|
||||||
}
|
}
|
||||||
addRadio(_sendFiles, SendWay::Files, (_list.files.size() == 1)
|
addRadio(_sendFiles, SendFilesWay::Files, (_list.files.size() == 1)
|
||||||
? lang(lng_send_file)
|
? lang(lng_send_file)
|
||||||
: lng_send_files(lt_count, _list.files.size()));
|
: lng_send_files(lt_count, _list.files.size()));
|
||||||
_sendWay->setChangedCallback([this](SendWay value) {
|
_sendWay->setChangedCallback([this](SendFilesWay value) {
|
||||||
if (_albumPreview) {
|
if (_albumPreview) {
|
||||||
_albumPreview->setSendWay(value);
|
_albumPreview->setSendWay(value);
|
||||||
}
|
}
|
||||||
|
@ -1021,14 +1034,25 @@ void SendFilesBox::setInnerFocus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::send(bool ctrlShiftEnter) {
|
void SendFilesBox::send(bool ctrlShiftEnter) {
|
||||||
// TODO settings
|
using Way = SendFilesWay;
|
||||||
//if (_compressed && _compressConfirm == CompressConfirm::Auto && _compressed->checked() != cCompressPastedImage()) {
|
const auto way = _sendWay ? _sendWay->value() : Way::Files;
|
||||||
// cSetCompressPastedImage(_compressed->checked());
|
|
||||||
// Local::writeUserSettings();
|
if (_compressConfirm == CompressConfirm::Auto) {
|
||||||
//}
|
const auto oldWay = Auth().data().sendFilesWay();
|
||||||
|
if (way != oldWay) {
|
||||||
|
// Check if the user _could_ use the old value, but didn't.
|
||||||
|
if ((oldWay == Way::Album && _sendAlbum)
|
||||||
|
|| (oldWay == Way::Photos && _sendPhotos)
|
||||||
|
|| (oldWay == Way::Files && _sendFiles)
|
||||||
|
|| (way == Way::Files && (_sendAlbum || _sendPhotos))) {
|
||||||
|
// And in that case save it to settings.
|
||||||
|
Auth().data().setSendFilesWay(way);
|
||||||
|
Auth().saveDataDelayed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_confirmed = true;
|
_confirmed = true;
|
||||||
if (_confirmedCallback) {
|
if (_confirmedCallback) {
|
||||||
const auto way = _sendWay ? _sendWay->value() : SendWay::Files;
|
|
||||||
auto caption = _caption
|
auto caption = _caption
|
||||||
? TextUtilities::PrepareForSending(
|
? TextUtilities::PrepareForSending(
|
||||||
_caption->getLastText(),
|
_caption->getLastText(),
|
||||||
|
|
|
@ -35,14 +35,14 @@ class InputArea;
|
||||||
struct GroupMediaLayout;
|
struct GroupMediaLayout;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
enum class SendFilesWay {
|
||||||
|
Album,
|
||||||
|
Photos,
|
||||||
|
Files,
|
||||||
|
};
|
||||||
|
|
||||||
class SendFilesBox : public BoxContent {
|
class SendFilesBox : public BoxContent {
|
||||||
public:
|
public:
|
||||||
enum class SendWay {
|
|
||||||
Album,
|
|
||||||
Photos,
|
|
||||||
Files,
|
|
||||||
};
|
|
||||||
|
|
||||||
SendFilesBox(
|
SendFilesBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
Storage::PreparedList &&list,
|
Storage::PreparedList &&list,
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
void setConfirmedCallback(
|
void setConfirmedCallback(
|
||||||
base::lambda<void(
|
base::lambda<void(
|
||||||
Storage::PreparedList &&list,
|
Storage::PreparedList &&list,
|
||||||
SendWay way,
|
SendFilesWay way,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
bool ctrlShiftEnter)> callback) {
|
bool ctrlShiftEnter)> callback) {
|
||||||
_confirmedCallback = std::move(callback);
|
_confirmedCallback = std::move(callback);
|
||||||
|
@ -103,17 +103,17 @@ private:
|
||||||
|
|
||||||
base::lambda<void(
|
base::lambda<void(
|
||||||
Storage::PreparedList &&list,
|
Storage::PreparedList &&list,
|
||||||
SendWay way,
|
SendFilesWay way,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
bool ctrlShiftEnter)> _confirmedCallback;
|
bool ctrlShiftEnter)> _confirmedCallback;
|
||||||
base::lambda<void()> _cancelledCallback;
|
base::lambda<void()> _cancelledCallback;
|
||||||
bool _confirmed = false;
|
bool _confirmed = false;
|
||||||
|
|
||||||
object_ptr<Ui::InputArea> _caption = { nullptr };
|
object_ptr<Ui::InputArea> _caption = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<SendWay>> _sendAlbum = { nullptr };
|
object_ptr<Ui::Radioenum<SendFilesWay>> _sendAlbum = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<SendWay>> _sendPhotos = { nullptr };
|
object_ptr<Ui::Radioenum<SendFilesWay>> _sendPhotos = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<SendWay>> _sendFiles = { nullptr };
|
object_ptr<Ui::Radioenum<SendFilesWay>> _sendFiles = { nullptr };
|
||||||
std::shared_ptr<Ui::RadioenumGroup<SendWay>> _sendWay;
|
std::shared_ptr<Ui::RadioenumGroup<SendFilesWay>> _sendWay;
|
||||||
|
|
||||||
rpl::variable<int> _footerHeight = 0;
|
rpl::variable<int> _footerHeight = 0;
|
||||||
|
|
||||||
|
|
|
@ -3133,7 +3133,7 @@ void HistoryWidget::chooseAttach() {
|
||||||
auto list = Storage::PrepareMediaList(
|
auto list = Storage::PrepareMediaList(
|
||||||
result.paths,
|
result.paths,
|
||||||
st::sendMediaPreviewSize);
|
st::sendMediaPreviewSize);
|
||||||
if (list.allFilesForCompress) {
|
if (list.allFilesForCompress || list.albumIsPossible) {
|
||||||
confirmSendingFiles(std::move(list), CompressConfirm::Auto);
|
confirmSendingFiles(std::move(list), CompressConfirm::Auto);
|
||||||
} else if (!showSendingFilesError(list)) {
|
} else if (!showSendingFilesError(list)) {
|
||||||
uploadFiles(std::move(list), SendMediaType::File);
|
uploadFiles(std::move(list), SendMediaType::File);
|
||||||
|
@ -3979,6 +3979,7 @@ bool HistoryWidget::showSendingFilesError(
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::show(Box<InformBox>(text));
|
Ui::show(Box<InformBox>(text));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4029,16 +4030,16 @@ bool HistoryWidget::confirmSendingFiles(
|
||||||
auto box = Box<SendFilesBox>(std::move(list), boxCompressConfirm);
|
auto box = Box<SendFilesBox>(std::move(list), boxCompressConfirm);
|
||||||
box->setConfirmedCallback(base::lambda_guarded(this, [=](
|
box->setConfirmedCallback(base::lambda_guarded(this, [=](
|
||||||
Storage::PreparedList &&list,
|
Storage::PreparedList &&list,
|
||||||
SendFilesBox::SendWay way,
|
SendFilesWay way,
|
||||||
const QString &caption,
|
const QString &caption,
|
||||||
bool ctrlShiftEnter) {
|
bool ctrlShiftEnter) {
|
||||||
if (showSendingFilesError(list)) {
|
if (showSendingFilesError(list)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto type = (way == SendFilesBox::SendWay::Files)
|
const auto type = (way == SendFilesWay::Files)
|
||||||
? SendMediaType::File
|
? SendMediaType::File
|
||||||
: SendMediaType::Photo;
|
: SendMediaType::Photo;
|
||||||
const auto album = (way == SendFilesBox::SendWay::Album)
|
const auto album = (way == SendFilesWay::Album)
|
||||||
? std::make_shared<SendingAlbum>()
|
? std::make_shared<SendingAlbum>()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
uploadFilesAfterConfirmation(
|
uploadFilesAfterConfirmation(
|
||||||
|
|
|
@ -64,7 +64,6 @@ QByteArray gLocalSalt;
|
||||||
DBIScale gRealScale = dbisAuto;
|
DBIScale gRealScale = dbisAuto;
|
||||||
DBIScale gScreenScale = dbisOne;
|
DBIScale gScreenScale = dbisOne;
|
||||||
DBIScale gConfigScale = dbisAuto;
|
DBIScale gConfigScale = dbisAuto;
|
||||||
bool gCompressPastedImage = true;
|
|
||||||
|
|
||||||
QString gTimeFormat = qsl("hh:mm");
|
QString gTimeFormat = qsl("hh:mm");
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,6 @@ DeclareSetting(QByteArray, LocalSalt);
|
||||||
DeclareSetting(DBIScale, RealScale);
|
DeclareSetting(DBIScale, RealScale);
|
||||||
DeclareSetting(DBIScale, ScreenScale);
|
DeclareSetting(DBIScale, ScreenScale);
|
||||||
DeclareSetting(DBIScale, ConfigScale);
|
DeclareSetting(DBIScale, ConfigScale);
|
||||||
DeclareSetting(bool, CompressPastedImage);
|
|
||||||
DeclareSetting(QString, TimeFormat);
|
DeclareSetting(QString, TimeFormat);
|
||||||
|
|
||||||
inline void cChangeTimeFormat(const QString &newFormat) {
|
inline void cChangeTimeFormat(const QString &newFormat) {
|
||||||
|
|
|
@ -523,7 +523,7 @@ void FileLoadTask::process() {
|
||||||
isVideo = true;
|
isVideo = true;
|
||||||
auto coverWidth = video->thumbnail.width();
|
auto coverWidth = video->thumbnail.width();
|
||||||
auto coverHeight = video->thumbnail.height();
|
auto coverHeight = video->thumbnail.height();
|
||||||
if (video->isGifv) {
|
if (video->isGifv && !_album) {
|
||||||
attributes.push_back(MTP_documentAttributeAnimated());
|
attributes.push_back(MTP_documentAttributeAnimated());
|
||||||
}
|
}
|
||||||
auto flags = MTPDdocumentAttributeVideo::Flags(0);
|
auto flags = MTPDdocumentAttributeVideo::Flags(0);
|
||||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "storage/serialize_common.h"
|
#include "storage/serialize_common.h"
|
||||||
#include "chat_helpers/stickers.h"
|
#include "chat_helpers/stickers.h"
|
||||||
#include "data/data_drafts.h"
|
#include "data/data_drafts.h"
|
||||||
|
#include "boxes/send_files_box.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
@ -1422,7 +1423,9 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetCompressPastedImage(v == 1);
|
GetStoredAuthSessionCache().setSendFilesWay((v == 1)
|
||||||
|
? SendFilesWay::Album
|
||||||
|
: SendFilesWay::Files);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiEmojiTabOld: {
|
case dbiEmojiTabOld: {
|
||||||
|
@ -1804,7 +1807,6 @@ void _writeUserSettings() {
|
||||||
data.stream << quint32(dbiNotificationsCorner) << qint32(Global::NotificationsCorner());
|
data.stream << quint32(dbiNotificationsCorner) << qint32(Global::NotificationsCorner());
|
||||||
data.stream << quint32(dbiAskDownloadPath) << qint32(Global::AskDownloadPath());
|
data.stream << quint32(dbiAskDownloadPath) << qint32(Global::AskDownloadPath());
|
||||||
data.stream << quint32(dbiDownloadPath) << (Global::AskDownloadPath() ? QString() : Global::DownloadPath()) << (Global::AskDownloadPath() ? QByteArray() : Global::DownloadPathBookmark());
|
data.stream << quint32(dbiDownloadPath) << (Global::AskDownloadPath() ? QString() : Global::DownloadPath()) << (Global::AskDownloadPath() ? QByteArray() : Global::DownloadPathBookmark());
|
||||||
data.stream << quint32(dbiCompressPastedImage) << qint32(cCompressPastedImage());
|
|
||||||
data.stream << quint32(dbiDialogLastPath) << cDialogLastPath();
|
data.stream << quint32(dbiDialogLastPath) << cDialogLastPath();
|
||||||
data.stream << quint32(dbiSongVolume) << qint32(qRound(Global::SongVolume() * 1e6));
|
data.stream << quint32(dbiSongVolume) << qint32(qRound(Global::SongVolume() * 1e6));
|
||||||
data.stream << quint32(dbiVideoVolume) << qint32(qRound(Global::VideoVolume() * 1e6));
|
data.stream << quint32(dbiVideoVolume) << qint32(qRound(Global::VideoVolume() * 1e6));
|
||||||
|
|
Loading…
Add table
Reference in a new issue