mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-22 00:57:09 +02:00
Improve info wrapping in section / layer.
Also move layerwidget to window/layer_widget. Also replace ui/effects/widget_fade_wrap with ui/wrap/fade_wrap.
This commit is contained in:
parent
ea0f6b9a12
commit
d1687ab963
84 changed files with 1631 additions and 1490 deletions
|
@ -79,6 +79,7 @@ slideShift: 100px;
|
||||||
slideShadow: icon {{ "slide_shadow", slideFadeOutShadowFg }};
|
slideShadow: icon {{ "slide_shadow", slideFadeOutShadowFg }};
|
||||||
|
|
||||||
slideWrapDuration: 150;
|
slideWrapDuration: 150;
|
||||||
|
fadeWrapDuration: 200;
|
||||||
|
|
||||||
linkCropLimit: 360px;
|
linkCropLimit: 360px;
|
||||||
linkFont: normalFont;
|
linkFont: normalFont;
|
||||||
|
|
|
@ -240,7 +240,7 @@ public:
|
||||||
AuthSessionData &data() {
|
AuthSessionData &data() {
|
||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
void saveDataDelayed(TimeMs delay);
|
void saveDataDelayed(TimeMs delay = kDefaultSaveDelay);
|
||||||
|
|
||||||
ApiWrap &api() {
|
ApiWrap &api() {
|
||||||
return *_api;
|
return *_api;
|
||||||
|
@ -259,6 +259,8 @@ public:
|
||||||
~AuthSession();
|
~AuthSession();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr auto kDefaultSaveDelay = TimeMs(1000);
|
||||||
|
|
||||||
const UserId _userId = 0;
|
const UserId _userId = 0;
|
||||||
AuthSessionData _data;
|
AuthSessionData _data;
|
||||||
base::Timer _saveDataTimer;
|
base::Timer _saveDataTimer;
|
||||||
|
|
|
@ -24,10 +24,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
@ -53,8 +54,8 @@ void BoxContent::setInner(object_ptr<TWidget> inner, const style::ScrollArea &st
|
||||||
_topShadow->raise();
|
_topShadow->raise();
|
||||||
_bottomShadow->raise();
|
_bottomShadow->raise();
|
||||||
} else {
|
} else {
|
||||||
_topShadow.create(this, object_ptr<BoxLayerTitleShadow>(this));
|
_topShadow.create(this);
|
||||||
_bottomShadow.create(this, object_ptr<BoxLayerTitleShadow>(this));
|
_bottomShadow.create(this);
|
||||||
}
|
}
|
||||||
if (!_preparing) {
|
if (!_preparing) {
|
||||||
// We didn't set dimensions yet, this will be called from finishPrepare();
|
// We didn't set dimensions yet, this will be called from finishPrepare();
|
||||||
|
@ -421,9 +422,6 @@ void AbstractBox::keyPressEvent(QKeyEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BoxLayerTitleShadow::BoxLayerTitleShadow(QWidget *parent) : Ui::PlainShadow(parent, st::boxLayerTitleShadow) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BoxContentDivider::BoxContentDivider(QWidget *parent) : RpWidget(parent) {
|
BoxContentDivider::BoxContentDivider(QWidget *parent) : RpWidget(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,25 +20,26 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "layerwidget.h"
|
#include "window/layer_widget.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/widgets/shadow.h"
|
|
||||||
|
namespace style {
|
||||||
|
struct RoundButton;
|
||||||
|
struct ScrollArea;
|
||||||
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class RoundButton;
|
class RoundButton;
|
||||||
class IconButton;
|
class IconButton;
|
||||||
class ScrollArea;
|
class ScrollArea;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
template <typename Widget>
|
class FadeShadow;
|
||||||
class WidgetFadeWrap;
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
class Controller;
|
class Controller;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
class BoxLayerTitleShadow;
|
|
||||||
|
|
||||||
class BoxContentDelegate {
|
class BoxContentDelegate {
|
||||||
public:
|
public:
|
||||||
virtual Window::Controller *controller() const = 0;
|
virtual Window::Controller *controller() const = 0;
|
||||||
|
@ -194,15 +195,18 @@ private:
|
||||||
bool _noContentMargin = false;
|
bool _noContentMargin = false;
|
||||||
int _innerTopSkip = 0;
|
int _innerTopSkip = 0;
|
||||||
object_ptr<Ui::ScrollArea> _scroll = { nullptr };
|
object_ptr<Ui::ScrollArea> _scroll = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<BoxLayerTitleShadow>> _topShadow = { nullptr };
|
object_ptr<Ui::FadeShadow> _topShadow = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<BoxLayerTitleShadow>> _bottomShadow = { nullptr };
|
object_ptr<Ui::FadeShadow> _bottomShadow = { nullptr };
|
||||||
|
|
||||||
object_ptr<QTimer> _draggingScrollTimer = { nullptr };
|
object_ptr<QTimer> _draggingScrollTimer = { nullptr };
|
||||||
int _draggingScrollDelta = 0;
|
int _draggingScrollDelta = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractBox : public LayerWidget, public BoxContentDelegate, protected base::Subscriber {
|
class AbstractBox
|
||||||
|
: public Window::LayerWidget
|
||||||
|
, public BoxContentDelegate
|
||||||
|
, protected base::Subscriber {
|
||||||
public:
|
public:
|
||||||
AbstractBox(QWidget *parent, Window::Controller *controller, object_ptr<BoxContent> content);
|
AbstractBox(QWidget *parent, Window::Controller *controller, object_ptr<BoxContent> content);
|
||||||
|
|
||||||
|
@ -284,12 +288,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BoxLayerTitleShadow : public Ui::PlainShadow {
|
|
||||||
public:
|
|
||||||
BoxLayerTitleShadow(QWidget *parent);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class BoxContentDivider : public Ui::RpWidget {
|
class BoxContentDivider : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
BoxContentDivider(QWidget *parent);
|
BoxContentDivider(QWidget *parent);
|
||||||
|
|
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "mtproto/sender.h"
|
#include "mtproto/sender.h"
|
||||||
|
#include "styles/style_widgets.h"
|
||||||
|
|
||||||
class ConfirmBox;
|
class ConfirmBox;
|
||||||
class PeerListBox;
|
class PeerListBox;
|
||||||
|
|
|
@ -88,7 +88,6 @@ boxLayerTitlePosition: point(23px, 16px);
|
||||||
boxLayerTitleHeight: 56px;
|
boxLayerTitleHeight: 56px;
|
||||||
boxLayerTitleAdditionalSkip: 9px;
|
boxLayerTitleAdditionalSkip: 9px;
|
||||||
boxLayerTitleAdditionalFont: normalFont;
|
boxLayerTitleAdditionalFont: normalFont;
|
||||||
boxLayerTitleShadow: shadowFg;
|
|
||||||
boxLayerScroll: defaultSolidScroll;
|
boxLayerScroll: defaultSolidScroll;
|
||||||
|
|
||||||
boxTopMargin: 6px;
|
boxTopMargin: 6px;
|
||||||
|
|
|
@ -24,25 +24,37 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "boxes/confirm_phone_box.h"
|
#include "boxes/confirm_phone_box.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void createErrorLabel(QWidget *parent, object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> &label, const QString &text, int x, int y) {
|
void createErrorLabel(
|
||||||
|
QWidget *parent,
|
||||||
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> &label,
|
||||||
|
const QString &text,
|
||||||
|
int x,
|
||||||
|
int y) {
|
||||||
if (label) {
|
if (label) {
|
||||||
auto errorFadeOut = std::move(label);
|
label->hideAnimated();
|
||||||
errorFadeOut->setUpdateCallback([label = errorFadeOut.data()] {
|
auto context = label.data();
|
||||||
if (label->isHidden() || !label->animating()) {
|
App::CallDelayed(
|
||||||
label->deleteLater();
|
st::fadeWrapDuration,
|
||||||
}
|
context,
|
||||||
});
|
[old = std::move(label)]() mutable {
|
||||||
errorFadeOut->hideAnimated();
|
old.destroy();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
label.create(parent, object_ptr<Ui::FlatLabel>(parent, text, Ui::FlatLabel::InitType::Simple, st::changePhoneError));
|
label.create(
|
||||||
|
parent,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
parent,
|
||||||
|
text,
|
||||||
|
Ui::FlatLabel::InitType::Simple,
|
||||||
|
st::changePhoneError));
|
||||||
label->hideFast();
|
label->hideFast();
|
||||||
label->moveToLeft(x, y);
|
label->moveToLeft(x, y);
|
||||||
label->showAnimated();
|
label->showAnimated();
|
||||||
|
@ -73,7 +85,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::PhoneInput> _phone = { nullptr };
|
object_ptr<Ui::PhoneInput> _phone = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
||||||
mtpRequestId _requestId = 0;
|
mtpRequestId _requestId = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -105,7 +117,7 @@ private:
|
||||||
int _codeLength = 0;
|
int _codeLength = 0;
|
||||||
int _callTimeout = 0;
|
int _callTimeout = 0;
|
||||||
object_ptr<SentCodeField> _code = { nullptr };
|
object_ptr<SentCodeField> _code = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _callLabel = { nullptr };
|
object_ptr<Ui::FlatLabel> _callLabel = { nullptr };
|
||||||
mtpRequestId _requestId = 0;
|
mtpRequestId _requestId = 0;
|
||||||
SentCodeCall _call;
|
SentCodeCall _call;
|
||||||
|
|
|
@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace style {
|
namespace style {
|
||||||
struct PeerList;
|
struct PeerList;
|
||||||
|
struct PeerListItem;
|
||||||
} // namespace style
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -34,6 +34,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/effects/slide_animation.h"
|
#include "ui/effects/slide_animation.h"
|
||||||
#include "ui/widgets/discrete_sliders.h"
|
#include "ui/widgets/discrete_sliders.h"
|
||||||
|
|
|
@ -126,7 +126,7 @@ private:
|
||||||
ChannelData *_megagroupSet = nullptr;
|
ChannelData *_megagroupSet = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<Ui::SlideAnimation> _slideAnimation;
|
std::unique_ptr<Ui::SlideAnimation> _slideAnimation;
|
||||||
object_ptr<BoxLayerTitleShadow> _titleShadow = { nullptr };
|
object_ptr<Ui::PlainShadow> _titleShadow = { nullptr };
|
||||||
|
|
||||||
mtpRequestId _archivedRequestId = 0;
|
mtpRequestId _archivedRequestId = 0;
|
||||||
bool _archivedLoaded = false;
|
bool _archivedLoaded = false;
|
||||||
|
@ -303,7 +303,7 @@ private:
|
||||||
MTPInputStickerSet _megagroupSetInput = MTP_inputStickerSetEmpty();
|
MTPInputStickerSet _megagroupSetInput = MTP_inputStickerSetEmpty();
|
||||||
std::unique_ptr<Row> _megagroupSelectedSet;
|
std::unique_ptr<Row> _megagroupSelectedSet;
|
||||||
object_ptr<Ui::UsernameInput> _megagroupSetField = { nullptr };
|
object_ptr<Ui::UsernameInput> _megagroupSetField = { nullptr };
|
||||||
object_ptr<BoxLayerTitleShadow> _megagroupSelectedShadow = { nullptr };
|
object_ptr<Ui::PlainShadow> _megagroupSelectedShadow = { nullptr };
|
||||||
object_ptr<Ui::CrossButton> _megagroupSelectedRemove = { nullptr };
|
object_ptr<Ui::CrossButton> _megagroupSelectedRemove = { nullptr };
|
||||||
object_ptr<BoxContentDivider> _megagroupDivider = { nullptr };
|
object_ptr<BoxContentDivider> _megagroupDivider = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _megagroupSubTitle = { nullptr };
|
object_ptr<Ui::FlatLabel> _megagroupSubTitle = { nullptr };
|
||||||
|
|
|
@ -28,7 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -245,11 +245,14 @@ Panel::Panel(not_null<Call*> call)
|
||||||
: _call(call)
|
: _call(call)
|
||||||
, _user(call->user())
|
, _user(call->user())
|
||||||
, _answerHangupRedial(this, st::callAnswer, &st::callHangup)
|
, _answerHangupRedial(this, st::callAnswer, &st::callHangup)
|
||||||
, _decline(this, object_ptr<Button>(this, st::callHangup), st::callPanelDuration)
|
, _decline(this, object_ptr<Button>(this, st::callHangup))
|
||||||
, _cancel(this, object_ptr<Button>(this, st::callCancel), st::callPanelDuration)
|
, _cancel(this, object_ptr<Button>(this, st::callCancel))
|
||||||
, _mute(this, st::callMuteToggle)
|
, _mute(this, st::callMuteToggle)
|
||||||
, _name(this, st::callName)
|
, _name(this, st::callName)
|
||||||
, _status(this, st::callStatus) {
|
, _status(this, st::callStatus) {
|
||||||
|
_decline->setDuration(st::callPanelDuration);
|
||||||
|
_cancel->setDuration(st::callPanelDuration);
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setWindowIcon(Window::CreateIcon());
|
setWindowIcon(Window::CreateIcon());
|
||||||
initControls();
|
initControls();
|
||||||
|
@ -338,8 +341,8 @@ void Panel::initControls() {
|
||||||
|
|
||||||
reinitControls();
|
reinitControls();
|
||||||
|
|
||||||
_decline->finishAnimation();
|
_decline->finishAnimations();
|
||||||
_cancel->finishAnimation();
|
_cancel->finishAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::reinitControls() {
|
void Panel::reinitControls() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Ui {
|
||||||
class IconButton;
|
class IconButton;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
class WidgetFadeWrap;
|
class FadeWrap;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Calls {
|
namespace Calls {
|
||||||
|
@ -103,8 +103,8 @@ private:
|
||||||
|
|
||||||
class Button;
|
class Button;
|
||||||
object_ptr<Button> _answerHangupRedial;
|
object_ptr<Button> _answerHangupRedial;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Button>> _decline;
|
object_ptr<Ui::FadeWrap<Button>> _decline;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Button>> _cancel;
|
object_ptr<Ui::FadeWrap<Button>> _cancel;
|
||||||
bool _hangupShown = false;
|
bool _hangupShown = false;
|
||||||
Animation _hangupShownProgress;
|
Animation _hangupShownProgress;
|
||||||
object_ptr<Ui::IconButton> _mute;
|
object_ptr<Ui::IconButton> _mute;
|
||||||
|
|
|
@ -37,11 +37,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr auto kSaveChosenTabTimeout = 1000;
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
class TabbedSelector::SlideAnimation : public Ui::RoundShadowAnimation {
|
class TabbedSelector::SlideAnimation : public Ui::RoundShadowAnimation {
|
||||||
public:
|
public:
|
||||||
|
@ -287,8 +282,8 @@ void TabbedSelector::Tab::saveScrollTop() {
|
||||||
|
|
||||||
TabbedSelector::TabbedSelector(QWidget *parent, not_null<Window::Controller*> controller) : RpWidget(parent)
|
TabbedSelector::TabbedSelector(QWidget *parent, not_null<Window::Controller*> controller) : RpWidget(parent)
|
||||||
, _tabsSlider(this, st::emojiTabs)
|
, _tabsSlider(this, st::emojiTabs)
|
||||||
, _topShadow(this, st::shadowFg)
|
, _topShadow(this)
|
||||||
, _bottomShadow(this, st::shadowFg)
|
, _bottomShadow(this)
|
||||||
, _scroll(this, st::emojiScroll)
|
, _scroll(this, st::emojiScroll)
|
||||||
, _tabs { {
|
, _tabs { {
|
||||||
Tab { SelectorTab::Emoji, object_ptr<EmojiListWidget>(this, controller) },
|
Tab { SelectorTab::Emoji, object_ptr<EmojiListWidget>(this, controller) },
|
||||||
|
@ -672,7 +667,7 @@ void TabbedSelector::switchTab() {
|
||||||
update();
|
update();
|
||||||
|
|
||||||
Auth().data().setSelectorTab(_currentTabType);
|
Auth().data().setSelectorTab(_currentTabType);
|
||||||
Auth().saveDataDelayed(kSaveChosenTabTimeout);
|
Auth().saveDataDelayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<EmojiListWidget*> TabbedSelector::emoji() const {
|
not_null<EmojiListWidget*> TabbedSelector::emoji() const {
|
||||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "dialogs/dialogs_search_from_controllers.h"
|
#include "dialogs/dialogs_search_from_controllers.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -32,7 +33,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "autoupdater.h"
|
#include "autoupdater.h"
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "profile/profile_channel_controllers.h"
|
#include "profile/profile_channel_controllers.h"
|
||||||
|
@ -94,8 +94,12 @@ void DialogsWidget::UpdateButton::paintEvent(QPaintEvent *e) {
|
||||||
DialogsWidget::DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
DialogsWidget::DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
||||||
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
||||||
, _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter))
|
, _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter))
|
||||||
, _chooseFromUser(this, object_ptr<Ui::IconButton>(this, st::dialogsSearchFrom))
|
, _chooseFromUser(
|
||||||
, _jumpToDate(this, object_ptr<Ui::IconButton>(this, st::dialogsCalendar))
|
this,
|
||||||
|
object_ptr<Ui::IconButton>(this, st::dialogsSearchFrom))
|
||||||
|
, _jumpToDate(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::IconButton>(this, st::dialogsCalendar))
|
||||||
, _cancelSearch(this, st::dialogsCancelSearch)
|
, _cancelSearch(this, st::dialogsCancelSearch)
|
||||||
, _lockUnlock(this, st::dialogsLock)
|
, _lockUnlock(this, st::dialogsLock)
|
||||||
, _scroll(this, st::dialogsScroll) {
|
, _scroll(this, st::dialogsScroll) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class FlatButton;
|
||||||
class FlatInput;
|
class FlatInput;
|
||||||
class CrossButton;
|
class CrossButton;
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
class WidgetScaledFadeWrap;
|
class FadeWrapScaled;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
@ -182,8 +182,8 @@ private:
|
||||||
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
||||||
object_ptr<Ui::IconButton> _mainMenuToggle;
|
object_ptr<Ui::IconButton> _mainMenuToggle;
|
||||||
object_ptr<Ui::FlatInput> _filter;
|
object_ptr<Ui::FlatInput> _filter;
|
||||||
object_ptr<Ui::WidgetScaledFadeWrap<Ui::IconButton>> _chooseFromUser;
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _chooseFromUser;
|
||||||
object_ptr<Ui::WidgetScaledFadeWrap<Ui::IconButton>> _jumpToDate;
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _jumpToDate;
|
||||||
object_ptr<Ui::CrossButton> _cancelSearch;
|
object_ptr<Ui::CrossButton> _cancelSearch;
|
||||||
object_ptr<Ui::IconButton> _lockUnlock;
|
object_ptr<Ui::IconButton> _lockUnlock;
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
|
|
|
@ -31,7 +31,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "layerwidget.h"
|
#include "window/layer_widget.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "base/observer.h"
|
#include "base/observer.h"
|
||||||
#include "base/task_queue.h"
|
#include "base/task_queue.h"
|
||||||
|
|
|
@ -23,7 +23,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "base/type_traits.h"
|
#include "base/type_traits.h"
|
||||||
#include "base/observer.h"
|
#include "base/observer.h"
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
class LayerWidget;
|
class LayerWidget;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
class BoxContent;
|
class BoxContent;
|
||||||
|
|
||||||
namespace InlineBots {
|
namespace InlineBots {
|
||||||
|
|
|
@ -251,7 +251,7 @@ void FixedBar::mousePressEvent(QMouseEvent *e) {
|
||||||
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel) : Window::SectionWidget(parent, controller)
|
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel) : Window::SectionWidget(parent, controller)
|
||||||
, _scroll(this, st::historyScroll, false)
|
, _scroll(this, st::historyScroll, false)
|
||||||
, _fixedBar(this, controller, channel)
|
, _fixedBar(this, controller, channel)
|
||||||
, _fixedBarShadow(this, st::shadowFg)
|
, _fixedBarShadow(this)
|
||||||
, _whatIsThis(this, lang(lng_admin_log_about).toUpper(), st::historyComposeButton) {
|
, _whatIsThis(this, lang(lng_admin_log_about).toUpper(), st::historyComposeButton) {
|
||||||
_fixedBar->move(0, 0);
|
_fixedBar->move(0, 0);
|
||||||
_fixedBar->resizeToWidth(width());
|
_fixedBar->resizeToWidth(width());
|
||||||
|
|
|
@ -33,6 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
|
||||||
DragArea::DragArea(QWidget *parent) : TWidget(parent) {
|
DragArea::DragArea(QWidget *parent) : TWidget(parent) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
|
@ -36,6 +36,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/inner_dropdown.h"
|
#include "ui/widgets/inner_dropdown.h"
|
||||||
#include "ui/widgets/dropdown_menu.h"
|
#include "ui/widgets/dropdown_menu.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "inline_bots/inline_bot_result.h"
|
#include "inline_bots/inline_bot_result.h"
|
||||||
#include "data/data_drafts.h"
|
#include "data/data_drafts.h"
|
||||||
|
@ -77,7 +78,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kSaveTabbedSelectorSectionTimeoutMs = 1000;
|
|
||||||
constexpr auto kMessagesPerPageFirst = 30;
|
constexpr auto kMessagesPerPageFirst = 30;
|
||||||
constexpr auto kMessagesPerPage = 50;
|
constexpr auto kMessagesPerPage = 50;
|
||||||
constexpr auto kPreloadHeightsCount = 3; // when 3 screens to scroll left make a preload request
|
constexpr auto kPreloadHeightsCount = 3; // when 3 screens to scroll left make a preload request
|
||||||
|
@ -539,7 +539,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
||||||
, _attachDragDocument(this)
|
, _attachDragDocument(this)
|
||||||
, _attachDragPhoto(this)
|
, _attachDragPhoto(this)
|
||||||
, _fileLoader(this, FileLoaderQueueStopTimeout)
|
, _fileLoader(this, FileLoaderQueueStopTimeout)
|
||||||
, _topShadow(this, st::shadowFg) {
|
, _topShadow(this) {
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
|
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
|
||||||
|
@ -3804,7 +3804,7 @@ void HistoryWidget::toggleTabbedSelectorMode() {
|
||||||
if (controller()->canShowThirdSection()
|
if (controller()->canShowThirdSection()
|
||||||
&& !Adaptive::OneColumn()) {
|
&& !Adaptive::OneColumn()) {
|
||||||
Auth().data().setTabbedSelectorSectionEnabled(true);
|
Auth().data().setTabbedSelectorSectionEnabled(true);
|
||||||
Auth().saveDataDelayed(kSaveTabbedSelectorSectionTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
pushTabbedSelectorToThirdSection();
|
pushTabbedSelectorToThirdSection();
|
||||||
} else {
|
} else {
|
||||||
_tabbedPanel->toggleAnimated();
|
_tabbedPanel->toggleAnimated();
|
||||||
|
@ -5244,7 +5244,7 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
|
||||||
HistoryWidget::PinnedBar::PinnedBar(MsgId msgId, HistoryWidget *parent)
|
HistoryWidget::PinnedBar::PinnedBar(MsgId msgId, HistoryWidget *parent)
|
||||||
: msgId(msgId)
|
: msgId(msgId)
|
||||||
, cancel(parent, st::historyReplyCancel)
|
, cancel(parent, st::historyReplyCancel)
|
||||||
, shadow(parent, st::shadowFg) {
|
, shadow(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryWidget::PinnedBar::~PinnedBar() {
|
HistoryWidget::PinnedBar::~PinnedBar() {
|
||||||
|
|
|
@ -54,21 +54,37 @@ infoScroll: ScrollArea(defaultScrollArea) {
|
||||||
|
|
||||||
infoTopBarBackIcon: icon {{ "info_back", boxTitleCloseFg }};
|
infoTopBarBackIcon: icon {{ "info_back", boxTitleCloseFg }};
|
||||||
infoTopBarBackIconOver: icon {{ "info_back", boxTitleCloseFgOver }};
|
infoTopBarBackIconOver: icon {{ "info_back", boxTitleCloseFgOver }};
|
||||||
infoTopBarHeight: boxLayerTitleHeight;
|
infoTopBarHeight: 54px;
|
||||||
infoTopBarBack: IconButton(defaultIconButton) {
|
infoTopBarBack: IconButton(defaultIconButton) {
|
||||||
width: infoTopBarHeight;
|
width: 70px;
|
||||||
height: infoTopBarHeight;
|
height: infoTopBarHeight;
|
||||||
|
|
||||||
icon: infoTopBarBackIcon;
|
icon: infoTopBarBackIcon;
|
||||||
iconOver: infoTopBarBackIconOver;
|
iconOver: infoTopBarBackIconOver;
|
||||||
iconPosition: point(10px, -1px);
|
iconPosition: point(11px, -1px);
|
||||||
|
|
||||||
rippleAreaPosition: point(6px, 6px);
|
rippleAreaPosition: point(6px, 6px);
|
||||||
rippleAreaSize: 44px;
|
rippleAreaSize: 42px;
|
||||||
ripple: RippleAnimation(defaultRippleAnimation) {
|
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||||
color: windowBgOver;
|
color: windowBgOver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
infoTopBarTitle: FlatLabel(defaultFlatLabel) {
|
||||||
|
textFg: windowBoldFg;
|
||||||
|
maxHeight: 20px;
|
||||||
|
style: TextStyle(defaultTextStyle) {
|
||||||
|
font: font(14px semibold);
|
||||||
|
linkFont: font(14px semibold);
|
||||||
|
linkFontOver: font(14px semibold);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
infoTopBar: InfoTopBar {
|
||||||
|
height: infoTopBarHeight;
|
||||||
|
back: infoTopBarBack;
|
||||||
|
title: infoTopBarTitle;
|
||||||
|
titlePosition: point(23px, 18px);
|
||||||
|
bg: windowBg;
|
||||||
|
}
|
||||||
|
|
||||||
infoLayerTopBarHeight: boxLayerTitleHeight;
|
infoLayerTopBarHeight: boxLayerTitleHeight;
|
||||||
infoLayerTopBarBackIcon: icon {{ "info_back", boxTitleCloseFg }};
|
infoLayerTopBarBackIcon: icon {{ "info_back", boxTitleCloseFg }};
|
||||||
|
@ -77,8 +93,11 @@ infoLayerTopBarBack: IconButton(infoTopBarBack) {
|
||||||
width: infoLayerTopBarHeight;
|
width: infoLayerTopBarHeight;
|
||||||
height: infoLayerTopBarHeight;
|
height: infoLayerTopBarHeight;
|
||||||
|
|
||||||
|
iconPosition: point(12px, -1px);
|
||||||
icon: infoLayerTopBarBackIcon;
|
icon: infoLayerTopBarBackIcon;
|
||||||
iconOver: infoLayerTopBarBackIconOver;
|
iconOver: infoLayerTopBarBackIconOver;
|
||||||
|
|
||||||
|
rippleAreaSize: 44px;
|
||||||
}
|
}
|
||||||
infoLayerTopBarCloseIcon: icon {{ "info_close", boxTitleCloseFg }};
|
infoLayerTopBarCloseIcon: icon {{ "info_close", boxTitleCloseFg }};
|
||||||
infoLayerTopBarCloseIconOver: icon {{ "info_close", boxTitleCloseFgOver }};
|
infoLayerTopBarCloseIconOver: icon {{ "info_close", boxTitleCloseFgOver }};
|
||||||
|
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <rpl/producer.h>
|
#include <rpl/producer.h>
|
||||||
#include "info/info_memento.h"
|
#include "info/info_content_widget.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace CommonGroups {
|
namespace CommonGroups {
|
||||||
|
|
157
Telegram/SourceFiles/info/info_content_widget.cpp
Normal file
157
Telegram/SourceFiles/info/info_content_widget.cpp
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#include "info/info_content_widget.h"
|
||||||
|
|
||||||
|
#include <rpl/never.h>
|
||||||
|
#include <rpl/combine.h>
|
||||||
|
#include "window/window_controller.h"
|
||||||
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "info/profile/info_profile_widget.h"
|
||||||
|
#include "info/media/info_media_widget.h"
|
||||||
|
#include "info/info_common_groups_widget.h"
|
||||||
|
#include "info/info_layer_widget.h"
|
||||||
|
#include "info/info_section_widget.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
|
#include "styles/style_profile.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
|
||||||
|
ContentWidget::ContentWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
not_null<PeerData*> peer)
|
||||||
|
: RpWidget(parent)
|
||||||
|
, _controller(controller)
|
||||||
|
, _peer(peer)
|
||||||
|
, _wrap(wrap)
|
||||||
|
, _scroll(this, st::infoScroll) {
|
||||||
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::setWrap(Wrap wrap) {
|
||||||
|
if (_wrap != wrap) {
|
||||||
|
_wrap = wrap;
|
||||||
|
_wrapChanges.fire_copy(_wrap);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::resizeEvent(QResizeEvent *e) {
|
||||||
|
auto newScrollTop = _scroll->scrollTop() + _topDelta;
|
||||||
|
auto scrollGeometry = rect().marginsRemoved(
|
||||||
|
QMargins(0, _scrollTopSkip, 0, 0));
|
||||||
|
if (_scroll->geometry() != scrollGeometry) {
|
||||||
|
_scroll->setGeometry(scrollGeometry);
|
||||||
|
_inner->resizeToWidth(_scroll->width());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_scroll->isHidden()) {
|
||||||
|
if (_topDelta) {
|
||||||
|
_scroll->scrollToY(newScrollTop);
|
||||||
|
}
|
||||||
|
auto scrollTop = _scroll->scrollTop();
|
||||||
|
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
p.fillRect(e->rect(), (_wrap == Wrap::Layer)
|
||||||
|
? st::boxBg
|
||||||
|
: st::profileBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::setGeometryWithTopMoved(
|
||||||
|
const QRect &newGeometry,
|
||||||
|
int topDelta) {
|
||||||
|
_topDelta = topDelta;
|
||||||
|
auto willBeResized = (size() != newGeometry.size());
|
||||||
|
if (geometry() != newGeometry) {
|
||||||
|
setGeometry(newGeometry);
|
||||||
|
}
|
||||||
|
if (!willBeResized) {
|
||||||
|
QResizeEvent fake(size(), size());
|
||||||
|
QApplication::sendEvent(this, &fake);
|
||||||
|
}
|
||||||
|
_topDelta = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ui::RpWidget *ContentWidget::doSetInnerWidget(
|
||||||
|
object_ptr<RpWidget> inner,
|
||||||
|
int scrollTopSkip) {
|
||||||
|
using namespace rpl::mappers;
|
||||||
|
|
||||||
|
_inner = _scroll->setOwnedWidget(std::move(inner));
|
||||||
|
_inner->move(0, 0);
|
||||||
|
|
||||||
|
rpl::combine(
|
||||||
|
_scroll->scrollTopValue(),
|
||||||
|
_scroll->heightValue(),
|
||||||
|
_inner->desiredHeightValue(),
|
||||||
|
tuple($1, $1 + $2, $3))
|
||||||
|
| rpl::start_with_next([inner = _inner](
|
||||||
|
int top,
|
||||||
|
int bottom,
|
||||||
|
int desired) {
|
||||||
|
inner->setVisibleTopBottom(top, bottom);
|
||||||
|
}, _inner->lifetime());
|
||||||
|
return _inner;
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<Section> ContentWidget::sectionRequest() const {
|
||||||
|
return rpl::never<Section>();
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> ContentWidget::desiredHeightValue() const {
|
||||||
|
return _inner->desiredHeightValue()
|
||||||
|
| rpl::map([this](int value) {
|
||||||
|
return value + _scrollTopSkip;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
rpl::producer<bool> ContentWidget::desiredShadowVisibility() const {
|
||||||
|
using namespace rpl::mappers;
|
||||||
|
return _scroll->scrollTopValue()
|
||||||
|
| rpl::map($1 > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ContentWidget::scrollTopSave() const {
|
||||||
|
return _scroll->scrollTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::scrollTopRestore(int scrollTop) {
|
||||||
|
_scroll->scrollToY(scrollTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContentWidget::scrollTo(const Ui::ScrollToRequest &request) {
|
||||||
|
_scroll->scrollTo(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ContentWidget::wheelEventFromFloatPlayer(QEvent *e) {
|
||||||
|
return _scroll->viewportEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect ContentWidget::rectForFloatPlayer() const {
|
||||||
|
return mapToGlobal(_scroll->geometry());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Info
|
150
Telegram/SourceFiles/info/info_content_widget.h
Normal file
150
Telegram/SourceFiles/info/info_content_widget.h
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/rp_widget.h"
|
||||||
|
#include "info/info_wrap_widget.h"
|
||||||
|
|
||||||
|
namespace Storage {
|
||||||
|
enum class SharedMediaType : char;
|
||||||
|
} // namespace Storage
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ScrollArea;
|
||||||
|
struct ScrollToRequest;
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
class Controller;
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
|
||||||
|
class ContentMemento;
|
||||||
|
|
||||||
|
class ContentWidget : public Ui::RpWidget {
|
||||||
|
public:
|
||||||
|
ContentWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
not_null<PeerData*> peer);
|
||||||
|
|
||||||
|
virtual bool showInternal(
|
||||||
|
not_null<ContentMemento*> memento) = 0;
|
||||||
|
virtual std::unique_ptr<ContentMemento> createMemento() = 0;
|
||||||
|
|
||||||
|
virtual rpl::producer<Section> sectionRequest() const;
|
||||||
|
|
||||||
|
Wrap wrap() const {
|
||||||
|
return _wrap;
|
||||||
|
}
|
||||||
|
void setWrap(Wrap wrap);
|
||||||
|
|
||||||
|
virtual Section section() const = 0;
|
||||||
|
not_null<PeerData*> peer() const {
|
||||||
|
return _peer;
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> desiredHeightValue() const override;
|
||||||
|
rpl::producer<bool> desiredShadowVisibility() const;
|
||||||
|
|
||||||
|
virtual void setInnerFocus() {
|
||||||
|
_inner->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// Float player interface.
|
||||||
|
bool wheelEventFromFloatPlayer(QEvent *e);
|
||||||
|
QRect rectForFloatPlayer() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
template <typename Widget>
|
||||||
|
Widget *setInnerWidget(
|
||||||
|
object_ptr<Widget> inner,
|
||||||
|
int scrollTopSkip = 0) {
|
||||||
|
return static_cast<Widget*>(
|
||||||
|
doSetInnerWidget(std::move(inner), scrollTopSkip));
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<Window::Controller*> controller() const {
|
||||||
|
return _controller;
|
||||||
|
}
|
||||||
|
rpl::producer<Wrap> wrapValue() const {
|
||||||
|
return _wrapChanges.events_starting_with_copy(_wrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
int scrollTopSave() const;
|
||||||
|
void scrollTopRestore(int scrollTop);
|
||||||
|
|
||||||
|
void scrollTo(const Ui::ScrollToRequest &request);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RpWidget *doSetInnerWidget(
|
||||||
|
object_ptr<RpWidget> inner,
|
||||||
|
int scrollTopSkip);
|
||||||
|
|
||||||
|
const not_null<Window::Controller*> _controller;
|
||||||
|
const not_null<PeerData*> _peer;
|
||||||
|
Wrap _wrap = Wrap::Layer;
|
||||||
|
rpl::event_stream<Wrap> _wrapChanges;
|
||||||
|
|
||||||
|
int _scrollTopSkip = 0;
|
||||||
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
|
Ui::RpWidget *_inner = nullptr;
|
||||||
|
|
||||||
|
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
||||||
|
int _topDelta = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class ContentMemento {
|
||||||
|
public:
|
||||||
|
virtual object_ptr<ContentWidget> createWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
const QRect &geometry) = 0;
|
||||||
|
|
||||||
|
virtual ~ContentMemento() = default;
|
||||||
|
|
||||||
|
void setScrollTop(int scrollTop) {
|
||||||
|
_scrollTop = scrollTop;
|
||||||
|
}
|
||||||
|
int scrollTop() const {
|
||||||
|
return _scrollTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int _scrollTop = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Info
|
|
@ -18,10 +18,12 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "info/info_layer_wrap.h"
|
#include "info/info_layer_widget.h"
|
||||||
|
|
||||||
#include "info/info_memento.h"
|
#include <rpl/mappers.h>
|
||||||
|
#include "info/info_content_widget.h"
|
||||||
#include "info/info_top_bar.h"
|
#include "info/info_top_bar.h"
|
||||||
|
#include "info/info_memento.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/focus_persister.h"
|
#include "ui/focus_persister.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
@ -35,81 +37,41 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr auto kThirdSectionInfoTimeoutMs = 1000;
|
LayerWidget::LayerWidget(
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
LayerWrap::LayerWrap(
|
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<Memento*> memento)
|
not_null<Memento*> memento)
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _content(createContent(controller, memento))
|
, _content(this, controller, Wrap::Layer, memento) {
|
||||||
, _topBar(createTopBar()) {
|
|
||||||
setupHeightConsumers();
|
setupHeightConsumers();
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerWrap::LayerWrap(
|
LayerWidget::LayerWidget(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<MoveMemento*> memento)
|
not_null<MoveMemento*> memento)
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _content(memento->content(this, Wrap::Layer))
|
, _content(memento->takeContent(this, Wrap::Layer)) {
|
||||||
, _topBar(createTopBar()) {
|
|
||||||
setupHeightConsumers();
|
setupHeightConsumers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrap::setupHeightConsumers() {
|
void LayerWidget::setupHeightConsumers() {
|
||||||
_content->desiredHeightValue()
|
_content->desiredHeightValue()
|
||||||
| rpl::start_with_next([this](int height) {
|
| rpl::start_with_next([this](int height) {
|
||||||
_desiredHeight = height;
|
_desiredHeight = height;
|
||||||
resizeToWidth(width());
|
resizeToWidth(width());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
heightValue()
|
|
||||||
| rpl::start_with_next([this](int height) {
|
|
||||||
_content->resize(
|
|
||||||
width(),
|
|
||||||
height - _topBar->bottomNoMargins() - st::boxRadius);
|
|
||||||
}, lifetime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<TopBar> LayerWrap::createTopBar() {
|
void LayerWidget::showFinished() {
|
||||||
auto result = object_ptr<TopBar>(
|
|
||||||
this,
|
|
||||||
st::infoLayerTopBar);
|
|
||||||
auto close = result->addButton(object_ptr<Ui::IconButton>(
|
|
||||||
result.data(),
|
|
||||||
st::infoLayerTopBarClose));
|
|
||||||
close->clicks()
|
|
||||||
| rpl::start_with_next([this] {
|
|
||||||
_controller->hideSpecialLayer();
|
|
||||||
}, close->lifetime());
|
|
||||||
result->setTitle(TitleValue(
|
|
||||||
_content->section(),
|
|
||||||
_content->peer()));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<ContentWidget> LayerWrap::createContent(
|
void LayerWidget::parentResized() {
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<Memento*> memento) {
|
|
||||||
return memento->content()->createWidget(
|
|
||||||
this,
|
|
||||||
Wrap::Layer,
|
|
||||||
controller,
|
|
||||||
QRect());
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerWrap::showFinished() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void LayerWrap::parentResized() {
|
|
||||||
auto parentSize = parentWidget()->size();
|
auto parentSize = parentWidget()->size();
|
||||||
auto parentWidth = parentSize.width();
|
auto parentWidth = parentSize.width();
|
||||||
if (parentWidth < MinimalSupportedWidth()) {
|
if (parentWidth < MinimalSupportedWidth()) {
|
||||||
Ui::FocusPersister persister(this);
|
Ui::FocusPersister persister(this);
|
||||||
auto localCopy = _controller;
|
auto localCopy = _controller;
|
||||||
auto memento = MoveMemento(std::move(_content), Wrap::Narrow);
|
auto memento = MoveMemento(std::move(_content));
|
||||||
localCopy->hideSpecialLayer(anim::type::instant);
|
localCopy->hideSpecialLayer(anim::type::instant);
|
||||||
localCopy->showSection(
|
localCopy->showSection(
|
||||||
std::move(memento),
|
std::move(memento),
|
||||||
|
@ -125,14 +87,14 @@ void LayerWrap::parentResized() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LayerWrap::takeToThirdSection() {
|
bool LayerWidget::takeToThirdSection() {
|
||||||
Ui::FocusPersister persister(this);
|
Ui::FocusPersister persister(this);
|
||||||
auto localCopy = _controller;
|
auto localCopy = _controller;
|
||||||
auto memento = MoveMemento(std::move(_content), Wrap::Side);
|
auto memento = MoveMemento(std::move(_content));
|
||||||
localCopy->hideSpecialLayer(anim::type::instant);
|
localCopy->hideSpecialLayer(anim::type::instant);
|
||||||
|
|
||||||
Auth().data().setThirdSectionInfoEnabled(true);
|
Auth().data().setThirdSectionInfoEnabled(true);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
localCopy->showSection(
|
localCopy->showSection(
|
||||||
std::move(memento),
|
std::move(memento),
|
||||||
anim::type::instant,
|
anim::type::instant,
|
||||||
|
@ -140,50 +102,50 @@ bool LayerWrap::takeToThirdSection() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LayerWrap::MinimalSupportedWidth() {
|
int LayerWidget::MinimalSupportedWidth() {
|
||||||
auto minimalMargins = 2 * st::infoMinimalLayerMargin;
|
auto minimalMargins = 2 * st::infoMinimalLayerMargin;
|
||||||
return st::infoMinimalWidth + minimalMargins;
|
return st::infoMinimalWidth + minimalMargins;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LayerWrap::resizeGetHeight(int newWidth) {
|
int LayerWidget::resizeGetHeight(int newWidth) {
|
||||||
if (!parentWidget() || !_content) {
|
if (!parentWidget() || !_content) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First resize content to new width and get the new desired height.
|
|
||||||
_topBar->resizeToWidth(newWidth);
|
|
||||||
_topBar->moveToLeft(0, st::boxRadius, newWidth);
|
|
||||||
_content->resizeToWidth(newWidth);
|
|
||||||
_content->moveToLeft(0, _topBar->bottomNoMargins(), newWidth);
|
|
||||||
|
|
||||||
auto parentSize = parentWidget()->size();
|
auto parentSize = parentWidget()->size();
|
||||||
auto windowWidth = parentSize.width();
|
auto windowWidth = parentSize.width();
|
||||||
auto windowHeight = parentSize.height();
|
auto windowHeight = parentSize.height();
|
||||||
auto maxHeight = _topBar->height() + _desiredHeight;
|
auto newHeight = st::boxRadius + _desiredHeight + st::boxRadius;
|
||||||
auto newHeight = st::boxRadius + maxHeight + st::boxRadius;
|
|
||||||
if (newHeight > windowHeight || newWidth >= windowWidth) {
|
if (newHeight > windowHeight || newWidth >= windowWidth) {
|
||||||
newHeight = windowHeight;
|
newHeight = windowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
setRoundedCorners(newHeight < windowHeight);
|
setRoundedCorners(newHeight < windowHeight);
|
||||||
|
|
||||||
|
// First resize content to new width and get the new desired height.
|
||||||
|
auto contentTop = st::boxRadius;
|
||||||
|
auto contentHeight = newHeight - contentTop;
|
||||||
|
if (_roundedCorners) {
|
||||||
|
contentHeight -= st::boxRadius;
|
||||||
|
}
|
||||||
|
_content->setGeometry(0, contentTop, newWidth, contentHeight);
|
||||||
|
|
||||||
moveToLeft((windowWidth - newWidth) / 2, (windowHeight - newHeight) / 2);
|
moveToLeft((windowWidth - newWidth) / 2, (windowHeight - newHeight) / 2);
|
||||||
|
|
||||||
_topBar->update();
|
|
||||||
_content->update();
|
_content->update();
|
||||||
update();
|
update();
|
||||||
|
|
||||||
return newHeight;
|
return newHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrap::setRoundedCorners(bool rounded) {
|
void LayerWidget::setRoundedCorners(bool rounded) {
|
||||||
_roundedCorners = rounded;
|
_roundedCorners = rounded;
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, !_roundedCorners);
|
setAttribute(Qt::WA_OpaquePaintEvent, !_roundedCorners);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrap::paintEvent(QPaintEvent *e) {
|
void LayerWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
if (_roundedCorners) {
|
if (_roundedCorners) {
|
||||||
Painter p(this);
|
|
||||||
auto clip = e->rect();
|
auto clip = e->rect();
|
||||||
auto r = st::boxRadius;
|
auto r = st::boxRadius;
|
||||||
auto parts = RectPart::None | 0;
|
auto parts = RectPart::None | 0;
|
||||||
|
@ -202,6 +164,8 @@ void LayerWrap::paintEvent(QPaintEvent *e) {
|
||||||
nullptr,
|
nullptr,
|
||||||
parts);
|
parts);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
p.fillRect(0, 0, width(), st::boxRadius, st::boxBg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "layerwidget.h"
|
#include "window/layer_widget.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
class Controller;
|
class Controller;
|
||||||
|
@ -30,15 +30,15 @@ namespace Info {
|
||||||
|
|
||||||
class Memento;
|
class Memento;
|
||||||
class MoveMemento;
|
class MoveMemento;
|
||||||
class ContentWidget;
|
class WrapWidget;
|
||||||
class TopBar;
|
class TopBar;
|
||||||
|
|
||||||
class LayerWrap : public LayerWidget {
|
class LayerWidget : public Window::LayerWidget {
|
||||||
public:
|
public:
|
||||||
LayerWrap(
|
LayerWidget(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
LayerWrap(
|
LayerWidget(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
not_null<MoveMemento*> memento);
|
not_null<MoveMemento*> memento);
|
||||||
|
|
||||||
|
@ -57,16 +57,10 @@ protected:
|
||||||
private:
|
private:
|
||||||
void setupHeightConsumers();
|
void setupHeightConsumers();
|
||||||
|
|
||||||
object_ptr<ContentWidget> createContent(
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<Memento*> memento);
|
|
||||||
object_ptr<TopBar> createTopBar();
|
|
||||||
|
|
||||||
void setRoundedCorners(bool roundedCorners);
|
void setRoundedCorners(bool roundedCorners);
|
||||||
|
|
||||||
not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
object_ptr<ContentWidget> _content;
|
object_ptr<WrapWidget> _content;
|
||||||
object_ptr<TopBar> _topBar;
|
|
||||||
|
|
||||||
int _desiredHeight = 0;
|
int _desiredHeight = 0;
|
||||||
bool _roundedCorners = false;
|
bool _roundedCorners = false;
|
|
@ -20,138 +20,29 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "info/info_memento.h"
|
#include "info/info_memento.h"
|
||||||
|
|
||||||
#include <rpl/never.h>
|
|
||||||
#include <rpl/combine.h>
|
|
||||||
#include "window/window_controller.h"
|
|
||||||
#include "ui/widgets/scroll_area.h"
|
|
||||||
#include "lang/lang_keys.h"
|
|
||||||
#include "info/profile/info_profile_widget.h"
|
#include "info/profile/info_profile_widget.h"
|
||||||
#include "info/info_media_widget.h"
|
#include "info/media/info_media_widget.h"
|
||||||
#include "info/info_common_groups_widget.h"
|
#include "info/info_common_groups_widget.h"
|
||||||
#include "info/info_layer_wrap.h"
|
#include "info/info_section_widget.h"
|
||||||
#include "info/info_narrow_wrap.h"
|
#include "info/info_layer_widget.h"
|
||||||
#include "info/info_side_wrap.h"
|
|
||||||
#include "styles/style_info.h"
|
|
||||||
#include "styles/style_profile.h"
|
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
ContentWidget::ContentWidget(
|
Memento::Memento(PeerId peerId)
|
||||||
QWidget *parent,
|
: Memento(peerId, Section::Type::Profile) {
|
||||||
Wrap wrap,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<PeerData*> peer)
|
|
||||||
: RpWidget(parent)
|
|
||||||
, _controller(controller)
|
|
||||||
, _peer(peer)
|
|
||||||
, _wrap(wrap)
|
|
||||||
, _scroll(this, st::infoScroll) {
|
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentWidget::setWrap(Wrap wrap) {
|
Memento::Memento(PeerId peerId, Section section)
|
||||||
if (_wrap != wrap) {
|
: Memento(peerId, section, Default(peerId, section)) {
|
||||||
_wrap = wrap;
|
|
||||||
_wrapChanges.fire_copy(_wrap);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentWidget::resizeEvent(QResizeEvent *e) {
|
Memento::Memento(
|
||||||
auto newScrollTop = _scroll->scrollTop() + _topDelta;
|
PeerId peerId,
|
||||||
auto scrollGeometry = rect().marginsRemoved(
|
Section section,
|
||||||
QMargins(0, _scrollTopSkip, 0, 0));
|
std::unique_ptr<ContentMemento> content)
|
||||||
if (_scroll->geometry() != scrollGeometry) {
|
: _peerId(peerId)
|
||||||
_scroll->setGeometry(scrollGeometry);
|
, _section(section)
|
||||||
_inner->resizeToWidth(_scroll->width());
|
, _content(std::move(content)) {
|
||||||
}
|
|
||||||
|
|
||||||
if (!_scroll->isHidden()) {
|
|
||||||
if (_topDelta) {
|
|
||||||
_scroll->scrollToY(newScrollTop);
|
|
||||||
}
|
|
||||||
auto scrollTop = _scroll->scrollTop();
|
|
||||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentWidget::paintEvent(QPaintEvent *e) {
|
|
||||||
Painter p(this);
|
|
||||||
p.fillRect(e->rect(), (_wrap == Wrap::Layer)
|
|
||||||
? st::boxBg
|
|
||||||
: st::profileBg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentWidget::setGeometryWithTopMoved(
|
|
||||||
const QRect &newGeometry,
|
|
||||||
int topDelta) {
|
|
||||||
_topDelta = topDelta;
|
|
||||||
auto willBeResized = (size() != newGeometry.size());
|
|
||||||
if (geometry() != newGeometry) {
|
|
||||||
setGeometry(newGeometry);
|
|
||||||
}
|
|
||||||
if (!willBeResized) {
|
|
||||||
QResizeEvent fake(size(), size());
|
|
||||||
QApplication::sendEvent(this, &fake);
|
|
||||||
}
|
|
||||||
_topDelta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ui::RpWidget *ContentWidget::doSetInnerWidget(
|
|
||||||
object_ptr<RpWidget> inner,
|
|
||||||
int scrollTopSkip) {
|
|
||||||
using namespace rpl::mappers;
|
|
||||||
|
|
||||||
_inner = _scroll->setOwnedWidget(std::move(inner));
|
|
||||||
_inner->move(0, 0);
|
|
||||||
|
|
||||||
rpl::combine(
|
|
||||||
_scroll->scrollTopValue(),
|
|
||||||
_scroll->heightValue(),
|
|
||||||
_inner->desiredHeightValue(),
|
|
||||||
tuple($1, $1 + $2, $3))
|
|
||||||
| rpl::start_with_next([inner = _inner](
|
|
||||||
int top,
|
|
||||||
int bottom,
|
|
||||||
int desired) {
|
|
||||||
inner->setVisibleTopBottom(top, bottom);
|
|
||||||
}, _inner->lifetime());
|
|
||||||
return _inner;
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<Section> ContentWidget::sectionRequest() const {
|
|
||||||
return rpl::never<Section>();
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> ContentWidget::desiredHeightValue() const {
|
|
||||||
return _inner->desiredHeightValue()
|
|
||||||
| rpl::map([this](int value) {
|
|
||||||
return value + _scrollTopSkip;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> ContentWidget::scrollTopValue() const {
|
|
||||||
return _scroll->scrollTopValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ContentWidget::scrollTopSave() const {
|
|
||||||
return _scroll->scrollTop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentWidget::scrollTopRestore(int scrollTop) {
|
|
||||||
_scroll->scrollToY(scrollTop);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentWidget::scrollTo(const Ui::ScrollToRequest &request) {
|
|
||||||
_scroll->scrollTo(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ContentWidget::wheelEventFromFloatPlayer(QEvent *e) {
|
|
||||||
return _scroll->viewportEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect ContentWidget::rectForFloatPlayer() const {
|
|
||||||
return mapToGlobal(_scroll->geometry());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ContentMemento> Memento::Default(
|
std::unique_ptr<ContentMemento> Memento::Default(
|
||||||
|
@ -177,34 +68,35 @@ object_ptr<Window::SectionWidget> Memento::createWidget(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
Window::Column column,
|
Window::Column column,
|
||||||
const QRect &geometry) {
|
const QRect &geometry) {
|
||||||
if (column == Window::Column::Third) {
|
auto wrap = (column == Window::Column::Third)
|
||||||
return object_ptr<SideWrap>(
|
? Wrap::Side
|
||||||
parent,
|
: Wrap::Narrow;
|
||||||
controller,
|
auto result = object_ptr<SectionWidget>(
|
||||||
this);
|
|
||||||
}
|
|
||||||
return object_ptr<NarrowWrap>(
|
|
||||||
parent,
|
parent,
|
||||||
controller,
|
controller,
|
||||||
|
wrap,
|
||||||
this);
|
this);
|
||||||
|
result->setGeometry(geometry);
|
||||||
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<LayerWidget> Memento::createLayer(
|
object_ptr<Window::LayerWidget> Memento::createLayer(
|
||||||
not_null<Window::Controller*> controller) {
|
not_null<Window::Controller*> controller,
|
||||||
auto layout = controller->computeColumnLayout();
|
const QRect &geometry) {
|
||||||
auto minimalWidthForLayer = st::infoMinimalWidth
|
if (geometry.width() >= LayerWidget::MinimalSupportedWidth()) {
|
||||||
+ 2 * st::infoMinimalLayerMargin;
|
return object_ptr<LayerWidget>(controller, this);
|
||||||
if (layout.bodyWidth < minimalWidthForLayer) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
return object_ptr<LayerWrap>(controller, this);
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveMemento::MoveMemento(
|
void Memento::setInner(std::unique_ptr<ContentMemento> content) {
|
||||||
object_ptr<ContentWidget> content,
|
_content = std::move(content);
|
||||||
Wrap wrap)
|
}
|
||||||
: _content(std::move(content))
|
|
||||||
, _wrap(wrap) {
|
Memento::~Memento() = default;
|
||||||
|
|
||||||
|
MoveMemento::MoveMemento(object_ptr<WrapWidget> content)
|
||||||
|
: _content(std::move(content)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> MoveMemento::createWidget(
|
object_ptr<Window::SectionWidget> MoveMemento::createWidget(
|
||||||
|
@ -212,36 +104,28 @@ object_ptr<Window::SectionWidget> MoveMemento::createWidget(
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
Window::Column column,
|
Window::Column column,
|
||||||
const QRect &geometry) {
|
const QRect &geometry) {
|
||||||
if (_wrap == Wrap::Narrow && column != Window::Column::Third) {
|
auto wrap = (column == Window::Column::Third)
|
||||||
auto result = object_ptr<NarrowWrap>(
|
? Wrap::Side
|
||||||
parent,
|
: Wrap::Narrow;
|
||||||
controller,
|
auto result = object_ptr<SectionWidget>(
|
||||||
this);
|
parent,
|
||||||
result->setGeometry(geometry);
|
controller,
|
||||||
return std::move(result);
|
wrap,
|
||||||
} else if (_wrap == Wrap::Side && column == Window::Column::Third) {
|
this);
|
||||||
auto result = object_ptr<SideWrap>(
|
result->setGeometry(geometry);
|
||||||
parent,
|
return std::move(result);
|
||||||
controller,
|
|
||||||
this);
|
|
||||||
result->setGeometry(geometry);
|
|
||||||
return std::move(result);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<LayerWidget> MoveMemento::createLayer(
|
object_ptr<Window::LayerWidget> MoveMemento::createLayer(
|
||||||
not_null<Window::Controller*> controller) {
|
not_null<Window::Controller*> controller,
|
||||||
if (_wrap == Wrap::Layer) {
|
const QRect &geometry) {
|
||||||
auto result = object_ptr<LayerWrap>(
|
if (geometry.width() < LayerWidget::MinimalSupportedWidth()) {
|
||||||
controller,
|
return nullptr;
|
||||||
this);
|
|
||||||
return std::move(result);
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
return object_ptr<LayerWidget>(controller, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<ContentWidget> MoveMemento::content(
|
object_ptr<WrapWidget> MoveMemento::takeContent(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
Wrap wrap) {
|
Wrap wrap) {
|
||||||
Ui::AttachParentChild(parent, _content);
|
Ui::AttachParentChild(parent, _content);
|
||||||
|
@ -249,50 +133,4 @@ object_ptr<ContentWidget> MoveMemento::content(
|
||||||
return std::move(_content);
|
return std::move(_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<QString> TitleValue(
|
|
||||||
const Section §ion,
|
|
||||||
not_null<PeerData*> peer) {
|
|
||||||
return Lang::Viewer([&] {
|
|
||||||
switch (section.type()) {
|
|
||||||
case Section::Type::Profile:
|
|
||||||
if (auto user = peer->asUser()) {
|
|
||||||
return user->botInfo
|
|
||||||
? lng_info_bot_title
|
|
||||||
: lng_info_user_title;
|
|
||||||
} else if (auto channel = peer->asChannel()) {
|
|
||||||
return channel->isMegagroup()
|
|
||||||
? lng_info_group_title
|
|
||||||
: lng_info_channel_title;
|
|
||||||
} else if (peer->isChat()) {
|
|
||||||
return lng_info_group_title;
|
|
||||||
}
|
|
||||||
Unexpected("Bad peer type in Info::TitleValue()");
|
|
||||||
|
|
||||||
case Section::Type::Media:
|
|
||||||
switch (section.mediaType()) {
|
|
||||||
case Section::MediaType::Photo:
|
|
||||||
return lng_media_type_photos;
|
|
||||||
case Section::MediaType::Video:
|
|
||||||
return lng_media_type_videos;
|
|
||||||
case Section::MediaType::MusicFile:
|
|
||||||
return lng_media_type_songs;
|
|
||||||
case Section::MediaType::File:
|
|
||||||
return lng_media_type_files;
|
|
||||||
case Section::MediaType::VoiceFile:
|
|
||||||
return lng_media_type_audios;
|
|
||||||
case Section::MediaType::Link:
|
|
||||||
return lng_media_type_links;
|
|
||||||
case Section::MediaType::RoundFile:
|
|
||||||
return lng_media_type_rounds;
|
|
||||||
}
|
|
||||||
Unexpected("Bad media type in Info::TitleValue()");
|
|
||||||
|
|
||||||
case Section::Type::CommonGroups:
|
|
||||||
return lng_profile_common_groups_section;
|
|
||||||
|
|
||||||
}
|
|
||||||
Unexpected("Bad section type in Info::TitleValue()");
|
|
||||||
}());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -20,8 +20,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/section_memento.h"
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
#include "info/info_wrap_widget.h"
|
||||||
|
#include "window/section_memento.h"
|
||||||
|
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
enum class SharedMediaType : char;
|
enum class SharedMediaType : char;
|
||||||
|
@ -34,164 +35,17 @@ struct ScrollToRequest;
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
enum class Wrap {
|
|
||||||
Layer,
|
|
||||||
Narrow,
|
|
||||||
Side,
|
|
||||||
};
|
|
||||||
|
|
||||||
class Section final {
|
|
||||||
public:
|
|
||||||
enum class Type {
|
|
||||||
Profile,
|
|
||||||
Media,
|
|
||||||
CommonGroups,
|
|
||||||
};
|
|
||||||
using MediaType = Storage::SharedMediaType;
|
|
||||||
|
|
||||||
Section(Type type) : _type(type) {
|
|
||||||
Expects(type != Type::Media);
|
|
||||||
}
|
|
||||||
Section(MediaType mediaType)
|
|
||||||
: _type(Type::Media)
|
|
||||||
, _mediaType(mediaType) {
|
|
||||||
}
|
|
||||||
|
|
||||||
Type type() const {
|
|
||||||
return _type;
|
|
||||||
}
|
|
||||||
MediaType mediaType() const {
|
|
||||||
Expects(_type == Type::Media);
|
|
||||||
return _mediaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Type _type;
|
|
||||||
Storage::SharedMediaType _mediaType;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class ContentMemento;
|
class ContentMemento;
|
||||||
|
class WrapWidget;
|
||||||
class ContentWidget : public Ui::RpWidget {
|
|
||||||
public:
|
|
||||||
ContentWidget(
|
|
||||||
QWidget *parent,
|
|
||||||
Wrap wrap,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<PeerData*> peer);
|
|
||||||
|
|
||||||
virtual bool showInternal(
|
|
||||||
not_null<ContentMemento*> memento) = 0;
|
|
||||||
virtual std::unique_ptr<ContentMemento> createMemento() = 0;
|
|
||||||
|
|
||||||
virtual rpl::producer<Section> sectionRequest() const;
|
|
||||||
|
|
||||||
void setWrap(Wrap wrap);
|
|
||||||
virtual Section section() const = 0;
|
|
||||||
not_null<PeerData*> peer() const {
|
|
||||||
return _peer;
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> desiredHeightValue() const override;
|
|
||||||
|
|
||||||
virtual void setInnerFocus() {
|
|
||||||
_inner->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Float player interface.
|
|
||||||
bool wheelEventFromFloatPlayer(QEvent *e);
|
|
||||||
QRect rectForFloatPlayer() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
template <typename Widget>
|
|
||||||
Widget *setInnerWidget(
|
|
||||||
object_ptr<Widget> inner,
|
|
||||||
int scrollTopSkip = 0) {
|
|
||||||
return static_cast<Widget*>(
|
|
||||||
doSetInnerWidget(std::move(inner), scrollTopSkip));
|
|
||||||
}
|
|
||||||
|
|
||||||
not_null<Window::Controller*> controller() const {
|
|
||||||
return _controller;
|
|
||||||
}
|
|
||||||
rpl::producer<Wrap> wrapValue() const {
|
|
||||||
return _wrapChanges.events_starting_with_copy(_wrap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
rpl::producer<int> scrollTopValue() const;
|
|
||||||
int scrollTopSave() const;
|
|
||||||
void scrollTopRestore(int scrollTop);
|
|
||||||
|
|
||||||
void scrollTo(const Ui::ScrollToRequest &request);
|
|
||||||
|
|
||||||
private:
|
|
||||||
RpWidget *doSetInnerWidget(
|
|
||||||
object_ptr<RpWidget> inner,
|
|
||||||
int scrollTopSkip);
|
|
||||||
|
|
||||||
const not_null<Window::Controller*> _controller;
|
|
||||||
const not_null<PeerData*> _peer;
|
|
||||||
Wrap _wrap = Wrap::Layer;
|
|
||||||
rpl::event_stream<Wrap> _wrapChanges;
|
|
||||||
|
|
||||||
int _scrollTopSkip = 0;
|
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
|
||||||
Ui::RpWidget *_inner = nullptr;
|
|
||||||
|
|
||||||
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
|
||||||
int _topDelta = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class ContentMemento {
|
|
||||||
public:
|
|
||||||
virtual object_ptr<ContentWidget> createWidget(
|
|
||||||
QWidget *parent,
|
|
||||||
Wrap wrap,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
const QRect &geometry) = 0;
|
|
||||||
|
|
||||||
virtual ~ContentMemento() = default;
|
|
||||||
|
|
||||||
void setScrollTop(int scrollTop) {
|
|
||||||
_scrollTop = scrollTop;
|
|
||||||
}
|
|
||||||
int scrollTop() const {
|
|
||||||
return _scrollTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int _scrollTop = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class Memento final : public Window::SectionMemento {
|
class Memento final : public Window::SectionMemento {
|
||||||
public:
|
public:
|
||||||
Memento(PeerId peerId)
|
Memento(PeerId peerId);
|
||||||
: Memento(peerId, Section::Type::Profile) {
|
Memento(PeerId peerId, Section section);
|
||||||
}
|
|
||||||
Memento(PeerId peerId, Section section)
|
|
||||||
: Memento(peerId, section, Default(peerId, section)) {
|
|
||||||
}
|
|
||||||
Memento(
|
Memento(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
Section section,
|
Section section,
|
||||||
std::unique_ptr<ContentMemento> content)
|
std::unique_ptr<ContentMemento> content);
|
||||||
: _peerId(peerId)
|
|
||||||
, _section(section)
|
|
||||||
, _content(std::move(content)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> createWidget(
|
object_ptr<Window::SectionWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -199,12 +53,11 @@ public:
|
||||||
Window::Column column,
|
Window::Column column,
|
||||||
const QRect &geometry) override;
|
const QRect &geometry) override;
|
||||||
|
|
||||||
object_ptr<LayerWidget> createLayer(
|
object_ptr<Window::LayerWidget> createLayer(
|
||||||
not_null<Window::Controller*> controller) override;
|
not_null<Window::Controller*> controller,
|
||||||
|
const QRect &geometry) override;
|
||||||
|
|
||||||
void setInner(std::unique_ptr<ContentMemento> content) {
|
void setInner(std::unique_ptr<ContentMemento> content);
|
||||||
_content = std::move(content);
|
|
||||||
}
|
|
||||||
not_null<ContentMemento*> content() {
|
not_null<ContentMemento*> content() {
|
||||||
return _content.get();
|
return _content.get();
|
||||||
}
|
}
|
||||||
|
@ -216,6 +69,8 @@ public:
|
||||||
return _section;
|
return _section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~Memento();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::unique_ptr<ContentMemento> Default(
|
static std::unique_ptr<ContentMemento> Default(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
|
@ -229,7 +84,7 @@ private:
|
||||||
|
|
||||||
class MoveMemento final : public Window::SectionMemento {
|
class MoveMemento final : public Window::SectionMemento {
|
||||||
public:
|
public:
|
||||||
MoveMemento(object_ptr<ContentWidget> content, Wrap wrap);
|
MoveMemento(object_ptr<WrapWidget> content);
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> createWidget(
|
object_ptr<Window::SectionWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -237,25 +92,21 @@ public:
|
||||||
Window::Column column,
|
Window::Column column,
|
||||||
const QRect &geometry) override;
|
const QRect &geometry) override;
|
||||||
|
|
||||||
object_ptr<LayerWidget> createLayer(
|
object_ptr<Window::LayerWidget> createLayer(
|
||||||
not_null<Window::Controller*> controller) override;
|
not_null<Window::Controller*> controller,
|
||||||
|
const QRect &geometry) override;
|
||||||
|
|
||||||
bool instant() const override {
|
bool instant() const override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<ContentWidget> content(
|
object_ptr<WrapWidget> takeContent(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
Wrap wrap);
|
Wrap wrap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
object_ptr<ContentWidget> _content;
|
object_ptr<WrapWidget> _content;
|
||||||
Wrap _wrap = Wrap::Layer;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rpl::producer<QString> TitleValue(
|
|
||||||
const Section §ion,
|
|
||||||
not_null<PeerData*> peer);
|
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -1,208 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of Telegram Desktop,
|
|
||||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
||||||
|
|
||||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
It is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give permission
|
|
||||||
to link the code of portions of this program with the OpenSSL library.
|
|
||||||
|
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#include "info/info_narrow_wrap.h"
|
|
||||||
|
|
||||||
#include <rpl/flatten_latest.h>
|
|
||||||
#include <rpl/filter.h>
|
|
||||||
#include "info/profile/info_profile_widget.h"
|
|
||||||
#include "info/info_media_widget.h"
|
|
||||||
#include "info/info_memento.h"
|
|
||||||
#include "info/info_top_bar.h"
|
|
||||||
#include "info/info_layer_wrap.h"
|
|
||||||
#include "ui/widgets/discrete_sliders.h"
|
|
||||||
#include "ui/widgets/shadow.h"
|
|
||||||
#include "ui/widgets/buttons.h"
|
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "window/window_controller.h"
|
|
||||||
#include "window/main_window.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "lang/lang_keys.h"
|
|
||||||
#include "mainwidget.h"
|
|
||||||
#include "styles/style_info.h"
|
|
||||||
#include "styles/style_profile.h"
|
|
||||||
|
|
||||||
namespace Info {
|
|
||||||
|
|
||||||
NarrowWrap::NarrowWrap(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<Memento*> memento)
|
|
||||||
: Window::SectionWidget(parent, controller)
|
|
||||||
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
|
||||||
_topShadow->hideFast();
|
|
||||||
_topShadow->raise();
|
|
||||||
setInternalState(geometry(), memento);
|
|
||||||
}
|
|
||||||
|
|
||||||
NarrowWrap::NarrowWrap(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<MoveMemento*> memento)
|
|
||||||
: Window::SectionWidget(parent, controller)
|
|
||||||
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
|
||||||
_topShadow->hideFast();
|
|
||||||
_topShadow->raise();
|
|
||||||
restoreState(memento);
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<LayerWidget> NarrowWrap::moveContentToLayer(
|
|
||||||
int availableWidth) {
|
|
||||||
if (width() < LayerWrap::MinimalSupportedWidth()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return MoveMemento(
|
|
||||||
std::move(_content),
|
|
||||||
Wrap::Layer
|
|
||||||
).createLayer(controller());
|
|
||||||
}
|
|
||||||
|
|
||||||
not_null<PeerData*> NarrowWrap::peer() const {
|
|
||||||
return _content->peer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::showContent(object_ptr<ContentWidget> content) {
|
|
||||||
_content = std::move(content);
|
|
||||||
_content->setGeometry(contentGeometry());
|
|
||||||
_content->show();
|
|
||||||
|
|
||||||
_topBar = createTopBar();
|
|
||||||
|
|
||||||
_desiredHeights.fire(desiredHeightForContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<TopBar> NarrowWrap::createTopBar() {
|
|
||||||
auto result = object_ptr<TopBar>(
|
|
||||||
this,
|
|
||||||
st::infoLayerTopBar);
|
|
||||||
result->enableBackButton(true);
|
|
||||||
result->backRequest()
|
|
||||||
| rpl::start_with_next([this] {
|
|
||||||
this->controller()->showBackFromStack();
|
|
||||||
}, result->lifetime());
|
|
||||||
result->setTitle(TitleValue(
|
|
||||||
_content->section(),
|
|
||||||
_content->peer()));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> NarrowWrap::desiredHeightForContent() const {
|
|
||||||
return _content->desiredHeightValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap NarrowWrap::grabForShowAnimation(
|
|
||||||
const Window::SectionSlideParams ¶ms) {
|
|
||||||
anim::SetDisabled(true);
|
|
||||||
if (params.withTopBarShadow) _topShadow->hide();
|
|
||||||
auto result = myGrab(this);
|
|
||||||
if (params.withTopBarShadow) _topShadow->show();
|
|
||||||
anim::SetDisabled(false);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::doSetInnerFocus() {
|
|
||||||
// _content->setInnerFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NarrowWrap::hasTopBarShadow() const {
|
|
||||||
return !_topShadow->isHidden() && !_topShadow->animating();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NarrowWrap::showInternal(
|
|
||||||
not_null<Window::SectionMemento*> memento) {
|
|
||||||
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
|
||||||
if (infoMemento->peerId() == peer()->id) {
|
|
||||||
restoreState(infoMemento);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::setInternalState(
|
|
||||||
const QRect &geometry,
|
|
||||||
not_null<Memento*> memento) {
|
|
||||||
setGeometry(geometry);
|
|
||||||
restoreState(memento);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<Window::SectionMemento> NarrowWrap::createMemento() {
|
|
||||||
auto result = std::make_unique<Memento>(peer()->id);
|
|
||||||
saveState(result.get());
|
|
||||||
return std::move(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> NarrowWrap::desiredHeight() const {
|
|
||||||
return
|
|
||||||
rpl::single(desiredHeightForContent())
|
|
||||||
| rpl::then(_desiredHeights.events())
|
|
||||||
| rpl::flatten_latest();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::saveState(not_null<Memento*> memento) {
|
|
||||||
memento->setInner(_content->createMemento());
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect NarrowWrap::contentGeometry() const {
|
|
||||||
return rect().marginsRemoved(
|
|
||||||
QMargins(0, _topBar ? _topBar->bottomNoMargins() : 0, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::restoreState(not_null<Memento*> memento) {
|
|
||||||
showContent(memento->content()->createWidget(
|
|
||||||
this,
|
|
||||||
Wrap::Narrow,
|
|
||||||
controller(),
|
|
||||||
contentGeometry()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::restoreState(not_null<MoveMemento*> memento) {
|
|
||||||
showContent(memento->content(this, Wrap::Narrow));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::resizeEvent(QResizeEvent *e) {
|
|
||||||
if (_topBar) {
|
|
||||||
_topBar->resizeToWidth(width());
|
|
||||||
_topBar->moveToLeft(0, 0);
|
|
||||||
}
|
|
||||||
if (_content) {
|
|
||||||
_content->setGeometry(contentGeometry());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NarrowWrap::paintEvent(QPaintEvent *e) {
|
|
||||||
SectionWidget::paintEvent(e);
|
|
||||||
if (animating()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Painter p(this);
|
|
||||||
p.fillRect(e->rect(), st::profileBg);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NarrowWrap::wheelEventFromFloatPlayer(QEvent *e) {
|
|
||||||
return _content->wheelEventFromFloatPlayer(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect NarrowWrap::rectForFloatPlayer() const {
|
|
||||||
return _content->rectForFloatPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Info
|
|
111
Telegram/SourceFiles/info/info_section_widget.cpp
Normal file
111
Telegram/SourceFiles/info/info_section_widget.cpp
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#include "info/info_section_widget.h"
|
||||||
|
|
||||||
|
#include "info/info_content_widget.h"
|
||||||
|
#include "info/info_wrap_widget.h"
|
||||||
|
#include "info/info_layer_widget.h"
|
||||||
|
#include "info/info_memento.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
|
||||||
|
SectionWidget::SectionWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<Memento*> memento)
|
||||||
|
: Window::SectionWidget(parent, controller)
|
||||||
|
, _content(this, controller, wrap, memento) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
SectionWidget::SectionWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<MoveMemento*> memento)
|
||||||
|
: Window::SectionWidget(parent, controller)
|
||||||
|
, _content(memento->takeContent(this, wrap)) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SectionWidget::init() {
|
||||||
|
_content->move(0, 0);
|
||||||
|
sizeValue()
|
||||||
|
| rpl::start_with_next([wrap = _content.data()](QSize size) {
|
||||||
|
wrap->resize(size);
|
||||||
|
}, _content->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
|
PeerData *SectionWidget::peerForDialogs() const {
|
||||||
|
return _content->peer();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SectionWidget::hasTopBarShadow() const {
|
||||||
|
return _content->hasTopBarShadow();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap SectionWidget::grabForShowAnimation(
|
||||||
|
const Window::SectionSlideParams ¶ms) {
|
||||||
|
return _content->grabForShowAnimation(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SectionWidget::doSetInnerFocus() {
|
||||||
|
_content->setInnerFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SectionWidget::showFinishedHook() {
|
||||||
|
_content->showFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SectionWidget::showInternal(
|
||||||
|
not_null<Window::SectionMemento*> memento) {
|
||||||
|
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||||
|
_content->showInternal(infoMemento);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Window::SectionMemento> SectionWidget::createMemento() {
|
||||||
|
auto result = std::make_unique<Memento>(_content->peer()->id);
|
||||||
|
_content->saveState(result.get());
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<Window::LayerWidget> SectionWidget::moveContentToLayer(
|
||||||
|
QRect bodyGeometry) {
|
||||||
|
if (_content->wrap() != Wrap::Narrow
|
||||||
|
|| width() < LayerWidget::MinimalSupportedWidth()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return MoveMemento(
|
||||||
|
std::move(_content)).createLayer(controller(), bodyGeometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SectionWidget::wheelEventFromFloatPlayer(QEvent *e) {
|
||||||
|
return _content->wheelEventFromFloatPlayer(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect SectionWidget::rectForFloatPlayer() const {
|
||||||
|
return _content->rectForFloatPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Info
|
|
@ -24,44 +24,33 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PlainShadow;
|
|
||||||
class SettingsSlider;
|
class SettingsSlider;
|
||||||
template <typename Widget>
|
|
||||||
class WidgetFadeWrap;
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Profile {
|
|
||||||
class Widget;
|
|
||||||
} // namespace Profile
|
|
||||||
|
|
||||||
namespace Media {
|
|
||||||
class Widget;
|
|
||||||
} // namespace Media
|
|
||||||
|
|
||||||
class Memento;
|
class Memento;
|
||||||
class MoveMemento;
|
class MoveMemento;
|
||||||
class ContentWidget;
|
class WrapWidget;
|
||||||
class TopBar;
|
enum class Wrap;
|
||||||
|
|
||||||
class NarrowWrap final : public Window::SectionWidget {
|
class SectionWidget final : public Window::SectionWidget {
|
||||||
public:
|
public:
|
||||||
NarrowWrap(
|
SectionWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
NarrowWrap(
|
SectionWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
not_null<MoveMemento*> memento);
|
not_null<MoveMemento*> memento);
|
||||||
|
|
||||||
not_null<PeerData*> peer() const;
|
not_null<PeerData*> peer() const;
|
||||||
PeerData *peerForDialogs() const override {
|
PeerData *peerForDialogs() const override;
|
||||||
return peer();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasTopBarShadow() const override;
|
bool hasTopBarShadow() const override;
|
||||||
|
|
||||||
QPixmap grabForShowAnimation(
|
QPixmap grabForShowAnimation(
|
||||||
const Window::SectionSlideParams ¶ms) override;
|
const Window::SectionSlideParams ¶ms) override;
|
||||||
|
|
||||||
|
@ -69,43 +58,21 @@ public:
|
||||||
not_null<Window::SectionMemento*> memento) override;
|
not_null<Window::SectionMemento*> memento) override;
|
||||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||||
|
|
||||||
rpl::producer<int> desiredHeight() const override;
|
object_ptr<Window::LayerWidget> moveContentToLayer(
|
||||||
|
QRect bodyGeometry) override;
|
||||||
object_ptr<LayerWidget> moveContentToLayer(
|
|
||||||
int availableWidth) override;
|
|
||||||
|
|
||||||
void setInternalState(
|
|
||||||
const QRect &geometry,
|
|
||||||
not_null<Memento*> memento);
|
|
||||||
|
|
||||||
// Float player interface.
|
// Float player interface.
|
||||||
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
||||||
QRect rectForFloatPlayer() const override;
|
QRect rectForFloatPlayer() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
void doSetInnerFocus() override;
|
void doSetInnerFocus() override;
|
||||||
|
void showFinishedHook() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void init();
|
||||||
void restoreState(not_null<Memento*> memento);
|
|
||||||
void restoreState(not_null<MoveMemento*> memento);
|
|
||||||
|
|
||||||
QRect contentGeometry() const;
|
object_ptr<WrapWidget> _content;
|
||||||
rpl::producer<int> desiredHeightForContent() const;
|
|
||||||
|
|
||||||
void showContent(object_ptr<ContentWidget> content);
|
|
||||||
object_ptr<TopBar> createTopBar();
|
|
||||||
|
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::PlainShadow>> _topShadow = { nullptr };
|
|
||||||
object_ptr<ContentWidget> _content = { nullptr };
|
|
||||||
object_ptr<TopBar> _topBar = { nullptr };
|
|
||||||
|
|
||||||
rpl::event_stream<rpl::producer<int>> _desiredHeights;
|
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,270 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of Telegram Desktop,
|
|
||||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
||||||
|
|
||||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
It is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give permission
|
|
||||||
to link the code of portions of this program with the OpenSSL library.
|
|
||||||
|
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#include "info/info_side_wrap.h"
|
|
||||||
|
|
||||||
#include <rpl/flatten_latest.h>
|
|
||||||
#include "info/profile/info_profile_widget.h"
|
|
||||||
#include "info/info_media_widget.h"
|
|
||||||
#include "info/info_memento.h"
|
|
||||||
#include "ui/widgets/discrete_sliders.h"
|
|
||||||
#include "auth_session.h"
|
|
||||||
#include "ui/widgets/shadow.h"
|
|
||||||
#include "lang/lang_keys.h"
|
|
||||||
#include "styles/style_info.h"
|
|
||||||
#include "styles/style_profile.h"
|
|
||||||
|
|
||||||
namespace Info {
|
|
||||||
|
|
||||||
SideWrap::SideWrap(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<Memento*> memento)
|
|
||||||
: Window::SectionWidget(parent, controller) {
|
|
||||||
setInternalState(geometry(), memento);
|
|
||||||
}
|
|
||||||
|
|
||||||
SideWrap::SideWrap(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<MoveMemento*> memento)
|
|
||||||
: Window::SectionWidget(parent, controller) {
|
|
||||||
restoreState(memento);
|
|
||||||
}
|
|
||||||
|
|
||||||
not_null<PeerData*> SideWrap::peer() const {
|
|
||||||
return _content->peer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::setupTabs() {
|
|
||||||
_tabsShadow.create(this, st::shadowFg);
|
|
||||||
_tabs.create(this, st::infoTabs);
|
|
||||||
auto sections = QStringList();
|
|
||||||
sections.push_back(lang(lng_profile_info_section));
|
|
||||||
sections.push_back(lang(lng_info_tab_media));
|
|
||||||
_tabs->setSections(sections);
|
|
||||||
_tabs->sectionActivated()
|
|
||||||
| rpl::map([](int index) { return static_cast<Tab>(index); })
|
|
||||||
| rpl::start_with_next(
|
|
||||||
[this](Tab tab) { showTab(tab); },
|
|
||||||
_lifetime);
|
|
||||||
|
|
||||||
_tabs->move(0, 0);
|
|
||||||
_tabs->resizeToWidth(width());
|
|
||||||
_tabs->show();
|
|
||||||
|
|
||||||
_tabsShadow->setGeometry(
|
|
||||||
0,
|
|
||||||
_tabs->height() - st::lineWidth,
|
|
||||||
width(),
|
|
||||||
st::lineWidth);
|
|
||||||
_tabsShadow->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::showTab(Tab tab) {
|
|
||||||
showContent(createContent(tab));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::setSection(const Section §ion) {
|
|
||||||
switch (section.type()) {
|
|
||||||
case Section::Type::Profile:
|
|
||||||
setCurrentTab(Tab::Profile);
|
|
||||||
break;
|
|
||||||
case Section::Type::Media:
|
|
||||||
switch (section.mediaType()) {
|
|
||||||
case Section::MediaType::Photo:
|
|
||||||
case Section::MediaType::Video:
|
|
||||||
case Section::MediaType::File:
|
|
||||||
setCurrentTab(Tab::Media);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
setCurrentTab(Tab::None);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Section::Type::CommonGroups:
|
|
||||||
setCurrentTab(Tab::None);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::showContent(object_ptr<ContentWidget> content) {
|
|
||||||
_content = std::move(content);
|
|
||||||
_content->setGeometry(contentGeometry());
|
|
||||||
_content->show();
|
|
||||||
|
|
||||||
_desiredHeights.fire(desiredHeightForContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> SideWrap::desiredHeightForContent() const {
|
|
||||||
auto result = _content->desiredHeightValue();
|
|
||||||
if (_tabs) {
|
|
||||||
result = std::move(result)
|
|
||||||
| rpl::map(func::add(_tabs->height()));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<ContentWidget> SideWrap::createContent(Tab tab) {
|
|
||||||
switch (tab) {
|
|
||||||
case Tab::Profile: return createProfileWidget();
|
|
||||||
case Tab::Media: return createMediaWidget();
|
|
||||||
}
|
|
||||||
Unexpected("Tab value in Info::SideWrap::createInner()");
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<Profile::Widget> SideWrap::createProfileWidget() {
|
|
||||||
auto result = object_ptr<Profile::Widget>(
|
|
||||||
this,
|
|
||||||
Wrap::Side,
|
|
||||||
controller(),
|
|
||||||
_content->peer());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
object_ptr<Media::Widget> SideWrap::createMediaWidget() {
|
|
||||||
auto result = object_ptr<Media::Widget>(
|
|
||||||
this,
|
|
||||||
Wrap::Side,
|
|
||||||
controller(),
|
|
||||||
_content->peer(),
|
|
||||||
Media::Widget::Type::Photo);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap SideWrap::grabForShowAnimation(
|
|
||||||
const Window::SectionSlideParams ¶ms) {
|
|
||||||
if (params.withTopBarShadow) _tabsShadow->hide();
|
|
||||||
auto result = myGrab(this);
|
|
||||||
if (params.withTopBarShadow) _tabsShadow->show();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::doSetInnerFocus() {
|
|
||||||
_content->setInnerFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::showFinishedHook() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SideWrap::showInternal(
|
|
||||||
not_null<Window::SectionMemento*> memento) {
|
|
||||||
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
|
||||||
if (infoMemento->peerId() == peer()->id) {
|
|
||||||
restoreState(infoMemento);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::setInternalState(
|
|
||||||
const QRect &geometry,
|
|
||||||
not_null<Memento*> memento) {
|
|
||||||
setGeometry(geometry);
|
|
||||||
restoreState(memento);
|
|
||||||
if (_tabs) {
|
|
||||||
_tabs->finishAnimations();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<Window::SectionMemento> SideWrap::createMemento() {
|
|
||||||
auto result = std::make_unique<Memento>(peer()->id);
|
|
||||||
saveState(result.get());
|
|
||||||
return std::move(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> SideWrap::desiredHeightValue() const {
|
|
||||||
return
|
|
||||||
rpl::single(desiredHeightForContent())
|
|
||||||
| rpl::then(_desiredHeights.events())
|
|
||||||
| rpl::flatten_latest();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::saveState(not_null<Memento*> memento) {
|
|
||||||
memento->setInner(_content->createMemento());
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect SideWrap::contentGeometry() const {
|
|
||||||
return (_tab == Tab::None)
|
|
||||||
? rect()
|
|
||||||
: rect().marginsRemoved({ 0, _tabs->height(), 0, 0 });
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::restoreState(not_null<Memento*> memento) {
|
|
||||||
// Validates contentGeometry().
|
|
||||||
setSection(memento->section());
|
|
||||||
showContent(memento->content()->createWidget(
|
|
||||||
this,
|
|
||||||
Wrap::Side,
|
|
||||||
controller(),
|
|
||||||
contentGeometry()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::restoreState(not_null<MoveMemento*> memento) {
|
|
||||||
auto content = memento->content(this, Wrap::Side);
|
|
||||||
setSection(content->section());
|
|
||||||
showContent(std::move(content));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::setCurrentTab(Tab tab) {
|
|
||||||
_tab = tab;
|
|
||||||
if (_tab == Tab::None) {
|
|
||||||
_tabs.destroy();
|
|
||||||
} else if (!_tabs) {
|
|
||||||
setupTabs();
|
|
||||||
} else {
|
|
||||||
_tabs->setActiveSection(static_cast<int>(tab));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::resizeEvent(QResizeEvent *e) {
|
|
||||||
if (_tabs) {
|
|
||||||
_tabs->resizeToWidth(width());
|
|
||||||
_tabsShadow->setGeometry(
|
|
||||||
0,
|
|
||||||
_tabs->height() - st::lineWidth,
|
|
||||||
width(),
|
|
||||||
st::lineWidth);
|
|
||||||
}
|
|
||||||
if (_content) {
|
|
||||||
_content->setGeometry(contentGeometry());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideWrap::paintEvent(QPaintEvent *e) {
|
|
||||||
SectionWidget::paintEvent(e);
|
|
||||||
if (animating()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Painter p(this);
|
|
||||||
p.fillRect(e->rect(), st::profileBg);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SideWrap::wheelEventFromFloatPlayer(QEvent *e) {
|
|
||||||
return _content->wheelEventFromFloatPlayer(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect SideWrap::rectForFloatPlayer() const {
|
|
||||||
return _content->rectForFloatPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Info
|
|
|
@ -21,8 +21,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "info/info_top_bar.h"
|
#include "info/info_top_bar.h"
|
||||||
|
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "info/info_wrap_widget.h"
|
||||||
|
#include "storage/storage_shared_media.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
|
@ -44,7 +49,7 @@ void TopBar::enableBackButton(bool enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
_back.create(this, _st.back);
|
_back.create(this, _st.back);
|
||||||
_back->clicks()
|
_back->clicks()
|
||||||
| rpl::start_to_stream(_backClicks, _lifetime);
|
| rpl::start_to_stream(_backClicks, lifetime());
|
||||||
} else {
|
} else {
|
||||||
_back.destroy();
|
_back.destroy();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +65,7 @@ void TopBar::pushButton(object_ptr<Ui::RpWidget> button) {
|
||||||
weak->widthValue()
|
weak->widthValue()
|
||||||
| rpl::start_with_next([this] {
|
| rpl::start_with_next([this] {
|
||||||
this->updateControlsGeometry(this->width());
|
this->updateControlsGeometry(this->width());
|
||||||
}, _lifetime);
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
int TopBar::resizeGetHeight(int newWidth) {
|
int TopBar::resizeGetHeight(int newWidth) {
|
||||||
|
@ -95,4 +100,50 @@ void TopBar::paintEvent(QPaintEvent *e) {
|
||||||
p.fillRect(e->rect(), _st.bg);
|
p.fillRect(e->rect(), _st.bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> TitleValue(
|
||||||
|
const Section §ion,
|
||||||
|
PeerId peerId) {
|
||||||
|
return Lang::Viewer([&] {
|
||||||
|
switch (section.type()) {
|
||||||
|
case Section::Type::Profile:
|
||||||
|
if (peerIsUser(peerId)) {
|
||||||
|
return App::user(peerId)->botInfo
|
||||||
|
? lng_info_bot_title
|
||||||
|
: lng_info_user_title;
|
||||||
|
} else if (peerIsChannel(peerId)) {
|
||||||
|
return App::channel(peerId)->isMegagroup()
|
||||||
|
? lng_info_group_title
|
||||||
|
: lng_info_channel_title;
|
||||||
|
} else if (peerIsChat(peerId)) {
|
||||||
|
return lng_info_group_title;
|
||||||
|
}
|
||||||
|
Unexpected("Bad peer type in Info::TitleValue()");
|
||||||
|
|
||||||
|
case Section::Type::Media:
|
||||||
|
switch (section.mediaType()) {
|
||||||
|
case Section::MediaType::Photo:
|
||||||
|
return lng_media_type_photos;
|
||||||
|
case Section::MediaType::Video:
|
||||||
|
return lng_media_type_videos;
|
||||||
|
case Section::MediaType::MusicFile:
|
||||||
|
return lng_media_type_songs;
|
||||||
|
case Section::MediaType::File:
|
||||||
|
return lng_media_type_files;
|
||||||
|
case Section::MediaType::VoiceFile:
|
||||||
|
return lng_media_type_audios;
|
||||||
|
case Section::MediaType::Link:
|
||||||
|
return lng_media_type_links;
|
||||||
|
case Section::MediaType::RoundFile:
|
||||||
|
return lng_media_type_rounds;
|
||||||
|
}
|
||||||
|
Unexpected("Bad media type in Info::TitleValue()");
|
||||||
|
|
||||||
|
case Section::Type::CommonGroups:
|
||||||
|
return lng_profile_common_groups_section;
|
||||||
|
|
||||||
|
}
|
||||||
|
Unexpected("Bad section type in Info::TitleValue()");
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -33,6 +33,12 @@ class FlatLabel;
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
|
class Section;
|
||||||
|
|
||||||
|
rpl::producer<QString> TitleValue(
|
||||||
|
const Section §ion,
|
||||||
|
PeerId peerId);
|
||||||
|
|
||||||
class TopBar : public Ui::RpWidget {
|
class TopBar : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
TopBar(QWidget *parent, const style::InfoTopBar &st);
|
TopBar(QWidget *parent, const style::InfoTopBar &st);
|
||||||
|
@ -65,7 +71,6 @@ private:
|
||||||
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
||||||
|
|
||||||
rpl::event_stream<> _backClicks;
|
rpl::event_stream<> _backClicks;
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
319
Telegram/SourceFiles/info/info_wrap_widget.cpp
Normal file
319
Telegram/SourceFiles/info/info_wrap_widget.cpp
Normal file
|
@ -0,0 +1,319 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#include "info/info_wrap_widget.h"
|
||||||
|
|
||||||
|
#include <rpl/flatten_latest.h>
|
||||||
|
#include "info/profile/info_profile_widget.h"
|
||||||
|
#include "info/media/info_media_widget.h"
|
||||||
|
#include "info/info_content_widget.h"
|
||||||
|
#include "info/info_memento.h"
|
||||||
|
#include "info/info_top_bar.h"
|
||||||
|
#include "ui/widgets/discrete_sliders.h"
|
||||||
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
|
#include "auth_session.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
|
#include "styles/style_profile.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
|
||||||
|
WrapWidget::WrapWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
|
not_null<Memento*> memento)
|
||||||
|
: RpWidget(parent)
|
||||||
|
, _controller(controller) {
|
||||||
|
applyState(wrap, memento);
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<PeerData*> WrapWidget::peer() const {
|
||||||
|
return _content->peer();
|
||||||
|
}
|
||||||
|
|
||||||
|
Wrap WrapWidget::wrap() const {
|
||||||
|
return _content->wrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::setWrap(Wrap wrap) {
|
||||||
|
_content->setWrap(wrap);
|
||||||
|
setupTop(wrap, _content->section(), _content->peer()->id);
|
||||||
|
finishShowContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::createTabs() {
|
||||||
|
_topTabs.create(this, st::infoTabs);
|
||||||
|
auto sections = QStringList();
|
||||||
|
sections.push_back(lang(lng_profile_info_section));
|
||||||
|
sections.push_back(lang(lng_info_tab_media));
|
||||||
|
_topTabs->setSections(sections);
|
||||||
|
_topTabs->sectionActivated()
|
||||||
|
| rpl::map([](int index) { return static_cast<Tab>(index); })
|
||||||
|
| rpl::start_with_next(
|
||||||
|
[this](Tab tab) { showTab(tab); },
|
||||||
|
lifetime());
|
||||||
|
|
||||||
|
_topTabs->move(0, 0);
|
||||||
|
_topTabs->resizeToWidth(width());
|
||||||
|
_topTabs->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::showTab(Tab tab) {
|
||||||
|
showContent(createContent(tab));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::setupTabbedTop(const Section §ion) {
|
||||||
|
switch (section.type()) {
|
||||||
|
case Section::Type::Profile:
|
||||||
|
setupTabs(Tab::Profile);
|
||||||
|
break;
|
||||||
|
case Section::Type::Media:
|
||||||
|
switch (section.mediaType()) {
|
||||||
|
case Section::MediaType::Photo:
|
||||||
|
case Section::MediaType::Video:
|
||||||
|
case Section::MediaType::File:
|
||||||
|
setupTabs(Tab::Media);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setupTabs(Tab::None);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Section::Type::CommonGroups:
|
||||||
|
setupTabs(Tab::None);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::setupTop(
|
||||||
|
Wrap wrap,
|
||||||
|
const Section §ion,
|
||||||
|
PeerId peerId) {
|
||||||
|
if (wrap == Wrap::Side) {
|
||||||
|
setupTabbedTop(section);
|
||||||
|
} else {
|
||||||
|
setupTabs(Tab::None);
|
||||||
|
}
|
||||||
|
if (_topTabs) {
|
||||||
|
_topBar.destroy();
|
||||||
|
} else {
|
||||||
|
createTopBar(wrap, section, peerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::createTopBar(
|
||||||
|
Wrap wrap,
|
||||||
|
const Section §ion,
|
||||||
|
PeerId peerId) {
|
||||||
|
_topBar = object_ptr<TopBar>(
|
||||||
|
this,
|
||||||
|
(wrap == Wrap::Layer)
|
||||||
|
? st::infoLayerTopBar
|
||||||
|
: st::infoTopBar);
|
||||||
|
_topBar->setTitle(TitleValue(
|
||||||
|
section,
|
||||||
|
peerId));
|
||||||
|
if (wrap != Wrap::Layer) {
|
||||||
|
_topBar->enableBackButton(true);
|
||||||
|
_topBar->backRequest()
|
||||||
|
| rpl::start_with_next([this] {
|
||||||
|
_controller->showBackFromStack();
|
||||||
|
}, _topBar->lifetime());
|
||||||
|
}
|
||||||
|
if (wrap == Wrap::Layer) {
|
||||||
|
auto close = _topBar->addButton(object_ptr<Ui::IconButton>(
|
||||||
|
_topBar,
|
||||||
|
st::infoLayerTopBarClose));
|
||||||
|
close->clicks()
|
||||||
|
| rpl::start_with_next([this] {
|
||||||
|
_controller->hideSpecialLayer();
|
||||||
|
}, close->lifetime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<Ui::RpWidget*> WrapWidget::topWidget() const {
|
||||||
|
if (_topTabs) {
|
||||||
|
return _topTabs;
|
||||||
|
}
|
||||||
|
return _topBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::showContent(object_ptr<ContentWidget> content) {
|
||||||
|
_content = std::move(content);
|
||||||
|
_content->show();
|
||||||
|
|
||||||
|
finishShowContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::finishShowContent() {
|
||||||
|
_topShadow.create(this);
|
||||||
|
_topShadow->toggleOn((wrap() == Wrap::Side)
|
||||||
|
? rpl::single(true)
|
||||||
|
: _content->desiredShadowVisibility());
|
||||||
|
|
||||||
|
if (_topTabs) {
|
||||||
|
_topTabs->finishAnimations();
|
||||||
|
}
|
||||||
|
_topShadow->finishAnimations();
|
||||||
|
|
||||||
|
updateContentGeometry();
|
||||||
|
|
||||||
|
_desiredHeights.fire(desiredHeightForContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> WrapWidget::desiredHeightForContent() const {
|
||||||
|
auto result = _content->desiredHeightValue();
|
||||||
|
if (_topTabs) {
|
||||||
|
result = std::move(result)
|
||||||
|
| rpl::map(func::add(_topTabs->height()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<ContentWidget> WrapWidget::createContent(Tab tab) {
|
||||||
|
switch (tab) {
|
||||||
|
case Tab::Profile: return createProfileWidget();
|
||||||
|
case Tab::Media: return createMediaWidget();
|
||||||
|
}
|
||||||
|
Unexpected("Tab value in Info::WrapWidget::createInner()");
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<Profile::Widget> WrapWidget::createProfileWidget() {
|
||||||
|
auto result = object_ptr<Profile::Widget>(
|
||||||
|
this,
|
||||||
|
Wrap::Side,
|
||||||
|
controller(),
|
||||||
|
_content->peer());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<Media::Widget> WrapWidget::createMediaWidget() {
|
||||||
|
auto result = object_ptr<Media::Widget>(
|
||||||
|
this,
|
||||||
|
Wrap::Side,
|
||||||
|
controller(),
|
||||||
|
_content->peer(),
|
||||||
|
Media::Widget::Type::Photo);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WrapWidget::hasTopBarShadow() const {
|
||||||
|
return !_topShadow->isHiddenOrHiding();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap WrapWidget::grabForShowAnimation(
|
||||||
|
const Window::SectionSlideParams ¶ms) {
|
||||||
|
if (params.withTopBarShadow) _topShadow->hide();
|
||||||
|
auto result = myGrab(this);
|
||||||
|
if (params.withTopBarShadow) _topShadow->show();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::setInnerFocus() {
|
||||||
|
_content->setInnerFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::showFinished() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WrapWidget::showInternal(
|
||||||
|
not_null<Window::SectionMemento*> memento) {
|
||||||
|
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||||
|
if (infoMemento->peerId() == peer()->id) {
|
||||||
|
applyState(_content->wrap(), infoMemento);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
||||||
|
auto result = std::make_unique<Memento>(peer()->id);
|
||||||
|
saveState(result.get());
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> WrapWidget::desiredHeightValue() const {
|
||||||
|
return
|
||||||
|
rpl::single(desiredHeightForContent())
|
||||||
|
| rpl::then(_desiredHeights.events())
|
||||||
|
| rpl::flatten_latest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::saveState(not_null<Memento*> memento) {
|
||||||
|
memento->setInner(_content->createMemento());
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect WrapWidget::contentGeometry() const {
|
||||||
|
return rect().marginsRemoved({ 0, topWidget()->height(), 0, 0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::applyState(Wrap wrap, not_null<Memento*> memento) {
|
||||||
|
// Validates contentGeometry().
|
||||||
|
setupTop(wrap, memento->section(), memento->peerId());
|
||||||
|
showContent(memento->content()->createWidget(
|
||||||
|
this,
|
||||||
|
wrap,
|
||||||
|
controller(),
|
||||||
|
contentGeometry()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::setupTabs(Tab tab) {
|
||||||
|
_tab = tab;
|
||||||
|
if (_tab == Tab::None) {
|
||||||
|
_topTabs.destroy();
|
||||||
|
} else if (!_topTabs) {
|
||||||
|
createTabs();
|
||||||
|
} else {
|
||||||
|
_topTabs->setActiveSection(static_cast<int>(tab));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::resizeEvent(QResizeEvent *e) {
|
||||||
|
topWidget()->resizeToWidth(width());
|
||||||
|
updateContentGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::updateContentGeometry() {
|
||||||
|
if (_content) {
|
||||||
|
_topShadow->resizeToWidth(width());
|
||||||
|
_topShadow->moveToLeft(0, topWidget()->height());
|
||||||
|
_content->setGeometry(contentGeometry());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrapWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
p.fillRect(e->rect(), st::profileBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WrapWidget::wheelEventFromFloatPlayer(QEvent *e) {
|
||||||
|
return _content->wheelEventFromFloatPlayer(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect WrapWidget::rectForFloatPlayer() const {
|
||||||
|
return _content->rectForFloatPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Info
|
|
@ -24,8 +24,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PlainShadow;
|
|
||||||
class SettingsSlider;
|
class SettingsSlider;
|
||||||
|
class FadeShadow;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
@ -41,50 +41,84 @@ class Section;
|
||||||
class Memento;
|
class Memento;
|
||||||
class MoveMemento;
|
class MoveMemento;
|
||||||
class ContentWidget;
|
class ContentWidget;
|
||||||
|
class TopBar;
|
||||||
|
|
||||||
class SideWrap final : public Window::SectionWidget {
|
enum class Wrap {
|
||||||
|
Layer,
|
||||||
|
Narrow,
|
||||||
|
Side,
|
||||||
|
};
|
||||||
|
|
||||||
|
class Section final {
|
||||||
public:
|
public:
|
||||||
SideWrap(
|
enum class Type {
|
||||||
|
Profile,
|
||||||
|
Media,
|
||||||
|
CommonGroups,
|
||||||
|
};
|
||||||
|
using MediaType = Storage::SharedMediaType;
|
||||||
|
|
||||||
|
Section(Type type) : _type(type) {
|
||||||
|
Expects(type != Type::Media);
|
||||||
|
}
|
||||||
|
Section(MediaType mediaType)
|
||||||
|
: _type(Type::Media)
|
||||||
|
, _mediaType(mediaType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Type type() const {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
MediaType mediaType() const {
|
||||||
|
Expects(_type == Type::Media);
|
||||||
|
return _mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Type _type;
|
||||||
|
Storage::SharedMediaType _mediaType;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class WrapWidget final : public Ui::RpWidget {
|
||||||
|
public:
|
||||||
|
WrapWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Window::Controller*> controller,
|
||||||
|
Wrap wrap,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
SideWrap(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::Controller*> controller,
|
|
||||||
not_null<MoveMemento*> memento);
|
|
||||||
|
|
||||||
not_null<PeerData*> peer() const;
|
not_null<PeerData*> peer() const;
|
||||||
PeerData *peerForDialogs() const override {
|
Wrap wrap() const;
|
||||||
return peer();
|
void setWrap(Wrap wrap);
|
||||||
}
|
|
||||||
|
|
||||||
bool hasTopBarShadow() const override {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool hasTopBarShadow() const;
|
||||||
QPixmap grabForShowAnimation(
|
QPixmap grabForShowAnimation(
|
||||||
const Window::SectionSlideParams ¶ms) override;
|
const Window::SectionSlideParams ¶ms);
|
||||||
|
|
||||||
bool showInternal(
|
bool showInternal(
|
||||||
not_null<Window::SectionMemento*> memento) override;
|
not_null<Window::SectionMemento*> memento);
|
||||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
std::unique_ptr<Window::SectionMemento> createMemento();
|
||||||
|
|
||||||
rpl::producer<int> desiredHeightValue() const override;
|
rpl::producer<int> desiredHeightValue() const;
|
||||||
|
|
||||||
void setInternalState(
|
void setInnerFocus();
|
||||||
const QRect &geometry,
|
void showFinished();
|
||||||
not_null<Memento*> memento);
|
|
||||||
|
void updateInternalState(not_null<Memento*> memento);
|
||||||
|
void saveState(not_null<Memento*> memento);
|
||||||
|
|
||||||
// Float player interface.
|
// Float player interface.
|
||||||
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
bool wheelEventFromFloatPlayer(QEvent *e);
|
||||||
QRect rectForFloatPlayer() const override;
|
QRect rectForFloatPlayer() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e);
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
void doSetInnerFocus() override;
|
not_null<Window::Controller*> controller() const {
|
||||||
void showFinishedHook() override;
|
return _controller;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Tab {
|
enum class Tab {
|
||||||
|
@ -92,31 +126,37 @@ private:
|
||||||
Media,
|
Media,
|
||||||
None,
|
None,
|
||||||
};
|
};
|
||||||
void saveState(not_null<Memento*> memento);
|
void applyState(Wrap wrap, not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void setupTop(Wrap wrap, const Section §ion, PeerId peerId);
|
||||||
void restoreState(not_null<MoveMemento*> memento);
|
void setupTabbedTop(const Section §ion);
|
||||||
|
void setupTabs(Tab tab);
|
||||||
|
void createTabs();
|
||||||
|
void createTopBar(
|
||||||
|
Wrap wrap,
|
||||||
|
const Section §ion,
|
||||||
|
PeerId peerId);
|
||||||
|
not_null<RpWidget*> topWidget() const;
|
||||||
|
|
||||||
QRect contentGeometry() const;
|
QRect contentGeometry() const;
|
||||||
rpl::producer<int> desiredHeightForContent() const;
|
rpl::producer<int> desiredHeightForContent() const;
|
||||||
|
void finishShowContent();
|
||||||
|
void updateContentGeometry();
|
||||||
|
|
||||||
void setupTabs();
|
|
||||||
void showTab(Tab tab);
|
void showTab(Tab tab);
|
||||||
void setCurrentTab(Tab tab);
|
|
||||||
void setSection(const Section §ion);
|
|
||||||
void showContent(object_ptr<ContentWidget> content);
|
void showContent(object_ptr<ContentWidget> content);
|
||||||
object_ptr<ContentWidget> createContent(Tab tab);
|
object_ptr<ContentWidget> createContent(Tab tab);
|
||||||
object_ptr<Profile::Widget> createProfileWidget();
|
object_ptr<Profile::Widget> createProfileWidget();
|
||||||
object_ptr<Media::Widget> createMediaWidget();
|
object_ptr<Media::Widget> createMediaWidget();
|
||||||
|
|
||||||
object_ptr<Ui::PlainShadow> _tabsShadow = { nullptr };
|
not_null<Window::Controller*> _controller;
|
||||||
object_ptr<Ui::SettingsSlider> _tabs = { nullptr };
|
|
||||||
object_ptr<ContentWidget> _content = { nullptr };
|
object_ptr<ContentWidget> _content = { nullptr };
|
||||||
|
object_ptr<Ui::SettingsSlider> _topTabs = { nullptr };
|
||||||
|
object_ptr<TopBar> _topBar = { nullptr };
|
||||||
|
object_ptr<Ui::FadeShadow> _topShadow = { nullptr };
|
||||||
Tab _tab = Tab::Profile;
|
Tab _tab = Tab::Profile;
|
||||||
|
|
||||||
rpl::event_stream<rpl::producer<int>> _desiredHeights;
|
rpl::event_stream<rpl::producer<int>> _desiredHeights;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
|
@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "info/info_media_inner_widget.h"
|
#include "info/media/info_media_inner_widget.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Media {
|
namespace Media {
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "info/info_media_widget.h"
|
#include "info/media/info_media_widget.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Media {
|
namespace Media {
|
|
@ -18,9 +18,9 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "info/info_media_widget.h"
|
#include "info/media/info_media_widget.h"
|
||||||
|
|
||||||
#include "info/info_media_inner_widget.h"
|
#include "info/media/info_media_inner_widget.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <rpl/producer.h>
|
#include <rpl/producer.h>
|
||||||
#include "info/info_memento.h"
|
#include "info/info_content_widget.h"
|
||||||
#include "storage/storage_shared_media.h"
|
#include "storage/storage_shared_media.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
|
@ -43,6 +43,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "history/history_shared_media.h"
|
#include "history/history_shared_media.h"
|
||||||
|
@ -184,7 +185,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupInfo(
|
||||||
}
|
}
|
||||||
result->add(object_ptr<Ui::SlideWrap<>>(
|
result->add(object_ptr<Ui::SlideWrap<>>(
|
||||||
result,
|
result,
|
||||||
object_ptr<Ui::PlainShadow>(result, st::shadowFg),
|
object_ptr<Ui::PlainShadow>(result),
|
||||||
st::infoProfileSeparatorPadding)
|
st::infoProfileSeparatorPadding)
|
||||||
)->toggleOn(std::move(tracker).atLeastOneShownValue());
|
)->toggleOn(std::move(tracker).atLeastOneShownValue());
|
||||||
object_ptr<FloatingIcon>(
|
object_ptr<FloatingIcon>(
|
||||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "info/profile/info_profile_icon.h"
|
#include "info/profile/info_profile_icon.h"
|
||||||
#include "info/profile/info_profile_values.h"
|
#include "info/profile/info_profile_values.h"
|
||||||
#include "info/profile/info_profile_members_controllers.h"
|
#include "info/profile/info_profile_members_controllers.h"
|
||||||
#include "info/info_memento.h"
|
#include "info/info_content_widget.h"
|
||||||
#include "profile/profile_block_group_members.h"
|
#include "profile/profile_block_group_members.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <rpl/producer.h>
|
#include <rpl/producer.h>
|
||||||
#include "info/info_memento.h"
|
#include "info/info_content_widget.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
@ -80,12 +80,8 @@ private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
||||||
void scrollTopUpdated(int scrollTop);
|
|
||||||
|
|
||||||
InnerWidget *_inner = nullptr;
|
InnerWidget *_inner = nullptr;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Profile
|
} // namespace Profile
|
||||||
|
|
|
@ -26,7 +26,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_intro.h"
|
#include "styles/style_intro.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
|
@ -94,7 +94,7 @@ void PhoneWidget::showSignup() {
|
||||||
if (!_signup) {
|
if (!_signup) {
|
||||||
auto signupText = lng_phone_notreg(lt_link_start, textcmdStartLink(1), lt_link_end, textcmdStopLink(), lt_signup_start, textcmdStartLink(2), lt_signup_end, textcmdStopLink());
|
auto signupText = lng_phone_notreg(lt_link_start, textcmdStartLink(1), lt_link_end, textcmdStopLink(), lt_signup_start, textcmdStartLink(2), lt_signup_end, textcmdStopLink());
|
||||||
auto inner = object_ptr<Ui::FlatLabel>(this, signupText, Ui::FlatLabel::InitType::Rich, st::introDescription);
|
auto inner = object_ptr<Ui::FlatLabel>(this, signupText, Ui::FlatLabel::InitType::Rich, st::introDescription);
|
||||||
_signup.create(this, std::move(inner), st::introErrorDuration);
|
_signup.create(this, std::move(inner));
|
||||||
_signup->entity()->setLink(1, MakeShared<UrlClickHandler>(qsl("https://telegram.org"), false));
|
_signup->entity()->setLink(1, MakeShared<UrlClickHandler>(qsl("https://telegram.org"), false));
|
||||||
_signup->entity()->setLink(2, MakeShared<LambdaClickHandler>([this] {
|
_signup->entity()->setLink(2, MakeShared<LambdaClickHandler>([this] {
|
||||||
toSignUp();
|
toSignUp();
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
object_ptr<Ui::CountryCodeInput> _code;
|
object_ptr<Ui::CountryCodeInput> _code;
|
||||||
object_ptr<Ui::PhonePartInput> _phone;
|
object_ptr<Ui::PhonePartInput> _phone;
|
||||||
|
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _signup = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _signup = { nullptr };
|
||||||
|
|
||||||
QString _sentPhone;
|
QString _sentPhone;
|
||||||
mtpRequestId _sentRequest = 0;
|
mtpRequestId _sentRequest = 0;
|
||||||
|
|
|
@ -37,7 +37,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/text/text.h"
|
#include "ui/text/text.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "ui/effects/slide_animation.h"
|
#include "ui/effects/slide_animation.h"
|
||||||
#include "autoupdater.h"
|
#include "autoupdater.h"
|
||||||
#include "window/window_slide_animation.h"
|
#include "window/window_slide_animation.h"
|
||||||
|
@ -56,8 +56,13 @@ constexpr str_const kDefaultCountry = "US";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent) : TWidget(parent)
|
Widget::Widget(QWidget *parent) : TWidget(parent)
|
||||||
, _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton), st::introSlideDuration)
|
, _back(this, object_ptr<Ui::IconButton>(this, st::introBackButton))
|
||||||
, _settings(this, object_ptr<Ui::RoundButton>(this, langFactory(lng_menu_settings), st::defaultBoxButton), st::introCoverDuration)
|
, _settings(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::RoundButton>(
|
||||||
|
this,
|
||||||
|
langFactory(lng_menu_settings),
|
||||||
|
st::defaultBoxButton))
|
||||||
, _next(this, base::lambda<QString()>(), st::introNextButton) {
|
, _next(this, base::lambda<QString()>(), st::introNextButton) {
|
||||||
auto country = Platform::SystemCountry();
|
auto country = Platform::SystemCountry();
|
||||||
if (country.isEmpty()) {
|
if (country.isEmpty()) {
|
||||||
|
@ -79,7 +84,7 @@ Widget::Widget(QWidget *parent) : TWidget(parent)
|
||||||
|
|
||||||
subscribe(Lang::CurrentCloudManager().firstLanguageSuggestion(), [this] { createLanguageLink(); });
|
subscribe(Lang::CurrentCloudManager().firstLanguageSuggestion(), [this] { createLanguageLink(); });
|
||||||
createLanguageLink();
|
createLanguageLink();
|
||||||
if (_changeLanguage) _changeLanguage->finishAnimation();
|
if (_changeLanguage) _changeLanguage->finishAnimations();
|
||||||
|
|
||||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||||
|
|
||||||
|
@ -108,7 +113,9 @@ void Widget::createLanguageLink() {
|
||||||
if (_changeLanguage) return;
|
if (_changeLanguage) return;
|
||||||
|
|
||||||
auto createLink = [this](const QString &text, const QString &languageId) {
|
auto createLink = [this](const QString &text, const QString &languageId) {
|
||||||
_changeLanguage.create(this, object_ptr<Ui::LinkButton>(this, text), st::introCoverDuration);
|
_changeLanguage.create(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::LinkButton>(this, text));
|
||||||
_changeLanguage->show();
|
_changeLanguage->show();
|
||||||
_changeLanguage->hideFast();
|
_changeLanguage->hideFast();
|
||||||
_changeLanguage->entity()->setClickedCallback([this, languageId] {
|
_changeLanguage->entity()->setClickedCallback([this, languageId] {
|
||||||
|
@ -138,7 +145,12 @@ void Widget::createLanguageLink() {
|
||||||
void Widget::onCheckUpdateStatus() {
|
void Widget::onCheckUpdateStatus() {
|
||||||
if (Sandbox::updatingState() == Application::UpdatingReady) {
|
if (Sandbox::updatingState() == Application::UpdatingReady) {
|
||||||
if (_update) return;
|
if (_update) return;
|
||||||
_update.create(this, object_ptr<Ui::RoundButton>(this, langFactory(lng_menu_update), st::defaultBoxButton), st::introCoverDuration);
|
_update.create(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::RoundButton>(
|
||||||
|
this,
|
||||||
|
langFactory(lng_menu_update),
|
||||||
|
st::defaultBoxButton));
|
||||||
if (!_a_show.animating()) _update->show();
|
if (!_a_show.animating()) _update->show();
|
||||||
_update->entity()->setClickedCallback([] {
|
_update->entity()->setClickedCallback([] {
|
||||||
checkReadyUpdate();
|
checkReadyUpdate();
|
||||||
|
@ -233,7 +245,9 @@ void Widget::appendStep(Step *step) {
|
||||||
void Widget::showResetButton() {
|
void Widget::showResetButton() {
|
||||||
if (!_resetAccount) {
|
if (!_resetAccount) {
|
||||||
auto entity = object_ptr<Ui::RoundButton>(this, langFactory(lng_signin_reset_account), st::introResetButton);
|
auto entity = object_ptr<Ui::RoundButton>(this, langFactory(lng_signin_reset_account), st::introResetButton);
|
||||||
_resetAccount.create(this, std::move(entity), st::introErrorDuration);
|
_resetAccount.create(
|
||||||
|
this,
|
||||||
|
std::move(entity));
|
||||||
_resetAccount->hideFast();
|
_resetAccount->hideFast();
|
||||||
_resetAccount->entity()->setClickedCallback([this] { resetAccount(); });
|
_resetAccount->entity()->setClickedCallback([this] { resetAccount(); });
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
@ -701,7 +715,13 @@ void Widget::Step::refreshError() {
|
||||||
if (_error) _error->hideAnimated();
|
if (_error) _error->hideAnimated();
|
||||||
} else {
|
} else {
|
||||||
if (!_error) {
|
if (!_error) {
|
||||||
_error.create(this, object_ptr<Ui::FlatLabel>(this, _errorCentered ? st::introErrorCentered : st::introError), st::introErrorDuration);
|
_error.create(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
this,
|
||||||
|
_errorCentered
|
||||||
|
? st::introErrorCentered
|
||||||
|
: st::introError));
|
||||||
_error->hideFast();
|
_error->hideFast();
|
||||||
}
|
}
|
||||||
_error->entity()->setText(_errorTextFactory());
|
_error->entity()->setText(_errorTextFactory());
|
||||||
|
@ -714,9 +734,16 @@ Widget::Step::Step(QWidget *parent, Data *data, bool hasCover) : TWidget(parent)
|
||||||
, _data(data)
|
, _data(data)
|
||||||
, _hasCover(hasCover)
|
, _hasCover(hasCover)
|
||||||
, _title(this, _hasCover ? st::introCoverTitle : st::introTitle)
|
, _title(this, _hasCover ? st::introCoverTitle : st::introTitle)
|
||||||
, _description(this, object_ptr<Ui::FlatLabel>(this, _hasCover ? st::introCoverDescription : st::introDescription), st::introErrorDuration) {
|
, _description(
|
||||||
|
this,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
this,
|
||||||
|
_hasCover
|
||||||
|
? st::introCoverDescription
|
||||||
|
: st::introDescription)) {
|
||||||
hide();
|
hide();
|
||||||
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
|
subscribe(Window::Theme::Background(), [this](
|
||||||
|
const Window::Theme::BackgroundUpdate &update) {
|
||||||
if (update.paletteChanged()) {
|
if (update.paletteChanged()) {
|
||||||
if (!_coverMask.isNull()) {
|
if (!_coverMask.isNull()) {
|
||||||
_coverMask = QPixmap();
|
_coverMask = QPixmap();
|
||||||
|
|
|
@ -30,7 +30,7 @@ class SlideAnimation;
|
||||||
class CrossFadeAnimation;
|
class CrossFadeAnimation;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
class WidgetFadeWrap;
|
class FadeWrap;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Intro {
|
namespace Intro {
|
||||||
|
@ -198,13 +198,13 @@ public:
|
||||||
|
|
||||||
object_ptr<Ui::FlatLabel> _title;
|
object_ptr<Ui::FlatLabel> _title;
|
||||||
base::lambda<QString()> _titleTextFactory;
|
base::lambda<QString()> _titleTextFactory;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _description;
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _description;
|
||||||
base::lambda<QString()> _descriptionTextFactory;
|
base::lambda<QString()> _descriptionTextFactory;
|
||||||
|
|
||||||
bool _errorCentered = false;
|
bool _errorCentered = false;
|
||||||
bool _errorBelowLink = false;
|
bool _errorBelowLink = false;
|
||||||
base::lambda<QString()> _errorTextFactory;
|
base::lambda<QString()> _errorTextFactory;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
||||||
|
|
||||||
Animation _a_show;
|
Animation _a_show;
|
||||||
CoverAnimation _coverAnimation;
|
CoverAnimation _coverAnimation;
|
||||||
|
@ -253,13 +253,13 @@ private:
|
||||||
int _nextTopFrom = 0;
|
int _nextTopFrom = 0;
|
||||||
int _controlsTopFrom = 0;
|
int _controlsTopFrom = 0;
|
||||||
|
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::IconButton>> _back;
|
object_ptr<Ui::FadeWrap<Ui::IconButton>> _back;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::RoundButton>> _update = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _update = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::RoundButton>> _settings;
|
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _settings;
|
||||||
|
|
||||||
object_ptr<Ui::RoundButton> _next;
|
object_ptr<Ui::RoundButton> _next;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::LinkButton>> _changeLanguage = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::LinkButton>> _changeLanguage = { nullptr };
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::RoundButton>> _resetAccount = { nullptr };
|
object_ptr<Ui::FadeWrap<Ui::RoundButton>> _resetAccount = { nullptr };
|
||||||
|
|
||||||
mtpRequestId _resetRequest = 0;
|
mtpRequestId _resetRequest = 0;
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kSaveFloatPlayerPositionTimeoutMs = TimeMs(1000);
|
|
||||||
|
|
||||||
MTPMessagesFilter TypeToMediaFilter(MediaOverviewType &type) {
|
MTPMessagesFilter TypeToMediaFilter(MediaOverviewType &type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case OverviewPhotos: return MTP_inputMessagesFilterPhotos();
|
case OverviewPhotos: return MTP_inputMessagesFilterPhotos();
|
||||||
|
@ -133,7 +131,7 @@ MainWidget::MainWidget(
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _dialogsWidth(st::dialogsWidthMin)
|
, _dialogsWidth(st::dialogsWidthMin)
|
||||||
, _sideShadow(this, st::shadowFg)
|
, _sideShadow(this)
|
||||||
, _sideResizeArea(this)
|
, _sideResizeArea(this)
|
||||||
, _dialogs(this, _controller)
|
, _dialogs(this, _controller)
|
||||||
, _history(this, _controller)
|
, _history(this, _controller)
|
||||||
|
@ -516,11 +514,11 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) {
|
||||||
}
|
}
|
||||||
if (Auth().data().floatPlayerColumn() != column) {
|
if (Auth().data().floatPlayerColumn() != column) {
|
||||||
Auth().data().setFloatPlayerColumn(column);
|
Auth().data().setFloatPlayerColumn(column);
|
||||||
Auth().saveDataDelayed(kSaveFloatPlayerPositionTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
}
|
}
|
||||||
if (Auth().data().floatPlayerCorner() != corner) {
|
if (Auth().data().floatPlayerCorner() != corner) {
|
||||||
Auth().data().setFloatPlayerCorner(corner);
|
Auth().data().setFloatPlayerCorner(corner);
|
||||||
Auth().saveDataDelayed(kSaveFloatPlayerPositionTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2938,7 +2936,7 @@ void MainWidget::showNewSection(
|
||||||
if (newThirdSection) {
|
if (newThirdSection) {
|
||||||
saveInStack = false;
|
saveInStack = false;
|
||||||
} else {
|
} else {
|
||||||
if (auto layer = memento.createLayer(_controller)) {
|
if (auto layer = memento.createLayer(_controller, rect())) {
|
||||||
_controller->showSpecialLayer(std::move(layer));
|
_controller->showSpecialLayer(std::move(layer));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3007,7 +3005,7 @@ void MainWidget::showNewSection(
|
||||||
if (newThirdSection) {
|
if (newThirdSection) {
|
||||||
_thirdSection = std::move(newThirdSection);
|
_thirdSection = std::move(newThirdSection);
|
||||||
if (!_thirdShadow) {
|
if (!_thirdShadow) {
|
||||||
_thirdShadow.create(this, st::shadowFg);
|
_thirdShadow.create(this);
|
||||||
_thirdShadow->show();
|
_thirdShadow->show();
|
||||||
orderWidgets();
|
orderWidgets();
|
||||||
}
|
}
|
||||||
|
@ -3044,7 +3042,7 @@ void MainWidget::checkMainSectionToLayer() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ui::FocusPersister persister(this);
|
Ui::FocusPersister persister(this);
|
||||||
if (auto layer = _mainSection->moveContentToLayer(width())) {
|
if (auto layer = _mainSection->moveContentToLayer(rect())) {
|
||||||
dropMainSection(_mainSection);
|
dropMainSection(_mainSection);
|
||||||
_controller->showSpecialLayer(
|
_controller->showSpecialLayer(
|
||||||
std::move(layer),
|
std::move(layer),
|
||||||
|
|
|
@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "base/zlib_help.h"
|
#include "base/zlib_help.h"
|
||||||
#include "lang/lang_cloud_manager.h"
|
#include "lang/lang_cloud_manager.h"
|
||||||
#include "lang/lang_instance.h"
|
#include "lang/lang_instance.h"
|
||||||
|
@ -38,7 +39,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "passcodewidget.h"
|
#include "passcodewidget.h"
|
||||||
#include "intro/introwidget.h"
|
#include "intro/introwidget.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "layerwidget.h"
|
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
#include "boxes/connection_box.h"
|
#include "boxes/connection_box.h"
|
||||||
|
@ -49,6 +49,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "settings/settings_widget.h"
|
#include "settings/settings_widget.h"
|
||||||
#include "platform/platform_notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
|
#include "window/layer_widget.h"
|
||||||
#include "window/notifications_manager.h"
|
#include "window/notifications_manager.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/themes/window_theme_warning.h"
|
#include "window/themes/window_theme_warning.h"
|
||||||
|
@ -325,7 +326,7 @@ void MainWindow::showSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showSpecialLayer(
|
void MainWindow::showSpecialLayer(
|
||||||
object_ptr<LayerWidget> layer,
|
object_ptr<Window::LayerWidget> layer,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
if (_passcode) return;
|
if (_passcode) return;
|
||||||
|
|
||||||
|
@ -702,16 +703,17 @@ void MainWindow::noIntro(Intro::Widget *was) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::noLayerStack(LayerStackWidget *was) {
|
void MainWindow::noLayerStack(Window::LayerStackWidget *was) {
|
||||||
if (was == _layerBg) {
|
if (was == _layerBg) {
|
||||||
_layerBg = nullptr;
|
_layerBg = nullptr;
|
||||||
if (controller()) {
|
if (controller()) {
|
||||||
controller()->disableGifPauseReason(Window::GifPauseReason::Layer);
|
controller()->disableGifPauseReason(
|
||||||
|
Window::GifPauseReason::Layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::layerFinishedHide(LayerStackWidget *was) {
|
void MainWindow::layerFinishedHide(Window::LayerStackWidget *was) {
|
||||||
if (was == _layerBg) {
|
if (was == _layerBg) {
|
||||||
auto resetFocus = Ui::InFocusChain(was);
|
auto resetFocus = Ui::InFocusChain(was);
|
||||||
if (resetFocus) setFocus();
|
if (resetFocus) setFocus();
|
||||||
|
|
|
@ -26,7 +26,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
class PasscodeWidget;
|
class PasscodeWidget;
|
||||||
class MainWidget;
|
class MainWidget;
|
||||||
class LayerStackWidget;
|
|
||||||
class BoxContent;
|
class BoxContent;
|
||||||
|
|
||||||
namespace Intro {
|
namespace Intro {
|
||||||
|
@ -38,6 +37,7 @@ class ClearManager;
|
||||||
} // namespace Local
|
} // namespace Local
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
class LayerStackWidget;
|
||||||
namespace Theme {
|
namespace Theme {
|
||||||
struct BackgroundUpdate;
|
struct BackgroundUpdate;
|
||||||
class WarningWidget;
|
class WarningWidget;
|
||||||
|
@ -102,8 +102,8 @@ public:
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
void noIntro(Intro::Widget *was);
|
void noIntro(Intro::Widget *was);
|
||||||
void noLayerStack(LayerStackWidget *was);
|
void noLayerStack(Window::LayerStackWidget *was);
|
||||||
void layerFinishedHide(LayerStackWidget *was);
|
void layerFinishedHide(Window::LayerStackWidget *was);
|
||||||
bool takeThirdSectionFromLayer();
|
bool takeThirdSectionFromLayer();
|
||||||
|
|
||||||
void checkHistoryActivation();
|
void checkHistoryActivation();
|
||||||
|
@ -135,7 +135,7 @@ public:
|
||||||
void updateTrayMenu(bool force = false) override;
|
void updateTrayMenu(bool force = false) override;
|
||||||
|
|
||||||
void showSpecialLayer(
|
void showSpecialLayer(
|
||||||
object_ptr<LayerWidget> layer,
|
object_ptr<Window::LayerWidget> layer,
|
||||||
anim::type animated);
|
anim::type animated);
|
||||||
void ui_showBox(
|
void ui_showBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
|
@ -209,7 +209,7 @@ private:
|
||||||
object_ptr<PasscodeWidget> _passcode = { nullptr };
|
object_ptr<PasscodeWidget> _passcode = { nullptr };
|
||||||
object_ptr<Intro::Widget> _intro = { nullptr };
|
object_ptr<Intro::Widget> _intro = { nullptr };
|
||||||
object_ptr<MainWidget> _main = { nullptr };
|
object_ptr<MainWidget> _main = { nullptr };
|
||||||
object_ptr<LayerStackWidget> _layerBg = { nullptr };
|
object_ptr<Window::LayerStackWidget> _layerBg = { nullptr };
|
||||||
object_ptr<MediaPreviewWidget> _mediaPreview = { nullptr };
|
object_ptr<MediaPreviewWidget> _mediaPreview = { nullptr };
|
||||||
|
|
||||||
object_ptr<ConnectingWidget> _connecting = { nullptr };
|
object_ptr<ConnectingWidget> _connecting = { nullptr };
|
||||||
|
|
|
@ -92,7 +92,7 @@ Widget::Widget(QWidget *parent) : RpWidget(parent)
|
||||||
, _volumeToggle(this, st::mediaPlayerVolumeToggle)
|
, _volumeToggle(this, st::mediaPlayerVolumeToggle)
|
||||||
, _repeatTrack(this, st::mediaPlayerRepeatButton)
|
, _repeatTrack(this, st::mediaPlayerRepeatButton)
|
||||||
, _close(this, st::mediaPlayerClose)
|
, _close(this, st::mediaPlayerClose)
|
||||||
, _shadow(this, st::shadowFg)
|
, _shadow(this)
|
||||||
, _playbackSlider(this, st::mediaPlayerPlayback)
|
, _playbackSlider(this, st::mediaPlayerPlayback)
|
||||||
, _playback(std::make_unique<Clip::Playback>()) {
|
, _playback(std::make_unique<Clip::Playback>()) {
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
|
|
@ -25,7 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_mediaview.h"
|
#include "styles/style_mediaview.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/continuous_sliders.h"
|
#include "ui/widgets/continuous_sliders.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/effects/fade_animation.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "media/media_audio.h"
|
#include "media/media_audio.h"
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/tooltip.h"
|
#include "ui/widgets/tooltip.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "window/top_bar_widget.h"
|
#include "window/top_bar_widget.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -1954,7 +1955,7 @@ OverviewWidget::OverviewWidget(QWidget *parent, not_null<Window::Controller*> co
|
||||||
, _topBar(this, controller)
|
, _topBar(this, controller)
|
||||||
, _scroll(this, st::settingsScroll, false)
|
, _scroll(this, st::settingsScroll, false)
|
||||||
, _mediaType(this, st::defaultDropdownMenu)
|
, _mediaType(this, st::defaultDropdownMenu)
|
||||||
, _topShadow(this, st::shadowFg) {
|
, _topShadow(this) {
|
||||||
_inner = _scroll->setOwnedWidget(object_ptr<OverviewInner>(this, _scroll, peer, type));
|
_inner = _scroll->setOwnedWidget(object_ptr<OverviewInner>(this, _scroll, peer, type));
|
||||||
_scroll->move(0, 0);
|
_scroll->move(0, 0);
|
||||||
_inner->move(0, 0);
|
_inner->move(0, 0);
|
||||||
|
|
|
@ -346,7 +346,7 @@ InnerWidget::~InnerWidget() {
|
||||||
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<UserData*> user) : Window::SectionWidget(parent, controller)
|
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<UserData*> user) : Window::SectionWidget(parent, controller)
|
||||||
, _scroll(this, st::settingsScroll)
|
, _scroll(this, st::settingsScroll)
|
||||||
, _fixedBar(this)
|
, _fixedBar(this)
|
||||||
, _fixedBarShadow(this, st::shadowFg) {
|
, _fixedBarShadow(this) {
|
||||||
_fixedBar->move(0, 0);
|
_fixedBar->move(0, 0);
|
||||||
_fixedBar->resizeToWidth(width());
|
_fixedBar->resizeToWidth(width());
|
||||||
_fixedBar->show();
|
_fixedBar->show();
|
||||||
|
|
|
@ -26,16 +26,15 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "profile/profile_section_memento.h"
|
#include "profile/profile_section_memento.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/wrap/fade_wrap.h"
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, PeerData *peer) : Window::SectionWidget(parent, controller)
|
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, PeerData *peer) : Window::SectionWidget(parent, controller)
|
||||||
, _scroll(this, st::settingsScroll)
|
, _scroll(this, st::settingsScroll)
|
||||||
, _fixedBar(this, peer)
|
, _fixedBar(this, peer)
|
||||||
, _fixedBarShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
, _fixedBarShadow(this) {
|
||||||
_fixedBar->move(0, 0);
|
_fixedBar->move(0, 0);
|
||||||
_fixedBar->resizeToWidth(width());
|
_fixedBar->resizeToWidth(width());
|
||||||
_fixedBar->show();
|
_fixedBar->show();
|
||||||
|
@ -108,7 +107,7 @@ void Widget::restoreState(not_null<SectionMemento*> memento) {
|
||||||
auto scrollTop = memento->getScrollTop();
|
auto scrollTop = memento->getScrollTop();
|
||||||
_scroll->scrollToY(scrollTop);
|
_scroll->scrollToY(scrollTop);
|
||||||
updateScrollState();
|
updateScrollState();
|
||||||
_fixedBarShadow->finishAnimation();
|
_fixedBarShadow->finishAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::resizeEvent(QResizeEvent *e) {
|
void Widget::resizeEvent(QResizeEvent *e) {
|
||||||
|
@ -118,7 +117,6 @@ void Widget::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
int newScrollTop = _scroll->scrollTop() + topDelta();
|
int newScrollTop = _scroll->scrollTop() + topDelta();
|
||||||
_fixedBar->resizeToWidth(width());
|
_fixedBar->resizeToWidth(width());
|
||||||
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
|
|
||||||
|
|
||||||
QSize scrollSize(width(), height() - _fixedBar->height());
|
QSize scrollSize(width(), height() - _fixedBar->height());
|
||||||
if (_scroll->size() != scrollSize) {
|
if (_scroll->size() != scrollSize) {
|
||||||
|
|
|
@ -24,9 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ScrollArea;
|
class ScrollArea;
|
||||||
class PlainShadow;
|
class FadeShadow;
|
||||||
template <typename Widget>
|
|
||||||
class WidgetFadeWrap;
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
@ -77,7 +75,7 @@ private:
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
QPointer<InnerWidget> _inner;
|
QPointer<InnerWidget> _inner;
|
||||||
object_ptr<FixedBar> _fixedBar;
|
object_ptr<FixedBar> _fixedBar;
|
||||||
object_ptr<Ui::WidgetFadeWrap<Ui::PlainShadow>> _fixedBarShadow;
|
object_ptr<Ui::FadeShadow> _fixedBarShadow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
|
@ -42,7 +43,7 @@ Layer::Layer()
|
||||||
: _scroll(this, st::settingsScroll)
|
: _scroll(this, st::settingsScroll)
|
||||||
, _fixedBar(this)
|
, _fixedBar(this)
|
||||||
, _fixedBarClose(this, st::settingsFixedBarClose)
|
, _fixedBarClose(this, st::settingsFixedBarClose)
|
||||||
, _fixedBarShadow(this, object_ptr<BoxLayerTitleShadow>(this)) {
|
, _fixedBarShadow(this) {
|
||||||
_fixedBar->moveToLeft(0, st::boxRadius);
|
_fixedBar->moveToLeft(0, st::boxRadius);
|
||||||
_fixedBarClose->moveToRight(0, 0);
|
_fixedBarClose->moveToRight(0, 0);
|
||||||
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
|
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
|
||||||
|
@ -107,6 +108,7 @@ void Layer::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
_fixedBar->resizeToWidth(width());
|
_fixedBar->resizeToWidth(width());
|
||||||
_fixedBar->moveToLeft(0, st::boxRadius);
|
_fixedBar->moveToLeft(0, st::boxRadius);
|
||||||
|
_fixedBar->update();
|
||||||
_fixedBarClose->moveToRight(0, 0);
|
_fixedBarClose->moveToRight(0, 0);
|
||||||
auto shadowTop = _fixedBar->y() + _fixedBar->height();
|
auto shadowTop = _fixedBar->y() + _fixedBar->height();
|
||||||
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
|
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
|
||||||
|
|
|
@ -20,16 +20,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "layerwidget.h"
|
#include "window/layer_widget.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
class BoxLayerTitleShadow;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ScrollArea;
|
class ScrollArea;
|
||||||
class IconButton;
|
class IconButton;
|
||||||
template <typename Widget>
|
class FadeShadow;
|
||||||
class WidgetFadeWrap;
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
@ -46,7 +43,7 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layer : public LayerWidget {
|
class Layer : public Window::LayerWidget {
|
||||||
public:
|
public:
|
||||||
Layer();
|
Layer();
|
||||||
|
|
||||||
|
@ -80,7 +77,7 @@ private:
|
||||||
QPointer<LayerInner> _inner;
|
QPointer<LayerInner> _inner;
|
||||||
object_ptr<FixedBar> _fixedBar;
|
object_ptr<FixedBar> _fixedBar;
|
||||||
object_ptr<Ui::IconButton> _fixedBarClose;
|
object_ptr<Ui::IconButton> _fixedBarClose;
|
||||||
object_ptr<Ui::WidgetFadeWrap<BoxLayerTitleShadow>> _fixedBarShadow;
|
object_ptr<Ui::FadeShadow> _fixedBarShadow;
|
||||||
|
|
||||||
bool _roundedCorners = false;
|
bool _roundedCorners = false;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
|
@ -289,11 +289,12 @@ private:
|
||||||
|
|
||||||
std::map<PeerId, Lists> _lists;
|
std::map<PeerId, Lists> _lists;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
rpl::event_stream<SharedMediaSliceUpdate> _sliceUpdated;
|
rpl::event_stream<SharedMediaSliceUpdate> _sliceUpdated;
|
||||||
rpl::event_stream<SharedMediaRemoveOne> _oneRemoved;
|
rpl::event_stream<SharedMediaRemoveOne> _oneRemoved;
|
||||||
rpl::event_stream<SharedMediaRemoveAll> _allRemoved;
|
rpl::event_stream<SharedMediaRemoveAll> _allRemoved;
|
||||||
|
|
||||||
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
|
|
@ -183,9 +183,10 @@ private:
|
||||||
|
|
||||||
std::map<UserId, List> _lists;
|
std::map<UserId, List> _lists;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
|
||||||
rpl::event_stream<UserPhotosSliceUpdate> _sliceUpdated;
|
rpl::event_stream<UserPhotosSliceUpdate> _sliceUpdated;
|
||||||
|
|
||||||
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
|
|
@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "ui/effects/widget_fade_wrap.h"
|
#include "ui/effects/fade_animation.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -153,43 +153,4 @@ void FadeAnimation::updateCallback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetFadeWrap<TWidget>::WidgetFadeWrap(QWidget *parent
|
|
||||||
, object_ptr<TWidget> entity
|
|
||||||
, int duration
|
|
||||||
, base::lambda<void()> updateCallback
|
|
||||||
, bool scaled) : TWidget(parent)
|
|
||||||
, _entity(std::move(entity))
|
|
||||||
, _duration(duration)
|
|
||||||
, _updateCallback(std::move(updateCallback))
|
|
||||||
, _animation(this, scaled) {
|
|
||||||
_animation.show();
|
|
||||||
installCallbacks();
|
|
||||||
_entity->setParent(this);
|
|
||||||
_entity->moveToLeft(0, 0);
|
|
||||||
_entity->installEventFilter(this);
|
|
||||||
resize(_entity->size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetFadeWrap<TWidget>::installCallbacks() {
|
|
||||||
if (_updateCallback) {
|
|
||||||
_animation.setFinishedCallback([this] { _updateCallback(); });
|
|
||||||
_animation.setUpdatedCallback([this](float64 opacity) { _updateCallback(); });
|
|
||||||
} else {
|
|
||||||
_animation.setFinishedCallback(base::lambda<void()>());
|
|
||||||
_animation.setUpdatedCallback(base::lambda<void(float64)>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WidgetFadeWrap<TWidget>::eventFilter(QObject *object, QEvent *event) {
|
|
||||||
if (object == _entity && event->type() == QEvent::Resize) {
|
|
||||||
resize(_entity->rect().size());
|
|
||||||
}
|
|
||||||
return TWidget::eventFilter(object, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetFadeWrap<TWidget>::paintEvent(QPaintEvent *e) {
|
|
||||||
Painter p(this);
|
|
||||||
_animation.paint(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
78
Telegram/SourceFiles/ui/effects/fade_animation.h
Normal file
78
Telegram/SourceFiles/ui/effects/fade_animation.h
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "styles/style_widgets.h"
|
||||||
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
|
||||||
|
class FadeAnimation {
|
||||||
|
public:
|
||||||
|
FadeAnimation(TWidget *widget, bool scaled = false);
|
||||||
|
|
||||||
|
bool paint(Painter &p);
|
||||||
|
void refreshCache();
|
||||||
|
|
||||||
|
using FinishedCallback = base::lambda<void()>;
|
||||||
|
void setFinishedCallback(FinishedCallback &&callback);
|
||||||
|
|
||||||
|
using UpdatedCallback = base::lambda<void(float64)>;
|
||||||
|
void setUpdatedCallback(UpdatedCallback &&callback);
|
||||||
|
|
||||||
|
void show();
|
||||||
|
void hide();
|
||||||
|
|
||||||
|
void fadeIn(int duration);
|
||||||
|
void fadeOut(int duration);
|
||||||
|
|
||||||
|
void finish() {
|
||||||
|
stopAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool animating() const {
|
||||||
|
return _animation.animating();
|
||||||
|
}
|
||||||
|
bool visible() const {
|
||||||
|
return _visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void startAnimation(int duration);
|
||||||
|
void stopAnimation();
|
||||||
|
|
||||||
|
void updateCallback();
|
||||||
|
QPixmap grabContent();
|
||||||
|
|
||||||
|
TWidget *_widget = nullptr;
|
||||||
|
bool _scaled = false;
|
||||||
|
|
||||||
|
Animation _animation;
|
||||||
|
QSize _size;
|
||||||
|
QPixmap _cache;
|
||||||
|
bool _visible = false;
|
||||||
|
|
||||||
|
FinishedCallback _finishedCallback;
|
||||||
|
UpdatedCallback _updatedCallback;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Ui
|
|
@ -1,203 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of Telegram Desktop,
|
|
||||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
||||||
|
|
||||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
It is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give permission
|
|
||||||
to link the code of portions of this program with the OpenSSL library.
|
|
||||||
|
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class TWidget;
|
|
||||||
|
|
||||||
#include "styles/style_widgets.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
|
|
||||||
class FadeAnimation {
|
|
||||||
public:
|
|
||||||
FadeAnimation(TWidget *widget, bool scaled = false);
|
|
||||||
|
|
||||||
bool paint(Painter &p);
|
|
||||||
void refreshCache();
|
|
||||||
|
|
||||||
using FinishedCallback = base::lambda<void()>;
|
|
||||||
void setFinishedCallback(FinishedCallback &&callback);
|
|
||||||
|
|
||||||
using UpdatedCallback = base::lambda<void(float64)>;
|
|
||||||
void setUpdatedCallback(UpdatedCallback &&callback);
|
|
||||||
|
|
||||||
void show();
|
|
||||||
void hide();
|
|
||||||
|
|
||||||
void fadeIn(int duration);
|
|
||||||
void fadeOut(int duration);
|
|
||||||
|
|
||||||
void finish() {
|
|
||||||
_animation.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool animating() const {
|
|
||||||
return _animation.animating();
|
|
||||||
}
|
|
||||||
bool visible() const {
|
|
||||||
return _visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void startAnimation(int duration);
|
|
||||||
void stopAnimation();
|
|
||||||
|
|
||||||
void updateCallback();
|
|
||||||
QPixmap grabContent();
|
|
||||||
|
|
||||||
TWidget *_widget = nullptr;
|
|
||||||
bool _scaled = false;
|
|
||||||
|
|
||||||
Animation _animation;
|
|
||||||
QSize _size;
|
|
||||||
QPixmap _cache;
|
|
||||||
bool _visible = false;
|
|
||||||
|
|
||||||
FinishedCallback _finishedCallback;
|
|
||||||
UpdatedCallback _updatedCallback;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Widget>
|
|
||||||
class WidgetFadeWrap;
|
|
||||||
|
|
||||||
template <>
|
|
||||||
class WidgetFadeWrap<TWidget> : public TWidget {
|
|
||||||
public:
|
|
||||||
WidgetFadeWrap(QWidget *parent
|
|
||||||
, object_ptr<TWidget> entity
|
|
||||||
, int duration = st::widgetFadeDuration
|
|
||||||
, base::lambda<void()> updateCallback = base::lambda<void()>()
|
|
||||||
, bool scaled = false);
|
|
||||||
|
|
||||||
void showAnimated() {
|
|
||||||
toggleAnimated(true);
|
|
||||||
}
|
|
||||||
void hideAnimated() {
|
|
||||||
toggleAnimated(false);
|
|
||||||
}
|
|
||||||
void toggleAnimated(bool visible) {
|
|
||||||
if (visible) {
|
|
||||||
_animation.fadeIn(_duration);
|
|
||||||
} else {
|
|
||||||
_animation.fadeOut(_duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void showFast() {
|
|
||||||
toggleFast(true);
|
|
||||||
}
|
|
||||||
void hideFast() {
|
|
||||||
toggleFast(false);
|
|
||||||
}
|
|
||||||
void toggleFast(bool visible) {
|
|
||||||
if (visible) {
|
|
||||||
_animation.show();
|
|
||||||
} else {
|
|
||||||
_animation.hide();
|
|
||||||
}
|
|
||||||
if (_updateCallback) {
|
|
||||||
_updateCallback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void finishAnimation() {
|
|
||||||
_animation.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isHiddenOrHiding() const {
|
|
||||||
return !_animation.visible();
|
|
||||||
}
|
|
||||||
|
|
||||||
TWidget *entity() {
|
|
||||||
return _entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TWidget *entity() const {
|
|
||||||
return _entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMargins getMargins() const override {
|
|
||||||
return _entity->getMargins();
|
|
||||||
}
|
|
||||||
int naturalWidth() const override {
|
|
||||||
return _entity->naturalWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool animating() const {
|
|
||||||
return _animation.animating();
|
|
||||||
}
|
|
||||||
void setUpdateCallback(base::lambda<void()> callback) {
|
|
||||||
_updateCallback = std::move(callback);
|
|
||||||
installCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *object, QEvent *event) override;
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void installCallbacks();
|
|
||||||
|
|
||||||
object_ptr<TWidget> _entity;
|
|
||||||
int _duration;
|
|
||||||
base::lambda<void()> _updateCallback;
|
|
||||||
|
|
||||||
FadeAnimation _animation;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Widget>
|
|
||||||
class WidgetFadeWrap : public WidgetFadeWrap<TWidget> {
|
|
||||||
public:
|
|
||||||
WidgetFadeWrap(QWidget *parent
|
|
||||||
, object_ptr<Widget> entity
|
|
||||||
, int duration = st::widgetFadeDuration
|
|
||||||
, base::lambda<void()> updateCallback = base::lambda<void()>()
|
|
||||||
, bool scaled = false) : WidgetFadeWrap<TWidget>(parent
|
|
||||||
, std::move(entity)
|
|
||||||
, duration
|
|
||||||
, std::move(updateCallback)
|
|
||||||
, scaled) {
|
|
||||||
}
|
|
||||||
Widget *entity() {
|
|
||||||
return static_cast<Widget*>(WidgetFadeWrap<TWidget>::entity());
|
|
||||||
}
|
|
||||||
const Widget *entity() const {
|
|
||||||
return static_cast<const Widget*>(WidgetFadeWrap<TWidget>::entity());
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Widget>
|
|
||||||
class WidgetScaledFadeWrap : public WidgetFadeWrap<Widget> {
|
|
||||||
public:
|
|
||||||
WidgetScaledFadeWrap(QWidget *parent
|
|
||||||
, object_ptr<Widget> entity
|
|
||||||
, int duration = st::widgetFadeDuration
|
|
||||||
, base::lambda<void()> updateCallback = base::lambda<void()>()) : WidgetFadeWrap<Widget>(parent
|
|
||||||
, std::move(entity)
|
|
||||||
, duration
|
|
||||||
, std::move(updateCallback)
|
|
||||||
, true) {
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Ui
|
|
|
@ -528,9 +528,10 @@ public:
|
||||||
|
|
||||||
// Use that instead "= new Object(parent, ...)"
|
// Use that instead "= new Object(parent, ...)"
|
||||||
template <typename Parent, typename... Args>
|
template <typename Parent, typename... Args>
|
||||||
void create(Parent &&parent, Args&&... args) {
|
Object *create(Parent &&parent, Args&&... args) {
|
||||||
destroy();
|
destroy();
|
||||||
_object = new Object(std::forward<Parent>(parent), std::forward<Args>(args)...);
|
_object = new Object(std::forward<Parent>(parent), std::forward<Args>(args)...);
|
||||||
|
return data();
|
||||||
}
|
}
|
||||||
void destroy() {
|
void destroy() {
|
||||||
delete base::take(_object);
|
delete base::take(_object);
|
||||||
|
|
|
@ -575,7 +575,12 @@ void IconButton::onStateChanged(State was, StateChangeSource source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint IconButton::prepareRippleStartPosition() const {
|
QPoint IconButton::prepareRippleStartPosition() const {
|
||||||
return mapFromGlobal(QCursor::pos()) - _st.rippleAreaPosition;
|
auto result = mapFromGlobal(QCursor::pos())
|
||||||
|
- _st.rippleAreaPosition;
|
||||||
|
auto rect = QRect(0, 0, _st.rippleAreaSize, _st.rippleAreaSize);
|
||||||
|
return rect.contains(result)
|
||||||
|
? result
|
||||||
|
: DisabledRippleStartPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage IconButton::prepareRippleMask() const {
|
QImage IconButton::prepareRippleMask() const {
|
||||||
|
|
|
@ -20,8 +20,20 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
|
|
||||||
|
#include "styles/style_widgets.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
|
PlainShadow::PlainShadow(QWidget *parent)
|
||||||
|
: PlainShadow(parent, st::shadowFg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
PlainShadow::PlainShadow(QWidget *parent, style::color color)
|
||||||
|
: RpWidget(parent)
|
||||||
|
, _color(color) {
|
||||||
|
resize(st::lineWidth, st::lineWidth);
|
||||||
|
}
|
||||||
|
|
||||||
void Shadow::paint(Painter &p, const QRect &box, int outerWidth, const style::Shadow &st, RectParts sides) {
|
void Shadow::paint(Painter &p, const QRect &box, int outerWidth, const style::Shadow &st, RectParts sides) {
|
||||||
auto left = (sides & RectPart::Left);
|
auto left = (sides & RectPart::Left);
|
||||||
auto top = (sides & RectPart::Top);
|
auto top = (sides & RectPart::Top);
|
||||||
|
@ -100,4 +112,9 @@ QPixmap Shadow::grab(TWidget *target, const style::Shadow &shadow, RectParts sid
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Shadow::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
paint(p, rect().marginsRemoved(_st.extend), width(), _st, _sides);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -17,17 +17,18 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "styles/style_widgets.h"
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
|
namespace style {
|
||||||
|
struct Shadow;
|
||||||
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
class PlainShadow : public RpWidget {
|
class PlainShadow : public RpWidget {
|
||||||
public:
|
public:
|
||||||
PlainShadow(QWidget *parent, style::color color)
|
PlainShadow(QWidget *parent);
|
||||||
: RpWidget(parent), _color(color) {
|
PlainShadow(QWidget *parent, style::color color);
|
||||||
resize(st::lineWidth, st::lineWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override {
|
void paintEvent(QPaintEvent *e) override {
|
||||||
|
@ -51,10 +52,7 @@ public:
|
||||||
static QPixmap grab(TWidget *target, const style::Shadow &shadow, RectParts sides = RectPart::Left | RectPart::Top | RectPart::Right | RectPart::Bottom);
|
static QPixmap grab(TWidget *target, const style::Shadow &shadow, RectParts sides = RectPart::Left | RectPart::Top | RectPart::Right | RectPart::Bottom);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override {
|
void paintEvent(QPaintEvent *e) override;
|
||||||
Painter p(this);
|
|
||||||
paint(p, rect().marginsRemoved(_st.extend), width(), _st, _sides);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const style::Shadow &_st;
|
const style::Shadow &_st;
|
||||||
|
|
98
Telegram/SourceFiles/ui/wrap/fade_wrap.cpp
Normal file
98
Telegram/SourceFiles/ui/wrap/fade_wrap.cpp
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#include "ui/wrap/fade_wrap.h"
|
||||||
|
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
|
||||||
|
FadeWrap<RpWidget>::FadeWrap(
|
||||||
|
QWidget *parent,
|
||||||
|
object_ptr<RpWidget> &&child,
|
||||||
|
bool scaled)
|
||||||
|
: Parent(parent, std::move(child))
|
||||||
|
, _duration(st::fadeWrapDuration)
|
||||||
|
, _animation(this, scaled) {
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::setDuration(int duration) {
|
||||||
|
_duration = duration;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleAnimated(
|
||||||
|
bool shown) {
|
||||||
|
auto updated = (shown != _animation.visible());
|
||||||
|
if (shown) {
|
||||||
|
_animation.fadeIn(_duration);
|
||||||
|
} else {
|
||||||
|
_animation.fadeOut(_duration);
|
||||||
|
}
|
||||||
|
if (updated) {
|
||||||
|
_shownUpdated.fire_copy(shown);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleFast(bool shown) {
|
||||||
|
auto updated = (shown != _animation.visible());
|
||||||
|
if (shown) {
|
||||||
|
_animation.show();
|
||||||
|
} else {
|
||||||
|
_animation.hide();
|
||||||
|
}
|
||||||
|
if (updated) {
|
||||||
|
_shownUpdated.fire_copy(shown);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimations() {
|
||||||
|
_animation.finish();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleOn(
|
||||||
|
rpl::producer<bool> &&shown) {
|
||||||
|
std::move(shown)
|
||||||
|
| rpl::start_with_next([this](bool shown) {
|
||||||
|
toggleAnimated(shown);
|
||||||
|
}, lifetime());
|
||||||
|
finishAnimations();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FadeWrap<RpWidget>::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
_animation.paint(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeShadow::FadeShadow(QWidget *parent)
|
||||||
|
: FadeShadow(parent, st::shadowFg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeShadow::FadeShadow(QWidget *parent, style::color color)
|
||||||
|
: Parent(parent, object_ptr<PlainShadow>(parent, color)) {
|
||||||
|
hideFast();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Ui
|
||||||
|
|
152
Telegram/SourceFiles/ui/wrap/fade_wrap.h
Normal file
152
Telegram/SourceFiles/ui/wrap/fade_wrap.h
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
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-2017 John Preston, https://desktop.telegram.org
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/wrap/wrap.h"
|
||||||
|
#include "ui/effects/fade_animation.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
|
||||||
|
template <typename Widget = RpWidget>
|
||||||
|
class FadeWrapScaled;
|
||||||
|
|
||||||
|
template <typename Widget = RpWidget>
|
||||||
|
class FadeWrap;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class FadeWrap<RpWidget> : public Wrap<RpWidget> {
|
||||||
|
using Parent = Wrap<RpWidget>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FadeWrap(QWidget *parent, object_ptr<RpWidget> &&child)
|
||||||
|
: FadeWrap(parent, std::move(child), false) {
|
||||||
|
}
|
||||||
|
FadeWrap(
|
||||||
|
QWidget *parent,
|
||||||
|
object_ptr<RpWidget> &&child,
|
||||||
|
bool scaled);
|
||||||
|
|
||||||
|
FadeWrap *setDuration(int duration);
|
||||||
|
FadeWrap *toggleAnimated(bool shown);
|
||||||
|
FadeWrap *toggleFast(bool shown);
|
||||||
|
FadeWrap *showAnimated() { return toggleAnimated(true); }
|
||||||
|
FadeWrap *hideAnimated() { return toggleAnimated(false); }
|
||||||
|
FadeWrap *showFast() { return toggleFast(true); }
|
||||||
|
FadeWrap *hideFast() { return toggleFast(false); }
|
||||||
|
FadeWrap *finishAnimations();
|
||||||
|
FadeWrap *toggleOn(rpl::producer<bool> &&shown);
|
||||||
|
|
||||||
|
bool animating() const {
|
||||||
|
return _animation.animating();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isHiddenOrHiding() const {
|
||||||
|
return !_animation.visible();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto shownValue() const {
|
||||||
|
return _shownUpdated.events_starting_with(
|
||||||
|
_animation.visible());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) final override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
rpl::event_stream<bool> _shownUpdated;
|
||||||
|
FadeAnimation _animation;
|
||||||
|
int _duration = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Widget>
|
||||||
|
class FadeWrap : public Wrap<Widget, FadeWrap<RpWidget>> {
|
||||||
|
using Parent = Wrap<Widget, FadeWrap<RpWidget>>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FadeWrap(QWidget *parent, object_ptr<Widget> &&child)
|
||||||
|
: Parent(parent, std::move(child)) {
|
||||||
|
}
|
||||||
|
FadeWrap(
|
||||||
|
QWidget *parent,
|
||||||
|
object_ptr<Widget> &&child,
|
||||||
|
bool scaled)
|
||||||
|
: Parent(parent, std::move(child), scaled) {
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeWrap *setDuration(int duration) {
|
||||||
|
return chain(Parent::setDuration(duration));
|
||||||
|
}
|
||||||
|
FadeWrap *toggleAnimated(bool shown) {
|
||||||
|
return chain(Parent::toggleAnimated(shown));
|
||||||
|
}
|
||||||
|
FadeWrap *toggleFast(bool shown) {
|
||||||
|
return chain(Parent::toggleFast(shown));
|
||||||
|
}
|
||||||
|
FadeWrap *showAnimated() {
|
||||||
|
return chain(Parent::showAnimated());
|
||||||
|
}
|
||||||
|
FadeWrap *hideAnimated() {
|
||||||
|
return chain(Parent::hideAnimated());
|
||||||
|
}
|
||||||
|
FadeWrap *showFast() {
|
||||||
|
return chain(Parent::showFast());
|
||||||
|
}
|
||||||
|
FadeWrap *hideFast() {
|
||||||
|
return chain(Parent::hideFast());
|
||||||
|
}
|
||||||
|
FadeWrap *finishAnimations() {
|
||||||
|
return chain(Parent::finishAnimations());
|
||||||
|
}
|
||||||
|
FadeWrap *toggleOn(rpl::producer<bool> &&shown) {
|
||||||
|
return chain(Parent::toggleOn(std::move(shown)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
FadeWrap *chain(FadeWrap<RpWidget> *result) {
|
||||||
|
return static_cast<FadeWrap*>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Widget>
|
||||||
|
class FadeWrapScaled : public FadeWrap<Widget> {
|
||||||
|
using Parent = FadeWrap<Widget>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FadeWrapScaled(QWidget *parent, object_ptr<Widget> &&child)
|
||||||
|
: Parent(parent, std::move(child), true) {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class PlainShadow;
|
||||||
|
class FadeShadow : public FadeWrap<PlainShadow> {
|
||||||
|
using Parent = FadeWrap<PlainShadow>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FadeShadow(QWidget *parent);
|
||||||
|
FadeShadow(QWidget *parent, style::color color);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Ui
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Ui {
|
||||||
|
|
||||||
PaddingWrap<RpWidget>::PaddingWrap(
|
PaddingWrap<RpWidget>::PaddingWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child,
|
object_ptr<RpWidget> &&child,
|
||||||
const style::margins &padding)
|
const style::margins &padding)
|
||||||
: Parent(parent, std::move(child))
|
: Parent(parent, std::move(child))
|
||||||
, _padding(padding) {
|
, _padding(padding) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class PaddingWrap<RpWidget> : public Wrap<RpWidget> {
|
||||||
public:
|
public:
|
||||||
PaddingWrap(
|
PaddingWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child,
|
object_ptr<RpWidget> &&child,
|
||||||
const style::margins &padding);
|
const style::margins &padding);
|
||||||
|
|
||||||
int naturalWidth() const override;
|
int naturalWidth() const override;
|
||||||
|
@ -55,7 +55,7 @@ class PaddingWrap : public Wrap<Widget, PaddingWrap<RpWidget>> {
|
||||||
public:
|
public:
|
||||||
PaddingWrap(
|
PaddingWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<Widget> child,
|
object_ptr<Widget> &&child,
|
||||||
const style::margins &padding)
|
const style::margins &padding)
|
||||||
: Parent(parent, std::move(child), padding) {
|
: Parent(parent, std::move(child), padding) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Ui {
|
||||||
|
|
||||||
SlideWrap<RpWidget>::SlideWrap(
|
SlideWrap<RpWidget>::SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child)
|
object_ptr<RpWidget> &&child)
|
||||||
: SlideWrap(
|
: SlideWrap(
|
||||||
parent,
|
parent,
|
||||||
std::move(child),
|
std::move(child),
|
||||||
|
@ -39,7 +39,7 @@ SlideWrap<RpWidget>::SlideWrap(
|
||||||
|
|
||||||
SlideWrap<RpWidget>::SlideWrap(
|
SlideWrap<RpWidget>::SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child,
|
object_ptr<RpWidget> &&child,
|
||||||
const style::margins &padding)
|
const style::margins &padding)
|
||||||
: Parent(
|
: Parent(
|
||||||
parent,
|
parent,
|
||||||
|
@ -59,7 +59,7 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleAnimated(
|
||||||
bool shown) {
|
bool shown) {
|
||||||
if (_shown != shown) {
|
if (_shown != shown) {
|
||||||
setShown(shown);
|
setShown(shown);
|
||||||
_slideAnimation.start(
|
_animation.start(
|
||||||
[this] { animationStep(); },
|
[this] { animationStep(); },
|
||||||
_shown ? 0. : 1.,
|
_shown ? 0. : 1.,
|
||||||
_shown ? 1. : 0.,
|
_shown ? 1. : 0.,
|
||||||
|
@ -77,7 +77,7 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleFast(bool shown) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimations() {
|
SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimations() {
|
||||||
_slideAnimation.finish();
|
_animation.finish();
|
||||||
animationStep();
|
animationStep();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -99,16 +99,16 @@ void SlideWrap<RpWidget>::animationStep() {
|
||||||
weak->moveToLeft(margins.left(), margins.top());
|
weak->moveToLeft(margins.left(), margins.top());
|
||||||
newWidth = weak->width();
|
newWidth = weak->width();
|
||||||
}
|
}
|
||||||
auto current = _slideAnimation.current(_shown ? 1. : 0.);
|
auto current = _animation.current(_shown ? 1. : 0.);
|
||||||
auto newHeight = wrapped()
|
auto newHeight = wrapped()
|
||||||
? (_slideAnimation.animating()
|
? (_animation.animating()
|
||||||
? anim::interpolate(0, wrapped()->heightNoMargins(), current)
|
? anim::interpolate(0, wrapped()->heightNoMargins(), current)
|
||||||
: (_shown ? wrapped()->height() : 0))
|
: (_shown ? wrapped()->height() : 0))
|
||||||
: 0;
|
: 0;
|
||||||
if (newWidth != width() || newHeight != height()) {
|
if (newWidth != width() || newHeight != height()) {
|
||||||
resize(newWidth, newHeight);
|
resize(newWidth, newHeight);
|
||||||
}
|
}
|
||||||
auto shouldBeHidden = !_shown && !_slideAnimation.animating();
|
auto shouldBeHidden = !_shown && !_animation.animating();
|
||||||
if (shouldBeHidden != isHidden()) {
|
if (shouldBeHidden != isHidden()) {
|
||||||
setVisible(!shouldBeHidden);
|
setVisible(!shouldBeHidden);
|
||||||
if (shouldBeHidden) {
|
if (shouldBeHidden) {
|
||||||
|
@ -137,7 +137,7 @@ int SlideWrap<RpWidget>::resizeGetHeight(int newWidth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlideWrap<RpWidget>::wrappedSizeUpdated(QSize size) {
|
void SlideWrap<RpWidget>::wrappedSizeUpdated(QSize size) {
|
||||||
if (_slideAnimation.animating()) {
|
if (_animation.animating()) {
|
||||||
animationStep();
|
animationStep();
|
||||||
} else if (_shown) {
|
} else if (_shown) {
|
||||||
resize(size);
|
resize(size);
|
||||||
|
|
|
@ -34,13 +34,13 @@ class SlideWrap<RpWidget> : public Wrap<PaddingWrap<RpWidget>> {
|
||||||
public:
|
public:
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child);
|
object_ptr<RpWidget> &&child);
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
const style::margins &padding);
|
const style::margins &padding);
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<RpWidget> child,
|
object_ptr<RpWidget> &&child,
|
||||||
const style::margins &padding);
|
const style::margins &padding);
|
||||||
|
|
||||||
SlideWrap *setDuration(int duration);
|
SlideWrap *setDuration(int duration);
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
|
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
|
||||||
|
|
||||||
bool animating() const {
|
bool animating() const {
|
||||||
return _slideAnimation.animating();
|
return _animation.animating();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMargins getMargins() const override;
|
QMargins getMargins() const override;
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
|
|
||||||
bool _shown = true;
|
bool _shown = true;
|
||||||
rpl::event_stream<bool> _shownUpdated;
|
rpl::event_stream<bool> _shownUpdated;
|
||||||
Animation _slideAnimation;
|
Animation _animation;
|
||||||
int _duration = 0;
|
int _duration = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -89,7 +89,7 @@ class SlideWrap : public Wrap<PaddingWrap<Widget>, SlideWrap<RpWidget>> {
|
||||||
public:
|
public:
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<Widget> child)
|
object_ptr<Widget> &&child)
|
||||||
: Parent(parent, std::move(child)) {
|
: Parent(parent, std::move(child)) {
|
||||||
}
|
}
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
}
|
}
|
||||||
SlideWrap(
|
SlideWrap(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
object_ptr<Widget> child,
|
object_ptr<Widget> &&child,
|
||||||
const style::margins &padding)
|
const style::margins &padding)
|
||||||
: Parent(parent, std::move(child), padding) {
|
: Parent(parent, std::move(child), padding) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct UnwrapHelper {
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
class Wrap<Widget, RpWidget> : public RpWidget {
|
class Wrap<Widget, RpWidget> : public RpWidget {
|
||||||
public:
|
public:
|
||||||
Wrap(QWidget *parent, object_ptr<Widget> child);
|
Wrap(QWidget *parent, object_ptr<Widget> &&child);
|
||||||
|
|
||||||
Widget *wrapped() {
|
Widget *wrapped() {
|
||||||
return _wrapped;
|
return _wrapped;
|
||||||
|
@ -115,7 +115,9 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
Wrap<Widget, RpWidget>::Wrap(QWidget *parent, object_ptr<Widget> child)
|
Wrap<Widget, RpWidget>::Wrap(
|
||||||
|
QWidget *parent,
|
||||||
|
object_ptr<Widget> &&child)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _wrapped(std::move(child)) {
|
, _wrapped(std::move(child)) {
|
||||||
if (_wrapped) {
|
if (_wrapped) {
|
||||||
|
|
|
@ -18,13 +18,13 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "lang/lang_keys.h"
|
#include "window/layer_widget.h"
|
||||||
|
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
#include "data/data_photo.h"
|
#include "data/data_photo.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "media/media_clip_reader.h"
|
#include "media/media_clip_reader.h"
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "layerwidget.h"
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
@ -44,6 +44,8 @@ constexpr int kStickerPreviewEmojiLimit = 10;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
namespace Window {
|
||||||
|
|
||||||
class LayerStackWidget::BackgroundWidget : public TWidget {
|
class LayerStackWidget::BackgroundWidget : public TWidget {
|
||||||
public:
|
public:
|
||||||
BackgroundWidget(QWidget *parent) : TWidget(parent) {
|
BackgroundWidget(QWidget *parent) : TWidget(parent) {
|
||||||
|
@ -325,7 +327,10 @@ void LayerStackWidget::BackgroundWidget::animationCallback() {
|
||||||
checkIfDone();
|
checkIfDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerStackWidget::LayerStackWidget(QWidget *parent, Window::Controller *controller) : TWidget(parent)
|
LayerStackWidget::LayerStackWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
Controller *controller)
|
||||||
|
: TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _background(this) {
|
, _background(this) {
|
||||||
setGeometry(parentWidget()->rect());
|
setGeometry(parentWidget()->rect());
|
||||||
|
@ -780,6 +785,8 @@ LayerStackWidget::~LayerStackWidget() {
|
||||||
if (App::wnd()) App::wnd()->noLayerStack(this);
|
if (App::wnd()) App::wnd()->noLayerStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _emojiSize(Ui::Emoji::Size(Ui::Emoji::Index() + 1) / cIntRetinaFactor()) {
|
, _emojiSize(Ui::Emoji::Size(Ui::Emoji::Index() + 1) / cIntRetinaFactor()) {
|
|
@ -23,9 +23,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
class MainMenu;
|
class MainMenu;
|
||||||
class Controller;
|
class Controller;
|
||||||
} // namespace Window
|
|
||||||
|
|
||||||
class LayerWidget : public Ui::RpWidget {
|
class LayerWidget : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
|
@ -87,9 +87,9 @@ class LayerStackWidget : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LayerStackWidget(QWidget *parent, Window::Controller *controller);
|
LayerStackWidget(QWidget *parent, Controller *controller);
|
||||||
|
|
||||||
Window::Controller *controller() const {
|
Controller *controller() const {
|
||||||
return _controller;
|
return _controller;
|
||||||
}
|
}
|
||||||
void finishAnimation();
|
void finishAnimation();
|
||||||
|
@ -173,18 +173,20 @@ private:
|
||||||
return const_cast<LayerStackWidget*>(this)->currentLayer();
|
return const_cast<LayerStackWidget*>(this)->currentLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Controller *_controller = nullptr;
|
Controller *_controller = nullptr;
|
||||||
|
|
||||||
QList<LayerWidget*> _layers;
|
QList<LayerWidget*> _layers;
|
||||||
|
|
||||||
object_ptr<LayerWidget> _specialLayer = { nullptr };
|
object_ptr<LayerWidget> _specialLayer = { nullptr };
|
||||||
object_ptr<Window::MainMenu> _mainMenu = { nullptr };
|
object_ptr<MainMenu> _mainMenu = { nullptr };
|
||||||
|
|
||||||
class BackgroundWidget;
|
class BackgroundWidget;
|
||||||
object_ptr<BackgroundWidget> _background;
|
object_ptr<BackgroundWidget> _background;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Window
|
||||||
|
|
||||||
class MediaPreviewWidget : public TWidget, private base::Subscriber {
|
class MediaPreviewWidget : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -20,24 +20,24 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class LayerWidget;
|
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
|
class LayerWidget;
|
||||||
enum class Column;
|
enum class Column;
|
||||||
|
|
||||||
class SectionMemento {
|
class SectionMemento {
|
||||||
public:
|
public:
|
||||||
virtual object_ptr<Window::SectionWidget> createWidget(
|
virtual object_ptr<SectionWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::Controller*> controller,
|
not_null<Controller*> controller,
|
||||||
Column column,
|
Column column,
|
||||||
const QRect &geometry) = 0;
|
const QRect &geometry) = 0;
|
||||||
|
|
||||||
virtual object_ptr<LayerWidget> createLayer(
|
virtual object_ptr<LayerWidget> createLayer(
|
||||||
not_null<Window::Controller*> controller) {
|
not_null<Controller*> controller,
|
||||||
|
const QRect &geometry) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
virtual bool instant() const {
|
virtual bool instant() const {
|
||||||
|
|
|
@ -26,6 +26,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
class Controller;
|
class Controller;
|
||||||
|
class LayerWidget;
|
||||||
|
|
||||||
enum class Column {
|
enum class Column {
|
||||||
First,
|
First,
|
||||||
|
@ -121,7 +122,7 @@ public:
|
||||||
|
|
||||||
// Some sections convert to layers on some geometry sizes.
|
// Some sections convert to layers on some geometry sizes.
|
||||||
virtual object_ptr<LayerWidget> moveContentToLayer(
|
virtual object_ptr<LayerWidget> moveContentToLayer(
|
||||||
int availableWidth) {
|
QRect bodyGeometry) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class BoxLayerTitleShadow;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class FlatButton;
|
class FlatButton;
|
||||||
class ScrollArea;
|
class ScrollArea;
|
||||||
class CrossButton;
|
class CrossButton;
|
||||||
class MultiSelect;
|
class MultiSelect;
|
||||||
|
class PlainShadow;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
@ -55,8 +54,8 @@ private:
|
||||||
QPointer<Inner> _inner;
|
QPointer<Inner> _inner;
|
||||||
object_ptr<Ui::CrossButton> _close;
|
object_ptr<Ui::CrossButton> _close;
|
||||||
object_ptr<Ui::MultiSelect> _select;
|
object_ptr<Ui::MultiSelect> _select;
|
||||||
object_ptr<BoxLayerTitleShadow> _leftShadow;
|
object_ptr<Ui::PlainShadow> _leftShadow;
|
||||||
object_ptr<BoxLayerTitleShadow> _topShadow;
|
object_ptr<Ui::PlainShadow> _topShadow;
|
||||||
object_ptr<Ui::FlatButton> _export;
|
object_ptr<Ui::FlatButton> _export;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
|
#include "ui/widgets/shadow.h"
|
||||||
#include "boxes/edit_color_box.h"
|
#include "boxes/edit_color_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr auto kThirdSectionInfoTimeoutMs = 1000;
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
TopBarWidget::TopBarWidget(
|
TopBarWidget::TopBarWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -208,7 +203,7 @@ void TopBarWidget::toggleInfoSection() {
|
||||||
} else if (auto peer = App::main()->historyPeer()) {
|
} else if (auto peer = App::main()->historyPeer()) {
|
||||||
if (_controller->canShowThirdSection()) {
|
if (_controller->canShowThirdSection()) {
|
||||||
Auth().data().setThirdSectionInfoEnabled(true);
|
Auth().data().setThirdSectionInfoEnabled(true);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
if (Adaptive::ThreeColumn()) {
|
if (Adaptive::ThreeColumn()) {
|
||||||
_controller->showSection(Info::Memento(peer->id));
|
_controller->showSection(Info::Memento(peer->id));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,11 +31,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr auto kThirdSectionInfoTimeoutMs = 1000;
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
void Controller::enableGifPauseReason(GifPauseReason reason) {
|
void Controller::enableGifPauseReason(GifPauseReason reason) {
|
||||||
if (!(_gifPauseReasons & reason)) {
|
if (!(_gifPauseReasons & reason)) {
|
||||||
|
@ -195,7 +190,7 @@ void Controller::closeThirdSection() {
|
||||||
}
|
}
|
||||||
Auth().data().setTabbedSelectorSectionEnabled(false);
|
Auth().data().setTabbedSelectorSectionEnabled(false);
|
||||||
Auth().data().setThirdSectionInfoEnabled(false);
|
Auth().data().setThirdSectionInfoEnabled(false);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
if (window()->size() != newWindowSize) {
|
if (window()->size() != newWindowSize) {
|
||||||
window()->resize(newWindowSize);
|
window()->resize(newWindowSize);
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,7 +298,7 @@ void Controller::showPeerInfo(
|
||||||
if (Adaptive::ThreeColumn()
|
if (Adaptive::ThreeColumn()
|
||||||
&& !Auth().data().thirdSectionInfoEnabled()) {
|
&& !Auth().data().thirdSectionInfoEnabled()) {
|
||||||
Auth().data().setThirdSectionInfoEnabled(true);
|
Auth().data().setThirdSectionInfoEnabled(true);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed();
|
||||||
}
|
}
|
||||||
showSection(
|
showSection(
|
||||||
Info::Memento(peerId),
|
Info::Memento(peerId),
|
||||||
|
|
|
@ -209,20 +209,22 @@
|
||||||
<(src_loc)/info/info_common_groups_inner_widget.h
|
<(src_loc)/info/info_common_groups_inner_widget.h
|
||||||
<(src_loc)/info/info_common_groups_widget.cpp
|
<(src_loc)/info/info_common_groups_widget.cpp
|
||||||
<(src_loc)/info/info_common_groups_widget.h
|
<(src_loc)/info/info_common_groups_widget.h
|
||||||
<(src_loc)/info/info_layer_wrap.cpp
|
<(src_loc)/info/info_content_widget.cpp
|
||||||
<(src_loc)/info/info_layer_wrap.h
|
<(src_loc)/info/info_content_widget.h
|
||||||
<(src_loc)/info/info_media_inner_widget.cpp
|
<(src_loc)/info/info_layer_widget.cpp
|
||||||
<(src_loc)/info/info_media_inner_widget.h
|
<(src_loc)/info/info_layer_widget.h
|
||||||
<(src_loc)/info/info_media_widget.cpp
|
|
||||||
<(src_loc)/info/info_media_widget.h
|
|
||||||
<(src_loc)/info/info_memento.cpp
|
<(src_loc)/info/info_memento.cpp
|
||||||
<(src_loc)/info/info_memento.h
|
<(src_loc)/info/info_memento.h
|
||||||
<(src_loc)/info/info_narrow_wrap.cpp
|
<(src_loc)/info/info_section_widget.cpp
|
||||||
<(src_loc)/info/info_narrow_wrap.h
|
<(src_loc)/info/info_section_widget.h
|
||||||
<(src_loc)/info/info_side_wrap.cpp
|
|
||||||
<(src_loc)/info/info_side_wrap.h
|
|
||||||
<(src_loc)/info/info_top_bar.cpp
|
<(src_loc)/info/info_top_bar.cpp
|
||||||
<(src_loc)/info/info_top_bar.h
|
<(src_loc)/info/info_top_bar.h
|
||||||
|
<(src_loc)/info/info_wrap_widget.cpp
|
||||||
|
<(src_loc)/info/info_wrap_widget.h
|
||||||
|
<(src_loc)/info/media/info_media_inner_widget.cpp
|
||||||
|
<(src_loc)/info/media/info_media_inner_widget.h
|
||||||
|
<(src_loc)/info/media/info_media_widget.cpp
|
||||||
|
<(src_loc)/info/media/info_media_widget.h
|
||||||
<(src_loc)/info/profile/info_profile_button.cpp
|
<(src_loc)/info/profile/info_profile_button.cpp
|
||||||
<(src_loc)/info/profile/info_profile_button.h
|
<(src_loc)/info/profile/info_profile_button.h
|
||||||
<(src_loc)/info/profile/info_profile_cover.cpp
|
<(src_loc)/info/profile/info_profile_cover.cpp
|
||||||
|
@ -499,6 +501,8 @@
|
||||||
<(src_loc)/storage/storage_user_photos.h
|
<(src_loc)/storage/storage_user_photos.h
|
||||||
<(src_loc)/ui/effects/cross_animation.cpp
|
<(src_loc)/ui/effects/cross_animation.cpp
|
||||||
<(src_loc)/ui/effects/cross_animation.h
|
<(src_loc)/ui/effects/cross_animation.h
|
||||||
|
<(src_loc)/ui/effects/fade_animation.cpp
|
||||||
|
<(src_loc)/ui/effects/fade_animation.h
|
||||||
<(src_loc)/ui/effects/panel_animation.cpp
|
<(src_loc)/ui/effects/panel_animation.cpp
|
||||||
<(src_loc)/ui/effects/panel_animation.h
|
<(src_loc)/ui/effects/panel_animation.h
|
||||||
<(src_loc)/ui/effects/radial_animation.cpp
|
<(src_loc)/ui/effects/radial_animation.cpp
|
||||||
|
@ -511,8 +515,6 @@
|
||||||
<(src_loc)/ui/effects/send_action_animations.h
|
<(src_loc)/ui/effects/send_action_animations.h
|
||||||
<(src_loc)/ui/effects/slide_animation.cpp
|
<(src_loc)/ui/effects/slide_animation.cpp
|
||||||
<(src_loc)/ui/effects/slide_animation.h
|
<(src_loc)/ui/effects/slide_animation.h
|
||||||
<(src_loc)/ui/effects/widget_fade_wrap.cpp
|
|
||||||
<(src_loc)/ui/effects/widget_fade_wrap.h
|
|
||||||
<(src_loc)/ui/style/style_core.cpp
|
<(src_loc)/ui/style/style_core.cpp
|
||||||
<(src_loc)/ui/style/style_core.h
|
<(src_loc)/ui/style/style_core.h
|
||||||
<(src_loc)/ui/style/style_core_color.cpp
|
<(src_loc)/ui/style/style_core_color.cpp
|
||||||
|
@ -563,6 +565,8 @@
|
||||||
<(src_loc)/ui/widgets/shadow.h
|
<(src_loc)/ui/widgets/shadow.h
|
||||||
<(src_loc)/ui/widgets/tooltip.cpp
|
<(src_loc)/ui/widgets/tooltip.cpp
|
||||||
<(src_loc)/ui/widgets/tooltip.h
|
<(src_loc)/ui/widgets/tooltip.h
|
||||||
|
<(src_loc)/ui/wrap/fade_wrap.cpp
|
||||||
|
<(src_loc)/ui/wrap/fade_wrap.h
|
||||||
<(src_loc)/ui/wrap/padding_wrap.cpp
|
<(src_loc)/ui/wrap/padding_wrap.cpp
|
||||||
<(src_loc)/ui/wrap/padding_wrap.h
|
<(src_loc)/ui/wrap/padding_wrap.h
|
||||||
<(src_loc)/ui/wrap/slide_wrap.cpp
|
<(src_loc)/ui/wrap/slide_wrap.cpp
|
||||||
|
@ -586,8 +590,8 @@
|
||||||
<(src_loc)/ui/special_buttons.h
|
<(src_loc)/ui/special_buttons.h
|
||||||
<(src_loc)/ui/twidget.cpp
|
<(src_loc)/ui/twidget.cpp
|
||||||
<(src_loc)/ui/twidget.h
|
<(src_loc)/ui/twidget.h
|
||||||
<(src_loc)/window/window_controller.cpp
|
<(src_loc)/window/layer_widget.cpp
|
||||||
<(src_loc)/window/window_controller.h
|
<(src_loc)/window/layer_widget.h
|
||||||
<(src_loc)/window/main_window.cpp
|
<(src_loc)/window/main_window.cpp
|
||||||
<(src_loc)/window/main_window.h
|
<(src_loc)/window/main_window.h
|
||||||
<(src_loc)/window/notifications_manager.cpp
|
<(src_loc)/window/notifications_manager.cpp
|
||||||
|
@ -603,6 +607,8 @@
|
||||||
<(src_loc)/window/section_widget.h
|
<(src_loc)/window/section_widget.h
|
||||||
<(src_loc)/window/top_bar_widget.cpp
|
<(src_loc)/window/top_bar_widget.cpp
|
||||||
<(src_loc)/window/top_bar_widget.h
|
<(src_loc)/window/top_bar_widget.h
|
||||||
|
<(src_loc)/window/window_controller.cpp
|
||||||
|
<(src_loc)/window/window_controller.h
|
||||||
<(src_loc)/window/window_main_menu.cpp
|
<(src_loc)/window/window_main_menu.cpp
|
||||||
<(src_loc)/window/window_main_menu.h
|
<(src_loc)/window/window_main_menu.h
|
||||||
<(src_loc)/window/window_slide_animation.cpp
|
<(src_loc)/window/window_slide_animation.cpp
|
||||||
|
@ -632,8 +638,6 @@
|
||||||
<(src_loc)/countries.h
|
<(src_loc)/countries.h
|
||||||
<(src_loc)/facades.cpp
|
<(src_loc)/facades.cpp
|
||||||
<(src_loc)/facades.h
|
<(src_loc)/facades.h
|
||||||
<(src_loc)/layerwidget.cpp
|
|
||||||
<(src_loc)/layerwidget.h
|
|
||||||
<(src_loc)/layout.cpp
|
<(src_loc)/layout.cpp
|
||||||
<(src_loc)/layout.h
|
<(src_loc)/layout.h
|
||||||
<(src_loc)/logs.cpp
|
<(src_loc)/logs.cpp
|
||||||
|
|
Loading…
Add table
Reference in a new issue