diff --git a/Telegram/Resources/art/channelcolor1.png b/Telegram/Resources/art/channelcolor1.png deleted file mode 100644 index fa84863938..0000000000 Binary files a/Telegram/Resources/art/channelcolor1.png and /dev/null differ diff --git a/Telegram/Resources/art/channelcolor2.png b/Telegram/Resources/art/channelcolor2.png deleted file mode 100644 index f3146254bc..0000000000 Binary files a/Telegram/Resources/art/channelcolor2.png and /dev/null differ diff --git a/Telegram/Resources/art/channelcolor3.png b/Telegram/Resources/art/channelcolor3.png deleted file mode 100644 index 60896638dc..0000000000 Binary files a/Telegram/Resources/art/channelcolor3.png and /dev/null differ diff --git a/Telegram/Resources/art/channelcolor4.png b/Telegram/Resources/art/channelcolor4.png deleted file mode 100644 index d683707426..0000000000 Binary files a/Telegram/Resources/art/channelcolor4.png and /dev/null differ diff --git a/Telegram/Resources/art/chatcolor1.png b/Telegram/Resources/art/chatcolor1.png deleted file mode 100644 index 77d012f8a1..0000000000 Binary files a/Telegram/Resources/art/chatcolor1.png and /dev/null differ diff --git a/Telegram/Resources/art/chatcolor2.png b/Telegram/Resources/art/chatcolor2.png deleted file mode 100644 index b637934d9c..0000000000 Binary files a/Telegram/Resources/art/chatcolor2.png and /dev/null differ diff --git a/Telegram/Resources/art/chatcolor3.png b/Telegram/Resources/art/chatcolor3.png deleted file mode 100644 index ad3cc7ed6f..0000000000 Binary files a/Telegram/Resources/art/chatcolor3.png and /dev/null differ diff --git a/Telegram/Resources/art/chatcolor4.png b/Telegram/Resources/art/chatcolor4.png deleted file mode 100644 index 5d54ea4806..0000000000 Binary files a/Telegram/Resources/art/chatcolor4.png and /dev/null differ diff --git a/Telegram/Resources/art/sprite.png b/Telegram/Resources/art/sprite.png index e8cdf61df2..450efca535 100644 Binary files a/Telegram/Resources/art/sprite.png and b/Telegram/Resources/art/sprite.png differ diff --git a/Telegram/Resources/art/sprite_200x.png b/Telegram/Resources/art/sprite_200x.png index 366203ca32..ed5987c106 100644 Binary files a/Telegram/Resources/art/sprite_200x.png and b/Telegram/Resources/art/sprite_200x.png differ diff --git a/Telegram/Resources/art/usercolor1.png b/Telegram/Resources/art/usercolor1.png deleted file mode 100644 index 726cc9bf4a..0000000000 Binary files a/Telegram/Resources/art/usercolor1.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor2.png b/Telegram/Resources/art/usercolor2.png deleted file mode 100644 index ddeb1f1637..0000000000 Binary files a/Telegram/Resources/art/usercolor2.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor3.png b/Telegram/Resources/art/usercolor3.png deleted file mode 100644 index 165e74f507..0000000000 Binary files a/Telegram/Resources/art/usercolor3.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor4.png b/Telegram/Resources/art/usercolor4.png deleted file mode 100644 index e404284407..0000000000 Binary files a/Telegram/Resources/art/usercolor4.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor5.png b/Telegram/Resources/art/usercolor5.png deleted file mode 100644 index 1909c77fe8..0000000000 Binary files a/Telegram/Resources/art/usercolor5.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor6.png b/Telegram/Resources/art/usercolor6.png deleted file mode 100644 index 97c9e80857..0000000000 Binary files a/Telegram/Resources/art/usercolor6.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor7.png b/Telegram/Resources/art/usercolor7.png deleted file mode 100644 index d769bd553b..0000000000 Binary files a/Telegram/Resources/art/usercolor7.png and /dev/null differ diff --git a/Telegram/Resources/art/usercolor8.png b/Telegram/Resources/art/usercolor8.png deleted file mode 100644 index 1fbbe1808e..0000000000 Binary files a/Telegram/Resources/art/usercolor8.png and /dev/null differ diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index bd1dd65c26..a2aee4a99e 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -41,15 +41,6 @@ transparent: #fff0; white: #fff; black: #000; -color1: #c03d33; // red -color2: #4fad2d; // green -color3: #d09306; // yellow -color4: #348cd4; // blue -color5: #8544d6; // purple -color6: #cd4073; // pink -color7: #2996ad; // sea -color8: #ce671b; // orange - wndMinWidth: 380px; adaptiveNormalWidth: 640px; diff --git a/Telegram/Resources/icons/userpic_channel.png b/Telegram/Resources/icons/userpic_channel.png new file mode 100644 index 0000000000..1f5fd21f26 Binary files /dev/null and b/Telegram/Resources/icons/userpic_channel.png differ diff --git a/Telegram/Resources/icons/userpic_channel@2x.png b/Telegram/Resources/icons/userpic_channel@2x.png new file mode 100644 index 0000000000..d3301baaf8 Binary files /dev/null and b/Telegram/Resources/icons/userpic_channel@2x.png differ diff --git a/Telegram/Resources/icons/userpic_chat.png b/Telegram/Resources/icons/userpic_chat.png new file mode 100644 index 0000000000..778e505c77 Binary files /dev/null and b/Telegram/Resources/icons/userpic_chat.png differ diff --git a/Telegram/Resources/icons/userpic_chat@2x.png b/Telegram/Resources/icons/userpic_chat@2x.png new file mode 100644 index 0000000000..cc2492297a Binary files /dev/null and b/Telegram/Resources/icons/userpic_chat@2x.png differ diff --git a/Telegram/Resources/icons/userpic_person.png b/Telegram/Resources/icons/userpic_person.png new file mode 100644 index 0000000000..fb28bf3c53 Binary files /dev/null and b/Telegram/Resources/icons/userpic_person.png differ diff --git a/Telegram/Resources/icons/userpic_person@2x.png b/Telegram/Resources/icons/userpic_person@2x.png new file mode 100644 index 0000000000..4b63a71011 Binary files /dev/null and b/Telegram/Resources/icons/userpic_person@2x.png differ diff --git a/Telegram/Resources/telegram.qrc b/Telegram/Resources/telegram.qrc index 4fff413351..9d916ea396 100644 --- a/Telegram/Resources/telegram.qrc +++ b/Telegram/Resources/telegram.qrc @@ -1,46 +1,27 @@ - - art/fonts/OpenSans-Regular.ttf - art/fonts/OpenSans-Bold.ttf - art/fonts/OpenSans-Semibold.ttf - art/newmsg.wav - art/bg.jpg - art/bg0.png - art/sprite.png - art/sprite_125x.png - art/sprite_150x.png - art/sprite_200x.png - art/blank.gif - art/icon256.png - art/iconbig256.png - - - art/chatcolor1.png - art/chatcolor2.png - art/chatcolor3.png - art/chatcolor4.png - art/channelcolor1.png - art/channelcolor2.png - art/channelcolor3.png - art/channelcolor4.png - art/usercolor1.png - art/usercolor2.png - art/usercolor3.png - art/usercolor4.png - art/usercolor5.png - art/usercolor6.png - art/usercolor7.png - art/usercolor8.png - - - qmime/freedesktop.org.xml - - - langs/lang_it.strings - langs/lang_es.strings - langs/lang_de.strings - langs/lang_nl.strings - langs/lang_pt_BR.strings - langs/lang_ko.strings - + + art/fonts/OpenSans-Regular.ttf + art/fonts/OpenSans-Bold.ttf + art/fonts/OpenSans-Semibold.ttf + art/newmsg.wav + art/bg.jpg + art/bg0.png + art/sprite.png + art/sprite_125x.png + art/sprite_150x.png + art/sprite_200x.png + art/icon256.png + art/iconbig256.png + + + qmime/freedesktop.org.xml + + + langs/lang_it.strings + langs/lang_es.strings + langs/lang_de.strings + langs/lang_nl.strings + langs/lang_pt_BR.strings + langs/lang_ko.strings + diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 37a4fe1de8..c81d899f42 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -92,3 +92,44 @@ historyViewsInSelectedIcon: icon {{ "history_views", #6a9bc5 }}; historyViewsOutIcon: icon {{ "history_views", historyOutFg }}; historyViewsOutSelectedIcon: icon {{ "history_views", historyOutSelectedFg }}; historyViewsInvertedIcon: icon {{ "history_views", #ffffffe6 }}; + +historyPeer1NameFg: #c03d33; // red +historyPeer1UserpicBg: #ed9482; +historyPeer1UserpicFg: #d3644b; +historyPeer1UserpicPerson: icon {{ size(120px, 120px), historyPeer1UserpicBg }, { "userpic_person", historyPeer1UserpicFg }}; +historyPeer1UserpicChat: icon {{ size(120px, 120px), historyPeer1UserpicBg }, { "userpic_chat", historyPeer1UserpicFg }}; +historyPeer1UserpicChannel: icon {{ size(120px, 120px), historyPeer1UserpicBg }, { "userpic_channel", historyPeer1UserpicFg }}; +historyPeer2NameFg: #4fad2d; // green +historyPeer2UserpicBg: #a8db92; +historyPeer2UserpicFg: #75c057; +historyPeer2UserpicPerson: icon {{ size(120px, 120px), historyPeer2UserpicBg }, { "userpic_person", historyPeer2UserpicFg }}; +historyPeer2UserpicChat: icon {{ size(120px, 120px), historyPeer2UserpicBg }, { "userpic_chat", historyPeer2UserpicFg }}; +historyPeer2UserpicChannel: icon {{ size(120px, 120px), historyPeer2UserpicBg }, { "userpic_channel", historyPeer2UserpicFg }}; +historyPeer3NameFg: #d09306; // yellow +historyPeer3UserpicBg: #efd289; +historyPeer3UserpicFg: #e4a861; +historyPeer3UserpicPerson: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_person", historyPeer3UserpicFg }}; +historyPeer3UserpicChat: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_chat", historyPeer3UserpicFg }}; +historyPeer3UserpicChannel: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_channel", historyPeer3UserpicFg }}; +historyPeer4NameFg: #348cd4; // blue +historyPeer4UserpicBg: #8fbfe9; +historyPeer4UserpicFg: #649fd3; +historyPeer4UserpicPerson: icon {{ size(120px, 120px), historyPeer4UserpicBg }, { "userpic_person", historyPeer4UserpicFg }}; +historyPeer4UserpicChat: icon {{ size(120px, 120px), historyPeer4UserpicBg }, { "userpic_chat", historyPeer4UserpicFg }}; +historyPeer4UserpicChannel: icon {{ size(120px, 120px), historyPeer4UserpicBg }, { "userpic_channel", historyPeer4UserpicFg }}; +historyPeer5NameFg: #8544d6; // purple +historyPeer5UserpicBg: #9992e4; +historyPeer5UserpicFg: #7b72cf; +historyPeer5UserpicPerson: icon {{ size(120px, 120px), historyPeer5UserpicBg }, { "userpic_person", historyPeer5UserpicFg }}; +historyPeer6NameFg: #cd4073; // pink +historyPeer6UserpicBg: #ffa9c3; +historyPeer6UserpicFg: #e87497; +historyPeer6UserpicPerson: icon {{ size(120px, 120px), historyPeer6UserpicBg }, { "userpic_person", historyPeer6UserpicFg }}; +historyPeer7NameFg: #2996ad; // sea +historyPeer7UserpicBg: #8eccdb; +historyPeer7UserpicFg: #5eb2c7; +historyPeer7UserpicPerson: icon {{ size(120px, 120px), historyPeer7UserpicBg }, { "userpic_person", historyPeer7UserpicFg }}; +historyPeer8NameFg: #ce671b; // orange +historyPeer8UserpicBg: #f7b37c; +historyPeer8UserpicFg: #de8d62; +historyPeer8UserpicPerson: icon {{ size(120px, 120px), historyPeer8UserpicBg }, { "userpic_person", historyPeer8UserpicFg }}; diff --git a/Telegram/SourceFiles/history/history_location_manager.cpp b/Telegram/SourceFiles/history/history_location_manager.cpp index ee90d67345..49633f7dfe 100644 --- a/Telegram/SourceFiles/history/history_location_manager.cpp +++ b/Telegram/SourceFiles/history/history_location_manager.cpp @@ -76,18 +76,14 @@ void LocationManager::init() { #endif // OS_MAC_OLD connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); - if (black) { - delete black->v(); - delete black; + if (notLoadedPlaceholder) { + delete notLoadedPlaceholder->v(); + delete notLoadedPlaceholder; } - QImage b(cIntRetinaFactor(), cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); - { - QPainter p(&b); - p.fillRect(QRect(0, 0, cIntRetinaFactor(), cIntRetinaFactor()), st::white->b); - } - QPixmap p = App::pixmapFromImageInPlace(std_::move(b)); - p.setDevicePixelRatio(cRetinaFactor()); - black = new ImagePtr(p, "PNG"); + auto data = QImage(cIntRetinaFactor(), cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + data.fill(st::white->c); + data.setDevicePixelRatio(cRetinaFactor()); + notLoadedPlaceholder = new ImagePtr(App::pixmapFromImageInPlace(std_::move(data)), "GIF"); } void LocationManager::reinit() { @@ -99,10 +95,10 @@ void LocationManager::deinit() { delete manager; manager = nullptr; } - if (black) { - delete black->v(); - delete black; - black = nullptr; + if (notLoadedPlaceholder) { + delete notLoadedPlaceholder->v(); + delete notLoadedPlaceholder; + notLoadedPlaceholder = nullptr; } dataLoadings.clear(); imageLoadings.clear(); @@ -206,7 +202,7 @@ void LocationManager::onFinished(QNetworkReply *reply) { if (format.isEmpty()) format = QByteArray("JPG"); } d->loading = false; - d->thumb = thumb.isNull() ? (*black) : ImagePtr(thumb, format); + d->thumb = thumb.isNull() ? (*notLoadedPlaceholder) : ImagePtr(thumb, format); serverRedirects.remove(d); if (App::main()) App::main()->update(); } @@ -236,7 +232,7 @@ void LocationManager::onFailed(QNetworkReply *reply) { void LocationManager::failed(LocationData *data) { data->loading = false; - data->thumb = *black; + data->thumb = *notLoadedPlaceholder; serverRedirects.remove(data); } diff --git a/Telegram/SourceFiles/history/history_location_manager.h b/Telegram/SourceFiles/history/history_location_manager.h index bf422e4bbf..da3e54587d 100644 --- a/Telegram/SourceFiles/history/history_location_manager.h +++ b/Telegram/SourceFiles/history/history_location_manager.h @@ -115,6 +115,6 @@ private: QNetworkAccessManager *manager = nullptr; QMap dataLoadings, imageLoadings; QMap serverRedirects; - ImagePtr *black = nullptr; + ImagePtr *notLoadedPlaceholder = nullptr; }; diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index ae6e6894dc..7748906700 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -2296,7 +2296,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, u if (_contact) { _contact->paintUserpic(p, st::msgFileThumbSize, rthumb.x(), rthumb.y()); } else { - p.drawPixmap(rthumb.topLeft(), userDefPhoto(qAbs(_userId) % UserColorsCount)->pixCircled(st::msgFileThumbSize, st::msgFileThumbSize)); + p.drawPixmap(rthumb.topLeft(), userDefPhoto(qAbs(_userId) % kUserColorsCount)->pixCircled(st::msgFileThumbSize, st::msgFileThumbSize)); } if (selected) { App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners); @@ -2313,7 +2313,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, u statustop = st::msgFileStatusTop; QRect inner(rtlrect(st::msgFilePadding.left(), st::msgFilePadding.top(), st::msgFileSize, st::msgFileSize, width)); - p.drawPixmap(inner.topLeft(), userDefPhoto(qAbs(_parent->id) % UserColorsCount)->pixCircled(st::msgFileSize, st::msgFileSize)); + p.drawPixmap(inner.topLeft(), userDefPhoto(qAbs(_parent->id) % kUserColorsCount)->pixCircled(st::msgFileSize, st::msgFileSize)); } int32 namewidth = width - nameleft - nameright; diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp index 3a530885c9..4b96752481 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp @@ -146,7 +146,7 @@ ImagePtr ItemBase::getResultThumb() const { QPixmap ItemBase::getResultContactAvatar(int width, int height) const { if (_result->_type == Result::Type::Contact) { - return userDefPhoto(qHash(_result->_id) % UserColorsCount)->pixCircled(width, height); + return userDefPhoto(qHash(_result->_id) % kUserColorsCount)->pixCircled(width, height); } return QPixmap(); } diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 252ce2d62e..98bc42e470 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -34,64 +34,81 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "media/media_audio.h" #include "localstorage.h" #include "history/history_media_types.h" +#include "styles/style_history.h" namespace { - int peerColorIndex(const PeerId &peer) { - UserId myId(MTP::authedId()), peerId(peerToBareInt(peer)); - QByteArray both(qsl("%1%2").arg(peerId).arg(myId).toUtf8()); - if (both.size() > 15) { - both = both.mid(0, 15); - } - uchar md5[16]; - hashMd5(both.constData(), both.size(), md5); - return (md5[peerId & 0x0F] & (peerIsUser(peer) ? 0x07 : 0x03)); - } + +int peerColorIndex(const PeerId &peer) { + auto myId = MTP::authedId(); + auto peerId = peerToBareInt(peer); + auto both = (QByteArray::number(peerId) + QByteArray::number(myId)).mid(0, 15); + uchar md5[16]; + hashMd5(both.constData(), both.size(), md5); + return (md5[peerId & 0x0F] & (peerIsUser(peer) ? 0x07 : 0x03)); } -style::color peerColor(int index) { - static const style::color peerColors[8] = { - style::color(st::color1), - style::color(st::color2), - style::color(st::color3), - style::color(st::color4), - style::color(st::color5), - style::color(st::color6), - style::color(st::color7), - style::color(st::color8) +struct ColorReferenceWrap { + ColorReferenceWrap(const style::color &data) : data(data) { + } + const style::color &data; +}; + +ImagePtr generateUserpicImage(const style::icon &icon) { + auto data = QImage(icon.width() * cIntRetinaFactor(), icon.height() * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + { + Painter p(&data); + icon.paint(p, 0, 0, icon.width()); + } + data.setDevicePixelRatio(cRetinaFactor()); + return ImagePtr(App::pixmapFromImageInPlace(std_::move(data)), "PNG"); +} + +} // namespace + +const style::color &peerColor(int index) { + static const ColorReferenceWrap peerColors[kUserColorsCount] = { + st::historyPeer1NameFg, + st::historyPeer2NameFg, + st::historyPeer3NameFg, + st::historyPeer4NameFg, + st::historyPeer5NameFg, + st::historyPeer6NameFg, + st::historyPeer7NameFg, + st::historyPeer8NameFg, }; - return peerColors[index]; + return peerColors[index].data; } ImagePtr userDefPhoto(int index) { - static const ImagePtr userDefPhotos[UserColorsCount] = { - ImagePtr(qsl(":/ava/art/usercolor1.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor2.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor3.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor4.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor5.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor6.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor7.png"), "PNG"), - ImagePtr(qsl(":/ava/art/usercolor8.png"), "PNG"), + static const ImagePtr userDefPhotos[kUserColorsCount] = { + generateUserpicImage(st::historyPeer1UserpicPerson), + generateUserpicImage(st::historyPeer2UserpicPerson), + generateUserpicImage(st::historyPeer3UserpicPerson), + generateUserpicImage(st::historyPeer4UserpicPerson), + generateUserpicImage(st::historyPeer5UserpicPerson), + generateUserpicImage(st::historyPeer6UserpicPerson), + generateUserpicImage(st::historyPeer7UserpicPerson), + generateUserpicImage(st::historyPeer8UserpicPerson), }; return userDefPhotos[index]; } ImagePtr chatDefPhoto(int index) { - static const ImagePtr chatDefPhotos[4] = { - ImagePtr(qsl(":/ava/art/chatcolor1.png"), "PNG"), - ImagePtr(qsl(":/ava/art/chatcolor2.png"), "PNG"), - ImagePtr(qsl(":/ava/art/chatcolor3.png"), "PNG"), - ImagePtr(qsl(":/ava/art/chatcolor4.png"), "PNG"), + static const ImagePtr chatDefPhotos[kChatColorsCount] = { + generateUserpicImage(st::historyPeer1UserpicChat), + generateUserpicImage(st::historyPeer2UserpicChat), + generateUserpicImage(st::historyPeer3UserpicChat), + generateUserpicImage(st::historyPeer4UserpicChat), }; return chatDefPhotos[index]; } ImagePtr channelDefPhoto(int index) { - static const ImagePtr channelDefPhotos[4] = { - ImagePtr(qsl(":/ava/art/channelcolor1.png"), "PNG"), - ImagePtr(qsl(":/ava/art/channelcolor2.png"), "PNG"), - ImagePtr(qsl(":/ava/art/channelcolor3.png"), "PNG"), - ImagePtr(qsl(":/ava/art/channelcolor4.png"), "PNG"), + static const ImagePtr channelDefPhotos[kChannelColorsCount] = { + generateUserpicImage(st::historyPeer1UserpicChannel), + generateUserpicImage(st::historyPeer2UserpicChannel), + generateUserpicImage(st::historyPeer3UserpicChannel), + generateUserpicImage(st::historyPeer4UserpicChannel), }; return channelDefPhotos[index]; } diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index a8c5d50051..9085b960f8 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -199,9 +199,11 @@ inline bool isNotifyMuted(NotifySettingsPtr settings, TimeId *changeIn = 0) { return false; } -static const int UserColorsCount = 8; +static constexpr int kUserColorsCount = 8; +static constexpr int kChatColorsCount = 4; +static constexpr int kChannelColorsCount = 4; -style::color peerColor(int index); +const style::color &peerColor(int index); ImagePtr userDefPhoto(int index); ImagePtr chatDefPhoto(int index); ImagePtr channelDefPhoto(int index); diff --git a/Telegram/SourceFiles/ui/images.cpp b/Telegram/SourceFiles/ui/images.cpp index 25e9199593..a6bb352bbf 100644 --- a/Telegram/SourceFiles/ui/images.cpp +++ b/Telegram/SourceFiles/ui/images.cpp @@ -27,29 +27,38 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "pspecific.h" namespace { - typedef QMap LocalImages; - LocalImages localImages; - typedef QMap WebImages; - WebImages webImages; +using LocalImages = QMap; +LocalImages localImages; - Image *blank() { - static Image *img = internal::getImage(qsl(":/gui/art/blank.gif"), "GIF"); - return img; - } +using WebImages = QMap; +WebImages webImages; - typedef QMap StorageImages; - StorageImages storageImages; - - int64 globalAcquiredSize = 0; - - static const uint64 BlurredCacheSkip = 0x1000000000000000LLU; - static const uint64 ColoredCacheSkip = 0x2000000000000000LLU; - static const uint64 BlurredColoredCacheSkip = 0x3000000000000000LLU; - static const uint64 RoundedCacheSkip = 0x4000000000000000LLU; - static const uint64 CircledCacheSkip = 0x5000000000000000LLU; +Image *generateBlankImage() { + auto data = QImage(cIntRetinaFactor(), cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); + data.fill(QColor(255, 255, 255, 0)); + data.setDevicePixelRatio(cRetinaFactor()); + return internal::getImage(App::pixmapFromImageInPlace(std_::move(data)), "GIF"); } +Image *blank() { + static auto blankImage = generateBlankImage(); + return blankImage; +} + +using StorageImages = QMap; +StorageImages storageImages; + +int64 globalAcquiredSize = 0; + +constexpr uint64 BlurredCacheSkip = 0x1000000000000000LLU; +constexpr uint64 ColoredCacheSkip = 0x2000000000000000LLU; +constexpr uint64 BlurredColoredCacheSkip = 0x3000000000000000LLU; +constexpr uint64 RoundedCacheSkip = 0x4000000000000000LLU; +constexpr uint64 CircledCacheSkip = 0x5000000000000000LLU; + +} // namespace + StorageImageLocation StorageImageLocation::Null; bool Image::isNull() const { diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index 35e99aa0ee..5a49cd29bc 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -58,7 +58,6 @@ 'pt-BR', ], 'travis_defines%': '', - 'linux_path_breakpad%': '<(libs_loc)/breakpad', }, 'includes': [ 'common_executable.gypi', @@ -86,7 +85,7 @@ 'include_dirs': [ '<(src_loc)', '<(SHARED_INTERMEDIATE_DIR)', - '<(linux_path_breakpad)/include/breakpad', + '<(libs_loc)/breakpad/src', '<(libs_loc)/lzma/C', '<(libs_loc)/libexif-0.6.20', '<(libs_loc)/zlib-1.2.8', diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi index 99a6c12142..d07b5928ab 100644 --- a/Telegram/gyp/telegram_linux.gypi +++ b/Telegram/gyp/telegram_linux.gypi @@ -31,19 +31,21 @@ 'linux_path_openal%': '/usr/local', 'linux_path_libexif_lib%': '<(libs_loc)/libexif-0.6.20/libexif/.libs', 'linux_path_va%': '/usr/local', + 'linux_path_breakpad%': '<(libs_loc)/breakpad', }, 'include_dirs': [ '/usr/local/include', '<(linux_path_ffmpeg)/include', '<(linux_path_openal)/include', + '<(linux_path_breakpad)/include/breakpad', ], 'library_dirs': [ '/usr/local/lib', '<(linux_path_ffmpeg)/lib', '<(linux_path_openal)/lib', - '<(linux_path_breakpad)/lib', '<(linux_path_libexif_lib)', '<(linux_path_va)/lib', + '<(linux_path_breakpad)/lib', ], 'libraries': [ 'breakpad_client',