Skip to content

Commit

Permalink
0.9.1 stable version with fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Sep 24, 2015
1 parent 069333b commit 51fbec0
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 83 deletions.
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once

static const int32 AppVersion = 9000;
static const wchar_t *AppVersionStr = L"0.9";
static const int32 AppVersion = 9001;
static const wchar_t *AppVersionStr = L"0.9.1";
static const bool DevVersion = false;

static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
Expand Down
41 changes: 17 additions & 24 deletions Telegram/SourceFiles/dialogswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,25 +424,22 @@ void DialogsListWidget::onDialogRowReplaced(DialogRow *oldRow, DialogRow *newRow
}

void DialogsListWidget::createDialog(History *history) {
if (history->dialogs.isEmpty()) {
History::DialogLinks links = dialogs.addToEnd(history);
int32 movedFrom = links[0]->pos * st::dlgHeight;
dialogs.adjustByPos(links);
history->dialogs = links;
bool creating = history->dialogs.isEmpty();
if (creating) {
history->dialogs = dialogs.addToEnd(history);
contactsNoDialogs.del(history->peer, history->dialogs[0]);
}

contactsNoDialogs.del(history->peer, links[0]);
History::DialogLinks links = history->dialogs;
int32 movedFrom = links[0]->pos * st::dlgHeight;
dialogs.adjustByPos(links);
int32 movedTo = links[0]->pos * st::dlgHeight;

emit dialogToTopFrom(movedFrom);
emit App::main()->dialogsUpdated();
emit dialogMoved(movedFrom, movedTo);

if (creating) {
refresh();
} else {
int32 movedFrom = history->dialogs[0]->pos * st::dlgHeight;
dialogs.adjustByPos(history->dialogs);

emit dialogToTopFrom(movedFrom);
emit App::main()->dialogsUpdated();

parentWidget()->update();
}
}
Expand Down Expand Up @@ -476,8 +473,6 @@ void DialogsListWidget::removeContact(UserData *user) {
contactsNoDialogs.del(user);
contacts.del(user);

emit App::main()->dialogsUpdated();

refresh();
}

Expand Down Expand Up @@ -823,7 +818,6 @@ void DialogsListWidget::addSavedPeersAfter(const QDateTime &date) {
while (!saved.isEmpty() && (date.isNull() || date < saved.lastKey())) {
History *history = App::history(saved.last()->id);
history->setPosInDialogsDate(saved.lastKey());
history->dialogs = dialogs.addToEnd(history);
contactsNoDialogs.del(history->peer);
saved.remove(saved.lastKey(), saved.last());
}
Expand Down Expand Up @@ -1499,8 +1493,8 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent)
{
scroll.setWidget(&list);
scroll.setFocusPolicy(Qt::NoFocus);
connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int)));
connect(&list, SIGNAL(dialogToTopFrom(int)), this, SLOT(onDialogToTopFrom(int)));
connect(&list, SIGNAL(mustScrollTo(int,int)), &scroll, SLOT(scrollToY(int,int)));
connect(&list, SIGNAL(dialogMoved(int,int)), this, SLOT(onDialogMoved(int,int)));
connect(&list, SIGNAL(searchMessages()), this, SLOT(onNeedSearchMessages()));
connect(&list, SIGNAL(searchResultChosen()), this, SLOT(onCancel()));
connect(&list, SIGNAL(completeHashtag(QString)), this, SLOT(onCompleteHashtag(QString)));
Expand Down Expand Up @@ -2278,11 +2272,10 @@ void DialogsWidget::onCancelSearchInPeer() {
}
}

void DialogsWidget::onDialogToTopFrom(int movedFrom) {
if (scroll.scrollTop() > 0) {
if (movedFrom > scroll.scrollTop()) {
scroll.scrollToY(scroll.scrollTop() + st::dlgHeight);
}
void DialogsWidget::onDialogMoved(int movedFrom, int movedTo) {
int32 st = scroll.scrollTop();
if (st > movedTo && st < movedFrom) {
scroll.scrollToY(st + st::dlgHeight);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/dialogswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public slots:
signals:

void mustScrollTo(int scrollToTop, int scrollToBottom);
void dialogToTopFrom(int movedFrom);
void dialogMoved(int movedFrom, int movedTo);
void searchMessages();
void searchResultChosen();
void cancelSearchInPeer();
Expand Down Expand Up @@ -241,7 +241,7 @@ public slots:
void onFilterCursorMoved(int from = -1, int to = -1);
void onCompleteHashtag(QString tag);

void onDialogToTopFrom(int movedFrom);
void onDialogMoved(int movedFrom, int movedTo);
bool onSearchMessages(bool searchCache = false);
void onNeedSearchMessages();

Expand Down
61 changes: 29 additions & 32 deletions Telegram/SourceFiles/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1956,54 +1956,51 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice, const QVector<MTPM
}

void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPMessageGroup> *collapsed) {
bool wasEmpty = isEmpty(), wasLoadedAtBottom = loadedAtBottom();

if (slice.isEmpty()) {
newLoaded = true;
if (!lastMsg) setLastMessage(lastImportantMessage());
if (!collapsed || collapsed->isEmpty() || !isChannel()) {
if (isChannel()) asChannelHistory()->checkJoinedMessage();
return;
}
}

const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;
if (!slice.isEmpty() || (isChannel() && collapsed && !collapsed->isEmpty())) {
const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;

bool wasEmpty = isEmpty();
HistoryItem *prev = blocks.isEmpty() ? 0 : blocks.back()->items.back();

HistoryItem *prev = blocks.isEmpty() ? 0 : blocks.back()->items.back();
HistoryBlock *block = new HistoryBlock(this);
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
for (QVector<MTPmessage>::const_iterator i = slice.cend(), e = slice.cbegin(); i != e;) {
--i;
HistoryItem *adding = createItem(block, *i, false);
if (!adding) continue;

HistoryBlock *block = new HistoryBlock(this);
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
for (QVector<MTPmessage>::const_iterator i = slice.cend(), e = slice.cbegin(); i != e;) {
--i;
HistoryItem *adding = createItem(block, *i, false);
if (!adding) continue;
for (; groupsIt != groupsEnd; ++groupsIt) {
if (groupsIt->type() != mtpc_messageGroup) continue;
const MTPDmessageGroup &group(groupsIt->c_messageGroup());
if (group.vmin_id.v >= adding->id) break;

prev = addMessageGroupAfterPrevToBlock(group, prev, block);
}

prev = addItemAfterPrevToBlock(adding, prev, block);
}
for (; groupsIt != groupsEnd; ++groupsIt) {
if (groupsIt->type() != mtpc_messageGroup) continue;
const MTPDmessageGroup &group(groupsIt->c_messageGroup());
if (group.vmin_id.v >= adding->id) break;

prev = addMessageGroupAfterPrevToBlock(group, prev, block);
}

prev = addItemAfterPrevToBlock(adding, prev, block);
}
for (; groupsIt != groupsEnd; ++groupsIt) {
if (groupsIt->type() != mtpc_messageGroup) continue;
const MTPDmessageGroup &group(groupsIt->c_messageGroup());

prev = addMessageGroupAfterPrevToBlock(group, prev, block);
}

bool wasLoadedAtBottom = loadedAtBottom();
if (block->items.size()) {
block->y = height;
blocks.push_back(block);
height += block->height;
} else {
newLoaded = true;
setLastMessage(lastImportantMessage());
delete block;
if (block->items.size()) {
block->y = height;
blocks.push_back(block);
height += block->height;
} else {
newLoaded = true;
setLastMessage(lastImportantMessage());
delete block;
}
}
if (!wasLoadedAtBottom && loadedAtBottom()) { // add all loaded photos to overview
int32 mask = 0;
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/historywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2926,9 +2926,9 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) {
_replyForwardPreviewCancel.hide();
}
_previewCache.clear();
_scroll.takeWidget();
if (_list) _list->deleteLater();
_list = 0;
_scroll.takeWidget();
updateTopBarSelection();

_showAtMsgId = showAtMsgId;
Expand Down
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/overviewwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ bool OverviewInner::itemHasPoint(MsgId msgId, int32 index, int32 x, int32 y) con
if (media) {
int32 w = _width - st::msgMargin.left() - st::msgMargin.right();
bool out = item->out(), fromChannel = item->fromChannel(), outbg = out && !fromChannel;
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.right()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? (w - mw) / 2 : (out ? w - mw : 0)) : 0);
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.left()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? 0 : (out ? w - mw : 0)) : 0);
if (item->displayFromPhoto()) {
left += st::msgPhotoSkip;
}
Expand Down Expand Up @@ -1228,7 +1228,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
HistoryMedia *media = item ? item->getMedia(true) : 0;
if (media) {
bool out = item->out(), fromChannel = item->fromChannel(), outbg = out && !fromChannel;
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.right()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? (w - mw) / 2 : (out ? w - mw : 0)) : 0);
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.left()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? 0 : (out ? w - mw : 0)) : 0);
if (item->displayFromPhoto()) {
p.drawPixmap(left, media->countHeight(item, w) - st::msgPhotoSize, item->from()->photo->pixRounded(st::msgPhotoSize));
left += st::msgPhotoSkip;
Expand Down Expand Up @@ -1435,7 +1435,7 @@ void OverviewInner::onUpdateSelected() {
HistoryMedia *media = item->getMedia(true);
if (media) {
bool out = item->out(), fromChannel = item->fromChannel(), outbg = out && !fromChannel;
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.right()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? (w - mw) / 2 : (out ? w - mw : 0)) : 0);
int32 mw = media->maxWidth(), left = (fromChannel ? (st::msgMargin.left() + st::msgMargin.left()) / 2 : (out ? st::msgMargin.right() : st::msgMargin.left())) + ((mw < w) ? (fromChannel ? 0 : (out ? w - mw : 0)) : 0);
if (item->displayFromPhoto()) {
if (QRect(left, y + st::msgMargin.top() + media->countHeight(item, w) - st::msgPhotoSize, st::msgPhotoSize, st::msgPhotoSize).contains(m)) {
lnk = item->from()->lnk;
Expand Down
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/profilewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void ProfileInner::onFullPeerUpdated(PeerData *peer) {
updateInvitationLink();
_members.setText(lng_channel_members_link(lt_count, (_peerChannel->count > 0) ? _peerChannel->count : 1));
_admins.setText(lng_channel_admins_link(lt_count, (_peerChannel->adminsCount > 0) ? _peerChannel->adminsCount : 1));
_onlineText = lng_chat_status_members(lt_count, _peerChannel->count > 0 ? _peerChannel->count : 1);
_onlineText = (_peerChannel->count > 0) ? lng_chat_status_members(lt_count, _peerChannel->count) : lang(lng_channel_status);
if (_peerChannel->about.isEmpty()) {
_about = Text(st::wndMinWidth - st::profilePadding.left() - st::profilePadding.right());
} else {
Expand Down Expand Up @@ -537,7 +537,7 @@ void ProfileInner::peerUpdated(PeerData *data) {
}
_members.setText(lng_channel_members_link(lt_count, (_peerChannel->count > 0) ? _peerChannel->count : 1));
_admins.setText(lng_channel_admins_link(lt_count, (_peerChannel->adminsCount > 0) ? _peerChannel->adminsCount : 1));
_onlineText = lng_chat_status_members(lt_count, _peerChannel->count > 0 ? _peerChannel->count : 1);
_onlineText = (_peerChannel->count > 0) ? lng_chat_status_members(lt_count, _peerChannel->count) : lang(lng_channel_status);
}
_photoLink = (photo && photo->date) ? TextLinkPtr(new PhotoLink(photo, _peer)) : TextLinkPtr();
if (_peer->name != _nameCache) {
Expand Down Expand Up @@ -620,7 +620,7 @@ void ProfileInner::reorderParticipants() {
if (_peerUser) {
_onlineText = App::onlineText(_peerUser, t, true);
} else if (_peerChannel) {
_onlineText = lng_chat_status_members(lt_count, _peerChannel->count > 0 ? _peerChannel->count : 1);
_onlineText = (_peerChannel->count > 0) ? lng_chat_status_members(lt_count, _peerChannel->count) : lang(lng_channel_status);
} else {
_onlineText = lang(lng_chat_status_unaccessible);
}
Expand Down Expand Up @@ -1104,8 +1104,8 @@ void ProfileInner::resizeEvent(QResizeEvent *e) {
addbyname = st::profileStatusTop + st::linkFont->ascent - (st::profileNameTop + st::profileNameFont->ascent);
}
_members.move(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop);
addbyname = st::profileStatusTop + st::linkFont->ascent - (st::profileNameTop + st::profileNameFont->ascent);
_admins.move(_left + st::profilePhotoSize + st::profileStatusLeft, top + 2 * addbyname + st::profileStatusTop);
addbyname += st::profileStatusTop + st::linkFont->ascent - (st::profileNameTop + st::profileNameFont->ascent);
_admins.move(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop);
if (_amCreator) {
_cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhotoSize - st::linkFont->height);
} else {
Expand Down
11 changes: 7 additions & 4 deletions Telegram/SourceFiles/pspecific_wnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2806,15 +2806,18 @@ bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title
if (!SUCCEEDED(hr)) return false;

ToastNotifications::iterator i = toastNotifications.find(peer->id);
if (i == toastNotifications.cend()) {
i = toastNotifications.insert(peer->id, QMap<MsgId, ToastNotificationPtr>());
} else {
if (i != toastNotifications.cend()) {
QMap<MsgId, ToastNotificationPtr>::iterator j = i->find(msgId);
if (j != i->cend()) {
toastNotifier->Hide(j->p.Get());
ComPtr<IToastNotification> notify = j->p;
i->erase(j);
toastNotifier->Hide(notify.Get());
i = toastNotifications.find(peer->id);
}
}
if (i == toastNotifications.cend()) {
i = toastNotifications.insert(peer->id, QMap<MsgId, ToastNotificationPtr>());
}
hr = toastNotifier->Show(toast.Get());
if (!SUCCEEDED(hr)) {
if (i->isEmpty()) toastNotifications.erase(i);
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Telegram.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<string>0.9.1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>CFBundleSignature</key>
Expand Down
Binary file modified Telegram/Telegram.rc
Binary file not shown.
12 changes: 6 additions & 6 deletions Telegram/Telegram.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9;
CURRENT_PROJECT_VERSION = 0.9.1;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -1715,7 +1715,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.9;
CURRENT_PROJECT_VERSION = 0.9.1;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
Expand All @@ -1741,10 +1741,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9;
CURRENT_PROJECT_VERSION = 0.9.1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
Expand Down Expand Up @@ -1875,10 +1875,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.9;
CURRENT_PROJECT_VERSION = 0.9.1;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9;
DYLIB_CURRENT_VERSION = 0.9.1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
Expand Down
6 changes: 3 additions & 3 deletions Telegram/Version
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppVersion 9000
AppVersion 9001
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9
AppVersionStr 0.9.0
AppVersionStrSmall 0.9.1
AppVersionStr 0.9.1
DevChannel 0

0 comments on commit 51fbec0

Please sign in to comment.