Merge pull request #316 from AttorneyOnline/messagebox

add BB packet for a MessageBox popup
This commit is contained in:
oldmud0 2021-01-06 12:41:52 -06:00 committed by GitHub
commit d308fc83de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -133,7 +133,7 @@ void Courtroom::char_clicked(int n_char)
qDebug() << "char_ini_path" << char_ini_path; qDebug() << "char_ini_path" << char_ini_path;
if (!file_exists(char_ini_path)) { if (!file_exists(char_ini_path)) {
call_notice("Could not find " + char_ini_path); call_error("Could not find " + char_ini_path);
return; return;
} }
} }

View File

@ -1,5 +1,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QMessageBox> #include <QMessageBox>
#include <QTimer>
#include <functional>
#include "debug_functions.h" #include "debug_functions.h"
@ -24,6 +26,10 @@ void call_notice(QString p_message)
msgBox->setWindowTitle( msgBox->setWindowTitle(
QCoreApplication::translate("debug_functions", "Notice")); QCoreApplication::translate("debug_functions", "Notice"));
// msgBox->setWindowModality(Qt::NonModal); msgBox->setStandardButtons(QMessageBox::NoButton);
msgBox->exec();
QTimer::singleShot(3000, msgBox, std::bind(&QMessageBox::setStandardButtons,msgBox,QMessageBox::Ok));
msgBox->exec();
} }

View File

@ -535,6 +535,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (courtroom_constructed && f_contents.size() > 0) if (courtroom_constructed && f_contents.size() > 0)
w_courtroom->set_mute(false, f_contents.at(0).toInt()); w_courtroom->set_mute(false, f_contents.at(0).toInt());
} }
else if (header == "BB") {
if (courtroom_constructed && f_contents.size() >= 1) {
call_notice(f_contents.at(0));
}
}
else if (header == "KK") { else if (header == "KK") {
if (courtroom_constructed && f_contents.size() >= 1) { if (courtroom_constructed && f_contents.size() >= 1) {
call_notice(tr("You have been kicked from the server.\nReason: %1") call_notice(tr("You have been kicked from the server.\nReason: %1")