stable version 0.9.16 - new design of media, gifs and inline bots

This commit is contained in:
John Preston 2016-01-04 19:13:25 +08:00
parent 839ce20b88
commit b201a5a975
10 changed files with 64 additions and 39 deletions

View file

@ -708,7 +708,7 @@ void Application::checkMapVersion() {
if (cDevVersion() && Local::oldMapVersion() < 9016) {
// versionFeatures = QString::fromUtf8("\xe2\x80\x94 Sticker management: manually rearrange your sticker packs, pack order is now synced across all your devices\n\xe2\x80\x94 Click and hold on a sticker to preview it before sending\n\xe2\x80\x94 New context menu for chats in chats list\n\xe2\x80\x94 Support for all existing emoji");// .replace('@', qsl("@") + QChar(0x200D));
versionFeatures = lng_new_version_text(lt_gifs_link, qsl("https://telegram.org/blog/gif-revolution"), lt_bots_link, qsl("https://telegram.org/blog/inline-bots")).trimmed();
} else if (Local::oldMapVersion() < 9015) {
} else if (Local::oldMapVersion() < 9016) {
versionFeatures = lng_new_version_text(lt_gifs_link, qsl("https://telegram.org/blog/gif-revolution"), lt_bots_link, qsl("https://telegram.org/blog/inline-bots")).trimmed();
} else {
versionFeatures = lang(lng_new_version_minor).trimmed();

View file

@ -20,10 +20,10 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 9015;
static const wchar_t *AppVersionStr = L"0.9.15";
static const int32 AppVersion = 9016;
static const wchar_t *AppVersionStr = L"0.9.16";
static const bool DevVersion = false;
#define BETA_VERSION (9015008ULL) // just comment this line to build public version
//#define BETA_VERSION (9015008ULL) // just comment this line to build public version
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";

View file

@ -1663,14 +1663,14 @@ void StickerPanInner::refreshStickers() {
updateSelected();
}
void StickerPanInner::inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, InlineRow &row, int32 &sumWidth) {
bool StickerPanInner::inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, InlineRow &row, int32 &sumWidth) {
LayoutInlineItem *layout = 0;
if (savedGif) {
layout = layoutPrepareSavedGif(savedGif, (_inlineRows.size() * MatrixRowShift) + row.items.size());
} else if (result) {
layout = layoutPrepareInlineResult(result, (_inlineRows.size() * MatrixRowShift) + row.items.size());
}
if (!layout) return;
if (!layout) return false;
layout->preload();
if (inlineRowFinalize(row, sumWidth, layout->fullLine())) {
@ -1678,6 +1678,7 @@ void StickerPanInner::inlineRowsAddItem(DocumentData *savedGif, InlineResult *re
}
row.items.push_back(layout);
sumWidth += layout->maxWidth();
return true;
}
bool StickerPanInner::inlineRowFinalize(InlineRow &row, int32 &sumWidth, bool force) {
@ -1770,7 +1771,7 @@ LayoutInlineItem *StickerPanInner::layoutPrepareInlineResult(InlineResult *resul
layout = new LayoutInlineGif(result, 0, false);
} else if (result->type == qstr("photo")) {
layout = new LayoutInlinePhoto(result, 0);
} else if (result->type == qstr("web_player_video")) {
} else if (result->type == qstr("video")) {
layout = new LayoutInlineWebVideo(result);
} else if (result->type == qstr("article")) {
layout = new LayoutInlineArticle(result, _inlineWithThumb);
@ -1901,14 +1902,14 @@ void StickerPanInner::clearInlineRowsPanel() {
clearInlineRows(false);
}
void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted) {
int32 StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted) {
_inlineBot = bot;
if (results.isEmpty() && (!_inlineBot || _inlineBot->username != cInlineGifBotUsername())) {
if (resultsDeleted) {
clearInlineRows(true);
}
emit emptyInlineRows();
return;
return 0;
}
if (_showingInlineItems) {
@ -1921,7 +1922,7 @@ void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &resu
_showingInlineItems = true;
_showingSavedGifs = false;
int32 count = results.size(), from = validateExistingInlineRows(results);
int32 count = results.size(), from = validateExistingInlineRows(results), added = 0;
if (count) {
_inlineRows.reserve(count);
@ -1929,7 +1930,9 @@ void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &resu
row.items.reserve(SavedGifsMaxPerRow);
int32 sumWidth = 0;
for (int32 i = from; i < count; ++i) {
inlineRowsAddItem(0, results.at(i), row, sumWidth);
if (inlineRowsAddItem(0, results.at(i), row, sumWidth)) {
++added;
}
}
inlineRowFinalize(row, sumWidth, true);
}
@ -1943,6 +1946,8 @@ void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &resu
_lastMousePos = QCursor::pos();
updateSelected();
}
return added;
}
int32 StickerPanInner::validateExistingInlineRows(const InlineResults &results) {
@ -3722,7 +3727,10 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) {
} else if (adding) {
it.value()->nextOffset = QString();
}
showInlineRows(!adding);
if (!showInlineRows(!adding)) {
it.value()->nextOffset = QString();
}
onScroll();
}
@ -3782,7 +3790,7 @@ void EmojiPan::onEmptyInlineRows() {
}
}
bool EmojiPan::refreshInlineRows() {
bool EmojiPan::refreshInlineRows(int32 *added) {
bool clear = true;
InlineCache::const_iterator i = _inlineCache.constFind(_inlineQuery);
if (i != _inlineCache.cend()) {
@ -3790,12 +3798,14 @@ bool EmojiPan::refreshInlineRows() {
_inlineNextOffset = i.value()->nextOffset;
}
if (clear) prepareShowHideCache();
s_inner.refreshInlineRows(_inlineBot, clear ? InlineResults() : i.value()->results, false);
int32 result = s_inner.refreshInlineRows(_inlineBot, clear ? InlineResults() : i.value()->results, false);
if (added) *added = result;
return !clear;
}
void EmojiPan::showInlineRows(bool newResults) {
bool clear = !refreshInlineRows();
int32 EmojiPan::showInlineRows(bool newResults) {
int32 added = 0;
bool clear = !refreshInlineRows(&added);
if (newResults) s_scroll.scrollToY(0);
e_switch.updateText(clear ? QString() : _inlineBot->username);
@ -3819,6 +3829,8 @@ void EmojiPan::showInlineRows(bool newResults) {
onSwitch();
}
}
return added;
}
void EmojiPan::recountContentMaxHeight() {

View file

@ -344,7 +344,7 @@ public:
void refreshStickers();
void refreshRecentStickers(bool resize = true);
void refreshSavedGifs();
void refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted);
int32 refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted);
void refreshRecent();
void inlineBotChanged();
void hideInlineRowsPanel();
@ -458,7 +458,7 @@ private:
InlineLayouts _inlineLayouts;
LayoutInlineItem *layoutPrepareInlineResult(InlineResult *result, int32 position);
void inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, InlineRow &row, int32 &sumWidth);
bool inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, InlineRow &row, int32 &sumWidth);
bool inlineRowFinalize(InlineRow &row, int32 &sumWidth, bool force = false);
InlineRow &layoutInlineRow(InlineRow &row, int32 sumWidth = 0);
@ -712,10 +712,10 @@ private:
QTimer _inlineRequestTimer;
void inlineBotChanged();
void showInlineRows(bool newResults);
int32 showInlineRows(bool newResults);
bool hideOnNoInlineResults();
void recountContentMaxHeight();
bool refreshInlineRows();
bool refreshInlineRows(int32 *added = 0);
UserData *_inlineBot;
QString _inlineQuery, _inlineNextQuery, _inlineNextOffset;
mtpRequestId _inlineRequestId;

View file

@ -1847,6 +1847,7 @@ void LayoutInlinePhoto::content_forget() {
LayoutInlineWebVideo::LayoutInlineWebVideo(InlineResult *result) : LayoutInlineItem(result, 0, 0)
, _send(new SendInlineItemLink())
, _link(result->content_url.isEmpty() ? 0 : linkFromUrl(result->content_url))
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
if (_result->duration) {
@ -1904,8 +1905,13 @@ void LayoutInlineWebVideo::paint(Painter &p, const QRect &clip, uint32 selection
}
void LayoutInlineWebVideo::getState(TextLinkPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const {
if (x >= 0 && x < _width && y >= 0 && y < _height) {
if (x >= 0 && x < st::inlineThumbSize && y >= st::inlineRowMargin && y < st::inlineRowMargin + st::inlineThumbSize) {
link = _link;
return;
}
if (x >= st::inlineThumbSize + st::inlineThumbSkip && x < _width && y >= 0 && y < _height) {
link = _send;
return;
}
}
@ -1934,6 +1940,7 @@ void LayoutInlineWebVideo::prepareThumb(int32 width, int32 height) const {
LayoutInlineArticle::LayoutInlineArticle(InlineResult *result, bool withThumb) : LayoutInlineItem(result, 0, 0)
, _send(new SendInlineItemLink())
, _url(result->url.isEmpty() ? 0 : linkFromUrl(result->url))
, _link(result->content_url.isEmpty() ? 0 : linkFromUrl(result->content_url))
, _withThumb(withThumb)
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
@ -2033,7 +2040,12 @@ void LayoutInlineArticle::paint(Painter &p, const QRect &clip, uint32 selection,
}
void LayoutInlineArticle::getState(TextLinkPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const {
if (x >= 0 && x < _width && y >= 0 && y < _height) {
int32 left = _withThumb ? (st::inlineThumbSize + st::inlineThumbSkip) : 0;
if (x >= 0 && x < left - st::inlineThumbSkip && y >= st::inlineRowMargin && y < st::inlineRowMargin + st::inlineThumbSize) {
link = _link;
return;
}
if (x >= left && x < _width && y >= 0 && y < _height) {
if (_url) {
int32 left = st::inlineThumbSize + st::inlineThumbSkip;
int32 titleHeight = qMin(_title.countHeight(_width - left), st::semiboldFont->height * 2);
@ -2045,6 +2057,7 @@ void LayoutInlineArticle::getState(TextLinkPtr &link, HistoryCursorState &cursor
}
}
link = _send;
return;
}
}

View file

@ -666,7 +666,7 @@ public:
private:
TextLinkPtr _send;
TextLinkPtr _send, _link;
mutable QPixmap _thumb;
Text _title, _description;
@ -689,7 +689,7 @@ public:
private:
TextLinkPtr _send, _url;
TextLinkPtr _send, _url, _link;
bool _withThumb;
mutable QPixmap _thumb;

View file

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.15</string>
<string>0.9.16</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,15,8
PRODUCTVERSION 0,9,15,8
FILEVERSION 0,9,16,0
PRODUCTVERSION 0,9,16,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.15.8"
VALUE "FileVersion", "0.9.16.0"
VALUE "LegalCopyright", "Copyright (C) 2013"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.15.8"
VALUE "ProductVersion", "0.9.16.0"
END
END
BLOCK "VarFileInfo"

View file

@ -1701,7 +1701,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.15;
CURRENT_PROJECT_VERSION = 0.9.16;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@ -1720,7 +1720,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.9.15;
CURRENT_PROJECT_VERSION = 0.9.16;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1747,10 +1747,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.15;
CURRENT_PROJECT_VERSION = 0.9.16;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.15;
DYLIB_CURRENT_VERSION = 0.9.16;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1882,10 +1882,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.15;
CURRENT_PROJECT_VERSION = 0.9.16;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.15;
DYLIB_CURRENT_VERSION = 0.9.16;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "";

View file

@ -1,6 +1,6 @@
AppVersion 9015
AppVersion 9016
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.15
AppVersionStr 0.9.15
AppVersionStrSmall 0.9.16
AppVersionStr 0.9.16
DevChannel 0
BetaVersion 9015008
BetaVersion 0 9015008