Merge pull request #28 from namecheap/bugfix/update-notification
Bugfix/update notification
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
# cmake_policy(SET CMP0076 OLD)
|
||||
|
||||
set(FLAMESHOT_VERSION 0.8.5.5)
|
||||
set(FLAMESHOT_VERSION 0.8.5.6)
|
||||
|
||||
# Flameshot-org
|
||||
#set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/latest")
|
||||
|
||||
@@ -159,8 +159,9 @@ void Controller::handleReplyCheckUpdates(QNetworkReply* reply)
|
||||
QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
|
||||
QJsonObject json = response.object();
|
||||
m_appLatestVersion = json["tag_name"].toString().replace("v", "");
|
||||
if (m_appLatestVersion.compare(
|
||||
QStringLiteral(APP_VERSION).replace("v", "")) < 0) {
|
||||
if (QStringLiteral(APP_VERSION)
|
||||
.replace("v", "")
|
||||
.compare(m_appLatestVersion) < 0) {
|
||||
m_appLatestUrl = json["html_url"].toString();
|
||||
QString newVersion =
|
||||
tr("New version %1 is available").arg(m_appLatestVersion);
|
||||
@@ -267,8 +268,8 @@ void Controller::startVisualCapture(const uint id,
|
||||
m_captureWindow->showFullScreen();
|
||||
#endif
|
||||
if (!m_appLatestUrl.isEmpty() &&
|
||||
0 != m_appLatestVersion.compare(
|
||||
ConfigHandler().ignoreUpdateToVersion())) {
|
||||
ConfigHandler().ignoreUpdateToVersion().compare(
|
||||
m_appLatestVersion) < 0) {
|
||||
m_captureWindow->showAppUpdateNotification(m_appLatestVersion,
|
||||
m_appLatestUrl);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ void UpdateNotificationWidget::updateButton()
|
||||
{
|
||||
QDesktopServices::openUrl(m_appLatestUrl);
|
||||
hide();
|
||||
if (parentWidget()) {
|
||||
parentWidget()->close();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateNotificationWidget::initInternalPanel()
|
||||
|
||||
Reference in New Issue
Block a user