mirror of https://github.com/procxx/kepka.git
Add call button to Info::Profile top bar.
This commit is contained in:
parent
355747d7bf
commit
79398fe6cf
|
@ -524,7 +524,8 @@ void UserData::setCallsStatus(CallsStatus callsStatus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserData::hasCalls() const {
|
bool UserData::hasCalls() const {
|
||||||
return (callsStatus() != CallsStatus::Disabled) && (callsStatus() != CallsStatus::Unknown);
|
return (callsStatus() != CallsStatus::Disabled)
|
||||||
|
&& (callsStatus() != CallsStatus::Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatData::setPhoto(const MTPChatPhoto &photo) {
|
void ChatData::setPhoto(const MTPChatPhoto &photo) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "profile/profile_back_button.h"
|
#include "profile/profile_back_button.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
#include "styles/style_chat_helpers.h"
|
#include "styles/style_chat_helpers.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/send_files_box.h"
|
#include "boxes/send_files_box.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
|
|
|
@ -164,6 +164,10 @@ infoNotificationsActive: icon {{
|
||||||
"info_notifications",
|
"info_notifications",
|
||||||
windowBgActive
|
windowBgActive
|
||||||
}};
|
}};
|
||||||
|
infoTopBarCall: IconButton(infoTopBarNotifications) {
|
||||||
|
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
||||||
|
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
||||||
|
}
|
||||||
infoTopBarForward: IconButton(infoTopBarBack) {
|
infoTopBarForward: IconButton(infoTopBarBack) {
|
||||||
width: 46px;
|
width: 46px;
|
||||||
icon: icon {{ "info_media_forward", boxTitleCloseFg }};
|
icon: icon {{ "info_media_forward", boxTitleCloseFg }};
|
||||||
|
@ -227,6 +231,10 @@ infoLayerTopBarNotifications: IconButton(infoLayerTopBarMenu) {
|
||||||
iconOver: icon {{ "info_notifications", boxTitleCloseFgOver }};
|
iconOver: icon {{ "info_notifications", boxTitleCloseFgOver }};
|
||||||
iconPosition: point(5px, 11px);
|
iconPosition: point(5px, 11px);
|
||||||
}
|
}
|
||||||
|
infoLayerTopBarCall: IconButton(infoLayerTopBarNotifications) {
|
||||||
|
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
||||||
|
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
||||||
|
}
|
||||||
infoLayerTopBarForward: IconButton(infoLayerTopBarBack) {
|
infoLayerTopBarForward: IconButton(infoLayerTopBarBack) {
|
||||||
width: 45px;
|
width: 45px;
|
||||||
icon: icon {{ "info_media_forward", boxTitleCloseFg }};
|
icon: icon {{ "info_media_forward", boxTitleCloseFg }};
|
||||||
|
@ -615,3 +623,59 @@ editPeerInvitesSkip: 10px;
|
||||||
historyTopBarBack: IconButton(infoTopBarBack) {
|
historyTopBarBack: IconButton(infoTopBarBack) {
|
||||||
width: 52px;
|
width: 52px;
|
||||||
}
|
}
|
||||||
|
topBarHeight: 54px;
|
||||||
|
topBarMenuPosition: point(-2px, 35px);
|
||||||
|
topBarDuration: 200;
|
||||||
|
topBarBackward: icon {{ "title_back", menuIconFg }};
|
||||||
|
topBarForwardAlpha: 0.6;
|
||||||
|
topBarBack: icon {{ "title_back", lightButtonFg }};
|
||||||
|
topBarArrowPadding: margins(39px, 8px, 17px, 8px);
|
||||||
|
topBarMinPadding: 5px;
|
||||||
|
topBarButton: RoundButton(defaultLightButton) {
|
||||||
|
width: -18px;
|
||||||
|
padding: margins(0px, 10px, 12px, 10px);
|
||||||
|
}
|
||||||
|
topBarClearButton: RoundButton(defaultLightButton) {
|
||||||
|
width: -18px;
|
||||||
|
}
|
||||||
|
topBarSearch: IconButton {
|
||||||
|
width: 40px;
|
||||||
|
height: topBarHeight;
|
||||||
|
|
||||||
|
icon: icon {{ "top_bar_search", menuIconFg }};
|
||||||
|
iconOver: icon {{ "top_bar_search", menuIconFgOver }};
|
||||||
|
iconPosition: point(4px, 11px);
|
||||||
|
|
||||||
|
rippleAreaPosition: point(0px, 7px);
|
||||||
|
rippleAreaSize: 40px;
|
||||||
|
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||||
|
color: windowBgOver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topBarSkip: -2px;
|
||||||
|
topBarCallSkip: -1px;
|
||||||
|
topBarMenuToggle: IconButton(topBarSearch) {
|
||||||
|
width: 44px;
|
||||||
|
|
||||||
|
icon: icon {{ "title_menu_dots", menuIconFg }};
|
||||||
|
iconOver: icon {{ "title_menu_dots", menuIconFgOver }};
|
||||||
|
iconPosition: point(16px, 17px);
|
||||||
|
|
||||||
|
rippleAreaPosition: point(0px, 7px);
|
||||||
|
}
|
||||||
|
topBarCall: IconButton(topBarSearch) {
|
||||||
|
icon: icon {{ "top_bar_call", menuIconFg }};
|
||||||
|
iconOver: icon {{ "top_bar_call", menuIconFgOver }};
|
||||||
|
}
|
||||||
|
topBarInfo: IconButton(topBarSearch) {
|
||||||
|
icon: icon {{ "top_bar_profile", menuIconFg }};
|
||||||
|
iconOver: icon {{ "top_bar_profile", menuIconFgOver }};
|
||||||
|
}
|
||||||
|
topBarInfoActive: icon {{ "top_bar_profile", windowActiveTextFg }};
|
||||||
|
topBarActionSkip: 10px;
|
||||||
|
|
||||||
|
topBarInfoButton: UserpicButton(defaultUserpicButton) {
|
||||||
|
size: size(52px, topBarHeight);
|
||||||
|
photoSize: 42px;
|
||||||
|
photoPosition: point(2px, -1px);
|
||||||
|
}
|
||||||
|
|
|
@ -145,6 +145,9 @@ Ui::FadeWrap<Ui::RpWidget> *TopBar::pushButton(
|
||||||
return !selectionMode()
|
return !selectionMode()
|
||||||
&& !_searchModeEnabled;
|
&& !_searchModeEnabled;
|
||||||
});
|
});
|
||||||
|
weak->toggle(
|
||||||
|
!selectionMode() && !_searchModeEnabled,
|
||||||
|
anim::type::instant);
|
||||||
weak->widthValue()
|
weak->widthValue()
|
||||||
| rpl::start_with_next([this] {
|
| rpl::start_with_next([this] {
|
||||||
updateControlsGeometry(width());
|
updateControlsGeometry(width());
|
||||||
|
|
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "info/info_wrap_widget.h"
|
#include "info/info_wrap_widget.h"
|
||||||
|
|
||||||
#include <rpl/flatten_latest.h>
|
#include <rpl/flatten_latest.h>
|
||||||
|
#include <rpl/take.h>
|
||||||
#include <rpl/combine.h>
|
#include <rpl/combine.h>
|
||||||
#include "info/profile/info_profile_widget.h"
|
#include "info/profile/info_profile_widget.h"
|
||||||
#include "info/profile/info_profile_members.h"
|
#include "info/profile/info_profile_members.h"
|
||||||
|
@ -36,6 +37,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/dropdown_menu.h"
|
#include "ui/widgets/dropdown_menu.h"
|
||||||
#include "ui/wrap/fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "ui/search_field_controller.h"
|
#include "ui/search_field_controller.h"
|
||||||
|
#include "calls/calls_instance.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "window/window_slide_animation.h"
|
#include "window/window_slide_animation.h"
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
|
@ -303,7 +305,7 @@ void WrapWidget::setupTop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WrapWidget::createTopBar() {
|
void WrapWidget::createTopBar() {
|
||||||
auto wrapValue = wrap();
|
const auto wrapValue = wrap();
|
||||||
auto selectedItems = _topBar
|
auto selectedItems = _topBar
|
||||||
? _topBar->takeSelectedItems()
|
? _topBar->takeSelectedItems()
|
||||||
: SelectedItems(Section::MediaType::kCount);
|
: SelectedItems(Section::MediaType::kCount);
|
||||||
|
@ -350,6 +352,7 @@ void WrapWidget::createTopBar() {
|
||||||
if (_controller->section().type() == Section::Type::Profile
|
if (_controller->section().type() == Section::Type::Profile
|
||||||
&& (wrapValue != Wrap::Side || hasStackHistory())) {
|
&& (wrapValue != Wrap::Side || hasStackHistory())) {
|
||||||
addProfileMenuButton();
|
addProfileMenuButton();
|
||||||
|
addProfileCallsButton();
|
||||||
// addProfileNotificationsButton();
|
// addProfileNotificationsButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +376,38 @@ void WrapWidget::addProfileMenuButton() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WrapWidget::addProfileCallsButton() {
|
||||||
|
Expects(_topBar != nullptr);
|
||||||
|
|
||||||
|
const auto user = _controller->peer()->asUser();
|
||||||
|
if (!user || user->isSelf() || !Global::PhoneCallsEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notify::PeerUpdateValue(
|
||||||
|
user,
|
||||||
|
Notify::PeerUpdate::Flag::UserHasCalls
|
||||||
|
) | rpl::filter([=] {
|
||||||
|
return user->hasCalls();
|
||||||
|
}) | rpl::take(
|
||||||
|
1
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
_topBar->addButton(
|
||||||
|
base::make_unique_q<Ui::IconButton>(
|
||||||
|
_topBar,
|
||||||
|
(wrap() == Wrap::Layer
|
||||||
|
? st::infoLayerTopBarCall
|
||||||
|
: st::infoTopBarCall))
|
||||||
|
)->addClickHandler([=] {
|
||||||
|
Calls::Current().startOutgoingCall(user);
|
||||||
|
});
|
||||||
|
}, _topBar->lifetime());
|
||||||
|
|
||||||
|
if (user && user->callsStatus() == UserData::CallsStatus::Unknown) {
|
||||||
|
user->updateFull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WrapWidget::addProfileNotificationsButton() {
|
void WrapWidget::addProfileNotificationsButton() {
|
||||||
Expects(_topBar != nullptr);
|
Expects(_topBar != nullptr);
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,7 @@ private:
|
||||||
bool requireTopBarSearch() const;
|
bool requireTopBarSearch() const;
|
||||||
|
|
||||||
void addProfileMenuButton();
|
void addProfileMenuButton();
|
||||||
|
void addProfileCallsButton();
|
||||||
void addProfileNotificationsButton();
|
void addProfileNotificationsButton();
|
||||||
void showProfileMenu();
|
void showProfileMenu();
|
||||||
|
|
||||||
|
@ -205,6 +206,7 @@ private:
|
||||||
object_ptr<Ui::RpWidget> _topBarSurrogate = { nullptr };
|
object_ptr<Ui::RpWidget> _topBarSurrogate = { nullptr };
|
||||||
Animation _topBarOverrideAnimation;
|
Animation _topBarOverrideAnimation;
|
||||||
bool _topBarOverrideShown = false;
|
bool _topBarOverrideShown = false;
|
||||||
|
|
||||||
object_ptr<Ui::FadeShadow> _topShadow;
|
object_ptr<Ui::FadeShadow> _topShadow;
|
||||||
base::unique_qptr<Ui::IconButton> _topBarMenuToggle;
|
base::unique_qptr<Ui::IconButton> _topBarMenuToggle;
|
||||||
base::unique_qptr<Ui::DropdownMenu> _topBarMenu;
|
base::unique_qptr<Ui::DropdownMenu> _topBarMenu;
|
||||||
|
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
using "basic.style";
|
using "basic.style";
|
||||||
|
|
||||||
using "ui/widgets/widgets.style";
|
using "ui/widgets/widgets.style";
|
||||||
using "window/window.style";
|
using "info/info.style";
|
||||||
|
|
||||||
profileBg: windowBg;
|
profileBg: windowBg;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_mediaview.h"
|
#include "styles/style_mediaview.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace Theme {
|
namespace Theme {
|
||||||
|
|
|
@ -247,64 +247,6 @@ titleButtonCloseIconActiveOver: icon {
|
||||||
{ "title_button_close", titleButtonCloseFgActiveOver, point(5px, 4px) },
|
{ "title_button_close", titleButtonCloseFgActiveOver, point(5px, 4px) },
|
||||||
};
|
};
|
||||||
|
|
||||||
// Legacy top bar.
|
|
||||||
topBarHeight: 54px;
|
|
||||||
topBarMenuPosition: point(-2px, 35px);
|
|
||||||
topBarDuration: 200;
|
|
||||||
topBarBackward: icon {{ "title_back", menuIconFg }};
|
|
||||||
topBarForwardAlpha: 0.6;
|
|
||||||
topBarBack: icon {{ "title_back", lightButtonFg }};
|
|
||||||
topBarArrowPadding: margins(39px, 8px, 17px, 8px);
|
|
||||||
topBarMinPadding: 5px;
|
|
||||||
topBarButton: RoundButton(defaultLightButton) {
|
|
||||||
width: -18px;
|
|
||||||
padding: margins(0px, 10px, 12px, 10px);
|
|
||||||
}
|
|
||||||
topBarClearButton: RoundButton(defaultLightButton) {
|
|
||||||
width: -18px;
|
|
||||||
}
|
|
||||||
topBarSearch: IconButton {
|
|
||||||
width: 40px;
|
|
||||||
height: topBarHeight;
|
|
||||||
|
|
||||||
icon: icon {{ "top_bar_search", menuIconFg }};
|
|
||||||
iconOver: icon {{ "top_bar_search", menuIconFgOver }};
|
|
||||||
iconPosition: point(4px, 11px);
|
|
||||||
|
|
||||||
rippleAreaPosition: point(0px, 7px);
|
|
||||||
rippleAreaSize: 40px;
|
|
||||||
ripple: RippleAnimation(defaultRippleAnimation) {
|
|
||||||
color: windowBgOver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
topBarCall: IconButton(topBarSearch) {
|
|
||||||
icon: icon {{ "top_bar_call", menuIconFg }};
|
|
||||||
iconOver: icon {{ "top_bar_call", menuIconFgOver }};
|
|
||||||
}
|
|
||||||
topBarInfo: IconButton(topBarSearch) {
|
|
||||||
icon: icon {{ "top_bar_profile", menuIconFg }};
|
|
||||||
iconOver: icon {{ "top_bar_profile", menuIconFgOver }};
|
|
||||||
}
|
|
||||||
topBarInfoActive: icon {{ "top_bar_profile", windowActiveTextFg }};
|
|
||||||
topBarSkip: -2px;
|
|
||||||
topBarCallSkip: -1px;
|
|
||||||
topBarMenuToggle: IconButton(topBarSearch) {
|
|
||||||
width: 44px;
|
|
||||||
|
|
||||||
icon: icon {{ "title_menu_dots", menuIconFg }};
|
|
||||||
iconOver: icon {{ "title_menu_dots", menuIconFgOver }};
|
|
||||||
iconPosition: point(16px, 17px);
|
|
||||||
|
|
||||||
rippleAreaPosition: point(0px, 7px);
|
|
||||||
}
|
|
||||||
topBarActionSkip: 10px;
|
|
||||||
|
|
||||||
topBarInfoButton: UserpicButton(defaultUserpicButton) {
|
|
||||||
size: size(52px, topBarHeight);
|
|
||||||
photoSize: 42px;
|
|
||||||
photoPosition: point(2px, -1px);
|
|
||||||
}
|
|
||||||
|
|
||||||
themeEditorSampleSize: size(90px, 51px);
|
themeEditorSampleSize: size(90px, 51px);
|
||||||
themeEditorMargin: margins(17px, 10px, 17px, 10px);
|
themeEditorMargin: margins(17px, 10px, 17px, 10px);
|
||||||
themeEditorDescriptionSkip: 10px;
|
themeEditorDescriptionSkip: 10px;
|
||||||
|
|
Loading…
Reference in New Issue