@@ -108,7 +108,7 @@ Application::Application(int& argc, char** argv)
108
108
checkUpdateResults ();
109
109
110
110
// TODO: if not disabled in settings / if time has come
111
- checkForUpdates ();
111
+ checkForUpdates (false );
112
112
}
113
113
114
114
Application::~Application ()
@@ -205,15 +205,15 @@ QString Application::getUpdatePath() const
205
205
return QDir::temp ().absoluteFilePath (" CEEDUpdate" );
206
206
}
207
207
208
- void Application::checkForUpdates ()
208
+ void Application::checkForUpdates (bool manual )
209
209
{
210
210
if (!Utils::isInternetConnected ())
211
211
{
212
212
qCritical () << " No Internet connection, update check skipped" ;
213
213
return ;
214
214
}
215
215
216
- QUrl infoUrl = _settings->getQSettings ()->value (" updateInfoUrl" , " https://api.github.com/repos/cegui/ceed-cpp/releases/latest" ).toUrl ();
216
+ const QUrl infoUrl = _settings->getQSettings ()->value (" updateInfoUrl" , " https://api.github.com/repos/cegui/ceed-cpp/releases/latest" ).toUrl ();
217
217
218
218
_mainWindow->setStatusMessage (" Checking for updates..." );
219
219
@@ -223,7 +223,7 @@ void Application::checkForUpdates()
223
223
onUpdateError (infoReply->url (), infoReply->errorString ());
224
224
});
225
225
226
- QObject::connect (infoReply, &QNetworkReply::finished, [this , infoReply]()
226
+ QObject::connect (infoReply, &QNetworkReply::finished, [this , infoReply, manual ]()
227
227
{
228
228
// Already processed by QNetworkReply::errorOccurred handler
229
229
if (infoReply->error () != QNetworkReply::NoError) return ;
@@ -246,8 +246,11 @@ void Application::checkForUpdates()
246
246
auto savedVersion = QVersionNumber::fromString (_settings->getQSettings ()->value (" update/version" ).toString ());
247
247
if (latestVersion.normalized () == savedVersion.normalized ())
248
248
{
249
- _mainWindow->setStatusMessage (tr (" Auto-update to %1 is blocked because it failed before. "
250
- " Use Help->Check For Updates to try again." ).arg (latestVersionStr));
249
+ const QString msg = tr (" Auto-update to %1 is blocked because it failed before. "
250
+ " Use Help->Check For Updates to try again." ).arg (latestVersionStr);
251
+ _mainWindow->setStatusMessage (msg);
252
+ if (manual)
253
+ QMessageBox::warning (_mainWindow, tr (" Auto-update blocked" ), msg);
251
254
return ;
252
255
}
253
256
else
@@ -262,6 +265,13 @@ void Application::checkForUpdates()
262
265
UpdateDialog dlg (currentVersion, latestVersion, releaseInfo);
263
266
dlg.exec ();
264
267
}
268
+ else
269
+ {
270
+ const QString msg = tr (" CEED is already at the latest version: %1" ).arg (applicationVersion ());
271
+ _mainWindow->setStatusMessage (" No update found" );
272
+ if (manual)
273
+ QMessageBox::information (_mainWindow, tr (" Already updated" ), msg);
274
+ }
265
275
}
266
276
catch (const std::exception & e)
267
277
{
0 commit comments