| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/dialogs/formupdate.cpp`/ |
| 2 | |
| 3 | #include "gui/dialogs/formupdate.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formupdate.h`/ |
| 4 | |
| 5 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 6 | #include "gui/guiutilities.h"cxx . . $ `<file>/src/librssguard/gui/guiutilities.h`/ |
| 7 | #include "miscellaneous/iconfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/iconfactory.h`/ |
| 8 | #include "network-web/downloader.h"cxx . . $ `<file>/src/librssguard/network-web/downloader.h`/ |
| 9 | #include "network-web/networkfactory.h"cxx . . $ `<file>/src/librssguard/network-web/networkfactory.h`/ |
| 10 | #include "network-web/webfactory.h"cxx . . $ `<file>/src/librssguard/network-web/webfactory.h`/ |
| 11 | |
| 12 | #include <QNetworkReply> |
| 13 | |
| 14 | #if defined(Q_OS_WIN) |
| 15 | #include <windows.h> |
| 16 | #endif |
| 17 | |
| 18 | FormUpdatecxx . . $ FormUpdate#::FormUpdatecxx . . $ FormUpdate#FormUpdate(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) : QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent) { |
| 19 | m_uicxx . . $ FormUpdate#m_ui..setupUicxx . . $ Ui_FormUpdate#setupUi(d194de0c0f68c28b).(this); |
| 20 | m_uicxx . . $ FormUpdate#m_ui..m_lblCurrentReleasecxx . . $ Ui_FormUpdate#m_lblCurrentRelease.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(APP_VERSIONcxx . . $ `<built-in>:496:9`!)); |
| 21 | m_uicxx . . $ FormUpdate#m_ui..m_tabInfocxx . . $ Ui_FormUpdate#m_tabInfo.->removeTabcxx . . $ QTabWidget#removeTab(d4f767463ce0a6b3).(1); |
| 22 | m_uicxx . . $ FormUpdate#m_ui..m_buttonBoxcxx . . $ Ui_FormUpdate#m_buttonBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 23 | |
| 24 | // Set flags and attributes. |
| 25 | GuiUtilitiescxx . . $ GuiUtilities#::applyDialogPropertiescxx . . $ GuiUtilities#applyDialogProperties(6e9150cdaac92159).(*this, qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("help-about"))); |
| 26 | |
| 27 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&m_downloadercxx . . $ FormUpdate#m_downloader., &Downloadercxx . . $ Downloader#::progresscxx . . $ Downloader#progress(8be204668a5c1685)., this, &FormUpdatecxx . . $ FormUpdate#::updateProgresscxx . . $ FormUpdate#updateProgress(8be204668a5c1685).); |
| 28 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&m_downloadercxx . . $ FormUpdate#m_downloader., &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., this, &FormUpdatecxx . . $ FormUpdate#::updateCompletedcxx . . $ FormUpdate#updateCompleted(377b816ef29857eb).); |
| 29 | |
| 30 | if (isSelfUpdateSupportedcxx . . $ FormUpdate#isSelfUpdateSupported(50ce9a9e25b4a850).()) { |
| 31 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate. = m_uicxx . . $ FormUpdate#m_ui..m_buttonBoxcxx . . $ Ui_FormUpdate#m_buttonBox.->addButtoncxx . . $ QDialogButtonBox#addButton(e1d5d6a6f174d44b).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Download selected update"), QDialogButtonBoxcxx . . $ QDialogButtonBox#::ButtonRolecxx . . $ QDialogButtonBox#ButtonRole#::ActionRolecxx . . $ QDialogButtonBox#ActionRole.); |
| 32 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Download new installation files.")); |
| 33 | } |
| 34 | else { |
| 35 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate. = |
| 36 | m_uicxx . . $ FormUpdate#m_ui..m_buttonBoxcxx . . $ Ui_FormUpdate#m_buttonBox.->addButtoncxx . . $ QDialogButtonBox#addButton(e1d5d6a6f174d44b).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Go to application website"), QDialogButtonBoxcxx . . $ QDialogButtonBox#::ButtonRolecxx . . $ QDialogButtonBox#ButtonRole#::ActionRolecxx . . $ QDialogButtonBox#ActionRole.); |
| 37 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Go to application website to get update packages manually.")); |
| 38 | } |
| 39 | |
| 40 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 41 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &FormUpdatecxx . . $ FormUpdate#::startUpdatecxx . . $ FormUpdate#startUpdate(49f6e7a06ebc5aa8).); |
| 42 | checkForUpdatescxx . . $ FormUpdate#checkForUpdates(49f6e7a06ebc5aa8).(); |
| 43 | } |
| 44 | |
| 45 | bool FormUpdatecxx . . $ FormUpdate#::isSelfUpdateSupportedcxx . . $ FormUpdate#isSelfUpdateSupported(50ce9a9e25b4a850).() const { |
| 46 | #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) |
| 47 | return true; |
| 48 | #else |
| 49 | return false; |
| 50 | #endif |
| 51 | } |
| 52 | |
| 53 | void FormUpdatecxx . . $ FormUpdate#::checkForUpdatescxx . . $ FormUpdate#checkForUpdates(49f6e7a06ebc5aa8).() { |
| 54 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->systemcxx . . $ Application#system(4ec014040ff5a0f7).(), |
| 55 | &SystemFactorycxx . . $ SystemFactory#::updatesCheckedcxx . . $ SystemFactory#updatesChecked(3f40250543adfaa5)., |
| 56 | this, |
| 57 | [this](const QPaircxx . . $ QPair#<QListcxx . . $ QList#<UpdateInfocxx . . $ UpdateInfo#>, QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#>& update) { |
| 58 | m_uicxx . . $ FormUpdate#m_ui..m_buttonBoxcxx . . $ Ui_FormUpdate#m_buttonBox.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 59 | disconnectcxx . . $ QObject#disconnect(bea847693c2a9ff4).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->systemcxx . . $ Application#system(4ec014040ff5a0f7).(), &SystemFactorycxx . . $ SystemFactory#::updatesCheckedcxx . . $ SystemFactory#updatesChecked(3f40250543adfaa5)., nullptr, nullptr); |
| 60 | |
| 61 | if (update.secondcxx . . $ std/pair#second. != QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 62 | m_updateInfocxx . . $ FormUpdate#m_updateInfo. =cxx . . $ UpdateInfo#`operator=`(9c84c141614a91e1). UpdateInfocxx . . $ UpdateInfo#(); |
| 63 | m_uicxx . . $ FormUpdate#m_ui..m_tabInfocxx . . $ Ui_FormUpdate#m_tabInfo.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 64 | |
| 65 | //: Unknown release. |
| 66 | m_uicxx . . $ FormUpdate#m_ui..m_lblAvailableReleasecxx . . $ Ui_FormUpdate#m_lblAvailableRelease.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("unknown")); |
| 67 | m_uicxx . . $ FormUpdate#m_ui..m_txtChangescxx . . $ Ui_FormUpdate#m_txtChanges.->clearcxx . . $ QTextEdit#clear(49f6e7a06ebc5aa8).(); |
| 68 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Errorcxx . . $ WidgetWithStatus#StatusType#Error., |
| 69 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Error: '%1'.").argcxx . . $ QString#arg(ad0bca07273edcc2).(NetworkFactorycxx . . $ NetworkFactory#::networkErrorTextcxx . . $ NetworkFactory#networkErrorText(76e9e349cca0e801).(update.secondcxx . . $ std/pair#second.)), |
| 70 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("List with updates was not\ndownloaded successfully.")); |
| 71 | } |
| 72 | else { |
| 73 | const bool self_update_supported = isSelfUpdateSupportedcxx . . $ FormUpdate#isSelfUpdateSupported(50ce9a9e25b4a850).(); |
| 74 | m_updateInfocxx . . $ FormUpdate#m_updateInfo. =cxx . . $ UpdateInfo#`operator=`(910ba3b66ff7eeb9). update.firstcxx . . $ std/pair#first..atcxx . . $ QList#at(c7965f769b39929).(0); |
| 75 | m_uicxx . . $ FormUpdate#m_ui..m_tabInfocxx . . $ Ui_FormUpdate#m_tabInfo.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 76 | m_uicxx . . $ FormUpdate#m_ui..m_lblAvailableReleasecxx . . $ Ui_FormUpdate#m_lblAvailableRelease.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(m_updateInfocxx . . $ FormUpdate#m_updateInfo..m_availableVersioncxx . . $ UpdateInfo#m_availableVersion.); |
| 77 | |
| 78 | #if QT_VERSIONcxx . . $ `<external>/3898848398875472725/qtversionchecks.h:17:9`! >= 0x050E00 // Qt >= 5.14.0 |
| 79 | m_uicxx . . $ FormUpdate#m_ui..m_txtChangescxx . . $ Ui_FormUpdate#m_txtChanges.->setMarkdowncxx . . $ QTextEdit#setMarkdown(3520e46b33348bf6).(m_updateInfocxx . . $ FormUpdate#m_updateInfo..m_changescxx . . $ UpdateInfo#m_changes.); |
| 80 | #else |
| 81 | m_ui.m_txtChanges->setText(m_updateInfo.m_changes); |
| 82 | #endif |
| 83 | |
| 84 | if (SystemFactorycxx . . $ SystemFactory#::isVersionNewercxx . . $ SystemFactory#isVersionNewer(edf9e4f73813982f).(m_updateInfocxx . . $ FormUpdate#m_updateInfo..m_availableVersioncxx . . $ UpdateInfo#m_availableVersion., QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(APP_VERSIONcxx . . $ `<built-in>:496:9`!))) { |
| 85 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(true); |
| 86 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Okcxx . . $ WidgetWithStatus#StatusType#Ok., |
| 87 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("New release available."), |
| 88 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("This is new version which can be\ndownloaded.")); |
| 89 | |
| 90 | if (self_update_supported) { |
| 91 | loadAvailableFilescxx . . $ FormUpdate#loadAvailableFiles(49f6e7a06ebc5aa8).(); |
| 92 | } |
| 93 | } |
| 94 | else { |
| 95 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Warningcxx . . $ WidgetWithStatus#StatusType#Warning., |
| 96 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("No new release available."), |
| 97 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("This release is not newer than\ncurrently installed one.")); |
| 98 | } |
| 99 | } |
| 100 | }); |
| 101 | |
| 102 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->systemcxx . . $ Application#system(4ec014040ff5a0f7).()->checkForUpdatescxx . . $ SystemFactory#checkForUpdates(83f5f38750778ac8).(); |
| 103 | } |
| 104 | |
| 105 | void FormUpdatecxx . . $ FormUpdate#::updateProgresscxx . . $ FormUpdate#updateProgress(8be204668a5c1685).(qint64cxx . . $ qint64# bytes_received, qint64cxx . . $ qint64# bytes_total) { |
| 106 | if (bytes_received - m_lastDownloadedBytescxx . . $ FormUpdate#m_lastDownloadedBytes. > 500000 || m_lastDownloadedBytescxx . . $ FormUpdate#m_lastDownloadedBytes. == 0) { |
| 107 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Informationcxx . . $ WidgetWithStatus#StatusType#Information., |
| 108 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Downloaded %1% (update size is %2 kB).") |
| 109 | .argcxx . . $ QString#arg(89b093bd48b6d6c0).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(bytes_total == 0L ? 0L : (bytes_received * 100.0) / bytes_total, |
| 110 | 'f', |
| 111 | 2), |
| 112 | QStringcxx . . $ QString#::numbercxx . . $ QString#number(ac5d358e2e30f7ea).(bytes_total / 1000.0, 'f', 2)), |
| 113 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Downloading update...")); |
| 114 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->repaintcxx . . $ QWidget#repaint(49f6e7a06ebc5aa8).(); |
| 115 | m_lastDownloadedBytescxx . . $ FormUpdate#m_lastDownloadedBytes. = bytes_received; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | void FormUpdatecxx . . $ FormUpdate#::saveUpdateFilecxx . . $ FormUpdate#saveUpdateFile(45672f3c6961a244).(const QByteArraycxx . . $ QByteArray#& file_contents) { |
| 120 | const QStringcxx . . $ QString# url_file = m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->currentItemcxx . . $ QListWidget#currentItem(a843e491ce3ee2b1).()->datacxx . . $ QListWidgetItem#data(fb36142a814bbf95).(Qtcxx . . $ Qt/::UserRolecxx . . $ Qt/UserRole.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 121 | const QStringcxx . . $ QString# temp_directory = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->tempFoldercxx . . $ Application#tempFolder(6ef7b6c27b00b43d).(); |
| 122 | |
| 123 | if (!temp_directory.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 124 | const QStringcxx . . $ QString# output_file_name = url_file.midcxx . . $ QString#mid(5eea715ff28b9227).(url_file.lastIndexOfcxx . . $ QString#lastIndexOf(aa6b5e61941c3c07).('/'cxx . . $ QChar#QChar(93d577a3e9528307).) + 1); |
| 125 | QFilecxx . . $ QFile# output_filecxx . . $ QFile#QFile(3520e46b33348bf6).(temp_directory + QDircxx . . $ QDir#::separatorcxx . . $ QDir#separator(44eb9225326fcbf5).() + output_file_name); |
| 126 | |
| 127 | if (output_file.opencxx . . $ QFile#open(da34f43c1eae080c).(QIODevicecxx . . $ QIODevice#::WriteOnlycxx . . $ QIODeviceBase#WriteOnly. |cxx . . $ `operator|`(64b8367948668350). QIODevicecxx . . $ QIODevice#::Truncatecxx . . $ QIODeviceBase#Truncate.)) { |
| 128 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Storing update file to temporary location" |
| 129 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(QDir::toNativeSeparators(output_file.fileName())); |
| 130 | |
| 131 | output_file.writecxx . . $ QIODevice#write(4ee2750a0be83987).(file_contents); |
| 132 | output_file.flushcxx . . $ QFileDevice#flush(c9857a73d68e59ba).(); |
| 133 | output_file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 134 | |
| 135 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Update file contents was successfuly saved."; |
| 136 | |
| 137 | m_updateFilePathcxx . . $ FormUpdate#m_updateFilePath. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). output_file.fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).(); |
| 138 | m_readyToInstallcxx . . $ FormUpdate#m_readyToInstall. = true; |
| 139 | } |
| 140 | else { |
| 141 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Cannot save downloaded update file because target temporary file '" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). output_file_name |
| 142 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "' cannot be opened for writing."; |
| 143 | } |
| 144 | } |
| 145 | else { |
| 146 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Cannot save downloaded update file because no TEMP directory is available."; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | void FormUpdatecxx . . $ FormUpdate#::loadAvailableFilescxx . . $ FormUpdate#loadAvailableFiles(49f6e7a06ebc5aa8).() { |
| 151 | m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->clearcxx . . $ QListWidget#clear(49f6e7a06ebc5aa8).(); |
| 152 | |
| 153 | for (const UpdateUrlcxx . . $ UpdateUrl#& url : stdcxx . . $ std/::as_constcxx . . $ std/as_const(1dc117cbefefc300).(m_updateInfocxx . . $ FormUpdate#m_updateInfo..m_urlscxx . . $ UpdateInfo#m_urls.)) { |
| 154 | if (SystemFactorycxx . . $ SystemFactory#::supportedUpdateFilescxx . . $ SystemFactory#supportedUpdateFiles(665c0c77e8c56958).().matchcxx . . $ QRegularExpression#match(d076266091fa4922).(url.m_namecxx . . $ UpdateUrl#m_name.).hasMatchcxx . . $ QRegularExpressionMatch#hasMatch(50ce9a9e25b4a850).()) { |
| 155 | QListWidgetItemcxx . . $ QListWidgetItem#* item = new QListWidgetItemcxx . . $ QListWidgetItem#(url.m_namecxx . . $ UpdateUrl#m_name. + trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).(" (size ") + url.m_sizecxx . . $ UpdateUrl#m_size. + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(")")); |
| 156 | |
| 157 | item->setDatacxx . . $ QListWidgetItem#setData(e71f85060bf8a055).(Qtcxx . . $ Qt/::ItemDataRolecxx . . $ Qt/ItemDataRole#::UserRolecxx . . $ Qt/UserRole., urlcxx . . $ QVariant#QVariant(132dd6869045752b)..m_fileUrlcxx . . $ UpdateUrl#m_fileUrl.); |
| 158 | item->setToolTipcxx . . $ QListWidgetItem#setToolTip(3520e46b33348bf6).(url.m_fileUrlcxx . . $ UpdateUrl#m_fileUrl.); |
| 159 | m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->addItemcxx . . $ QListWidget#addItem(13c1c8ad030616f4).(item); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->countcxx . . $ QListWidget#count(455f465bc33b4cdf).() > 0) { |
| 164 | m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->setCurrentRowcxx . . $ QListWidget#setCurrentRow(d4f767463ce0a6b3).(0); |
| 165 | } |
| 166 | else { |
| 167 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 168 | } |
| 169 | |
| 170 | m_uicxx . . $ FormUpdate#m_ui..m_tabInfocxx . . $ Ui_FormUpdate#m_tabInfo.->addTabcxx . . $ QTabWidget#addTab(308397e7339ec173).(m_uicxx . . $ FormUpdate#m_ui..tabFilescxx . . $ Ui_FormUpdate#tabFiles., trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Available update files")); |
| 171 | m_uicxx . . $ FormUpdate#m_ui..m_tabInfocxx . . $ Ui_FormUpdate#m_tabInfo.->setCurrentIndexcxx . . $ QTabWidget#setCurrentIndex(d4f767463ce0a6b3).(1); |
| 172 | } |
| 173 | |
| 174 | void FormUpdatecxx . . $ FormUpdate#::updateCompletedcxx . . $ FormUpdate#updateCompleted(377b816ef29857eb).(const QUrlcxx . . $ QUrl#& url, |
| 175 | QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# status, |
| 176 | int http_code, |
| 177 | const QByteArraycxx . . $ QByteArray#& contents) { |
| 178 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(url) |
| 179 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(http_code) |
| 180 | |
| 181 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Download of application update file was completed with code" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(status); |
| 182 | |
| 183 | switch (status) { |
| 184 | case QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.: |
| 185 | saveUpdateFilecxx . . $ FormUpdate#saveUpdateFile(45672f3c6961a244).(contents); |
| 186 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Okcxx . . $ WidgetWithStatus#StatusType#Ok., |
| 187 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Downloaded successfully"), |
| 188 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Package was downloaded successfully.\nYou can install it now.")); |
| 189 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Install")); |
| 190 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 191 | break; |
| 192 | |
| 193 | default: |
| 194 | m_uicxx . . $ FormUpdate#m_ui..m_lblStatuscxx . . $ Ui_FormUpdate#m_lblStatus.->setStatuscxx . . $ LabelWithStatus#setStatus(810dc34ace2b0f32).(WidgetWithStatuscxx . . $ WidgetWithStatus#::StatusTypecxx . . $ WidgetWithStatus#StatusType#::Errorcxx . . $ WidgetWithStatus#StatusType#Error., |
| 195 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Error occured"), |
| 196 | trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Error occured during downloading of the package.")); |
| 197 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Error occured")); |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void FormUpdatecxx . . $ FormUpdate#::startUpdatecxx . . $ FormUpdate#startUpdate(49f6e7a06ebc5aa8).() { |
| 203 | QStringcxx . . $ QString# url_filecxx . . $ QString#QString(ced63f7c635d850d).; |
| 204 | const bool update_for_this_system = isSelfUpdateSupportedcxx . . $ FormUpdate#isSelfUpdateSupported(50ce9a9e25b4a850).(); |
| 205 | |
| 206 | if (update_for_this_system && m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->currentItemcxx . . $ QListWidget#currentItem(a843e491ce3ee2b1).() != nullptr) { |
| 207 | url_file =cxx . . $ QString#`operator=`(4f35bf974e7f8568). m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->currentItemcxx . . $ QListWidget#currentItem(a843e491ce3ee2b1).()->datacxx . . $ QListWidgetItem#data(fb36142a814bbf95).(Qtcxx . . $ Qt/::UserRolecxx . . $ Qt/UserRole.).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 208 | m_uicxx . . $ FormUpdate#m_ui..m_listFilescxx . . $ Ui_FormUpdate#m_listFiles.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 209 | } |
| 210 | else { |
| 211 | url_file =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(APP_URLcxx . . $ `<built-in>:492:9`!); |
| 212 | } |
| 213 | |
| 214 | if (m_readyToInstallcxx . . $ FormUpdate#m_readyToInstall.) { |
| 215 | closecxx . . $ QWidget#close(c9857a73d68e59ba).(); |
| 216 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_GUIcxx . . $ `src/librssguard/definitions/definitions.h:174:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Preparing to launch external installer '" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). QDircxx . . $ QDir#::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(m_updateFilePathcxx . . $ FormUpdate#m_updateFilePath.) |
| 217 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "'."; |
| 218 | |
| 219 | #if defined(Q_OS_WIN) |
| 220 | HINSTANCE exec_result = |
| 221 | ShellExecute(nullptr, |
| 222 | nullptr, |
| 223 | reinterpret_cast<const WCHAR*>(QDir::toNativeSeparators(m_updateFilePath).utf16()), |
| 224 | nullptr, |
| 225 | nullptr, |
| 226 | SW_NORMAL); |
| 227 | |
| 228 | if (exec_result <= HINSTANCE(32)) { |
| 229 | qDebugNN << LOGSEC_GUI << "External updater was not launched due to error."; |
| 230 | qApp->showGuiMessage(Notification::Event::GeneralEvent, |
| 231 | {tr("Cannot update application"), |
| 232 | tr("Cannot launch external updater. Update application manually."), |
| 233 | QSystemTrayIcon::MessageIcon::Warning}, |
| 234 | {}, |
| 235 | {}, |
| 236 | this); |
| 237 | } |
| 238 | else { |
| 239 | qApp->quit(); |
| 240 | } |
| 241 | #endif |
| 242 | } |
| 243 | else if (update_for_this_system) { |
| 244 | updateProgresscxx . . $ FormUpdate#updateProgress(8be204668a5c1685).(0, 100); |
| 245 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(trcxx . . $ FormUpdate#tr(75d9f1c324b4579d).("Downloading update...")); |
| 246 | m_btnUpdatecxx . . $ FormUpdate#m_btnUpdate.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 247 | m_downloadercxx . . $ FormUpdate#m_downloader..downloadFilecxx . . $ Downloader#downloadFile(59dca4567f557537).(url_file); |
| 248 | } |
| 249 | else { |
| 250 | // Self-update and package are not available. |
| 251 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->openUrlInExternalBrowsercxx . . $ WebFactory#openUrlInExternalBrowser(dd54f9efb9153ea5).(url_filecxx . . $ QUrl#QUrl(ea1f3831e370f1cb).); |
| 252 | } |
| 253 | } |