Skip to content

Commit

Permalink
Removed RefPair struct. Beta 9040128.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Apr 11, 2016
1 parent e0d6a68 commit 5762391
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 55 deletions.
36 changes: 0 additions & 36 deletions Telegram/SourceFiles/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,42 +803,6 @@ static int32 QuarterArcLength = (FullArcLength / 4);
static int32 MinArcLength = (FullArcLength / 360);
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>
inline QSharedPointer<T> MakeShared(Args&&... args) {
return QSharedPointer<T>(new T(std_::forward<Args>(args)...));
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
18 changes: 10 additions & 8 deletions Telegram/SourceFiles/dialogswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Telegram/SourceFiles/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2228,13 +2228,13 @@ void History::clearOnDestroy() {
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);
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 {
Expand Down
6 changes: 5 additions & 1 deletion Telegram/SourceFiles/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ class History {
uint64 sortKeyInChatList() const {
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 {
return !chatListLinks(list).isEmpty();
}
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.40
AppVersionStr 0.9.40
DevChannel 0
BetaVersion 9040127
BetaVersion 9040128

0 comments on commit 5762391

Please sign in to comment.