summaryrefslogtreecommitdiff
path: root/src/downloadlist.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Stable DownloadId refactor (#2375)Al2026-05-071-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Replace chopped by mid in download list. (#2089)Mikaël Capelle2024-08-031-1/+1
|
* Apply clang-format.Mikaël Capelle2023-07-091-106/+147
|
* Convert everything to CRLF.Mikaël Capelle2023-07-091-291/+291
|
* Sort filetimes from newer to older while sorting by status in downloadlistAL2021-07-101-1/+1
|
* Fix download list sorting.Mikaël Capelle2021-02-261-2/+2
|
* Fix download of meta-information in download tab.Mikaël Capelle2021-01-311-52/+49
|
* Use proper naming convention for constants.Mikaël Capelle2021-01-221-1/+1
|
* Add message for invalid drag. Split & clean code.Mikaël Capelle2021-01-021-1/+2
|
* Drag and drop from download view to install + Expand and scroll to mod on ↵Mikaël Capelle2021-01-021-0/+12
| | | | install.
* renamed DownloadList::lessThan to lessThanPredicate and added a comment that ↵isanae2020-12-281-1/+1
| | | | it's used with the filter widget
* removed setUpdateDelay(false) calls, it's the defaultisanae2020-12-261-2/+78
| | | | FilterWidget for downloads tab
* Add source game column to the download listLostDragonist2019-12-061-1/+8
|
* moved code for byte sizes and speed to uibaseisanae2019-08-261-19/+2
| | | | | added scoped classes for QSettings groups and arrays servers logged on startup
* changed qCritical() to log::error()isanae2019-07-221-2/+3
| | | | removed now unused vlog()
* download list: made all column left-aligned except for sizeisanae2019-05-221-3/+3
|
* download list: added columns for mod name, version and nexus idisanae2019-05-221-1/+28
|
* Use MD5 when querying info before bothering the userLostDragonist2019-03-071-2/+3
|
* Limit the download file description to 4096 charactersLostDragonist2019-02-211-1/+1
| | | | The description is limited to 255 characters on the Nexus so this is mostly protecting against invalid data.
* Fix some compiler warningsKrzysztof Starecki2018-12-311-2/+2
|
* Add filetime column to download tabKrzysztof Starecki2018-12-311-5/+7
|
* Add 'download meta information' support to download tabKrzysztof Starecki2018-12-311-1/+6
|
* Fix download layout bug, port most of remaining themesKrzysztof Starecki2018-12-311-42/+24
|
* Add qss styling options for progress bar and compact mode widgetsKrzysztof Starecki2018-12-311-10/+3
|
* Add icon for incomplete download info, add download progress delegateKrzysztof Starecki2018-12-301-0/+5
|
* Add downloadlist styling tweaksKrzysztof Starecki2018-12-301-8/+25
|
* Fix adding new downloads, add missing download progress statesKrzysztof Starecki2018-12-301-18/+53
|
* Port context menus to new downloadlistKrzysztof Starecki2018-12-301-0/+2
|
* Disable downloadlist widget delegates, port partial functionality to QTreeViewKrzysztof Starecki2018-12-301-7/+38
|
* Fix for download list refreshing, courtesy of bshdLostDragonist2018-12-291-2/+1
|
* Added sortable "Size" column to the downlaods tab.Al12rs2018-07-171-1/+2
|
* Revert "Applied clang-format on source"Sandro Jäckel2018-02-231-51/+72
| | | | This reverts commit 5e5c9c07291f6b09623d31c92b1fb61c4ede576e.
* Applied clang-format on sourceSandro Jäckel2018-02-221-72/+51
|
* - bugfix: MO would report invalid index errors when downloading while ↵Tannin2014-08-251-2/+2
| | | | download list is sorted by filetime descending
* normalized eol style (all files should now have windows line endings)Tannin2014-07-171-114/+114
|
* - download tooltip now also includes the file descriptionTannin2014-05-011-1/+1
| | | | - will now display an error message when the ini file can't be updated (in addition to what windows says)
* - loot integration now displays the reportTannin2014-04-051-1/+1
| | | | | - fixes to the previous merge - bugfix: cli loot didn't handle non-ascii characters correctly
* Merge with branch1.1Tannin2014-04-051-5/+12
|\
| * - nxmhandler will now ask before registering itselfTannin2014-01-041-7/+12
| | | | | | | | | | | | - downloads from nexus are now displayed before file information is retrieved - logging from the ui is now a bit more informative - download list now scrolls to bottom automatically
| * - tooltip on download list now contains the file nameTannin2013-10-181-2/+4
| | | | | | | | | | | | - bugfix: when refreshing the directory tree conflict information wasn't immediately refreshed (including on start) - bugfix: dataChanged events wasn't emitted when user changed the modlist - bugfix: file patterns in checkfnis plugin weren't completely correct
* | - added support for mod page pluginsTannin2013-09-151-2/+2
|/ | | | | | | - re-introduced the integrated browser - added a plugin to download from the tes alliance page - the download list now contains the file description - nexus interface now stores cookies persistently to reduce number of required log-ins
* - mod list can now be sorted by install timeTannin2013-08-311-2/+2
| | | | | - the sorting of download archives wasn't actually by index instead of file time - bugfix: some of the plugins crashed if they failed to create a mod
* - some fixes for qt5 compatibilityTannin2013-06-201-87/+88
| | | | | | | | | | | | | | | | | | | | | - hook.dll no longer creates a dump and uninstalls it if an exception is reported that doesn't originate from it - NCC used read-only transactions again because otherwise solid archives become unusably slow. - removed the integrated nexus browser - the mod description and motd are now rendered in QTextBrowser. This (and the above) eliminates the dependency on qtwebkit - removed the direct file download for mod files - reduced CPU usage during downloads by invalidating only one column of the download list. This widget still needs to be replaced - added the complete filename as an option for the modname - applications that require elevation can now be started by invoking an elevated secondary ModOrganizer instance - MO will now register nexus file servers and provides a settings dialog to pick preferred servers. (This preference is not used yet) - worked around 1-2 bugs in QSortFilterProxy - handling of nxm links is now done by an external application. This allows the registration of different applications depending on the game - integrated fomod installer now displays the screenshot in a scalable view - bugfix: integrated fomod installer didn't name output files correctly if the name differs from the source name - bugfix: a successful login to nexus was (sometimes?) not correctly detected as a success - bugfix: top-level entries in QtGroupingProxy were sometimes incorrectly displayed as groups - bugfix: GetPrivateProfile... optimization could cause null-pointer indirection - bugfix: GetCurrentWorkingDirectory caused buffer overflow in case of pre-flighting (buffer size 0) - bugfix: configurator plugin now also uses qt5 (it's currently broken though)
* initial commit to mercurial repository.Tannin2013-02-031-0/+106
Corresponds to MO version 0.12.6