Change main menu cloud icon to saved messages.

This commit is contained in:
John Preston 2017-12-05 20:48:03 +04:00
parent 8b3d203861
commit 993877b0d4
4 changed files with 41 additions and 9 deletions

View file

@ -84,10 +84,23 @@ void EmptyUserpic::PaintSavedMessages(
int y, int y,
int outerWidth, int outerWidth,
int size) { int size) {
const auto &bg = st::historyPeer4UserpicBg;
const auto &fg = st::historyPeerUserpicFg;
PaintSavedMessages(p, x, y, outerWidth, size, bg, fg);
}
void EmptyUserpic::PaintSavedMessages(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg) {
x = rtl() ? (outerWidth - x - size) : x; x = rtl() ? (outerWidth - x - size) : x;
PainterHighQualityEnabler hq(p); PainterHighQualityEnabler hq(p);
p.setBrush(st::historyPeer4UserpicBg); p.setBrush(bg);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawEllipse(x, y, size, size); p.drawEllipse(x, y, size, size);
@ -118,7 +131,7 @@ void EmptyUserpic::PaintSavedMessages(
const auto half = (top + bottom) / 2; const auto half = (top + bottom) / 2;
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
auto pen = st::historyPeerUserpicFg->p; auto pen = fg->p;
pen.setWidthF(thinkness); pen.setWidthF(thinkness);
pen.setCapStyle(Qt::FlatCap); pen.setCapStyle(Qt::FlatCap);

View file

@ -53,6 +53,14 @@ public:
int y, int y,
int outerWidth, int outerWidth,
int size); int size);
static void PaintSavedMessages(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg);
~EmptyUserpic(); ~EmptyUserpic();

View file

@ -113,7 +113,7 @@ mainMenuCloudButton: IconButton {
height: 64px; height: 64px;
icon: icon { icon: icon {
{ "menu_cloud", mainMenuCloudFg }, // { "menu_cloud", mainMenuCloudFg },
}; };
iconPosition: point(22px, 22px); iconPosition: point(22px, 22px);
} }

View file

@ -27,6 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/menu.h" #include "ui/widgets/menu.h"
#include "ui/special_buttons.h" #include "ui/special_buttons.h"
#include "ui/empty_userpic.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "storage/localstorage.h" #include "storage/localstorage.h"
#include "boxes/about_box.h" #include "boxes/about_box.h"
@ -199,13 +200,23 @@ void MainMenu::paintEvent(QPaintEvent *e) {
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText); p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _phoneText);
} }
if (_cloudButton) { if (_cloudButton) {
PainterHighQualityEnabler hq(p); Ui::EmptyUserpic::PaintSavedMessages(
p.setPen(Qt::NoPen); p,
p.setBrush(st::mainMenuCloudBg); _cloudButton->x() + (_cloudButton->width() - st::mainMenuCloudSize) / 2,
auto cloudBg = QRect(_cloudButton->x() + (_cloudButton->width() - st::mainMenuCloudSize) / 2,
_cloudButton->y() + (_cloudButton->height() - st::mainMenuCloudSize) / 2, _cloudButton->y() + (_cloudButton->height() - st::mainMenuCloudSize) / 2,
st::mainMenuCloudSize, st::mainMenuCloudSize); width(),
p.drawEllipse(cloudBg); st::mainMenuCloudSize,
st::mainMenuCloudBg,
st::mainMenuCloudFg);
//PainterHighQualityEnabler hq(p);
//p.setPen(Qt::NoPen);
//p.setBrush(st::mainMenuCloudBg);
//auto cloudBg = QRect(
// _cloudButton->x() + (_cloudButton->width() - st::mainMenuCloudSize) / 2,
// _cloudButton->y() + (_cloudButton->height() - st::mainMenuCloudSize) / 2,
// st::mainMenuCloudSize,
// st::mainMenuCloudSize);
//p.drawEllipse(cloudBg);
} }
} }
auto other = QRect(0, st::mainMenuCoverHeight, width(), height() - st::mainMenuCoverHeight).intersected(clip); auto other = QRect(0, st::mainMenuCoverHeight, width(), height() - st::mainMenuCoverHeight).intersected(clip);