source/widget/MTextEdit.cpp
/**
 * Repaints the text edit with the changed color of the colorType.
 *
 * @param colorType ColoredMessage::ColorType.
 * @param color New color for the colorType.
 * @param username The username for comparison if the colorType is usercolor.
 */
Repaints the text edit with the changed color of the colorType.


Repaints the text edit with the changed color of the colorType .
void MTextEdit::repaint(const QString& colorType, const QColor& color, const QString& username)
{
    QList<ColoredMessage> currentColoredMessages = coloredMessages;
    resetVariables();
    clear();
    foreach(ColoredMessage coloredMessage, currentColoredMessages)
    {
        if (ColorUtil::toString(coloredMessage.getColorType()).toLower() == colorType.toLower())
        {
            if (coloredMessage.getColorType() == ColoredMessage::USERCOLOR)
            {
                if (username.isEmpty() || coloredMessage.getMessage() == username)
                {
                    coloredMessage.setColor(color);
                }
            }
            else
            {
                coloredMessage.setColor(color);
            }
        }
        else if (colorType.isEmpty())
        {
            coloredMessage.setColor(QColor::Invalid);
        }
        else if (colorType.toLower() == "default"
                && coloredMessage.getColorType() == ColoredMessage::USERCOLOR)
        {
            coloredMessage.setColor(config->getUserColor(coloredMessage.getMessage(), color));
        }
        appendColoredMessage(coloredMessage);
    }
}
void MTextEdit :: repaint ( const QString & colorType , const QColor & color , const QString & username ) { QList < ColoredMessage > currentColoredMessages = coloredMessages ; resetVariables ( ) ; clear ( ) ; foreach ( ColoredMessage coloredMessage , currentColoredMessages ) { if ( ColorUtil :: toString ( coloredMessage . getColorType ( ) ) . toLower ( ) == colorType . toLower ( ) ) { if ( coloredMessage . getColorType ( ) == ColoredMessage :: USERCOLOR ) { if ( username . isEmpty ( ) || coloredMessage . getMessage ( ) == username ) { coloredMessage . setColor ( color ) ; } } else { coloredMessage . setColor ( color ) ; } } else if ( colorType . isEmpty ( ) ) { coloredMessage . setColor ( QColor :: Invalid ) ; } else if ( colorType . toLower ( ) == " " && coloredMessage . getColorType ( ) == ColoredMessage :: USERCOLOR ) { coloredMessage . setColor ( config -> getUserColor ( coloredMessage . getMessage ( ) , color ) ) ; } appendColoredMessage ( coloredMessage ) ; } }
Repaints the text edit with the changed color of the colorType.
Repaints the text edit with the changed color of the colorType .