| 52 | } |
| 53 | |
| 54 | void UpdateChecker::checkForUpdate(const QString& updateChannel, bool notifyNoUpdate) |
| 55 | { |
| 56 | if (m_externalUpdater) |
| 57 | { |
| 58 | m_externalUpdater->setBetaAllowed(updateChannel == "beta"); |
| 59 | if (notifyNoUpdate) |
| 60 | { |
| 61 | qDebug() << "Checking for updates."; |
| 62 | m_externalUpdater->checkForUpdates(); |
| 63 | } else |
| 64 | { |
| 65 | // The updater library already handles automatic update checks. |
| 66 | return; |
| 67 | } |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | qDebug() << "Checking for updates."; |
| 72 | // If the channel list hasn't loaded yet, load it and defer checking for updates until |
| 73 | // later. |
| 74 | if (!m_chanListLoaded) |
| 75 | { |
| 76 | qDebug() << "Channel list isn't loaded yet. Loading channel list and deferring update check."; |
| 77 | m_checkUpdateWaiting = true; |
| 78 | m_deferredUpdateChannel = updateChannel; |
| 79 | updateChanList(notifyNoUpdate); |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | if (m_updateChecking) |
| 84 | { |
| 85 | qDebug() << "Ignoring update check request. Already checking for updates."; |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | // Find the desired channel within the channel list and get its repo URL. If if cannot be |
| 90 | // found, error. |
| 91 | QString stableUrl; |
| 92 | m_newRepoUrl = ""; |
| 93 | for (ChannelListEntry entry: m_channels) |
| 94 | { |
| 95 | qDebug() << "channelEntry = " << entry.id; |
| 96 | if (entry.id == "stable") |
| 97 | { |
| 98 | stableUrl = entry.url; |
| 99 | } |
| 100 | if (entry.id == updateChannel) |
| 101 | { |
| 102 | m_newRepoUrl = entry.url; |
| 103 | qDebug() << "is intended update channel: " << entry.id; |
| 104 | } |
| 105 | if (entry.id == m_currentChannel) |
| 106 | { |
| 107 | m_currentRepoUrl = entry.url; |
| 108 | qDebug() << "is current update channel: " << entry.id; |
| 109 | } |
| 110 | } |
| 111 |
no test coverage detected