Some icons moved from sprite to separate files.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 66 KiB |
|
@ -91,15 +91,6 @@ boxTitleFont: font(boxFontSize bold);
|
|||
boxTitlePosition: point(26px, 28px);
|
||||
boxTitleHeight: 54px;
|
||||
|
||||
boxBlueTitleBg: #6393b5;
|
||||
boxBlueTitleAdditionalFg: #dae9f5;
|
||||
boxBlueTitleAdditionalSkip: 12px;
|
||||
boxBlueTitlePosition: point(23px, 18px);
|
||||
boxBlueCloseIcon: sprite(120px, 108px, 12px, 12px);
|
||||
boxBlueCloseBg: #c8e1f0;
|
||||
boxBlueCloseDuration: 150;
|
||||
boxBlueShadow: sprite(132px, 108px, 1px, 4px);
|
||||
|
||||
boxButtonFont: font(boxFontSize semibold);
|
||||
defaultBoxButton: RoundButton {
|
||||
textFg: #2f9fea;
|
||||
|
@ -337,8 +328,6 @@ boxScrollShadowBg: #00000012;
|
|||
|
||||
titleBg: #6389a8;
|
||||
titleHeight: 39px;
|
||||
titleIconPos: point(7px, 7px);
|
||||
titleIconImg: sprite(161px, 100px, 26px, 26px);
|
||||
titleFont: font(17px);
|
||||
titlePos: point(44px, 29px);
|
||||
titleMenuOffset: 36px;
|
||||
|
@ -908,8 +897,6 @@ msgDateImgBgSelected: #1c4a7187;
|
|||
msgDateImgPadding: point(8px, 2px);
|
||||
msgDateImgCheckSpace: 4px;
|
||||
|
||||
msgDogImg: sprite(216px, 92px, 126px, 126px);
|
||||
|
||||
collapseButton: flatButton(btnDefFlat) {
|
||||
font: msgServiceFont;
|
||||
overFont: msgServiceFont;
|
||||
|
@ -1289,9 +1276,6 @@ layerPadding: margins(10px, 10px, 10px, 10px);
|
|||
contactPadding: margins(49px, 22px, 0px, 6px);
|
||||
contactSkip: 13px;
|
||||
contactPhoneSkip: 30px;
|
||||
contactUserIcon: sprite(120px, 90px, 18px, 18px);
|
||||
contactPhoneIcon: sprite(138px, 90px, 18px, 18px);
|
||||
contactIconTop: 10px;
|
||||
|
||||
contactsPhotoSize: 42px;
|
||||
contactsPadding: margins(16px, 7px, 16px, 7px);
|
||||
|
@ -1304,11 +1288,6 @@ contactsStatusFgOver: #7c99b2;
|
|||
contactsStatusFgOnline: #3b8dcc;
|
||||
contactsBgOver: overBg;
|
||||
contactsCheckPosition: point(8px, 16px);
|
||||
contactsNewItemHeight: 53px;
|
||||
contactsNewItemIcon: sprite(307px, 248px, 22px, 16px);
|
||||
contactsNewItemIconPosition: point(29px, 19px);
|
||||
contactsNewItemTop: 18px;
|
||||
contactsNewItemFg: #4b82af;
|
||||
contactsAboutBg: #f7f7f7;
|
||||
contactsAboutShadow: #0000001F;
|
||||
contactsAdminCheckbox: Checkbox(defaultBoxCheckbox) {
|
||||
|
@ -1832,8 +1811,6 @@ medviewSaveMsgShown: 2000;
|
|||
medviewSaveMsgHiding: 2500;
|
||||
medviewSaveMsg: #000000b2;
|
||||
|
||||
mvTransparentBrush: sprite(9px, 124px, 8px, 8px);
|
||||
|
||||
// Mac specific
|
||||
|
||||
macAccessoryWidth: 450.;
|
||||
|
|
BIN
Telegram/Resources/icons/add_contact_phone.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
Telegram/Resources/icons/add_contact_phone@2x.png
Normal file
After Width: | Height: | Size: 708 B |
BIN
Telegram/Resources/icons/add_contact_user.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
Telegram/Resources/icons/add_contact_user@2x.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
Telegram/Resources/icons/box_button_close.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
Telegram/Resources/icons/box_button_close@2x.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
Telegram/Resources/icons/box_title_shadow.png
Normal file
After Width: | Height: | Size: 85 B |
BIN
Telegram/Resources/icons/box_title_shadow@2x.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
Telegram/Resources/icons/contacts_add.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
Telegram/Resources/icons/contacts_add@2x.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
Telegram/Resources/icons/history_empty_dog.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
Telegram/Resources/icons/history_empty_dog@2x.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
Telegram/Resources/icons/title_icon.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
Telegram/Resources/icons/title_icon@2x.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
Telegram/Resources/icons/title_icon_bg.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
Telegram/Resources/icons/title_icon_bg@2x.png
Normal file
After Width: | Height: | Size: 701 B |
|
@ -2819,41 +2819,7 @@ namespace {
|
|||
|
||||
uint64 max = qMax(1ULL, components[maxtomin[0]]), mid = qMax(1ULL, components[maxtomin[1]]), min = qMax(1ULL, components[maxtomin[2]]);
|
||||
|
||||
QImage dog = App::sprite().toImage().copy(st::msgDogImg.rect());
|
||||
QImage::Format f = dog.format();
|
||||
if (f != QImage::Format_ARGB32 && f != QImage::Format_ARGB32_Premultiplied) {
|
||||
dog = dog.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
}
|
||||
uchar *dogBits = dog.bits();
|
||||
if (max != min) {
|
||||
float64 coef = float64(mid - min) / float64(max - min);
|
||||
for (int i = 0, s = dog.width() * dog.height() * 4; i < s; i += 4) {
|
||||
int dogmaxtomin[3] = { i, i + 1, i + 2 };
|
||||
if (dogBits[dogmaxtomin[0]] < dogBits[dogmaxtomin[1]]) {
|
||||
qSwap(dogmaxtomin[0], dogmaxtomin[1]);
|
||||
}
|
||||
if (dogBits[dogmaxtomin[1]] < dogBits[dogmaxtomin[2]]) {
|
||||
qSwap(dogmaxtomin[1], dogmaxtomin[2]);
|
||||
if (dogBits[dogmaxtomin[0]] < dogBits[dogmaxtomin[1]]) {
|
||||
qSwap(dogmaxtomin[0], dogmaxtomin[1]);
|
||||
}
|
||||
}
|
||||
uchar result[3];
|
||||
result[maxtomin[0]] = dogBits[dogmaxtomin[0]];
|
||||
result[maxtomin[2]] = dogBits[dogmaxtomin[2]];
|
||||
result[maxtomin[1]] = uchar(qRound(result[maxtomin[2]] + (result[maxtomin[0]] - result[maxtomin[2]]) * coef));
|
||||
dogBits[i] = result[2];
|
||||
dogBits[i + 1] = result[1];
|
||||
dogBits[i + 2] = result[0];
|
||||
}
|
||||
} else {
|
||||
for (int i = 0, s = dog.width() * dog.height() * 4; i < s; i += 4) {
|
||||
uchar b = dogBits[i], g = dogBits[i + 1], r = dogBits[i + 2];
|
||||
dogBits[i] = dogBits[i + 1] = dogBits[i + 2] = (r + r + b + g + g + g) / 6;
|
||||
}
|
||||
}
|
||||
|
||||
Window::chatBackground()->init(id, pixmapFromImageInPlace(std_::move(img)), pixmapFromImageInPlace(std_::move(dog)));
|
||||
Window::chatBackground()->init(id, pixmapFromImageInPlace(std_::move(img)));
|
||||
|
||||
memcpy(componentsScroll, components, sizeof(components));
|
||||
memcpy(componentsPoint, components, sizeof(components));
|
||||
|
|
|
@ -26,16 +26,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "abstractbox.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
void BlueTitleShadow::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
QRect r(e->rect());
|
||||
p.drawPixmap(QRect(r.left(), 0, r.width(), height()), App::sprite(), st::boxBlueShadow.rect());
|
||||
st::boxBlueTitleShadow.fill(p, QRect(r.left(), 0, r.width(), height()));
|
||||
}
|
||||
|
||||
BlueTitleClose::BlueTitleClose(QWidget *parent) : Button(parent)
|
||||
, a_iconFg(st::boxBlueCloseBg->c)
|
||||
, a_iconFg(st::boxBlueCloseFg->c)
|
||||
, _a_over(animation(this, &BlueTitleClose::step_over)) {
|
||||
resize(st::boxTitleHeight, st::boxTitleHeight);
|
||||
setCursor(style::cur_pointer);
|
||||
|
@ -44,7 +45,7 @@ BlueTitleClose::BlueTitleClose(QWidget *parent) : Button(parent)
|
|||
|
||||
void BlueTitleClose::onStateChange(int oldState, ButtonStateChangeSource source) {
|
||||
if ((oldState & StateOver) != (_state & StateOver)) {
|
||||
a_iconFg.start(((_state & StateOver) ? st::white : st::boxBlueCloseBg)->c);
|
||||
a_iconFg.start(((_state & StateOver) ? st::boxBlueCloseOverFg : st::boxBlueCloseFg)->c);
|
||||
_a_over.start();
|
||||
}
|
||||
}
|
||||
|
@ -57,28 +58,23 @@ void BlueTitleClose::step_over(float64 ms, bool timer) {
|
|||
} else {
|
||||
a_iconFg.update(dt, anim::linear);
|
||||
}
|
||||
if (timer) update((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
|
||||
if (timer) update((st::boxTitleHeight - st::boxBlueCloseIcon.width()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.height()) / 2, st::boxBlueCloseIcon.width(), st::boxBlueCloseIcon.height());
|
||||
}
|
||||
|
||||
void BlueTitleClose::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
QRect r(e->rect()), s((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
|
||||
QRect r(e->rect()), s((st::boxTitleHeight - st::boxBlueCloseIcon.width()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.height()) / 2, st::boxBlueCloseIcon.width(), st::boxBlueCloseIcon.height());
|
||||
if (!s.contains(r)) {
|
||||
p.fillRect(r, st::boxBlueTitleBg->b);
|
||||
p.fillRect(r, st::boxBlueTitleBg);
|
||||
}
|
||||
if (s.intersects(r)) {
|
||||
p.fillRect(s.intersected(r), a_iconFg.current());
|
||||
p.drawSprite(s.topLeft(), st::boxBlueCloseIcon);
|
||||
st::boxBlueCloseIcon.paint(p, s.topLeft(), width());
|
||||
}
|
||||
}
|
||||
|
||||
AbstractBox::AbstractBox(int32 w) : LayerWidget()
|
||||
, _maxHeight(0)
|
||||
, _closed(false)
|
||||
, _blueTitle(false)
|
||||
, _blueClose(0)
|
||||
, _blueShadow(0) {
|
||||
AbstractBox::AbstractBox(int w) : LayerWidget() {
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
resize(w, 0);
|
||||
}
|
||||
|
@ -101,7 +97,7 @@ void AbstractBox::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
if (_blueShadow) {
|
||||
_blueShadow->moveToLeft(0, st::boxTitleHeight);
|
||||
_blueShadow->resize(width(), st::boxBlueShadow.pxHeight());
|
||||
_blueShadow->resize(width(), st::boxBlueTitleShadow.height());
|
||||
}
|
||||
LayerWidget::resizeEvent(e);
|
||||
}
|
||||
|
@ -165,8 +161,8 @@ void AbstractBox::resizeMaxHeight(int32 newWidth, int32 maxHeight) {
|
|||
}
|
||||
}
|
||||
|
||||
int32 AbstractBox::countHeight() const {
|
||||
return qMin(_maxHeight, App::wnd()->height() - int32(2 * st::boxVerticalMargin));
|
||||
int AbstractBox::countHeight() const {
|
||||
return qMin(_maxHeight, App::wnd()->height() - 2 * st::boxVerticalMargin);
|
||||
}
|
||||
|
||||
void AbstractBox::onClose() {
|
||||
|
|
|
@ -52,7 +52,7 @@ class AbstractBox : public LayerWidget, protected base::Subscriber {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbstractBox(int32 w = st::boxWideWidth);
|
||||
AbstractBox(int w = st::boxWideWidth);
|
||||
void parentResized() override;
|
||||
void showDone() override {
|
||||
showAll();
|
||||
|
@ -83,14 +83,14 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
int32 _maxHeight;
|
||||
int32 countHeight() const;
|
||||
int _maxHeight = 0;
|
||||
int countHeight() const;
|
||||
|
||||
bool _closed;
|
||||
bool _closed = false;
|
||||
|
||||
bool _blueTitle;
|
||||
BlueTitleClose *_blueClose;
|
||||
BlueTitleShadow *_blueShadow;
|
||||
bool _blueTitle = false;
|
||||
BlueTitleClose *_blueClose = nullptr;
|
||||
BlueTitleShadow *_blueShadow = nullptr;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -109,8 +109,8 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
|
|||
paintTitle(p, _boxTitle);
|
||||
|
||||
if (_retry.isHidden()) {
|
||||
p.drawSpriteLeft(st::boxPadding.left(), _first.y() + st::contactIconTop, width(), st::contactUserIcon);
|
||||
p.drawSpriteLeft(st::boxPadding.left(), _phone.y() + st::contactIconTop, width(), st::contactPhoneIcon);
|
||||
st::contactUserIcon.paint(p, st::boxPadding.left(), _first.y() + st::contactIconTop, width());
|
||||
st::contactPhoneIcon.paint(p, st::boxPadding.left(), _phone.y() + st::contactIconTop, width());
|
||||
} else {
|
||||
p.setPen(st::black->p);
|
||||
p.setFont(st::boxTextFont->f);
|
||||
|
|
|
@ -21,6 +21,16 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
using "basic.style";
|
||||
using "ui/widgets/widgets.style";
|
||||
|
||||
boxBlueTitleBg: #6393b5;
|
||||
boxBlueTitleAdditionalFg: #dae9f5;
|
||||
boxBlueTitleAdditionalSkip: 12px;
|
||||
boxBlueTitlePosition: point(23px, 18px);
|
||||
boxBlueTitleShadow: icon {{ "box_title_shadow", windowShadowFg }};
|
||||
boxBlueCloseFg: #c8e1f0;
|
||||
boxBlueCloseOverFg: #ffffff;
|
||||
boxBlueCloseIcon: icon {{ "box_button_close", boxBlueTitleBg }};
|
||||
boxBlueCloseDuration: 150;
|
||||
|
||||
confirmInviteTitle: flatLabel(labelDefFlat) {
|
||||
font: font(16px semibold);
|
||||
align: align(center);
|
||||
|
@ -68,6 +78,15 @@ aboutRevokePublicLabel: flatLabel(labelDefFlat) {
|
|||
textFg: windowTextFg;
|
||||
}
|
||||
|
||||
contactUserIcon: icon {{ "add_contact_user", #999999 }};
|
||||
contactPhoneIcon: icon {{ "add_contact_phone", #999999 }};
|
||||
contactIconTop: 10px;
|
||||
|
||||
contactsNewItemHeight: 53px;
|
||||
contactsNewItemIcon: icon {{ "contacts_add", #749fc2, point(29px, 19px) }};
|
||||
contactsNewItemTop: 18px;
|
||||
contactsNewItemFg: #4b82af;
|
||||
|
||||
contactsMultiSelect: MultiSelect {
|
||||
padding: margins(8px, 8px, 8px, 8px);
|
||||
maxHeight: 104px;
|
||||
|
|
|
@ -100,6 +100,7 @@ ContactsBox::ContactsBox(UserData *bot) : ItemListBox(st::contactsScroll)
|
|||
|
||||
void ContactsBox::init() {
|
||||
_select->resizeToWidth(st::boxWideWidth);
|
||||
myEnsureResized(_select);
|
||||
|
||||
auto inviting = (_inner->creating() == CreatingGroupGroup) || (_inner->channel() && _inner->membersFilter() == MembersFilter::Recent) || _inner->chat();
|
||||
auto topSkip = getTopScrollSkip();
|
||||
|
@ -1073,7 +1074,7 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
} else {
|
||||
p.fillRect(0, 0, width(), st::contactsNewItemHeight, (_newItemSel ? st::contactsBgOver : st::white)->b);
|
||||
p.setFont(st::contactsNameFont);
|
||||
p.drawSpriteLeft(st::contactsNewItemIconPosition.x(), st::contactsNewItemIconPosition.y(), width(), st::contactsNewItemIcon);
|
||||
st::contactsNewItemIcon.paint(p, 0, 0, width());
|
||||
p.setPen(st::contactsNewItemFg);
|
||||
p.drawTextLeft(st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(lng_add_contact_button));
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "stdafx.h"
|
||||
#include "boxes/members_box.h"
|
||||
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "lang.h"
|
||||
#include "mainwidget.h"
|
||||
|
@ -149,7 +150,7 @@ void MembersBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
} else {
|
||||
if (_newItemHeight) {
|
||||
p.fillRect(0, 0, width(), _newItemHeight, (_newItemSel ? st::contactsBgOver : st::white)->b);
|
||||
p.drawSpriteLeft(st::contactsNewItemIconPosition.x(), st::contactsNewItemIconPosition.y(), width(), st::contactsNewItemIcon);
|
||||
st::contactsNewItemIcon.paint(p, 0, 0, width());
|
||||
p.setFont(st::contactsNameFont);
|
||||
p.setPen(st::contactsNewItemFg);
|
||||
p.drawTextLeft(st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::contactsNewItemTop, width(), lang(_filter == MembersFilter::Admins ? lng_channel_add_admins : lng_channel_add_members));
|
||||
|
|
|
@ -48,6 +48,7 @@ ShareBox::ShareBox(CopyCallback &©Callback, SubmitCallback &&submitCallback,
|
|||
, _topShadow(this)
|
||||
, _bottomShadow(this) {
|
||||
_select->resizeToWidth(st::boxWideWidth);
|
||||
myEnsureResized(_select);
|
||||
|
||||
auto topSkip = getTopScrollSkip();
|
||||
auto bottomSkip = st::boxButtonPadding.top() + _share->height() + st::boxButtonPadding.bottom();
|
||||
|
|
|
@ -35,6 +35,9 @@ historyToDownPaddingTop: 10px;
|
|||
historyToDownBadgeFont: semiboldFont;
|
||||
historyToDownBadgeSize: 22px;
|
||||
|
||||
historyEmptyDog: icon {{ "history_empty_dog", #ffffff }};
|
||||
historyEmptySize: 128px;
|
||||
|
||||
membersInnerScroll: flatScroll(solidScroll) {
|
||||
deltat: 3px;
|
||||
deltab: 3px;
|
||||
|
|
|
@ -334,6 +334,16 @@ QVector<int> ServiceMessagePainter::countLineWidths(const Text &text, const QRec
|
|||
return lineWidths;
|
||||
}
|
||||
|
||||
void paintEmpty(Painter &p, int width, int height) {
|
||||
auto position = QPoint((width - st::historyEmptySize) / 2, ((height - st::historyEmptySize) * 4) / 9);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(App::msgServiceBg());
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
p.drawEllipse(rtlrect(position.x(), position.y(), st::historyEmptySize, st::historyEmptySize, width));
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
st::historyEmptyDog.paint(p, position.x() + (st::historyEmptySize - st::historyEmptyDog.width()) / 2, position.y() + (st::historyEmptySize - st::historyEmptyDog.height()) / 2, width);
|
||||
}
|
||||
|
||||
void serviceColorsUpdated() {
|
||||
if (serviceMessageStyle) {
|
||||
for (auto &corner : serviceMessageStyle->corners) {
|
||||
|
|
|
@ -48,6 +48,8 @@ private:
|
|||
|
||||
};
|
||||
|
||||
void paintEmpty(Painter &p, int width, int height);
|
||||
|
||||
void serviceColorsUpdated();
|
||||
|
||||
} // namespace HistoryLayout
|
||||
|
|
|
@ -376,8 +376,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
textstyleRestore();
|
||||
}
|
||||
} else if (noHistoryDisplayed) {
|
||||
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||
HistoryLayout::paintEmpty(p, width(), height());
|
||||
}
|
||||
if (!noHistoryDisplayed) {
|
||||
adjustCurrent(r.top());
|
||||
|
@ -8776,8 +8775,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
if (_scroll.isHidden()) {
|
||||
p.setClipRect(_scroll.geometry());
|
||||
QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||
HistoryLayout::paintEmpty(p, width(), height() - _field.height() - 2 * st::sendPadding);
|
||||
}
|
||||
} else {
|
||||
style::font font(st::msgServiceFont);
|
||||
|
|
|
@ -230,11 +230,6 @@ style::color documentSelectedColor(int32 colorIndex) {
|
|||
return colors[colorIndex & 3];
|
||||
}
|
||||
|
||||
style::sprite documentCorner(int32 colorIndex) {
|
||||
static style::sprite corners[] = { st::msgFileBlue, st::msgFileGreen, st::msgFileRed, st::msgFileYellow };
|
||||
return corners[colorIndex & 3];
|
||||
}
|
||||
|
||||
RoundCorners documentCorners(int32 colorIndex) {
|
||||
return RoundCorners(DocBlueCorners + (colorIndex & 3));
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ style::color documentColor(int32 colorIndex);
|
|||
style::color documentDarkColor(int32 colorIndex);
|
||||
style::color documentOverColor(int32 colorIndex);
|
||||
style::color documentSelectedColor(int32 colorIndex);
|
||||
style::sprite documentCorner(int32 colorIndex);
|
||||
RoundCorners documentCorners(int32 colorIndex);
|
||||
bool documentIsValidMediaFile(const QString &filepath);
|
||||
|
||||
|
|
|
@ -715,7 +715,7 @@ HitTestType MainWindow::hitTest(const QPoint &p) const {
|
|||
}
|
||||
|
||||
QRect MainWindow::iconRect() const {
|
||||
return QRect(st::titleIconPos + title->geometry().topLeft(), st::titleIconImg.pxSize());
|
||||
return title->iconRect();
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject *obj, QEvent *e) {
|
||||
|
|
|
@ -85,19 +85,28 @@ mediaviewClose: icon {{ "mediaview_close", #ffffff }};
|
|||
mediaviewSave: icon {{ "mediaview_download", #ffffff }};
|
||||
mediaviewMore: icon {{ "mediaview_more", #ffffff }};
|
||||
|
||||
mediaviewFileRedCornerFg: #d55959;
|
||||
mediaviewFileYellowCornerFg: #e8a659;
|
||||
mediaviewFileGreenCornerFg: #49a957;
|
||||
mediaviewFileBlueCornerFg: #599dcf;
|
||||
|
||||
mediaviewFileRed: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #d55959 },
|
||||
{ "mediaview_file_corner", mediaviewFileRedCornerFg },
|
||||
};
|
||||
mediaviewFileYellow: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #e8a659 },
|
||||
{ "mediaview_file_corner", mediaviewFileYellowCornerFg },
|
||||
};
|
||||
mediaviewFileGreen: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #49a957 },
|
||||
{ "mediaview_file_corner", mediaviewFileGreenCornerFg },
|
||||
};
|
||||
mediaviewFileBlue: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #599dcf },
|
||||
{ "mediaview_file_corner", mediaviewFileBlueCornerFg },
|
||||
};
|
||||
|
||||
mediaviewTransparentBg: #ffffff;
|
||||
mediaviewTransparentFg: #cccccc;
|
||||
mediaviewTransparentSize: 4px;
|
||||
|
|
|
@ -103,7 +103,7 @@ MediaView::MediaView() : TWidget(App::wnd())
|
|||
}
|
||||
});
|
||||
|
||||
_transparentBrush = QBrush(App::sprite().copy(st::mvTransparentBrush.rect()));
|
||||
generateTransparentBrush();
|
||||
|
||||
setWindowFlags(Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::Tool | Qt::NoDropShadowWindowHint);
|
||||
moveToScreen();
|
||||
|
@ -2628,6 +2628,19 @@ void MediaView::loadBack() {
|
|||
}
|
||||
}
|
||||
|
||||
void MediaView::generateTransparentBrush() {
|
||||
auto size = st::mediaviewTransparentSize * cIntRetinaFactor();
|
||||
auto transparent = QImage(2 * size, 2 * size, QImage::Format_ARGB32_Premultiplied);
|
||||
transparent.fill(st::mediaviewTransparentBg->c);
|
||||
{
|
||||
Painter p(&transparent);
|
||||
p.fillRect(rtlrect(0, size, size, size, 2 * size), st::mediaviewTransparentFg);
|
||||
p.fillRect(rtlrect(size, 0, size, size, 2 * size), st::mediaviewTransparentFg);
|
||||
}
|
||||
transparent.setDevicePixelRatio(cRetinaFactor());
|
||||
_transparentBrush = QBrush(transparent);
|
||||
}
|
||||
|
||||
MediaView::LastChatPhoto MediaView::computeLastOverviewChatPhoto() {
|
||||
LastChatPhoto emptyResult = { nullptr, nullptr };
|
||||
auto lastPhotoInOverview = [&emptyResult](auto history, auto list) -> LastChatPhoto {
|
||||
|
|
|
@ -136,6 +136,8 @@ private:
|
|||
void findCurrent();
|
||||
void loadBack();
|
||||
|
||||
void generateTransparentBrush();
|
||||
|
||||
void updateCursor();
|
||||
void setZoomLevel(int newZoom);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
using "basic.style";
|
||||
using "history/history.style";
|
||||
using "media/view/mediaview.style";
|
||||
|
||||
OverviewFileLayout {
|
||||
maxWidth: pixels;
|
||||
|
|
|
@ -34,6 +34,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "application.h"
|
||||
#include "overview/overview_layout.h"
|
||||
#include "history/history_media_types.h"
|
||||
#include "history/history_service_layout.h"
|
||||
#include "media/media_audio.h"
|
||||
|
||||
// flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
|
||||
|
@ -778,8 +779,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
|||
Overview::Layout::PaintContext context(ms, _selMode);
|
||||
|
||||
if (_history->overview[_type].isEmpty() && (!_migrated || !_history->overviewLoaded(_type) || _migrated->overview[_type].isEmpty())) {
|
||||
QPoint dogPos((_width - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
|
||||
p.drawPixmap(dogPos, Window::chatBackground()->dog());
|
||||
HistoryLayout::paintEmpty(p, _width, height());
|
||||
return;
|
||||
} else if (_inSearch && _searchResults.isEmpty() && _searchFull && (!_migrated || _searchFullMigrated) && !_searchTimer.isActive()) {
|
||||
p.setFont(st::noContactsFont->f);
|
||||
|
|
|
@ -20,6 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
using "basic.style";
|
||||
|
||||
using "boxes/boxes.style";
|
||||
|
||||
featuredStickersHeader: 45px;
|
||||
featuredStickersSkip: 15px;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
#include "media/player/media_player_title_button.h"
|
||||
#include "media/player/media_player_panel.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "styles/style_window.h"
|
||||
|
||||
class TitleWidget::Hider : public TWidget {
|
||||
public:
|
||||
|
@ -126,9 +127,9 @@ void TitleWidget::paintEvent(QPaintEvent *e) {
|
|||
auto chooseText = lang(inlineSwitchChoose ? lng_inline_switch_choose : lng_forward_choose);
|
||||
p.drawText(st::titleMenuOffset - st::titleTextButton.width / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, chooseText);
|
||||
}
|
||||
p.drawSprite(st::titleIconPos, st::titleIconImg);
|
||||
st::titleIcon.paint(p, st::titleIconPosition, width());
|
||||
if (Adaptive::OneColumn() && !_counter.isNull() && App::main()) {
|
||||
p.drawPixmap(st::titleIconPos.x() + st::titleIconImg.pxWidth() - (_counter.width() / cIntRetinaFactor()), st::titleIconPos.y() + st::titleIconImg.pxHeight() - (_counter.height() / cIntRetinaFactor()), _counter);
|
||||
p.drawPixmap(st::titleCounterPosition, _counter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,11 +336,11 @@ void TitleWidget::updateCounter() {
|
|||
}
|
||||
_counter = App::pixmapFromImageInPlace(App::wnd()->iconWithCounter(size, counter, bg, false));
|
||||
_counter.setDevicePixelRatio(cRetinaFactor());
|
||||
update(QRect(st::titleIconPos, st::titleIconImg.pxSize()));
|
||||
update(QRect(st::titleCounterPosition, _counter.size() / cIntRetinaFactor()));
|
||||
} else {
|
||||
if (!_counter.isNull()) {
|
||||
update(QRect(st::titleCounterPosition, _counter.size() / cIntRetinaFactor()));
|
||||
_counter = QPixmap();
|
||||
update(QRect(st::titleIconPos, st::titleIconImg.pxSize()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +396,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) {
|
|||
int x(p.x()), y(p.y()), w(width()), h(height());
|
||||
if (!Adaptive::OneColumn() && _hider && x >= App::main()->dlgsWidth()) return HitTestType::None;
|
||||
|
||||
if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconImg.pxWidth() && y < st::titleIconPos.y() + st::titleIconImg.pxHeight()) {
|
||||
if (x >= st::titleIconPosition.x() && y >= st::titleIconPosition.y() && x < st::titleIconPosition.x() + st::titleIcon.width() && y < st::titleIconPosition.y() + st::titleIcon.height()) {
|
||||
return HitTestType::Icon;
|
||||
} else if (false
|
||||
|| (_player && _player->geometry().contains(p))
|
||||
|
@ -420,3 +421,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) {
|
|||
}
|
||||
return HitTestType::None;
|
||||
}
|
||||
|
||||
QRect TitleWidget::iconRect() const {
|
||||
return myrtlrect(QRect(st::titleIconPosition, st::titleIcon.size()));
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
void maximizedChanged(bool maximized, bool force = false);
|
||||
|
||||
HitTestType hitTest(const QPoint &p);
|
||||
QRect iconRect() const;
|
||||
|
||||
void setHideLevel(float64 level);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void MonoIcon::ensureLoaded() const {
|
|||
if (size > sizeTag.size() && !memcmp(data, sizeTag.data(), sizeTag.size())) {
|
||||
size -= sizeTag.size();
|
||||
data += sizeTag.size();
|
||||
QByteArray baForStream(reinterpret_cast<const char*>(data), size);
|
||||
auto baForStream = QByteArray::fromRawData(reinterpret_cast<const char*>(data), size);
|
||||
QBuffer buffer(&baForStream);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
|
||||
|
@ -207,7 +207,7 @@ int Icon::width() const {
|
|||
int Icon::height() const {
|
||||
if (_height < 0) {
|
||||
_height = 0;
|
||||
for_const (const auto &part, _parts) {
|
||||
for_const (auto &part, _parts) {
|
||||
accumulate_max(_height, part.offset().x() + part.height());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,9 @@ public:
|
|||
void fill(QPainter &p, const QRect &rect) const;
|
||||
int width() const;
|
||||
int height() const;
|
||||
QSize size() const {
|
||||
return QSize(width(), height());
|
||||
}
|
||||
|
||||
private:
|
||||
struct ColoredCopy {
|
||||
|
|
|
@ -41,10 +41,9 @@ void ChatBackground::initIfEmpty() {
|
|||
}
|
||||
}
|
||||
|
||||
void ChatBackground::init(int32 id, QPixmap &&image, QPixmap &&dog) {
|
||||
void ChatBackground::init(int32 id, QPixmap &&image) {
|
||||
_id = id;
|
||||
_image = std_::move(image);
|
||||
_dog = std_::move(dog);
|
||||
|
||||
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||
}
|
||||
|
@ -52,7 +51,6 @@ void ChatBackground::init(int32 id, QPixmap &&image, QPixmap &&dog) {
|
|||
void ChatBackground::reset() {
|
||||
_id = 0;
|
||||
_image = QPixmap();
|
||||
_dog = QPixmap();
|
||||
_tile = false;
|
||||
|
||||
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||
|
@ -66,10 +64,6 @@ const QPixmap &ChatBackground::image() const {
|
|||
return _image;
|
||||
}
|
||||
|
||||
const QPixmap &ChatBackground::dog() const {
|
||||
return _dog;
|
||||
}
|
||||
|
||||
bool ChatBackground::tile() const {
|
||||
return _tile;
|
||||
}
|
||||
|
|
|
@ -39,19 +39,17 @@ class ChatBackground : public base::Observable<ChatBackgroundUpdate> {
|
|||
public:
|
||||
bool empty() const;
|
||||
void initIfEmpty();
|
||||
void init(int32 id, QPixmap &&image, QPixmap &&dog);
|
||||
void init(int32 id, QPixmap &&image);
|
||||
void reset();
|
||||
|
||||
int32 id() const;
|
||||
const QPixmap &image() const;
|
||||
const QPixmap &dog() const;
|
||||
bool tile() const;
|
||||
void setTile(bool tile);
|
||||
|
||||
private:
|
||||
int32 _id = 0;
|
||||
QPixmap _image;
|
||||
QPixmap _dog;
|
||||
bool _tile = false;
|
||||
|
||||
};
|
||||
|
|
|
@ -21,6 +21,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||
|
||||
using "basic.style";
|
||||
|
||||
titleIconPosition: point(9px, 9px);
|
||||
titleIcon: icon {
|
||||
{ "title_icon_bg", #49708f },
|
||||
{ "title_icon", #ffffff, point(4px, 4px) }
|
||||
};
|
||||
titleCounterPosition: point(17px, 17px);
|
||||
|
||||
notifyBg: white;
|
||||
notifyBorder: #f1f1f1;
|
||||
notifyBorderWidth: 1px;
|
||||
|
|