Commit graph

21 commits

Author SHA1 Message Date
Vadim Peretokin
61c2afd406
Fix an empty XDG config directory hiding every profile (#9712)
#### Brief overview of PR changes/additions

- An empty `$XDG_CONFIG_HOME/mudlet` silently beat a populated
`~/.config/mudlet`, so a stray `mkdir` hid every profile and Mudlet ran
its first-launch onboarding as though the user were new. It also stuck:
the first such launch wrote `Mudlet.ini` into that directory, which then
kept it winning.
- The two candidate roots are now ranked (`profiles/` > `Mudlet.ini` >
exists > absent) and the stronger claim wins, with
`$XDG_CONFIG_HOME/mudlet` taking ties so a fresh install and a
deliberate opt-in both still land there. A directory that cannot be
listed counts as populated rather than empty, so a permission bit cannot
re-enter the bug.
- Creating `profiles/` is now the opt-in a test harness uses; the
`mudlet` directory alone is not, because other tooling creates that by
accident. Where both roots hold profiles, `setupConfig()` names the one
it is ignoring instead of leaving those profiles apparently gone.

#### Motivation for adding to Mudlet

Data-loss-shaped regression from #9552 "improve: honor XDG_CONFIG_HOME
for Mudlet's config directory" (`e6c268cb0`). The profiles are orphaned
rather than destroyed, but a returning user sees "5.0 wiped my
profiles". `src/mudlet-lua/tests/README.md` itself instructed `mkdir -p
"$CONFIG_DIR/mudlet"`, so following Mudlet's own test docs triggered it.

#### Other info (issues closed, discussion etc)

Test case: create `~/.config/mudlet/profiles/{AlphaGame,BetaGame}`,
`mkdir -p $XDG_CONFIG_HOME/mudlet`, launch. Before: no profiles and the
onboarding dialog. After: both profiles listed.

`ConfigDirOverrideTest` covers the resolution table including the sticky
`Mudlet.ini` state, both-populated, symlinked and unreadable
directories; each new guard was mutation-checked. The busted suite
passes 2422/0 against an isolated `$XDG_CONFIG_HOME/mudlet/profiles`
root.

Not fixed here, and pre-existing rather than 5.0 regressions:
`CredentialManager` stores passwords and the OAuth reconnect token under
`AppConfigLocation` while the config root is `confPath`, so exporting
`XDG_CONFIG_HOME` strands them, and the plaintext-password migration
reads one path, writes the other and deletes the original. Both
reproduce identically on the 4.22.0 binary and need their own migration
path.

Assisted-by: Claude:claude-opus-5
2026-08-10 22:17:09 +02:00
Vadim Peretokin
c0e1fac7cb
fix: profile close during a map operation, Discord presence truncation, and interrupting ttsSpeak() (#9686)
#### Brief overview of PR changes/additions
- Closing a profile no longer frees the map out from under a running
import, export or download. `TMap` counts the operations that pump
`qApp->processEvents()`, and `mudlet::closeHost()` - which one of those
pumps is what delivers it - stops the operation and destroys the `Host`
once it has unwound, instead of half way through it.
- Discord presence fields keep their last character and are only ever
cut between characters: each buffer is now the documented limit plus
room for its terminator, and a new `utils::copyUtf8String()` walks the
cut back to a character boundary.
- An interrupting `ttsSpeak()` announces the utterance it starts, and
the `Ready` an engine reports for the utterance it cut off no longer
drains `ttsQueue()` over the top of the one the script asked for.

#### Motivation for adding to Mudlet
Each is a filed defect, and each was reproduced before it was fixed. The
map one is a use-after-free: ASan reports `heap-use-after-free` inside
`TMap::readJsonMapFile()`, freed by `~TMap` <- `~Host` <-
`HostManager::deleteHost` <- `mudlet::closeHost` delivered by the
import's own `processEvents()`. The Discord one is worse than one field
looking wrong: a single over-long non-ASCII field makes the whole
`SET_ACTIVITY` payload undecodable, so the entire presence update is
discarded - the fake Discord client recorded exactly that. The TTS one
silently drops speech: `ttsQueue()` plus an interrupting `ttsSpeak()`
speaks the queued line and never speaks the requested one.

#### Other info (issues closed, discussion etc)
Closes #9520, closes #9634, closes #9659.

`MapCloseDuringImportTest` stages the close through
`mudlet::slot_closeProfileByName()` and lets the map operation's own
pump deliver it; the functional tests build with ASan, so the pre-fix
run is a sanitizer report rather than an inference.
`TtsInterruptingSpeakTest` hands `ttsStateChanged()` the `Ready` a real
engine sends, which Qt's mock engine never does - the mock-visible half
is pinned in `Media_spec.lua`, where the two specs that recorded the old
behaviour are updated. `Discord_spec.lua` gains four end-to-end specs
against `CI/discord-ipc-fixture.py` asserting that the captured frame
still decodes as JSON and that a field is cut on a character boundary,
and `DiscordTest.cpp` covers the same at unit level. Every new or
changed test was confirmed to fail without its fix.

Two things deliberately left alone, both older than this PR:
`Host::requestClose()` still runs nested inside the map operation's pump
(it saves the profile there), and an XML import or a map download has no
cancel to poll, so a close waits for it rather than stopping it.

**Test case:** Export a large map with `exportJsonMap()` and close the
profile's tab while it runs; then `setDiscordDetail(string.rep("ä",
65))` and confirm the presence still updates; then `ttsQueue("queued
line") ttsSpeak("first")` followed immediately by `ttsSpeak("second")`
and confirm "second" is what gets spoken.

Assisted-by: Claude:claude-opus-5
2026-08-07 06:10:42 +02:00
Vadim Peretokin
6c991a1708
infrastructure: make windows safe to destroy while a field has the text cursor (#9596)
#### Brief overview of PR changes/additions
- New `utils::disconnectChildSignals()`, called by the destructors of
the connection dialog, the preferences and the editor: a window stops
listening to its own widgets before it goes away.
- Covers the reported case (connection dialog `Profile name` field) plus
the same exposure found in the preferences (MMCP chat name, shortcut
editors) and the editor (item name, command, pattern and sound file
fields). The preferences and the editor had no destructor at all before
this.
- New `DialogTeardownTest` covering all three windows, plus a canary
that fails if a future Qt stops emitting the focus-out signals the whole
thing rests on.

#### Motivation for adding to Mudlet
Destroying one of these windows while the text cursor sits in one of its
fields aborts the run - which is how #9574 turned up, in a functional
test - and the windows should simply be safe to destroy, rather than
safe only along the `close()` paths that happen to hide them first.

#### Other info (issues closed, discussion etc)
Closes #9574.

The mechanism: a visible window is taken off the screen while its
base-class destructors unwind (`~QDialog` hides it, `~QWidget` closes
any other window class). That moves the keyboard focus off the field
holding it, the field reports `editingFinished()`, and Qt delivers that
to a slot of an object whose derived part is already gone:

```
ASSERT failure in dlgConnectionProfiles: "Called object is not of the correct type (class destructor may have already run)"
```

**How much of this can a player hit today: as far as I can trace, none
of it**, which is why there are no crash reports behind this:

- Every production teardown goes through `close()` / `accept()` /
`reject()` first, and that hide happens while the object is still whole
- so the field's `editingFinished()` is delivered normally and the edit
is saved, exactly as before. `Host::closeChildren()` closes the editor
that way, `mudlet::closeEvent()` closes the connection dialog that way.
- Nothing `delete`s or `deleteLater()`s these three windows directly.
- At exit `main()` deletes the QApplication, which destroys platform
windows without running widget destructors, so the preferences dialog -
the one window nothing explicitly closes - is never destructed either.
- The assert is a `Q_ASSERT_X`, and since we never set
`CMAKE_BUILD_TYPE`, Qt defines `QT_NO_DEBUG` for our builds and compiles
it out. A shipped build would not abort at that point; it would run the
slot against destroyed members instead, which is undefined behaviour
that can quietly rename a profile or a trigger.

So this is a latent trap rather than a live player crash: it fires today
in the test suite, and it fires the moment any future code destroys one
of these windows while it is on screen. The fix is small enough to be
worth taking on those terms.

Verified with standalone Qt probes: `QLineEdit` emits once anything has
written to it (`setText()` is enough, even with an empty string),
`QAbstractSpinBox` and `QKeySequenceEdit` emit unconditionally, and
plain child widgets such as the editor's `dlg*MainArea` panels are not
exposed - their slots still run while they are alive.

`test/functional_tests/DialogTeardownTest.cpp` is formatted with the
repo's clang-format, which the older tests next to it predate.

**Test case:** `ctest -R DialogTeardownTest`. All three cases abort on
`development` with the assert above and pass here. There is no manual
GUI reproduction - see the tracing above.
2026-08-03 11:40:11 +02:00
Vadim Peretokin
e6c268cb0b
improve: honor XDG_CONFIG_HOME for Mudlet's config directory (#9552)
#### Brief overview of PR changes/additions
- Mudlet now honors `XDG_CONFIG_HOME` (it previously hardcoded
`~/.config/mudlet`): precedence is portable.txt (unchanged) >
`$XDG_CONFIG_HOME/mudlet` when set and absolute > legacy
`~/.config/mudlet`
- Migration guard: users who already export `XDG_CONFIG_HOME` keep their
legacy profiles (a one-time hint explains how to migrate); a stale
pre-4.19 `Mudlet.conf` leftover cannot shadow real profiles
- Test harnesses opt into isolation by pre-creating an empty
`$XDG_CONFIG_HOME/mudlet` - fixes parallel busted runs colliding on the
shared self-test profile's sqlite (locked/readonly flakes) and state
accumulating across runs
- `MUDLET_TEST_FAILURE_MARKER` isolates the shared
`/tmp/busted-tests-failed` marker; new `ConfigDirOverrideTest` (11
cases) locks the resolution table in

#### Motivation for adding to Mudlet
Proper XDG platform behavior on Linux, and hermetic parallel test runs -
proven by A/B: two simultaneous suites sharing one config dir reproduce
the sqlite flakes, isolated dirs run both green (679/0/0 each).

#### Other info (issues closed, discussion etc)

**Test case:** `export XDG_CONFIG_HOME=/tmp/x && mkdir -p /tmp/x/mudlet`
then launch - Mudlet uses `/tmp/x/mudlet`; unset it - Mudlet uses
`~/.config/mudlet` as before; run two busted suites simultaneously with
distinct pre-created XDG dirs - both green.


Assisted-by: Claude:claude-opus-4-8
2026-07-29 09:19:38 +02:00
Vadim Peretokin
282d774956
Fix: cap telnet subnegotiation length to bound memory use (#9440)
#### Brief overview of PR changes/additions
An `IAC SB` (subnegotiation begin) with no matching `IAC SE` grew the
subnegotiation buffer without bound across socket reads (the existing
missing-SE recovery only triggers on an embedded IAC byte). This aborts
a subnegotiation that exceeds 5MB - far larger than any real
GMCP/MSDP/ATCP payload - and recovers.

#### Motivation for adding to Mudlet
Prevents a hostile or broken game server from exhausting memory (a
denial of service).

#### Other info (issues closed, discussion etc)
Found via a source-code audit; no linked issue. The 5MB cap is easily
tunable.

---------

Signed-off-by: Vadim Peretokin <vadim.peretokin@mudlet.org>
2026-07-20 22:45:22 +02:00
Stephen Lyons
fb221e1bae
Fix: Clazy warnings part 6 - use-static-qregularexpression (#9211)
#### Brief overview of PR changes/additions
One of a series of PRs, each addressing a type of issue reported by
Clazy.

This is the: "Don't create temporary `QRegularExpression` objects. Use a
`static QRegularExpression` object instead
[-Wclazy-use-static-qregularexpression]" one.

#### Motivation for adding to Mudlet
Remove warnings detected by the Clazy tool - either when explicitly run
on the Mudlet code-base or detected by the background scanner/analyser
that Qt Creator offers.

#### Other info (issues closed, discussion etc)
A summary I found for this is:
> Creating temporary `QRegularExpression` objects can be inefficient;
it's recommended to use a `static QRegularExpression object` instead to
improve performance. This approach avoids the overhead of recreating the
regex each time it is used.

In the `CredentialManager` class file there were a number of raw
C-string literals that needed to be wrapped in `qsl(`...`)` to mark them
as NOT to be translated. Furthermore the corresponding header file
`CredentialManager.h` was NOT included in the list of header files in
the `./src/CMakeLists.txt` file - so did not show up in - or was
searchable as a project file until it is added by this PR.

---------

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-04-25 12:41:24 +01:00
Stephen Lyons
f7ed7452f6
Fix: correct use of forward declared type items in headers (#9208)
#### Brief overview of PR changes/additions
A number of fixes to remove errors reported during Clazy analysis of the
Mudlet files - such errors prevent getting warnings from such files for
things that are addressed by #9195 and #9196. Generally this required
the movement of method definitions from a header file to the
corresponding class file so that forward declared types/classes were not
used/returned by definitions in the header files.

#### Motivation for adding to Mudlet
Preparing the code-base to allow further investigation of warnings that
Clang-Tidy reports when it can review ALL the files in the Mudlet
sources.

#### Other info (issues closed, discussion etc)
I suspect this will reveal some more warnings of the types in those
other mentioned PRs - in the files that could not be analysed before
because of the errors fixed here.

---------

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2026-04-20 09:59:42 +01:00
Vadim Peretokin
d7cd7cdcea
Infrastructure: Improve code readability with cleaner empty checks (#8755)
#### Brief overview of PR changes/additions

Replace `.size() == 0` / `.size() > 0` comparisons with `.isEmpty()` /
`.empty()` across 3 files.

#### Motivation for adding to Mudlet

Using `.isEmpty()` (Qt) and `.empty()` (STL) is more readable and
idiomatic than size comparisons. Also removed a redundant double-check
(`!x.isEmpty() && x.size() >= 1`).

#### Other info (issues closed, discussion etc)

**Test case:** Build compiles without errors. No behavioral change -
these are semantically equivalent checks.

Files changed:
- `src/ctelnet.cpp`
- `src/TBuffer.cpp`
- `src/utils.h`
-

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-06 14:30:50 +01:00
Vadim Peretokin
9c4395f7c6
Infrastructure: improve safety of internal text handling (#8724)
#### Brief overview of PR changes/additions

Replace C-style string copy functions (`strcpy`/`strncpy`) with safer
`memcpy` + explicit null termination across 5 files. Adds null checks
for memory allocation failures.

#### Motivation for adding to Mudlet

Follows [curl's security
guidance](https://daniel.haxx.se/blog/2025/12/29/no-strcpy-either/) on
eliminating unsafe string functions. Also fixes a latent bug in
`TAlias.cpp` where a dangling pointer could occur from temporary object
lifetimes.

#### Other info (issues closed, discussion etc)

**Test case:** Verify triggers, aliases, and Discord Rich Presence still
work:
1. Create a regex alias (e.g. `^test (.+)$`) and confirm it captures
groups correctly
2. Create a trigger with a filter chain and confirm child triggers match
3. If Discord integration is enabled, verify game status displays in
Discord

No functional changes intended - this is a defensive code quality
improvement.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-06 12:07:25 +01:00
Vadim Peretokin
a3bfcfd031
Add: undo/redo for Mudlet editor (#8469)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Adds undo/redo for Mudlet editor - allows you to undo
adding/changing/deleting triggers, aliases and so on. This PR also adds
visual tests that can be run inside the `Mudlet self-test` profile, and
they are hooked up to run in the CI pipeline automatically. The deletion
confirmation dialog has been itself deleted since we can now undo.
#### Motivation for adding to Mudlet
Long-awaited and often requested feature. Fixes #707 and addresses
#8272.
#### Other info (issues closed, discussion etc)
This test also adds 300+ tests that can be run in the Mudlet self-test
profile (launch it from the CLI using `--profile "Mudlet self-test"`):



https://github.com/user-attachments/assets/f7f10fcc-0129-47f0-ad8c-d54816820d57

/claim #707

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
Co-authored-by: Zooka <136661366+ZookaOnGit@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-11 09:50:15 +05:00
Vadim Peretokin
745c4a5b59
Infrastructure: Remove else-after-return anti-pattern (#8575)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Remove unnecessary else blocks following return statements throughout
the codebase.
#### Motivation for adding to Mudlet
Better code readability 
#### Other info (issues closed, discussion etc)
Other anti patterns are visible in this PR thanks to this, but let's
keep this PR focused on one pattern only.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-25 18:10:28 +01:00
Vadim Peretokin
8cb58cf0ca
Infrastructure: remove MSVC leak detection (#8378)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Remove support for leak detection using MSVC - this functionality hasn't
been in use in a decade, and we're switching to to using
[LeakSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer)
instead.
#### Motivation for adding to Mudlet
Cleaner code.
#### Other info (issues closed, discussion etc)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-21 15:11:09 +01:00
Vadim Peretokin
33f8cb0378
Fix: deprecation warnings not to appear in Qt 6.8.3 (#8368)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Fix deprecation warnings not to appear in Qt 6.8.3 as well as 6.9. While
these functions got properly depricated in 6.9 per Qt documentation, it
seems the warnings for them started to appear in 6.8.3 as well.
#### Motivation for adding to Mudlet
Less noise when compiling.
#### Other info (issues closed, discussion etc)
2025-10-19 01:43:37 +02:00
Mike Conley
b3f10d81c5
Improve: Match detached window menu to main and focus behavior (#8196)
#### Brief overview of PR changes/additions

Transforms detached windows into fully functional independent workspaces
with complete menu systems and proper focus management. When dialogs are
closed, focus now correctly returns to the originating profile tab
instead of jumping to the main window. Also fixes profile management
issues where reconnecting would restore profiles to unexpected window
locations.

#### Motivation for adding to Mudlet

Detached windows were previously limited - users had to constantly
switch back to the main window for most operations and experienced
confusing focus behavior when closing dialogs. Profile management was
also broken, with closed profiles sometimes reappearing in the wrong
window after reconnection. This made multi-profile workflows inefficient
and frustrating.

#### Other info (issues closed, discussion etc)

- **Complete menu system**: Added Games, Toolbox, Options, Window, Help,
and About menus to detached windows with full feature parity
- **Universal focus restoration**: All dialogs (script editors, notepad,
package manager, module manager, preferences, package exporter) now
properly restore focus to the correct profile tab
- **Fixed profile cleanup**: Profiles no longer appear in wrong windows
after disconnection and reconnection
- **Code consolidation**: Eliminated significant duplicate code while
improving maintainability
- **UI consistency**: Added missing options like "Show Connection
Indicators" to main window for parity
- Closes issue #8192 (detached window toolbox accessibility) and #8109
(`Window` menu consistency)

---------

Co-authored-by: Zooka <136661366+ZookaOnGit@users.noreply.github.com>
2025-09-19 00:32:22 +02:00
Vadim Peretokin
aaad5d7bb0
Add: export areas as an image (#8156)
#### Brief overview of PR changes/additions
- Added a right-click option "export an area as an image" on the 2D map
- Adds a Lua API: `lua exportAreaImage(areaID, "picture location", Z
level of the area to export)`
#### Motivation for adding to Mudlet
Long-standing request, fix https://github.com/Mudlet/Mudlet/issues/756
#### Other info (issues closed, discussion etc)


I started on a zoom feature, but couldn't work out how to get room
symbols not to blur at higher zoom - so I'll leave that for someone
else. It's disabled in the Lua API right now.

edit: [Added
documentation](https://wiki.mudlet.org/w/Area_51#exportAreaImage_PR.238156),
and also improved the zLevel parameter to accept `true` - if this is
provided, then all Z levels of an area will be exported. Credit for the
idea to @SlySven.

---------

Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
2025-09-07 09:37:56 +02:00
Stephen Lyons
dd802f042e
Infrastructure: fix C++20 and Qt warnings (#7819)
#### Brief overview of PR changes/additions
* Fix `HostManager::Iter::operator!=` and
`HostManager::Iter::operator==` so the comparison is between equally
`const`-ness items.
* Fix `(slot) T2DMap::slot_setRoomProperties(...)` so that one argument
is handled correctly even if it isn't initialised (or used) - by
changing it from a `bool` to a `std::optional<bool>`.
* Change `(void) T2DMap::mouseMoveEvent(QMouseEvent*)` so that it uses
`(QPointF) QMouseEvent::position()` instead of the deprecated in Qt 6
`(QPointF) QMouseEvent::localPos()`.
* Remove some unused, explicit `this` captures in some lambda functions
where they are not used.
* Switch to the **static** `(QStringList) QFontDatabase::families(...)`
from the deprecated in Qt 6 non-static one.
* Revise some `QDateTime` class usages to avoid warnings for things that
have changed in Qt 6.9.0

#### Motivation for adding to Mudlet
Less warnings during the build process.

#### Other info (issues closed, discussion etc)
There are still five warnings for the third party edbee-lib editor
widget involving "arithmetic between different enumeration types" ...
"is deprecated [-Wdeprecated-enum-enumconversion]".

---------

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-04-27 18:45:09 +01:00
Zooka
7f05b267f5
improve: remove qt5 checks (#7736)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Attempt to remove all obsolete qt5 checks.

#### Motivation for adding to Mudlet
Migrate to qt6.

#### Other info (issues closed, discussion etc)

---------

Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
2025-02-24 06:59:51 +01:00
ConcurrentCrab
d8cd226885
Add portable support (#7375)
/claim #888

#### Brief overview of PR changes/additions

This PR:
- refactors Mudlet initialisation code to use a single source of truth
for config directory paths
- change QSettings storage to an `IniFormat` file in the config
directory and adds migration code from old formats
- adds support for a `<executable_dir>/portable.txt` marker which sets
the config directory to `<executable_dir>/portable`

#### Motivation for adding to Mudlet

This PR teaches Mudlet to store data portably.

#### Usage Instructions

If you're interested in trying out this PR, you can download the CI
builds from the **add-deployment-links** bot below.

There are currently two ways to enable portable mode for Mudlet (in
order of importance):
- You can create an empty `portable.txt` file in the same folder as the
Mudlet executable (or appimage etc.)
- This will tell Mudlet to use a folder named `portable` (in the same
folder as the executable) for its data
- You can create an `~/.config/mudlet/portable.txt` file with its
contents being a path on your filesystem
- This will tell Mudlet to use the path written in the file as the
folder for its data
- e.g. the contents could be `/mount/media/flashdrive/mudlet_data` or
`D:\games\portable\mudlet_data`
- The path can be relative, in which case it will be interpreted
relative to the Mudlet executable's folder
- Mudlet will create _exactly_ one folder, that is, the last part of the
given path, if it doesn't exist already. At least everything up to its
parent folder must exist already or it will lead to an error.
- e.g. if given `D:\games\portable\mudlet_data`, at least
`D:\games\portable` must be an existing folder
- This is to avoid taking unintended input. If you see this error but
this actually is what you want, just create those folders manually

Any errors will result in the issue being printed to stderr and the
program terminating. You probably won't see the error outputs if
launched from GUI so it's recommended to start Mudlet from the terminal.

Ofc when you first launch Mudlet in portable mode, it will start with a
new clean config in the respective folder, just like a new install. If
you wish to migrate your existing config data to be portable:
- You need to launch this build at least once (without any
`portable.txt`)
- This is because it needs to migrate config files from the old format
to the new, portable-friendly one
- Then you can just copy/move your default data directory
`~/.config/mudlet` to wherever you want and use one of the above
`portable.txt`s to point Mudlet to that path.
2024-08-10 14:17:42 +02:00
Geert Konijnendijk
d191ff9f53
Infrastructure: Support both Qt5 & Qt6 in CMake and qmake builds (#6654)
#### Brief overview of PR changes/additions

- Port code to work in both Qt5 & Qt6. 
- Notable exception: playing media for Qt6 (see discussion in
https://github.com/Mudlet/Mudlet/issues/5623#issuecomment-1455052433)
- Add support for Qt6 in CMake files
- Add support for Qt6 in qmake file

#### Motivation for adding to Mudlet

See https://github.com/Mudlet/Mudlet/issues/5623

#### Other info (issues closed, discussion etc)

Closes https://github.com/Mudlet/Mudlet/issues/5623. 

##### Suggested follow-up work
- Add support for Qt6 to Windows build
- Add Qt6 targets to CI
- Implement playing media for Qt6 (see discussion in
https://github.com/Mudlet/Mudlet/issues/5623#issuecomment-1455052433)
- Reimplement gamepad support using a different library as the Qt
gamepad module was [removed ](https://wiki.qt.io/Qt_6.0.0_Modules)in Qt6

---------

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Vadim Peretokin <vperetokin@hey.com>
2023-03-20 07:18:24 +01:00
Stephen Lyons
0671a62dd0
Infrastructure: replace qsl(...) used for Tooltips (#5694)
Specifically when it is used to put HTML like tags around the text so that it
triggers the "rich-text" detector in the Qt libraries so that the tips gets
better formatting than being a single (long) line of plain text.

Whilst working on this PR I also spotted and fixed:
* A couple of raw strings in the `VarUnit` class that should have been
translated (or replaced with a `QString()`) - this required adding the
`Q_DECLARE_TR_FUNCTIONS(`className`)` macro to that class as it is not
derived from the `QObject` class which we normally use to provide the
`QObject::tr(`...`)` method.
* The tooltip for the "Save item" button in the editor contained a
unmatched `<p>`...`</p>` tag pair as well as a useless (as it is ignored
there) `\n` {Line Feed}.
* The tooltip for the "Save profile" button in the editor contained a
unmatched `<p>`...`</p>` tag pair.
* I had previously defined the `QT_NO_CAST_FROM_ASCII` and
`QT_NO_CAST_TO_ASCII` macros in the `dlgRoomExits` class but they are
no longer considered useful for us so I have removed those Qt macros.
* The `utils::richText(`...`)` wraper has exactly the same code effect as
the `(const QString) singleParagraph` helper function in the `dlgRoomExits`
class - so it has been replaced by that.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Vadim Peretokin <vperetokin@gmail.com>
2021-12-26 15:22:05 +00:00
Vadim Peretokin
39a91d3bdf
Infrastructure: Add short qsl macro to stand in for 'QStringLiteral' (#5640) 2021-12-07 06:21:39 +01:00