fixed some crashes and started on music list

This commit is contained in:
David Skoland 2017-02-08 09:21:54 +01:00
parent 85e3938fc6
commit 723ef24e46
4 changed files with 29 additions and 7 deletions

View File

@ -600,12 +600,36 @@ void Courtroom::enter_courtroom(int p_cid)
ui_flip->show();
}
list_music();
ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(true);
ui_ic_chat_message->setFocus();
}
void Courtroom::list_music()
{
ui_music_list->clear();
for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
{
QString i_song = music_list.at(n_song);
if (i_song.toLower().contains(ui_music_search->text().toLower()))
{
ui_music_list->addItem(i_song);
QString song_path = ao_app->get_base_path() + "sounds/music/" + i_song.toLower();
if (file_exists(song_path))
ui_music_list->item(n_song)->setBackground(Qt::green);
else
ui_music_list->item(n_song)->setBackground(Qt::red);
}
}
}
void Courtroom::append_ms_chatmessage(QString f_message)
{
const QTextCursor old_cursor = ui_ms_chatlog->textCursor();

View File

@ -56,6 +56,7 @@ public:
QString get_current_char() {return current_char;}
void enter_courtroom(int p_cid);
void list_music();
void append_ms_chatmessage(QString f_message);
void append_server_chatmessage(QString f_message);

View File

@ -104,12 +104,8 @@ void Courtroom::on_emote_clicked(int p_id)
f_emote->set_off(current_char, n_real_emote);
}
qDebug() << "on_emote_clicked with current_emote " << current_emote;
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
qDebug() << "on_emote_clicked called with emote mod " << emote_mod;
if (emote_mod == 1 ||
emote_mod == 3 ||
emote_mod == 4)

View File

@ -297,7 +297,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_contents.size() < 3)
goto end;
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
if (courtroom_constructed)
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
}
else if (header == "MS")
{
@ -308,8 +309,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
if (f_contents.size() < 1)
goto end;
w_courtroom->handle_wtce(f_contents.at(0));
if (courtroom_constructed)
w_courtroom->handle_wtce(f_contents.at(0));
}
else if (header == "checkconnection")
{