#### Brief overview of PR changes/additions
Ran clang-format on all 134 CPP files in src/ using the project's
.clang-format config
#### Motivation for adding to Mudlet
Ensures consistent code formatting across the codebase.
#### Other info (issues closed, discussion etc)
None
**Test case:** Build the project and verify it compiles successfully.
#### Brief overview of PR changes/additions
Replaces the deprecated `QSignalMapper` class with modern lambda
functions in the Color Trigger dialog.
#### Motivation for adding to Mudlet
`QSignalMapper` has been deprecated since Qt 5.10 and the codebase had a
TODO comment requesting this modernization.
#### Other info (issues closed, discussion etc)
**Testing instructions:**
1. Open the Trigger Editor
2. Create a new trigger and set its type to "color trigger"
3. Click the foreground or background color button to open the Color
Trigger dialog
4. Verify all 16 basic color buttons (Black through Light White) work
correctly when clicked
5. Confirm the dialog closes and the selected color is applied to the
trigger
Co-authored-by: Claude <noreply@anthropic.com>
<!-- 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>
#### Brief overview of PR changes/additions
Revise some signal names to handled changes made in Qt 5.15 and demanded
(because old named signals have been removed) in Qt 6, for
`QSignalMapper`.
#### Motivation for adding to Mudlet
Prevent error messages and problems with a signal-slot connection not
working for user-actions added to the 2D mapper context menu and the
fore-/back-ground colour selection buttons in colour triggers.
#### Other info (issues closed, discussion etc)
`QSignalMapper` has been depreciated in Qt6 as the functionality it
proved can now be done in C++ lamda functions - however making such
changes requires a firm understanding of how each of them works and in
the meantime it is less complex to just use the functor form of the
`connect(...)` - to replace the obsolete `const char[]` form and to use
the newer names that are supported from Qt version **5.15.0**.
I pointed out this issue in our Discord "#mudlet-development" channel at
[2024/08/03 21:16
UTC](https://canary.discord.com/channels/283581582550237184/283582439002210305/1280637687552020510).
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
#### Motivation for adding to Mudlet
There is supposed to be a label that demonstrates the grey value
selected when the "More colors" button is clicked for a color trigger
item and the 24 position slider is adjusted. This color is also supposed
to be replaced in the foreground or background colour set for the color
trigger and is recorded as part of the details for a color trigger.
#### Brief overview of PR changes/additions
However, a defect in #5328 seems to have been based on the
"slider-value" being passed to `(void)
dlgColorTrigger::slot_grayColorChanged(int)` being in the range 232 to
255 rather than the 0 to 23 that it is. The result is that the QColor
generated from that grey scale part of the ANSI 256 color range is wrong
(invalid). This at least means that the grey color chosen does not show
up in the editor - it also may mean that such color triggers may be
defective and not work as expected.
#### Other info (issues closed, discussion etc)
The previous PR that introduced this bug is over 2 years old - I guess
it was not something that rates more than a **low** priority - but it is
a one-liner to fix! 😀
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
#### Brief overview of PR changes/additions
Update the tr() annotation style, as discussed in #5522
#### Motivation for adding to Mudlet
Makes the code cleaner and also keeps Mudlet in tune with the latest
standards.
#### Other info (issues closed, discussion etc)
/claim #5522
---------
Co-authored-by: TachyonicBytes <support@tachyonicbytes.com>
Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
<!-- Keep the title short & concise so anyone non-technical can
understand it,
the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Mark read-only variables as const - that is, not intended to change
after they've been declared
#### Motivation for adding to Mudlet
So we don't change them by accident later on, and also to clearly state
intentions for the variables
#### Other info (issues closed, discussion etc)
This is also recommended by the [C++ Core
Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es25-declare-an-object-const-or-constexpr-unless-you-want-to-modify-its-value-later-on)
#### Brief overview of PR changes/additions
make variable name more readable
#### Motivation for adding to Mudlet
Improve readability
#### Other info (issues closed, discussion etc)
Fix#6375
Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
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>
This is the edited summary of a squash and merge of 14 commits:
Adds support for SGR Reverse (swap foreground and background colours)
"7"/"27" for On/Off and SGR Overline "53"/"55" for On/Off
Remove unused cruft:
* (void) TTextEdit::drawFrame(QPainter&, const QRect&)
* (void) TTextEdit::updateLastLine
* const QChar cLF & cSPACE in TBuffer (as it happens they are completely
unused and redundant as the enum QChar::SpecialCharacter provides
QChar::LineFeed and QChar::Space to provide the same constants)
* (QTime) TBuffer::mTime
* (void) TConsole::echoUserWindow(const QString&)
* (QPoint) TBuffer::insert(QPoint&, const QString&, int, int, int,
int, int, int, bool, bool, bool, bool)
* (void) TConsole::printDebug(...) functionally the same as one type of
(void) TConsole::print(...) just with a different order of arguments.
Convert #define constants TCHAR_BOLD etc. into a QFLag/enum
TChar::AttributeFlags which is declared and capable of QFlag OR operations.
Refactor a number of methods that take lots of bools and ints as individual
formatting options and colour components to take single
TChar::AttributeFlags and one or two QColors instead.
Remove a large number of (int) colour value component values as member
variables in TBuffer as they are not needed.
Convert highly repetitive intermediate methods to setBold, setItalics etc.
to take a (combinations allowed) TChar::Attribute flag value instead.
Convert 2x3 int as colour components (r,g,b) in TColorTable defined in
TTrigger class to a pair of QColors.
Remove unused QString argument from:
* (void) mudlet::setLink(...)
* (void) TConsole::setLink(...)
Remove unused QColor argument from:
* (inline void) TTextEdit::drawCharacters(...)
Refactor arguments in:
*(QString) TBuffer::bufferToHtml(QPoint P1, QPoint P2,
bool allowedTimestamps, int spacePadding = 0)
to:
(QString) TBuffer::bufferToHtml(const bool showTimeStamp = false,
const int row = -1, const int endColumn = -1,
const int startColumn = 0, int spacePadding = 0)
Convert to const references some method arguments.
Add TBuffer::set[BF]gColor(...) overloads that take a QColor argument.
Add selection state methods select()/deselect()/isSelected() const methods
to TChar class to hide/separate the selection process from the formatting
effect. (TChar::Reverse tracks the ANSI SGR reverse colour attribute and
its effect is EX-ORed with the (bool) TChar::mIsSelected flag).
Add a new tempAnsiColorTrigger lua function that, unlike tempColorTrigger
uses the correct ANSIcolors in the range 0-15 - although the original also
handles the 256 colour range in the 16-255 correctly those first 16 values
are miss-mapped and it is not possible to change them without breakage.
Adds 256-color support to Editor GUI for color triggers - and allows
choosing the default (unmodified) fore or background colors to match one
(the previous did not) and also allows one of the fore or background color
to be ignored so only the other is considered. The ignored color case is
saved in the profile data and can exported but MAY not work in previous
Mudlet versions which cannot handle the value used! It is also reported as
an error to have a color trigger with both fore and background ignored in
both the lua functions and in the GUI.
Also:
Fixed a code structure issue in TLuaInterpreter::debug() which would not
work correctly if there was more than one value on the lua stack to print
out.
This will close issues #477 and #703.
Converted some `QObject::connect` calls to the new Qt5 compile time
version.
Removed an unused `TTrigger*` argument from
`dlgColorTrigger::setupBasicButtons(...)`.
Removed an unused flag:
* `(bool) TConsole::mSaveLayoutRequested
Also spotted some dead code from abandoned attempt to support blinking,
some reordering that a new version of Qt spotted as needed in the TBuffer
and TChar constructor initialisation lists, and a operator precedence item
that could be clarified with an addition pair of `(`...`)`s.
A previous error in the prior PR that this one is attempting to replace
had a problem in HTML generation that I reproduced here and which needed
the same fix (a missing escaped `"` mark).
An upgraded Qt Creator pointed out to me some initiliser list issues in
`TBuffer` and `TConsole`; and some C-style casts in some font settings in
the latter class.
Remove a debugging output line that is not useful now and will be spammy.
Modernise a triplet of QObject::connect(...) calls that will otherwise
clash harder when merged into development after "upgrade-to-qt5-connect"
PR has also been merged into the main branch.
Also:
* add some explanation/help text to the dlgColorTrigger dialog.
* revise the text explaining the formula (232 + grey scale value 0..23)
used for colours from the 24 grey-scale part of the 256 colour range.
* add some tool-tips to parts of the dlgColorTrigger dialog.
* add a generic static method to the mudlet class to provide a consistent
and re-usable "HTML" wrapper around text - which will be particularly
useful for tool-tip generation.
Revise: change colour trigger UI to hide colours 16-255 by default
This follows a suggestion from a peer in the review process.
Update: add Wiki documentation link comment
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
clang-format has an option to sort header #include lines in source code
files - however the `#include "pre_guard.h"` and `#include "post_guard.h"`
includes are position sensitive - they must wrap around Qt's own classes'
includes in our files and they must not be tidied-up/rearranged.
This commit adds the necessary comments that commands clang tools to not
touch these lines.
We had previously done this on the XMLimport class as a test case but
during recent major branch merging operations one of these comments was
lost from the XMLimport.cpp file!
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Found these the hard way - in use - and it meant that one could not specify
a colour trigger to fire on cyan or light white (grey ?) - one of which was
just the colour I needed for a Mud that I had returned to after it had come
back after being off-line for more than six months - I'd always wondered
why I could never get my WoTMUD (now at game.wotmud.org:2224) room name
trigger to work...!
Using gitk blame it transpires that this bug dates to 03/11/2009 and
predates Mudlet version 1.0.1 !
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
This also allows for memory leak checking on MSVC by having include
surrounding Qt headers, which break if you have a macro define new
to be something which tracks line information.