diff --git a/Telegram/SourceFiles/basic_types.h b/Telegram/SourceFiles/basic_types.h index 4298c59f6..75757ba02 100644 --- a/Telegram/SourceFiles/basic_types.h +++ b/Telegram/SourceFiles/basic_types.h @@ -803,42 +803,6 @@ static int32 QuarterArcLength = (FullArcLength / 4); static int32 MinArcLength = (FullArcLength / 360); static int32 AlmostFullArcLength = (FullArcLength - MinArcLength); -template -class RefPairImplementation { -public: - template - const RefPairImplementation &operator=(const RefPairImplementation &other) const { - _first = other._first; - _second = other._second; - return *this; - } - - template - const RefPairImplementation &operator=(const QPair &other) const { - _first = other.first; - _second = other.second; - return *this; - } - -private: - RefPairImplementation(T1 &first, T2 &second) : _first(first), _second(second) { - } - RefPairImplementation(const RefPairImplementation &other); - - template - friend RefPairImplementation RefPairCreator(T3 &first, T4 &second); - - T1 &_first; - T2 &_second; -}; - -template -inline RefPairImplementation RefPairCreator(T1 &first, T2 &second) { - return RefPairImplementation(first, second); -} - -#define RefPair(Type1, Name1, Type2, Name2) Type1 Name1; Type2 Name2; RefPairCreator(Name1, Name2) - template inline QSharedPointer MakeShared(Args&&... args) { return QSharedPointer(new T(std_::forward(args)...)); diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index d1e88b6c4..fc327897d 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org static const int32 AppVersion = 9040; static const wchar_t *AppVersionStr = L"0.9.40"; static const bool DevVersion = false; -#define BETA_VERSION (9040127ULL) // just comment this line to build public version +#define BETA_VERSION (9040128ULL) // 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"; diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 297ba54d4..7c8460aae 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -456,14 +456,15 @@ void DialogsInner::createDialog(History *history) { } } } - RefPair(int32, movedFrom, int32, movedTo) = changed; - emit dialogMoved(movedFrom, movedTo); + int from = dialogsOffset() + changed.movedFrom * st::dlgHeight; + int to = dialogsOffset() + changed.movedTo * st::dlgHeight; + emit dialogMoved(from, to); if (creating) { refresh(); - } else if (_state == DefaultState && movedFrom != movedTo) { - update(0, dialogsOffset() + qMin(movedFrom, movedTo), fullWidth(), qAbs(movedFrom - movedTo) + st::dlgHeight); + } else if (_state == DefaultState && changed.movedFrom != changed.movedTo) { + update(0, qMin(from, to), fullWidth(), qAbs(from - to) + st::dlgHeight); } } @@ -1162,14 +1163,15 @@ void DialogsInner::notify_historyMuteUpdated(History *history) { if (Global::DialogsMode() != Dialogs::Mode::Important) { return; } - RefPair(int32, movedFrom, int32, movedTo) = changed; - emit dialogMoved(movedFrom, movedTo); + int from = dialogsOffset() + changed.movedFrom * st::dlgHeight; + int to = dialogsOffset() + changed.movedTo * st::dlgHeight; + emit dialogMoved(from, to); if (creating) { refresh(); - } else if (_state == DefaultState && movedFrom != movedTo) { - update(0, dialogsOffset() + qMin(movedFrom, movedTo), fullWidth(), qAbs(movedFrom - movedTo) + st::dlgHeight); + } else if (_state == DefaultState && changed.movedFrom != changed.movedTo) { + update(0, qMin(from, to), fullWidth(), qAbs(from - to) + st::dlgHeight); } } } diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index ef44e65bf..4a0890ccc 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -2228,13 +2228,13 @@ void History::clearOnDestroy() { clearBlocks(false); } -QPair History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) { +History::PositionInChatListChange History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) { t_assert(indexed != nullptr); Dialogs::Row *lnk = mainChatListLink(list); - int32 movedFrom = lnk->pos() * st::dlgHeight; + int32 movedFrom = lnk->pos(); indexed->adjustByPos(chatListLinks(list)); - int32 movedTo = lnk->pos() * st::dlgHeight; - return qMakePair(movedFrom, movedTo); + int32 movedTo = lnk->pos(); + return { movedFrom, movedTo }; } int History::posInChatList(Dialogs::Mode list) const { diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 095fc2c96..ce0d8aca7 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -278,7 +278,11 @@ public: uint64 sortKeyInChatList() const { return _sortKeyInChatList; } - QPair adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed); + struct PositionInChatListChange { + int movedFrom; + int movedTo; + }; + PositionInChatListChange adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed); bool inChatList(Dialogs::Mode list) const { return !chatListLinks(list).isEmpty(); } diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index a4c62726c..2299da7c3 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "Resources\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,40,127 - PRODUCTVERSION 0,9,40,127 + FILEVERSION 0,9,40,128 + PRODUCTVERSION 0,9,40,128 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.40.127" + VALUE "FileVersion", "0.9.40.128" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.40.127" + VALUE "ProductVersion", "0.9.40.128" END END BLOCK "VarFileInfo" diff --git a/Telegram/Version b/Telegram/Version index 1a02f2c2b..c2248b5e5 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -3,4 +3,4 @@ AppVersionStrMajor 0.9 AppVersionStrSmall 0.9.40 AppVersionStr 0.9.40 DevChannel 0 -BetaVersion 9040127 +BetaVersion 9040128