2009-05-22 19:32:47 +02:00
/***************************************************************************
2014-08-15 02:11:43 -07:00
* Copyright ( C ) 2008 - 2009 by Heiko Koehn - KoehnHeiko @ googlemail . com *
* Copyright ( C ) 2014 by Ahmed Charles - acharles @ outlook . com *
2021-12-26 15:22:05 +00:00
* Copyright ( C ) 2015 , 2018 - 2019 , 2021 by Stephen Lyons *
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
* - slysven @ virginmedia . com *
2009-05-22 19:32:47 +02:00
* *
* 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 *
* the Free Software Foundation ; either version 2 of the License , or *
* ( at your option ) any later version . *
* *
* This program is distributed in the hope that it will be useful , *
* but WITHOUT ANY WARRANTY ; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the *
* GNU General Public License for more details . *
* *
* You should have received a copy of the GNU General Public License *
* along with this program ; if not , write to the *
* Free Software Foundation , Inc . , *
* 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA . *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2014-08-15 02:11:43 -07:00
2009-05-22 19:32:47 +02:00
# include "dlgColorTrigger.h"
2014-08-15 02:11:43 -07:00
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
# include "dlgTriggerEditor.h"
2009-05-22 19:32:47 +02:00
# include "Host.h"
# include "TTextEdit.h"
2017-04-14 00:40:02 -07:00
# include "TTrigger.h"
# include "mudlet.h"
2009-05-22 19:32:47 +02:00
2014-08-15 02:11:43 -07:00
2022-11-14 10:14:16 +01:00
dlgColorTrigger : : dlgColorTrigger ( QWidget * pParentWidget , TTrigger * pT , const bool isBackGround , const QString & title )
: QDialog ( pParentWidget )
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
, mpTrigger ( pT )
, mIsBackground ( isBackGround )
2009-05-22 19:32:47 +02:00
{
// init generated dialog
setupUi ( this ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// The buttonBox's Cancel button has been connect up to this class's
// rejected() signal to close it without changing anything in the caller!
// The Ignore button means do not consider this fore or back ground (as per
// mIsBackground) for the colour trigger - only use the other one (which
// must be set)
// The Apply button unhides the display of the colors codes 16 - 255 - it
// is set up as a one-shot operation, and is effectively "fired" if the
// existing color is in that range of numbers:
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setText ( tr ( " More colors " ) ) ;
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setCheckable ( true ) ;
2021-12-26 15:22:05 +00:00
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setToolTip ( utils : : richText ( tr ( " Click to access all 256 ANSI colors. " ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
connect ( buttonBox - > button ( QDialogButtonBox : : Apply ) , & QAbstractButton : : clicked , this , & dlgColorTrigger : : slot_moreColorsClicked ) ;
2020-12-16 19:40:59 +01:00
connect ( buttonBox - > button ( QDialogButtonBox : : Ignore ) , & QAbstractButton : : clicked , this , & dlgColorTrigger : : slot_resetColorClicked ) ;
2021-12-26 15:22:05 +00:00
buttonBox - > button ( QDialogButtonBox : : Ignore )
- > setToolTip ( utils : : richText ( mIsBackground
? tr ( " Click to make the color trigger ignore the text's background color - however choosing this for both foreground and background is an error. " )
: tr ( " Click to make the color trigger ignore the text's foreground color - however choosing this for both foreground and background is an error. " ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// The Reset button means trigger only if the text is not set to anything
// so is in the "default" colour - what ever THAT is:
2020-12-16 19:40:59 +01:00
connect ( buttonBox - > button ( QDialogButtonBox : : Reset ) , & QAbstractButton : : clicked , this , & dlgColorTrigger : : slot_defaultColorClicked ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
buttonBox - > button ( QDialogButtonBox : : Reset ) - > setText ( tr ( " Default " ) ) ;
2021-12-26 15:22:05 +00:00
buttonBox - > button ( QDialogButtonBox : : Reset )
2025-02-24 09:59:51 +04:00
- > setToolTip ( utils : : richText ( mIsBackground ? tr ( " Click to make the color trigger when the text's background color has not been modified from its normal value. " )
: tr ( " Click to make the color trigger when the text's foreground color has not been modified from its normal value. " ) ) ) ;
2021-12-26 15:22:05 +00:00
groupBox_basicColors - > setToolTip ( utils : : richText ( mIsBackground ? tr ( " Click a color to make the trigger fire only when the text's background color matches the color number indicated. " )
: tr ( " Click a color to make the trigger fire only when the text's foreground color matches the color number indicated. " ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
connect ( pushButton_setUsingRgbValue , & QAbstractButton : : clicked , this , & dlgColorTrigger : : slot_rgbColorClicked ) ;
connect ( pushButton_setUsingGrayValue , & QAbstractButton : : clicked , this , & dlgColorTrigger : : slot_grayColorClicked ) ;
setupBasicButton ( pushButton_black , 0 , mpTrigger - > mpHost - > mBlack , tr ( " Black " ) ) ;
setupBasicButton ( pushButton_red , 1 , mpTrigger - > mpHost - > mRed , tr ( " Red " ) ) ;
setupBasicButton ( pushButton_green , 2 , mpTrigger - > mpHost - > mGreen , tr ( " Green " ) ) ;
setupBasicButton ( pushButton_yellow , 3 , mpTrigger - > mpHost - > mYellow , tr ( " Yellow " ) ) ;
setupBasicButton ( pushButton_blue , 4 , mpTrigger - > mpHost - > mBlue , tr ( " Blue " ) ) ;
setupBasicButton ( pushButton_magenta , 5 , mpTrigger - > mpHost - > mMagenta , tr ( " Magenta " ) ) ;
setupBasicButton ( pushButton_cyan , 6 , mpTrigger - > mpHost - > mCyan , tr ( " Cyan " ) ) ;
setupBasicButton ( pushButton_white , 7 , mpTrigger - > mpHost - > mWhite , tr ( " White (Light gray) " ) ) ;
setupBasicButton ( pushButton_Lblack , 8 , mpTrigger - > mpHost - > mLightBlack , tr ( " Light black (Dark gray) " ) ) ;
setupBasicButton ( pushButton_Lred , 9 , mpTrigger - > mpHost - > mLightRed , tr ( " Light red " ) ) ;
setupBasicButton ( pushButton_Lgreen , 10 , mpTrigger - > mpHost - > mLightGreen , tr ( " Light green " ) ) ;
setupBasicButton ( pushButton_Lyellow , 11 , mpTrigger - > mpHost - > mLightYellow , tr ( " Light yellow " ) ) ;
setupBasicButton ( pushButton_Lblue , 12 , mpTrigger - > mpHost - > mLightBlue , tr ( " Light blue " ) ) ;
setupBasicButton ( pushButton_Lmagenta , 13 , mpTrigger - > mpHost - > mLightMagenta , tr ( " Light magenta " ) ) ;
setupBasicButton ( pushButton_Lcyan , 14 , mpTrigger - > mpHost - > mLightCyan , tr ( " Light cyan " ) ) ;
setupBasicButton ( pushButton_Lwhite , 15 , mpTrigger - > mpHost - > mLightWhite , tr ( " Light white " ) ) ;
// These will correctly set the colours on the value label in their area:
if ( mIsBackground ) {
if ( mpTrigger - > mColorTriggerBgAnsi > = 16 & & mpTrigger - > mColorTriggerBgAnsi < = 231 ) {
slot_moreColorsClicked ( ) ;
horizontalSlider_red - > setSliderPosition ( ( mpTrigger - > mColorTriggerBgAnsi - 16 ) / 36 ) ;
horizontalSlider_green - > setSliderPosition ( ( mpTrigger - > mColorTriggerBgAnsi - 16 - horizontalSlider_red - > value ( ) * 36 ) / 6 ) ;
horizontalSlider_blue - > setSliderPosition ( ( mpTrigger - > mColorTriggerBgAnsi - 16 - horizontalSlider_red - > value ( ) * 36 ) - horizontalSlider_green - > value ( ) * 6 ) ;
slot_rgbColorChanged ( ) ;
slot_grayColorChanged ( 0 ) ;
slot_setRBGButtonFocus ( ) ;
} else if ( mpTrigger - > mColorTriggerBgAnsi > = 232 & & mpTrigger - > mColorTriggerBgAnsi < = 255 ) {
slot_moreColorsClicked ( ) ;
// The RGB controls will be at zeros so this will set the things up
// to those
slot_rgbColorChanged ( ) ;
// We can set the gray directly
slot_grayColorChanged ( mpTrigger - > mColorTriggerBgAnsi - 232 ) ;
slot_setGreyButtonFocus ( ) ;
} else {
// In the case of default / ignore or one of the basic 16 - colors
// we will hide the extra ones:
groupBox_rgbScale - > setVisible ( false ) ;
groupBox_grayScale - > setVisible ( false ) ;
// The color is either not set (is reset) or a basic colour - we do
// not provide a means to set a colour trigger based on a 16M value
// (yet) from the GUI?
// The RGB controls will be at zeros so this will set the things up
// to those
slot_rgbColorChanged ( ) ;
// We can set the gray directly
slot_grayColorChanged ( 0 ) ;
}
2009-05-22 19:32:47 +02:00
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mpTrigger - > mColorTriggerFgAnsi > = 16 & & mpTrigger - > mColorTriggerFgAnsi < = 231 ) {
slot_moreColorsClicked ( ) ;
// Current background for this trigger is a RGB one so set that
// control to the matching value:
2009-05-22 19:32:47 +02:00
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
horizontalSlider_red - > setSliderPosition ( ( mpTrigger - > mColorTriggerFgAnsi - 16 ) / 36 ) ;
horizontalSlider_green - > setSliderPosition ( ( mpTrigger - > mColorTriggerFgAnsi - 16 - horizontalSlider_red - > value ( ) * 36 ) / 6 ) ;
horizontalSlider_blue - > setSliderPosition ( ( mpTrigger - > mColorTriggerFgAnsi - 16 - horizontalSlider_red - > value ( ) * 36 ) - horizontalSlider_green - > value ( ) * 6 ) ;
slot_rgbColorChanged ( ) ;
slot_grayColorChanged ( 0 ) ;
slot_setRBGButtonFocus ( ) ;
2009-05-22 19:32:47 +02:00
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
} else if ( mpTrigger - > mColorTriggerFgAnsi > = 232 & & mpTrigger - > mColorTriggerFgAnsi < = 255 ) {
slot_moreColorsClicked ( ) ;
// Current background for this trigger is a Gray one so set that
// control to the matching value:
2009-05-22 19:32:47 +02:00
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// The RGB controls will be at zeros so this will set the things up
// to those
slot_rgbColorChanged ( ) ;
// We can set the gray directly
slot_grayColorChanged ( mpTrigger - > mColorTriggerFgAnsi - 232 ) ;
slot_setGreyButtonFocus ( ) ;
} else {
// In the case of default / ignore or one of the basic 16 - colors
// we will hide the extra ones:
groupBox_rgbScale - > setVisible ( false ) ;
groupBox_grayScale - > setVisible ( false ) ;
// The color is either not set (is reset) or a basic colour - we do
// not provide a means to set a colour trigger based on a 16M value
// (yet) from the GUI?
// The RGB controls will be at zeros so this will set the things up
// to those
slot_rgbColorChanged ( ) ;
// We can set the gray directly
slot_grayColorChanged ( 0 ) ;
}
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( ! title . isNull ( ) ) {
setWindowTitle ( title ) ;
2017-04-27 03:55:38 -07:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
label_rgbValue - > setEnabled ( false ) ;
label_grayValue - > setEnabled ( false ) ;
// We set up the controls into the default state before wiring up the slots
// that get run on changing the controls - the "set" button in each of these
// groupboxes gets the focus once any of the sliders are adjusted:
connect ( horizontalSlider_red , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_rgbColorChanged ) ;
connect ( horizontalSlider_red , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_setRBGButtonFocus ) ;
connect ( horizontalSlider_green , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_rgbColorChanged ) ;
connect ( horizontalSlider_green , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_setRBGButtonFocus ) ;
connect ( horizontalSlider_blue , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_rgbColorChanged ) ;
connect ( horizontalSlider_blue , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_setRBGButtonFocus ) ;
connect ( horizontalSlider_gray , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_grayColorChanged ) ;
connect ( horizontalSlider_gray , & QAbstractSlider : : valueChanged , this , & dlgColorTrigger : : slot_setGreyButtonFocus ) ;
// If the current is ignored or default set the focus onto them:
if ( ( mIsBackground & & mpTrigger - > mColorTriggerBgAnsi = = TTrigger : : scmDefault ) | | ( ! mIsBackground & & mpTrigger - > mColorTriggerFgAnsi = = TTrigger : : scmDefault ) ) {
buttonBox - > button ( QDialogButtonBox : : Reset ) - > setFocus ( ) ;
} else if ( ( mIsBackground & & mpTrigger - > mColorTriggerBgAnsi = = TTrigger : : scmIgnored ) | | ( ! mIsBackground & & mpTrigger - > mColorTriggerFgAnsi = = TTrigger : : scmIgnored ) ) {
buttonBox - > button ( QDialogButtonBox : : Ignore ) - > setFocus ( ) ;
2009-05-22 19:32:47 +02:00
}
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : setupBasicButton ( QPushButton * pButton , const int ansiColor , const QColor & color , const QString & colorText )
2009-05-22 19:32:47 +02:00
{
2025-12-27 11:24:43 +01:00
connect ( pButton , & QPushButton : : clicked , this , [ this , ansiColor ] ( ) {
slot_basicColorClicked ( ansiColor ) ;
} ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( ( mIsBackground & & ( mpTrigger - > mColorTriggerBgAnsi = = ansiColor ) ) | | ( ! mIsBackground & & ( mpTrigger - > mColorTriggerFgAnsi = = ansiColor ) ) ) {
pButton - > setFocus ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
2023-05-29 22:03:34 +03:00
//: Color Trigger dialog button in basic 16-color set, the first value is the name of the color, the second is the ANSI color number - for most languages modification is not likely to be needed - this text is used in two places
pButton - > setText ( tr ( " %1 [%2] " ) . arg ( colorText , QString : : number ( ansiColor ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
pButton - > setStyleSheet ( dlgTriggerEditor : : generateButtonStyleSheet ( color ) ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_rgbColorChanged ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mRgbAnsiColorNumber = 16 + 36 * horizontalSlider_red - > value ( ) + 6 * horizontalSlider_green - > value ( ) + horizontalSlider_blue - > value ( ) ;
mRgbAnsiColor = QColor ( horizontalSlider_red - > value ( ) * 51 , horizontalSlider_green - > value ( ) * 51 , horizontalSlider_blue - > value ( ) * 51 ) ;
2021-12-07 06:21:39 +01:00
label_rgbValue - > setText ( qsl ( " [%1] " ) . arg ( QString : : number ( mRgbAnsiColorNumber ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// Use the same stylesheet code as in the main editor and for the basic 16
// color buttons but because this is a QLabel we need to replace one word in
// the generated stylesheet:
label_rgbValue - > setStyleSheet ( dlgTriggerEditor : : generateButtonStyleSheet ( mRgbAnsiColor ) . replace ( QLatin1String ( " QPushButton " ) , QLatin1String ( " QLabel " ) ) ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_setRBGButtonFocus ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
pushButton_setUsingRgbValue - > setFocus ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_grayColorChanged ( int sliderValue )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mGrayAnsiColorNumber = 232 + sliderValue ;
2023-10-21 21:48:02 +01:00
const int value = sliderValue * 10 + 8 ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mGrayAnsiColor = QColor ( value , value , value ) ;
2021-12-07 06:21:39 +01:00
label_grayValue - > setText ( qsl ( " [%1] " ) . arg ( QString : : number ( mGrayAnsiColorNumber ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// Use the same stylesheet code as in the main editor and for the basic 16
// color buttons but because this is a QLabel we need to replace one word in
// the generated stylesheet:
label_grayValue - > setStyleSheet ( dlgTriggerEditor : : generateButtonStyleSheet ( mGrayAnsiColor ) . replace ( QLatin1String ( " QPushButton " ) , QLatin1String ( " QLabel " ) ) ) ;
if ( horizontalSlider_gray - > value ( ) ! = sliderValue ) {
// This slot is also used to set the value so it may need to reposition
// the slider as well - but we do not want to get into a loop so only
// do this if the values differ:
horizontalSlider_gray - > setValue ( sliderValue ) ;
2009-05-22 19:32:47 +02:00
}
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_setGreyButtonFocus ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
pushButton_setUsingGrayValue - > setFocus ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_basicColorClicked ( int ansiColor )
2009-05-22 19:32:47 +02:00
{
2017-04-27 03:55:38 -07:00
if ( ! mpTrigger ) {
return ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
QColor choosenColor ;
// clang-format off
switch ( ansiColor ) {
case 0 : choosenColor = mpTrigger - > mpHost - > mBlack ; break ;
case 1 : choosenColor = mpTrigger - > mpHost - > mRed ; break ;
case 2 : choosenColor = mpTrigger - > mpHost - > mGreen ; break ;
case 3 : choosenColor = mpTrigger - > mpHost - > mYellow ; break ;
case 4 : choosenColor = mpTrigger - > mpHost - > mBlue ; break ;
case 5 : choosenColor = mpTrigger - > mpHost - > mMagenta ; break ;
case 6 : choosenColor = mpTrigger - > mpHost - > mCyan ; break ;
case 7 : choosenColor = mpTrigger - > mpHost - > mWhite ; break ;
case 8 : choosenColor = mpTrigger - > mpHost - > mLightBlack ; break ;
case 9 : choosenColor = mpTrigger - > mpHost - > mLightRed ; break ;
case 10 : choosenColor = mpTrigger - > mpHost - > mLightGreen ; break ;
case 11 : choosenColor = mpTrigger - > mpHost - > mLightYellow ; break ;
case 12 : choosenColor = mpTrigger - > mpHost - > mLightBlue ; break ;
case 13 : choosenColor = mpTrigger - > mpHost - > mLightMagenta ; break ;
case 14 : choosenColor = mpTrigger - > mpHost - > mLightCyan ; break ;
case 15 : choosenColor = mpTrigger - > mpHost - > mLightWhite ; break ;
default :
Q_UNREACHABLE ( ) ;
}
// clang-format on
2009-05-23 21:29:08 +02:00
mpTrigger - > mColorTrigger = true ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mIsBackground ) {
mpTrigger - > mColorTriggerBgAnsi = ansiColor ;
mpTrigger - > mColorTriggerBgColor = choosenColor ;
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mpTrigger - > mColorTriggerFgAnsi = ansiColor ;
mpTrigger - > mColorTriggerFgColor = choosenColor ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
2009-05-22 19:32:47 +02:00
close ( ) ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_rgbColorClicked ( )
2009-05-22 19:32:47 +02:00
{
2009-05-23 21:29:08 +02:00
mpTrigger - > mColorTrigger = true ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mIsBackground ) {
mpTrigger - > mColorTriggerBgAnsi = mRgbAnsiColorNumber ;
mpTrigger - > mColorTriggerBgColor = mRgbAnsiColor ;
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mpTrigger - > mColorTriggerFgAnsi = mRgbAnsiColorNumber ;
mpTrigger - > mColorTriggerFgColor = mRgbAnsiColor ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
2009-05-22 19:32:47 +02:00
close ( ) ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_grayColorClicked ( )
2009-05-22 19:32:47 +02:00
{
2009-05-23 21:29:08 +02:00
mpTrigger - > mColorTrigger = true ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mIsBackground ) {
mpTrigger - > mColorTriggerBgAnsi = mGrayAnsiColorNumber ;
mpTrigger - > mColorTriggerBgColor = mGrayAnsiColor ;
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mpTrigger - > mColorTriggerFgAnsi = mGrayAnsiColorNumber ;
mpTrigger - > mColorTriggerFgColor = mGrayAnsiColor ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
2009-05-22 19:32:47 +02:00
close ( ) ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_resetColorClicked ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mIsBackground ) {
mpTrigger - > mColorTriggerBgAnsi = TTrigger : : scmIgnored ;
mpTrigger - > mColorTriggerBgColor = QColor ( ) ;
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mpTrigger - > mColorTriggerFgAnsi = TTrigger : : scmIgnored ;
mpTrigger - > mColorTriggerFgColor = QColor ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// Reset mColorTrigger if NEITHER this one OR the other are set
mpTrigger - > mColorTrigger = ( mpTrigger - > mColorTriggerFgAnsi ! = TTrigger : : scmIgnored | | mpTrigger - > mColorTriggerBgAnsi ! = TTrigger : : scmIgnored ) ;
2009-05-22 19:32:47 +02:00
close ( ) ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_defaultColorClicked ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( mIsBackground ) {
mpTrigger - > mColorTriggerBgAnsi = TTrigger : : scmDefault ;
mpTrigger - > mColorTriggerBgColor = QColor ( ) ;
2017-04-27 03:55:38 -07:00
} else {
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
mpTrigger - > mColorTriggerFgAnsi = TTrigger : : scmDefault ;
mpTrigger - > mColorTriggerFgColor = QColor ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
2009-05-22 19:32:47 +02:00
close ( ) ;
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
void dlgColorTrigger : : slot_moreColorsClicked ( )
2009-05-22 19:32:47 +02:00
{
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
// Used to pull the button down if this slot is called from the constructor:
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setChecked ( true ) ;
2021-08-22 08:01:05 +02:00
// Implement a one-shot action by disabling it once it is pressed:
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setEnabled ( false ) ;
2021-12-26 15:22:05 +00:00
buttonBox - > button ( QDialogButtonBox : : Apply ) - > setToolTip ( utils : : richText ( tr ( " All color options are showing. " ) ) ) ;
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( groupBox_rgbScale - > isHidden ( ) ) {
groupBox_rgbScale - > show ( ) ;
2009-05-22 19:32:47 +02:00
}
Refactor: clean up TBuffer text format aspects (#1840)
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>
2019-01-28 23:23:53 +00:00
if ( groupBox_grayScale - > isHidden ( ) ) {
groupBox_grayScale - > show ( ) ;
}
2009-05-22 19:32:47 +02:00
}