mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Added photo editor hint to EditCaptionBox.
This commit is contained in:
parent
5bd17ae1b2
commit
e4cff8cb4b
4 changed files with 45 additions and 7 deletions
|
@ -184,6 +184,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
"lng_edit_media_album_error" = "This file cannot be saved as a part of an album.";
|
||||
"lng_edit_media_invalid_file" = "Sorry, no way to use this file.";
|
||||
"lng_edit_photo_editor_hint" = "Left-click on the photo to edit.";
|
||||
"lng_edit_caption_attach" = "Sorry, you can't attach a new media while you're editing your message.";
|
||||
"lng_edit_caption_voice" = "Sorry, you can't edit your message while you're having an unsent voice message.";
|
||||
|
||||
|
|
|
@ -424,6 +424,10 @@ backgroundScroll: ScrollArea(boxScroll) {
|
|||
deltab: 10px;
|
||||
}
|
||||
|
||||
sendMediaPreviewSize: 308px;
|
||||
sendMediaPreviewHeightMax: 1280;
|
||||
sendMediaRowSkip: 10px;
|
||||
|
||||
editMediaButtonSize: 28px;
|
||||
editMediaButtonSkip: 8px;
|
||||
editMediaButtonFileSkipRight: 1px;
|
||||
|
@ -441,6 +445,11 @@ editMediaButton: IconButton {
|
|||
ripple: defaultRippleAnimation;
|
||||
}
|
||||
|
||||
editMediaHintLabel: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
minWidth: sendMediaPreviewSize;
|
||||
}
|
||||
|
||||
// SendFilesBox
|
||||
|
||||
sendBoxAlbumGroupEditInternalSkip: 8px;
|
||||
|
@ -520,6 +529,7 @@ usernameTextStyle: TextStyle(boxTextStyle, passcodeTextStyle) {
|
|||
}
|
||||
usernameDefaultFg: windowSubTextFg;
|
||||
|
||||
editMediaLabelMargins: margins(0px, 11px, 0px, 0px);
|
||||
editMediaCheckboxMargins: margins(0px, 15px, 23px, 15px);
|
||||
|
||||
downloadPathSkip: 10px;
|
||||
|
@ -646,10 +656,6 @@ groupStickersField: InputField(defaultMultiSelectSearchField) {
|
|||
}
|
||||
groupStickersSubTitleHeight: 36px;
|
||||
|
||||
sendMediaPreviewSize: 308px;
|
||||
sendMediaPreviewHeightMax: 1280;
|
||||
sendMediaRowSkip: 10px;
|
||||
|
||||
proxyUsePadding: margins(22px, 6px, 22px, 5px);
|
||||
proxyTryIPv6Padding: margins(22px, 8px, 22px, 5px);
|
||||
proxyRowPadding: margins(22px, 8px, 8px, 8px);
|
||||
|
|
|
@ -384,6 +384,16 @@ EditCaptionBox::EditCaptionBox(
|
|||
|
||||
InitSpellchecker(_controller, _field);
|
||||
|
||||
auto label = object_ptr<Ui::SlideWrap<Ui::FlatLabel>>(
|
||||
this,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
tr::lng_edit_photo_editor_hint(tr::now),
|
||||
st::editMediaHintLabel),
|
||||
st::editMediaLabelMargins);
|
||||
_hintLabel = label.data();
|
||||
_hintLabel->toggle(_photo, anim::type::instant);
|
||||
|
||||
auto r = object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
|
||||
this,
|
||||
object_ptr<Ui::Checkbox>(
|
||||
|
@ -639,6 +649,7 @@ void EditCaptionBox::updateEditPreview() {
|
|||
|
||||
const auto showCheckbox = _photo && (_albumType == Ui::AlbumType::None);
|
||||
_wayWrap->toggle(showCheckbox, anim::type::instant);
|
||||
_hintLabel->toggle(_photo, anim::type::instant);
|
||||
_photoEditorButton->setVisible(_photo);
|
||||
|
||||
if (!_doc) {
|
||||
|
@ -838,7 +849,7 @@ void EditCaptionBox::updateCaptionMaxHeight() {
|
|||
|
||||
_field->setMaxHeight(_doc
|
||||
? st::confirmCaptionArea.heightMax
|
||||
: st::confirmEditCaptionAreaHeightMax);
|
||||
: (st::confirmEditCaptionAreaHeightMax - (_hintLabel->height() / 2)));
|
||||
|
||||
// Restore.
|
||||
_field->setTextWithTags(text);
|
||||
|
@ -922,6 +933,9 @@ void EditCaptionBox::updateBoxSize() {
|
|||
if (_photo) {
|
||||
newHeight += _wayWrap->height() / 2;
|
||||
}
|
||||
if (_hintLabel->toggled()) {
|
||||
newHeight += _hintLabel->height();
|
||||
}
|
||||
const auto &st = isThumbedLayout()
|
||||
? st::msgFileThumbLayout
|
||||
: st::msgFileLayout;
|
||||
|
@ -1083,18 +1097,34 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
|||
void EditCaptionBox::resizeEvent(QResizeEvent *e) {
|
||||
BoxContent::resizeEvent(e);
|
||||
|
||||
const auto previewBottom = st::boxPhotoPadding.top() + _thumbh;
|
||||
const auto hintToggled = _hintLabel->toggled();
|
||||
|
||||
if (hintToggled) {
|
||||
_hintLabel->resize(st::sendMediaPreviewSize, _hintLabel->height());
|
||||
_hintLabel->moveToLeft(st::boxPhotoPadding.left(), previewBottom);
|
||||
}
|
||||
|
||||
if (_photo) {
|
||||
_wayWrap->resize(st::sendMediaPreviewSize, _wayWrap->height());
|
||||
_wayWrap->moveToLeft(
|
||||
st::boxPhotoPadding.left(),
|
||||
st::boxPhotoPadding.top() + _thumbh);
|
||||
hintToggled
|
||||
? _hintLabel->y() + _hintLabel->height()
|
||||
: previewBottom);
|
||||
|
||||
_photoEditorButton->resize(_thumbw, _thumbh);
|
||||
_photoEditorButton->moveToLeft(_thumbx, st::boxPhotoPadding.top());
|
||||
}
|
||||
|
||||
_field->resize(st::sendMediaPreviewSize, _field->height());
|
||||
_field->moveToLeft(st::boxPhotoPadding.left(), height() - st::normalFont->height - errorTopSkip() - _field->height());
|
||||
_field->moveToLeft(
|
||||
st::boxPhotoPadding.left(),
|
||||
height()
|
||||
- st::normalFont->height
|
||||
- errorTopSkip()
|
||||
- _field->height());
|
||||
|
||||
_emojiToggle->moveToLeft(
|
||||
(st::boxPhotoPadding.left()
|
||||
+ st::sendMediaPreviewSize
|
||||
|
|
|
@ -144,6 +144,7 @@ private:
|
|||
|
||||
object_ptr<Ui::IconButton> _editMedia = nullptr;
|
||||
Ui::SlideWrap<Ui::RpWidget> *_wayWrap = nullptr;
|
||||
Ui::SlideWrap<Ui::RpWidget> *_hintLabel = nullptr;
|
||||
QString _newMediaPath;
|
||||
Ui::AlbumType _albumType = Ui::AlbumType();
|
||||
bool _isAllowedEditMedia = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue