Commit Graph

56 Commits

Author SHA1 Message Date
Rachel Powers
62a402d05a refactor: move functions to utils + code-review fixes
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-06 19:10:58 -07:00
Rachel Powers
b266068644
Apply suggestions from code review
Co-authored-by: flow <flowlnlnln@gmail.com>
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-05 14:07:10 -07:00
Rachel Powers
733619ca74 feat: estimate remining time on downloads
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:48:00 -07:00
Rachel Powers
236764adf6 refactor: Qt can handle const& in signals and slots
While most Qt types cna use implicit data sharing
pasing our own structs means copies. const& ensure
it's only copied as needed by Qt.

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:48:00 -07:00
Rachel Powers
d7032d975c fix: no need to loop all sub tasks
pathc by flowin

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Signed-off-by: flow <flowlnlnln@gmail.com>
2023-05-01 10:48:00 -07:00
Rachel Powers
0fb6a2836b refactor: propogate only only one StepProgress at a time
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:48:00 -07:00
Rachel Powers
6b28af6cc5 fix: clean up license headers for Tasks
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:48:00 -07:00
Rachel Powers
b6452215c1 feat: add details signal to Task
feat: add details to mod pack downloading
feat: add logging rule sloading form `ligging.ini at data path root
feat: add `launcher.task` `launcher.task.net` and `launcher.task.net.[down|up]load` logging categories
fix: add new subtask progress to the end of the lay out not the beginning (cuts down on flickering)

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:47:50 -07:00
Rachel Powers
f1028fa66d fix: properly map progress range
- doument PCRE used for URL compacting

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:47:31 -07:00
Rachel Powers
9d2f0e4dc8 feat: Propogated subtask progress
Oh boy this is big.

> TaskStepProgress struct is now QMetaObject compatabile and can be sent through signals
> Task now has a method to propogates sub task progress it must be signal bound by each task containing a task wishing to report progress of it's children.
> Downloads report speed
> Tasks now have UUIDS to track them
  - use when reporting
  - use when logging
  - use when storeing them or objects related to them

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:47:20 -07:00
Rachel Powers
f997529cd4 feat: better task tracking
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
2023-05-01 10:45:34 -07:00
flow
29f7ea752f
refactor: make shared_qobject_ptr ctor explicit
This turns issues like creating two shared ptrs from a single raw ptr
from popping up at runtime, instead making them a compile error.

Signed-off-by: flow <flowlnlnln@gmail.com>
2023-01-25 16:57:51 -03:00
flow
90feaaf2df
fix(Tasks): don't try to start more tasks than necessary
Signed-off-by: flow <flowlnlnln@gmail.com>
2023-01-24 17:04:05 -03:00
flow
00d42d296e
fix: call processEvents() before adding new tasks to the task queue
This allows the ongoing task to go off the stack before the next one is
started.

Signed-off-by: flow <flowlnlnln@gmail.com>
2023-01-18 16:23:30 -03:00
flow
81fedbf03c
refactor(Tasks): remove 'm_total_size' from ConcurrentTask
We can use the queues directly instead.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-12-17 13:10:19 -03:00
flow
b0c866bfaa
feat(Tasks): allow adding subtasks while running in ConcurrentTask
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-12-15 13:48:53 -03:00
flow
dd578354c4
feat(Tasks): add ConcurrentTask::clear to allow re-using tasks
This way old runs won't pile up in the internal DSs

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-12-15 13:45:50 -03:00
Bensuperpc
56ae4e5b6a
Change old style cast to C++ cast
Change old style cast to C++ cast

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
2022-10-22 13:04:48 +02:00
flow
be8c6f218c
refactor: setAbortStatus -> setAbortable
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-20 18:36:10 -03:00
flow
6a50fa35ec
feat: add canAbort() status change in Task
By now, it's a recurring pattern of wanting to restrict aborting in
certain situations. This avoids further code duplication, and adds a
signal that external users can hook up to to respond to such change.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-20 18:36:09 -03:00
Sefa Eyeoglu
4c7d3a103c
refactor: restructure tests
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-11 22:29:01 +02:00
flow
7cf2c3be0f
fix: start at least one task in ConcurrentTask
This allows us to emit all the necessary stuff when we're finished in
the case of starting a task with no subtasks. In particular, this caused
the mod updater to not work properly :)

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-07 12:11:42 -03:00
flow
064ae49d2b
fix: make MultipleOptionsTask inherit directly from SequentialTask
It's not a good idea to have multiple concurrent tasks running on a
sequential thing like this one.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:02 -03:00
flow
247f99ce2f
feat(test): add more tests to Tasks
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
87a0482b8b
refactor: make MultipleOptionsTask inherit from ConcurrentTask too
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
e899699918
refactor: make SequentialTask inherit from ConcurrentTask
In a way, sequential tasks are just concurrent tasks with only a single
task running concurrently, so we can remove LOTS of duplicated logic :)

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
bdf464e792
fix: abort logic running subsequent tasks anyways some times
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
c410bb4ecb
fix: 'succeeded while not running' spam in ConcurrentTask
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
a720bcc637
fix: bogus progress update when the total step progress was zero
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:01 -03:00
flow
369a8cdc74
fix: only try to start tasks that are really there
This fixes an annoying issue where concurrent tasks would try to start
multiple tasks even when there was not that many tasks to run in the
first place, causing some amount of log spam.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:29:00 -03:00
Sefa Eyeoglu
f371ec210c
Merge pull request #1052 from flowln/resource_model 2022-08-28 16:52:53 +02:00
flow
2d63c86022
feat: make Task a QRunnable
This makes it possible to run a task in another thread.

I added a variable to toggle debug prints because they seem to trigger
an assertion on Qt internals when the task in on another thread. Of
course, this isn't awesome, but can wait until we improve our logging.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:41:59 -03:00
flow
a9e8ed5087
fix: pump events and do a queued start for concurrent tasks
Heavy workloads can consume a ton of time doing their stuff, and starve
the event loop out of events. This adds an event processing call after
every concurrent task has been completed, to decrease the event loop
stravation on such loads.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-07-24 17:46:54 -03:00
flow
9a44c92211
feat: add MultipleOptionsTask
This is a variation of a Sequential Task, in which a subtask failing
will prompt the next one to execute, and a subtask being successful will
stop the task.

This way, this can be used for easily managing fallbacks with tasks. :D

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-07-17 11:33:41 -03:00
flow
882c82f82c
fix: always update global progress of sequential tasks
Previously, it would not update the global counter if the subTask didn't
update its progress, even though progress was being made.

This also prevents a segmentation fault while aborting the task.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-07-17 11:33:41 -03:00
flow
fb75c23f4e
Merge pull request #784 from Scrumplex/refactor-cmake
Refactor tests
2022-07-02 17:50:08 -03:00
flow
8e80b4bfc1
feat: add ConcurrentTask
This tasks (or rather, meta-task) has the ability to run several other
sub tasks concurrently.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-07-01 08:34:10 -03:00
Sefa Eyeoglu
effe46db86
refactor: move away from UnitTest.cmake 2022-06-14 14:44:49 +02:00
Sefa Eyeoglu
1ab00ca8b2
Merge pull request #426 from flowln/mod_perma
Add on-disk mod metadata information
2022-06-04 13:23:38 +02:00
flow
f8e7fb3d48
fix: better handle corner case 2022-05-24 20:27:25 -03:00
flow
eaa5ce4467
feat(ui): adapt SequentialTask to nested SequentialTasks 2022-05-23 14:42:27 -03:00
flow
166f872712
fix: various issues with ProgressDialog and SequentialTasks
- Fix aborting sequential tasks
- Fix displaying wrong number of tasks concluded
- Fix text cutting when the URL is too big
2022-05-21 08:36:36 -03:00
flow
17bbfe8d89
fix: virtual signal in Task.h 2022-05-17 06:47:00 -03:00
flow
dd2b324d8f
chore: add license header to remaining files
Also remove some unused imports
2022-05-12 18:11:55 -03:00
flow
57d65177c8
fix: abort and fail logic in tasks
Also sets up correctly the status connections
2022-05-12 18:11:55 -03:00
flow
efa3fbff39
refactor: remove some superfluous signals
Since now we're inheriting from Task, some signals can be reused.
2022-05-12 18:11:55 -03:00
flow
8c8eabf7ac
refactor: organize a little more the code in launcher/net/
This also reduces some code duplication by using some Task logic in
NetAction.
2022-05-12 18:11:49 -03:00
flow
eeae3eca67
test: add new test to Task test
Also adds one more check to setStatus test
2022-04-07 19:42:26 -03:00
flow
d0cda6d605
test: add basic Task unit test
Only only two tests for now. We can iterate on this later :^)

This is to try to avoid breaking things again!
2022-04-07 19:08:01 -03:00
flow
be2512bb4b
fix: issue with status of non-sequencial tasks 2022-04-07 18:41:32 -03:00