fixed media_only dcs, added copy post link to clipboard, fixed signature display in gifs, 0.9.27 dev version

This commit is contained in:
John Preston 2016-02-25 20:23:42 +03:00
parent 2b6e30bcb5
commit 37309a91ac
14 changed files with 71 additions and 96 deletions

View File

@ -716,16 +716,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_view_group" = "View group info";
"lng_context_view_channel" = "View channel info";
"lng_context_open_link" = "Open Link";
"lng_context_copy_link" = "Copy Link";
"lng_context_copy_post_link" = "Copy Post Link";
"lng_context_open_email" = "Write to this address";
"lng_context_copy_email" = "Copy email address";
"lng_context_open_hashtag" = "Search by hashtag";
"lng_context_copy_hashtag" = "Copy hashtag";
"lng_context_open_mention" = "Open profile";
"lng_context_copy_mention" = "Copy username";
"lng_context_open_image" = "Open Image";
"lng_context_save_image" = "Save Image As..";
"lng_context_forward_image" = "Forward Image";
"lng_context_delete_image" = "Delete Image";
@ -734,13 +729,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Cancel Download";
"lng_context_show_in_folder" = "Show in Folder";
"lng_context_show_in_finder" = "Show in Finder";
"lng_context_open_video" = "Open Video";
"lng_context_save_video" = "Save Video As..";
"lng_context_open_audio" = "Open Audio";
"lng_context_save_audio" = "Save Audio As..";
"lng_context_pack_info" = "Pack Info";
"lng_context_pack_add" = "Add Stickers";
"lng_context_open_file" = "Open File";
"lng_context_save_file" = "Save File As..";
"lng_context_forward_file" = "Forward File";
"lng_context_delete_file" = "Delete File";

View File

@ -20,10 +20,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 9026;
static const wchar_t *AppVersionStr = L"0.9.26";
static const bool DevVersion = false;
#define BETA_VERSION (9026001ULL) // just comment this line to build public version
static const int32 AppVersion = 9027;
static const wchar_t *AppVersionStr = L"0.9.27";
static const bool DevVersion = true;
//#define BETA_VERSION (9026001ULL) // 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

@ -4455,8 +4455,8 @@ void HistoryGif::initDimensions(const HistoryItem *parent) {
_thumbh = th;
_maxw = qMax(tw, int32(st::minPhotoSize));
_minh = qMax(th, int32(st::minPhotoSize));
_maxw = qMax(_maxw, parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
if (!gif() || !_gif->ready()) {
_maxw = qMax(_maxw, parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
_maxw = qMax(_maxw, gifMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
}
if (bubble) {
@ -4506,12 +4506,12 @@ int32 HistoryGif::resize(int32 width, const HistoryItem *parent) {
_width = qMax(tw, int32(st::minPhotoSize));
_height = qMax(th, int32(st::minPhotoSize));
_width = qMax(_width, parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
if (gif() && _gif->ready()) {
if (!_gif->started()) {
_gif->start(_thumbw, _thumbh, _width, _height, true);
}
} else {
_width = qMax(_width, parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
_width = qMax(_width, gifMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
}
if (bubble) {

View File

@ -1032,6 +1032,12 @@ public:
}
bool canEdit(const QDateTime &cur) const;
bool hasDirectLink() const {
return id > 0 && _history->peer->isChannel() && _history->peer->asChannel()->isPublic();
}
QString directLink() const {
return hasDirectLink() ? qsl("https://telegram.me/") + _history->peer->asChannel()->username + '/' + QString::number(id) : QString();
}
int32 y;
MsgId id;

View File

@ -879,7 +879,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
}
if (lnkPhoto) {
_menu->addAction(lang(lng_context_open_image), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_save_image), this, SLOT(saveContextImage()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true);
} else {
@ -892,10 +891,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) {
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
}
_menu->addAction(lang(lnkIsVideo ? lng_context_open_video : (lnkIsAudio ? lng_context_open_audio : lng_context_open_file)), this, SLOT(openContextFile()))->setEnabled(true);
_menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true);
}
}
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
_menu->addAction(lang(lng_context_copy_post_link), _widget, SLOT(onCopyPostLink()));
}
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
@ -980,19 +981,18 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
QLatin1String linktype = _contextMenuLnk ? _contextMenuLnk->type() : qstr("");
if (linktype == qstr("TextLink") || linktype == qstr("LocationLink")) {
_menu->addAction(lang(lng_context_open_link), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_link), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("EmailLink")) {
_menu->addAction(lang(lng_context_open_email), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_email), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("MentionLink")) {
_menu->addAction(lang(lng_context_open_mention), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_mention), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("HashtagLink")) {
_menu->addAction(lang(lng_context_open_hashtag), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_hashtag), this, SLOT(copyContextUrl()))->setEnabled(true);
} else {
}
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
_menu->addAction(lang(lng_context_copy_post_link), _widget, SLOT(onCopyPostLink()));
}
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
@ -1044,13 +1044,6 @@ void HistoryInner::copySelectedText() {
}
}
void HistoryInner::openContextUrl() {
HistoryItem *was = App::hoveredLinkItem();
App::hoveredLinkItem(App::contextItem());
_contextMenuLnk->onClick(Qt::LeftButton);
App::hoveredLinkItem(was);
}
void HistoryInner::copyContextUrl() {
QString enc = _contextMenuLnk->encoded();
if (!enc.isEmpty()) {
@ -1109,14 +1102,6 @@ void HistoryInner::showContextInFolder() {
if (!already.isEmpty()) psShowInFolder(already);
}
void HistoryInner::openContextFile() {
HistoryItem *was = App::hoveredLinkItem();
App::hoveredLinkItem(App::contextItem());
DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data());
if (lnkDocument) DocumentOpenLink(lnkDocument->document()).onClick(Qt::LeftButton);
App::hoveredLinkItem(was);
}
void HistoryInner::saveContextFile() {
if (DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data())) {
DocumentSaveLink::doSave(lnkDocument->document(), true);
@ -6952,6 +6937,13 @@ void HistoryWidget::onEditMessage() {
}
}
void HistoryWidget::onCopyPostLink() {
HistoryItem *to = App::contextItem();
if (!to || !to->hasDirectLink()) return;
QApplication::clipboard()->setText(to->directLink());
}
bool HistoryWidget::lastForceReplyReplied(const FullMsgId &replyTo) const {
if (replyTo.msg > 0 && replyTo.channel != _channel) return false;
return _keyboard.forceReply() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _keyboard.forMsgId().msg == (replyTo.msg < 0 ? replyToId() : replyTo.msg);

View File

@ -108,13 +108,11 @@ public slots:
void onUpdateSelected();
void onParentGeometryChanged();
void openContextUrl();
void copyContextUrl();
void saveContextImage();
void copyContextImage();
void cancelContextDownload();
void showContextInFolder();
void openContextFile();
void saveContextFile();
void saveContextGif();
void copyContextText();
@ -610,6 +608,7 @@ public slots:
void onCancel();
void onReplyToMessage();
void onEditMessage();
void onCopyPostLink();
void onFieldBarCancel();
void onCancelSendAction();

View File

@ -3769,16 +3769,17 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
RecentStickerPack::iterator i = recent.begin(), e = recent.end();
for (; i != e; ++i) {
if (i->first == sticker) {
++i->second;
if (i->second > 0x8000) {
for (RecentStickerPack::iterator j = recent.begin(); j != e; ++j) {
if (j->second > 1) {
j->second /= 2;
} else {
j->second = 1;
}
}
}
i->second = recent.begin()->second; // throw to the first place
//++i->second;
//if (i->second > 0x8000) {
// for (RecentStickerPack::iterator j = recent.begin(); j != e; ++j) {
// if (j->second > 1) {
// j->second /= 2;
// } else {
// j->second = 1;
// }
// }
//}
for (; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) {
break;
@ -3790,13 +3791,14 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
}
if (i == e) {
while (recent.size() >= StickerPanPerRow * StickerPanRowsPerPage) recent.pop_back();
recent.push_back(qMakePair(sticker, 1));
for (i = recent.end() - 1; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) {
break;
}
qSwap(*i, *(i - 1));
}
recent.push_front(qMakePair(sticker, recent.isEmpty() ? 1 : recent.begin()->second));
//recent.push_back(qMakePair(sticker, 1));
//for (i = recent.end() - 1; i != recent.begin(); --i) {
// if ((i - 1)->second > i->second) {
// break;
// }
// qSwap(*i, *(i - 1));
//}
}
Local::writeUserSettings();

View File

@ -1967,6 +1967,15 @@ void MTProtoConnectionPrivate::restartNow() {
void MTProtoConnectionPrivate::socketStart(bool afterConfig) {
bool isDldDc = (dc >= MTP::dldStart) && (dc < MTP::dldEnd);
if (isDldDc) { // using media_only addresses only if key for this dc is already created
QReadLocker lockFinished(&sessionDataMutex);
if (sessionData) {
if (!sessionData->getKey()) {
isDldDc = false;
}
}
}
int32 baseDc = (dc % _mtp_internal::dcShift);
static const int IPv4address = 0, IPv6address = 1;
@ -2046,7 +2055,7 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) {
_pingSender.stop();
if (!noIPv4) DEBUG_LOG(("MTP Info: creating IPv4 connection to %1:%2 (tcp) and %1:%2 (http)..").arg(ip[IPv4address][TcpProtocol].c_str()).arg(port[IPv4address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol]));
if (!noIPv6) DEBUG_LOG(("MTP Info: creating IPv4 connection to [%1]:%2 (tcp) and [%1]:%2 (http)..").arg(ip[IPv6address][TcpProtocol].c_str()).arg(port[IPv6address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol]));
if (!noIPv6) DEBUG_LOG(("MTP Info: creating IPv6 connection to [%1]:%2 (tcp) and [%1]:%2 (http)..").arg(ip[IPv6address][TcpProtocol].c_str()).arg(port[IPv6address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol]));
_waitForConnectedTimer.start(_waitForConnected);
if (_conn4) {

View File

@ -1271,7 +1271,6 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_to_msg), this, SLOT(goToMessage()))->setEnabled(true);
}
if (lnkPhoto) {
_menu->addAction(lang(lng_context_open_image), this, SLOT(openContextUrl()))->setEnabled(true);
} else {
if (lnkDocument && lnkDocument->document()->loading()) {
_menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true);
@ -1279,7 +1278,6 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) {
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
}
_menu->addAction(lang(lnkIsVideo ? lng_context_open_video : (lnkIsAudio ? lng_context_open_audio : lng_context_open_file)), this, SLOT(openContextFile()))->setEnabled(true);
_menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true);
}
}
@ -1309,16 +1307,12 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu = new PopupMenu();
QLatin1String linktype = _contextMenuLnk ? _contextMenuLnk->type() : qstr("");
if (linktype == qstr("TextLink") || linktype == qstr("LocationLink")) {
_menu->addAction(lang(lng_context_open_link), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_link), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("EmailLink")) {
_menu->addAction(lang(lng_context_open_email), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_email), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("MentionLink")) {
_menu->addAction(lang(lng_context_open_mention), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_mention), this, SLOT(copyContextUrl()))->setEnabled(true);
} else if (linktype == qstr("HashtagLink")) {
_menu->addAction(lang(lng_context_open_hashtag), this, SLOT(openContextUrl()))->setEnabled(true);
_menu->addAction(lang(lng_context_copy_hashtag), this, SLOT(copyContextUrl()))->setEnabled(true);
} else {
}
@ -1447,15 +1441,6 @@ void OverviewInner::setSelectMode(bool enabled) {
_selMode = enabled;
}
void OverviewInner::openContextUrl() {
if (_contextMenuLnk) {
HistoryItem *was = App::hoveredLinkItem();
App::hoveredLinkItem(App::contextItem());
_contextMenuLnk->onClick(Qt::LeftButton);
App::hoveredLinkItem(was);
}
}
void OverviewInner::copyContextUrl() {
QString enc = _contextMenuLnk ? _contextMenuLnk->encoded() : QString();
if (!enc.isEmpty()) {
@ -1521,14 +1506,6 @@ void OverviewInner::saveContextFile() {
if (lnkDocument) DocumentSaveLink::doSave(lnkDocument->document(), true);
}
void OverviewInner::openContextFile() {
HistoryItem *was = App::hoveredLinkItem();
App::hoveredLinkItem(App::contextItem());
DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data());
if (lnkDocument) DocumentOpenLink(lnkDocument->document()).onClick(Qt::LeftButton);
App::hoveredLinkItem(was);
}
bool OverviewInner::onSearchMessages(bool searchCache) {
_searchTimer.stop();
QString q = _search.text().trimmed();

View File

@ -86,12 +86,10 @@ public slots:
void onUpdateSelected();
void openContextUrl();
void copyContextUrl();
void cancelContextDownload();
void showContextInFolder();
void saveContextFile();
void openContextFile();
void goToMessage();
void deleteMessage();

View File

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.26</string>
<string>0.9.27</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,26,1
PRODUCTVERSION 0,9,26,1
FILEVERSION 0,9,27,0
PRODUCTVERSION 0,9,27,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.26.1"
VALUE "FileVersion", "0.9.27.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.26.1"
VALUE "ProductVersion", "0.9.27.0"
END
END
BLOCK "VarFileInfo"

View File

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

View File

@ -1,6 +1,6 @@
AppVersion 9026
AppVersion 9027
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.26
AppVersionStr 0.9.26
DevChannel 0
BetaVersion 9026001
AppVersionStrSmall 0.9.27
AppVersionStr 0.9.27
DevChannel 1
BetaVersion 0 9026001