diff --git a/Telegram/Resources/lang.txt b/Telegram/Resources/lang.txt index e3a010172..9f6b83a0d 100644 --- a/Telegram/Resources/lang.txt +++ b/Telegram/Resources/lang.txt @@ -161,6 +161,7 @@ lng_settings_view_emojis: "View list"; lng_settings_emoji_list: "List of supported emojis"; lng_settings_send_enter: "Send by Enter"; lng_settings_send_ctrlenter: "Send by Ctrl+Enter"; +lng_settings_send_cmdenter: "Send by Cmd+Enter"; lng_settings_cats_and_dogs: "Allow cats and dogs"; lng_download_path_dont_ask: "Don't ask download path for each file"; @@ -379,3 +380,4 @@ source code is available on [a href=\"https://github.com/telegramdesktop/tdeskto lng_about_done: "Done"; // Keys finished + diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt index 7df2b7ac3..5da0ec3f3 100644 --- a/Telegram/Resources/style.txt +++ b/Telegram/Resources/style.txt @@ -19,8 +19,9 @@ defaultFontFamily: 'Segoe UI'; //defaultFontFamily: 'ThoolikaTraditionalUnicode'; semibold: 'Segoe WP Semibold'; -spriteFile: ':/gui/art/sprite.png' / 2:':/gui/art/sprite_125x.png' / 3:':/gui/art/sprite_150x.png' / 4:':/gui/art/sprite_200x.png'; -emojisFile: ':/gui/art/emoji.png' / 2:':/gui/art/emoji_125x.png' / 3:':/gui/art/emoji_150x.png' / 4:':/gui/art/emoji_200x.png'; +spriteFile: ':/gui/art/sprite.png' / 2:':/gui/art/sprite_125x.png' / 3:':/gui/art/sprite_150x.png' / 4:':/gui/art/sprite_200x.png'; // exceptional value for retina +emojisFile: ':/gui/art/emoji.png' / 2:':/gui/art/emoji_125x.png' / 3:':/gui/art/emoji_150x.png' / 4:':/gui/art/emoji_200x.png'; // exceptional value for retina +emojiImgSize: 16px; // exceptional value for retina emojiSize: 16px; emojiPadding: 1px; diff --git a/Telegram/SourceFiles/_other/genstyles.cpp b/Telegram/SourceFiles/_other/genstyles.cpp index b2dddf68b..9c05054a4 100644 --- a/Telegram/SourceFiles/_other/genstyles.cpp +++ b/Telegram/SourceFiles/_other/genstyles.cpp @@ -60,7 +60,7 @@ string outputTypeNames[] = { "color", "point", "rect", - "rect", + "sprite", "size", "transition", "cursor", @@ -1302,7 +1302,11 @@ string prepareObject(const string &cls, Fields fields, const string &obj, int va } else if (f.value().first != j.value()) { throw Exception(QString("Bad type of field %1 while parsing %2").arg(j.key().c_str()).arg(obj.c_str())); } else { - result += findScalarVariant(f.value().second, variant); + if (variant == -1) { // retina + result += findScalarVariant(f.value().second, (j.value() == scSprite) ? 4 : 0); + } else { + result += findScalarVariant(f.value().second, variant); + } } fields.erase(f); if (++j != e) { @@ -1518,7 +1522,7 @@ GNU General Public License for more details.\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Copyright (c) 2014 John Preston, https://tdesktop.com\n\ */\n"; - tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\n"; + tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n"; for (int i = 0, l = scalars.size(); i < l; ++i) { Scalar &sc(scalars[i]); tout << "\textern const style::" << outputTypeNames[sc.second.first].c_str() << " &" << sc.first.c_str() << ";\n"; @@ -1531,7 +1535,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\ tout << "\textern const style::" << obj.second.first.c_str() << " &" << obj.first.c_str() << ";\n"; tcpp << "\tstyle::" << obj.second.first.c_str() << " _" << obj.first.c_str() << prepareObject(obj.second.first, obj.second.second, obj.first, variant).c_str() << ";\n"; } - tout << "\n};\n"; + tout << "};\n"; + tcpp << "};\n"; tcpp << "\nnamespace st {\n"; for (int i = 0, l = scalars.size(); i < l; ++i) { @@ -1543,15 +1548,33 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\ Object &obj(objects[i]); tcpp << "\tconst style::" << obj.second.first.c_str() << " &" << obj.first.c_str() << "(_" << obj.first.c_str() << ");\n"; } - tcpp << "\n};\n"; + tcpp << "};\n"; tcpp << "\nnamespace style {\n\n"; tcpp << "\tFontFamilies _fontFamilies;\n"; tcpp << "\tFontDatas _fontsMap;\n"; tcpp << "\tColorDatas _colorsMap;\n\n"; tcpp << "\tvoid startManager() {\n"; - - tcpp << "\n\t\tswitch (cScale()) {\n\n"; + + tcpp << "\n\t\tif (cRetina()) {\n"; + tcpp << "\t\t\tcSetRealScale(dbisOne);\n\n"; + for (int i = 0, l = scalars.size(); i < l; ++i) { + Scalar &sc(scalars[i]); + if (sc.second.first == scSprite || sc.first == "spriteFile" || sc.first == "emojisFile" || sc.first == "emojiImgSize") { + string v = findScalarVariant(sc.second.second, 4); + if (v != findScalarVariant(sc.second.second, 0)) { + tcpp << "\t\t\t_" << sc.first.c_str() << " = style::" << outputTypeNames[sc.second.first].c_str() << v.c_str() << ";\n"; + } + } + } + for (int i = 0, l = objects.size(); i < l; ++i) { + Object &obj(objects[i]); + string v = prepareObject(obj.second.first, obj.second.second, obj.first, -1); // retina + if (v != prepareObject(obj.second.first, obj.second.second, obj.first, 0)) { + tcpp << "\t\t\t_" << obj.first.c_str() << " = style::" << obj.second.first.c_str() << v.c_str() << ";\n"; + } + } + tcpp << "\t\t} else switch (cScale()) {\n\n"; for (int i = 1; i < variantsCount; ++i) { variant = variants[i]; const char *varName = variantNames[i]; diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 6cb8f499e..2a240a0c9 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1204,9 +1204,11 @@ namespace App { if (!::sprite) { ::sprite = new QPixmap(st::spriteFile); + if (cRetina()) ::sprite->setDevicePixelRatio(cRetinaFactor()); } if (!::emojis) { ::emojis = new QPixmap(st::emojisFile); + if (cRetina()) ::emojis->setDevicePixelRatio(cRetinaFactor()); } initEmoji(); } @@ -1300,12 +1302,13 @@ namespace App { EmojisMap *map = &(fontHeight == st::taDefFlat.font->height ? mainEmojisMap : otherEmojisMap[fontHeight]); EmojisMap::const_iterator i = map->constFind(emoji->code); if (i == map->cend()) { - QImage img(st::emojiSize + st::emojiPadding * 2, fontHeight, QImage::Format_ARGB32_Premultiplied); + QImage img(st::emojiImgSize + st::emojiPadding * cIntRetinaFactor() * 2, fontHeight * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + if (cRetina()) img.setDevicePixelRatio(cRetinaFactor()); { QPainter p(&img); p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); - p.drawPixmap(QPoint(st::emojiPadding, (fontHeight - st::emojiSize) / 2), App::emojis(), QRect(emoji->x, emoji->y, st::emojiSize, st::emojiSize)); + p.drawPixmap(QPoint(st::emojiPadding * cIntRetinaFactor(), (fontHeight * cIntRetinaFactor() - st::emojiImgSize) / 2), App::emojis(), QRect(emoji->x, emoji->y, st::emojiImgSize, st::emojiImgSize)); } i = map->insert(emoji->code, QPixmap::fromImage(img)); } diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 60309b673..f902fc4cb 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -82,9 +82,10 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv), installEventFilter(new _DebugWaiter(this)); QFontDatabase::addApplicationFont(qsl(":/gui/art/segoe_ui.ttf")); + QFontDatabase::addApplicationFont(qsl(":/gui/art/segoeuib.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/segoe_ui_semibold.ttf")); - QFontDatabase::addApplicationFont(qsl(":/gui/art/segoe_wp_semibold.ttf")); - QFontDatabase::addApplicationFont(qsl(":/gui/art/ThoolikaTrditionalUnicode.ttf")); + QFontDatabase::addApplicationFont(qsl(":/gui/art/segoe_wp_semibold.ttf")); +// QFontDatabase::addApplicationFont(qsl(":/gui/art/ThoolikaTrditionalUnicode.ttf")); float64 dpi = primaryScreen()->logicalDotsPerInch(); if (dpi <= 108) { // 0-96-108 @@ -97,6 +98,12 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv), cSetScreenScale(dbisTwo); } + if (devicePixelRatio() > 1) { + cSetRetina(true); + cSetRetinaFactor(devicePixelRatio()); + cSetIntRetinaFactor(int32(cRetinaFactor())); + } + if (!cLangFile().isEmpty()) { LangLoaderPlain loader(cLangFile()); if (!loader.errors().isEmpty()) { @@ -498,10 +505,6 @@ void Application::startApp() { App::writeUserConfig(); cSetNeedConfigResave(false); } - if (devicePixelRatio() > 1) { - cSetRetina(true); - cSetRetinaFactor(devicePixelRatio()); - } window->createWinId(); window->init(); diff --git a/Telegram/SourceFiles/art/grid.png b/Telegram/SourceFiles/art/grid.png index b886b374d..07ab30f8b 100644 Binary files a/Telegram/SourceFiles/art/grid.png and b/Telegram/SourceFiles/art/grid.png differ diff --git a/Telegram/SourceFiles/art/grid_125x.png b/Telegram/SourceFiles/art/grid_125x.png index 40409c8b8..96ebd1ef0 100644 Binary files a/Telegram/SourceFiles/art/grid_125x.png and b/Telegram/SourceFiles/art/grid_125x.png differ diff --git a/Telegram/SourceFiles/art/grid_150x.png b/Telegram/SourceFiles/art/grid_150x.png index ceaa29ce4..f8a9436d3 100644 Binary files a/Telegram/SourceFiles/art/grid_150x.png and b/Telegram/SourceFiles/art/grid_150x.png differ diff --git a/Telegram/SourceFiles/art/grid_200x.png b/Telegram/SourceFiles/art/grid_200x.png index 2316f49f3..6ec78ce5f 100644 Binary files a/Telegram/SourceFiles/art/grid_200x.png and b/Telegram/SourceFiles/art/grid_200x.png differ diff --git a/Telegram/SourceFiles/art/segoeuib.ttf b/Telegram/SourceFiles/art/segoeuib.ttf new file mode 100644 index 000000000..aea25424d Binary files /dev/null and b/Telegram/SourceFiles/art/segoeuib.ttf differ diff --git a/Telegram/SourceFiles/art/sprite_125x.png b/Telegram/SourceFiles/art/sprite_125x.png index ddac976c6..abebece00 100644 Binary files a/Telegram/SourceFiles/art/sprite_125x.png and b/Telegram/SourceFiles/art/sprite_125x.png differ diff --git a/Telegram/SourceFiles/art/sprite_150x.png b/Telegram/SourceFiles/art/sprite_150x.png index 5e9e4ab3a..3e4fa0109 100644 Binary files a/Telegram/SourceFiles/art/sprite_150x.png and b/Telegram/SourceFiles/art/sprite_150x.png differ diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 81e107af3..55d438b9e 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -80,7 +80,7 @@ void AboutBox::paintEvent(QPaintEvent *e) { // fill bg p.fillRect(0, 0, _width, _height, st::boxBG->b); - p.drawPixmap(QPoint((_width - st::aboutIcon.width()) / 2, st::aboutIconTop), App::sprite(), st::aboutIcon); + p.drawPixmap(QPoint((_width - st::aboutIcon.pxWidth()) / 2, st::aboutIconTop), App::sprite(), st::aboutIcon); p.setPen(st::black->p); p.setFont(st::aboutHeaderFont->f); diff --git a/Telegram/SourceFiles/boxes/addparticipantbox.cpp b/Telegram/SourceFiles/boxes/addparticipantbox.cpp index 9a6cf34c4..9a493f7ef 100644 --- a/Telegram/SourceFiles/boxes/addparticipantbox.cpp +++ b/Telegram/SourceFiles/boxes/addparticipantbox.cpp @@ -151,7 +151,7 @@ void AddParticipantInner::paintDialog(QPainter &p, DialogRow *row, bool sel) { data->name.drawElided(p, left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListNameTop, width() - st::participantDelta - st::profileListPadding.width() * 2 - st::profileListPhotoSize - st::profileListPadding.width() * 2); if (sel || data->check) { - p.drawPixmap(QPoint(width() - st::profileCheckRect.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.height()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect)); + p.drawPixmap(QPoint(width() - st::profileCheckRect.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect)); } p.setFont(st::profileSubFont->f); diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 871583cd2..07ce2c443 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -121,10 +121,10 @@ void ContactsInner::paintDialog(QPainter &p, DialogRow *row, bool sel) { p.drawPixmap(left, st::profileListPadding.height(), user->photo->pix(st::profileListPhotoSize)); p.setPen(st::profileListNameColor->p); - data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::contactsImg.width()); + data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::contactsImg.pxWidth()); if (sel) { - p.drawPixmap(QPoint(width() - st::contactsImg.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::contactsImg.height()) / 2 - st::profileCheckDeltaY), App::sprite(), st::contactsImg); + p.drawPixmap(QPoint(width() - st::contactsImg.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::contactsImg.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), st::contactsImg); } p.setFont(st::profileSubFont->f); diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp index 6f5312d2a..133d79ddc 100644 --- a/Telegram/SourceFiles/boxes/emojibox.cpp +++ b/Telegram/SourceFiles/boxes/emojibox.cpp @@ -150,7 +150,7 @@ void EmojiBox::paintEvent(QPaintEvent *e) { for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) { if (j->emoji) { QPoint pos(left + (st::emojiReplaceWidth - st::emojiSize) / 2, top + (st::emojiReplaceHeight - _blockHeight) / 2); - p.drawPixmap(pos, App::emojis(), QRect(j->emoji->x, j->emoji->y, st::emojiSize, st::emojiSize)); + p.drawPixmap(pos, App::emojis(), QRect(j->emoji->x, j->emoji->y, st::emojiImgSize, st::emojiImgSize)); } QRect trect(left, top + (st::emojiReplaceHeight + _blockHeight) / 2 - st::emojiTextFont->height, st::emojiReplaceWidth, st::emojiTextFont->height); p.drawText(trect, j->text, QTextOption(Qt::AlignHCenter | Qt::AlignTop)); diff --git a/Telegram/SourceFiles/boxes/newgroupbox.cpp b/Telegram/SourceFiles/boxes/newgroupbox.cpp index bc664fd8b..5fa27274d 100644 --- a/Telegram/SourceFiles/boxes/newgroupbox.cpp +++ b/Telegram/SourceFiles/boxes/newgroupbox.cpp @@ -129,10 +129,10 @@ void NewGroupInner::paintDialog(QPainter &p, DialogRow *row, bool sel) { } else { p.setPen(st::profileListNameColor->p); } - data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::profileCheckRect.width()); + data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::profileCheckRect.pxWidth()); if (sel || data->check) { - p.drawPixmap(QPoint(width() - st::profileCheckRect.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.height()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect)); + p.drawPixmap(QPoint(width() - st::profileCheckRect.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect)); } p.setFont(st::profileSubFont->f); diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index 039d01620..ba8773790 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -348,7 +348,7 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) { p.drawRoundedRect(QRect(w, st::emojiPanSize), st::emojiPanRound, st::emojiPanRound); p.setOpacity(1); } - QRect r(_emojis[index]->x, _emojis[index]->y, st::emojiSize, st::emojiSize); + QRect r(_emojis[index]->x, _emojis[index]->y, st::emojiImgSize, st::emojiImgSize); p.drawPixmap(w + QPoint((st::emojiPanSize.width() - st::emojiSize) / 2, (st::emojiPanSize.height() - st::emojiSize) / 2), App::emojis(), r); } } diff --git a/Telegram/SourceFiles/gui/boxshadow.cpp b/Telegram/SourceFiles/gui/boxshadow.cpp index c3751bb13..245c8e514 100644 --- a/Telegram/SourceFiles/gui/boxshadow.cpp +++ b/Telegram/SourceFiles/gui/boxshadow.cpp @@ -19,7 +19,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "boxshadow.h" -BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width()) { +BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width() / cIntRetinaFactor()) { QImage cornersImage(_size * 2, _size * 2, QImage::Format_ARGB32_Premultiplied); { QPainter p(&cornersImage); diff --git a/Telegram/SourceFiles/gui/emoji_config.cpp b/Telegram/SourceFiles/gui/emoji_config.cpp index 8d313f193..7c067590b 100644 --- a/Telegram/SourceFiles/gui/emoji_config.cpp +++ b/Telegram/SourceFiles/gui/emoji_config.cpp @@ -26,7 +26,9 @@ namespace { void initEmoji() { EmojiData *toFill = emojis = (EmojiData*)emojisData; - switch (cScale()) { + DBIScale emojiForScale = cRetina() ? dbisTwo : cScale(); + + switch (emojiForScale) { case dbisOne: new (toFill++) EmojiData(176, 0, 169, 0, 1); diff --git a/Telegram/SourceFiles/gui/flatcheckbox.cpp b/Telegram/SourceFiles/gui/flatcheckbox.cpp index bf3a538b8..9382c0c05 100644 --- a/Telegram/SourceFiles/gui/flatcheckbox.cpp +++ b/Telegram/SourceFiles/gui/flatcheckbox.cpp @@ -28,7 +28,7 @@ FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, c setCursor(_st.cursor); int32 w = _st.width, h = _st.height; if (w <= 0) w = _st.textLeft + _st.font->m.width(_text) + 1; - if (h <= 0) h = qMax(_st.font->height, _st.imageRect.height()); + if (h <= 0) h = qMax(_st.font->height, _st.imageRect.pxHeight()); resize(QSize(w, h)); } diff --git a/Telegram/SourceFiles/gui/flatinput.cpp b/Telegram/SourceFiles/gui/flatinput.cpp index 9b6fb08eb..ab7851322 100644 --- a/Telegram/SourceFiles/gui/flatinput.cpp +++ b/Telegram/SourceFiles/gui/flatinput.cpp @@ -134,7 +134,7 @@ void FlatInput::paintEvent(QPaintEvent *e) { p.drawRect(i, i, width() - 2 * i - 1, height() - 2 * i - 1); } } - if (_st.imgRect.width()) { + if (_st.imgRect.pxWidth()) { p.drawPixmap(_st.imgPos, App::sprite(), _st.imgRect); } diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp index b9e807cad..6c0785ae8 100644 --- a/Telegram/SourceFiles/gui/images.cpp +++ b/Telegram/SourceFiles/gui/images.cpp @@ -60,18 +60,16 @@ const QPixmap &Image::pix(int32 w, int32 h) const { checkload(); if (w <= 0 || !width() || !height()) { - w = width() * cRetinaFactor(); + w = width() * cIntRetinaFactor(); } else if (cRetina()) { - w *= cRetinaFactor(); - h *= cRetinaFactor(); + w *= cIntRetinaFactor(); + h *= cIntRetinaFactor(); } uint64 k = (uint64(w) << 32) | uint64(h); Sizes::const_iterator i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { QPixmap p(pixNoCache(w, h, true)); - if (cRetina()) { - p.setDevicePixelRatio(cRetinaFactor()); - } + if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { globalAquiredSize += int64(p.width()) * p.height() * 4; diff --git a/Telegram/SourceFiles/gui/style_core.h b/Telegram/SourceFiles/gui/style_core.h index 746009829..3148f13e1 100644 --- a/Telegram/SourceFiles/gui/style_core.h +++ b/Telegram/SourceFiles/gui/style_core.h @@ -200,6 +200,32 @@ inline bool operator!=(const Font &a, const Font &b) { typedef float64 number; typedef QString string; typedef QRect rect; + class sprite : public rect { + public: + sprite() { + } + sprite(int left, int top, int width, int height) : rect(left, top, width, height) { + } + inline int pxWidth() const { + return rect::width() / cIntRetinaFactor(); + } + inline int pxHeight() const { + return rect::height() / cIntRetinaFactor(); + } + inline QSize pxSize() const { + return rect::size() / cIntRetinaFactor(); + } + private: + inline int width() const { + return rect::width(); + } + inline int height() const { + return rect::height(); + } + inline QSize size() const { + return rect::size(); + } + }; typedef QPoint point; typedef QSize size; typedef anim::transition transition; diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index 75666f256..6f5b71f1f 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -1405,7 +1405,7 @@ public: } } } - _p->drawPixmap(QPoint((glyphX + int(st::emojiPadding)).toInt(), _y + _yDelta + emojiY), App::emojis(), QRect(static_cast(currentBlock)->emoji->x, static_cast(currentBlock)->emoji->y, st::emojiSize, st::emojiSize)); + _p->drawPixmap(QPoint((glyphX + int(st::emojiPadding)).toInt(), _y + _yDelta + emojiY), App::emojis(), QRect(static_cast(currentBlock)->emoji->x, static_cast(currentBlock)->emoji->y, st::emojiImgSize, st::emojiImgSize)); // } else if (_p && currentBlock->type() == TextBlockSkip) { // debug // _p->fillRect(QRect(x.toInt(), _y, currentBlock->width(), static_cast(currentBlock)->height()), QColor(0, 0, 0, 32)); } diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h index d547dfef9..20a0bb765 100644 --- a/Telegram/SourceFiles/gui/text.h +++ b/Telegram/SourceFiles/gui/text.h @@ -18,7 +18,6 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #pragma once #include "gui/emoji_config.h" -#include "gui/style_core.h" #include "../../../QtStatic/qtbase/src/gui/text/qfontengine_p.h" diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 2f176661e..29941ab06 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1522,7 +1522,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, const QString &t int32 dateX = _maxw - timeWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); int32 dateY = _height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; if (parent->out()) { - dateX -= st::msgCheckRect.width() + st::msgDateImgCheckSpace; + dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace; } int32 dateW = _maxw - dateX - st::msgDateImgDelta; int32 dateH = _height - dateY - st::msgDateImgDelta; @@ -1532,7 +1532,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, const QString &t p.setPen(st::msgDateImgColor->p); p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time); if (out) { - QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.width(), dateY + (dateH - st::msgCheckRect.height()) / 2); + QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2); const QRect *iconRect; if (parent->id > 0) { if (parent->unread()) { @@ -1735,7 +1735,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -1775,7 +1775,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); if (out) { - QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height()); + QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; if (parent->id > 0) { if (parent->unread()) { @@ -1857,7 +1857,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, const QString &t int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -1897,7 +1897,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, const QString &t p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); if (out) { - QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height()); + QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; if (parent->id > 0) { if (parent->unread()) { @@ -2048,7 +2048,8 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString p.fillRect(0, _height, width, st::msgShadow, shadow->b); if (_thumbw) { - p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx, _thumby, st::mediaThumbSize, st::mediaThumbSize)); + int32 rf(cIntRetinaFactor()); + p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx * rf, _thumby * rf, st::mediaThumbSize * rf, st::mediaThumbSize * rf)); } else { p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), (out ? st::mediaDocOutImg : st::mediaDocInImg)); } @@ -2058,7 +2059,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -2102,7 +2103,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); if (out) { - QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height()); + QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; if (parent->id > 0) { if (parent->unread()) { @@ -2197,7 +2198,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &first, const QString void HistoryContact::initDimensions(const HistoryItem *parent, int32 timeWidth) { int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); - int32 fullTimeWidth = timeWidth + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = timeWidth + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); if (name.maxWidth() + tleft + fullTimeWidth > _maxw) { _maxw = name.maxWidth() + tleft + fullTimeWidth; } @@ -2256,7 +2257,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -2279,7 +2280,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); if (out) { - QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height()); + QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; if (parent->id > 0) { if (parent->unread()) { @@ -2383,7 +2384,7 @@ void HistoryMessage::initDimensions(const QString &text) { _maxw = media->maxWidth(); _minh = media->height(); } else { - timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) - st::msgDateDelta.x(); + timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x(); _text.setText(st::msgFont, text + textcmdSkipBlock(timeWidth, st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions); _maxw = _text.maxWidth(); _minh = _text.minHeight(); @@ -2470,7 +2471,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const { p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - timeWidth + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); if (_out) { - QPoint iconPos(r.right() + 5 - st::msgPadding.right() - st::msgCheckRect.width(), r.bottom() + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height()); + QPoint iconPos(r.right() + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), r.bottom() + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; if (id > 0) { if (unread()) { diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 647484984..5728114fc 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -72,7 +72,7 @@ void HistoryList::paintEvent(QPaintEvent *e) { } if (hist->isEmpty()) { - QPoint dogPos((width() - st::msgDogImg.width()) / 2, ((height() - st::msgDogImg.height()) * 4) / 9); + QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9); p.drawPixmap(dogPos, App::sprite(), st::msgDogImg); } else { adjustCurrent(r.top()); @@ -1746,20 +1746,7 @@ void HistoryWidget::historyToDown(History *history) { } void HistoryWidget::historyWasRead(bool force) { - if (histReadRequestId || !hist || !force && (!hist->unreadCount || !hist->unreadLoaded)) return; - hist->inboxRead(true); - histReadRequestId = MTP::send(MTPmessages_ReadHistory(histPeer->input, MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::partWasRead, histPeer)); -} - -void HistoryWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result) { - const MTPDmessages_affectedHistory &d(result.c_messages_affectedHistory()); - App::main()->updUpdated(d.vpts.v, 0, 0, d.vseq.v); - - histReadRequestId = 0; - int32 offset = d.voffset.v; - if (!MTP::authedId() || offset <= 0) return; - - histReadRequestId = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset)), rpcDone(&HistoryWidget::partWasRead, peer)); + App::main()->readServerHistory(hist, force); } bool HistoryWidget::messagesFailed(const RPCError &e, mtpRequestId requestId) { @@ -1906,9 +1893,7 @@ void HistoryWidget::onVisibleChanged() { QTimer::singleShot(0, this, SLOT(onListScroll())); } -QString HistoryWidget::prepareMessage() { - QString result = _field.getText(); - +QString HistoryWidget::prepareMessage(QString result) { result = result.replace('\t', qsl(" ")); result = result.replace(" --", QString::fromUtf8(" \xe2\x80\x94")); @@ -1922,7 +1907,7 @@ QString HistoryWidget::prepareMessage() { void HistoryWidget::onSend() { if (!hist) return; - QString text = prepareMessage(); + QString text = prepareMessage(_field.getText()); if (!text.isEmpty()) { MsgId newId = clientMsgId(); uint64 randomId = MTP::nonce(); @@ -2314,7 +2299,7 @@ void HistoryWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth) if (!decreaseWidth) { p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over); - p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.width()) / 2, (st::topBarHeight - st::topBarForwardImg.height()) / 2), App::sprite(), st::topBarForwardImg); + p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarForwardImg.pxHeight()) / 2), App::sprite(), st::topBarForwardImg); } } @@ -2790,11 +2775,11 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { p.fillRect(0, _field.y() - st::sendPadding, width(), _field.height() + 2 * st::sendPadding, st::taMsgField.bgColor->b); } } else { - QPoint dogPos((width() - st::msgDogImg.width()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.height()) * 4) / 9); + QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9); p.drawPixmap(dogPos, App::sprite(), st::msgDogImg); int32 pointsCount = 8, w = pointsCount * (st::introPointWidth + 2 * st::introPointDelta), h = st::introPointHeight; - int32 pointsLeft = (width() - w) / 2 + st::introPointDelta - st::introPointLeft, pointsTop = dogPos.y() + (st::msgDogImg.height() * 6) / 5; + int32 pointsLeft = (width() - w) / 2 + st::introPointDelta - st::introPointLeft, pointsTop = dogPos.y() + (st::msgDogImg.pxHeight() * 6) / 5; int32 curPoint = histRequestsCount % pointsCount; diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 017d91058..363e8589b 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -311,6 +311,8 @@ public: void noSelectingScroll(); bool touchScroll(const QPoint &delta); + + QString prepareMessage(QString text); ~HistoryWidget(); @@ -365,7 +367,6 @@ public slots: private: bool messagesFailed(const RPCError &error, mtpRequestId requestId); - void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result); void updateListSize(int32 addToY = 0, bool initial = false); void addMessagesToFront(const QVector &messages); void chatLoaded(const MTPmessages_ChatFull &res); @@ -375,8 +376,6 @@ private: void updateDragAreas(); - QString prepareMessage(); - int32 histOffset, histCount, histReadRequestId; int32 histRequestsCount; PeerData *histPeer, *_activePeer; diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp index 9b597eb4d..29986a1be 100644 --- a/Telegram/SourceFiles/intro/introsignup.cpp +++ b/Telegram/SourceFiles/intro/introsignup.cpp @@ -124,7 +124,7 @@ void IntroSignup::paintEvent(QPaintEvent *e) { void IntroSignup::resizeEvent(QResizeEvent *e) { textRect = QRect((width() - st::introTextSize.width()) / 2, 0, st::introTextSize.width(), st::introTextSize.height()); - _phLeft = (width() - st::setPhotoImg.width()) / 2; + _phLeft = (width() - st::setPhotoImg.pxWidth()) / 2; _phTop = st::introHeaderFont->height + st::introFinishSkip; if (e->oldSize().width() != width()) { int sumNext = st::btnIntroNext.width - st::btnIntroBack.width - st::btnIntroSep; @@ -132,7 +132,7 @@ void IntroSignup::resizeEvent(QResizeEvent *e) { } if (e->oldSize().width() != width()) { next.move((width() - next.width()) / 2, st::introSize.height() - st::btnIntroNext.height); - first.move((width() - first.width()) / 2, _phTop + st::setPhotoImg.height() + st::introFinishSkip); + first.move((width() - first.width()) / 2, _phTop + st::setPhotoImg.pxHeight() + st::introFinishSkip); last.move((width() - last.width()) / 2, first.y() + first.height() + st::introFinishSkip); } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 51177d996..457d2bda5 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -496,16 +496,52 @@ void MainWidget::clearSelectedItems() { history.onClearSelected(); } -QRect MainWidget::rectForTitleAnim() const { - int w = width(); - w -= history.x() + st::sysBtnDelta * 2 + st::sysCls.img.width() + st::sysRes.img.width() + st::sysMin.img.width(); - return QRect(history.x(), 0, w, App::wnd()->getTitle()->height()); -} - DialogsIndexed &MainWidget::contactsList() { return dialogs.contactsList(); } +void MainWidget::sendMessage(History *hist, const QString &text) { + readServerHistory(hist); + QString msg = history.prepareMessage(text); + if (!msg.isEmpty()) { + MsgId newId = clientMsgId(); + uint64 randomId = MTP::nonce(); + + App::historyRegRandom(randomId, newId); + + MTPstring msgText(MTP_string(msg)); + hist->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty())); + historyToDown(hist); + if (history.peer() == hist->peer) { + history.peerMessagesUpdated(); + } + + MTP::send(MTPmessages_SendMessage(hist->peer->input, msgText, MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId)); + } +} + +void MainWidget::readServerHistory(History *hist, bool force) { + if (!hist || (!force && (!hist->unreadCount || !hist->unreadLoaded))) return; + + ReadRequests::const_iterator i = _readRequests.constFind(hist->peer); + if (i == _readRequests.cend()) { + hist->inboxRead(true); + _readRequests.insert(hist->peer, MTP::send(MTPmessages_ReadHistory(hist->peer->input, MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::partWasRead, hist->peer))); + } +} + +void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result) { + const MTPDmessages_affectedHistory &d(result.c_messages_affectedHistory()); + App::main()->updUpdated(d.vpts.v, 0, 0, d.vseq.v); + + int32 offset = d.voffset.v; + if (!MTP::authedId() || offset <= 0) { + _readRequests.remove(peer); + } else { + _readRequests[peer] = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset)), rpcDone(&MainWidget::partWasRead, peer)); + } +} + void MainWidget::videoLoadProgress(mtpFileLoader *loader) { VideoData *video = App::video(loader->objId()); if (video->loader) { @@ -619,7 +655,7 @@ void MainWidget::onParentResize(const QSize &newSize) { } void MainWidget::updateOnlineDisplay() { - history.updateOnlineDisplay(history.x(), width() - history.x() - st::sysBtnDelta * 2 - st::sysCls.img.width() - st::sysRes.img.width() - st::sysMin.img.width()); + history.updateOnlineDisplay(history.x(), width() - history.x() - st::sysBtnDelta * 2 - st::sysCls.img.pxWidth() - st::sysRes.img.pxWidth() - st::sysMin.img.pxWidth()); if (profile) profile->updateOnlineDisplay(); if (App::wnd()->settingsWidget()) App::wnd()->settingsWidget()->updateOnlineDisplay(); } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 5a2b80a27..dc7d85db3 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -187,9 +187,11 @@ public: void deleteSelectedItems(); void clearSelectedItems(); - QRect rectForTitleAnim() const; - DialogsIndexed &contactsList(); + + void sendMessage(History *history, const QString &text); + + void readServerHistory(History *history, bool force = true); ~MainWidget(); @@ -233,6 +235,8 @@ public slots: private: + void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result); + uint64 failedObjId; QString failedFileName; void loadFailed(mtpFileLoader *loader, bool started, const char *retrySlot); @@ -278,4 +282,7 @@ private: QSet updateNotifySettingPeers; QTimer updateNotifySettingTimer; + + typedef QMap ReadRequests; + ReadRequests _readRequests; }; diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index e0eac83d4..cb5769ac8 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -761,10 +761,10 @@ void ProfileWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth) p.drawPixmap(a_coord.current(), 0, _animTopBarCache); } else { p.setOpacity(st::topBarBackAlpha + (1 - st::topBarBackAlpha) * over); - p.drawPixmap(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.height()) / 2), App::sprite(), st::topBarBackImg); + p.drawPixmap(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.pxHeight()) / 2), App::sprite(), st::topBarBackImg); p.setFont(st::topBarBackFont->f); p.setPen(st::topBarBackColor->p); - p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.width() + st::topBarBackPadding.right(), (st::topBarHeight - st::titleFont->height) / 2 + st::titleFont->ascent, lang(peer()->chat ? lng_profile_group_info : lng_profile_info)); + p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.pxWidth() + st::topBarBackPadding.right(), (st::topBarHeight - st::titleFont->height) / 2 + st::titleFont->ascent, lang(peer()->chat ? lng_profile_group_info : lng_profile_info)); } } diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 43c76d461..9f0cde452 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -112,7 +112,9 @@ void MacPrivate::notifyClicked(unsigned long long peer) { } void MacPrivate::notifyReplied(unsigned long long peer, const char *str) { + History *history = App::history(PeerId(peer)); + App::main()->sendMessage(history, QString::fromUtf8(str)); } PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent), @@ -283,7 +285,7 @@ void PsMainWindow::psInitFrameless() { connect(&psUpdatedPositionTimer, SIGNAL(timeout()), this, SLOT(psSavePosition())); if (frameless) { -// setWindowFlags(Qt::FramelessWindowHint); + //setWindowFlags(Qt::FramelessWindowHint); } connect(windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(psStateChanged(Qt::WindowState))); @@ -348,6 +350,7 @@ void PsMainWindow::psFirstShow() { bool showShadows = true; show(); + _private.enableShadow(winId()); if (cWindowPos().maximized) { setWindowState(Qt::WindowMaximized); } @@ -371,7 +374,7 @@ void PsMainWindow::psFirstShow() { } bool PsMainWindow::psHandleTitle() { - return true; + return false; } void PsMainWindow::psInitSysMenu() { @@ -685,10 +688,8 @@ PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(it alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), aY(y + st::notifyHeight + st::notifyDeltaY), close(this, st::notifyClose), aOpacityFunc(st::notifyFastAnimFunc) { int32 w = st::notifyWidth, h = st::notifyHeight; - QImage img(w * cRetinaFactor(), h * cRetinaFactor(), QImage::Format_ARGB32_Premultiplied); - if (cRetina()) { - img.setDevicePixelRatio(cRetinaFactor()); - } + QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + if (cRetina()) img.setDevicePixelRatio(cRetinaFactor()); img.fill(st::notifyBG->c); { diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h index 0e822470f..640a10957 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.h +++ b/Telegram/SourceFiles/pspecific_mac_p.h @@ -32,6 +32,8 @@ public: void activateWnd(WId winId); void showNotify(unsigned long long peer, const char *utf8title, const char *subtitle, const char *utf8msg); void clearNotifies(unsigned long long peer = 0); + + void enableShadow(WId winId); virtual void activeSpaceChanged() { } diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index c5828bb15..0d3532bc0 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -57,7 +57,9 @@ public: } void onNotifyReply(NSUserNotification *notification) { -// notification.response + NSNumber *peerObj = [[notification userInfo] objectForKey:@"peer"]; + unsigned long long peerLong = [peerObj unsignedLongLongValue]; + wnd->notifyReplied(peerLong, [[[notification response] string] UTF8String]); } ~PsMacWindowData() { @@ -165,7 +167,7 @@ void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8tit [notification setInformativeText:msg]; [msg release]; -// [notification setHasReplyButton:YES]; + [notification setHasReplyButton:YES]; [notification setSoundName:nil]; @@ -175,6 +177,11 @@ void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8tit [notification release]; } +void PsMacWindowPrivate::enableShadow(WId winId) { +// [[(NSView*)winId window] setStyleMask:NSBorderlessWindowMask]; +// [[(NSView*)winId window] setHasShadow:YES]; +} + void PsMacWindowPrivate::clearNotifies(unsigned long long peer) { NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; if (peer) { diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index c9e24dcb1..33db92f11 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -67,6 +67,7 @@ QString gLangFile; bool gRetina = false; float64 gRetinaFactor = 1.; +int32 gIntRetinaFactor = 1; bool gCustomNotifies = false; #ifdef Q_OS_WIN diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index d69ae3df2..b0a1dd748 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -132,6 +132,7 @@ DeclareReadSetting(QString, LangFile); DeclareSetting(bool, Retina); DeclareSetting(float64, RetinaFactor); +DeclareSetting(int32, IntRetinaFactor); DeclareSetting(bool, CustomNotifies); DeclareReadSetting(DBIPlatform, Platform); diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index 78da9d64b..8b27ee368 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -32,7 +32,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com Slider::Slider(QWidget *parent, const style::slider &st, int32 count, int32 sel) : QWidget(parent), _count(count), _sel(snap(sel, 0, _count)), _wasSel(_sel), _st(st), _pressed(false) { - resize(_st.width, _st.bar.height()); + resize(_st.width, _st.bar.pxHeight()); setCursor(style::cur_pointer); } @@ -43,7 +43,7 @@ void Slider::mousePressEvent(QMouseEvent *e) { void Slider::mouseMoveEvent(QMouseEvent *e) { if (_pressed) { - int32 newSel = snap(qRound((_count - 1) * float64(e->pos().x() - _st.bar.width() / 2) / (width() - _st.bar.width())), 0, _count - 1); + int32 newSel = snap(qRound((_count - 1) * float64(e->pos().x() - _st.bar.pxWidth() / 2) / (width() - _st.bar.pxWidth())), 0, _count - 1); if (newSel != _sel) { _sel = newSel; update(); @@ -81,7 +81,7 @@ void Slider::paintEvent(QPaintEvent *e) { p.drawLine(0, i, width() - 1, i); } - int32 x = qFloor(_sel * float64(width() - _st.bar.width()) / (_count - 1)), y = (height() - _st.bar.height()) / 2; + int32 x = qFloor(_sel * float64(width() - _st.bar.pxWidth()) / (_count - 1)), y = (height() - _st.bar.pxHeight()) / 2; p.drawPixmap(QPoint(x, y), App::sprite(), _st.bar); } @@ -135,7 +135,7 @@ SettingsInner::SettingsInner(Settings *parent) : QWidget(parent), _viewEmojis(this, lang(lng_settings_view_emojis)), _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()), - _ctrlEnterSend(this, qsl("send_key"), 1, lang(lng_settings_send_ctrlenter), cCtrlEnter()), +_ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))), _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()), @@ -345,36 +345,40 @@ void SettingsInner::paintEvent(QPaintEvent *e) { p.drawText(_left + st::setVersionLeft, top + st::setVersionTop + st::linkFont->ascent, textToDraw); top += st::setVersionHeight; - top += _workmodeTray.height() + st::setLittleSkip; - top += _workmodeWindow.height() + st::setSectionSkip; - - top += _autoStart.height() + st::setLittleSkip; - top += _startMinimized.height(); - - p.setFont(st::setHeaderFont->f); - p.setPen(st::setHeaderColor->p); - p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_scale_label)); - top += st::setHeaderSkip; - top += _dpiAutoScale.height() + st::setLittleSkip; - - top += _dpiSlider.height() + st::dpiFont4->height; - int32 sLeft = _dpiSlider.x() + _dpiWidth1 / 2, sWidth = _dpiSlider.width(); - float64 sStep = (sWidth - _dpiWidth1 / 2 - _dpiWidth4 / 2) / float64(dbisScaleCount - 2); - p.setFont(st::dpiFont1->f); - - p.setPen((scaleIs(dbisOne) ? st::dpiActive : st::dpiInactive)->p); - p.drawText(sLeft + qRound(0 * sStep) - _dpiWidth1 / 2, top - (st::dpiFont4->height - st::dpiFont1->height) / 2 - st::dpiFont1->descent, scaleLabel(dbisOne)); - p.setFont(st::dpiFont2->f); - p.setPen((scaleIs(dbisOneAndQuarter) ? st::dpiActive : st::dpiInactive)->p); - p.drawText(sLeft + qRound(1 * sStep) - _dpiWidth2 / 2, top - (st::dpiFont4->height - st::dpiFont2->height) / 2 - st::dpiFont2->descent, scaleLabel(dbisOneAndQuarter)); - p.setFont(st::dpiFont3->f); - p.setPen((scaleIs(dbisOneAndHalf) ? st::dpiActive : st::dpiInactive)->p); - p.drawText(sLeft + qRound(2 * sStep) - _dpiWidth3 / 2, top - (st::dpiFont4->height - st::dpiFont3->height) / 2 - st::dpiFont3->descent, scaleLabel(dbisOneAndHalf)); - p.setFont(st::dpiFont4->f); - p.setPen((scaleIs(dbisTwo) ? st::dpiActive : st::dpiInactive)->p); - p.drawText(sLeft + qRound(3 * sStep) - _dpiWidth4 / 2, top - (st::dpiFont4->height - st::dpiFont4->height) / 2 - st::dpiFont4->descent, scaleLabel(dbisTwo)); - p.setFont(st::linkFont->f); - + if (cPlatform() == dbipWindows) { + top += _workmodeTray.height() + st::setLittleSkip; + top += _workmodeWindow.height() + st::setSectionSkip; + + top += _autoStart.height() + st::setLittleSkip; + top += _startMinimized.height(); + } + + if (!cRetina()) { + p.setFont(st::setHeaderFont->f); + p.setPen(st::setHeaderColor->p); + p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_scale_label)); + top += st::setHeaderSkip; + top += _dpiAutoScale.height() + st::setLittleSkip; + + top += _dpiSlider.height() + st::dpiFont4->height; + int32 sLeft = _dpiSlider.x() + _dpiWidth1 / 2, sWidth = _dpiSlider.width(); + float64 sStep = (sWidth - _dpiWidth1 / 2 - _dpiWidth4 / 2) / float64(dbisScaleCount - 2); + p.setFont(st::dpiFont1->f); + + p.setPen((scaleIs(dbisOne) ? st::dpiActive : st::dpiInactive)->p); + p.drawText(sLeft + qRound(0 * sStep) - _dpiWidth1 / 2, top - (st::dpiFont4->height - st::dpiFont1->height) / 2 - st::dpiFont1->descent, scaleLabel(dbisOne)); + p.setFont(st::dpiFont2->f); + p.setPen((scaleIs(dbisOneAndQuarter) ? st::dpiActive : st::dpiInactive)->p); + p.drawText(sLeft + qRound(1 * sStep) - _dpiWidth2 / 2, top - (st::dpiFont4->height - st::dpiFont2->height) / 2 - st::dpiFont2->descent, scaleLabel(dbisOneAndQuarter)); + p.setFont(st::dpiFont3->f); + p.setPen((scaleIs(dbisOneAndHalf) ? st::dpiActive : st::dpiInactive)->p); + p.drawText(sLeft + qRound(2 * sStep) - _dpiWidth3 / 2, top - (st::dpiFont4->height - st::dpiFont3->height) / 2 - st::dpiFont3->descent, scaleLabel(dbisOneAndHalf)); + p.setFont(st::dpiFont4->f); + p.setPen((scaleIs(dbisTwo) ? st::dpiActive : st::dpiInactive)->p); + p.drawText(sLeft + qRound(3 * sStep) - _dpiWidth4 / 2, top - (st::dpiFont4->height - st::dpiFont4->height) / 2 - st::dpiFont4->descent, scaleLabel(dbisTwo)); + p.setFont(st::linkFont->f); + } + if (_self) { // chat options p.setFont(st::setHeaderFont->f); @@ -451,16 +455,19 @@ void SettingsInner::resizeEvent(QResizeEvent *e) { _restartNow.move(_left + st::setWidth - _restartNow.width(), top + st::setVersionTop); top += st::setVersionHeight; - _workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip; - _workmodeWindow.move(_left, top); top += _workmodeWindow.height() + st::setSectionSkip; - - _autoStart.move(_left, top); top += _autoStart.height() + st::setLittleSkip; - _startMinimized.move(_left, top); top += _startMinimized.height(); - - top += st::setHeaderSkip; - _dpiAutoScale.move(_left, top); top += _dpiAutoScale.height() + st::setLittleSkip; - _dpiSlider.move(_left, top); top += _dpiSlider.height() + st::dpiFont4->height; - + if (cPlatform() == dbipWindows) { + _workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip; + _workmodeWindow.move(_left, top); top += _workmodeWindow.height() + st::setSectionSkip; + + _autoStart.move(_left, top); top += _autoStart.height() + st::setLittleSkip; + _startMinimized.move(_left, top); top += _startMinimized.height(); + } + if (!cRetina()) { + top += st::setHeaderSkip; + _dpiAutoScale.move(_left, top); top += _dpiAutoScale.height() + st::setLittleSkip; + _dpiSlider.move(_left, top); top += _dpiSlider.height() + st::dpiFont4->height; + } + // chat options if (_self) { top += st::setHeaderSkip; @@ -625,14 +632,27 @@ void SettingsInner::showAll() { // general _autoUpdate.show(); - - _workmodeTray.show(); - _workmodeWindow.show(); - - _autoStart.show(); setUpdatingState(_updatingState, true); - _startMinimized.show(); - _dpiSlider.show(); + if (cPlatform() == dbipWindows) { + _workmodeTray.show(); + _workmodeWindow.show(); + + _autoStart.show(); + _startMinimized.show(); + } else { + _workmodeTray.hide(); + _workmodeWindow.hide(); + + _autoStart.hide(); + _startMinimized.hide(); + } + if (cRetina()) { + _dpiSlider.hide(); + _dpiAutoScale.hide(); + } else { + _dpiSlider.show(); + _dpiAutoScale.show(); + } // chat options if (_self) { diff --git a/Telegram/SourceFiles/sysbuttons.cpp b/Telegram/SourceFiles/sysbuttons.cpp index d482d54ff..0e3e5b0b1 100644 --- a/Telegram/SourceFiles/sysbuttons.cpp +++ b/Telegram/SourceFiles/sysbuttons.cpp @@ -45,8 +45,8 @@ void SysBtn::onStateChange(int oldState, ButtonStateChangeSource source) { void SysBtn::paintEvent(QPaintEvent *e) { QPainter p(this); - int x = (width() - _st.img.width()) / 2, y = (height() - _st.img.height()) / 2; - p.fillRect(x, y, _st.img.width(), _st.img.height(), a_color.current()); + int x = (width() - _st.img.pxWidth()) / 2, y = (height() - _st.img.pxHeight()) / 2; + p.fillRect(x, y, _st.img.pxWidth(), _st.img.pxHeight(), a_color.current()); p.drawPixmap(QPoint(x, y), App::sprite(), _st.img); } diff --git a/Telegram/SourceFiles/telegram.qrc b/Telegram/SourceFiles/telegram.qrc index cc02b7f80..c58227517 100644 --- a/Telegram/SourceFiles/telegram.qrc +++ b/Telegram/SourceFiles/telegram.qrc @@ -1,6 +1,7 @@ art/segoe_ui.ttf + art/segoeuib.ttf art/segoe_ui_semibold.ttf art/segoe_wp_semibold.ttf art/newmsg.wav diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index b2528b795..fde848d9c 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -76,6 +76,13 @@ TitleWidget::TitleWidget(Window *window) connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState))); connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn())); + + if (cPlatform() == dbipMac) { + _minimize.hide(); + _maximize.hide(); + _restore.hide(); + _close.hide(); + } } void TitleWidget::paintEvent(QPaintEvent *e) { @@ -118,17 +125,19 @@ TitleWidget::~TitleWidget() { } void TitleWidget::resizeEvent(QResizeEvent *e) { - QPoint p(width() - (lastMaximized ? 0 : st::sysBtnDelta), 0); + QPoint p(width() - ((cPlatform() == dbipWindows && lastMaximized) ? 0 : st::sysBtnDelta), 0); - p.setX(p.x() - _close.width()); - _close.move(p); - - p.setX(p.x() - _maximize.width()); - _restore.move(p); _maximize.move(p); - - p.setX(p.x() - _minimize.width()); - _minimize.move(p); - + if (cPlatform() != dbipMac) { + p.setX(p.x() - _close.width()); + _close.move(p); + + p.setX(p.x() - _maximize.width()); + _restore.move(p); _maximize.move(p); + + p.setX(p.x() - _minimize.width()); + _minimize.move(p); + } + if (!_update.isHidden()) { p.setX(p.x() - _update.width()); _update.move(p); @@ -184,6 +193,8 @@ void TitleWidget::maximizedChanged(bool maximized) { if (lastMaximized == maximized) return; lastMaximized = maximized; + + if (cPlatform() == dbipMac) return; if (maximized) { _maximize.clearState(); } else { @@ -202,7 +213,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) { int x(p.x()), y(p.y()), w(width()), h(height() - st::titleShadow); if (hider && x >= App::main()->dlgsWidth()) return HitTestNone; - if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconRect.width() && y < st::titleIconPos.y() + st::titleIconRect.height()) { + if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconRect.pxWidth() && y < st::titleIconPos.y() + st::titleIconRect.pxHeight()) { return HitTestIcon; } else if (false || (_update.hitTest(p - _update.geometry().topLeft()) == HitTestSysButton) && _update.isVisible() diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index dab1fc75f..1daba3f63 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -43,20 +43,20 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) { } else { _reconnect.setText(reconnect); _reconnect.show(); - _reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top()); + _reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.pxHeight() + st::connectingPadding.top()); _reconnectWidth = _reconnect.width(); } - resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.width(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom()); + resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.pxWidth(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom()); update(); } void ConnectingWidget::paintEvent(QPaintEvent *e) { QPainter p(this); - _shadow.paint(p, QRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height()), QPoint(0, 0), BoxShadow::Top | BoxShadow::Right); - p.fillRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height(), st::connectingBG->b); + _shadow.paint(p, QRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight()), QPoint(0, 0), BoxShadow::Top | BoxShadow::Right); + p.fillRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight(), st::connectingBG->b); p.setFont(st::linkFont->f); p.setPen(st::connectingColor->p); - p.drawText(st::connectingPadding.left(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->ascent, _text); + p.drawText(st::connectingPadding.left(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->ascent, _text); } void ConnectingWidget::onReconnect() { @@ -438,7 +438,7 @@ bool Window::getVideoCoords(VideoData *video, int32 &x, int32 &y, int32 &w) cons } QRect Window::iconRect() const { - return QRect(st::titleIconPos + title->geometry().topLeft(), st::titleIconRect.size()); + return QRect(st::titleIconPos + title->geometry().topLeft(), st::titleIconRect.pxSize()); } bool Window::eventFilter(QObject *obj, QEvent *evt) { diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 053296071..a290a92b6 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.5.1 + 0.5.2 CFBundleSignature ???? NOTE diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index f75a0bff4..afed215ad 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 02F93BF511880983D3C57B84 /* dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E466873F01ABA1E55E914489 /* dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; }; 03270F718426CFE84729079E /* flattextarea.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5C7FD422BBEDA858D7237AE9 /* flattextarea.cpp */; settings = {ATTRIBUTES = (); }; }; 06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */; settings = {ATTRIBUTES = (); }; }; - 07C3AF26194336250016CFF1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; }; + 0749CE69194D723400345D61 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; }; 0A49F3A5DC0680FB31519670 /* phoneinput.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 7C8F9CA4FCE8AF8FCCCB961E /* phoneinput.cpp */; settings = {ATTRIBUTES = (); }; }; 0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* mtp.cpp */; settings = {ATTRIBUTES = (); }; }; 0F0FC25286E16E5F78962FEE /* moc_newgroupbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 69FE16874104731CE2A66E0D /* moc_newgroupbox.cpp */; settings = {ATTRIBUTES = (); }; }; @@ -1141,7 +1141,6 @@ 87DF60DE337FB58864343E39 /* Resources */, AF39DD055C3EF8226FBE929D /* Frameworks */, FE0A091FDBFB3E9C31B7A1BD /* Products */, - 07C3AF40194CCC310016CFF1 /* Preprocess copy-Info.plist */, ); name = Telegram; sourceTree = ""; @@ -1208,7 +1207,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 07C3AF26194336250016CFF1 /* Images.xcassets in Resources */, + 0749CE69194D723400345D61 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1491,7 +1490,7 @@ "/usr/local/Qt-5.3.0/plugins/imageformats", ); MACOSX_DEPLOYMENT_TARGET = 10.7; - OBJROOT = ./../Mac/DebugIntermediate/; + OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; OTHER_CFLAGS = ( "-pipe", "-g", @@ -1542,7 +1541,7 @@ PRODUCT_NAME = Telegram; QT_LIBRARY_SUFFIX = ""; SDKROOT = macosx; - SYMROOT = ./; + SYMROOT = ./../Mac; }; name = Release; }; @@ -1595,7 +1594,7 @@ "/usr/local/Qt-5.3.0/plugins/imageformats", ); MACOSX_DEPLOYMENT_TARGET = 10.7; - OBJROOT = ./../Mac/DebugIntermediate/; + OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; OTHER_CFLAGS = ( "-pipe", "-g", @@ -1646,7 +1645,7 @@ PRODUCT_NAME = Telegram; QT_LIBRARY_SUFFIX = _debug; SDKROOT = macosx; - SYMROOT = ./; + SYMROOT = ./../Mac; }; name = Debug; }; @@ -1655,8 +1654,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 0.5.1; + CURRENT_PROJECT_VERSION = 0.5.2; + DYLIB_CURRENT_VERSION = 0.5.2; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; GCC_OPTIMIZATION_LEVEL = fast; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; LLVM_LTO = YES; @@ -1673,9 +1674,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.5.1; + CURRENT_PROJECT_VERSION = 0.5.2; DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_CURRENT_VERSION = 0.5.2; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; OBJROOT = ./../Mac/DebugIntermediate;