fix - 'update version notification' widget position and event handler for Linux

This commit is contained in:
Yuriy Puchkov
2020-12-18 15:22:14 +02:00
parent aee8a55292
commit 2114ad3c32
3 changed files with 13 additions and 2 deletions

View File

@@ -159,6 +159,7 @@ void Controller::handleReplyCheckUpdates(QNetworkReply* reply)
QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
QJsonObject json = response.object();
m_appLatestVersion = json["tag_name"].toString().replace("v", "");
m_appLatestVersion = "0.8.5.7";
if (QStringLiteral(APP_VERSION)
.replace("v", "")
.compare(m_appLatestVersion) < 0) {

View File

@@ -784,8 +784,15 @@ void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
m_updateNotificationWidget =
new UpdateNotificationWidget(this, appLatestVersion, appLatestUrl);
}
m_updateNotificationWidget->move(
(width() - m_updateNotificationWidget->width()) / 2, 0);
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
int ax = (width() - m_updateNotificationWidget->width()) / 2;
#else
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
int ax = helpRect.left() +
((helpRect.width() - m_updateNotificationWidget->width()) / 2);
#endif
m_updateNotificationWidget->move(ax, 0);
makeChild(m_updateNotificationWidget);
m_updateNotificationWidget->show();
}

View File

@@ -85,6 +85,9 @@ void UpdateNotificationWidget::updateButton()
{
QDesktopServices::openUrl(m_appLatestUrl);
hide();
if (parentWidget()) {
parentWidget()->close();
}
}
void UpdateNotificationWidget::initInternalPanel()