Beta version 1.4.4: Correct caption limit.

This commit is contained in:
John Preston 2018-10-17 14:38:07 +03:00
parent 54f2b1b2d8
commit c5d20a21f7
8 changed files with 15 additions and 6 deletions

View File

@ -209,7 +209,7 @@ EditCaptionBox::EditCaptionBox(
Ui::InputField::Mode::MultiLine,
langFactory(lng_photo_caption),
editData);
_field->setMaxLength(MaxPhotoCaption);
_field->setMaxLength(Global::CaptionLengthMax());
_field->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_field->setInstantReplaces(Ui::InstantReplaces::Default());
_field->setInstantReplacesEnabled(Global::ReplaceEmojiValue());

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kMaxRating = 5;
constexpr auto kRateCallCommentLengthMax = 200;
} // namespace
@ -78,7 +79,7 @@ void RateCallBox::ratingChanged(int value) {
langFactory(lng_call_rate_comment));
_comment->show();
_comment->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_comment->setMaxLength(MaxPhotoCaption);
_comment->setMaxLength(kRateCallCommentLengthMax);
_comment->resize(width() - (st::callRatingPadding.left() + st::callRatingPadding.right()), _comment->height());
updateMaxHeight();

View File

@ -17,6 +17,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "mainwindow.h"
namespace {
constexpr auto kReportReasonLengthMax = 200;
} // namespace
ReportBox::ReportBox(QWidget*, not_null<PeerData*> peer)
: _peer(peer) {
}
@ -89,7 +95,7 @@ void ReportBox::reasonChanged(Reason reason) {
langFactory(lng_report_reason_description));
_reasonOtherText->show();
_reasonOtherText->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_reasonOtherText->setMaxLength(MaxPhotoCaption);
_reasonOtherText->setMaxLength(kReportReasonLengthMax);
_reasonOtherText->resize(width() - (st::boxPadding.left() + st::boxOptionListPadding.left() + st::boxPadding.right()), _reasonOtherText->height());
updateMaxHeight();

View File

@ -1556,7 +1556,7 @@ void SendFilesBox::applyAlbumOrder() {
}
void SendFilesBox::setupCaption() {
_caption->setMaxLength(MaxPhotoCaption);
_caption->setMaxLength(Global::CaptionLengthMax());
_caption->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
connect(_caption, &Ui::InputField::resized, [=] {
captionResized();

View File

@ -75,8 +75,6 @@ enum {
SearchPeopleLimit = 5,
UsernameCheckTimeout = 200,
MaxPhotoCaption = 200,
MaxMessageSize = 4096,
WriteMapTimeout = 1000,

View File

@ -622,6 +622,7 @@ struct Data {
: qsl("apv2.stel.com");
bool PhoneCallsEnabled = true;
bool BlockedMode = false;
int32 CaptionLengthMax = 1024;
base::Observable<void> PhoneCallsEnabledChanged;
HiddenPinnedMessagesMap HiddenPinnedMessages;
@ -750,6 +751,7 @@ DefineVar(Global, int32, WebFileDcId);
DefineVar(Global, QString, TxtDomainString);
DefineVar(Global, bool, PhoneCallsEnabled);
DefineVar(Global, bool, BlockedMode);
DefineVar(Global, int32, CaptionLengthMax);
DefineRefVar(Global, base::Observable<void>, PhoneCallsEnabledChanged);
DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages);

View File

@ -286,6 +286,7 @@ DeclareVar(int32, WebFileDcId);
DeclareVar(QString, TxtDomainString);
DeclareVar(bool, PhoneCallsEnabled);
DeclareVar(bool, BlockedMode);
DeclareVar(int32, CaptionLengthMax);
DeclareRefVar(base::Observable<void>, PhoneCallsEnabledChanged);
typedef QMap<PeerId, MsgId> HiddenPinnedMessagesMap;

View File

@ -768,6 +768,7 @@ void Instance::Private::configLoadDone(const MTPConfig &result) {
Global::RefPhoneCallsEnabledChanged().notify();
}
Global::SetBlockedMode(data.is_blocked_mode());
Global::SetCaptionLengthMax(data.vcaption_length_max.v);
const auto lang = data.has_suggested_lang_code()
? qs(data.vsuggested_lang_code)