Fix update checker not working on macOS (#1642)

* Prevent update dialog from going off screen

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Daniel 2020-05-10 07:13:47 -04:00 committed by GitHub
parent c5a7205d12
commit 680b500993
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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();