2017-09-30 18:26:45 +00:00
|
|
|
/*
|
|
|
|
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>
|
2017-10-03 13:05:58 +00:00
|
|
|
#include <rpl/combine.h>
|
2017-09-30 18:26:45 +00:00
|
|
|
#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"
|
2017-10-03 13:05:58 +00:00
|
|
|
#include "window/window_slide_animation.h"
|
2017-09-30 18:26:45 +00:00
|
|
|
#include "auth_session.h"
|
|
|
|
#include "lang/lang_keys.h"
|
|
|
|
#include "styles/style_info.h"
|
|
|
|
#include "styles/style_profile.h"
|
|
|
|
|
|
|
|
namespace Info {
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
struct WrapWidget::StackItem {
|
|
|
|
std::unique_ptr<ContentMemento> section;
|
|
|
|
std::unique_ptr<ContentMemento> anotherTab;
|
|
|
|
};
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
WrapWidget::WrapWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
Wrap wrap,
|
|
|
|
not_null<Memento*> memento)
|
2017-10-03 14:57:11 +00:00
|
|
|
: SectionWidget(parent, controller)
|
2017-10-03 13:05:58 +00:00
|
|
|
, _wrap(wrap)
|
|
|
|
, _topShadow(this) {
|
|
|
|
_topShadow->toggleOn(topShadowToggledValue());
|
|
|
|
showNewContent(memento->content());
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
not_null<PeerData*> WrapWidget::peer() const {
|
|
|
|
return _content->peer();
|
|
|
|
}
|
|
|
|
|
|
|
|
Wrap WrapWidget::wrap() const {
|
2017-10-03 13:05:58 +00:00
|
|
|
return _wrap.current();
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::setWrap(Wrap wrap) {
|
2017-10-03 13:05:58 +00:00
|
|
|
if (_wrap.current() != wrap) {
|
|
|
|
_wrap = wrap;
|
|
|
|
setupTop(_content->section(), _content->peer()->id);
|
|
|
|
finishShowContent();
|
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2017-10-03 14:57:11 +00:00
|
|
|
|
|
|
|
_topTabsBackground.create(this, st::profileBg);
|
|
|
|
|
|
|
|
_topTabsBackground->move(0, 0);
|
|
|
|
_topTabsBackground->resize(
|
|
|
|
width(),
|
|
|
|
_topTabs->height() - st::lineWidth);
|
|
|
|
_topTabsBackground->show();
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::showTab(Tab tab) {
|
2017-10-03 17:41:44 +00:00
|
|
|
Expects(_content != nullptr);
|
|
|
|
auto direction = (tab > _tab)
|
|
|
|
? SlideDirection::FromRight
|
|
|
|
: SlideDirection::FromLeft;
|
|
|
|
auto newAnotherMemento = _content->createMemento();
|
|
|
|
auto newContent = _anotherTabMemento
|
|
|
|
? createContent(_anotherTabMemento.get())
|
|
|
|
: createContent(tab);
|
|
|
|
auto animationParams = SectionSlideParams();
|
|
|
|
// animationParams.withFade = (wrap() == Wrap::Layer);
|
|
|
|
animationParams.withTabs = true;
|
|
|
|
animationParams.withTopBarShadow = hasTopBarShadow()
|
|
|
|
&& newContent->hasTopBarShadow();
|
|
|
|
animationParams.oldContentCache = grabForShowAnimation(
|
|
|
|
animationParams);
|
|
|
|
|
|
|
|
showContent(std::move(newContent));
|
|
|
|
|
|
|
|
showAnimated(direction, animationParams);
|
|
|
|
|
|
|
|
_anotherTabMemento = std::move(newAnotherMemento);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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(
|
|
|
|
const Section §ion,
|
|
|
|
PeerId peerId) {
|
2017-10-03 13:05:58 +00:00
|
|
|
if (wrap() == Wrap::Side && _historyStack.empty()) {
|
2017-09-30 18:26:45 +00:00
|
|
|
setupTabbedTop(section);
|
|
|
|
} else {
|
|
|
|
setupTabs(Tab::None);
|
|
|
|
}
|
|
|
|
if (_topTabs) {
|
|
|
|
_topBar.destroy();
|
|
|
|
} else {
|
2017-10-03 13:05:58 +00:00
|
|
|
createTopBar(section, peerId);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::createTopBar(
|
|
|
|
const Section §ion,
|
|
|
|
PeerId peerId) {
|
2017-10-03 13:05:58 +00:00
|
|
|
_topBar.create(
|
2017-09-30 18:26:45 +00:00
|
|
|
this,
|
2017-10-03 13:05:58 +00:00
|
|
|
(wrap() == Wrap::Layer)
|
2017-09-30 18:26:45 +00:00
|
|
|
? st::infoLayerTopBar
|
|
|
|
: st::infoTopBar);
|
2017-10-03 13:05:58 +00:00
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
_topBar->setTitle(TitleValue(
|
|
|
|
section,
|
|
|
|
peerId));
|
2017-10-03 13:05:58 +00:00
|
|
|
if (wrap() != Wrap::Layer || !_historyStack.empty()) {
|
2017-09-30 18:26:45 +00:00
|
|
|
_topBar->enableBackButton(true);
|
|
|
|
_topBar->backRequest()
|
|
|
|
| rpl::start_with_next([this] {
|
2017-10-03 13:05:58 +00:00
|
|
|
showBackFromStack();
|
2017-09-30 18:26:45 +00:00
|
|
|
}, _topBar->lifetime());
|
|
|
|
}
|
2017-10-03 13:05:58 +00:00
|
|
|
if (wrap() == Wrap::Layer) {
|
2017-09-30 18:26:45 +00:00
|
|
|
auto close = _topBar->addButton(object_ptr<Ui::IconButton>(
|
|
|
|
_topBar,
|
|
|
|
st::infoLayerTopBarClose));
|
2017-10-03 14:57:11 +00:00
|
|
|
close->addClickHandler([this] {
|
|
|
|
controller()->hideSpecialLayer();
|
|
|
|
});
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
2017-10-03 13:05:58 +00:00
|
|
|
|
|
|
|
_topBar->move(0, 0);
|
|
|
|
_topBar->resizeToWidth(width());
|
|
|
|
_topBar->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::showBackFromStack() {
|
|
|
|
auto params = Window::SectionShow(
|
|
|
|
Window::SectionShow::Way::Backward);
|
|
|
|
if (!_historyStack.empty()) {
|
|
|
|
auto last = std::move(_historyStack.back());
|
|
|
|
_historyStack.pop_back();
|
|
|
|
_anotherTabMemento = std::move(last.anotherTab);
|
|
|
|
showNewContent(
|
|
|
|
last.section.get(),
|
|
|
|
params);
|
|
|
|
} else {
|
2017-10-03 14:57:11 +00:00
|
|
|
controller()->showBackFromStack(params);
|
2017-10-03 13:05:58 +00:00
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
not_null<Ui::RpWidget*> WrapWidget::topWidget() const {
|
|
|
|
if (_topTabs) {
|
2017-10-03 14:57:11 +00:00
|
|
|
return _topTabsBackground;
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
return _topBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::showContent(object_ptr<ContentWidget> content) {
|
|
|
|
_content = std::move(content);
|
|
|
|
_content->show();
|
|
|
|
finishShowContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::finishShowContent() {
|
2017-10-03 13:05:58 +00:00
|
|
|
updateContentGeometry();
|
|
|
|
_desiredHeights.fire(desiredHeightForContent());
|
|
|
|
_desiredShadowVisibilities.fire(_content->desiredShadowVisibility());
|
2017-10-03 14:57:11 +00:00
|
|
|
_topShadow->raise();
|
|
|
|
_topShadow->finishAnimating();
|
2017-09-30 18:26:45 +00:00
|
|
|
if (_topTabs) {
|
2017-10-03 14:57:11 +00:00
|
|
|
_topTabs->raise();
|
2017-09-30 19:20:40 +00:00
|
|
|
_topTabs->finishAnimating();
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
2017-10-03 13:05:58 +00:00
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
rpl::producer<bool> WrapWidget::topShadowToggledValue() const {
|
|
|
|
using namespace rpl::mappers;
|
|
|
|
return rpl::combine(
|
|
|
|
_wrap.value(),
|
|
|
|
_desiredShadowVisibilities.events() | rpl::flatten_latest(),
|
|
|
|
($1 == Wrap::Side) || $2);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rpl::producer<int> WrapWidget::desiredHeightForContent() const {
|
2017-10-03 13:05:58 +00:00
|
|
|
using namespace rpl::mappers;
|
|
|
|
return rpl::combine(
|
|
|
|
_content->desiredHeightValue(),
|
2017-10-03 14:57:11 +00:00
|
|
|
topWidget()->heightValue(),
|
2017-10-03 13:05:58 +00:00
|
|
|
$1 + $2);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
2017-10-03 13:05:58 +00:00
|
|
|
_wrap.value(),
|
2017-09-30 18:26:45 +00:00
|
|
|
controller(),
|
|
|
|
_content->peer());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
object_ptr<Media::Widget> WrapWidget::createMediaWidget() {
|
|
|
|
auto result = object_ptr<Media::Widget>(
|
|
|
|
this,
|
2017-10-03 13:05:58 +00:00
|
|
|
_wrap.value(),
|
2017-09-30 18:26:45 +00:00
|
|
|
controller(),
|
|
|
|
_content->peer(),
|
|
|
|
Media::Widget::Type::Photo);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
object_ptr<ContentWidget> WrapWidget::createContent(
|
|
|
|
not_null<ContentMemento*> memento) {
|
|
|
|
return memento->createWidget(
|
|
|
|
this,
|
|
|
|
_wrap.value(),
|
|
|
|
controller(),
|
|
|
|
contentGeometry());
|
|
|
|
}
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
bool WrapWidget::hasTopBarShadow() const {
|
2017-09-30 19:20:40 +00:00
|
|
|
return _topShadow->toggled();
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QPixmap WrapWidget::grabForShowAnimation(
|
|
|
|
const Window::SectionSlideParams ¶ms) {
|
2017-10-03 14:57:11 +00:00
|
|
|
if (params.withTopBarShadow) {
|
|
|
|
_topShadow->setVisible(false);
|
|
|
|
} else {
|
|
|
|
_topShadow->toggle(_topShadow->toggled(), anim::type::instant);
|
|
|
|
}
|
2017-10-03 17:41:44 +00:00
|
|
|
if (params.withTabs && _topTabs) {
|
|
|
|
_topTabs->hide();
|
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
auto result = myGrab(this);
|
2017-10-03 17:41:44 +00:00
|
|
|
if (params.withTopBarShadow) {
|
|
|
|
_topShadow->setVisible(true);
|
|
|
|
}
|
|
|
|
if (params.withTabs && _topTabs) {
|
|
|
|
_topTabs->show();
|
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-10-03 17:41:44 +00:00
|
|
|
void WrapWidget::showAnimatedHook(
|
|
|
|
const Window::SectionSlideParams ¶ms) {
|
|
|
|
if (params.withTabs && _topTabs) {
|
|
|
|
_topTabs->show();
|
|
|
|
_topTabsBackground->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-03 14:57:11 +00:00
|
|
|
void WrapWidget::doSetInnerFocus() {
|
2017-09-30 18:26:45 +00:00
|
|
|
_content->setInnerFocus();
|
|
|
|
}
|
|
|
|
|
2017-10-03 14:57:11 +00:00
|
|
|
void WrapWidget::showFinishedHook() {
|
|
|
|
// Restore shadow visibility after showChildren() call.
|
|
|
|
_topShadow->toggle(_topShadow->toggled(), anim::type::instant);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WrapWidget::showInternal(
|
2017-10-03 13:05:58 +00:00
|
|
|
not_null<Window::SectionMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms) {
|
2017-09-30 18:26:45 +00:00
|
|
|
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
2017-10-03 13:05:58 +00:00
|
|
|
auto content = infoMemento->content();
|
|
|
|
if (!_content->showInternal(content)) {
|
|
|
|
showNewContent(
|
|
|
|
content,
|
|
|
|
params);
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
2017-10-03 13:05:58 +00:00
|
|
|
return true;
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
2017-10-03 13:05:58 +00:00
|
|
|
auto result = std::make_unique<Memento>(_content->peer()->id);
|
2017-09-30 18:26:45 +00:00
|
|
|
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 {
|
2017-10-03 14:57:11 +00:00
|
|
|
return rect().marginsRemoved({ 0, topWidget()->height(), 0, 0 });
|
2017-10-03 13:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::showNewContent(
|
|
|
|
not_null<ContentMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms) {
|
|
|
|
auto saveToStack = (_content != nullptr)
|
|
|
|
&& (params.way == Window::SectionShow::Way::Forward);
|
2017-10-03 14:57:11 +00:00
|
|
|
auto needAnimation = (_content != nullptr)
|
2017-10-03 13:05:58 +00:00
|
|
|
&& (params.animated != anim::type::instant);
|
2017-10-03 14:57:11 +00:00
|
|
|
auto animationParams = SectionSlideParams();
|
2017-10-03 17:41:44 +00:00
|
|
|
auto newContent = object_ptr<ContentWidget>(nullptr);
|
2017-10-03 14:57:11 +00:00
|
|
|
if (needAnimation) {
|
2017-10-03 17:41:44 +00:00
|
|
|
newContent = createContent(memento);
|
2017-10-03 14:57:11 +00:00
|
|
|
animationParams.withTopBarShadow = hasTopBarShadow()
|
|
|
|
&& newContent->hasTopBarShadow();
|
|
|
|
animationParams.oldContentCache = grabForShowAnimation(
|
|
|
|
animationParams);
|
2017-10-03 17:41:44 +00:00
|
|
|
// animationParams.withFade = (wrap() == Wrap::Layer);
|
2017-10-03 13:05:58 +00:00
|
|
|
}
|
|
|
|
if (saveToStack) {
|
|
|
|
auto item = StackItem();
|
|
|
|
item.section = _content->createMemento();
|
|
|
|
if (_anotherTabMemento) {
|
|
|
|
item.anotherTab = std::move(_anotherTabMemento);
|
|
|
|
}
|
|
|
|
_historyStack.push_back(std::move(item));
|
|
|
|
} else if (params.way == Window::SectionShow::Way::ClearStack) {
|
|
|
|
_historyStack.clear();
|
|
|
|
}
|
2017-10-03 17:41:44 +00:00
|
|
|
if (newContent) {
|
|
|
|
setupTop(newContent->section(), newContent->peer()->id);
|
|
|
|
showContent(std::move(newContent));
|
|
|
|
} else {
|
|
|
|
showNewContent(memento);
|
|
|
|
}
|
2017-10-03 14:57:11 +00:00
|
|
|
if (animationParams) {
|
|
|
|
showAnimated(
|
|
|
|
saveToStack
|
|
|
|
? SlideDirection::FromRight
|
|
|
|
: SlideDirection::FromLeft,
|
|
|
|
animationParams);
|
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
void WrapWidget::showNewContent(not_null<ContentMemento*> memento) {
|
2017-09-30 18:26:45 +00:00
|
|
|
// Validates contentGeometry().
|
2017-10-03 13:05:58 +00:00
|
|
|
setupTop(memento->section(), memento->peerId());
|
|
|
|
showContent(createContent(memento));
|
2017-09-30 18:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::setupTabs(Tab tab) {
|
|
|
|
_tab = tab;
|
|
|
|
if (_tab == Tab::None) {
|
|
|
|
_topTabs.destroy();
|
2017-10-03 14:57:11 +00:00
|
|
|
_topTabsBackground.destroy();
|
2017-09-30 18:26:45 +00:00
|
|
|
} else if (!_topTabs) {
|
|
|
|
createTabs();
|
|
|
|
} else {
|
|
|
|
_topTabs->setActiveSection(static_cast<int>(tab));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::resizeEvent(QResizeEvent *e) {
|
2017-10-03 14:57:11 +00:00
|
|
|
if (_topTabs) {
|
|
|
|
_topTabs->resizeToWidth(width());
|
|
|
|
_topTabsBackground->resize(
|
|
|
|
width(),
|
|
|
|
_topTabs->height() - st::lineWidth);
|
|
|
|
} else if (_topBar) {
|
|
|
|
_topBar->resizeToWidth(width());
|
|
|
|
}
|
2017-09-30 18:26:45 +00:00
|
|
|
updateContentGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrapWidget::updateContentGeometry() {
|
|
|
|
if (_content) {
|
|
|
|
_topShadow->resizeToWidth(width());
|
2017-10-03 14:57:11 +00:00
|
|
|
_topShadow->moveToLeft(0, topWidget()->height());
|
2017-09-30 18:26:45 +00:00
|
|
|
_content->setGeometry(contentGeometry());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WrapWidget::wheelEventFromFloatPlayer(QEvent *e) {
|
|
|
|
return _content->wheelEventFromFloatPlayer(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect WrapWidget::rectForFloatPlayer() const {
|
|
|
|
return _content->rectForFloatPlayer();
|
|
|
|
}
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
WrapWidget::~WrapWidget() = default;
|
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
} // namespace Info
|