diff --git a/src/Host.h b/src/Host.h index 12f30b797ca..742e1dd7d82 100644 --- a/src/Host.h +++ b/src/Host.h @@ -4,7 +4,7 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2015-2020, 2022-2023 by Stephen Lyons * + * Copyright (C) 2015-2020, 2022-2024 by Stephen Lyons * * - slysven@virginmedia.com * * Copyright (C) 2016 by Ian Adkins - ieadkins@gmail.com * * Copyright (C) 2018 by Huadong Qi - novload@outlook.com * @@ -424,7 +424,6 @@ class Host : public QObject bool showIdsInEditor() const { return mShowIDsInEditor; } void setShowIdsInEditor(const bool isShown) { mShowIDsInEditor = isShown; if (mpEditorDialog) {mpEditorDialog->showIDLabels(isShown);} } - cTelnet mTelnet; QPointer mpConsole; dlgPackageManager* mpPackageManager; @@ -707,15 +706,15 @@ class Host : public QObject // shortcut to switch between the input line and the main window CaretShortcut mCaretShortcut = CaretShortcut::None; - // Support a long-standing hack for using the 1m (Bold) code to select - // a set of brighter 8 colors (the second eight) from the 256 colors for - // "16 color" mode of operation - alongside the basic 30m (Black) to - // 37m (White) set of codes. Using the "AIXTERM" codes (90m to - // 97m) codes or the 38::5:Nm ones are later (better) ways of - // accessing that second set of 8 but some Servers only know the first for - // 16 color operation. The prior behaviour for Mudlet would be almost - // equivalent to this option being true but it limits the ability to have - // completely separate bold (and faint) font weightings: + // Support a long-standing hack among all clients for using the 1m + // Bold) code to select a set of brighter 8 colors (the second eight) from + // the 256 colors for "16 color" mode of operation - alongside the basic + // 30m (Black) to 37m (White) set of codes. Using the "AIXTERM" + // codes (90m to 97m) codes or the 38::5:Nm ones are later + // (better) ways of accessing that second set of 8 but some Servers only + // know the first for 16 color operation. The prior behaviour for Mudlet + // would be almost equivalent to this option being true but it limits the + // ability to have completely separate bold (and faint) font weightings: bool mBoldIsBright = true; signals: diff --git a/src/TAccessibleTextEdit.cpp b/src/TAccessibleTextEdit.cpp index c2e7a6f9454..6e4f41117dd 100644 --- a/src/TAccessibleTextEdit.cpp +++ b/src/TAccessibleTextEdit.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014-2017 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2014-2020, 2023 by Stephen Lyons * + * Copyright (C) 2014-2020, 2023-2024 by Stephen Lyons * * - slysven@virginmedia.com * * Copyright (C) 2022 by Thiago Jung Bauermann - bauermann@kolabnow.com * * * diff --git a/src/TBuffer.cpp b/src/TBuffer.cpp index 6f5fb2471b1..37b0c410973 100644 --- a/src/TBuffer.cpp +++ b/src/TBuffer.cpp @@ -411,13 +411,6 @@ void TBuffer::translateToPlainText(std::string& incoming, const bool isFromServe localBuffer = incoming; } - // Set the class member flag now so that it is available when decoding any - // SGR codes later on: - if (mpConsole->getType() == TConsole::MainConsole) { - // Only the Main Console needs to consider this: - mProcessingServerText = isFromServer; - } - // Fixup table for our own, substitute QTextCodecs: QByteArray encodingTableToUse{mEncoding}; if (mEncoding == "M_CP437") { @@ -739,16 +732,16 @@ void TBuffer::translateToPlainText(std::string& incoming, const bool isFromServe } if (mpHost->mBlankLineBehaviour == Host::BlankLineBehaviour::ReplaceWithSpace) { const TChar::AttributeFlags attributeFlags = - ( ((mBold || mpHost->mMxpClient.bold()) ? TChar::Bold : TChar::None) - | (mFaint ? TChar::Faint : TChar::None) - | ((mItalics || mpHost->mMxpClient.italic()) ? TChar::Italic : TChar::None) - | (mOverline ? TChar::Overline : TChar::None) - | (mReverse ? TChar::Reverse : TChar::None) - | ((mStrikeOut || mpHost->mMxpClient.strikeOut()) ? TChar::StrikeOut : TChar::None) - | ((mUnderline || mpHost->mMxpClient.underline()) ? TChar::Underline : TChar::None) - | (mFastBlink ? TChar::FastBlink : (mBlink ? TChar::Blink :TChar::None)) - | (TChar::alternateFontFlag(mAltFont)) - | (mConcealed ? TChar::Concealed : TChar::None)); + ( ((mBold || mpHost->mMxpClient.bold()) ? TChar::Bold : TChar::None) + | (mFaint ? TChar::Faint : TChar::None) + | ((mItalics || mpHost->mMxpClient.italic()) ? TChar::Italic : TChar::None) + | (mOverline ? TChar::Overline : TChar::None) + | (mReverse ? TChar::Reverse : TChar::None) + | ((mStrikeOut || mpHost->mMxpClient.strikeOut()) ? TChar::StrikeOut : TChar::None) + | ((mUnderline || mpHost->mMxpClient.underline()) ? TChar::Underline : TChar::None) + | (mFastBlink ? TChar::FastBlink : (mBlink ? TChar::Blink :TChar::None)) + | (TChar::alternateFontFlag(mAltFont)) + | (mConcealed ? TChar::Concealed : TChar::None)); // Note: we are using the background color for the // foreground color as well so that we are transparent: @@ -886,16 +879,16 @@ void TBuffer::translateToPlainText(std::string& incoming, const bool isFromServe } const TChar::AttributeFlags attributeFlags = - ( ((mBold || mpHost->mMxpClient.bold()) ? TChar::Bold : TChar::None) - | (mFaint ? TChar::Faint : TChar::None) - | ((mItalics || mpHost->mMxpClient.italic()) ? TChar::Italic : TChar::None) - | (mOverline ? TChar::Overline : TChar::None) - | (mReverse ? TChar::Reverse : TChar::None) - | ((mStrikeOut || mpHost->mMxpClient.strikeOut()) ? TChar::StrikeOut : TChar::None) - | ((mUnderline || mpHost->mMxpClient.underline()) ? TChar::Underline : TChar::None) - | (mFastBlink ? TChar::FastBlink : (mBlink ? TChar::Blink :TChar::None)) - | (TChar::alternateFontFlag(mAltFont)) - | (mConcealed ? TChar::Concealed : TChar::None)); + ( ((mBold || mpHost->mMxpClient.bold()) ? TChar::Bold : TChar::None) + | (mFaint ? TChar::Faint : TChar::None) + | ((mItalics || mpHost->mMxpClient.italic()) ? TChar::Italic : TChar::None) + | (mOverline ? TChar::Overline : TChar::None) + | (mReverse ? TChar::Reverse : TChar::None) + | ((mStrikeOut || mpHost->mMxpClient.strikeOut()) ? TChar::StrikeOut : TChar::None) + | ((mUnderline || mpHost->mMxpClient.underline()) ? TChar::Underline : TChar::None) + | (mFastBlink ? TChar::FastBlink : (mBlink ? TChar::Blink :TChar::None)) + | (TChar::alternateFontFlag(mAltFont)) + | (mConcealed ? TChar::Concealed : TChar::None)); TChar c((mpHost && mpHost->mBoldIsBright && mMayShift8ColorSet && mBold) ? mForeGroundColorLight : mForeGroundColor, @@ -927,27 +920,6 @@ void TBuffer::translateToPlainText(std::string& incoming, const bool isFromServe } } -void TBuffer::setSgrCodeSeenFlag(const SgrCodeFlag flag) -{ - if (!mProcessingServerText) { - return; - } - - if (mpConsole->getType() != TConsole::MainConsole) { - return; - } - - auto currentFlags = mSgrCodesSeen; - mSgrCodesSeen |= flag; - if (currentFlags == mSgrCodesSeen) { - return; - } - - auto pMainConsole = qobject_cast(mpConsole); - Q_ASSERT_X(pMainConsole, "TBuffer::setSgrCodeSeenFlag", "mpConsole pointer does not point to a TMainConsole instance!"); - emit pMainConsole->TMainConsole::signal_sgrFlagsChanged(); -} - void TBuffer::decodeSGR38(const QStringList& parameters, bool isColonSeparated) { #if defined(DEBUG_SGR_PROCESSING) @@ -955,8 +927,6 @@ void TBuffer::decodeSGR38(const QStringList& parameters, bool isColonSeparated) #endif if (parameters.at(1) == QLatin1String("5")) { - setSgrCodeSeenFlag(Sgr_38_5); - int tag = 0; if (parameters.count() > 2) { bool isOk = false; @@ -1024,8 +994,6 @@ void TBuffer::decodeSGR38(const QStringList& parameters, bool isColonSeparated) } else if (parameters.at(1) == QLatin1String("2")) { - setSgrCodeSeenFlag(Sgr_38_2); - if (parameters.count() >= 6) { // Have enough for all three colour // components @@ -1094,8 +1062,6 @@ void TBuffer::decodeSGR48(const QStringList& parameters, bool isColonSeparated) if (parameters.at(1) == QLatin1String("5")) { - setSgrCodeSeenFlag(Sgr_48_5); - int tag = 0; if (parameters.count() > 2) { bool isOk = false; @@ -1163,8 +1129,6 @@ void TBuffer::decodeSGR48(const QStringList& parameters, bool isColonSeparated) } else if (parameters.at(1) == QLatin1String("2")) { - setSgrCodeSeenFlag(Sgr_48_2); - if (parameters.count() >= 6) { // Have enough for all three colour // components @@ -1528,11 +1492,9 @@ void TBuffer::decodeSGR(const QString& sequence) break; case 1: mBold = true; - setSgrCodeSeenFlag(Sgr_Bold); break; case 2: mFaint = true; - setSgrCodeSeenFlag(Sgr_Faint); break; case 3: // There is a proposal by the "VTE" terminal @@ -1556,19 +1518,16 @@ void TBuffer::decodeSGR(const QString& sequence) case 5: mBlink = true; mFastBlink = false; - setSgrCodeSeenFlag(Sgr_Blinking); break; //slow-blinking, display as italics instead for the moment case 6: mBlink = false; mFastBlink = true; - setSgrCodeSeenFlag(Sgr_Blinking); break; //fast blinking, display as italics instead for the moment case 7: mReverse = true; break; case 8: // Concealed characters (set foreground to be the same as background?) mConcealed = true; - setSgrCodeSeenFlag(Sgr_Conceal); break; case 9: mStrikeOut = true; @@ -1579,39 +1538,30 @@ void TBuffer::decodeSGR(const QString& sequence) case 11: // 11 to 19 are alternate fonts, what and where those // are set is not so well specified mAltFont = 1; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 12: mAltFont = 2; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 13: mAltFont = 3; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 14: mAltFont = 4; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 15: mAltFont = 5; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 16: mAltFont = 6; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 17: mAltFont = 7; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 18: mAltFont = 8; - setSgrCodeSeenFlag(Sgr_AltFont); break; case 19: mAltFont = 9; - setSgrCodeSeenFlag(Sgr_AltFont); break; // case 20: // Fracktur - a weird gothic Germanic font apparently // case 21: // Double underline according to specs @@ -1643,49 +1593,41 @@ void TBuffer::decodeSGR(const QString& sequence) mForeGroundColor = mBlack; mForeGroundColorLight = mLightBlack; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 31: mForeGroundColor = mRed; mForeGroundColorLight = mLightRed; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 32: mForeGroundColor = mGreen; mForeGroundColorLight = mLightGreen; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 33: mForeGroundColor = mYellow; mForeGroundColorLight = mLightYellow; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 34: mForeGroundColor = mBlue; mForeGroundColorLight = mLightBlue; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 35: mForeGroundColor = mMagenta; mForeGroundColorLight = mLightMagenta; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 36: mForeGroundColor = mCyan; mForeGroundColorLight = mLightCyan; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 37: mForeGroundColor = mWhite; mForeGroundColorLight = mLightWhite; mMayShift8ColorSet = true; - setSgrCodeSeenFlag(Sgr_30_37); break; case 38: { // We are not now using the basic 8 colors so we won't @@ -1789,35 +1731,27 @@ void TBuffer::decodeSGR(const QString& sequence) break; case 40: mBackGroundColor = mBlack; - setSgrCodeSeenFlag(Sgr_40_47); break; case 41: mBackGroundColor = mRed; - setSgrCodeSeenFlag(Sgr_40_47); break; case 42: mBackGroundColor = mGreen; - setSgrCodeSeenFlag(Sgr_40_47); break; case 43: mBackGroundColor = mYellow; - setSgrCodeSeenFlag(Sgr_40_47); break; case 44: mBackGroundColor = mBlue; - setSgrCodeSeenFlag(Sgr_40_47); break; case 45: mBackGroundColor = mMagenta; - setSgrCodeSeenFlag(Sgr_40_47); break; case 46: mBackGroundColor = mCyan; - setSgrCodeSeenFlag(Sgr_40_47); break; case 47: mBackGroundColor = mWhite; - setSgrCodeSeenFlag(Sgr_40_47); break; case 48: { // We only have single elements so we will need to steal the @@ -1940,74 +1874,58 @@ void TBuffer::decodeSGR(const QString& sequence) case 90: mForeGroundColor = mLightBlack; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 91: mForeGroundColor = mLightRed; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 92: mForeGroundColor = mLightGreen; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 93: mForeGroundColor = mLightYellow; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 94: mForeGroundColor = mLightBlue; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 95: mForeGroundColor = mLightMagenta; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 96: mForeGroundColor = mLightCyan; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 97: mForeGroundColor = mLightWhite; mMayShift8ColorSet = false; - setSgrCodeSeenFlag(Sgr_90_97); break; case 100: mBackGroundColor = mLightBlack; - setSgrCodeSeenFlag(Sgr_100_107); break; case 101: mBackGroundColor = mLightRed; - setSgrCodeSeenFlag(Sgr_100_107); break; case 102: mBackGroundColor = mLightGreen; - setSgrCodeSeenFlag(Sgr_100_107); break; case 103: mBackGroundColor = mLightYellow; - setSgrCodeSeenFlag(Sgr_100_107); break; case 104: mBackGroundColor = mLightBlue; - setSgrCodeSeenFlag(Sgr_100_107); break; case 105: mBackGroundColor = mLightMagenta; - setSgrCodeSeenFlag(Sgr_100_107); break; case 106: mBackGroundColor = mLightCyan; - setSgrCodeSeenFlag(Sgr_100_107); break; case 107: mBackGroundColor = mLightWhite; - setSgrCodeSeenFlag(Sgr_100_107); break; default: qDebug().noquote().nospace() << "TBuffer::translateToPlainText(...) INFO - Unhandled single SGR code sequence CSI " << tag << " m received, Mudlet will ignore it."; diff --git a/src/TBuffer.h b/src/TBuffer.h index 535d3d1f70d..133b6d856f8 100644 --- a/src/TBuffer.h +++ b/src/TBuffer.h @@ -4,7 +4,7 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2015, 2017-2018, 2020, 2022-2023 by Stephen Lyons * + * Copyright (C) 2015, 2017-2018, 2020, 2022-2024 by Stephen Lyons * * - slysven@virginmedia.com * * * * This program is free software; you can redistribute it and/or modify * @@ -300,27 +300,6 @@ class TBuffer static const int csmCssFontWeight_bold = 800; #endif - // Used to record if some particular SGR codes have been received from the - // Game Server - only used in the TMainConsole instance - enum SgrCodeFlag { - Sgr_None = 0x0, - Sgr_Bold = 0x1, // May be combined with Sgr_30_37 (for original {?} 16 colors) or, more hopefully used for a font rendering effect - Sgr_Faint = 0x2, // Usage is probably rare, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_Blinking = 0x4, // Either Blink or Fast Blink code has been seen - at present we convert them to italics - Sgr_Conceal = 0x8, // The hidden/concealed code has been seen - at present Mudlet does not handle it and shows the text - Sgr_30_37 = 0x10, // Basic 8 FG colors unless combined with Sgr_Bold for 16 colors - Sgr_90_97 = 0x20, // Basic 16 FG colors when combined with Sgr_30_37, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_38_2 = 0x40, // 16M FG colors, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_38_5 = 0x80, // 256 FG colors, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_40_47 = 0x100, // Basic 8 BG colors might be combined with Sgr_Bold for 16 colors but that doesn't make much sense as it would also change the FG color as well - Sgr_100_107 = 0x200, // Basic 16 BG colors when combined with Sgr_30_37, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_48_2 = 0x400, // 16M BG colors, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_48_5 = 0x800, // 256 BG colors, would suggest that Server is NOT using Sgr_Bold to select bright colors in a 16 color mode - Sgr_AltFont = 0x1000 // Any of the alternate font codes (SGR 11 to 19) - }; - Q_DECLARE_FLAGS(SgrCodeFlags, SgrCodeFlag) - - QPoint insert(QPoint&, const QString& text, int, int, int, int, int, int, bool bold, bool italics, bool underline, bool strikeout); bool insertInLine(QPoint& cursor, const QString& what, const TChar& format); void expandLine(int y, int count, TChar&); @@ -369,8 +348,6 @@ class TBuffer // is apparently incompatible with using a default constructor - sigh! void encodingChanged(const QByteArray &); void clearSearchHighlights(); - SgrCodeFlags getSgrCodesSeen() const { return mSgrCodesSeen; } - void resetSgrCodesSeen() { mSgrCodesSeen = Sgr_None; } static int lengthInGraphemes(const QString& text); @@ -406,7 +383,7 @@ class TBuffer void decodeSGR48(const QStringList&, bool isColonSeparated = true); void decodeOSC(const QString&); void resetColors(); - void setSgrCodeSeenFlag(const SgrCodeFlag); + QPointer mpConsole; @@ -480,13 +457,8 @@ class TBuffer QByteArray mEncoding; QTextCodec* mMainIncomingCodec = nullptr; - - bool mProcessingServerText = false; - SgrCodeFlags mSgrCodesSeen = Sgr_None; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(TBuffer::SgrCodeFlags) - #ifndef QT_NO_DEBUG_STREAM // Dumper for the TChar::AttributeFlags - so that qDebug gives a detailed broken // down results when presented with the value rather than just a hex value. diff --git a/src/TLuaInterpreter.cpp b/src/TLuaInterpreter.cpp index 5bfd2e6c0f0..0b3da931ed8 100644 --- a/src/TLuaInterpreter.cpp +++ b/src/TLuaInterpreter.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * - * Copyright (C) 2013-2023 by Stephen Lyons - slysven@virginmedia.com * + * Copyright (C) 2013-2024 by Stephen Lyons - slysven@virginmedia.com * * Copyright (C) 2014-2017 by Ahmed Charles - acharles@outlook.com * * Copyright (C) 2016 by Eric Wallace - eewallace@gmail.com * * Copyright (C) 2016 by Chris Leacy - cleacy1972@gmail.com * diff --git a/src/TLuaInterpreter.h b/src/TLuaInterpreter.h index c7bc29b59c0..4e054056bbc 100644 --- a/src/TLuaInterpreter.h +++ b/src/TLuaInterpreter.h @@ -3,7 +3,7 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * - * Copyright (C) 2013-2016, 2018-2023 by Stephen Lyons * + * Copyright (C) 2013-2016, 2018-2024 by Stephen Lyons * * - slysven@virginmedia.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * * Copyright (C) 2016-2018 by Ian Adkins - ieadkins@gmail.com * diff --git a/src/TLuaInterpreterUI.cpp b/src/TLuaInterpreterUI.cpp index d4c1c5b252b..18c39e4e35e 100644 --- a/src/TLuaInterpreterUI.cpp +++ b/src/TLuaInterpreterUI.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * - * Copyright (C) 2013-2022 by Stephen Lyons - slysven@virginmedia.com * + * Copyright (C) 2013-2024 by Stephen Lyons - slysven@virginmedia.com * * Copyright (C) 2014-2017 by Ahmed Charles - acharles@outlook.com * * Copyright (C) 2016 by Eric Wallace - eewallace@gmail.com * * Copyright (C) 2016 by Chris Leacy - cleacy1972@gmail.com * diff --git a/src/TMainConsole.h b/src/TMainConsole.h index 6269f8ac234..61cd24a5875 100644 --- a/src/TMainConsole.h +++ b/src/TMainConsole.h @@ -4,7 +4,7 @@ /*************************************************************************** * Copyright (C) 2008-2012 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2014-2016, 2018-2022 by Stephen Lyons * + * Copyright (C) 2014-2016, 2018-2022, 2023 by Stephen Lyons * * - slysven@virginmedia.com * * Copyright (C) 2016 by Ian Adkins - ieadkins@gmail.com * * * @@ -133,9 +133,6 @@ public slots: // class, second argument is true for a lower priority indication when // locally produced information is painted into main console void signal_newDataAlert(const QString&, bool isLowerPriorityChange = false); - // Signal to update the status display of these flags if the preferences - // dialog is open - actaully emitted from the TBuffer class: - void signal_sgrFlagsChanged(); private: diff --git a/src/TTextEdit.cpp b/src/TTextEdit.cpp index dc4c168b595..59f2172672f 100644 --- a/src/TTextEdit.cpp +++ b/src/TTextEdit.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2008-2012 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2014-2016, 2018-2023 by Stephen Lyons * + * Copyright (C) 2014-2016, 2018-2024 by Stephen Lyons * * - slysven@virginmedia.com * * Copyright (C) 2016-2017 by Ian Adkins - ieadkins@gmail.com * * Copyright (C) 2017 by Chris Reid - WackyWormer@hotmail.com * diff --git a/src/XMLexport.cpp b/src/XMLexport.cpp index ae8d2ea8fed..bd3a1f76d70 100644 --- a/src/XMLexport.cpp +++ b/src/XMLexport.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * * Copyright (C) 2016-2017 by Ian Adkins - ieadkins@gmail.com * - * Copyright (C) 2017-2023 by Stephen Lyons - slysven@virginmedia.com * + * Copyright (C) 2017-2024 by Stephen Lyons - slysven@virginmedia.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * diff --git a/src/XMLimport.cpp b/src/XMLimport.cpp index c9515a57984..2bce2628f49 100644 --- a/src/XMLimport.cpp +++ b/src/XMLimport.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2008-2013 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2016-2023 by Stephen Lyons - slysven@virginmedia.com * + * Copyright (C) 2016-2024 by Stephen Lyons - slysven@virginmedia.com * * Copyright (C) 2016-2017 by Ian Adkins - ieadkins@gmail.com * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/dlgProfilePreferences.cpp b/src/dlgProfilePreferences.cpp index 49a8ce405e4..8077446b388 100644 --- a/src/dlgProfilePreferences.cpp +++ b/src/dlgProfilePreferences.cpp @@ -345,11 +345,6 @@ dlgProfilePreferences::dlgProfilePreferences(QWidget* pParentWidget, Host* pHost comboBox_guiLanguage->addItem(qsl("No translations available!")); } } - groupBox_sgrCodesSeen->setChecked(false); - slot_toggleSgrCodesSeenVisibilty(false); - connect(groupBox_sgrCodesSeen, &QGroupBox::toggled, this, &dlgProfilePreferences::slot_toggleSgrCodesSeenVisibilty); - slot_toggleExtraFontSamplesVisibilty(false); - connect(checkBox_toggleExtraFontSamplesVisibilty, &QCheckBox::toggled, this, &dlgProfilePreferences::slot_toggleExtraFontSamplesVisibilty); setupPasswordsMigration(); @@ -451,7 +446,6 @@ void dlgProfilePreferences::disableHostDetails() // ===== tab_displayColors ===== groupBox_displayColors->setEnabled(false); - groupBox_sgrCodesSeen->setEnabled(false); // ===== tab_mapper ===== // most of groupBox_mapFiles is disabled but there is ONE checkBox that @@ -575,7 +569,6 @@ void dlgProfilePreferences::enableHostDetails() // ===== tab_displayColors ===== groupBox_displayColors->setEnabled(true); - groupBox_sgrCodesSeen->setEnabled(true); // ===== tab_mapper ===== // most of groupBox_mapFiles is disabled but there is ONE checkBox that @@ -801,7 +794,6 @@ void dlgProfilePreferences::initWithHost(Host* pHost) // has a font size larger than the preset range offers? fontSize->setCurrentIndex(9); // default font is size 10, index 9. } - updateFontSampleDisplays(pHost->getDisplayFont()); wrap_at_spinBox->setValue(pHost->mWrapAt); indent_wrapped_spinBox->setValue(pHost->mWrapIndentCount); @@ -1182,9 +1174,6 @@ void dlgProfilePreferences::initWithHost(Host* pHost) // Identify which Profile we are showing the settings for: setWindowTitle(tr("Profile preferences - %1").arg(pHost->getName())); - // Populate the SGR codes seen checkBoxes in that groupBox - slot_updateSgrCodeFlags(); - // CHECKME: Have moved ALL the connects, where possible, to the end so that // none are triggered by the setup operations... connect(pushButton_command_line_foreground_color, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_setCommandLineFgColor); @@ -1213,13 +1202,10 @@ void dlgProfilePreferences::initWithHost(Host* pHost) connect(pushButton_command_background_color, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_setCommandBgColor); connect(pushButton_resetColors, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_resetColors); - connect(pHost->mpConsole, &TMainConsole::signal_sgrFlagsChanged, this, &dlgProfilePreferences::slot_updateSgrCodeFlags); - connect(toolButton_resetSgrCodeDetection, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_resetSgrCodeFlags); connect(reset_colors_button_2, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_resetMapColors); connect(fontComboBox, &QFontComboBox::currentFontChanged, this, &dlgProfilePreferences::slot_setDisplayFont); connect(fontSize, qOverload(&QComboBox::currentIndexChanged), this, &dlgProfilePreferences::slot_setFontSize); - connect(lineEdit_fontSample_normal, &QLineEdit::textChanged, this, &dlgProfilePreferences::slot_updateFontSamplesText); connect(pushButton_black_2, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_setMapColorBlack); connect(pushButton_Lblack_2, &QAbstractButton::clicked, this, &dlgProfilePreferences::slot_setMapColorLightBlack); @@ -1334,12 +1320,6 @@ void dlgProfilePreferences::disconnectHostRelatedControls() disconnect(pushButton_lWhite, &QAbstractButton::clicked, nullptr, nullptr); disconnect(pushButton_resetColors, &QAbstractButton::clicked, nullptr, nullptr); - if (!mpHost.isNull() && !mpHost->mpConsole.isNull()) { - // They are still around and not null - if they were nulled prior to this - // then this connection would automatically have gone away: - disconnect(mpHost->mpConsole, &TMainConsole::signal_sgrFlagsChanged, this, &dlgProfilePreferences::slot_updateSgrCodeFlags); - } - disconnect(toolButton_resetSgrCodeDetection, &QAbstractButton::clicked, nullptr, nullptr); disconnect(reset_colors_button_2, &QAbstractButton::clicked, nullptr, nullptr); disconnect(fontComboBox, qOverload(&QFontComboBox::currentFontChanged), nullptr, nullptr); @@ -1436,9 +1416,6 @@ void dlgProfilePreferences::clearHostDetails() fontSize->clear(); setColors(); - // The absence of a valid host will cause this to clear all the checkBoxes - // in the groupBox_sgrCodesSeen: - slot_updateSgrCodeFlags(); setColors2(); wrap_at_spinBox->clear(); @@ -1930,9 +1907,6 @@ void dlgProfilePreferences::slot_setDisplayFont() return; } - // update the font samples when the font or size selections change - updateFontSampleDisplays(newFont); - // update the display properly when font or size selections change. mainConsole->changeColors(); mainConsole->mUpperPane->updateScreenView(); @@ -4548,106 +4522,3 @@ void dlgProfilePreferences::slot_changeLargeAreaExitArrows(const bool state) pHost->setLargeAreaExitArrows(state); } - -void dlgProfilePreferences::slot_updateFontSamplesText(const QString& newText) -{ - lineEdit_fontSample_bold->setText(newText); - lineEdit_fontSample_faint->setText(newText); - lineEdit_fontSample_boldAndFaint->setText(newText); -} - -// The weights used need to match those in TTextEdit::drawGraphemeForeground(...) -void dlgProfilePreferences::updateFontSampleDisplays(const QFont& newFont) -{ - lineEdit_fontSample_normal->setFont(newFont); - - QFont faintFont = newFont; - faintFont.setWeight(TBuffer::csmFontWeight_faint); - lineEdit_fontSample_faint->setFont(faintFont); - - QFont boldFont = newFont; - boldFont.setWeight(TBuffer::csmFontWeight_bold); - lineEdit_fontSample_bold->setFont(boldFont); - - QFont boldAndFaintFont = newFont; - boldAndFaintFont.setWeight(TBuffer::csmFontWeight_boldAndFaint); - lineEdit_fontSample_boldAndFaint->setFont(boldAndFaintFont); -} - -void dlgProfilePreferences::slot_resetSgrCodeFlags() -{ - if (!mpHost.isNull() && !mpHost.data()->mpConsole.isNull()) { - auto& buffer = mpHost.data()->mpConsole.data()->buffer; - buffer.resetSgrCodesSeen(); - } - - slot_updateSgrCodeFlags(); -} - -void dlgProfilePreferences::slot_toggleSgrCodesSeenVisibilty(const bool statusCheckBoxesVisible) -{ - checkBox_16MBgColors->setVisible(statusCheckBoxesVisible); - checkBox_16MFgColors->setVisible(statusCheckBoxesVisible); - checkBox_256BgColors->setVisible(statusCheckBoxesVisible); - checkBox_256FgColors->setVisible(statusCheckBoxesVisible); - checkBox_additional8BgColors->setVisible(statusCheckBoxesVisible); - checkBox_additional8FgColors->setVisible(statusCheckBoxesVisible); - checkBox_altFont->setVisible(statusCheckBoxesVisible); - checkBox_bold->setVisible(statusCheckBoxesVisible); - checkBox_basic8BgColors->setVisible(statusCheckBoxesVisible); - checkBox_basic8FgColors->setVisible(statusCheckBoxesVisible); - checkBox_blinking->setVisible(statusCheckBoxesVisible); - checkBox_concealed->setVisible(statusCheckBoxesVisible); - checkBox_faint->setVisible(statusCheckBoxesVisible); - toolButton_resetSgrCodeDetection->setVisible(statusCheckBoxesVisible); -} - -void dlgProfilePreferences::slot_toggleExtraFontSamplesVisibilty(const bool extraFontSamplesVisible) -{ - label_fontSample_bold->setVisible(extraFontSamplesVisible); - lineEdit_fontSample_bold->setVisible(extraFontSamplesVisible); - label_fontSample_faint->setVisible(extraFontSamplesVisible); - lineEdit_fontSample_faint->setVisible(extraFontSamplesVisible); - label_fontSample_boldAndFaint->setVisible(extraFontSamplesVisible); - lineEdit_fontSample_boldAndFaint->setVisible(extraFontSamplesVisible); -} - -void dlgProfilePreferences::slot_updateSgrCodeFlags() -{ - if (mpHost.isNull() || mpHost.data()->mpConsole.isNull()) { - // No Host pointer so no data to show - groupBox_sgrCodesSeen->setChecked(false); - groupBox_sgrCodesSeen->setVisible(false); - - checkBox_16MBgColors->setChecked(false); - checkBox_16MFgColors->setChecked(false); - checkBox_256BgColors->setChecked(false); - checkBox_256FgColors->setChecked(false); - checkBox_additional8BgColors->setChecked(false); - checkBox_additional8FgColors->setChecked(false); - checkBox_altFont->setChecked(false); - checkBox_bold->setChecked(false); - checkBox_basic8BgColors->setChecked(false); - checkBox_basic8FgColors->setChecked(false); - checkBox_blinking->setChecked(false); - checkBox_concealed->setChecked(false); - checkBox_faint->setChecked(false); - return; - } - - auto& buffer = mpHost.data()->mpConsole.data()->buffer; - const auto sgrFlagsState = buffer.getSgrCodesSeen(); - checkBox_16MBgColors->setChecked(sgrFlagsState & TBuffer::Sgr_48_2); - checkBox_16MFgColors->setChecked(sgrFlagsState & TBuffer::Sgr_38_2); - checkBox_256BgColors->setChecked(sgrFlagsState & TBuffer::Sgr_48_5); - checkBox_256FgColors->setChecked(sgrFlagsState & TBuffer::Sgr_38_5); - checkBox_additional8BgColors->setChecked(sgrFlagsState & TBuffer::Sgr_100_107); - checkBox_additional8FgColors->setChecked(sgrFlagsState & TBuffer::Sgr_90_97); - checkBox_altFont->setChecked(sgrFlagsState & TBuffer::Sgr_AltFont); - checkBox_bold->setChecked(sgrFlagsState & TBuffer::Sgr_Bold); - checkBox_basic8BgColors->setChecked(sgrFlagsState & TBuffer::Sgr_40_47); - checkBox_basic8FgColors->setChecked(sgrFlagsState & TBuffer::Sgr_30_37); - checkBox_blinking->setChecked(sgrFlagsState & TBuffer::Sgr_Blinking); - checkBox_concealed->setChecked(sgrFlagsState & TBuffer::Sgr_Conceal); - checkBox_faint->setChecked(sgrFlagsState & TBuffer::Sgr_Faint); -} diff --git a/src/dlgProfilePreferences.h b/src/dlgProfilePreferences.h index 9b3e9381af4..a3889374dfc 100644 --- a/src/dlgProfilePreferences.h +++ b/src/dlgProfilePreferences.h @@ -4,7 +4,7 @@ /*************************************************************************** * Copyright (C) 2008-2012 by Heiko Koehn - KoehnHeiko@googlemail.com * * Copyright (C) 2014 by Ahmed Charles - acharles@outlook.com * - * Copyright (C) 2017-2018, 2022-2024 by Stephen Lyons * + * Copyright (C) 2017-2018, 2022-2023 by Stephen Lyons * * - slysven@virginmedia.com * * * * This program is free software; you can redistribute it and/or modify * @@ -173,15 +173,6 @@ private slots: void slot_changeLargeAreaExitArrows(const bool); void slot_hidePasswordMigrationLabel(); void slot_loadHistoryMap(); - void slot_updateFontSamplesText(const QString&); - // Used by the preference dialog to reset the TBuffer::mSgrCodesSeen flags - // for the Main Console: - void slot_resetSgrCodeFlags(); - // Used by the TMainConsole::buffer to update the status display of the - // above mentioned flags: - void slot_updateSgrCodeFlags(); - void slot_toggleSgrCodesSeenVisibilty(const bool); - void slot_toggleExtraFontSamplesVisibilty(const bool); signals: @@ -215,7 +206,6 @@ private slots: QString mapSaveLoadDirectory(Host* pHost); void loadMap(const QString&); void fillOutMapHistory(); - void updateFontSampleDisplays(const QFont&); int mFontSize = 10; diff --git a/src/ui/profile_preferences.ui b/src/ui/profile_preferences.ui index f92adc40a14..85db215c68b 100644 --- a/src/ui/profile_preferences.ui +++ b/src/ui/profile_preferences.ui @@ -756,7 +756,7 @@ Font - + @@ -831,143 +831,6 @@ you can use it but there could be issues with aligning columns of text - - - - <p>Mudlet can display text in multiple "weights" ("Normal", "Bold", "Faint" and "Faint+Bold") <u>provided that the font chosen actually has those multiple weights</u>. This can be checked by comparing the results of something typed into the "Normal" box and seeing how it is presented for the others.</p><p><i>The Game Server can control the weight that is used for any text by combinations of the ANSI "Set Graphics Redition" codes <tt>1</tt> (bold) and <tt>2</tt> (faint), however the bold code is also used in some Games to select the second eight of the sixteeen colors in one type of "16-color" mode and if that is the case (which can now be controlled by the checkbox option <tt>BOLD is Bright</tt> in the "Color view" tab) it will interfere with using the bold option to make text <b>bold</b>.</i></p> - - - Font sample: - - - - - - Show samples in all the weights that Mudlet might use - - - false - - - - - - - Normal: - - - lineEdit_fontSample_normal - - - - - - - - false - - - - Enter some text here to see how it is rendered in all four supported "weights". - - - - - - - Bold: - - - - - - - - false - - - - ForbiddenCursor - - - Qt::NoFocus - - - false - - - true - - - Enter some text in the "Normal" box to see how it looks when it is "Bold". - - - - - - - Faint: - - - - - - - - false - - - - ForbiddenCursor - - - Qt::NoFocus - - - false - - - true - - - Enter some text in the "Normal" box to see how it looks when it is "Faint". - - - - - - - Bold + Faint: - - - - - - - - false - - - - ForbiddenCursor - - - Qt::NoFocus - - - false - - - true - - - Enter some text in the "Normal" box to see how it looks when it is "Bold" and "Faint". - - - - - - @@ -2072,182 +1935,6 @@ you can use it but there could be issues with aligning columns of text - - - - "Set Graphics Rendition" codes detected (check this to show details) - - - true - - - false - - - - - - false - - - Bold ("1") - - - - - - - false - - - Faint ("2") - - - - - - - false - - - Blinking ('5' = slow or '6' = rapid) - - - - - - - false - - - Concealed ('8') - - - - - - - false - - - Alternate Font ('11' to '19') - - - - - - - false - - - <p>Basic eight foreground colors using '<tt>3?</tt>' where ? is an integer from <tt>0</tt> to <tt>7</tt>.</p><p><i>If only this box for <b>foreground</b> colors is checked <u>and so is the <tt>Bold</tt> one</u> then it is likely that the Game Server is using the latter to indicated that it wants Mudlet to operate in the "BOLD is Bright" mode where that attribute is used to select a second set of eight colors (the right column of colours in the box above) and you should activate that option in the box above.</i></p> - - - Basic 8 foreground colors ('30' to '37') - - - - - - - false - - - <p>Basic eight background colors using '<tt>4?</tt>' where ? is an integer from <tt>0</tt> to <tt>7</tt>.</p> - - - Basic 8 background colors ('40' to '47') - - - - - - - false - - - <p>Second eight of sixteen foreground colors using '<tt>9?</tt>' where ? is an integer from <tt>0</tt> to <tt>7</tt>.</p> - - - Additional 8 foreground colors for 16 in total ('90' to '97') - - - - - - - false - - - <p>Second eight of sixteen background colors using '<tt>10?</tt>' where ? is an integer from <tt>0</tt> to <tt>7</tt>.</p> - - - Additional 8 background colors for 16 in total ('100' to '107') - - - - - - - false - - - <p>256 foreground colors using '<tt>38;5;N</tt>' or '<tt>38:5:N</tt>' where N is an integer from <tt>0</tt> to <tt>255</tt>.</p> - - - 256 foreground colors - - - - - - - false - - - <p>256 background colors using '<tt>48;5;N</tt>' or '<tt>48:5:N...</tt>' where N is an integer from <tt>0</tt> to <tt>255</tt>.</p> - - - 256 background colors - - - - - - - false - - - <p>16M foreground colors using '<tt>38;2;R;G;B...</tt>', '<tt>38;2;;R;G;B...</tt>' or '<tt>38:2::R:G:B...</tt>' where R, G and B are integers from <tt>0</tt> to <tt>255</tt>.</p> - - - 16M foreground colors - - - - - - - false - - - <p>16M background colors using '<tt>48;2;R;G;B...</tt>', '<tt>48;2;;R;G;B...</tt>' or '<tt>48:2::R:G:B...</tt>' where R, G and B are integers from <tt>0</tt> to <tt>255</tt>.</p> - - - 16M background colors - - - - - - - Reset detection - - - - - - @@ -4532,8 +4219,6 @@ you can use it but there could be issues with aligning columns of text fontComboBox fontSize checkBox_antiAlias - checkBox_toggleExtraFontSamplesVisibilty - lineEdit_fontSample_normal topBorderHeight bottomBorderHeight leftBorderWidth @@ -4579,8 +4264,6 @@ you can use it but there could be issues with aligning columns of text pushButton_lCyan pushButton_lWhite pushButton_resetColors - groupBox_sgrCodesSeen - toolButton_resetSgrCodeDetection pushButton_saveMap pushButton_loadMap comboBox_mapHistory @@ -4670,19 +4353,6 @@ you can use it but there could be issues with aligning columns of text comboBox_store_passwords_in timeEdit_timerDebugOutputMinimumInterval doubleSpinBox_networkPacketTimeout - checkBox_bold - checkBox_blinking - checkBox_altFont - checkBox_basic8FgColors - checkBox_additional8FgColors - checkBox_256FgColors - checkBox_16MFgColors - checkBox_faint - checkBox_concealed - checkBox_basic8BgColors - checkBox_additional8BgColors - checkBox_256BgColors - checkBox_16MBgColors