mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-24 01:06:59 +00:00
Added universal duration to styles.
This commit is contained in:
parent
7388f46adf
commit
804991a69c
@ -546,7 +546,7 @@ rightsToggle: Toggle(defaultToggle) {
|
||||
vsize: 5px;
|
||||
vshift: 1px;
|
||||
stroke: 2px;
|
||||
duration: 120;
|
||||
duration: universalDuration;
|
||||
}
|
||||
|
||||
rightsButton: SettingsButton(defaultSettingsButton) {
|
||||
|
@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_session.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/timer.h"
|
||||
#include "styles/style_basic.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_chat_helpers.h" // style::GroupCallUserpics
|
||||
#include "styles/style_layers.h"
|
||||
@ -49,7 +50,6 @@ enum class BarState {
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdateDebugTimeoutMs = crl::time(500);
|
||||
constexpr auto kSwitchStateDuration = 120;
|
||||
|
||||
constexpr auto kMinorBlobAlpha = 76. / 255.;
|
||||
|
||||
@ -374,7 +374,7 @@ void TopBar::initControls() {
|
||||
};
|
||||
|
||||
_switchStateAnimation.stop();
|
||||
const auto duration = (to - from) * kSwitchStateDuration;
|
||||
const auto duration = (to - from) * st::universalDuration;
|
||||
_switchStateAnimation.start(
|
||||
_switchStateCallback,
|
||||
from,
|
||||
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/fields/input_field.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "styles/style_basic.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
@ -26,7 +27,6 @@ namespace {
|
||||
constexpr auto kRoundRadius = 9;
|
||||
constexpr auto kMaxGroupCallLength = 40;
|
||||
constexpr auto kSwitchDuration = 200;
|
||||
constexpr auto kSelectDuration = 120;
|
||||
|
||||
class GraphicButton final : public Ui::AbstractButton {
|
||||
public:
|
||||
@ -103,7 +103,7 @@ void GraphicButton::setToggled(bool value) {
|
||||
[=] { update(); },
|
||||
_toggled ? 0. : 1.,
|
||||
_toggled ? 1. : 0.,
|
||||
kSelectDuration);
|
||||
st::universalDuration);
|
||||
}
|
||||
|
||||
void GraphicButton::paintEvent(QPaintEvent *e) {
|
||||
|
@ -1108,8 +1108,6 @@ historyRecordVoiceFgOver: historyComposeIconFgOver;
|
||||
historyRecordVoiceFgInactive: attentionButtonFg;
|
||||
historyRecordVoiceFgActive: windowBgActive;
|
||||
historyRecordVoiceFgActiveIcon: windowFgActive;
|
||||
historyRecordVoiceShowDuration: 120;
|
||||
historyRecordVoiceDuration: 120;
|
||||
historyRecordVoice: icon {{ "chat/input_record", historyRecordVoiceFg }};
|
||||
historyRecordVoiceOver: icon {{ "chat/input_record", historyRecordVoiceFgOver }};
|
||||
historyRecordVoiceOnceBg: icon {{ "voice_lock/audio_once_bg", historySendIconFg }};
|
||||
|
@ -38,7 +38,6 @@ namespace {
|
||||
|
||||
constexpr auto kShowExactDelay = crl::time(300);
|
||||
constexpr auto kMaxNonScrolledEmoji = 7;
|
||||
constexpr auto kAnimationDuration = crl::time(120);
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -528,7 +527,7 @@ void SuggestionsWidget::setSelected(int selected, anim::type animated) {
|
||||
[=] { update(); },
|
||||
_selected,
|
||||
selected,
|
||||
kAnimationDuration,
|
||||
st::universalDuration,
|
||||
anim::sineInOut);
|
||||
if (_scrollMax > 0) {
|
||||
const auto selectedMax = int(_rows.size()) - 3;
|
||||
@ -560,7 +559,7 @@ void SuggestionsWidget::scrollTo(int value, anim::type animated) {
|
||||
[=] { update(); },
|
||||
_scrollValue,
|
||||
value,
|
||||
kAnimationDuration,
|
||||
st::universalDuration,
|
||||
anim::sineInOut);
|
||||
}
|
||||
_scrollValue = value;
|
||||
|
@ -116,7 +116,7 @@ dialogsSpeakingDenominator: 8.;
|
||||
|
||||
dialogsImportantBarHeight: 37px;
|
||||
|
||||
dialogsWidthDuration: 120;
|
||||
dialogsWidthDuration: universalDuration;
|
||||
dialogsTextWidthMin: 150px;
|
||||
|
||||
dialogsTextPalette: TextPalette(defaultTextPalette) {
|
||||
|
@ -302,7 +302,7 @@ TTLButton::TTLButton(
|
||||
[=] { update(); },
|
||||
isActive ? 0. : 1.,
|
||||
isActive ? 1. : 0.,
|
||||
st::historyRecordVoiceShowDuration);
|
||||
st::universalDuration);
|
||||
});
|
||||
|
||||
Ui::RpWidget::shownValue() | rpl::start_with_next([=](bool shown) {
|
||||
@ -1058,9 +1058,11 @@ void RecordLock::drawProgress(QPainter &p) {
|
||||
}
|
||||
|
||||
void RecordLock::startLockingAnimation(float64 to) {
|
||||
auto callback = [=](float64 value) { setProgress(value); };
|
||||
const auto &duration = st::historyRecordVoiceShowDuration;
|
||||
_lockEnderAnimation.start(std::move(callback), 0., to, duration);
|
||||
_lockEnderAnimation.start(
|
||||
[=](float64 value) { setProgress(value); },
|
||||
0.,
|
||||
to,
|
||||
st::universalDuration);
|
||||
}
|
||||
|
||||
void RecordLock::requestPaintProgress(float64 progress) {
|
||||
@ -1453,7 +1455,7 @@ void VoiceRecordBar::init() {
|
||||
if (!value) {
|
||||
_listen = nullptr;
|
||||
}
|
||||
}, 1., 0., st::historyRecordVoiceShowDuration * 2);
|
||||
}, 1., 0., st::universalDuration * 2);
|
||||
setLevelAsSend();
|
||||
|
||||
return;
|
||||
@ -1473,7 +1475,6 @@ void VoiceRecordBar::init() {
|
||||
// _lockShowing = false;
|
||||
|
||||
const auto to = 1.;
|
||||
const auto &duration = st::historyRecordVoiceShowDuration;
|
||||
auto callback = [=](float64 value) {
|
||||
paintShowListenCallback(value);
|
||||
if (to == value) {
|
||||
@ -1481,7 +1482,11 @@ void VoiceRecordBar::init() {
|
||||
}
|
||||
};
|
||||
_showListenAnimation.stop();
|
||||
_showListenAnimation.start(std::move(callback), 0., to, duration);
|
||||
_showListenAnimation.start(
|
||||
std::move(callback),
|
||||
0.,
|
||||
to,
|
||||
st::universalDuration);
|
||||
}, lifetime());
|
||||
|
||||
_lock->locks(
|
||||
@ -1498,15 +1503,16 @@ void VoiceRecordBar::init() {
|
||||
|
||||
setLevelAsSend();
|
||||
|
||||
const auto &duration = st::historyRecordVoiceShowDuration;
|
||||
const auto from = 0.;
|
||||
const auto to = 1.;
|
||||
auto callback = [=](float64 value) {
|
||||
_lock->requestPaintLockToStopProgress(value);
|
||||
update();
|
||||
updateTTLGeometry(TTLAnimationType::RightLeft, value);
|
||||
};
|
||||
_lockToStopAnimation.start(std::move(callback), from, to, duration);
|
||||
_lockToStopAnimation.start(
|
||||
std::move(callback),
|
||||
0.,
|
||||
1.,
|
||||
st::universalDuration);
|
||||
}, lifetime());
|
||||
|
||||
_send->events(
|
||||
@ -1523,7 +1529,7 @@ void VoiceRecordBar::init() {
|
||||
return;
|
||||
}
|
||||
_recordingTipRequired = true;
|
||||
_startTimer.callOnce(st::historyRecordVoiceShowDuration);
|
||||
_startTimer.callOnce(st::universalDuration);
|
||||
} else if (e->type() == QEvent::MouseButtonRelease) {
|
||||
if (base::take(_recordingTipRequired)) {
|
||||
_recordingTipRequests.fire({});
|
||||
@ -1556,23 +1562,24 @@ void VoiceRecordBar::init() {
|
||||
|
||||
void VoiceRecordBar::activeAnimate(bool active) {
|
||||
const auto to = active ? 1. : 0.;
|
||||
const auto &duration = st::historyRecordVoiceDuration;
|
||||
if (_activeAnimation.animating()) {
|
||||
_activeAnimation.change(to, duration);
|
||||
_activeAnimation.change(to, st::universalDuration);
|
||||
} else {
|
||||
auto callback = [=] {
|
||||
update(_messageRect);
|
||||
_level->requestPaintColor(activeAnimationRatio());
|
||||
};
|
||||
const auto from = active ? 0. : 1.;
|
||||
_activeAnimation.start(std::move(callback), from, to, duration);
|
||||
_activeAnimation.start(
|
||||
std::move(callback),
|
||||
active ? 0. : 1.,
|
||||
to,
|
||||
st::universalDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void VoiceRecordBar::visibilityAnimate(bool show, Fn<void()> &&callback) {
|
||||
const auto to = show ? 1. : 0.;
|
||||
const auto from = show ? 0. : 1.;
|
||||
const auto &duration = st::historyRecordVoiceShowDuration;
|
||||
auto animationCallback = [=, callback = std::move(callback)](auto value) {
|
||||
if (!_listen) {
|
||||
_level->requestPaintProgress(value);
|
||||
@ -1589,7 +1596,11 @@ void VoiceRecordBar::visibilityAnimate(bool show, Fn<void()> &&callback) {
|
||||
}
|
||||
}
|
||||
};
|
||||
_showAnimation.start(std::move(animationCallback), from, to, duration);
|
||||
_showAnimation.start(
|
||||
std::move(animationCallback),
|
||||
from,
|
||||
to,
|
||||
st::universalDuration);
|
||||
}
|
||||
|
||||
void VoiceRecordBar::setStartRecordingFilter(FilterCallback &&callback) {
|
||||
|
@ -196,8 +196,8 @@ void VoiceRecordButton::init() {
|
||||
}
|
||||
update();
|
||||
};
|
||||
const auto duration = st::historyRecordVoiceDuration * 2;
|
||||
_stateChangedAnimation.start(std::move(callback), 0., to, duration);
|
||||
constexpr auto kDuration = st::universalDuration * 2;
|
||||
_stateChangedAnimation.start(std::move(callback), 0., to, kDuration);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
|
@ -66,5 +66,3 @@ userpicBuilderEmojiColorPlus: IconButton(userpicBuilderEmojiColorMinus) {
|
||||
}
|
||||
|
||||
userpicBuilderEmojiToggleStickersIcon: icon {{ "menu/stickers", emojiIconFg }};
|
||||
|
||||
userpicBuilderEmojiSlideDuration: 120;
|
||||
|
@ -137,7 +137,7 @@ void ColorsLine::fillButtons() {
|
||||
wasChosen->setSelectedProgress(1. - progress);
|
||||
}
|
||||
nowChosen->setSelectedProgress(progress);
|
||||
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
|
||||
}, 0., 1., st::universalDuration);
|
||||
});
|
||||
if (i < _colors->size()) {
|
||||
button->setBrush((*_colors)[i]);
|
||||
@ -164,7 +164,7 @@ void ColorsLine::fillButtons() {
|
||||
setLastChosen();
|
||||
});
|
||||
for (const auto &wrap : _wraps) {
|
||||
wrap->setDuration(st::userpicBuilderEmojiSlideDuration);
|
||||
wrap->setDuration(st::universalDuration);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ void ColorsLine::processChange(
|
||||
const auto left = anim::interpolate(wasLeft, nowLeft, value);
|
||||
_wraps[i]->moveToLeft(left, 0);
|
||||
}
|
||||
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
|
||||
}, 0., 1., st::universalDuration);
|
||||
}
|
||||
|
||||
void ColorsLine::setLastChosen() const {
|
||||
|
@ -493,7 +493,7 @@ not_null<Ui::VerticalLayout*> CreateUserpicBuilder(
|
||||
1. - progress);
|
||||
}
|
||||
state->circleButtons[now]->setSelectedProgress(progress);
|
||||
}, 0., 1., st::userpicBuilderEmojiSlideDuration);
|
||||
}, 0., 1., st::universalDuration);
|
||||
state->colorIndex = now;
|
||||
|
||||
const auto result = isSpecial
|
||||
|
@ -119,7 +119,6 @@ introCodeDigitFont: font(20px);
|
||||
introCodeDigitHeight: 50px;
|
||||
introCodeDigitBorderWidth: 4px;
|
||||
introCodeDigitSkip: 10px;
|
||||
introCodeDigitAnimatioDuration: 120;
|
||||
|
||||
introPasswordHint: FlatLabel(introDescription) {
|
||||
textFg: windowFg;
|
||||
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/painter.h"
|
||||
#include "ui/rect.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "styles/style_basic.h"
|
||||
#include "styles/style_intro.h"
|
||||
#include "styles/style_layers.h" // boxRadius
|
||||
|
||||
@ -91,7 +92,6 @@ void CodeDigit::setDigit(int digit) {
|
||||
}
|
||||
_dataDigit = digit;
|
||||
if (_viewDigit != digit) {
|
||||
constexpr auto kDuration = st::introCodeDigitAnimatioDuration;
|
||||
_animation.stop();
|
||||
if (digit == kDigitNone) {
|
||||
_animation.start([=](float64 value) {
|
||||
@ -99,10 +99,10 @@ void CodeDigit::setDigit(int digit) {
|
||||
if (!value) {
|
||||
_viewDigit = digit;
|
||||
}
|
||||
}, 1., 0., kDuration);
|
||||
}, 1., 0., st::universalDuration);
|
||||
} else {
|
||||
_viewDigit = digit;
|
||||
_animation.start([=] { update(); }, 0., 1., kDuration);
|
||||
_animation.start([=] { update(); }, 0, 1., st::universalDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ historyPollRadio: Radio(defaultRadio) {
|
||||
diameter: 18px;
|
||||
thickness: 2px;
|
||||
skip: 65px; // * 0.1
|
||||
duration: 120;
|
||||
duration: universalDuration;
|
||||
rippleAreaPadding: 8px;
|
||||
}
|
||||
historyPollRadioOpacity: 0.7;
|
||||
|
@ -40,7 +40,7 @@ void SendButton::setType(Type type) {
|
||||
[=] { update(); },
|
||||
0.,
|
||||
1.,
|
||||
st::historyRecordVoiceDuration);
|
||||
st::universalDuration);
|
||||
setPointerCursor(_type != Type::Slowmode);
|
||||
update();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user