add translation support to demo server messages
This commit is contained in:
parent
6b267e8fdc
commit
b15e669bee
@ -150,7 +150,8 @@ void DemoServer::handle_packet(AOPacket packet)
|
|||||||
}
|
}
|
||||||
else if (header == "CC") {
|
else if (header == "CC") {
|
||||||
client_sock->write("PV#0#CID#-1#%");
|
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") {
|
else if (header == "CT") {
|
||||||
if (contents[1].startsWith("/load"))
|
if (contents[1].startsWith("/load"))
|
||||||
@ -159,14 +160,16 @@ void DemoServer::handle_packet(AOPacket packet)
|
|||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
load_demo(path);
|
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] == ">")
|
else if (contents[1].startsWith("/play") || contents[1] == ">")
|
||||||
{
|
{
|
||||||
if (timer->interval() != 0 && !timer->isActive())
|
if (timer->interval() != 0 && !timer->isActive())
|
||||||
{
|
{
|
||||||
timer->start();
|
timer->start();
|
||||||
client_sock->write("CT#DEMO#Resuming playback.#1#%");
|
QString packet = "CT#DEMO#" + tr("Resuming playback.") + "#1#%";
|
||||||
|
client_sock->write(packet.toUtf8());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -180,7 +183,8 @@ void DemoServer::handle_packet(AOPacket packet)
|
|||||||
int timeleft = timer->remainingTime();
|
int timeleft = timer->remainingTime();
|
||||||
timer->stop();
|
timer->stop();
|
||||||
timer->setInterval(timeleft);
|
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"))
|
else if (contents[1].startsWith("/max_wait"))
|
||||||
{
|
{
|
||||||
@ -194,29 +198,38 @@ void DemoServer::handle_packet(AOPacket packet)
|
|||||||
if (p_max_wait < 0)
|
if (p_max_wait < 0)
|
||||||
p_max_wait = -1;
|
p_max_wait = -1;
|
||||||
max_wait = p_max_wait;
|
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(QString::number(max_wait).toUtf8());
|
||||||
client_sock->write(" milliseconds.#1#%");
|
packet = " " + tr("milliseconds.") + "#1#%";
|
||||||
|
client_sock->write(packet.toUtf8());
|
||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
{
|
{
|
||||||
client_sock->write("CT#DEMO#Current max_wait is ");
|
|
||||||
client_sock->write(QString::number(max_wait).toUtf8());
|
QString packet = "CT#DEMO#" + tr("Current max_wait is") + " ";
|
||||||
client_sock->write(" milliseconds.#1#%");
|
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"))
|
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"))
|
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 +278,16 @@ void DemoServer::playback()
|
|||||||
// Skip the difference on the timers
|
// Skip the difference on the timers
|
||||||
emit skip_timers(wait_packet.get_contents().at(0).toInt() - duration);
|
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;
|
elapsed_time += duration;
|
||||||
timer->start(duration);
|
timer->start(duration);
|
||||||
}
|
}
|
||||||
else
|
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("CT#DEMO#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);
|
timer->setInterval(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user