diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/aolayer.cpp | 2 | ||||
| -rw-r--r-- | src/courtroom.cpp | 9 | ||||
| -rw-r--r-- | src/demoserver.cpp | 46 | ||||
| -rw-r--r-- | src/text_file_functions.cpp | 34 |
4 files changed, 48 insertions, 43 deletions
diff --git a/src/aolayer.cpp b/src/aolayer.cpp index f0d5779e..18213ce1 100644 --- a/src/aolayer.cpp +++ b/src/aolayer.cpp @@ -156,7 +156,7 @@ void CharLayer::load_image(QString p_filename, QString p_charname, transform_mode = ao_app->get_scaling( ao_app->get_emote_property(p_charname, p_filename, "scaling")); stretch = ao_app->get_emote_property(p_charname, p_filename, "stretch") - .startsWith(true); + .startsWith("true"); if ((p_charname == last_char) && ((p_filename == last_emote) || (p_filename.mid(3, -1) == last_emote.mid(3, -1))) && diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 91ddee4a..494d69f6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1994,15 +1994,6 @@ void Courtroom::chatmessage_enqueue(QStringList p_contents) void Courtroom::chatmessage_dequeue() { - // Chat stopped being processed, indicate that the user can post their message now. - QString f_custom_theme; - if (ao_app->is_customchat_enabled()) { - QString f_char = m_chatmessage[CHAR_NAME]; - f_custom_theme = ao_app->get_chat(f_char); - } - ui_vp_chat_arrow->transform_mode = ao_app->get_misc_scaling(f_custom_theme); - ui_vp_chat_arrow->load_image("chat_arrow", f_custom_theme); - // Nothing to parse in the queue if (chatmessage_queue.isEmpty()) return; diff --git a/src/demoserver.cpp b/src/demoserver.cpp index 509a356a..764cf225 100644 --- a/src/demoserver.cpp +++ b/src/demoserver.cpp @@ -150,7 +150,8 @@ void DemoServer::handle_packet(AOPacket packet) } else if (header == "CC") { client_sock->write("PV#0#CID#-1#%"); - client_sock->write("CT#DEMO#Demo file loaded. Send /play or > in OOC to begin playback.#1#%"); + QString packet = "CT#DEMO#" + tr("Demo file loaded. Send /play or > in OOC to begin playback.") + "#1#%"; + client_sock->write(packet.toUtf8()); } else if (header == "CT") { if (contents[1].startsWith("/load")) @@ -159,14 +160,16 @@ void DemoServer::handle_packet(AOPacket packet) if (path.isEmpty()) return; load_demo(path); - client_sock->write("CT#DEMO#Demo file loaded. Send /play or > in OOC to begin playback.#1#%"); + QString packet = "CT#DEMO#" + tr("Demo file loaded. Send /play or > in OOC to begin playback.") + "#1#%"; + client_sock->write(packet.toUtf8()); } else if (contents[1].startsWith("/play") || contents[1] == ">") { if (timer->interval() != 0 && !timer->isActive()) { timer->start(); - client_sock->write("CT#DEMO#Resuming playback.#1#%"); + QString packet = "CT#DEMO#" + tr("Resuming playback.") + "#1#%"; + client_sock->write(packet.toUtf8()); } else { @@ -180,7 +183,8 @@ void DemoServer::handle_packet(AOPacket packet) int timeleft = timer->remainingTime(); timer->stop(); timer->setInterval(timeleft); - client_sock->write("CT#DEMO#Pausing playback.#1#%"); + QString packet = "CT#DEMO#" + tr("Pausing playback.") + "#1#%"; + client_sock->write(packet.toUtf8()); } else if (contents[1].startsWith("/max_wait")) { @@ -194,29 +198,37 @@ void DemoServer::handle_packet(AOPacket packet) if (p_max_wait < 0) p_max_wait = -1; max_wait = p_max_wait; - client_sock->write("CT#DEMO#Setting max_wait to "); + QString packet = "CT#DEMO#" + tr("Setting max_wait to") + " "; + client_sock->write(packet.toUtf8()); client_sock->write(QString::number(max_wait).toUtf8()); - client_sock->write(" milliseconds.#1#%"); + packet = " " + tr("milliseconds.") + "#1#%"; + client_sock->write(packet.toUtf8()); } else { - client_sock->write("CT#DEMO#Not a valid integer!#1#%"); + QString packet = "CT#DEMO#" + tr("Not a valid integer!") + "#1#%"; + client_sock->write(packet.toUtf8()); } } else { - client_sock->write("CT#DEMO#Current max_wait is "); - client_sock->write(QString::number(max_wait).toUtf8()); - client_sock->write(" milliseconds.#1#%"); + + QString packet = "CT#DEMO#" + tr("Current max_wait is") + " "; + client_sock->write(packet.toUtf8()); + client_sock->write(QString::number(max_wait).toUtf8()); + packet = " " + tr("milliseconds.") + "#1#%"; + client_sock->write(packet.toUtf8()); } } else if (contents[1].startsWith("/min_wait")) { - client_sock->write("CT#DEMO#min_wait is deprecated. Use the client Settings for minimum wait instead!"); + QString packet = "CT#DEMO#" + tr("min_wait is deprecated. Use the client Settings for minimum wait instead!") + "#1#%"; + client_sock->write(packet.toUtf8()); } else if (contents[1].startsWith("/help")) { - client_sock->write("CT#DEMO#Available commands:\nload, play, pause, max_wait, help#1#%"); + QString packet = "CT#DEMO#" + tr("Available commands:\nload, play, pause, max_wait, help") + "#1#%"; + client_sock->write(packet.toUtf8()); } } } @@ -265,12 +277,16 @@ void DemoServer::playback() // Skip the difference on the timers emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration); } + else if (timer->interval() != 0 && duration + elapsed_time > timer->interval()) { + duration = qMax(0, timer->interval() - elapsed_time); + emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration); + } elapsed_time += duration; timer->start(duration); } - else - { - client_sock->write("CT#DEMO#Reached the end of the demo file. Send /play or > in OOC to restart, or /load to open a new file.#1#%"); + else { + QString end_packet = "CT#DEMO#" + tr("Reached the end of the demo file. Send /play or > in OOC to restart, or /load to open a new file.") + "#1#%"; + client_sock->write(end_packet.toUtf8()); timer->setInterval(0); } } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f6a5d6ce..a671d618 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -243,33 +243,31 @@ QVector<server_type> AOApplication::read_serverlist_txt() serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::ReadOnly)) { - return f_server_list; - } + if (serverlist_txt.open(QIODevice::ReadOnly)) { + QTextStream in(&serverlist_txt); - QTextStream in(&serverlist_txt); + while (!in.atEnd()) { + QString line = in.readLine(); + server_type f_server; + QStringList line_contents = line.split(":"); - while (!in.atEnd()) { - QString line = in.readLine(); - server_type f_server; - QStringList line_contents = line.split(":"); - - if (line_contents.size() < 3) - continue; + if (line_contents.size() < 3) + continue; - f_server.ip = line_contents.at(0); - f_server.port = line_contents.at(1).toInt(); - f_server.name = line_contents.at(2); - f_server.desc = ""; + f_server.ip = line_contents.at(0); + f_server.port = line_contents.at(1).toInt(); + f_server.name = line_contents.at(2); + f_server.desc = ""; - f_server_list.append(f_server); + f_server_list.append(f_server); + } } server_type demo_server; demo_server.ip = "127.0.0.1"; demo_server.port = 99999; - demo_server.name = "Demo playback"; - demo_server.desc = "Play back demos you have previously recorded"; + demo_server.name = tr("Demo playback"); + demo_server.desc = tr("Play back demos you have previously recorded"); f_server_list.append(demo_server); return f_server_list; |
