Commit Graph

32 Commits (master)

Author SHA1 Message Date
Evil Eye d88ddc97cc Avoid an apparent compiler error in MSVC 2019 2 months ago
Alexei Kotov eea916a43d Save/load INI importer flags in the launcher (#8189) 2 months ago
AnyOldName3 31c84e0407 We don't need to capture constexpr stuff 2 months ago
AnyOldName3 b596902329 c a p i t u l a t e
Looks like I forgot to reformat after a typo fix.
2 months ago
AnyOldName3 c2b383ea92 Store original representation of paths in content lists
Also compare against existing content lists in a more forgiving way.

The first improvement makes it possible to use relative paths in openmw.cfg without the launcher canonicalising them.
This was really annoying if you used a relative path on purpose.
It also stops the launcher converting all paths to Qt's convention, where forward slashes are used on Windows even though they're not native.
The engine doesn't care, so you could always put either in the config file, but the launcher wouldn't stand for that, and would make them match.

To make this work, we need to store a path's originalRepresentation in the content list, compare paths loaded from openmw.cfg based on their originalRepresentation, and convert paths from originalRepresentation to absolute value when loading them from a content list.

The second improvement means that paths that are equivalent, but expressed differently (e.g. mismatched case on Windows, mismatched separators on Windows, or mild differences like unnecessary `./`es and doubled separators) don't trigger the creation of a new effectively-identical content list.

To make this work, we had to switch the comparison to lexicaly normalise the path first.
It could only be lexical normalisation as originalRepresentation might be absolute, relative, or absolute-but-based-on-a-path-slug, and we didn't want slugs to break things or relative paths to count as equivalent to absolute ones that refer to the same file.
The comparison is case-insensitive on Windows, and case-sensitive elsewhere.
This isn't strictly right, as you can have case-sensitive things mounted on Windows or tell a Linux directory to be case-insensitive, but we can't tell when that might happen based on a lexical path as it depends on real directory properties (and might differ for different parts of the path, which is too much hassle to support).
2 months ago
Evil Eye 6d182dcdae Compare content files and archives case insensitively when matching existing profiles 2 months ago
AnyOldName3 decfe75ae5 Don't attempt to continue an outer loop from an inner loop 6 months ago
AnyOldName3 a130ca57a4 Track source of settings
This one's a biggie.

The basic idea's that GameSettings should know:
* what the interpreted value of a setting is, so it can actually be used.
* what the original value the user put in their config was, so it can be put back when the config's saved.
* which path it's processing the openmw.cfg from so relative paths can be resolved correctly.
* whether a setting's a user setting that can be modified, or from one of the other openmw.cfg files that can't necessarily be modified.

This had fairly wide-reaching implications.

The first is that paths are resolved properly in cases where they previously wouldn't have been.
Without this commit, if the launcher saw a relative path in an openmw.cfg, it'd be resolved relative to the process' working directory (which we always set to the binary directory for reasons I won't get into).
That's not what the engine does, so is bad.
It's also not something a user's likely to suspect.
This mess is no longer a problem as paths are resolved correctly when they're loaded instead of on demand when they're used by whatever uses them.

Another problem was that if paths used slugs like ?userconfig? would be written back to openmw.cfg with the slugs replaced, which defeats the object of using the slugs.
This is also fixed.

Tracking which settings are user settings and which are in a non-editable openmw.cfg allows the launcher to grey out rows so they can't be edited (which is sensible as they can't be edited on-disk) while still being aware of content files that are provided by non-user data directories etc.
This is done in a pretty straightforward way for the data directories and fallback-archives, as those bits of UI are basic, but it's more complicated for content files as that uses a nmodel/view approach and has a lot more moving parts.
Thankfully, I'd already implemented that when dealing with builtin.omwscripts, so it just needed wiring up.

One more thing of note is that I made the SettingValue struct storable as a QVariant so it could be attached to the UI widgets as userdata, and then I could just grab the original representation and use it instead of needing any complicated mapping from display value to on-disk value.
10 months ago
AnyOldName3 f476301670 There's no such thing as the global data directory
That's what resources/vfs is for.
10 months ago
elsid e92ada09af
Replace QRegExp by QRegularExpression 2 years ago
elsid cf75363290
Typed launcher settings
QMultiMap is not clear about what settings exist and it's not efficient way to
access them after they are loaded.
2 years ago
Andrei Kortunov ee9ab8d393 Use STL-style iterators instead of Java-style ones 2 years ago
jvoisin c90d22f3b2 Replace usage of QRegularExpression::anchoredPattern with `^` and `$`
Using `^` and `$` is shorter than `QRegularExpression::anchoredPattern`,
and even allows us in one case to get rid of a trailing `.*`.
2 years ago
Andrei Kortunov 307a60e87c Migrate from QRegExp to more modern QRegularExpression 2 years ago
elsid 843753da14
Remove unused includes 2 years ago
Project579 5cf2a958eb Make conversions between std::chrono time_point and string safer by not using "localtime" directly. 2 years ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
Project579 ca14fc00dc Added dedicated functions for conversions between QString and std::filesystem::path. 2 years ago
Project579 c226b35f1f Fix some remaining encoding errors due to std::filesystem transition. 2 years ago
Project579 a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2 years ago
Project579 e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2 years ago
jvoisin 6feb92a9bf Remove boost::filesystem from a couple of files 3 years ago
fredzio b88d32ff5b Add 3 tabs in the "Data Files" page
1 with the data directories
2 with the BSA archives
3 with the content selector

When user select a directory to be added, first we walk the directory
hierarchy to make a list of all potential data= entries. If we find
none, the selected directory is added.

If more than one data directory is found, user is presented with a
directory list to check which one(s) are to be added.

Directories containing one or more content file are marked with an icon.

data= and fallback-archive= lines are handled like content= lines:
- they are part of the profile in launcher.cfg, prefixed by the profile
name
- they are updated in openmw.cfg when profile is selected / created

Directories can be moved in the list by drag and drop or by buttons.
Insertion is possible anywhere in the list.
Global data path and data local are shown but are greyed out, as they
are always included.

No attempt is made to ensure that the user choice are valid
(dependencies, overwrite of content).

After a profile is loaded, any added content is highlighted in green.
3 years ago
fredzio dbdd397716 Remove deadcode. 4 years ago
Bret Curtis e51ca542d4 components/config cleanup 4 years ago
Andrei Kortunov 487bfed672 Use QMultiMap instead of QMap 5 years ago
elsid 045ceeac11
Replace foreach macro by for-loop 5 years ago
cfcohen 67c4b17581 Commit files that I thought wre in the previous commit. :-[ I'm
accustomed to the hg behavior of commiting all modified files by
default.
9 years ago
dteviot accc078e0e Morrowind.ini import progress bar. (Fixes #2344)
1. Show a "bouncing ball" Progress bar when importing from morrowind.ini.
2. Removed dialog that asks for content list name when import game files from morrowind.ini. Instead, name is time stamp.
3. Removed commented out code.
4. Additional bugfix. No longer create a empty content list when OpenMW.cfg has no content files.
10 years ago
dteviot 05b89be8bf Launcher sets content list to match values in openmw.cfg (Fixes #811)
I took the liberty to add accessor & mutator functions for classes ContentListsGameSettings and LauncherSettings , as existing code can reverse order of entries.
Also replaced some "magic strings" with named constants.
10 years ago
pvdk 21c406316f Working on the Settings tab: start the importer/wizard 11 years ago
pvdk 095ff4e17a Moved launcher settings stuff into components, so they can be reused in the wizard 11 years ago