version 0.8.24 with new sticker packs buttons done

This commit is contained in:
John Preston 2015-06-08 15:24:21 +03:00
parent c449e45def
commit 3a35b6c5fd
8 changed files with 54 additions and 42 deletions

View File

@ -1,10 +1,10 @@
@echo OFF @echo OFF
set "AppVersion=8023" set "AppVersion=8024"
set "AppVersionStrSmall=0.8.23" set "AppVersionStrSmall=0.8.24"
set "AppVersionStr=0.8.23" set "AppVersionStr=0.8.24"
set "AppVersionStrFull=0.8.23.0" set "AppVersionStrFull=0.8.24.0"
set "DevChannel=1" set "DevChannel=0"
if %DevChannel% neq 0 goto preparedev if %DevChannel% neq 0 goto preparedev

View File

@ -17,9 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
static const int32 AppVersion = 8023; static const int32 AppVersion = 8024;
static const wchar_t *AppVersionStr = L"0.8.23"; static const wchar_t *AppVersionStr = L"0.8.24";
static const bool DevChannel = true; static const bool DevChannel = false;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop"; static const wchar_t *AppName = L"Telegram Desktop";

View File

@ -1158,7 +1158,7 @@ int StickerPanInner::countHeight() {
for (int i = 0; i < _sets.size(); ++i) { 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).size(), rows = (cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0);
int h = st::emojiPanHeader + rows * st::stickerPanSize.height(); int h = st::emojiPanHeader + rows * st::stickerPanSize.height();
if (i == _sets.size() - 1 && _setIds.at(i) != CustomStickerSetId && h < minLastH) h = minLastH; if (i == _sets.size() - 1 && h < minLastH) h = minLastH;
result += h; result += h;
} }
return result + st::stickerPanPadding; return result + st::stickerPanPadding;
@ -1179,7 +1179,7 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
tilly = y + st::emojiPanHeader + (rows * st::stickerPanSize.height()); tilly = y + st::emojiPanHeader + (rows * st::stickerPanSize.height());
if (r.top() >= tilly) continue; if (r.top() >= tilly) continue;
bool special = (_setIds[c] == DefaultStickerSetId || _setIds[c] == CustomStickerSetId || _setIds[c] == RecentStickerSetId); bool special = (_setIds[c] == DefaultStickerSetId || _setIds[c] == RecentStickerSetId);
y += st::emojiPanHeader; y += st::emojiPanHeader;
QString title = _titles[c]; QString title = _titles[c];
@ -1244,7 +1244,7 @@ void StickerPanInner::paintEvent(QPaintEvent *e) {
p.drawPixmapLeft(ppos, width(), sticker->sticker->img->pix(w, h)); p.drawPixmapLeft(ppos, width(), sticker->sticker->img->pix(w, h));
} }
if (hover > 0 && _setIds[c] == CustomStickerSetId) { if (hover > 0 && _setIds[c] == RecentStickerSetId && _custom.at(index)) {
float64 xHover = _hovers[c][_sets[c].size() + index]; float64 xHover = _hovers[c][_sets[c].size() + index];
QPoint xPos = pos + QPoint(st::stickerPanSize.width() - st::stickerPanDelete.pxWidth(), 0); QPoint xPos = pos + QPoint(st::stickerPanSize.width() - st::stickerPanDelete.pxWidth(), 0);
@ -1298,16 +1298,16 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
} }
int tab = (_selected / emojiTabShift), sel = _selected % emojiTabShift; int tab = (_selected / emojiTabShift), sel = _selected % emojiTabShift;
if (_setIds[tab] == CustomStickerSetId && sel >= _sets[tab].size() && sel < _sets[tab].size() * 2) { if (_setIds[tab] == RecentStickerSetId && sel >= _sets[tab].size() && sel < _sets[tab].size() * 2 && _custom.at(sel - _sets[tab].size())) {
clearSelection(true); clearSelection(true);
int32 refresh = 0; bool refresh = false;
DocumentData *sticker = _sets[tab].at(sel - _sets[tab].size()); DocumentData *sticker = _sets[tab].at(sel - _sets[tab].size());
RecentStickerPack &recent(cGetRecentStickers()); RecentStickerPack &recent(cGetRecentStickers());
for (int32 i = 0, l = recent.size(); i < l; ++i) { for (int32 i = 0, l = recent.size(); i < l; ++i) {
if (recent.at(i).first == sticker) { if (recent.at(i).first == sticker) {
recent.removeAt(i); recent.removeAt(i);
Local::writeUserSettings(); Local::writeUserSettings();
refresh = 1; refresh = true;
break; break;
} }
} }
@ -1321,17 +1321,13 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
sets.erase(it); sets.erase(it);
} }
Local::writeStickers(); Local::writeStickers();
refresh = 2; refresh = true;
break; break;
} }
} }
} }
if (refresh) { if (refresh) {
if (refresh > 1) {
refreshStickers();
} else {
refreshRecent(); refreshRecent();
}
updateSelected(); updateSelected();
update(); update();
} }
@ -1388,7 +1384,6 @@ void StickerPanInner::refreshStickers() {
refreshRecent(false); refreshRecent(false);
appendSet(CustomStickerSetId);
appendSet(DefaultStickerSetId); appendSet(DefaultStickerSetId);
for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) { for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) {
appendSet(*i); appendSet(*i);
@ -1457,14 +1452,16 @@ void StickerPanInner::appendSet(uint64 setId) {
} }
_setIds.push_back(it->id); _setIds.push_back(it->id);
_sets.push_back(pack); _sets.push_back(pack);
_hovers.push_back(QVector<float64>(it->stickers.size() + (it->id == CustomStickerSetId ? it->stickers.size() : 1), 0)); _hovers.push_back(QVector<float64>(it->stickers.size() + 1, 0));
int32 availw = width() - st::emojiPanHeaderLeft - st::emojiSwitchSkip - _emojiWidth - (st::emojiSwitchSkip - st::emojiSwitchImgSkip); int32 availw = width() - st::emojiPanHeaderLeft - st::emojiSwitchSkip - _emojiWidth - (st::emojiSwitchSkip - st::emojiSwitchImgSkip);
_titles.push_back(st::emojiPanHeaderFont->m.elidedText(it->title, Qt::ElideRight, availw)); _titles.push_back(st::emojiPanHeaderFont->m.elidedText(it->title, Qt::ElideRight, availw));
} }
void StickerPanInner::refreshRecent(bool performResize) { void StickerPanInner::refreshRecent(bool performResize) {
_custom.clear();
clearSelection(true); clearSelection(true);
if (cGetRecentStickers().isEmpty()) { StickerSets::const_iterator customIt = cStickerSets().constFind(CustomStickerSetId);
if (cGetRecentStickers().isEmpty() && (customIt == cStickerSets().cend() || customIt->stickers.isEmpty())) {
if (!_setIds.isEmpty() && _setIds.at(0) == RecentStickerSetId) { if (!_setIds.isEmpty() && _setIds.at(0) == RecentStickerSetId) {
_setIds.pop_front(); _setIds.pop_front();
_sets.pop_front(); _sets.pop_front();
@ -1473,18 +1470,33 @@ void StickerPanInner::refreshRecent(bool performResize) {
} }
} else { } else {
StickerPack recent; StickerPack recent;
recent.reserve(cGetRecentStickers().size()); int32 customCnt = (customIt == cStickerSets().cend() ? 0 : customIt->stickers.size());
QMap<DocumentData*, bool> recentOnly;
recent.reserve(cGetRecentStickers().size() + customCnt);
_custom.reserve(cGetRecentStickers().size() + customCnt);
for (int32 i = 0, l = cGetRecentStickers().size(); i < l; ++i) { for (int32 i = 0, l = cGetRecentStickers().size(); i < l; ++i) {
recent.push_back(cGetRecentStickers().at(i).first); DocumentData *s = cGetRecentStickers().at(i).first;
recent.push_back(s);
recentOnly.insert(s, true);
_custom.push_back(false);
}
for (int32 i = 0; i < customCnt; ++i) {
DocumentData *s = customIt->stickers.at(i);
if (recentOnly.contains(s)) {
_custom[recent.indexOf(s)] = true;
} else {
recent.push_back(s);
_custom.push_back(true);
}
} }
if (_setIds.isEmpty() || _setIds.at(0) != RecentStickerSetId) { if (_setIds.isEmpty() || _setIds.at(0) != RecentStickerSetId) {
_setIds.push_front(RecentStickerSetId); _setIds.push_front(RecentStickerSetId);
_hovers.push_back(QVector<float64>(recent.size() + 1, 0)); _hovers.push_back(QVector<float64>(recent.size() * 2, 0));
_sets.push_back(recent); _sets.push_back(recent);
_titles.push_back(lang(lng_emoji_category0)); _titles.push_back(lang(lng_emoji_category0));
} else { } else {
_sets[0] = recent; _sets[0] = recent;
_hovers[0].resize(recent.size() + 1); _hovers[0].resize(recent.size() * 2);
} }
} }
@ -1503,7 +1515,6 @@ void StickerPanInner::fillIcons(QVector<StickerIcon> &icons) {
icons.reserve(_sets.size()); icons.reserve(_sets.size());
int32 i = 0; int32 i = 0;
if (_setIds.at(0) == RecentStickerSetId) ++i; if (_setIds.at(0) == RecentStickerSetId) ++i;
if (_setIds.at(0) == CustomStickerSetId || _setIds.at(1) == CustomStickerSetId) ++i;
if (i > 0) icons.push_back(StickerIcon()); if (i > 0) icons.push_back(StickerIcon());
for (int32 l = _sets.size(); i < l; ++i) { for (int32 l = _sets.size(); i < l; ++i) {
DocumentData *s = _sets.at(i).at(0); DocumentData *s = _sets.at(i).at(0);
@ -1538,7 +1549,7 @@ void StickerPanInner::updateSelected() {
int y, ytill = 0, sx = (rtl() ? width() - p.x() : p.x()) - st::stickerPanPadding; int y, ytill = 0, sx = (rtl() ? width() - p.x() : p.x()) - st::stickerPanPadding;
for (int c = 0, l = _setIds.size(); c < l; ++c) { for (int c = 0, l = _setIds.size(); c < l; ++c) {
int cnt = _sets[c].size(); int cnt = _sets[c].size();
bool special = _setIds[c] == DefaultStickerSetId || _setIds[c] == CustomStickerSetId || _setIds[c] == RecentStickerSetId; bool special = _setIds[c] == DefaultStickerSetId || _setIds[c] == RecentStickerSetId;
y = ytill; y = ytill;
ytill = y + st::emojiPanHeader + ((cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0)) * st::stickerPanSize.height(); ytill = y + st::emojiPanHeader + ((cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0)) * st::stickerPanSize.height();
if (p.y() >= y && p.y() < ytill) { if (p.y() >= y && p.y() < ytill) {
@ -1551,7 +1562,7 @@ void StickerPanInner::updateSelected() {
if (selIndex >= _sets[c].size()) { if (selIndex >= _sets[c].size()) {
selIndex = -1; selIndex = -1;
} else { } else {
if (_setIds[c] == CustomStickerSetId) { if (_setIds[c] == RecentStickerSetId && _custom[selIndex]) {
int32 inx = sx - (selIndex % StickerPanPerRow) * st::stickerPanSize.width(), iny = p.y() - y - ((selIndex / StickerPanPerRow) * st::stickerPanSize.height()); 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()) { if (inx >= st::stickerPanSize.width() - st::stickerPanDelete.pxWidth() && iny < st::stickerPanDelete.pxHeight()) {
selIndex += _sets[c].size(); selIndex += _sets[c].size();
@ -1568,11 +1579,11 @@ void StickerPanInner::updateSelected() {
bool startanim = false; bool startanim = false;
int oldSel = _selected, oldSelTab = oldSel / emojiTabShift, xOldSel = -1, newSel = selIndex, newSelTab = newSel / emojiTabShift, xNewSel = -1; int oldSel = _selected, oldSelTab = oldSel / emojiTabShift, xOldSel = -1, newSel = selIndex, newSelTab = newSel / emojiTabShift, xNewSel = -1;
if (oldSel >= 0 && oldSelTab < _setIds.size() && _setIds[oldSelTab] == CustomStickerSetId && oldSel >= oldSelTab * emojiTabShift + _sets[oldSelTab].size()) { if (oldSel >= 0 && oldSelTab < _setIds.size() && _setIds[oldSelTab] == RecentStickerSetId && oldSel >= oldSelTab * emojiTabShift + _sets[oldSelTab].size()) {
xOldSel = oldSel; xOldSel = oldSel;
oldSel -= _sets[oldSelTab].size(); oldSel -= _sets[oldSelTab].size();
} }
if (newSel >= 0 && newSelTab < _setIds.size() && _setIds[newSelTab] == CustomStickerSetId && newSel >= newSelTab * emojiTabShift + _sets[newSelTab].size()) { if (newSel >= 0 && newSelTab < _setIds.size() && _setIds[newSelTab] == RecentStickerSetId && newSel >= newSelTab * emojiTabShift + _sets[newSelTab].size()) {
xNewSel = newSel; xNewSel = newSel;
newSel -= _sets[newSelTab].size(); newSel -= _sets[newSelTab].size();
} }
@ -2347,7 +2358,7 @@ void EmojiPan::onSwitch() {
void EmojiPan::onRemoveSet(uint64 setId) { void EmojiPan::onRemoveSet(uint64 setId) {
StickerSets::const_iterator it = cStickerSets().constFind(setId); StickerSets::const_iterator it = cStickerSets().constFind(setId);
if (it != cStickerSets().cend() && setId != CustomStickerSetId && setId != DefaultStickerSetId && setId != RecentStickerSetId) { if (it != cStickerSets().cend() && setId != DefaultStickerSetId && setId != RecentStickerSetId) {
_removingSetId = it->id; _removingSetId = it->id;
ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title)); ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title));
connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure())); connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure()));
@ -2359,7 +2370,7 @@ void EmojiPan::onRemoveSet(uint64 setId) {
void EmojiPan::onRemoveSetSure() { void EmojiPan::onRemoveSetSure() {
App::wnd()->hideLayer(); App::wnd()->hideLayer();
StickerSets::iterator it = cRefStickerSets().find(_removingSetId); StickerSets::iterator it = cRefStickerSets().find(_removingSetId);
if (it != cRefStickerSets().cend() && _removingSetId != CustomStickerSetId && _removingSetId != DefaultStickerSetId && _removingSetId != RecentStickerSetId) { if (it != cRefStickerSets().cend() && _removingSetId != DefaultStickerSetId && _removingSetId != RecentStickerSetId) {
if (it->id && it->access) { if (it->id && it->access) {
MTP::send(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))); MTP::send(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access))));
} else if (!it->shortName.isEmpty()) { } else if (!it->shortName.isEmpty()) {

View File

@ -343,6 +343,7 @@ private:
QList<uint64> _setIds; QList<uint64> _setIds;
QList<StickerPack> _sets; QList<StickerPack> _sets;
QList<QVector<float64> > _hovers; QList<QVector<float64> > _hovers;
QList<bool> _custom;
int32 _selected, _pressedSel; int32 _selected, _pressedSel;
QPoint _lastMousePos; QPoint _lastMousePos;

View File

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.8.23</string> <string>0.8.24</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>

Binary file not shown.

View File

@ -1703,7 +1703,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.23; CURRENT_PROJECT_VERSION = 0.8.24;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
@ -1721,7 +1721,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.8.23; CURRENT_PROJECT_VERSION = 0.8.24;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast; GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1747,10 +1747,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.23; CURRENT_PROJECT_VERSION = 0.8.24;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.8; DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.23; DYLIB_CURRENT_VERSION = 0.8.24;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1890,10 +1890,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.23; CURRENT_PROJECT_VERSION = 0.8.24;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.8; DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.23; DYLIB_CURRENT_VERSION = 0.8.24;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;

View File

@ -1,2 +1,2 @@
echo 8023 0.8.23 1 echo 8024 0.8.24 0
# AppVersion AppVersionStr DevChannel # AppVersion AppVersionStr DevChannel