animations refactored

This commit is contained in:
John Preston 2015-12-08 15:33:37 +03:00
parent f25fde09b7
commit 0b96dd5362
71 changed files with 1370 additions and 1584 deletions

View file

@ -1480,7 +1480,6 @@ notifySlowHideFunc: transition(easeInCirc);
notifyWaitShortHide: 0;
notifyWaitLongHide: 20000;
notifyFastAnim: 150;
notifyFastAnimFunc: transition(linear);
notifyWidth: 316px;
notifyHeight: 80px;
notifyDeltaX: 6px;

View file

@ -36,7 +36,7 @@ void BlueTitleShadow::paintEvent(QPaintEvent *e) {
BlueTitleClose::BlueTitleClose(QWidget *parent) : Button(parent)
, a_iconFg(st::boxBlueCloseBg->c)
, _a_over(animFunc(this, &BlueTitleClose::animStep_over)) {
, _a_over(animation(this, &BlueTitleClose::step_over)) {
resize(st::boxTitleHeight, st::boxTitleHeight);
setCursor(style::cur_pointer);
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
@ -49,18 +49,15 @@ void BlueTitleClose::onStateChange(int oldState, ButtonStateChangeSource source)
}
}
bool BlueTitleClose::animStep_over(float64 ms) {
void BlueTitleClose::step_over(float64 ms, bool timer) {
float64 dt = ms / st::boxBlueCloseDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_over.stop();
a_iconFg.finish();
} else {
a_iconFg.update(dt, anim::linear);
}
update((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
return res;
if (timer) update((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
}
void BlueTitleClose::paintEvent(QPaintEvent *e) {
@ -156,7 +153,7 @@ void AbstractBox::paintEvent(QPaintEvent *e) {
if (paint(p)) return;
}
void AbstractBox::animStep(float64 ms) {
void AbstractBox::showStep(float64 ms) {
if (ms >= 1) {
a_opacity.finish();
_cache = QPixmap();

View file

@ -41,7 +41,7 @@ public slots:
void onStateChange(int oldState, ButtonStateChangeSource source);
private:
bool animStep_over(float64 ms);
void step_over(float64 ms, bool timer);
anim::cvalue a_iconFg;
Animation _a_over;
@ -54,7 +54,7 @@ public:
AbstractBox(int32 w = st::boxWideWidth);
void parentResized();
void animStep(float64 ms);
void showStep(float64 ms);
void keyPressEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);

View file

@ -342,7 +342,7 @@ void NewGroupBox::onNext() {
GroupInfoBox::GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose) : AbstractBox(),
_creating(creating),
a_photoOver(0, 0),
_a_photoOver(animFunc(this, &GroupInfoBox::animStep_photoOver)),
_a_photoOver(animation(this, &GroupInfoBox::step_photoOver)),
_photoOver(false),
_title(this, st::defaultInputField, lang(_creating == CreatingGroupChannel ? lng_dlg_new_channel_name : lng_dlg_new_group_name)),
_description(this, st::newGroupDescription, lang(lng_create_group_description)),
@ -464,17 +464,15 @@ void GroupInfoBox::leaveEvent(QEvent *e) {
updateSelected(QCursor::pos());
}
bool GroupInfoBox::animStep_photoOver(float64 ms) {
void GroupInfoBox::step_photoOver(float64 ms, bool timer) {
float64 dt = ms / st::setPhotoDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_photoOver.stop();
a_photoOver.finish();
} else {
a_photoOver.update(dt, anim::linear);
}
update(photoRect());
return res;
if (timer) update(photoRect());
}
void GroupInfoBox::onNameSubmit() {
@ -604,23 +602,25 @@ void GroupInfoBox::onPhotoReady(const QImage &img) {
_photoSmall.setDevicePixelRatio(cRetinaFactor());
}
SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : AbstractBox(),
_channel(channel),
_existing(existing),
_public(this, qsl("channel_privacy"), 0, lang(lng_create_public_channel_title), true),
_private(this, qsl("channel_privacy"), 1, lang(lng_create_private_channel_title)),
_comments(this, lang(lng_create_channel_comments), false),
_aboutPublicWidth(width() - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultRadiobutton.textPosition.x()),
_aboutPublic(st::normalFont, lang(lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth),
_aboutPrivate(st::normalFont, lang(lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth),
_aboutComments(st::normalFont, lang(lng_create_channel_comments_about), _defaultOptions, _aboutPublicWidth),
_link(this, st::defaultInputField, QString(), channel->username, true),
_linkOver(false),
_save(this, lang(lng_settings_save), st::defaultBoxButton),
_skip(this, lang(existing ? lng_cancel : lng_create_group_skip), st::cancelBoxButton),
_tooMuchUsernames(false),
_saveRequestId(0), _checkRequestId(0),
a_goodOpacity(0, 0), _a_goodFade(animFunc(this, &SetupChannelBox::animStep_goodFade)) {
SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : AbstractBox()
, _channel(channel)
, _existing(existing)
, _public(this, qsl("channel_privacy"), 0, lang(lng_create_public_channel_title), true)
, _private(this, qsl("channel_privacy"), 1, lang(lng_create_private_channel_title))
, _comments(this, lang(lng_create_channel_comments), false)
, _aboutPublicWidth(width() - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultRadiobutton.textPosition.x())
, _aboutPublic(st::normalFont, lang(lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth)
, _aboutPrivate(st::normalFont, lang(lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth)
, _aboutComments(st::normalFont, lang(lng_create_channel_comments_about), _defaultOptions, _aboutPublicWidth)
, _link(this, st::defaultInputField, QString(), channel->username, true)
, _linkOver(false)
, _save(this, lang(lng_settings_save), st::defaultBoxButton)
, _skip(this, lang(existing ? lng_cancel : lng_create_group_skip), st::cancelBoxButton)
, _tooMuchUsernames(false)
, _saveRequestId(0)
, _checkRequestId(0)
, a_goodOpacity(0, 0)
, _a_goodFade(animation(this, &SetupChannelBox::step_goodFade)) {
setMouseTracking(true);
_checkRequestId = MTP::send(MTPchannels_CheckUsername(_channel->inputChannel, MTP_string("preston")), RPCDoneHandlerPtr(), rpcFail(&SetupChannelBox::onFirstCheckFail));
@ -772,17 +772,15 @@ void SetupChannelBox::updateSelected(const QPoint &cursorGlobalPosition) {
}
}
bool SetupChannelBox::animStep_goodFade(float64 ms) {
void SetupChannelBox::step_goodFade(float64 ms, bool timer) {
float dt = ms / st::newGroupLinkFadeDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_goodFade.stop();
a_goodOpacity.finish();
} else {
a_goodOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void SetupChannelBox::closePressed() {

View file

@ -113,8 +113,6 @@ public:
void mousePressEvent(QMouseEvent *e);
void leaveEvent(QEvent *e);
bool animStep_photoOver(float64 ms);
void setInnerFocus() {
_title.setFocus();
}
@ -136,6 +134,8 @@ protected:
private:
void step_photoOver(float64 ms, bool timer);
QRect photoRect() const;
void updateMaxHeight();
@ -202,7 +202,7 @@ protected:
private:
void updateSelected(const QPoint &cursorGlobalPosition);
bool animStep_goodFade(float64 ms);
void step_goodFade(float64 ms, bool timer);
void onUpdateDone(const MTPBool &result);
bool onUpdateFail(const RPCError &error);

View file

@ -187,11 +187,13 @@ void ConfirmLinkBox::onOpenLink() {
Ui::hideLayer();
}
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth),
_close(this, lang(lng_box_ok), st::defaultBoxButton),
_text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()),
_link(link), _linkOver(false),
a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) {
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth)
, _close(this, lang(lng_box_ok), st::defaultBoxButton)
, _text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right())
, _link(link)
, _linkOver(false)
, a_goodOpacity(0, 0)
, _a_good(animation(this, &MaxInviteBox::step_good)) {
setMouseTracking(true);
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right();
@ -213,7 +215,7 @@ void MaxInviteBox::mousePressEvent(QMouseEvent *e) {
App::app()->clipboard()->setText(_link);
_goodTextLink = lang(lng_create_channel_link_copied);
a_goodOpacity = anim::fvalue(1, 0);
a_good.start();
_a_good.start();
}
}
@ -232,17 +234,15 @@ void MaxInviteBox::updateSelected(const QPoint &cursorGlobalPosition) {
}
}
bool MaxInviteBox::goodAnimStep(float64 ms) {
void MaxInviteBox::step_good(float64 ms, bool timer) {
float dt = ms / st::newGroupLinkFadeDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_good.stop();
a_goodOpacity.finish();
} else {
a_goodOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void MaxInviteBox::hideAll() {

View file

@ -108,8 +108,7 @@ public:
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void leaveEvent(QEvent *e);
void updateLink();
protected:
void hideAll();
@ -118,7 +117,7 @@ protected:
private:
void updateSelected(const QPoint &cursorGlobalPosition);
bool goodAnimStep(float64 ms);
void step_good(float64 ms, bool timer);
BoxButton _close;
Text _text;
@ -132,5 +131,5 @@ private:
QString _goodTextLink;
anim::fvalue a_goodOpacity;
Animation a_good;
Animation _a_good;
};

View file

@ -333,7 +333,7 @@ StickersInner::StickersInner() : TWidget()
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
, _aboveShadowFadeStart(0)
, _aboveShadowFadeOpacity(0, 0)
, _a_shifting(animFunc(this, &StickersInner::animStep_shifting))
, _a_shifting(animation(this, &StickersInner::step_shifting))
, _itemsTop(st::membersPadding.top())
, _saving(false)
, _removeSel(-1)
@ -355,7 +355,7 @@ void StickersInner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
Painter p(this);
updateAnimatedValues();
_a_shifting.step();
p.fillRect(r, st::white);
p.setClipRect(r);
@ -489,7 +489,7 @@ void StickersInner::onUpdateSelected() {
}
_rows.at(_dragging)->yadd = anim::ivalue(local.y() - _dragStart.y(), local.y() - _dragStart.y());
_animStartTimes[_dragging] = 0;
updateAnimatedRegions();
_a_shifting.step(getms(), true);
emit checkDraggingScroll(local.y());
} else {
@ -538,33 +538,14 @@ void StickersInner::mouseReleaseEvent(QMouseEvent *e) {
}
}
void StickersInner::updateAnimatedRegions() {
int32 updateMin = -1, updateMax = 0;
for (int32 i = 0, l = _animStartTimes.size(); i < l; ++i) {
if (_animStartTimes.at(i)) {
if (updateMin < 0) updateMin = i;
updateMax = i;
}
}
if (_aboveShadowFadeStart) {
if (updateMin < 0 || updateMin > _above) updateMin = _above;
if (updateMax < _above) updateMin = _above;
}
if (_dragging >= 0) {
if (updateMin < 0 || updateMin > _dragging) updateMin = _dragging;
if (updateMax < _dragging) updateMax = _dragging;
}
if (updateMin >= 0) {
update(0, _itemsTop + _rowHeight * (updateMin - 1), width(), _rowHeight * (updateMax - updateMin + 3));
}
}
bool StickersInner::updateAnimatedValues() {
void StickersInner::step_shifting(uint64 ms, bool timer) {
bool animating = false;
uint64 ms = getms();
int32 updateMin = -1, updateMax = 0;
for (int32 i = 0, l = _animStartTimes.size(); i < l; ++i) {
uint64 start = _animStartTimes.at(i);
if (start) {
if (updateMin < 0) updateMin = i;
updateMax = i;
if (start + st::stickersRowDuration > ms && ms >= start) {
_rows.at(i)->yadd.update((ms - start) / st::stickersRowDuration, anim::sineInOut);
animating = true;
@ -575,6 +556,8 @@ bool StickersInner::updateAnimatedValues() {
}
}
if (_aboveShadowFadeStart) {
if (updateMin < 0 || updateMin > _above) updateMin = _above;
if (updateMax < _above) updateMin = _above;
if (_aboveShadowFadeStart + st::stickersRowDuration > ms && ms > _aboveShadowFadeStart) {
_aboveShadowFadeOpacity.update((ms - _aboveShadowFadeStart) / st::stickersRowDuration, anim::sineInOut);
animating = true;
@ -583,17 +566,19 @@ bool StickersInner::updateAnimatedValues() {
_aboveShadowFadeStart = 0;
}
}
return animating;
}
bool StickersInner::animStep_shifting(float64) {
updateAnimatedRegions();
bool animating = updateAnimatedValues();
if (timer) {
if (_dragging >= 0) {
if (updateMin < 0 || updateMin > _dragging) updateMin = _dragging;
if (updateMax < _dragging) updateMax = _dragging;
}
if (updateMin >= 0) {
update(0, _itemsTop + _rowHeight * (updateMin - 1), width(), _rowHeight * (updateMax - updateMin + 3));
}
}
if (!animating) {
_above = _dragging;
_a_shifting.stop();
}
return animating;
}
void StickersInner::clear() {

View file

@ -144,13 +144,11 @@ public slots:
private:
bool animStep_shifting(float64 ms);
void step_shifting(uint64 ms, bool timer);
void paintRow(Painter &p, int32 index);
void clear();
void setRemoveSel(int32 removeSel);
float64 aboveShadowOpacity() const;
void updateAnimatedRegions();
bool updateAnimatedValues();
int32 _rowHeight;
struct StickerSetRow {

View file

@ -1737,7 +1737,7 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : TWidget(parent)
, _cancelSearch(this, st::btnCancelSearch)
, _scroll(this, st::dlgScroll)
, _inner(&_scroll, parent)
, _a_show(animFunc(this, &DialogsWidget::animStep_show))
, _a_show(animation(this, &DialogsWidget::step_show))
, _searchInPeer(0)
, _searchInMigrated(0)
, _searchFull(false)
@ -1839,13 +1839,11 @@ void DialogsWidget::animShow(const QPixmap &bgAnimCache) {
show();
}
bool DialogsWidget::animStep_show(float64 ms) {
void DialogsWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -1865,8 +1863,7 @@ bool DialogsWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
return res;
if (timer) update();
}
void DialogsWidget::onCancel() {

View file

@ -242,7 +242,7 @@ public:
void dialogsToUp();
void animShow(const QPixmap &bgAnimCache);
bool animStep_show(float64 ms);
void step_show(float64 ms, bool timer);
void destroyData();

View file

@ -32,8 +32,15 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h"
#include "boxes/stickersetbox.h"
Dropdown::Dropdown(QWidget *parent, const style::dropdown &st) : TWidget(parent),
_ignore(false), _selected(-1), _st(st), _width(_st.width), _hiding(false), a_opacity(0), _shadow(_st.shadow) {
Dropdown::Dropdown(QWidget *parent, const style::dropdown &st) : TWidget(parent)
, _ignore(false)
, _selected(-1)
, _st(st)
, _width(_st.width)
, _hiding(false)
, a_opacity(0)
, _a_appearance(animation(this, &Dropdown::step_appearance))
, _shadow(_st.shadow) {
resetButtons();
_hideTimer.setSingleShot(true);
@ -118,7 +125,7 @@ void Dropdown::resizeEvent(QResizeEvent *e) {
void Dropdown::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (animating()) {
if (_a_appearance.animating()) {
p.setOpacity(a_opacity.current());
}
@ -151,7 +158,7 @@ void Dropdown::enterEvent(QEvent *e) {
}
void Dropdown::leaveEvent(QEvent *e) {
if (animating()) {
if (_a_appearance.animating()) {
hideStart();
} else {
_hideTimer.start(300);
@ -231,7 +238,7 @@ void Dropdown::otherEnter() {
}
void Dropdown::otherLeave() {
if (animating()) {
if (_a_appearance.animating()) {
hideStart();
} else {
_hideTimer.start(0);
@ -239,8 +246,8 @@ void Dropdown::otherLeave() {
}
void Dropdown::fastHide() {
if (animating()) {
anim::stop(this);
if (_a_appearance.animating()) {
_a_appearance.stop();
}
a_opacity = anim::fvalue(0, 0);
_hideTimer.stop();
@ -256,7 +263,7 @@ void Dropdown::adjustButtons() {
void Dropdown::hideStart() {
_hiding = true;
a_opacity.start(0);
anim::start(this);
_a_appearance.start();
}
void Dropdown::hideFinish() {
@ -276,24 +283,22 @@ void Dropdown::showStart() {
_hiding = false;
show();
a_opacity.start(1);
anim::start(this);
_a_appearance.start();
}
bool Dropdown::animStep(float64 ms) {
void Dropdown::step_appearance(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_opacity.finish();
if (_hiding) {
hideFinish();
}
res = false;
} else {
a_opacity.update(dt, anim::linear);
}
adjustButtons();
update();
return res;
if (timer) update();
}
bool Dropdown::eventFilter(QObject *obj, QEvent *e) {
@ -311,8 +316,13 @@ bool Dropdown::eventFilter(QObject *obj, QEvent *e) {
return false;
}
DragArea::DragArea(QWidget *parent) : TWidget(parent),
_hiding(false), _in(false), a_opacity(0), a_color(st::dragColor->c), _shadow(st::boxShadow) {
DragArea::DragArea(QWidget *parent) : TWidget(parent)
, _hiding(false)
, _in(false)
, a_opacity(0)
, a_color(st::dragColor->c)
, _a_appearance(animation(this, &DragArea::step_appearance))
, _shadow(st::boxShadow) {
setMouseTracking(true);
setAcceptDrops(true);
}
@ -325,7 +335,7 @@ void DragArea::mouseMoveEvent(QMouseEvent *e) {
_in = newIn;
a_opacity.start(1);
a_color.start((_in ? st::dragDropColor : st::dragColor)->c);
anim::start(this);
_a_appearance.start();
}
}
@ -336,7 +346,7 @@ void DragArea::dragMoveEvent(QDragMoveEvent *e) {
_in = newIn;
a_opacity.start(1);
a_color.start((_in ? st::dragDropColor : st::dragColor)->c);
anim::start(this);
_a_appearance.start();
}
e->setDropAction(_in ? Qt::CopyAction : Qt::IgnoreAction);
e->accept();
@ -351,7 +361,7 @@ void DragArea::setText(const QString &text, const QString &subtext) {
void DragArea::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (animating()) {
if (_a_appearance.animating()) {
p.setOpacity(a_opacity.current());
}
@ -382,7 +392,7 @@ void DragArea::dragLeaveEvent(QDragLeaveEvent *e) {
_in = false;
a_opacity.start(_hiding ? 0 : 1);
a_color.start((_in ? st::dragDropColor : st::dragColor)->c);
anim::start(this);
_a_appearance.start();
}
void DragArea::dropEvent(QDropEvent *e) {
@ -401,8 +411,8 @@ void DragArea::otherLeave() {
}
void DragArea::fastHide() {
if (animating()) {
anim::stop(this);
if (_a_appearance.animating()) {
_a_appearance.stop();
}
a_opacity = anim::fvalue(0, 0);
hide();
@ -413,7 +423,7 @@ void DragArea::hideStart() {
_in = false;
a_opacity.start(0);
a_color.start((_in ? st::dragDropColor : st::dragColor)->c);
anim::start(this);
_a_appearance.start();
}
void DragArea::hideFinish() {
@ -427,29 +437,34 @@ void DragArea::showStart() {
show();
a_opacity.start(1);
a_color.start((_in ? st::dragDropColor : st::dragColor)->c);
anim::start(this);
_a_appearance.start();
}
bool DragArea::animStep(float64 ms) {
void DragArea::step_appearance(float64 ms, bool timer) {
float64 dt = ms / st::dropdownDef.duration;
bool res = true;
if (dt >= 1) {
a_opacity.finish();
a_color.finish();
if (_hiding) {
hideFinish();
}
res = false;
_a_appearance.stop();
} else {
a_opacity.update(dt, anim::linear);
a_color.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
EmojiColorPicker::EmojiColorPicker() :
_ignoreShow(false), _selected(-1), _pressedSel(-1), _hiding(false), a_opacity(0), _shadow(st::dropdownDef.shadow) {
EmojiColorPicker::EmojiColorPicker() : TWidget()
, _ignoreShow(false)
, _a_selected(animation(this, &EmojiColorPicker::step_selected))
, _selected(-1)
, _pressedSel(-1)
, _hiding(false)
, a_opacity(0)
, _a_appearance(animation(this, &EmojiColorPicker::step_appearance))
, _shadow(st::dropdownDef.shadow) {
memset(_variants, 0, sizeof(_variants));
memset(_hovers, 0, sizeof(_hovers));
@ -547,51 +562,52 @@ void EmojiColorPicker::mouseMoveEvent(QMouseEvent *e) {
updateSelected();
}
bool EmojiColorPicker::animStep(float64 ms) {
bool res1 = false, res2 = false;
if (!_cache.isNull()) {
float64 dt = ms / st::dropdownDef.duration;
if (dt >= 1) {
a_opacity.finish();
_cache = QPixmap();
if (_hiding) {
hide();
emit hidden();
} else {
_lastMousePos = QCursor::pos();
updateSelected();
}
void EmojiColorPicker::step_appearance(float64 ms, bool timer) {
if (_cache.isNull()) {
_a_appearance.stop();
return;
}
float64 dt = ms / st::dropdownDef.duration;
if (dt >= 1) {
a_opacity.finish();
_cache = QPixmap();
if (_hiding) {
hide();
emit hidden();
} else {
a_opacity.update(dt, anim::linear);
res1 = true;
_lastMousePos = QCursor::pos();
updateSelected();
}
update();
_a_appearance.stop();
} else {
a_opacity.update(dt, anim::linear);
}
if (!_emojiAnimations.isEmpty()) {
uint64 now = getms();
QRegion toUpdate;
for (EmojiAnimations::iterator i = _emojiAnimations.begin(); i != _emojiAnimations.end();) {
int index = qAbs(i.key()) - 1;
float64 dt = float64(now - i.value()) / st::emojiPanDuration;
if (dt >= 1) {
_hovers[index] = (i.key() > 0) ? 1 : 0;
i = _emojiAnimations.erase(i);
} else {
_hovers[index] = (i.key() > 0) ? dt : (1 - dt);
++i;
}
toUpdate += QRect(st::dropdownDef.shadow.pxWidth() + st::emojiColorsPadding + index * st::emojiPanSize.width() + (index ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.pxHeight() + st::emojiColorsPadding, st::emojiPanSize.width(), st::emojiPanSize.height());
if (timer) update();
}
void EmojiColorPicker::step_selected(uint64 ms, bool timer) {
QRegion toUpdate;
for (EmojiAnimations::iterator i = _emojiAnimations.begin(); i != _emojiAnimations.end();) {
int index = qAbs(i.key()) - 1;
float64 dt = float64(ms - i.value()) / st::emojiPanDuration;
if (dt >= 1) {
_hovers[index] = (i.key() > 0) ? 1 : 0;
i = _emojiAnimations.erase(i);
} else {
_hovers[index] = (i.key() > 0) ? dt : (1 - dt);
++i;
}
res2 = !_emojiAnimations.isEmpty();
rtlupdate(toUpdate.boundingRect());
toUpdate += QRect(st::dropdownDef.shadow.pxWidth() + st::emojiColorsPadding + index * st::emojiPanSize.width() + (index ? 2 * st::emojiColorsPadding + st::emojiColorsSep : 0), st::dropdownDef.shadow.pxHeight() + st::emojiColorsPadding, st::emojiPanSize.width(), st::emojiPanSize.height());
}
return res1 || res2;
if (timer) rtlupdate(toUpdate.boundingRect());
if (_emojiAnimations.isEmpty()) _a_selected.stop();
}
void EmojiColorPicker::hideStart(bool fast) {
if (fast) {
clearSelection(true);
if (animating()) anim::stop(this);
if (_a_appearance.animating()) _a_appearance.stop();
if (_a_selected.animating()) _a_selected.stop();
a_opacity = anim::fvalue(0);
_cache = QPixmap();
hide();
@ -604,7 +620,7 @@ void EmojiColorPicker::hideStart(bool fast) {
}
_hiding = true;
a_opacity.start(0);
anim::start(this);
_a_appearance.start();
}
}
@ -613,8 +629,8 @@ void EmojiColorPicker::showStart() {
_hiding = false;
if (!isHidden() && a_opacity.current() == 1) {
if (animating()) {
anim::stop(this);
if (_a_appearance.animating()) {
_a_appearance.stop();
_cache = QPixmap();
}
return;
@ -626,7 +642,7 @@ void EmojiColorPicker::showStart() {
}
show();
a_opacity.start(1);
anim::start(this);
_a_appearance.start();
}
void EmojiColorPicker::clearSelection(bool fast) {
@ -676,7 +692,7 @@ void EmojiColorPicker::updateSelected() {
}
setCursor((_selected >= 0) ? style::cur_pointer : style::cur_default);
}
if (startanim && !animating()) anim::start(this);
if (startanim && !_a_selected.animating()) _a_selected.start();
}
void EmojiColorPicker::drawVariant(Painter &p, int variant) {
@ -694,8 +710,13 @@ void EmojiColorPicker::drawVariant(Painter &p, int variant) {
p.drawPixmapLeft(w.x() + (st::emojiPanSize.width() - (esize / cIntRetinaFactor())) / 2, w.y() + (st::emojiPanSize.height() - (esize / cIntRetinaFactor())) / 2, width(), App::emojiLarge(), QRect(_variants[variant]->x * esize, _variants[variant]->y * esize, esize, esize));
}
EmojiPanInner::EmojiPanInner() : _maxHeight(int(st::emojiPanMaxHeight)),
_top(0), _selected(-1), _pressedSel(-1), _pickerSel(-1) {
EmojiPanInner::EmojiPanInner() : TWidget()
, _maxHeight(int(st::emojiPanMaxHeight))
, _a_selected(animation(this, &EmojiPanInner::step_selected))
, _top(0)
, _selected(-1)
, _pressedSel(-1)
, _pickerSel(-1) {
resize(st::emojiPanWidth - st::emojiScroll.width, countHeight());
setMouseTracking(true);
@ -1030,7 +1051,7 @@ void EmojiPanInner::clearSelection(bool fast) {
_hovers[tab][sel] = 0;
}
_selected = _pressedSel = -1;
anim::stop(this);
_a_selected.stop();
} else {
updateSelected();
}
@ -1155,15 +1176,14 @@ void EmojiPanInner::updateSelected() {
}
_selected = selIndex;
if (startanim) anim::start(this);
if (startanim && !_a_selected.animating()) _a_selected.start();
}
bool EmojiPanInner::animStep(float64 ms) {
uint64 now = getms();
void EmojiPanInner::step_selected(uint64 ms, bool timer) {
QRegion toUpdate;
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {
int index = qAbs(i.key()) - 1, tab = (index / MatrixRowShift), sel = index % MatrixRowShift;
float64 dt = float64(now - i.value()) / st::emojiPanDuration;
float64 dt = float64(ms - i.value()) / st::emojiPanDuration;
if (dt >= 1) {
_hovers[tab][sel] = (i.key() > 0) ? 1 : 0;
i = _animations.erase(i);
@ -1173,8 +1193,8 @@ bool EmojiPanInner::animStep(float64 ms) {
}
toUpdate += emojiRect(tab, sel);
}
rtlupdate(toUpdate.boundingRect());
return !_animations.isEmpty();
if (timer) rtlupdate(toUpdate.boundingRect());
if (_animations.isEmpty()) _a_selected.stop();
}
void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) {
@ -1197,6 +1217,7 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) {
}
StickerPanInner::StickerPanInner() : TWidget()
, _a_selected(animation(this, &StickerPanInner::step_selected))
, _top(0)
, _selected(-1)
, _pressedSel(-1)
@ -1459,7 +1480,7 @@ void StickerPanInner::clearSelection(bool fast) {
_sets[tab].hovers[sel] = 0;
}
_selected = _pressedSel = -1;
anim::stop(this);
_a_selected.stop();
} else {
updateSelected();
}
@ -1733,7 +1754,7 @@ void StickerPanInner::updateSelected() {
Ui::showStickerPreview(_sets.at(newSelTab).pack.at(newSel % MatrixRowShift));
}
}
if (startanim) anim::start(this);
if (startanim && !_a_selected.animating()) _a_selected.start();
}
void StickerPanInner::onSettings() {
@ -1750,12 +1771,11 @@ void StickerPanInner::onPreview() {
}
}
bool StickerPanInner::animStep(float64 ms) {
uint64 now = getms();
void StickerPanInner::step_selected(uint64 ms, bool timer) {
QRegion toUpdate;
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {
int index = qAbs(i.key()) - 1, tab = (index / MatrixRowShift), sel = index % MatrixRowShift;
float64 dt = float64(now - i.value()) / st::emojiPanDuration;
float64 dt = float64(ms - i.value()) / st::emojiPanDuration;
if (dt >= 1) {
_sets[tab].hovers[sel] = (i.key() > 0) ? 1 : 0;
i = _animations.erase(i);
@ -1765,8 +1785,8 @@ bool StickerPanInner::animStep(float64 ms) {
}
toUpdate += stickerRect(tab, sel);
}
rtlupdate(toUpdate.boundingRect());
return !_animations.isEmpty();
if (timer)rtlupdate(toUpdate.boundingRect());
if (_animations.isEmpty()) _a_selected.stop();
}
void StickerPanInner::showStickerSet(uint64 setId) {
@ -1869,22 +1889,43 @@ void EmojiSwitchButton::paintEvent(QPaintEvent *e) {
}
}
EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent), _maxHeight(st::emojiPanMaxHeight),
_horizontal(false), _noTabUpdate(false), _hiding(false), a_opacity(0), _shadow(st::dropdownDef.shadow),
_recent(this , qsl("emoji_group"), dbietRecent , QString(), true , st::rbEmojiRecent),
_people(this , qsl("emoji_group"), dbietPeople , QString(), false, st::rbEmojiPeople),
_nature(this , qsl("emoji_group"), dbietNature , QString(), false, st::rbEmojiNature),
_food(this , qsl("emoji_group"), dbietFood , QString(), false, st::rbEmojiFood),
_activity(this, qsl("emoji_group"), dbietActivity, QString(), false, st::rbEmojiActivity),
_travel(this , qsl("emoji_group"), dbietTravel , QString(), false, st::rbEmojiTravel),
_objects(this , qsl("emoji_group"), dbietObjects , QString(), false, st::rbEmojiObjects),
_symbols(this , qsl("emoji_group"), dbietSymbols , QString(), false, st::rbEmojiSymbols),
_iconOver(-1), _iconSel(0), _iconDown(-1), _iconsDragging(false),
_iconAnim(animFunc(this, &EmojiPan::iconAnim)),
_iconsLeft(0), _iconsTop(0), _iconsStartX(0), _iconsMax(0), _iconsX(0, 0), _iconSelX(0, 0), _iconsStartAnim(0),
_stickersShown(false), _moveStart(0),
e_scroll(this, st::emojiScroll), e_inner(), e_switch(&e_scroll, true),
s_scroll(this, st::emojiScroll), s_inner(), s_switch(&s_scroll, false), _removingSetId(0) {
EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
, _maxHeight(st::emojiPanMaxHeight)
, _horizontal(false)
, _noTabUpdate(false)
, _hiding(false)
, a_opacity(0)
, _a_appearance(animation(this, &EmojiPan::step_appearance))
, _shadow(st::dropdownDef.shadow)
, _recent(this , qsl("emoji_group"), dbietRecent , QString(), true , st::rbEmojiRecent)
, _people(this , qsl("emoji_group"), dbietPeople , QString(), false, st::rbEmojiPeople)
, _nature(this , qsl("emoji_group"), dbietNature , QString(), false, st::rbEmojiNature)
, _food(this , qsl("emoji_group"), dbietFood , QString(), false, st::rbEmojiFood)
, _activity(this, qsl("emoji_group"), dbietActivity, QString(), false, st::rbEmojiActivity)
, _travel(this , qsl("emoji_group"), dbietTravel , QString(), false, st::rbEmojiTravel)
, _objects(this , qsl("emoji_group"), dbietObjects , QString(), false, st::rbEmojiObjects)
, _symbols(this , qsl("emoji_group"), dbietSymbols , QString(), false, st::rbEmojiSymbols)
, _iconOver(-1)
, _iconSel(0)
, _iconDown(-1)
, _iconsDragging(false)
, _a_icons(animation(this, &EmojiPan::step_icons))
, _iconsLeft(0)
, _iconsTop(0)
, _iconsStartX(0)
, _iconsMax(0)
, _iconsX(0, 0)
, _iconSelX(0, 0)
, _iconsStartAnim(0)
, _stickersShown(false)
, _a_slide(animation(this, &EmojiPan::step_slide))
, e_scroll(this, st::emojiScroll)
, e_inner()
, e_switch(&e_scroll, true)
, s_scroll(this, st::emojiScroll)
, s_inner()
, s_switch(&s_scroll, false)
, _removingSetId(0) {
setFocusPolicy(Qt::NoFocus);
e_scroll.setFocusPolicy(Qt::NoFocus);
e_scroll.viewport()->setFocusPolicy(Qt::NoFocus);
@ -2121,7 +2162,7 @@ void EmojiPan::enterEvent(QEvent *e) {
void EmojiPan::leaveEvent(QEvent *e) {
if (_removingSetId) return;
if (animating()) {
if (_a_appearance.animating()) {
hideStart();
} else {
_hideTimer.start(300);
@ -2134,7 +2175,7 @@ void EmojiPan::otherEnter() {
}
void EmojiPan::otherLeave() {
if (animating()) {
if (_a_appearance.animating()) {
hideStart();
} else {
_hideTimer.start(0);
@ -2170,7 +2211,7 @@ void EmojiPan::mouseMoveEvent(QMouseEvent *e) {
if (newX != _iconsX.current()) {
_iconsX = anim::ivalue(newX, newX);
_iconsStartAnim = 0;
if (_iconAnimations.isEmpty()) _iconAnim.stop();
if (_iconAnimations.isEmpty()) _a_icons.stop();
updateIcons();
}
}
@ -2188,7 +2229,7 @@ void EmojiPan::mouseReleaseEvent(QMouseEvent *e) {
if (newX != _iconsX.current()) {
_iconsX = anim::ivalue(newX, newX);
_iconsStartAnim = 0;
if (_iconAnimations.isEmpty()) _iconAnim.stop();
if (_iconAnimations.isEmpty()) _a_icons.stop();
updateIcons();
}
_iconsDragging = false;
@ -2220,7 +2261,7 @@ bool EmojiPan::event(QEvent *e) {
if (newX != _iconsX.current()) {
_iconsX = anim::ivalue(newX, newX);
_iconsStartAnim = 0;
if (_iconAnimations.isEmpty()) _iconAnim.stop();
if (_iconAnimations.isEmpty()) _a_icons.stop();
updateSelected();
updateIcons();
}
@ -2229,8 +2270,8 @@ bool EmojiPan::event(QEvent *e) {
}
void EmojiPan::fastHide() {
if (animating()) {
anim::stop(this);
if (_a_appearance.animating()) {
_a_appearance.stop();
}
a_opacity = anim::fvalue(0, 0);
_hideTimer.stop();
@ -2254,7 +2295,7 @@ void EmojiPan::onRefreshIcons() {
_iconsX = anim::ivalue(0, 0);
_iconSelX.finish();
_iconsStartAnim = 0;
_iconAnim.stop();
_a_icons.stop();
if (_icons.isEmpty()) {
_iconsMax = 0;
} else {
@ -2330,7 +2371,7 @@ void EmojiPan::updateSelected() {
_iconAnimations.insert(_iconOver + 1, getms());
}
}
if (startanim) _iconAnim.start();
if (startanim && !_a_icons.animating()) _a_icons.start();
}
}
@ -2339,13 +2380,15 @@ void EmojiPan::updateIcons() {
update(r.left(), _iconsTop, r.width(), st::rbEmoji.height);
}
bool EmojiPan::iconAnim(float64 ms) {
if (!_stickersShown) return false;
void EmojiPan::step_icons(uint64 ms, bool timer) {
if (!_stickersShown) {
_a_icons.stop();
return;
}
uint64 now = getms();
for (Animations::iterator i = _iconAnimations.begin(); i != _iconAnimations.end();) {
int index = qAbs(i.key()) - 1;
float64 dt = float64(now - i.value()) / st::emojiPanDuration;
float64 dt = float64(ms - i.value()) / st::emojiPanDuration;
if (index >= _iconHovers.size()) {
i = _iconAnimations.erase(i);
} else if (dt >= 1) {
@ -2358,7 +2401,7 @@ bool EmojiPan::iconAnim(float64 ms) {
}
if (_iconsStartAnim) {
float64 dt = (now - _iconsStartAnim) / st::stickerIconMove;
float64 dt = (ms - _iconsStartAnim) / st::stickerIconMove;
if (dt >= 1) {
_iconsStartAnim = 0;
_iconsX.finish();
@ -2367,55 +2410,56 @@ bool EmojiPan::iconAnim(float64 ms) {
_iconsX.update(dt, anim::linear);
_iconSelX.update(dt, anim::linear);
}
updateSelected();
if (timer) updateSelected();
}
updateIcons();
if (timer) updateIcons();
return !_iconAnimations.isEmpty() || _iconsStartAnim;
if (_iconAnimations.isEmpty() && !_iconsStartAnim) {
_a_icons.stop();
}
}
bool EmojiPan::animStep(float64 ms) {
bool res1 = false;
if (_moveStart) {
float64 movems = getms() - _moveStart;
float64 fullDuration = st::introSlideDelta + st::introSlideDuration, dt = ms / fullDuration;
float64 dt1 = (movems > st::introSlideDuration) ? 1 : (movems / st::introSlideDuration), dt2 = (movems > st::introSlideDelta) ? (movems - st::introSlideDelta) / (st::introSlideDuration) : 0;
if (dt2 >= 1) {
a_fromCoord.finish();
a_fromAlpha.finish();
a_toCoord.finish();
a_toAlpha.finish();
_fromCache = _toCache = QPixmap();
_moveStart = 0;
if (_cache.isNull()) showAll();
} else {
a_fromCoord.update(dt1, st::introHideFunc);
a_fromAlpha.update(dt1, st::introAlphaHideFunc);
a_toCoord.update(dt2, st::introShowFunc);
a_toAlpha.update(dt2, st::introAlphaShowFunc);
res1 = true;
}
void EmojiPan::step_slide(float64 ms, bool timer) {
float64 fullDuration = st::introSlideDelta + st::introSlideDuration, dt = ms / fullDuration;
float64 dt1 = (ms > st::introSlideDuration) ? 1 : (ms / st::introSlideDuration), dt2 = (ms > st::introSlideDelta) ? (ms - st::introSlideDelta) / (st::introSlideDuration) : 0;
if (dt2 >= 1) {
_a_slide.stop();
a_fromCoord.finish();
a_fromAlpha.finish();
a_toCoord.finish();
a_toAlpha.finish();
_fromCache = _toCache = QPixmap();
if (_cache.isNull()) showAll();
} else {
a_fromCoord.update(dt1, st::introHideFunc);
a_fromAlpha.update(dt1, st::introAlphaHideFunc);
a_toCoord.update(dt2, st::introShowFunc);
a_toAlpha.update(dt2, st::introAlphaShowFunc);
}
bool res2 = false;
if (!_cache.isNull()) {
float64 dt = ms / st::dropdownDef.duration;
if (dt >= 1) {
a_opacity.finish();
if (_hiding) {
res1 = false;
hideFinish();
} else {
_cache = QPixmap();
if (_toCache.isNull()) showAll();
}
} else {
a_opacity.update(dt, anim::linear);
res2 = true;
}
if (timer) update();
}
void EmojiPan::step_appearance(float64 ms, bool timer) {
if (_cache.isNull()) {
_a_appearance.stop();
return;
}
update();
return res1 || res2;
float64 dt = ms / st::dropdownDef.duration;
if (dt >= 1) {
_a_appearance.stop();
a_opacity.finish();
if (_hiding) {
hideFinish();
} else {
_cache = QPixmap();
if (_toCache.isNull()) showAll();
}
} else {
a_opacity.update(dt, anim::linear);
}
if (timer) update();
}
void EmojiPan::hideStart() {
@ -2429,14 +2473,14 @@ void EmojiPan::hideStart() {
hideAll();
_hiding = true;
a_opacity.start(0);
anim::start(this);
_a_appearance.start();
}
void EmojiPan::hideFinish() {
hide();
e_inner.hideFinish();
_cache = _toCache = _fromCache = QPixmap();
_moveStart = 0;
_a_slide.stop();
_horizontal = false;
e_scroll.scrollToY(0);
@ -2451,7 +2495,7 @@ void EmojiPan::hideFinish() {
_iconsX = anim::ivalue(0, 0);
_iconSelX = anim::ivalue(0, 0);
_iconsStartAnim = 0;
_iconAnim.stop();
_a_icons.stop();
_iconHovers = _icons.isEmpty() ? QVector<float64>() : QVector<float64>(_icons.size(), 0);
_iconAnimations.clear();
}
@ -2466,7 +2510,7 @@ void EmojiPan::showStart() {
s_inner.preloadImages();
_stickersShown = false;
_fromCache = _toCache = QPixmap();
_moveStart = 0;
_a_slide.stop();
}
if (_cache.isNull()) {
QPixmap from = _fromCache, to = _toCache;
@ -2479,7 +2523,7 @@ void EmojiPan::showStart() {
_hiding = false;
show();
a_opacity.start(1);
anim::start(this);
_a_appearance.start();
emit updateStickers();
}
@ -2626,7 +2670,7 @@ void EmojiPan::onScroll() {
_iconSelX.start(newSel * st::rbEmoji.width);
_iconsX.start(snap((2 * newSel - 7 - ((_icons.isEmpty() || _icons.at(0).sticker) ? 0 : 1)) * int(st::rbEmoji.width) / 2, 0, _iconsMax));
_iconsStartAnim = getms();
_iconAnim.start();
_a_icons.start();
updateSelected();
updateIcons();
}
@ -2642,7 +2686,7 @@ void EmojiPan::onSwitch() {
_iconOver = -1;
_iconHovers = _icons.isEmpty() ? QVector<float64>() : QVector<float64>(_icons.size(), 0);
_iconAnimations.clear();
_iconAnim.stop();
_a_icons.stop();
_cache = QPixmap();
showAll();
@ -2650,7 +2694,6 @@ void EmojiPan::onSwitch() {
_cache = cache;
hideAll();
_moveStart = getms();
if (_stickersShown) {
e_inner.hideFinish();
@ -2661,7 +2704,7 @@ void EmojiPan::onSwitch() {
a_fromCoord = (_stickersShown != rtl()) ? anim::ivalue(0, -st::emojiPanWidth) : anim::ivalue(0, st::emojiPanWidth);
a_fromAlpha = anim::fvalue(1, 0);
if (!animating()) anim::start(this);
_a_slide.start();
update();
}
@ -2966,8 +3009,16 @@ void MentionsInner::onParentGeometryChanged() {
}
}
MentionsDropdown::MentionsDropdown(QWidget *parent) : TWidget(parent),
_scroll(this, st::mentionScroll), _inner(this, &_rows, &_hrows, &_crows), _chat(0), _user(0), _channel(0), _hiding(false), a_opacity(0), _shadow(st::dropdownDef.shadow) {
MentionsDropdown::MentionsDropdown(QWidget *parent) : TWidget(parent)
, _scroll(this, st::mentionScroll)
, _inner(this, &_rows, &_hrows, &_crows)
, _chat(0)
, _user(0)
, _channel(0)
, _hiding(false)
, a_opacity(0)
, _a_appearance(animation(this, &MentionsDropdown::step_appearance))
, _shadow(st::dropdownDef.shadow) {
_hideTimer.setSingleShot(true);
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(hideStart()));
connect(&_inner, SIGNAL(chosen(QString)), this, SIGNAL(chosen(QString)));
@ -2997,7 +3048,7 @@ _scroll(this, st::mentionScroll), _inner(this, &_rows, &_hrows, &_crows), _chat(
void MentionsDropdown::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (animating()) {
if (_a_appearance.animating()) {
p.setOpacity(a_opacity.current());
p.drawPixmap(0, 0, _cache);
return;
@ -3202,8 +3253,8 @@ void MentionsDropdown::recount(bool toDown) {
}
void MentionsDropdown::fastHide() {
if (animating()) {
anim::stop(this);
if (_a_appearance.animating()) {
_a_appearance.stop();
}
a_opacity = anim::fvalue(0, 0);
_hideTimer.stop();
@ -3220,7 +3271,7 @@ void MentionsDropdown::hideStart() {
_hiding = true;
a_opacity.start(0);
setAttribute(Qt::WA_OpaquePaintEvent, false);
anim::start(this);
_a_appearance.start();
}
}
@ -3244,13 +3295,13 @@ void MentionsDropdown::showStart() {
show();
a_opacity.start(1);
setAttribute(Qt::WA_OpaquePaintEvent, false);
anim::start(this);
_a_appearance.start();
}
bool MentionsDropdown::animStep(float64 ms) {
void MentionsDropdown::step_appearance(float64 ms, bool timer) {
float64 dt = ms / st::dropdownDef.duration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_opacity.finish();
_cache = QPixmap();
setAttribute(Qt::WA_OpaquePaintEvent);
@ -3260,12 +3311,10 @@ bool MentionsDropdown::animStep(float64 ms) {
_scroll.show();
_inner.clearSel();
}
res = false;
} else {
a_opacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
const QString &MentionsDropdown::filter() const {

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/twidget.h"
#include "gui/boxshadow.h"
class Dropdown : public TWidget, public Animated {
class Dropdown : public TWidget {
Q_OBJECT
public:
@ -46,12 +46,12 @@ public:
void fastHide();
void ignoreShow(bool ignore = true);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
bool eventFilter(QObject *obj, QEvent *e);
bool overlaps(const QRect &globalRect) {
if (isHidden() || animating()) return false;
if (isHidden() || _a_appearance.animating()) return false;
return QRect(_st.padding.left(),
_st.padding.top(),
@ -91,6 +91,7 @@ private:
bool _hiding;
anim::fvalue a_opacity;
Animation _a_appearance;
QTimer _hideTimer;
@ -98,7 +99,7 @@ private:
};
class DragArea : public TWidget, public Animated {
class DragArea : public TWidget {
Q_OBJECT
public:
@ -119,10 +120,10 @@ public:
void fastHide();
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
bool overlaps(const QRect &globalRect) {
if (isHidden() || animating()) return false;
if (isHidden() || _a_appearance.animating()) return false;
return QRect(st::dragPadding.left(),
st::dragPadding.top(),
@ -148,6 +149,7 @@ private:
anim::fvalue a_opacity;
anim::cvalue a_color;
Animation _a_appearance;
BoxShadow _shadow;
@ -158,7 +160,7 @@ private:
class EmojiPanel;
static const int EmojiColorsCount = 5;
class EmojiColorPicker : public TWidget, public Animated {
class EmojiColorPicker : public TWidget {
Q_OBJECT
public:
@ -174,7 +176,8 @@ public:
void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void step_selected(uint64 ms, bool timer);
void showStart();
void clearSelection(bool fast = false);
@ -200,6 +203,7 @@ private:
typedef QMap<int32, uint64> EmojiAnimations; // index - showing, -index - hiding
EmojiAnimations _emojiAnimations;
Animation _a_selected;
float64 _hovers[EmojiColorsCount + 1];
@ -210,6 +214,7 @@ private:
QPixmap _cache;
anim::fvalue a_opacity;
Animation _a_appearance;
QTimer _hideTimer;
@ -217,7 +222,7 @@ private:
};
class EmojiPanInner : public TWidget, public Animated {
class EmojiPanInner : public TWidget {
Q_OBJECT
public:
@ -234,7 +239,7 @@ public:
void leaveToChildEvent(QEvent *e);
void enterFromChildEvent(QEvent *e);
bool animStep(float64 ms);
void step_selected(uint64 ms, bool timer);
void hideFinish();
void showEmojiPack(DBIEmojiTab packIndex);
@ -283,6 +288,7 @@ private:
typedef QMap<int32, uint64> Animations; // index - showing, -index - hiding
Animations _animations;
Animation _a_selected;
int32 _top, _counts[emojiTabCount];
@ -310,7 +316,7 @@ struct StickerIcon {
int32 pixw, pixh;
};
class StickerPanInner : public TWidget, public Animated {
class StickerPanInner : public TWidget {
Q_OBJECT
public:
@ -327,7 +333,7 @@ public:
void leaveToChildEvent(QEvent *e);
void enterFromChildEvent(QEvent *e);
bool animStep(float64 ms);
void step_selected(uint64 ms, bool timer);
void showStickerSet(uint64 setId);
@ -376,6 +382,7 @@ private:
typedef QMap<int32, uint64> Animations; // index - showing, -index - hiding
Animations _animations;
Animation _a_selected;
int32 _top;
@ -454,7 +461,7 @@ protected:
};
class EmojiPan : public TWidget, public Animated {
class EmojiPan : public TWidget {
Q_OBJECT
public:
@ -480,9 +487,9 @@ public:
return _hiding || _hideTimer.isActive();
}
bool animStep(float64 ms);
bool iconAnim(float64 ms);
void step_appearance(float64 ms, bool timer);
void step_slide(float64 ms, bool timer);
void step_icons(uint64 ms, bool timer);
bool eventFilter(QObject *obj, QEvent *e);
void stickersInstalled(uint64 setId);
@ -547,6 +554,7 @@ private:
QPixmap _cache;
anim::fvalue a_opacity;
Animation _a_appearance;
QTimer _hideTimer;
@ -559,7 +567,7 @@ private:
bool _iconsDragging;
typedef QMap<int32, uint64> Animations; // index - showing, -index - hiding
Animations _iconAnimations;
Animation _iconAnim;
Animation _a_icons;
QPoint _iconsMousePos, _iconsMouseDown;
int32 _iconsLeft, _iconsTop;
int32 _iconsStartX, _iconsMax;
@ -570,7 +578,7 @@ private:
QPixmap _fromCache, _toCache;
anim::ivalue a_fromCoord, a_toCoord;
anim::fvalue a_fromAlpha, a_toAlpha;
uint64 _moveStart;
Animation _a_slide;
ScrollArea e_scroll;
EmojiPanInner e_inner;
@ -590,7 +598,7 @@ typedef QList<QString> HashtagRows;
typedef QList<QPair<UserData*, const BotCommand*> > BotCommandRows;
class MentionsDropdown;
class MentionsInner : public QWidget {
class MentionsInner : public TWidget {
Q_OBJECT
public:
@ -636,7 +644,7 @@ private:
bool _overDelete;
};
class MentionsDropdown : public TWidget, public Animated {
class MentionsDropdown : public TWidget {
Q_OBJECT
public:
@ -652,7 +660,7 @@ public:
void updateFiltered(bool toDown = false);
void setBoundings(QRect boundings);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
const QString &filter() const;
ChatData *chat() const;
@ -706,6 +714,7 @@ private:
bool _hiding;
anim::fvalue a_opacity;
Animation _a_appearance;
QTimer _hideTimer;

View file

@ -26,7 +26,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "window.h"
namespace {
AnimationManager *manager = 0;
AnimationManager *_manager = 0;
};
namespace anim {
@ -78,34 +78,34 @@ namespace anim {
return delta * (t2 * t2 * t + 1);
}
void start(Animated *obj) {
if (!manager) return;
manager->start(obj);
}
void step(Animated *obj) {
if (!manager) return;
manager->step(obj);
}
void stop(Animated *obj) {
if (!manager) return;
manager->stop(obj);
}
void startManager() {
delete manager;
manager = new AnimationManager();
delete _manager;
_manager = new AnimationManager();
}
void stopManager() {
delete manager;
manager = 0;
delete _manager;
_manager = 0;
}
}
bool AnimatedGif::animStep(float64 ms) {
void Animation::start() {
if (!_manager) return;
_cb->start();
_manager->start(this);
_animating = true;
}
void Animation::stop() {
if (!_manager) return;
_animating = false;
_manager->stop(this);
}
void AnimatedGif::step_frame(float64 ms, bool timer) {
int32 f = frame;
while (f < images.size() && ms > delays[f]) {
++f;
@ -152,13 +152,14 @@ bool AnimatedGif::animStep(float64 ms) {
}
if (frame != f) {
frame = f;
if (msg && App::main()) {
App::main()->msgUpdated(msg);
} else {
emit updated();
if (timer) {
if (msg && App::main()) {
App::main()->msgUpdated(msg);
} else {
emit updated();
}
}
}
return true;
}
void AnimatedGif::start(HistoryItem *row, const FileLocation &f) {
@ -205,7 +206,7 @@ void AnimatedGif::start(HistoryItem *row, const FileLocation &f) {
msg = row;
anim::start(this);
_a_frames.start();
if (msg) {
msg->initDimensions();
if (App::main()) App::main()->itemResized(msg, true);
@ -233,7 +234,7 @@ void AnimatedGif::stop(bool onItemRemoved) {
delays.clear();
w = h = frame = framesCount = duration = 0;
anim::stop(this);
_a_frames.stop();
if (row && !onItemRemoved) {
row->initDimensions();
if (App::main()) App::main()->itemResized(row, true);

View file

@ -24,8 +24,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include <QtCore/QTimer>
#include <QtGui/QColor>
class Animated;
namespace anim {
typedef float64 (*transition)(const float64 &delta, const float64 &dt);
@ -187,216 +185,203 @@ namespace anim {
float64 _from_r, _from_g, _from_b, _from_a, _delta_r, _delta_g, _delta_b, _delta_a;
};
void start(Animated *obj);
void step(Animated *obj);
void stop(Animated *obj);
void startManager();
void stopManager();
};
class Animated {
class Animation;
class AnimationCallbacks {
public:
virtual void start() {
}
virtual void step(Animation *a, uint64 ms, bool timer) = 0;
virtual ~AnimationCallbacks() {
}
};
class Animation {
public:
Animated() : animStarted(0), animInProcess(false) {
Animation(AnimationCallbacks *cb) : _cb(cb), _animating(false) {
}
virtual bool animStep(float64 ms) = 0;
void start();
void stop();
void animReset() {
animStarted = float64(getms());
void step(uint64 ms, bool timer = false) {
_cb->step(this, ms, timer);
}
virtual ~Animated() {
if (animating()) {
anim::stop(this);
}
void step() {
step(getms(), false);
}
bool animating() const {
return animInProcess;
}
private:
float64 animStarted;
bool animInProcess;
friend class AnimationManager;
};
class AnimationFunc {
public:
virtual bool animStep(float64 ms) = 0;
virtual ~AnimationFunc() {
}
};
template <typename Type>
class AnimationFuncOwned : public AnimationFunc {
public:
typedef bool (Type::*Method)(float64);
AnimationFuncOwned(Type *obj, Method method) : _obj(obj), _method(method) {
}
bool animStep(float64 ms) {
return (_obj->*_method)(ms);
}
private:
Type *_obj;
Method _method;
};
template <typename Type>
AnimationFunc *animFunc(Type *obj, typename AnimationFuncOwned<Type>::Method method) {
return new AnimationFuncOwned<Type>(obj, method);
}
class Animation : public Animated {
public:
Animation(AnimationFunc *func) : _func(func) {
}
void start() {
anim::start(this);
}
void stop() {
anim::stop(this);
}
//Animation
bool animStep(float64 ms) {
return _func->animStep(ms);
return _animating;
}
~Animation() {
delete _func;
if (_animating) stop();
delete _cb;
}
private:
AnimationFunc *_func;
AnimationCallbacks *_cb;
bool _animating;
};
template <typename Type>
class AnimationCallbacksRelative : public AnimationCallbacks {
public:
typedef void (Type::*Method)(float64, bool);
AnimationCallbacksRelative(Type *obj, Method method) : _started(0), _obj(obj), _method(method) {
}
void start() {
_started = float64(getms());
}
void step(Animation *a, uint64 ms, bool timer) {
(_obj->*_method)(ms - _started, timer);
}
private:
float64 _started;
Type *_obj;
Method _method;
};
template <typename Type>
AnimationCallbacks *animation(Type *obj, typename AnimationCallbacksRelative<Type>::Method method) {
return new AnimationCallbacksRelative<Type>(obj, method);
}
template <typename Type>
class AnimationCallbacksAbsolute : public AnimationCallbacks {
public:
typedef void (Type::*Method)(uint64, bool);
AnimationCallbacksAbsolute(Type *obj, Method method) : _obj(obj), _method(method) {
}
void step(Animation *a, uint64 ms, bool timer) {
(_obj->*_method)(ms, timer);
}
private:
Type *_obj;
Method _method;
};
template <typename Type>
AnimationCallbacks *animation(Type *obj, typename AnimationCallbacksAbsolute<Type>::Method method) {
return new AnimationCallbacksAbsolute<Type>(obj, method);
}
class AnimationManager : public QObject {
Q_OBJECT
public:
AnimationManager() : timer(this), iterating(false) {
timer.setSingleShot(false);
connect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
AnimationManager() : _timer(this), _iterating(false) {
_timer.setSingleShot(false);
connect(&_timer, SIGNAL(timeout()), this, SLOT(timeout()));
}
void start(Animated *obj) {
obj->animReset();
if (iterating) {
toStart.insert(obj);
if (!toStop.isEmpty()) {
toStop.remove(obj);
void start(Animation *obj) {
if (_iterating) {
_starting.insert(obj, NullType());
if (!_stopping.isEmpty()) {
_stopping.remove(obj);
}
} else {
if (!objs.size()) {
timer.start(AnimationTimerDelta);
}
objs.insert(obj);
}
obj->animInProcess = true;
}
void step(Animated *obj) {
if (iterating) return;
float64 ms = float64(getms());
AnimObjs::iterator i = objs.find(obj);
if (i != objs.cend()) {
Animated *obj = *i;
if (!obj->animStep(ms - obj->animStarted)) {
objs.erase(i);
if (!objs.size()) {
timer.stop();
}
obj->animInProcess = false;
if (_objects.isEmpty()) {
_timer.start(AnimationTimerDelta);
}
_objects.insert(obj, NullType());
}
}
void stop(Animated *obj) {
if (iterating) {
toStop.insert(obj);
if (!toStart.isEmpty()) {
toStart.insert(obj);
void stop(Animation *obj) {
if (_iterating) {
_stopping.insert(obj, NullType());
if (!_starting.isEmpty()) {
_starting.insert(obj, NullType());
}
} else {
AnimObjs::iterator i = objs.find(obj);
if (i != objs.cend()) {
objs.erase(i);
if (!objs.size()) {
timer.stop();
AnimatingObjects::iterator i = _objects.find(obj);
if (i != _objects.cend()) {
_objects.erase(i);
if (_objects.isEmpty()) {
_timer.stop();
}
}
}
obj->animInProcess = false;
}
public slots:
void timeout() {
iterating = true;
float64 ms = float64(getms());
for (AnimObjs::iterator i = objs.begin(), e = objs.end(); i != e; ) {
Animated *obj = *i;
if (!obj->animStep(ms - obj->animStarted)) {
i = objs.erase(i);
obj->animInProcess = false;
} else {
++i;
}
_iterating = true;
uint64 ms = getms();
for (AnimatingObjects::const_iterator i = _objects.begin(), e = _objects.end(); i != e; ++i) {
i.key()->step(ms, true);
}
iterating = false;
if (!toStart.isEmpty()) {
for (AnimObjs::iterator i = toStart.begin(), e = toStart.end(); i != e; ++i) {
objs.insert(*i);
_iterating = false;
if (!_starting.isEmpty()) {
for (AnimatingObjects::iterator i = _starting.begin(), e = _starting.end(); i != e; ++i) {
_objects.insert(i.key(), NullType());
}
toStart.clear();
_starting.clear();
}
if (!toStop.isEmpty()) {
for (AnimObjs::iterator i = toStop.begin(), e = toStop.end(); i != e; ++i) {
objs.remove(*i);
if (!_stopping.isEmpty()) {
for (AnimatingObjects::iterator i = _stopping.begin(), e = _stopping.end(); i != e; ++i) {
_objects.remove(i.key());
}
toStop.clear();
_stopping.clear();
}
if (!objs.size()) {
timer.stop();
if (!_objects.size()) {
_timer.stop();
}
}
private:
typedef QSet<Animated*> AnimObjs;
AnimObjs objs;
AnimObjs toStart;
AnimObjs toStop;
QTimer timer;
bool iterating;
typedef QMap<Animation*, NullType> AnimatingObjects;
AnimatingObjects _objects, _starting, _stopping;
QTimer _timer;
bool _iterating;
};
class HistoryItem;
class FileLocation;
class AnimatedGif : public QObject, public Animated {
class AnimatedGif : public QObject {
Q_OBJECT
public:
AnimatedGif() : msg(0), file(0), access(false), reader(0), w(0), h(0), frame(0), framesCount(0), duration(0) {
AnimatedGif() : QObject()
, msg(0)
, file(0)
, access(false)
, reader(0)
, w(0)
, h(0)
, frame(0)
, framesCount(0)
, duration(0)
, _a_frames(animation(this, &AnimatedGif::step_frame)) {
}
bool animStep(float64 ms);
void step_frame(float64 ms, bool timer);
void start(HistoryItem *row, const FileLocation &file);
void stop(bool onItemRemoved = false);
@ -430,4 +415,7 @@ private:
QVector<QImage> images;
QVector<int64> delays;
int32 framesCount, duration;
Animation _a_frames;
};

View file

@ -21,10 +21,14 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "gui/flatbutton.h"
FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent),
_text(text),
_st(st), _autoFontPadding(0),
a_bg(st.bgColor->c), a_text(st.color->c), _opacity(1) {
FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent)
, _text(text)
, _st(st)
, _autoFontPadding(0)
, a_bg(st.bgColor->c)
, a_text(st.color->c)
, _a_appearance(animation(this, &FlatButton::step_appearance))
, _opacity(1) {
if (_st.width < 0) {
_st.width = textWidth() - _st.width;
} else if (!_st.width) {
@ -88,19 +92,17 @@ void FlatButton::resizeEvent(QResizeEvent *e) {
return Button::resizeEvent(e);
}
bool FlatButton::animStep(float64 ms) {
void FlatButton::step_appearance(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_bg.finish();
a_text.finish();
res = false;
} else {
a_bg.update(dt, anim::linear);
a_text.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void FlatButton::onStateChange(int oldState, ButtonStateChangeSource source) {
@ -110,12 +112,12 @@ void FlatButton::onStateChange(int oldState, ButtonStateChangeSource source) {
a_bg.start(bgColorTo->c);
a_text.start(colorTo->c);
if (source == ButtonByUser || source == ButtonByPress) {
anim::stop(this);
_a_appearance.stop();
a_bg.finish();
a_text.finish();
update();
} else {
anim::start(this);
_a_appearance.start();
}
}
@ -164,8 +166,14 @@ void LinkButton::onStateChange(int oldState, ButtonStateChangeSource source) {
LinkButton::~LinkButton() {
}
IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent),
_text(text), _st(st), _width(_st.width), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) {
IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent)
, _text(text)
, _st(st)
, _width(_st.width)
, a_opacity(_st.opacity)
, a_bg(_st.bgColor->c)
, _a_appearance(animation(this, &IconedButton::step_appearance))
, _opacity(1) {
if (_width < 0) {
_width = _st.font->width(text) - _width;
@ -199,25 +207,23 @@ QString IconedButton::getText() const {
return _text;
}
bool IconedButton::animStep(float64 ms) {
bool res = true;
void IconedButton::step_appearance(float64 ms, bool timer) {
if (_st.duration <= 1) {
_a_appearance.stop();
a_opacity.finish();
a_bg.finish();
res = false;
} else {
float64 dt = ms / _st.duration;
if (dt >= 1) {
_a_appearance.stop();
a_opacity.finish();
a_bg.finish();
res = false;
} else {
a_opacity.update(dt, anim::linear);
a_bg.update(dt, anim::linear);
}
}
update();
return res;
if (timer) update();
}
void IconedButton::onStateChange(int oldState, ButtonStateChangeSource source) {
@ -225,12 +231,12 @@ void IconedButton::onStateChange(int oldState, ButtonStateChangeSource source) {
a_bg.start(((_state & (StateOver | StateDown)) ? _st.overBgColor : _st.bgColor)->c);
if (source == ButtonByUser || source == ButtonByPress) {
anim::stop(this);
_a_appearance.stop();
a_opacity.finish();
a_bg.finish();
update();
} else {
anim::start(this);
_a_appearance.start();
}
}
@ -283,10 +289,14 @@ void MaskedButton::paintEvent(QPaintEvent *e) {
}
}
BoxButton::BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st) : Button(parent),
_text(text.toUpper()), _fullText(text.toUpper()), _textWidth(st.font->width(_text)),
_st(st),
a_textBgOverOpacity(0), a_textFg(st.textFg->c), _a_over(animFunc(this, &BoxButton::animStep_over)) {
BoxButton::BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st) : Button(parent)
, _text(text.toUpper())
, _fullText(text.toUpper())
, _textWidth(st.font->width(_text))
, _st(st)
, a_textBgOverOpacity(0)
, a_textFg(st.textFg->c)
, _a_over(animation(this, &BoxButton::step_over)) {
if (_st.width <= 0) {
resize(_textWidth - _st.width, _st.height);
} else {
@ -322,19 +332,17 @@ void BoxButton::paintEvent(QPaintEvent *e) {
p.drawText((width() - _textWidth) / 2, _st.textTop + _st.font->ascent, _text);
}
bool BoxButton::animStep_over(float64 ms) {
void BoxButton::step_over(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_over.stop();
a_textFg.finish();
a_textBgOverOpacity.finish();
res = false;
} else {
a_textFg.update(dt, anim::linear);
a_textBgOverOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void BoxButton::onStateChange(int oldState, ButtonStateChangeSource source) {

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/animation.h"
#include "style.h"
class FlatButton : public Button, public Animated {
class FlatButton : public Button {
Q_OBJECT
public:
@ -34,7 +34,7 @@ public:
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void paintEvent(QPaintEvent *e);
void setOpacity(float64 o);
float64 opacity() const;
@ -63,7 +63,10 @@ private:
style::font _autoFont;
anim::cvalue a_bg, a_text;
Animation _a_appearance;
float64 _opacity;
};
class LinkButton : public Button {
@ -89,14 +92,14 @@ private:
style::linkButton _st;
};
class IconedButton : public Button, public Animated {
class IconedButton : public Button {
Q_OBJECT
public:
IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text = QString());
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void paintEvent(QPaintEvent *e);
void setOpacity(float64 o);
@ -117,6 +120,7 @@ protected:
anim::fvalue a_opacity;
anim::cvalue a_bg;
Animation _a_appearance;
float64 _opacity;
};
@ -141,7 +145,7 @@ public:
void paintEvent(QPaintEvent *e);
bool animStep_over(float64 ms);
void step_over(float64 ms, bool timer);
public slots:

View file

@ -24,8 +24,13 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "flatcheckbox.h"
FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent),
_st(st), a_over(0, 0), _text(text), _opacity(1), _checked(checked) {
FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent)
, _st(st)
, a_over(0, 0)
, _a_appearance(animation(this, &FlatCheckbox::step_appearance))
, _text(text)
, _opacity(1)
, _checked(checked) {
connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
setCursor(_st.cursor);
@ -60,17 +65,17 @@ void FlatCheckbox::onClicked() {
void FlatCheckbox::onStateChange(int oldState, ButtonStateChangeSource source) {
if ((_state & StateOver) && !(oldState & StateOver)) {
a_over.start(1);
anim::start(this);
_a_appearance.start();
} else if (!(_state & StateOver) && (oldState & StateOver)) {
a_over.start(0);
anim::start(this);
_a_appearance.start();
}
if ((_state & StateDisabled) && !(oldState & StateDisabled)) {
setCursor(_st.disabledCursor);
anim::start(this);
_a_appearance.start();
} else if (!(_state & StateDisabled) && (oldState & StateDisabled)) {
setCursor(_st.cursor);
anim::start(this);
_a_appearance.start();
}
}
@ -114,17 +119,15 @@ void FlatCheckbox::paintEvent(QPaintEvent *e) {
}
}
bool FlatCheckbox::animStep(float64 ms) {
void FlatCheckbox::step_appearance(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_over.finish();
res = false;
} else {
a_over.update(dt, _st.bgFunc);
}
update();
return res;
if (timer) update();
}
template <typename Type>
@ -135,7 +138,8 @@ public:
TemplateRadiobuttonsGroup(const QString &name) : _name(name), _val(0) {
}
void remove(Type * const &radio);
void remove(Type * const &radio) {
}
int32 val() const {
return _val;
}
@ -232,12 +236,16 @@ FlatRadiobutton::~FlatRadiobutton() {
reinterpret_cast<FlatRadiobuttonGroup*>(_group)->remove(this);
}
Checkbox::Checkbox(QWidget *parent, const QString &text, bool checked, const style::Checkbox &st) : Button(parent),
_st(st),
a_over(0), a_checked(checked ? 1 : 0),
_a_over(animFunc(this, &Checkbox::animStep_over)), _a_checked(animFunc(this, &Checkbox::animStep_checked)),
_text(text), _fullText(text), _textWidth(st.font->width(text)),
_checked(checked) {
Checkbox::Checkbox(QWidget *parent, const QString &text, bool checked, const style::Checkbox &st) : Button(parent)
, _st(st)
, a_over(0)
, a_checked(checked ? 1 : 0)
, _a_over(animation(this, &Checkbox::step_over))
, _a_checked(animation(this, &Checkbox::step_checked))
, _text(text)
, _fullText(text)
, _textWidth(st.font->width(text))
, _checked(checked) {
if (_st.width <= 0) {
resize(_textWidth - _st.width, _st.height);
} else {
@ -275,30 +283,26 @@ void Checkbox::setChecked(bool checked) {
}
}
bool Checkbox::animStep_over(float64 ms) {
void Checkbox::step_over(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_over.stop();
a_over.finish();
res = false;
} else {
a_over.update(dt, anim::linear);
}
update(_checkRect);
return res;
if (timer) update(_checkRect);
}
bool Checkbox::animStep_checked(float64 ms) {
void Checkbox::step_checked(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
a_checked.finish();
res = false;
_a_checked.stop();
} else {
a_checked.update(dt, anim::linear);
}
update(_checkRect);
return res;
if (timer) update(_checkRect);
}
void Checkbox::paintEvent(QPaintEvent *e) {
@ -372,12 +376,18 @@ void Checkbox::onStateChange(int oldState, ButtonStateChangeSource source) {
}
}
Radiobutton::Radiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::Radiobutton &st) : Button(parent),
_st(st),
a_over(0), a_checked(checked ? 1 : 0),
_a_over(animFunc(this, &Radiobutton::animStep_over)), _a_checked(animFunc(this, &Radiobutton::animStep_checked)),
_text(text), _fullText(text), _textWidth(st.font->width(text)),
_checked(checked), _group(radiobuttons.reg(group)), _value(value) {
Radiobutton::Radiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::Radiobutton &st) : Button(parent)
, _st(st)
, a_over(0)
, a_checked(checked ? 1 : 0)
, _a_over(animation(this, &Radiobutton::step_over))
, _a_checked(animation(this, &Radiobutton::step_checked))
, _text(text)
, _fullText(text)
, _textWidth(st.font->width(text))
, _checked(checked)
, _group(radiobuttons.reg(group))
, _value(value) {
if (_st.width <= 0) {
resize(_textWidth - _st.width, _st.height);
} else {
@ -419,30 +429,26 @@ void Radiobutton::setChecked(bool checked) {
}
}
bool Radiobutton::animStep_over(float64 ms) {
void Radiobutton::step_over(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_over.stop();
a_over.finish();
res = false;
} else {
a_over.update(dt, anim::linear);
}
update(_checkRect);
return res;
if (timer) update(_checkRect);
}
bool Radiobutton::animStep_checked(float64 ms) {
void Radiobutton::step_checked(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
a_checked.finish();
res = false;
_a_checked.stop();
} else {
a_checked.update(dt, anim::linear);
}
update(_checkRect);
return res;
if (timer) update(_checkRect);
}
void Radiobutton::paintEvent(QPaintEvent *e) {

View file

@ -22,7 +22,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/button.h"
class FlatCheckbox : public Button, public Animated {
class FlatCheckbox : public Button {
Q_OBJECT
public:
@ -32,7 +32,7 @@ public:
bool checked() const;
void setChecked(bool checked);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void paintEvent(QPaintEvent *e);
void setOpacity(float64 o);
@ -50,6 +50,8 @@ private:
style::flatCheckbox _st;
anim::fvalue a_over;
Animation _a_appearance;
QString _text;
style::font _font;
@ -91,8 +93,8 @@ public:
bool checked() const;
void setChecked(bool checked);
bool animStep_over(float64 ms);
bool animStep_checked(float64 ms);
void step_over(float64 ms, bool timer);
void step_checked(float64 ms, bool timer);
void paintEvent(QPaintEvent *e);
@ -133,8 +135,8 @@ public:
return _value;
}
bool animStep_over(float64 ms);
bool animStep_checked(float64 ms);
void step_over(float64 ms, bool timer);
void step_checked(float64 ms, bool timer);
void paintEvent(QPaintEvent *e);

View file

@ -51,10 +51,20 @@ namespace {
InputStyle<MaskedInputField> _inputFieldStyle;
}
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent),
_oldtext(v), _fullph(pholder), _fastph(false), _customUpDown(false), _phVisible(!v.length()),
a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), _st(st) {
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent)
, _oldtext(v)
, _fullph(pholder)
, _fastph(false)
, _customUpDown(false)
, _phVisible(!v.length())
, a_phLeft(_phVisible ? 0 : st.phShift)
, a_phAlpha(_phVisible ? 1 : 0)
, a_phColor(st.phColor->c)
, a_borderColor(st.borderColor->c)
, a_bgColor(st.bgColor->c)
, _a_appearance(animation(this, &FlatInput::step_appearance))
, _notingBene(0)
, _st(st) {
resize(_st.width, _st.height);
setFont(_st.font->f);
@ -158,7 +168,7 @@ void FlatInput::paintEvent(QPaintEvent *e) {
}
bool phDraw = _phVisible;
if (animating()) {
if (_a_appearance.animating()) {
p.setOpacity(a_phAlpha.current());
phDraw = true;
}
@ -180,7 +190,7 @@ void FlatInput::focusInEvent(QFocusEvent *e) {
a_borderColor.start(_st.borderActive->c);
}
a_bgColor.start(_st.bgActive->c);
anim::start(this);
_a_appearance.start();
QLineEdit::focusInEvent(e);
emit focused();
}
@ -191,7 +201,7 @@ void FlatInput::focusOutEvent(QFocusEvent *e) {
a_borderColor.start(_st.borderColor->c);
}
a_bgColor.start(_st.bgColor->c);
anim::start(this);
_a_appearance.start();
QLineEdit::focusOutEvent(e);
emit blurred();
}
@ -224,11 +234,10 @@ QSize FlatInput::minimumSizeHint() const {
return geometry().size();
}
bool FlatInput::animStep(float64 ms) {
void FlatInput::step_appearance(float64 ms, bool timer) {
float dt = ms / _st.phDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_appearance.stop();
a_phLeft.finish();
a_phAlpha.finish();
a_phColor.finish();
@ -236,8 +245,8 @@ bool FlatInput::animStep(float64 ms) {
if (_notingBene > 0) {
_notingBene = -1;
a_borderColor.start((hasFocus() ? _st.borderActive : _st.borderColor)->c);
anim::start(this);
return true;
_a_appearance.start();
return;
} else if (_notingBene) {
_notingBene = 0;
}
@ -249,8 +258,7 @@ bool FlatInput::animStep(float64 ms) {
a_bgColor.update(dt, _st.phColorFunc);
a_borderColor.update(dt, _st.phColorFunc);
}
update();
return res;
if (timer) update();
}
void FlatInput::setPlaceholder(const QString &ph) {
@ -279,7 +287,7 @@ void FlatInput::updatePlaceholder() {
} else {
a_phLeft.start(vis ? 0 : _st.phShift);
a_phAlpha.start(vis ? 1 : 0);
anim::start(this);
_a_appearance.start();
}
_phVisible = vis;
}
@ -345,11 +353,11 @@ void FlatInput::notaBene() {
_notingBene = 1;
setFocus();
a_borderColor.start(_st.borderError->c);
anim::start(this);
_a_appearance.start();
}
CountryCodeInput::CountryCodeInput(QWidget *parent, const style::flatInput &st) : FlatInput(parent, st), _nosignal(false) {
CountryCodeInput::CountryCodeInput(QWidget *parent, const style::flatInput &st) : FlatInput(parent, st)
, _nosignal(false) {
}
void CountryCodeInput::startErasing(QKeyEvent *e) {
@ -541,38 +549,39 @@ void PhonePartInput::onChooseCode(const QString &code) {
updatePlaceholder();
}
InputArea::InputArea(QWidget *parent, const style::InputArea &st, const QString &ph, const QString &val) : TWidget(parent),
_maxLength(-1),
_inner(this),
_oldtext(val),
InputArea::InputArea(QWidget *parent, const style::InputArea &st, const QString &ph, const QString &val) : TWidget(parent)
, _maxLength(-1)
, _inner(this)
, _oldtext(val)
_ctrlEnterSubmit(CtrlEnterSubmitCtrlEnter),
_undoAvailable(false),
_redoAvailable(false),
_inHeightCheck(false),
, _ctrlEnterSubmit(CtrlEnterSubmitCtrlEnter)
, _undoAvailable(false)
, _redoAvailable(false)
, _inHeightCheck(false)
_customUpDown(false),
, _customUpDown(false)
_placeholderFull(ph),
_placeholderVisible(val.isEmpty()),
a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift),
a_placeholderOpacity(_placeholderVisible ? 1 : 0),
a_placeholderFg(st.placeholderFg->c),
_a_placeholderFg(animFunc(this, &InputArea::animStep_placeholderFg)),
_a_placeholderShift(animFunc(this, &InputArea::animStep_placeholderShift)),
, _placeholderFull(ph)
, _placeholderVisible(val.isEmpty())
, a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift)
, a_placeholderOpacity(_placeholderVisible ? 1 : 0)
, a_placeholderFg(st.placeholderFg->c)
, _a_placeholderFg(animation(this, &InputArea::step_placeholderFg))
, _a_placeholderShift(animation(this, &InputArea::step_placeholderShift))
a_borderOpacityActive(0),
a_borderFg(st.borderFg->c),
_a_border(animFunc(this, &InputArea::animStep_border)),
, a_borderOpacityActive(0)
, a_borderFg(st.borderFg->c)
, _a_border(animation(this, &InputArea::step_border))
_focused(false), _error(false),
, _focused(false)
, _error(false)
_st(st),
, _st(st)
_touchPress(false),
_touchRightButton(false),
_touchMove(false),
_correcting(false) {
, _touchPress(false)
, _touchRightButton(false)
, _touchMove(false)
, _correcting(false) {
_inner.setAcceptRichText(false);
resize(_st.width, _st.heightMin);
@ -1106,47 +1115,42 @@ void InputArea::onRedoAvailable(bool avail) {
if (App::wnd()) App::wnd()->updateGlobalMenu();
}
bool InputArea::animStep_placeholderFg(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void InputArea::step_placeholderFg(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderFg.stop();
a_placeholderFg.finish();
} else {
a_placeholderFg.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool InputArea::animStep_placeholderShift(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void InputArea::step_placeholderShift(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderShift.stop();
a_placeholderLeft.finish();
a_placeholderOpacity.finish();
} else {
a_placeholderLeft.update(dt, anim::linear);
a_placeholderOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool InputArea::animStep_border(float64 ms) {
float dt = ms / _st.duration;
void InputArea::step_border(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
res = false;
_a_border.stop();
a_borderFg.finish();
a_borderOpacityActive.finish();
} else {
a_borderFg.update(dt, anim::linear);
a_borderOpacityActive.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void InputArea::updatePlaceholder() {
@ -1261,36 +1265,37 @@ void InputArea::showError() {
}
}
InputField::InputField(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : TWidget(parent),
_maxLength(-1),
_inner(this),
_oldtext(val),
InputField::InputField(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : TWidget(parent)
, _maxLength(-1)
, _inner(this)
, _oldtext(val)
_undoAvailable(false),
_redoAvailable(false),
, _undoAvailable(false)
, _redoAvailable(false)
_customUpDown(true),
, _customUpDown(true)
_placeholderFull(ph),
_placeholderVisible(val.isEmpty()),
a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift),
a_placeholderOpacity(_placeholderVisible ? 1 : 0),
a_placeholderFg(st.placeholderFg->c),
_a_placeholderFg(animFunc(this, &InputField::animStep_placeholderFg)),
_a_placeholderShift(animFunc(this, &InputField::animStep_placeholderShift)),
, _placeholderFull(ph)
, _placeholderVisible(val.isEmpty())
, a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift)
, a_placeholderOpacity(_placeholderVisible ? 1 : 0)
, a_placeholderFg(st.placeholderFg->c)
, _a_placeholderFg(animation(this, &InputField::step_placeholderFg))
, _a_placeholderShift(animation(this, &InputField::step_placeholderShift))
a_borderOpacityActive(0),
a_borderFg(st.borderFg->c),
_a_border(animFunc(this, &InputField::animStep_border)),
, a_borderOpacityActive(0)
, a_borderFg(st.borderFg->c)
, _a_border(animation(this, &InputField::step_border))
_focused(false), _error(false),
, _focused(false)
, _error(false)
_st(st),
, _st(st)
_touchPress(false),
_touchRightButton(false),
_touchMove(false),
_correcting(false) {
, _touchPress(false)
, _touchRightButton(false)
, _touchMove(false)
, _correcting(false) {
_inner.setAcceptRichText(false);
resize(_st.width, _st.height);
@ -1834,47 +1839,41 @@ void InputField::selectAll() {
_inner.setTextCursor(c);
}
bool InputField::animStep_placeholderFg(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void InputField::step_placeholderFg(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderFg.stop();
a_placeholderFg.finish();
} else {
a_placeholderFg.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool InputField::animStep_placeholderShift(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void InputField::step_placeholderShift(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderShift.stop();
a_placeholderLeft.finish();
a_placeholderOpacity.finish();
} else {
a_placeholderLeft.update(dt, anim::linear);
a_placeholderOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool InputField::animStep_border(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void InputField::step_border(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_border.stop();
a_borderFg.finish();
a_borderOpacityActive.finish();
} else {
a_borderFg.update(dt, anim::linear);
a_borderOpacityActive.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void InputField::updatePlaceholder() {
@ -1981,34 +1980,35 @@ void InputField::showError() {
}
}
MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st, const QString &placeholder, const QString &val) : QLineEdit(val, parent),
_st(st),
_maxLength(-1),
_oldtext(val),
MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st, const QString &placeholder, const QString &val) : QLineEdit(val, parent)
, _st(st)
, _maxLength(-1)
, _oldtext(val)
_undoAvailable(false),
_redoAvailable(false),
, _undoAvailable(false)
, _redoAvailable(false)
_customUpDown(false),
, _customUpDown(false)
_placeholderFull(placeholder),
_placeholderVisible(val.isEmpty()),
_placeholderFast(false),
a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift),
a_placeholderOpacity(_placeholderVisible ? 1 : 0),
a_placeholderFg(st.placeholderFg->c),
_a_placeholderFg(animFunc(this, &MaskedInputField::animStep_placeholderFg)),
_a_placeholderShift(animFunc(this, &MaskedInputField::animStep_placeholderShift)),
, _placeholderFull(placeholder)
, _placeholderVisible(val.isEmpty())
, _placeholderFast(false)
, a_placeholderLeft(_placeholderVisible ? 0 : st.placeholderShift)
, a_placeholderOpacity(_placeholderVisible ? 1 : 0)
, a_placeholderFg(st.placeholderFg->c)
, _a_placeholderFg(animation(this, &MaskedInputField::step_placeholderFg))
, _a_placeholderShift(animation(this, &MaskedInputField::step_placeholderShift))
a_borderOpacityActive(0),
a_borderFg(st.borderFg->c),
_a_border(animFunc(this, &MaskedInputField::animStep_border)),
, a_borderOpacityActive(0)
, a_borderFg(st.borderFg->c)
, _a_border(animation(this, &MaskedInputField::step_border))
_focused(false), _error(false),
, _focused(false)
, _error(false)
_touchPress(false),
_touchRightButton(false),
_touchMove(false) {
, _touchPress(false)
, _touchRightButton(false)
, _touchMove(false) {
resize(_st.width, _st.height);
setFont(_st.font->f);
@ -2188,47 +2188,41 @@ QSize MaskedInputField::minimumSizeHint() const {
return geometry().size();
}
bool MaskedInputField::animStep_placeholderFg(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void MaskedInputField::step_placeholderFg(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderFg.stop();
a_placeholderFg.finish();
} else {
a_placeholderFg.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool MaskedInputField::animStep_placeholderShift(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void MaskedInputField::step_placeholderShift(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_placeholderShift.stop();
a_placeholderLeft.finish();
a_placeholderOpacity.finish();
} else {
a_placeholderLeft.update(dt, anim::linear);
a_placeholderOpacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool MaskedInputField::animStep_border(float64 ms) {
float dt = ms / _st.duration;
bool res = true;
void MaskedInputField::step_border(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
if (dt >= 1) {
res = false;
_a_border.stop();
a_borderFg.finish();
a_borderOpacityActive.finish();
} else {
a_borderFg.update(dt, anim::linear);
a_borderOpacityActive.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
bool MaskedInputField::setPlaceholder(const QString &placeholder) {

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "style.h"
#include "animation.h"
class FlatInput : public QLineEdit, public Animated {
class FlatInput : public QLineEdit {
Q_OBJECT
T_WIDGET
@ -50,7 +50,7 @@ public:
QRect getTextRect() const;
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
QSize sizeHint() const;
QSize minimumSizeHint() const;
@ -98,6 +98,7 @@ private:
anim::ivalue a_phLeft;
anim::fvalue a_phAlpha;
anim::cvalue a_phColor, a_borderColor, a_bgColor;
Animation _a_appearance;
int _notingBene;
style::flatInput _st;
@ -196,9 +197,9 @@ public:
}
void updatePlaceholder();
bool animStep_placeholderFg(float64 ms);
bool animStep_placeholderShift(float64 ms);
bool animStep_border(float64 ms);
void step_placeholderFg(float64 ms, bool timer);
void step_placeholderShift(float64 ms, bool timer);
void step_border(float64 ms, bool timer);
QSize sizeHint() const;
QSize minimumSizeHint() const;
@ -354,9 +355,9 @@ public:
}
void updatePlaceholder();
bool animStep_placeholderFg(float64 ms);
bool animStep_placeholderShift(float64 ms);
bool animStep_border(float64 ms);
void step_placeholderFg(float64 ms, bool timer);
void step_placeholderShift(float64 ms, bool timer);
void step_border(float64 ms, bool timer);
QSize sizeHint() const;
QSize minimumSizeHint() const;
@ -523,9 +524,9 @@ public:
QRect getTextRect() const;
bool animStep_placeholderFg(float64 ms);
bool animStep_placeholderShift(float64 ms);
bool animStep_border(float64 ms);
void step_placeholderFg(float64 ms, bool timer);
void step_placeholderShift(float64 ms, bool timer);
void step_border(float64 ms, bool timer);
QSize sizeHint() const;
QSize minimumSizeHint() const;

View file

@ -24,12 +24,27 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "flattextarea.h"
#include "window.h"
FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(parent),
_minHeight(-1), _maxHeight(-1), _maxLength(-1), _ctrlEnterSubmit(true),
_oldtext(v), _phVisible(!v.length()),
a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
_st(st), _undoAvailable(false), _redoAvailable(false), _inDrop(false), _inHeightCheck(false), _fakeMargin(0),
_touchPress(false), _touchRightButton(false), _touchMove(false), _correcting(false) {
FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(parent)
, _minHeight(-1)
, _maxHeight(-1)
, _maxLength(-1)
, _ctrlEnterSubmit(true)
, _oldtext(v)
, _phVisible(!v.length())
, a_phLeft(_phVisible ? 0 : st.phShift)
, a_phAlpha(_phVisible ? 1 : 0)
, a_phColor(st.phColor->c)
, _a_appearance(animation(this, &FlatTextarea::step_appearance))
, _st(st)
, _undoAvailable(false)
, _redoAvailable(false)
, _inDrop(false)
, _inHeightCheck(false)
, _fakeMargin(0)
, _touchPress(false)
, _touchRightButton(false)
, _touchMove(false)
, _correcting(false) {
setAcceptRichText(false);
resize(_st.width, _st.font->height);
@ -74,10 +89,10 @@ _touchPress(false), _touchRightButton(false), _touchMove(false), _correcting(fal
void FlatTextarea::setTextFast(const QString &text) {
setPlainText(text);
if (animating()) {
if (_a_appearance.animating()) {
a_phLeft.finish();
a_phAlpha.finish();
anim::stop(this);
_a_appearance.stop();
update();
}
}
@ -184,7 +199,7 @@ void FlatTextarea::paintEvent(QPaintEvent *e) {
QRect r(rect().intersected(e->rect()));
p.fillRect(r, _st.bgColor->b);
bool phDraw = _phVisible;
if (animating()) {
if (_a_appearance.animating()) {
p.setOpacity(a_phAlpha.current());
phDraw = true;
}
@ -203,13 +218,13 @@ void FlatTextarea::paintEvent(QPaintEvent *e) {
void FlatTextarea::focusInEvent(QFocusEvent *e) {
a_phColor.start(_st.phFocusColor->c);
anim::start(this);
_a_appearance.start();
QTextEdit::focusInEvent(e);
}
void FlatTextarea::focusOutEvent(QFocusEvent *e) {
a_phColor.start(_st.phColor->c);
anim::start(this);
_a_appearance.start();
QTextEdit::focusOutEvent(e);
}
@ -807,11 +822,10 @@ void FlatTextarea::onRedoAvailable(bool avail) {
if (App::wnd()) App::wnd()->updateGlobalMenu();
}
bool FlatTextarea::animStep(float64 ms) {
void FlatTextarea::step_appearance(float64 ms, bool timer) {
float dt = ms / _st.phDuration;
bool res = true;
if (dt >= 1) {
res = false;
_a_appearance.stop();
a_phLeft.finish();
a_phAlpha.finish();
a_phColor.finish();
@ -823,8 +837,7 @@ bool FlatTextarea::animStep(float64 ms) {
a_phAlpha.update(dt, _st.phAlphaFunc);
a_phColor.update(dt, _st.phColorFunc);
}
update();
return res;
if (timer) update();
}
void FlatTextarea::setPlaceholder(const QString &ph) {
@ -839,7 +852,7 @@ void FlatTextarea::updatePlaceholder() {
a_phLeft.start(vis ? 0 : _st.phShift);
a_phAlpha.start(vis ? 1 : 0);
anim::start(this);
_a_appearance.start();
_phVisible = vis;
}

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "style.h"
#include "animation.h"
class FlatTextarea : public QTextEdit, public Animated {
class FlatTextarea : public QTextEdit {
Q_OBJECT
T_WIDGET
@ -56,7 +56,7 @@ public:
QRect getTextRect() const;
int32 fakeMargin() const;
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
QSize sizeHint() const;
QSize minimumSizeHint() const;
@ -127,6 +127,8 @@ private:
anim::ivalue a_phLeft;
anim::fvalue a_phAlpha;
anim::cvalue a_phColor;
Animation _a_appearance;
style::flatTextarea _st;
bool _undoAvailable, _redoAvailable, _inDrop, _inHeightCheck;

View file

@ -36,7 +36,7 @@ PopupMenu::PopupMenu(const style::PopupMenu &st) : TWidget(0)
, _selected(-1)
, _childMenuIndex(-1)
, a_opacity(1)
, _a_hide(animFunc(this, &PopupMenu::animStep_hide))
, _a_hide(animation(this, &PopupMenu::step_hide))
, _deleteOnHide(true)
, _triggering(false)
, _deleteLater(false) {
@ -54,7 +54,7 @@ PopupMenu::PopupMenu(QMenu *menu, const style::PopupMenu &st) : TWidget(0)
, _selected(-1)
, _childMenuIndex(-1)
, a_opacity(1)
, _a_hide(animFunc(this, &PopupMenu::animStep_hide))
, _a_hide(animation(this, &PopupMenu::step_hide))
, _deleteOnHide(true)
, _triggering(false)
, _deleteLater(false) {
@ -440,18 +440,16 @@ void PopupMenu::hideFinish() {
hide();
}
bool PopupMenu::animStep_hide(float64 ms) {
void PopupMenu::step_hide(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_hide.stop();
a_opacity.finish();
hideFinish();
res = false;
} else {
a_opacity.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void PopupMenu::deleteOnHide(bool del) {

View file

@ -59,7 +59,7 @@ private:
void childHiding(PopupMenu *child);
bool animStep_hide(float64 ms);
void step_hide(float64 ms, bool timer);
void init();
void hideFinish();

View file

@ -38,12 +38,20 @@ void ScrollShadow::changeVisibility(bool shown) {
setVisible(shown);
}
ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st) : QWidget(parent), _st(st), _vertical(vert),
_over(false), _overbar(false), _moving(false), _topSh(false), _bottomSh(false),
_connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()),
_scrollMax(_connected->maximum()), _hideIn(-1),
a_bg((_st->hiding ? st::transparent : _st->bgColor)->c),
a_bar((_st->hiding ? st::transparent : _st->barColor)->c) {
ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st) : QWidget(parent)
, _st(st)
, _vertical(vert)
, _over(false)
, _overbar(false)
, _moving(false)
, _topSh(false)
, _bottomSh(false)
, _connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar())
, _scrollMax(_connected->maximum())
, _hideIn(-1)
, a_bg((_st->hiding ? st::transparent : _st->bgColor)->c)
, a_bar((_st->hiding ? st::transparent : _st->barColor)->c)
, _a_appearance(animation(this, &ScrollBar::step_appearance)) {
recountSize();
_hideTimer.setSingleShot(true);
@ -115,7 +123,7 @@ void ScrollBar::onHideTimer() {
_hideIn = -1;
a_bg.start(QColor(a_bg.current().red(), a_bg.current().green(), a_bg.current().blue(), 0));
a_bar.start(QColor(a_bar.current().red(), a_bar.current().green(), a_bar.current().blue(), 0));
anim::start(this);
_a_appearance.start();
}
ScrollArea *ScrollBar::area() {
@ -144,26 +152,24 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
}
}
bool ScrollBar::animStep(float64 ms) {
void ScrollBar::step_appearance(float64 ms, bool timer) {
float64 dt = ms / _st->duration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_bg.finish();
a_bar.finish();
res = false;
} else {
a_bg.update(dt, anim::linear);
a_bar.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void ScrollBar::hideTimeout(int64 dt) {
if (_hideIn < 0) {
a_bg.start((_over ? _st->bgOverColor : _st->bgColor)->c);
a_bar.start((_overbar ? _st->barOverColor : _st->barColor)->c);
anim::start(this);
_a_appearance.start();
}
_hideIn = dt;
if (!_moving && _hideIn >= 0) {
@ -177,7 +183,7 @@ void ScrollBar::enterEvent(QEvent *e) {
_over = true;
a_bg.start(_st->bgOverColor->c);
a_bar.start(_st->barColor->c);
anim::start(this);
_a_appearance.start();
}
void ScrollBar::leaveEvent(QEvent *e) {
@ -185,7 +191,7 @@ void ScrollBar::leaveEvent(QEvent *e) {
setMouseTracking(false);
a_bg.start(_st->bgColor->c);
a_bar.start(_st->barColor->c);
anim::start(this);
_a_appearance.start();
if (_hideIn >= 0) {
_hideTimer.start(_hideIn);
} else if (_st->hiding) {
@ -202,7 +208,7 @@ void ScrollBar::mouseMoveEvent(QMouseEvent *e) {
if (!_moving) {
a_bar.start((newOverBar ? _st->barOverColor : _st->barColor)->c);
a_bg.start(_st->bgOverColor->c);
anim::start(this);
_a_appearance.start();
}
}
if (_moving) {
@ -232,7 +238,7 @@ void ScrollBar::mousePressEvent(QMouseEvent *e) {
_overbar = true;
a_bar.start(_st->barOverColor->c);
a_bg.start(_st->bgOverColor->c);
anim::start(this);
_a_appearance.start();
}
}
emit area()->scrollStarted();
@ -257,7 +263,7 @@ void ScrollBar::mouseReleaseEvent(QMouseEvent *e) {
_hideTimer.start(_hideIn);
}
}
if (a) anim::start(this);
if (a) _a_appearance.start();
emit area()->scrollFinished();
}
if (!_over) {

View file

@ -50,7 +50,7 @@ private:
};
class ScrollBar : public QWidget, public Animated {
class ScrollBar : public QWidget {
Q_OBJECT
public:
@ -67,7 +67,7 @@ public:
void mouseReleaseEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void hideTimeout(int64 dt);
@ -100,6 +100,8 @@ private:
QTimer _hideTimer;
anim::cvalue a_bg, a_bar;
Animation _a_appearance;
QRect _bar;
};

View file

@ -1,160 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "switcher.h"
Switcher::Switcher(QWidget *parent, const style::switcher &st) : TWidget(parent)
, _selected(0)
, _over(-1)
, _wasOver(-1)
, _pressed(-1)
, _st(st)
, a_bgOver(_st.bgColor->c)
, a_bgWasOver(_st.bgHovered->c) {
resize(width(), _st.height);
}
void Switcher::leaveEvent(QEvent *e) {
setOver(-1);
if (_pressed >= 0) return;
setMouseTracking(false);
return TWidget::leaveEvent(e);
}
void Switcher::enterEvent(QEvent *e) {
setMouseTracking(true);
return TWidget::enterEvent(e);
}
void Switcher::mousePressEvent(QMouseEvent *e) {
if (e->buttons() & Qt::LeftButton) {
mouseMoveEvent(e);
if (_over != _pressed) {
_pressed = _over;
e->accept();
}
}
}
void Switcher::mouseMoveEvent(QMouseEvent *e) {
if (rect().contains(e->pos())) {
if (width()) {
setOver((e->pos().x() * _buttons.size()) / width());
}
} else {
setOver(-1);
}
}
void Switcher::mouseReleaseEvent(QMouseEvent *e) {
if (_pressed >= 0) {
if (_pressed == _over && _pressed != _selected) {
setSelected(_pressed);
} else {
setSelected(_selected);
}
} else {
leaveEvent(e);
}
}
void Switcher::addButton(const QString &btn) {
_buttons.push_back(btn);
update();
}
bool Switcher::animStep(float64 ms) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
res = false;
a_bgOver.finish();
a_bgWasOver.finish();
} else {
a_bgOver.update(dt, anim::linear);
a_bgWasOver.update(dt, anim::linear);
}
update();
return res;
}
void Switcher::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.fillRect(rect(), _st.bgColor->b);
if (!_buttons.isEmpty()) {
p.setFont(_st.font->f);
float64 btnWidth = float64(width()) / _buttons.size();
for (int i = 0; i < _buttons.size(); ++i) {
QRect btnRect(qRound(i * btnWidth), 0, qRound((i + 1) * btnWidth) - qRound(i * btnWidth), height());
if (i == _selected) {
p.fillRect(btnRect, _st.bgActive->b);
} else if (i == _over) {
p.fillRect(btnRect, a_bgOver.current());
} else if (i == _wasOver) {
p.fillRect(btnRect, a_bgWasOver.current());
}
p.setPen((i == _selected ? _st.activeColor : _st.textColor)->p);
p.drawText(btnRect, _buttons[i], style::al_center);
}
}
if (_st.border) {
p.fillRect(0, 0, width() - _st.border, _st.border, _st.borderColor->b);
p.fillRect(width() - _st.border, 0, _st.border, height() - _st.border, _st.borderColor->b);
p.fillRect(_st.border, height() - _st.border, width() - _st.border, _st.border, _st.borderColor->b);
p.fillRect(0, _st.border, _st.border, height() - _st.border, _st.borderColor->b);
}
}
int Switcher::selected() const {
return _selected;
}
void Switcher::setSelected(int selected) {
if (selected != _selected) {
_selected = selected;
emit changed();
}
_pressed = _over = _wasOver = -1;
anim::stop(this);
setCursor(style::cur_default);
update();
}
void Switcher::setOver(int over) {
if (over != _over) {
QColor c(a_bgOver.current());
if (_wasOver == over) {
a_bgOver = anim::cvalue(a_bgWasOver.current(), _st.bgHovered->c);
} else {
a_bgOver = anim::cvalue(_st.bgColor->c, _st.bgHovered->c);
}
a_bgWasOver = anim::cvalue(c, _st.bgColor->c);
_wasOver = _over;
_over = over;
anim::start(this);
setCursor((_over >= 0 && _over != _selected) ? style::cur_pointer : style::cur_default);
}
}

View file

@ -1,65 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtWidgets/QWidget>
#include "gui/twidget.h"
class Switcher : public TWidget, public Animated {
Q_OBJECT
public:
Switcher(QWidget *parent, const style::switcher &st);
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void addButton(const QString &btn);
bool animStep(float64 ms);
int selected() const;
void setSelected(int selected);
signals:
void changed();
private:
void setOver(int over);
int _selected;
int _over, _wasOver, _pressed;
typedef QVector<QString> Buttons;
Buttons _buttons;
style::switcher _st;
anim::cvalue a_bgOver, a_bgWasOver;
};

View file

@ -1357,11 +1357,10 @@ void Histories::regSendAction(History *history, UserData *user, const MTPSendMes
}
history->updateTyping(ms, history->typingFrame, true);
anim::start(this);
_a_typings.start();
}
bool Histories::animStep(float64) {
uint64 ms = getms(true);
void Histories::step_typings(uint64 ms, bool timer) {
for (TypingHistories::iterator i = typing.begin(), e = typing.end(); i != e;) {
uint32 typingFrame = (ms - i.value()) / 150;
i.key()->updateTyping(ms, typingFrame);
@ -1371,7 +1370,9 @@ bool Histories::animStep(float64) {
++i;
}
}
return !typing.isEmpty();
if (typing.isEmpty()) {
_a_typings.stop();
}
}
void Histories::remove(const PeerId &peer) {
@ -2968,23 +2969,25 @@ void HistoryBlock::removeItem(HistoryItem *item) {
}
}
bool ItemAnimations::animStep(float64 ms) {
void ItemAnimations::step_animate(float64 ms, bool timer) {
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {
const HistoryItem *item = i.key();
if (item->animating()) {
App::main()->msgUpdated(item);
if (timer) App::main()->msgUpdated(item);
++i;
} else {
i = _animations.erase(i);
}
}
return !_animations.isEmpty();
if (_animations.isEmpty()) {
_a_animate.stop();
}
}
uint64 ItemAnimations::animate(const HistoryItem *item, uint64 ms) {
if (_animations.isEmpty()) {
_animations.insert(item, ms);
anim::start(this);
_a_animate.start();
return 0;
}
Animations::const_iterator i = _animations.constFind(item);

View file

@ -45,16 +45,16 @@ enum NewMessageType {
};
class History;
class Histories : public Animated {
class Histories {
public:
typedef QHash<PeerId, History*> Map;
Map map;
Histories() : unreadFull(0), unreadMuted(0) {
Histories() : unreadFull(0), unreadMuted(0), _a_typings(animation(this, &Histories::step_typings)) {
}
void regSendAction(History *history, UserData *user, const MTPSendMessageAction &action);
bool animStep(float64 ms);
void step_typings(uint64 ms, bool timer);
History *find(const PeerId &peerId);
History *findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead);
@ -71,6 +71,7 @@ public:
typedef QMap<History*, uint64> TypingHistories; // when typing in this history started
TypingHistories typing;
Animation _a_typings;
int32 unreadFull, unreadMuted;
};
@ -789,16 +790,19 @@ protected:
};
class ItemAnimations : public Animated {
class ItemAnimations {
public:
bool animStep(float64 ms);
ItemAnimations() : _a_animate(animation(this, &ItemAnimations::step_animate)) {
}
void step_animate(float64 ms, bool timer);
uint64 animate(const HistoryItem *item, uint64 ms);
void remove(const HistoryItem *item);
private:
typedef QMap<const HistoryItem*, uint64> Animations;
Animations _animations;
Animation _a_animate;
};
ItemAnimations &itemAnimations();

View file

@ -1945,8 +1945,16 @@ void ReportSpamPanel::setReported(bool reported, PeerData *onPeer) {
update();
}
BotKeyboard::BotKeyboard() : _height(0), _maxOuterHeight(0), _maximizeSize(false), _singleUse(false), _forceReply(false),
_sel(-1), _down(-1), _hoverAnim(animFunc(this, &BotKeyboard::hoverStep)), _st(&st::botKbButton) {
BotKeyboard::BotKeyboard() : TWidget()
, _height(0)
, _maxOuterHeight(0)
, _maximizeSize(false)
, _singleUse(false)
, _forceReply(false)
, _sel(-1)
, _down(-1)
, _a_selected(animation(this, &BotKeyboard::step_selected))
, _st(&st::botKbButton) {
setGeometry(0, 0, _st->margin, _st->margin);
_height = _st->margin;
setMouseTracking(true);
@ -2124,11 +2132,10 @@ bool BotKeyboard::forceReply() const {
return _forceReply;
}
bool BotKeyboard::hoverStep(float64 ms) {
uint64 now = getms();
void BotKeyboard::step_selected(uint64 ms, bool timer) {
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {
int index = qAbs(i.key()) - 1, row = (index / MatrixRowShift), col = index % MatrixRowShift;
float64 dt = float64(now - i.value()) / st::botKbDuration;
float64 dt = float64(ms - i.value()) / st::botKbDuration;
if (dt >= 1) {
_btns[row][col].hover = (i.key() > 0) ? 1 : 0;
i = _animations.erase(i);
@ -2137,8 +2144,10 @@ bool BotKeyboard::hoverStep(float64 ms) {
++i;
}
}
update();
return !_animations.isEmpty();
if (timer) update();
if (_animations.isEmpty()) {
_a_selected.stop();
}
}
void BotKeyboard::resizeToWidth(int32 width, int32 maxOuterHeight) {
@ -2183,7 +2192,7 @@ void BotKeyboard::clearSelection() {
_btns[row][col].hover = 0;
}
_animations.clear();
_hoverAnim.stop();
_a_selected.stop();
if (_sel >= 0) {
int row = (_sel / MatrixRowShift), col = _sel % MatrixRowShift;
_btns[row][col].hover = 0;
@ -2246,7 +2255,7 @@ void BotKeyboard::updateSelected() {
_animations.insert(_sel + 1, getms());
}
}
if (startanim) _hoverAnim.start();
if (startanim && !_a_selected.animating()) _a_selected.start();
}
}
@ -2258,11 +2267,11 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : TWidget(p
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, offered(0)
, a_opacity(0, 1)
, _a_appearance(animation(this, &HistoryHider::step_appearance))
, hiding(false)
, _forwardRequest(0)
, toTextWidth(0)
, shadow(st::boxShadow)
{
, shadow(st::boxShadow) {
init();
}
@ -2274,11 +2283,11 @@ HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : TWidge
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, offered(0)
, a_opacity(0, 1)
, _a_appearance(animation(this, &HistoryHider::step_appearance))
, hiding(false)
, _forwardRequest(0)
, toTextWidth(0)
, shadow(st::boxShadow)
{
, shadow(st::boxShadow) {
init();
}
@ -2290,11 +2299,11 @@ HistoryHider::HistoryHider(MainWidget *parent) : TWidget(parent)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, offered(0)
, a_opacity(0, 1)
, _a_appearance(animation(this, &HistoryHider::step_appearance))
, hiding(false)
, _forwardRequest(0)
, toTextWidth(0)
, shadow(st::boxShadow)
{
, shadow(st::boxShadow) {
init();
}
@ -2308,11 +2317,11 @@ HistoryHider::HistoryHider(MainWidget *parent, const QString &url, const QString
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
, offered(0)
, a_opacity(0, 1)
, _a_appearance(animation(this, &HistoryHider::step_appearance))
, hiding(false)
, _forwardRequest(0)
, toTextWidth(0)
, shadow(st::boxShadow)
{
, shadow(st::boxShadow) {
init();
}
@ -2324,24 +2333,22 @@ void HistoryHider::init() {
_chooseWidth = st::forwardFont->width(lang(lng_forward_choose));
resizeEvent(0);
anim::start(this);
_a_appearance.start();
}
bool HistoryHider::animStep(float64 ms) {
void HistoryHider::step_appearance(float64 ms, bool timer) {
float64 dt = ms / 200;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_opacity.finish();
if (hiding) {
QTimer::singleShot(0, this, SLOT(deleteLater()));
}
res = false;
} else {
a_opacity.update(dt, anim::linear);
}
App::wnd()->getTitle()->setHideLevel(a_opacity.current());
update();
return res;
if (timer) update();
}
bool HistoryHider::withConfirm() const {
@ -2411,7 +2418,7 @@ void HistoryHider::startHide() {
a_opacity.start(0);
_send.hide();
_cancel.hide();
anim::start(this);
_a_appearance.start();
} else {
QTimer::singleShot(0, this, SLOT(deleteLater()));
}
@ -2581,8 +2588,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
, _broadcast(this, QString(), true, st::broadcastToggle)
, _cmdStartShown(false)
, _field(this, st::taMsgField, lang(lng_message_ph))
, _recordAnim(animFunc(this, &HistoryWidget::recordStep))
, _recordingAnim(animFunc(this, &HistoryWidget::recordingStep))
, _a_record(animation(this, &HistoryWidget::step_record))
, _a_recording(animation(this, &HistoryWidget::step_recording))
, _recording(false), _inRecord(false), _inField(false), _inReply(false)
, a_recordingLevel(0, 0), _recordingSamples(0)
, a_recordOver(0, 0), a_recordDown(0, 0), a_recordCancel(st::recordCancel->c, st::recordCancel->c)
@ -2601,7 +2608,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
, _serviceImageCacheSize(0)
, _confirmWithTextId(0)
, _titlePeerTextWidth(0)
, _a_show(animFunc(this, &HistoryWidget::animStep_show))
, _a_show(animation(this, &HistoryWidget::step_show))
, _scrollDelta(0)
, _saveDraftStart(0)
, _saveDraftText(false)
@ -2756,7 +2763,7 @@ void HistoryWidget::onTextChange() {
} else if (!_field.isHidden() && _send.isHidden()) {
_send.show();
setMouseTracking(false);
_recordAnim.stop();
_a_record.stop();
_inRecord = _inField = false;
a_recordOver = a_recordDown = anim::fvalue(0, 0);
a_recordCancel = anim::cvalue(st::recordCancel->c, st::recordCancel->c);
@ -2921,7 +2928,7 @@ void HistoryWidget::onRecordUpdate(qint16 level, qint32 samples) {
}
a_recordingLevel.start(level);
_recordingAnim.start();
_a_recording.start();
_recordingSamples = samples;
if (samples < 0 || samples >= AudioVoiceMsgFrequency * AudioVoiceMsgMaxLength) {
stopRecording(_peer && samples > 0 && _inField);
@ -3625,7 +3632,7 @@ void HistoryWidget::updateControlsVisibility() {
} else {
_send.show();
setMouseTracking(false);
_recordAnim.stop();
_a_record.stop();
_inRecord = _inField = false;
a_recordOver = anim::fvalue(0, 0);
}
@ -4431,15 +4438,13 @@ void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
activate();
}
bool HistoryWidget::animStep_show(float64 ms) {
void HistoryWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_topShadow.setVisible(_peer ? true : false);
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -4453,9 +4458,10 @@ bool HistoryWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
App::main()->topBar()->update();
return res;
if (timer) {
update();
App::main()->topBar()->update();
}
}
void HistoryWidget::doneShow() {
@ -4481,11 +4487,10 @@ void HistoryWidget::animStop() {
_topShadow.setVisible(_peer ? true : false);
}
bool HistoryWidget::recordStep(float64 ms) {
void HistoryWidget::step_record(float64 ms, bool timer) {
float64 dt = ms / st::btnSend.duration;
bool res = true;
if (dt >= 1 || !_send.isHidden() || isBotStart() || isBlocked()) {
res = false;
_a_record.stop();
a_recordOver.finish();
a_recordDown.finish();
a_recordCancel.finish();
@ -4494,25 +4499,24 @@ bool HistoryWidget::recordStep(float64 ms) {
a_recordDown.update(dt, anim::linear);
a_recordCancel.update(dt, anim::linear);
}
if (_recording) {
updateField();
} else {
update(_send.geometry());
if (timer) {
if (_recording) {
updateField();
} else {
update(_send.geometry());
}
}
return res;
}
bool HistoryWidget::recordingStep(float64 ms) {
void HistoryWidget::step_recording(float64 ms, bool timer) {
float64 dt = ms / AudioVoiceMsgUpdateView;
bool res = true;
if (dt >= 1) {
res = false;
_a_recording.stop();
a_recordingLevel.finish();
} else {
a_recordingLevel.update(dt, anim::linear);
}
update(_attachDocument.geometry());
return res;
if (timer) update(_attachDocument.geometry());
}
void HistoryWidget::onPhotoSelect() {
@ -4623,7 +4627,7 @@ void HistoryWidget::mouseMoveEvent(QMouseEvent *e) {
_inReply = inReply;
setCursor(inReply ? style::cur_pointer : style::cur_default);
}
if (startAnim) _recordAnim.start();
if (startAnim) _a_record.start();
}
void HistoryWidget::leaveToChildEvent(QEvent *e) { // e -- from enterEvent() of child TWidget
@ -4648,7 +4652,7 @@ void HistoryWidget::stopRecording(bool send) {
audioCapture()->stop(send);
a_recordingLevel = anim::ivalue(0, 0);
_recordingAnim.stop();
_a_recording.stop();
_recording = false;
_recordingSamples = 0;
@ -4664,7 +4668,7 @@ void HistoryWidget::stopRecording(bool send) {
a_recordDown.start(0);
a_recordOver.restart();
a_recordCancel = anim::cvalue(st::recordCancel->c, st::recordCancel->c);
_recordAnim.start();
_a_record.start();
}
void HistoryWidget::sendBotCommand(const QString &cmd, MsgId replyTo) { // replyTo != 0 from ReplyKeyboardMarkup, == 0 from cmd links
@ -6001,7 +6005,7 @@ void HistoryWidget::mousePressEvent(QMouseEvent *e) {
a_recordDown.start(1);
a_recordOver.restart();
_recordAnim.start();
_a_record.start();
} else if (_inReply) {
App::main()->showPeerHistory(_peer->id, replyToId());
}

View file

@ -249,7 +249,7 @@ private:
};
class BotKeyboard : public QWidget {
class BotKeyboard : public TWidget {
Q_OBJECT
public:
@ -267,7 +267,7 @@ public:
bool hasMarkup() const;
bool forceReply() const;
bool hoverStep(float64 ms);
void step_selected(uint64 ms, bool timer);
void resizeToWidth(int32 width, int32 maxOuterHeight);
bool maximizeSize() const;
@ -308,13 +308,13 @@ private:
typedef QMap<int32, uint64> Animations;
Animations _animations;
Animation _hoverAnim;
Animation _a_selected;
const style::botKeyboardButton *_st;
};
class HistoryHider : public TWidget, public Animated {
class HistoryHider : public TWidget {
Q_OBJECT
public:
@ -324,7 +324,7 @@ public:
HistoryHider(MainWidget *parent); // send path from command line argument
HistoryHider(MainWidget *parent, const QString &url, const QString &text); // share url
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
bool withConfirm() const;
void paintEvent(QPaintEvent *e);
@ -362,7 +362,10 @@ private:
BoxButton _send, _cancel;
PeerData *offered;
anim::fvalue a_opacity;
Animation _a_appearance;
QRect box;
bool hiding;
@ -471,7 +474,7 @@ public:
HistoryItem *atTopImportantMsg(int32 &bottomUnderScrollTop) const;
void animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false);
bool animStep_show(float64 ms);
void step_show(float64 ms, bool timer);
void animStop();
void updateWideMode();
@ -510,8 +513,8 @@ public:
void updatePreview();
void previewCancel();
bool recordStep(float64 ms);
bool recordingStep(float64 ms);
void step_record(float64 ms, bool timer);
void step_recording(float64 ms, bool timer);
void stopRecording(bool send);
void onListEscapePressed();
@ -759,7 +762,7 @@ private:
FlatCheckbox _broadcast;
bool _cmdStartShown;
MessageField _field;
Animation _recordAnim, _recordingAnim;
Animation _a_record, _a_recording;
bool _recording, _inRecord, _inField, _inReply;
anim::ivalue a_recordingLevel;
int32 _recordingSamples;

View file

@ -52,27 +52,27 @@ namespace {
}
}
IntroWidget::IntroWidget(Window *window) : TWidget(window),
_langChangeTo(0),
_a_stage(animFunc(this, &IntroWidget::animStep_stage)),
_cacheHideIndex(0),
_cacheShowIndex(0),
_a_show(animFunc(this, &IntroWidget::animStep_show)),
wnd(window),
steps(new IntroSteps(this)),
phone(0),
code(0),
signup(0),
pwdcheck(0),
current(0),
moving(0),
_callTimeout(60),
_registered(false),
_hasRecovery(false),
_codeByTelegram(false),
_back(this, st::setClose),
_backFrom(0), _backTo(0) {
setGeometry(QRect(0, st::titleHeight, wnd->width(), wnd->height() - st::titleHeight));
IntroWidget::IntroWidget(Window *window) : TWidget(window)
, _langChangeTo(0)
, _a_stage(animation(this, &IntroWidget::step_stage))
, _cacheHideIndex(0)
, _cacheShowIndex(0)
, _a_show(animation(this, &IntroWidget::step_show))
, steps(new IntroSteps(this))
, phone(0)
, code(0)
, signup(0)
, pwdcheck(0)
, current(0)
, moving(0)
, _callTimeout(60)
, _registered(false)
, _hasRecovery(false)
, _codeByTelegram(false)
, _back(this, st::setClose)
, _backFrom(0)
, _backTo(0) {
setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight));
connect(&_back, SIGNAL(clicked()), this, SLOT(onIntroBack()));
_back.hide();
@ -162,7 +162,7 @@ void IntroWidget::prepareMove() {
_backTo = stages[current + moving]->hasBack() ? 1 : 0;
_backFrom = stages[current]->hasBack() ? 1 : 0;
animStep_stage(0);
_a_stage.step();
if (_backFrom > 0 || _backTo > 0) {
_back.show();
} else {
@ -227,13 +227,11 @@ void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) {
show();
}
bool IntroWidget::animStep_show(float64 ms) {
void IntroWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -253,21 +251,19 @@ bool IntroWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
return res;
if (timer) update();
}
void IntroWidget::animStop_show() {
void IntroWidget::stop_show() {
_a_show.stop();
}
bool IntroWidget::animStep_stage(float64 ms) {
bool res = true;
void IntroWidget::step_stage(float64 ms, bool timer) {
float64 fullDuration = st::introSlideDelta + st::introSlideDuration, dt = ms / fullDuration;
float64 dt1 = (ms > st::introSlideDuration) ? 1 : (ms / st::introSlideDuration), dt2 = (ms > st::introSlideDelta) ? (ms - st::introSlideDelta) / (st::introSlideDuration) : 0;
if (dt >= 1) {
res = false;
_a_stage.stop();
a_coordShow.finish();
a_opacityShow.finish();
@ -292,8 +288,7 @@ bool IntroWidget::animStep_stage(float64 ms) {
_back.setOpacity(1);
}
}
update();
return res;
if (timer) update();
}
void IntroWidget::paintEvent(QPaintEvent *e) {
@ -414,7 +409,7 @@ void IntroWidget::mousePressEvent(QMouseEvent *e) {
}
void IntroWidget::finish(const MTPUser &user, const QImage &photo) {
wnd->setupMain(true, &user);
App::wnd()->setupMain(true, &user);
if (!photo.isNull()) {
App::app()->uploadProfilePhoto(photo, MTP::authedId());
}

View file

@ -44,10 +44,10 @@ public:
void updateWideMode();
void animShow(const QPixmap &bgAnimCache, bool back = false);
bool animStep_show(float64 ms);
void animStop_show();
void step_show(float64 ms, bool timer);
void stop_show();
bool animStep_stage(float64 ms);
void step_stage(float64 ms, bool timer);
QRect innerRect() const;
QString currentCountry() const;
@ -108,7 +108,6 @@ private:
anim::ivalue a_coordUnder, a_coordOver;
anim::fvalue a_shadow;
Window *wnd;
IntroSteps *steps;
IntroPhone *phone;
IntroCode *code;

View file

@ -72,12 +72,15 @@ void CodeInput::correctValue(const QString &was, QString &now) {
if (strict) emit codeEntered();
}
IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent), errorAlpha(0),
next(this, lang(lng_intro_next), st::btnIntroNext),
_desc(st::introTextSize.width()),
_noTelegramCode(this, lang(lng_code_no_telegram), st::introLink),
_noTelegramCodeRequestId(0),
code(this, st::inpIntroCode, lang(lng_code_ph)), waitTillCall(intro()->getCallTimeout()) {
IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroCode::step_error))
, next(this, lang(lng_intro_next), st::btnIntroNext)
, _desc(st::introTextSize.width())
, _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink)
, _noTelegramCodeRequestId(0)
, code(this, st::inpIntroCode, lang(lng_code_ph))
, waitTillCall(intro()->getCallTimeout()) {
setVisible(false);
setGeometry(parent->innerRect());
@ -132,8 +135,8 @@ void IntroCode::paintEvent(QPaintEvent *e) {
}
p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center);
}
if (animating() || error.length()) {
p.setOpacity(errorAlpha.current());
if (_a_error.animating() || error.length()) {
p.setOpacity(a_errorAlpha.current());
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrTop, st::introTextSize.width(), st::introErrHeight), error, style::al_center);
@ -151,32 +154,30 @@ void IntroCode::resizeEvent(QResizeEvent *e) {
void IntroCode::showError(const QString &err) {
if (!err.isEmpty()) code.notaBene();
if (!animating() && err == error) return;
if (!_a_error.animating() && err == error) return;
if (err.length()) {
error = err;
errorAlpha.start(1);
a_errorAlpha.start(1);
} else {
errorAlpha.start(0);
a_errorAlpha.start(0);
}
anim::start(this);
_a_error.start();
}
bool IntroCode::animStep(float64 ms) {
void IntroCode::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
bool res = true;
if (dt >= 1) {
res = false;
errorAlpha.finish();
if (!errorAlpha.current()) {
_a_error.stop();
a_errorAlpha.finish();
if (!a_errorAlpha.current()) {
error = "";
}
} else {
errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, st::introErrFunc);
}
update();
return res;
if (timer) update();
}
void IntroCode::activate() {
@ -185,7 +186,7 @@ void IntroCode::activate() {
callTimer.start(1000);
}
error = "";
errorAlpha = anim::fvalue(0);
a_errorAlpha = anim::fvalue(0);
sentCode = QString();
show();
code.setDisabled(false);

View file

@ -42,7 +42,7 @@ protected:
};
class IntroCode : public IntroStage, public Animated, public RPCSender {
class IntroCode : public IntroStage, public RPCSender {
Q_OBJECT
public:
@ -52,7 +52,7 @@ public:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_error(float64 ms, bool timer);
void activate();
void prepareShow();
@ -86,7 +86,8 @@ private:
void stopCheck();
QString error;
anim::fvalue errorAlpha;
anim::fvalue a_errorAlpha;
Animation _a_error;
FlatButton next;

View file

@ -45,13 +45,16 @@ namespace {
};
}
IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
errorAlpha(0), changed(false),
next(this, lang(lng_intro_next), st::btnIntroNext),
country(this, st::introCountry),
phone(this, st::inpIntroPhone), code(this, st::inpIntroCountryCode),
_signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle),
_showSignup(false) {
IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroPhone::step_error))
, changed(false)
, next(this, lang(lng_intro_next), st::btnIntroNext)
, country(this, st::introCountry)
, phone(this, st::inpIntroPhone)
, code(this, st::inpIntroCountryCode)
, _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle)
, _showSignup(false) {
setVisible(false);
setGeometry(parent->innerRect());
@ -92,9 +95,9 @@ void IntroPhone::paintEvent(QPaintEvent *e) {
p.setFont(st::introFont->f);
p.drawText(textRect, lang(lng_phone_desc), style::al_bottom);
}
if (animating() || error.length()) {
if (_a_error.animating() || error.length()) {
int32 errorY = _showSignup ? ((phone.y() + phone.height() + next.y() - st::introErrFont->height) / 2) : (next.y() + next.height() + st::introErrTop);
p.setOpacity(errorAlpha.current());
p.setOpacity(a_errorAlpha.current());
p.setFont(st::introErrFont->f);
p.setPen(st::introErrColor->p);
p.drawText(QRect(textRect.x(), errorY, textRect.width(), st::introErrFont->height), error, style::al_top);
@ -123,36 +126,34 @@ void IntroPhone::showError(const QString &err, bool signUp) {
_showSignup = signUp;
}
if (!animating() && err == error) return;
if (!_a_error.animating() && err == error) return;
if (err.length()) {
error = err;
errorAlpha.start(1);
a_errorAlpha.start(1);
} else {
errorAlpha.start(0);
a_errorAlpha.start(0);
}
_signup.hide();
anim::start(this);
_a_error.start();
}
bool IntroPhone::animStep(float64 ms) {
void IntroPhone::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
bool res = true;
if (dt >= 1) {
res = false;
errorAlpha.finish();
if (!errorAlpha.current()) {
_a_error.stop();
a_errorAlpha.finish();
if (!a_errorAlpha.current()) {
error = "";
_signup.hide();
} else if (!error.isEmpty() && _showSignup) {
_signup.show();
}
} else {
errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, st::introErrFunc);
}
update();
return res;
if (timer) update();
}
void IntroPhone::countryChanged() {
@ -293,7 +294,7 @@ void IntroPhone::selectCountry(const QString &c) {
void IntroPhone::activate() {
error = "";
errorAlpha = anim::fvalue(0);
a_errorAlpha = anim::fvalue(0);
show();
enableAll(true);
}

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/countryinput.h"
#include "intro.h"
class IntroPhone : public IntroStage, public Animated, public RPCSender {
class IntroPhone : public IntroStage, public RPCSender {
Q_OBJECT
public:
@ -35,7 +35,7 @@ public:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_error(float64 ms, bool timer);
void selectCountry(const QString &country);
@ -67,7 +67,8 @@ private:
void showError(const QString &err, bool signUp = false);
QString error;
anim::fvalue errorAlpha;
anim::fvalue a_errorAlpha;
Animation _a_error;
bool changed;
FlatButton next;

View file

@ -30,18 +30,19 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "intro/intropwdcheck.h"
#include "intro/intro.h"
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStage(parent),
errorAlpha(0),
_next(this, lang(lng_intro_submit), st::btnIntroNext),
_salt(parent->getPwdSalt()),
_hasRecovery(parent->getHasRecovery()),
_hint(parent->getPwdHint()),
_pwdField(this, st::inpIntroPassword, lang(lng_signin_password)),
_codeField(this, st::inpIntroPassword, lang(lng_signin_code)),
_toRecover(this, lang(lng_signin_recover)),
_toPassword(this, lang(lng_signin_try_password)),
_reset(this, lang(lng_signin_reset_account), st::btnRedLink),
sentRequest(0) {
IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStage(parent)
, a_errorAlpha(0)
, _a_error(animation(this, &IntroPwdCheck::step_error))
, _next(this, lang(lng_intro_submit), st::btnIntroNext)
, _salt(parent->getPwdSalt())
, _hasRecovery(parent->getHasRecovery())
, _hint(parent->getPwdHint())
, _pwdField(this, st::inpIntroPassword, lang(lng_signin_password))
, _codeField(this, st::inpIntroPassword, lang(lng_signin_code))
, _toRecover(this, lang(lng_signin_recover))
, _toPassword(this, lang(lng_signin_try_password))
, _reset(this, lang(lng_signin_reset_account), st::btnRedLink)
, sentRequest(0) {
setVisible(false);
setGeometry(parent->innerRect());
@ -86,8 +87,8 @@ void IntroPwdCheck::paintEvent(QPaintEvent *e) {
} else if (!_hint.isEmpty()) {
_hintText.drawElided(p, _pwdField.x(), _pwdField.y() + _pwdField.height() + st::introFinishSkip, _pwdField.width(), 1, style::al_top);
}
if (animating() || error.length()) {
p.setOpacity(errorAlpha.current());
if (_a_error.animating() || error.length()) {
p.setOpacity(a_errorAlpha.current());
QRect errRect((width() - st::introErrWidth) / 2, (_pwdField.y() + _pwdField.height() + st::introFinishSkip + st::introFont->height + _next.y() - st::introErrHeight) / 2, st::introErrWidth, st::introErrHeight);
p.setFont(st::introErrFont->f);
@ -111,32 +112,30 @@ void IntroPwdCheck::resizeEvent(QResizeEvent *e) {
}
void IntroPwdCheck::showError(const QString &err) {
if (!animating() && err == error) return;
if (!_a_error.animating() && err == error) return;
if (err.length()) {
error = err;
errorAlpha.start(1);
a_errorAlpha.start(1);
} else {
errorAlpha.start(0);
a_errorAlpha.start(0);
}
anim::start(this);
_a_error.start();
}
bool IntroPwdCheck::animStep(float64 ms) {
void IntroPwdCheck::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
bool res = true;
if (dt >= 1) {
res = false;
errorAlpha.finish();
if (!errorAlpha.current()) {
_a_error.stop();
a_errorAlpha.finish();
if (!a_errorAlpha.current()) {
error = "";
}
} else {
errorAlpha.update(dt, st::introErrFunc);
a_errorAlpha.update(dt, st::introErrFunc);
}
update();
return res;
if (timer) update();
}
void IntroPwdCheck::activate() {

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/flatinput.h"
#include "intro.h"
class IntroPwdCheck : public IntroStage, public Animated, public RPCSender {
class IntroPwdCheck : public IntroStage, public RPCSender {
Q_OBJECT
public:
@ -35,7 +35,7 @@ public:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_error(float64 ms, bool timer);
void activate();
void deactivate();
@ -69,7 +69,8 @@ private:
bool deleteFail(const RPCError &error);
QString error;
anim::fvalue errorAlpha;
anim::fvalue a_errorAlpha;
Animation _a_error;
FlatButton _next;

View file

@ -30,12 +30,15 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "intro/introsignup.h"
#include "intro/intro.h"
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent),
errorAlpha(0), a_photo(0),
next(this, lang(lng_intro_finish), st::btnIntroNext),
first(this, st::inpIntroName, lang(lng_signup_firstname)),
last(this, st::inpIntroName, lang(lng_signup_lastname)),
_invertOrder(langFirstNameGoesSecond()) {
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent)
, a_errorAlpha(0)
, a_photoOver(0)
, _a_error(animation(this, &IntroSignup::step_error))
, _a_photo(animation(this, &IntroSignup::step_photo))
, next(this, lang(lng_intro_finish), st::btnIntroNext)
, first(this, st::inpIntroName, lang(lng_signup_firstname))
, last(this, st::inpIntroName, lang(lng_signup_lastname))
, _invertOrder(langFirstNameGoesSecond()) {
setVisible(false);
setGeometry(parent->innerRect());
@ -54,9 +57,8 @@ void IntroSignup::mouseMoveEvent(QMouseEvent *e) {
if (photoOver != _photoOver) {
_photoOver = photoOver;
if (_photoSmall.isNull()) {
a_photo.start(_photoOver ? 1 : 0);
errorAlpha.restart();
anim::start(this);
a_photoOver.start(_photoOver ? 1 : 0);
_a_photo.start();
}
}
@ -107,8 +109,8 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
p.setFont(st::introFont->f);
p.drawText(textRect, lang(lng_signup_desc), style::al_bottom);
}
if (animating() || error.length()) {
p.setOpacity(errorAlpha.current());
if (_a_error.animating() || error.length()) {
p.setOpacity(a_errorAlpha.current());
QRect errRect;
if (_invertOrder) {
@ -124,17 +126,17 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
}
if (_photoSmall.isNull()) {
if (a_photo.current() < 1) {
if (a_photoOver.current() < 1) {
QRect pix(st::setPhotoImg);
pix.moveTo(pix.x() + (pix.width() - st::introPhotoSize) / 2, pix.y() + (pix.height() - st::introPhotoSize) / 2);
pix.setSize(QSize(st::introPhotoSize, st::introPhotoSize));
p.drawPixmap(QPoint(_phLeft, _phTop), App::sprite(), pix);
}
if (a_photo.current() > 0) {
if (a_photoOver.current() > 0) {
QRect pix(st::setOverPhotoImg);
pix.moveTo(pix.x() + (pix.width() - st::introPhotoSize) / 2, pix.y() + (pix.height() - st::introPhotoSize) / 2);
pix.setSize(QSize(st::introPhotoSize, st::introPhotoSize));
p.setOpacity(a_photo.current());
p.setOpacity(a_photoOver.current());
p.drawPixmap(QPoint(_phLeft, _phTop), App::sprite(), pix);
p.setOpacity(1);
}
@ -160,35 +162,42 @@ void IntroSignup::resizeEvent(QResizeEvent *e) {
}
void IntroSignup::showError(const QString &err) {
if (!animating() && err == error) return;
if (!_a_error.animating() && err == error) return;
if (err.length()) {
error = err;
errorAlpha.start(1);
a_errorAlpha.start(1);
} else {
errorAlpha.start(0);
a_errorAlpha.start(0);
}
a_photo.restart();
anim::start(this);
_a_error.start();
}
bool IntroSignup::animStep(float64 ms) {
void IntroSignup::step_error(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
bool res = true;
if (dt >= 1) {
res = false;
errorAlpha.finish();
if (!errorAlpha.current()) {
_a_error.stop();
a_errorAlpha.finish();
if (!a_errorAlpha.current()) {
error = "";
}
a_photo.finish();
} else {
errorAlpha.update(dt, st::introErrFunc);
a_photo.update(dt, anim::linear);
a_errorAlpha.update(dt, st::introErrFunc);
}
update();
return res;
if (timer) update();
}
void IntroSignup::step_photo(float64 ms, bool timer) {
float64 dt = ms / st::introErrDuration;
if (dt >= 1) {
_a_photo.stop();
a_photoOver.finish();
} else {
a_photoOver.update(dt, anim::linear);
}
if (timer) update();
}
void IntroSignup::activate() {

View file

@ -25,7 +25,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/flatinput.h"
#include "intro.h"
class IntroSignup : public IntroStage, public Animated, public RPCSender {
class IntroSignup : public IntroStage, public RPCSender {
Q_OBJECT
public:
@ -37,7 +37,8 @@ public:
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
bool animStep(float64 ms);
void step_error(float64 ms, bool timer);
void step_photo(float64 ms, bool timer);
void activate();
void deactivate();
@ -60,7 +61,9 @@ private:
void stopCheck();
QString error;
anim::fvalue errorAlpha, a_photo;
anim::fvalue a_errorAlpha, a_photoOver;
Animation _a_error;
Animation _a_photo;
FlatButton next;

View file

@ -29,15 +29,15 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
BackgroundWidget::BackgroundWidget(QWidget *parent, LayeredWidget *w) : TWidget(parent)
, w(w)
, aBackground(0)
, aBackgroundFunc(anim::easeOutCirc)
, a_bg(0)
, _a_background(animation(this, &BackgroundWidget::step_background))
, hiding(false)
, shadow(st::boxShadow) {
w->setParent(this);
if (App::app()) App::app()->mtpPause();
setGeometry(0, 0, App::wnd()->width(), App::wnd()->height());
aBackground.start(1);
anim::start(this);
a_bg.start(1);
_a_background.start();
show();
connect(w, SIGNAL(closed()), this, SLOT(onInnerClose()));
connect(w, SIGNAL(resized()), this, SLOT(update()));
@ -46,7 +46,7 @@ BackgroundWidget::BackgroundWidget(QWidget *parent, LayeredWidget *w) : TWidget(
}
void BackgroundWidget::showFast() {
animStep(st::layerSlideDuration + 1);
_a_background.step(getms() + st::layerSlideDuration + 1);
update();
}
@ -58,10 +58,10 @@ void BackgroundWidget::paintEvent(QPaintEvent *e) {
if (!trivial) {
p.setClipRect(e->rect());
}
p.setOpacity(st::layerAlpha * aBackground.current());
p.setOpacity(st::layerAlpha * a_bg.current());
p.fillRect(rect(), st::layerBg->b);
p.setOpacity(aBackground.current());
p.setOpacity(a_bg.current());
shadow.paint(p, w->geometry(), st::boxShadowShift);
}
@ -90,7 +90,7 @@ bool BackgroundWidget::onInnerClose() {
_hidden.pop_back();
w->show();
resizeEvent(0);
w->animStep(1);
w->showStep(1);
update();
return false;
}
@ -101,8 +101,8 @@ void BackgroundWidget::startHide() {
hiding = true;
if (App::wnd()) App::wnd()->setInnerFocus();
aBackground.start(0);
anim::start(this);
a_bg.start(0);
_a_background.start();
w->startHide();
}
@ -139,7 +139,7 @@ void BackgroundWidget::replaceInner(LayeredWidget *n) {
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(boxDestroyed(QObject*)));
w->show();
resizeEvent(0);
w->animStep(1);
w->showStep(1);
update();
}
@ -150,28 +150,25 @@ void BackgroundWidget::showLayerLast(LayeredWidget *n) {
connect(n, SIGNAL(resized()), this, SLOT(update()));
connect(n, SIGNAL(destroyed(QObject*)), this, SLOT(boxDestroyed(QObject*)));
n->parentResized();
n->animStep(1);
n->showStep(1);
n->hide();
update();
}
bool BackgroundWidget::animStep(float64 ms) {
void BackgroundWidget::step_background(float64 ms, bool timer) {
float64 dt = ms / (hiding ? st::layerHideDuration : st::layerSlideDuration);
w->animStep(dt);
bool res = true;
w->showStep(dt);
if (dt >= 1) {
aBackground.finish();
a_bg.finish();
if (hiding) {
App::wnd()->layerFinishedHide(this);
}
anim::stop(this);
res = false;
_a_background.stop();
if (App::app()) App::app()->mtpUnpause();
} else {
aBackground.update(dt, aBackgroundFunc);
a_bg.update(dt, anim::easeOutCirc);
}
update();
return res;
if (timer) update();
}
void BackgroundWidget::boxDestroyed(QObject *obj) {
@ -196,7 +193,7 @@ BackgroundWidget::~BackgroundWidget() {
StickerPreviewWidget::StickerPreviewWidget(QWidget *parent) : TWidget(parent)
, a_shown(0, 0)
, _a_shown(animFunc(this, &StickerPreviewWidget::animStep_shown))
, _a_shown(animation(this, &StickerPreviewWidget::step_shown))
, _doc(0)
, _cacheStatus(CacheNotLoaded) {
setAttribute(Qt::WA_TransparentForMouseEvents);
@ -222,17 +219,16 @@ void StickerPreviewWidget::resizeEvent(QResizeEvent *e) {
update();
}
bool StickerPreviewWidget::animStep_shown(float64 ms) {
void StickerPreviewWidget::step_shown(float64 ms, bool timer) {
float64 dt = ms / st::stickerPreviewDuration;
if (dt >= 1) {
a_shown.finish();
_a_shown.stop();
a_shown.finish();
if (a_shown.current() < 0.5) hide();
} else {
a_shown.update(dt, anim::linear);
}
update();
return true;
if (timer) update();
}
void StickerPreviewWidget::showPreview(DocumentData *sticker) {

View file

@ -27,7 +27,7 @@ class LayeredWidget : public TWidget {
public:
virtual void animStep(float64 ms) {
virtual void showStep(float64 ms) {
}
virtual void parentResized() = 0;
virtual void startHide() {
@ -57,7 +57,7 @@ signals:
};
class BackgroundWidget : public TWidget, public Animated {
class BackgroundWidget : public TWidget {
Q_OBJECT
public:
@ -76,7 +76,7 @@ public:
void replaceInner(LayeredWidget *n);
void showLayerLast(LayeredWidget *n);
bool animStep(float64 ms);
void step_background(float64 ms, bool timer);
bool canSetFocus() const;
void setInnerFocus();
@ -98,8 +98,9 @@ private:
LayeredWidget *w;
typedef QList<LayeredWidget*> HiddenLayers;
HiddenLayers _hidden;
anim::fvalue aBackground;
anim::transition aBackgroundFunc;
anim::fvalue a_bg;
Animation _a_background;
bool hiding;
BoxShadow shadow;
@ -115,7 +116,7 @@ public:
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep_shown(float64 ms);
void step_shown(float64 ms, bool timer);
void showPreview(DocumentData *sticker);
void hidePreview();

View file

@ -38,6 +38,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
, a_over(0)
, _a_appearance(animation(this, &TopBarWidget::step_appearance))
, _selPeer(0)
, _selCount(0)
, _canDelete(false)
@ -147,35 +148,33 @@ void TopBarWidget::onDeleteAndExitSure() {
void TopBarWidget::enterEvent(QEvent *e) {
a_over.start(1);
anim::start(this);
_a_appearance.start();
}
void TopBarWidget::enterFromChildEvent(QEvent *e) {
a_over.start(1);
anim::start(this);
_a_appearance.start();
}
void TopBarWidget::leaveEvent(QEvent *e) {
a_over.start(0);
anim::start(this);
_a_appearance.start();
}
void TopBarWidget::leaveToChildEvent(QEvent *e) {
a_over.start(0);
anim::start(this);
_a_appearance.start();
}
bool TopBarWidget::animStep(float64 ms) {
void TopBarWidget::step_appearance(float64 ms, bool timer) {
float64 dt = ms / st::topBarDuration;
bool res = true;
if (dt >= 1) {
_a_appearance.stop();
a_over.finish();
res = false;
} else {
a_over.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
void TopBarWidget::paintEvent(QPaintEvent *e) {
@ -383,7 +382,7 @@ MainWidget::MainWidget(Window *window) : TWidget(window)
, _started(0)
, failedObjId(0)
, _toForwardNameVersion(0)
, _a_show(animFunc(this, &MainWidget::animStep_show))
, _a_show(animation(this, &MainWidget::step_show))
, _dialogsWidth(st::dlgMinWidth)
, dialogs(this)
, history(this)
@ -422,7 +421,7 @@ MainWidget::MainWidget(Window *window) : TWidget(window)
_ptsWaiter.setRequesting(true);
updateScrollColors();
connect(window, SIGNAL(resized(const QSize&)), this, SLOT(onParentResize(const QSize&)));
connect(App::wnd(), SIGNAL(resized(const QSize&)), this, SLOT(onParentResize(const QSize&)));
connect(&dialogs, SIGNAL(cancelled()), this, SLOT(dialogsCancelled()));
connect(&history, SIGNAL(cancelled()), &dialogs, SLOT(activate()));
connect(this, SIGNAL(peerPhotoChanged(PeerData*)), this, SIGNAL(dialogsUpdated()));
@ -2676,13 +2675,11 @@ void MainWidget::animShow(const QPixmap &bgAnimCache, bool back) {
show();
}
bool MainWidget::animStep_show(float64 ms) {
void MainWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -2698,8 +2695,7 @@ bool MainWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
return res;
if (timer) update();
}
void MainWidget::animStop_show() {

View file

@ -32,7 +32,7 @@ struct DialogRow;
class MainWidget;
class ConfirmBox;
class TopBarWidget : public TWidget, public Animated {
class TopBarWidget : public TWidget {
Q_OBJECT
public:
@ -47,7 +47,7 @@ public:
void mousePressEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *e);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void enableShadow(bool enable = true);
void startAnim();
@ -87,6 +87,7 @@ private:
MainWidget *main();
anim::fvalue a_over;
Animation _a_appearance;
PeerData *_selPeer;
uint32 _selCount;
@ -202,7 +203,7 @@ public:
int32 contentScrollAddToY() const;
void animShow(const QPixmap &bgAnimCache, bool back = false);
bool animStep_show(float64 ms);
void step_show(float64 ms, bool timer);
void animStop_show();
void start(const MTPUser &user);

View file

@ -111,6 +111,7 @@ MediaView::MediaView() : TWidget(App::wnd())
, _down(OverNone)
, _lastAction(-st::mvDeltaFromLastAction, -st::mvDeltaFromLastAction)
, _ignoringDropdown(false)
, _a_state(animation(this, &MediaView::step_state))
, _controlsState(ControlsShown)
, _controlsAnimStarted(0)
, _menu(0)
@ -300,8 +301,8 @@ void MediaView::updateControls() {
_docCancel.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocBlue.pxWidth(), _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
_docCancel.show();
if (!_docRadialFirst) _docRadialFirst = _docRadialLast = _docRadialStart = getms();
if (!animating()) anim::start(this);
anim::step(this);
if (!_a_state.animating()) _a_state.start();
_a_state.step();
} else {
if (_doc->already(true).isEmpty()) {
_docDownload.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocBlue.pxWidth(), _docRect.y() + st::mvDocPadding + st::mvDocLinksTop);
@ -395,9 +396,8 @@ void MediaView::updateDropdown() {
_dropdown.moveToRight(0, height() - _dropdown.height());
}
bool MediaView::animStep(float64 msp) {
void MediaView::step_state(uint64 ms, bool timer) {
bool result = false;
uint64 ms = getms();
for (Showing::iterator i = _animations.begin(); i != _animations.end();) {
int64 start = i.value();
switch (i.key()) {
@ -472,7 +472,9 @@ bool MediaView::animStep(float64 msp) {
a_docRadialStart.update(fromstart - qFloor(fromstart), anim::linear);
update(_docIconRect);
}
return result || !_animations.isEmpty();
if (!result && _animations.isEmpty()) {
_a_state.stop();
}
}
MediaView::~MediaView() {
@ -496,7 +498,7 @@ void MediaView::activateControls() {
_controlsState = ControlsShowing;
_controlsAnimStarted = getms();
a_cOpacity.start(1);
if (!animating()) anim::start(this);
if (!_a_state.animating()) _a_state.start();
}
}
@ -506,7 +508,7 @@ void MediaView::onHideControls(bool force) {
_controlsState = ControlsHiding;
_controlsAnimStarted = getms();
a_cOpacity.start(0);
if (!animating()) anim::start(this);
if (!_a_state.animating()) _a_state.start();
}
void MediaView::onDropdownHiding() {
@ -743,7 +745,7 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) {
setCursor(style::cur_default);
if (!_animations.isEmpty()) {
_animations.clear();
anim::stop(this);
_a_state.stop();
}
if (!_animOpacities.isEmpty()) _animOpacities.clear();
@ -774,7 +776,7 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) {
setCursor(style::cur_default);
if (!_animations.isEmpty()) {
_animations.clear();
anim::stop(this);
_a_state.stop();
}
if (!_animOpacities.isEmpty()) _animOpacities.clear();
@ -828,7 +830,7 @@ void MediaView::showDocument(DocumentData *doc, HistoryItem *context) {
setCursor(style::cur_default);
if (!_animations.isEmpty()) {
_animations.clear();
anim::stop(this);
_a_state.stop();
}
if (!_animOpacities.isEmpty()) _animOpacities.clear();
@ -1721,7 +1723,7 @@ bool MediaView::updateOverState(OverState newState) {
} else {
_animOpacities.insert(_over, anim::fvalue(1, 0));
}
if (!animating()) anim::start(this);
if (!_a_state.animating()) _a_state.start();
} else {
result = false;
}
@ -1734,7 +1736,7 @@ bool MediaView::updateOverState(OverState newState) {
} else {
_animOpacities.insert(_over, anim::fvalue(0, 1));
}
if (!animating()) anim::start(this);
if (!_a_state.animating()) _a_state.start();
setCursor(style::cur_pointer);
} else {
setCursor(style::cur_default);

View file

@ -22,7 +22,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "dropdown.h"
class MediaView : public TWidget, public RPCSender, public Animated {
class MediaView : public TWidget, public RPCSender {
Q_OBJECT
public:
@ -65,7 +65,7 @@ public:
void updateControls();
void updateDropdown();
bool animStep(float64 dt);
void step_state(uint64 ms, bool timer);
void showSaveMsgFile();
void close();
@ -184,6 +184,8 @@ private:
QPoint _lastAction, _lastMouseMovePos;
bool _ignoringDropdown;
Animation _a_state;
enum ControlsState {
ControlsShowing,
ControlsShown,

View file

@ -2669,7 +2669,7 @@ OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewTyp
, _scroll(this, st::historyScroll, false)
, _inner(this, &_scroll, peer, type)
, _noDropResizeIndex(false)
, _a_show(animFunc(this, &OverviewWidget::animStep_show))
, _a_show(animation(this, &OverviewWidget::step_show))
, _scrollSetAfterShow(0)
, _scrollDelta(0)
, _selCount(0)
@ -2946,15 +2946,13 @@ void OverviewWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimT
_inner.activate();
}
bool OverviewWidget::animStep_show(float64 ms) {
void OverviewWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_topShadow.show();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -2969,9 +2967,10 @@ bool OverviewWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
App::main()->topBar()->update();
return res;
if (timer) {
update();
App::main()->topBar()->update();
}
}
void OverviewWidget::updateWideMode() {

View file

@ -307,7 +307,7 @@ public:
void fastShow(bool back = false, int32 lastScrollTop = -1);
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1);
bool animStep_show(float64 ms);
void step_show(float64 ms, bool timer);
void updateWideMode();
void doneShow();

View file

@ -30,7 +30,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/text.h"
PasscodeWidget::PasscodeWidget(QWidget *parent) : TWidget(parent)
, _a_show(animFunc(this, &PasscodeWidget::animStep_show))
, _a_show(animation(this, &PasscodeWidget::step_show))
, _passcode(this, st::passcodeInput)
, _submit(this, lang(lng_passcode_submit), st::passcodeSubmit)
, _logout(this, lang(lng_passcode_logout)) {
@ -129,13 +129,11 @@ void PasscodeWidget::animShow(const QPixmap &bgAnimCache, bool back) {
show();
}
bool PasscodeWidget::animStep_show(float64 ms) {
void PasscodeWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -151,11 +149,10 @@ bool PasscodeWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
return res;
if (timer) update();
}
void PasscodeWidget::animStop_show() {
void PasscodeWidget::stop_show() {
_a_show.stop();
}

View file

@ -34,8 +34,8 @@ public:
void setInnerFocus();
void animShow(const QPixmap &bgAnimCache, bool back = false);
bool animStep_show(float64 ms);
void animStop_show();
void step_show(float64 ms, bool timer);
void stop_show();
~PasscodeWidget();

View file

@ -41,7 +41,7 @@ PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent)
, _downCoord(0)
, _downFrequency(AudioVoiceMsgFrequency)
, _downProgress(0.)
, _stateAnim(animFunc(this, &PlayerWidget::stateStep))
, _a_state(animation(this, &PlayerWidget::step_state))
, _msgmigrated(false)
, _index(-1)
, _migrated(0)
@ -54,7 +54,7 @@ PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent)
, _loaded(0)
, a_progress(0., 0.)
, a_loadProgress(0., 0.)
, _progressAnim(animFunc(this, &PlayerWidget::progressStep))
, _a_progress(animation(this, &PlayerWidget::step_progress))
, _sideShadow(this, st::shadowColor) {
resize(st::wndMinWidth, st::playerHeight);
setMouseTracking(true);
@ -236,7 +236,7 @@ void PlayerWidget::updateOverState(OverState newState) {
if (_over != OverNone) {
_stateAnimations.remove(_over);
_stateAnimations[-_over] = getms() - ((1. - _stateHovers[_over]) * st::playerDuration);
if (!_stateAnim.animating()) _stateAnim.start();
if (!_a_state.animating()) _a_state.start();
} else {
result = false;
}
@ -244,7 +244,7 @@ void PlayerWidget::updateOverState(OverState newState) {
if (newState != OverNone) {
_stateAnimations.remove(-_over);
_stateAnimations[_over] = getms() - (_stateHovers[_over] * st::playerDuration);
if (!_stateAnim.animating()) _stateAnim.start();
if (!_a_state.animating()) _a_state.start();
setCursor(style::cur_pointer);
} else {
setCursor(style::cur_default);
@ -375,9 +375,7 @@ bool PlayerWidget::seekingSong(const SongMsgId &song) const {
return (_down == OverPlayback) && (song == _song);
}
bool PlayerWidget::stateStep(float64 msc) {
bool result = false;
uint64 ms = getms();
void PlayerWidget::step_state(uint64 ms, bool timer) {
for (StateAnimations::iterator i = _stateAnimations.begin(); i != _stateAnimations.cend();) {
int32 over = qAbs(i.key());
updateOverRect(OverState(over));
@ -391,7 +389,9 @@ bool PlayerWidget::stateStep(float64 msc) {
++i;
}
}
return !_stateAnimations.isEmpty();
if (_stateAnimations.isEmpty()) {
_a_state.stop();
}
}
void PlayerWidget::mouseMoveEvent(QMouseEvent *e) {
@ -462,7 +462,7 @@ void PlayerWidget::mouseReleaseEvent(QMouseEvent *e) {
_showPause = true;
a_progress = anim::fvalue(_downProgress, _downProgress);
_progressAnim.stop();
_a_progress.stop();
}
update();
} else if (_down == OverClose && _over == OverClose) {
@ -573,19 +573,17 @@ void PlayerWidget::resizeEvent(QResizeEvent *e) {
update();
}
bool PlayerWidget::progressStep(float64 ms) {
void PlayerWidget::step_progress(float64 ms, bool timer) {
float64 dt = ms / (2 * AudioVoiceMsgUpdateView);
bool res = true;
if (_duration && dt >= 1) {
_a_progress.stop();
a_progress.finish();
a_loadProgress.finish();
res = false;
} else {
a_progress.update(qMin(dt, 1.), anim::linear);
a_loadProgress.update(1. - (st::radialDuration / (st::radialDuration + ms)), anim::linear);
}
rtlupdate(_playbackRect);
return res;
if (timer) rtlupdate(_playbackRect);
}
void PlayerWidget::updateState() {
@ -668,11 +666,11 @@ void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState,
if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) {
a_progress.start(progress);
a_loadProgress.start(loadProgress);
_progressAnim.start();
_a_progress.start();
} else {
a_progress = anim::fvalue(progress, progress);
a_loadProgress = anim::fvalue(loadProgress, loadProgress);
_progressAnim.stop();
_a_progress.stop();
}
_position = position;
_duration = duration;
@ -683,11 +681,11 @@ void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState,
if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) {
a_progress.start(progress);
a_loadProgress.start(loadProgress);
_progressAnim.start();
_a_progress.start();
} else {
a_progress = anim::fvalue(progress, progress);
a_loadProgress = anim::fvalue(loadProgress, loadProgress);
_progressAnim.stop();
_a_progress.stop();
}
_position = position;
_duration = duration;

View file

@ -43,8 +43,8 @@ public:
void nextPressed();
void stopPressed();
bool progressStep(float64 ms);
bool stateStep(float64 ms);
void step_progress(float64 ms, bool timer);
void step_state(uint64 ms, bool timer);
void updateState(SongMsgId playing, AudioPlayerState playingState, int64 playingPosition, int64 playingDuration, int32 playingFrequency);
void updateState();
@ -97,7 +97,7 @@ private:
float64 _stateHovers[OverStateCount];
typedef QMap<int32, uint64> StateAnimations;
StateAnimations _stateAnimations;
Animation _stateAnim;
Animation _a_state;
SongMsgId _song;
bool _msgmigrated;
@ -114,7 +114,7 @@ private:
int32 _loaded;
anim::fvalue a_progress, a_loadProgress;
Animation _progressAnim;
Animation _a_progress;
PlainShadow _sideShadow;

View file

@ -67,7 +67,8 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, PeerData
, _aboutTop(0)
, _aboutHeight(0)
, a_photo(0)
, a_photoOver(0)
, _a_photo(animation(this, &ProfileInner::step_photo))
, _photoOver(false)
// migrate to megagroup
@ -766,11 +767,11 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
if (_photoLink || _peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator)) {
p.drawPixmap(_left, top, _peer->photo->pix(st::profilePhotoSize));
} else {
if (a_photo.current() < 1) {
if (a_photoOver.current() < 1) {
p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg);
}
if (a_photo.current() > 0) {
p.setOpacity(a_photo.current());
if (a_photoOver.current() > 0) {
p.setOpacity(a_photoOver.current());
p.drawPixmap(QPoint(_left, top), App::sprite(), st::setOverPhotoImg);
p.setOpacity(1);
}
@ -990,8 +991,8 @@ void ProfileInner::mouseMoveEvent(QMouseEvent *e) {
if (photoOver != _photoOver) {
_photoOver = photoOver;
if (!_photoLink && ((_peerChat && _peerChat->canEdit()) || (_peerChannel && _amCreator))) {
a_photo.start(_photoOver ? 1 : 0);
anim::start(this);
a_photoOver.start(_photoOver ? 1 : 0);
_a_photo.start();
}
}
if (!_photoLink && (_peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator))) {
@ -1424,17 +1425,15 @@ void ProfileInner::onCopyUsername() {
QApplication::clipboard()->setText('@' + _peerUser->username);
}
bool ProfileInner::animStep(float64 ms) {
void ProfileInner::step_photo(float64 ms, bool timer) {
float64 dt = ms / st::setPhotoDuration;
bool res = true;
if (dt >= 1) {
res = false;
a_photo.finish();
_a_photo.stop();
a_photoOver.finish();
} else {
a_photo.update(dt, anim::linear);
a_photoOver.update(dt, anim::linear);
}
update(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize);
return res;
if (timer) update(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize);
}
PeerData *ProfileInner::peer() const {
@ -1723,7 +1722,7 @@ QString ProfileInner::overviewLinkText(int32 type, int32 count) {
ProfileWidget::ProfileWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
, _scroll(this, st::setScroll)
, _inner(this, &_scroll, peer)
, _a_show(animFunc(this, &ProfileWidget::animStep_show))
, _a_show(animation(this, &ProfileWidget::step_show))
, _sideShadow(this, st::shadowColor)
, _topShadow(this, st::shadowColor)
, _inGrab(false) {
@ -1857,15 +1856,13 @@ void ProfileWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
_inner.setFocus();
}
bool ProfileWidget::animStep_show(float64 ms) {
void ProfileWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
_sideShadow.setVisible(cWideMode());
_topShadow.show();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -1882,9 +1879,10 @@ bool ProfileWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
App::main()->topBar()->update();
return res;
if (timer) {
update();
App::main()->topBar()->update();
}
}
void ProfileWidget::updateOnlineDisplay() {

View file

@ -21,7 +21,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#pragma once
class ProfileWidget;
class ProfileInner : public TWidget, public RPCSender, public Animated {
class ProfileInner : public TWidget, public RPCSender {
Q_OBJECT
public:
@ -44,7 +44,7 @@ public:
void resizeEvent(QResizeEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
bool animStep(float64 ms);
void step_photo(float64 ms, bool timer);
PeerData *peer() const;
bool allMediaShown() const;
@ -162,7 +162,8 @@ private:
Text _about;
int32 _aboutTop, _aboutHeight;
anim::fvalue a_photo;
anim::fvalue a_photoOver;
Animation _a_photo;
bool _photoOver;
QString _errorText;
@ -235,7 +236,7 @@ public:
int32 lastScrollTop() const;
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1);
bool animStep_show(float64 ms);
void step_show(float64 ms, bool timer);
void updateOnlineDisplay();
void updateOnlineDisplayTimer();

View file

@ -111,96 +111,99 @@ bool scaleIs(DBIScale scale) {
return cRealScale() == scale || (cRealScale() == dbisAuto && cScreenScale() == scale);
}
SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
_self(App::self()),
SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
, _self(App::self())
// profile
_nameCache(self() ? self()->name : QString()),
_uploadPhoto(this, lang(lng_settings_upload), st::btnSetUpload),
_cancelPhoto(this, lang(lng_cancel)), _nameOver(false), _photoOver(false), a_photo(0),
// profile
, _nameCache(self() ? self()->name : QString())
, _uploadPhoto(this, lang(lng_settings_upload), st::btnSetUpload)
, _cancelPhoto(this, lang(lng_cancel))
, _nameOver(false)
, _photoOver(false)
, a_photoOver(0)
, _a_photo(animation(this, &SettingsInner::step_photo))
// contact info
_phoneText(self() ? App::formatPhone(self()->phone) : QString()),
_chooseUsername(this, (self() && !self()->username.isEmpty()) ? ('@' + self()->username) : lang(lng_settings_choose_username)),
// contact info
, _phoneText(self() ? App::formatPhone(self()->phone) : QString())
, _chooseUsername(this, (self() && !self()->username.isEmpty()) ? ('@' + self()->username) : lang(lng_settings_choose_username))
// notifications
_desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify()),
_senderName(this, lang(lng_settings_show_name), cNotifyView() <= dbinvShowName),
_messagePreview(this, lang(lng_settings_show_preview), cNotifyView() <= dbinvShowPreview),
_windowsNotifications(this, lang(lng_settings_use_windows), cWindowsNotifications()),
_soundNotify(this, lang(lng_settings_sound_notify), cSoundNotify()),
_includeMuted(this, lang(lng_settings_include_muted), cIncludeMuted()),
// notifications
, _desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify())
, _senderName(this, lang(lng_settings_show_name), cNotifyView() <= dbinvShowName)
, _messagePreview(this, lang(lng_settings_show_preview), cNotifyView() <= dbinvShowPreview)
, _windowsNotifications(this, lang(lng_settings_use_windows), cWindowsNotifications())
, _soundNotify(this, lang(lng_settings_sound_notify), cSoundNotify())
, _includeMuted(this, lang(lng_settings_include_muted), cIncludeMuted())
// general
_changeLanguage(this, lang(lng_settings_change_lang)),
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
_autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate()),
_checkNow(this, lang(lng_settings_check_now)),
_restartNow(this, lang(lng_settings_update_now)),
#endif
// general
, _changeLanguage(this, lang(lng_settings_change_lang))
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
, _autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate())
, _checkNow(this, lang(lng_settings_check_now))
, _restartNow(this, lang(lng_settings_update_now))
#endif
_supportTray(cSupportTray()),
_workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)),
_workmodeWindow(this, lang(lng_settings_workmode_window), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray)),
, _supportTray(cSupportTray())
, _workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray))
, _workmodeWindow(this, lang(lng_settings_workmode_window), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray))
_autoStart(this, lang(lng_settings_auto_start), cAutoStart()),
_startMinimized(this, lang(lng_settings_start_min), cStartMinimized()),
_sendToMenu(this, lang(lng_settings_add_sendto), cSendToMenu()),
, _autoStart(this, lang(lng_settings_auto_start), cAutoStart())
, _startMinimized(this, lang(lng_settings_start_min), cStartMinimized())
, _sendToMenu(this, lang(lng_settings_add_sendto), cSendToMenu())
_dpiAutoScale(this, lng_settings_scale_auto(lt_cur, scaleLabel(cScreenScale())), (cConfigScale() == dbisAuto)),
_dpiSlider(this, st::dpiSlider, dbisScaleCount - 1, cEvalScale(cConfigScale()) - 1),
_dpiWidth1(st::dpiFont1->width(scaleLabel(dbisOne))),
_dpiWidth2(st::dpiFont2->width(scaleLabel(dbisOneAndQuarter))),
_dpiWidth3(st::dpiFont3->width(scaleLabel(dbisOneAndHalf))),
_dpiWidth4(st::dpiFont4->width(scaleLabel(dbisTwo))),
, _dpiAutoScale(this, lng_settings_scale_auto(lt_cur, scaleLabel(cScreenScale())), (cConfigScale() == dbisAuto))
, _dpiSlider(this, st::dpiSlider, dbisScaleCount - 1, cEvalScale(cConfigScale()) - 1)
, _dpiWidth1(st::dpiFont1->width(scaleLabel(dbisOne)))
, _dpiWidth2(st::dpiFont2->width(scaleLabel(dbisOneAndQuarter)))
, _dpiWidth3(st::dpiFont3->width(scaleLabel(dbisOneAndHalf)))
, _dpiWidth4(st::dpiFont4->width(scaleLabel(dbisTwo)))
// chat options
_replaceEmojis(this, lang(lng_settings_replace_emojis), cReplaceEmojis()),
_viewEmojis(this, lang(lng_settings_view_emojis)),
_stickers(this, lang(lng_stickers_you_have)),
// chat options
, _replaceEmojis(this, lang(lng_settings_replace_emojis), cReplaceEmojis())
, _viewEmojis(this, lang(lng_settings_view_emojis))
, _stickers(this, lang(lng_stickers_you_have))
_enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()),
_ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()),
, _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter())
, _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter())
_dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()),
_downloadPathWidth(st::linkFont->width(lang(lng_download_path_label)) + st::linkFont->spacew),
_downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_default) : ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::setVersionLeft - _downloadPathWidth))),
_downloadPathClear(this, lang(lng_download_path_clear)),
_tempDirClearingWidth(st::linkFont->width(lang(lng_download_path_clearing))),
_tempDirClearedWidth(st::linkFont->width(lang(lng_download_path_cleared))),
_tempDirClearFailedWidth(st::linkFont->width(lang(lng_download_path_clear_failed))),
, _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath())
, _downloadPathWidth(st::linkFont->width(lang(lng_download_path_label)) + st::linkFont->spacew)
, _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_default) : ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::setVersionLeft - _downloadPathWidth)))
, _downloadPathClear(this, lang(lng_download_path_clear))
, _tempDirClearingWidth(st::linkFont->width(lang(lng_download_path_clearing)))
, _tempDirClearedWidth(st::linkFont->width(lang(lng_download_path_cleared)))
, _tempDirClearFailedWidth(st::linkFont->width(lang(lng_download_path_clear_failed)))
// chat background
_backFromGallery(this, lang(lng_settings_bg_from_gallery)),
_backFromFile(this, lang(lng_settings_bg_from_file)),
_tileBackground(this, lang(lng_settings_bg_tile), cTileBackground()),
_needBackgroundUpdate(false),
// chat background
, _backFromGallery(this, lang(lng_settings_bg_from_gallery))
, _backFromFile(this, lang(lng_settings_bg_from_file))
, _tileBackground(this, lang(lng_settings_bg_tile), cTileBackground())
, _needBackgroundUpdate(false)
// local storage
_localStorageClear(this, lang(lng_local_storage_clear)),
_localStorageHeight(1),
_storageClearingWidth(st::linkFont->width(lang(lng_local_storage_clearing))),
_storageClearedWidth(st::linkFont->width(lang(lng_local_storage_cleared))),
_storageClearFailedWidth(st::linkFont->width(lang(lng_local_storage_clear_failed))),
// local storage
, _localStorageClear(this, lang(lng_local_storage_clear))
, _localStorageHeight(1)
, _storageClearingWidth(st::linkFont->width(lang(lng_local_storage_clearing)))
, _storageClearedWidth(st::linkFont->width(lang(lng_local_storage_cleared)))
, _storageClearFailedWidth(st::linkFont->width(lang(lng_local_storage_clear_failed)))
// advanced
_passcodeEdit(this, lang(cHasPasscode() ? lng_passcode_change : lng_passcode_turn_on)),
_passcodeTurnOff(this, lang(lng_passcode_turn_off)),
_autoLock(this, (cAutoLock() % 3600) ? lng_passcode_autolock_minutes(lt_count, cAutoLock() / 60) : lng_passcode_autolock_hours(lt_count, cAutoLock() / 3600)),
_autoLockText(lang(psIdleSupported() ? lng_passcode_autolock_away : lng_passcode_autolock_inactive) + ' '),
_autoLockWidth(st::linkFont->width(_autoLockText)),
_passwordEdit(this, lang(lng_cloud_password_set)),
_passwordTurnOff(this, lang(lng_passcode_turn_off)),
_hasPasswordRecovery(false),
_connectionType(this, lang(lng_connection_auto_connecting)),
_connectionTypeText(lang(lng_connection_type) + ' '),
_connectionTypeWidth(st::linkFont->width(_connectionTypeText)),
_showSessions(this, lang(lng_settings_show_sessions)),
_askQuestion(this, lang(lng_settings_ask_question)),
_telegramFAQ(this, lang(lng_settings_faq)),
_logOut(this, lang(lng_settings_logout), st::btnLogout),
_supportGetRequest(0)
{
// advanced
, _passcodeEdit(this, lang(cHasPasscode() ? lng_passcode_change : lng_passcode_turn_on))
, _passcodeTurnOff(this, lang(lng_passcode_turn_off))
, _autoLock(this, (cAutoLock() % 3600) ? lng_passcode_autolock_minutes(lt_count, cAutoLock() / 60) : lng_passcode_autolock_hours(lt_count, cAutoLock() / 3600))
, _autoLockText(lang(psIdleSupported() ? lng_passcode_autolock_away : lng_passcode_autolock_inactive) + ' ')
, _autoLockWidth(st::linkFont->width(_autoLockText))
, _passwordEdit(this, lang(lng_cloud_password_set))
, _passwordTurnOff(this, lang(lng_passcode_turn_off))
, _hasPasswordRecovery(false)
, _connectionType(this, lang(lng_connection_auto_connecting))
, _connectionTypeText(lang(lng_connection_type) + ' ')
, _connectionTypeWidth(st::linkFont->width(_connectionTypeText))
, _showSessions(this, lang(lng_settings_show_sessions))
, _askQuestion(this, lang(lng_settings_ask_question))
, _telegramFAQ(this, lang(lng_settings_faq))
, _logOut(this, lang(lng_settings_logout), st::btnLogout)
, _supportGetRequest(0) {
if (self()) {
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
@ -393,11 +396,11 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
if (_photoLink) {
p.drawPixmap(_left, top, self()->photo->pix(st::setPhotoSize));
} else {
if (a_photo.current() < 1) {
if (a_photoOver.current() < 1) {
p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg);
}
if (a_photo.current() > 0) {
p.setOpacity(a_photo.current());
if (a_photoOver.current() > 0) {
p.setOpacity(a_photoOver.current());
p.drawPixmap(QPoint(_left, top), App::sprite(), st::setOverPhotoImg);
p.setOpacity(1);
}
@ -816,8 +819,8 @@ void SettingsInner::mouseMoveEvent(QMouseEvent *e) {
if (photoOver != _photoOver) {
_photoOver = photoOver;
if (!_photoLink) {
a_photo.start(_photoOver ? 1 : 0);
anim::start(this);
a_photoOver.start(_photoOver ? 1 : 0);
_a_photo.start();
}
}
@ -845,17 +848,15 @@ void SettingsInner::mousePressEvent(QMouseEvent *e) {
void SettingsInner::contextMenuEvent(QContextMenuEvent *e) {
}
bool SettingsInner::animStep(float64 ms) {
void SettingsInner::step_photo(float64 ms, bool timer) {
float64 dt = ms / st::setPhotoDuration;
bool res = true;
if (dt >= 1) {
res = false;
a_photo.finish();
_a_photo.stop();
a_photoOver.finish();
} else {
a_photo.update(dt, anim::linear);
a_photoOver.update(dt, anim::linear);
}
update(_left, st::setTop, st::setPhotoSize, st::setPhotoSize);
return res;
if (timer) update(_left, st::setTop, st::setPhotoSize, st::setPhotoSize);
}
void SettingsInner::updateSize(int32 newWidth) {
@ -1763,7 +1764,7 @@ void SettingsInner::onPhotoUpdateDone(PeerId peer) {
}
SettingsWidget::SettingsWidget(Window *parent) : TWidget(parent)
, _a_show(animFunc(this, &SettingsWidget::animStep_show))
, _a_show(animation(this, &SettingsWidget::step_show))
, _scroll(this, st::setScroll)
, _inner(this)
, _close(this, st::setClose) {
@ -1800,13 +1801,11 @@ void SettingsWidget::animShow(const QPixmap &bgAnimCache, bool back) {
show();
}
bool SettingsWidget::animStep_show(float64 ms) {
void SettingsWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / st::slideDuration;
bool res = true;
if (dt >= 1) {
_a_show.stop();
res = false;
a_coordUnder.finish();
a_coordOver.finish();
a_shadow.finish();
@ -1822,11 +1821,10 @@ bool SettingsWidget::animStep_show(float64 ms) {
a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction);
}
update();
return res;
if (timer) update();
}
void SettingsWidget::animStop_show() {
void SettingsWidget::stop_show() {
_a_show.stop();
}

View file

@ -57,7 +57,7 @@ private:
};
class SettingsInner : public QWidget, public RPCSender, public Animated {
class SettingsInner : public TWidget, public RPCSender {
Q_OBJECT
public:
@ -71,7 +71,7 @@ public:
void mousePressEvent(QMouseEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
bool animStep(float64 ms);
void step_photo(float64 ms, bool timer);
void updateSize(int32 newWidth);
@ -203,7 +203,8 @@ private:
FlatButton _uploadPhoto;
LinkButton _cancelPhoto;
bool _nameOver, _photoOver;
anim::fvalue a_photo;
anim::fvalue a_photoOver;
Animation _a_photo;
QString _errorText;
@ -315,8 +316,8 @@ public:
void updateWideMode();
void animShow(const QPixmap &bgAnimCache, bool back = false);
bool animStep_show(float64 ms);
void animStop_show();
void step_show(float64 ms, bool timer);
void stop_show();
void updateOnlineDisplay();
void updateConnectionType();

View file

@ -64,7 +64,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "gui/flatbutton.h"
#include "gui/boxshadow.h"
#include "gui/popupmenu.h"
#include "gui/switcher.h"
#include "gui/scrollarea.h"
#include "gui/images.h"
#include "gui/text.h"

View file

@ -28,8 +28,12 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "application.h"
#include "autoupdater.h"
SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text) : Button(parent),
_st(st), a_color(_st.color->c), _overLevel(0), _text(text) {
SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text) : Button(parent)
, _st(st)
, a_color(_st.color->c)
, _a_color(animation(this, &SysBtn::step_color))
, _overLevel(0)
, _text(text) {
int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text)));
resize(w, _st.size.height());
setCursor(style::cur_default);
@ -51,11 +55,11 @@ void SysBtn::onStateChange(int oldState, ButtonStateChangeSource source) {
a_color.start((_state & StateOver ? _st.overColor : _st.color)->c);
if (source == ButtonByUser || source == ButtonByPress) {
anim::stop(this);
_a_color.stop();
a_color.finish();
update();
} else {
anim::start(this);
_a_color.start();
}
}
@ -96,17 +100,15 @@ HitTestType SysBtn::hitTest(const QPoint &p) const {
return HitTestNone;
}
bool SysBtn::animStep(float64 ms) {
void SysBtn::step_color(float64 ms, bool timer) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
_a_color.stop();
a_color.finish();
res = false;
} else {
a_color.update(dt, anim::linear);
}
update();
return res;
if (timer) update();
}
MinimizeBtn::MinimizeBtn(QWidget *parent, Window *window) : SysBtn(parent, st::sysMin), wnd(window) {

View file

@ -26,7 +26,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
class Window;
class SysBtn : public Button, public Animated {
class SysBtn : public Button {
Q_OBJECT
public:
@ -41,7 +41,7 @@ public:
void setOverLevel(float64 level);
bool animStep(float64 ms);
void step_color(float64 ms, bool timer);
public slots:
@ -51,6 +51,8 @@ protected:
style::sysButton _st;
anim::cvalue a_color;
Animation _a_color;
float64 _overLevel;
QString _text;

View file

@ -49,23 +49,23 @@ void TitleHider::setLevel(float64 level) {
update();
}
TitleWidget::TitleWidget(Window *window)
: QWidget(window)
, wnd(window)
, hideLevel(0)
, hider(0)
, _back(this, st::titleBackButton, lang(lng_menu_back))
, _cancel(this, lang(lng_cancel), st::titleTextButton)
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
, _about(this, lang(lng_menu_about), st::titleTextButton)
, _lock(this, window)
, _update(this, window, lang(lng_menu_update))
, _minimize(this, window)
, _maximize(this, window)
, _restore(this, window)
, _close(this, window)
, lastMaximized(!(window->windowState() & Qt::WindowMaximized))
TitleWidget::TitleWidget(Window *window) : TWidget(window)
, wnd(window)
, hideLevel(0)
, hider(0)
, _back(this, st::titleBackButton, lang(lng_menu_back))
, _cancel(this, lang(lng_cancel), st::titleTextButton)
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
, _about(this, lang(lng_menu_about), st::titleTextButton)
, _lock(this, window)
, _update(this, window, lang(lng_menu_update))
, _minimize(this, window)
, _maximize(this, window)
, _restore(this, window)
, _close(this, window)
, _a_update(animation(this, &TitleWidget::step_update))
, lastMaximized(!(window->windowState() & Qt::WindowMaximized))
{
setGeometry(0, 0, wnd->width(), st::titleHeight);
setAttribute(Qt::WA_OpaquePaintEvent);
@ -110,11 +110,10 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
}
}
bool TitleWidget::animStep(float64 ms) {
void TitleWidget::step_update(float64 ms, bool timer) {
float64 phase = sin(M_PI_2 * (ms / st::updateBlinkDuration));
if (phase < 0) phase = -phase;
_update.setOverLevel(phase);
return true;
}
void TitleWidget::setHideLevel(float64 level) {
@ -332,7 +331,7 @@ void TitleWidget::showUpdateBtn() {
_restore.hide();
_maximize.hide();
_close.hide();
anim::start(this);
_a_update.start();
} else {
_update.hide();
if (cPlatform() == dbipWindows) {
@ -340,7 +339,7 @@ void TitleWidget::showUpdateBtn() {
maximizedChanged(lastMaximized, true);
_close.show();
}
anim::stop(this);
_a_update.stop();
}
resizeEvent(0);
update();

View file

@ -39,7 +39,7 @@ private:
};
class TitleWidget : public QWidget, public Animated {
class TitleWidget : public TWidget {
Q_OBJECT
public:
@ -61,7 +61,7 @@ public:
void setHideLevel(float64 level);
bool animStep(float64 ms);
void step_update(float64 ms, bool timer);
~TitleWidget();
@ -97,6 +97,8 @@ private:
RestoreBtn _restore;
CloseBtn _close;
Animation _a_update;
bool lastMaximized;
QPixmap _counter;

View file

@ -82,9 +82,10 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) :
, posDuration(st::notifyFastAnim)
, hiding(false)
, _index(0)
, aOpacity(0)
, aOpacityFunc(st::notifyFastAnimFunc)
, aY(y + st::notifyHeight + st::notifyDeltaY) {
, a_opacity(0)
, a_y(y + st::notifyHeight + st::notifyDeltaY)
, a_func(anim::linear)
, _a_appearance(animation(this, &NotifyWindow::step_appearance)) {
updateNotifyDisplay();
@ -99,19 +100,19 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) :
close.move(st::notifyWidth - st::notifyClose.width - st::notifyClosePos.x(), st::notifyClosePos.y());
close.show();
aY.start(y);
setGeometry(x, aY.current(), st::notifyWidth, st::notifyHeight);
a_y.start(y);
setGeometry(x, a_y.current(), st::notifyWidth, st::notifyHeight);
aOpacity.start(1);
a_opacity.start(1);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
show();
setWindowOpacity(aOpacity.current());
setWindowOpacity(a_opacity.current());
alphaDuration = posDuration = st::notifyFastAnim;
anim::start(this);
_a_appearance.start();
checkLastInput();
}
@ -140,11 +141,11 @@ void NotifyWindow::moveTo(int32 x, int32 y, int32 index) {
if (index >= 0) {
_index = index;
}
move(x, aY.current());
aY.start(y);
aOpacity.restart();
move(x, a_y.current());
a_y.start(y);
a_opacity.restart();
posDuration = st::notifyFastAnim;
anim::start(this);
_a_appearance.start();
}
void NotifyWindow::updateNotifyDisplay() {
@ -262,7 +263,7 @@ void NotifyWindow::unlinkHistoryAndNotify() {
void NotifyWindow::unlinkHistory(History *hist) {
if (!hist || hist == history) {
animHide(st::notifyFastAnim, st::notifyFastAnimFunc);
animHide(st::notifyFastAnim, anim::linear);
history = 0;
item = 0;
}
@ -309,22 +310,22 @@ void NotifyWindow::paintEvent(QPaintEvent *e) {
void NotifyWindow::animHide(float64 duration, anim::transition func) {
if (!history) return;
alphaDuration = duration;
aOpacityFunc = func;
aOpacity.start(0);
aY.restart();
a_func = func;
a_opacity.start(0);
a_y.restart();
hiding = true;
anim::start(this);
_a_appearance.start();
}
void NotifyWindow::stopHiding() {
if (!history) return;
alphaDuration = st::notifyFastAnim;
aOpacityFunc = st::notifyFastAnimFunc;
aOpacity.start(1);
aY.restart();
a_func = anim::linear;
a_opacity.start(1);
a_y.restart();
hiding = false;
hideTimer.stop();
anim::start(this);
_a_appearance.start();
}
void NotifyWindow::hideByTimer() {
@ -332,25 +333,27 @@ void NotifyWindow::hideByTimer() {
animHide(st::notifySlowHide, st::notifySlowHideFunc);
}
bool NotifyWindow::animStep(float64 ms) {
void NotifyWindow::step_appearance(float64 ms, bool timer) {
float64 dtAlpha = ms / alphaDuration, dtPos = ms / posDuration;
if (dtAlpha >= 1) {
aOpacity.finish();
a_opacity.finish();
if (hiding) {
_a_appearance.stop();
deleteLater();
} else if (dtPos >= 1) {
_a_appearance.stop();
}
} else {
aOpacity.update(dtAlpha, aOpacityFunc);
a_opacity.update(dtAlpha, a_func);
}
setWindowOpacity(aOpacity.current());
setWindowOpacity(a_opacity.current());
if (dtPos >= 1) {
aY.finish();
a_y.finish();
} else {
aY.update(dtPos, anim::linear);
a_y.update(dtPos, anim::linear);
}
move(x(), aY.current());
move(x(), a_y.current());
update();
return (dtAlpha < 1 || (!hiding && dtPos < 1));
}
NotifyWindow::~NotifyWindow() {
@ -481,7 +484,7 @@ void Window::clearWidgets() {
_passcode = 0;
}
if (settings) {
settings->animStop_show();
settings->stop_show();
settings->hide();
settings->deleteLater();
settings->rpcInvalidate();
@ -495,7 +498,7 @@ void Window::clearWidgets() {
main = 0;
}
if (intro) {
intro->animStop_show();
intro->stop_show();
intro->hide();
intro->deleteLater();
intro->rpcInvalidate();
@ -524,7 +527,7 @@ void Window::clearPasscode() {
QPixmap bg = grabInner();
_passcode->animStop_show();
_passcode->stop_show();
_passcode->hide();
_passcode->deleteLater();
_passcode = 0;
@ -544,7 +547,7 @@ void Window::setupPasscode(bool anim) {
QPixmap bg = grabInner();
if (_passcode) {
_passcode->animStop_show();
_passcode->stop_show();
_passcode->hide();
_passcode->deleteLater();
}
@ -686,7 +689,7 @@ void Window::showSettings() {
QPixmap bg = grabInner();
if (intro) {
intro->animStop_show();
intro->stop_show();
intro->hide();
} else if (main) {
main->animStop_show();
@ -703,7 +706,7 @@ void Window::hideSettings(bool fast) {
if (!settings || _passcode) return;
if (fast) {
settings->animStop_show();
settings->stop_show();
settings->hide();
settings->deleteLater();
settings->rpcInvalidate();
@ -716,7 +719,7 @@ void Window::hideSettings(bool fast) {
} else {
QPixmap bg = grabInner();
settings->animStop_show();
settings->stop_show();
settings->hide();
settings->deleteLater();
settings->rpcInvalidate();

View file

@ -59,7 +59,7 @@ private:
};
class NotifyWindow : public QWidget, public Animated {
class NotifyWindow : public TWidget {
Q_OBJECT
public:
@ -71,7 +71,7 @@ public:
void mousePressEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
bool animStep(float64 ms);
void step_appearance(float64 ms, bool timer);
void animHide(float64 duration, anim::transition func);
void startHiding();
void stopHiding();
@ -111,9 +111,11 @@ private:
QTimer hideTimer, inputTimer;
bool hiding;
int32 _index;
anim::fvalue aOpacity;
anim::transition aOpacityFunc;
anim::ivalue aY;
anim::fvalue a_opacity;
anim::transition a_func;
anim::ivalue a_y;
Animation _a_appearance;
ImagePtr peerPhoto;
};

View file

@ -138,7 +138,6 @@ SOURCES += \
./SourceFiles/gui/style_core.cpp \
./SourceFiles/gui/text.cpp \
./SourceFiles/gui/twidget.cpp \
./SourceFiles/gui/switcher.cpp \
./GeneratedFiles/lang_auto.cpp \
./GeneratedFiles/style_auto.cpp \
./GeneratedFiles/numbers.cpp \
@ -231,7 +230,6 @@ HEADERS += \
./SourceFiles/gui/style_core.h \
./SourceFiles/gui/text.h \
./SourceFiles/gui/twidget.h \
./SourceFiles/gui/switcher.h \
./GeneratedFiles/lang_auto.h \
./GeneratedFiles/style_auto.h \
./GeneratedFiles/style_classes.h \

View file

@ -389,10 +389,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_switcher.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_sysbuttons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -651,10 +647,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_switcher.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_sysbuttons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -939,10 +931,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_switcher.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_sysbuttons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -1009,7 +997,6 @@
<ClCompile Include="SourceFiles\gui\flatbutton.cpp" />
<ClCompile Include="SourceFiles\gui\scrollarea.cpp" />
<ClCompile Include="SourceFiles\gui\style_core.cpp" />
<ClCompile Include="SourceFiles\gui\switcher.cpp" />
<ClCompile Include="SourceFiles\gui\text.cpp" />
<ClCompile Include="SourceFiles\gui\twidget.cpp" />
<ClCompile Include="SourceFiles\history.cpp" />
@ -1635,20 +1622,6 @@
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
</CustomBuild>
<ClInclude Include="SourceFiles\gui\style_core.h" />
<CustomBuild Include="SourceFiles\gui\switcher.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing switcher.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/gui/switcher.h"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing switcher.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/gui/switcher.h"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing switcher.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/gui/switcher.h"</Command>
</CustomBuild>
<ClInclude Include="SourceFiles\gui\text.h" />
<CustomBuild Include="SourceFiles\history.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>

View file

@ -609,18 +609,6 @@
<ClCompile Include="GeneratedFiles\Release\moc_aboutbox.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="SourceFiles\gui\switcher.cpp">
<Filter>gui</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_switcher.cpp">
<Filter>Generated Files\Deploy</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_switcher.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_switcher.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="SourceFiles\mediaview.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -1129,9 +1117,6 @@
<CustomBuild Include="SourceFiles\gui\flatlabel.h">
<Filter>gui</Filter>
</CustomBuild>
<CustomBuild Include="SourceFiles\gui\switcher.h">
<Filter>gui</Filter>
</CustomBuild>
<CustomBuild Include="SourceFiles\mediaview.h">
<Filter>Source Files</Filter>
</CustomBuild>

View file

@ -68,8 +68,6 @@
07B604351B46A20900CA29FE /* moc_playerwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07B604341B46A20900CA29FE /* moc_playerwidget.cpp */; };
07BE850F1A2093C9008ACB9F /* localstorage.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07BE850D1A2093C9008ACB9F /* localstorage.cpp */; };
07BE85121A20961F008ACB9F /* moc_localstorage.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07BE85111A20961F008ACB9F /* moc_localstorage.cpp */; };
07C4753B1967DF1C00CAAFE9 /* switcher.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C475391967DF1C00CAAFE9 /* switcher.cpp */; };
07C4753F1967E37300CAAFE9 /* moc_switcher.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */; };
07C7596F1B1F7E0000662169 /* autoupdater.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C7596D1B1F7E0000662169 /* autoupdater.cpp */; };
07C759721B1F7E2800662169 /* moc_autoupdater.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07C759711B1F7E2800662169 /* moc_autoupdater.cpp */; };
07CAACD81AEA64F00058E508 /* AudioUnit.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 07CAACD71AEA64F00058E508 /* AudioUnit.framework */; };
@ -315,9 +313,6 @@
07C3AF27194336B90016CFF1 /* pspecific_mac_p.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pspecific_mac_p.h; path = SourceFiles/pspecific_mac_p.h; sourceTree = SOURCE_ROOT; };
07C3AF2919433ABF0016CFF1 /* style_classes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = style_classes.txt; path = Resources/style_classes.txt; sourceTree = SOURCE_ROOT; };
07C3AF2A19433ABF0016CFF1 /* style.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = style.txt; path = Resources/style.txt; sourceTree = SOURCE_ROOT; };
07C475391967DF1C00CAAFE9 /* switcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = switcher.cpp; path = SourceFiles/gui/switcher.cpp; sourceTree = SOURCE_ROOT; };
07C4753A1967DF1C00CAAFE9 /* switcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = switcher.h; path = SourceFiles/gui/switcher.h; sourceTree = SOURCE_ROOT; };
07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_switcher.cpp; path = GeneratedFiles/Debug/moc_switcher.cpp; sourceTree = SOURCE_ROOT; };
07C7596D1B1F7E0000662169 /* autoupdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = autoupdater.cpp; path = SourceFiles/autoupdater.cpp; sourceTree = SOURCE_ROOT; };
07C7596E1B1F7E0000662169 /* autoupdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = autoupdater.h; path = SourceFiles/autoupdater.h; sourceTree = SOURCE_ROOT; };
07C759711B1F7E2800662169 /* moc_autoupdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_autoupdater.cpp; path = GeneratedFiles/Debug/moc_autoupdater.cpp; sourceTree = SOURCE_ROOT; };
@ -840,7 +835,6 @@
6A510365F9F6367ECB0DB065 /* images.cpp */,
6E1859D714E4471E053D90C9 /* scrollarea.cpp */,
420A06A32B66D250142B4B6D /* style_core.cpp */,
07C475391967DF1C00CAAFE9 /* switcher.cpp */,
135FD3715BFDC50AD7B00E04 /* text.cpp */,
BB1602EA641643DE565005B1 /* twidget.cpp */,
85FABD67716E36CD8B3CA4FA /* animation.h */,
@ -858,7 +852,6 @@
0F8FFD87AEBAC448568570DC /* images.h */,
83A36F229E897566E011B79E /* scrollarea.h */,
0FC38EE7F29EF895925A2C49 /* style_core.h */,
07C4753A1967DF1C00CAAFE9 /* switcher.h */,
6E8FD0ED1B60D43929944CD2 /* text.h */,
507CCEEC4CBA3E3BD6EEDED1 /* twidget.h */,
);
@ -1119,7 +1112,6 @@
074FCB9019D36E60004C6EB2 /* moc_popupmenu.cpp */,
07D703BA19B88FB900C4EED2 /* moc_audio.cpp */,
0732E4AB199E268A00D50FE7 /* moc_overviewwidget.cpp */,
07C4753E1967E37300CAAFE9 /* moc_switcher.cpp */,
E181C525E21A16F2D4396CA7 /* moc_application.cpp */,
3B3ED09AB00290D78CF1181B /* moc_dialogswidget.cpp */,
AC9B5F6FB4B984C8D76F7AE2 /* moc_dropdown.cpp */,
@ -1554,7 +1546,6 @@
EBE29731916DB43BF49FE7A4 /* aboutbox.cpp in Compile Sources */,
4426AF526AAD86D6F73CE36F /* addcontactbox.cpp in Compile Sources */,
07D7034B19B8755A00C4EED2 /* audio.cpp in Compile Sources */,
07C4753B1967DF1C00CAAFE9 /* switcher.cpp in Compile Sources */,
A0A6B97F7DBEC81004EC9461 /* confirmbox.cpp in Compile Sources */,
4FEA8F51B7BC7CAC71347A1A /* connectionbox.cpp in Compile Sources */,
07C7596F1B1F7E0000662169 /* autoupdater.cpp in Compile Sources */,
@ -1562,7 +1553,6 @@
298BFAB73BF182297584F96F /* contactsbox.cpp in Compile Sources */,
BA41D511A9BBCA09365DF88C /* downloadpathbox.cpp in Compile Sources */,
07DB67511AD07CB800A51329 /* intropwdcheck.cpp in Compile Sources */,
07C4753F1967E37300CAAFE9 /* moc_switcher.cpp in Compile Sources */,
3ABE4F9B2264F770D944106D /* emojibox.cpp in Compile Sources */,
07D703BB19B88FB900C4EED2 /* moc_audio.cpp in Compile Sources */,
77B998AC22A13EF3DDEE07AC /* photocropbox.cpp in Compile Sources */,

View file

@ -43,7 +43,7 @@ compilers: GeneratedFiles/qrc_telegram.cpp GeneratedFiles/qrc_telegram_emojis.cp
GeneratedFiles/Debug/moc_popupmenu.cpp\
GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp\
GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp\
GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp\
GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp\
GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp\
GeneratedFiles/Debug/moc_autolockbox.cpp\
GeneratedFiles/Debug/moc_backgroundbox.cpp\
@ -99,9 +99,9 @@ GeneratedFiles/qrc_telegram_mac.cpp: SourceFiles/telegram_mac.qrc \
SourceFiles/art/osxtray.png
/usr/local/Qt-5.5.1/bin/rcc -name telegram_mac SourceFiles/telegram_mac.qrc -o GeneratedFiles/qrc_telegram_mac.cpp
compiler_moc_header_make_all: GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
compiler_moc_header_make_all: GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
compiler_moc_header_clean:
-$(DEL_FILE) GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_switcher.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamedbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
-$(DEL_FILE) GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamedbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp
GeneratedFiles/Debug/moc_apiwrap.cpp: SourceFiles/types.h \
SourceFiles/logs.h \
SourceFiles/apiwrap.h
@ -428,20 +428,6 @@ GeneratedFiles/Debug/moc_flattextarea.cpp: ../../Libraries/QtStatic/qtbase/inclu
SourceFiles/gui/flattextarea.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/gui/flattextarea.h -o GeneratedFiles/Debug/moc_flattextarea.cpp
GeneratedFiles/Debug/moc_switcher.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \
SourceFiles/gui/twidget.h \
SourceFiles/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/gui/animation.h \
SourceFiles/types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
SourceFiles/logs.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/gui/switcher.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/gui/switcher.h -o GeneratedFiles/Debug/moc_switcher.cpp
GeneratedFiles/Debug/moc_scrollarea.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QScrollArea \
SourceFiles/style.h \
GeneratedFiles/style_classes.h \