diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 0e8d430329..58331cba58 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -680,32 +680,6 @@ msgWaveformOutActiveSelected: #6badad; msgWaveformOutInactive: #b3e2b4; msgWaveformOutInactiveSelected: #91c3c3; -sendPadding: 9px; -btnSend: flatButton { - duration: 200; - cursor: cursor(pointer); - - color: btnYesColor; - overColor: btnYesHover; - - bgColor: historySendBg; - overBgColor: historySendBgOver; - - width: -32px; - height: 46px; - - textTop: 12px; - overTextTop: 12px; - downTextTop: 13px; - - font: font(16px); - overFont: font(16px); -} -btnUnblock: flatButton(btnSend) { - color: #d15948; - overColor: #d15948; -} - historyScroll: flatScroll(scrollDef) { barColor: #89a0b47a; bgColor: #89a0b44c; diff --git a/Telegram/Resources/colors.palette b/Telegram/Resources/colors.palette index ac980b21ea..c102bf3ef1 100644 --- a/Telegram/Resources/colors.palette +++ b/Telegram/Resources/colors.palette @@ -169,13 +169,15 @@ emojiPanHeaderBg: #fffffff2 | emojiPanBg; historyComposeAreaBg: windowBg; historyComposeIconFg: menuIconFg; historyComposeIconFgOver: menuIconFgOver; +historySendIconFg: windowActiveBg; +historySendIconFgOver: windowActiveBg; historyPinnedBg: historyComposeAreaBg; historyReplyBg: historyComposeAreaBg; historyReplyCancelIconFg: cancelIconFg; historyReplyCancelIconFgOver: cancelIconFgOver; -historySendBg: historyComposeAreaBg; -historySendBgOver: #f5f5f5 | historySendBg; +historyComposeButtonBg: historyComposeAreaBg; +historyComposeButtonBgOver: #f5f5f5; historyTextInFg: windowTextFg; historyTextOutFg: windowTextFg; diff --git a/Telegram/Resources/icons/media_type_file.png b/Telegram/Resources/icons/media_type_file.png index dcc7996f18..37c310a39e 100644 Binary files a/Telegram/Resources/icons/media_type_file.png and b/Telegram/Resources/icons/media_type_file.png differ diff --git a/Telegram/Resources/icons/media_type_file@2x.png b/Telegram/Resources/icons/media_type_file@2x.png index 7df85a0b28..c1e9fa7736 100644 Binary files a/Telegram/Resources/icons/media_type_file@2x.png and b/Telegram/Resources/icons/media_type_file@2x.png differ diff --git a/Telegram/Resources/icons/media_type_link.png b/Telegram/Resources/icons/media_type_link.png deleted file mode 100644 index 02b47d0e92..0000000000 Binary files a/Telegram/Resources/icons/media_type_link.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_link@2x.png b/Telegram/Resources/icons/media_type_link@2x.png deleted file mode 100644 index d10338d6ef..0000000000 Binary files a/Telegram/Resources/icons/media_type_link@2x.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_photo.png b/Telegram/Resources/icons/media_type_photo.png index 520c9b5d86..1bda90336a 100644 Binary files a/Telegram/Resources/icons/media_type_photo.png and b/Telegram/Resources/icons/media_type_photo.png differ diff --git a/Telegram/Resources/icons/media_type_photo@2x.png b/Telegram/Resources/icons/media_type_photo@2x.png index e2a1fa4dff..87a72b39e0 100644 Binary files a/Telegram/Resources/icons/media_type_photo@2x.png and b/Telegram/Resources/icons/media_type_photo@2x.png differ diff --git a/Telegram/Resources/icons/media_type_song.png b/Telegram/Resources/icons/media_type_song.png deleted file mode 100644 index da6d751ab7..0000000000 Binary files a/Telegram/Resources/icons/media_type_song.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_song@2x.png b/Telegram/Resources/icons/media_type_song@2x.png deleted file mode 100644 index 24c8128fdf..0000000000 Binary files a/Telegram/Resources/icons/media_type_song@2x.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_video.png b/Telegram/Resources/icons/media_type_video.png deleted file mode 100644 index 48a8321e1d..0000000000 Binary files a/Telegram/Resources/icons/media_type_video.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_video@2x.png b/Telegram/Resources/icons/media_type_video@2x.png deleted file mode 100644 index 6366ba5b6e..0000000000 Binary files a/Telegram/Resources/icons/media_type_video@2x.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_voice.png b/Telegram/Resources/icons/media_type_voice.png deleted file mode 100644 index 66deec6dd6..0000000000 Binary files a/Telegram/Resources/icons/media_type_voice.png and /dev/null differ diff --git a/Telegram/Resources/icons/media_type_voice@2x.png b/Telegram/Resources/icons/media_type_voice@2x.png deleted file mode 100644 index cdbdcadbcb..0000000000 Binary files a/Telegram/Resources/icons/media_type_voice@2x.png and /dev/null differ diff --git a/Telegram/Resources/icons/send_control_attach.png b/Telegram/Resources/icons/send_control_attach.png new file mode 100644 index 0000000000..a16628b77b Binary files /dev/null and b/Telegram/Resources/icons/send_control_attach.png differ diff --git a/Telegram/Resources/icons/send_control_attach@2x.png b/Telegram/Resources/icons/send_control_attach@2x.png new file mode 100644 index 0000000000..8b0c4d3e15 Binary files /dev/null and b/Telegram/Resources/icons/send_control_attach@2x.png differ diff --git a/Telegram/Resources/icons/send_control_bot_command.png b/Telegram/Resources/icons/send_control_bot_command.png index f18a7c01a1..34cc9d6eb0 100644 Binary files a/Telegram/Resources/icons/send_control_bot_command.png and b/Telegram/Resources/icons/send_control_bot_command.png differ diff --git a/Telegram/Resources/icons/send_control_bot_command@2x.png b/Telegram/Resources/icons/send_control_bot_command@2x.png index 0db466a7c5..faaf97c168 100644 Binary files a/Telegram/Resources/icons/send_control_bot_command@2x.png and b/Telegram/Resources/icons/send_control_bot_command@2x.png differ diff --git a/Telegram/Resources/icons/send_control_bot_keyboard.png b/Telegram/Resources/icons/send_control_bot_keyboard.png index 329f8ef428..b9423a7161 100644 Binary files a/Telegram/Resources/icons/send_control_bot_keyboard.png and b/Telegram/Resources/icons/send_control_bot_keyboard.png differ diff --git a/Telegram/Resources/icons/send_control_bot_keyboard@2x.png b/Telegram/Resources/icons/send_control_bot_keyboard@2x.png index 43f0be684c..482e40831c 100644 Binary files a/Telegram/Resources/icons/send_control_bot_keyboard@2x.png and b/Telegram/Resources/icons/send_control_bot_keyboard@2x.png differ diff --git a/Telegram/Resources/icons/send_control_bot_keyboard_hide.png b/Telegram/Resources/icons/send_control_bot_keyboard_hide.png index 6ada764b54..ceaaccf73c 100644 Binary files a/Telegram/Resources/icons/send_control_bot_keyboard_hide.png and b/Telegram/Resources/icons/send_control_bot_keyboard_hide.png differ diff --git a/Telegram/Resources/icons/send_control_bot_keyboard_hide@2x.png b/Telegram/Resources/icons/send_control_bot_keyboard_hide@2x.png index 49ebaa0bac..89cb528dfc 100644 Binary files a/Telegram/Resources/icons/send_control_bot_keyboard_hide@2x.png and b/Telegram/Resources/icons/send_control_bot_keyboard_hide@2x.png differ diff --git a/Telegram/Resources/icons/send_control_emoji.png b/Telegram/Resources/icons/send_control_emoji.png index 65c52d50c9..5698c8421b 100644 Binary files a/Telegram/Resources/icons/send_control_emoji.png and b/Telegram/Resources/icons/send_control_emoji.png differ diff --git a/Telegram/Resources/icons/send_control_emoji@2x.png b/Telegram/Resources/icons/send_control_emoji@2x.png index 773350b003..8a1a772b59 100644 Binary files a/Telegram/Resources/icons/send_control_emoji@2x.png and b/Telegram/Resources/icons/send_control_emoji@2x.png differ diff --git a/Telegram/Resources/icons/send_control_record.png b/Telegram/Resources/icons/send_control_record.png index 8729b1fcba..36882d408c 100644 Binary files a/Telegram/Resources/icons/send_control_record.png and b/Telegram/Resources/icons/send_control_record.png differ diff --git a/Telegram/Resources/icons/send_control_record@2x.png b/Telegram/Resources/icons/send_control_record@2x.png index 7a45e6df27..3eba00f2e6 100644 Binary files a/Telegram/Resources/icons/send_control_record@2x.png and b/Telegram/Resources/icons/send_control_record@2x.png differ diff --git a/Telegram/Resources/icons/send_control_send.png b/Telegram/Resources/icons/send_control_send.png new file mode 100644 index 0000000000..6414c8bfaa Binary files /dev/null and b/Telegram/Resources/icons/send_control_send.png differ diff --git a/Telegram/Resources/icons/send_control_send@2x.png b/Telegram/Resources/icons/send_control_send@2x.png new file mode 100644 index 0000000000..559248cea3 Binary files /dev/null and b/Telegram/Resources/icons/send_control_send@2x.png differ diff --git a/Telegram/Resources/sample.tdesktop-theme b/Telegram/Resources/sample.tdesktop-theme index 128f748a8a..87c9a5aee3 100644 --- a/Telegram/Resources/sample.tdesktop-theme +++ b/Telegram/Resources/sample.tdesktop-theme @@ -137,12 +137,14 @@ emojiPanHeaderBg: #fffffff2; // emojiPanBg; historyComposeAreaBg: windowBg; historyComposeIconFg: menuIconFg; historyComposeIconFgOver: menuIconFgOver; +historySendIconFg: windowActiveBg; +historySendIconFgOver: windowActiveBg; historyPinnedBg: historyComposeAreaBg; historyReplyBg: historyComposeAreaBg; historyReplyCancelIconFg: cancelIconFg; historyReplyCancelIconFgOver: cancelIconFgOver; -historySendBg: historyComposeAreaBg; -historySendBgOver: #f5f5f5; // historySendBg; +historyComposeButtonBg: historyComposeAreaBg; +historyComposeButtonBgOver: #f5f5f5; historyTextInFg: windowTextFg; historyTextOutFg: windowTextFg; historyCaptionInFg: historyTextInFg; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 437c2c7470..bc36e866d0 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -104,13 +104,12 @@ dialogsFilter: flatInput(inpDefGray) { textMrg: margins(32px, 3px, 32px, 3px); } dialogsCancelSearch: IconButton(dialogsMenuToggle) { - icon: icon {{ "dialogs_cancel_search", #a6a6a6, point(0px, 1px) }}; + icon: icon {{ "dialogs_cancel_search", dialogsMenuIconFg, point(0px, 1px) }}; + iconOver: icon {{ "dialogs_cancel_search", dialogsMenuIconFgOver, point(0px, 1px) }}; } dialogsMenu: DropdownMenu(defaultDropdownMenu) { menu: Menu(defaultMenu) { - skip: 8px; - itemIconPosition: point(15px, 8px); itemPadding: margins(56px, 10px, 56px, 12px); } diff --git a/Telegram/SourceFiles/history/field_autocomplete.cpp b/Telegram/SourceFiles/history/field_autocomplete.cpp index b4db5ee2fd..c0e21850fb 100644 --- a/Telegram/SourceFiles/history/field_autocomplete.cpp +++ b/Telegram/SourceFiles/history/field_autocomplete.cpp @@ -541,7 +541,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) { int32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#'); int32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize; int32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right(); - int32 htagleft = st::historyAttachPhoto.width + st::historyComposeField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width; + int32 htagleft = st::historyAttach.width + st::historyComposeField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width; if (!_srows->isEmpty()) { int32 rows = rowscount(_srows->size(), _stickersPerRow); diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index d373a32825..8cccec7ab9 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -157,29 +157,61 @@ historyComposeField: flatTextarea { historyComposeFieldMaxHeight: 224px; // historyMinHeight: 56px; -historyAttachDocument: IconButton { +historySendPadding: 9px; +historySendRight: 2px; + +historyComposeButton: flatButton { + duration: 200; + cursor: cursor(pointer); + + color: btnYesColor; + overColor: btnYesHover; + + bgColor: historyComposeButtonBg; + overBgColor: historyComposeButtonBgOver; + + width: -32px; + height: 46px; + + textTop: 12px; + overTextTop: 12px; + downTextTop: 13px; + + font: font(16px); + overFont: font(16px); +} +historyUnblock: flatButton(historyComposeButton) { + color: #d15948; + overColor: #d15948; +} + +historySend: IconButton { width: 46px; height: 46px; - icon: icon {{ "media_type_file", historyComposeIconFg, point(2px, 2px) }}; - iconOver: icon {{ "media_type_file", historyComposeIconFgOver, point(2px, 2px) }}; + icon: icon {{ "send_control_send", historySendIconFg }}; + iconOver: icon {{ "send_control_send", historySendIconFgOver }}; - iconPosition: point(9px, 9px); - iconPositionDown: point(9px, 10px); + iconPosition: point(11px, 11px); + iconPositionDown: point(11px, 11px); } -historyAttachPhoto: IconButton(historyAttachDocument) { - icon: icon {{ "media_type_photo", historyComposeIconFg, point(2px, 2px) }}; - iconOver: icon {{ "media_type_photo", historyComposeIconFgOver, point(2px, 2px) }}; +historyAttach: IconButton(historySend) { + icon: icon {{ "send_control_attach", historyComposeIconFg }}; + iconOver: icon {{ "send_control_attach", historyComposeIconFgOver }}; } -historyAttachEmoji: IconButton(historyAttachDocument) { - width: 33px; +historyAttachFileIcon: icon {{ "media_type_file", historyComposeIconFg }}; +historyAttachFileIconOver: icon {{ "media_type_file", historyComposeIconFgOver }}; +historyAttachPhotoIcon: icon {{ "media_type_photo", historyComposeIconFg }}; +historyAttachPhotoIconOver: icon {{ "media_type_photo", historyComposeIconFgOver }}; + +historyAttachEmoji: IconButton(historyAttach) { icon: icon {{ "send_control_emoji", historyComposeIconFg }}; iconOver: icon {{ "send_control_emoji", historyComposeIconFgOver }}; - iconPosition: point(12px, 16px); - iconPositionDown: point(12px, 16px); + iconPosition: point(15px, 15px); + iconPositionDown: point(15px, 15px); } -historyEmojiCircle: size(19px, 19px); +historyEmojiCircle: size(20px, 20px); historyEmojiCirclePeriod: 1500; historyEmojiCircleDuration: 500; historyEmojiCircleTop: 13px; @@ -187,21 +219,18 @@ historyEmojiCircleLine: 2px; historyEmojiCircleFg: historyComposeIconFg; historyEmojiCircleFgOver: historyComposeIconFgOver; historyEmojiCirclePart: 3.5; -historyBotKeyboardShow: IconButton(historyAttachEmoji) { +historyBotKeyboardShow: IconButton(historySend) { icon: icon {{ "send_control_bot_keyboard", historyComposeIconFg }}; iconOver: icon {{ "send_control_bot_keyboard", historyComposeIconFgOver }}; - - iconPosition: point(6px, 12px); - iconPositionDown: point(6px, 12px); } -historyBotKeyboardHide: IconButton(historyAttachEmoji) { +historyBotKeyboardHide: IconButton(historySend) { icon: icon {{ "send_control_bot_keyboard_hide", historyComposeIconFg }}; iconOver: icon {{ "send_control_bot_keyboard_hide", historyComposeIconFgOver }}; - iconPosition: point(5px, 17px); - iconPositionDown: point(5px, 17px); + iconPosition: point(11px, 16px); + iconPositionDown: point(11px, 16px); } -historyBotCommandStart: IconButton(historyBotKeyboardShow) { +historyBotCommandStart: IconButton(historySend) { icon: icon {{ "send_control_bot_command", historyComposeIconFg }}; iconOver: icon {{ "send_control_bot_command", historyComposeIconFgOver }}; } @@ -220,27 +249,16 @@ historyRecordFont: font(13px); historyRecordDurationFg: #000000; historyRecordTextTop: 14px; +historyAttachDropdownMenu: DropdownMenu(defaultDropdownMenu) { + menu: Menu(defaultMenu) { + itemIconPosition: point(13px, 6px); + itemPadding: margins(54px, 11px, 54px, 11px); + } +} historyMediaTypeFile: icon {{ "media_type_file", menuIconFg, point(2px, 2px) }}; historyMediaTypeFileOver: icon {{ "media_type_file", menuIconFgOver, point(2px, 2px) }}; historyMediaTypePhoto: icon {{ "media_type_photo", menuIconFg, point(2px, 2px) }}; historyMediaTypePhotoOver: icon {{ "media_type_photo", menuIconFgOver, point(2px, 2px) }}; -historyMediaTypeVideo: icon {{ "media_type_video", menuIconFg, point(2px, 2px) }}; -historyMediaTypeVideoOver: icon {{ "media_type_video", menuIconFgOver, point(2px, 2px) }}; -historyMediaTypeSong: icon {{ "media_type_song", menuIconFg, point(0px, 0px) }}; -historyMediaTypeSongOver: icon {{ "media_type_song", menuIconFgOver, point(0px, 0px) }}; -historyMediaTypeVoice: icon {{ "media_type_voice", menuIconFg, point(2px, 2px) }}; -historyMediaTypeVoiceOver: icon {{ "media_type_voice", menuIconFgOver, point(2px, 2px) }}; -historyMediaTypeLink: icon {{ "media_type_link", menuIconFg, point(2px, 2px) }}; -historyMediaTypeLinkOver: icon {{ "media_type_link", menuIconFgOver, point(2px, 2px) }}; - -historyAttachDropdownMenu: DropdownMenu(defaultDropdownMenu) { - menu: Menu(defaultMenu) { - skip: 5px; - - itemIconPosition: point(12px, 6px); - itemPadding: margins(48px, 11px, 48px, 11px); - } -} historySilentToggle: IconButton(historyBotKeyboardShow) { icon: icon {{ "send_control_silent_off", historyComposeIconFg }}; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 08159e603d..4b1ef29607 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1702,7 +1702,7 @@ void HistoryInner::toggleScrollDateShown() { _scrollDateShown = !_scrollDateShown; auto from = _scrollDateShown ? 0. : 1.; auto to = _scrollDateShown ? 1. : 0.; - _scrollDateOpacity.start([this] { repaintScrollDateCallback(); }, from, to, st::historyAttachPhoto.duration); + _scrollDateOpacity.start([this] { repaintScrollDateCallback(); }, from, to, st::historyAttach.duration); } void HistoryInner::repaintScrollDateCallback() { @@ -2303,7 +2303,7 @@ void HistoryInner::onParentGeometryChanged() { } MessageField::MessageField(HistoryWidget *history, const style::flatTextarea &st, const QString &ph, const QString &val) : FlatTextarea(history, st, ph, val), history(history) { - setMinHeight(st::btnSend.height - 2 * st::sendPadding); + setMinHeight(st::historySend.height - 2 * st::historySendPadding); setMaxHeight(st::historyComposeFieldMaxHeight); } @@ -2995,13 +2995,12 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) , _historyToEnd(this) , _fieldAutocomplete(this) , _reportSpamPanel(this) -, _send(this, lang(lng_send_button), st::btnSend) -, _unblock(this, lang(lng_unblock_button), st::btnUnblock) -, _botStart(this, lang(lng_bot_start), st::btnSend) -, _joinChannel(this, lang(lng_channel_join), st::btnSend) -, _muteUnmute(this, lang(lng_channel_mute), st::btnSend) -, _attachDocument(this, st::historyAttachDocument) -, _attachPhoto(this, st::historyAttachPhoto) +, _send(this, st::historySend) +, _unblock(this, lang(lng_unblock_button), st::historyUnblock) +, _botStart(this, lang(lng_bot_start), st::historyComposeButton) +, _joinChannel(this, lang(lng_channel_join), st::historyComposeButton) +, _muteUnmute(this, lang(lng_channel_mute), st::historyComposeButton) +, _attachToggle(this, st::historyAttach) , _attachEmoji(this, st::historyAttachEmoji) , _botKeyboardShow(this, st::historyBotKeyboardShow) , _botKeyboardHide(this, st::historyBotKeyboardHide) @@ -3035,8 +3034,18 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) connect(_joinChannel, SIGNAL(clicked()), this, SLOT(onJoinChannel())); connect(_muteUnmute, SIGNAL(clicked()), this, SLOT(onMuteUnmute())); connect(_silent, SIGNAL(clicked()), this, SLOT(onBroadcastSilentChange())); - connect(_attachDocument, SIGNAL(clicked()), this, SLOT(onDocumentSelect())); - connect(_attachPhoto, SIGNAL(clicked()), this, SLOT(onPhotoSelect())); + _attachToggle->setClickedCallback([this] { + if (cDefaultAttach() == dbidaPhoto) { + onPhotoSelect(); + } else { + onDocumentSelect(); + } + }); + if (cDefaultAttach() == dbidaPhoto) { + _attachToggle->setIcon(&st::historyAttachPhotoIcon, &st::historyAttachPhotoIconOver); + } else { + _attachToggle->setIcon(&st::historyAttachFileIcon, &st::historyAttachFileIconOver); + } connect(_field, SIGNAL(submitted(bool)), this, SLOT(onSend(bool))); connect(_field, SIGNAL(cancelled()), this, SLOT(onCancel())); connect(_field, SIGNAL(tabbed()), this, SLOT(onFieldTabbed())); @@ -3112,16 +3121,14 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) _reportSpamPanel.move(0, 0); _reportSpamPanel.hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _attachEmoji->hide(); _botKeyboardShow->hide(); _botKeyboardHide->hide(); _silent->hide(); _botCommandStart->hide(); - _attachDocument->installEventFilter(_attachType); - _attachPhoto->installEventFilter(_attachType); + _attachToggle->installEventFilter(_attachType); _attachEmoji->installEventFilter(_emojiPan); connect(_botKeyboardShow, SIGNAL(clicked()), this, SLOT(onKbToggle())); @@ -4502,8 +4509,7 @@ void HistoryWidget::updateControlsVisibility() { _fieldAutocomplete->hide(); _field->hide(); _fieldBarCancel->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _attachEmoji->hide(); _silent->hide(); _historyToEnd->hide(); @@ -4561,13 +4567,11 @@ void HistoryWidget::updateControlsVisibility() { _send->hide(); if (_inlineBotCancel) _inlineBotCancel->hide(); _botStart->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _silent->hide(); _kbScroll.hide(); _fieldBarCancel->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _attachEmoji->hide(); _botKeyboardShow->hide(); _botKeyboardHide->hide(); @@ -4597,8 +4601,7 @@ void HistoryWidget::updateControlsVisibility() { _botKeyboardShow->hide(); _botKeyboardHide->hide(); _botCommandStart->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _silent->hide(); _kbScroll.hide(); _fieldBarCancel->hide(); @@ -4626,8 +4629,7 @@ void HistoryWidget::updateControlsVisibility() { _botKeyboardShow->hide(); _botKeyboardHide->hide(); _botCommandStart->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _silent->hide(); if (_kbShown) { _kbScroll.show(); @@ -4664,13 +4666,7 @@ void HistoryWidget::updateControlsVisibility() { } } } - if (cDefaultAttach() == dbidaPhoto) { - _attachDocument->hide(); - _attachPhoto->show(); - } else { - _attachDocument->show(); - _attachPhoto->hide(); - } + _attachToggle->show(); if (hasSilentToggle()) { _silent->show(); } else { @@ -4696,13 +4692,11 @@ void HistoryWidget::updateControlsVisibility() { _botStart->hide(); _joinChannel->hide(); _muteUnmute->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _silent->hide(); _kbScroll.hide(); _fieldBarCancel->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _attachEmoji->hide(); _botKeyboardShow->hide(); _botKeyboardHide->hide(); @@ -5456,8 +5450,7 @@ void HistoryWidget::showAnimated(Window::SlideDirection direction, const Window: _kbScroll.hide(); _reportSpamPanel.hide(); _historyToEnd->hide(); - _attachDocument->hide(); - _attachPhoto->hide(); + _attachToggle->hide(); _attachEmoji->hide(); _fieldAutocomplete->hide(); _silent->hide(); @@ -5545,7 +5538,7 @@ void HistoryWidget::animStop() { } void HistoryWidget::step_record(float64 ms, bool timer) { - float64 dt = ms / st::btnSend.duration; + float64 dt = ms / st::historyComposeButton.duration; if (dt >= 1 || !_send->isHidden() || isBotStart() || isBlocked()) { _a_record.stop(); a_recordDown.finish(); @@ -5571,15 +5564,13 @@ void HistoryWidget::step_recording(float64 ms, bool timer) { } else { a_recordingLevel.update(dt, anim::linear); } - if (timer) update(_attachDocument->geometry()); + if (timer) update(_attachToggle->geometry()); } void HistoryWidget::onPhotoSelect() { if (!_history) return; - _attachDocument->clearState(); - _attachDocument->hide(); - _attachPhoto->show(); + _attachToggle->setIcon(&st::historyAttachPhotoIcon, &st::historyAttachPhotoIconOver); _attachType->hideFast(); if (cDefaultAttach() != dbidaPhoto) { @@ -5605,9 +5596,7 @@ void HistoryWidget::onPhotoSelect() { void HistoryWidget::onDocumentSelect() { if (!_history) return; - _attachPhoto->clearState(); - _attachPhoto->hide(); - _attachDocument->show(); + _attachToggle->setIcon(&st::historyAttachFileIcon, &st::historyAttachFileIconOver); _attachType->hideFast(); if (cDefaultAttach() != dbidaDocument) { @@ -5663,7 +5652,7 @@ void HistoryWidget::mouseMoveEvent(QMouseEvent *e) { QPoint pos(e ? e->pos() : mapFromGlobal(QCursor::pos())); bool inRecord = _send->geometry().contains(pos); bool inField = pos.y() >= (_scroll.y() + _scroll.height()) && pos.y() < height() && pos.x() >= 0 && pos.x() < width(); - bool inReplyEdit = QRect(st::historyReplySkip, _field->y() - st::sendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId()); + bool inReplyEdit = QRect(st::historyReplySkip, _field->y() - st::historySendPadding - st::historyReplyHeight, width() - st::historyReplySkip - _fieldBarCancel->width(), st::historyReplyHeight).contains(pos) && (_editMsgId || replyToId()); bool inPinnedMsg = QRect(0, 0, width(), st::historyReplyHeight).contains(pos) && _pinnedBar; if (inRecord != _inRecord) { _inRecord = inRecord; @@ -5692,7 +5681,7 @@ void HistoryWidget::leaveToChildEvent(QEvent *e, QWidget *child) { // e -- from void HistoryWidget::mouseReleaseEvent(QMouseEvent *e) { if (_replyForwardPressed) { _replyForwardPressed = false; - update(0, _field->y() - st::sendPadding - st::historyReplyHeight, width(), st::historyReplyHeight); + update(0, _field->y() - st::historySendPadding - st::historyReplyHeight, width(), st::historyReplyHeight); } if (_attachDrag != DragStateNone || !_attachDragPhoto->isHidden() || !_attachDragDocument->isHidden()) { _attachDrag = DragStateNone; @@ -6417,47 +6406,47 @@ void HistoryWidget::updateOnlineDisplayTimer() { } void HistoryWidget::moveFieldControls() { - int w = width(), h = height(), right = w, bottom = h, keyboardHeight = 0; - int maxKeyboardHeight = st::historyComposeFieldMaxHeight - _field->height(); + auto keyboardHeight = 0; + auto bottom = height(); + auto maxKeyboardHeight = st::historyComposeFieldMaxHeight - _field->height(); _keyboard.resizeToWidth(width(), maxKeyboardHeight); if (_kbShown) { keyboardHeight = qMin(_keyboard.height(), maxKeyboardHeight); bottom -= keyboardHeight; - _kbScroll.setGeometry(0, bottom, w, keyboardHeight); + _kbScroll.setGeometry(0, bottom, width(), keyboardHeight); } -// _attachType ----------------------------------------------------------- _emojiPan --------- _fieldBarCancel +// _attachToggle --------------------------------------------------------- _emojiPan --------- _fieldBarCancel // (_attachDocument|_attachPhoto) _field (_silent|_cmdStart|_kbShow) (_kbHide|_attachEmoji) [_broadcast] _send // (_botStart|_unblock|_joinChannel|_muteUnmute) - int buttonsBottom = bottom - _attachDocument->height(); - _attachDocument->move(0, buttonsBottom); - _attachPhoto->move(0, buttonsBottom); - _field->move(_attachDocument->width(), bottom - _field->height() - st::sendPadding); - _send->move(right - _send->width(), buttonsBottom); + auto buttonsBottom = bottom - _attachToggle->height(); + auto left = 0; + _attachToggle->moveToLeft(left, buttonsBottom); left += _attachToggle->width(); + _field->moveToLeft(left, bottom - _field->height() - st::historySendPadding); + auto right = st::historySendRight; + _send->moveToRight(right, buttonsBottom); right += _send->width(); if (_inlineBotCancel) _inlineBotCancel->move(_send->pos()); - right -= _send->width(); - _attachEmoji->move(right - _attachEmoji->width(), buttonsBottom); - _botKeyboardHide->move(right - _botKeyboardHide->width(), buttonsBottom); - right -= _attachEmoji->width(); - _botKeyboardShow->move(right - _botKeyboardShow->width(), buttonsBottom); - _botCommandStart->move(right - _botCommandStart->width(), buttonsBottom); - _silent->move(right - _silent->width(), buttonsBottom); + _attachEmoji->moveToRight(right, buttonsBottom); + _botKeyboardHide->moveToRight(right, buttonsBottom); right += _botKeyboardHide->width(); + _botKeyboardShow->moveToRight(right, buttonsBottom); + _botCommandStart->moveToRight(right, buttonsBottom); + _silent->moveToRight(right, buttonsBottom); - right = w; - _fieldBarCancel->move(right - _fieldBarCancel->width(), _field->y() - st::sendPadding - _fieldBarCancel->height()); - _attachType->move(0, _attachDocument->y() - _attachType->height()); + _fieldBarCancel->moveToRight(0, _field->y() - st::historySendPadding - _fieldBarCancel->height()); + _attachType->moveToLeft(0, _attachToggle->y() - _attachType->height()); _emojiPan->moveBottom(_attachEmoji->y()); - _botStart->setGeometry(0, bottom - _botStart->height(), w, _botStart->height()); - _unblock->setGeometry(0, bottom - _unblock->height(), w, _unblock->height()); - _joinChannel->setGeometry(0, bottom - _joinChannel->height(), w, _joinChannel->height()); - _muteUnmute->setGeometry(0, bottom - _muteUnmute->height(), w, _muteUnmute->height()); + auto fullWidthButtonRect = QRect(0, bottom - _botStart->height(), width(), _botStart->height()); + _botStart->setGeometry(fullWidthButtonRect); + _unblock->setGeometry(fullWidthButtonRect); + _joinChannel->setGeometry(fullWidthButtonRect); + _muteUnmute->setGeometry(fullWidthButtonRect); } void HistoryWidget::updateFieldSize() { bool kbShowShown = _history && !_kbShown && _keyboard.hasMarkup(); - int fieldWidth = width() - _attachDocument->width(); + int fieldWidth = width() - _attachToggle->width(); fieldWidth -= _send->width(); fieldWidth -= _attachEmoji->width(); if (kbShowShown) fieldWidth -= _botKeyboardShow->width(); @@ -6525,14 +6514,14 @@ void HistoryWidget::onCheckFieldAutocomplete() { void HistoryWidget::updateFieldPlaceholder() { if (_editMsgId) { _field->setPlaceholder(lang(lng_edit_message_text)); - _send->setText(lang(lng_settings_save)); +// _send->setText(lang(lng_settings_save)); } else { if (_inlineBot && _inlineBot != LookingUpInlineBot) { _field->setPlaceholder(_inlineBot->botInfo->inlinePlaceholder.mid(1), _inlineBot->username.size() + 2); } else { _field->setPlaceholder(lang((_history && _history->isChannel() && !_history->isMegagroup()) ? (_silent->checked() ? lng_broadcast_silent_ph : lng_broadcast_ph) : lng_message_ph)); } - _send->setText(lang(lng_send_button)); +// _send->setText(lang(lng_send_button)); } } @@ -7097,7 +7086,7 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh newScrollHeight -= _unblock->height(); } else { if (_canSendMessages) { - newScrollHeight -= (_field->height() + 2 * st::sendPadding); + newScrollHeight -= (_field->height() + 2 * st::historySendPadding); } if (_editMsgId || replyToId() || readyToForward() || (_previewData && _previewData->pendingTill >= 0)) { newScrollHeight -= st::historyReplyHeight; @@ -7400,7 +7389,7 @@ void HistoryWidget::updateToEndVisibility() { } void HistoryWidget::mousePressEvent(QMouseEvent *e) { - _replyForwardPressed = QRect(0, _field->y() - st::sendPadding - st::historyReplyHeight, st::historyReplySkip, st::historyReplyHeight).contains(e->pos()); + _replyForwardPressed = QRect(0, _field->y() - st::historySendPadding - st::historyReplyHeight, st::historyReplySkip, st::historyReplyHeight).contains(e->pos()); if (_replyForwardPressed && !_fieldBarCancel->isHidden()) { updateField(); } else if (_inRecord && cHasAudioCapture()) { @@ -8480,7 +8469,7 @@ void HistoryWidget::updateField() { } void HistoryWidget::drawField(Painter &p, const QRect &rect) { - int32 backy = _field->y() - st::sendPadding, backh = _field->height() + 2 * st::sendPadding; + int32 backy = _field->y() - st::historySendPadding, backh = _field->height() + 2 * st::historySendPadding; Text *from = 0, *text = 0; bool serviceColor = false, hasForward = readyToForward(); ImagePtr preview; @@ -8644,20 +8633,20 @@ void HistoryWidget::drawRecording(Painter &p) { p.setRenderHint(QPainter::HighQualityAntialiasing); float64 delta = qMin(float64(a_recordingLevel.current()) / 0x4000, 1.); int32 d = 2 * qRound(st::historyRecordSignalMin + (delta * (st::historyRecordSignalMax - st::historyRecordSignalMin))); - p.drawEllipse(_attachPhoto->x() + (_attachEmoji->width() - d) / 2, _attachPhoto->y() + (_attachPhoto->height() - d) / 2, d, d); + p.drawEllipse(_attachToggle->x() + (_attachEmoji->width() - d) / 2, _attachToggle->y() + (_attachToggle->height() - d) / 2, d, d); p.setRenderHint(QPainter::HighQualityAntialiasing, false); QString duration = formatDurationText(_recordingSamples / AudioVoiceMsgFrequency); p.setFont(st::historyRecordFont); p.setPen(st::historyRecordDurationFg); - p.drawText(_attachPhoto->x() + _attachEmoji->width(), _attachPhoto->y() + st::historyRecordTextTop + st::historyRecordFont->ascent, duration); + p.drawText(_attachToggle->x() + _attachEmoji->width(), _attachToggle->y() + st::historyRecordTextTop + st::historyRecordFont->ascent, duration); - int32 left = _attachPhoto->x() + _attachEmoji->width() + st::historyRecordFont->width(duration) + ((_send->width() - st::historyRecordVoice.width()) / 2); + int32 left = _attachToggle->x() + _attachEmoji->width() + st::historyRecordFont->width(duration) + ((_send->width() - st::historyRecordVoice.width()) / 2); int32 right = width() - _send->width(); p.setPen(anim::pen(st::historyRecordCancel, st::historyRecordCancelActive, a_recordCancelActive.current())); - p.drawText(left + (right - left - _recordCancelWidth) / 2, _attachPhoto->y() + st::historyRecordTextTop + st::historyRecordFont->ascent, lang(lng_record_cancel)); + p.drawText(left + (right - left - _recordCancelWidth) / 2, _attachToggle->y() + st::historyRecordTextTop + st::historyRecordFont->ascent, lang(lng_record_cancel)); } void HistoryWidget::drawPinnedBar(Painter &p) { @@ -8766,12 +8755,12 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { } if (_scroll.isHidden()) { p.setClipRect(_scroll.geometry()); - HistoryLayout::paintEmpty(p, width(), height() - _field->height() - 2 * st::sendPadding); + HistoryLayout::paintEmpty(p, width(), height() - _field->height() - 2 * st::historySendPadding); } } else { style::font font(st::msgServiceFont); int32 w = font->width(lang(lng_willbe_history)) + st::msgPadding.left() + st::msgPadding.right(), h = font->height + st::msgServicePadding.top() + st::msgServicePadding.bottom() + 2; - QRect tr((width() - w) / 2, (height() - _field->height() - 2 * st::sendPadding - h) / 2, w, h); + QRect tr((width() - w) / 2, (height() - _field->height() - 2 * st::historySendPadding - h) / 2, w, h); HistoryLayout::ServiceMessagePainter::paintBubble(p, tr.x(), tr.y(), tr.width(), tr.height()); p.setPen(st::msgServiceColor->p); diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 8af783d46c..1af2d8003c 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -1099,15 +1099,14 @@ private: ReportSpamPanel _reportSpamPanel; - ChildWidget _send; + ChildWidget _send; ChildWidget _unblock; ChildWidget _botStart; ChildWidget _joinChannel; ChildWidget _muteUnmute; mtpRequestId _unblockRequest = 0; mtpRequestId _reportSpamRequest = 0; - ChildWidget _attachDocument; - ChildWidget _attachPhoto; + ChildWidget _attachToggle; ChildWidget _attachEmoji; ChildWidget _botKeyboardShow; ChildWidget _botKeyboardHide; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 3f9ff7e99c..80c4cc1d55 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -22,7 +22,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "mainwidget.h" #include "styles/style_dialogs.h" -#include "styles/style_history.h" #include "ui/buttons/peer_avatar_button.h" #include "ui/buttons/round_button.h" #include "ui/widgets/shadow.h" @@ -76,7 +75,7 @@ MainWidget::MainWidget(QWidget *parent) : TWidget(parent) , _topBar(this) , _playerPlaylist(this, Media::Player::Panel::Layout::OnlyPlaylist) , _playerPanel(this, Media::Player::Panel::Layout::Full) -, _mediaType(this, st::historyAttachDropdownMenu) +, _mediaType(this, st::defaultDropdownMenu) , _api(new ApiWrap(this)) { MTP::setGlobalDoneHandler(rpcDone(&MainWidget::updateReceived)); _ptsWaiter.setRequesting(true); @@ -1386,12 +1385,12 @@ void MainWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) { for (int32 i = 0; i < OverviewCount; ++i) { if (mask & (1 << i)) { switch (i) { - case OverviewPhotos: _mediaType->addAction(lang(lng_media_type_photos), this, SLOT(onPhotosSelect()), &st::historyMediaTypePhoto, &st::historyMediaTypePhotoOver); break; - case OverviewVideos: _mediaType->addAction(lang(lng_media_type_videos), this, SLOT(onVideosSelect()), &st::historyMediaTypeVideo, &st::historyMediaTypeVideoOver); break; - case OverviewMusicFiles: _mediaType->addAction(lang(lng_media_type_songs), this, SLOT(onSongsSelect()), &st::historyMediaTypeSong, &st::historyMediaTypeSongOver); break; - case OverviewFiles: _mediaType->addAction(lang(lng_media_type_files), this, SLOT(onDocumentsSelect()), &st::historyMediaTypeFile, &st::historyMediaTypeFileOver); break; - case OverviewVoiceFiles: _mediaType->addAction(lang(lng_media_type_audios), this, SLOT(onAudiosSelect()), &st::historyMediaTypeVoice, &st::historyMediaTypeVoiceOver); break; - case OverviewLinks: _mediaType->addAction(lang(lng_media_type_links), this, SLOT(onLinksSelect()), &st::historyMediaTypeLink, &st::historyMediaTypeLinkOver); break; + case OverviewPhotos: _mediaType->addAction(lang(lng_media_type_photos), this, SLOT(onPhotosSelect())); break; + case OverviewVideos: _mediaType->addAction(lang(lng_media_type_videos), this, SLOT(onVideosSelect())); break; + case OverviewMusicFiles: _mediaType->addAction(lang(lng_media_type_songs), this, SLOT(onSongsSelect())); break; + case OverviewFiles: _mediaType->addAction(lang(lng_media_type_files), this, SLOT(onDocumentsSelect())); break; + case OverviewVoiceFiles: _mediaType->addAction(lang(lng_media_type_audios), this, SLOT(onAudiosSelect())); break; + case OverviewLinks: _mediaType->addAction(lang(lng_media_type_links), this, SLOT(onLinksSelect())); break; } } } diff --git a/Telegram/SourceFiles/settings/settings_scale_widget.cpp b/Telegram/SourceFiles/settings/settings_scale_widget.cpp index 710bd4a390..a2971788ea 100644 --- a/Telegram/SourceFiles/settings/settings_scale_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_widget.cpp @@ -81,10 +81,6 @@ void ScaleWidget::onAutoChosen() { } void ScaleWidget::setScale(DBIScale newScale) { - if (cConfigScale() == newScale) return; - - cSetConfigScale(newScale); - Local::writeSettings(); if (newScale == dbisAuto && !_auto->checked()) { _auto->setChecked(true); } else if (newScale != dbisAuto && _auto->checked()) { @@ -94,10 +90,17 @@ void ScaleWidget::setScale(DBIScale newScale) { if (_scale->activeSection() != newScale - 1) { _scale->setActiveSection(newScale - 1); } - if (cEvalScale(cConfigScale()) != cEvalScale(cRealScale())) { - auto box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), st::defaultBoxButton, lang(lng_settings_restart_later)); + + if (cEvalScale(newScale) != cEvalScale(cRealScale())) { + _newScale = newScale; + + auto box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), st::defaultBoxButton, lang(lng_cancel)); connect(box, SIGNAL(confirmed()), this, SLOT(onRestartNow())); + connect(box, SIGNAL(cancelled()), this, SLOT(onCancel())); Ui::showLayer(box); + } else { + cSetConfigScale(newScale); + Local::writeSettings(); } } @@ -116,7 +119,13 @@ void ScaleWidget::scaleChanged() { } void ScaleWidget::onRestartNow() { + cSetConfigScale(_newScale); + Local::writeSettings(); App::restart(); } +void ScaleWidget::onCancel() { + setScale(cRealScale()); +} + } // namespace Settings diff --git a/Telegram/SourceFiles/settings/settings_scale_widget.h b/Telegram/SourceFiles/settings/settings_scale_widget.h index 1f975a7265..c75cacf6f7 100644 --- a/Telegram/SourceFiles/settings/settings_scale_widget.h +++ b/Telegram/SourceFiles/settings/settings_scale_widget.h @@ -38,6 +38,7 @@ public: private slots: void onAutoChosen(); void onRestartNow(); + void onCancel(); private: void scaleChanged(); @@ -47,6 +48,8 @@ private: ChildWidget _auto = { nullptr }; ChildWidget _scale = { nullptr }; + DBIScale _newScale = dbisAuto; + }; } // namespace Settings diff --git a/Telegram/SourceFiles/ui/buttons/history_down_button.cpp b/Telegram/SourceFiles/ui/buttons/history_down_button.cpp index bb1fc740bb..832f890402 100644 --- a/Telegram/SourceFiles/ui/buttons/history_down_button.cpp +++ b/Telegram/SourceFiles/ui/buttons/history_down_button.cpp @@ -143,7 +143,7 @@ EmojiButton::EmojiButton(QWidget *parent, const style::IconButton &st) : Button( void EmojiButton::paintEvent(QPaintEvent *e) { Painter p(this); - uint64 ms = getms(); + auto ms = getms(); p.fillRect(e->rect(), st::historyComposeAreaBg); diff --git a/Telegram/SourceFiles/ui/widgets/widgets.style b/Telegram/SourceFiles/ui/widgets/widgets.style index 40604159d4..2945416cd1 100644 --- a/Telegram/SourceFiles/ui/widgets/widgets.style +++ b/Telegram/SourceFiles/ui/widgets/widgets.style @@ -206,7 +206,7 @@ discreteSliderDuration: 200; defaultMenuArrow: icon {{ "dropdown_submenu_arrow", #373737 }}; defaultMenu: Menu { - skip: 5px; + skip: 8px; itemBg: windowBg; itemBgOver: windowOverBg;