mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 14:50:24 +00:00
forward by drag-n-drop from media overview, fixed video overview, stickers enlarged and optimized, preparing version 0.8.34.dev
This commit is contained in:
parent
8e82b8894d
commit
405dfbebae
Telegram
PrepareWin.bat
Resources
SourceFiles
apiwrap.cppapiwrap.happ.cppapplication.cpp
Telegram.plistTelegram.rcboxes
config.hdropdown.cppdropdown.hhistory.cpphistory.hhistorywidget.cpphistorywidget.hlocalstorage.cppmainwidget.cppmtproto
overviewwidget.cppoverviewwidget.hsettings.cppsettings.hstructs.hTelegram.xcodeproj
Version.sh@ -1,10 +1,10 @@
|
||||
@echo OFF
|
||||
|
||||
set "AppVersionStrMajor=0.8"
|
||||
set "AppVersion=8033"
|
||||
set "AppVersionStrSmall=0.8.33"
|
||||
set "AppVersionStr=0.8.33"
|
||||
set "AppVersionStrFull=0.8.33.0"
|
||||
set "AppVersion=8034"
|
||||
set "AppVersionStrSmall=0.8.34"
|
||||
set "AppVersionStr=0.8.34"
|
||||
set "AppVersionStrFull=0.8.34.0"
|
||||
set "DevChannel=1"
|
||||
|
||||
if %DevChannel% neq 0 goto preparedev
|
||||
|
@ -1565,7 +1565,7 @@ rbEmoji: flatCheckbox {
|
||||
bgColor: emojiPanCategories;
|
||||
disColor: emojiPanCategories;
|
||||
|
||||
width: 36px;
|
||||
width: 42px;
|
||||
height: 46px;
|
||||
|
||||
textTop: 0px;
|
||||
@ -1576,7 +1576,7 @@ rbEmoji: flatCheckbox {
|
||||
cursor: cursor(pointer);
|
||||
|
||||
disabledCursor: cursor(default);
|
||||
imagePos: point(8px, 12px);
|
||||
imagePos: point(11px, 12px);
|
||||
}
|
||||
rbEmojiRecent: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiRecentOver;
|
||||
@ -1642,16 +1642,17 @@ rbEmojiObjects: flatCheckbox(rbEmoji) {
|
||||
disImageRect: emojiObjectsOver;
|
||||
chkDisImageRect: emojiObjectsActive;
|
||||
}
|
||||
emojiPanPadding: 10px;
|
||||
emojiPanSize: size(39px, 35px);
|
||||
emojiPanFullSize: size(300px, 321px);
|
||||
emojiPanPadding: 12px;
|
||||
emojiPanSize: size(45px, 41px);
|
||||
emojiPanWidth: 345px;
|
||||
emojiPanMaxHeight: 366px;
|
||||
emojiPanDuration: 200;
|
||||
emojiPanHover: #f0f4f7;
|
||||
|
||||
emojiPanHeader: 42px;
|
||||
emojiPanHeaderFont: font(fsize semibold);
|
||||
emojiPanHeaderColor: #999;
|
||||
emojiPanHeaderLeft: 17px;
|
||||
emojiPanHeaderLeft: 22px;
|
||||
emojiPanHeaderTop: 12px;
|
||||
emojiPanHeaderBg: #fffffff2;
|
||||
|
||||
@ -1665,7 +1666,7 @@ emojiSwitchStickers: sprite(318px, 328px, 8px, 12px);
|
||||
emojiSwitchEmoji: sprite(310px, 328px, 8px, 12px);
|
||||
emojiSwitchColor: #42a8db;
|
||||
|
||||
stickerPanSize: size(55px, 55px);
|
||||
stickerPanSize: size(64px, 64px);
|
||||
stickerPanPadding: 11px;
|
||||
stickerPanDelete: sprite(123px, 132px, 12px, 12px);
|
||||
stickerPanDeleteOpacity: 0.5;
|
||||
|
@ -83,6 +83,54 @@ void ApiWrap::requestReplyTo(HistoryReply *reply, MsgId to) {
|
||||
if (!req.req) _replyToTimer.start(1);
|
||||
}
|
||||
|
||||
void ApiWrap::resolveReplyTo() {
|
||||
if (_replyToRequests.isEmpty()) return;
|
||||
|
||||
QVector<MTPint> ids;
|
||||
ids.reserve(_replyToRequests.size());
|
||||
for (ReplyToRequests::const_iterator i = _replyToRequests.cbegin(), e = _replyToRequests.cend(); i != e; ++i) {
|
||||
if (!i.value().req) {
|
||||
ids.push_back(MTP_int(i.key()));
|
||||
}
|
||||
}
|
||||
if (!ids.isEmpty()) {
|
||||
mtpRequestId req = MTP::send(MTPmessages_GetMessages(MTP_vector<MTPint>(ids)), rpcDone(&ApiWrap::gotReplyTo));
|
||||
for (ReplyToRequests::iterator i = _replyToRequests.begin(), e = _replyToRequests.end(); i != e; ++i) {
|
||||
i.value().req = req;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::gotReplyTo(const MTPmessages_Messages &msgs, mtpRequestId req) {
|
||||
switch (msgs.type()) {
|
||||
case mtpc_messages_messages:
|
||||
App::feedUsers(msgs.c_messages_messages().vusers);
|
||||
App::feedChats(msgs.c_messages_messages().vchats);
|
||||
App::feedMsgs(msgs.c_messages_messages().vmessages, -1);
|
||||
break;
|
||||
|
||||
case mtpc_messages_messagesSlice:
|
||||
App::feedUsers(msgs.c_messages_messagesSlice().vusers);
|
||||
App::feedChats(msgs.c_messages_messagesSlice().vchats);
|
||||
App::feedMsgs(msgs.c_messages_messagesSlice().vmessages, -1);
|
||||
break;
|
||||
}
|
||||
for (ReplyToRequests::iterator i = _replyToRequests.begin(); i != _replyToRequests.cend();) {
|
||||
if (i.value().req == req) {
|
||||
for (QList<HistoryReply*>::const_iterator j = i.value().replies.cbegin(), e = i.value().replies.cend(); j != e; ++j) {
|
||||
if (*j) {
|
||||
(*j)->updateReplyTo(true);
|
||||
} else {
|
||||
App::main()->updateReplyTo();
|
||||
}
|
||||
}
|
||||
i = _replyToRequests.erase(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::requestFullPeer(PeerData *peer) {
|
||||
if (!peer || _fullRequests.contains(peer)) return;
|
||||
mtpRequestId req;
|
||||
@ -94,25 +142,6 @@ void ApiWrap::requestFullPeer(PeerData *peer) {
|
||||
_fullRequests.insert(peer, req);
|
||||
}
|
||||
|
||||
void ApiWrap::requestWebPageDelayed(WebPageData *page) {
|
||||
if (page->pendingTill <= 0) return;
|
||||
_webPagesPending.insert(page, 0);
|
||||
int32 left = (page->pendingTill - unixtime()) * 1000;
|
||||
if (!_webPagesTimer.isActive() || left <= _webPagesTimer.remainingTime()) {
|
||||
_webPagesTimer.start((left < 0 ? 0 : left) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::clearWebPageRequest(WebPageData *page) {
|
||||
_webPagesPending.remove(page);
|
||||
if (_webPagesPending.isEmpty() && _webPagesTimer.isActive()) _webPagesTimer.stop();
|
||||
}
|
||||
|
||||
void ApiWrap::clearWebPageRequests() {
|
||||
_webPagesPending.clear();
|
||||
_webPagesTimer.stop();
|
||||
}
|
||||
|
||||
void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
|
||||
const MTPDmessages_chatFull &d(result.c_messages_chatFull());
|
||||
const MTPDchatFull &f(d.vfull_chat.c_chatFull());
|
||||
@ -168,22 +197,143 @@ bool ApiWrap::gotPeerFailed(PeerData *peer, const RPCError &error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ApiWrap::resolveReplyTo() {
|
||||
if (_replyToRequests.isEmpty()) return;
|
||||
void ApiWrap::scheduleStickerSetRequest(uint64 setId, uint64 access) {
|
||||
if (!_stickerSetRequests.contains(setId)) {
|
||||
_stickerSetRequests.insert(setId, qMakePair(access, 0));
|
||||
}
|
||||
}
|
||||
|
||||
QVector<MTPint> ids;
|
||||
ids.reserve(_replyToRequests.size());
|
||||
for (ReplyToRequests::const_iterator i = _replyToRequests.cbegin(), e = _replyToRequests.cend(); i != e; ++i) {
|
||||
if (!i.value().req) {
|
||||
ids.push_back(MTP_int(i.key()));
|
||||
void ApiWrap::requestStickerSets() {
|
||||
for (QMap<uint64, QPair<uint64, mtpRequestId> >::iterator i = _stickerSetRequests.begin(), j = i, e = _stickerSetRequests.end(); i != e; i = j) {
|
||||
if (i.value().second) continue;
|
||||
|
||||
++j;
|
||||
int32 wait = (j == e) ? 0 : 10;
|
||||
i.value().second = MTP::send(MTPmessages_GetStickerSet(MTP_inputStickerSetID(MTP_long(i.key()), MTP_long(i.value().first))), rpcDone(&ApiWrap::gotStickerSet, i.key()), rpcFail(&ApiWrap::gotStickerSetFail, i.key()), 0, wait);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) {
|
||||
_stickerSetRequests.remove(setId);
|
||||
|
||||
if (result.type() != mtpc_messages_stickerSet) return;
|
||||
const MTPDmessages_stickerSet &d(result.c_messages_stickerSet());
|
||||
|
||||
if (d.vset.type() != mtpc_stickerSet) return;
|
||||
const MTPDstickerSet &s(d.vset.c_stickerSet());
|
||||
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
StickerSets::iterator it = sets.find(setId);
|
||||
if (it == sets.cend()) return;
|
||||
|
||||
it->access = s.vaccess_hash.v;
|
||||
it->hash = s.vhash.v;
|
||||
it->shortName = qs(s.vshort_name);
|
||||
QString title = qs(s.vtitle);
|
||||
if ((it->flags & MTPDstickerSet_flag_official) && !title.compare(qstr("Great Minds"), Qt::CaseInsensitive)) {
|
||||
title = lang(lng_stickers_default_set);
|
||||
}
|
||||
it->title = title;
|
||||
it->flags = s.vflags.v;
|
||||
|
||||
const QVector<MTPDocument> &d_docs(d.vdocuments.c_vector().v);
|
||||
StickerSets::iterator custom = sets.find(CustomStickerSetId);
|
||||
|
||||
QSet<DocumentData*> found;
|
||||
int32 wasCount = -1;
|
||||
for (int32 i = 0, l = d_docs.size(); i != l; ++i) {
|
||||
DocumentData *doc = App::feedDocument(d_docs.at(i));
|
||||
if (!doc || !doc->sticker) continue;
|
||||
|
||||
if (wasCount < 0) wasCount = it->stickers.size();
|
||||
if (it->stickers.indexOf(doc) < 0) {
|
||||
it->stickers.push_back(doc);
|
||||
} else {
|
||||
found.insert(doc);
|
||||
}
|
||||
|
||||
if (custom != sets.cend()) {
|
||||
int32 index = custom->stickers.indexOf(doc);
|
||||
if (index >= 0) {
|
||||
custom->stickers.removeAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ids.isEmpty()) {
|
||||
mtpRequestId req = MTP::send(MTPmessages_GetMessages(MTP_vector<MTPint>(ids)), rpcDone(&ApiWrap::gotReplyTo));
|
||||
for (ReplyToRequests::iterator i = _replyToRequests.begin(), e = _replyToRequests.end(); i != e; ++i) {
|
||||
i.value().req = req;
|
||||
if (custom != sets.cend() && custom->stickers.isEmpty()) {
|
||||
sets.erase(custom);
|
||||
custom = sets.end();
|
||||
}
|
||||
|
||||
bool writeRecent = false;
|
||||
RecentStickerPack &recent(cGetRecentStickers());
|
||||
|
||||
if (wasCount < 0) { // no stickers received
|
||||
for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) {
|
||||
if (it->stickers.indexOf(i->first) >= 0) {
|
||||
i = recent.erase(i);
|
||||
writeRecent = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
cRefStickerSetsOrder().removeOne(setId);
|
||||
sets.erase(it);
|
||||
} else {
|
||||
for (int32 j = 0, l = wasCount; j < l;) {
|
||||
if (found.contains(it->stickers.at(j))) {
|
||||
++j;
|
||||
} else {
|
||||
for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) {
|
||||
if (it->stickers.at(j) == i->first) {
|
||||
i = recent.erase(i);
|
||||
writeRecent = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
it->stickers.removeAt(j);
|
||||
--l;
|
||||
}
|
||||
}
|
||||
if (it->stickers.isEmpty()) {
|
||||
cRefStickerSetsOrder().removeOne(setId);
|
||||
sets.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
if (writeRecent) {
|
||||
Local::writeUserSettings();
|
||||
}
|
||||
|
||||
Local::writeStickers();
|
||||
|
||||
if (App::main()) emit App::main()->stickersUpdated();
|
||||
}
|
||||
|
||||
bool ApiWrap::gotStickerSetFail(uint64 setId, const RPCError &error) {
|
||||
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
|
||||
|
||||
_stickerSetRequests.remove(setId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ApiWrap::requestWebPageDelayed(WebPageData *page) {
|
||||
if (page->pendingTill <= 0) return;
|
||||
_webPagesPending.insert(page, 0);
|
||||
int32 left = (page->pendingTill - unixtime()) * 1000;
|
||||
if (!_webPagesTimer.isActive() || left <= _webPagesTimer.remainingTime()) {
|
||||
_webPagesTimer.start((left < 0 ? 0 : left) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::clearWebPageRequest(WebPageData *page) {
|
||||
_webPagesPending.remove(page);
|
||||
if (_webPagesPending.isEmpty() && _webPagesTimer.isActive()) _webPagesTimer.stop();
|
||||
}
|
||||
|
||||
void ApiWrap::clearWebPageRequests() {
|
||||
_webPagesPending.clear();
|
||||
_webPagesTimer.stop();
|
||||
}
|
||||
|
||||
void ApiWrap::resolveWebPages() {
|
||||
@ -214,36 +364,6 @@ void ApiWrap::resolveWebPages() {
|
||||
if (m < INT_MAX) _webPagesTimer.start(m * 1000);
|
||||
}
|
||||
|
||||
void ApiWrap::gotReplyTo(const MTPmessages_Messages &msgs, mtpRequestId req) {
|
||||
switch (msgs.type()) {
|
||||
case mtpc_messages_messages:
|
||||
App::feedUsers(msgs.c_messages_messages().vusers);
|
||||
App::feedChats(msgs.c_messages_messages().vchats);
|
||||
App::feedMsgs(msgs.c_messages_messages().vmessages, -1);
|
||||
break;
|
||||
|
||||
case mtpc_messages_messagesSlice:
|
||||
App::feedUsers(msgs.c_messages_messagesSlice().vusers);
|
||||
App::feedChats(msgs.c_messages_messagesSlice().vchats);
|
||||
App::feedMsgs(msgs.c_messages_messagesSlice().vmessages, -1);
|
||||
break;
|
||||
}
|
||||
for (ReplyToRequests::iterator i = _replyToRequests.begin(); i != _replyToRequests.cend();) {
|
||||
if (i.value().req == req) {
|
||||
for (QList<HistoryReply*>::const_iterator j = i.value().replies.cbegin(), e = i.value().replies.cend(); j != e; ++j) {
|
||||
if (*j) {
|
||||
(*j)->updateReplyTo(true);
|
||||
} else {
|
||||
App::main()->updateReplyTo();
|
||||
}
|
||||
}
|
||||
i = _replyToRequests.erase(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::gotWebPages(const MTPmessages_Messages &msgs, mtpRequestId req) {
|
||||
const QVector<MTPMessage> *v = 0;
|
||||
switch (msgs.type()) {
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
void clearWebPageRequest(WebPageData *page);
|
||||
void clearWebPageRequests();
|
||||
|
||||
void scheduleStickerSetRequest(uint64 setId, uint64 access);
|
||||
void requestStickerSets();
|
||||
|
||||
~ApiWrap();
|
||||
|
||||
signals:
|
||||
@ -71,4 +74,8 @@ private:
|
||||
WebPagesPending _webPagesPending;
|
||||
SingleTimer _webPagesTimer;
|
||||
|
||||
QMap<uint64, QPair<uint64, mtpRequestId> > _stickerSetRequests;
|
||||
void gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result);
|
||||
bool gotStickerSetFail(uint64 setId, const RPCError &error);
|
||||
|
||||
};
|
||||
|
@ -741,6 +741,9 @@ namespace App {
|
||||
History *h = App::historyLoaded(peer);
|
||||
if (h) {
|
||||
h->outboxRead(upTo);
|
||||
if (!h->peer->chat) {
|
||||
h->peer->asUser()->madeAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1577,7 +1580,6 @@ namespace App {
|
||||
if (api()) api()->clearWebPageRequests();
|
||||
cSetRecentStickers(RecentStickerPack());
|
||||
cSetStickersHash(QByteArray());
|
||||
cSetEmojiStickers(EmojiStickersMap());
|
||||
cSetStickerSets(StickerSets());
|
||||
cSetStickerSetsOrder(StickerSetsOrder());
|
||||
cSetLastStickersUpdate(0);
|
||||
|
@ -640,8 +640,8 @@ void Application::checkMapVersion() {
|
||||
psRegisterCustomScheme();
|
||||
if (Local::oldMapVersion()) {
|
||||
QString versionFeatures;
|
||||
if (DevChannel && Local::oldMapVersion() < 8033) {
|
||||
versionFeatures = QString::fromUtf8("\xe2\x80\x94 IPv6 connection checkbox added to Connection Type box in Settings");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
if (DevChannel && Local::oldMapVersion() < 8034) {
|
||||
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
} else if (!DevChannel && Local::oldMapVersion() < 8030) {
|
||||
versionFeatures = lng_new_version_text(lt_blog_link, qsl("https://telegram.org/blog/bot-revolution"));// lang(lng_new_version_text).trimmed();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
#include "localstorage.h"
|
||||
|
||||
StickerSetInner::StickerSetInner(const MTPInputStickerSet &set) :
|
||||
_loaded(false), _setId(0), _setAccess(0), _bottom(0),
|
||||
_loaded(false), _setId(0), _setAccess(0), _setCount(0), _setHash(0), _setFlags(0), _bottom(0),
|
||||
_input(set), _installRequest(0) {
|
||||
switch (set.type()) {
|
||||
case mtpc_inputStickerSetID: _setId = set.c_inputStickerSetID().vid.v; _setAccess = set.c_inputStickerSetID().vaccess_hash.v; break;
|
||||
@ -57,6 +57,9 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
|
||||
_setShortName = qs(s.vshort_name);
|
||||
_setId = s.vid.v;
|
||||
_setAccess = s.vaccess_hash.v;
|
||||
_setCount = s.vcount.v;
|
||||
_setHash = s.vhash.v;
|
||||
_setFlags = s.vflags.v;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,13 +87,25 @@ bool StickerSetInner::failedSet(const RPCError &error) {
|
||||
void StickerSetInner::installDone(const MTPBool &result) {
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
|
||||
sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName)).value().stickers = _pack;
|
||||
int32 index = cStickerSetsOrder().indexOf(_setId);
|
||||
if (index > 0) {
|
||||
cRefStickerSetsOrder().removeAt(index);
|
||||
cRefStickerSetsOrder().push_front(_setId);
|
||||
} else if (index < 0) {
|
||||
cRefStickerSetsOrder().push_front(_setId);
|
||||
sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)).value().stickers = _pack;
|
||||
|
||||
int32 insertAtIndex = 0;
|
||||
StickerSetsOrder &order(cRefStickerSetsOrder());
|
||||
for (int32 s = order.size(); insertAtIndex < s; ++insertAtIndex) {
|
||||
StickerSets::const_iterator i = sets.constFind(order.at(insertAtIndex));
|
||||
if (i == sets.cend() || !(i->flags & MTPDstickerSet_flag_official)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
int32 currentIndex = cStickerSetsOrder().indexOf(_setId);
|
||||
if (currentIndex != insertAtIndex) {
|
||||
if (currentIndex > 0) {
|
||||
order.removeAt(currentIndex);
|
||||
if (currentIndex < insertAtIndex) {
|
||||
--insertAtIndex;
|
||||
}
|
||||
}
|
||||
order.insert(insertAtIndex, _setId);
|
||||
}
|
||||
|
||||
StickerSets::iterator custom = sets.find(CustomStickerSetId);
|
||||
@ -193,7 +208,7 @@ QString StickerSetInner::shortName() const {
|
||||
|
||||
void StickerSetInner::install() {
|
||||
if (_installRequest) return;
|
||||
_installRequest = MTP::send(MTPmessages_InstallStickerSet(_input), rpcDone(&StickerSetInner::installDone), rpcFail(&StickerSetInner::installFailed));
|
||||
_installRequest = MTP::send(MTPmessages_InstallStickerSet(_input, MTP_bool(false)), rpcDone(&StickerSetInner::installDone), rpcFail(&StickerSetInner::installFailed));
|
||||
}
|
||||
|
||||
StickerSetInner::~StickerSetInner() {
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
bool _loaded;
|
||||
uint64 _setId, _setAccess;
|
||||
QString _title, _setTitle, _setShortName;
|
||||
int32 _setCount, _setHash, _setFlags;
|
||||
|
||||
int32 _bottom;
|
||||
MTPInputStickerSet _input;
|
||||
|
@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
static const int32 AppVersion = 8033;
|
||||
static const wchar_t *AppVersionStr = L"0.8.33";
|
||||
static const int32 AppVersion = 8034;
|
||||
static const wchar_t *AppVersionStr = L"0.8.34";
|
||||
static const bool DevChannel = true;
|
||||
|
||||
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
|
||||
|
@ -684,10 +684,11 @@ void EmojiColorPicker::drawVariant(Painter &p, int variant) {
|
||||
p.drawPixmapLeft(w.x() + (st::emojiPanSize.width() - (esize / cIntRetinaFactor())) / 2, w.y() + (st::emojiPanSize.height() - (esize / cIntRetinaFactor())) / 2, width(), App::emojisLarge(), QRect(_variants[variant]->x * esize, _variants[variant]->y * esize, esize, esize));
|
||||
}
|
||||
|
||||
EmojiPanInner::EmojiPanInner(QWidget *parent) : TWidget(parent),
|
||||
EmojiPanInner::EmojiPanInner(QWidget *parent) : TWidget(parent), _maxHeight(int(st::emojiPanMaxHeight)),
|
||||
_top(0), _selected(-1), _pressedSel(-1), _pickerSel(-1), _picker(this),
|
||||
_switcherHover(0), _stickersWidth(st::emojiPanHeaderFont->m.width(lang(lng_switch_stickers))) {
|
||||
resize(st::emojiPanFullSize.width(), countHeight());
|
||||
resize(st::emojiPanWidth, countHeight());
|
||||
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
@ -709,6 +710,11 @@ _switcherHover(0), _stickersWidth(st::emojiPanHeaderFont->m.width(lang(lng_switc
|
||||
connect(&_picker, SIGNAL(hidden()), this, SLOT(onPickerHidden()));
|
||||
}
|
||||
|
||||
void EmojiPanInner::setMaxHeight(int32 h) {
|
||||
_maxHeight = h;
|
||||
resize(st::emojiPanWidth, countHeight());
|
||||
}
|
||||
|
||||
void EmojiPanInner::setScrollTop(int top) {
|
||||
if (top == _top) return;
|
||||
|
||||
@ -1131,10 +1137,11 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) {
|
||||
update();
|
||||
}
|
||||
|
||||
StickerPanInner::StickerPanInner(QWidget *parent) : TWidget(parent),
|
||||
StickerPanInner::StickerPanInner(QWidget *parent) : TWidget(parent), _maxHeight(st::emojiPanMaxHeight),
|
||||
_top(0), _selected(-1), _pressedSel(-1),
|
||||
_switcherHover(0), _emojiWidth(st::emojiPanHeaderFont->m.width(lang(lng_switch_emoji))) {
|
||||
resize(st::emojiPanFullSize.width(), countHeight());
|
||||
resize(st::emojiPanWidth, countHeight());
|
||||
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
@ -1143,6 +1150,11 @@ _switcherHover(0), _emojiWidth(st::emojiPanHeaderFont->m.width(lang(lng_switch_e
|
||||
refreshStickers();
|
||||
}
|
||||
|
||||
void StickerPanInner::setMaxHeight(int32 h) {
|
||||
_maxHeight = h;
|
||||
resize(st::emojiPanWidth, countHeight());
|
||||
}
|
||||
|
||||
void StickerPanInner::setScrollTop(int top) {
|
||||
if (top == _top) return;
|
||||
|
||||
@ -1154,9 +1166,9 @@ void StickerPanInner::setScrollTop(int top) {
|
||||
}
|
||||
|
||||
int StickerPanInner::countHeight() {
|
||||
int result = 0, minLastH = st::emojiPanFullSize.height() - st::rbEmoji.height - st::stickerPanPadding;
|
||||
int result = 0, minLastH = _maxHeight - st::rbEmoji.height - st::stickerPanPadding;
|
||||
for (int i = 0; i < _sets.size(); ++i) {
|
||||
int cnt = _sets.at(i).size(), rows = (cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0);
|
||||
int cnt = _sets.at(i).pack.size(), rows = (cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0);
|
||||
int h = st::emojiPanHeader + rows * st::stickerPanSize.height();
|
||||
if (i == _sets.size() - 1 && h < minLastH) h = minLastH;
|
||||
result += h;
|
||||
@ -1174,21 +1186,21 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
|
||||
int32 y, tilly = 0;
|
||||
for (int c = 0, l = _sets.size(); c < l; ++c) {
|
||||
y = tilly;
|
||||
int32 size = _sets.at(c).size();
|
||||
int32 size = _sets.at(c).pack.size();
|
||||
int32 rows = (size / StickerPanPerRow) + ((size % StickerPanPerRow) ? 1 : 0);
|
||||
tilly = y + st::emojiPanHeader + (rows * st::stickerPanSize.height());
|
||||
if (r.top() >= tilly) continue;
|
||||
|
||||
bool special = (_setIds[c] == DefaultStickerSetId || _setIds[c] == RecentStickerSetId);
|
||||
bool special = (_sets[c].flags & MTPDstickerSet_flag_official);
|
||||
y += st::emojiPanHeader;
|
||||
|
||||
QString title = _titles[c];
|
||||
QString title = _sets[c].title;
|
||||
if (r.bottom() <= y) {
|
||||
p.setFont(st::emojiPanHeaderFont->f);
|
||||
p.setPen(st::emojiPanHeaderColor->p);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft, qMax(y - int(st::emojiPanHeader), _top) + st::emojiPanHeaderTop, width(), title);
|
||||
if (!special && y >= _top + 2 * st::emojiPanHeader) {
|
||||
p.setOpacity(st::stickerPanDeleteOpacity + (1 - st::stickerPanDeleteOpacity) * _hovers[c][size]);
|
||||
p.setOpacity(st::stickerPanDeleteOpacity + (1 - st::stickerPanDeleteOpacity) * _sets[c].hovers[size]);
|
||||
p.drawSpriteRight(QPoint(st::emojiPanHeaderLeft, y - (st::emojiPanHeader + st::notifyClose.icon.pxHeight()) / 2), width(), st::notifyClose.icon);
|
||||
p.setOpacity(1);
|
||||
}
|
||||
@ -1201,9 +1213,9 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
|
||||
int32 index = i * StickerPanPerRow + j;
|
||||
if (index >= size) break;
|
||||
|
||||
float64 hover = _hovers[c][index];
|
||||
float64 hover = _sets[c].hovers[index];
|
||||
|
||||
DocumentData *sticker = _sets[c][index];
|
||||
DocumentData *sticker = _sets[c].pack[index];
|
||||
if (!sticker->sticker) continue;
|
||||
|
||||
QPoint pos(st::stickerPanPadding + j * st::stickerPanSize.width(), y + i * st::stickerPanSize.height());
|
||||
@ -1244,8 +1256,8 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
|
||||
p.drawPixmapLeft(ppos, width(), sticker->sticker->img->pix(w, h));
|
||||
}
|
||||
|
||||
if (hover > 0 && _setIds[c] == RecentStickerSetId && _custom.at(index)) {
|
||||
float64 xHover = _hovers[c][_sets[c].size() + index];
|
||||
if (hover > 0 && _sets[c].id == RecentStickerSetId && _custom.at(index)) {
|
||||
float64 xHover = _sets[c].hovers[_sets[c].pack.size() + index];
|
||||
|
||||
QPoint xPos = pos + QPoint(st::stickerPanSize.width() - st::stickerPanDelete.pxWidth(), 0);
|
||||
p.setOpacity(hover * (xHover + (1 - xHover) * st::stickerPanDeleteOpacity));
|
||||
@ -1258,7 +1270,7 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
|
||||
if (y - st::emojiPanHeader < _top) {
|
||||
p.fillRect(QRect(0, qMin(_top, tilly - int(st::emojiPanHeader)), width(), st::emojiPanHeader), st::emojiPanHeaderBg->b);
|
||||
} else if (!special && y >= _top + 2 * st::emojiPanHeader) {
|
||||
p.setOpacity(st::stickerPanDeleteOpacity + (1 - st::stickerPanDeleteOpacity) * _hovers[c][size]);
|
||||
p.setOpacity(st::stickerPanDeleteOpacity + (1 - st::stickerPanDeleteOpacity) * _sets[c].hovers[size]);
|
||||
p.drawSpriteRight(QPoint(st::emojiPanHeaderLeft, y - (st::emojiPanHeader + st::notifyClose.icon.pxHeight()) / 2), width(), st::notifyClose.icon);
|
||||
p.setOpacity(1);
|
||||
}
|
||||
@ -1293,15 +1305,15 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
emit switchToEmoji();
|
||||
return;
|
||||
}
|
||||
if (_selected >= MatrixRowShift * _setIds.size()) {
|
||||
if (_selected >= MatrixRowShift * _sets.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int tab = (_selected / MatrixRowShift), sel = _selected % MatrixRowShift;
|
||||
if (_setIds[tab] == RecentStickerSetId && sel >= _sets[tab].size() && sel < _sets[tab].size() * 2 && _custom.at(sel - _sets[tab].size())) {
|
||||
if (_sets[tab].id == RecentStickerSetId && sel >= _sets[tab].pack.size() && sel < _sets[tab].pack.size() * 2 && _custom.at(sel - _sets[tab].pack.size())) {
|
||||
clearSelection(true);
|
||||
bool refresh = false;
|
||||
DocumentData *sticker = _sets[tab].at(sel - _sets[tab].size());
|
||||
DocumentData *sticker = _sets[tab].pack.at(sel - _sets[tab].pack.size());
|
||||
RecentStickerPack &recent(cGetRecentStickers());
|
||||
for (int32 i = 0, l = recent.size(); i < l; ++i) {
|
||||
if (recent.at(i).first == sticker) {
|
||||
@ -1333,10 +1345,10 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sel < _sets[tab].size()) {
|
||||
emit selected(_sets[tab][sel]);
|
||||
} else if (sel == _sets[tab].size()) {
|
||||
emit removing(_setIds[tab]);
|
||||
if (sel < _sets[tab].pack.size()) {
|
||||
emit selected(_sets[tab].pack[sel]);
|
||||
} else if (sel == _sets[tab].pack.size()) {
|
||||
emit removing(_sets[tab].id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1363,7 +1375,7 @@ void StickerPanInner::clearSelection(bool fast) {
|
||||
if (fast) {
|
||||
for (Animations::const_iterator i = _animations.cbegin(); i != _animations.cend(); ++i) {
|
||||
int index = qAbs(i.key()) - 1, tab = (index / MatrixRowShift), sel = index % MatrixRowShift;
|
||||
(index == SwitcherSelected ? _switcherHover : _hovers[tab][sel]) = 0;
|
||||
(index == SwitcherSelected ? _switcherHover : _sets[tab].hovers[sel]) = 0;
|
||||
}
|
||||
_animations.clear();
|
||||
_selected = _pressedSel = -1;
|
||||
@ -1377,14 +1389,9 @@ void StickerPanInner::refreshStickers() {
|
||||
clearSelection(true);
|
||||
|
||||
const StickerSets &sets(cStickerSets());
|
||||
_setIds.clear(); _setIds.reserve(sets.size() + 1);
|
||||
_sets.clear(); _sets.reserve(sets.size() + 1);
|
||||
_hovers.clear(); _hovers.reserve(sets.size() + 1);
|
||||
_titles.clear(); _titles.reserve(sets.size() + 1);
|
||||
|
||||
refreshRecent(false);
|
||||
|
||||
appendSet(DefaultStickerSetId);
|
||||
for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) {
|
||||
appendSet(*i);
|
||||
}
|
||||
@ -1400,10 +1407,10 @@ void StickerPanInner::refreshStickers() {
|
||||
void StickerPanInner::preloadImages() {
|
||||
uint64 ms = getms();
|
||||
for (int32 i = 0, l = _sets.size(), k = 0; i < l; ++i) {
|
||||
for (int32 j = 0, n = _sets.at(i).size(); j < n; ++j) {
|
||||
for (int32 j = 0, n = _sets.at(i).pack.size(); j < n; ++j) {
|
||||
if (++k > StickerPanPerRow * (StickerPanPerRow + 1)) break;
|
||||
|
||||
DocumentData *sticker = _sets.at(i).at(j);
|
||||
DocumentData *sticker = _sets.at(i).pack.at(j);
|
||||
if (!sticker || !sticker->sticker) continue;
|
||||
|
||||
bool goodThumb = !sticker->thumb->isNull() && ((sticker->thumb->width() >= 128) || (sticker->thumb->height() >= 128));
|
||||
@ -1430,14 +1437,14 @@ void StickerPanInner::preloadImages() {
|
||||
uint64 StickerPanInner::currentSet(int yOffset) const {
|
||||
int y, ytill = 0;
|
||||
for (int i = 0, l = _sets.size(); i < l; ++i) {
|
||||
int cnt = _sets.at(i).size();
|
||||
int cnt = _sets.at(i).pack.size();
|
||||
y = ytill;
|
||||
ytill = y + st::emojiPanHeader + ((cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0)) * st::stickerPanSize.height();
|
||||
if (yOffset < ytill) {
|
||||
return _setIds.at(i);
|
||||
return _sets.at(i).id;
|
||||
}
|
||||
}
|
||||
return _setIds.isEmpty() ? RecentStickerSetId : _setIds.back();
|
||||
return _sets.isEmpty() ? RecentStickerSetId : _sets.back().id;
|
||||
}
|
||||
|
||||
void StickerPanInner::appendSet(uint64 setId) {
|
||||
@ -1450,11 +1457,9 @@ void StickerPanInner::appendSet(uint64 setId) {
|
||||
for (int32 i = 0, l = it->stickers.size(); i < l; ++i) {
|
||||
pack.push_back(it->stickers.at(i));
|
||||
}
|
||||
_setIds.push_back(it->id);
|
||||
_sets.push_back(pack);
|
||||
_hovers.push_back(QVector<float64>(it->stickers.size() + 1, 0));
|
||||
int32 availw = width() - st::emojiPanHeaderLeft - st::emojiSwitchSkip - _emojiWidth - (st::emojiSwitchSkip - st::emojiSwitchImgSkip);
|
||||
_titles.push_back(st::emojiPanHeaderFont->m.elidedText(it->title, Qt::ElideRight, availw));
|
||||
QString title = st::emojiPanHeaderFont->m.elidedText(it->title, Qt::ElideRight, availw);
|
||||
_sets.push_back(DisplayedSet(it->id, it->flags, title, pack.size() + 1, pack));
|
||||
}
|
||||
|
||||
void StickerPanInner::refreshRecent(bool performResize) {
|
||||
@ -1462,11 +1467,8 @@ void StickerPanInner::refreshRecent(bool performResize) {
|
||||
clearSelection(true);
|
||||
StickerSets::const_iterator customIt = cStickerSets().constFind(CustomStickerSetId);
|
||||
if (cGetRecentStickers().isEmpty() && (customIt == cStickerSets().cend() || customIt->stickers.isEmpty())) {
|
||||
if (!_setIds.isEmpty() && _setIds.at(0) == RecentStickerSetId) {
|
||||
_setIds.pop_front();
|
||||
if (!_sets.isEmpty() && _sets.at(0).id == RecentStickerSetId) {
|
||||
_sets.pop_front();
|
||||
_hovers.pop_front();
|
||||
_titles.pop_front();
|
||||
}
|
||||
} else {
|
||||
StickerPack recent;
|
||||
@ -1489,14 +1491,11 @@ void StickerPanInner::refreshRecent(bool performResize) {
|
||||
_custom.push_back(true);
|
||||
}
|
||||
}
|
||||
if (_setIds.isEmpty() || _setIds.at(0) != RecentStickerSetId) {
|
||||
_setIds.push_front(RecentStickerSetId);
|
||||
_hovers.push_back(QVector<float64>(recent.size() * 2, 0));
|
||||
_sets.push_back(recent);
|
||||
_titles.push_back(lang(lng_emoji_category0));
|
||||
if (_sets.isEmpty() || _sets.at(0).id != RecentStickerSetId) {
|
||||
_sets.push_back(DisplayedSet(RecentStickerSetId, MTPDstickerSet_flag_official, lang(lng_emoji_category0), recent.size() * 2, recent));
|
||||
} else {
|
||||
_sets[0] = recent;
|
||||
_hovers[0].resize(recent.size() * 2);
|
||||
_sets[0].pack = recent;
|
||||
_sets[0].hovers.resize(recent.size() * 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1510,14 +1509,14 @@ void StickerPanInner::refreshRecent(bool performResize) {
|
||||
|
||||
void StickerPanInner::fillIcons(QVector<StickerIcon> &icons) {
|
||||
icons.clear();
|
||||
if (_setIds.isEmpty()) return;
|
||||
if (_sets.isEmpty()) return;
|
||||
|
||||
icons.reserve(_sets.size());
|
||||
int32 i = 0;
|
||||
if (_setIds.at(0) == RecentStickerSetId) ++i;
|
||||
if (_sets.at(0).id == RecentStickerSetId) ++i;
|
||||
if (i > 0) icons.push_back(StickerIcon());
|
||||
for (int32 l = _sets.size(); i < l; ++i) {
|
||||
DocumentData *s = _sets.at(i).at(0);
|
||||
DocumentData *s = _sets.at(i).pack.at(0);
|
||||
int32 availw = st::rbEmoji.width - 2 * st::stickerIconPadding, availh = st::rbEmoji.height - 2 * st::stickerIconPadding;
|
||||
int32 thumbw = s->thumb->width(), thumbh = s->thumb->height(), pixw = 1, pixh = 1;
|
||||
if (availw * thumbh > availh * thumbw) {
|
||||
@ -1529,7 +1528,7 @@ void StickerPanInner::fillIcons(QVector<StickerIcon> &icons) {
|
||||
}
|
||||
if (pixw < 1) pixw = 1;
|
||||
if (pixh < 1) pixh = 1;
|
||||
icons.push_back(StickerIcon(_setIds.at(i), s, pixw, pixh));
|
||||
icons.push_back(StickerIcon(_sets.at(i).id, s, pixw, pixh));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1547,25 +1546,27 @@ void StickerPanInner::updateSelected() {
|
||||
}
|
||||
} else {
|
||||
int y, ytill = 0, sx = (rtl() ? width() - p.x() : p.x()) - st::stickerPanPadding;
|
||||
for (int c = 0, l = _setIds.size(); c < l; ++c) {
|
||||
int cnt = _sets[c].size();
|
||||
bool special = _setIds[c] == DefaultStickerSetId || _setIds[c] == RecentStickerSetId;
|
||||
for (int c = 0, l = _sets.size(); c < l; ++c) {
|
||||
const DisplayedSet &set(_sets.at(c));
|
||||
int cnt = set.pack.size();
|
||||
bool special = (set.flags & MTPDstickerSet_flag_official);
|
||||
|
||||
y = ytill;
|
||||
ytill = y + st::emojiPanHeader + ((cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0)) * st::stickerPanSize.height();
|
||||
if (p.y() >= y && p.y() < ytill) {
|
||||
if (!special && p.y() >= y && p.y() < y + st::emojiPanHeader && sx + st::stickerPanPadding >= width() - st::emojiPanHeaderLeft - st::notifyClose.icon.pxWidth() && sx + st::stickerPanPadding < width() - st::emojiPanHeaderLeft) {
|
||||
selIndex = c * MatrixRowShift + _sets[c].size();
|
||||
selIndex = c * MatrixRowShift + set.pack.size();
|
||||
} else {
|
||||
y += st::emojiPanHeader;
|
||||
if (p.y() >= y && sx >= 0 && sx < StickerPanPerRow * st::stickerPanSize.width()) {
|
||||
selIndex = qFloor((p.y() - y) / st::stickerPanSize.height()) * StickerPanPerRow + qFloor(sx / st::stickerPanSize.width());
|
||||
if (selIndex >= _sets[c].size()) {
|
||||
if (selIndex >= set.pack.size()) {
|
||||
selIndex = -1;
|
||||
} else {
|
||||
if (_setIds[c] == RecentStickerSetId && _custom[selIndex]) {
|
||||
if (set.id == RecentStickerSetId && _custom[selIndex]) {
|
||||
int32 inx = sx - (selIndex % StickerPanPerRow) * st::stickerPanSize.width(), iny = p.y() - y - ((selIndex / StickerPanPerRow) * st::stickerPanSize.height());
|
||||
if (inx >= st::stickerPanSize.width() - st::stickerPanDelete.pxWidth() && iny < st::stickerPanDelete.pxHeight()) {
|
||||
selIndex += _sets[c].size();
|
||||
selIndex += set.pack.size();
|
||||
}
|
||||
}
|
||||
selIndex += c * MatrixRowShift;
|
||||
@ -1579,13 +1580,13 @@ void StickerPanInner::updateSelected() {
|
||||
|
||||
bool startanim = false;
|
||||
int oldSel = _selected, oldSelTab = oldSel / MatrixRowShift, xOldSel = -1, newSel = selIndex, newSelTab = newSel / MatrixRowShift, xNewSel = -1;
|
||||
if (oldSel >= 0 && oldSelTab < _setIds.size() && _setIds[oldSelTab] == RecentStickerSetId && oldSel >= oldSelTab * MatrixRowShift + _sets[oldSelTab].size()) {
|
||||
if (oldSel >= 0 && oldSelTab < _sets.size() && _sets[oldSelTab].id == RecentStickerSetId && oldSel >= oldSelTab * MatrixRowShift + _sets[oldSelTab].pack.size()) {
|
||||
xOldSel = oldSel;
|
||||
oldSel -= _sets[oldSelTab].size();
|
||||
oldSel -= _sets[oldSelTab].pack.size();
|
||||
}
|
||||
if (newSel >= 0 && newSelTab < _setIds.size() && _setIds[newSelTab] == RecentStickerSetId && newSel >= newSelTab * MatrixRowShift + _sets[newSelTab].size()) {
|
||||
if (newSel >= 0 && newSelTab < _sets.size() && _sets[newSelTab].id == RecentStickerSetId && newSel >= newSelTab * MatrixRowShift + _sets[newSelTab].pack.size()) {
|
||||
xNewSel = newSel;
|
||||
newSel -= _sets[newSelTab].size();
|
||||
newSel -= _sets[newSelTab].pack.size();
|
||||
}
|
||||
if (newSel != oldSel) {
|
||||
if (oldSel >= 0) {
|
||||
@ -1630,10 +1631,10 @@ bool StickerPanInner::animStep(float64 ms) {
|
||||
int index = qAbs(i.key()) - 1, tab = (index / MatrixRowShift), sel = index % MatrixRowShift;
|
||||
float64 dt = float64(now - i.value()) / st::emojiPanDuration;
|
||||
if (dt >= 1) {
|
||||
(index == SwitcherSelected ? _switcherHover : _hovers[tab][sel]) = (i.key() > 0) ? 1 : 0;
|
||||
(index == SwitcherSelected ? _switcherHover : _sets[tab].hovers[sel]) = (i.key() > 0) ? 1 : 0;
|
||||
i = _animations.erase(i);
|
||||
} else {
|
||||
(index == SwitcherSelected ? _switcherHover : _hovers[tab][sel]) = (i.key() > 0) ? dt : (1 - dt);
|
||||
(index == SwitcherSelected ? _switcherHover : _sets[tab].hovers[sel]) = (i.key() > 0) ? dt : (1 - dt);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@ -1645,9 +1646,9 @@ void StickerPanInner::showStickerSet(uint64 setId) {
|
||||
clearSelection(true);
|
||||
|
||||
int32 y = 0;
|
||||
for (int c = 0; c < _setIds.size(); ++c) {
|
||||
if (_setIds.at(c) == setId) break;
|
||||
int rows = (_sets[c].size() / StickerPanPerRow) + ((_sets[c].size() % StickerPanPerRow) ? 1 : 0);
|
||||
for (int c = 0; c < _sets.size(); ++c) {
|
||||
if (_sets.at(c).id == setId) break;
|
||||
int rows = (_sets[c].pack.size() / StickerPanPerRow) + ((_sets[c].pack.size() % StickerPanPerRow) ? 1 : 0);
|
||||
y += st::emojiPanHeader + rows * st::stickerPanSize.height();
|
||||
}
|
||||
|
||||
@ -1658,7 +1659,7 @@ void StickerPanInner::showStickerSet(uint64 setId) {
|
||||
update();
|
||||
}
|
||||
|
||||
EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent),
|
||||
EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent), _maxHeight(st::emojiPanMaxHeight),
|
||||
_horizontal(false), _noTabUpdate(false), _hiding(false), a_opacity(0), _shadow(st::dropdownDef.shadow),
|
||||
_recent(this , qsl("emoji_group"), dbietRecent , QString(), true , st::rbEmojiRecent),
|
||||
_people(this , qsl("emoji_group"), dbietPeople , QString(), false, st::rbEmojiPeople),
|
||||
@ -1679,12 +1680,12 @@ e_scroll(this, st::emojiScroll), e_inner(), s_scroll(this, st::emojiScroll), s_i
|
||||
s_scroll.setFocusPolicy(Qt::NoFocus);
|
||||
s_scroll.viewport()->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
_width = st::dropdownDef.padding.left() + st::emojiPanFullSize.width() + st::dropdownDef.padding.right();
|
||||
_height = st::dropdownDef.padding.top() + st::emojiPanFullSize.height() + st::dropdownDef.padding.bottom();
|
||||
_width = st::dropdownDef.padding.left() + st::emojiPanWidth + st::dropdownDef.padding.right();
|
||||
_height = st::dropdownDef.padding.top() + _maxHeight + st::dropdownDef.padding.bottom();
|
||||
resize(_width, _height);
|
||||
|
||||
e_scroll.resize(st::emojiPanFullSize.width(), st::emojiPanFullSize.height() - st::rbEmoji.height);
|
||||
s_scroll.resize(st::emojiPanFullSize.width(), st::emojiPanFullSize.height() - st::rbEmoji.height);
|
||||
e_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
s_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
|
||||
e_scroll.move(st::dropdownDef.padding.left(), st::dropdownDef.padding.top());
|
||||
e_scroll.setWidget(&e_inner);
|
||||
@ -1696,8 +1697,8 @@ e_scroll(this, st::emojiScroll), e_inner(), s_scroll(this, st::emojiScroll), s_i
|
||||
s_inner.setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
s_scroll.setAutoFillBackground(true);
|
||||
|
||||
int32 left = _iconsLeft = st::dropdownDef.padding.left() + (st::emojiPanFullSize.width() - 8 * st::rbEmoji.width) / 2;
|
||||
int32 top = _iconsTop = st::dropdownDef.padding.top() + st::emojiPanFullSize.height() - st::rbEmoji.height;
|
||||
int32 left = _iconsLeft = st::dropdownDef.padding.left() + (st::emojiPanWidth - 8 * st::rbEmoji.width) / 2;
|
||||
int32 top = _iconsTop = st::dropdownDef.padding.top() + _maxHeight - st::rbEmoji.height;
|
||||
prepareTab(left, top, _width, _recent);
|
||||
prepareTab(left, top, _width, _people);
|
||||
prepareTab(left, top, _width, _nature);
|
||||
@ -1735,6 +1736,41 @@ e_scroll(this, st::emojiScroll), e_inner(), s_scroll(this, st::emojiScroll), s_i
|
||||
// setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
}
|
||||
|
||||
void EmojiPan::setMaxHeight(int32 h) {
|
||||
h = qMin(int(st::emojiPanMaxHeight), h);
|
||||
if (h == _maxHeight) return;
|
||||
|
||||
int32 was = _maxHeight;
|
||||
_maxHeight = h;
|
||||
|
||||
_height = st::dropdownDef.padding.top() + _maxHeight + st::dropdownDef.padding.bottom();
|
||||
resize(_width, _height);
|
||||
|
||||
if (was > _maxHeight) {
|
||||
e_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
s_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
s_inner.setMaxHeight(_maxHeight);
|
||||
e_inner.setMaxHeight(_maxHeight);
|
||||
} else {
|
||||
s_inner.setMaxHeight(_maxHeight);
|
||||
e_inner.setMaxHeight(_maxHeight);
|
||||
e_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
s_scroll.resize(st::emojiPanWidth, _maxHeight - st::rbEmoji.height);
|
||||
}
|
||||
|
||||
_iconsTop = st::dropdownDef.padding.top() + _maxHeight - st::rbEmoji.height;
|
||||
_recent.move(_recent.x(), _iconsTop);
|
||||
_people.move(_people.x(), _iconsTop);
|
||||
_nature.move(_nature.x(), _iconsTop);
|
||||
_food.move(_food.x(), _iconsTop);
|
||||
_celebration.move(_celebration.x(), _iconsTop);
|
||||
_activity.move(_activity.x(), _iconsTop);
|
||||
_travel.move(_travel.x(), _iconsTop);
|
||||
_objects.move(_objects.x(), _iconsTop);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void EmojiPan::prepareTab(int32 &left, int32 top, int32 _width, FlatRadiobutton &tab) {
|
||||
tab.moveToLeft(left, top, _width);
|
||||
left += tab.width();
|
||||
@ -2362,9 +2398,9 @@ void EmojiPan::onSwitch() {
|
||||
hideAll();
|
||||
_moveStart = getms();
|
||||
|
||||
a_toCoord = (_stickersShown != rtl()) ? anim::ivalue(st::emojiPanFullSize.width(), 0) : anim::ivalue(-st::emojiPanFullSize.width(), 0);
|
||||
a_toCoord = (_stickersShown != rtl()) ? anim::ivalue(st::emojiPanWidth, 0) : anim::ivalue(-st::emojiPanWidth, 0);
|
||||
a_toAlpha = anim::fvalue(0, 1);
|
||||
a_fromCoord = (_stickersShown != rtl()) ? anim::ivalue(0, -st::emojiPanFullSize.width()) : anim::ivalue(0, st::emojiPanFullSize.width());
|
||||
a_fromCoord = (_stickersShown != rtl()) ? anim::ivalue(0, -st::emojiPanWidth) : anim::ivalue(0, st::emojiPanWidth);
|
||||
a_fromAlpha = anim::fvalue(1, 0);
|
||||
|
||||
if (!animating()) anim::start(this);
|
||||
@ -2373,7 +2409,7 @@ void EmojiPan::onSwitch() {
|
||||
|
||||
void EmojiPan::onRemoveSet(uint64 setId) {
|
||||
StickerSets::const_iterator it = cStickerSets().constFind(setId);
|
||||
if (it != cStickerSets().cend() && setId != DefaultStickerSetId && setId != RecentStickerSetId) {
|
||||
if (it != cStickerSets().cend() && !(it->flags & MTPDstickerSet_flag_official)) {
|
||||
_removingSetId = it->id;
|
||||
ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title));
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure()));
|
||||
@ -2385,7 +2421,7 @@ void EmojiPan::onRemoveSet(uint64 setId) {
|
||||
void EmojiPan::onRemoveSetSure() {
|
||||
App::wnd()->hideLayer();
|
||||
StickerSets::iterator it = cRefStickerSets().find(_removingSetId);
|
||||
if (it != cRefStickerSets().cend() && _removingSetId != DefaultStickerSetId && _removingSetId != RecentStickerSetId) {
|
||||
if (it != cRefStickerSets().cend() && !(it->flags & MTPDstickerSet_flag_official)) {
|
||||
if (it->id && it->access) {
|
||||
MTP::send(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access))));
|
||||
} else if (!it->shortName.isEmpty()) {
|
||||
|
@ -202,6 +202,7 @@ public:
|
||||
|
||||
EmojiPanInner(QWidget *parent = 0);
|
||||
|
||||
void setMaxHeight(int32 h);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
@ -244,6 +245,8 @@ signals:
|
||||
|
||||
private:
|
||||
|
||||
int32 _maxHeight;
|
||||
|
||||
int32 countHeight();
|
||||
void selectEmoji(EmojiPtr emoji);
|
||||
|
||||
@ -286,6 +289,7 @@ public:
|
||||
|
||||
StickerPanInner(QWidget *parent = 0);
|
||||
|
||||
void setMaxHeight(int32 h);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
@ -329,6 +333,8 @@ signals:
|
||||
|
||||
private:
|
||||
|
||||
int32 _maxHeight;
|
||||
|
||||
void appendSet(uint64 setId);
|
||||
|
||||
int32 countHeight();
|
||||
@ -339,10 +345,16 @@ private:
|
||||
|
||||
int32 _top;
|
||||
|
||||
QList<QString> _titles;
|
||||
QList<uint64> _setIds;
|
||||
QList<StickerPack> _sets;
|
||||
QList<QVector<float64> > _hovers;
|
||||
struct DisplayedSet {
|
||||
DisplayedSet(uint64 id, int32 flags, const QString &title, int32 hoversSize, const StickerPack &pack = StickerPack()) : id(id), flags(flags), title(title), hovers(hoversSize, 0), pack(pack) {
|
||||
}
|
||||
uint64 id;
|
||||
int32 flags;
|
||||
QString title;
|
||||
QVector<float64> hovers;
|
||||
StickerPack pack;
|
||||
};
|
||||
QList<DisplayedSet> _sets;
|
||||
QList<bool> _custom;
|
||||
|
||||
int32 _selected, _pressedSel;
|
||||
@ -359,6 +371,7 @@ public:
|
||||
|
||||
EmojiPan(QWidget *parent);
|
||||
|
||||
void setMaxHeight(int32 h);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
void enterEvent(QEvent *e);
|
||||
@ -412,6 +425,7 @@ signals:
|
||||
|
||||
private:
|
||||
|
||||
int32 _maxHeight;
|
||||
bool _horizontal;
|
||||
|
||||
void leaveToChildEvent(QEvent *e);
|
||||
|
@ -2123,15 +2123,55 @@ const QString HistoryVideo::inHistoryText() const {
|
||||
}
|
||||
|
||||
bool HistoryVideo::hasPoint(int32 x, int32 y, const HistoryItem *parent, int32 width) const {
|
||||
int32 height = _height;
|
||||
if (width < 0) {
|
||||
width = w;
|
||||
} else if (!_caption.isEmpty()) {
|
||||
height = countHeight(parent, width);
|
||||
}
|
||||
if (width >= _maxw) {
|
||||
width = _maxw;
|
||||
}
|
||||
return (x >= 0 && y >= 0 && x < width && y < height);
|
||||
}
|
||||
|
||||
int32 HistoryVideo::countHeight(const HistoryItem *parent, int32 width) const {
|
||||
if (_caption.isEmpty()) return _height;
|
||||
|
||||
if (width < 0) width = w;
|
||||
if (width >= _maxw) {
|
||||
width = _maxw;
|
||||
}
|
||||
return (x >= 0 && y >= 0 && x < width && y < _height);
|
||||
|
||||
int32 h = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom();
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
h += st::msgPadding.top() + st::msgNameFont->height;
|
||||
}
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
h += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) {
|
||||
if (parent->out() || !parent->history()->peer->chat) {
|
||||
h += st::msgPadding.top();
|
||||
}
|
||||
h += st::msgServiceNameFont->height;
|
||||
}
|
||||
if (!_caption.isEmpty()) {
|
||||
int32 textw = width - st::mediaPadding.left() - st::mediaPadding.right();
|
||||
if (!parent->out()) { // substract Download / Save As button
|
||||
textw -= st::mediaSaveDelta + _buttonWidth;
|
||||
}
|
||||
h += st::webPagePhotoSkip + _caption.countHeight(textw);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
void HistoryVideo::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent, int32 width) const {
|
||||
if (width < 0) width = w;
|
||||
int32 height = _height;
|
||||
if (width < 0) {
|
||||
width = w;
|
||||
} else if (!_caption.isEmpty()) {
|
||||
height = countHeight(parent, width);
|
||||
}
|
||||
if (width < 1) return;
|
||||
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
@ -2157,7 +2197,7 @@ void HistoryVideo::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x
|
||||
}
|
||||
|
||||
if (!out) { // draw Download / Save As button
|
||||
int32 h = _height;
|
||||
int32 h = height;
|
||||
if (!_caption.isEmpty()) {
|
||||
h -= st::webPagePhotoSkip + _caption.countHeight(width - _buttonWidth - st::mediaSaveDelta - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
}
|
||||
@ -2203,7 +2243,12 @@ HistoryMedia *HistoryVideo::clone() const {
|
||||
}
|
||||
|
||||
void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const {
|
||||
if (width < 0) width = w;
|
||||
int32 height = _height;
|
||||
if (width < 0) {
|
||||
width = w;
|
||||
} else if (!_caption.isEmpty()) {
|
||||
height = countHeight(parent, width);
|
||||
}
|
||||
if (width < 1) return;
|
||||
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
@ -2235,7 +2280,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
pressed = hovered && ((data->loader ? _cancell : _savel) == textlnkDown());
|
||||
if (hovered && !pressed && textlnkDown()) hovered = false;
|
||||
|
||||
int32 h = _height;
|
||||
int32 h = height;
|
||||
if (!_caption.isEmpty()) {
|
||||
h -= st::webPagePhotoSkip + _caption.countHeight(width - _buttonWidth - st::mediaSaveDelta - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
}
|
||||
@ -2257,7 +2302,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
style::color bg(selected ? (out ? st::msgOutSelectBg : st::msgInSelectBg) : (out ? st::msgOutBg : st::msgInBg));
|
||||
style::color sh(selected ? (out ? st::msgOutSelectShadow : st::msgInSelectShadow) : (out ? st::msgOutShadow : st::msgInShadow));
|
||||
RoundCorners cors(selected ? (out ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out ? MessageOutCorners : MessageInCorners));
|
||||
App::roundRect(p, 0, 0, width, _height, bg, cors, &sh);
|
||||
App::roundRect(p, 0, 0, width, height, bg, cors, &sh);
|
||||
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
p.setFont(st::msgNameFont->f);
|
||||
@ -2334,9 +2379,9 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor));
|
||||
p.setPen(date->p);
|
||||
|
||||
p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, parent->time());
|
||||
p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, parent->time());
|
||||
if (out) {
|
||||
QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
|
||||
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()) {
|
||||
@ -3049,22 +3094,6 @@ HistorySticker::HistorySticker(DocumentData *document) : HistoryMedia()
|
||||
, pixw(1), pixh(1), data(document), lastw(0)
|
||||
{
|
||||
data->thumb->load();
|
||||
updateStickerEmoji();
|
||||
}
|
||||
|
||||
bool HistorySticker::updateStickerEmoji() {
|
||||
if (!data->sticker->alt.isEmpty()) {
|
||||
_emoji = data->sticker->alt;
|
||||
return true;
|
||||
}
|
||||
const EmojiStickersMap &stickers(cEmojiStickers());
|
||||
EmojiStickersMap::const_iterator i = stickers.constFind(data);
|
||||
QString emoji = (i == stickers.cend()) ? QString() : emojiString(i.value());
|
||||
if (emoji != _emoji) {
|
||||
_emoji = emoji;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void HistorySticker::initDimensions(const HistoryItem *parent) {
|
||||
@ -5169,15 +5198,6 @@ QString HistoryMessage::notificationText() const {
|
||||
return msg;
|
||||
}
|
||||
|
||||
void HistoryMessage::updateStickerEmoji() {
|
||||
if (_media) {
|
||||
if (_media->updateStickerEmoji()) {
|
||||
_history->textCachedFor = 0;
|
||||
if (App::wnd()) App::wnd()->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HistoryMessage::~HistoryMessage() {
|
||||
if (_media) {
|
||||
_media->unregItem(this);
|
||||
|
@ -724,8 +724,6 @@ public:
|
||||
}
|
||||
virtual void updateMedia(const MTPMessageMedia &media) {
|
||||
}
|
||||
virtual void updateStickerEmoji() {
|
||||
}
|
||||
|
||||
virtual QString selectedText(uint32 selection) const {
|
||||
return qsl("[-]");
|
||||
@ -856,10 +854,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool updateStickerEmoji() {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool animating() const {
|
||||
return false;
|
||||
}
|
||||
@ -947,6 +941,7 @@ public:
|
||||
const QString inDialogsText() const;
|
||||
const QString inHistoryText() const;
|
||||
bool hasPoint(int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const;
|
||||
int32 countHeight(const HistoryItem *parent, int32 width = -1) const;
|
||||
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const;
|
||||
bool uploading() const {
|
||||
return (data->status == FileUploading);
|
||||
@ -1086,7 +1081,6 @@ public:
|
||||
void unregItem(HistoryItem *item);
|
||||
|
||||
void updateFrom(const MTPMessageMedia &media);
|
||||
bool updateStickerEmoji();
|
||||
|
||||
private:
|
||||
|
||||
@ -1292,7 +1286,6 @@ public:
|
||||
_media->updateFrom(media);
|
||||
}
|
||||
}
|
||||
void updateStickerEmoji();
|
||||
|
||||
QString selectedText(uint32 selection) const;
|
||||
QString inDialogsText() const;
|
||||
|
@ -491,6 +491,90 @@ void HistoryList::dragActionCancel() {
|
||||
historyWidget->noSelectingScroll();
|
||||
}
|
||||
|
||||
void HistoryList::dragExec() {
|
||||
bool uponSelected = false;
|
||||
if (_dragItem) {
|
||||
bool afterDragSymbol;
|
||||
uint16 symbol;
|
||||
if (!_selected.isEmpty() && _selected.cbegin().value() == FullItemSel) {
|
||||
uponSelected = _selected.contains(_dragItem);
|
||||
} else {
|
||||
_dragItem->getSymbol(symbol, afterDragSymbol, uponSelected, _dragStartPos.x(), _dragStartPos.y());
|
||||
if (uponSelected) {
|
||||
if (_selected.isEmpty() ||
|
||||
_selected.cbegin().value() == FullItemSel ||
|
||||
_selected.cbegin().key() != _dragItem
|
||||
) {
|
||||
uponSelected = false;
|
||||
} else {
|
||||
uint16 selFrom = (_selected.cbegin().value() >> 16) & 0xFFFF, selTo = _selected.cbegin().value() & 0xFFFF;
|
||||
if (symbol < selFrom || symbol >= selTo) {
|
||||
uponSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QString sel;
|
||||
QList<QUrl> urls;
|
||||
if (uponSelected) {
|
||||
sel = getSelectedText();
|
||||
} else if (textlnkDown()) {
|
||||
sel = textlnkDown()->encoded();
|
||||
if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
urls.push_back(QUrl::fromEncoded(sel.toUtf8()));
|
||||
}
|
||||
}
|
||||
if (!sel.isEmpty()) {
|
||||
updateDragSelection(0, 0, false);
|
||||
historyWidget->noSelectingScroll();
|
||||
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
mimeData->setText(sel);
|
||||
if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
if (uponSelected && !_selected.isEmpty() && _selected.cbegin().value() == FullItemSel && cWideMode()) {
|
||||
mimeData->setData(qsl("application/x-td-forward-selected"), "1");
|
||||
}
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec();
|
||||
return;
|
||||
} else {
|
||||
HistoryItem *pressedLnkItem = App::pressedLinkItem(), *pressedItem = App::pressedItem();
|
||||
QLatin1String lnkType = (textlnkDown() && pressedLnkItem) ? textlnkDown()->type() : qstr("");
|
||||
bool lnkPhoto = (lnkType == qstr("PhotoLink")),
|
||||
lnkVideo = (lnkType == qstr("VideoOpenLink")),
|
||||
lnkAudio = (lnkType == qstr("AudioOpenLink")),
|
||||
lnkDocument = (lnkType == qstr("DocumentOpenLink")),
|
||||
lnkContact = (lnkType == qstr("PeerLink") && dynamic_cast<HistoryContact*>(pressedLnkItem->getMedia())),
|
||||
dragSticker = dynamic_cast<HistorySticker*>(pressedItem ? pressedItem->getMedia() : 0),
|
||||
dragByDate = (_dragCursorState == HistoryInDateCursorState);
|
||||
if (lnkPhoto || lnkVideo || lnkAudio || lnkDocument || lnkContact || dragSticker || dragByDate) {
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
if (dragSticker || dragByDate) {
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed"), "1");
|
||||
} else {
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed-link"), "1");
|
||||
}
|
||||
if (lnkDocument) {
|
||||
QString already = static_cast<DocumentOpenLink*>(textlnkDown().data())->document()->already(true);
|
||||
if (!already.isEmpty()) {
|
||||
QList<QUrl> urls;
|
||||
urls.push_back(QUrl::fromLocalFile(already));
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
}
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryList::itemRemoved(HistoryItem *item) {
|
||||
SelectedItems::iterator i = _selected.find(item);
|
||||
if (i != _selected.cend()) {
|
||||
@ -1280,93 +1364,7 @@ void HistoryList::onUpdateSelected() {
|
||||
if (item != _dragItem || (m - _dragStartPos).manhattanLength() >= QApplication::startDragDistance()) {
|
||||
if (_dragAction == PrepareDrag) {
|
||||
_dragAction = Dragging;
|
||||
|
||||
bool uponSelected = false;
|
||||
if (_dragItem) {
|
||||
bool afterDragSymbol;
|
||||
uint16 symbol;
|
||||
if (!_selected.isEmpty() && _selected.cbegin().value() == FullItemSel) {
|
||||
uponSelected = _selected.contains(_dragItem);
|
||||
} else {
|
||||
_dragItem->getSymbol(symbol, afterDragSymbol, uponSelected, _dragStartPos.x(), _dragStartPos.y());
|
||||
if (uponSelected) {
|
||||
if (_selected.isEmpty() ||
|
||||
_selected.cbegin().value() == FullItemSel ||
|
||||
_selected.cbegin().key() != _dragItem
|
||||
) {
|
||||
uponSelected = false;
|
||||
} else {
|
||||
uint16 selFrom = (_selected.cbegin().value() >> 16) & 0xFFFF, selTo = _selected.cbegin().value() & 0xFFFF;
|
||||
if (symbol < selFrom || symbol >= selTo) {
|
||||
uponSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QString sel;
|
||||
QList<QUrl> urls;
|
||||
if (uponSelected) {
|
||||
sel = getSelectedText();
|
||||
} else if (textlnkDown()) {
|
||||
sel = textlnkDown()->encoded();
|
||||
if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
urls.push_back(QUrl::fromEncoded(sel.toUtf8()));
|
||||
}
|
||||
}
|
||||
if (!sel.isEmpty()) {
|
||||
updateDragSelection(0, 0, false);
|
||||
historyWidget->noSelectingScroll();
|
||||
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
mimeData->setText(sel);
|
||||
if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
if (uponSelected && !_selected.isEmpty() && _selected.cbegin().value() == FullItemSel && cWideMode()) {
|
||||
QStringList ids;
|
||||
ids.reserve(_selected.size());
|
||||
for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) {
|
||||
ids.push_back(QString::number(i.key()->id, 16));
|
||||
}
|
||||
mimeData->setData(qsl("application/x-td-forward-selected"), "1");
|
||||
}
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec();
|
||||
return;
|
||||
} else {
|
||||
HistoryItem *pressedLnkItem = App::pressedLinkItem(), *pressedItem = App::pressedItem();
|
||||
QLatin1String lnkType = (textlnkDown() && pressedLnkItem) ? textlnkDown()->type() : qstr("");
|
||||
bool lnkPhoto = (lnkType == qstr("PhotoLink")),
|
||||
lnkVideo = (lnkType == qstr("VideoOpenLink")),
|
||||
lnkAudio = (lnkType == qstr("AudioOpenLink")),
|
||||
lnkDocument = (lnkType == qstr("DocumentOpenLink")),
|
||||
lnkContact = (lnkType == qstr("PeerLink") && dynamic_cast<HistoryContact*>(pressedLnkItem->getMedia())),
|
||||
dragSticker = dynamic_cast<HistorySticker*>(pressedItem ? pressedItem->getMedia() : 0),
|
||||
dragByDate = (_dragCursorState == HistoryInDateCursorState);
|
||||
if (lnkPhoto || lnkVideo || lnkAudio || lnkDocument || lnkContact || dragSticker || dragByDate) {
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
if (dragSticker || dragByDate) {
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed"), "1");
|
||||
} else {
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed-link"), "1");
|
||||
}
|
||||
if (lnkDocument) {
|
||||
QString already = static_cast<DocumentOpenLink*>(textlnkDown().data())->document()->already(true);
|
||||
if (!already.isEmpty()) {
|
||||
QList<QUrl> urls;
|
||||
urls.push_back(QUrl::fromLocalFile(already));
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
}
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
dragExec();
|
||||
} else if (_dragAction == PrepareSelect) {
|
||||
_dragAction = Selecting;
|
||||
}
|
||||
@ -2478,9 +2476,6 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
|
||||
if (stickers.type() != mtpc_messages_allStickers) return;
|
||||
const MTPDmessages_allStickers &d(stickers.c_messages_allStickers());
|
||||
|
||||
EmojiStickersMap map;
|
||||
|
||||
const QVector<MTPDocument> &d_docs(d.vdocuments.c_vector().v);
|
||||
const QVector<MTPStickerSet> &d_sets(d.vsets.c_vector().v);
|
||||
|
||||
QByteArray wasHash = cStickersHash();
|
||||
@ -2490,183 +2485,62 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
|
||||
setsOrder.clear();
|
||||
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
StickerSets::iterator def = sets.find(DefaultStickerSetId);
|
||||
if (def == sets.cend()) {
|
||||
def = sets.insert(DefaultStickerSetId, StickerSet(DefaultStickerSetId, 0, lang(lng_stickers_default_set), QString()));
|
||||
QMap<uint64, uint64> setsToRequest;
|
||||
for (StickerSets::iterator i = sets.begin(), e = sets.end(); i != e; ++i) {
|
||||
i->access = 0; // mark for removing
|
||||
}
|
||||
for (int32 i = 0, l = d_sets.size(); i != l; ++i) {
|
||||
if (d_sets.at(i).type() == mtpc_stickerSet) {
|
||||
const MTPDstickerSet &set(d_sets.at(i).c_stickerSet());
|
||||
StickerSets::iterator i = sets.find(set.vid.v);
|
||||
setsOrder.push_back(set.vid.v);
|
||||
QString title = qs(set.vtitle);
|
||||
if (set.vflags.v & MTPDstickerSet_flag_official) {
|
||||
if (!title.compare(qstr("Great Minds"), Qt::CaseInsensitive)) {
|
||||
title = lang(lng_stickers_default_set);
|
||||
}
|
||||
setsOrder.push_front(set.vid.v);
|
||||
} else {
|
||||
setsOrder.push_back(set.vid.v);
|
||||
}
|
||||
|
||||
if (i == sets.cend()) {
|
||||
i = sets.insert(set.vid.v, StickerSet(set.vid.v, set.vaccess_hash.v, qs(set.vtitle), qs(set.vshort_name)));
|
||||
i = sets.insert(set.vid.v, StickerSet(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | MTPDstickerSet_flag_NOT_LOADED));
|
||||
if (!(i->flags & MTPDstickerSet_flag_disabled)) {
|
||||
setsToRequest.insert(set.vid.v, set.vaccess_hash.v);
|
||||
}
|
||||
} else {
|
||||
i->access = set.vaccess_hash.v;
|
||||
i->title = qs(set.vtitle);
|
||||
i->title = title;
|
||||
i->shortName = qs(set.vshort_name);
|
||||
i->flags = set.vflags.v;
|
||||
if (i->count != set.vcount.v || i->hash != set.vhash.v) {
|
||||
i->count = set.vcount.v;
|
||||
i->hash = set.vhash.v;
|
||||
i->flags |= MTPDstickerSet_flag_NOT_LOADED; // need to request this set
|
||||
if (!(i->flags & MTPDstickerSet_flag_disabled)) {
|
||||
setsToRequest.insert(set.vid.v, set.vaccess_hash.v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StickerSets::iterator custom = sets.find(CustomStickerSetId);
|
||||
|
||||
bool added = false, removed = false;
|
||||
QSet<DocumentData*> found;
|
||||
QMap<uint64, int32> wasCount;
|
||||
for (int32 i = 0, l = d_docs.size(); i != l; ++i) {
|
||||
DocumentData *doc = App::feedDocument(d_docs.at(i));
|
||||
if (!doc || !doc->sticker) continue;
|
||||
|
||||
switch (doc->sticker->set.type()) {
|
||||
case mtpc_inputStickerSetEmpty: { // default set - great minds
|
||||
if (!wasCount.contains(DefaultStickerSetId)) wasCount.insert(DefaultStickerSetId, def->stickers.size());
|
||||
if (def->stickers.indexOf(doc) < 0) {
|
||||
def->stickers.push_back(doc);
|
||||
added = true;
|
||||
} else {
|
||||
found.insert(doc);
|
||||
}
|
||||
} break;
|
||||
case mtpc_inputStickerSetID: {
|
||||
StickerSets::iterator it = sets.find(doc->sticker->set.c_inputStickerSetID().vid.v);
|
||||
if (it == sets.cend()) {
|
||||
LOG(("Sticker Set not found by ID: %1").arg(doc->sticker->set.c_inputStickerSetID().vid.v));
|
||||
} else {
|
||||
if (!wasCount.contains(it->id)) wasCount.insert(it->id, it->stickers.size());
|
||||
if (it->stickers.indexOf(doc) < 0) {
|
||||
it->stickers.push_back(doc);
|
||||
added = true;
|
||||
} else {
|
||||
found.insert(doc);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case mtpc_inputStickerSetShortName: {
|
||||
QString name = qs(doc->sticker->set.c_inputStickerSetShortName().vshort_name).toLower().trimmed();
|
||||
StickerSets::iterator it = sets.begin();
|
||||
for (; it != sets.cend(); ++it) {
|
||||
if (it->shortName.toLower().trimmed() == name) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (it == sets.cend()) {
|
||||
LOG(("Sticker Set not found by name: %1").arg(name));
|
||||
} else {
|
||||
if (!wasCount.contains(it->id)) wasCount.insert(it->id, it->stickers.size());
|
||||
if (it->stickers.indexOf(doc) < 0) {
|
||||
it->stickers.push_back(doc);
|
||||
added = true;
|
||||
} else {
|
||||
found.insert(doc);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
if (custom != sets.cend()) {
|
||||
int32 index = custom->stickers.indexOf(doc);
|
||||
if (index >= 0) {
|
||||
custom->stickers.removeAt(index);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (custom != sets.cend() && custom->stickers.isEmpty()) {
|
||||
sets.erase(custom);
|
||||
custom = sets.end();
|
||||
}
|
||||
bool writeRecent = false;
|
||||
RecentStickerPack &recent(cGetRecentStickers());
|
||||
for (StickerSets::iterator it = sets.begin(); it != sets.cend();) {
|
||||
if (it->id == CustomStickerSetId || it->id == RecentStickerSetId) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
QMap<uint64, int32>::const_iterator was = wasCount.constFind(it->id);
|
||||
if (was == wasCount.cend()) { // no such stickers added
|
||||
for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) {
|
||||
if (it->stickers.indexOf(i->first) >= 0) {
|
||||
i = recent.erase(i);
|
||||
writeRecent = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
setsOrder.removeOne(it->id);
|
||||
it = sets.erase(it);
|
||||
removed = true;
|
||||
for (StickerSets::iterator i = sets.begin(), e = sets.end(); i != e;) {
|
||||
if (i->id == CustomStickerSetId || i->access != 0) {
|
||||
++i;
|
||||
} else {
|
||||
for (int32 j = 0, l = was.value(); j < l;) {
|
||||
if (found.contains(it->stickers.at(j))) {
|
||||
++j;
|
||||
} else {
|
||||
for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) {
|
||||
if (it->stickers.at(j) == i->first) {
|
||||
i = recent.erase(i);
|
||||
writeRecent = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
it->stickers.removeAt(j);
|
||||
--l;
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
if (it->stickers.isEmpty()) {
|
||||
setsOrder.removeOne(it->id);
|
||||
it = sets.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (added || removed || cStickersHash() != wasHash) {
|
||||
Local::writeStickers();
|
||||
}
|
||||
if (writeRecent) {
|
||||
Local::writeUserSettings();
|
||||
}
|
||||
|
||||
const QVector<MTPStickerPack> &packs(d.vpacks.c_vector().v);
|
||||
for (int32 i = 0, l = packs.size(); i != l; ++i) {
|
||||
if (packs.at(i).type() == mtpc_stickerPack) {
|
||||
const MTPDstickerPack &p(packs.at(i).c_stickerPack());
|
||||
QString emoticon(qs(p.vemoticon));
|
||||
EmojiPtr e = 0;
|
||||
for (const QChar *ch = emoticon.constData(), *end = emoticon.constEnd(); ch != end; ++ch) {
|
||||
int len = 0;
|
||||
e = emojiFromText(ch, end, len);
|
||||
if (e) break;
|
||||
|
||||
if (ch + 1 < end && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) ++ch;
|
||||
}
|
||||
if (e) {
|
||||
const QVector<MTPlong> docs(p.vdocuments.c_vector().v);
|
||||
if (!docs.isEmpty()) {
|
||||
for (int32 j = 0, s = docs.size(); j < s; ++j) {
|
||||
DocumentData *doc = App::document(docs.at(j).v);
|
||||
map.insert(doc, e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG(("Sticker Error: Could not find emoji for string: %1").arg(emoticon));
|
||||
}
|
||||
i = sets.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
cSetEmojiStickers(map);
|
||||
|
||||
const DocumentItems &items(App::documentItems());
|
||||
for (EmojiStickersMap::const_iterator i = map.cbegin(), e = map.cend(); i != e; ++i) {
|
||||
DocumentItems::const_iterator j = items.constFind(i.key());
|
||||
if (j != items.cend()) {
|
||||
for (HistoryItemsMap::const_iterator k = j->cbegin(), end = j->cend(); k != end; ++k) {
|
||||
k.key()->updateStickerEmoji();
|
||||
}
|
||||
if (!setsToRequest.isEmpty()) {
|
||||
for (QMap<uint64, uint64>::const_iterator i = setsToRequest.cbegin(), e = setsToRequest.cend(); i != e; ++i) {
|
||||
App::api()->scheduleStickerSetRequest(i.key(), i.value());
|
||||
}
|
||||
App::api()->requestStickerSets();
|
||||
}
|
||||
|
||||
Local::writeStickers();
|
||||
|
||||
if (App::main()) emit App::main()->stickersUpdated();
|
||||
}
|
||||
|
||||
@ -4630,6 +4504,7 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
|
||||
_cmdStart.move(_attachEmoji.x() - _cmdStart.width(), height() - kbh - _cmdStart.height());
|
||||
|
||||
_attachType.move(0, _attachDocument.y() - _attachType.height());
|
||||
_emojiPan.setMaxHeight(height() - st::dropdownDef.padding.top() - st::dropdownDef.padding.bottom() - _attachEmoji.height());
|
||||
_emojiPan.move(width() - _emojiPan.width(), _attachEmoji.y() - _emojiPan.height());
|
||||
|
||||
switch (_attachDrag) {
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
void dragActionUpdate(const QPoint &screenPos);
|
||||
void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
|
||||
void dragActionCancel();
|
||||
void dragExec();
|
||||
|
||||
void touchScrollUpdated(const QPoint &screenPos);
|
||||
QPoint mapMouseToItem(QPoint p, HistoryItem *item);
|
||||
|
@ -2240,9 +2240,17 @@ namespace Local {
|
||||
|
||||
void _writeStickerSet(QDataStream &stream, uint64 setId) {
|
||||
StickerSets::const_iterator it = cStickerSets().constFind(setId);
|
||||
if (it == cStickerSets().cend() || it->stickers.isEmpty()) return;
|
||||
if (it == cStickerSets().cend()) return;
|
||||
|
||||
stream << quint64(it->id) << quint64(it->access) << it->title << it->shortName << quint32(it->stickers.size());
|
||||
bool notLoaded = (it->flags & MTPDstickerSet_flag_NOT_LOADED);
|
||||
if (notLoaded) {
|
||||
stream << quint64(it->id) << quint64(it->access) << it->title << it->shortName << qint32(-it->count) << qint32(it->hash) << qint32(it->flags);
|
||||
return;
|
||||
} else {
|
||||
if (it->stickers.isEmpty()) return;
|
||||
}
|
||||
|
||||
stream << quint64(it->id) << quint64(it->access) << it->title << it->shortName << qint32(it->stickers.size()) << qint32(it->hash) << qint32(it->flags);
|
||||
for (StickerPack::const_iterator j = it->stickers.cbegin(), e = it->stickers.cend(); j != e; ++j) {
|
||||
DocumentData *doc = *j;
|
||||
stream << quint64(doc->id) << quint64(doc->access) << qint32(doc->date) << doc->name << doc->mime << qint32(doc->dc) << qint32(doc->size) << qint32(doc->dimensions.width()) << qint32(doc->dimensions.height()) << qint32(doc->type) << doc->sticker->alt;
|
||||
@ -2275,17 +2283,20 @@ namespace Local {
|
||||
}
|
||||
_writeMap();
|
||||
} else {
|
||||
if (!_stickersKey) {
|
||||
_stickersKey = genKey();
|
||||
_mapChanged = true;
|
||||
_writeMap(WriteMapFast);
|
||||
}
|
||||
int32 setsCount = 0;
|
||||
quint32 size = sizeof(quint32) + _bytearraySize(cStickersHash());
|
||||
for (StickerSets::const_iterator i = sets.cbegin(); i != sets.cend(); ++i) {
|
||||
if (i->stickers.isEmpty()) continue;
|
||||
bool notLoaded = (i->flags & MTPDstickerSet_flag_NOT_LOADED);
|
||||
if (notLoaded) {
|
||||
if (!(i->flags & MTPDstickerSet_flag_disabled)) { // waiting to receive
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (i->stickers.isEmpty()) continue;
|
||||
}
|
||||
|
||||
// id + access + title + shortName + stickersCount
|
||||
size += sizeof(quint64) * 2 + _stringSize(i->title) + _stringSize(i->shortName) + sizeof(quint32);
|
||||
// id + access + title + shortName + stickersCount + hash + flags
|
||||
size += sizeof(quint64) * 2 + _stringSize(i->title) + _stringSize(i->shortName) + sizeof(quint32) + sizeof(qint32) * 2;
|
||||
for (StickerPack::const_iterator j = i->stickers.cbegin(), e = i->stickers.cend(); j != e; ++j) {
|
||||
DocumentData *doc = *j;
|
||||
|
||||
@ -2295,10 +2306,16 @@ namespace Local {
|
||||
// thumb-width + thumb-height + thumb-dc + thumb-volume + thumb-local + thumb-secret
|
||||
size += sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(quint64) + sizeof(qint32) + sizeof(quint64);
|
||||
}
|
||||
++setsCount;
|
||||
}
|
||||
|
||||
if (!_stickersKey) {
|
||||
_stickersKey = genKey();
|
||||
_mapChanged = true;
|
||||
_writeMap(WriteMapFast);
|
||||
}
|
||||
EncryptedDescriptor data(size);
|
||||
data.stream << quint32(cStickerSets().size()) << cStickersHash();
|
||||
_writeStickerSet(data.stream, DefaultStickerSetId);
|
||||
data.stream << quint32(setsCount) << cStickersHash();
|
||||
_writeStickerSet(data.stream, CustomStickerSetId);
|
||||
for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) {
|
||||
_writeStickerSet(data.stream, *i);
|
||||
@ -2321,15 +2338,17 @@ namespace Local {
|
||||
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
sets.clear();
|
||||
cSetStickerSetsOrder(StickerSetsOrder());
|
||||
|
||||
StickerSetsOrder &order(cRefStickerSetsOrder());
|
||||
order.clear();
|
||||
|
||||
RecentStickerPack &recent(cRefRecentStickers());
|
||||
recent.clear();
|
||||
|
||||
cSetStickersHash(QByteArray());
|
||||
|
||||
StickerSet &def(sets.insert(DefaultStickerSetId, StickerSet(DefaultStickerSetId, 0, lang(lng_stickers_default_set), QString())).value());
|
||||
StickerSet &custom(sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString())).value());
|
||||
StickerSet &def(sets.insert(DefaultStickerSetId, StickerSet(DefaultStickerSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet_flag_official)).value());
|
||||
StickerSet &custom(sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)).value());
|
||||
|
||||
QMap<uint64, bool> read;
|
||||
while (!stickers.stream.atEnd()) {
|
||||
@ -2360,12 +2379,18 @@ namespace Local {
|
||||
|
||||
if (value > 0) {
|
||||
def.stickers.push_back(doc);
|
||||
++def.count;
|
||||
} else {
|
||||
custom.stickers.push_back(doc);
|
||||
++custom.count;
|
||||
}
|
||||
if (recent.size() < StickerPanPerRow * StickerPanRowsPerPage && qAbs(value) > 1) recent.push_back(qMakePair(doc, qAbs(value)));
|
||||
}
|
||||
if (def.stickers.isEmpty()) sets.remove(DefaultStickerSetId);
|
||||
if (def.stickers.isEmpty()) {
|
||||
sets.remove(DefaultStickerSetId);
|
||||
} else {
|
||||
order.push_front(DefaultStickerSetId);
|
||||
}
|
||||
if (custom.stickers.isEmpty()) sets.remove(CustomStickerSetId);
|
||||
|
||||
writeStickers();
|
||||
@ -2405,11 +2430,18 @@ namespace Local {
|
||||
for (uint32 i = 0; i < cnt; ++i) {
|
||||
quint64 setId = 0, setAccess = 0;
|
||||
QString setTitle, setShortName;
|
||||
quint32 scnt = 0;
|
||||
qint32 scnt = 0;
|
||||
stickers.stream >> setId >> setAccess >> setTitle >> setShortName >> scnt;
|
||||
|
||||
qint32 setHash = 0, setFlags = 0;
|
||||
if (stickers.version > 8033) {
|
||||
stickers.stream >> setHash >> setFlags;
|
||||
}
|
||||
|
||||
if (setId == DefaultStickerSetId) {
|
||||
setTitle = lang(lng_stickers_default_set);
|
||||
setFlags |= MTPDstickerSet_flag_official;
|
||||
order.push_front(setId);
|
||||
} else if (setId == CustomStickerSetId) {
|
||||
setTitle = lang(lng_custom_stickers);
|
||||
} else if (setId) {
|
||||
@ -2417,7 +2449,12 @@ namespace Local {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
StickerSet &set(sets.insert(setId, StickerSet(setId, setAccess, setTitle, setShortName)).value());
|
||||
StickerSet &set(sets.insert(setId, StickerSet(setId, setAccess, setTitle, setShortName, 0, setHash, setFlags)).value());
|
||||
if (scnt < 0) { // disabled not loaded set
|
||||
set.count = -scnt;
|
||||
continue;
|
||||
}
|
||||
|
||||
set.stickers.reserve(scnt);
|
||||
|
||||
QMap<uint64, bool> read;
|
||||
@ -2465,6 +2502,7 @@ namespace Local {
|
||||
if (!doc->sticker) continue;
|
||||
|
||||
set.stickers.push_back(doc);
|
||||
++set.count;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1948,9 +1948,9 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
|
||||
}
|
||||
overview = new OverviewWidget(this, peer, type);
|
||||
_mediaTypeMask = 0;
|
||||
mediaOverviewUpdated(peer);
|
||||
_topBar.show();
|
||||
resizeEvent(0);
|
||||
mediaOverviewUpdated(peer);
|
||||
overview->animShow(animCache, animTopBarCache, back, lastScrollTop);
|
||||
history.animStop();
|
||||
history.showPeer(0, 0, false, true);
|
||||
@ -2920,7 +2920,7 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
|
||||
}
|
||||
StickerSets &sets(cRefStickerSets());
|
||||
for (StickerSets::const_iterator i = sets.cbegin(); i != sets.cend(); ++i) {
|
||||
if (i->id == CustomStickerSetId || (setId && i->id == setId) || (!setName.isEmpty() && i->shortName.toLower().trimmed() == setName) || (!setId && setName.isEmpty() && i->id == DefaultStickerSetId)) {
|
||||
if (i->id == CustomStickerSetId || i->id == DefaultStickerSetId || (setId && i->id == setId) || (!setName.isEmpty() && i->shortName.toLower().trimmed() == setName)) {
|
||||
for (int32 j = 0, l = i->stickers.size(); j < l; ++j) {
|
||||
if (i->stickers.at(j) == sticker) {
|
||||
found = true;
|
||||
@ -2933,9 +2933,10 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
|
||||
if (!found) {
|
||||
StickerSets::iterator it = sets.find(CustomStickerSetId);
|
||||
if (it == sets.cend()) {
|
||||
it = sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString()));
|
||||
it = sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0));
|
||||
}
|
||||
it->stickers.push_back(sticker);
|
||||
++it->count;
|
||||
Local::writeStickers();
|
||||
}
|
||||
history.updateRecentStickers();
|
||||
@ -3238,6 +3239,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
if (item->isMediaUnread()) {
|
||||
item->markMediaRead();
|
||||
msgUpdated(item->history()->peer->id, item);
|
||||
if (item->out() && !item->history()->peer->chat) {
|
||||
item->history()->peer->asUser()->madeAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,12 @@ enum {
|
||||
MTPDreplyKeyboardMarkup_flag_single_use = (1 << 1),
|
||||
MTPDreplyKeyboardMarkup_flag_personal = (1 << 2),
|
||||
MTPDreplyKeyboardMarkup_flag_FORCE_REPLY = (1 << 30), // client side flag for forceReply
|
||||
MTPDreplyKeyboardMarkup_flag_ZERO = (1 << 31) // client side flag for zeroMarkup
|
||||
MTPDreplyKeyboardMarkup_flag_ZERO = (1 << 31), // client side flag for zeroMarkup
|
||||
|
||||
MTPDstickerSet_flag_installed = (1 << 0),
|
||||
MTPDstickerSet_flag_disabled = (1 << 1),
|
||||
MTPDstickerSet_flag_official = (1 << 2),
|
||||
MTPDstickerSet_flag_NOT_LOADED = (1 << 31), // client side flag for not yet loaded set
|
||||
};
|
||||
|
||||
static const MTPReplyMarkup MTPnullMarkup = MTP_replyKeyboardMarkup(MTP_int(0), MTP_vector<MTPKeyboardButtonRow>(0));
|
||||
|
@ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = {
|
||||
mtpc_invokeWithLayer17,
|
||||
mtpc_invokeWithLayer18,
|
||||
}, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
|
||||
static const mtpPrime mtpCurrentLayer = 31;
|
||||
static const mtpPrime mtpCurrentLayer = 32;
|
||||
|
||||
template <typename bareT>
|
||||
class MTPBoxed : public bareT {
|
||||
|
@ -3887,6 +3887,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" performer: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -3949,9 +3951,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" packs: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" sets: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" documents: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" sets: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -4262,10 +4262,13 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 6: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -4885,6 +4888,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" disabled: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
@ -338,13 +338,13 @@ enum {
|
||||
mtpc_documentAttributeAnimated = 0x11b58939,
|
||||
mtpc_documentAttributeSticker = 0x3a556302,
|
||||
mtpc_documentAttributeVideo = 0x5910cccb,
|
||||
mtpc_documentAttributeAudio = 0x51448e5,
|
||||
mtpc_documentAttributeAudio = 0xded218e0,
|
||||
mtpc_documentAttributeFilename = 0x15590068,
|
||||
mtpc_messages_stickersNotModified = 0xf1749a22,
|
||||
mtpc_messages_stickers = 0x8a8ecd32,
|
||||
mtpc_stickerPack = 0x12b299d4,
|
||||
mtpc_messages_allStickersNotModified = 0xe86602c3,
|
||||
mtpc_messages_allStickers = 0x5ce352ec,
|
||||
mtpc_messages_allStickers = 0xd51dafdb,
|
||||
mtpc_disabledFeature = 0xae636f24,
|
||||
mtpc_updateReadHistoryInbox = 0x9961fd5c,
|
||||
mtpc_updateReadHistoryOutbox = 0x2f2f21bf,
|
||||
@ -377,7 +377,7 @@ enum {
|
||||
mtpc_inputStickerSetEmpty = 0xffb62b95,
|
||||
mtpc_inputStickerSetID = 0x9de7a269,
|
||||
mtpc_inputStickerSetShortName = 0x861cc8a0,
|
||||
mtpc_stickerSet = 0xa7a43b17,
|
||||
mtpc_stickerSet = 0xcd303b41,
|
||||
mtpc_messages_stickerSet = 0xb60a24a6,
|
||||
mtpc_user = 0x22e49072,
|
||||
mtpc_botCommand = 0xc27ac8c7,
|
||||
@ -513,7 +513,7 @@ enum {
|
||||
mtpc_messages_checkChatInvite = 0x3eadb1bb,
|
||||
mtpc_messages_importChatInvite = 0x6c50051c,
|
||||
mtpc_messages_getStickerSet = 0x2619a90e,
|
||||
mtpc_messages_installStickerSet = 0xefbbfae9,
|
||||
mtpc_messages_installStickerSet = 0x7b30c3a6,
|
||||
mtpc_messages_uninstallStickerSet = 0xf96e55de,
|
||||
mtpc_messages_startBot = 0x1b3e0ffc
|
||||
};
|
||||
@ -7146,7 +7146,7 @@ private:
|
||||
friend MTPdocumentAttribute MTP_documentAttributeAnimated();
|
||||
friend MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset);
|
||||
friend MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h);
|
||||
friend MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _duration);
|
||||
friend MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _duration, const MTPstring &_title, const MTPstring &_performer);
|
||||
friend MTPdocumentAttribute MTP_documentAttributeFilename(const MTPstring &_file_name);
|
||||
|
||||
mtpTypeId _type;
|
||||
@ -7254,7 +7254,7 @@ private:
|
||||
explicit MTPmessages_allStickers(MTPDmessages_allStickers *_data);
|
||||
|
||||
friend MTPmessages_allStickers MTP_messages_allStickersNotModified();
|
||||
friend MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents);
|
||||
friend MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerSet> &_sets);
|
||||
|
||||
mtpTypeId _type;
|
||||
};
|
||||
@ -7819,7 +7819,7 @@ public:
|
||||
private:
|
||||
explicit MTPstickerSet(MTPDstickerSet *_data);
|
||||
|
||||
friend MTPstickerSet MTP_stickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name);
|
||||
friend MTPstickerSet MTP_stickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash);
|
||||
};
|
||||
typedef MTPBoxed<MTPstickerSet> MTPStickerSet;
|
||||
|
||||
@ -10916,10 +10916,12 @@ class MTPDdocumentAttributeAudio : public mtpDataImpl<MTPDdocumentAttributeAudio
|
||||
public:
|
||||
MTPDdocumentAttributeAudio() {
|
||||
}
|
||||
MTPDdocumentAttributeAudio(MTPint _duration) : vduration(_duration) {
|
||||
MTPDdocumentAttributeAudio(MTPint _duration, const MTPstring &_title, const MTPstring &_performer) : vduration(_duration), vtitle(_title), vperformer(_performer) {
|
||||
}
|
||||
|
||||
MTPint vduration;
|
||||
MTPstring vtitle;
|
||||
MTPstring vperformer;
|
||||
};
|
||||
|
||||
class MTPDdocumentAttributeFilename : public mtpDataImpl<MTPDdocumentAttributeFilename> {
|
||||
@ -10958,13 +10960,11 @@ class MTPDmessages_allStickers : public mtpDataImpl<MTPDmessages_allStickers> {
|
||||
public:
|
||||
MTPDmessages_allStickers() {
|
||||
}
|
||||
MTPDmessages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents) : vhash(_hash), vpacks(_packs), vsets(_sets), vdocuments(_documents) {
|
||||
MTPDmessages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerSet> &_sets) : vhash(_hash), vsets(_sets) {
|
||||
}
|
||||
|
||||
MTPstring vhash;
|
||||
MTPVector<MTPStickerPack> vpacks;
|
||||
MTPVector<MTPStickerSet> vsets;
|
||||
MTPVector<MTPDocument> vdocuments;
|
||||
};
|
||||
|
||||
class MTPDdisabledFeature : public mtpDataImpl<MTPDdisabledFeature> {
|
||||
@ -11229,13 +11229,16 @@ class MTPDstickerSet : public mtpDataImpl<MTPDstickerSet> {
|
||||
public:
|
||||
MTPDstickerSet() {
|
||||
}
|
||||
MTPDstickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name) : vid(_id), vaccess_hash(_access_hash), vtitle(_title), vshort_name(_short_name) {
|
||||
MTPDstickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vshort_name(_short_name), vcount(_count), vhash(_hash) {
|
||||
}
|
||||
|
||||
MTPint vflags;
|
||||
MTPlong vid;
|
||||
MTPlong vaccess_hash;
|
||||
MTPstring vtitle;
|
||||
MTPstring vshort_name;
|
||||
MTPint vcount;
|
||||
MTPint vhash;
|
||||
};
|
||||
|
||||
class MTPDmessages_stickerSet : public mtpDataImpl<MTPDmessages_stickerSet> {
|
||||
@ -16920,26 +16923,29 @@ public:
|
||||
class MTPmessages_installStickerSet { // RPC method 'messages.installStickerSet'
|
||||
public:
|
||||
MTPInputStickerSet vstickerset;
|
||||
MTPBool vdisabled;
|
||||
|
||||
MTPmessages_installStickerSet() {
|
||||
}
|
||||
MTPmessages_installStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) {
|
||||
read(from, end, cons);
|
||||
}
|
||||
MTPmessages_installStickerSet(const MTPInputStickerSet &_stickerset) : vstickerset(_stickerset) {
|
||||
MTPmessages_installStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _disabled) : vstickerset(_stickerset), vdisabled(_disabled) {
|
||||
}
|
||||
|
||||
uint32 innerLength() const {
|
||||
return vstickerset.innerLength();
|
||||
return vstickerset.innerLength() + vdisabled.innerLength();
|
||||
}
|
||||
mtpTypeId type() const {
|
||||
return mtpc_messages_installStickerSet;
|
||||
}
|
||||
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) {
|
||||
vstickerset.read(from, end);
|
||||
vdisabled.read(from, end);
|
||||
}
|
||||
void write(mtpBuffer &to) const {
|
||||
vstickerset.write(to);
|
||||
vdisabled.write(to);
|
||||
}
|
||||
|
||||
typedef MTPBool ResponseType;
|
||||
@ -16952,7 +16958,7 @@ public:
|
||||
}
|
||||
MTPmessages_InstallStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_installStickerSet>(from, end, cons) {
|
||||
}
|
||||
MTPmessages_InstallStickerSet(const MTPInputStickerSet &_stickerset) : MTPBoxed<MTPmessages_installStickerSet>(MTPmessages_installStickerSet(_stickerset)) {
|
||||
MTPmessages_InstallStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _disabled) : MTPBoxed<MTPmessages_installStickerSet>(MTPmessages_installStickerSet(_stickerset, _disabled)) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -24857,7 +24863,7 @@ inline uint32 MTPdocumentAttribute::innerLength() const {
|
||||
}
|
||||
case mtpc_documentAttributeAudio: {
|
||||
const MTPDdocumentAttributeAudio &v(c_documentAttributeAudio());
|
||||
return v.vduration.innerLength();
|
||||
return v.vduration.innerLength() + v.vtitle.innerLength() + v.vperformer.innerLength();
|
||||
}
|
||||
case mtpc_documentAttributeFilename: {
|
||||
const MTPDdocumentAttributeFilename &v(c_documentAttributeFilename());
|
||||
@ -24897,6 +24903,8 @@ inline void MTPdocumentAttribute::read(const mtpPrime *&from, const mtpPrime *en
|
||||
if (!data) setData(new MTPDdocumentAttributeAudio());
|
||||
MTPDdocumentAttributeAudio &v(_documentAttributeAudio());
|
||||
v.vduration.read(from, end);
|
||||
v.vtitle.read(from, end);
|
||||
v.vperformer.read(from, end);
|
||||
} break;
|
||||
case mtpc_documentAttributeFilename: _type = cons; {
|
||||
if (!data) setData(new MTPDdocumentAttributeFilename());
|
||||
@ -24927,6 +24935,8 @@ inline void MTPdocumentAttribute::write(mtpBuffer &to) const {
|
||||
case mtpc_documentAttributeAudio: {
|
||||
const MTPDdocumentAttributeAudio &v(c_documentAttributeAudio());
|
||||
v.vduration.write(to);
|
||||
v.vtitle.write(to);
|
||||
v.vperformer.write(to);
|
||||
} break;
|
||||
case mtpc_documentAttributeFilename: {
|
||||
const MTPDdocumentAttributeFilename &v(c_documentAttributeFilename());
|
||||
@ -24967,8 +24977,8 @@ inline MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt,
|
||||
inline MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h) {
|
||||
return MTPdocumentAttribute(new MTPDdocumentAttributeVideo(_duration, _w, _h));
|
||||
}
|
||||
inline MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _duration) {
|
||||
return MTPdocumentAttribute(new MTPDdocumentAttributeAudio(_duration));
|
||||
inline MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _duration, const MTPstring &_title, const MTPstring &_performer) {
|
||||
return MTPdocumentAttribute(new MTPDdocumentAttributeAudio(_duration, _title, _performer));
|
||||
}
|
||||
inline MTPdocumentAttribute MTP_documentAttributeFilename(const MTPstring &_file_name) {
|
||||
return MTPdocumentAttribute(new MTPDdocumentAttributeFilename(_file_name));
|
||||
@ -25058,7 +25068,7 @@ inline uint32 MTPmessages_allStickers::innerLength() const {
|
||||
switch (_type) {
|
||||
case mtpc_messages_allStickers: {
|
||||
const MTPDmessages_allStickers &v(c_messages_allStickers());
|
||||
return v.vhash.innerLength() + v.vpacks.innerLength() + v.vsets.innerLength() + v.vdocuments.innerLength();
|
||||
return v.vhash.innerLength() + v.vsets.innerLength();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -25075,9 +25085,7 @@ inline void MTPmessages_allStickers::read(const mtpPrime *&from, const mtpPrime
|
||||
if (!data) setData(new MTPDmessages_allStickers());
|
||||
MTPDmessages_allStickers &v(_messages_allStickers());
|
||||
v.vhash.read(from, end);
|
||||
v.vpacks.read(from, end);
|
||||
v.vsets.read(from, end);
|
||||
v.vdocuments.read(from, end);
|
||||
} break;
|
||||
default: throw mtpErrorUnexpected(cons, "MTPmessages_allStickers");
|
||||
}
|
||||
@ -25087,9 +25095,7 @@ inline void MTPmessages_allStickers::write(mtpBuffer &to) const {
|
||||
case mtpc_messages_allStickers: {
|
||||
const MTPDmessages_allStickers &v(c_messages_allStickers());
|
||||
v.vhash.write(to);
|
||||
v.vpacks.write(to);
|
||||
v.vsets.write(to);
|
||||
v.vdocuments.write(to);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@ -25105,8 +25111,8 @@ inline MTPmessages_allStickers::MTPmessages_allStickers(MTPDmessages_allStickers
|
||||
inline MTPmessages_allStickers MTP_messages_allStickersNotModified() {
|
||||
return MTPmessages_allStickers(mtpc_messages_allStickersNotModified);
|
||||
}
|
||||
inline MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerPack> &_packs, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPDocument> &_documents) {
|
||||
return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _packs, _sets, _documents));
|
||||
inline MTPmessages_allStickers MTP_messages_allStickers(const MTPstring &_hash, const MTPVector<MTPStickerSet> &_sets) {
|
||||
return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _sets));
|
||||
}
|
||||
|
||||
inline MTPdisabledFeature::MTPdisabledFeature() : mtpDataOwner(new MTPDdisabledFeature()) {
|
||||
@ -25777,7 +25783,7 @@ inline MTPstickerSet::MTPstickerSet() : mtpDataOwner(new MTPDstickerSet()) {
|
||||
|
||||
inline uint32 MTPstickerSet::innerLength() const {
|
||||
const MTPDstickerSet &v(c_stickerSet());
|
||||
return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vtitle.innerLength() + v.vshort_name.innerLength();
|
||||
return v.vflags.innerLength() + v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vtitle.innerLength() + v.vshort_name.innerLength() + v.vcount.innerLength() + v.vhash.innerLength();
|
||||
}
|
||||
inline mtpTypeId MTPstickerSet::type() const {
|
||||
return mtpc_stickerSet;
|
||||
@ -25787,22 +25793,28 @@ inline void MTPstickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpT
|
||||
|
||||
if (!data) setData(new MTPDstickerSet());
|
||||
MTPDstickerSet &v(_stickerSet());
|
||||
v.vflags.read(from, end);
|
||||
v.vid.read(from, end);
|
||||
v.vaccess_hash.read(from, end);
|
||||
v.vtitle.read(from, end);
|
||||
v.vshort_name.read(from, end);
|
||||
v.vcount.read(from, end);
|
||||
v.vhash.read(from, end);
|
||||
}
|
||||
inline void MTPstickerSet::write(mtpBuffer &to) const {
|
||||
const MTPDstickerSet &v(c_stickerSet());
|
||||
v.vflags.write(to);
|
||||
v.vid.write(to);
|
||||
v.vaccess_hash.write(to);
|
||||
v.vtitle.write(to);
|
||||
v.vshort_name.write(to);
|
||||
v.vcount.write(to);
|
||||
v.vhash.write(to);
|
||||
}
|
||||
inline MTPstickerSet::MTPstickerSet(MTPDstickerSet *_data) : mtpDataOwner(_data) {
|
||||
}
|
||||
inline MTPstickerSet MTP_stickerSet(const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name) {
|
||||
return MTPstickerSet(new MTPDstickerSet(_id, _access_hash, _title, _short_name));
|
||||
inline MTPstickerSet MTP_stickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) {
|
||||
return MTPstickerSet(new MTPDstickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash));
|
||||
}
|
||||
|
||||
inline MTPmessages_stickerSet::MTPmessages_stickerSet() : mtpDataOwner(new MTPDmessages_stickerSet()) {
|
||||
|
@ -524,7 +524,7 @@ documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
|
||||
documentAttributeAnimated#11b58939 = DocumentAttribute;
|
||||
documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute;
|
||||
documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute;
|
||||
documentAttributeAudio#51448e5 duration:int = DocumentAttribute;
|
||||
documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute;
|
||||
documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
|
||||
|
||||
messages.stickersNotModified#f1749a22 = messages.Stickers;
|
||||
@ -533,7 +533,7 @@ messages.stickers#8a8ecd32 hash:string stickers:Vector<Document> = messages.Stic
|
||||
stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;
|
||||
|
||||
messages.allStickersNotModified#e86602c3 = messages.AllStickers;
|
||||
messages.allStickers#5ce352ec hash:string packs:Vector<StickerPack> sets:Vector<StickerSet> documents:Vector<Document> = messages.AllStickers;
|
||||
messages.allStickers#d51dafdb hash:string sets:Vector<StickerSet> = messages.AllStickers;
|
||||
|
||||
disabledFeature#ae636f24 feature:string description:string = DisabledFeature;
|
||||
|
||||
@ -588,7 +588,7 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
|
||||
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
|
||||
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
|
||||
|
||||
stickerSet#a7a43b17 id:long access_hash:long title:string short_name:string = StickerSet;
|
||||
stickerSet#cd303b41 flags:# id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
|
||||
|
||||
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
|
||||
|
||||
@ -767,6 +767,6 @@ messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
|
||||
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
|
||||
messages.importChatInvite#6c50051c hash:string = Updates;
|
||||
messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet;
|
||||
messages.installStickerSet#efbbfae9 stickerset:InputStickerSet = Bool;
|
||||
messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool;
|
||||
messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool;
|
||||
messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates;
|
||||
|
@ -40,7 +40,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
||||
, _photosInRow(1)
|
||||
, _photosToAdd(0)
|
||||
, _selMode(false)
|
||||
, _width(0)
|
||||
, _width(st::wndMinWidth)
|
||||
, _height(0)
|
||||
, _minHeight(0)
|
||||
, _addToY(0)
|
||||
@ -73,7 +73,6 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
connect(&_touchScrollTimer, SIGNAL(timeout()), this, SLOT(onTouchScrollTimer()));
|
||||
|
||||
mediaOverviewUpdated();
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
@ -367,12 +366,11 @@ void OverviewInner::dragActionStart(const QPoint &screenPos, Qt::MouseButton but
|
||||
_dragStartPos = mapMouseToItem(mapFromGlobal(screenPos), _dragItem, _dragItemIndex);
|
||||
_dragWasInactive = App::wnd()->inactivePress();
|
||||
if (_dragWasInactive) App::wnd()->inactivePress(false);
|
||||
bool textLink = textlnkDown() && !textlnkDown()->encoded().isEmpty();
|
||||
if (textLink) {
|
||||
if (textlnkDown() && _selected.isEmpty()) {
|
||||
_dragAction = PrepareDrag;
|
||||
} else if (!_selected.isEmpty()) {
|
||||
if (_selected.cbegin().value() == FullItemSel) {
|
||||
if (_selected.constFind(_dragItem) != _selected.cend() && App::hoveredItem()) {
|
||||
if (_selected.constFind(_dragItem) != _selected.cend() && textlnkDown()) {
|
||||
_dragAction = PrepareDrag; // start items drag
|
||||
} else {
|
||||
_dragAction = PrepareSelect; // start items select
|
||||
@ -382,23 +380,25 @@ void OverviewInner::dragActionStart(const QPoint &screenPos, Qt::MouseButton but
|
||||
if (_dragAction == NoDrag && _dragItem) {
|
||||
bool afterDragSymbol = false , uponSymbol = false;
|
||||
uint16 symbol = 0;
|
||||
if (textlnkDown()) {
|
||||
_dragSymbol = symbol;
|
||||
uint32 selStatus = (_dragSymbol << 16) | _dragSymbol;
|
||||
if (selStatus != FullItemSel && (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel)) {
|
||||
if (!_selected.isEmpty()) {
|
||||
updateMsg(_selected.cbegin().key(), -1);
|
||||
_selected.clear();
|
||||
if (!_dragWasInactive) {
|
||||
if (textlnkDown()) {
|
||||
_dragSymbol = symbol;
|
||||
uint32 selStatus = (_dragSymbol << 16) | _dragSymbol;
|
||||
if (selStatus != FullItemSel && (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel)) {
|
||||
if (!_selected.isEmpty()) {
|
||||
updateMsg(_selected.cbegin().key(), -1);
|
||||
_selected.clear();
|
||||
}
|
||||
_selected.insert(_dragItem, selStatus);
|
||||
_dragAction = Selecting;
|
||||
updateMsg(_dragItem, _dragItemIndex);
|
||||
_overview->updateTopBarSelection();
|
||||
} else {
|
||||
_dragAction = PrepareSelect;
|
||||
}
|
||||
_selected.insert(_dragItem, selStatus);
|
||||
_dragAction = Selecting;
|
||||
updateMsg(_dragItem, _dragItemIndex);
|
||||
_overview->updateTopBarSelection();
|
||||
} else {
|
||||
_dragAction = PrepareSelect;
|
||||
_dragAction = PrepareSelect; // start items select
|
||||
}
|
||||
} else {
|
||||
_dragAction = PrepareSelect; // start items select
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,6 +461,11 @@ void OverviewInner::dragActionFinish(const QPoint &screenPos, Qt::MouseButton bu
|
||||
if (i != _selected.cend() && i.value() == FullItemSel) {
|
||||
_selected.erase(i);
|
||||
updateMsg(_dragItem, _dragItemIndex);
|
||||
} else if (i == _selected.cend() && _dragItem > 0 && !_selected.isEmpty() && _selected.cbegin().value() == FullItemSel) {
|
||||
if (_selected.size() < MaxSelectedItems) {
|
||||
_selected.insert(_dragItem, FullItemSel);
|
||||
updateMsg(_dragItem, _dragItemIndex);
|
||||
}
|
||||
} else {
|
||||
_selected.clear();
|
||||
parentWidget()->update();
|
||||
@ -481,6 +486,71 @@ void OverviewInner::dragActionFinish(const QPoint &screenPos, Qt::MouseButton bu
|
||||
_overview->updateTopBarSelection();
|
||||
}
|
||||
|
||||
void OverviewInner::dragExec() {
|
||||
bool uponSelected = false;
|
||||
if (_dragItem) {
|
||||
bool afterDragSymbol;
|
||||
uint16 symbol;
|
||||
if (!_selected.isEmpty() && _selected.cbegin().value() == FullItemSel) {
|
||||
uponSelected = _selected.contains(_dragItem);
|
||||
} else {
|
||||
uponSelected = false;
|
||||
}
|
||||
}
|
||||
QString sel;
|
||||
QList<QUrl> urls;
|
||||
bool forwardSelected = false;
|
||||
if (uponSelected) {
|
||||
forwardSelected = !_selected.isEmpty() && _selected.cbegin().value() == FullItemSel && cWideMode();
|
||||
} else if (textlnkDown()) {
|
||||
sel = textlnkDown()->encoded();
|
||||
if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
urls.push_back(QUrl::fromEncoded(sel.toUtf8()));
|
||||
}
|
||||
}
|
||||
if (!sel.isEmpty() || forwardSelected) {
|
||||
updateDragSelection(0, -1, 0, -1, false);
|
||||
_overview->noSelectingScroll();
|
||||
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
if (!sel.isEmpty()) mimeData->setText(sel);
|
||||
if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
if (forwardSelected) {
|
||||
mimeData->setData(qsl("application/x-td-forward-selected"), "1");
|
||||
}
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec();
|
||||
return;
|
||||
} else {
|
||||
HistoryItem *pressedLnkItem = App::pressedLinkItem(), *pressedItem = App::pressedItem();
|
||||
QLatin1String lnkType = (textlnkDown() && pressedLnkItem) ? textlnkDown()->type() : qstr("");
|
||||
bool lnkPhoto = (lnkType == qstr("PhotoLink")),
|
||||
lnkVideo = (lnkType == qstr("VideoOpenLink")),
|
||||
lnkAudio = (lnkType == qstr("AudioOpenLink")),
|
||||
lnkDocument = (lnkType == qstr("DocumentOpenLink"));
|
||||
if (lnkPhoto || lnkVideo || lnkAudio || lnkDocument) {
|
||||
QDrag *drag = new QDrag(App::wnd());
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed-link"), "1");
|
||||
if (lnkDocument) {
|
||||
QString already = static_cast<DocumentOpenLink*>(textlnkDown().data())->document()->already(true);
|
||||
if (!already.isEmpty()) {
|
||||
QList<QUrl> urls;
|
||||
urls.push_back(QUrl::fromLocalFile(already));
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
}
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
drag->exec(Qt::CopyAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewInner::touchScrollUpdated(const QPoint &screenPos) {
|
||||
_touchPos = screenPos;
|
||||
_overview->touchScroll(_touchPos - _touchPrevPos);
|
||||
@ -866,6 +936,7 @@ void OverviewInner::onUpdateSelected() {
|
||||
if (_mousedItem != _dragItem || (m - _dragStartPos).manhattanLength() >= QApplication::startDragDistance()) {
|
||||
if (_dragAction == PrepareDrag) {
|
||||
_dragAction = Dragging;
|
||||
dragExec();
|
||||
} else if (_dragAction == PrepareSelect) {
|
||||
_dragAction = Selecting;
|
||||
}
|
||||
@ -1021,7 +1092,7 @@ void OverviewInner::leaveEvent(QEvent *e) {
|
||||
|
||||
void OverviewInner::resizeEvent(QResizeEvent *e) {
|
||||
_width = width();
|
||||
showAll();
|
||||
showAll(true);
|
||||
onUpdateSelected();
|
||||
update();
|
||||
}
|
||||
@ -1304,7 +1375,7 @@ void OverviewInner::onTouchScrollTimer() {
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewInner::mediaOverviewUpdated() {
|
||||
void OverviewInner::mediaOverviewUpdated(bool fromResize) {
|
||||
int32 oldHeight = _height;
|
||||
if (_type != OverviewPhotos) {
|
||||
History::MediaOverview &o(_hist->_overview[_type]);
|
||||
@ -1312,6 +1383,7 @@ void OverviewInner::mediaOverviewUpdated() {
|
||||
_items.reserve(2 * l); // day items
|
||||
|
||||
int32 y = 0, in = 0;
|
||||
int32 w = _width - st::msgMargin.left() - st::msgMargin.right();
|
||||
bool allGood = true;
|
||||
QDate prevDate;
|
||||
for (int32 i = 0; i < l; ++i) {
|
||||
@ -1319,14 +1391,36 @@ void OverviewInner::mediaOverviewUpdated() {
|
||||
if (allGood) {
|
||||
if (_items.size() > in && _items.at(in).msgid == msgid) {
|
||||
prevDate = _items.at(in).date;
|
||||
y = _items.at(in).y;
|
||||
if (fromResize) {
|
||||
HistoryItem *item = App::histItemById(msgid);
|
||||
HistoryMedia *media = item ? item->getMedia(true) : 0;
|
||||
if (media) {
|
||||
y += media->countHeight(item, w) + st::msgMargin.top() + st::msgMargin.bottom(); // item height
|
||||
}
|
||||
_items[in].y = y;
|
||||
} else {
|
||||
y = _items.at(in).y;
|
||||
}
|
||||
++in;
|
||||
continue;
|
||||
}
|
||||
if (_items.size() > in + 1 && !_items.at(in).msgid && _items.at(in + 1).msgid == msgid) { // day item
|
||||
if (fromResize) {
|
||||
y += st::msgServiceFont->height + st::msgServicePadding.top() + st::msgServicePadding.bottom() + st::msgServiceMargin.top() + st::msgServiceMargin.bottom(); // day item height
|
||||
_items[in].y = y;
|
||||
}
|
||||
++in;
|
||||
prevDate = _items.at(in).date;
|
||||
y = _items.at(in).y;
|
||||
if (fromResize) {
|
||||
HistoryItem *item = App::histItemById(msgid);
|
||||
HistoryMedia *media = item ? item->getMedia(true) : 0;
|
||||
if (media) {
|
||||
y += media->countHeight(item, w) + st::msgMargin.top() + st::msgMargin.bottom(); // item height
|
||||
}
|
||||
_items[in].y = y;
|
||||
} else {
|
||||
y = _items.at(in).y;
|
||||
}
|
||||
++in;
|
||||
continue;
|
||||
}
|
||||
@ -1353,7 +1447,6 @@ void OverviewInner::mediaOverviewUpdated() {
|
||||
} else {
|
||||
prevDate = date;
|
||||
}
|
||||
int32 w = _width - st::msgMargin.left() - st::msgMargin.right();
|
||||
media->initDimensions(item);
|
||||
y += media->countHeight(item, w) + st::msgMargin.top() + st::msgMargin.bottom(); // item height
|
||||
if (_items.size() > in) {
|
||||
@ -1378,8 +1471,10 @@ void OverviewInner::mediaOverviewUpdated() {
|
||||
}
|
||||
if (_height != y) {
|
||||
_height = y;
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
resize(width(), _minHeight > _height ? _minHeight : _height);
|
||||
if (!fromResize) {
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
resize(width(), _minHeight > _height ? _minHeight : _height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1388,9 +1483,11 @@ void OverviewInner::mediaOverviewUpdated() {
|
||||
fixItemIndex(_mousedItemIndex, _mousedItem);
|
||||
fixItemIndex(_dragItemIndex, _dragItem);
|
||||
|
||||
resizeEvent(0);
|
||||
if (_height != oldHeight) {
|
||||
_overview->scrollBy(_height - oldHeight);
|
||||
if (!fromResize) {
|
||||
resizeEvent(0);
|
||||
if (_height != oldHeight) {
|
||||
_overview->scrollBy(_height - oldHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1503,7 +1600,7 @@ void OverviewInner::msgUpdated(const HistoryItem *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewInner::showAll() {
|
||||
void OverviewInner::showAll(bool recountHeights) {
|
||||
int32 newHeight = height();
|
||||
if (_type == OverviewPhotos) {
|
||||
_photosInRow = int32(width() - st::overviewPhotoSkip) / int32(st::overviewPhotoMinSize + st::overviewPhotoSkip);
|
||||
@ -1518,10 +1615,13 @@ void OverviewInner::showAll() {
|
||||
}
|
||||
int32 rows = ((_photosToAdd + count) / _photosInRow) + (((_photosToAdd + count) % _photosInRow) ? 1 : 0);
|
||||
newHeight = _height = (_vsize + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip;
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
} else {
|
||||
if (recountHeights && _type == OverviewVideos) { // recount heights because of captions
|
||||
mediaOverviewUpdated(true);
|
||||
}
|
||||
newHeight = _height;
|
||||
}
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
if (newHeight < _minHeight) {
|
||||
newHeight = _minHeight;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void dragActionUpdate(const QPoint &screenPos);
|
||||
void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
|
||||
void dragActionCancel();
|
||||
void dragExec();
|
||||
|
||||
void touchScrollUpdated(const QPoint &screenPos);
|
||||
QPoint mapMouseToItem(QPoint p, MsgId itemId, int32 itemIndex);
|
||||
@ -57,7 +58,7 @@ public:
|
||||
|
||||
void setSelectMode(bool enabled);
|
||||
|
||||
void mediaOverviewUpdated();
|
||||
void mediaOverviewUpdated(bool fromResize = false);
|
||||
void changingMsgId(HistoryItem *row, MsgId newId);
|
||||
void msgUpdated(const HistoryItem *msg);
|
||||
void itemRemoved(HistoryItem *item);
|
||||
@ -107,7 +108,7 @@ private:
|
||||
void applyDragSelection();
|
||||
|
||||
QPixmap genPix(PhotoData *photo, int32 size);
|
||||
void showAll();
|
||||
void showAll(bool recountHeights = false);
|
||||
|
||||
OverviewWidget *_overview;
|
||||
ScrollArea *_scroll;
|
||||
|
@ -99,8 +99,6 @@ EmojiColorVariants gEmojiVariants;
|
||||
|
||||
QByteArray gStickersHash;
|
||||
|
||||
EmojiStickersMap gEmojiStickers;
|
||||
|
||||
RecentStickerPreload gRecentStickersPreload;
|
||||
RecentStickerPack gRecentStickers;
|
||||
StickerSets gStickerSets;
|
||||
|
@ -189,9 +189,6 @@ struct DocumentData;
|
||||
typedef QVector<DocumentData*> StickerPack;
|
||||
DeclareSetting(QByteArray, StickersHash);
|
||||
|
||||
typedef QMap<DocumentData*, EmojiPtr> EmojiStickersMap;
|
||||
DeclareSetting(EmojiStickersMap, EmojiStickers);
|
||||
|
||||
typedef QList<QPair<DocumentData*, int16> > RecentStickerPackOld;
|
||||
typedef QVector<QPair<uint64, ushort> > RecentStickerPreload;
|
||||
typedef QVector<QPair<DocumentData*, ushort> > RecentStickerPack;
|
||||
@ -202,12 +199,14 @@ RecentStickerPack &cGetRecentStickers();
|
||||
|
||||
DeclareSetting(uint64, LastStickersUpdate);
|
||||
|
||||
static const uint64 DefaultStickerSetId = 0, CustomStickerSetId = 0xFFFFFFFFFFFFFFFFLLU, RecentStickerSetId = 0xFFFFFFFFFFFFFFFELLU;
|
||||
static const uint64 DefaultStickerSetId = 0; // for backward compatibility
|
||||
static const uint64 CustomStickerSetId = 0xFFFFFFFFFFFFFFFFLLU, RecentStickerSetId = 0xFFFFFFFFFFFFFFFELLU;
|
||||
struct StickerSet {
|
||||
StickerSet(uint64 id, uint64 access, const QString &title, const QString &shortName) : id(id), access(access), title(title), shortName(shortName) {
|
||||
StickerSet(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, int32 flags) : id(id), access(access), title(title), shortName(shortName), count(count), hash(hash), flags(flags) {
|
||||
}
|
||||
uint64 id, access;
|
||||
QString title, shortName;
|
||||
int32 count, hash, flags;
|
||||
StickerPack stickers;
|
||||
};
|
||||
typedef QMap<uint64, StickerSet> StickerSets;
|
||||
|
@ -466,11 +466,11 @@ struct StickerData {
|
||||
};
|
||||
|
||||
enum DocumentType {
|
||||
FileDocument,
|
||||
VideoDocument,
|
||||
AudioDocument,
|
||||
StickerDocument,
|
||||
AnimatedDocument
|
||||
FileDocument = 0,
|
||||
VideoDocument = 1,
|
||||
AudioDocument = 2,
|
||||
StickerDocument = 3,
|
||||
AnimatedDocument = 4,
|
||||
};
|
||||
struct DocumentData {
|
||||
DocumentData(const DocumentId &id, const uint64 &access = 0, int32 date = 0, const QVector<MTPDocumentAttribute> &attributes = QVector<MTPDocumentAttribute>(), const QString &mime = QString(), const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0);
|
||||
|
@ -11,7 +11,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.8.33</string>
|
||||
<string>0.8.34</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
Binary file not shown.
@ -1701,7 +1701,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.33;
|
||||
CURRENT_PROJECT_VERSION = 0.8.34;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@ -1719,7 +1719,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 0.8.33;
|
||||
CURRENT_PROJECT_VERSION = 0.8.34;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||
@ -1745,10 +1745,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.33;
|
||||
CURRENT_PROJECT_VERSION = 0.8.34;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.33;
|
||||
DYLIB_CURRENT_VERSION = 0.8.34;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
@ -1888,10 +1888,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.33;
|
||||
CURRENT_PROJECT_VERSION = 0.8.34;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.33;
|
||||
DYLIB_CURRENT_VERSION = 0.8.34;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
@ -1,2 +1,2 @@
|
||||
echo 0.8 8033 0.8.33 1
|
||||
echo 0.8 8034 0.8.34 1
|
||||
# AppVersionStrMajor AppVersion AppVersionStr DevChannel
|
||||
|
Loading…
Reference in New Issue
Block a user