mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Improve scheduled voice chat top bar design.
This commit is contained in:
@@ -720,6 +720,11 @@ groupCallTopBarJoin: RoundButton(defaultActiveButton) {
|
||||
height: 26px;
|
||||
textTop: 4px;
|
||||
}
|
||||
groupCallTopBarOpen: RoundButton(groupCallTopBarJoin) {
|
||||
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||
color: shadowFg;
|
||||
}
|
||||
}
|
||||
groupCallBox: Box(defaultBox) {
|
||||
button: RoundButton(defaultBoxButton) {
|
||||
textFg: groupCallActiveFg;
|
||||
|
@@ -152,17 +152,17 @@ void ScheduleGroupCallBox(
|
||||
const auto now = base::unixtime::now();
|
||||
const auto duration = (date - now);
|
||||
if (duration >= 24 * 60 * 60) {
|
||||
return tr::lng_signin_reset_days(
|
||||
return tr::lng_group_call_duration_days(
|
||||
tr::now,
|
||||
lt_count,
|
||||
duration / (24 * 60 * 60));
|
||||
} else if (duration >= 60 * 60) {
|
||||
return tr::lng_signin_reset_hours(
|
||||
return tr::lng_group_call_duration_hours(
|
||||
tr::now,
|
||||
lt_count,
|
||||
duration / (60 * 60));
|
||||
}
|
||||
return tr::lng_signin_reset_minutes(
|
||||
return tr::lng_group_call_duration_minutes(
|
||||
tr::now,
|
||||
lt_count,
|
||||
std::max(duration / 60, 1));
|
||||
|
@@ -234,9 +234,9 @@ GroupCall::GroupCall(
|
||||
return not_null{ real };
|
||||
}) | rpl::take(
|
||||
1
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> call) {
|
||||
) | rpl::start_with_next([=](not_null<Data::GroupCall*> real) {
|
||||
subscribeToReal(real);
|
||||
_realChanges.fire_copy(call);
|
||||
_realChanges.fire_copy(real);
|
||||
}, _lifetime);
|
||||
}
|
||||
if (_id) {
|
||||
|
@@ -514,15 +514,6 @@ base::unique_qptr<Ui::Menu::ItemBase> MakeRecordingAction(
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
base::unique_qptr<Ui::Menu::ItemBase> MakeFinishAction(
|
||||
not_null<Ui::Menu::Menu*> menu,
|
||||
Fn<void()> callback) {
|
||||
return MakeAttentionAction(
|
||||
menu,
|
||||
tr::lng_group_call_end(tr::now),
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void LeaveBox(
|
||||
@@ -530,16 +521,25 @@ void LeaveBox(
|
||||
not_null<GroupCall*> call,
|
||||
bool discardChecked,
|
||||
BoxContext context) {
|
||||
box->setTitle(tr::lng_group_call_leave_title());
|
||||
const auto scheduled = (call->scheduleDate() != 0);
|
||||
if (!scheduled) {
|
||||
box->setTitle(tr::lng_group_call_leave_title());
|
||||
}
|
||||
const auto inCall = (context == BoxContext::GroupCallPanel);
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box.get(),
|
||||
tr::lng_group_call_leave_sure(),
|
||||
(inCall ? st::groupCallBoxLabel : st::boxLabel)));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box.get(),
|
||||
(scheduled
|
||||
? tr::lng_group_call_close_sure()
|
||||
: tr::lng_group_call_leave_sure()),
|
||||
(inCall ? st::groupCallBoxLabel : st::boxLabel)),
|
||||
scheduled ? st::boxPadding : st::boxRowPadding);
|
||||
const auto discard = call->peer()->canManageGroupCall()
|
||||
? box->addRow(object_ptr<Ui::Checkbox>(
|
||||
box.get(),
|
||||
tr::lng_group_call_end(),
|
||||
(scheduled
|
||||
? tr::lng_group_call_also_cancel()
|
||||
: tr::lng_group_call_also_end()),
|
||||
discardChecked,
|
||||
(inCall ? st::groupCallCheckbox : st::defaultBoxCheckbox),
|
||||
(inCall ? st::groupCallCheck : st::defaultCheck)),
|
||||
@@ -550,7 +550,10 @@ void LeaveBox(
|
||||
st::boxRowPadding.bottom()))
|
||||
: nullptr;
|
||||
const auto weak = base::make_weak(call.get());
|
||||
box->addButton(tr::lng_group_call_leave(), [=] {
|
||||
auto label = scheduled
|
||||
? tr::lng_group_call_close()
|
||||
: tr::lng_group_call_leave();
|
||||
box->addButton(std::move(label), [=] {
|
||||
const auto discardCall = (discard && discard->checked());
|
||||
box->closeBox();
|
||||
|
||||
@@ -603,7 +606,8 @@ void FillMenu(
|
||||
|
||||
const auto addEditJoinAs = call->showChooseJoinAs();
|
||||
const auto addEditTitle = peer->canManageGroupCall();
|
||||
const auto addEditRecording = peer->canManageGroupCall();
|
||||
const auto addEditRecording = peer->canManageGroupCall()
|
||||
&& !real->scheduleDate();
|
||||
if (addEditJoinAs) {
|
||||
menu->addAction(MakeJoinAsAction(
|
||||
menu->menu(),
|
||||
@@ -660,7 +664,7 @@ void FillMenu(
|
||||
showBox(Box(SettingsBox, strong));
|
||||
}
|
||||
});
|
||||
menu->addAction(MakeFinishAction(menu->menu(), [=] {
|
||||
const auto finish = [=] {
|
||||
if (const auto strong = weak.get()) {
|
||||
showBox(Box(
|
||||
LeaveBox,
|
||||
@@ -668,7 +672,13 @@ void FillMenu(
|
||||
true,
|
||||
BoxContext::GroupCallPanel));
|
||||
}
|
||||
}));
|
||||
};
|
||||
menu->addAction(MakeAttentionAction(
|
||||
menu->menu(),
|
||||
(real->scheduleDate()
|
||||
? tr::lng_group_call_cancel(tr::now)
|
||||
: tr::lng_group_call_end(tr::now)),
|
||||
finish));
|
||||
}
|
||||
|
||||
base::unique_qptr<Ui::Menu::ItemBase> MakeAttentionAction(
|
||||
|
@@ -266,7 +266,7 @@ Panel::Panel(not_null<GroupCall*> call)
|
||||
Core::App().appDeactivatedValue(),
|
||||
Ui::CallMuteButtonState{
|
||||
.text = (_call->scheduleDate()
|
||||
? "Start Now" // #TODO voice chats
|
||||
? tr::lng_group_call_start_now(tr::now)
|
||||
: tr::lng_group_call_connecting(tr::now)),
|
||||
.type = (_call->scheduleDate()
|
||||
? Ui::CallMuteButtonType::ScheduledCanStart
|
||||
@@ -451,7 +451,20 @@ void Panel::initControls() {
|
||||
});
|
||||
|
||||
_settings->setText(tr::lng_group_call_settings());
|
||||
_hangup->setText(tr::lng_group_call_leave());
|
||||
const auto scheduled = (_call->scheduleDate() != 0);
|
||||
_hangup->setText(scheduled
|
||||
? tr::lng_group_call_close()
|
||||
: tr::lng_group_call_leave());
|
||||
if (scheduled) {
|
||||
_call->real(
|
||||
) | rpl::map([=](not_null<Data::GroupCall*> real) {
|
||||
return real->scheduleDateValue();
|
||||
}) | rpl::flatten_latest() | rpl::filter([](TimeId date) {
|
||||
return (date == 0);
|
||||
}) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
_hangup->setText(tr::lng_group_call_leave());
|
||||
}, _callLifetime);
|
||||
}
|
||||
|
||||
_call->stateValue(
|
||||
) | rpl::filter([](State state) {
|
||||
@@ -497,10 +510,10 @@ void Panel::setupRealMuteButtonState(not_null<Data::GroupCall*> real) {
|
||||
_mute->setState(Ui::CallMuteButtonState{
|
||||
.text = (scheduleDate
|
||||
? (canManage
|
||||
? "Start Now" // #TODO voice chats
|
||||
? tr::lng_group_call_start_now(tr::now)
|
||||
: scheduleStartSubscribed
|
||||
? "Cancel Reminder"
|
||||
: "Set Reminder")
|
||||
? tr::lng_group_call_cancel_reminder(tr::now)
|
||||
: tr::lng_group_call_set_reminder(tr::now))
|
||||
: state == GroupCall::InstanceState::Disconnected
|
||||
? tr::lng_group_call_connecting(tr::now)
|
||||
: mute == MuteState::ForceMuted
|
||||
|
@@ -122,6 +122,9 @@ private:
|
||||
object_ptr<Ui::DropdownMenu> _menu = { nullptr };
|
||||
object_ptr<Ui::AbstractButton> _joinAsToggle = { nullptr };
|
||||
object_ptr<Members> _members = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _startsIn = { nullptr };
|
||||
object_ptr<Ui::RpWidget> _countdown = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _startsWhen = { nullptr };
|
||||
ChooseJoinAsProcess _joinAsProcess;
|
||||
|
||||
object_ptr<Ui::CallButton> _settings;
|
||||
|
@@ -57,8 +57,13 @@ constexpr auto kHideBlobsDuration = crl::time(500);
|
||||
constexpr auto kBlobLevelDuration = crl::time(250);
|
||||
constexpr auto kBlobUpdateInterval = crl::time(100);
|
||||
|
||||
auto BarStateFromMuteState(MuteState state, GroupCall::InstanceState instanceState) {
|
||||
return (instanceState == GroupCall::InstanceState::Disconnected)
|
||||
auto BarStateFromMuteState(
|
||||
MuteState state,
|
||||
GroupCall::InstanceState instanceState,
|
||||
TimeId scheduledDate) {
|
||||
return scheduledDate
|
||||
? BarState::ForceMuted
|
||||
: (instanceState == GroupCall::InstanceState::Disconnected)
|
||||
? BarState::Connecting
|
||||
: (state == MuteState::ForceMuted || state == MuteState::RaisedHand)
|
||||
? BarState::ForceMuted
|
||||
@@ -293,19 +298,27 @@ void TopBar::initControls() {
|
||||
_call
|
||||
? mapToState(_call->muted())
|
||||
: _groupCall->muted(),
|
||||
GroupCall::InstanceState::Connected));
|
||||
GroupCall::InstanceState::Connected,
|
||||
_call ? TimeId(0) : _groupCall->scheduleDate()));
|
||||
using namespace rpl::mappers;
|
||||
auto muted = _call
|
||||
? rpl::combine(
|
||||
_call->mutedValue() | rpl::map(mapToState),
|
||||
rpl::single(GroupCall::InstanceState::Connected)
|
||||
rpl::single(GroupCall::InstanceState::Connected),
|
||||
rpl::single(TimeId(0))
|
||||
) | rpl::type_erased()
|
||||
: rpl::combine(
|
||||
(_groupCall->mutedValue()
|
||||
| MapPushToTalkToActive()
|
||||
| rpl::distinct_until_changed()
|
||||
| rpl::type_erased()),
|
||||
_groupCall->instanceStateValue()
|
||||
_groupCall->instanceStateValue(),
|
||||
rpl::single(
|
||||
_groupCall->scheduleDate()
|
||||
) | rpl::then(_groupCall->real(
|
||||
) | rpl::map([](not_null<Data::GroupCall*> call) {
|
||||
return call->scheduleDateValue();
|
||||
}) | rpl::flatten_latest())
|
||||
) | rpl::filter(_2 != GroupCall::InstanceState::TransitionToRtc);
|
||||
std::move(
|
||||
muted
|
||||
|
Reference in New Issue
Block a user