mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Side shadow moved to MainWidget. Testing slide animation with 3s duration.
New profile widget has fixed top bar outside of scroll area.
This commit is contained in:
parent
3d073eddd6
commit
bf8a98a13b
31 changed files with 366 additions and 175 deletions
|
@ -375,7 +375,7 @@ versionColor: #777;
|
|||
shadowColor: rgba(0, 0, 0, 24);
|
||||
|
||||
slideDuration: 240;
|
||||
slideShift: 0.3;
|
||||
slideShift: 100px;
|
||||
slideFadeOut: 0.3;
|
||||
slideShadow: sprite(348px, 71px, 48px, 1px);
|
||||
slideFunction: transition(easeOutCirc);
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void DialogsWidget::animShow(const QPixmap &bgAnimCache) {
|
|||
_cancelSearch.hide();
|
||||
_newGroup.hide();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
|
|
@ -2767,7 +2767,6 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
|||
, _attachDragPhoto(this)
|
||||
, _fileLoader(this, FileLoaderQueueStopTimeout)
|
||||
, _a_show(animation(this, &HistoryWidget::step_show))
|
||||
, _sideShadow(this, st::shadowColor)
|
||||
, _topShadow(this, st::shadowColor) {
|
||||
_scroll.setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
|
@ -2890,7 +2889,6 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
|||
_attachDragPhoto.hide();
|
||||
|
||||
_topShadow.hide();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
|
||||
connect(&_attachDragDocument, SIGNAL(dropped(const QMimeData*)), this, SLOT(onDocumentDrop(const QMimeData*)));
|
||||
connect(&_attachDragPhoto, SIGNAL(dropped(const QMimeData*)), this, SLOT(onPhotoDrop(const QMimeData*)));
|
||||
|
@ -5038,7 +5036,7 @@ void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
|
|||
_pinnedBar->cancel.hide();
|
||||
}
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
@ -5048,10 +5046,9 @@ void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
|
|||
}
|
||||
|
||||
void HistoryWidget::step_show(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::slideDuration;
|
||||
float64 dt = ms / 3000;// st::slideDuration;
|
||||
if (dt >= 1) {
|
||||
_a_show.stop();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_topShadow.setVisible(_peer ? true : false);
|
||||
|
||||
a_coordUnder.finish();
|
||||
|
@ -5090,14 +5087,12 @@ void HistoryWidget::doneShow() {
|
|||
}
|
||||
|
||||
void HistoryWidget::updateAdaptiveLayout() {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
update();
|
||||
}
|
||||
|
||||
void HistoryWidget::animStop() {
|
||||
if (!_a_show.animating()) return;
|
||||
_a_show.stop();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_topShadow.setVisible(_peer ? true : false);
|
||||
}
|
||||
|
||||
|
@ -6489,8 +6484,6 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
|
||||
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
|
||||
_sideShadow.resize(st::lineWidth, height());
|
||||
_sideShadow.moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void HistoryWidget::itemRemoved(HistoryItem *item) {
|
||||
|
@ -7081,7 +7074,6 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
|
|||
}
|
||||
connect(&_pinnedBar->cancel, SIGNAL(clicked()), this, SLOT(onPinnedHide()));
|
||||
_reportSpamPanel.raise();
|
||||
_sideShadow.raise();
|
||||
_topShadow.raise();
|
||||
updatePinnedBar();
|
||||
result = true;
|
||||
|
|
|
@ -656,12 +656,10 @@ public:
|
|||
bool contentOverlapped(const QRect &globalRect);
|
||||
|
||||
void grabStart() override {
|
||||
_sideShadow.hide();
|
||||
_inGrab = true;
|
||||
resizeEvent(0);
|
||||
}
|
||||
void grabFinish() override {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_inGrab = false;
|
||||
resizeEvent(0);
|
||||
}
|
||||
|
@ -1086,7 +1084,7 @@ private:
|
|||
bool _saveDraftText = false;
|
||||
QTimer _saveDraftTimer;
|
||||
|
||||
PlainShadow _sideShadow, _topShadow;
|
||||
PlainShadow _topShadow;
|
||||
bool _inGrab = false;
|
||||
|
||||
};
|
||||
|
|
|
@ -180,7 +180,7 @@ void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
|||
step()->hide();
|
||||
_back.hide();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
|
|
@ -48,6 +48,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
MainWidget::MainWidget(MainWindow *window) : TWidget(window)
|
||||
, _a_show(animation(this, &MainWidget::step_show))
|
||||
, _sideShadow(this, st::shadowColor)
|
||||
, _dialogs(this)
|
||||
, _history(this)
|
||||
, _player(this)
|
||||
|
@ -387,7 +388,7 @@ QPixmap MainWidget::grabInner() {
|
|||
if (_overview && !_overview->isHidden()) {
|
||||
return myGrab(_overview);
|
||||
} else if (_profile && !_profile->isHidden()) {
|
||||
return myGrab(_profile);
|
||||
return myGrab(_profile, QRect(0, st::topBarHeight, _history->width(), _history->height() - st::topBarHeight));
|
||||
} else if (Adaptive::OneColumn() && _history->isHidden()) {
|
||||
return myGrab(_dialogs, QRect(0, st::topBarHeight, _dialogs->width(), _dialogs->height() - st::topBarHeight));
|
||||
} else if (_history->peer()) {
|
||||
|
@ -407,6 +408,8 @@ bool MainWidget::isItemVisible(HistoryItem *item) {
|
|||
QPixmap MainWidget::grabTopBar() {
|
||||
if (!_topBar->isHidden()) {
|
||||
return myGrab(_topBar);
|
||||
} else if (_profile) {
|
||||
return myGrab(_profile, QRect(0, 0, _profile->width(), st::topBarHeight));
|
||||
} else if (Adaptive::OneColumn() && _history->isHidden()) {
|
||||
return myGrab(_dialogs, QRect(0, 0, _dialogs->width(), st::topBarHeight));
|
||||
} else {
|
||||
|
@ -528,7 +531,9 @@ void MainWidget::noHider(HistoryHider *destroyed) {
|
|||
if (Adaptive::OneColumn()) {
|
||||
animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
|
||||
} else {
|
||||
_sideShadow.hide();
|
||||
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
|
||||
_sideShadow.show();
|
||||
}
|
||||
} else {
|
||||
animCache = grabInner();
|
||||
|
@ -2050,7 +2055,9 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
|
|||
} else if (Adaptive::OneColumn()) {
|
||||
animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
|
||||
} else {
|
||||
_sideShadow.hide();
|
||||
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
|
||||
_sideShadow.show();
|
||||
}
|
||||
if (peerId || !Adaptive::OneColumn()) {
|
||||
animTopBarCache = grabTopBar();
|
||||
|
@ -2261,7 +2268,9 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop)
|
|||
if (Adaptive::OneColumn()) {
|
||||
animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
|
||||
} else {
|
||||
_sideShadow.hide();
|
||||
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
|
||||
_sideShadow.show();
|
||||
}
|
||||
// QPixmap animCache = grabInner(), animTopBarCache = grabTopBar();
|
||||
if (!back) {
|
||||
|
@ -2343,6 +2352,7 @@ void MainWidget::orderWidgets() {
|
|||
_player->raise();
|
||||
_dialogs->raise();
|
||||
_mediaType->raise();
|
||||
_sideShadow.raise();
|
||||
if (_hider) _hider->raise();
|
||||
}
|
||||
|
||||
|
@ -2435,7 +2445,7 @@ void MainWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
|||
(back ? _cacheUnder : _cacheOver) = myGrab(this);
|
||||
hideAll();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
@ -2587,6 +2597,8 @@ void MainWidget::resizeEvent(QResizeEvent *e) {
|
|||
_dialogsWidth = chatsListWidth(width());
|
||||
_dialogs->resize(_dialogsWidth, height());
|
||||
_dialogs->moveToLeft(0, 0);
|
||||
_sideShadow.resize(st::lineWidth, height());
|
||||
_sideShadow.moveToLeft(_dialogsWidth, 0);
|
||||
_player->resize(width() - _dialogsWidth, _player->height());
|
||||
_player->moveToLeft(_dialogsWidth, 0);
|
||||
_topBar->resize(width() - _dialogsWidth, st::topBarHeight);
|
||||
|
@ -2616,11 +2628,9 @@ void MainWidget::keyPressEvent(QKeyEvent *e) {
|
|||
|
||||
void MainWidget::updateAdaptiveLayout() {
|
||||
showAll();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_topBar->updateAdaptiveLayout();
|
||||
_history->updateAdaptiveLayout();
|
||||
if (_overview) _overview->updateAdaptiveLayout();
|
||||
// if (_profile) _profile->updateAdaptiveLayout(); TODO
|
||||
_player->updateAdaptiveLayout();
|
||||
}
|
||||
|
||||
bool MainWidget::needBackButton() {
|
||||
|
|
|
@ -552,6 +552,8 @@ private:
|
|||
|
||||
int _dialogsWidth = st::dlgMinWidth;
|
||||
|
||||
PlainShadow _sideShadow;
|
||||
|
||||
ChildWidget<DialogsWidget> _dialogs;
|
||||
ChildWidget<HistoryWidget> _history;
|
||||
ChildWidget<Profile::Widget> _profile = { nullptr };
|
||||
|
|
|
@ -1922,7 +1922,6 @@ OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewTyp
|
|||
, _scrollSetAfterShow(0)
|
||||
, _scrollDelta(0)
|
||||
, _selCount(0)
|
||||
, _sideShadow(this, st::shadowColor)
|
||||
, _topShadow(this, st::shadowColor)
|
||||
, _inGrab(false) {
|
||||
_scroll.setFocusPolicy(Qt::NoFocus);
|
||||
|
@ -1930,8 +1929,6 @@ OverviewWidget::OverviewWidget(QWidget *parent, PeerData *peer, MediaOverviewTyp
|
|||
_scroll.move(0, 0);
|
||||
_inner.move(0, 0);
|
||||
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
|
||||
updateScrollColors();
|
||||
|
||||
_scroll.show();
|
||||
|
@ -1983,8 +1980,6 @@ void OverviewWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
|
||||
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
|
||||
_sideShadow.resize(st::lineWidth, height());
|
||||
_sideShadow.moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void OverviewWidget::paintEvent(QPaintEvent *e) {
|
||||
|
@ -2148,7 +2143,7 @@ void OverviewWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimT
|
|||
_scroll.hide();
|
||||
_topShadow.hide();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
@ -2163,7 +2158,6 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
|
|||
float64 dt = ms / st::slideDuration;
|
||||
if (dt >= 1) {
|
||||
_a_show.stop();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_topShadow.show();
|
||||
|
||||
a_coordUnder.finish();
|
||||
|
@ -2186,10 +2180,6 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
|
|||
}
|
||||
}
|
||||
|
||||
void OverviewWidget::updateAdaptiveLayout() {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
}
|
||||
|
||||
void OverviewWidget::doneShow() {
|
||||
_scroll.show();
|
||||
_scroll.scrollToY(_scrollSetAfterShow);
|
||||
|
|
|
@ -279,7 +279,6 @@ public:
|
|||
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1);
|
||||
void step_show(float64 ms, bool timer);
|
||||
|
||||
void updateAdaptiveLayout();
|
||||
void doneShow();
|
||||
|
||||
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
|
||||
|
@ -300,12 +299,10 @@ public:
|
|||
void updateAfterDrag();
|
||||
|
||||
void grabStart() override {
|
||||
_sideShadow.hide();
|
||||
_inGrab = true;
|
||||
resizeEvent(0);
|
||||
}
|
||||
void grabFinish() override {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_inGrab = false;
|
||||
resizeEvent(0);
|
||||
}
|
||||
|
@ -354,7 +351,7 @@ private:
|
|||
|
||||
int32 _selCount;
|
||||
|
||||
PlainShadow _sideShadow, _topShadow;
|
||||
PlainShadow _topShadow;
|
||||
bool _inGrab;
|
||||
|
||||
};
|
||||
|
|
|
@ -119,7 +119,7 @@ void PasscodeWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
|||
(back ? _cacheUnder : _cacheOver) = myGrab(this);
|
||||
hideAll();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
|
|
@ -33,12 +33,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent)
|
||||
, _a_state(animation(this, &PlayerWidget::step_state))
|
||||
, _a_progress(animation(this, &PlayerWidget::step_progress))
|
||||
, _sideShadow(this, st::shadowColor) {
|
||||
, _a_progress(animation(this, &PlayerWidget::step_progress)) {
|
||||
resize(st::wndMinWidth, st::playerHeight);
|
||||
setMouseTracking(true);
|
||||
memset(_stateHovers, 0, sizeof(_stateHovers));
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
}
|
||||
|
||||
void PlayerWidget::paintEvent(QPaintEvent *e) {
|
||||
|
@ -343,10 +341,6 @@ void PlayerWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type)
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerWidget::updateAdaptiveLayout() {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
}
|
||||
|
||||
bool PlayerWidget::seekingSong(const SongMsgId &song) const {
|
||||
return (_down == OverPlayback) && (song == _song);
|
||||
}
|
||||
|
@ -570,9 +564,6 @@ void PlayerWidget::resizeEvent(QResizeEvent *e) {
|
|||
int32 infoLeft = (_fullAvailable ? (_nextRect.x() + _nextRect.width()) : (_playRect.x() + _playRect.width()));
|
||||
_infoRect = QRect(infoLeft + st::playerSkip / 2, 0, (_fullAvailable ? _fullRect.x() : _repeatRect.x()) - infoLeft - st::playerSkip, availh);
|
||||
|
||||
_sideShadow.resize(st::lineWidth, height());
|
||||
_sideShadow.moveToLeft(0, 0);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
void clearSelection();
|
||||
|
||||
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
bool seekingSong(const SongMsgId &song) const;
|
||||
|
||||
|
@ -136,6 +135,4 @@ private:
|
|||
anim::fvalue a_loadProgress = { 0., 0. };
|
||||
Animation _a_progress;
|
||||
|
||||
PlainShadow _sideShadow;
|
||||
|
||||
};
|
||||
|
|
|
@ -25,39 +25,49 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "lang.h"
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
namespace Profile {
|
||||
namespace {
|
||||
|
||||
class BackButton final : public Button {
|
||||
class OnlineCounter {
|
||||
public:
|
||||
BackButton(QWidget *parent) : Button(parent) {
|
||||
setCursor(style::cur_pointer);
|
||||
OnlineCounter() : _currentTime(unixtime()), _self(App::self()) {
|
||||
}
|
||||
|
||||
void resizeToWidth(int newWidth) {
|
||||
resize(newWidth, st::profileTopBarHeight);
|
||||
void feedUser(UserData *user) {
|
||||
if (App::onlineForSort(user, _currentTime) > _currentTime) {
|
||||
++_result;
|
||||
if (user != _self) {
|
||||
_onlyMe = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
st::profileTopBarBackIcon.paint(p, st::profileTopBarBackIconPosition, width());
|
||||
|
||||
p.setFont(st::profileTopBarBackFont);
|
||||
p.setPen(st::profileTopBarBackFg);
|
||||
p.drawTextLeft(st::profileTopBarBackPosition.x(), st::profileTopBarBackPosition.y(), width(), lang(lng_menu_back));
|
||||
QString result(int fullCount) const {
|
||||
if (_result > 0 && !_onlyMe) {
|
||||
return lng_chat_status_members_online(lt_count, fullCount, lt_count_online, _result);
|
||||
}
|
||||
return lng_chat_status_members(lt_count, fullCount);
|
||||
}
|
||||
|
||||
private:
|
||||
bool _onlyMe = true;
|
||||
int _result = 0;
|
||||
int _currentTime;
|
||||
UserData *_self;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
class PhotoButton final : public Button {
|
||||
public:
|
||||
PhotoButton(QWidget *parent, PeerData *peer) : Button(parent), _peer(peer) {
|
||||
resize(st::profilePhotoSize, st::profilePhotoSize);
|
||||
}
|
||||
void photoUpdated() {
|
||||
bool hasPhoto = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId);
|
||||
setCursor(hasPhoto ? style::cur_pointer : style::cur_default);
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) {
|
||||
|
@ -77,29 +87,29 @@ CoverWidget::CoverWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
|
|||
, _peerChat(peer->asChat())
|
||||
, _peerChannel(peer->asChannel())
|
||||
, _peerMegagroup(peer->isMegagroup() ? _peerChannel : nullptr)
|
||||
, _backButton(this)
|
||||
, _photoButton(this, peer) {
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
_backButton->moveToLeft(0, 0);
|
||||
connect(_backButton, SIGNAL(clicked()), this, SLOT(onBack()));
|
||||
_photoButton->photoUpdated();
|
||||
connect(_photoButton, SIGNAL(clicked()), this, SLOT(onPhotoShow()));
|
||||
|
||||
_nameText.setText(st::profileNameFont, App::peerName(_peer));
|
||||
updateStatusText();
|
||||
}
|
||||
|
||||
void CoverWidget::onBack() {
|
||||
App::main()->showBackFromStack();
|
||||
void CoverWidget::onPhotoShow() {
|
||||
PhotoData *photo = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId) ? App::photo(_peer->photoId) : nullptr;
|
||||
if ((_peer->photoId == UnknownPeerPhotoId) || (_peer->photoId && !photo->date)) {
|
||||
App::api()->requestFullPeer(_peer);
|
||||
}
|
||||
if (photo && photo->date) {
|
||||
App::wnd()->showPhoto(photo, _peer);
|
||||
}
|
||||
}
|
||||
|
||||
void CoverWidget::resizeToWidth(int newWidth) {
|
||||
int newHeight = 0;
|
||||
|
||||
// Top bar
|
||||
_backButton->resizeToWidth(newWidth);
|
||||
newHeight += _backButton->height();
|
||||
|
||||
// Cover content
|
||||
newHeight += st::profileMarginTop;
|
||||
_photoButton->moveToLeft(st::profilePhotoLeft, newHeight);
|
||||
|
||||
|
@ -143,34 +153,19 @@ void CoverWidget::updateStatusText() {
|
|||
_statusText = lng_chat_status_members(lt_count, _peerChat->count);
|
||||
}
|
||||
} else {
|
||||
int onlineCount = 0;
|
||||
bool onlyMe = true;
|
||||
for (auto i = _peerChat->participants.cbegin(), e = _peerChat->participants.cend(); i != e; ++i) {
|
||||
auto onlineTill = App::onlineForSort(i.key(), currentTime);
|
||||
if (onlineTill > currentTime) {
|
||||
++onlineCount;
|
||||
}
|
||||
}
|
||||
if (onlineCount && !onlyMe) {
|
||||
_statusText = lng_chat_status_members_online(lt_count, _peerChat->participants.size(), lt_count_online, onlineCount);
|
||||
} else {
|
||||
_statusText = lng_chat_status_members(lt_count, _peerChat->participants.size());
|
||||
OnlineCounter counter;
|
||||
auto &participants = _peerChat->participants;
|
||||
for (auto i = participants.cbegin(), e = participants.cend(); i != e; ++i) {
|
||||
counter.feedUser(i.key());
|
||||
}
|
||||
_statusText = counter.result(participants.size());
|
||||
}
|
||||
} else if (isUsingMegagroupOnlineCount()) {
|
||||
int onlineCount = 0;
|
||||
bool onlyMe = true;
|
||||
for_const (auto &user, _peerMegagroup->mgInfo->lastParticipants) {
|
||||
auto onlineTill = App::onlineForSort(user, currentTime);
|
||||
if (onlineTill > currentTime) {
|
||||
++onlineCount;
|
||||
}
|
||||
}
|
||||
if (onlineCount && !onlyMe) {
|
||||
_statusText = lng_chat_status_members_online(lt_count, _peerMegagroup->count, lt_count_online, onlineCount);
|
||||
} else {
|
||||
_statusText = lng_chat_status_members(lt_count, _peerMegagroup->count);
|
||||
OnlineCounter counter;
|
||||
for_const (auto user, _peerMegagroup->mgInfo->lastParticipants) {
|
||||
counter.feedUser(user);
|
||||
}
|
||||
_statusText = counter.result(_peerMegagroup->count);
|
||||
} else if (_peerChannel) {
|
||||
if (_peerChannel->count > 0) {
|
||||
_statusText = lng_chat_status_members(lt_count, _peerChannel->count);
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
void resizeToWidth(int newWidth);
|
||||
|
||||
public slots:
|
||||
void onBack();
|
||||
void onPhotoShow();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
@ -50,10 +50,6 @@ private:
|
|||
ChannelData *_peerChannel;
|
||||
ChannelData *_peerMegagroup;
|
||||
|
||||
// Top bar
|
||||
ChildWidget<BackButton> _backButton;
|
||||
QList<FlatButton*> _rightActions;
|
||||
|
||||
// Cover content
|
||||
ChildWidget<PhotoButton> _photoButton;
|
||||
|
||||
|
|
103
Telegram/SourceFiles/profile/profile_fixed_bar.cpp
Normal file
103
Telegram/SourceFiles/profile/profile_fixed_bar.cpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
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-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "profile/profile_fixed_bar.h"
|
||||
|
||||
#include "styles/style_profile.h"
|
||||
#include "lang.h"
|
||||
#include "mainwidget.h"
|
||||
|
||||
namespace Profile {
|
||||
|
||||
class BackButton final : public Button {
|
||||
public:
|
||||
BackButton(QWidget *parent) : Button(parent) {
|
||||
setCursor(style::cur_pointer);
|
||||
}
|
||||
|
||||
void resizeToWidth(int newWidth) {
|
||||
resize(newWidth, st::profileTopBarHeight);
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
p.fillRect(e->rect(), st::profileBg);
|
||||
st::profileTopBarBackIcon.paint(p, st::profileTopBarBackIconPosition, width());
|
||||
|
||||
p.setFont(st::profileTopBarBackFont);
|
||||
p.setPen(st::profileTopBarBackFg);
|
||||
p.drawTextLeft(st::profileTopBarBackPosition.x(), st::profileTopBarBackPosition.y(), width(), lang(lng_menu_back));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
FixedBar::FixedBar(QWidget *parent, PeerData *peer) : TWidget(parent)
|
||||
, _peer(peer)
|
||||
, _peerUser(peer->asUser())
|
||||
, _peerChat(peer->asChat())
|
||||
, _peerChannel(peer->asChannel())
|
||||
, _peerMegagroup(peer->isMegagroup() ? _peerChannel : nullptr)
|
||||
, _backButton(this) {
|
||||
_backButton->moveToLeft(0, 0);
|
||||
connect(_backButton, SIGNAL(clicked()), this, SLOT(onBack()));
|
||||
}
|
||||
|
||||
void FixedBar::onBack() {
|
||||
App::main()->showBackFromStack();
|
||||
}
|
||||
|
||||
void FixedBar::resizeToWidth(int newWidth) {
|
||||
int newHeight = 0;
|
||||
|
||||
_backButton->resizeToWidth(newWidth);
|
||||
newHeight += _backButton->height();
|
||||
|
||||
resize(newWidth, newHeight);
|
||||
}
|
||||
|
||||
void FixedBar::setAnimatingMode(bool enabled) {
|
||||
if (_animatingMode != enabled) {
|
||||
_animatingMode = enabled;
|
||||
setCursor(_animatingMode ? style::cur_pointer : style::cur_default);
|
||||
if (_animatingMode) {
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||
hideChildren();
|
||||
} else {
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
showChildren();
|
||||
}
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
void FixedBar::mousePressEvent(QMouseEvent *e) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
onBack();
|
||||
} else {
|
||||
TWidget::mousePressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Profile
|
59
Telegram/SourceFiles/profile/profile_fixed_bar.h
Normal file
59
Telegram/SourceFiles/profile/profile_fixed_bar.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
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-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Profile {
|
||||
|
||||
class BackButton;
|
||||
|
||||
class FixedBar final : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FixedBar(QWidget *parent, PeerData *peer);
|
||||
|
||||
void resizeToWidth(int newWidth);
|
||||
|
||||
// When animating mode is enabled the content is hidden and the
|
||||
// whole fixed bar acts like a back button.
|
||||
void setAnimatingMode(bool enabled);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
|
||||
public slots:
|
||||
void onBack();
|
||||
|
||||
private:
|
||||
PeerData *_peer;
|
||||
UserData *_peerUser;
|
||||
ChatData *_peerChat;
|
||||
ChannelData *_peerChannel;
|
||||
ChannelData *_peerMegagroup;
|
||||
|
||||
ChildWidget<BackButton> _backButton;
|
||||
QList<FlatButton*> _rightActions;
|
||||
|
||||
bool _animatingMode = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Profile
|
|
@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
#include "styles/style_profile.h"
|
||||
#include "profile/profile_cover.h"
|
||||
#include "apiwrap.h"
|
||||
|
||||
namespace Profile {
|
||||
|
||||
|
@ -37,10 +38,25 @@ void InnerWidget::resizeToWidth(int newWidth, int minHeight) {
|
|||
resize(newWidth, naturalHeight + _addedHeight);
|
||||
}
|
||||
|
||||
void InnerWidget::decreaseAdditionalHeight(int removeHeight) {
|
||||
if (removeHeight > 0) {
|
||||
resizeToWidth(width(), height() - removeHeight);
|
||||
void InnerWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) {
|
||||
_visibleTop = visibleTop;
|
||||
_visibleBottom = visibleBottom;
|
||||
|
||||
int notDisplayedAtBottom = height() - _visibleBottom;
|
||||
if (notDisplayedAtBottom > 0) {
|
||||
decreaseAdditionalHeight(notDisplayedAtBottom);
|
||||
}
|
||||
|
||||
//loadProfilePhotos(_visibleTop);
|
||||
if (peer()->isMegagroup() && !peer()->asChannel()->mgInfo->lastParticipants.isEmpty() && peer()->asChannel()->mgInfo->lastParticipants.size() < peer()->asChannel()->count) {
|
||||
if (_visibleTop + (PreloadHeightsCount + 1) * (_visibleBottom - _visibleTop) > height()) {
|
||||
App::api()->requestLastParticipants(peer()->asChannel(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::decreaseAdditionalHeight(int removeHeight) {
|
||||
resizeToWidth(width(), height() - removeHeight);
|
||||
}
|
||||
|
||||
void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||
|
|
|
@ -38,10 +38,8 @@ public:
|
|||
// Count new height for width=newWidth and resize to it.
|
||||
void resizeToWidth(int newWidth, int minHeight);
|
||||
|
||||
// Sometimes height of this widget is larger than it is required
|
||||
// so that it is allowed to scroll down to the desired position.
|
||||
// When resizing with scroll moving up the additional height may be decreased.
|
||||
void decreaseAdditionalHeight(int removeHeight);
|
||||
// Updates the area that is visible inside the scroll container.
|
||||
void setVisibleTopBottom(int visibleTop, int visibleBottom);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
@ -50,11 +48,18 @@ private:
|
|||
// Resizes content and counts natural widget height for the desired width.
|
||||
int resizeGetHeight(int newWidth);
|
||||
|
||||
// Sometimes height of this widget is larger than it is required
|
||||
// so that it is allowed to scroll down to the desired position.
|
||||
// When resizing with scroll moving up the additional height may be decreased.
|
||||
void decreaseAdditionalHeight(int removeHeight);
|
||||
|
||||
PeerData *_peer;
|
||||
|
||||
// Height that we added to the natural height so that it is allowed
|
||||
// to scroll down to the desired position.
|
||||
int _addedHeight = 0;
|
||||
int _visibleTop = 0;
|
||||
int _visibleBottom = 0;
|
||||
|
||||
ChildWidget<CoverWidget> _cover;
|
||||
QList<BlockWidget*> _blocks;
|
||||
|
|
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "stdafx.h"
|
||||
#include "profile/profile_widget.h"
|
||||
|
||||
#include "profile/profile_fixed_bar.h"
|
||||
#include "profile/profile_inner_widget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "application.h"
|
||||
|
@ -28,14 +29,16 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
namespace Profile {
|
||||
|
||||
Widget::Widget(QWidget *parent, PeerData *peer) : TWidget(parent)
|
||||
, _fixedBar(this, peer)
|
||||
, _scroll(this, st::setScroll)
|
||||
, _inner(this, peer)
|
||||
, _sideShadow(this, st::shadowColor) {
|
||||
_scroll->setWidget(_inner);
|
||||
_scroll->move(0, 0);
|
||||
_scroll->show();
|
||||
, _inner(this, peer) {
|
||||
_fixedBar->move(0, 0);
|
||||
_fixedBar->resizeToWidth(width());
|
||||
_fixedBar->show();
|
||||
|
||||
_sideShadow->setVisible(!Adaptive::OneColumn());
|
||||
_scroll->setWidget(_inner);
|
||||
_scroll->move(0, _fixedBar->height());
|
||||
_scroll->show();
|
||||
|
||||
connect(_scroll, SIGNAL(scrolled()), _inner, SLOT(updateSelected()));
|
||||
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
|
@ -58,12 +61,13 @@ void Widget::setGeometryWithTopMoved(const QRect &newGeometry, int topDelta) {
|
|||
}
|
||||
|
||||
void Widget::showAnimated(SlideDirection direction, const QPixmap &oldContentCache) {
|
||||
show();
|
||||
_scroll->show();
|
||||
_sideShadow->hide();
|
||||
_showAnimation = nullptr;
|
||||
|
||||
showChildren();
|
||||
_fixedBar->setAnimatingMode(false);
|
||||
auto myContentCache = myGrab(this);
|
||||
_scroll->hide();
|
||||
_sideShadow->show();
|
||||
hideChildren();
|
||||
_fixedBar->setAnimatingMode(true);
|
||||
|
||||
_showAnimation = std_::make_unique<SlideAnimation>();
|
||||
_showAnimation->setDirection(direction);
|
||||
|
@ -71,6 +75,8 @@ void Widget::showAnimated(SlideDirection direction, const QPixmap &oldContentCac
|
|||
_showAnimation->setFinishedCallback(func(this, &Widget::showFinished));
|
||||
_showAnimation->setPixmaps(oldContentCache, myContentCache);
|
||||
_showAnimation->start();
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
void Widget::setInnerFocus() {
|
||||
|
@ -79,24 +85,20 @@ void Widget::setInnerFocus() {
|
|||
|
||||
void Widget::resizeEvent(QResizeEvent *e) {
|
||||
int newScrollTop = _scroll->scrollTop() + _topDelta;
|
||||
if (_scroll->size() != size()) {
|
||||
_scroll->resize(size());
|
||||
if (_inner->width() != width()) {
|
||||
_inner->resizeToWidth(width(), _scroll->height());
|
||||
}
|
||||
_fixedBar->resizeToWidth(width());
|
||||
|
||||
QSize scrollSize(width(), height() - _fixedBar->height());
|
||||
if (_scroll->size() != scrollSize) {
|
||||
_scroll->resize(scrollSize);
|
||||
_inner->resizeToWidth(scrollSize.width(), _scroll->height());
|
||||
}
|
||||
if (!_scroll->isHidden()) {
|
||||
if (_topDelta) {
|
||||
_scroll->scrollToY(newScrollTop);
|
||||
}
|
||||
int notDisplayedAtBottom = _scroll->scrollTopMax() - _scroll->scrollTop();
|
||||
if (notDisplayedAtBottom > 0) {
|
||||
_inner->decreaseAdditionalHeight(notDisplayedAtBottom);
|
||||
}
|
||||
int scrollTop = _scroll->scrollTop();
|
||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||
}
|
||||
|
||||
_sideShadow->resize(st::lineWidth, height());
|
||||
_sideShadow->moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e) {
|
||||
|
@ -108,11 +110,19 @@ void Widget::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::onScroll() {
|
||||
int scrollTop = _scroll->scrollTop();
|
||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||
}
|
||||
|
||||
void Widget::showFinished() {
|
||||
if (isHidden()) return;
|
||||
|
||||
App::app()->mtpUnpause();
|
||||
_scroll->show();
|
||||
|
||||
showChildren();
|
||||
_fixedBar->setAnimatingMode(false);
|
||||
|
||||
setInnerFocus();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class ScrollArea;
|
|||
namespace Profile {
|
||||
|
||||
class InnerWidget;
|
||||
class FixedBar;
|
||||
class Widget final : public TWidget {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -48,6 +49,9 @@ protected:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void onScroll();
|
||||
|
||||
private:
|
||||
// QWidget::update() method is overloaded and we need template deduction.
|
||||
void repaintCallback() {
|
||||
|
@ -55,9 +59,9 @@ private:
|
|||
}
|
||||
void showFinished();
|
||||
|
||||
ChildWidget<FixedBar> _fixedBar;
|
||||
ChildWidget<ScrollArea> _scroll;
|
||||
ChildWidget<InnerWidget> _inner;
|
||||
ChildWidget<PlainShadow> _sideShadow;
|
||||
|
||||
std_::unique_ptr<SlideAnimation> _showAnimation;
|
||||
|
||||
|
|
|
@ -1864,7 +1864,6 @@ ProfileWidget::ProfileWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
|
|||
, _scroll(this, st::setScroll)
|
||||
, _inner(this, peer)
|
||||
, _a_show(animation(this, &ProfileWidget::step_show))
|
||||
, _sideShadow(this, st::shadowColor)
|
||||
, _topShadow(this, st::shadowColor)
|
||||
, _inGrab(false) {
|
||||
_scroll.setWidget(&_inner);
|
||||
|
@ -1872,8 +1871,6 @@ ProfileWidget::ProfileWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
|
|||
_inner.move(0, 0);
|
||||
_scroll.show();
|
||||
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
|
||||
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSelected()));
|
||||
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
}
|
||||
|
@ -1906,8 +1903,6 @@ void ProfileWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
_topShadow.resize(width() - ((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0), st::lineWidth);
|
||||
_topShadow.moveToLeft((!Adaptive::OneColumn() && !_inGrab) ? st::lineWidth : 0, 0);
|
||||
_sideShadow.resize(st::lineWidth, height());
|
||||
_sideShadow.moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void ProfileWidget::mousePressEvent(QMouseEvent *e) {
|
||||
|
@ -1988,7 +1983,7 @@ void ProfileWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
|
|||
_scroll.hide();
|
||||
_topShadow.hide();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
@ -2003,7 +1998,6 @@ void ProfileWidget::step_show(float64 ms, bool timer) {
|
|||
float64 dt = ms / st::slideDuration;
|
||||
if (dt >= 1) {
|
||||
_a_show.stop();
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_topShadow.show();
|
||||
|
||||
a_coordUnder.finish();
|
||||
|
@ -2055,10 +2049,6 @@ void ProfileWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type)
|
|||
}
|
||||
}
|
||||
|
||||
void ProfileWidget::updateAdaptiveLayout() {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
}
|
||||
|
||||
PeerData *ProfileWidget::ui_getPeerForMouseAction() {
|
||||
return _inner.peer();
|
||||
}
|
||||
|
|
|
@ -257,15 +257,12 @@ public:
|
|||
|
||||
void updateNotifySettings();
|
||||
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
void grabStart() override {
|
||||
_sideShadow.hide();
|
||||
_inGrab = true;
|
||||
resizeEvent(0);
|
||||
}
|
||||
void grabFinish() override {
|
||||
_sideShadow.setVisible(!Adaptive::OneColumn());
|
||||
_inGrab = false;
|
||||
resizeEvent(0);
|
||||
}
|
||||
|
@ -294,7 +291,7 @@ private:
|
|||
anim::ivalue a_coordUnder, a_coordOver;
|
||||
anim::fvalue a_shadow;
|
||||
|
||||
PlainShadow _sideShadow, _topShadow;
|
||||
PlainShadow _topShadow;
|
||||
bool _inGrab;
|
||||
|
||||
};
|
||||
|
|
|
@ -851,7 +851,6 @@ namespace {
|
|||
_psShadowWindows.setColor(_shInactive);
|
||||
}
|
||||
if (Global::started()) {
|
||||
QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection);
|
||||
App::wnd()->update();
|
||||
}
|
||||
} return false;
|
||||
|
|
|
@ -852,7 +852,6 @@ namespace {
|
|||
// _psShadowWindows.setColor(_shInactive);
|
||||
//}
|
||||
if (Global::started()) {
|
||||
QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection);
|
||||
App::wnd()->update();
|
||||
}
|
||||
} return false;
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void SettingsWidget::animShow(const QPixmap &bgAnimCache, bool back) {
|
|||
(back ? _cacheUnder : _cacheOver) = myGrab(this);
|
||||
hideAll();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width()));
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
_a_show.start();
|
||||
|
|
|
@ -61,7 +61,7 @@ void SlideAnimation::setFinishedCallback(FinishedCallback &&callback) {
|
|||
|
||||
void SlideAnimation::start() {
|
||||
int width = _cacheUnder.width() / cIntRetinaFactor();
|
||||
int delta = qFloor(st::slideShift * width);
|
||||
int delta = st::slideShift;
|
||||
a_progress = anim::fvalue(0, 1);
|
||||
if (_direction == SlideDirection::FromLeft) {
|
||||
std::swap(_cacheUnder, _cacheOver);
|
||||
|
@ -75,7 +75,7 @@ void SlideAnimation::start() {
|
|||
}
|
||||
|
||||
void SlideAnimation::step(float64 ms, bool timer) {
|
||||
float64 dt = ms / st::slideDuration;
|
||||
float64 dt = ms / 3000;// st::slideDuration;
|
||||
if (dt >= 1) {
|
||||
dt = 1;
|
||||
if (timer) {
|
||||
|
|
|
@ -184,6 +184,21 @@ public:
|
|||
|
||||
bool inFocusChain() const;
|
||||
|
||||
void hideChildren() {
|
||||
for (auto child : children()) {
|
||||
if (auto widget = qobject_cast<QWidget*>(child)) {
|
||||
widget->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
void showChildren() {
|
||||
for (auto child : children()) {
|
||||
if (auto widget = qobject_cast<QWidget*>(child)) {
|
||||
widget->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void myEnsureResized(QWidget *target);
|
||||
|
|
|
@ -51,8 +51,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
|
|||
, _addContact(this, lang(lng_profile_add_contact), st::topBarButton)
|
||||
, _deleteContact(this, lang(lng_profile_delete_contact), st::topBarButton)
|
||||
, _mediaType(this, lang(lng_media_type), st::topBarButton)
|
||||
, _search(this, st::topBarSearch)
|
||||
, _sideShadow(this, st::shadowColor) {
|
||||
, _search(this, st::topBarSearch) {
|
||||
|
||||
connect(_forward, SIGNAL(clicked()), this, SLOT(onForwardSelection()));
|
||||
connect(_delete, SIGNAL(clicked()), this, SLOT(onDeleteSelection()));
|
||||
|
@ -263,9 +262,6 @@ void TopBarWidget::resizeEvent(QResizeEvent *e) {
|
|||
if (!_addContact->isHidden()) _addContact->move(r -= _addContact->width(), 0);
|
||||
if (!_mediaType->isHidden()) _mediaType->move(r -= _mediaType->width(), 0);
|
||||
_search->move(width() - (_info->isHidden() ? st::topBarForwardPadding.right() : _info->width()) - _search->width(), 0);
|
||||
|
||||
_sideShadow->resize(st::lineWidth, height());
|
||||
_sideShadow->moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void TopBarWidget::startAnim() {
|
||||
|
@ -285,7 +281,6 @@ void TopBarWidget::startAnim() {
|
|||
|
||||
void TopBarWidget::stopAnim() {
|
||||
_animating = false;
|
||||
_sideShadow->setVisible(!Adaptive::OneColumn());
|
||||
showAll();
|
||||
}
|
||||
|
||||
|
@ -363,7 +358,6 @@ void TopBarWidget::showAll() {
|
|||
_info->hide();
|
||||
}
|
||||
}
|
||||
_sideShadow->setVisible(!Adaptive::OneColumn());
|
||||
resizeEvent(nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void step_appearance(float64 ms, bool timer);
|
||||
void enableShadow(bool enable = true);
|
||||
|
||||
void startAnim();
|
||||
void stopAnim();
|
||||
|
@ -58,14 +57,7 @@ public:
|
|||
|
||||
FlatButton *mediaTypeButton();
|
||||
|
||||
void grabStart() override {
|
||||
_sideShadow->hide();
|
||||
}
|
||||
void grabFinish() override {
|
||||
_sideShadow->setVisible(!Adaptive::OneColumn());
|
||||
}
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
|
||||
void onForwardSelection();
|
||||
void onDeleteSelection();
|
||||
|
@ -107,8 +99,6 @@ private:
|
|||
|
||||
ChildWidget<IconedButton> _search;
|
||||
|
||||
ChildWidget<PlainShadow> _sideShadow;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Window
|
||||
|
|
|
@ -390,6 +390,10 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_profile_fixed_bar.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_profile_inner_widget.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -689,6 +693,10 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_profile_fixed_bar.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_profile_inner_widget.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -1014,6 +1022,10 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_profile_fixed_bar.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_profile_inner_widget.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -1163,6 +1175,7 @@
|
|||
<ClCompile Include="SourceFiles\playerwidget.cpp" />
|
||||
<ClCompile Include="SourceFiles\profilewidget.cpp" />
|
||||
<ClCompile Include="SourceFiles\profile\profile_cover.cpp" />
|
||||
<ClCompile Include="SourceFiles\profile\profile_fixed_bar.cpp" />
|
||||
<ClCompile Include="SourceFiles\profile\profile_inner_widget.cpp" />
|
||||
<ClCompile Include="SourceFiles\profile\profile_widget.cpp" />
|
||||
<ClCompile Include="SourceFiles\pspecific_linux.cpp">
|
||||
|
@ -1459,6 +1472,20 @@
|
|||
<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" "-fstdafx.h" "-f../../SourceFiles/profile/profile_cover.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="SourceFiles\profile\profile_fixed_bar.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing profile_fixed_bar.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" "-fstdafx.h" "-f../../SourceFiles/profile/profile_fixed_bar.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing profile_fixed_bar.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" "-fstdafx.h" "-f../../SourceFiles/profile/profile_fixed_bar.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl_debug\Debug\include"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing profile_fixed_bar.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" "-fstdafx.h" "-f../../SourceFiles/profile/profile_fixed_bar.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore\5.6.0\QtCore" "-I$(QTDIR)\include\QtGui\5.6.0\QtGui" "-I.\..\..\Libraries\breakpad\src" "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\ThirdParty\minizip" "-I.\..\..\Libraries\openssl\Release\include"</Command>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="SourceFiles\serialize\serialize_common.h" />
|
||||
<ClInclude Include="SourceFiles\serialize\serialize_document.h" />
|
||||
<ClInclude Include="SourceFiles\shortcuts.h" />
|
||||
|
|
|
@ -1149,6 +1149,18 @@
|
|||
<ClCompile Include="GeneratedFiles\Release\moc_profile_cover.cpp">
|
||||
<Filter>GeneratedFiles\Release</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SourceFiles\profile\profile_fixed_bar.cpp">
|
||||
<Filter>SourceFiles\profile</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_profile_fixed_bar.cpp">
|
||||
<Filter>GeneratedFiles\Deploy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_profile_fixed_bar.cpp">
|
||||
<Filter>GeneratedFiles\Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_profile_fixed_bar.cpp">
|
||||
<Filter>GeneratedFiles\Release</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SourceFiles\stdafx.h">
|
||||
|
@ -1576,6 +1588,9 @@
|
|||
<CustomBuild Include="SourceFiles\profile\profile_cover.h">
|
||||
<Filter>SourceFiles\profile</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="SourceFiles\profile\profile_fixed_bar.h">
|
||||
<Filter>SourceFiles\profile</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\langs\lang_it.strings">
|
||||
|
|
Loading…
Add table
Reference in a new issue