Commit Graph

1191 Commits

Author SHA1 Message Date
flow
8a65726e9d
fix: use more robust method of finding matches for major version
This uses the proper version list to find all MC versions matching the
major number (_don't say anything about SemVer_ 🔫).

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-07 08:27:53 -03:00
flow
1b0ca47682
Merge pull request #939 from flowln/mod_downloader_improve
Some more UI / UX improvements to the mod downloader!
2022-09-07 08:27:11 -03:00
flow
8e3f5c3305
Merge pull request #966 from flowln/refactor_tasks
Reduce code duplication in tasks, fix some bugs and add some tests
2022-09-07 08:26:28 -03:00
timoreo
4817f0312d
Fixed up a warning
Signed-off-by: timoreo <contact@timoreo.fr>
2022-09-06 14:32:19 +02:00
Sefa Eyeoglu
b70a82c609
Merge pull request #1111 from PolyMC/revert-1067-classpath-epicness 2022-09-05 20:06:33 +02:00
Sefa Eyeoglu
25d1e0c4e6
Merge pull request #1107 from DioEgizio/smaller-about 2022-09-05 17:52:16 +02:00
Sefa Eyeoglu
8e3356f11a
Merge pull request #1034 from Scrumplex/detect-performance-features 2022-09-05 17:45:17 +02:00
Sefa Eyeoglu
1b559c7776
Revert "Move classpath definition into NewLaunch itself"
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-09-05 17:37:10 +02:00
DioEgizio
d5583f0f02 make the about dialog smaller
Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
2022-09-04 14:32:33 +02:00
flow
bedd3c50b6
fix: improve handling of unrecognized pack formats
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 15:05:23 -03:00
flow
43a7af3f44
fix: removing mods with their metadata as well
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:23 -03:00
flow
9db27c6acc
fix: crash when adding resource packs directly in the folder
This fixes an issue in which, when adding a new resource pack externally
to PolyMC, when the resource pack view was open, would crash poly.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
42c81395b3
fix: race condition on ResourceFolderModel tests
This (hopefully) fixes the race contiditions that sometimes got
triggered in tests.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
3b13e692d2
feat: move resource pack images to QPixmapCache
This takes care of evicting entries when the cache gets too big for us,
so we can add new entries without much worries.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
0331f5a1eb
feat(tests): add tests for resource pack parsing
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
8a7e117f6b
refactor: move resource pack file parsing utilities to separate namespace
This makes it easier to use that logic in other contexts.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
9b984cedac
feat: add image from pack.png to resource packs
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:22 -03:00
flow
dd9e30b24a
feat: add resource icon to InfoFrame
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
6a93688b2e
fix: filtering in regex search in resource packs
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
3ab17a97a8
fix: sorting by pack format
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
f21ae66265
feat: add basic resource pack parsing of pack.mcmeta
This parses the pack format ID and the description from the local file,
from both a ZIP and a folder, and hooks it into the model.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
afa1a5e932
feat: modify InfoFrame and ResourcePackPage to show ResourcePack info
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
050768c266
feat: add more resource pack info
Adds pack format id and description to ResourcePack, that'll be parsed
from pack.mcmeta.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:21 -03:00
flow
cda2bfc240
feat: allow specifying factory for resources in BasicFolderLoadTask
This allows us to hook our own resource type, that possibly has more
content than the base Resource, to it.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-09-03 13:37:20 -03:00
Sefa Eyeoglu
2f167b1512
Merge pull request #1095 from flowln/ensure_file_path_in_override 2022-09-01 09:54:22 +02:00
flow
ba3ac85356
Merge pull request #1067 from Scrumplex/classpath-epicness
Move classpath definition into NewLaunch itself
2022-08-31 18:28:29 -03:00
flow
ec29cedeb7
Merge pull request #1080 from flowln/eternal_cache
Never invalidate libraries cache entries by time elapsed
2022-08-31 18:28:07 -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
7b6d269904
refactor: make NetJob inherit from ConcurrentTask as well!
Avoids lots of code duplication

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
flow
3f4e55be4f
fix: ensure destination file paths exist when overriding folders
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 16:28:23 -03:00
flow
2186b134a4
fix: Mod type enum -> Resource type enum
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-28 14:47:52 -03:00
Sefa Eyeoglu
f371ec210c
Merge pull request #1052 from flowln/resource_model 2022-08-28 16:52:53 +02:00
Sefa Eyeoglu
afcd669d2f
Merge pull request #965 from flowln/fat_files_in_memory
Refactor a bit EnsureMetadataTask and calculate hashes in a incremental manner
2022-08-28 11:03:12 +02:00
DioEgizio
13184eb8e9 fix: fix urls on ftb legacy
Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
2022-08-24 12:31:38 +02:00
flow
ddf1e1ccee
fix: make FML libraries cache eternal
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-21 13:47:49 -03:00
flow
5ac4e73697
fix: make libraries cache eternal
This restores the behavior prior to PR #920.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-21 13:47:49 -03:00
flow
6be59b53f1
feat: add eternal cache entries
Those are entries that don't get stale over time, so we don't invalidate
them if they 'expire'.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-21 13:47:49 -03:00
flow
0b81b283bf
fix: LGTM warnings
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:56 -03:00
flow
e2ab2aea32
change: add enable/disable to resources
TIL that zip resource packs, when disabled, actually have the effect of
not showing up in the game at all. Since this can be useful to someone,
I moved the logic for it to the resources.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:54 -03:00
flow
c3ceefbafb
refactor+fix: add new tests for Resource models and fix issues
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:49:23 -03:00
flow
e7cf9932a9
refactor: simplify Mod structure
No need to keep track of pointers left and right. A single one already
gives enough headaches!

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:51 -03:00
flow
0c9d03f5df
fix(tests): add timeout on ModFolderModel's tests
If the update never ends, the signal is not emitted and we become stuck
in the event loop forever. So a very lenient timer is added to prevent
that.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:01 -03:00
flow
92aa24ae34
fix: don't give shared pointer to obj. external to the model
It causes some weird problems and adds refcounting overhead.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:48:00 -03:00
flow
97a74d5c1f
refactor: adapt rest of the codebase to the new resource model
In order to access the ModFolderModel from the ModFolderPage, i created
a new m_model for the correct type, shadowing the m_model of type
ResourceFolderModel. This creates two shared_ptr references to the same object,
but since they will have the same lifetime, it doesn't generate a memory
leak.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:58 -03:00
flow
256f8094f5
refactor: make Resource Pack model inherit from ResourceFolderModel
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:11 -03:00
flow
1e2f0ab308
refactor: move more tied logic to model and move logic to the resources
This moves the QSortFilterProxyModel to the resource model files,
acessible via a factory method, and moves the sorting and filtering to
the objects themselves, decoupling the code a bit.

This also adds a basic implementation of methods in the
ResourceFolderModel, simplifying the process of constructing a new model
from it.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:47:08 -03:00
flow
af2cf2734d
refactor: move things around in the mod model
Makes the method order in the cpp file the same as in the header file.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:46:33 -03:00
flow
ec62d8e973
refactor: move general code from mod model to its own model
This aims to continue decoupling other types of resources (e.g. resource
packs, shader packs, etc) from mods, so that we don't have to
continuously watch our backs for changes to one of them affecting the
others.

To do so, this creates a more general list model for resources, based on
the mods one, that allows you to extend it with functionality for other
resources.

I had to do some template and preprocessor stuff to get around the
QObject limitation of not allowing templated classes, so that's sadge :c

On the other hand, I tried cleaning up most general-purpose code in the
mod model, and added some documentation, because it looks nice :D

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:45:01 -03:00
flow
3225f514f6
refactor: move general info from Mod to Resource
This allows us to create other resources that are not Mods, but can
still share a significant portion of code.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-20 10:41:59 -03: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
Sefa Eyeoglu
afb9ebcd99
fix: distinguish Coremods
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-20 12:53:13 +02:00
Sefa Eyeoglu
92d7e44525
Merge pull request #878 from flowln/lazy_settings 2022-08-20 12:50:56 +02:00
Sefa Eyeoglu
a517f442ea
Merge pull request #1023 from flowln/better_shared_ptr 2022-08-20 12:50:50 +02:00
Sefa Eyeoglu
311758233b
Merge pull request #1044 from flowln/better_orphan_fix 2022-08-20 12:50:43 +02:00
Sefa Eyeoglu
6e086eb808
Merge pull request #992 from Scrumplex/refactor-version 2022-08-20 12:50:25 +02:00
Sefa Eyeoglu
7e8644430c
Merge pull request #1007 from Gingeh/disable-update-button 2022-08-20 12:50:19 +02:00
Sefa Eyeoglu
70a8f6743a
Merge pull request #919 from kumquat-ir/download-all-blocked 2022-08-20 12:50:01 +02:00
Sefa Eyeoglu
d5a2185030
Merge pull request #1068 from TayouVR/improvedWindowsJavaCheck 2022-08-19 14:26:36 +02:00
Tayou
26f31e9288
use qEnvironmentVariable instead of qgetenv in JavaUtils
Signed-off-by: Tayou <tayou@gmx.net>
2022-08-18 23:59:35 +02:00
Sefa Eyeoglu
e654e66839
Merge pull request #1049 from flowln/waiting_for_news_-_- 2022-08-18 22:53:41 +02:00
Tayou
bb4861cf0d check for java installs in PATH on windows
this should find java installs from scoop as well as any other installer, that registers java in the PATH environment variable.

Signed-off-by: Tayou <tayou@gmx.net>
2022-08-18 18:24:32 +02:00
Sefa Eyeoglu
01505910f4
refactor: move classpath definition into NewLaunch itself
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-18 18:14:01 +02:00
Sefa Eyeoglu
ab766a0598
Merge pull request #968 from magneticflux-/utf8-logging
Decode process lines as UTF-8
2022-08-18 10:44:01 +02:00
Mitchell Skaggs
3c4b45c9e7
Use C locale codec for decoding
This should correctly decode multi-byte non-UTF-8 text, such as Windows-936 (Simplified Chinese)

Signed-off-by: Mitchell Skaggs <skaggsm333@gmail.com>
2022-08-13 10:39:05 -05:00
flow
93507a263b
fix: hide 'More news...' button if the news aren't loaded yet
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-12 17:41:11 -03:00
Sefa Eyeoglu
1175461030
refactor: switch to new versioning scheme
The new versioning system is based on the versioning system used by the
GNOME Foundation for the GNOME desktop.

We are dropping the "major version" as defined by SemVer and move to a
version number with a most and least significant number.

The most significant number must be incremented, if there are new
features or significant changes since last major release.

Otherwise, the least significant number must be incremented, if there
are only minor changes since the last release. New features or
significant changes mustn't be introduced by a bump of the least
significant number.

If a minor change would introduce small user-facing changes (like a
message-box or slight UI changes), it could still be classified as a
minor change.
At the end of the day, a human shall decide, if a change is minor or
significant, as there is no clear line that would separate a "minor" and
a "significant" change in a GUI-application.

Definitions:

feature: New user-facing functionality
significant change: Something that changes user-facing behavior
minor change: Something that fixes unexpected behavior

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-12 14:22:24 +02:00
flow
2f5e55bea0
fix: only remove orphaned metadata on first opening
This avoids deleting the metadata while one is updating their mods.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-11 13:11:56 -03:00
timoreo
c375e7b4df
Merge pull request #897 from jamierocks/atl-updating-initial 2022-08-11 08:50:05 +02:00
timoreo
5d188c69ed
Merge pull request #1039 from budak7273/fix-world-safety-nag-title-text 2022-08-11 07:33:13 +02:00
timoreo
1a5986abe0
Merge pull request #920 from flowln/metacache_fix 2022-08-11 07:32:43 +02:00
Robb
cebac3c10e
Make new title strings translatable
Signed-off-by: Robb <computerguy440+gh@gmail.com>
2022-08-10 12:07:24 -05:00
timoreo
a5da3db966
Merge pull request #1018 from Scrumplex/fix-infinite-auth-loop 2022-08-10 18:14:26 +02:00
Robb
cd30f75173
fix: Make world safety nag title text match the action being performed instead of always saying 'Copy World'
Signed-off-by: Robb <computerguy440+gh@gmail.com>
2022-08-09 16:01:21 -05:00
Mitchell Skaggs
94df4ceb36
Fix use of Qt 5.14 enum
Signed-off-by: Mitchell Skaggs <skaggsm333@gmail.com>
2022-08-09 00:17:53 -05:00
Mitchell Skaggs
a14476c5fb
Replace local 8-bit decoding with UTF-8 decoding
Handles incomplete byte sequences using `QTextDecoder`

Signed-off-by: Mitchell Skaggs <skaggsm333@gmail.com>
2022-08-08 23:54:01 -05:00
Sefa Eyeoglu
d82bb29919
fix: don't apply GameMode/MangoHud, if they aren't supported
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:19:46 +02:00
Sefa Eyeoglu
33af0c6a7c
refactor: don't include mangohud's library path
This could cause issues on some environments. Users should just put
MangoHud libs into global LD_LIBRARY_PATH, just like with any other
library

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:16:37 +02:00
Sefa Eyeoglu
68f3f98bc3
feat: detect GameMode and MangoHud's presence
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:16:37 +02:00
Sefa Eyeoglu
f873cd5b1a
refactor: store current capabilities
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-08 21:16:37 +02:00
flow
7b27f200b1
fix: don't mutate QHash while iterating over it
Even though it was using a QMutableHashIterator, sometimes it didn't
work quite well, so this is a bit better.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-05 16:30:12 -03:00
flow
f4b207220c
fix: add some more nullptr checks / protection
die sigsegv 🔫

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-05 15:10:44 -03:00
flow
d835e1d14e
refactor: simplify smart pointers more
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-05 11:38:46 -03:00
flow
75f92de8f8
Merge pull request #1017 from flowln/kill_orphan_metadata
Remove orphaned metadata to avoid problems with auto-updating instances
2022-08-04 12:57:20 -07:00
flow
362ecdb583
refactor+fix: use QSharedPointer for shared_qobject_ptr
Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-04 15:33:51 -03:00
Sefa Eyeoglu
355762aa30
fix: emit abort in LaunchController
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-04 10:07:36 +02:00
Sefa Eyeoglu
be4fb65470
fix: Add root path detection on OpenBSD
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-03 21:14:32 +02:00
Sefa Eyeoglu
4ed296bad4
fix: allow user to interrupt launch after 3 tries
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2022-08-03 20:38:40 +02:00
Gingeh
a8aa862919 Move large condition into a new lambda
Signed-off-by: Gingeh <39150378+Gingeh@users.noreply.github.com>
2022-08-03 16:39:30 +10:00
flow
31ba1de53b
fix: remove orphaned metadata to avoid problems with auto-updating insts
Just as my master has taught me. 🔫

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-02 16:15:39 -03:00
Gingeh
f33b31e048 Check for running instance when re-opening the mod folder page and when selecting mods
Signed-off-by: Gingeh <39150378+Gingeh@users.noreply.github.com>
2022-08-02 14:14:45 +10:00
Gingeh
0d10ebb7ca Update launcher/ui/pages/instance/ModFolderPage.h
Co-authored-by: flow <flowlnlnln@gmail.com>
Signed-off-by: Gingeh <39150378+Gingeh@users.noreply.github.com>
2022-08-02 12:50:25 +10:00
flow
4a8abc948e
fix: prevent segfault due to callbacks into deleted objects
Since network requests are, for the most part, asynchronous, there's a
chance a request only comes through after the request sender has already
been deleted.

This adds a global (read static) hash table relating models for the mod
downloader to their status (true = alive, false = destroyed). It is a
bit of a hack, but I couldn't come up with a better way of doing this.

To reproduce the issue before this commit: scroll really quickly through
CF mods, to trigger network requests for their versions and description.
Then, in the middle of it close the mod downloader. Sometimes this will
create a crash.

Signed-off-by: flow <flowlnlnln@gmail.com>
2022-08-01 18:34:15 -03:00
Gingeh
77b640b76b Disable "Check for Updates" and "Download Mods" while the game is running
Signed-off-by: Gingeh <39150378+Gingeh@users.noreply.github.com>
2022-08-01 20:56:05 +10:00