From 5ffc5dd2181bde575e8684cd7da0812469c083b8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Jun 2016 14:18:55 +0300 Subject: [PATCH] Blue online in top bar in conversation with user. Profile styles fix. --- Telegram/Resources/basic.style | 24 ++++++++++++------- Telegram/SourceFiles/boxes/addcontactbox.cpp | 2 +- Telegram/SourceFiles/boxes/confirmbox.cpp | 8 +++---- Telegram/SourceFiles/boxes/connectionbox.cpp | 18 +++++++------- Telegram/SourceFiles/boxes/photosendbox.cpp | 2 +- Telegram/SourceFiles/historywidget.cpp | 11 +++++---- Telegram/SourceFiles/historywidget.h | 3 ++- Telegram/SourceFiles/profile/profile.style | 7 ++++-- .../profile/profile_settings_widget.cpp | 4 ++-- Telegram/SourceFiles/settingswidget.cpp | 2 +- 10 files changed, 47 insertions(+), 34 deletions(-) diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index a4b20b3f7..e938985e9 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -161,7 +161,7 @@ defaultLeftOutlineButton: OutlineButton { textFgOver: windowActiveTextFg; font: normalFont; - padding: margins(11px, 6px, 11px, 6px); + padding: margins(11px, 5px, 11px, 5px); } attentionLeftOutlineButton: OutlineButton(defaultLeftOutlineButton) { outlineFgOver: #e43f3f; @@ -237,19 +237,24 @@ defaultCheckbox: Checkbox { checkFgOver: #b3b3b3; checkFgActive: #40ace3; - width: -46px; + width: -44px; height: 22px; - textPosition: point(34px, 0px); + textPosition: point(32px, 2px); diameter: 22px; thickness: 2px; checkIcon: icon { { "default_checkbox_check", #ffffff, point(4px, 7px) } }; - font: boxTextFont; + font: normalFont; duration: 120; } +defaultBoxCheckbox: Checkbox { + width: -46px; + textPosition: point(34px, 0px); + font: boxTextFont; +} defaultRadiobutton: Radiobutton { textFg: black; textBg: white; @@ -397,8 +402,9 @@ titleRed: #ee4928; titleGray: #777; titleGreen: #41a903; -titleStatusColor: #999; -titleTypingColor: #0080c0; +titleStatusFg: #999; +titleStatusActiveFg: #0080c0; +titleTypingFg: #0080c0; statusFont: font(fsize); versionColor: #777; @@ -1561,7 +1567,7 @@ contactsNewItemTop: 18px; contactsNewItemFg: #4b82af; contactsAboutBg: #f7f7f7; contactsAboutShadow: #0000001F; -contactsAdminCheckbox: Checkbox(defaultCheckbox) { +contactsAdminCheckbox: Checkbox(defaultBoxCheckbox) { font: semiboldFont; textBg: #f7f7f7; textPosition: point(34px, 1px); @@ -1638,8 +1644,8 @@ confirmCompressedSkip: 10px; profileMaxWidth: 410px; profilePadding: margins(28px, 30px, 28px, 0px); -profileOnlineColor: titleTypingColor; -profileOfflineColor: titleStatusColor; +profileOnlineFg: titleStatusActiveFg; +profileOfflineFg: titleStatusFg; membersPadding: margins(0px, 10px, 0px, 10px); diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index 5b1024489..4dae334a5 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -1161,7 +1161,7 @@ EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox() , _cancel(this, lang(lng_cancel), st::cancelBoxButton) , _title(this, st::defaultInputField, lang(lng_dlg_new_channel_name), _channel->name) , _description(this, st::newGroupDescription, lang(lng_create_group_description), _channel->about()) -, _sign(this, lang(lng_edit_sign_messages), channel->addsSignature()) +, _sign(this, lang(lng_edit_sign_messages), channel->addsSignature(), st::defaultBoxCheckbox) , _publicLink(this, lang(channel->isPublic() ? lng_profile_edit_public_link : lng_profile_create_public_link), st::defaultBoxLinkButton) , _saveTitleRequestId(0) , _saveDescriptionRequestId(0) diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index 3b2dc1cce..2d5937a0f 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -382,7 +382,7 @@ PinMessageBox::PinMessageBox(ChannelData *channel, MsgId msgId) : AbstractBox(st , _channel(channel) , _msgId(msgId) , _text(this, lang(lng_pinned_pin_sure), FlatLabel::InitType::Simple, st::boxLabel) -, _notify(this, lang(lng_pinned_notify), true) +, _notify(this, lang(lng_pinned_notify), true, st::defaultBoxCheckbox) , _pin(this, lang(lng_pinned_pin), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { _text.resizeToWidth(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()); @@ -441,9 +441,9 @@ RichDeleteMessageBox::RichDeleteMessageBox(ChannelData *channel, UserData *from, , _from(from) , _msgId(msgId) , _text(this, lang(lng_selected_delete_sure_this), FlatLabel::InitType::Simple, st::boxLabel) -, _banUser(this, lang(lng_ban_user), false) -, _reportSpam(this, lang(lng_report_spam), false) -, _deleteAll(this, lang(lng_delete_all_from), false) +, _banUser(this, lang(lng_ban_user), false, st::defaultBoxCheckbox) +, _reportSpam(this, lang(lng_report_spam), false, st::defaultBoxCheckbox) +, _deleteAll(this, lang(lng_delete_all_from), false, st::defaultBoxCheckbox) , _delete(this, lang(lng_box_delete), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { t_assert(_channel != nullptr); diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index 8f2fc96b0..a08c723a4 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -35,7 +35,7 @@ ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth) , _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto)) , _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy)) , _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)) -, _tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6()) +, _tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6(), st::defaultBoxCheckbox) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { @@ -223,14 +223,14 @@ void ConnectionBox::onSave() { } AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth) -, _photoPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadPhoto() & dbiadNoPrivate)) -, _photoGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadPhoto() & dbiadNoGroups)) -, _audioPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadAudio() & dbiadNoPrivate)) -, _audioGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadAudio() & dbiadNoGroups)) -, _gifPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadGif() & dbiadNoPrivate)) -, _gifGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadGif() & dbiadNoGroups)) -, _gifPlay(this, lang(lng_media_auto_play), cAutoPlayGif()) -, _sectionHeight(st::boxTitleHeight + 2 * (st::defaultCheckbox.height + st::setLittleSkip)) +, _photoPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadPhoto() & dbiadNoPrivate), st::defaultBoxCheckbox) +, _photoGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadPhoto() & dbiadNoGroups), st::defaultBoxCheckbox) +, _audioPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadAudio() & dbiadNoPrivate), st::defaultBoxCheckbox) +, _audioGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadAudio() & dbiadNoGroups), st::defaultBoxCheckbox) +, _gifPrivate(this, lang(lng_media_auto_private_chats), !(cAutoDownloadGif() & dbiadNoPrivate), st::defaultBoxCheckbox) +, _gifGroups(this, lang(lng_media_auto_groups), !(cAutoDownloadGif() & dbiadNoGroups), st::defaultBoxCheckbox) +, _gifPlay(this, lang(lng_media_auto_play), cAutoPlayGif(), st::defaultBoxCheckbox) +, _sectionHeight(st::boxTitleHeight + 2 * (st::defaultBoxCheckbox.height + st::setLittleSkip)) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp index b8c9608b7..073c917fd 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.cpp +++ b/Telegram/SourceFiles/boxes/photosendbox.cpp @@ -31,7 +31,7 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW , _animated(false) , _caption(this, st::confirmCaptionArea, lang(lng_photo_caption)) , _compressedFromSettings(_file->type == PrepareAuto) -, _compressed(this, lang(lng_send_image_compressed), _compressedFromSettings ? cCompressPastedImage() : true) +, _compressed(this, lang(lng_send_image_compressed), _compressedFromSettings ? cCompressPastedImage() : true, st::defaultBoxCheckbox) , _send(this, lang(lng_send_button), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) , _thumbx(0) diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 29a891ded..a4a91a941 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -5958,10 +5958,10 @@ void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { QRect rectForName(st::topBarForwardPadding.left() + increaseLeft, st::topBarForwardPadding.top(), width() - decreaseWidth - st::topBarForwardPadding.left() - st::topBarForwardPadding.right(), st::msgNameFont->height); p.setFont(st::dialogsTextFont); if (_history->typing.isEmpty() && _history->sendActions.isEmpty()) { - p.setPen(st::titleStatusColor->p); + p.setPen(_titlePeerTextOnline ? st::titleStatusActiveFg : st::titleStatusFg); p.drawText(rectForName.x(), st::topBarHeight - st::topBarForwardPadding.bottom() - st::dialogsTextFont->height + st::dialogsTextFont->ascent, _titlePeerText); } else { - p.setPen(st::titleTypingColor->p); + p.setPen(st::titleTypingFg); _history->typingText.drawElided(p, rectForName.x(), st::topBarHeight - st::topBarForwardPadding.bottom() - st::dialogsTextFont->height, rectForName.width()); } @@ -5990,8 +5990,10 @@ void HistoryWidget::updateOnlineDisplay(int32 x, int32 w) { QString text; int32 t = unixtime(); - if (_peer->isUser()) { - text = App::onlineText(_peer->asUser(), t); + bool titlePeerTextOnline = false; + if (auto user = _peer->asUser()) { + text = App::onlineText(user, t); + titlePeerTextOnline = App::onlineColorUse(user, t); } else if (_peer->isChat()) { ChatData *chat = _peer->asChat(); if (!chat->amIn()) { @@ -6037,6 +6039,7 @@ void HistoryWidget::updateOnlineDisplay(int32 x, int32 w) { } if (_titlePeerText != text) { _titlePeerText = text; + _titlePeerTextOnline = titlePeerTextOnline; _titlePeerTextWidth = st::dialogsTextFont->width(_titlePeerText); if (App::main()) { App::main()->topBar()->update(); diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 1b1f92c20..4f0047210 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -1118,7 +1118,8 @@ private: uint64 _confirmWithTextId = 0; QString _titlePeerText; - int32 _titlePeerTextWidth = 0; + bool _titlePeerTextOnline = false; + int _titlePeerTextWidth = 0; Animation _a_show; QPixmap _cacheUnder, _cacheOver; diff --git a/Telegram/SourceFiles/profile/profile.style b/Telegram/SourceFiles/profile/profile.style index 46a7c8564..d61ba0ba8 100644 --- a/Telegram/SourceFiles/profile/profile.style +++ b/Telegram/SourceFiles/profile/profile.style @@ -118,8 +118,8 @@ profileBlockWideWidthMin: 300px; profileBlockWideWidthMax: 340px; profileBlockMarginTop: 14px; profileBlockMarginRight: 10px; -profileBlockMarginBottom: 4px; -profileBlockTitleHeight: 25px; +profileBlockMarginBottom: 7px; +profileBlockTitleHeight: 24px; profileBlockTitleFont: font(14px semibold); profileBlockTitleFg: #333333; profileBlockTitlePosition: point(24px, 0px); @@ -137,6 +137,9 @@ profileBlockOneLineTextPart: flatLabel(profileBlockTextPart) { profileBlockOneLineSkip: 9px; profileBlockOneLineWidthMax: 240px; +profileEnableNotificationsTop: 7px; +profileSettingsBlockSkip: 8px; + profileInviteLinkText: flatLabel(profileBlockTextPart) { width: 1px; // Required for BreakEverywhere } diff --git a/Telegram/SourceFiles/profile/profile_settings_widget.cpp b/Telegram/SourceFiles/profile/profile_settings_widget.cpp index 3fe1c033e..b40342f22 100644 --- a/Telegram/SourceFiles/profile/profile_settings_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_settings_widget.cpp @@ -78,10 +78,10 @@ void SettingsWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { } int SettingsWidget::resizeGetHeight(int newWidth) { - int newHeight = contentTop(); + int newHeight = contentTop() + st::profileEnableNotificationsTop; _enableNotifications->moveToLeft(st::profileBlockTitlePosition.x(), newHeight); - newHeight += _enableNotifications->height() + st::profileBlockOneLineSkip; + newHeight += _enableNotifications->height() + st::profileSettingsBlockSkip; auto moveLink = [&newHeight, newWidth](Ui::LeftOutlineButton *button) { if (!button) return; diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index a8229447b..73e56a782 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -426,7 +426,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) { p.setFont(st::setStatusFont->f); bool connecting = App::wnd()->connectingVisible(); - p.setPen((connecting ? st::profileOfflineColor : st::profileOnlineColor)->p); + p.setPen((connecting ? st::profileOfflineFg : st::profileOnlineFg)->p); p.drawText(_uploadPhoto.x() + st::setStatusLeft, top + st::setStatusTop + st::setStatusFont->ascent, lang(connecting ? lng_status_connecting : lng_status_online)); top += st::setPhotoSize;