1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-16 16:10:58 +00:00
Commit Graph

89 Commits

Author SHA1 Message Date
Evil Eye
d88ddc97cc Avoid an apparent compiler error in MSVC 2019 2024-11-11 17:54:48 +01:00
Alexei Kotov
5d37cb3b74 Exterminate script blacklisting (#8214) 2024-10-31 14:59:55 +03:00
Alexei Kotov
eea916a43d Save/load INI importer flags in the launcher (#8189) 2024-10-27 21:30:23 +03:00
AnyOldName3
31c84e0407 We don't need to capture constexpr stuff 2024-10-25 00:49:46 +00:00
AnyOldName3
7640b6bcf4 Typo 2024-10-25 00:32:12 +00:00
AnyOldName3
b596902329 c a p i t u l a t e
Looks like I forgot to reformat after a typo fix.
2024-10-25 00:53:27 +01:00
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).
2024-10-25 00:49:59 +01:00
Evil Eye
6d182dcdae Compare content files and archives case insensitively when matching existing profiles 2024-10-21 19:42:37 +02:00
AnyOldName3
cd7941dc9f Some launcher fixes
I tried to fix https://gitlab.com/OpenMW/openmw/-/issues/8080 by making it so that instead of crashing, we showed an error.

In doing so, I discovered some problems with plugin sorting and the refresh button, like:
* it forgetting the non-user content files somewhere
* nothing guaranteeing that built-in content files stay at the top of the list and them only being there because the first data directory that provides them is usually the first data directory
* it forgetting the non-user content files somewhere else
* it looking like it'd forget any kind of non-user setting under certain circumstances

I fixed those problems too
2024-07-31 00:04:38 +01:00
AnyOldName3
decfe75ae5 Don't attempt to continue an outer loop from an inner loop 2024-06-21 14:05:52 +01:00
AnyOldName3
bb3c22e4a5 Add and register SettingValue stream operators 2024-04-01 00:15:58 +01:00
AnyOldName3
a06ab94a20 Canonicalise resolved representation of data directories 2024-03-15 00:42:15 +00:00
AnyOldName3
36f5c819bb capitulate 2024-03-07 01:48:16 +00:00
AnyOldName3
243b5b6666 Hopefully convince the old MSVC version on GitLab CI to work
The old code was legal, and the things it did worked in other places, so should have worked here, too.

Hopefully just rearranging stuff convinces what I assume to be a compiler bug to not happen.
2024-03-06 23:52:16 +00:00
AnyOldName3
ed23f48754 Actually erase the things we're removing
Caused by bad copy and paste
2024-03-06 23:44:24 +00:00
AnyOldName3
bf24bb71b1 Explicitly use std::strong_ordering
Otherwise it's ambiguous how to build <=> from <, == and >
2024-03-06 01:23:51 +00:00
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.
2024-03-06 00:36:13 +00:00
AnyOldName3
b8cb757ca4 Oopsie 2024-02-29 00:01:14 +00:00
AnyOldName3
9e1334cc09 Resync composing and path openmw.cfg settings with options.cpp 2024-02-28 23:49:55 +00:00
AnyOldName3
f476301670 There's no such thing as the global data directory
That's what resources/vfs is for.
2024-02-27 14:11:48 +00:00
AnyOldName3
7d28788aee data-local is already unquoted when it's read 2024-02-27 02:14:31 +00:00
AnyOldName3
dbdecfe94b Use approved safety comment for path escaping explanation
I thought I'd got this one already
2024-02-27 01:41:12 +00:00
AnyOldName3
90966ecc47 Handle replace= lines properly in the launcher 2024-02-27 01:39:49 +00:00
Andrei Kortunov
87c9f395f1 Move local variables in components 2024-01-19 16:01:48 +04:00
elsid
f6fce5ee15
Cleanup includes 2023-07-08 11:28:56 +02:00
AnyOldName3
106dbba086 Restore and clarify comments damaged by !2971 2023-07-07 13:05:48 +00:00
Bret Curtis
0db31207dc remove remaining boost::filesystem cruft 2023-04-25 16:15:04 +02:00
Petr Mikheev
0769e3daf0 Fix #7294 (launcher creates new contentlist everytime) 2023-03-26 20:12:20 +02:00
elsid
9815f930d9
Setup launcher configuration manager and logging before initializing UI 2023-03-21 21:29:57 +01:00
elsid
e92ada09af
Replace QRegExp by QRegularExpression 2023-02-05 13:30:26 +01:00
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.
2023-01-27 12:42:05 +01:00
elsid
dd89403df0
Move ensureUtf8Encoding to named namespace
To follow https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#sf21-dont-use-an-unnamed-anonymous-namespace-in-a-header

Add QtGlobal include to define QT_VERSION and QT_VERSION_CHECK macroses before
they're used.
2023-01-18 22:58:35 +01:00
Andrei Kortunov
ee9ab8d393 Use STL-style iterators instead of Java-style ones 2023-01-15 20:23:18 +04:00
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 `.*`.
2023-01-12 22:52:00 +01:00
Andrei Kortunov
bfcbc2350d Handle UTF-8 in Qt streams in the Qt6-compatible way 2023-01-12 15:39:50 +04:00
Andrei Kortunov
307a60e87c Migrate from QRegExp to more modern QRegularExpression 2023-01-11 11:21:46 +04:00
elsid
843753da14
Remove unused includes 2022-10-09 16:44:18 +02:00
Project579
5cf2a958eb Make conversions between std::chrono time_point and string safer by not using "localtime" directly. 2022-09-24 21:47:27 +02:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
Project579
ca14fc00dc Added dedicated functions for conversions between QString and std::filesystem::path. 2022-09-11 14:41:21 +02:00
Project579
c226b35f1f Fix some remaining encoding errors due to std::filesystem transition. 2022-09-11 14:41:20 +02:00
Project579
a13709c510 Replace implicit convertions from std::filesystem::path to std::string with correctly converting functions. 2022-09-11 14:41:20 +02:00
Project579
e5c417c968 Make sure all paths are passed as std::filesystem::path instead of std::string where possible. 2022-09-11 14:41:15 +02:00
Project579
35fe214588 Updated components/misc/timeconvert.hpp to fix the Android build. 2022-09-11 02:20:01 +02:00
Project579
5446571aec Circumvent QT MOC bugs by including the filesystem header in a specific order. 2022-09-11 02:19:07 +02:00
Project579
4bb07282c9 Replace all remaining occurrences of boost::filesystem with std::filesystem. 2022-09-11 02:19:00 +02:00
Andrei Kortunov
e3ad30a517 Do not copy data when it is not needed 2022-08-15 11:52:09 +04:00
Evil Eye
c081b8cfa9 Don't load content entries from global and local configs 2022-06-30 20:57:51 +02:00
jvoisin
8b9ed57348 Clean up Qt includes 2022-06-17 11:56:54 +02:00
jvoisin
6feb92a9bf Remove boost::filesystem from a couple of files 2022-05-24 21:18:21 +00:00