mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
New profiles Xcode build ready, couple of retina-support bugs fixed.
This commit is contained in:
@@ -49,8 +49,8 @@ constexpr int kErrorCouldNotWrite = 845;
|
||||
} // namespace
|
||||
|
||||
SpriteGenerator::SpriteGenerator(const structure::Module &module, bool forceReGenerate)
|
||||
: forceReGenerate_(forceReGenerate)
|
||||
, module_(module)
|
||||
: module_(module)
|
||||
, forceReGenerate_(forceReGenerate)
|
||||
, basePath_(QFileInfo(module.filepath()).dir().absolutePath()) {
|
||||
}
|
||||
|
||||
|
@@ -2208,7 +2208,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
|
||||
App::wnd()->getTitle()->updateBackButton();
|
||||
}
|
||||
|
||||
void MainWidget::showWideSection(Window::SectionMemento &memento) {
|
||||
void MainWidget::showWideSection(const Window::SectionMemento &memento) {
|
||||
App::wnd()->hideSettings();
|
||||
if (_wideSection && _wideSection->showInternal(&memento)) {
|
||||
return;
|
||||
@@ -2283,7 +2283,7 @@ Window::SectionSlideParams MainWidget::prepareDialogsAnimation() {
|
||||
return prepareShowAnimation(false);
|
||||
}
|
||||
|
||||
void MainWidget::showWideSectionAnimated(Window::SectionMemento *memento, bool back) {
|
||||
void MainWidget::showWideSectionAnimated(const Window::SectionMemento *memento, bool back) {
|
||||
QPixmap animCache;
|
||||
|
||||
auto newWideGeometry = QRect(_history->x(), _playerHeight, _history->width(), height() - _playerHeight);
|
||||
|
@@ -223,7 +223,7 @@ public:
|
||||
|
||||
PeerData *overviewPeer();
|
||||
bool mediaTypeSwitch();
|
||||
void showWideSection(Window::SectionMemento &memento);
|
||||
void showWideSection(const Window::SectionMemento &memento);
|
||||
void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1);
|
||||
void showBackFromStack();
|
||||
void orderWidgets();
|
||||
@@ -502,7 +502,7 @@ private:
|
||||
void overviewLoaded(History *history, const MTPmessages_Messages &result, mtpRequestId req);
|
||||
|
||||
Window::SectionSlideParams prepareShowAnimation(bool willHaveTopBarShadow);
|
||||
void showWideSectionAnimated(Window::SectionMemento *memento, bool back);
|
||||
void showWideSectionAnimated(const Window::SectionMemento *memento, bool back);
|
||||
|
||||
// All this methods use the prepareShowAnimation().
|
||||
Window::SectionSlideParams prepareWideSectionAnimation(Window::SectionWidget *section);
|
||||
|
@@ -217,7 +217,7 @@ bool CoverWidget::mimeDataHasImage(const QMimeData *mimeData) const {
|
||||
auto uriListFormat = qsl("text/uri-list");
|
||||
if (!mimeData->hasFormat(uriListFormat)) return false;
|
||||
|
||||
auto &urls = mimeData->urls();
|
||||
const auto &urls = mimeData->urls();
|
||||
if (urls.size() != 1) return false;
|
||||
|
||||
auto &url = urls.at(0);
|
||||
@@ -273,7 +273,7 @@ void CoverWidget::dropEvent(QDropEvent *e) {
|
||||
if (mimeData->hasImage()) {
|
||||
img = qvariant_cast<QImage>(mimeData->imageData());
|
||||
} else {
|
||||
auto &urls = mimeData->urls();
|
||||
const auto &urls = mimeData->urls();
|
||||
if (urls.size() == 1) {
|
||||
auto &url = urls.at(0);
|
||||
if (url.isLocalFile()) {
|
||||
|
@@ -106,9 +106,10 @@ QPixmap UserpicButton::prepareUserpicPixmap() const {
|
||||
auto retina = cIntRetinaFactor();
|
||||
auto size = st::profilePhotoSize * retina;
|
||||
QImage image(size, size, QImage::Format_ARGB32_Premultiplied);
|
||||
image.setDevicePixelRatio(cRetinaFactor());
|
||||
{
|
||||
Painter p(&image);
|
||||
p.fillRect(0, 0, size, size, st::profileBg);
|
||||
p.fillRect(0, 0, st::profilePhotoSize, st::profilePhotoSize, st::profileBg);
|
||||
_peer->paintUserpic(p, st::profilePhotoSize, 0, 0);
|
||||
}
|
||||
return App::pixmapFromImageInPlace(std_::move(image));
|
||||
|
@@ -30,10 +30,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
namespace Profile {
|
||||
|
||||
Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
|
||||
, _fixedBar(this, peer)
|
||||
, _fixedBarShadow(this, st::shadowColor)
|
||||
, _scroll(this, st::setScroll)
|
||||
, _inner(this, peer) {
|
||||
, _inner(this, peer)
|
||||
, _fixedBar(this, peer)
|
||||
, _fixedBarShadow(this, st::shadowColor) {
|
||||
_fixedBar->move(0, 0);
|
||||
_fixedBar->resizeToWidth(width());
|
||||
_fixedBar->show();
|
||||
@@ -69,8 +69,8 @@ void Widget::setInnerFocus() {
|
||||
_inner->setFocus();
|
||||
}
|
||||
|
||||
bool Widget::showInternal(Window::SectionMemento *memento) {
|
||||
if (auto profileMemento = dynamic_cast<SectionMemento*>(memento)) {
|
||||
bool Widget::showInternal(const Window::SectionMemento *memento) {
|
||||
if (auto profileMemento = dynamic_cast<const SectionMemento*>(memento)) {
|
||||
if (profileMemento->_peer == peer()) {
|
||||
// Perhaps no need to do that?..
|
||||
_scroll->scrollToY(profileMemento->_scrollTop);
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void updateAdaptiveLayout() override;
|
||||
|
||||
bool showInternal(Window::SectionMemento *memento) override;
|
||||
bool showInternal(const Window::SectionMemento *memento) override;
|
||||
std_::unique_ptr<Window::SectionMemento> createMemento() const override;
|
||||
|
||||
void setInternalState(const SectionMemento *memento);
|
||||
|
@@ -216,6 +216,7 @@ public:
|
||||
}
|
||||
AnimationCallbacks &operator=(AnimationCallbacks &&other) {
|
||||
std::swap(_implementation, other._implementation);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void start() { _implementation->start(); }
|
||||
|
@@ -27,6 +27,8 @@ class SectionWidget;
|
||||
class SectionMemento {
|
||||
public:
|
||||
virtual SectionWidget *createWidget(QWidget *parent, const QRect &geometry) const = 0;
|
||||
virtual ~SectionMemento() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
// Attempt to show the required section inside the existing one.
|
||||
// For example if this section already shows exactly the required
|
||||
// memento it can simply return true - it is shown already.
|
||||
virtual bool showInternal(SectionMemento *memento) = 0;
|
||||
virtual bool showInternal(const SectionMemento *memento) = 0;
|
||||
|
||||
// Create a memento of that section to store it in the history stack.
|
||||
virtual std_::unique_ptr<SectionMemento> createMemento() const = 0;
|
||||
|
Reference in New Issue
Block a user