Profile done as a new generic Window::SectionWidget.

Slide animation reimplemented.
This commit is contained in:
John Preston 2016-05-19 15:03:51 +03:00
parent 6e2dea7030
commit 1d42144c95
37 changed files with 1052 additions and 373 deletions

View file

@ -11,7 +11,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
* Windows XP - Windows 10 (**not** RT) * Windows XP - Windows 10 (**not** RT)
* Mac OS X 10.8 - Mac OS X 10.11 * Mac OS X 10.8 - Mac OS X 10.11
* Mac OS X 10.6 - Mac OS X 10.7 (separate build) * Mac OS X 10.6 - Mac OS X 10.7 (separate build)
* Ubuntu 12.04 - Ubuntu 15.04 * Ubuntu 12.04 - Ubuntu 16.04
* Fedora 22 * Fedora 22
## Third-party libraries ## Third-party libraries

View file

@ -373,12 +373,13 @@ statusFont: font(fsize);
versionColor: #777; versionColor: #777;
shadowColor: rgba(0, 0, 0, 24); shadowColor: rgba(0, 0, 0, 24);
shadowToggleDuration: 200;
slideDuration: 240; slideDuration: 240;
slideShift: 100px; slideShift: 100px;
slideFadeOut: 0.3; slideFadeOut: 0.3;
slideShadow: sprite(348px, 71px, 48px, 1px); slideShadow: sprite(348px, 71px, 48px, 1px);
slideFunction: transition(easeOutCirc); slideFunction: transition(linear);
btnDefIconed: iconedButton { btnDefIconed: iconedButton {
color: white; color: white;

View file

@ -1976,7 +1976,7 @@ void MembersInner::chooseParticipant() {
if (_sel < 0 || _sel >= _rows.size()) return; if (_sel < 0 || _sel >= _rows.size()) return;
if (PeerData *peer = _rows[_sel]) { if (PeerData *peer = _rows[_sel]) {
Ui::hideLayer(); Ui::hideLayer();
App::main()->showPeerProfile(peer, ShowAtUnreadMsgId); Ui::showPeerProfile(peer);
} }
} }

View file

@ -74,14 +74,15 @@ bool Processor::write(const structure::Module &module) const {
QFileInfo srcFile(module.filepath()); QFileInfo srcFile(module.filepath());
QString dstFilePath = dir.absolutePath() + '/' + destFileBaseName(module); QString dstFilePath = dir.absolutePath() + '/' + destFileBaseName(module);
bool forceReGenerate = false;// !options_.rebuildDependencies;
common::ProjectInfo project = { common::ProjectInfo project = {
"codegen_style", "codegen_style",
srcFile.fileName(), srcFile.fileName(),
"stdafx.h", "stdafx.h",
!options_.rebuildDependencies, // forceReGenerate forceReGenerate
}; };
SpriteGenerator spriteGenerator(module); SpriteGenerator spriteGenerator(module, forceReGenerate);
if (!spriteGenerator.writeSprites()) { if (!spriteGenerator.writeSprites()) {
return false; return false;
} }

View file

@ -48,8 +48,9 @@ constexpr int kErrorCouldNotWrite = 845;
} // namespace } // namespace
SpriteGenerator::SpriteGenerator(const structure::Module &module) SpriteGenerator::SpriteGenerator(const structure::Module &module, bool forceReGenerate)
: module_(module) : forceReGenerate_(forceReGenerate)
, module_(module)
, basePath_(QFileInfo(module.filepath()).dir().absolutePath()) { , basePath_(QFileInfo(module.filepath()).dir().absolutePath()) {
} }
@ -84,7 +85,7 @@ bool SpriteGenerator::writeSprites() {
} }
} }
QFile file(filepath); QFile file(filepath);
if (file.open(QIODevice::ReadOnly)) { if (!forceReGenerate_ && file.open(QIODevice::ReadOnly)) {
if (file.readAll() == spriteData) { if (file.readAll() == spriteData) {
continue; continue;
} }

View file

@ -34,7 +34,7 @@ class Module;
class SpriteGenerator { class SpriteGenerator {
public: public:
SpriteGenerator(const structure::Module &module); SpriteGenerator(const structure::Module &module, bool forceReGenerate);
SpriteGenerator(const SpriteGenerator &other) = delete; SpriteGenerator(const SpriteGenerator &other) = delete;
SpriteGenerator &operator=(const SpriteGenerator &other) = delete; SpriteGenerator &operator=(const SpriteGenerator &other) = delete;
@ -46,6 +46,7 @@ private:
QImage generateSprite(int scale); // scale = 5 for 125% and 6 for 150%. QImage generateSprite(int scale); // scale = 5 for 125% and 6 for 150%.
const structure::Module &module_; const structure::Module &module_;
bool forceReGenerate_;
QString basePath_; QString basePath_;
QImage sprite2x_; QImage sprite2x_;
QList<structure::Variable> sprites_; QList<structure::Variable> sprites_;

View file

@ -661,7 +661,7 @@ bool DialogsInner::menuPeerMuted() {
void DialogsInner::onContextProfile() { void DialogsInner::onContextProfile() {
if (!_menuPeer) return; if (!_menuPeer) return;
App::main()->showPeerProfile(_menuPeer); Ui::showPeerProfile(_menuPeer);
} }
void DialogsInner::onContextToggleNotifications() { void DialogsInner::onContextToggleNotifications() {
@ -1849,27 +1849,30 @@ void DialogsWidget::dialogsToUp() {
} }
} }
void DialogsWidget::animShow(const QPixmap &bgAnimCache) { void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params) {
if (App::app()) App::app()->mtpPause(); if (App::app()) App::app()->mtpPause();
bool back = true; _cacheUnder = params.oldContentCache;
(back ? _cacheOver : _cacheUnder) = bgAnimCache; show();
_cacheOver = App::main()->grabForShowAnimation(params);
_a_show.stop(); _a_show.stop();
(back ? _cacheUnder : _cacheOver) = myGrab(this);
_scroll.hide(); _scroll.hide();
_filter.hide(); _filter.hide();
_cancelSearch.hide(); _cancelSearch.hide();
_newGroup.hide(); _newGroup.hide();
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift); int delta = st::slideShift;
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0); a_progress = anim::fvalue(0, 1);
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1); if (direction == Window::SlideDirection::FromLeft) {
a_coordUnder = anim::ivalue(0, delta);
a_coordOver = anim::ivalue(-delta, 0);
} else {
a_coordUnder = anim::ivalue(0, -delta);
a_coordOver = anim::ivalue(delta, 0);
}
_a_show.start(); _a_show.start();
show();
} }
void DialogsWidget::step_show(float64 ms, bool timer) { void DialogsWidget::step_show(float64 ms, bool timer) {
@ -1879,7 +1882,7 @@ void DialogsWidget::step_show(float64 ms, bool timer) {
a_coordUnder.finish(); a_coordUnder.finish();
a_coordOver.finish(); a_coordOver.finish();
a_shadow.finish(); a_progress.finish();
_cacheUnder = _cacheOver = QPixmap(); _cacheUnder = _cacheOver = QPixmap();
@ -1894,7 +1897,7 @@ void DialogsWidget::step_show(float64 ms, bool timer) {
} else { } else {
a_coordUnder.update(dt, st::slideFunction); a_coordUnder.update(dt, st::slideFunction);
a_coordOver.update(dt, st::slideFunction); a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction); a_progress.update(dt, st::slideFunction);
} }
if (timer) update(); if (timer) update();
} }
@ -2535,15 +2538,24 @@ void DialogsWidget::paintEvent(QPaintEvent *e) {
p.setClipRect(r); p.setClipRect(r);
} }
if (_a_show.animating()) { if (_a_show.animating()) {
if (a_coordOver.current() > 0) { int retina = cIntRetinaFactor();
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor())); if (a_progress.current() < 1) {
p.setOpacity(a_shadow.current() * st::slideFadeOut); int underLeft = a_coordUnder.current();
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b); int underWidth = _cacheUnder.width() / retina;
p.setOpacity(1); int underHeight = _cacheUnder.height() / retina;
p.fillRect(r, st::white);
QRect underDst(0, 0, underWidth + underLeft, underHeight);
QRect underSrc(-underLeft * retina, 0, (underWidth + underLeft) * retina, underHeight * retina);
p.setOpacity(1. - a_progress.current());
p.drawPixmap(underDst, _cacheUnder, underSrc);
p.setOpacity(a_progress.current());
} }
p.drawPixmap(a_coordOver.current(), 0, _cacheOver); int overLeft = a_coordOver.current();
p.setOpacity(a_shadow.current()); int overWidth = _cacheOver.width() / retina;
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), height()), App::sprite(), st::slideShadow.rect()); int overHeight = _cacheOver.height() / retina;
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
QRect overSrc(0, 0, (overWidth - overLeft) * retina, overHeight * retina);
p.drawPixmap(overDst, _cacheOver, overSrc);
return; return;
} }
QRect above(0, 0, width(), _scroll.y()); QRect above(0, 0, width(), _scroll.y());

View file

@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "window/section_widget.h"
class MainWidget; class MainWidget;
namespace Dialogs { namespace Dialogs {
class Row; class Row;
@ -260,7 +262,10 @@ public:
void dialogsToUp(); void dialogsToUp();
void animShow(const QPixmap &bgAnimCache); bool hasTopBarShadow() const {
return true;
}
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params);
void step_show(float64 ms, bool timer); void step_show(float64 ms, bool timer);
void destroyData(); void destroyData();
@ -338,7 +343,7 @@ private:
Animation _a_show; Animation _a_show;
QPixmap _cacheUnder, _cacheOver; QPixmap _cacheUnder, _cacheOver;
anim::ivalue a_coordUnder, a_coordOver; anim::ivalue a_coordUnder, a_coordOver;
anim::fvalue a_shadow; anim::fvalue a_progress;
PeerData *_searchInPeer, *_searchInMigrated; PeerData *_searchInPeer, *_searchInMigrated;

View file

@ -20,6 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "profile/profile_section_memento.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "application.h" #include "application.h"
@ -237,7 +238,15 @@ void autoplayMediaInlineAsync(const FullMsgId &msgId) {
} }
void showPeerProfile(const PeerId &peer) { void showPeerProfile(const PeerId &peer) {
if (MainWidget *m = App::main()) m->showPeerProfile(App::peer(peer)); if (auto m = App::main()) {
m->showWideSection(Profile::SectionMemento(App::peer(peer)));
}
}
void showPeerOverview(const PeerId &peer, MediaOverviewType type) {
if (auto m = App::main()) {
m->showMediaOverview(App::peer(peer), type);
}
} }
void showPeerHistory(const PeerId &peer, MsgId msgId, bool back) { void showPeerHistory(const PeerId &peer, MsgId msgId, bool back) {

View file

@ -75,6 +75,14 @@ inline void showPeerProfile(const History *history) {
showPeerProfile(history->peer->id); showPeerProfile(history->peer->id);
} }
void showPeerOverview(const PeerId &peer, MediaOverviewType type);
inline void showPeerOverview(const PeerData *peer, MediaOverviewType type) {
showPeerOverview(peer->id, type);
}
inline void showPeerOverview(const History *history, MediaOverviewType type) {
showPeerOverview(history->peer->id, type);
}
void showPeerHistory(const PeerId &peer, MsgId msgId, bool back = false); void showPeerHistory(const PeerId &peer, MsgId msgId, bool back = false);
inline void showPeerHistory(const PeerData *peer, MsgId msgId, bool back = false) { inline void showPeerHistory(const PeerData *peer, MsgId msgId, bool back = false) {
showPeerHistory(peer->id, msgId, back); showPeerHistory(peer->id, msgId, back);

View file

@ -4089,7 +4089,9 @@ bool HistoryWidget::reportSpamSettingFail(const RPCError &error, mtpRequestId re
} }
void HistoryWidget::updateControlsVisibility() { void HistoryWidget::updateControlsVisibility() {
if (!_a_show.animating()) {
_topShadow.setVisible(_peer ? true : false); _topShadow.setVisible(_peer ? true : false);
}
if (!_history || _a_show.animating()) { if (!_history || _a_show.animating()) {
_reportSpamPanel.hide(); _reportSpamPanel.hide();
_scroll.hide(); _scroll.hide();
@ -5123,15 +5125,15 @@ HistoryItem *HistoryWidget::atTopImportantMsg(int32 &bottomUnderScrollTop) const
return _list->atTopImportantMsg(_scroll.scrollTop(), _scroll.height(), bottomUnderScrollTop); return _list->atTopImportantMsg(_scroll.scrollTop(), _scroll.height(), bottomUnderScrollTop);
} }
void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back) { void HistoryWidget::showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params) {
if (App::app()) App::app()->mtpPause(); if (App::app()) App::app()->mtpPause();
(back ? _cacheOver : _cacheUnder) = bgAnimCache; _cacheUnder = params.oldContentCache;
(back ? _cacheTopBarOver : _cacheTopBarUnder) = bgAnimTopBarCache; show();
(back ? _cacheUnder : _cacheOver) = myGrab(this); _topShadow.setVisible(params.withTopBarShadow ? false : true);
App::main()->topBar()->stopAnim(); _cacheOver = App::main()->grabForShowAnimation(params);
(back ? _cacheTopBarUnder : _cacheTopBarOver) = myGrab(App::main()->topBar());
App::main()->topBar()->startAnim(); App::main()->topBar()->startAnim();
_topShadow.setVisible(params.withTopBarShadow ? true : false);
_scroll.hide(); _scroll.hide();
_kbScroll.hide(); _kbScroll.hide();
@ -5155,31 +5157,37 @@ void HistoryWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTo
_botStart.hide(); _botStart.hide();
_joinChannel.hide(); _joinChannel.hide();
_muteUnmute.hide(); _muteUnmute.hide();
_topShadow.hide();
if (_pinnedBar) { if (_pinnedBar) {
_pinnedBar->shadow.hide(); _pinnedBar->shadow.hide();
_pinnedBar->cancel.hide(); _pinnedBar->cancel.hide();
} }
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift); int delta = st::slideShift;
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0); a_progress = anim::fvalue(0, 1);
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1); if (direction == Window::SlideDirection::FromLeft) {
a_coordUnder = anim::ivalue(0, delta);
a_coordOver = anim::ivalue(-delta, 0);
} else {
a_coordUnder = anim::ivalue(0, -delta);
a_coordOver = anim::ivalue(delta, 0);
}
_a_show.start(); _a_show.start();
App::main()->topBar()->update(); App::main()->topBar()->update();
activate(); activate();
} }
void HistoryWidget::step_show(float64 ms, bool timer) { void HistoryWidget::step_show(float64 ms, bool timer) {
float64 dt = ms / 3000;// st::slideDuration; float64 dt = ms / st::slideDuration;
if (dt >= 1) { if (dt >= 1) {
_a_show.stop(); _a_show.stop();
_topShadow.setVisible(_peer ? true : false); _topShadow.setVisible(_peer ? true : false);
a_coordUnder.finish(); a_coordUnder.finish();
a_coordOver.finish(); a_coordOver.finish();
a_shadow.finish(); a_progress.finish();
_cacheUnder = _cacheOver = _cacheTopBarUnder = _cacheTopBarOver = QPixmap(); _cacheUnder = _cacheOver = QPixmap();
App::main()->topBar()->stopAnim(); App::main()->topBar()->stopAnim();
doneShow(); doneShow();
@ -5187,7 +5195,7 @@ void HistoryWidget::step_show(float64 ms, bool timer) {
} else { } else {
a_coordUnder.update(dt, st::slideFunction); a_coordUnder.update(dt, st::slideFunction);
a_coordOver.update(dt, st::slideFunction); a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction); a_progress.update(dt, st::slideFunction);
} }
if (timer) { if (timer) {
update(); update();
@ -5903,10 +5911,24 @@ void HistoryWidget::onForwardHere() {
void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { void HistoryWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) {
if (_a_show.animating()) { if (_a_show.animating()) {
p.drawPixmap(a_coordUnder.current(), 0, _cacheTopBarUnder); int retina = cIntRetinaFactor();
p.drawPixmap(a_coordOver.current(), 0, _cacheTopBarOver); if (a_progress.current() < 1) {
p.setOpacity(a_shadow.current()); int underLeft = a_coordUnder.current();
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), st::topBarHeight), App::sprite(), st::slideShadow.rect()); int underWidth = _cacheUnder.width() / retina;
int underHeight = st::topBarHeight;
p.fillRect(0, 0, underWidth, underHeight, st::white);
QRect underDst(0, 0, underWidth + underLeft, underHeight);
QRect underSrc(-underLeft * retina, 0, (underWidth + underLeft) * retina, underHeight * retina);
p.setOpacity(1. - a_progress.current());
p.drawPixmap(underDst, _cacheUnder, underSrc);
p.setOpacity(a_progress.current());
}
int overLeft = a_coordOver.current();
int overWidth = _cacheOver.width() / retina;
int overHeight = st::topBarHeight;
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
QRect overSrc(0, 0, (overWidth - overLeft) * retina, overHeight * retina);
p.drawPixmap(overDst, _cacheOver, overSrc);
return; return;
} }
@ -5940,7 +5962,7 @@ void HistoryWidget::topBarClick() {
if (Adaptive::OneColumn()) { if (Adaptive::OneColumn()) {
Ui::showChatsList(); Ui::showChatsList();
} else { } else {
if (_history) App::main()->showPeerProfile(_peer); if (_history) Ui::showPeerProfile(_peer);
} }
} }
@ -8310,20 +8332,31 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
if (r != rect()) { if (r != rect()) {
p.setClipRect(r); p.setClipRect(r);
} }
bool hasTopBar = !App::main()->topBar()->isHidden(), hasPlayer = !App::main()->player()->isHidden();
if (_a_show.animating()) { if (_a_show.animating()) {
if (a_coordOver.current() > 0) { int retina = cIntRetinaFactor();
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor())); int inCacheTop = hasTopBar ? st::topBarHeight : 0;
p.setOpacity(a_shadow.current() * st::slideFadeOut); if (a_progress.current() < 1) {
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b); int underLeft = a_coordUnder.current();
p.setOpacity(1); int underWidth = _cacheUnder.width() / retina;
int underHeight = height();
p.fillRect(r, st::white);
QRect underDst(0, 0, underWidth + underLeft, underHeight);
QRect underSrc(-underLeft * retina, inCacheTop * retina, (underWidth + underLeft) * retina, underHeight * retina);
p.setOpacity(1. - a_progress.current());
p.drawPixmap(underDst, _cacheUnder, underSrc);
p.setOpacity(a_progress.current());
} }
p.drawPixmap(a_coordOver.current(), 0, _cacheOver); int overLeft = a_coordOver.current();
p.setOpacity(a_shadow.current()); int overWidth = _cacheOver.width() / retina;
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), height()), App::sprite(), st::slideShadow.rect()); int overHeight = height();
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
QRect overSrc(0, inCacheTop * retina, (overWidth - overLeft) * retina, overHeight * retina);
p.drawPixmap(overDst, _cacheOver, overSrc);
return; return;
} }
bool hasTopBar = !App::main()->topBar()->isHidden(), hasPlayer = !App::main()->player()->isHidden();
QRect fill(0, 0, width(), App::main()->height()); QRect fill(0, 0, width(), App::main()->height());
int fromy = (hasTopBar ? (-st::topBarHeight) : 0) + (hasPlayer ? (-st::playerHeight) : 0), x = 0, y = 0; int fromy = (hasTopBar ? (-st::topBarHeight) : 0) + (hasPlayer ? (-st::playerHeight) : 0), x = 0, y = 0;
QPixmap cached = App::main()->cachedBackground(fill, x, y); QPixmap cached = App::main()->cachedBackground(fill, x, y);

View file

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "dropdown.h" #include "dropdown.h"
#include "history/history_common.h" #include "history/history_common.h"
#include "history/field_autocomplete.h" #include "history/field_autocomplete.h"
#include "window/section_widget.h"
namespace InlineBots { namespace InlineBots {
namespace Layout { namespace Layout {
@ -576,7 +577,10 @@ public:
MsgId msgId() const; MsgId msgId() const;
HistoryItem *atTopImportantMsg(int32 &bottomUnderScrollTop) const; HistoryItem *atTopImportantMsg(int32 &bottomUnderScrollTop) const;
void animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false); bool hasTopBarShadow() const {
return peer() != nullptr;
}
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params);
void step_show(float64 ms, bool timer); void step_show(float64 ms, bool timer);
void animStop(); void animStop();
@ -659,9 +663,14 @@ public:
_inGrab = true; _inGrab = true;
resizeEvent(0); resizeEvent(0);
} }
void grapWithoutTopBarShadow() {
grabStart();
_topShadow.hide();
}
void grabFinish() override { void grabFinish() override {
_inGrab = false; _inGrab = false;
resizeEvent(0); resizeEvent(0);
_topShadow.show();
} }
bool isItemVisible(HistoryItem *item); bool isItemVisible(HistoryItem *item);
@ -1084,9 +1093,9 @@ private:
int32 _titlePeerTextWidth = 0; int32 _titlePeerTextWidth = 0;
Animation _a_show; Animation _a_show;
QPixmap _cacheUnder, _cacheOver, _cacheTopBarUnder, _cacheTopBarOver; QPixmap _cacheUnder, _cacheOver;
anim::ivalue a_coordUnder, a_coordOver; anim::ivalue a_coordUnder, a_coordOver;
anim::fvalue a_shadow; anim::fvalue a_progress;
QTimer _scrollTimer; QTimer _scrollTimer;
int32 _scrollDelta = 0; int32 _scrollDelta = 0;

View file

@ -22,7 +22,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "ui/buttons/peer_avatar_button.h" #include "ui/buttons/peer_avatar_button.h"
#include "profile/profile_widget.h" #include "window/section_memento.h"
#include "window/section_widget.h"
#include "window/top_bar_widget.h" #include "window/top_bar_widget.h"
#include "apiwrap.h" #include "apiwrap.h"
#include "dialogswidget.h" #include "dialogswidget.h"
@ -45,6 +46,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "shortcuts.h" #include "shortcuts.h"
#include "audio.h" #include "audio.h"
StackItemSection::StackItemSection(std_::unique_ptr<Window::SectionMemento> &&memento) : StackItem(nullptr)
, _memento(std_::move(memento)) {
}
StackItemSection::~StackItemSection() {
}
MainWidget::MainWidget(MainWindow *window) : TWidget(window) MainWidget::MainWidget(MainWindow *window) : TWidget(window)
, _a_show(animation(this, &MainWidget::step_show)) , _a_show(animation(this, &MainWidget::step_show))
, _sideShadow(this, st::shadowColor) , _sideShadow(this, st::shadowColor)
@ -390,8 +398,8 @@ void MainWidget::rpcClear() {
QPixmap MainWidget::grabInner() { QPixmap MainWidget::grabInner() {
if (_overview && !_overview->isHidden()) { if (_overview && !_overview->isHidden()) {
return myGrab(_overview); return myGrab(_overview);
} else if (_profile && !_profile->isHidden()) { } else if (_wideSection && !_wideSection->isHidden()) {
return myGrab(_profile, QRect(0, st::topBarHeight, _history->width(), _history->height() - st::topBarHeight)); return myGrab(_wideSection, QRect(0, st::topBarHeight, _history->width(), _history->height() - st::topBarHeight));
} else if (Adaptive::OneColumn() && _history->isHidden()) { } else if (Adaptive::OneColumn() && _history->isHidden()) {
return myGrab(_dialogs, QRect(0, st::topBarHeight, _dialogs->width(), _dialogs->height() - st::topBarHeight)); return myGrab(_dialogs, QRect(0, st::topBarHeight, _dialogs->width(), _dialogs->height() - st::topBarHeight));
} else if (_history->peer()) { } else if (_history->peer()) {
@ -411,8 +419,8 @@ bool MainWidget::isItemVisible(HistoryItem *item) {
QPixmap MainWidget::grabTopBar() { QPixmap MainWidget::grabTopBar() {
if (!_topBar->isHidden()) { if (!_topBar->isHidden()) {
return myGrab(_topBar); return myGrab(_topBar);
} else if (_profile) { } else if (_wideSection) {
return myGrab(_profile, QRect(0, 0, _profile->width(), st::topBarHeight)); return myGrab(_wideSection, QRect(0, 0, _wideSection->width(), st::topBarHeight));
} else if (Adaptive::OneColumn() && _history->isHidden()) { } else if (Adaptive::OneColumn() && _history->isHidden()) {
return myGrab(_dialogs, QRect(0, 0, _dialogs->width(), st::topBarHeight)); return myGrab(_dialogs, QRect(0, 0, _dialogs->width(), st::topBarHeight));
} else { } else {
@ -528,29 +536,22 @@ void MainWidget::noHider(HistoryHider *destroyed) {
_forwardConfirm = 0; _forwardConfirm = 0;
} }
onHistoryShown(_history->history(), _history->msgId()); onHistoryShown(_history->history(), _history->msgId());
if (_profile || _overview || (_history->peer() && _history->peer()->id)) { if (_wideSection || _overview || (_history->peer() && _history->peer()->id)) {
QPixmap animCache, animTopBarCache; Window::SectionSlideParams animationParams;
if (_profile) { if (_overview) {
if (Adaptive::OneColumn()) { animationParams = prepareOverviewAnimation();
animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight)); } else if (_wideSection) {
animationParams = prepareWideSectionAnimation(_wideSection);
} else { } else {
_sideShadow.hide(); animationParams = prepareHistoryAnimation(_history->peer() ? _history->peer()->id : 0);
animCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
_sideShadow.show();
}
} else {
animCache = grabInner();
animTopBarCache = grabTopBar();
} }
_dialogs->hide(); _dialogs->hide();
if (_overview) { if (_overview) {
_overview->show(); _overview->showAnimated(Window::SlideDirection::FromRight, animationParams);
_overview->animShow(animCache, animTopBarCache); } else if (_wideSection) {
} else if (_profile) { _wideSection->showAnimated(Window::SlideDirection::FromRight, animationParams);
_profile->showAnimated(SlideDirection::FromRight, animCache);
} else { } else {
_history->show(); _history->showAnimated(Window::SlideDirection::FromRight, animationParams);
_history->animShow(animCache, animTopBarCache);
} }
} }
App::wnd()->getTitle()->updateBackButton(); App::wnd()->getTitle()->updateBackButton();
@ -575,19 +576,19 @@ void MainWidget::hiderLayer(HistoryHider *h) {
dialogsToUp(); dialogsToUp();
_hider->hide(); _hider->hide();
QPixmap animCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight)); auto animationParams = prepareDialogsAnimation();
onHistoryShown(0, 0); onHistoryShown(0, 0);
if (_overview) { if (_overview) {
_overview->hide(); _overview->hide();
} else if (_profile) { } else if (_wideSection) {
_profile->hide(); _wideSection->hide();
} else { } else {
_history->hide(); _history->hide();
} }
_dialogs->show(); _dialogs->show();
resizeEvent(0); resizeEvent(0);
_dialogs->animShow(animCache); _dialogs->showAnimated(Window::SlideDirection::FromLeft, animationParams);
App::wnd()->getTitle()->updateBackButton(); App::wnd()->getTitle()->updateBackButton();
} else { } else {
_hider->show(); _hider->show();
@ -1878,15 +1879,15 @@ void MainWidget::setInnerFocus() {
_hider->setFocus(); _hider->setFocus();
} else if (_overview) { } else if (_overview) {
_overview->activate(); _overview->activate();
} else if (_profile) { } else if (_wideSection) {
_profile->setInnerFocus(); _wideSection->setInnerFocus();
} else { } else {
dialogsActivate(); dialogsActivate();
} }
} else if (_overview) { } else if (_overview) {
_overview->activate(); _overview->activate();
} else if (_profile) { } else if (_wideSection) {
_profile->setInnerFocus(); _wideSection->setInnerFocus();
} else { } else {
_history->setInnerFocus(); _history->setInnerFocus();
} }
@ -2030,31 +2031,19 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
_hider = nullptr; _hider = nullptr;
} }
QPixmap animCache, animTopBarCache; Window::SectionSlideParams animationParams;
if (!_a_show.animating() && ((_history->isHidden() && (_profile || _overview)) || (Adaptive::OneColumn() && (_history->isHidden() || !peerId)))) { if (!_a_show.animating() && ((_history->isHidden() && (_wideSection || _overview)) || (Adaptive::OneColumn() && (_history->isHidden() || !peerId)))) {
if (peerId) { animationParams = prepareHistoryAnimation(peerId);
animCache = grabInner();
} 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();
}
_history->show();
} }
if (_history->peer() && _history->peer()->id != peerId) clearBotStartToken(_history->peer()); if (_history->peer() && _history->peer()->id != peerId) clearBotStartToken(_history->peer());
_history->showHistory(peerId, showAtMsgId); _history->showHistory(peerId, showAtMsgId);
bool noPeer = (!_history->peer() || !_history->peer()->id), onlyDialogs = noPeer && Adaptive::OneColumn(); bool noPeer = (!_history->peer() || !_history->peer()->id), onlyDialogs = noPeer && Adaptive::OneColumn();
if (_profile || _overview) { if (_wideSection || _overview) {
if (_profile) { if (_wideSection) {
_profile->hide(); _wideSection->hide();
_profile->deleteLater(); _wideSection->deleteLater();
_profile = nullptr; _wideSection = nullptr;
} }
if (_overview) { if (_overview) {
_overview->hide(); _overview->hide();
@ -2073,9 +2062,10 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
_topBar->hide(); _topBar->hide();
_history->hide(); _history->hide();
if (!_a_show.animating()) { if (!_a_show.animating()) {
if (!animationParams.oldContentCache.isNull()) {
_dialogs->showAnimated(back ? Window::SlideDirection::FromLeft : Window::SlideDirection::FromRight, animationParams);
} else {
_dialogs->show(); _dialogs->show();
if (!animCache.isNull()) {
_dialogs->animShow(animCache);
} }
} }
} else { } else {
@ -2090,14 +2080,16 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
} }
if (Adaptive::OneColumn() && !_dialogs->isHidden()) _dialogs->hide(); if (Adaptive::OneColumn() && !_dialogs->isHidden()) _dialogs->hide();
if (!_a_show.animating()) { if (!_a_show.animating()) {
if (_history->isHidden()) _history->show(); if (!animationParams.oldContentCache.isNull()) {
if (!animCache.isNull()) { _history->showAnimated(back ? Window::SlideDirection::FromLeft : Window::SlideDirection::FromRight, animationParams);
_history->animShow(animCache, animTopBarCache, back); } else {
} else if (App::wnd()) { _history->show();
if (App::wnd()) {
QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus())); QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus()));
} }
} }
} }
}
//if (wasActivePeer && wasActivePeer->isChannel() && activePeer() != wasActivePeer) { //if (wasActivePeer && wasActivePeer->isChannel() && activePeer() != wasActivePeer) {
// wasActivePeer->asChannel()->ptsWaitingForShortPoll(false); // wasActivePeer->asChannel()->ptsWaitingForShortPoll(false);
//} //}
@ -2112,8 +2104,8 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool bac
} }
PeerData *MainWidget::ui_getPeerForMouseAction() { PeerData *MainWidget::ui_getPeerForMouseAction() {
if (_profile) { if (_wideSection) {
//return _profile->ui_getPeerForMouseAction(); TODO //return _wideSection->ui_getPeerForMouseAction(); TODO
} }
return _history->ui_getPeerForMouseAction(); return _history->ui_getPeerForMouseAction();
} }
@ -2152,10 +2144,6 @@ MsgId MainWidget::activeMsgId() {
return _history->peer() ? _history->msgId() : _msgIdInStack; return _history->peer() ? _history->msgId() : _msgIdInStack;
} }
PeerData *MainWidget::profilePeer() {
return _profile ? _profile->peer() : 0;
}
PeerData *MainWidget::overviewPeer() { PeerData *MainWidget::overviewPeer() {
return _overview ? _overview->peer() : 0; return _overview ? _overview->peer() : 0;
} }
@ -2186,18 +2174,15 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
return; return;
} }
QRect topBarRect = QRect(_topBar->x(), _topBar->y(), _topBar->width(), st::topBarHeight); Window::SectionSlideParams animationParams;
QRect historyRect = QRect(_history->x(), topBarRect.y() + topBarRect.height(), _history->width(), _history->y() + _history->height() - topBarRect.y() - topBarRect.height()); if (!_a_show.animating() && (Adaptive::OneColumn() || _wideSection || _overview || _history->peer())) {
QPixmap animCache, animTopBarCache; animationParams = prepareOverviewAnimation();
if (!_a_show.animating() && (Adaptive::OneColumn() || _profile || _overview || _history->peer())) {
animCache = grabInner();
animTopBarCache = grabTopBar();
} }
if (!back) { if (!back) {
if (_overview) { if (_overview) {
_stack.push_back(new StackItemOverview(_overview->peer(), _overview->type(), _overview->lastWidth(), _overview->lastScrollTop())); _stack.push_back(new StackItemOverview(_overview->peer(), _overview->type(), _overview->lastWidth(), _overview->lastScrollTop()));
} else if (_profile) { } else if (_wideSection) {
// _stack.push_back(new StackItemProfile(_profile->peer(), _profile->lastScrollTop())); TODO _stack.push_back(new StackItemSection(_wideSection->createMemento()));
} else if (_history->peer()) { } else if (_history->peer()) {
dlgUpdated(); dlgUpdated();
_peerInStack = _history->peer(); _peerInStack = _history->peer();
@ -2212,18 +2197,19 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
_overview->deleteLater(); _overview->deleteLater();
_overview->rpcClear(); _overview->rpcClear();
} }
if (_profile) { if (_wideSection) {
_profile->hide(); _wideSection->hide();
_profile->deleteLater(); _wideSection->deleteLater();
_profile = nullptr; _wideSection = nullptr;
} }
_overview = new OverviewWidget(this, peer, type); _overview = new OverviewWidget(this, peer, type);
_mediaTypeMask = 0; _mediaTypeMask = 0;
_topBar->show(); _topBar->show();
resizeEvent(nullptr); resizeEvent(nullptr);
mediaOverviewUpdated(peer, type); mediaOverviewUpdated(peer, type);
if (!animCache.isNull()) { _overview->setLastScrollTop(lastScrollTop);
_overview->animShow(animCache, animTopBarCache, back, lastScrollTop); if (!animationParams.oldContentCache.isNull()) {
_overview->showAnimated(back ? Window::SlideDirection::FromLeft : Window::SlideDirection::FromRight, animationParams);
} else { } else {
_overview->fastShow(); _overview->fastShow();
} }
@ -2238,28 +2224,16 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
App::wnd()->getTitle()->updateBackButton(); App::wnd()->getTitle()->updateBackButton();
} }
void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop) { void MainWidget::showWideSection(Window::SectionMemento &memento) {
if (peer->migrateTo()) {
peer = peer->migrateTo();
}
App::wnd()->hideSettings(); App::wnd()->hideSettings();
if (_profile && _profile->peer() == peer) return; if (_wideSection && _wideSection->showInternal(&memento)) {
return;
QPixmap animCache;
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) {
if (_overview) { if (_overview) {
_stack.push_back(new StackItemOverview(_overview->peer(), _overview->type(), _overview->lastWidth(), _overview->lastScrollTop())); _stack.push_back(new StackItemOverview(_overview->peer(), _overview->type(), _overview->lastWidth(), _overview->lastScrollTop()));
} else if (_profile) { } else if (_wideSection) {
// _stack.push_back(new StackItemProfile(_profile->peer(), _profile->lastScrollTop())); TODO _stack.push_back(new StackItemSection(_wideSection->createMemento()));
} else if (_history->peer()) { } else if (_history->peer()) {
dlgUpdated(); dlgUpdated();
_peerInStack = _history->peer(); _peerInStack = _history->peer();
@ -2267,7 +2241,71 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop)
dlgUpdated(); dlgUpdated();
_stack.push_back(new StackItemHistory(_peerInStack, _msgIdInStack, _history->replyReturns())); _stack.push_back(new StackItemHistory(_peerInStack, _msgIdInStack, _history->replyReturns()));
} }
showWideSectionAnimated(&memento, false);
}
Window::SectionSlideParams MainWidget::prepareShowAnimation(bool willHaveTopBarShadow) {
Window::SectionSlideParams result;
result.withTopBarShadow = willHaveTopBarShadow;
if (selectingPeer() && Adaptive::OneColumn()) {
result.withTopBarShadow = false;
} else if (_wideSection) {
if (!_wideSection->hasTopBarShadow()) {
result.withTopBarShadow = false;
} }
} else if (!_overview && !_history->peer()) {
result.withTopBarShadow = false;
}
if (selectingPeer() && Adaptive::OneColumn()) {
result.oldContentCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
} else if (_wideSection) {
result.oldContentCache = _wideSection->grabForShowAnimation(result);
} else {
if (result.withTopBarShadow) {
if (_overview) _overview->grapWithoutTopBarShadow();
_history->grapWithoutTopBarShadow();
} else {
if (_overview) _overview->grabStart();
_history->grabStart();
}
if (Adaptive::OneColumn()) {
result.oldContentCache = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
} else {
_sideShadow.hide();
result.oldContentCache = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
_sideShadow.show();
}
if (_overview) _overview->grabFinish();
_history->grabFinish();
}
return result;
}
Window::SectionSlideParams MainWidget::prepareWideSectionAnimation(Window::SectionWidget *section) {
return prepareShowAnimation(section->hasTopBarShadow());
}
Window::SectionSlideParams MainWidget::prepareHistoryAnimation(PeerId historyPeerId) {
return prepareShowAnimation(historyPeerId != 0);
}
Window::SectionSlideParams MainWidget::prepareOverviewAnimation() {
return prepareShowAnimation(true);
}
Window::SectionSlideParams MainWidget::prepareDialogsAnimation() {
return prepareShowAnimation(false);
}
void MainWidget::showWideSectionAnimated(Window::SectionMemento *memento, bool back) {
QPixmap animCache;
auto newWideGeometry = QRect(_history->x(), _playerHeight, _history->width(), height() - _playerHeight);
auto newWideSection = memento->createWidget(this, newWideGeometry);
Window::SectionSlideParams animationParams = prepareWideSectionAnimation(newWideSection);
if (_overview) { if (_overview) {
_overview->hide(); _overview->hide();
_overview->clear(); _overview->clear();
@ -2275,17 +2313,17 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop)
_overview->rpcClear(); _overview->rpcClear();
_overview = nullptr; _overview = nullptr;
} }
if (_profile) { if (_wideSection) {
_profile->hide(); _wideSection->hide();
_profile->deleteLater(); _wideSection->deleteLater();
_profile = nullptr; _wideSection = nullptr;
} }
_profile = new Profile::Widget(this, peer); _wideSection = newWideSection;
_topBar->hide(); _topBar->hide();
resizeEvent(0); resizeEvent(0);
_profile->showAnimated(SlideDirection::FromRight, animCache); auto direction = back ? Window::SlideDirection::FromLeft : Window::SlideDirection::FromRight;
_wideSection->showAnimated(direction, animationParams);
_history->animStop(); _history->animStop();
if (back) clearBotStartToken(_history->peer());
_history->showHistory(0, 0); _history->showHistory(0, 0);
_history->hide(); _history->hide();
if (Adaptive::OneColumn()) _dialogs->hide(); if (Adaptive::OneColumn()) _dialogs->hide();
@ -2304,6 +2342,9 @@ void MainWidget::showBackFromStack() {
} }
StackItem *item = _stack.back(); StackItem *item = _stack.back();
_stack.pop_back(); _stack.pop_back();
if (auto currentHistoryPeer = _history->peer()) {
clearBotStartToken(currentHistoryPeer);
}
if (item->type() == HistoryStackItem) { if (item->type() == HistoryStackItem) {
dlgUpdated(); dlgUpdated();
_peerInStack = 0; _peerInStack = 0;
@ -2319,9 +2360,9 @@ void MainWidget::showBackFromStack() {
StackItemHistory *histItem = static_cast<StackItemHistory*>(item); StackItemHistory *histItem = static_cast<StackItemHistory*>(item);
Ui::showPeerHistory(histItem->peer->id, App::main()->activeMsgId(), true); Ui::showPeerHistory(histItem->peer->id, App::main()->activeMsgId(), true);
_history->setReplyReturns(histItem->peer->id, histItem->replyReturns); _history->setReplyReturns(histItem->peer->id, histItem->replyReturns);
} else if (item->type() == ProfileStackItem) { } else if (item->type() == SectionStackItem) {
StackItemProfile *profItem = static_cast<StackItemProfile*>(item); StackItemSection *sectionItem = static_cast<StackItemSection*>(item);
showPeerProfile(profItem->peer, true, profItem->lastScrollTop); showWideSectionAnimated(sectionItem->memento(), true);
} else if (item->type() == OverviewStackItem) { } else if (item->type() == OverviewStackItem) {
StackItemOverview *overItem = static_cast<StackItemOverview*>(item); StackItemOverview *overItem = static_cast<StackItemOverview*>(item);
showMediaOverview(overItem->peer, overItem->mediaType, true, overItem->lastScrollTop); showMediaOverview(overItem->peer, overItem->mediaType, true, overItem->lastScrollTop);
@ -2345,6 +2386,19 @@ QRect MainWidget::historyRect() const {
return r; return r;
} }
QPixmap MainWidget::grabForShowAnimation(const Window::SectionSlideParams &params) {
_topBar->stopAnim();
QPixmap result;
if (Adaptive::OneColumn()) {
result = myGrab(this, QRect(0, _playerHeight, _dialogsWidth, height() - _playerHeight));
} else {
_sideShadow.hide();
result = myGrab(this, QRect(_dialogsWidth, _playerHeight, width() - _dialogsWidth, height() - _playerHeight));
_sideShadow.show();
}
return result;
}
void MainWidget::dlgUpdated() { void MainWidget::dlgUpdated() {
if (_peerInStack) { if (_peerInStack) {
_dialogs->dlgUpdated(App::history(_peerInStack->id), _msgIdInStack); _dialogs->dlgUpdated(App::history(_peerInStack->id), _msgIdInStack);
@ -2482,12 +2536,13 @@ void MainWidget::paintEvent(QPaintEvent *e) {
void MainWidget::hideAll() { void MainWidget::hideAll() {
_dialogs->hide(); _dialogs->hide();
_history->hide(); _history->hide();
if (_profile) { if (_wideSection) {
_profile->hide(); _wideSection->hide();
} }
if (_overview) { if (_overview) {
_overview->hide(); _overview->hide();
} }
_sideShadow.hide();
_topBar->hide(); _topBar->hide();
_mediaType->hide(); _mediaType->hide();
if (_player->isOpened() && !_player->isHidden()) { if (_player->isOpened() && !_player->isHidden()) {
@ -2501,6 +2556,7 @@ void MainWidget::showAll() {
cSetPasswordRecovered(false); cSetPasswordRecovered(false);
Ui::showLayer(new InformBox(lang(lng_signin_password_removed))); Ui::showLayer(new InformBox(lang(lng_signin_password_removed)));
} }
_sideShadow.show();
if (Adaptive::OneColumn()) { if (Adaptive::OneColumn()) {
if (_hider) { if (_hider) {
_hider->hide(); _hider->hide();
@ -2515,12 +2571,12 @@ void MainWidget::showAll() {
_dialogs->show(); _dialogs->show();
_history->hide(); _history->hide();
if (_overview) _overview->hide(); if (_overview) _overview->hide();
if (_profile) _profile->hide(); if (_wideSection) _wideSection->hide();
_topBar->hide(); _topBar->hide();
} else if (_overview) { } else if (_overview) {
_overview->show(); _overview->show();
} else if (_profile) { } else if (_wideSection) {
_profile->show(); _wideSection->show();
} else if (_history->peer()) { } else if (_history->peer()) {
_history->show(); _history->show();
_history->resizeEvent(0); _history->resizeEvent(0);
@ -2528,7 +2584,7 @@ void MainWidget::showAll() {
_dialogs->show(); _dialogs->show();
_history->hide(); _history->hide();
} }
if (_profile) { if (_wideSection) {
_topBar->hide(); _topBar->hide();
} else if (!selectingPeer() && (_overview || _history->peer())) { } else if (!selectingPeer() && (_overview || _history->peer())) {
_topBar->show(); _topBar->show();
@ -2545,13 +2601,13 @@ void MainWidget::showAll() {
_dialogs->show(); _dialogs->show();
if (_overview) { if (_overview) {
_overview->show(); _overview->show();
} else if (_profile) { } else if (_wideSection) {
_profile->show(); _wideSection->show();
} else { } else {
_history->show(); _history->show();
_history->resizeEvent(0); _history->resizeEvent(0);
} }
if (_profile) { if (_wideSection) {
_topBar->hide(); _topBar->hide();
} else if (_overview || _history->peer()) { } else if (_overview || _history->peer()) {
_topBar->show(); _topBar->show();
@ -2593,9 +2649,9 @@ void MainWidget::resizeEvent(QResizeEvent *e) {
} }
} }
_mediaType->moveToLeft(width() - _mediaType->width(), _playerHeight + st::topBarHeight); _mediaType->moveToLeft(width() - _mediaType->width(), _playerHeight + st::topBarHeight);
if (_profile) { if (_wideSection) {
QRect profileGeometry(_history->x(), _playerHeight, _history->width(), height() - _playerHeight); QRect wideSectionGeometry(_history->x(), _playerHeight, _history->width(), height() - _playerHeight);
_profile->setGeometryWithTopMoved(profileGeometry, _contentScrollAddToY); _wideSection->setGeometryWithTopMoved(wideSectionGeometry, _contentScrollAddToY);
} }
if (_overview) _overview->setGeometry(_history->geometry()); if (_overview) _overview->setGeometry(_history->geometry());
_contentScrollAddToY = 0; _contentScrollAddToY = 0;
@ -2611,20 +2667,21 @@ void MainWidget::keyPressEvent(QKeyEvent *e) {
void MainWidget::updateAdaptiveLayout() { void MainWidget::updateAdaptiveLayout() {
showAll(); showAll();
_sideShadow.setVisible(!Adaptive::OneColumn()); _sideShadow.setVisible(!Adaptive::OneColumn());
if (_wideSection) {
_wideSection->updateAdaptiveLayout();
}
_topBar->updateAdaptiveLayout(); _topBar->updateAdaptiveLayout();
_history->updateAdaptiveLayout(); _history->updateAdaptiveLayout();
} }
bool MainWidget::needBackButton() { bool MainWidget::needBackButton() {
return _overview || _profile || (_history->peer() && _history->peer()->id); return _overview || _wideSection || _history->peer();
} }
void MainWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { void MainWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) {
if (_profile) { if (_overview) {
// _profile->paintTopBar(p, over, decreaseWidth);
} else if (_overview) {
_overview->paintTopBar(p, over, decreaseWidth); _overview->paintTopBar(p, over, decreaseWidth);
} else { } else if (!_wideSection) {
_history->paintTopBar(p, over, decreaseWidth); _history->paintTopBar(p, over, decreaseWidth);
} }
} }
@ -2668,11 +2725,9 @@ PlayerWidget *MainWidget::player() {
} }
void MainWidget::onTopBarClick() { void MainWidget::onTopBarClick() {
if (_profile) { if (_overview) {
// _profile->topBarClick();
} else if (_overview) {
_overview->topBarClick(); _overview->topBarClick();
} else { } else if (!_wideSection) {
_history->topBarClick(); _history->topBarClick();
} }
} }
@ -3308,7 +3363,7 @@ void MainWidget::openPeerByName(const QString &username, MsgId msgId, const QStr
// Always open bot chats, even from mention links. // Always open bot chats, even from mention links.
Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId); Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId);
} else { } else {
showPeerProfile(peer); Ui::showPeerProfile(peer);
} }
} else { } else {
if (msgId == ShowAtProfileMsgId || !peer->isChannel()) { // show specific posts only in channels / supergroups if (msgId == ShowAtProfileMsgId || !peer->isChannel()) { // show specific posts only in channels / supergroups
@ -3391,7 +3446,7 @@ void MainWidget::usernameResolveDone(QPair<MsgId, QString> msgIdAndStartToken, c
// Always open bot chats, even from mention links. // Always open bot chats, even from mention links.
Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId); Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId);
} else { } else {
showPeerProfile(peer); Ui::showPeerProfile(peer);
} }
} else { } else {
if (msgId == ShowAtProfileMsgId || !peer->isChannel()) { // show specific posts only in channels / supergroups if (msgId == ShowAtProfileMsgId || !peer->isChannel()) { // show specific posts only in channels / supergroups
@ -3690,7 +3745,7 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
void MainWidget::activate() { void MainWidget::activate() {
if (_a_show.animating()) return; if (_a_show.animating()) return;
if (!_profile && !_overview) { if (!_wideSection && !_overview) {
if (_hider) { if (_hider) {
if (_hider->wasOffered()) { if (_hider->wasOffered()) {
_hider->setFocus(); _hider->setFocus();
@ -3724,7 +3779,7 @@ bool MainWidget::isActive() const {
} }
bool MainWidget::historyIsActive() const { bool MainWidget::historyIsActive() const {
return isActive() && !_profile && !_overview && _history->isActive(); return isActive() && !_wideSection && !_overview && _history->isActive();
} }
bool MainWidget::lastWasOnline() const { bool MainWidget::lastWasOnline() const {

View file

@ -33,18 +33,16 @@ class PeerAvatarButton;
namespace Window { namespace Window {
class TopBarWidget; class TopBarWidget;
class SectionMemento;
class SectionWidget;
struct SectionSlideParams;
} // namespace Window } // namespace Window
namespace Profile {
class Widget;
} // namespace Profile
class MainWindow; class MainWindow;
class ApiWrap; class ApiWrap;
class ConfirmBox; class ConfirmBox;
class DialogsWidget; class DialogsWidget;
class HistoryWidget; class HistoryWidget;
class ProfileWidget;
class OverviewWidget; class OverviewWidget;
class PlayerWidget; class PlayerWidget;
class HistoryHider; class HistoryHider;
@ -52,7 +50,7 @@ class Dropdown;
enum StackItemType { enum StackItemType {
HistoryStackItem, HistoryStackItem,
ProfileStackItem, SectionStackItem,
OverviewStackItem, OverviewStackItem,
}; };
@ -68,8 +66,9 @@ public:
class StackItemHistory : public StackItem { class StackItemHistory : public StackItem {
public: public:
StackItemHistory(PeerData *peer, MsgId msgId, QList<MsgId> replyReturns) : StackItem(peer), StackItemHistory(PeerData *peer, MsgId msgId, QList<MsgId> replyReturns) : StackItem(peer)
msgId(msgId), replyReturns(replyReturns) { , msgId(msgId)
, replyReturns(replyReturns) {
} }
StackItemType type() const { StackItemType type() const {
return HistoryStackItem; return HistoryStackItem;
@ -78,19 +77,29 @@ msgId(msgId), replyReturns(replyReturns) {
QList<MsgId> replyReturns; QList<MsgId> replyReturns;
}; };
class StackItemProfile : public StackItem { class StackItemSection : public StackItem {
public: public:
StackItemProfile(PeerData *peer, int32 lastScrollTop) : StackItem(peer), lastScrollTop(lastScrollTop) { StackItemSection(std_::unique_ptr<Window::SectionMemento> &&memento);
} ~StackItemSection();
StackItemType type() const { StackItemType type() const {
return ProfileStackItem; return SectionStackItem;
} }
int32 lastScrollTop; Window::SectionMemento *memento() const {
return _memento.get();
}
private:
std_::unique_ptr<Window::SectionMemento> _memento;
}; };
class StackItemOverview : public StackItem { class StackItemOverview : public StackItem {
public: public:
StackItemOverview(PeerData *peer, MediaOverviewType mediaType, int32 lastWidth, int32 lastScrollTop) : StackItem(peer), mediaType(mediaType), lastWidth(lastWidth), lastScrollTop(lastScrollTop) { StackItemOverview(PeerData *peer, MediaOverviewType mediaType, int32 lastWidth, int32 lastScrollTop) : StackItem(peer)
, mediaType(mediaType)
, lastWidth(lastWidth)
, lastScrollTop(lastScrollTop) {
} }
StackItemType type() const { StackItemType type() const {
return OverviewStackItem; return OverviewStackItem;
@ -214,14 +223,14 @@ public:
PeerData *activePeer(); PeerData *activePeer();
MsgId activeMsgId(); MsgId activeMsgId();
PeerData *profilePeer();
PeerData *overviewPeer(); PeerData *overviewPeer();
bool mediaTypeSwitch(); bool mediaTypeSwitch();
void showPeerProfile(PeerData *peer, bool back = false, int32 lastScrollTop = -1); void showWideSection(Window::SectionMemento &memento);
void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1); void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1);
void showBackFromStack(); void showBackFromStack();
void orderWidgets(); void orderWidgets();
QRect historyRect() const; QRect historyRect() const;
QPixmap grabForShowAnimation(const Window::SectionSlideParams &params);
void onSendFileConfirm(const FileLoadResultPtr &file, bool ctrlShiftEnter); void onSendFileConfirm(const FileLoadResultPtr &file, bool ctrlShiftEnter);
void onSendFileCancel(const FileLoadResultPtr &file); void onSendFileCancel(const FileLoadResultPtr &file);
@ -485,7 +494,6 @@ public slots:
void ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId); void ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId);
private: private:
void sendReadRequest(PeerData *peer, MsgId upTo); void sendReadRequest(PeerData *peer, MsgId upTo);
void channelWasRead(PeerData *peer, const MTPBool &result); void channelWasRead(PeerData *peer, const MTPBool &result);
void historyWasRead(PeerData *peer, const MTPmessages_AffectedMessages &result); void historyWasRead(PeerData *peer, const MTPmessages_AffectedMessages &result);
@ -495,6 +503,15 @@ private:
void messagesAffected(PeerData *peer, const MTPmessages_AffectedMessages &result); void messagesAffected(PeerData *peer, const MTPmessages_AffectedMessages &result);
void overviewLoaded(History *history, const MTPmessages_Messages &result, mtpRequestId req); void overviewLoaded(History *history, const MTPmessages_Messages &result, mtpRequestId req);
Window::SectionSlideParams prepareShowAnimation(bool willHaveTopBarShadow);
void showWideSectionAnimated(Window::SectionMemento *memento, bool back);
// All this methods use the prepareShowAnimation().
Window::SectionSlideParams prepareWideSectionAnimation(Window::SectionWidget *section);
Window::SectionSlideParams prepareHistoryAnimation(PeerId historyPeerId);
Window::SectionSlideParams prepareOverviewAnimation();
Window::SectionSlideParams prepareDialogsAnimation();
bool _started = false; bool _started = false;
uint64 failedObjId = 0; uint64 failedObjId = 0;
@ -564,7 +581,7 @@ private:
ChildWidget<DialogsWidget> _dialogs; ChildWidget<DialogsWidget> _dialogs;
ChildWidget<HistoryWidget> _history; ChildWidget<HistoryWidget> _history;
ChildWidget<Profile::Widget> _profile = { nullptr }; ChildWidget<Window::SectionWidget> _wideSection = { nullptr };
ChildWidget<OverviewWidget> _overview = { nullptr }; ChildWidget<OverviewWidget> _overview = { nullptr };
ChildWidget<PlayerWidget> _player; ChildWidget<PlayerWidget> _player;
ChildWidget<Window::TopBarWidget> _topBar; ChildWidget<Window::TopBarWidget> _topBar;

View file

@ -1838,7 +1838,7 @@ void MediaView::mouseReleaseEvent(QMouseEvent *e) {
if (_over == OverName && _down == OverName) { if (_over == OverName && _down == OverName) {
if (App::wnd() && _from) { if (App::wnd() && _from) {
close(); close();
if (App::main()) App::main()->showPeerProfile(_from); Ui::showPeerProfile(_from);
} }
} else if (_over == OverDate && _down == OverDate) { } else if (_over == OverDate && _down == OverDate) {
onToMessage(); onToMessage();

View file

@ -1987,15 +1987,25 @@ void OverviewWidget::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
if (_a_show.animating()) { if (_a_show.animating()) {
if (a_coordOver.current() > 0) { int retina = cIntRetinaFactor();
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor())); int inCacheTop = st::topBarHeight;
p.setOpacity(a_shadow.current() * st::slideFadeOut); if (a_progress.current() < 1) {
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b); int underLeft = a_coordUnder.current();
p.setOpacity(1); int underWidth = _cacheUnder.width() / retina;
int underHeight = height();
p.fillRect(e->rect(), st::white);
QRect underDst(0, 0, underWidth + underLeft, underHeight);
QRect underSrc(-underLeft * retina, inCacheTop * retina, (underWidth + underLeft) * retina, underHeight * retina);
p.setOpacity(1. - a_progress.current());
p.drawPixmap(underDst, _cacheUnder, underSrc);
p.setOpacity(a_progress.current());
} }
p.drawPixmap(a_coordOver.current(), 0, _cacheOver); int overLeft = a_coordOver.current();
p.setOpacity(a_shadow.current()); int overWidth = _cacheOver.width() / retina;
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), height()), App::sprite(), st::slideShadow.rect()); int overHeight = height();
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
QRect overSrc(0, inCacheTop * retina, (overWidth - overLeft) * retina, overHeight * retina);
p.drawPixmap(overDst, _cacheOver, overSrc);
return; return;
} }
@ -2020,10 +2030,24 @@ void OverviewWidget::scrollReset() {
void OverviewWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) { void OverviewWidget::paintTopBar(Painter &p, float64 over, int32 decreaseWidth) {
if (_a_show.animating()) { if (_a_show.animating()) {
p.drawPixmap(a_coordUnder.current(), 0, _cacheTopBarUnder); int retina = cIntRetinaFactor();
p.drawPixmap(a_coordOver.current(), 0, _cacheTopBarOver); if (a_progress.current() < 1) {
p.setOpacity(a_shadow.current()); int underLeft = a_coordUnder.current();
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), st::topBarHeight), App::sprite(), st::slideShadow.rect()); int underWidth = _cacheUnder.width() / retina;
int underHeight = st::topBarHeight;
p.fillRect(0, 0, underWidth, underHeight, st::white);
QRect underDst(0, 0, underWidth + underLeft, underHeight);
QRect underSrc(-underLeft * retina, 0, (underWidth + underLeft) * retina, underHeight * retina);
p.setOpacity(1. - a_progress.current());
p.drawPixmap(underDst, _cacheUnder, underSrc);
p.setOpacity(a_progress.current());
}
int overLeft = a_coordOver.current();
int overWidth = _cacheOver.width() / retina;
int overHeight = st::topBarHeight;
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
QRect overSrc(0, 0, (overWidth - overLeft) * retina, overHeight * retina);
p.drawPixmap(overDst, _cacheOver, overSrc);
return; return;
} }
p.setOpacity(st::topBarBackAlpha + (1 - st::topBarBackAlpha) * over); p.setOpacity(st::topBarBackAlpha + (1 - st::topBarBackAlpha) * over);
@ -2127,31 +2151,40 @@ void OverviewWidget::fastShow(bool back, int32 lastScrollTop) {
if (App::app()) App::app()->mtpUnpause(); if (App::app()) App::app()->mtpUnpause();
} }
void OverviewWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back, int32 lastScrollTop) { void OverviewWidget::setLastScrollTop(int lastScrollTop) {
if (App::app()) App::app()->mtpPause();
(back ? _cacheOver : _cacheUnder) = bgAnimCache;
(back ? _cacheTopBarOver : _cacheTopBarUnder) = bgAnimTopBarCache;
resizeEvent(0); resizeEvent(0);
_scroll.scrollToY(lastScrollTop < 0 ? countBestScroll() : lastScrollTop); _scroll.scrollToY(lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
(back ? _cacheUnder : _cacheOver) = myGrab(this); }
App::main()->topBar()->stopAnim();
(back ? _cacheTopBarUnder : _cacheTopBarOver) = myGrab(App::main()->topBar()); void OverviewWidget::showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params) {
if (App::app()) App::app()->mtpPause();
resizeEvent(0);
_cacheUnder = params.oldContentCache;
show();
_topShadow.setVisible(params.withTopBarShadow ? false : true);
_cacheOver = App::main()->grabForShowAnimation(params);
_topShadow.setVisible(params.withTopBarShadow ? true : false);
App::main()->topBar()->startAnim(); App::main()->topBar()->startAnim();
_scrollSetAfterShow = _scroll.scrollTop(); _scrollSetAfterShow = _scroll.scrollTop();
_scroll.hide(); _scroll.hide();
_topShadow.hide();
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift); int delta = st::slideShift;
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0); a_progress = anim::fvalue(0, 1);
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1); if (direction == Window::SlideDirection::FromLeft) {
a_coordUnder = anim::ivalue(0, delta);
a_coordOver = anim::ivalue(-delta, 0);
} else {
a_coordUnder = anim::ivalue(0, -delta);
a_coordOver = anim::ivalue(delta, 0);
}
_a_show.start(); _a_show.start();
show();
App::main()->topBar()->update(); App::main()->topBar()->update();
_inner.activate();
activate();
} }
void OverviewWidget::step_show(float64 ms, bool timer) { void OverviewWidget::step_show(float64 ms, bool timer) {
@ -2162,8 +2195,8 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
a_coordUnder.finish(); a_coordUnder.finish();
a_coordOver.finish(); a_coordOver.finish();
a_shadow.finish(); a_progress.finish();
_cacheUnder = _cacheOver = _cacheTopBarUnder = _cacheTopBarOver = QPixmap(); _cacheUnder = _cacheOver = QPixmap();
App::main()->topBar()->stopAnim(); App::main()->topBar()->stopAnim();
doneShow(); doneShow();
@ -2172,7 +2205,7 @@ void OverviewWidget::step_show(float64 ms, bool timer) {
} else { } else {
a_coordUnder.update(dt, st::slideFunction); a_coordUnder.update(dt, st::slideFunction);
a_coordOver.update(dt, st::slideFunction); a_coordOver.update(dt, st::slideFunction);
a_shadow.update(dt, st::slideFunction); a_progress.update(dt, st::slideFunction);
} }
if (timer) { if (timer) {
update(); update();

View file

@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "window/section_widget.h"
namespace Overview { namespace Overview {
namespace Layout { namespace Layout {
@ -276,7 +278,11 @@ public:
int32 countBestScroll() const; int32 countBestScroll() const;
void fastShow(bool back = false, int32 lastScrollTop = -1); void fastShow(bool back = false, int32 lastScrollTop = -1);
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1); bool hasTopBarShadow() const {
return true;
}
void setLastScrollTop(int lastScrollTop);
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params);
void step_show(float64 ms, bool timer); void step_show(float64 ms, bool timer);
void doneShow(); void doneShow();
@ -302,9 +308,14 @@ public:
_inGrab = true; _inGrab = true;
resizeEvent(0); resizeEvent(0);
} }
void grapWithoutTopBarShadow() {
grabStart();
_topShadow.hide();
}
void grabFinish() override { void grabFinish() override {
_inGrab = false; _inGrab = false;
resizeEvent(0); resizeEvent(0);
_topShadow.show();
} }
void rpcClear() override { void rpcClear() override {
_inner.rpcClear(); _inner.rpcClear();
@ -340,9 +351,9 @@ private:
QString _header; QString _header;
Animation _a_show; Animation _a_show;
QPixmap _cacheUnder, _cacheOver, _cacheTopBarUnder, _cacheTopBarOver; QPixmap _cacheUnder, _cacheOver;
anim::ivalue a_coordUnder, a_coordOver; anim::ivalue a_coordUnder, a_coordOver;
anim::fvalue a_shadow; anim::fvalue a_progress;
int32 _scrollSetAfterShow; int32 _scrollSetAfterShow;

View file

@ -44,7 +44,7 @@ void InnerWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) {
int notDisplayedAtBottom = height() - _visibleBottom; int notDisplayedAtBottom = height() - _visibleBottom;
if (notDisplayedAtBottom > 0) { if (notDisplayedAtBottom > 0) {
decreaseAdditionalHeight(notDisplayedAtBottom); // decreaseAdditionalHeight(notDisplayedAtBottom);
} }
//loadProfilePhotos(_visibleTop); //loadProfilePhotos(_visibleTop);
@ -65,6 +65,10 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.fillRect(e->rect(), st::white); p.fillRect(e->rect(), st::white);
} }
void InnerWidget::mousePressEvent(QMouseEvent *e) { // TEMP for testing
Ui::showPeerOverview(_peer, OverviewPhotos);
}
int InnerWidget::resizeGetHeight(int newWidth) { int InnerWidget::resizeGetHeight(int newWidth) {
_cover->resizeToWidth(newWidth); _cover->resizeToWidth(newWidth);
int newHeight = _cover->height(); int newHeight = _cover->height();

View file

@ -43,6 +43,7 @@ public:
protected: protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
void mousePressEvent(QMouseEvent *e) override; // TEMP for testing
private: private:
// Resizes content and counts natural widget height for the desired width. // Resizes content and counts natural widget height for the desired width.

View file

@ -0,0 +1,35 @@
/*
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_section_memento.h"
#include "profile/profile_widget.h"
namespace Profile {
Window::SectionWidget *SectionMemento::createWidget(QWidget *parent, const QRect &geometry) const {
auto result = new Widget(parent, _peer);
result->setGeometry(geometry);
result->setInternalState(this);
return result;
}
} // namespace Profile

View file

@ -0,0 +1,44 @@
/*
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
#include "window/section_memento.h"
namespace Profile {
class Widget;
class SectionMemento : public Window::SectionMemento {
public:
SectionMemento(PeerData *peer) : _peer(peer) {
}
Window::SectionWidget *createWidget(QWidget *parent, const QRect &geometry) const override;
private:
friend class Widget;
PeerData *_peer;
int _scrollTop = 0;
};
} // namespace Window

View file

@ -23,19 +23,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "profile/profile_fixed_bar.h" #include "profile/profile_fixed_bar.h"
#include "profile/profile_inner_widget.h" #include "profile/profile_inner_widget.h"
#include "profile/profile_section_memento.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "application.h" #include "application.h"
namespace Profile { namespace Profile {
Widget::Widget(QWidget *parent, PeerData *peer) : TWidget(parent) Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
, _fixedBar(this, peer) , _fixedBar(this, peer)
, _fixedBarShadow(this, st::shadowColor)
, _scroll(this, st::setScroll) , _scroll(this, st::setScroll)
, _inner(this, peer) { , _inner(this, peer) {
_fixedBar->move(0, 0); _fixedBar->move(0, 0);
_fixedBar->resizeToWidth(width()); _fixedBar->resizeToWidth(width());
_fixedBar->show(); _fixedBar->show();
_fixedBarShadow->setMode(ToggleableShadow::Mode::HiddenFast);
_fixedBarShadow->raise();
updateAdaptiveLayout();
_scroll->setWidget(_inner); _scroll->setWidget(_inner);
_scroll->move(0, _fixedBar->height()); _scroll->move(0, _fixedBar->height());
_scroll->show(); _scroll->show();
@ -44,86 +50,85 @@ Widget::Widget(QWidget *parent, PeerData *peer) : TWidget(parent)
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
} }
void Widget::updateAdaptiveLayout() {
_fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height());
}
PeerData *Widget::peer() const { PeerData *Widget::peer() const {
return _inner->peer(); return _inner->peer();
} }
void Widget::setGeometryWithTopMoved(const QRect &newGeometry, int topDelta) { QPixmap Widget::grabForShowAnimation(const Window::SectionSlideParams &params) {
_topDelta = topDelta; if (params.withTopBarShadow) _fixedBarShadow->hide();
bool willBeResized = (size() != newGeometry.size()); auto result = myGrab(this);
if (geometry() != newGeometry) { if (params.withTopBarShadow) _fixedBarShadow->show();
setGeometry(newGeometry); return result;
}
if (!willBeResized) {
resizeEvent(nullptr);
}
_topDelta = 0;
}
void Widget::showAnimated(SlideDirection direction, const QPixmap &oldContentCache) {
_showAnimation = nullptr;
showChildren();
_fixedBar->setAnimatingMode(false);
auto myContentCache = myGrab(this);
hideChildren();
_fixedBar->setAnimatingMode(true);
_showAnimation = std_::make_unique<SlideAnimation>();
_showAnimation->setDirection(direction);
_showAnimation->setRepaintCallback(func(this, &Widget::repaintCallback));
_showAnimation->setFinishedCallback(func(this, &Widget::showFinished));
_showAnimation->setPixmaps(oldContentCache, myContentCache);
_showAnimation->start();
show();
} }
void Widget::setInnerFocus() { void Widget::setInnerFocus() {
_inner->setFocus(); _inner->setFocus();
} }
bool Widget::showInternal(Window::SectionMemento *memento) {
if (auto profileMemento = dynamic_cast<SectionMemento*>(memento)) {
if (profileMemento->_peer == peer()) {
// Perhaps no need to do that?..
_scroll->scrollToY(profileMemento->_scrollTop);
return true;
}
}
return false;
}
void Widget::setInternalState(const SectionMemento *memento) {
myEnsureResized(this);
_scroll->scrollToY(memento->_scrollTop);
_fixedBarShadow->setMode(memento->_scrollTop > 0 ? ToggleableShadow::Mode::ShownFast : ToggleableShadow::Mode::HiddenFast);
}
std_::unique_ptr<Window::SectionMemento> Widget::createMemento() const {
auto result = std_::make_unique<SectionMemento>(peer());
result->_scrollTop = _scroll->scrollTop();
return std_::move(result);
}
void Widget::resizeEvent(QResizeEvent *e) { void Widget::resizeEvent(QResizeEvent *e) {
int newScrollTop = _scroll->scrollTop() + _topDelta; if (!width() || !height()) {
return;
}
int newScrollTop = _scroll->scrollTop() + topDelta();
_fixedBar->resizeToWidth(width()); _fixedBar->resizeToWidth(width());
_fixedBarShadow->resize(width(), st::lineWidth);
QSize scrollSize(width(), height() - _fixedBar->height()); QSize scrollSize(width(), height() - _fixedBar->height());
if (_scroll->size() != scrollSize) { if (_scroll->size() != scrollSize) {
_scroll->resize(scrollSize); _scroll->resize(scrollSize);
_inner->resizeToWidth(scrollSize.width(), _scroll->height()); _inner->resizeToWidth(scrollSize.width(), _scroll->height() * 2);
} }
if (!_scroll->isHidden()) { if (!_scroll->isHidden()) {
if (_topDelta) { if (topDelta()) {
_scroll->scrollToY(newScrollTop); _scroll->scrollToY(newScrollTop);
} }
int scrollTop = _scroll->scrollTop(); int scrollTop = _scroll->scrollTop();
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height()); _inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
} _fixedBarShadow->setMode((scrollTop > 0) ? ToggleableShadow::Mode::Shown : ToggleableShadow::Mode::Hidden);
}
void Widget::paintEvent(QPaintEvent *e) {
if (Ui::skipPaintEvent(this, e)) return;
if (_showAnimation) {
Painter p(this);
_showAnimation->paintContents(p, e->rect());
} }
} }
void Widget::onScroll() { void Widget::onScroll() {
int scrollTop = _scroll->scrollTop(); int scrollTop = _scroll->scrollTop();
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height()); _inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
_fixedBarShadow->setMode((scrollTop > 0) ? ToggleableShadow::Mode::Shown : ToggleableShadow::Mode::Hidden);
} }
void Widget::showFinished() { void Widget::showAnimatedHook() {
if (isHidden()) return; _fixedBar->setAnimatingMode(true);
}
App::app()->mtpUnpause(); void Widget::showFinishedHook() {
showChildren();
_fixedBar->setAnimatingMode(false); _fixedBar->setAnimatingMode(false);
setInnerFocus();
} }
} // namespace Profile } // namespace Profile

View file

@ -20,53 +20,57 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "ui/slide_animation.h" #include "window/section_widget.h"
class ScrollArea; class ScrollArea;
namespace Profile { namespace Profile {
class SectionMemento;
class InnerWidget; class InnerWidget;
class FixedBar; class FixedBar;
class Widget final : public TWidget { class Widget final : public Window::SectionWidget {
Q_OBJECT Q_OBJECT
public: public:
Widget(QWidget *parent, PeerData *peer); Widget(QWidget *parent, PeerData *peer);
PeerData *peer() const; PeerData *peer() const;
PeerData *peerForDialogs() const override {
return peer();
}
// When resizing the widget with top edge moved up or down and we bool hasTopBarShadow() const override {
// want to add this top movement to the scroll position, so inner return _fixedBarShadow->isFullyShown();
// content will not move. }
void setGeometryWithTopMoved(const QRect &newGeometry, int topDelta);
void showAnimated(SlideDirection direction, const QPixmap &oldContentCache); QPixmap grabForShowAnimation(const Window::SectionSlideParams &params) override;
void setInnerFocus(); void setInnerFocus() override;
void updateAdaptiveLayout() override;
bool showInternal(Window::SectionMemento *memento) override;
std_::unique_ptr<Window::SectionMemento> createMemento() const override;
void setInternalState(const SectionMemento *memento);
protected: protected:
void resizeEvent(QResizeEvent *e) override; void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void showAnimatedHook() override;
void showFinishedHook() override;
private slots: private slots:
void onScroll(); void onScroll();
private: private:
// QWidget::update() method is overloaded and we need template deduction. friend class SectionMemento;
void repaintCallback() {
update();
}
void showFinished();
ChildWidget<FixedBar> _fixedBar;
ChildWidget<ScrollArea> _scroll; ChildWidget<ScrollArea> _scroll;
ChildWidget<InnerWidget> _inner; ChildWidget<InnerWidget> _inner;
ChildWidget<FixedBar> _fixedBar;
std_::unique_ptr<SlideAnimation> _showAnimation; ChildWidget<ToggleableShadow> _fixedBarShadow;
// Saving here topDelta in resizeWithTopMoved() to get it passed to resizeEvent().
int _topDelta = 0;
}; };

View file

@ -1170,7 +1170,7 @@ void ProfileInner::mousePressEvent(QMouseEvent *e) {
_kickDown = _kickOver; _kickDown = _kickOver;
update(); update();
} else if (_selectedRow >= 0 && _selectedRow < _participants.size()) { } else if (_selectedRow >= 0 && _selectedRow < _participants.size()) {
App::main()->showPeerProfile(_participants[_selectedRow]); Ui::showPeerProfile(_participants[_selectedRow]);
} else if (QRect(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize).contains(e->pos())) { } else if (QRect(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize).contains(e->pos())) {
if (_photoLink) { if (_photoLink) {
_photoLink->onClick(e->button()); _photoLink->onClick(e->button());

View file

@ -1502,7 +1502,7 @@ void PeerOpenClickHandler::onClickImpl() const {
Ui::showPeerHistory(peer(), ShowAtUnreadMsgId); Ui::showPeerHistory(peer(), ShowAtUnreadMsgId);
} }
} else { } else {
App::main()->showPeerProfile(peer()); Ui::showPeerProfile(peer());
} }
} }
} }

View file

@ -365,7 +365,7 @@ public:
using Callback = Function<void>; using Callback = Function<void>;
SimpleAnimation() : _data(0) { SimpleAnimation() {
} }
bool animating(uint64 ms) { bool animating(uint64 ms) {
@ -376,7 +376,7 @@ public:
return false; return false;
} }
bool isNull() { bool isNull() const {
return !_data; return !_data;
} }
@ -384,6 +384,10 @@ public:
return _data ? _data->a.current() : typename AnimType::Type(); return _data ? _data->a.current() : typename AnimType::Type();
} }
typename AnimType::Type current(const typename AnimType::Type &def) {
return _data ? _data->a.current() : def;
}
typename AnimType::Type current(uint64 ms, const typename AnimType::Type &def) { typename AnimType::Type current(uint64 ms, const typename AnimType::Type &def) {
return animating(ms) ? current() : def; return animating(ms) ? current() : def;
} }
@ -405,6 +409,17 @@ public:
} }
} }
void finish() {
if (isNull()) {
return;
}
_data->a.finish();
_data->_a.stop();
delete _data;
_data = nullptr;
}
~SimpleAnimation() { ~SimpleAnimation() {
deleteAndMark(_data); deleteAndMark(_data);
} }
@ -424,7 +439,7 @@ private:
float64 duration; float64 duration;
anim::transition transition; anim::transition transition;
}; };
Data *_data; Data *_data = nullptr;
void step(float64 ms, bool timer) { void step(float64 ms, bool timer) {
float64 dt = (ms >= _data->duration) ? 1 : (ms / _data->duration); float64 dt = (ms >= _data->duration) ? 1 : (ms / _data->duration);
@ -439,15 +454,15 @@ private:
} }
if (!_data->_a.animating()) { if (!_data->_a.animating()) {
delete _data; delete _data;
_data = 0; _data = nullptr;
} }
} }
}; };
typedef SimpleAnimation<anim::fvalue> FloatAnimation; using FloatAnimation = SimpleAnimation<anim::fvalue>;
typedef SimpleAnimation<anim::ivalue> IntAnimation; using IntAnimation = SimpleAnimation<anim::ivalue>;
typedef SimpleAnimation<anim::cvalue> ColorAnimation; using ColorAnimation = SimpleAnimation<anim::cvalue>;
#define EnsureAnimation(animation, from, callback) if ((animation).isNull()) { (animation).setup((from), (callback)); } #define EnsureAnimation(animation, from, callback) if ((animation).isNull()) { (animation).setup((from), (callback)); }

View file

@ -77,3 +77,45 @@ QPixmap myGrab(TWidget *target, QRect rect) {
return result; return result;
} }
enum class Mode {
Shown,
ShownFast,
Hidden,
HiddenFast
};
void ToggleableShadow::setMode(Mode mode) {
if (mode == Mode::ShownFast || mode == Mode::HiddenFast) {
if (!_a_opacity.isNull()) {
_a_opacity.finish();
update();
}
}
if (_shown && (mode == Mode::Hidden || mode == Mode::HiddenFast)) {
_shown = false;
if (mode == Mode::Hidden) {
if (_a_opacity.isNull()) {
_a_opacity.setup(1., func(this, &ToggleableShadow::repaintCallback));
}
_a_opacity.start(0., st::shadowToggleDuration);
}
} else if (!_shown && (mode == Mode::Shown || mode == Mode::ShownFast)) {
_shown = true;
if (mode == Mode::Shown) {
if (_a_opacity.isNull()) {
_a_opacity.setup(0., func(this, &ToggleableShadow::repaintCallback));
}
_a_opacity.start(1., st::shadowToggleDuration);
}
}
}
void ToggleableShadow::paintEvent(QPaintEvent *e) {
Painter p(this);
if (_a_opacity.animating(getms())) {
p.setOpacity(_a_opacity.current());
} else if (!_shown) {
return;
}
p.fillRect(e->rect(), _color);
}

View file

@ -208,7 +208,9 @@ class PlainShadow : public TWidget {
public: public:
PlainShadow(QWidget *parent, const style::color &color) : TWidget(parent), _color(color) { PlainShadow(QWidget *parent, const style::color &color) : TWidget(parent), _color(color) {
} }
void paintEvent(QPaintEvent *e) {
protected:
void paintEvent(QPaintEvent *e) override {
Painter(this).fillRect(e->rect(), _color->b); Painter(this).fillRect(e->rect(), _color->b);
} }
@ -217,6 +219,37 @@ private:
}; };
class ToggleableShadow : public TWidget {
public:
ToggleableShadow(QWidget *parent, const style::color &color) : TWidget(parent), _color(color) {
}
enum class Mode {
Shown,
ShownFast,
Hidden,
HiddenFast
};
void setMode(Mode mode);
bool isFullyShown() const {
return _shown && _a_opacity.isNull();
}
protected:
void paintEvent(QPaintEvent *e) override;
private:
void repaintCallback() {
update();
}
const style::color &_color;
FloatAnimation _a_opacity;
bool _shown = true;
};
class SingleDelayedCall : public QObject { class SingleDelayedCall : public QObject {
Q_OBJECT Q_OBJECT

View file

@ -0,0 +1,33 @@
/*
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 Window {
class SectionWidget;
class SectionMemento {
public:
virtual SectionWidget *createWidget(QWidget *parent, const QRect &geometry) const = 0;
};
} // namespace Window

View file

@ -0,0 +1,82 @@
/*
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 "window/section_widget.h"
#include "application.h"
namespace Window {
SectionWidget::SectionWidget(QWidget *parent) : TWidget(parent) {
}
void SectionWidget::setGeometryWithTopMoved(const QRect &newGeometry, int topDelta) {
_topDelta = topDelta;
bool willBeResized = (size() != newGeometry.size());
if (geometry() != newGeometry) {
setGeometry(newGeometry);
}
if (!willBeResized) {
resizeEvent(nullptr);
}
_topDelta = 0;
}
void SectionWidget::showAnimated(SlideDirection direction, const SectionSlideParams &params) {
t_assert(_showAnimation == nullptr);
showChildren();
auto myContentCache = grabForShowAnimation(params);
hideChildren();
showAnimatedHook();
_showAnimation = std_::make_unique<SlideAnimation>();
_showAnimation->setDirection(direction);
_showAnimation->setRepaintCallback(func(this, &SectionWidget::repaintCallback));
_showAnimation->setFinishedCallback(func(this, &SectionWidget::showFinished));
_showAnimation->setPixmaps(params.oldContentCache, myContentCache);
_showAnimation->setTopBarShadow(params.withTopBarShadow);
_showAnimation->start();
show();
}
void SectionWidget::paintEvent(QPaintEvent *e) {
if (Ui::skipPaintEvent(this, e)) return;
if (_showAnimation) {
Painter p(this);
_showAnimation->paintContents(p, e->rect());
}
}
void SectionWidget::showFinished() {
if (isHidden()) return;
App::app()->mtpUnpause();
showChildren();
showFinishedHook();
setInnerFocus();
}
} // namespace Window

View file

@ -0,0 +1,108 @@
/*
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
#include "ui/twidget.h"
#include "window/slide_animation.h"
namespace Window {
class SectionMemento;
struct SectionSlideParams {
QPixmap oldContentCache;
bool withTopBarShadow = false;
};
class SectionWidget : public TWidget {
Q_OBJECT
public:
SectionWidget(QWidget *parent);
virtual PeerData *peerForDialogs() const {
return nullptr;
}
// When resizing the widget with top edge moved up or down and we
// want to add this top movement to the scroll position, so inner
// content will not move.
void setGeometryWithTopMoved(const QRect &newGeometry, int topDelta);
virtual bool hasTopBarShadow() const {
return false;
}
void showAnimated(SlideDirection direction, const SectionSlideParams &params);
// This can be used to grab with or without top bar shadow.
// This will be protected when animation preparation will be done inside.
virtual QPixmap grabForShowAnimation(const SectionSlideParams &params) {
return myGrab(this);
}
// Attempt to show the required section inside the existing one.
// For example if this section already shows exactly the required
// memento it can simply return true - it is shown already.
virtual bool showInternal(SectionMemento *memento) = 0;
// Create a memento of that section to store it in the history stack.
virtual std_::unique_ptr<SectionMemento> createMemento() const = 0;
virtual void setInnerFocus() {
setFocus();
}
virtual void updateAdaptiveLayout() {
}
protected:
void paintEvent(QPaintEvent *e) override;
// Temp variable used in resizeEvent() implementation, that is passed
// to setGeometryWithTopMoved() to adjust the scroll position with the resize.
int topDelta() const {
return _topDelta;
}
// Called after the hideChildren() call in showAnimated().
virtual void showAnimatedHook() {
}
// Called after the showChildren() call in showFinished().
virtual void showFinishedHook() {
}
private:
// QWidget::update() method is overloaded and we need template deduction.
void repaintCallback() {
update();
}
void showFinished();
std_::unique_ptr<SlideAnimation> _showAnimation;
// Saving here topDelta in resizeWithTopMoved() to get it passed to resizeEvent().
int _topDelta = 0;
};
} // namespace Window

View file

@ -19,17 +19,20 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "ui/slide_animation.h" #include "window/slide_animation.h"
namespace Window {
SlideAnimation::SlideAnimation() SlideAnimation::SlideAnimation()
: _animation(animation(this, &SlideAnimation::step)) { : _animation(animation(this, &SlideAnimation::step)) {
} }
void SlideAnimation::paintContents(Painter &p, const QRect &update) const { void SlideAnimation::paintContents(Painter &p, const QRect &update) const {
int retina = cIntRetinaFactor();
_animation.step(getms()); _animation.step(getms());
if (a_progress.current() < 1) { if (a_progress.current() < 1) {
p.fillRect(update, st::white); p.fillRect(update, st::white);
int retina = cIntRetinaFactor();
int underLeft = a_coordUnder.current(); int underLeft = a_coordUnder.current();
int underWidth = _cacheUnder.width() / retina; int underWidth = _cacheUnder.width() / retina;
int underHeight = _cacheUnder.height() / retina; int underHeight = _cacheUnder.height() / retina;
@ -40,6 +43,11 @@ void SlideAnimation::paintContents(Painter &p, const QRect &update) const {
p.setOpacity(a_progress.current()); p.setOpacity(a_progress.current());
} }
p.drawPixmap(a_coordOver.current(), 0, _cacheOver); p.drawPixmap(a_coordOver.current(), 0, _cacheOver);
if (_topBarShadowEnabled) {
p.setOpacity(1);
p.fillRect(0, st::topBarHeight, _cacheOver.width() / retina, st::lineWidth, st::shadowColor);
}
} }
void SlideAnimation::setDirection(SlideDirection direction) { void SlideAnimation::setDirection(SlideDirection direction) {
@ -51,6 +59,10 @@ void SlideAnimation::setPixmaps(const QPixmap &oldContentCache, const QPixmap &n
_cacheOver = newContentCache; _cacheOver = newContentCache;
} }
void SlideAnimation::setTopBarShadow(bool enabled) {
_topBarShadowEnabled = enabled;
}
void SlideAnimation::setRepaintCallback(RepaintCallback &&callback) { void SlideAnimation::setRepaintCallback(RepaintCallback &&callback) {
_repaintCallback = std_::move(callback); _repaintCallback = std_::move(callback);
} }
@ -60,13 +72,11 @@ void SlideAnimation::setFinishedCallback(FinishedCallback &&callback) {
} }
void SlideAnimation::start() { void SlideAnimation::start() {
int width = _cacheUnder.width() / cIntRetinaFactor();
int delta = st::slideShift; int delta = st::slideShift;
a_progress = anim::fvalue(0, 1); a_progress = anim::fvalue(0, 1);
if (_direction == SlideDirection::FromLeft) { if (_direction == SlideDirection::FromLeft) {
std::swap(_cacheUnder, _cacheOver); a_coordUnder = anim::ivalue(0, delta);
a_coordUnder = anim::ivalue(-delta, 0); a_coordOver = anim::ivalue(-delta, 0);
a_coordOver = anim::ivalue(0, delta);
} else { } else {
a_coordUnder = anim::ivalue(0, -delta); a_coordUnder = anim::ivalue(0, -delta);
a_coordOver = anim::ivalue(delta, 0); a_coordOver = anim::ivalue(delta, 0);
@ -75,7 +85,7 @@ void SlideAnimation::start() {
} }
void SlideAnimation::step(float64 ms, bool timer) { void SlideAnimation::step(float64 ms, bool timer) {
float64 dt = ms / 3000;// st::slideDuration; float64 dt = ms / st::slideDuration;
if (dt >= 1) { if (dt >= 1) {
dt = 1; dt = 1;
if (timer) { if (timer) {
@ -95,3 +105,5 @@ void SlideAnimation::step(float64 ms, bool timer) {
_repaintCallback.call(); _repaintCallback.call();
} }
} }
} // namespace Window

View file

@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
namespace Window {
enum class SlideDirection { enum class SlideDirection {
FromRight, FromRight,
FromLeft, FromLeft,
@ -33,6 +35,7 @@ public:
void setDirection(SlideDirection direction); void setDirection(SlideDirection direction);
void setPixmaps(const QPixmap &oldContentCache, const QPixmap &newContentCache); void setPixmaps(const QPixmap &oldContentCache, const QPixmap &newContentCache);
void setTopBarShadow(bool enabled);
using RepaintCallback = Function<void>; using RepaintCallback = Function<void>;
void setRepaintCallback(RepaintCallback &&callback); void setRepaintCallback(RepaintCallback &&callback);
@ -46,6 +49,7 @@ private:
void step(float64 ms, bool timer); void step(float64 ms, bool timer);
SlideDirection _direction = SlideDirection::FromRight; SlideDirection _direction = SlideDirection::FromRight;
bool _topBarShadowEnabled = false;
mutable Animation _animation; mutable Animation _animation;
QPixmap _cacheUnder, _cacheOver; QPixmap _cacheUnder, _cacheOver;
@ -56,3 +60,5 @@ private:
FinishedCallback _finishedCallback; FinishedCallback _finishedCallback;
}; };
} // namespace Window

View file

@ -81,17 +81,17 @@ void TopBarWidget::onClearSelection() {
void TopBarWidget::onInfoClicked() { void TopBarWidget::onInfoClicked() {
PeerData *p = App::main() ? App::main()->historyPeer() : 0; PeerData *p = App::main() ? App::main()->historyPeer() : 0;
if (p) App::main()->showPeerProfile(p); if (p) Ui::showPeerProfile(p);
} }
void TopBarWidget::onAddContact() { void TopBarWidget::onAddContact() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
UserData *u = p ? p->asUser() : 0; UserData *u = p ? p->asUser() : 0;
if (u) Ui::showLayer(new AddContactBox(u->firstName, u->lastName, u->phone.isEmpty() ? App::phoneFromSharedContact(peerToUser(u->id)) : u->phone)); if (u) Ui::showLayer(new AddContactBox(u->firstName, u->lastName, u->phone.isEmpty() ? App::phoneFromSharedContact(peerToUser(u->id)) : u->phone));
} }
void TopBarWidget::onEdit() { void TopBarWidget::onEdit() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
if (p) { if (p) {
if (p->isChannel()) { if (p->isChannel()) {
Ui::showLayer(new EditChannelBox(p->asChannel())); Ui::showLayer(new EditChannelBox(p->asChannel()));
@ -104,7 +104,7 @@ void TopBarWidget::onEdit() {
} }
void TopBarWidget::onDeleteContact() { void TopBarWidget::onDeleteContact() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
UserData *u = p ? p->asUser() : 0; UserData *u = p ? p->asUser() : 0;
if (u) { if (u) {
ConfirmBox *box = new ConfirmBox(lng_sure_delete_contact(lt_contact, p->name), lang(lng_box_delete)); ConfirmBox *box = new ConfirmBox(lng_sure_delete_contact(lt_contact, p->name), lang(lng_box_delete));
@ -114,7 +114,7 @@ void TopBarWidget::onDeleteContact() {
} }
void TopBarWidget::onDeleteContactSure() { void TopBarWidget::onDeleteContactSure() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
UserData *u = p ? p->asUser() : 0; UserData *u = p ? p->asUser() : 0;
if (u) { if (u) {
Ui::showChatsList(); Ui::showChatsList();
@ -124,7 +124,7 @@ void TopBarWidget::onDeleteContactSure() {
} }
void TopBarWidget::onDeleteAndExit() { void TopBarWidget::onDeleteAndExit() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
ChatData *c = p ? p->asChat() : 0; ChatData *c = p ? p->asChat() : 0;
if (c) { if (c) {
ConfirmBox *box = new ConfirmBox(lng_sure_delete_and_exit(lt_group, p->name), lang(lng_box_leave), st::attentionBoxButton); ConfirmBox *box = new ConfirmBox(lng_sure_delete_and_exit(lt_group, p->name), lang(lng_box_leave), st::attentionBoxButton);
@ -134,7 +134,7 @@ void TopBarWidget::onDeleteAndExit() {
} }
void TopBarWidget::onDeleteAndExitSure() { void TopBarWidget::onDeleteAndExitSure() {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
ChatData *c = p ? p->asChat() : 0; ChatData *c = p ? p->asChat() : 0;
if (c) { if (c) {
Ui::showChatsList(); Ui::showChatsList();
@ -181,22 +181,28 @@ void TopBarWidget::step_appearance(float64 ms, bool timer) {
void TopBarWidget::paintEvent(QPaintEvent *e) { void TopBarWidget::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
if (e->rect().top() < st::topBarHeight) { // optimize shadow-only drawing
p.fillRect(QRect(0, 0, width(), st::topBarHeight), st::topBarBG->b); p.fillRect(QRect(0, 0, width(), st::topBarHeight), st::topBarBG->b);
if (_clearSelection->isHidden()) { if (_clearSelection->isHidden()) {
p.save(); p.save();
main()->paintTopBar(p, a_over.current(), _info->isHidden() ? 0 : _info->width()); int decreaseWidth = 0;
if (!_info->isHidden()) {
decreaseWidth += _info->width();
decreaseWidth -= st::topBarForwardPadding.right();
}
if (!_search->isHidden()) {
decreaseWidth += _search->width();
}
main()->paintTopBar(p, a_over.current(), decreaseWidth);
p.restore(); p.restore();
} else { } else {
p.setFont(st::linkFont->f); p.setFont(st::linkFont);
p.setPen(st::btnDefLink.color->p); p.setPen(st::btnDefLink.color);
p.drawText(_selStrLeft, st::topBarButton.textTop + st::linkFont->ascent, _selStr); p.drawText(_selStrLeft, st::topBarButton.textTop + st::linkFont->ascent, _selStr);
} }
}
} }
void TopBarWidget::mousePressEvent(QMouseEvent *e) { void TopBarWidget::mousePressEvent(QMouseEvent *e) {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
if (e->button() == Qt::LeftButton && e->pos().y() < st::topBarHeight && (p || !_selCount)) { if (e->button() == Qt::LeftButton && e->pos().y() < st::topBarHeight && (p || !_selCount)) {
emit clicked(); emit clicked();
} }
@ -289,7 +295,7 @@ void TopBarWidget::showAll() {
resizeEvent(0); resizeEvent(0);
return; return;
} }
PeerData *p = App::main() ? App::main()->profilePeer() : 0, *h = App::main() ? App::main()->historyPeer() : 0, *o = App::main() ? App::main()->overviewPeer() : 0; PeerData *p = nullptr/*App::main() ? App::main()->profilePeer() : 0*/, *h = App::main() ? App::main()->historyPeer() : 0, *o = App::main() ? App::main()->overviewPeer() : 0;
if (p && (p->isChat() || (p->isUser() && (p->asUser()->contact >= 0 || !App::phoneFromSharedContact(peerToUser(p->id)).isEmpty())))) { if (p && (p->isChat() || (p->isUser() && (p->asUser()->contact >= 0 || !App::phoneFromSharedContact(peerToUser(p->id)).isEmpty())))) {
if (p->isChat()) { if (p->isChat()) {
if (p->asChat()->canEdit()) { if (p->asChat()->canEdit()) {
@ -362,7 +368,7 @@ void TopBarWidget::showAll() {
} }
void TopBarWidget::showSelected(uint32 selCount, bool canDelete) { void TopBarWidget::showSelected(uint32 selCount, bool canDelete) {
PeerData *p = App::main() ? App::main()->profilePeer() : 0; PeerData *p = nullptr;// App::main() ? App::main()->profilePeer() : 0;
_selPeer = App::main()->overviewPeer() ? App::main()->overviewPeer() : App::main()->peer(); _selPeer = App::main()->overviewPeer() ? App::main()->overviewPeer() : App::main()->peer();
_selCount = selCount; _selCount = selCount;
_canDelete = canDelete; _canDelete = canDelete;

View file

@ -27,7 +27,6 @@ class PeerAvatarButton;
} // namespace Ui } // namespace Ui
class FlatButton; class FlatButton;
class IconedButton; class IconedButton;
class PlainShadow;
namespace Window { namespace Window {

View file

@ -429,6 +429,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_section_widget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_session.cpp"> <ClCompile Include="GeneratedFiles\Debug\moc_session.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -736,6 +740,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_section_widget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_session.cpp"> <ClCompile Include="GeneratedFiles\Deploy\moc_session.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@ -1069,6 +1077,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_section_widget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_session.cpp"> <ClCompile Include="GeneratedFiles\Release\moc_session.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -1190,6 +1202,7 @@
<ClCompile Include="SourceFiles\profile\profile_cover.cpp" /> <ClCompile Include="SourceFiles\profile\profile_cover.cpp" />
<ClCompile Include="SourceFiles\profile\profile_fixed_bar.cpp" /> <ClCompile Include="SourceFiles\profile\profile_fixed_bar.cpp" />
<ClCompile Include="SourceFiles\profile\profile_inner_widget.cpp" /> <ClCompile Include="SourceFiles\profile\profile_inner_widget.cpp" />
<ClCompile Include="SourceFiles\profile\profile_section_memento.cpp" />
<ClCompile Include="SourceFiles\profile\profile_widget.cpp" /> <ClCompile Include="SourceFiles\profile\profile_widget.cpp" />
<ClCompile Include="SourceFiles\pspecific_linux.cpp"> <ClCompile Include="SourceFiles\pspecific_linux.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@ -1239,7 +1252,6 @@
<ClCompile Include="SourceFiles\ui\images.cpp" /> <ClCompile Include="SourceFiles\ui\images.cpp" />
<ClCompile Include="SourceFiles\ui\popupmenu.cpp" /> <ClCompile Include="SourceFiles\ui\popupmenu.cpp" />
<ClCompile Include="SourceFiles\ui\scrollarea.cpp" /> <ClCompile Include="SourceFiles\ui\scrollarea.cpp" />
<ClCompile Include="SourceFiles\ui\slide_animation.cpp" />
<ClCompile Include="SourceFiles\ui\style\style_core.cpp" /> <ClCompile Include="SourceFiles\ui\style\style_core.cpp" />
<ClCompile Include="SourceFiles\ui\style\style_core_color.cpp" /> <ClCompile Include="SourceFiles\ui\style\style_core_color.cpp" />
<ClCompile Include="SourceFiles\ui\style\style_core_icon.cpp" /> <ClCompile Include="SourceFiles\ui\style\style_core_icon.cpp" />
@ -1253,6 +1265,8 @@
<ClCompile Include="SourceFiles\ui\toast\toast_widget.cpp" /> <ClCompile Include="SourceFiles\ui\toast\toast_widget.cpp" />
<ClCompile Include="SourceFiles\ui\twidget.cpp" /> <ClCompile Include="SourceFiles\ui\twidget.cpp" />
<ClCompile Include="SourceFiles\mainwindow.cpp" /> <ClCompile Include="SourceFiles\mainwindow.cpp" />
<ClCompile Include="SourceFiles\window\section_widget.cpp" />
<ClCompile Include="SourceFiles\window\slide_animation.cpp" />
<ClCompile Include="SourceFiles\window\top_bar_widget.cpp" /> <ClCompile Include="SourceFiles\window\top_bar_widget.cpp" />
<ClCompile Include="ThirdParty\minizip\zip.c"> <ClCompile Include="ThirdParty\minizip\zip.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
@ -1513,6 +1527,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs> <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> <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> </CustomBuild>
<ClInclude Include="SourceFiles\profile\profile_section_memento.h" />
<ClInclude Include="SourceFiles\serialize\serialize_common.h" /> <ClInclude Include="SourceFiles\serialize\serialize_common.h" />
<ClInclude Include="SourceFiles\serialize\serialize_document.h" /> <ClInclude Include="SourceFiles\serialize\serialize_document.h" />
<ClInclude Include="SourceFiles\shortcuts.h" /> <ClInclude Include="SourceFiles\shortcuts.h" />
@ -1675,7 +1690,6 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -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" "-fstdafx.h" "-f../../SourceFiles/ui/twidget.h"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -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" "-fstdafx.h" "-f../../SourceFiles/ui/twidget.h"</Command>
</CustomBuild> </CustomBuild>
<ClInclude Include="SourceFiles\ui\slide_animation.h" />
<ClInclude Include="SourceFiles\ui\style\style_core.h" /> <ClInclude Include="SourceFiles\ui\style\style_core.h" />
<ClInclude Include="SourceFiles\ui\style\style_core_color.h" /> <ClInclude Include="SourceFiles\ui\style\style_core_color.h" />
<ClInclude Include="SourceFiles\ui\style\style_core_font.h" /> <ClInclude Include="SourceFiles\ui\style\style_core_font.h" />
@ -1714,6 +1728,22 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -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" "-fstdafx.h" "-f../../SourceFiles/window/top_bar_widget.h"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -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" "-fstdafx.h" "-f../../SourceFiles/window/top_bar_widget.h"</Command>
</CustomBuild> </CustomBuild>
<CustomBuild Include="SourceFiles\window\section_widget.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing section_widget.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/window/section_widget.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 section_widget.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/window/section_widget.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 section_widget.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/window/section_widget.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\window\section_memento.h" />
<ClInclude Include="SourceFiles\window\slide_animation.h" />
<ClInclude Include="ThirdParty\minizip\crypt.h" /> <ClInclude Include="ThirdParty\minizip\crypt.h" />
<ClInclude Include="ThirdParty\minizip\ioapi.h" /> <ClInclude Include="ThirdParty\minizip\ioapi.h" />
<ClInclude Include="ThirdParty\minizip\zip.h" /> <ClInclude Include="ThirdParty\minizip\zip.h" />

View file

@ -1119,9 +1119,6 @@
<ClCompile Include="GeneratedFiles\Release\moc_profile_widget.cpp"> <ClCompile Include="GeneratedFiles\Release\moc_profile_widget.cpp">
<Filter>GeneratedFiles\Release</Filter> <Filter>GeneratedFiles\Release</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SourceFiles\ui\slide_animation.cpp">
<Filter>SourceFiles\ui</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_profile_inner_widget.cpp"> <ClCompile Include="GeneratedFiles\Deploy\moc_profile_inner_widget.cpp">
<Filter>GeneratedFiles\Deploy</Filter> <Filter>GeneratedFiles\Deploy</Filter>
</ClCompile> </ClCompile>
@ -1173,6 +1170,24 @@
<ClCompile Include="GeneratedFiles\Release\moc_field_autocomplete.cpp"> <ClCompile Include="GeneratedFiles\Release\moc_field_autocomplete.cpp">
<Filter>GeneratedFiles\Release</Filter> <Filter>GeneratedFiles\Release</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SourceFiles\window\section_widget.cpp">
<Filter>SourceFiles\window</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Deploy\moc_section_widget.cpp">
<Filter>GeneratedFiles\Deploy</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_section_widget.cpp">
<Filter>GeneratedFiles\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_section_widget.cpp">
<Filter>GeneratedFiles\Release</Filter>
</ClCompile>
<ClCompile Include="SourceFiles\window\slide_animation.cpp">
<Filter>SourceFiles\window</Filter>
</ClCompile>
<ClCompile Include="SourceFiles\profile\profile_section_memento.cpp">
<Filter>SourceFiles\profile</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="SourceFiles\stdafx.h"> <ClInclude Include="SourceFiles\stdafx.h">
@ -1346,12 +1361,18 @@
<ClInclude Include="Resources\winrc\resource.h"> <ClInclude Include="Resources\winrc\resource.h">
<Filter>Resources\winrc</Filter> <Filter>Resources\winrc</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SourceFiles\ui\slide_animation.h">
<Filter>SourceFiles\ui</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\styles\style_profile.h"> <ClInclude Include="GeneratedFiles\styles\style_profile.h">
<Filter>GeneratedFiles\styles</Filter> <Filter>GeneratedFiles\styles</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SourceFiles\window\slide_animation.h">
<Filter>SourceFiles\window</Filter>
</ClInclude>
<ClInclude Include="SourceFiles\window\section_memento.h">
<Filter>SourceFiles\window</Filter>
</ClInclude>
<ClInclude Include="SourceFiles\profile\profile_section_memento.h">
<Filter>SourceFiles\profile</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="SourceFiles\application.h"> <CustomBuild Include="SourceFiles\application.h">
@ -1609,6 +1630,9 @@
<CustomBuild Include="Resources\basic.style"> <CustomBuild Include="Resources\basic.style">
<Filter>Resources</Filter> <Filter>Resources</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="SourceFiles\window\section_widget.h">
<Filter>SourceFiles\window</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Resources\langs\lang_it.strings"> <None Include="Resources\langs\lang_it.strings">