| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/downloadmanager.cpp`/ |
| 2 | |
| 3 | #include "network-web/downloadmanager.h"cxx . . $ `<file>/src/librssguard/network-web/downloadmanager.h`/ |
| 4 | |
| 5 | #include "gui/dialogs/filedialog.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/filedialog.h`/ |
| 6 | #include "gui/dialogs/formmain.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formmain.h`/ |
| 7 | #include "gui/messagebox.h"cxx . . $ `<file>/src/librssguard/gui/messagebox.h`/ |
| 8 | #include "gui/tabwidget.h"cxx . . $ `<file>/src/librssguard/gui/tabwidget.h`/ |
| 9 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 10 | #include "miscellaneous/autosaver.h"cxx . . $ `<file>/src/librssguard/miscellaneous/autosaver.h`/ |
| 11 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 12 | #include "network-web/silentnetworkaccessmanager.h"cxx . . $ `<file>/src/librssguard/network-web/silentnetworkaccessmanager.h`/ |
| 13 | |
| 14 | #include "ui_downloaditem.h"cxx . . $ `<file>/build/src/librssguard/ui_downloaditem.h`/ |
| 15 | #include "ui_downloadmanager.h"cxx . . $ `<file>/build/src/librssguard/ui_downloadmanager.h`/ |
| 16 | |
| 17 | #include <cmath> |
| 18 | |
| 19 | #include <QDebug> |
| 20 | #include <QDesktopServices> |
| 21 | #include <QFileIconProvider> |
| 22 | #include <QHeaderView> |
| 23 | #include <QMessageBox> |
| 24 | #include <QMetaEnum> |
| 25 | #include <QMetaObject> |
| 26 | #include <QMimeData> |
| 27 | #include <QSettings> |
| 28 | |
| 29 | DownloadItemcxx . . $ DownloadItem#::DownloadItemcxx . . $ DownloadItem#DownloadItem(576202a375d04f7d).(QNetworkReplycxx . . $ QNetworkReply#* reply, |
| 30 | const QStringcxx . . $ QString#& preferred_file_name, |
| 31 | const stdcxx . . $ std/::functioncxx . . $ std/function#<void(DownloadItemcxx . . $ DownloadItem#*)>& run_on_finish, |
| 32 | QWidgetcxx . . $ QWidget#* parent) |
| 33 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), m_uicxx . . $ DownloadItem#m_ui.(new Uicxx . . $ Ui/::DownloadItemcxx . . $ Ui/DownloadItem#), m_replycxx . . $ DownloadItem#m_reply.(reply), m_preferredFileNamecxx . . $ DownloadItem#m_preferredFileName.(preferred_file_name), |
| 34 | m_runOnFinishcxx . . $ DownloadItem#m_runOnFinish.(run_on_finish), m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived.(0), m_requestFileNamecxx . . $ DownloadItem#m_requestFileName.(false), m_startedSavingcxx . . $ DownloadItem#m_startedSaving.(false), |
| 35 | m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading.(false), m_gettingFileNamecxx . . $ DownloadItem#m_gettingFileName.(false), m_canceledFileSelectcxx . . $ DownloadItem#m_canceledFileSelect.(false) { |
| 36 | m_uicxx . . $ DownloadItem#m_ui.->setupUicxx . . $ Ui_DownloadItem#setupUi(108f35f7aa7f3cf9).(this); |
| 37 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 38 | m_requestFileNamecxx . . $ DownloadItem#m_requestFileName. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Downloads::AlwaysPromptForFilename)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 39 | |
| 40 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("view-refresh"))); |
| 41 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFilecxx . . $ Ui_DownloadItem#m_btnOpenFile.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("document-open"))); |
| 42 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFoldercxx . . $ Ui_DownloadItem#m_btnOpenFolder.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("folder"))); |
| 43 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("process-stop"))); |
| 44 | |
| 45 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &DownloadItemcxx . . $ DownloadItem#::stopcxx . . $ DownloadItem#stop(49f6e7a06ebc5aa8).); |
| 46 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFilecxx . . $ Ui_DownloadItem#m_btnOpenFile., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &DownloadItemcxx . . $ DownloadItem#::openFilecxx . . $ DownloadItem#openFile(49f6e7a06ebc5aa8).); |
| 47 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &DownloadItemcxx . . $ DownloadItem#::tryAgaincxx . . $ DownloadItem#tryAgain(49f6e7a06ebc5aa8).); |
| 48 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFoldercxx . . $ Ui_DownloadItem#m_btnOpenFolder., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &DownloadItemcxx . . $ DownloadItem#::openFoldercxx . . $ DownloadItem#openFolder(49f6e7a06ebc5aa8).); |
| 49 | |
| 50 | initcxx . . $ DownloadItem#init(49f6e7a06ebc5aa8).(); |
| 51 | } |
| 52 | |
| 53 | DownloadItemcxx . . $ DownloadItem#::~cxx . . $ DownloadItem#`~DownloadItem`(ced63f7c635d850d).DownloadItemcxx . . $ DownloadItem#() { |
| 54 | delete m_uicxx . . $ DownloadItem#m_ui.; |
| 55 | } |
| 56 | |
| 57 | void DownloadItemcxx . . $ DownloadItem#::initcxx . . $ DownloadItem#init(49f6e7a06ebc5aa8).() { |
| 58 | if (m_replycxx . . $ DownloadItem#m_reply. == nullptr) { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | m_startedSavingcxx . . $ DownloadItem#m_startedSaving. = false; |
| 63 | m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading. = false; |
| 64 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFilecxx . . $ Ui_DownloadItem#m_btnOpenFile.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 65 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFoldercxx . . $ Ui_DownloadItem#m_btnOpenFolder.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 66 | m_urlcxx . . $ DownloadItem#m_url. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). m_replycxx . . $ DownloadItem#m_reply.->urlcxx . . $ QNetworkReply#url(36d9834fe7321282).(); |
| 67 | m_replycxx . . $ DownloadItem#m_reply.->setParentcxx . . $ QObject#setParent(749de1b6ae65bddd).(this); |
| 68 | |
| 69 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_replycxx . . $ DownloadItem#m_reply., &QNetworkReplycxx . . $ QNetworkReply#::readyReadcxx . . $ QIODevice#readyRead(49f6e7a06ebc5aa8)., this, &DownloadItemcxx . . $ DownloadItem#::downloadReadyReadcxx . . $ DownloadItem#downloadReadyRead(49f6e7a06ebc5aa8).); |
| 70 | |
| 71 | #if QT_VERSIONcxx . . $ `<external>/3898848398875472725/qtversionchecks.h:17:9`! >= 0x050F00 // Qt >= 5.15.0 |
| 72 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_replycxx . . $ DownloadItem#m_reply., &QNetworkReplycxx . . $ QNetworkReply#::errorOccurredcxx . . $ QNetworkReply#errorOccurred(5272ddc769b2e651)., this, &DownloadItemcxx . . $ DownloadItem#::errorcxx . . $ DownloadItem#error(5272ddc769b2e651).); |
| 73 | #else |
| 74 | connect(m_reply, |
| 75 | static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), |
| 76 | this, |
| 77 | &DownloadItem::error); |
| 78 | #endif |
| 79 | |
| 80 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_replycxx . . $ DownloadItem#m_reply., &QNetworkReplycxx . . $ QNetworkReply#::downloadProgresscxx . . $ QNetworkReply#downloadProgress(8be204668a5c1685)., this, &DownloadItemcxx . . $ DownloadItem#::downloadProgresscxx . . $ DownloadItem#downloadProgress(8be204668a5c1685).); |
| 81 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_replycxx . . $ DownloadItem#m_reply., &QNetworkReplycxx . . $ QNetworkReply#::metaDataChangedcxx . . $ QNetworkReply#metaDataChanged(49f6e7a06ebc5aa8)., this, &DownloadItemcxx . . $ DownloadItem#::metaDataChangedcxx . . $ DownloadItem#metaDataChanged(49f6e7a06ebc5aa8).); |
| 82 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_replycxx . . $ DownloadItem#m_reply., &QNetworkReplycxx . . $ QNetworkReply#::finishedcxx . . $ QNetworkReply#finished(49f6e7a06ebc5aa8)., this, &DownloadItemcxx . . $ DownloadItem#::finishedcxx . . $ DownloadItem#finished(49f6e7a06ebc5aa8).); |
| 83 | |
| 84 | // Reset info. |
| 85 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->clearcxx . . $ QLabel#clear(49f6e7a06ebc5aa8).(); |
| 86 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setValuecxx . . $ QProgressBar#setValue(d4f767463ce0a6b3).(0); |
| 87 | getFileNamecxx . . $ DownloadItem#getFileName(49f6e7a06ebc5aa8).(); |
| 88 | |
| 89 | // Start timer for the download estimation. |
| 90 | m_downloadTimecxx . . $ DownloadItem#m_downloadTime..startcxx . . $ QElapsedTimer#start(ced63f7c635d850d).(); |
| 91 | |
| 92 | if (m_replycxx . . $ DownloadItem#m_reply.->errorcxx . . $ QNetworkReply#error(c916dcceceba1ae7).() != QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 93 | errorcxx . . $ DownloadItem#error(5272ddc769b2e651).(m_replycxx . . $ DownloadItem#m_reply.->errorcxx . . $ QNetworkReply#error(c916dcceceba1ae7).()); |
| 94 | finishedcxx . . $ DownloadItem#finished(49f6e7a06ebc5aa8).(); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | void DownloadItemcxx . . $ DownloadItem#::getFileNamecxx . . $ DownloadItem#getFileName(49f6e7a06ebc5aa8).() { |
| 99 | if (m_gettingFileNamecxx . . $ DownloadItem#m_gettingFileName.) { |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | const QStringcxx . . $ QString# download_directory = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->downloadManagercxx . . $ Application#downloadManager(456f9618ee541670).()->downloadDirectorycxx . . $ DownloadManager#downloadDirectory(4365c3963150523e).(); |
| 104 | QStringcxx . . $ QString# chosen_filename = saveFileNamecxx . . $ DownloadItem#saveFileName(5555d9024dcf93fb).(download_directory); |
| 105 | const QStringcxx . . $ QString# filename_for_prompt = |
| 106 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Downloads::TargetExplicitDirectory)).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).() +cxx . . $ operator+(adfbdceb504720ce). |
| 107 | QDircxx . . $ QDir#::separatorcxx . . $ QDir#separator(44eb9225326fcbf5).() +cxx . . $ operator+(adfbdceb504720ce). QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(chosen_filename).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).(); |
| 108 | |
| 109 | if (m_requestFileNamecxx . . $ DownloadItem#m_requestFileName.) { |
| 110 | // User must provide the path where he wants to save downloaded file in. |
| 111 | m_gettingFileNamecxx . . $ DownloadItem#m_gettingFileName. = true; |
| 112 | chosen_filename =cxx . . $ QString#`operator=`(4f35bf974e7f8568). FileDialogcxx . . $ FileDialog#::saveFileNamecxx . . $ FileDialog#saveFileName(7deab5c64a7710be).(this, |
| 113 | trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Select destination for downloaded file"), |
| 114 | filename_for_prompt, |
| 115 | QStringcxx . . $ QString#QString(ced63f7c635d850d).(), |
| 116 | nullptr); |
| 117 | m_gettingFileNamecxx . . $ DownloadItem#m_gettingFileName. = false; |
| 118 | |
| 119 | if (chosen_filename.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 120 | stopcxx . . $ DownloadItem#stop(49f6e7a06ebc5aa8).(); |
| 121 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 122 | m_uicxx . . $ DownloadItem#m_ui.->m_lblLocalFilenamecxx . . $ Ui_DownloadItem#m_lblLocalFilename.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Selection of local file cancelled.")); |
| 123 | m_canceledFileSelectcxx . . $ DownloadItem#m_canceledFileSelect. = true; |
| 124 | return; |
| 125 | } |
| 126 | |
| 127 | const QFileInfocxx . . $ QFileInfo# file_info = QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(chosen_filename); |
| 128 | |
| 129 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), |
| 130 | Downloadscxx . . $ Downloads/::TargetExplicitDirectorycxx . . $ Downloads/TargetExplicitDirectory., |
| 131 | QDircxx . . $ QVariant#QVariant(132dd6869045752b).::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(chosen_filename).absolutePathcxx . . $ QFileInfo#absolutePath(6ef7b6c27b00b43d).())); |
| 132 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->downloadManagercxx . . $ Application#downloadManager(456f9618ee541670).()->setDownloadDirectorycxx . . $ DownloadManager#setDownloadDirectory(3520e46b33348bf6).(file_info.absoluteDircxx . . $ QFileInfo#absoluteDir(ac6552cf9b6b4ed1).().absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).()); |
| 133 | } |
| 134 | |
| 135 | m_outputcxx . . $ DownloadItem#m_output..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(chosen_filename); |
| 136 | |
| 137 | // Check file path for saving. |
| 138 | const QDircxx . . $ QDir# save_dir = QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).()).dircxx . . $ QFileInfo#dir(ac6552cf9b6b4ed1).(); |
| 139 | |
| 140 | if (!save_dir.existscxx . . $ QDir#exists(50ce9a9e25b4a850).() && !save_dir.mkpathcxx . . $ QDir#mkpath(48f7a61be61bdeff).(save_dir.absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).())) { |
| 141 | stopcxx . . $ DownloadItem#stop(49f6e7a06ebc5aa8).(); |
| 142 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 143 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Download directory couldn't be created")); |
| 144 | return; |
| 145 | } |
| 146 | |
| 147 | updateInfoAndUrlLabelcxx . . $ DownloadItem#updateInfoAndUrlLabel(49f6e7a06ebc5aa8).(); |
| 148 | |
| 149 | if (m_requestFileNamecxx . . $ DownloadItem#m_requestFileName.) { |
| 150 | downloadReadyReadcxx . . $ DownloadItem#downloadReadyRead(49f6e7a06ebc5aa8).(); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | QStringcxx . . $ QString# DownloadItemcxx . . $ DownloadItem#::saveFileNamecxx . . $ DownloadItem#saveFileName(5555d9024dcf93fb).(const QStringcxx . . $ QString#& directory) const { |
| 155 | QStringcxx . . $ QString# pathcxx . . $ QString#QString(ced63f7c635d850d).; |
| 156 | |
| 157 | if (m_replycxx . . $ DownloadItem#m_reply.->hasRawHeadercxx . . $ QNetworkReply#hasRawHeader(38e0d8b294f97fcd).("Content-Disposition"cxx . . $ QAnyStringView#QAnyStringView(80d8335016fb1bdc).)) { |
| 158 | QStringcxx . . $ QString# value = QLatin1Stringcxx . . $ QString#QString(4641beeb24e75d60).(m_replycxx . . $ DownloadItem#m_reply.->rawHeadercxx . . $ QNetworkReply#rawHeader(b41e5df66146ff48).("Content-Disposition"cxx . . $ QAnyStringView#QAnyStringView(80d8335016fb1bdc).)); |
| 159 | QRegularExpressioncxx . . $ QRegularExpression# expcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(".*filename\\s*=\\s*\"?([^\"]+)\"?")); |
| 160 | QRegularExpressionMatchcxx . . $ QRegularExpressionMatch# match = exp.matchcxx . . $ QRegularExpression#match(d076266091fa4922).(value); |
| 161 | |
| 162 | if (match.isValidcxx . . $ QRegularExpressionMatch#isValid(50ce9a9e25b4a850).()) { |
| 163 | QStringcxx . . $ QString# name = match.capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 164 | |
| 165 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QUrlcxx . . $ QUrl#::fromPercentEncodingcxx . . $ QUrl#fromPercentEncoding(4e15edac36d215be).(name.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).()); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | if (!m_preferredFileNamecxx . . $ DownloadItem#m_preferredFileName..isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 170 | path =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). m_preferredFileNamecxx . . $ DownloadItem#m_preferredFileName.; |
| 171 | } |
| 172 | else if (path.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 173 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). m_urlcxx . . $ DownloadItem#m_url..pathcxx . . $ QUrl#path(9d7420bec8bfe6c9).(); |
| 174 | } |
| 175 | |
| 176 | const QFileInfocxx . . $ QFileInfo# infocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(path); |
| 177 | QStringcxx . . $ QString# base_name = info.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).(); |
| 178 | QStringcxx . . $ QString# end_name = info.suffixcxx . . $ QFileInfo#suffix(6ef7b6c27b00b43d).(); |
| 179 | |
| 180 | static QRegularExpressioncxx . . $ QRegularExpression# regcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("\\/|<|\\?")); |
| 181 | |
| 182 | if (base_name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).() || base_name.containscxx . . $ QString#contains(7f58d9c5cd237edb).(reg)) { |
| 183 | base_name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("unnamed_download"); |
| 184 | } |
| 185 | |
| 186 | if (!end_name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 187 | end_name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!('.') +cxx . . $ operator+(adfbdceb504720ce). end_name; |
| 188 | } |
| 189 | |
| 190 | QStringcxx . . $ QString# name = directory +cxx . . $ operator+(adfbdceb504720ce). base_name +cxx . . $ operator+(adfbdceb504720ce). end_name; |
| 191 | |
| 192 | if (!m_requestFileNamecxx . . $ DownloadItem#m_requestFileName. && QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(name)) { |
| 193 | int i = 1; |
| 194 | |
| 195 | do { |
| 196 | name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). directory +cxx . . $ operator+(adfbdceb504720ce). base_name +cxx . . $ operator+(adfbdceb504720ce). QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!('-') +cxx . . $ operator+(adfbdceb504720ce). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(i++) +cxx . . $ operator+(adfbdceb504720ce). end_name; |
| 197 | } |
| 198 | while (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(name)); |
| 199 | } |
| 200 | |
| 201 | return namecxx . . $ QString#QString(28715ad661ad3cec).; |
| 202 | } |
| 203 | |
| 204 | const QFilecxx . . $ QFile#& DownloadItemcxx . . $ DownloadItem#::outputcxx . . $ DownloadItem#output(32503c22158a31ab).() const { |
| 205 | return m_outputcxx . . $ DownloadItem#m_output.; |
| 206 | } |
| 207 | |
| 208 | void DownloadItemcxx . . $ DownloadItem#::stopcxx . . $ DownloadItem#stop(49f6e7a06ebc5aa8).() { |
| 209 | setUpdatesEnabledcxx . . $ QWidget#setUpdatesEnabled(b45ddcbc8423892c).(false); |
| 210 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 211 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 212 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 213 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); |
| 214 | setUpdatesEnabledcxx . . $ QWidget#setUpdatesEnabled(b45ddcbc8423892c).(true); |
| 215 | m_replycxx . . $ DownloadItem#m_reply.->abortcxx . . $ QNetworkReply#abort(49f6e7a06ebc5aa8).(); |
| 216 | |
| 217 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadFinishedcxx . . $ DownloadItem#downloadFinished(49f6e7a06ebc5aa8).(); |
| 218 | } |
| 219 | |
| 220 | void DownloadItemcxx . . $ DownloadItem#::openFilecxx . . $ DownloadItem#openFile(49f6e7a06ebc5aa8).() { |
| 221 | if (!QDesktopServicescxx . . $ QDesktopServices#::openUrlcxx . . $ QDesktopServices#openUrl(3c1e6c2c1d0bcefc).(QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).(m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).()))) { |
| 222 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->showGuiMessagecxx . . $ Application#showGuiMessage(cf433640a87c3b52).(Notificationcxx . . $ Notification#::Eventcxx . . $ Notification#Event#::GeneralEventcxx . . $ Notification#Event#GeneralEvent., |
| 223 | {cxx . . $ GuiMessage#GuiMessage(b833bfd374dccacd).trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Cannot open file"), |
| 224 | trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Cannot open output file. Open it manually."), |
| 225 | QSystemTrayIconcxx . . $ QSystemTrayIcon#::MessageIconcxx . . $ QSystemTrayIcon#MessageIcon#::Warningcxx . . $ QSystemTrayIcon#Warning.}); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | void DownloadItemcxx . . $ DownloadItem#::openFoldercxx . . $ DownloadItem#openFolder(49f6e7a06ebc5aa8).() { |
| 230 | if (m_outputcxx . . $ DownloadItem#m_output..existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) { |
| 231 | if (!SystemFactorycxx . . $ SystemFactory#::openFolderFilecxx . . $ SystemFactory#openFolderFile(e1defb592416720d).(m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).())) { |
| 232 | MsgBoxcxx . . $ MsgBox#::showcxx . . $ MsgBox#show(699e792c6fa2d501).(this, |
| 233 | QMessageBoxcxx . . $ QMessageBox#::Iconcxx . . $ QMessageBox#Icon#::Warningcxx . . $ QMessageBox#Warning., |
| 234 | trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Cannot open directory"), |
| 235 | trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Cannot open output directory. Open it manually."), |
| 236 | QStringcxx . . $ QString#QString(ced63f7c635d850d).(), |
| 237 | m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).()); |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | void DownloadItemcxx . . $ DownloadItem#::tryAgaincxx . . $ DownloadItem#tryAgain(49f6e7a06ebc5aa8).() { |
| 243 | if (!m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).()) { |
| 244 | return; |
| 245 | } |
| 246 | |
| 247 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 248 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 249 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 250 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(true); |
| 251 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(true); |
| 252 | QNetworkReplycxx . . $ QNetworkReply#* new_download = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->downloadManagercxx . . $ Application#downloadManager(456f9618ee541670).()->networkManagercxx . . $ DownloadManager#networkManager(7f01183d3c0901fa).()->getcxx . . $ QNetworkAccessManager#get(d12587da35e4fcd1).(QNetworkRequestcxx . . $ QNetworkRequest#(m_urlcxx . . $ DownloadItem#m_url.)); |
| 253 | |
| 254 | if (m_replycxx . . $ DownloadItem#m_reply. != nullptr) { |
| 255 | m_replycxx . . $ DownloadItem#m_reply.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 256 | } |
| 257 | |
| 258 | if (m_outputcxx . . $ DownloadItem#m_output..existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) { |
| 259 | m_outputcxx . . $ DownloadItem#m_output..removecxx . . $ QFile#remove(c9857a73d68e59ba).(); |
| 260 | } |
| 261 | |
| 262 | m_replycxx . . $ DownloadItem#m_reply. = new_download; |
| 263 | initcxx . . $ DownloadItem#init(49f6e7a06ebc5aa8).(); |
| 264 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ DownloadItem#statusChanged(49f6e7a06ebc5aa8).(); |
| 265 | } |
| 266 | |
| 267 | void DownloadItemcxx . . $ DownloadItem#::downloadReadyReadcxx . . $ DownloadItem#downloadReadyRead(49f6e7a06ebc5aa8).() { |
| 268 | if (m_requestFileNamecxx . . $ DownloadItem#m_requestFileName. && m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 269 | return; |
| 270 | } |
| 271 | |
| 272 | if (!m_outputcxx . . $ DownloadItem#m_output..isOpencxx . . $ QIODevice#isOpen(50ce9a9e25b4a850).()) { |
| 273 | if (!m_requestFileNamecxx . . $ DownloadItem#m_requestFileName.) { |
| 274 | getFileNamecxx . . $ DownloadItem#getFileName(49f6e7a06ebc5aa8).(); |
| 275 | } |
| 276 | |
| 277 | if (!m_outputcxx . . $ DownloadItem#m_output..opencxx . . $ QFile#open(da34f43c1eae080c).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::WriteOnlycxx . . $ QIODeviceBase#WriteOnly.)) { |
| 278 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Error opening output file: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(m_outputcxx . . $ DownloadItem#m_output..errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 279 | stopcxx . . $ DownloadItem#stop(49f6e7a06ebc5aa8).(); |
| 280 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ DownloadItem#statusChanged(49f6e7a06ebc5aa8).(); |
| 281 | |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ DownloadItem#statusChanged(49f6e7a06ebc5aa8).(); |
| 286 | } |
| 287 | |
| 288 | if (-1 == m_outputcxx . . $ DownloadItem#m_output..writecxx . . $ QIODevice#write(4ee2750a0be83987).(m_replycxx . . $ DownloadItem#m_reply.->readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).())) { |
| 289 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Error when saving file: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(m_outputcxx . . $ DownloadItem#m_output..errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 290 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->clickcxx . . $ QAbstractButton#click(49f6e7a06ebc5aa8).(); |
| 291 | } |
| 292 | else { |
| 293 | m_startedSavingcxx . . $ DownloadItem#m_startedSaving. = true; |
| 294 | |
| 295 | if (m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading.) { |
| 296 | finishedcxx . . $ DownloadItem#finished(49f6e7a06ebc5aa8).(); |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | void DownloadItemcxx . . $ DownloadItem#::errorcxx . . $ DownloadItem#error(5272ddc769b2e651).(QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# code) { |
| 302 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(code) |
| 303 | |
| 304 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Error: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(m_replycxx . . $ DownloadItem#m_reply.->errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).())); |
| 305 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 306 | m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(true); |
| 307 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadFinishedcxx . . $ DownloadItem#downloadFinished(49f6e7a06ebc5aa8).(); |
| 308 | } |
| 309 | |
| 310 | void DownloadItemcxx . . $ DownloadItem#::metaDataChangedcxx . . $ DownloadItem#metaDataChanged(49f6e7a06ebc5aa8).() { |
| 311 | QVariantcxx . . $ QVariant# locationHeader = m_replycxx . . $ DownloadItem#m_reply.->headercxx . . $ QNetworkReply#header(e61ac600faea07c3).(QNetworkRequestcxx . . $ QNetworkRequest#::KnownHeaderscxx . . $ QNetworkRequest#KnownHeaders#::LocationHeadercxx . . $ QNetworkRequest#LocationHeader.); |
| 312 | |
| 313 | if (locationHeader.isValidcxx . . $ QVariant#isValid(50ce9a9e25b4a850).()) { |
| 314 | m_urlcxx . . $ DownloadItem#m_url. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). locationHeader.toUrlcxx . . $ QVariant#toUrl(36d9834fe7321282).(); |
| 315 | m_replycxx . . $ DownloadItem#m_reply.->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 316 | m_replycxx . . $ DownloadItem#m_reply. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->downloadManagercxx . . $ Application#downloadManager(456f9618ee541670).()->networkManagercxx . . $ DownloadManager#networkManager(7f01183d3c0901fa).()->getcxx . . $ QNetworkAccessManager#get(d12587da35e4fcd1).(QNetworkRequestcxx . . $ QNetworkRequest#(m_urlcxx . . $ DownloadItem#m_url.)); |
| 317 | initcxx . . $ DownloadItem#init(49f6e7a06ebc5aa8).(); |
| 318 | return; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | void DownloadItemcxx . . $ DownloadItem#::downloadProgresscxx . . $ DownloadItem#downloadProgress(8be204668a5c1685).(qint64cxx . . $ qint64# bytes_received, qint64cxx . . $ qint64# bytes_total) { |
| 323 | QTimecxx . . $ QTime# now = QTimecxx . . $ QTime#::currentTimecxx . . $ QTime#currentTime(bd2fc2b92108c576).(); |
| 324 | |
| 325 | if (m_lastProgressTimecxx . . $ DownloadItem#m_lastProgressTime..isValidcxx . . $ QTime#isValid(50ce9a9e25b4a850).() && m_lastProgressTimecxx . . $ DownloadItem#m_lastProgressTime..msecsTocxx . . $ QTime#msecsTo(15b6bb977d4fe1e8).(now) < 25) { |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | m_lastProgressTimecxx . . $ DownloadItem#m_lastProgressTime. =cxx . . $ QTime#`operator=`(283c2b3277289151). now; |
| 330 | m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived. = bytes_received; |
| 331 | qint64cxx . . $ qint64# currentValue = 0; |
| 332 | qint64cxx . . $ qint64# totalValue = 0; |
| 333 | |
| 334 | if (bytes_total > 0) { |
| 335 | currentValue = bytes_received * 100 / bytes_total; |
| 336 | totalValue = 100; |
| 337 | } |
| 338 | |
| 339 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setValuecxx . . $ QProgressBar#setValue(d4f767463ce0a6b3).(currentValue); |
| 340 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setMaximumcxx . . $ QProgressBar#setMaximum(d4f767463ce0a6b3).(totalValue); |
| 341 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! progresscxx . . $ DownloadItem#progress(8be204668a5c1685).(currentValue, totalValue); |
| 342 | |
| 343 | updateDownloadInfoLabelcxx . . $ DownloadItem#updateDownloadInfoLabel(49f6e7a06ebc5aa8).(); |
| 344 | } |
| 345 | |
| 346 | qint64cxx . . $ qint64# DownloadItemcxx . . $ DownloadItem#::bytesTotalcxx . . $ DownloadItem#bytesTotal(98833e9ab7de59a4).() const { |
| 347 | return m_replycxx . . $ DownloadItem#m_reply. == nullptr ? 0 : m_replycxx . . $ DownloadItem#m_reply.->headercxx . . $ QNetworkReply#header(e61ac600faea07c3).(QNetworkRequestcxx . . $ QNetworkRequest#::ContentLengthHeadercxx . . $ QNetworkRequest#ContentLengthHeader.).toULongLongcxx . . $ QVariant#toULongLong(5821a3a313f79089).(); |
| 348 | } |
| 349 | |
| 350 | qint64cxx . . $ qint64# DownloadItemcxx . . $ DownloadItem#::bytesReceivedcxx . . $ DownloadItem#bytesReceived(98833e9ab7de59a4).() const { |
| 351 | return m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived.; |
| 352 | } |
| 353 | |
| 354 | double DownloadItemcxx . . $ DownloadItem#::remainingTimecxx . . $ DownloadItem#remainingTime(21b6c25e127938e2).() const { |
| 355 | if (!downloadingcxx . . $ DownloadItem#downloading(50ce9a9e25b4a850).()) { |
| 356 | return -1.0; |
| 357 | } |
| 358 | |
| 359 | double time_remaining = ((double)(bytesTotalcxx . . $ DownloadItem#bytesTotal(98833e9ab7de59a4).() - bytesReceivedcxx . . $ DownloadItem#bytesReceived(98833e9ab7de59a4).())) / currentSpeedcxx . . $ DownloadItem#currentSpeed(21b6c25e127938e2).(); |
| 360 | |
| 361 | // When downloading the ETA should never be 0. |
| 362 | if ((int)time_remaining == 0) { |
| 363 | time_remaining = 1.0; |
| 364 | } |
| 365 | |
| 366 | return time_remaining; |
| 367 | } |
| 368 | |
| 369 | double DownloadItemcxx . . $ DownloadItem#::currentSpeedcxx . . $ DownloadItem#currentSpeed(21b6c25e127938e2).() const { |
| 370 | if (!downloadingcxx . . $ DownloadItem#downloading(50ce9a9e25b4a850).()) { |
| 371 | return -1.0; |
| 372 | } |
| 373 | else { |
| 374 | return m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived. * 1000.0 / m_downloadTimecxx . . $ DownloadItem#m_downloadTime..elapsedcxx . . $ QElapsedTimer#elapsed(6b0412d51016192f).(); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | void DownloadItemcxx . . $ DownloadItem#::updateDownloadInfoLabelcxx . . $ DownloadItem#updateDownloadInfoLabel(49f6e7a06ebc5aa8).() { |
| 379 | if (m_replycxx . . $ DownloadItem#m_reply.->errorcxx . . $ QNetworkReply#error(c916dcceceba1ae7).() != QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 380 | return; |
| 381 | } |
| 382 | |
| 383 | const qint64cxx . . $ qint64# bytes_total = m_replycxx . . $ DownloadItem#m_reply.->headercxx . . $ QNetworkReply#header(e61ac600faea07c3).(QNetworkRequestcxx . . $ QNetworkRequest#::ContentLengthHeadercxx . . $ QNetworkRequest#ContentLengthHeader.).toULongLongcxx . . $ QVariant#toULongLong(5821a3a313f79089).(); |
| 384 | bool running = !downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).(); |
| 385 | double speed = currentSpeedcxx . . $ DownloadItem#currentSpeed(21b6c25e127938e2).(); |
| 386 | double time_remaining = remainingTimecxx . . $ DownloadItem#remainingTime(21b6c25e127938e2).(); |
| 387 | QStringcxx . . $ QString# infocxx . . $ QString#QString(ced63f7c635d850d).; |
| 388 | |
| 389 | if (running) { |
| 390 | QStringcxx . . $ QString# remainingcxx . . $ QString#QString(ced63f7c635d850d).; |
| 391 | |
| 392 | if (bytes_total != 0) { |
| 393 | remaining =cxx . . $ QString#`operator=`(4f35bf974e7f8568). DownloadManagercxx . . $ DownloadManager#::timeStringcxx . . $ DownloadManager#timeString(d25daef7ecfdbcd3).(time_remaining); |
| 394 | } |
| 395 | |
| 396 | info =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("%1 of %2 (%3 per second) - %4")) |
| 397 | .argcxx . . $ QString#arg(89b093bd48b6d6c0).(DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived.), |
| 398 | bytes_total == 0 ? QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("?") : DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(bytes_total), |
| 399 | DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).((int)speed), |
| 400 | remaining); |
| 401 | } |
| 402 | else { |
| 403 | if (m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived. == bytes_total) { |
| 404 | info =cxx . . $ QString#`operator=`(4f35bf974e7f8568). DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(m_outputcxx . . $ DownloadItem#m_output..sizecxx . . $ QFile#size(98833e9ab7de59a4).()); |
| 405 | } |
| 406 | else { |
| 407 | info =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("%1 of %2 - download completed") |
| 408 | .argcxx . . $ QString#arg(89b093bd48b6d6c0).(DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived.), DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(m_bytesReceivedcxx . . $ DownloadItem#m_bytesReceived.)); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(info); |
| 413 | } |
| 414 | |
| 415 | bool DownloadItemcxx . . $ DownloadItem#::downloadingcxx . . $ DownloadItem#downloading(50ce9a9e25b4a850).() const { |
| 416 | return !m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading.; |
| 417 | |
| 418 | // return (m_ui->m_progressDownload->isVisible()); |
| 419 | } |
| 420 | |
| 421 | bool DownloadItemcxx . . $ DownloadItem#::downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).() const { |
| 422 | return (m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).() && m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).()); |
| 423 | } |
| 424 | |
| 425 | void DownloadItemcxx . . $ DownloadItem#::finishedcxx . . $ DownloadItem#finished(49f6e7a06ebc5aa8).() { |
| 426 | m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading. = true; |
| 427 | |
| 428 | if (!m_startedSavingcxx . . $ DownloadItem#m_startedSaving.) { |
| 429 | return; |
| 430 | } |
| 431 | |
| 432 | m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 433 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 434 | m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 435 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFilecxx . . $ Ui_DownloadItem#m_btnOpenFile.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 436 | m_uicxx . . $ DownloadItem#m_ui.->m_btnOpenFoldercxx . . $ Ui_DownloadItem#m_btnOpenFolder.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(true); |
| 437 | m_outputcxx . . $ DownloadItem#m_output..closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 438 | updateDownloadInfoLabelcxx . . $ DownloadItem#updateDownloadInfoLabel(49f6e7a06ebc5aa8).(); |
| 439 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ DownloadItem#statusChanged(49f6e7a06ebc5aa8).(); |
| 440 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadFinishedcxx . . $ DownloadItem#downloadFinished(49f6e7a06ebc5aa8).(); |
| 441 | |
| 442 | if (m_runOnFinishcxx . . $ DownloadItem#m_runOnFinish.) { |
| 443 | m_runOnFinishcxx . . $ DownloadItem#m_runOnFinish.(cxx . . $ std/function#`operator()`(39e0826ffb540481).this); |
| 444 | } |
| 445 | |
| 446 | if (downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).()) { |
| 447 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->showGuiMessagecxx . . $ Application#showGuiMessage(cf433640a87c3b52).(Notificationcxx . . $ Notification#::Eventcxx . . $ Notification#Event#::GeneralEventcxx . . $ Notification#Event#GeneralEvent., |
| 448 | {cxx . . $ GuiMessage#GuiMessage(b833bfd374dccacd).trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Download finished"), |
| 449 | trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("File '%1' is downloaded.\nClick here to open parent directory.") |
| 450 | .argcxx . . $ QString#arg(ad0bca07273edcc2).(QDircxx . . $ QDir#::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).())), |
| 451 | QSystemTrayIconcxx . . $ QSystemTrayIcon#::MessageIconcxx . . $ QSystemTrayIcon#MessageIcon#::Informationcxx . . $ QSystemTrayIcon#Information.}, |
| 452 | {cxx . . $ GuiMessageDestination#GuiMessageDestination(9e113dd3a0d25c95).}, |
| 453 | {cxx . . $ GuiAction#GuiAction(7d816f6132cf943f).trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Open folder"), [cxx . . $ std/function#function(bdc3712e480e4d04).this] { |
| 454 | openFoldercxx . . $ DownloadItem#openFolder(49f6e7a06ebc5aa8).(); |
| 455 | }}); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | void DownloadItemcxx . . $ DownloadItem#::updateInfoAndUrlLabelcxx . . $ DownloadItem#updateInfoAndUrlLabel(49f6e7a06ebc5aa8).() { |
| 460 | m_uicxx . . $ DownloadItem#m_ui.->m_lblRemoteFilenamecxx . . $ Ui_DownloadItem#m_lblRemoteFilename.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("URL: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(m_urlcxx . . $ DownloadItem#m_url..toStringcxx . . $ QUrl#toString(632475ebea3355f1).())); |
| 461 | m_uicxx . . $ DownloadItem#m_ui.->m_lblLocalFilenamecxx . . $ Ui_DownloadItem#m_lblLocalFilename.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ DownloadItem#tr(75d9f1c324b4579d).("Local file: %1").argcxx . . $ QString#arg(ad0bca07273edcc2).(QDircxx . . $ QDir#::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).()))); |
| 462 | } |
| 463 | |
| 464 | DownloadManagercxx . . $ DownloadManager#::DownloadManagercxx . . $ DownloadManager#DownloadManager(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 465 | : TabContentcxx . . $ TabContent#(parent), m_uicxx . . $ DownloadManager#m_ui.(new Uicxx . . $ Ui/::DownloadManagercxx . . $ Ui/DownloadManager#), m_autoSavercxx . . $ DownloadManager#m_autoSaver.(new AutoSavercxx . . $ AutoSaver#AutoSaver(dafbaae74a3bad82).(this)), |
| 466 | m_modelcxx . . $ DownloadManager#m_model.(new DownloadModelcxx . . $ DownloadModel#DownloadModel(30676a2113473e37).(this)), m_networkManagercxx . . $ DownloadManager#m_networkManager.(new SilentNetworkAccessManagercxx . . $ SilentNetworkAccessManager#SilentNetworkAccessManager(749de1b6ae65bddd).(this)), m_iconProvidercxx . . $ DownloadManager#m_iconProvider.(nullptr), |
| 467 | m_removePolicycxx . . $ DownloadManager#m_removePolicy.(RemovePolicycxx . . $ DownloadManager#RemovePolicy#::Nevercxx . . $ DownloadManager#RemovePolicy#Never.) { |
| 468 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).setupUicxx . . $ Ui_DownloadManager#setupUi(108f35f7aa7f3cf9).(this); |
| 469 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setShowGridcxx . . $ QTableView#setShowGrid(b45ddcbc8423892c).(false); |
| 470 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->verticalHeadercxx . . $ QTableView#verticalHeader(f0c0fe1a435d30ff).()->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 471 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->horizontalHeadercxx . . $ QTableView#horizontalHeader(f0c0fe1a435d30ff).()->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 472 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setAlternatingRowColorscxx . . $ QAbstractItemView#setAlternatingRowColors(b45ddcbc8423892c).(true); |
| 473 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->horizontalHeadercxx . . $ QTableView#horizontalHeader(f0c0fe1a435d30ff).()->setStretchLastSectioncxx . . $ QHeaderView#setStretchLastSection(b45ddcbc8423892c).(true); |
| 474 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setModelcxx . . $ QTableView#setModel(c6e1f1e42522b780).(m_modelcxx . . $ DownloadManager#m_model.); |
| 475 | |
| 476 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup.->setIconcxx . . $ QAbstractButton#setIcon(71dcdac178620ed6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->iconscxx . . $ Application#icons(d976db2a0d825b70).()->fromThemecxx . . $ IconFactory#fromTheme(e457fbbee8993f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("edit-clear"))); |
| 477 | |
| 478 | setDownloadDirectorycxx . . $ DownloadManager#setDownloadDirectory(3520e46b33348bf6).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Downloads::TargetDirectory)).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).()); |
| 479 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup., &QPushButtoncxx . . $ QPushButton#::clickedcxx . . $ QAbstractButton#clicked(b45ddcbc8423892c)., this, &DownloadManagercxx . . $ DownloadManager#::cleanupcxx . . $ DownloadManager#cleanup(49f6e7a06ebc5aa8).); |
| 480 | loadcxx . . $ DownloadManager#load(49f6e7a06ebc5aa8).(); |
| 481 | } |
| 482 | |
| 483 | DownloadManagercxx . . $ DownloadManager#::~cxx . . $ DownloadManager#`~DownloadManager`(ced63f7c635d850d).DownloadManagercxx . . $ DownloadManager#() { |
| 484 | m_autoSavercxx . . $ DownloadManager#m_autoSaver.->changeOccurredcxx . . $ AutoSaver#changeOccurred(49f6e7a06ebc5aa8).(); |
| 485 | m_autoSavercxx . . $ DownloadManager#m_autoSaver.->saveIfNeccessarycxx . . $ AutoSaver#saveIfNeccessary(49f6e7a06ebc5aa8).(); |
| 486 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NETWORKcxx . . $ `src/librssguard/definitions/definitions.h:168:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Destroying DownloadManager instance."; |
| 487 | } |
| 488 | |
| 489 | int DownloadManagercxx . . $ DownloadManager#::activeDownloadscxx . . $ DownloadManager#activeDownloads(455f465bc33b4cdf).() const { |
| 490 | int count = 0; |
| 491 | |
| 492 | for (const DownloadItemcxx . . $ DownloadItem#* download : m_downloadscxx . . $ DownloadManager#m_downloads.) { |
| 493 | if (download->downloadingcxx . . $ DownloadItem#downloading(50ce9a9e25b4a850).()) { |
| 494 | count++; |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | return count; |
| 499 | } |
| 500 | |
| 501 | int DownloadManagercxx . . $ DownloadManager#::downloadProgresscxx . . $ DownloadManager#downloadProgress(455f465bc33b4cdf).() const { |
| 502 | qint64cxx . . $ qint64# bytes_total = 0; |
| 503 | qint64cxx . . $ qint64# bytes_received = 0; |
| 504 | |
| 505 | for (const DownloadItemcxx . . $ DownloadItem#* download : m_downloadscxx . . $ DownloadManager#m_downloads.) { |
| 506 | if (download->downloadingcxx . . $ DownloadItem#downloading(50ce9a9e25b4a850).()) { |
| 507 | bytes_total += download->bytesTotalcxx . . $ DownloadItem#bytesTotal(98833e9ab7de59a4).(); |
| 508 | bytes_received += download->bytesReceivedcxx . . $ DownloadItem#bytesReceived(98833e9ab7de59a4).(); |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | if (bytes_total <= 0) { |
| 513 | return -1; |
| 514 | } |
| 515 | else { |
| 516 | return int((bytes_received * 100.0) / bytes_total); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | void DownloadManagercxx . . $ DownloadManager#::downloadcxx . . $ DownloadManager#download(fd95f041e4857ee1).(const QNetworkRequestcxx . . $ QNetworkRequest#& request, |
| 521 | const QStringcxx . . $ QString#& preferred_file_name, |
| 522 | const stdcxx . . $ std/::functioncxx . . $ std/function#<void(DownloadItemcxx . . $ DownloadItem#*)>& run_on_finish) { |
| 523 | if (!request.urlcxx . . $ QNetworkRequest#url(36d9834fe7321282).().isEmptycxx . . $ QUrl#isEmpty(50ce9a9e25b4a850).()) { |
| 524 | handleUnsupportedContentcxx . . $ DownloadManager#handleUnsupportedContent(c12be52dfbc5265e).(m_networkManagercxx . . $ DownloadManager#m_networkManager.->getcxx . . $ QNetworkAccessManager#get(d12587da35e4fcd1).(request), preferred_file_name, run_on_finish); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | void DownloadManagercxx . . $ DownloadManager#::downloadcxx . . $ DownloadManager#download(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 529 | downloadcxx . . $ DownloadManager#download(fd95f041e4857ee1).(QNetworkRequestcxx . . $ QNetworkRequest#(url)); |
| 530 | } |
| 531 | |
| 532 | void DownloadManagercxx . . $ DownloadManager#::handleUnsupportedContentcxx . . $ DownloadManager#handleUnsupportedContent(c12be52dfbc5265e).(QNetworkReplycxx . . $ QNetworkReply#* reply, |
| 533 | const QStringcxx . . $ QString#& preferred_file_name, |
| 534 | const stdcxx . . $ std/::functioncxx . . $ std/function#<void(DownloadItemcxx . . $ DownloadItem#*)>& run_on_finish) { |
| 535 | if (reply == nullptr || reply->urlcxx . . $ QNetworkReply#url(36d9834fe7321282).().isEmptycxx . . $ QUrl#isEmpty(50ce9a9e25b4a850).()) { |
| 536 | return; |
| 537 | } |
| 538 | |
| 539 | const QVariantcxx . . $ QVariant# header = reply->headercxx . . $ QNetworkReply#header(e61ac600faea07c3).(QNetworkRequestcxx . . $ QNetworkRequest#::KnownHeaderscxx . . $ QNetworkRequest#KnownHeaders#::ContentLengthHeadercxx . . $ QNetworkRequest#ContentLengthHeader.); |
| 540 | bool ok; |
| 541 | const int size = header.toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(&ok); |
| 542 | |
| 543 | if (ok && size == 0) { |
| 544 | return; |
| 545 | } |
| 546 | |
| 547 | auto* item = new DownloadItemcxx . . $ DownloadItem#(reply, preferred_file_name, run_on_finish, this); |
| 548 | |
| 549 | addItemcxx . . $ DownloadManager#addItem(7e19e328a15a9e4f).(item); |
| 550 | |
| 551 | if (!item->m_canceledFileSelectcxx . . $ DownloadItem#m_canceledFileSelect. && |
| 552 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Downloads::ShowDownloadsWhenNewDownloadStarts)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) { |
| 553 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->mainFormcxx . . $ Application#mainForm(da73b49c3e1670d9).()->tabWidgetcxx . . $ FormMain#tabWidget(331dafdc3f7547ba).()->showDownloadManagercxx . . $ TabWidget#showDownloadManager(49f6e7a06ebc5aa8).(); |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | void DownloadManagercxx . . $ DownloadManager#::addItemcxx . . $ DownloadManager#addItem(7e19e328a15a9e4f).(DownloadItemcxx . . $ DownloadItem#* item) { |
| 558 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(item, |
| 559 | &DownloadItemcxx . . $ DownloadItem#::statusChangedcxx . . $ DownloadItem#statusChanged(49f6e7a06ebc5aa8)., |
| 560 | this, |
| 561 | static_cast<void (DownloadManagercxx . . $ DownloadManager#::*)()>(&DownloadManagercxx . . $ DownloadManager#::updateRowcxx . . $ DownloadManager#updateRow(49f6e7a06ebc5aa8).)); |
| 562 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(item, &DownloadItemcxx . . $ DownloadItem#::progresscxx . . $ DownloadItem#progress(8be204668a5c1685)., this, &DownloadManagercxx . . $ DownloadManager#::itemProgresscxx . . $ DownloadManager#itemProgress(49f6e7a06ebc5aa8).); |
| 563 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(item, &DownloadItemcxx . . $ DownloadItem#::downloadFinishedcxx . . $ DownloadItem#downloadFinished(49f6e7a06ebc5aa8)., this, &DownloadManagercxx . . $ DownloadManager#::itemFinishedcxx . . $ DownloadManager#itemFinished(49f6e7a06ebc5aa8).); |
| 564 | |
| 565 | const int row = m_downloadscxx . . $ DownloadManager#m_downloads..countcxx . . $ QList#count(6b0412d51016192f).(); |
| 566 | |
| 567 | m_modelcxx . . $ DownloadManager#m_model.->beginInsertRowscxx . . $ QAbstractItemModel#beginInsertRows(d1f44b3c3a3f9fa).(QModelIndexcxx . . $ QModelIndex#QModelIndex(ced63f7c635d850d).(), row, row); |
| 568 | m_downloadscxx . . $ DownloadManager#m_downloads..appendcxx . . $ QList#append(200d2dc08238a4ed).(item); |
| 569 | m_modelcxx . . $ DownloadManager#m_model.->endInsertRowscxx . . $ QAbstractItemModel#endInsertRows(49f6e7a06ebc5aa8).(); |
| 570 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setIndexWidgetcxx . . $ QAbstractItemView#setIndexWidget(954d28fe21aaf364).(m_modelcxx . . $ DownloadManager#m_model.->indexcxx . . $ QAbstractListModel#index(37dbccf64c4e392).(row, 0), item); |
| 571 | QIconcxx . . $ QIcon# icon = stylecxx . . $ QWidget#style(5bbb00d3017c281f).()->standardIconcxx . . $ QStyle#standardIcon(cd3259ff6fd988a0).(QStylecxx . . $ QStyle#::StandardPixmapcxx . . $ QStyle#StandardPixmap#::SP_FileIconcxx . . $ QStyle#SP_FileIcon.); |
| 572 | |
| 573 | item->m_uicxx . . $ DownloadItem#m_ui.->m_lblFileIconcxx . . $ Ui_DownloadItem#m_lblFileIcon.->setPixmapcxx . . $ QLabel#setPixmap(8887f7d25b86c3f4).(icon.pixmapcxx . . $ QIcon#pixmap(6ca65e964a77a341).(DOWNLOADER_ICON_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:96:9`!, DOWNLOADER_ICON_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:96:9`!)); |
| 574 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setRowHeightcxx . . $ QTableView#setRowHeight(3e454b8ccf442868).(row, item->sizeHintcxx . . $ QWidget#sizeHint(4b3b776e5ee2b367).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).()); |
| 575 | |
| 576 | // Just in case of download finishes before it is actually added. |
| 577 | updateRowcxx . . $ DownloadManager#updateRow(7e19e328a15a9e4f).(item); |
| 578 | } |
| 579 | |
| 580 | SilentNetworkAccessManagercxx . . $ SilentNetworkAccessManager#* DownloadManagercxx . . $ DownloadManager#::networkManagercxx . . $ DownloadManager#networkManager(7f01183d3c0901fa).() const { |
| 581 | return m_networkManagercxx . . $ DownloadManager#m_networkManager.; |
| 582 | } |
| 583 | |
| 584 | int DownloadManagercxx . . $ DownloadManager#::totalDownloadscxx . . $ DownloadManager#totalDownloads(455f465bc33b4cdf).() const { |
| 585 | return m_downloadscxx . . $ DownloadManager#m_downloads..sizecxx . . $ QList#size(6b0412d51016192f).(); |
| 586 | } |
| 587 | |
| 588 | void DownloadManagercxx . . $ DownloadManager#::itemFinishedcxx . . $ DownloadManager#itemFinished(49f6e7a06ebc5aa8).() { |
| 589 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadFinishedcxx . . $ DownloadManager#downloadFinished(49f6e7a06ebc5aa8).(); |
| 590 | } |
| 591 | |
| 592 | void DownloadManagercxx . . $ DownloadManager#::updateRowcxx . . $ DownloadManager#updateRow(49f6e7a06ebc5aa8).() { |
| 593 | if (auto* item = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<DownloadItemcxx . . $ DownloadItem#*>(sendercxx . . $ QObject#sender(2dbb680a34285c44).())) { |
| 594 | updateRowcxx . . $ DownloadManager#updateRow(7e19e328a15a9e4f).(item); |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | void DownloadManagercxx . . $ DownloadManager#::itemProgresscxx . . $ DownloadManager#itemProgress(49f6e7a06ebc5aa8).() { |
| 599 | int progress = downloadProgresscxx . . $ DownloadManager#downloadProgress(455f465bc33b4cdf).(); |
| 600 | |
| 601 | if (progress < 0) { |
| 602 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadFinishedcxx . . $ DownloadManager#downloadFinished(49f6e7a06ebc5aa8).(); |
| 603 | } |
| 604 | else { |
| 605 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! downloadProgressedcxx . . $ DownloadManager#downloadProgressed(4b11a7293b4ed91c).(progress, trcxx . . $ DownloadManager#tr(75d9f1c324b4579d).("Downloading %n file(s)...", "", activeDownloadscxx . . $ DownloadManager#activeDownloads(455f465bc33b4cdf).())); |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | void DownloadManagercxx . . $ DownloadManager#::updateRowcxx . . $ DownloadManager#updateRow(7e19e328a15a9e4f).(DownloadItemcxx . . $ DownloadItem#* item) { |
| 610 | const int row = m_downloadscxx . . $ DownloadManager#m_downloads..indexOfcxx . . $ QListSpecialMethodsBase#indexOf(284c58bbf0d07092).(item); |
| 611 | |
| 612 | if (row == -1) { |
| 613 | return; |
| 614 | } |
| 615 | |
| 616 | if (m_iconProvidercxx . . $ DownloadManager#m_iconProvider..isNullcxx . . $ QScopedPointer#isNull(3482b152b9333168).()) { |
| 617 | m_iconProvidercxx . . $ DownloadManager#m_iconProvider..resetcxx . . $ QScopedPointer#reset(b1f27668ced7db9d).(new QFileIconProvidercxx . . $ QFileIconProvider#QFileIconProvider(49f6e7a06ebc5aa8).()); |
| 618 | } |
| 619 | |
| 620 | QIconcxx . . $ QIcon# icon = m_iconProvidercxx . . $ DownloadManager#m_iconProvider.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).iconcxx . . $ QFileIconProvider#icon(7d10cf7837546d47).(QFileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(item->m_outputcxx . . $ DownloadItem#m_output..fileNamecxx . . $ QFile#fileName(6ef7b6c27b00b43d).())); |
| 621 | |
| 622 | if (icon.isNullcxx . . $ QIcon#isNull(50ce9a9e25b4a850).()) { |
| 623 | icon =cxx . . $ QIcon#`operator=`(bc9f66e25baced4b). stylecxx . . $ QWidget#style(5bbb00d3017c281f).()->standardIconcxx . . $ QStyle#standardIcon(cd3259ff6fd988a0).(QStylecxx . . $ QStyle#::StandardPixmapcxx . . $ QStyle#StandardPixmap#::SP_FileIconcxx . . $ QStyle#SP_FileIcon.); |
| 624 | } |
| 625 | |
| 626 | item->m_uicxx . . $ DownloadItem#m_ui.->m_lblFileIconcxx . . $ Ui_DownloadItem#m_lblFileIcon.->setPixmapcxx . . $ QLabel#setPixmap(8887f7d25b86c3f4).(icon.pixmapcxx . . $ QIcon#pixmap(6ca65e964a77a341).(DOWNLOADER_ICON_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:96:9`!, DOWNLOADER_ICON_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:96:9`!)); |
| 627 | int old_height = m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->rowHeightcxx . . $ QTableView#rowHeight(7ccb52b1bfe01045).(row); |
| 628 | |
| 629 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_viewDownloadscxx . . $ Ui_DownloadManager#m_viewDownloads.->setRowHeightcxx . . $ QTableView#setRowHeight(3e454b8ccf442868).(row, qMaxcxx . . $ qMax(2a338fce5842aa6a).(old_height, item->minimumSizeHintcxx . . $ QWidget#minimumSizeHint(4b3b776e5ee2b367).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).())); |
| 630 | |
| 631 | // Remove the item if: |
| 632 | // a) It is not downloading and private browsing is enabled. |
| 633 | // OR |
| 634 | // b) Item is already downloaded and it should be remove from downloader list. |
| 635 | bool remove = item->downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).() && removePolicycxx . . $ DownloadManager#removePolicy(e63b99a0d9fabe98).() == RemovePolicycxx . . $ DownloadManager#RemovePolicy#::OnSuccessfullDownloadcxx . . $ DownloadManager#RemovePolicy#OnSuccessfullDownload.; |
| 636 | |
| 637 | if (remove) { |
| 638 | m_modelcxx . . $ DownloadManager#m_model.->removeRowcxx . . $ QAbstractItemModel#removeRow(eb30e146838e644d).(row); |
| 639 | } |
| 640 | |
| 641 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(m_downloadscxx . . $ DownloadManager#m_downloads..countcxx . . $ QList#count(6b0412d51016192f).() - activeDownloadscxx . . $ DownloadManager#activeDownloads(455f465bc33b4cdf).() > 0); |
| 642 | } |
| 643 | |
| 644 | DownloadManagercxx . . $ DownloadManager#::RemovePolicycxx . . $ DownloadManager#RemovePolicy# DownloadManagercxx . . $ DownloadManager#::removePolicycxx . . $ DownloadManager#removePolicy(e63b99a0d9fabe98).() const { |
| 645 | return m_removePolicycxx . . $ DownloadManager#m_removePolicy.; |
| 646 | } |
| 647 | |
| 648 | void DownloadManagercxx . . $ DownloadManager#::setRemovePolicycxx . . $ DownloadManager#setRemovePolicy(e285bcd5cafef979).(RemovePolicycxx . . $ DownloadManager#RemovePolicy# policy) { |
| 649 | if (policy != m_removePolicycxx . . $ DownloadManager#m_removePolicy.) { |
| 650 | m_removePolicycxx . . $ DownloadManager#m_removePolicy. = policy; |
| 651 | m_autoSavercxx . . $ DownloadManager#m_autoSaver.->changeOccurredcxx . . $ AutoSaver#changeOccurred(49f6e7a06ebc5aa8).(); |
| 652 | |
| 653 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! removePolicyChangedcxx . . $ DownloadManager#removePolicyChanged(49f6e7a06ebc5aa8).(); |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | void DownloadManagercxx . . $ DownloadManager#::savecxx . . $ DownloadManager#save(83f5f38750778ac8).() const { |
| 658 | if (m_removePolicycxx . . $ DownloadManager#m_removePolicy. == RemovePolicycxx . . $ DownloadManager#RemovePolicy#::OnExitcxx . . $ DownloadManager#RemovePolicy#OnExit.) { |
| 659 | // No saving. |
| 660 | return; |
| 661 | } |
| 662 | |
| 663 | Settingscxx . . $ Settings#* settings = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).(); |
| 664 | QStringcxx . . $ QString# keycxx . . $ QString#QString(ced63f7c635d850d).; |
| 665 | |
| 666 | settings->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), Downloadscxx . . $ Downloads/::RemovePolicycxx . . $ Downloads/RemovePolicy., (cxx . . $ QVariant#QVariant(f349c77f591a7878).int)removePolicycxx . . $ DownloadManager#removePolicy(e63b99a0d9fabe98).()); |
| 667 | |
| 668 | // Save all download items. |
| 669 | for (int i = 0; i < m_downloadscxx . . $ DownloadManager#m_downloads..countcxx . . $ QList#count(6b0412d51016192f).(); i++) { |
| 670 | settings->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemUrlcxx . . $ Downloads/ItemUrl.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i), m_downloadscxx . . $ QVariant#QVariant(9a9d0cfaabb61200).[cxx . . $ QList#`operator[]`(c7965f769b39929).i]->m_urlcxx . . $ DownloadItem#m_url.); |
| 671 | settings->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), |
| 672 | QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemLocationcxx . . $ Downloads/ItemLocation.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i), |
| 673 | QFileInfocxx . . $ QVariant#QVariant(132dd6869045752b).(m_downloadscxx . . $ DownloadManager#m_downloads.[cxx . . $ QList#`operator[]`(c7965f769b39929).i]->m_outputcxx . . $ DownloadItem#m_output.).filePathcxx . . $ QFileInfo#filePath(6ef7b6c27b00b43d).()); |
| 674 | settings->setValuecxx . . $ Settings#setValue(365356ede4ebaabb).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemDonecxx . . $ Downloads/ItemDone.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i), m_downloadscxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).[cxx . . $ QList#`operator[]`(c7965f769b39929).i]->downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).()); |
| 675 | } |
| 676 | |
| 677 | // Remove all redundant saved download items. |
| 678 | int i = m_downloadscxx . . $ DownloadManager#m_downloads..sizecxx . . $ QList#size(6b0412d51016192f).(); |
| 679 | |
| 680 | while (!(key =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemUrlcxx . . $ Downloads/ItemUrl.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i)).isEmptycxx . . $ QString#isEmpty(3482b152b9333168).() && settings->containscxx . . $ Settings#contains(90f171d2530d3e23).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), key)) { |
| 681 | settings->removecxx . . $ Settings#remove(c1427772cd1877b0).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), key); |
| 682 | settings->removecxx . . $ Settings#remove(c1427772cd1877b0).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemLocationcxx . . $ Downloads/ItemLocation.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i)); |
| 683 | settings->removecxx . . $ Settings#remove(c1427772cd1877b0).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemDonecxx . . $ Downloads/ItemDone.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i)); |
| 684 | i++; |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | void DownloadManagercxx . . $ DownloadManager#::loadcxx . . $ DownloadManager#load(49f6e7a06ebc5aa8).() { |
| 689 | const Settingscxx . . $ Settings#* settings = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).(); |
| 690 | int i = 0; |
| 691 | |
| 692 | // Restore the policy. |
| 693 | m_removePolicycxx . . $ DownloadManager#m_removePolicy. = |
| 694 | static_cast<RemovePolicycxx . . $ DownloadManager#RemovePolicy#>(settings->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Downloads::RemovePolicy)).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).()); |
| 695 | |
| 696 | // Restore downloads. |
| 697 | while (settings->containscxx . . $ Settings#contains(90f171d2530d3e23).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemUrlcxx . . $ Downloads/ItemUrl.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i))) { |
| 698 | QUrlcxx . . $ QUrl# url = settings->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemUrlcxx . . $ Downloads/ItemUrl.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i)).toUrlcxx . . $ QVariant#toUrl(36d9834fe7321282).(); |
| 699 | QStringcxx . . $ QString# file_name = settings->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemLocationcxx . . $ Downloads/ItemLocation.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i)).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 700 | bool done = settings->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Downloads), QStringcxx . . $ QString#QString(132dd6869045752b).(Downloadscxx . . $ Downloads/::ItemDonecxx . . $ Downloads/ItemDone.).argcxx . . $ QString#arg(ed67e9a87de2cd4e).(i), truecxx . . $ QVariant#QVariant(9f0ba574c1c44ffc).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 701 | |
| 702 | if (!url.isEmptycxx . . $ QUrl#isEmpty(50ce9a9e25b4a850).() && !file_name.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 703 | auto* item = new DownloadItemcxx . . $ DownloadItem#(nullptr, {cxx . . $ QString#QString(ced63f7c635d850d).}, {cxx . . $ std/function#function(ced63f7c635d850d).}, this); |
| 704 | |
| 705 | item->m_finishedDownloadingcxx . . $ DownloadItem#m_finishedDownloading. = done; |
| 706 | item->m_outputcxx . . $ DownloadItem#m_output..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(file_name); |
| 707 | item->m_urlcxx . . $ DownloadItem#m_url. =cxx . . $ QUrl#`operator=`(5236b30dc3aa36dd). url; |
| 708 | |
| 709 | item->updateInfoAndUrlLabelcxx . . $ DownloadItem#updateInfoAndUrlLabel(49f6e7a06ebc5aa8).(); |
| 710 | |
| 711 | item->m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 712 | item->m_uicxx . . $ DownloadItem#m_ui.->m_btnStopDownloadcxx . . $ Ui_DownloadItem#m_btnStopDownload.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 713 | item->m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(!done); |
| 714 | item->m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(!done); |
| 715 | item->m_uicxx . . $ DownloadItem#m_ui.->m_progressDownloadcxx . . $ Ui_DownloadItem#m_progressDownload.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(false); |
| 716 | |
| 717 | addItemcxx . . $ DownloadManager#addItem(7e19e328a15a9e4f).(item); |
| 718 | } |
| 719 | |
| 720 | i++; |
| 721 | } |
| 722 | |
| 723 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(m_downloadscxx . . $ DownloadManager#m_downloads..sizecxx . . $ QList#size(6b0412d51016192f).() - activeDownloadscxx . . $ DownloadManager#activeDownloads(455f465bc33b4cdf).() > 0); |
| 724 | } |
| 725 | |
| 726 | void DownloadManagercxx . . $ DownloadManager#::cleanupcxx . . $ DownloadManager#cleanup(49f6e7a06ebc5aa8).() { |
| 727 | if (!m_downloadscxx . . $ DownloadManager#m_downloads..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 728 | m_modelcxx . . $ DownloadManager#m_model.->removeRowscxx . . $ DownloadModel#removeRows(c4e00837c4ba3150).(0, m_downloadscxx . . $ DownloadManager#m_downloads..countcxx . . $ QList#count(6b0412d51016192f).()); |
| 729 | m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | void DownloadManagercxx . . $ DownloadManager#::setDownloadDirectorycxx . . $ DownloadManager#setDownloadDirectory(3520e46b33348bf6).(const QStringcxx . . $ QString#& directory) { |
| 734 | m_downloadDirectorycxx . . $ DownloadManager#m_downloadDirectory. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). directory; |
| 735 | |
| 736 | if (!m_downloadDirectorycxx . . $ DownloadManager#m_downloadDirectory..isEmptycxx . . $ QString#isEmpty(3482b152b9333168).() && !m_downloadDirectorycxx . . $ DownloadManager#m_downloadDirectory..endsWithcxx . . $ QString#endsWith(7cf081d1b6a1defd).(QDircxx . . $ QDir#::separatorcxx . . $ QDir#separator(44eb9225326fcbf5).())) { |
| 737 | m_downloadDirectorycxx . . $ DownloadManager#m_downloadDirectory. +=cxx . . $ QString#`operator+=`(3a2ffbdf8ecc25e2). QDircxx . . $ QDir#::separatorcxx . . $ QDir#separator(44eb9225326fcbf5).(); |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | QStringcxx . . $ QString# DownloadManagercxx . . $ DownloadManager#::downloadDirectorycxx . . $ DownloadManager#downloadDirectory(4365c3963150523e).() { |
| 742 | return m_downloadDirectorycxx . . $ QString#QString(132dd6869045752b).; |
| 743 | } |
| 744 | |
| 745 | QStringcxx . . $ QString# DownloadManagercxx . . $ DownloadManager#::timeStringcxx . . $ DownloadManager#timeString(d25daef7ecfdbcd3).(double time_remaining) { |
| 746 | QStringcxx . . $ QString# remainingcxx . . $ QString#QString(ced63f7c635d850d).; |
| 747 | |
| 748 | if (time_remaining > 60) { |
| 749 | time_remaining = time_remaining / 60; |
| 750 | time_remaining = floor(time_remaining); |
| 751 | remaining =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ DownloadManager#tr(75d9f1c324b4579d).("%n minutes remaining", "", (int)time_remaining); |
| 752 | } |
| 753 | else { |
| 754 | time_remaining = floor(time_remaining); |
| 755 | remaining =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ DownloadManager#tr(75d9f1c324b4579d).("%n seconds remaining", "", (int)time_remaining); |
| 756 | } |
| 757 | |
| 758 | return remainingcxx . . $ QString#QString(28715ad661ad3cec).; |
| 759 | } |
| 760 | |
| 761 | QStringcxx . . $ QString# DownloadManagercxx . . $ DownloadManager#::dataStringcxx . . $ DownloadManager#dataString(20e0a2766677f583).(qint64cxx . . $ qint64# size) { |
| 762 | QStringcxx . . $ QString# unitcxx . . $ QString#QString(ced63f7c635d850d).; |
| 763 | double new_size; |
| 764 | |
| 765 | if (size < 1024) { |
| 766 | new_size = size; |
| 767 | unit =cxx . . $ QString#`operator=`(4f35bf974e7f8568). trcxx . . $ DownloadManager#tr(75d9f1c324b4579d).("bytes"); |
| 768 | } |
| 769 | else if (size < 1024 * 1024) { |
| 770 | new_size = (double)size / (double)1024; |
| 771 | unit =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("kB"); |
| 772 | } |
| 773 | else if (size < 1024 * 1024 * 1024) { |
| 774 | new_size = (double)size / (double)(1024 * 1024); |
| 775 | unit =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("MB"); |
| 776 | } |
| 777 | else { |
| 778 | new_size = (double)size / (double)(1024 * 1024 * 1024); |
| 779 | unit =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("GB"); |
| 780 | } |
| 781 | |
| 782 | return QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("%1 %2").argcxx . . $ QString#arg(4bc30c57834ce0f4).(new_size, 0, 'f', 1).argcxx . . $ QString#arg(ad0bca07273edcc2).(unit); |
| 783 | } |
| 784 | |
| 785 | DownloadModelcxx . . $ DownloadModel#::DownloadModelcxx . . $ DownloadModel#DownloadModel(30676a2113473e37).(DownloadManagercxx . . $ DownloadManager#* download_manager, QObjectcxx . . $ QObject#* parent) |
| 786 | : QAbstractListModelcxx . . $ QAbstractListModel#(parent), m_downloadManagercxx . . $ DownloadModel#m_downloadManager.(download_manager) {} |
| 787 | |
| 788 | QVariantcxx . . $ QVariant# DownloadModelcxx . . $ DownloadModel#::datacxx . . $ DownloadModel#data(69b5b18a001c0029).(const QModelIndexcxx . . $ QModelIndex#& index, int role) const { |
| 789 | if (index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).() < 0 || index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).() >= rowCountcxx . . $ DownloadModel#rowCount(e3878d4d6cd9529c).(index.parentcxx . . $ QModelIndex#parent(a394cbc57608ce34).())) { |
| 790 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 791 | } |
| 792 | |
| 793 | if (role == Qtcxx . . $ Qt/::ToolTipRolecxx . . $ Qt/ToolTipRole.) { |
| 794 | if (!m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).())->downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).()) { |
| 795 | return m_downloadManagercxx . . $ QVariant#QVariant(132dd6869045752b).->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).())->m_uicxx . . $ DownloadItem#m_ui.->m_lblInfoDownloadcxx . . $ Ui_DownloadItem#m_lblInfoDownload.->textcxx . . $ QLabel#text(6ef7b6c27b00b43d).(); |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 800 | } |
| 801 | |
| 802 | int DownloadModelcxx . . $ DownloadModel#::rowCountcxx . . $ DownloadModel#rowCount(e3878d4d6cd9529c).(const QModelIndexcxx . . $ QModelIndex#& parent) const { |
| 803 | return parent.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).() ? 0 : m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..countcxx . . $ QList#count(6b0412d51016192f).(); |
| 804 | } |
| 805 | |
| 806 | bool DownloadModelcxx . . $ DownloadModel#::removeRowscxx . . $ DownloadModel#removeRows(c4e00837c4ba3150).(int row, int count, const QModelIndexcxx . . $ QModelIndex#& parent) { |
| 807 | if (parent.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).()) { |
| 808 | return false; |
| 809 | } |
| 810 | |
| 811 | int lastRow = row + count - 1; |
| 812 | |
| 813 | for (int i = lastRow; i >= row; --i) { |
| 814 | if (m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(i)->downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).() || |
| 815 | m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(i)->m_uicxx . . $ DownloadItem#m_ui.->m_btnTryAgaincxx . . $ Ui_DownloadItem#m_btnTryAgain.->isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).()) { |
| 816 | beginRemoveRowscxx . . $ QAbstractItemModel#beginRemoveRows(d1f44b3c3a3f9fa).(parent, i, i); |
| 817 | m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..takeAtcxx . . $ QList#takeAt(1f8c468676ec449a).(i)->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 818 | endRemoveRowscxx . . $ QAbstractItemModel#endRemoveRows(49f6e7a06ebc5aa8).(); |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_autoSavercxx . . $ DownloadManager#m_autoSaver.->changeOccurredcxx . . $ AutoSaver#changeOccurred(49f6e7a06ebc5aa8).(); |
| 823 | |
| 824 | if (m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->totalDownloadscxx . . $ DownloadManager#totalDownloads(455f465bc33b4cdf).() == 0) { |
| 825 | m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_uicxx . . $ DownloadManager#m_ui.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).m_btnCleanupcxx . . $ Ui_DownloadManager#m_btnCleanup.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 826 | } |
| 827 | |
| 828 | return true; |
| 829 | } |
| 830 | |
| 831 | Qtcxx . . $ Qt/::ItemFlagscxx . . $ Qt/ItemFlags# DownloadModelcxx . . $ DownloadModel#::flagscxx . . $ DownloadModel#flags(36b38c1b3d3f7b45).(const QModelIndexcxx . . $ QModelIndex#& index) const { |
| 832 | if (index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).() < 0 || index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).() >= rowCountcxx . . $ DownloadModel#rowCount(e3878d4d6cd9529c).(index.parentcxx . . $ QModelIndex#parent(a394cbc57608ce34).())) { |
| 833 | return Qtcxx . . $ QFlags#QFlags(93d577a3e9528307).::ItemFlagcxx . . $ Qt/ItemFlag#::NoItemFlagscxx . . $ Qt/NoItemFlags.; |
| 834 | } |
| 835 | |
| 836 | Qtcxx . . $ Qt/::ItemFlagscxx . . $ Qt/ItemFlags# default_flags = QAbstractListModelcxx . . $ QAbstractListModel#::flagscxx . . $ QAbstractListModel#flags(36b38c1b3d3f7b45).(index); |
| 837 | DownloadItemcxx . . $ DownloadItem#* item = m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).()); |
| 838 | |
| 839 | if (item->downloadedSuccessfullycxx . . $ DownloadItem#downloadedSuccessfully(50ce9a9e25b4a850).()) { |
| 840 | return default_flags |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). Qtcxx . . $ Qt/::ItemFlagcxx . . $ Qt/ItemFlag#::ItemIsDragEnabledcxx . . $ Qt/ItemIsDragEnabled.; |
| 841 | } |
| 842 | |
| 843 | return default_flags; |
| 844 | } |
| 845 | |
| 846 | QMimeDatacxx . . $ QMimeData#* DownloadModelcxx . . $ DownloadModel#::mimeDatacxx . . $ DownloadModel#mimeData(8814472558f0ef9a).(const QModelIndexListcxx . . $ QModelIndexList#& indexes) const { |
| 847 | auto* mimeData = new QMimeDatacxx . . $ QMimeData#QMimeData(49f6e7a06ebc5aa8).(); |
| 848 | QListcxx . . $ QList#<QUrlcxx . . $ QUrl#> urlscxx . . $ QList#QList(ced63f7c635d850d).; |
| 849 | |
| 850 | for (const QModelIndexcxx . . $ QModelIndex#& index : indexes) { |
| 851 | if (!index.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).()) { |
| 852 | continue; |
| 853 | } |
| 854 | |
| 855 | urls.appendcxx . . $ QList#append(1262c8661f7a27a7).(QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).(QFileInfocxx . . $ QFileInfo#QFileInfo(4ad1f70a54388cc8).(m_downloadManagercxx . . $ DownloadModel#m_downloadManager.->m_downloadscxx . . $ DownloadManager#m_downloads..atcxx . . $ QList#at(c7965f769b39929).(index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).())->m_outputcxx . . $ DownloadItem#m_output.) |
| 856 | .absoluteFilePathcxx . . $ QFileInfo#absoluteFilePath(6ef7b6c27b00b43d).())); |
| 857 | } |
| 858 | |
| 859 | mimeData->setUrlscxx . . $ QMimeData#setUrls(dbd2f48e689c9f8b).(urls); |
| 860 | return mimeData; |
| 861 | } |