summaryrefslogtreecommitdiff
path: root/src/downloadmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add setting to show notifications when downloads complete or fail (#2338)Jonathan Feenstra2026-05-151-0/+16
|
* Stable DownloadId refactor (#2375)Al2026-05-071-458/+500
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Encapsulate the downloads directory watcher in DirWatcherManager QFileSystemWatcher suppression currently relies on public static start/end methods and a static counter. Seven call sites pair them raw, one of them outside the class. Any exception between a pair permanently disables the watcher, and the static counter implies a singleton DownloadManager. A new DirWatcherManager owns the watcher, the counter (now an instance member), and the filtering. The only way to suspend is an RAII Guard obtained via a scopedGuard() factory. All raw pairs migrate to guards. A TODO flags the existing processEvents() in the dtor as a known reentrancy hazard worth replacing later. * Replace aboutToUpdate/update(int) with ModelResetGuard Replace the fragile two-signal protocol with a refcounted RAII ModelResetGuard. Split update(int) into aboutToResetModel/modelReset (guard only) and rowChanged(int); notifyRowChanged() is suppressed while a reset is active. Fixes "beginResetModel without endResetModel" warnings from three sites in downloadFinished/removeDownload that were pairing reset with a row update. removePending only opens a guard when an actual match is removed. * Centralize row notifications in setState and fix missed emits setState emits notifyRowChanged itself, uses indexByInfo (-1 when untracked), and re-looks up the row at each use so reply->abort() and plugin callbacks that re-enter and erase info don't produce stale signals. Remove the trailing emit loop from createMetaFile and the now-redundant notifyRowChanged calls scattered after setState. Add the two missing emits in restoreDownload (after m_Hidden) and metaDataChanged (after rename). Guard downloadFinished with a top-level DirWatcherGuard to prevent filesystem events from its writes racing with model updates. * Fix comma operator in addNXMDownload pending-dedup check The game-name comparison result was discarded by the comma operator, so the dedup only matched modId/fileId across all games. * Fix lost finished() signal on fast downloads Hoist the file-exists prompt out of startDownload so setup is straight-line. Connect finished() last and dispatch manually if the reply already finished. * Fix memory leak in DownloadInfo::createFromMeta Move the allocation past the early-return checks so path-mismatch and hidden-skip paths no longer leak a fresh DownloadInfo. * Sanitize suffix path in getDownloadFileName The collision-avoidance branch was using the raw baseName, so invalid characters sanitized out of the initial path leaked into the suffixed one. * [pre-commit.ci] Auto fixes from pre-commit.com hooks. * Remove unused alphabetical translation vector m_AlphabeticalTranslation was written but never read; drop it along with refreshAlphabeticalTranslation, ByName, and the LessThanWrapper helper. * Address PR feedback: fix redundant check and move refresh outside try catch. * Coalesce the removeDownload reset with the following refreshList Moves the ModelResetGuard out of the try-catch so it also wraps the refreshList() call below. Without this, one reset fires when the guard destructs at the end of the try block and another fires from refreshList's own guard, producing two resets where one is sufficient. * Guard the .meta creation in openMetaFile against the directory watcher openMetaFile creates the .meta file via QSettings when one does not exist; the disk write fires directoryChanged and triggers a spurious refreshList. Wrap it in a DirWatcherManager::Guard like the other meta-file editing paths. * Extract getValidGameShortName method in download manager (#2380) * Add stable download id index and PendingDownload struct Replace the (game, mod, file) tuple backing m_PendingDownloads with a named struct, and add m_ByID as an O(1) m_DownloadID-to-info index kept in sync with every m_ActiveDownloads mutation. Encapsulate the id counter behind DownloadInfo::newDownloadID(), the only supported way to consume from s_NextDownloadID. Infrastructure only; external behaviour is unchanged. * Return stable ids from the plugin-facing download API startDownloadURLs / startDownloadNexusFile / addNXMDownload now reserve and return m_DownloadID instead of a stale index. Plugin callbacks fire with m_DownloadID; downloadPath looks up via m_ByID. nxmDownloadURLsAvailable threads the reserved id into the materializing DownloadInfo, and Nexus API failures wake waiting plugins via notifyPendingDownloadFailed. Incidental: startDownload now returns bool and frees newDownload on output-open failure; createMetaFile is deferred past that check so failed starts no longer leave an orphan .meta. * Split downloadFinished into onReplyFinished slot and finishDownload The old dual-use downloadFinished(int = 0) took either an explicit index or relied on sender() when called as a slot. Split into a sender-resolved slot and an id-based direct call, removing the ambiguous index-zero path. * Introduce DownloadID alias and row/id accessors Add a DownloadID type alias for the stable per-download handle and two public accessors (downloadIDAtRow, rowForDownloadID) so callers can translate between the view's row vocabulary and the model's id vocabulary without reaching into the manager's internals. DownloadList now embeds the DownloadID in QModelIndex::internalId() so any code holding an index can identify the download directly. * Convert cancel/pause/resume action methods to take DownloadID The four methods (cancel, pause, resume, resumeDownloadInt) now accept a DownloadID, resolve through m_ByID, and no longer care about row positions. Internal callers iterate DownloadInfo* or look up via id; DownloadsTab translates row -> id at the connect boundary so the view's int-shaped signals keep working unchanged. Also switches the remaining unsigned int signatures that refer to the download id (finishDownload, downloadInfoByID, PendingDownload::reservedID, m_ByID, newDownloadID, s_NextDownloadID) to the DownloadID alias. Drive-by fix: finishDownload's retry branch could read info->m_Tries after info had been deleted in the CANCELED/retries-exhausted branch above; now re-resolves via m_ByID.value(id) before touching any fields. * [pre-commit.ci] Auto fixes from pre-commit.com hooks. * fix warnings about unused variables and size_t types * cleanup dead code * avoid calling processEvents when releasing the DirWatcherGuard * [pre-commit.ci] Auto fixes from pre-commit.com hooks. * use QEventLoop instead of manual ProcessEvents * don't call processEvents in download started and defer handling finish state in event loop * Cleanup pending download in case of failure. * Add missing notifyPendingDownloadFailed if user cancels * [pre-commit.ci] Auto fixes from pre-commit.com hooks. * Refactor pending download failure handling and cover rename failures * fix rebase bug, addNXMDownload not returning the correct type --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com>
* Download command: Add game instance check (#2388)Jeremy Rimpo2026-05-041-2/+40
| | | | | * Add game instance check - Should be ignored if not passed to command - Functions much like NXM game check
* Extended MODL / direct download handling (#2384)Jeremy Rimpo2026-05-031-0/+16
| | | | | | | * Extended MODL / direct download handling - name, modname, version, and source options added to download command - nxmhandler init adds schemas and MODL entry with default launch args - Add MODL register button to general tab - On window display, call meta function to trigger both registrations
* Handle Nexus collections links (#2383)Jeremy Rimpo2026-05-021-0/+8
| | | | - Pops up dialog when the NXM link is a collection - Collection link data available, though still unsupported
* Add author and uploader columns to mod list (#2269)Jonathan Feenstra2025-08-181-5/+41
|
* Mass Metadata Parsing: Prevent re-querying and manual prompts to enter ↵Jonathan Feenstra2025-05-231-6/+48
| | | | | | | | | | | missing data (#2135) * Add a button to "Query Info" of every download in the list --------- Co-authored-by: Deewens <dudonadrien@gmail.com> Co-authored-by: KenJyn76 <liambonilla@gmail.com> Co-authored-by: Al <26797547+Al12rs@users.noreply.github.com>
* Dependency Updates Meta PR (#2242)Jeremy Rimpo2025-05-221-0/+3
| | | | | * Update dll manifests * Fixes for emit / model refresh issues
* Add startDownloadNexusFileForGame (#2181)Jonathan Feenstra2025-01-021-5/+4
|
* Download issue fixesJeremy Rimpo2023-11-051-26/+22
| | | | | | - Add scoped watcher disabler - Disable during mod install - Update interprocess message handler to fix 'unable to communicate' issues
* Download files from direct URLs via a command line parameter (#1873)Eddoursul2023-09-181-6/+32
| | | | * Download files via a command line parameter * Use a GET parameter to predetermine Content-Disposition header in S3-compatible temporary URLs
* Apply clang-format.Mikaël Capelle2023-07-091-487/+573
|
* Extend download speed datatypes to qint64/long long to avoid overflowJeremy Rimpo2022-05-041-4/+4
|
* Decrease rolling window size for download speedJeremy Rimpo2022-04-191-2/+2
|
* Restore HTTP/2 and set configurationJeremy Rimpo2022-04-191-1/+5
| | | | > Window size values reflect those used in Firefox and Chrome
* Patch for slow download speedsJeremy Rimpo2022-04-191-0/+1
| | | | | - Disable HTTP/2 protocol - Not ideal, might be able to adjust QHttp2Configuration settings
* Download status improvementsJeremy Rimpo2022-04-191-16/+15
| | | | | - Better speed calculation - Add download time estimate
* Better nexus network errorsJeremy Rimpo2022-04-191-2/+2
|
* Remove dependency on Core5CompatJeremy Rimpo2022-04-191-4/+4
|
* Added ARCHIVED support for nexus update check and download query.AL2021-07-121-2/+5
| | | | | Use FileStatus enum instead of scattered int literals. Re-wrote the update check code
* Sanitize download file namesChris Bessent2021-04-291-2/+3
| | | | Also switch instance name sanitizer to MOBase version
* custom browser commandisanae2020-12-281-1/+1
| | | | changed some places that used QDesktopServices to use shell::Open() from uibase instead
* optimizations for download manager:isanae2020-12-241-24/+67
| | | | | | | - use envfs for walking directory - minimize string copies, disk access - use set of filenames to check for duplicates - use file size from envfs
* Merge pull request #1313 from Holt59/load-plugin-without-restartMikaël Capelle2020-12-071-9/+9
|\ | | | | Implement loading/unloading of plugins without restarting
| * Fix callbacks for pluginlist, modlist and download manager.Mikaël Capelle2020-12-021-9/+9
| |
* | handle null plugin when adding a downloadisanae2020-12-031-0/+10
|/ | | | happens when some plugins refer to other plugins that are missing
* Compute supported extensions dynamically in installation and download manager.Mikaël Capelle2020-12-011-15/+3
|
* fixed boost bind warningsisanae2020-11-031-1/+3
|
* Switch from Qt signals to boost::signals for DownloadManager.Mikaël Capelle2020-10-111-2/+29
|
* Updating error loggingerri1202020-08-201-1/+1
|
* Removed error log localizationerri1202020-08-201-1/+1
|
* Create meta file if it does not exist when trying to open iterri1202020-08-201-7/+11
|
* Added Open Meta File context action to downloadserri1202020-08-201-0/+23
|
* added more timingsisanae2020-02-181-1/+3
| | | | missed fileregisterfwd.h in cmake list
* Merge pull request #1000 from Al12rs/startup_performanceisanae2020-02-181-3/+6
|\ | | | | Startup performance
| * Cleanup commented codeAL2020-02-171-3/+2
| |
| * Avoid refreshing when setting downloads supported extensions as it only ↵AL2020-02-161-1/+3
| | | | | | | | happens during init.
| * Allow not refreshing downloads when setting their folder, for example during ↵AL2020-02-161-2/+4
| | | | | | | | init.
* | Change Qtime to QElapsedtimer in some palaces to remove the warnings.AL2020-02-151-1/+1
|/
* Merge pull request #969 from ModOrganizer2/2_2_2Chris Bessent2020-01-131-24/+34
|\ | | | | Pull in 2.2.2.1 changes
| * Fix downloading files that have no file nameChris Bessent2020-01-111-0/+7
| | | | | | | | | | | | | | | | | | Somehow some mods on the Nexus have no file name in certain API responses. Previously, MO assumed the last part of the URL is the file name. This worked until the Nexus started adding URL query stuff to the URL (?md5=xxx). Now, strip out all the URL query stuff to get a valid file name.
| * Don't ask for the game when there's only one gameChris Bessent2020-01-101-6/+13
| |
| * Use the old query info logic when MD5 query is ambiguousChris Bessent2020-01-101-18/+14
| | | | | | | | | | An author accidentally uploaded a mod's files to a different mod. This resulted in querying info finding the wrong mod/file.
* | Migrate obsoleted qVariantFromValueSilarn2019-12-311-2/+2
|/
* Add source game column to the download listLostDragonist2019-12-061-0/+13
|
* fixed crash when starting multiple downloads with dialog boxes openedisanae2019-12-021-8/+23
| | | | fixed download manager dialog boxes not having a parent
* removed useless logging about serversisanae2019-11-261-4/+3
|
* Sort the files when presenting them during querying infoLostDragonist2019-11-231-0/+2
|
* added error messages to FileRenamer and a few moreisanae2019-10-041-5/+5
| | | | fixes for shell functions changing names
* Fix md5 hashing for large download filesLostDragonist2019-09-281-3/+26
| | | | | | | | | Previously, the md5 hashing was broken for download files larger than about 2GB. This was due to the maximum size of a QByteArray. The hashing was broken up into 10MB chunks to correct this issue. Additionally, a progress bar was added as hashing large files would lock up the GUI.