Commit Graph

39 Commits

Author SHA1 Message Date
flow
fcef6321fc
Merge pull request #228 from bensuperpc/change_cast 2022-10-28 21:34:59 +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
flow
9b8493c304
feat: Use a single progress dialog when doing multiple tasks
This puts all mod downloading tasks inside a SequentialTask, which is,
for more than one task, a multi step task. This is handled by the
ProgressDialog by showing both the global progress of tasks executed,
and the individual progress of each of them.
2022-04-01 09:32:00 -03:00
Petr Mrázek
9fc677c2a4 NOISSUE more refactoring 2021-11-21 23:36:55 +01:00
Petr Mrázek
69213b1206 NOISSUE continue refactoring things to make tests pass 2021-11-21 23:21:12 +01:00
Petr Mrázek
c2c56a2f6c NOISSUE fix build 2021-11-20 17:08:34 +01:00
Petr Mrázek
5b3dffce62 NOISSUE continue debranding... 2021-10-21 00:47:53 +02:00
Petr Mrázek
20b9f2b42a NOISSUE Flatten gui and logic libraries into MultiMC 2021-07-25 19:50:44 +02:00