mirror of https://github.com/procxx/kepka.git
Improve layer / section exchange for Info.
This commit is contained in:
parent
b7077eb71d
commit
f4d9618487
|
@ -32,6 +32,8 @@ public:
|
||||||
TabbedMemento(
|
TabbedMemento(
|
||||||
object_ptr<TabbedSelector> selector,
|
object_ptr<TabbedSelector> selector,
|
||||||
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod);
|
base::lambda<void(object_ptr<TabbedSelector>)> returnMethod);
|
||||||
|
TabbedMemento(TabbedMemento &&other) = default;
|
||||||
|
TabbedMemento &operator=(TabbedMemento &&other) = default;
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> createWidget(
|
object_ptr<Window::SectionWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
|
|
@ -269,5 +269,5 @@ void BotCommandClickHandler::onClick(Qt::MouseButton button) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWithEntities BotCommandClickHandler::getExpandedLinkTextWithEntities(ExpandLinksMode mode, int entityOffset, const QStringRef &textPart) const {
|
TextWithEntities BotCommandClickHandler::getExpandedLinkTextWithEntities(ExpandLinksMode mode, int entityOffset, const QStringRef &textPart) const {
|
||||||
return simpleTextWithEntity({ EntityInTextHashtag, entityOffset, textPart.size() });
|
return simpleTextWithEntity({ EntityInTextBotCommand, entityOffset, textPart.size() });
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,9 +202,12 @@ void logOutDelayed() {
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
void showBox(object_ptr<BoxContent> content, LayerOptions options) {
|
void showBox(
|
||||||
|
object_ptr<BoxContent> content,
|
||||||
|
LayerOptions options,
|
||||||
|
anim::type animated) {
|
||||||
if (auto w = App::wnd()) {
|
if (auto w = App::wnd()) {
|
||||||
w->ui_showBox(std::move(content), options);
|
w->ui_showBox(std::move(content), options, animated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,19 +231,18 @@ void hideMediaPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideLayer(bool fast) {
|
void hideLayer(anim::type animated) {
|
||||||
if (auto w = App::wnd()) {
|
if (auto w = App::wnd()) {
|
||||||
w->ui_showBox(
|
w->ui_showBox(
|
||||||
{ nullptr },
|
{ nullptr },
|
||||||
LayerOption::CloseOther | (fast ? LayerOption::ForceFast : LayerOption::Animated));
|
LayerOption::CloseOther,
|
||||||
|
animated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideSettingsAndLayer(bool fast) {
|
void hideSettingsAndLayer(anim::type animated) {
|
||||||
if (auto w = App::wnd()) {
|
if (auto w = App::wnd()) {
|
||||||
w->ui_hideSettingsAndLayer(fast
|
w->ui_hideSettingsAndLayer(animated);
|
||||||
? LayerOption::ForceFast
|
|
||||||
: LayerOption::Animated);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,14 +259,23 @@ void repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
|
|
||||||
void autoplayMediaInlineAsync(const FullMsgId &msgId) {
|
void autoplayMediaInlineAsync(const FullMsgId &msgId) {
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
QMetaObject::invokeMethod(main, "ui_autoplayMediaInlineAsync", Qt::QueuedConnection, Q_ARG(qint32, msgId.channel), Q_ARG(qint32, msgId.msg));
|
InvokeQueued(main, [msgId] {
|
||||||
|
if (auto item = App::histItemById(msgId)) {
|
||||||
|
if (auto media = item->getMedia()) {
|
||||||
|
media->playInline(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showPeerProfile(const PeerId &peer) {
|
void showPeerProfile(const PeerId &peer) {
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
// main->showSection(Profile::SectionMemento(App::peer(peer)));
|
// main->showSection(Profile::SectionMemento(App::peer(peer)));
|
||||||
main->showSection(Info::Memento(peer), anim::type::normal);
|
main->showSection(
|
||||||
|
Info::Memento(peer),
|
||||||
|
anim::type::normal,
|
||||||
|
anim::activation::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,14 +285,22 @@ void showPeerOverview(const PeerId &peer, MediaOverviewType type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way) {
|
void showPeerHistory(
|
||||||
if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, way);
|
const PeerId &peer,
|
||||||
|
MsgId msgId,
|
||||||
|
ShowWay way,
|
||||||
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
|
if (MainWidget *m = App::main()) {
|
||||||
|
m->ui_showPeerHistory(peer, msgId, way, animated, activation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) {
|
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) {
|
||||||
if (MainWidget *m = App::main()) {
|
if (MainWidget *m = App::main()) {
|
||||||
qRegisterMetaType<Ui::ShowWay>();
|
InvokeQueued(m, [peer, msgId, way] {
|
||||||
QMetaObject::invokeMethod(m, "ui_showPeerHistoryAsync", Qt::QueuedConnection, Q_ARG(quint64, peer), Q_ARG(qint32, msgId), Q_ARG(Ui::ShowWay, way));
|
showPeerHistory(peer, msgId, way);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,6 @@ enum class LayerOption {
|
||||||
CloseOther = (1 << 0),
|
CloseOther = (1 << 0),
|
||||||
KeepOther = (1 << 1),
|
KeepOther = (1 << 1),
|
||||||
ShowAfterOther = (1 << 2),
|
ShowAfterOther = (1 << 2),
|
||||||
|
|
||||||
Animated = (1 << 3),
|
|
||||||
ForceFast = (1 << 4),
|
|
||||||
};
|
};
|
||||||
using LayerOptions = base::flags<LayerOption>;
|
using LayerOptions = base::flags<LayerOption>;
|
||||||
inline constexpr auto is_flag_type(LayerOption) { return true; };
|
inline constexpr auto is_flag_type(LayerOption) { return true; };
|
||||||
|
@ -97,7 +94,10 @@ inline constexpr auto is_flag_type(LayerOption) { return true; };
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
void showBox(object_ptr<BoxContent> content, LayerOptions options);
|
void showBox(
|
||||||
|
object_ptr<BoxContent> content,
|
||||||
|
LayerOptions options,
|
||||||
|
anim::type animated);
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
|
@ -108,14 +108,15 @@ void hideMediaPreview();
|
||||||
template <typename BoxType>
|
template <typename BoxType>
|
||||||
QPointer<BoxType> show(
|
QPointer<BoxType> show(
|
||||||
object_ptr<BoxType> content,
|
object_ptr<BoxType> content,
|
||||||
LayerOptions options = LayerOption::CloseOther) {
|
LayerOptions options = LayerOption::CloseOther,
|
||||||
|
anim::type animated = anim::type::normal) {
|
||||||
auto result = QPointer<BoxType>(content.data());
|
auto result = QPointer<BoxType>(content.data());
|
||||||
internal::showBox(std::move(content), options);
|
internal::showBox(std::move(content), options, animated);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideLayer(bool fast = false);
|
void hideLayer(anim::type animated = anim::type::normal);
|
||||||
void hideSettingsAndLayer(bool fast = false);
|
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
|
||||||
bool isLayerShown();
|
bool isLayerShown();
|
||||||
|
|
||||||
void repaintHistoryItem(not_null<const HistoryItem*> item);
|
void repaintHistoryItem(not_null<const HistoryItem*> item);
|
||||||
|
@ -142,14 +143,28 @@ enum class ShowWay {
|
||||||
Forward,
|
Forward,
|
||||||
Backward,
|
Backward,
|
||||||
};
|
};
|
||||||
void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
|
void showPeerHistory(
|
||||||
inline void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack) {
|
const PeerId &peer,
|
||||||
|
MsgId msgId,
|
||||||
|
ShowWay way = ShowWay::ClearStack,
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
|
|
||||||
|
inline void showPeerHistory(
|
||||||
|
const PeerData *peer,
|
||||||
|
MsgId msgId,
|
||||||
|
ShowWay way = ShowWay::ClearStack) {
|
||||||
showPeerHistory(peer->id, msgId, way);
|
showPeerHistory(peer->id, msgId, way);
|
||||||
}
|
}
|
||||||
inline void showPeerHistory(const History *history, MsgId msgId, ShowWay way = ShowWay::ClearStack) {
|
inline void showPeerHistory(
|
||||||
|
const History *history,
|
||||||
|
MsgId msgId,
|
||||||
|
ShowWay way = ShowWay::ClearStack) {
|
||||||
showPeerHistory(history->peer->id, msgId, way);
|
showPeerHistory(history->peer->id, msgId, way);
|
||||||
}
|
}
|
||||||
inline void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack) {
|
inline void showPeerHistoryAtItem(
|
||||||
|
const HistoryItem *item,
|
||||||
|
ShowWay way = ShowWay::ClearStack) {
|
||||||
showPeerHistory(item->history()->peer->id, item->id, way);
|
showPeerHistory(item->history()->peer->id, item->id, way);
|
||||||
}
|
}
|
||||||
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
|
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
|
||||||
|
|
|
@ -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 "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -41,7 +42,10 @@ namespace AdminLog {
|
||||||
|
|
||||||
class FixedBar final : public TWidget, private base::Subscriber {
|
class FixedBar final : public TWidget, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
FixedBar(QWidget *parent, not_null<ChannelData*> channel);
|
FixedBar(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
not_null<ChannelData*> channel);
|
||||||
|
|
||||||
base::Observable<void> showFilterSignal;
|
base::Observable<void> showFilterSignal;
|
||||||
base::Observable<void> searchCancelledSignal;
|
base::Observable<void> searchCancelledSignal;
|
||||||
|
@ -74,6 +78,7 @@ private:
|
||||||
void applySearch();
|
void applySearch();
|
||||||
void searchAnimationCallback();
|
void searchAnimationCallback();
|
||||||
|
|
||||||
|
not_null<Window::Controller*> _controller;
|
||||||
not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
object_ptr<Ui::FlatInput> _field;
|
object_ptr<Ui::FlatInput> _field;
|
||||||
object_ptr<Profile::BackButton> _backButton;
|
object_ptr<Profile::BackButton> _backButton;
|
||||||
|
@ -101,7 +106,11 @@ object_ptr<Window::SectionWidget> SectionMemento::createWidget(
|
||||||
return std::move(result);
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedBar::FixedBar(QWidget *parent, not_null<ChannelData*> channel) : TWidget(parent)
|
FixedBar::FixedBar(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::Controller*> controller,
|
||||||
|
not_null<ChannelData*> channel) : TWidget(parent)
|
||||||
|
, _controller(controller)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _field(this, st::historyAdminLogSearchField, langFactory(lng_dlg_filter))
|
, _field(this, st::historyAdminLogSearchField, langFactory(lng_dlg_filter))
|
||||||
, _backButton(this, lang(lng_admin_log_title_all))
|
, _backButton(this, lang(lng_admin_log_title_all))
|
||||||
|
@ -128,7 +137,7 @@ void FixedBar::applyFilter(const FilterValue &value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedBar::goBack() {
|
void FixedBar::goBack() {
|
||||||
App::main()->showBackFromStack();
|
_controller->showBackFromStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedBar::showSearch() {
|
void FixedBar::showSearch() {
|
||||||
|
@ -241,7 +250,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, channel)
|
, _fixedBar(this, controller, channel)
|
||||||
, _fixedBarShadow(this, st::shadowFg)
|
, _fixedBarShadow(this, st::shadowFg)
|
||||||
, _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);
|
||||||
|
|
|
@ -706,7 +706,7 @@ HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> cont
|
||||||
if (update.flags & UpdateFlag::RestrictionReasonChanged) {
|
if (update.flags & UpdateFlag::RestrictionReasonChanged) {
|
||||||
auto restriction = _peer->restrictionReason();
|
auto restriction = _peer->restrictionReason();
|
||||||
if (!restriction.isEmpty()) {
|
if (!restriction.isEmpty()) {
|
||||||
App::main()->showBackFromStack();
|
this->controller()->showBackFromStack();
|
||||||
Ui::show(Box<InformBox>(restriction));
|
Ui::show(Box<InformBox>(restriction));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2217,7 +2217,7 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId
|
||||||
|
|
||||||
if (error.type() == qstr("CHANNEL_PRIVATE") || error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA") || error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
if (error.type() == qstr("CHANNEL_PRIVATE") || error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA") || error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||||
auto was = _peer;
|
auto was = _peer;
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
Ui::show(Box<InformBox>(lang((was && was->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible)));
|
Ui::show(Box<InformBox>(lang((was && was->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2229,7 +2229,7 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId
|
||||||
_preloadDownRequest = 0;
|
_preloadDownRequest = 0;
|
||||||
} else if (_firstLoadRequest == requestId) {
|
} else if (_firstLoadRequest == requestId) {
|
||||||
_firstLoadRequest = 0;
|
_firstLoadRequest = 0;
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
} else if (_delayedShowAtRequest == requestId) {
|
} else if (_delayedShowAtRequest == requestId) {
|
||||||
_delayedShowAtRequest = 0;
|
_delayedShowAtRequest = 0;
|
||||||
}
|
}
|
||||||
|
@ -3751,7 +3751,7 @@ void HistoryWidget::onModerateKeyActivate(int index, bool *outHandled) {
|
||||||
|
|
||||||
void HistoryWidget::topBarClick() {
|
void HistoryWidget::topBarClick() {
|
||||||
if (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) {
|
if (Adaptive::OneColumn() || !App::main()->stackIsEmpty()) {
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
} else if (_peer) {
|
} else if (_peer) {
|
||||||
controller()->showPeerInfo(_peer);
|
controller()->showPeerInfo(_peer);
|
||||||
}
|
}
|
||||||
|
@ -3772,19 +3772,26 @@ void HistoryWidget::pushTabbedSelectorToThirdSection() {
|
||||||
&st::historyRecordVoiceRippleBgActive);
|
&st::historyRecordVoiceRippleBgActive);
|
||||||
auto destroyingPanel = std::move(_tabbedPanel);
|
auto destroyingPanel = std::move(_tabbedPanel);
|
||||||
controller()->resizeForThirdSection();
|
controller()->resizeForThirdSection();
|
||||||
controller()->showSection(ChatHelpers::TabbedMemento(
|
auto memento = ChatHelpers::TabbedMemento(
|
||||||
destroyingPanel->takeSelector(),
|
destroyingPanel->takeSelector(),
|
||||||
base::lambda_guarded(this, [this](
|
base::lambda_guarded(this, [this](
|
||||||
object_ptr<TabbedSelector> selector) {
|
object_ptr<TabbedSelector> selector) {
|
||||||
returnTabbedSelector(std::move(selector));
|
returnTabbedSelector(std::move(selector));
|
||||||
})));
|
}));
|
||||||
|
controller()->showSection(
|
||||||
|
std::move(memento),
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::pushInfoToThirdSection() {
|
void HistoryWidget::pushInfoToThirdSection() {
|
||||||
if (!_peer) {
|
if (!_peer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
controller()->showPeerInfo(_peer);
|
controller()->showPeerInfo(
|
||||||
|
_peer,
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::toggleTabbedSelectorMode() {
|
void HistoryWidget::toggleTabbedSelectorMode() {
|
||||||
|
@ -4527,7 +4534,7 @@ void HistoryWidget::onReportSpamClear() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Invalidates _peer.
|
// Invalidates _peer.
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::peerMessagesUpdated(PeerId peer) {
|
void HistoryWidget::peerMessagesUpdated(PeerId peer) {
|
||||||
|
@ -5092,7 +5099,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
} else if (e->key() == Qt::Key_Back) {
|
} else if (e->key() == Qt::Key_Back) {
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
emit cancelled();
|
emit cancelled();
|
||||||
} else if (e->key() == Qt::Key_PageDown) {
|
} else if (e->key() == Qt::Key_PageDown) {
|
||||||
_scroll->keyPressEvent(e);
|
_scroll->keyPressEvent(e);
|
||||||
|
@ -5894,7 +5901,7 @@ void HistoryWidget::onCancel() {
|
||||||
} else if (!_fieldAutocomplete->isHidden()) {
|
} else if (!_fieldAutocomplete->isHidden()) {
|
||||||
_fieldAutocomplete->hideAnimated();
|
_fieldAutocomplete->hideAnimated();
|
||||||
} else {
|
} else {
|
||||||
App::main()->showBackFromStack();
|
controller()->showBackFromStack();
|
||||||
emit cancelled();
|
emit cancelled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,8 +108,11 @@ void LayerWrap::parentResized() {
|
||||||
if (parentWidth < MinimalSupportedWidth()) {
|
if (parentWidth < MinimalSupportedWidth()) {
|
||||||
auto localCopy = _controller;
|
auto localCopy = _controller;
|
||||||
auto memento = MoveMemento(std::move(_content), Wrap::Narrow);
|
auto memento = MoveMemento(std::move(_content), Wrap::Narrow);
|
||||||
localCopy->hideSpecialLayer(LayerOption::ForceFast);
|
localCopy->hideSpecialLayer(anim::type::instant);
|
||||||
localCopy->showSection(std::move(memento));
|
localCopy->showSection(
|
||||||
|
std::move(memento),
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
} else if (_controller->canShowThirdSectionWithoutResize()) {
|
} else if (_controller->canShowThirdSectionWithoutResize()) {
|
||||||
takeToThirdSection();
|
takeToThirdSection();
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,11 +126,14 @@ void LayerWrap::parentResized() {
|
||||||
bool LayerWrap::takeToThirdSection() {
|
bool LayerWrap::takeToThirdSection() {
|
||||||
auto localCopy = _controller;
|
auto localCopy = _controller;
|
||||||
auto memento = MoveMemento(std::move(_content), Wrap::Side);
|
auto memento = MoveMemento(std::move(_content), Wrap::Side);
|
||||||
localCopy->hideSpecialLayer(LayerOption::ForceFast);
|
localCopy->hideSpecialLayer(anim::type::instant);
|
||||||
|
|
||||||
Auth().data().setThirdSectionInfoEnabled(true);
|
Auth().data().setThirdSectionInfoEnabled(true);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
||||||
localCopy->showSection(std::move(memento));
|
localCopy->showSection(
|
||||||
|
std::move(memento),
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include <rpl/combine.h>
|
#include <rpl/combine.h>
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "boxes/add_contact_box.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "info/info_profile_widget.h"
|
#include "info/info_profile_widget.h"
|
||||||
#include "info/info_profile_lines.h"
|
#include "info/info_profile_lines.h"
|
||||||
|
@ -143,7 +144,12 @@ void InnerWidget::setupMainUserButtons(
|
||||||
addContact->finishAnimations();
|
addContact->finishAnimations();
|
||||||
addContact->entity()->clicks()
|
addContact->entity()->clicks()
|
||||||
| rpl::start([user](auto&&) {
|
| rpl::start([user](auto&&) {
|
||||||
App::main()->shareContactLayer(user);
|
auto firstName = user->firstName;
|
||||||
|
auto lastName = user->lastName;
|
||||||
|
auto phone = user->phone().isEmpty()
|
||||||
|
? App::phoneFromSharedContact(user->bareId())
|
||||||
|
: user->phone();
|
||||||
|
Ui::show(Box<AddContactBox>(firstName, lastName, phone));
|
||||||
}, addContact->lifetime());
|
}, addContact->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,17 +113,21 @@ void LayerStackWidget::BackgroundWidget::setCacheImages(QPixmap &&bodyCache, QPi
|
||||||
void LayerStackWidget::BackgroundWidget::startAnimation(Action action) {
|
void LayerStackWidget::BackgroundWidget::startAnimation(Action action) {
|
||||||
if (action == Action::ShowMainMenu) {
|
if (action == Action::ShowMainMenu) {
|
||||||
setMainMenuShown(true);
|
setMainMenuShown(true);
|
||||||
} else if (action != Action::HideLayer) {
|
} else if (action != Action::HideLayer
|
||||||
|
&& action != Action::HideSpecialLayer) {
|
||||||
setMainMenuShown(false);
|
setMainMenuShown(false);
|
||||||
}
|
}
|
||||||
if (action == Action::ShowSpecialLayer) {
|
if (action == Action::ShowSpecialLayer) {
|
||||||
setSpecialLayerShown(true);
|
setSpecialLayerShown(true);
|
||||||
} else if (action == Action::ShowMainMenu || action == Action::HideAll) {
|
} else if (action == Action::ShowMainMenu
|
||||||
|
|| action == Action::HideAll
|
||||||
|
|| action == Action::HideSpecialLayer) {
|
||||||
setSpecialLayerShown(false);
|
setSpecialLayerShown(false);
|
||||||
}
|
}
|
||||||
if (action == Action::ShowLayer) {
|
if (action == Action::ShowLayer) {
|
||||||
setLayerShown(true);
|
setLayerShown(true);
|
||||||
} else {
|
} else if (action != Action::ShowSpecialLayer
|
||||||
|
&& action != Action::HideSpecialLayer) {
|
||||||
setLayerShown(false);
|
setLayerShown(false);
|
||||||
}
|
}
|
||||||
_wasAnimating = true;
|
_wasAnimating = true;
|
||||||
|
@ -352,37 +356,37 @@ bool LayerWidget::overlaps(const QRect &globalRect) {
|
||||||
|
|
||||||
void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
|
void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
hideCurrent(LayerOption::Animated);
|
hideCurrent(anim::type::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
|
void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
|
||||||
hideCurrent(LayerOption::Animated);
|
hideCurrent(anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::hideCurrent(LayerOptions options) {
|
void LayerStackWidget::hideCurrent(anim::type animated) {
|
||||||
return currentLayer() ? hideLayers(options) : hideAll(options);
|
return currentLayer() ? hideLayers(animated) : hideAll(animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::hideLayers(LayerOptions options) {
|
void LayerStackWidget::hideLayers(anim::type animated) {
|
||||||
startAnimation([] {}, [this] {
|
startAnimation([] {}, [this] {
|
||||||
clearLayers();
|
clearLayers();
|
||||||
}, Action::HideLayer, options);
|
}, Action::HideLayer, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::hideAll(LayerOptions options) {
|
void LayerStackWidget::hideAll(anim::type animated) {
|
||||||
startAnimation([] {}, [this] {
|
startAnimation([] {}, [this] {
|
||||||
clearLayers();
|
clearLayers();
|
||||||
clearSpecialLayer();
|
clearSpecialLayer();
|
||||||
_mainMenu.destroyDelayed();
|
_mainMenu.destroyDelayed();
|
||||||
}, Action::HideAll, options);
|
}, Action::HideAll, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::hideTopLayer(LayerOptions options) {
|
void LayerStackWidget::hideTopLayer(anim::type animated) {
|
||||||
if (_specialLayer) {
|
if (_specialLayer) {
|
||||||
hideLayers(options);
|
hideLayers(animated);
|
||||||
} else {
|
} else {
|
||||||
hideAll(options);
|
hideAll(animated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,10 +434,10 @@ void LayerStackWidget::onLayerClosed(LayerWidget *layer) {
|
||||||
}
|
}
|
||||||
layer->deleteLater();
|
layer->deleteLater();
|
||||||
if (layer == _specialLayer) {
|
if (layer == _specialLayer) {
|
||||||
hideAll(LayerOption::Animated);
|
hideAll(anim::type::normal);
|
||||||
} else if (layer == currentLayer()) {
|
} else if (layer == currentLayer()) {
|
||||||
if (_layers.size() == 1) {
|
if (_layers.size() == 1) {
|
||||||
hideCurrent(LayerOption::Animated);
|
hideCurrent(anim::type::normal);
|
||||||
} else {
|
} else {
|
||||||
if (layer->inFocusChain()) setFocus();
|
if (layer->inFocusChain()) setFocus();
|
||||||
layer->hide();
|
layer->hide();
|
||||||
|
@ -511,10 +515,10 @@ void LayerStackWidget::startAnimation(
|
||||||
SetupNew setupNewWidgets,
|
SetupNew setupNewWidgets,
|
||||||
ClearOld clearOldWidgets,
|
ClearOld clearOldWidgets,
|
||||||
Action action,
|
Action action,
|
||||||
LayerOptions options) {
|
anim::type animated) {
|
||||||
if (App::quitting()) return;
|
if (App::quitting()) return;
|
||||||
|
|
||||||
if (options & LayerOption::ForceFast) {
|
if (animated == anim::type::instant) {
|
||||||
setupNewWidgets();
|
setupNewWidgets();
|
||||||
clearOldWidgets();
|
clearOldWidgets();
|
||||||
prepareForAnimation();
|
prepareForAnimation();
|
||||||
|
@ -542,8 +546,10 @@ void LayerStackWidget::resizeEvent(QResizeEvent *e) {
|
||||||
updateLayerBoxes();
|
updateLayerBoxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showBox(object_ptr<BoxContent> box) {
|
void LayerStackWidget::showBox(
|
||||||
auto pointer = pushBox(std::move(box));
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated) {
|
||||||
|
auto pointer = pushBox(std::move(box), animated);
|
||||||
while (!_layers.isEmpty() && _layers.front() != pointer) {
|
while (!_layers.isEmpty() && _layers.front() != pointer) {
|
||||||
auto removingLayer = _layers.front();
|
auto removingLayer = _layers.front();
|
||||||
_layers.pop_front();
|
_layers.pop_front();
|
||||||
|
@ -610,18 +616,26 @@ void LayerStackWidget::showFinished() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showSpecialLayer(object_ptr<LayerWidget> layer) {
|
void LayerStackWidget::showSpecialLayer(
|
||||||
|
object_ptr<LayerWidget> layer,
|
||||||
|
anim::type animated) {
|
||||||
startAnimation([this, layer = std::move(layer)]() mutable {
|
startAnimation([this, layer = std::move(layer)]() mutable {
|
||||||
_specialLayer.destroyDelayed();
|
_specialLayer.destroyDelayed();
|
||||||
_specialLayer = std::move(layer);
|
_specialLayer = std::move(layer);
|
||||||
initChildLayer(_specialLayer);
|
initChildLayer(_specialLayer);
|
||||||
}, [this] {
|
}, [this] {
|
||||||
clearLayers();
|
|
||||||
_mainMenu.destroyDelayed();
|
_mainMenu.destroyDelayed();
|
||||||
}, Action::ShowSpecialLayer, LayerOption::Animated);
|
}, Action::ShowSpecialLayer, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::showMainMenu() {
|
void LayerStackWidget::hideSpecialLayer(anim::type animated) {
|
||||||
|
startAnimation([] {}, [this] {
|
||||||
|
clearSpecialLayer();
|
||||||
|
_mainMenu.destroyDelayed();
|
||||||
|
}, Action::HideSpecialLayer, animated);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::showMainMenu(anim::type animated) {
|
||||||
startAnimation([this] {
|
startAnimation([this] {
|
||||||
_mainMenu.create(this);
|
_mainMenu.create(this);
|
||||||
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
_mainMenu->setGeometryToLeft(0, 0, _mainMenu->width(), height());
|
||||||
|
@ -629,20 +643,27 @@ void LayerStackWidget::showMainMenu() {
|
||||||
}, [this] {
|
}, [this] {
|
||||||
clearLayers();
|
clearLayers();
|
||||||
_specialLayer.destroyDelayed();
|
_specialLayer.destroyDelayed();
|
||||||
}, Action::ShowMainMenu, LayerOption::Animated);
|
}, Action::ShowMainMenu, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::appendBox(object_ptr<BoxContent> box) {
|
void LayerStackWidget::appendBox(
|
||||||
pushBox(std::move(box));
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated) {
|
||||||
|
pushBox(std::move(box), animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerWidget *LayerStackWidget::pushBox(object_ptr<BoxContent> box) {
|
LayerWidget *LayerStackWidget::pushBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated) {
|
||||||
auto oldLayer = currentLayer();
|
auto oldLayer = currentLayer();
|
||||||
if (oldLayer) {
|
if (oldLayer) {
|
||||||
if (oldLayer->inFocusChain()) setFocus();
|
if (oldLayer->inFocusChain()) setFocus();
|
||||||
oldLayer->hide();
|
oldLayer->hide();
|
||||||
}
|
}
|
||||||
auto layer = object_ptr<AbstractBox>(this, _controller, std::move(box));
|
auto layer = object_ptr<AbstractBox>(
|
||||||
|
this,
|
||||||
|
_controller,
|
||||||
|
std::move(box));
|
||||||
_layers.push_back(layer);
|
_layers.push_back(layer);
|
||||||
initChildLayer(layer);
|
initChildLayer(layer);
|
||||||
|
|
||||||
|
@ -654,15 +675,17 @@ LayerWidget *LayerStackWidget::pushBox(object_ptr<BoxContent> box) {
|
||||||
} else {
|
} else {
|
||||||
startAnimation([] {}, [this] {
|
startAnimation([] {}, [this] {
|
||||||
_mainMenu.destroyDelayed();
|
_mainMenu.destroyDelayed();
|
||||||
}, Action::ShowLayer, LayerOption::Animated);
|
}, Action::ShowLayer, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer.data();
|
return layer.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStackWidget::prependBox(object_ptr<BoxContent> box) {
|
void LayerStackWidget::prependBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated) {
|
||||||
if (_layers.empty()) {
|
if (_layers.empty()) {
|
||||||
return showBox(std::move(box));
|
return showBox(std::move(box), animated);
|
||||||
}
|
}
|
||||||
auto layer = object_ptr<AbstractBox>(this, _controller, std::move(box));
|
auto layer = object_ptr<AbstractBox>(this, _controller, std::move(box));
|
||||||
layer->hide();
|
layer->hide();
|
||||||
|
@ -720,7 +743,7 @@ void LayerStackWidget::sendFakeMouseEvent() {
|
||||||
void LayerStackWidget::onLayerDestroyed(QObject *obj) {
|
void LayerStackWidget::onLayerDestroyed(QObject *obj) {
|
||||||
if (obj == _specialLayer) {
|
if (obj == _specialLayer) {
|
||||||
_specialLayer = nullptr;
|
_specialLayer = nullptr;
|
||||||
hideAll(LayerOption::Animated);
|
hideAll(anim::type::normal);
|
||||||
} else if (obj == currentLayer()) {
|
} else if (obj == currentLayer()) {
|
||||||
_layers.pop_back();
|
_layers.pop_back();
|
||||||
if (auto newLayer = currentLayer()) {
|
if (auto newLayer = currentLayer()) {
|
||||||
|
@ -730,7 +753,7 @@ void LayerStackWidget::onLayerDestroyed(QObject *obj) {
|
||||||
showFinished();
|
showFinished();
|
||||||
}
|
}
|
||||||
} else if (!_specialLayer) {
|
} else if (!_specialLayer) {
|
||||||
hideAll(LayerOption::Animated);
|
hideAll(anim::type::normal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
||||||
|
|
|
@ -94,11 +94,19 @@ public:
|
||||||
}
|
}
|
||||||
void finishAnimation();
|
void finishAnimation();
|
||||||
|
|
||||||
void showBox(object_ptr<BoxContent> box);
|
void showBox(
|
||||||
void showSpecialLayer(object_ptr<LayerWidget> layer);
|
object_ptr<BoxContent> box,
|
||||||
void showMainMenu();
|
anim::type animated);
|
||||||
void appendBox(object_ptr<BoxContent> box);
|
void showSpecialLayer(
|
||||||
void prependBox(object_ptr<BoxContent> box);
|
object_ptr<LayerWidget> layer,
|
||||||
|
anim::type animated);
|
||||||
|
void showMainMenu(anim::type animated);
|
||||||
|
void appendBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
|
void prependBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
bool takeToThirdSection();
|
bool takeToThirdSection();
|
||||||
|
|
||||||
bool canSetFocus() const;
|
bool canSetFocus() const;
|
||||||
|
@ -106,9 +114,10 @@ public:
|
||||||
|
|
||||||
bool contentOverlapped(const QRect &globalRect);
|
bool contentOverlapped(const QRect &globalRect);
|
||||||
|
|
||||||
void hideLayers(LayerOptions options);
|
void hideSpecialLayer(anim::type animated);
|
||||||
void hideAll(LayerOptions options);
|
void hideLayers(anim::type animated);
|
||||||
void hideTopLayer(LayerOptions options);
|
void hideAll(anim::type animated);
|
||||||
|
void hideTopLayer(anim::type animated);
|
||||||
|
|
||||||
bool layerShown() const;
|
bool layerShown() const;
|
||||||
|
|
||||||
|
@ -125,14 +134,17 @@ private slots:
|
||||||
void onLayerResized();
|
void onLayerResized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LayerWidget *pushBox(object_ptr<BoxContent> box);
|
LayerWidget *pushBox(
|
||||||
|
object_ptr<BoxContent> box,
|
||||||
|
anim::type animated);
|
||||||
void showFinished();
|
void showFinished();
|
||||||
void hideCurrent(LayerOptions options);
|
void hideCurrent(anim::type animated);
|
||||||
|
|
||||||
enum class Action {
|
enum class Action {
|
||||||
ShowMainMenu,
|
ShowMainMenu,
|
||||||
ShowSpecialLayer,
|
ShowSpecialLayer,
|
||||||
ShowLayer,
|
ShowLayer,
|
||||||
|
HideSpecialLayer,
|
||||||
HideLayer,
|
HideLayer,
|
||||||
HideAll,
|
HideAll,
|
||||||
};
|
};
|
||||||
|
@ -141,7 +153,7 @@ private:
|
||||||
SetupNew setupNewWidgets,
|
SetupNew setupNewWidgets,
|
||||||
ClearOld clearOldWidgets,
|
ClearOld clearOldWidgets,
|
||||||
Action action,
|
Action action,
|
||||||
LayerOptions options);
|
anim::type animated);
|
||||||
|
|
||||||
void prepareForAnimation();
|
void prepareForAnimation();
|
||||||
void animationDone();
|
void animationDone();
|
||||||
|
|
|
@ -1577,7 +1577,6 @@ bool MainWidget::insertBotCommand(const QString &cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::searchMessages(const QString &query, PeerData *inPeer) {
|
void MainWidget::searchMessages(const QString &query, PeerData *inPeer) {
|
||||||
Messenger::Instance().hideMediaView();
|
|
||||||
_dialogs->searchMessages(query, inPeer);
|
_dialogs->searchMessages(query, inPeer);
|
||||||
if (Adaptive::OneColumn()) {
|
if (Adaptive::OneColumn()) {
|
||||||
Ui::showChatsList();
|
Ui::showChatsList();
|
||||||
|
@ -1743,18 +1742,6 @@ void MainWidget::messagesAffected(PeerData *peer, const MTPmessages_AffectedMess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::ui_showPeerHistoryAsync(quint64 peerId, qint32 showAtMsgId, Ui::ShowWay way) {
|
|
||||||
Ui::showPeerHistory(peerId, showAtMsgId, way);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWidget::ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId) {
|
|
||||||
if (HistoryItem *item = App::histItemById(channelId, msgId)) {
|
|
||||||
if (HistoryMedia *media = item->getMedia()) {
|
|
||||||
media->playInline(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWidget::handleAudioUpdate(const AudioMsgId &audioId) {
|
void MainWidget::handleAudioUpdate(const AudioMsgId &audioId) {
|
||||||
using State = Media::Player::State;
|
using State = Media::Player::State;
|
||||||
auto state = Media::Player::mixer()->currentState(audioId.type());
|
auto state = Media::Player::mixer()->currentState(audioId.type());
|
||||||
|
@ -2457,17 +2444,23 @@ void MainWidget::ctrlEnterSubmitUpdated() {
|
||||||
_history->updateFieldSubmitSettings();
|
_history->updateFieldSubmitSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::ShowWay way) {
|
void MainWidget::ui_showPeerHistory(
|
||||||
|
PeerId peerId,
|
||||||
|
MsgId showAtMsgId,
|
||||||
|
Ui::ShowWay way,
|
||||||
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
if (auto peer = App::peerLoaded(peerId)) {
|
if (auto peer = App::peerLoaded(peerId)) {
|
||||||
if (peer->migrateTo()) {
|
if (peer->migrateTo()) {
|
||||||
peer = peer->migrateTo();
|
peer = peer->migrateTo();
|
||||||
peerId = peer->id;
|
peerId = peer->id;
|
||||||
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
if (showAtMsgId > 0) showAtMsgId = -showAtMsgId;
|
||||||
}
|
}
|
||||||
QString restriction = peer->restrictionReason();
|
auto restriction = peer->restrictionReason();
|
||||||
if (!restriction.isEmpty()) {
|
if (!restriction.isEmpty()) {
|
||||||
Ui::showChatsList();
|
if (activation != anim::activation::background) {
|
||||||
Ui::show(Box<InformBox>(restriction));
|
Ui::show(Box<InformBox>(restriction));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2505,8 +2498,9 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
|
||||||
}
|
}
|
||||||
|
|
||||||
auto wasActivePeer = activePeer();
|
auto wasActivePeer = activePeer();
|
||||||
|
if (activation != anim::activation::background) {
|
||||||
Ui::hideSettingsAndLayer();
|
Ui::hideSettingsAndLayer();
|
||||||
|
}
|
||||||
if (_hider) {
|
if (_hider) {
|
||||||
_hider->startHide();
|
_hider->startHide();
|
||||||
_hider = nullptr;
|
_hider = nullptr;
|
||||||
|
@ -2695,7 +2689,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
|
||||||
if (_overview->type() != type) {
|
if (_overview->type() != type) {
|
||||||
_overview->switchType(type);
|
_overview->switchType(type);
|
||||||
} else if (type == OverviewMusicFiles) { // hack for player
|
} else if (type == OverviewMusicFiles) { // hack for player
|
||||||
showBackFromStack();
|
_controller->showBackFromStack();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2758,7 +2752,8 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
|
||||||
|
|
||||||
void MainWidget::showSection(
|
void MainWidget::showSection(
|
||||||
Window::SectionMemento &&memento,
|
Window::SectionMemento &&memento,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
if (_mainSection && _mainSection->showInternal(&memento)) {
|
if (_mainSection && _mainSection->showInternal(&memento)) {
|
||||||
return;
|
return;
|
||||||
} else if (_thirdSection && _thirdSection->showInternal(&memento)) {
|
} else if (_thirdSection && _thirdSection->showInternal(&memento)) {
|
||||||
|
@ -2770,7 +2765,12 @@ void MainWidget::showSection(
|
||||||
// we need to update adaptive layout to Adaptive::ThirdColumn().
|
// we need to update adaptive layout to Adaptive::ThirdColumn().
|
||||||
updateColumnLayout();
|
updateColumnLayout();
|
||||||
|
|
||||||
showNewSection(std::move(memento), false, true, animated);
|
showNewSection(
|
||||||
|
std::move(memento),
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::updateColumnLayout() {
|
void MainWidget::updateColumnLayout() {
|
||||||
|
@ -2902,7 +2902,8 @@ void MainWidget::showNewSection(
|
||||||
Window::SectionMemento &&memento,
|
Window::SectionMemento &&memento,
|
||||||
bool back,
|
bool back,
|
||||||
bool saveInStack,
|
bool saveInStack,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
using Column = Window::Column;
|
using Column = Window::Column;
|
||||||
|
|
||||||
auto thirdSectionTop = getThirdSectionTop();
|
auto thirdSectionTop = getThirdSectionTop();
|
||||||
|
@ -2927,6 +2928,10 @@ void MainWidget::showNewSection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activation != anim::activation::background) {
|
||||||
|
Ui::hideSettingsAndLayer();
|
||||||
|
}
|
||||||
|
|
||||||
QPixmap animCache;
|
QPixmap animCache;
|
||||||
|
|
||||||
_controller->dialogsListFocused().set(false, true);
|
_controller->dialogsListFocused().set(false, true);
|
||||||
|
@ -3026,7 +3031,7 @@ void MainWidget::checkMainSectionToLayer() {
|
||||||
dropMainSection(_mainSection);
|
dropMainSection(_mainSection);
|
||||||
_controller->showSpecialLayer(
|
_controller->showSpecialLayer(
|
||||||
std::move(layer),
|
std::move(layer),
|
||||||
LayerOption::ForceFast);
|
anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3035,7 +3040,9 @@ void MainWidget::dropMainSection(Window::SectionWidget *widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mainSection.destroy();
|
_mainSection.destroy();
|
||||||
showBackFromStack();
|
_controller->showBackFromStack(
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::isMainSectionShown() const {
|
bool MainWidget::isMainSectionShown() const {
|
||||||
|
@ -3050,10 +3057,12 @@ bool MainWidget::stackIsEmpty() const {
|
||||||
return _stack.empty();
|
return _stack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::showBackFromStack() {
|
void MainWidget::showBackFromStack(
|
||||||
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
if (selectingPeer()) return;
|
if (selectingPeer()) return;
|
||||||
if (_stack.empty()) {
|
if (_stack.empty()) {
|
||||||
Ui::showChatsList();
|
_controller->clearSectionStack(animated, activation);
|
||||||
if (App::wnd()) QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus()));
|
if (App::wnd()) QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3076,7 +3085,12 @@ void MainWidget::showBackFromStack() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto historyItem = static_cast<StackItemHistory*>(item.get());
|
auto historyItem = static_cast<StackItemHistory*>(item.get());
|
||||||
Ui::showPeerHistory(historyItem->peer->id, ShowAtUnreadMsgId, Ui::ShowWay::Backward);
|
_controller->showPeerHistory(
|
||||||
|
historyItem->peer->id,
|
||||||
|
Ui::ShowWay::Backward,
|
||||||
|
ShowAtUnreadMsgId,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
_history->setReplyReturns(historyItem->peer->id, historyItem->replyReturns);
|
_history->setReplyReturns(historyItem->peer->id, historyItem->replyReturns);
|
||||||
} else if (item->type() == SectionStackItem) {
|
} else if (item->type() == SectionStackItem) {
|
||||||
auto sectionItem = static_cast<StackItemSection*>(item.get());
|
auto sectionItem = static_cast<StackItemSection*>(item.get());
|
||||||
|
@ -3084,10 +3098,15 @@ void MainWidget::showBackFromStack() {
|
||||||
std::move(*sectionItem->memento()),
|
std::move(*sectionItem->memento()),
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
anim::type::normal);
|
animated,
|
||||||
|
activation);
|
||||||
} else if (item->type() == OverviewStackItem) {
|
} else if (item->type() == OverviewStackItem) {
|
||||||
auto overviewItem = static_cast<StackItemOverview*>(item.get());
|
auto overviewItem = static_cast<StackItemOverview*>(item.get());
|
||||||
showMediaOverview(overviewItem->peer, overviewItem->mediaType, true, overviewItem->lastScrollTop);
|
showMediaOverview(
|
||||||
|
overviewItem->peer,
|
||||||
|
overviewItem->mediaType,
|
||||||
|
true,
|
||||||
|
overviewItem->lastScrollTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3332,7 +3351,7 @@ void MainWidget::showAll() {
|
||||||
if (_hider) _hider->offerPeer(0);
|
if (_hider) _hider->offerPeer(0);
|
||||||
}), base::lambda_guarded(this, [this] {
|
}), base::lambda_guarded(this, [this] {
|
||||||
if (_hider && _forwardConfirm) _hider->offerPeer(0);
|
if (_hider && _forwardConfirm) _hider->offerPeer(0);
|
||||||
})), LayerOption::ForceFast);
|
})), LayerOption::CloseOther, anim::type::instant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selectingPeer()) {
|
if (selectingPeer()) {
|
||||||
|
@ -3364,7 +3383,7 @@ void MainWidget::showAll() {
|
||||||
_hider->show();
|
_hider->show();
|
||||||
if (_forwardConfirm) {
|
if (_forwardConfirm) {
|
||||||
_forwardConfirm = nullptr;
|
_forwardConfirm = nullptr;
|
||||||
Ui::hideLayer(true);
|
Ui::hideLayer(anim::type::instant);
|
||||||
if (_hider->wasOffered()) {
|
if (_hider->wasOffered()) {
|
||||||
_hider->setFocus();
|
_hider->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -3531,7 +3550,10 @@ void MainWidget::updateThirdColumnToCurrentPeer(PeerData *peer) {
|
||||||
&& Auth().data().tabbedSelectorSectionEnabled()
|
&& Auth().data().tabbedSelectorSectionEnabled()
|
||||||
&& peer) {
|
&& peer) {
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
_controller->showPeerInfo(peer);
|
_controller->showPeerInfo(
|
||||||
|
peer,
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
Auth().data().setTabbedSelectorSectionEnabled(true);
|
Auth().data().setTabbedSelectorSectionEnabled(true);
|
||||||
Auth().data().setTabbedReplacedWithInfo(true);
|
Auth().data().setTabbedReplacedWithInfo(true);
|
||||||
} else if (Auth().data().tabbedReplacedWithInfo()) {
|
} else if (Auth().data().tabbedReplacedWithInfo()) {
|
||||||
|
@ -3545,7 +3567,10 @@ void MainWidget::updateThirdColumnToCurrentPeer(PeerData *peer) {
|
||||||
_thirdShadow.destroy();
|
_thirdShadow.destroy();
|
||||||
} else if (Adaptive::ThreeColumn()
|
} else if (Adaptive::ThreeColumn()
|
||||||
&& Auth().data().thirdSectionInfoEnabled()) {
|
&& Auth().data().thirdSectionInfoEnabled()) {
|
||||||
_controller->showPeerInfo(peer, anim::type::instant);
|
_controller->showPeerInfo(
|
||||||
|
peer,
|
||||||
|
anim::type::instant,
|
||||||
|
anim::activation::background);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3616,7 +3641,7 @@ bool MainWidget::eventFilter(QObject *o, QEvent *e) {
|
||||||
}
|
}
|
||||||
} else if (e->type() == QEvent::MouseButtonPress) {
|
} else if (e->type() == QEvent::MouseButtonPress) {
|
||||||
if (static_cast<QMouseEvent*>(e)->button() == Qt::BackButton) {
|
if (static_cast<QMouseEvent*>(e)->button() == Qt::BackButton) {
|
||||||
showBackFromStack();
|
_controller->showBackFromStack();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (e->type() == QEvent::Wheel && !_playerFloats.empty()) {
|
} else if (e->type() == QEvent::Wheel && !_playerFloats.empty()) {
|
||||||
|
|
|
@ -215,11 +215,14 @@ public:
|
||||||
bool showMediaTypeSwitch() const;
|
bool showMediaTypeSwitch() const;
|
||||||
void showSection(
|
void showSection(
|
||||||
Window::SectionMemento &&memento,
|
Window::SectionMemento &&memento,
|
||||||
anim::type animated);
|
anim::type animated,
|
||||||
|
anim::activation activation);
|
||||||
void updateColumnLayout();
|
void updateColumnLayout();
|
||||||
void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1);
|
void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1);
|
||||||
bool stackIsEmpty() const;
|
bool stackIsEmpty() const;
|
||||||
void showBackFromStack();
|
void showBackFromStack(
|
||||||
|
anim::type animated,
|
||||||
|
anim::activation activation);
|
||||||
void orderWidgets();
|
void orderWidgets();
|
||||||
QRect historyRect() const;
|
QRect historyRect() const;
|
||||||
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms);
|
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms);
|
||||||
|
@ -391,7 +394,12 @@ public:
|
||||||
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
||||||
|
|
||||||
void ui_repaintHistoryItem(not_null<const HistoryItem*> item);
|
void ui_repaintHistoryItem(not_null<const HistoryItem*> item);
|
||||||
void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way);
|
void ui_showPeerHistory(
|
||||||
|
PeerId peer,
|
||||||
|
MsgId msgId,
|
||||||
|
Ui::ShowWay way,
|
||||||
|
anim::type animated,
|
||||||
|
anim::activation activation);
|
||||||
PeerData *ui_getPeerForMouseAction();
|
PeerData *ui_getPeerForMouseAction();
|
||||||
|
|
||||||
void notify_botCommandsChanged(UserData *bot);
|
void notify_botCommandsChanged(UserData *bot);
|
||||||
|
@ -448,9 +456,6 @@ public slots:
|
||||||
|
|
||||||
void onViewsIncrement();
|
void onViewsIncrement();
|
||||||
|
|
||||||
void ui_showPeerHistoryAsync(quint64 peerId, qint32 showAtMsgId, Ui::ShowWay way);
|
|
||||||
void ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
@ -532,7 +537,8 @@ private:
|
||||||
Window::SectionMemento &&memento,
|
Window::SectionMemento &&memento,
|
||||||
bool back,
|
bool back,
|
||||||
bool saveInStack,
|
bool saveInStack,
|
||||||
anim::type animated);
|
anim::type animated,
|
||||||
|
anim::activation activation);
|
||||||
void dropMainSection(Window::SectionWidget *widget);
|
void dropMainSection(Window::SectionWidget *widget);
|
||||||
|
|
||||||
Window::SectionSlideParams prepareThirdSectionAnimation(Window::SectionWidget *section);
|
Window::SectionSlideParams prepareThirdSectionAnimation(Window::SectionWidget *section);
|
||||||
|
|
|
@ -227,7 +227,7 @@ void MainWindow::setupPasscode() {
|
||||||
|
|
||||||
if (_main) _main->hide();
|
if (_main) _main->hide();
|
||||||
Messenger::Instance().hideMediaView();
|
Messenger::Instance().hideMediaView();
|
||||||
Ui::hideSettingsAndLayer(true);
|
Ui::hideSettingsAndLayer(anim::type::instant);
|
||||||
if (_intro) _intro->hide();
|
if (_intro) _intro->hide();
|
||||||
if (animated) {
|
if (animated) {
|
||||||
_passcode->showAnimated(bg);
|
_passcode->showAnimated(bg);
|
||||||
|
@ -239,7 +239,7 @@ void MainWindow::setupPasscode() {
|
||||||
void MainWindow::setupIntro() {
|
void MainWindow::setupIntro() {
|
||||||
if (_intro && !_intro->isHidden() && !_main) return;
|
if (_intro && !_intro->isHidden() && !_main) return;
|
||||||
|
|
||||||
Ui::hideSettingsAndLayer(true);
|
Ui::hideSettingsAndLayer(anim::type::instant);
|
||||||
|
|
||||||
auto animated = (_main || _passcode);
|
auto animated = (_main || _passcode);
|
||||||
auto bg = animated ? grabInner() : QPixmap();
|
auto bg = animated ? grabInner() : QPixmap();
|
||||||
|
@ -325,13 +325,14 @@ void MainWindow::showSettings() {
|
||||||
|
|
||||||
void MainWindow::showSpecialLayer(
|
void MainWindow::showSpecialLayer(
|
||||||
object_ptr<LayerWidget> layer,
|
object_ptr<LayerWidget> layer,
|
||||||
LayerOptions options) {
|
anim::type animated) {
|
||||||
if (_passcode) return;
|
if (_passcode) return;
|
||||||
|
|
||||||
ensureLayerCreated();
|
if (layer) {
|
||||||
_layerBg->showSpecialLayer(std::move(layer));
|
ensureLayerCreated();
|
||||||
if (options & LayerOption::ForceFast) {
|
_layerBg->showSpecialLayer(std::move(layer), animated);
|
||||||
_layerBg->finishAnimation();
|
} else if (_layerBg) {
|
||||||
|
_layerBg->hideSpecialLayer(animated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +342,7 @@ void MainWindow::showMainMenu() {
|
||||||
if (isHidden()) showFromTray();
|
if (isHidden()) showFromTray();
|
||||||
|
|
||||||
ensureLayerCreated();
|
ensureLayerCreated();
|
||||||
_layerBg->showMainMenu();
|
_layerBg->showMainMenu(anim::type::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ensureLayerCreated() {
|
void MainWindow::ensureLayerCreated() {
|
||||||
|
@ -362,10 +363,10 @@ void MainWindow::destroyLayerDelayed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ui_hideSettingsAndLayer(LayerOptions options) {
|
void MainWindow::ui_hideSettingsAndLayer(anim::type animated) {
|
||||||
if (_layerBg) {
|
if (_layerBg) {
|
||||||
_layerBg->hideAll(options);
|
_layerBg->hideAll(animated);
|
||||||
if (options & LayerOption::ForceFast) {
|
if (animated == anim::type::instant) {
|
||||||
destroyLayerDelayed();
|
destroyLayerDelayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,25 +404,24 @@ PasscodeWidget *MainWindow::passcodeWidget() {
|
||||||
|
|
||||||
void MainWindow::ui_showBox(
|
void MainWindow::ui_showBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
LayerOptions options) {
|
LayerOptions options,
|
||||||
|
anim::type animated) {
|
||||||
if (box) {
|
if (box) {
|
||||||
ensureLayerCreated();
|
ensureLayerCreated();
|
||||||
if (options & LayerOption::KeepOther) {
|
if (options & LayerOption::KeepOther) {
|
||||||
if (options & LayerOption::ShowAfterOther) {
|
if (options & LayerOption::ShowAfterOther) {
|
||||||
_layerBg->prependBox(std::move(box));
|
_layerBg->prependBox(std::move(box), animated);
|
||||||
} else {
|
} else {
|
||||||
_layerBg->appendBox(std::move(box));
|
_layerBg->appendBox(std::move(box), animated);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_layerBg->showBox(std::move(box));
|
_layerBg->showBox(std::move(box), animated);
|
||||||
}
|
|
||||||
if (options & LayerOption::ForceFast) {
|
|
||||||
_layerBg->finishAnimation();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_layerBg) {
|
if (_layerBg) {
|
||||||
_layerBg->hideTopLayer(options);
|
_layerBg->hideTopLayer(animated);
|
||||||
if ((options & LayerOption::ForceFast) && !_layerBg->layerShown()) {
|
if ((animated == anim::type::instant)
|
||||||
|
&& !_layerBg->layerShown()) {
|
||||||
destroyLayerDelayed();
|
destroyLayerDelayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -978,7 +978,7 @@ QImage MainWindow::iconWithCounter(int size, int count, style::color bg, style::
|
||||||
void MainWindow::sendPaths() {
|
void MainWindow::sendPaths() {
|
||||||
if (App::passcoded()) return;
|
if (App::passcoded()) return;
|
||||||
Messenger::Instance().hideMediaView();
|
Messenger::Instance().hideMediaView();
|
||||||
Ui::hideSettingsAndLayer(true);
|
Ui::hideSettingsAndLayer(anim::type::instant);
|
||||||
if (_main) {
|
if (_main) {
|
||||||
_main->activate();
|
_main->activate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,12 +136,12 @@ public:
|
||||||
|
|
||||||
void showSpecialLayer(
|
void showSpecialLayer(
|
||||||
object_ptr<LayerWidget> layer,
|
object_ptr<LayerWidget> layer,
|
||||||
LayerOptions options);
|
anim::type animated);
|
||||||
|
|
||||||
void ui_showBox(
|
void ui_showBox(
|
||||||
object_ptr<BoxContent> box,
|
object_ptr<BoxContent> box,
|
||||||
LayerOptions options);
|
LayerOptions options,
|
||||||
void ui_hideSettingsAndLayer(LayerOptions options);
|
anim::type animated);
|
||||||
|
void ui_hideSettingsAndLayer(anim::type animated);
|
||||||
bool ui_isLayerShown();
|
bool ui_isLayerShown();
|
||||||
void ui_showMediaPreview(DocumentData *document);
|
void ui_showMediaPreview(DocumentData *document);
|
||||||
void ui_showMediaPreview(PhotoData *photo);
|
void ui_showMediaPreview(PhotoData *photo);
|
||||||
|
|
|
@ -647,11 +647,6 @@ void MediaView::updateMixerVideoVolume() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaView::close() {
|
void MediaView::close() {
|
||||||
_sharedMedia = nullptr;
|
|
||||||
_sharedMediaData = base::none;
|
|
||||||
_userPhotos = nullptr;
|
|
||||||
_userPhotosData = base::none;
|
|
||||||
if (_menu) _menu->hideMenu(true);
|
|
||||||
Messenger::Instance().hideMediaView();
|
Messenger::Instance().hideMediaView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1256,7 +1251,7 @@ void MediaView::displayPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
|
||||||
_caption.setMarkedText(
|
_caption.setMarkedText(
|
||||||
st::mediaviewCaptionStyle,
|
st::mediaviewCaptionStyle,
|
||||||
photoMsg->getCaption(),
|
photoMsg->getCaption(),
|
||||||
asBot ? _captionBotOptions : _captionTextOptions);
|
itemTextOptions(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2728,6 +2723,11 @@ bool MediaView::eventFilter(QObject *obj, QEvent *e) {
|
||||||
|
|
||||||
void MediaView::setVisible(bool visible) {
|
void MediaView::setVisible(bool visible) {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
_sharedMedia = nullptr;
|
||||||
|
_sharedMediaData = base::none;
|
||||||
|
_userPhotos = nullptr;
|
||||||
|
_userPhotosData = base::none;
|
||||||
|
if (_menu) _menu->hideMenu(true);
|
||||||
_controlsHideTimer.stop();
|
_controlsHideTimer.stop();
|
||||||
_controlsState = ControlsShown;
|
_controlsState = ControlsShown;
|
||||||
a_cOpacity = anim::value(1, 1);
|
a_cOpacity = anim::value(1, 1);
|
||||||
|
|
|
@ -204,14 +204,14 @@ void Messenger::showPhoto(not_null<const PhotoOpenClickHandler*> link, HistoryIt
|
||||||
}
|
}
|
||||||
|
|
||||||
void Messenger::showPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
|
void Messenger::showPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
|
||||||
if (_mediaView->isHidden()) Ui::hideLayer(true);
|
if (_mediaView->isHidden()) Ui::hideLayer(anim::type::instant);
|
||||||
_mediaView->showPhoto(photo, item);
|
_mediaView->showPhoto(photo, item);
|
||||||
_mediaView->activateWindow();
|
_mediaView->activateWindow();
|
||||||
_mediaView->setFocus();
|
_mediaView->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Messenger::showPhoto(not_null<PhotoData*> photo, PeerData *peer) {
|
void Messenger::showPhoto(not_null<PhotoData*> photo, PeerData *peer) {
|
||||||
if (_mediaView->isHidden()) Ui::hideLayer(true);
|
if (_mediaView->isHidden()) Ui::hideLayer(anim::type::instant);
|
||||||
_mediaView->showPhoto(photo, peer);
|
_mediaView->showPhoto(photo, peer);
|
||||||
_mediaView->activateWindow();
|
_mediaView->activateWindow();
|
||||||
_mediaView->setFocus();
|
_mediaView->setFocus();
|
||||||
|
@ -221,7 +221,9 @@ void Messenger::showDocument(not_null<DocumentData*> document, HistoryItem *item
|
||||||
if (cUseExternalVideoPlayer() && document->isVideo()) {
|
if (cUseExternalVideoPlayer() && document->isVideo()) {
|
||||||
QDesktopServices::openUrl(QUrl("file:///" + document->location(false).fname));
|
QDesktopServices::openUrl(QUrl("file:///" + document->location(false).fname));
|
||||||
} else {
|
} else {
|
||||||
if (_mediaView->isHidden()) Ui::hideLayer(true);
|
if (_mediaView->isHidden()) {
|
||||||
|
Ui::hideLayer(anim::type::instant);
|
||||||
|
}
|
||||||
_mediaView->showDocument(document, item);
|
_mediaView->showDocument(document, item);
|
||||||
_mediaView->activateWindow();
|
_mediaView->activateWindow();
|
||||||
_mediaView->setFocus();
|
_mediaView->setFocus();
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ void OverviewInner::keyPressEvent(QKeyEvent *e) {
|
||||||
if ((_search->isHidden() || !_search->hasFocus()) && !_overview->isHidden() && e->key() == Qt::Key_Escape) {
|
if ((_search->isHidden() || !_search->hasFocus()) && !_overview->isHidden() && e->key() == Qt::Key_Escape) {
|
||||||
onCancel();
|
onCancel();
|
||||||
} else if (e->key() == Qt::Key_Back) {
|
} else if (e->key() == Qt::Key_Back) {
|
||||||
App::main()->showBackFromStack();
|
App::main()->showBackFromStack(anim::type::normal, anim::activation::normal);
|
||||||
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
||||||
onSearchMessages();
|
onSearchMessages();
|
||||||
}
|
}
|
||||||
|
@ -1527,7 +1527,7 @@ void OverviewInner::onSearchUpdate() {
|
||||||
void OverviewInner::onCancel() {
|
void OverviewInner::onCancel() {
|
||||||
if (_selected.isEmpty()) {
|
if (_selected.isEmpty()) {
|
||||||
if (onCancelSearch()) return;
|
if (onCancelSearch()) return;
|
||||||
App::main()->showBackFromStack();
|
App::main()->showBackFromStack(anim::type::normal, anim::activation::normal);
|
||||||
} else {
|
} else {
|
||||||
_overview->onClearSelected();
|
_overview->onClearSelected();
|
||||||
}
|
}
|
||||||
|
@ -2070,7 +2070,7 @@ bool OverviewWidget::paintTopBar(Painter &p, int decreaseWidth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewWidget::topBarClick() {
|
void OverviewWidget::topBarClick() {
|
||||||
App::main()->showBackFromStack();
|
App::main()->showBackFromStack(anim::type::normal, anim::activation::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerData *OverviewWidget::peer() const {
|
PeerData *OverviewWidget::peer() const {
|
||||||
|
|
|
@ -62,7 +62,7 @@ QByteArray EscapeShell(const QByteArray &content) {
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
void UnsafeShowInFolder(const QString &filepath) {
|
void UnsafeShowInFolder(const QString &filepath) {
|
||||||
Ui::hideLayer(true); // Hide mediaview to make other apps visible.
|
Ui::hideLayer(anim::type::instant); // Hide mediaview to make other apps visible.
|
||||||
|
|
||||||
auto absolutePath = QFileInfo(filepath).absoluteFilePath();
|
auto absolutePath = QFileInfo(filepath).absoluteFilePath();
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
|
@ -149,14 +149,19 @@ void ChannelMembersWidget::onMembers() {
|
||||||
|
|
||||||
void ChannelMembersWidget::onAdmins() {
|
void ChannelMembersWidget::onAdmins() {
|
||||||
if (auto channel = peer()->asChannel()) {
|
if (auto channel = peer()->asChannel()) {
|
||||||
ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Admins);
|
ParticipantsBoxController::Start(
|
||||||
|
channel,
|
||||||
|
ParticipantsBoxController::Role::Admins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelMembersWidget::onRecentActions() {
|
void ChannelMembersWidget::onRecentActions() {
|
||||||
if (auto channel = peer()->asChannel()) {
|
if (auto channel = peer()->asChannel()) {
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
main->showSection(AdminLog::SectionMemento(channel), anim::type::normal);
|
main->showSection(
|
||||||
|
AdminLog::SectionMemento(channel),
|
||||||
|
anim::type::normal,
|
||||||
|
anim::activation::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,27 +212,36 @@ void SettingsWidget::onManageAdmins() {
|
||||||
if (auto chat = peer()->asChat()) {
|
if (auto chat = peer()->asChat()) {
|
||||||
EditChatAdminsBoxController::Start(chat);
|
EditChatAdminsBoxController::Start(chat);
|
||||||
} else if (auto channel = peer()->asChannel()) {
|
} else if (auto channel = peer()->asChannel()) {
|
||||||
ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Admins);
|
ParticipantsBoxController::Start(
|
||||||
|
channel,
|
||||||
|
ParticipantsBoxController::Role::Admins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::onRecentActions() {
|
void SettingsWidget::onRecentActions() {
|
||||||
if (auto channel = peer()->asChannel()) {
|
if (auto channel = peer()->asChannel()) {
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
main->showSection(AdminLog::SectionMemento(channel), anim::type::normal);
|
main->showSection(
|
||||||
|
AdminLog::SectionMemento(channel),
|
||||||
|
anim::type::normal,
|
||||||
|
anim::activation::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::onManageBannedUsers() {
|
void SettingsWidget::onManageBannedUsers() {
|
||||||
if (auto channel = peer()->asMegagroup()) {
|
if (auto channel = peer()->asMegagroup()) {
|
||||||
ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Kicked);
|
ParticipantsBoxController::Start(
|
||||||
|
channel,
|
||||||
|
ParticipantsBoxController::Role::Kicked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::onManageRestrictedUsers() {
|
void SettingsWidget::onManageRestrictedUsers() {
|
||||||
if (auto channel = peer()->asMegagroup()) {
|
if (auto channel = peer()->asMegagroup()) {
|
||||||
ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Restricted);
|
ParticipantsBoxController::Start(
|
||||||
|
channel,
|
||||||
|
ParticipantsBoxController::Role::Restricted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,10 @@ void SharedMediaWidget::onShowCommonGroups() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
main->showSection(Profile::CommonGroups::SectionMemento(peer()->asUser()), anim::type::normal);
|
main->showSection(
|
||||||
|
Profile::CommonGroups::SectionMemento(peer()->asUser()),
|
||||||
|
anim::type::normal,
|
||||||
|
anim::activation::normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,9 @@ FixedBar::FixedBar(QWidget *parent) : TWidget(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedBar::onBack() {
|
void FixedBar::onBack() {
|
||||||
App::main()->showBackFromStack();
|
App::main()->showBackFromStack(
|
||||||
|
anim::type::normal,
|
||||||
|
anim::activation::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FixedBar::resizeGetHeight(int newWidth) {
|
int FixedBar::resizeGetHeight(int newWidth) {
|
||||||
|
|
|
@ -148,7 +148,7 @@ void FixedBar::addRightAction(RightActionType type, base::lambda<QString()> text
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedBar::onBack() {
|
void FixedBar::onBack() {
|
||||||
App::main()->showBackFromStack();
|
App::main()->showBackFromStack(anim::type::normal, anim::activation::normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedBar::onEditChannel() {
|
void FixedBar::onEditChannel() {
|
||||||
|
|
|
@ -98,6 +98,11 @@ enum class type {
|
||||||
instant,
|
instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class activation {
|
||||||
|
normal,
|
||||||
|
background,
|
||||||
|
};
|
||||||
|
|
||||||
using transition = base::lambda<float64(float64 delta, float64 dt)>;
|
using transition = base::lambda<float64(float64 delta, float64 dt)>;
|
||||||
|
|
||||||
extern transition linear;
|
extern transition linear;
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool MainWindow::hideNoQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::clearWidgets() {
|
void MainWindow::clearWidgets() {
|
||||||
Ui::hideLayer(true);
|
Ui::hideLayer(anim::type::instant);
|
||||||
clearWidgetsHook();
|
clearWidgetsHook();
|
||||||
updateGlobalMenu();
|
updateGlobalMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,64 +257,93 @@ void Controller::updateColumnLayout() {
|
||||||
void Controller::showPeerHistory(
|
void Controller::showPeerHistory(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
Ui::ShowWay way,
|
Ui::ShowWay way,
|
||||||
MsgId msgId) {
|
MsgId msgId,
|
||||||
Ui::showPeerHistory(peerId, msgId, way);
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
|
Ui::showPeerHistory(
|
||||||
|
peerId,
|
||||||
|
msgId,
|
||||||
|
way,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showPeerHistory(
|
void Controller::showPeerHistory(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ShowWay way,
|
Ui::ShowWay way,
|
||||||
MsgId msgId) {
|
MsgId msgId,
|
||||||
showPeerHistory(peer->id, way, msgId);
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
|
showPeerHistory(
|
||||||
|
peer->id,
|
||||||
|
way,
|
||||||
|
msgId,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showPeerHistory(
|
void Controller::showPeerHistory(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
Ui::ShowWay way,
|
Ui::ShowWay way,
|
||||||
MsgId msgId) {
|
MsgId msgId,
|
||||||
showPeerHistory(history->peer->id, way, msgId);
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
|
showPeerHistory(
|
||||||
|
history->peer->id,
|
||||||
|
way,
|
||||||
|
msgId,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showPeerInfo(
|
void Controller::showPeerInfo(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
if (Adaptive::ThreeColumn()) {
|
if (Adaptive::ThreeColumn()) {
|
||||||
Auth().data().setThirdSectionInfoEnabled(true);
|
Auth().data().setThirdSectionInfoEnabled(true);
|
||||||
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
Auth().saveDataDelayed(kThirdSectionInfoTimeoutMs);
|
||||||
}
|
}
|
||||||
showSection(Info::Memento(peerId), animated);
|
showSection(
|
||||||
|
Info::Memento(peerId),
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showPeerInfo(
|
void Controller::showPeerInfo(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
showPeerInfo(peer->id, animated);
|
anim::activation activation) {
|
||||||
|
showPeerInfo(peer->id, animated, activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showPeerInfo(
|
void Controller::showPeerInfo(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
showPeerInfo(history->peer->id, animated);
|
anim::activation activation) {
|
||||||
|
showPeerInfo(history->peer->id, animated, activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showSection(
|
void Controller::showSection(
|
||||||
SectionMemento &&memento,
|
SectionMemento &&memento,
|
||||||
anim::type animated) {
|
anim::type animated,
|
||||||
App::main()->showSection(std::move(memento), animated);
|
anim::activation activation) {
|
||||||
|
App::main()->showSection(
|
||||||
|
std::move(memento),
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showBackFromStack() {
|
void Controller::showBackFromStack(
|
||||||
chats()->showBackFromStack();
|
anim::type animated,
|
||||||
|
anim::activation activation) {
|
||||||
|
chats()->showBackFromStack(animated, activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showSpecialLayer(
|
void Controller::showSpecialLayer(
|
||||||
object_ptr<LayerWidget> &&layer,
|
object_ptr<LayerWidget> &&layer,
|
||||||
LayerOptions options) {
|
anim::type animated) {
|
||||||
App::wnd()->showSpecialLayer(std::move(layer), options);
|
App::wnd()->showSpecialLayer(std::move(layer), animated);
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::hideSpecialLayer(LayerOptions options) {
|
|
||||||
Ui::hideSettingsAndLayer(options & LayerOption::ForceFast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<MainWidget*> Controller::chats() const {
|
not_null<MainWidget*> Controller::chats() const {
|
||||||
|
|
|
@ -95,38 +95,65 @@ public:
|
||||||
void closeThirdSection();
|
void closeThirdSection();
|
||||||
void showSection(
|
void showSection(
|
||||||
SectionMemento &&memento,
|
SectionMemento &&memento,
|
||||||
anim::type animated = anim::type::normal);
|
anim::type animated = anim::type::normal,
|
||||||
void showBackFromStack();
|
anim::activation activation = anim::activation::normal);
|
||||||
|
void showBackFromStack(
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
void showSpecialLayer(
|
void showSpecialLayer(
|
||||||
object_ptr<LayerWidget> &&layer,
|
object_ptr<LayerWidget> &&layer,
|
||||||
LayerOptions options = LayerOption::Animated);
|
anim::type animated = anim::type::normal);
|
||||||
void hideSpecialLayer(
|
void hideSpecialLayer(
|
||||||
LayerOptions options = LayerOption::Animated);
|
anim::type animated = anim::type::normal) {
|
||||||
|
showSpecialLayer(nullptr, animated);
|
||||||
|
}
|
||||||
|
|
||||||
void showPeerHistory(
|
void showPeerHistory(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
||||||
MsgId msgId = ShowAtUnreadMsgId);
|
MsgId msgId = ShowAtUnreadMsgId,
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
void showPeerHistory(
|
void showPeerHistory(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
||||||
MsgId msgId = ShowAtUnreadMsgId);
|
MsgId msgId = ShowAtUnreadMsgId,
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
void showPeerHistory(
|
void showPeerHistory(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
Ui::ShowWay way = Ui::ShowWay::ClearStack,
|
||||||
MsgId msgId = ShowAtUnreadMsgId);
|
MsgId msgId = ShowAtUnreadMsgId,
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
|
|
||||||
void showPeerInfo(
|
void showPeerInfo(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
anim::type animated = anim::type::normal);
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
void showPeerInfo(
|
void showPeerInfo(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
anim::type animated = anim::type::normal);
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
void showPeerInfo(
|
void showPeerInfo(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
anim::type animated = anim::type::normal);
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal);
|
||||||
|
|
||||||
void showJumpToDate(not_null<PeerData*> peer, QDate requestedDate);
|
void clearSectionStack(
|
||||||
|
anim::type animated = anim::type::normal,
|
||||||
|
anim::activation activation = anim::activation::normal) {
|
||||||
|
showPeerHistory(
|
||||||
|
PeerId(0),
|
||||||
|
Ui::ShowWay::ClearStack,
|
||||||
|
ShowAtUnreadMsgId,
|
||||||
|
animated,
|
||||||
|
activation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showJumpToDate(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
QDate requestedDate);
|
||||||
|
|
||||||
base::Variable<float64> &dialogsWidthRatio() {
|
base::Variable<float64> &dialogsWidthRatio() {
|
||||||
return _dialogsWidthRatio;
|
return _dialogsWidthRatio;
|
||||||
|
|
Loading…
Reference in New Issue