tabs vs. spaces: the eternal struggle

This commit is contained in:
David Skoland 2018-02-08 12:52:03 +01:00
parent ebe4968175
commit 403e5b4328

View File

@ -81,7 +81,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app);
ui_vp_objection = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app);
ui_ic_chatlog = new QTextEdit(this); ui_ic_chatlog = new QTextEdit(this);
ui_ic_chatlog->setReadOnly(true); ui_ic_chatlog->setReadOnly(true);
ui_ms_chatlog = new AOTextArea(this); ui_ms_chatlog = new AOTextArea(this);
@ -964,7 +964,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_evidence_present->set_image("present_disabled.png"); ui_evidence_present->set_image("present_disabled.png");
} }
append_ic_text(": " + m_chatmessage[MESSAGE], f_showname); append_ic_text(": " + m_chatmessage[MESSAGE], f_showname);
previous_ic_message = f_message; previous_ic_message = f_message;
@ -1150,18 +1150,18 @@ void Courtroom::handle_chatmessage_3()
void Courtroom::append_ic_text(QString p_text, QString p_name) void Courtroom::append_ic_text(QString p_text, QString p_name)
{ {
QTextCharFormat bold; QTextCharFormat bold;
QTextCharFormat normal; QTextCharFormat normal;
bold.setFontWeight(QFont::Bold); bold.setFontWeight(QFont::Bold);
normal.setFontWeight(QFont::Normal); normal.setFontWeight(QFont::Normal);
const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const QTextCursor old_cursor = ui_ic_chatlog->textCursor();
const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value();
const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->moveCursor(QTextCursor::Start);
ui_ic_chatlog->textCursor().insertText(p_name, bold); ui_ic_chatlog->textCursor().insertText(p_name, bold);
ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
if (old_cursor.hasSelection() || !is_scrolled_up) if (old_cursor.hasSelection() || !is_scrolled_up)
{ {
@ -1531,7 +1531,7 @@ void Courtroom::handle_song(QStringList *p_contents)
if (!mute_map.value(n_char)) if (!mute_map.value(n_char))
{ {
append_ic_text(" has played a song: " + f_song, str_char); append_ic_text(" has played a song: " + f_song, str_char);
music_player->play(f_song); music_player->play(f_song);
} }
} }