This allows us to check whether a search request is already on-going, in
which case we don't need to make another one (and shouldn't).
Signed-off-by: flow <flowlnlnln@gmail.com>
This refactors the sorting methods to join every bit of it into a single
list, easing maintanance. It also removes the weird index contraint on
the list of methods by adding an index field to the DS that holds the
method.
Lastly, it puts the available methods on their respective API, so other
resources on the same API can re-use them later on.
Signed-off-by: flow <flowlnlnln@gmail.com>
This makes it so that we don't need a reference to the parent page in
the model. It will be useful once we change the page from a widget-based
one to a QML page.
It also makes tasks be created in the dialog instead of the page, so
that the dialog can also have the necessary information to mark versions
as selected / deselected easily. It also makes the task pointers into
smart pointers.
Signed-off-by: flow <flowlnlnln@gmail.com>
Puts them all inside the 'ResourceDownload' namespace, so that it's a
bit clearer from the outside that those belong to the same 'module'.
Signed-off-by: flow <flowlnlnln@gmail.com>
Firstly, this abstract away behavior in the mod download models that can
also be applied to other types of resources into a superclass, allowing
other resource types to be implemented without so much code duplication.
For that, this also generalizes the APIs used (currently, ModrinthAPI
and FlameAPI) to be able to make requests to other types of resources.
It also does a general cleanup of both of those. In particular, this
makes use of std::optional instead of invalid values for errors and,
well, optional values :p
This is a squash of some commits that were becoming too interlaced
together to be cleanly separated.
Signed-off-by: flow <flowlnlnln@gmail.com>
It has a delay of 350ms from the last typed character to search, in
order to cache small changes while typing.
Signed-off-by: flow <flowlnlnln@gmail.com>
This allows us to define custom painting for list view items. In
particular, this is applied to the mod downloader, in order to allow
displaying both the mod name and mod description, and settings their
effects (like bold or underline) independent of each other.
Signed-off-by: flow <flowlnlnln@gmail.com>
This makes ModDownloadTask into a SequentialTask with 2 subtasks:
Downloading the mod files and updating the index with the new
information.
The index updating is done first so that, in the future, we
can prompt the user before download if, for instance, we discover
there's another version already installed.
This hopefully makes it easier to the user to know that their changes
will only apply after hitting the search button.
I tried setting the background color, but it seems more unreliable on
cross-platform than underlining. Also, it could be worse for daltonic people,
so I don't know what to do :(