MCPcopy Create free account
hub / github.com/baldurk/renderdoc / CheckUpdates

Method CheckUpdates

qrenderdoc/Windows/MainWindow.cpp:1427–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425}
1426
1427void MainWindow::CheckUpdates(bool forceCheck, UpdateResultMethod callback)
1428{
1429 if(!updateAction)
1430 return;
1431
1432 bool mismatch = HandleMismatchedVersions();
1433 if(mismatch)
1434 return;
1435
1436 if(!forceCheck && !m_Ctx.Config().CheckUpdate_AllowChecks)
1437 {
1438 updateAction->setVisible(false);
1439 if(callback)
1440 callback(UpdateResult::Disabled);
1441 return;
1442 }
1443
1444#if RENDERDOC_OFFICIAL_BUILD
1445
1446 // if the current version isn't the one we expected, clear any cached update state
1447 if(m_Ctx.Config().CheckUpdate_CurrentVersion != MAJOR_MINOR_VERSION_STRING)
1448 {
1449 m_Ctx.Config().CheckUpdate_UpdateAvailable = false;
1450 m_Ctx.Config().CheckUpdate_UpdateResponse = "";
1451 m_Ctx.Config().CheckUpdate_CurrentVersion = MAJOR_MINOR_VERSION_STRING;
1452 }
1453
1454 QDateTime today = QDateTime::currentDateTime();
1455
1456 // check by default every 2 days
1457 QDateTime compare = today.addDays(-2);
1458
1459 // if there's already an update available, go down to checking every week.
1460 if(m_Ctx.Config().CheckUpdate_UpdateAvailable)
1461 compare = today.addDays(-7);
1462
1463 bool checkDue = compare.secsTo(m_Ctx.Config().CheckUpdate_LastUpdate) < 0;
1464
1465 if(m_Ctx.Config().CheckUpdate_UpdateAvailable)
1466 {
1467 // Mark an update available
1468 SetUpdateAvailable();
1469
1470 // If we don't have a proper update response, or we're overdue for a check, then do it again.
1471 // The reason for this is twofold: first, if someone has been delaying their updates for a long
1472 // time then there might be a newer update available that we should refresh to, so we should
1473 // find out and refresh the update status. The other reason is that when we get a positive
1474 // response from the server we force-display the popup which means the user will get reminded
1475 // every week or so that an update is pending.
1476 if(m_Ctx.Config().CheckUpdate_UpdateResponse.isEmpty() || checkDue)
1477 {
1478 forceCheck = true;
1479 }
1480
1481 // If we're not forcing a recheck, we're done.
1482 if(!forceCheck)
1483 return;
1484 }

Callers

nothing calls this directly

Calls 10

setMaximumMethod · 0.80
trFunction · 0.50
QUrlFunction · 0.50
QStringFunction · 0.50
fromUtf8Function · 0.50
ConfigMethod · 0.45
isEmptyMethod · 0.45
SaveMethod · 0.45
setTextMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected