Removed RefPair struct. Beta 9040128.

This commit is contained in:
John Preston 2016-04-11 15:14:54 +04:00
parent e0d6a68554
commit 576239166d
7 changed files with 25 additions and 55 deletions

View file

@ -803,42 +803,6 @@ static int32 QuarterArcLength = (FullArcLength / 4);
static int32 MinArcLength = (FullArcLength / 360); static int32 MinArcLength = (FullArcLength / 360);
static int32 AlmostFullArcLength = (FullArcLength - MinArcLength); static int32 AlmostFullArcLength = (FullArcLength - MinArcLength);
template <typename T1, typename T2>
class RefPairImplementation {
public:
template <typename T3, typename T4>
const RefPairImplementation &operator=(const RefPairImplementation<T3, T4> &other) const {
_first = other._first;
_second = other._second;
return *this;
}
template <typename T3, typename T4>
const RefPairImplementation &operator=(const QPair<T3, T4> &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 <typename T3, typename T4>
friend RefPairImplementation<T3, T4> RefPairCreator(T3 &first, T4 &second);
T1 &_first;
T2 &_second;
};
template <typename T1, typename T2>
inline RefPairImplementation<T1, T2> RefPairCreator(T1 &first, T2 &second) {
return RefPairImplementation<T1, T2>(first, second);
}
#define RefPair(Type1, Name1, Type2, Name2) Type1 Name1; Type2 Name2; RefPairCreator(Name1, Name2)
template <typename T, typename... Args> template <typename T, typename... Args>
inline QSharedPointer<T> MakeShared(Args&&... args) { inline QSharedPointer<T> MakeShared(Args&&... args) {
return QSharedPointer<T>(new T(std_::forward<Args>(args)...)); return QSharedPointer<T>(new T(std_::forward<Args>(args)...));

View file

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
static const int32 AppVersion = 9040; static const int32 AppVersion = 9040;
static const wchar_t *AppVersionStr = L"0.9.40"; static const wchar_t *AppVersionStr = L"0.9.40";
static const bool DevVersion = false; 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 *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop"; static const wchar_t *AppName = L"Telegram Desktop";

View file

@ -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) { if (creating) {
refresh(); refresh();
} else if (_state == DefaultState && movedFrom != movedTo) { } else if (_state == DefaultState && changed.movedFrom != changed.movedTo) {
update(0, dialogsOffset() + qMin(movedFrom, movedTo), fullWidth(), qAbs(movedFrom - movedTo) + st::dlgHeight); 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) { if (Global::DialogsMode() != Dialogs::Mode::Important) {
return; 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) { if (creating) {
refresh(); refresh();
} else if (_state == DefaultState && movedFrom != movedTo) { } else if (_state == DefaultState && changed.movedFrom != changed.movedTo) {
update(0, dialogsOffset() + qMin(movedFrom, movedTo), fullWidth(), qAbs(movedFrom - movedTo) + st::dlgHeight); update(0, qMin(from, to), fullWidth(), qAbs(from - to) + st::dlgHeight);
} }
} }
} }

View file

@ -2228,13 +2228,13 @@ void History::clearOnDestroy() {
clearBlocks(false); clearBlocks(false);
} }
QPair<int32, int32> History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) { History::PositionInChatListChange History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) {
t_assert(indexed != nullptr); t_assert(indexed != nullptr);
Dialogs::Row *lnk = mainChatListLink(list); Dialogs::Row *lnk = mainChatListLink(list);
int32 movedFrom = lnk->pos() * st::dlgHeight; int32 movedFrom = lnk->pos();
indexed->adjustByPos(chatListLinks(list)); indexed->adjustByPos(chatListLinks(list));
int32 movedTo = lnk->pos() * st::dlgHeight; int32 movedTo = lnk->pos();
return qMakePair(movedFrom, movedTo); return { movedFrom, movedTo };
} }
int History::posInChatList(Dialogs::Mode list) const { int History::posInChatList(Dialogs::Mode list) const {

View file

@ -278,7 +278,11 @@ public:
uint64 sortKeyInChatList() const { uint64 sortKeyInChatList() const {
return _sortKeyInChatList; return _sortKeyInChatList;
} }
QPair<int32, int32> 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 { bool inChatList(Dialogs::Mode list) const {
return !chatListLinks(list).isEmpty(); return !chatListLinks(list).isEmpty();
} }

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "Resources\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,40,127 FILEVERSION 0,9,40,128
PRODUCTVERSION 0,9,40,127 PRODUCTVERSION 0,9,40,128
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.40.127" VALUE "FileVersion", "0.9.40.128"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.40.127" VALUE "ProductVersion", "0.9.40.128"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.40 AppVersionStrSmall 0.9.40
AppVersionStr 0.9.40 AppVersionStr 0.9.40
DevChannel 0 DevChannel 0
BetaVersion 9040127 BetaVersion 9040128