Fixed a bug with inline blue, added whispering.

Furthermore, there are no longer any checks on the yellow
and the rainbow colours, they are available from the getgo.
This commit is contained in:
Cerapter 2018-07-26 23:19:32 +02:00
parent 5aacfa8b48
commit 8c81a88e13
2 changed files with 52 additions and 6 deletions

View File

@ -174,8 +174,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_text_color->addItem("Red"); ui_text_color->addItem("Red");
ui_text_color->addItem("Orange"); ui_text_color->addItem("Orange");
ui_text_color->addItem("Blue"); ui_text_color->addItem("Blue");
if (ao_app->yellow_text_enabled) ui_text_color->addItem("Yellow");
ui_text_color->addItem("Yellow"); ui_text_color->addItem("Rainbow");
//ui_text_color->addItem("Pink");
//ui_text_color->addItem("Purple");
ui_music_slider = new QSlider(Qt::Horizontal, this); ui_music_slider = new QSlider(Qt::Horizontal, this);
ui_music_slider->setRange(0, 100); ui_music_slider->setRange(0, 100);
@ -906,7 +908,7 @@ void Courtroom::on_chat_return_pressed()
if (text_color < 0) if (text_color < 0)
f_text_color = "0"; f_text_color = "0";
else if (text_color > 4 && !ao_app->yellow_text_enabled) else if (text_color > 8)
f_text_color = "0"; f_text_color = "0";
else else
f_text_color = QString::number(text_color); f_text_color = QString::number(text_color);
@ -1228,6 +1230,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
else if (f_character == "(" and !ic_next_is_not_special) else if (f_character == "(" and !ic_next_is_not_special)
{ {
ic_colour_stack.push(INLINE_BLUE); ic_colour_stack.push(INLINE_BLUE);
trick_check_pos++;
} }
else if (f_character == ")" and !ic_next_is_not_special else if (f_character == ")" and !ic_next_is_not_special
and !ic_colour_stack.empty()) and !ic_colour_stack.empty())
@ -1235,6 +1238,22 @@ void Courtroom::append_ic_text(QString p_text, QString p_name)
if (ic_colour_stack.top() == INLINE_BLUE) if (ic_colour_stack.top() == INLINE_BLUE)
{ {
ic_colour_stack.pop(); ic_colour_stack.pop();
trick_check_pos++;
}
}
else if (f_character == "[" and !ic_next_is_not_special)
{
ic_colour_stack.push(INLINE_GREY);
trick_check_pos++;
}
else if (f_character == "]" and !ic_next_is_not_special
and !ic_colour_stack.empty())
{
if (ic_colour_stack.top() == INLINE_GREY)
{
ic_colour_stack.pop();
trick_check_pos++;
} }
} }
@ -1459,6 +1478,21 @@ void Courtroom::chat_tick()
} }
} }
else if (f_character == "[" and !next_character_is_not_special)
{
inline_colour_stack.push(INLINE_GREY);
ui_vp_message->insertHtml("<font color=\"#BBBBBB\">" + f_character + "</font>");
}
else if (f_character == "]" and !next_character_is_not_special
and !inline_colour_stack.empty())
{
if (inline_colour_stack.top() == INLINE_GREY)
{
inline_colour_stack.pop();
ui_vp_message->insertHtml("<font color=\"#BBBBBB\">" + f_character + "</font>");
}
}
else if (f_character == "`" and !next_character_is_not_special) else if (f_character == "`" and !next_character_is_not_special)
{ {
if (!inline_colour_stack.empty()) if (!inline_colour_stack.empty())
@ -1493,6 +1527,9 @@ void Courtroom::chat_tick()
case INLINE_GREEN: case INLINE_GREEN:
ui_vp_message->insertHtml("<font color=\"#00FF00\">" + f_character + "</font>"); ui_vp_message->insertHtml("<font color=\"#00FF00\">" + f_character + "</font>");
break; break;
case INLINE_GREY:
ui_vp_message->insertHtml("<font color=\"#BBBBBB\">" + f_character + "</font>");
break;
default: default:
ui_vp_message->insertHtml(f_character); ui_vp_message->insertHtml(f_character);
break; break;
@ -1674,6 +1711,14 @@ void Courtroom::set_text_color()
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: yellow"); "color: yellow");
break; break;
case PINK:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: pink");
break;
case PURPLE:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: purple");
break;
default: default:
qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR]; qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
case WHITE: case WHITE:
@ -1827,9 +1872,9 @@ void Courtroom::on_ooc_return_pressed()
ui_guard->show(); ui_guard->show();
else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended)
{ {
ui_text_color->addItem("Rainbow"); //ui_text_color->addItem("Rainbow");
ui_ooc_chat_message->clear(); ui_ooc_chat_message->clear();
rainbow_appended = true; //rainbow_appended = true;
return; return;
} }

View File

@ -156,7 +156,8 @@ private:
enum INLINE_COLOURS { enum INLINE_COLOURS {
INLINE_BLUE, INLINE_BLUE,
INLINE_GREEN, INLINE_GREEN,
INLINE_ORANGE INLINE_ORANGE,
INLINE_GREY
}; };
// A stack of inline colours. // A stack of inline colours.