diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 8245a63142..f3fba09aaa 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -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); diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index b2de4040dc..5d10a6bb08 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -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(); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index c8c21e8392..bd80d24997 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -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; diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 667471617c..3a5bda2985 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -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; }; diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 8323ba7e0b..09caacd8c5 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -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(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 11be42bbd3..dd7f77a2fc 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -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() { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 7bc90af759..84d9a79b31 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -552,6 +552,8 @@ private: int _dialogsWidth = st::dlgMinWidth; + PlainShadow _sideShadow; + ChildWidget _dialogs; ChildWidget _history; ChildWidget _profile = { nullptr }; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index dcd166361a..230eead86e 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -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); diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index 001f81df4f..75639b066d 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -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; }; diff --git a/Telegram/SourceFiles/passcodewidget.cpp b/Telegram/SourceFiles/passcodewidget.cpp index 63e3e48104..ef4b8c9edb 100644 --- a/Telegram/SourceFiles/passcodewidget.cpp +++ b/Telegram/SourceFiles/passcodewidget.cpp @@ -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(); diff --git a/Telegram/SourceFiles/playerwidget.cpp b/Telegram/SourceFiles/playerwidget.cpp index a8511b6d43..ca697b771a 100644 --- a/Telegram/SourceFiles/playerwidget.cpp +++ b/Telegram/SourceFiles/playerwidget.cpp @@ -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(); } diff --git a/Telegram/SourceFiles/playerwidget.h b/Telegram/SourceFiles/playerwidget.h index c5286fca58..4eda5b0d70 100644 --- a/Telegram/SourceFiles/playerwidget.h +++ b/Telegram/SourceFiles/playerwidget.h @@ -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; - }; diff --git a/Telegram/SourceFiles/profile/profile_cover.cpp b/Telegram/SourceFiles/profile/profile_cover.cpp index c73d0fa150..98ba80f27f 100644 --- a/Telegram/SourceFiles/profile/profile_cover.cpp +++ b/Telegram/SourceFiles/profile/profile_cover.cpp @@ -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); diff --git a/Telegram/SourceFiles/profile/profile_cover.h b/Telegram/SourceFiles/profile/profile_cover.h index c09a309ca8..1f06abcca3 100644 --- a/Telegram/SourceFiles/profile/profile_cover.h +++ b/Telegram/SourceFiles/profile/profile_cover.h @@ -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; - QList _rightActions; - // Cover content ChildWidget _photoButton; diff --git a/Telegram/SourceFiles/profile/profile_fixed_bar.cpp b/Telegram/SourceFiles/profile/profile_fixed_bar.cpp new file mode 100644 index 0000000000..785f5971b5 --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_fixed_bar.cpp @@ -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 diff --git a/Telegram/SourceFiles/profile/profile_fixed_bar.h b/Telegram/SourceFiles/profile/profile_fixed_bar.h new file mode 100644 index 0000000000..2c42ff67a3 --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_fixed_bar.h @@ -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; + QList _rightActions; + + bool _animatingMode = false; + +}; + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.cpp b/Telegram/SourceFiles/profile/profile_inner_widget.cpp index 7d62441d25..8a6cf4fc4b 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_inner_widget.cpp @@ -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) { diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.h b/Telegram/SourceFiles/profile/profile_inner_widget.h index 5a4368aa03..e91c018ea3 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.h +++ b/Telegram/SourceFiles/profile/profile_inner_widget.h @@ -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 _cover; QList _blocks; diff --git a/Telegram/SourceFiles/profile/profile_widget.cpp b/Telegram/SourceFiles/profile/profile_widget.cpp index 5f7b1c7b69..05458068d9 100644 --- a/Telegram/SourceFiles/profile/profile_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_widget.cpp @@ -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(); _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(); } diff --git a/Telegram/SourceFiles/profile/profile_widget.h b/Telegram/SourceFiles/profile/profile_widget.h index 13e765edc7..cb27e3fcf2 100644 --- a/Telegram/SourceFiles/profile/profile_widget.h +++ b/Telegram/SourceFiles/profile/profile_widget.h @@ -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; ChildWidget _scroll; ChildWidget _inner; - ChildWidget _sideShadow; std_::unique_ptr _showAnimation; diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 9dee29e7a0..a6bd9b4570 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -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(); } diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index 6a8e1debd2..79de732d36 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -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; }; diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp index be6675c1d0..6718db8488 100644 --- a/Telegram/SourceFiles/pspecific_win.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -851,7 +851,6 @@ namespace { _psShadowWindows.setColor(_shInactive); } if (Global::started()) { - QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection); App::wnd()->update(); } } return false; diff --git a/Telegram/SourceFiles/pspecific_winrt.cpp b/Telegram/SourceFiles/pspecific_winrt.cpp index 76a8eb1cf2..79858d2b7e 100644 --- a/Telegram/SourceFiles/pspecific_winrt.cpp +++ b/Telegram/SourceFiles/pspecific_winrt.cpp @@ -852,7 +852,6 @@ namespace { // _psShadowWindows.setColor(_shInactive); //} if (Global::started()) { - QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection); App::wnd()->update(); } } return false; diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index 418de84059..c7aaeec12e 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -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(); diff --git a/Telegram/SourceFiles/ui/slide_animation.cpp b/Telegram/SourceFiles/ui/slide_animation.cpp index ecd59f1d88..266a1ad168 100644 --- a/Telegram/SourceFiles/ui/slide_animation.cpp +++ b/Telegram/SourceFiles/ui/slide_animation.cpp @@ -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) { diff --git a/Telegram/SourceFiles/ui/twidget.h b/Telegram/SourceFiles/ui/twidget.h index 8a803ad0a4..3af3f6ec9f 100644 --- a/Telegram/SourceFiles/ui/twidget.h +++ b/Telegram/SourceFiles/ui/twidget.h @@ -184,6 +184,21 @@ public: bool inFocusChain() const; + void hideChildren() { + for (auto child : children()) { + if (auto widget = qobject_cast(child)) { + widget->hide(); + } + } + } + void showChildren() { + for (auto child : children()) { + if (auto widget = qobject_cast(child)) { + widget->show(); + } + } + } + }; void myEnsureResized(QWidget *target); diff --git a/Telegram/SourceFiles/window/top_bar_widget.cpp b/Telegram/SourceFiles/window/top_bar_widget.cpp index 4f4ba9e76d..0b1fe6e499 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.cpp +++ b/Telegram/SourceFiles/window/top_bar_widget.cpp @@ -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); } diff --git a/Telegram/SourceFiles/window/top_bar_widget.h b/Telegram/SourceFiles/window/top_bar_widget.h index 3c94114e6a..69c416e502 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.h +++ b/Telegram/SourceFiles/window/top_bar_widget.h @@ -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 _search; - ChildWidget _sideShadow; - }; } // namespace Window diff --git a/Telegram/Telegram.vcxproj b/Telegram/Telegram.vcxproj index 71e8ad6848..96170141ce 100644 --- a/Telegram/Telegram.vcxproj +++ b/Telegram/Telegram.vcxproj @@ -390,6 +390,10 @@ true true + + true + true + true true @@ -689,6 +693,10 @@ true true + + true + true + true true @@ -1014,6 +1022,10 @@ true true + + true + true + true true @@ -1163,6 +1175,7 @@ + @@ -1459,6 +1472,20 @@ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(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" + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing profile_fixed_bar.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(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" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing profile_fixed_bar.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(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" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing profile_fixed_bar.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(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" + diff --git a/Telegram/Telegram.vcxproj.filters b/Telegram/Telegram.vcxproj.filters index 9abae748d3..2197516041 100644 --- a/Telegram/Telegram.vcxproj.filters +++ b/Telegram/Telegram.vcxproj.filters @@ -1149,6 +1149,18 @@ GeneratedFiles\Release + + SourceFiles\profile + + + GeneratedFiles\Deploy + + + GeneratedFiles\Debug + + + GeneratedFiles\Release + @@ -1576,6 +1588,9 @@ SourceFiles\profile + + SourceFiles\profile +