Merge branch 'dev' into bots

This commit is contained in:
John Preston 2016-03-26 11:24:50 +03:00
commit ebf9d3285b
27 changed files with 300 additions and 156 deletions

View File

@ -7,9 +7,9 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
## Supported systems
* Windows XP - Windows 10 (**not** RT)
* Mac OS X 10.8 - Mac OS X 10.10
* Mac OS X 10.8 - Mac OS X 10.11
* Mac OS X 10.6 - Mac OS X 10.7 (separate build)
* Ubuntu 12.04 - Ubuntu 14.04
* Ubuntu 12.04 - Ubuntu 15.04
* Fedora 22
## Third-party libraries

View File

@ -57,7 +57,11 @@ elif [ "$BuildTarget" == "mac" ]; then
echo "Deploying version $AppVersionStrFull for Windows.."
else
DeployMac="1"
DeployMac32="1"
if [ "$BetaVersion" != "0" ]; then
DeployMac32="0"
else
DeployMac32="1"
fi
DeployWin="1"
echo "Deploying three versions of $AppVersionStrFull: for Windows, OS X 10.6 and 10.7 and OS X 10.8+.."
fi

View File

@ -1148,7 +1148,7 @@ collapseButton: flatButton(btnDefFlat) {
textTop: 3px;
overTextTop: 3px;
downTextTop: 3px;
height: 24px;
height: 25px;
}
collapseHideDuration: 200;
collapseShowDuration: 200;

View File

@ -67,7 +67,8 @@ namespace {
SharedContactItems sharedContactItems;
GifItems gifItems;
typedef QMap<HistoryItem*, OrderedSet<HistoryItem*> > DependentItems;
typedef OrderedSet<HistoryItem*> DependentItemsSet;
typedef QMap<HistoryItem*, DependentItemsSet> DependentItems;
DependentItems dependentItems;
Histories histories;
@ -1787,26 +1788,28 @@ namespace App {
if (App::wnd()) {
App::wnd()->notifyItemRemoved(item);
}
item->history()->setPendingResize();
}
void historyUnregItem(HistoryItem *item) {
MsgsData *data = fetchMsgsData(item->channelId(), false);
if (!data) return;
MsgsData::iterator i = data->find(item->id);
auto i = data->find(item->id);
if (i != data->cend()) {
if (i.value() == item) {
data->erase(i);
}
}
historyItemDetached(item);
DependentItems::iterator j = ::dependentItems.find(item);
auto j = ::dependentItems.find(item);
if (j != ::dependentItems.cend()) {
for (OrderedSet<HistoryItem*>::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) {
k.key()->dependencyItemRemoved(item);
}
DependentItemsSet items;
std::swap(items, j.value());
::dependentItems.erase(j);
for_const (HistoryItem *dependent, items) {
dependent->dependencyItemRemoved(item);
}
}
if (App::main() && !App::quitting()) {
App::main()->itemRemoved(item);
@ -1816,8 +1819,8 @@ namespace App {
void historyUpdateDependent(HistoryItem *item) {
DependentItems::iterator j = ::dependentItems.find(item);
if (j != ::dependentItems.cend()) {
for (OrderedSet<HistoryItem*>::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) {
k.key()->updateDependencyItem();
for_const (HistoryItem *dependent, j.value()) {
dependent->updateDependencyItem();
}
}
if (App::main()) {
@ -1829,15 +1832,15 @@ namespace App {
::dependentItems.clear();
QVector<HistoryItem*> toDelete;
for (MsgsData::const_iterator i = msgsData.cbegin(), e = msgsData.cend(); i != e; ++i) {
if ((*i)->detached()) {
toDelete.push_back(*i);
for_const (HistoryItem *item, msgsData) {
if (item->detached()) {
toDelete.push_back(item);
}
}
for (ChannelMsgsData::const_iterator j = channelMsgsData.cbegin(), end = channelMsgsData.cend(); j != end; ++j) {
for (MsgsData::const_iterator i = j->cbegin(), e = j->cend(); i != e; ++i) {
if ((*i)->detached()) {
toDelete.push_back(*i);
for_const (const MsgsData &chMsgsData, channelMsgsData) {
for_const (HistoryItem *item, chMsgsData) {
if (item->detached()) {
toDelete.push_back(item);
}
}
}
@ -1903,7 +1906,7 @@ namespace App {
}
void historyUnregDependency(HistoryItem *dependent, HistoryItem *dependency) {
DependentItems::iterator i = ::dependentItems.find(dependency);
auto i = ::dependentItems.find(dependency);
if (i != ::dependentItems.cend()) {
i.value().remove(dependent);
if (i.value().isEmpty()) {

View File

@ -1025,10 +1025,10 @@ void AppClass::checkMapVersion() {
if (Local::oldMapVersion() < AppVersion) {
if (Local::oldMapVersion()) {
QString versionFeatures;
if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9031) {
if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9035) {
// QString ctrl = (cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? qsl("Cmd") : qsl("Ctrl");
// versionFeatures = QString::fromUtf8("\xe2\x80\x94 %1+W or %2+F4 for close window\n\xe2\x80\x94 %3+L to lock Telegram if you use a local passcode\n\xe2\x80\x94 Bug fixes and other minor improvements").arg(ctrl).arg(ctrl).arg(ctrl);// .replace('@', qsl("@") + QChar(0x200D));
versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed();
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Design improvements\n\xe2\x80\x94 Bug fixes and other minor improvements");// .replace('@', qsl("@") + QChar(0x200D));
// versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed();
} else if (Local::oldMapVersion() < 9031) {
versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed();
} else {

View File

@ -227,12 +227,15 @@ void audioPlayNotify() {
emit audioPlayer()->faderOnTimer();
}
// can be called at any moment when audio error
void audioFinish() {
if (player) {
deleteAndMark(player);
delete player;
player = nullptr;
}
if (capture) {
deleteAndMark(capture);
delete capture;
capture = nullptr;
}
alSourceStop(notifySource);

View File

@ -1670,12 +1670,15 @@ void ContactsBox::getAdminsDone(const MTPmessages_ChatFull &result) {
}
}
_saveRequestId = 0;
for (ChatData::Admins::const_iterator i = curadmins.cbegin(), e = curadmins.cend(); i != e; ++i) {
MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, i.key()->inputUser, MTP_boolFalse()), rpcDone(&ContactsBox::removeAdminDone, i.key()), rpcFail(&ContactsBox::editAdminFail), 0, (appoint.isEmpty() && i + 1 == e) ? 0 : 10);
for_const (UserData *user, curadmins) {
MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, user->inputUser, MTP_boolFalse()), rpcDone(&ContactsBox::removeAdminDone, user), rpcFail(&ContactsBox::editAdminFail), 0, 10);
}
for (int32 i = 0, l = appoint.size(); i < l; ++i) {
MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, appoint.at(i)->inputUser, MTP_boolTrue()), rpcDone(&ContactsBox::setAdminDone, appoint.at(i)), rpcFail(&ContactsBox::editAdminFail), 0, (i + 1 == l) ? 0 : 10);
for_const (UserData *user, appoint) {
MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, user->inputUser, MTP_boolTrue()), rpcDone(&ContactsBox::setAdminDone, user), rpcFail(&ContactsBox::editAdminFail), 0, 10);
}
MTP::sendAnything();
_saveRequestId = curadmins.size() + appoint.size();
if (!_saveRequestId) {
onClose();

View File

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

@ -4501,8 +4501,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) {
if (_channel->mgInfo->bots.isEmpty()) {
if (!_channel->mgInfo->botStatus && App::api()) App::api()->requestBots(_channel);
} else {
for (MegagroupInfo::Bots::const_iterator i = _channel->mgInfo->bots.cbegin(), e = _channel->mgInfo->bots.cend(); i != e; ++i) {
UserData *user = i.key();
for_const (auto *user, _channel->mgInfo->bots) {
if (!user->botInfo) continue;
if (!user->botInfo->inited && App::api()) App::api()->requestFullPeer(user);
if (user->botInfo->commands.isEmpty()) continue;

View File

@ -216,8 +216,8 @@ namespace Notify {
if (MainWidget *m = App::main()) {
m->notify_handlePendingHistoryUpdate();
}
for (auto i = Global::PendingRepaintItems().cbegin(), e = Global::PendingRepaintItems().cend(); i != e; ++i) {
Ui::repaintHistoryItem(i.key());
for_const (HistoryItem *item, Global::PendingRepaintItems()) {
Ui::repaintHistoryItem(item);
}
Global::RefPendingRepaintItems().clear();
}

View File

@ -759,12 +759,12 @@ HistoryItem *ChannelHistory::addNewToBlocks(const MTPMessage &msg, NewMessageTyp
if (prev && prev->type() == HistoryItemGroup) {
static_cast<HistoryGroup*>(prev)->uniteWith(item);
return prev;
} else {
QDateTime date = prev ? prev->date : item->date;
HistoryBlock *block = prev ? prev->block() : pushBackNewBlock();
addItemToBlock(HistoryGroup::create(this, item, date), block);
}
QDateTime date = prev ? prev->date : item->date;
HistoryBlock *block = prev ? prev->block() : pushBackNewBlock();
return addItemToBlock(HistoryGroup::create(this, item, date), block);
return item;
}
// when we are receiving channel dialog rows we get one important and one not important
@ -830,6 +830,7 @@ void ChannelHistory::switchMode() {
int willAddToBlock = qMin(int(MessagesPerPage), count - i);
block->items.reserve(willAddToBlock);
for (int till = i + willAddToBlock; i < till; ++i) {
t_assert(_otherList.at(i)->detached());
addItemToBlock(_otherList.at(i), block);
}
@ -1137,6 +1138,10 @@ void Histories::clear() {
for (Map::const_iterator i = map.cbegin(), e = map.cend(); i != e; ++i) {
delete i.value();
}
_unreadFull = _unreadMuted = 0;
if (App::wnd()) {
App::wnd()->updateCounter();
}
App::historyClearItems();
typing.clear();
map.clear();
@ -1998,7 +2003,7 @@ void History::setUnreadCount(int newUnreadCount, bool psUpdate) {
if (loadedAtBottom()) showFrom = lastImportantMessage();
inboxReadBefore = qMax(inboxReadBefore, msgIdForRead());
} else if (!newUnreadCount) {
showFrom = 0;
showFrom = nullptr;
inboxReadBefore = qMax(inboxReadBefore, msgIdForRead() + 1);
}
if (inChatList()) {
@ -2563,7 +2568,7 @@ void History::changeMsgId(MsgId oldId, MsgId newId) {
}
void History::removeBlock(HistoryBlock *block) {
setPendingResize();
t_assert(block->items.isEmpty());
int index = block->indexInHistory();
blocks.removeAt(index);
@ -2573,7 +2578,6 @@ void History::removeBlock(HistoryBlock *block) {
if (index < blocks.size()) {
blocks.at(index)->items.front()->previousItemChanged();
}
delete block;
}
History::~History() {
@ -2614,7 +2618,7 @@ void HistoryBlock::clear(bool leaveItems) {
void HistoryBlock::removeItem(HistoryItem *item) {
t_assert(item->block() == this);
int32 itemIndex = item->indexInBlock();
int itemIndex = item->indexInBlock();
if (history->showFrom == item) {
history->getNextShowFrom(this, itemIndex);
}
@ -2625,13 +2629,14 @@ void HistoryBlock::removeItem(HistoryItem *item) {
history->getNextScrollTopItem(this, itemIndex);
}
int myIndex = indexInHistory();
if (myIndex >= 0) { // fix message groups
int blockIndex = indexInHistory();
if (blockIndex >= 0) { // fix message groups
if (item->isImportant()) { // unite message groups around this important message
HistoryGroup *nextGroup = 0, *prevGroup = 0;
HistoryCollapse *nextCollapse = 0;
HistoryItem *prevItem = 0;
for (int32 nextBlock = myIndex, nextIndex = qMin(items.size(), itemIndex + 1); nextBlock < history->blocks.size(); ++nextBlock) {
HistoryGroup *nextGroup = nullptr;
HistoryGroup *prevGroup = nullptr;
HistoryCollapse *nextCollapse = nullptr;
HistoryItem *prevItem = nullptr;
for (int nextBlock = blockIndex, nextIndex = qMin(items.size(), itemIndex + 1); nextBlock < history->blocks.size(); ++nextBlock) {
HistoryBlock *block = history->blocks.at(nextBlock);
for (; nextIndex < block->items.size(); ++nextIndex) {
HistoryItem *item = block->items.at(nextIndex);
@ -2651,7 +2656,7 @@ void HistoryBlock::removeItem(HistoryItem *item) {
break;
}
}
for (int32 prevBlock = myIndex + 1, prevIndex = qMax(1, itemIndex); prevBlock > 0;) {
for (int prevBlock = blockIndex + 1, prevIndex = qMax(1, itemIndex); prevBlock > 0;) {
--prevBlock;
HistoryBlock *block = history->blocks.at(prevBlock);
if (!prevIndex) prevIndex = block->items.size();
@ -2680,24 +2685,26 @@ void HistoryBlock::removeItem(HistoryItem *item) {
}
}
}
// myIndex can be invalid now, because of destroying previous blocks
// itemIndex/blockIndex can be invalid now, because of destroying previous items/blocks
blockIndex = indexInHistory();
itemIndex = item->indexInBlock();
item->detachFast();
items.remove(itemIndex);
for (int i = itemIndex, l = items.size(); i < l; ++i) {
items.at(i)->setIndexInBlock(i);
}
if (itemIndex < items.size()) {
if (items.isEmpty()) {
history->removeBlock(this);
} else if (itemIndex < items.size()) {
items.at(itemIndex)->previousItemChanged();
} else if (_indexInHistory + 1 < history->blocks.size()) {
history->blocks.at(_indexInHistory + 1)->items.front()->previousItemChanged();
}
if ((!item->out() || item->isPost()) && item->unread() && history->unreadCount) {
history->setUnreadCount(history->unreadCount - 1);
} else if (blockIndex + 1 < history->blocks.size()) {
history->blocks.at(blockIndex + 1)->items.front()->previousItemChanged();
}
if (items.isEmpty()) {
history->removeBlock(this);
delete this;
}
}
@ -2790,6 +2797,9 @@ void HistoryItem::destroy() {
history()->clearLastKeyboard();
if (App::main()) App::main()->updateBotKeyboard(history());
}
if ((!out() || isPost()) && unread() && history()->unreadCount > 0) {
history()->setUnreadCount(history()->unreadCount - 1);
}
delete this;
}
@ -2800,7 +2810,6 @@ void HistoryItem::detach() {
_history->asChannelHistory()->messageDetached(this);
}
_block->removeItem(this);
detachFast();
App::historyItemDetached(this);
_history->setPendingResize();

View File

@ -239,7 +239,6 @@ public:
return blocks.isEmpty();
}
void clear(bool leaveItems = false);
void removeBlock(HistoryBlock *block);
virtual ~History();
@ -498,11 +497,16 @@ private:
MediaOverviewIds overviewIds[OverviewCount];
int32 overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded
void clearBlocks(bool leaveItems);
friend class HistoryBlock;
friend class ChannelHistory;
// this method just removes a block from the blocks list
// when the last item from this block was detached and
// calls the required previousItemChanged()
void removeBlock(HistoryBlock *block);
void clearBlocks(bool leaveItems);
HistoryItem *createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem);
HistoryItem *createItemForwarded(MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *msg);
HistoryItem *createItemDocument(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption);
@ -1163,7 +1167,10 @@ public:
return !_block;
}
void attachToBlock(HistoryBlock *block, int index) {
t_assert(_block == nullptr && _indexInBlock < 0);
t_assert(_block == nullptr);
t_assert(_indexInBlock < 0);
t_assert(block != nullptr);
t_assert(index >= 0);
_block = block;
_indexInBlock = index;
@ -1172,6 +1179,9 @@ public:
}
}
void setIndexInBlock(int index) {
t_assert(_block != nullptr);
t_assert(index >= 0);
_indexInBlock = index;
}
int indexInBlock() const {

View File

@ -663,10 +663,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_stickers_count" = "{count:Lade...|# Sticker|# Sticker}";
"lng_in_dlg_photo" = "Bild";
"lng_in_dlg_video" = "Video file";
"lng_in_dlg_audio_file" = "Audio file";
"lng_in_dlg_video" = "Videodatei";
"lng_in_dlg_audio_file" = "Audiodatei";
"lng_in_dlg_contact" = "Kontakt";
"lng_in_dlg_audio" = "Voice message";
"lng_in_dlg_audio" = "Sprachnachricht";
"lng_in_dlg_file" = "Datei";
"lng_in_dlg_sticker" = "Sticker";
"lng_in_dlg_sticker_emoji" = "{emoji} (Sticker)";
@ -741,9 +741,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_maps_point" = "Standort";
"lng_save_photo" = "Bild speichern";
"lng_save_video" = "Save video file";
"lng_save_audio_file" = "Save audio file";
"lng_save_audio" = "Save voice message";
"lng_save_video" = "Videodatei speichern";
"lng_save_audio_file" = "Audiodatei speichern";
"lng_save_audio" = "Sprachnachricht speichern";
"lng_save_file" = "Datei speichern";
"lng_save_downloaded" = "{ready} / {total} {mb}";
"lng_duration_and_size" = "{duration}, {size}";
@ -768,9 +768,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Download abbrechen";
"lng_context_show_in_folder" = "Im Ordner anzeigen";
"lng_context_show_in_finder" = "Im Finder zeigen";
"lng_context_save_video" = "Save Video File As...";
"lng_context_save_audio_file" = "Save Audio File As...";
"lng_context_save_audio" = "Save Voice Message As...";
"lng_context_save_video" = "Videodatei speichern unter...";
"lng_context_save_audio_file" = "Audiodatei speichern unter...";
"lng_context_save_audio" = "Sprachnachricht speichern unter...";
"lng_context_pack_info" = "Sticker-Paket";
"lng_context_pack_add" = "Sticker hinzufügen";
"lng_context_save_file" = "Datei speichern unter...";

View File

@ -663,10 +663,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_stickers_count" = "{count:Cargando...|# sticker|# stickers}";
"lng_in_dlg_photo" = "Foto";
"lng_in_dlg_video" = "Video file";
"lng_in_dlg_audio_file" = "Audio file";
"lng_in_dlg_video" = "Vídeo";
"lng_in_dlg_audio_file" = "Audio";
"lng_in_dlg_contact" = "Contacto";
"lng_in_dlg_audio" = "Voice message";
"lng_in_dlg_audio" = "Mensaje de voz";
"lng_in_dlg_file" = "Archivo";
"lng_in_dlg_sticker" = "Sticker";
"lng_in_dlg_sticker_emoji" = "{emoji} (sticker)";
@ -741,9 +741,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_maps_point" = "Ubicación";
"lng_save_photo" = "Guardar imagen";
"lng_save_video" = "Save video file";
"lng_save_audio_file" = "Save audio file";
"lng_save_audio" = "Save voice message";
"lng_save_video" = "Guardar vídeo";
"lng_save_audio_file" = "Guardar audio";
"lng_save_audio" = "Guardar mensaje de voz";
"lng_save_file" = "Guardar archivo";
"lng_save_downloaded" = "{ready} / {total} {mb}";
"lng_duration_and_size" = "{duration}, {size}";
@ -768,9 +768,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Cancelar descarga";
"lng_context_show_in_folder" = "Mostrar en la carpeta";
"lng_context_show_in_finder" = "Mostrar en el Finder";
"lng_context_save_video" = "Save Video File As...";
"lng_context_save_audio_file" = "Save Audio File As...";
"lng_context_save_audio" = "Save Voice Message As...";
"lng_context_save_video" = "Guardar como...";
"lng_context_save_audio_file" = "Guardar como...";
"lng_context_save_audio" = "Guardar como...";
"lng_context_pack_info" = "Información del pack";
"lng_context_pack_add" = "Añadir stickers";
"lng_context_save_file" = "Guardar como...";

View File

@ -663,10 +663,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_stickers_count" = "{count:Caricamento...|# sticker|# sticker}";
"lng_in_dlg_photo" = "Foto";
"lng_in_dlg_video" = "Video file";
"lng_in_dlg_audio_file" = "Audio file";
"lng_in_dlg_video" = "File video";
"lng_in_dlg_audio_file" = "File audio";
"lng_in_dlg_contact" = "Contatto";
"lng_in_dlg_audio" = "Voice message";
"lng_in_dlg_audio" = "Messaggio vocale";
"lng_in_dlg_file" = "File";
"lng_in_dlg_sticker" = "Sticker";
"lng_in_dlg_sticker_emoji" = "{emoji} (sticker)";
@ -741,9 +741,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_maps_point" = "Posizione";
"lng_save_photo" = "Salva immagine";
"lng_save_video" = "Save video file";
"lng_save_audio_file" = "Save audio file";
"lng_save_audio" = "Save voice message";
"lng_save_video" = "Salva file video";
"lng_save_audio_file" = "Salva file audio";
"lng_save_audio" = "Salva messaggio vocale";
"lng_save_file" = "Salva file";
"lng_save_downloaded" = "{ready} / {total} {mb}";
"lng_duration_and_size" = "{duration}, {size}";
@ -768,9 +768,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Annulla download";
"lng_context_show_in_folder" = "Mostra nella cartella";
"lng_context_show_in_finder" = "Mostra nel Finder";
"lng_context_save_video" = "Save Video File As...";
"lng_context_save_audio_file" = "Save Audio File As...";
"lng_context_save_audio" = "Save Voice Message As...";
"lng_context_save_video" = "Salva file video come...";
"lng_context_save_audio_file" = "Salva file audio come...";
"lng_context_save_audio" = "Salva messaggio vocale come...";
"lng_context_pack_info" = "Mostra sticker";
"lng_context_pack_add" = "Aggiungi sticker";
"lng_context_save_file" = "Salva file come...";

View File

@ -663,10 +663,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_stickers_count" = "{count:Carregando...|# sticker|# stickers}";
"lng_in_dlg_photo" = "Foto";
"lng_in_dlg_video" = "Video file";
"lng_in_dlg_audio_file" = "Audio file";
"lng_in_dlg_video" = "Vídeo";
"lng_in_dlg_audio_file" = "Áudio";
"lng_in_dlg_contact" = "Contato";
"lng_in_dlg_audio" = "Voice message";
"lng_in_dlg_audio" = "Mensagem de voz";
"lng_in_dlg_file" = "Arquivo";
"lng_in_dlg_sticker" = "Sticker";
"lng_in_dlg_sticker_emoji" = "{emoji} (sticker)";
@ -741,9 +741,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_maps_point" = "Localização";
"lng_save_photo" = "Salvar imagem";
"lng_save_video" = "Save video file";
"lng_save_audio_file" = "Save audio file";
"lng_save_audio" = "Save voice message";
"lng_save_video" = "Salvar vídeo";
"lng_save_audio_file" = "Salvar áudio";
"lng_save_audio" = "Salvar mensagens de voz";
"lng_save_file" = "Salvar arquivo";
"lng_save_downloaded" = "{ready} / {total} {mb}";
"lng_duration_and_size" = "{duration}, {size}";
@ -768,9 +768,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Cancelar Download";
"lng_context_show_in_folder" = "Mostrar na Pasta";
"lng_context_show_in_finder" = "Mostrar no Finder";
"lng_context_save_video" = "Save Video File As...";
"lng_context_save_audio_file" = "Save Audio File As...";
"lng_context_save_audio" = "Save Voice Message As...";
"lng_context_save_video" = "Salvar Vídeo Como...";
"lng_context_save_audio_file" = "Salvar Áudio Como...";
"lng_context_save_audio" = "Salvar Mensagem de Voz Como...";
"lng_context_pack_info" = "Informação do pacote";
"lng_context_pack_add" = "Adicionar aos Stickers";
"lng_context_save_file" = "Salvar Arquivo Como...";

View File

@ -452,7 +452,7 @@ ConnectionPrivate::ConnectionPrivate(QThread *thread, Connection *owner, Session
connect(thread, SIGNAL(started()), this, SLOT(socketStart()));
connect(thread, SIGNAL(finished()), this, SLOT(doFinish()));
connect(this, SIGNAL(finished(MTProtoConnection*)), globalSlotCarrier(), SLOT(connectionFinished(MTProtoConnection*)), Qt::QueuedConnection);
connect(this, SIGNAL(finished(Connection*)), globalSlotCarrier(), SLOT(connectionFinished(Connection*)), Qt::QueuedConnection);
connect(&retryTimer, SIGNAL(timeout()), this, SLOT(retryByTimer()));
connect(&_waitForConnectedTimer, SIGNAL(timeout()), this, SLOT(onWaitConnectedFailed()));
@ -765,13 +765,13 @@ void ConnectionPrivate::tryToSend() {
if (_pingIdToSend) {
if (prependOnly || dc != bareDcId(dc)) {
MTPPing ping(MTPping(MTP_long(_pingIdToSend)));
uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send
uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send
pingRequest = mtpRequestData::prepare(pingSize);
ping.write(*pingRequest);
DEBUG_LOG(("MTP Info: sending ping, ping_id: %1").arg(_pingIdToSend));
} else {
MTPPing_delay_disconnect ping(MTP_long(_pingIdToSend), MTP_int(MTPPingDelayDisconnect));
uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send
uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send
pingRequest = mtpRequestData::prepare(pingSize);
ping.write(*pingRequest);
DEBUG_LOG(("MTP Info: sending ping_delay_disconnect, ping_id: %1").arg(_pingIdToSend));
@ -1176,7 +1176,7 @@ void ConnectionPrivate::restart(bool mayBeBadKey) {
QReadLocker lockFinished(&sessionDataMutex);
if (!sessionData) return;
DEBUG_LOG(("MTP Info: restarting MTProtoConnection, maybe bad key = %1").arg(Logs::b(mayBeBadKey)));
DEBUG_LOG(("MTP Info: restarting Connection, maybe bad key = %1").arg(Logs::b(mayBeBadKey)));
_waitForReceivedTimer.stop();
_waitForConnectedTimer.stop();
@ -2342,7 +2342,7 @@ void ConnectionPrivate::updateAuthKey() {
QReadLocker lockFinished(&sessionDataMutex);
if (!sessionData || !_conn) return;
DEBUG_LOG(("AuthKey Info: MTProtoConnection updating key from MTProtoSession, dc %1").arg(dc));
DEBUG_LOG(("AuthKey Info: Connection updating key from Session, dc %1").arg(dc));
uint64 newKeyId = 0;
{
ReadLockerAttempt lock(sessionData->keyMutex());
@ -2359,7 +2359,7 @@ void ConnectionPrivate::updateAuthKey() {
clearMessages();
keyId = newKeyId;
}
DEBUG_LOG(("AuthKey Info: MTProtoConnection update key from MTProtoSession, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str()));
DEBUG_LOG(("AuthKey Info: Connection update key from Session, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str()));
if (keyId) {
return authKeyCreated();
}

View File

@ -269,11 +269,11 @@ void ConfigLoader::enumDC() {
dcs.insert(MTP::bareDcId(i.key()));
}
}
OrderedSet<int32>::const_iterator i = dcs.constFind(_enumCurrent);
auto i = dcs.constFind(_enumCurrent);
if (i == dcs.cend() || (++i) == dcs.cend()) {
_enumCurrent = dcs.cbegin().key();
_enumCurrent = *dcs.cbegin();
} else {
_enumCurrent = i.key();
_enumCurrent = *i;
}
_enumRequest = MTP::send(MTPhelp_GetConfig(), rpcDone(configLoaded), rpcFail(configFailed), MTP::cfgDcId(_enumCurrent));

View File

@ -100,7 +100,7 @@ namespace {
LOG(("MTP Error: could not find request %1 for resending").arg(requestId));
continue;
}
int32 dcWithShift = newdc;
ShiftedDcId dcWithShift = newdc;
{
RequestsByDC::iterator k = requestsByDC.find(requestId);
if (k == requestsByDC.cend()) {
@ -111,7 +111,7 @@ namespace {
setdc(newdc);
k.value() = -newdc;
} else {
dcWithShift += getDcIdShift(k.value());
dcWithShift = shiftDcId(newdc, getDcIdShift(k.value()));
k.value() = dcWithShift;
}
DEBUG_LOG(("MTP Info: resending request %1 to dc %2 after import auth").arg(requestId).arg(k.value()));
@ -167,7 +167,7 @@ namespace {
if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(err)).hasMatch()) {
if (!requestId) return false;
int32 dcWithShift = 0, newdcWithShift = m.captured(2).toInt();
ShiftedDcId dcWithShift = 0, newdcWithShift = m.captured(2).toInt();
{
QMutexLocker locker(&requestByDCLock);
RequestsByDC::iterator i = requestsByDC.find(requestId);
@ -193,7 +193,7 @@ namespace {
MTP::setdc(newdcWithShift);
}
} else {
newdcWithShift += MTP::getDcIdShift(dcWithShift);
newdcWithShift = shiftDcId(newdcWithShift, getDcIdShift(dcWithShift));
}
mtpRequest req;
@ -837,9 +837,9 @@ void finish() {
sessions.clear();
mainSession = nullptr;
for (MTPQuittingConnections::const_iterator i = quittingConnections.cbegin(), e = quittingConnections.cend(); i != e; ++i) {
i.key()->waitTillFinish();
delete i.key();
for_const (internal::Connection *connection, quittingConnections) {
connection->waitTillFinish();
delete connection;
}
quittingConnections.clear();

View File

@ -985,27 +985,27 @@ void WebLoadManager::process() {
i.value() = 0;
}
}
for (Loaders::iterator i = _loaders.begin(), e = _loaders.end(); i != e;) {
LoaderPointers::iterator it = _loaderPointers.find(i.key()->_interface);
if (it != _loaderPointers.cend() && it.key()->_private != i.key()) {
for (auto i = _loaders.begin(), e = _loaders.end(); i != e;) {
LoaderPointers::iterator it = _loaderPointers.find((*i)->_interface);
if (it != _loaderPointers.cend() && it.key()->_private != (*i)) {
it = _loaderPointers.end();
}
if (it == _loaderPointers.cend()) {
if (QNetworkReply *reply = i.key()->reply()) {
if (QNetworkReply *reply = (*i)->reply()) {
_replies.remove(reply);
reply->abort();
reply->deleteLater();
}
delete i.key();
delete (*i);
i = _loaders.erase(i);
} else {
++i;
}
}
}
for (Loaders::const_iterator i = newLoaders.cbegin(), e = newLoaders.cend(); i != e; ++i) {
if (_loaders.contains(i.key())) {
sendRequest(i.key());
for_const (webFileLoaderPrivate *loader, newLoaders) {
if (_loaders.contains(loader)) {
sendRequest(loader);
}
}
}
@ -1047,8 +1047,8 @@ void WebLoadManager::clear() {
}
_loaderPointers.clear();
for (Loaders::iterator i = _loaders.begin(), e = _loaders.end(); i != e; ++i) {
delete i.key();
for_const (webFileLoaderPrivate *loader, _loaders) {
delete loader;
}
_loaders.clear();

View File

@ -85,7 +85,7 @@ Session::Session(int32 dcenter) : QObject()
return;
}
if (dcWithShift) {
DEBUG_LOG(("Session Info: MTProtoSession::start called on already started session"));
DEBUG_LOG(("Session Info: Session::start called on already started session"));
return;
}
@ -461,18 +461,18 @@ QReadWriteLock *Session::keyMutex() const {
}
void Session::authKeyCreatedForDC() {
DEBUG_LOG(("AuthKey Info: MTProtoSession::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift));
DEBUG_LOG(("AuthKey Info: Session::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift));
data.setKey(dc->getKey());
emit authKeyCreated();
}
void Session::notifyKeyCreated(const AuthKeyPtr &key) {
DEBUG_LOG(("AuthKey Info: MTProtoSession::keyCreated(), setting, dcWithShift %1").arg(dcWithShift));
DEBUG_LOG(("AuthKey Info: Session::keyCreated(), setting, dcWithShift %1").arg(dcWithShift));
dc->setKey(key);
}
void Session::layerWasInitedForDC(bool wasInited) {
DEBUG_LOG(("MTP Info: MTProtoSession::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift));
DEBUG_LOG(("MTP Info: Session::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift));
data.setLayerWasInited(wasInited);
}

View File

@ -951,7 +951,7 @@ void GifOpenLink::onClick(Qt::MouseButton button) const {
void DocumentSaveLink::doSave(DocumentData *data, bool forceSavingAs) {
if (!data->date) return;
QString filepath = data->filepath(DocumentData::FilePathResolveSaveFromData, forceSavingAs);
QString filepath = data->filepath(DocumentData::FilePathResolveSaveFromDataSilent, forceSavingAs);
if (!filepath.isEmpty() && !forceSavingAs) {
QPoint pos(QCursor::pos());
if (!psShowOpenWithMenu(pos.x(), pos.y(), filepath)) {
@ -1376,7 +1376,7 @@ QString DocumentData::filepath(FilePathResolveType type, bool forceSavingAs) con
if (saveFromData) {
if (type != FilePathResolveSaveFromData && type != FilePathResolveSaveFromDataSilent) {
saveFromData = false;
} else if (type == FilePathResolveSaveFromDataSilent && cAskDownloadPath()) {
} else if (type == FilePathResolveSaveFromDataSilent && (cAskDownloadPath() || forceSavingAs)) {
saveFromData = false;
}
}

View File

@ -36,13 +36,126 @@ T *getPointerAndReset(T *&ptr) {
struct NullType {
};
// ordered set template based on QMap
template <typename T>
class OrderedSet : public QMap<T, NullType> {
class OrderedSet {
typedef OrderedSet<T> Self;
typedef QMap<T, NullType> Impl;
typedef typename Impl::iterator IteratorImpl;
typedef typename Impl::const_iterator ConstIteratorImpl;
Impl impl_;
public:
void insert(const T &v) {
QMap<T, NullType>::insert(v, NullType());
}
inline bool operator==(const Self &other) const { return impl_ == other.impl_; }
inline bool operator!=(const Self &other) const { return impl_ != other.impl_; }
inline int size() const { return impl_.size(); }
inline bool isEmpty() const { return impl_.isEmpty(); }
inline void detach() { return impl_.detach(); }
inline bool isDetached() const { return impl_.isDetached(); }
inline void clear() { return impl_.clear(); }
inline QList<T> values() const { return impl_.keys(); }
inline const T &first() const { return impl_.firstKey(); }
inline const T &last() const { return impl_.lastKey(); }
class const_iterator;
class iterator {
public:
typedef typename IteratorImpl::iterator_category iterator_category;
typedef typename IteratorImpl::difference_type difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
explicit iterator(const IteratorImpl &impl) : impl_(impl) {
}
inline const T &operator*() const { return impl_.key(); }
inline const T *operator->() const { return &impl_.key(); }
inline bool operator==(const iterator &other) const { return impl_ == other.impl_; }
inline bool operator!=(const iterator &other) const { return impl_ != other.impl_; }
inline iterator &operator++() { ++impl_; return *this; }
inline iterator operator++(int) { return iterator(impl_++); }
inline iterator &operator--() { --impl_; return *this; }
inline iterator operator--(int) { return iterator(impl_--); }
inline iterator operator+(int j) const { return iterator(impl_ + j); }
inline iterator operator-(int j) const { return iterator(impl_ - j); }
inline iterator &operator+=(int j) { impl_ += j; return *this; }
inline iterator &operator-=(int j) { impl_ -= j; return *this; }
friend class const_iterator;
inline bool operator==(const const_iterator &other) const { return impl_ == other.impl_; }
inline bool operator!=(const const_iterator &other) const { return impl_ != other.impl_; }
private:
IteratorImpl impl_;
friend class OrderedSet<T>;
};
friend class iterator;
class const_iterator {
public:
typedef typename IteratorImpl::iterator_category iterator_category;
typedef typename IteratorImpl::difference_type difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
explicit const_iterator(const ConstIteratorImpl &impl) : impl_(impl) {
}
inline const T &operator*() const { return impl_.key(); }
inline const T *operator->() const { return &impl_.key(); }
inline bool operator==(const const_iterator &other) const { return impl_ == other.impl_; }
inline bool operator!=(const const_iterator &other) const { return impl_ != other.impl_; }
inline const_iterator &operator++() { ++impl_; return *this; }
inline const_iterator operator++(int) { return const_iterator(impl_++); }
inline const_iterator &operator--() { --impl_; return *this; }
inline const_iterator operator--(int) { return const_iterator(impl_--); }
inline const_iterator operator+(int j) const { return const_iterator(impl_ + j); }
inline const_iterator operator-(int j) const { return const_iterator(impl_ - j); }
inline const_iterator &operator+=(int j) { impl_ += j; return *this; }
inline const_iterator &operator-=(int j) { impl_ -= j; return *this; }
friend class iterator;
inline bool operator==(const iterator &other) const { return impl_ == other.impl_; }
inline bool operator!=(const iterator &other) const { return impl_ != other.impl_; }
private:
ConstIteratorImpl impl_;
friend class OrderedSet<T>;
};
friend class const_iterator;
// STL style
inline iterator begin() { return iterator(impl_.begin()); }
inline const_iterator begin() const { return const_iterator(impl_.cbegin()); }
inline const_iterator constBegin() const { return const_iterator(impl_.cbegin()); }
inline const_iterator cbegin() const { return const_iterator(impl_.cbegin()); }
inline iterator end() { detach(); return iterator(impl_.end()); }
inline const_iterator end() const { return const_iterator(impl_.cend()); }
inline const_iterator constEnd() const { return const_iterator(impl_.cend()); }
inline const_iterator cend() const { return const_iterator(impl_.cend()); }
inline iterator erase(iterator it) { return iterator(impl_.erase(it.impl_)); }
inline iterator insert(const T &value) { return iterator(impl_.insert(value, NullType())); }
inline iterator insert(const_iterator pos, const T &value) { return iterator(impl_.insert(pos.impl_, value, NullType())); }
inline int remove(const T &value) { return impl_.remove(value); }
inline bool contains(const T &value) const { return impl_.contains(value); }
// more Qt
typedef iterator Iterator;
typedef const_iterator ConstIterator;
inline int count() const { return impl_.count(); }
inline iterator find(const T &value) { return iterator(impl_.find(value)); }
inline const_iterator find(const T &value) const { return const_iterator(impl_.constFind(value)); }
inline const_iterator constFind(const T &value) const { return const_iterator(impl_.constFind(value)); }
inline Self &unite(const Self &other) { impl_.unite(other.impl_); return *this; }
// STL compatibility
typedef typename Impl::difference_type difference_type;
typedef typename Impl::size_type size_type;
inline bool empty() const { return impl_.empty(); }
};

View File

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.34</string>
<string>0.9.36</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,34,4
PRODUCTVERSION 0,9,34,4
FILEVERSION 0,9,36,0
PRODUCTVERSION 0,9,36,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.34.4"
VALUE "FileVersion", "0.9.36.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.34.4"
VALUE "ProductVersion", "0.9.36.0"
END
END
BLOCK "VarFileInfo"

View File

@ -1772,7 +1772,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.34;
CURRENT_PROJECT_VERSION = 0.9.36;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@ -1791,7 +1791,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.9.34;
CURRENT_PROJECT_VERSION = 0.9.36;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1820,10 +1820,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.34;
CURRENT_PROJECT_VERSION = 0.9.36;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.34;
DYLIB_CURRENT_VERSION = 0.9.36;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1961,10 +1961,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9.34;
CURRENT_PROJECT_VERSION = 0.9.36;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.34;
DYLIB_CURRENT_VERSION = 0.9.36;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "";

View File

@ -1,6 +1,6 @@
AppVersion 9034
AppVersion 9036
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.34
AppVersionStr 0.9.34
DevChannel 0
BetaVersion 9034004
AppVersionStrSmall 0.9.36
AppVersionStr 0.9.36
DevChannel 1
BetaVersion 0 9034004