From 680b500993c3fb16cc92121812e658127dca59c4 Mon Sep 17 00:00:00 2001 From: Daniel <24928223+dnsge@users.noreply.github.com> Date: Sun, 10 May 2020 07:13:47 -0400 Subject: [PATCH] Fix update checker not working on macOS (#1642) * Prevent update dialog from going off screen Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/singletons/Updates.cpp | 12 +++++++----- src/util/InitUpdateButton.cpp | 13 +++++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8227a15d5..e81e87638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,5 +8,6 @@ - Minor: Removed "Online Logs" functionality as services are shut down (#1640) - Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546) - Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602) +- Bugfix: MacOS updater looked for non-existing fields, causing it to always fail the update check (#1642) - Settings open faster - Dev: Fully remove Twitch Chatroom support diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 8f1054982..3b6ca327f 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -259,7 +259,7 @@ void Updates::checkForUpdates() } #if defined Q_OS_WIN || defined Q_OS_MACOS - /// Windows downloads an installer for the new version + /// Downloads an installer for the new version QJsonValue updateExe_val = object.value("updateexe"); if (!updateExe_val.isString()) { @@ -268,7 +268,8 @@ void Updates::checkForUpdates() return Failure; } this->updateExe_ = updateExe_val.toString(); - +#endif +#ifdef Q_OS_WIN /// Windows portable QJsonValue portable_val = object.value("portable_download"); if (!portable_val.isString()) @@ -278,14 +279,15 @@ void Updates::checkForUpdates() return Failure; } this->updatePortable_ = portable_val.toString(); - -#elif defined Q_OS_LINUX +#endif +#ifdef Q_OS_LINUX QJsonValue updateGuide_val = object.value("updateguide"); if (updateGuide_val.isString()) { this->updateGuideLink_ = updateGuide_val.toString(); } -#else +#endif +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) && !defined(Q_OS_LINUX) return Failure; #endif diff --git a/src/util/InitUpdateButton.cpp b/src/util/InitUpdateButton.cpp index 826c8feb8..4c1de6b89 100644 --- a/src/util/InitUpdateButton.cpp +++ b/src/util/InitUpdateButton.cpp @@ -14,8 +14,17 @@ void initUpdateButton(Button &button, QObject::connect(&button, &Button::leftClicked, [&button] { auto dialog = new UpdateDialog(); dialog->setActionOnFocusLoss(BaseWindow::Delete); - dialog->move(button.mapToGlobal( - QPoint(int(-100 * button.scale()), button.height()))); + + auto globalPoint = button.mapToGlobal( + QPoint(int(-100 * button.scale()), button.height())); + + // Make sure that update dialog will not go off left edge of screen + if (globalPoint.x() < 0) + { + globalPoint.setX(0); + } + + dialog->move(globalPoint); dialog->show(); dialog->raise();