From 1a4986058d8c37ca4560fe02c6d5566d40615aa1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Sep 2016 12:57:44 -0400 Subject: [PATCH 1/2] Fixed warning for non-MAS Xcode version. --- Telegram/SourceFiles/pspecific_mac_p.h | 4 +++- Telegram/SourceFiles/pspecific_mac_p.mm | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h index f128ebe91..f95607a0b 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.h +++ b/Telegram/SourceFiles/pspecific_mac_p.h @@ -89,7 +89,6 @@ QByteArray objc_downloadPathBookmark(const QString &path); QByteArray objc_pathBookmark(const QString &path); void objc_downloadPathEnableAccess(const QByteArray &bookmark); -class objc_FileBookmarkData; class objc_FileBookmark { public: objc_FileBookmark(const QByteArray &bookmark); @@ -103,6 +102,9 @@ public: ~objc_FileBookmark(); private: +#ifdef OS_MAC_STORE + class objc_FileBookmarkData; objc_FileBookmarkData *data = nullptr; +#endif // OS_MAC_STORE }; diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index fd0022457..c6bb35f30 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -1160,7 +1160,7 @@ namespace { QMutex _bookmarksMutex; } -class objc_FileBookmarkData { +class objc_FileBookmark::objc_FileBookmarkData { public: ~objc_FileBookmarkData() { if (url) [url release]; From 9bd30ba09f4bf9b99e41772fad0e4cf11750b2c1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Sep 2016 13:01:33 -0400 Subject: [PATCH 2/2] Alpha version 0.10.3: fixed the build for old OS X versions and Qt 5.3.2 --- Telegram/SourceFiles/boxes/addcontactbox.cpp | 2 +- Telegram/SourceFiles/core/basic_types.h | 9 +++++- Telegram/SourceFiles/core/observer.h | 2 +- .../SourceFiles/core/vector_of_moveable.h | 8 ++--- Telegram/SourceFiles/pspecific_mac_p.h | 32 +++++++++---------- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index ee742defd..2b621ff10 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -1355,7 +1355,7 @@ RevokePublicLinkBox::RevokePublicLinkBox(base::lambda_unique &&revokeCal , _revokeWidth(st::normalFont->width(lang(lng_channels_too_much_public_revoke))) , _aboutRevoke(this, lang(lng_channels_too_much_public_about), FlatLabel::InitType::Simple, st::aboutRevokePublicLabel) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) -, _revokeCallback(std::move(revokeCallback)) { +, _revokeCallback(std_::move(revokeCallback)) { setMouseTracking(true); MTP::send(MTPchannels_GetAdminedPublicChannels(), rpcDone(&RevokePublicLinkBox::getPublicDone), rpcFail(&RevokePublicLinkBox::getPublicFail)); diff --git a/Telegram/SourceFiles/core/basic_types.h b/Telegram/SourceFiles/core/basic_types.h index b22743c36..42a314387 100644 --- a/Telegram/SourceFiles/core/basic_types.h +++ b/Telegram/SourceFiles/core/basic_types.h @@ -339,6 +339,13 @@ inline constexpr typename remove_reference::type &&move(T &&value) noexcept { return static_cast::type&&>(value); } +template +void swap(T &a, T &b) { + T tmp = move(a); + a = move(b); + b = move(tmp); +} + template struct remove_const { using type = T; @@ -510,7 +517,7 @@ struct is_base_of { template T createAndSwap(T &value) { T result = T(); - std::swap(result, value); + std_::swap(result, value); return std_::move(result); } diff --git a/Telegram/SourceFiles/core/observer.h b/Telegram/SourceFiles/core/observer.h index 452a0ef83..f37494625 100644 --- a/Telegram/SourceFiles/core/observer.h +++ b/Telegram/SourceFiles/core/observer.h @@ -417,7 +417,7 @@ private: } static void destroyNode(Subscription::Node *node) { - if (auto that = node->observable.lock()) { + if (auto that = node->observable.toStrongRef()) { static_cast(that.data())->remove(node); } } diff --git a/Telegram/SourceFiles/core/vector_of_moveable.h b/Telegram/SourceFiles/core/vector_of_moveable.h index 8328b8668..861b184ec 100644 --- a/Telegram/SourceFiles/core/vector_of_moveable.h +++ b/Telegram/SourceFiles/core/vector_of_moveable.h @@ -39,9 +39,9 @@ public: , _plaindata(createAndSwap(other._plaindata)) { } vector_of_moveable &operator=(vector_of_moveable &&other) { - std::swap(_size, other._size); - std::swap(_capacity, other._capacity); - std::swap(_plaindata, other._plaindata); + std_::swap(_size, other._size); + std_::swap(_capacity, other._capacity); + std_::swap(_plaindata, other._plaindata); return *this; } @@ -165,7 +165,7 @@ private: new (newLocation) T(std_::move(*oldLocation)); oldLocation->~T(); } - std::swap(_plaindata, newPlainData); + std_::swap(_plaindata, newPlainData); _capacity = newCapacity; operator delete[](newPlainData); } diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h index f95607a0b..2cd3098e2 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.h +++ b/Telegram/SourceFiles/pspecific_mac_p.h @@ -24,31 +24,31 @@ public: PsMacWindowPrivate(); - void setWindowBadge(const QString &str); - void startBounce(); + void setWindowBadge(const QString &str); + void startBounce(); void updateDelegate(); - - void showNotify(uint64 peer, int32 msgId, const QPixmap &pix, const QString &title, const QString &subtitle, const QString &msg, bool withReply); - void clearNotifies(uint64 peer = 0); - - void enableShadow(WId winId); + + void showNotify(uint64 peer, int32 msgId, const QPixmap &pix, const QString &title, const QString &subtitle, const QString &msg, bool withReply); + void clearNotifies(uint64 peer = 0); + + void enableShadow(WId winId); bool filterNativeEvent(void *event); - virtual void activeSpaceChanged() { - } + virtual void activeSpaceChanged() { + } virtual void darkModeChanged() { } - virtual void notifyClicked(unsigned long long peer, int msgid) { - } - virtual void notifyReplied(unsigned long long peer, int msgid, const char *str) { - } - + virtual void notifyClicked(unsigned long long peer, int msgid) { + } + virtual void notifyReplied(unsigned long long peer, int msgid, const char *str) { + } + ~PsMacWindowPrivate(); - PsMacWindowData *data; - + PsMacWindowData *data; + }; void objc_holdOnTop(WId winId);