mirror of
https://github.com/simple64/simple64.git
synced 2026-11-12 10:13:48 +01:00
update gui
This commit is contained in:
1 parent
90390c5629
commit
2aebd659d1
7 files changed
+21
-21
No files matched your search
@@ -10,7 +10,7 @@ endif()
|
||||
|
||||
include_directories(../mupen64plus-core/src/api)
|
||||
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x0602ff -DNETPLAY_VER=14)
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x0602ff -DNETPLAY_VER=15)
|
||||
|
||||
if (DEFINED ENV{SIMPLE64_AUTOUPDATE})
|
||||
add_definitions(-D_AUTOUPDATE)
|
||||
|
||||
@@ -177,15 +177,15 @@ void CreateRoom::createRoom()
|
||||
json.insert("emulator", "simple64");
|
||||
|
||||
QJsonDocument json_doc(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
}
|
||||
|
||||
void CreateRoom::processBinaryMessage(QByteArray message)
|
||||
void CreateRoom::processTextMessage(QString message)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setTextFormat(Qt::RichText);
|
||||
msgBox.setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message);
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
QJsonObject json = json_doc.object();
|
||||
if (json.value("type").toString() == "reply_create_room")
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void CreateRoom::handleServerChanged(int index)
|
||||
connect(webSocket, &QWebSocket::disconnected, timer, &QTimer::stop);
|
||||
connect(webSocket, &QObject::destroyed, timer, &QTimer::stop);
|
||||
|
||||
connect(webSocket, &QWebSocket::binaryMessageReceived, this, &CreateRoom::processBinaryMessage);
|
||||
connect(webSocket, &QWebSocket::textMessageReceived, this, &CreateRoom::processTextMessage);
|
||||
|
||||
timer->start(2500);
|
||||
QString serverAddress = serverChooser->itemData(index) == "Custom" ? customServerHost.prepend("ws://") : serverChooser->itemData(index).toString();
|
||||
|
||||
@@ -20,7 +20,7 @@ private slots:
|
||||
void handleCreateButton();
|
||||
void createRoom();
|
||||
void downloadFinished(QNetworkReply *reply);
|
||||
void processBinaryMessage(QByteArray message);
|
||||
void processTextMessage(QString message);
|
||||
void onFinished(int result);
|
||||
void processBroadcast();
|
||||
void handleServerChanged(int index);
|
||||
|
||||
@@ -178,7 +178,7 @@ void JoinRoom::joinGame()
|
||||
json.insert("port", room_port);
|
||||
|
||||
QJsonDocument json_doc(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,7 +230,7 @@ void JoinRoom::serverChanged(int index)
|
||||
connect(webSocket, &QWebSocket::disconnected, connectionTimer, &QTimer::stop);
|
||||
connect(webSocket, &QObject::destroyed, connectionTimer, &QTimer::stop);
|
||||
|
||||
connect(webSocket, &QWebSocket::binaryMessageReceived, this, &JoinRoom::processBinaryMessage);
|
||||
connect(webSocket, &QWebSocket::textMessageReceived, this, &JoinRoom::processTextMessage);
|
||||
|
||||
QTimer *pingTimer = new QTimer(this);
|
||||
connect(webSocket, &QWebSocket::pong, this, &JoinRoom::updatePing);
|
||||
@@ -259,12 +259,12 @@ void JoinRoom::onConnected()
|
||||
json.insert("netplay_version", NETPLAY_VER);
|
||||
json.insert("emulator", "simple64");
|
||||
QJsonDocument json_doc(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
}
|
||||
|
||||
void JoinRoom::processBinaryMessage(QByteArray message)
|
||||
void JoinRoom::processTextMessage(QString message)
|
||||
{
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message);
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
QJsonObject json = json_doc.object();
|
||||
QMessageBox msgBox;
|
||||
msgBox.setTextFormat(Qt::RichText);
|
||||
|
||||
@@ -19,7 +19,7 @@ private slots:
|
||||
void downloadFinished(QNetworkReply *reply);
|
||||
void serverChanged(int index);
|
||||
void onConnected();
|
||||
void processBinaryMessage(QByteArray message);
|
||||
void processTextMessage(QString message);
|
||||
void refresh();
|
||||
void joinGame();
|
||||
void onFinished(int result);
|
||||
|
||||
@@ -19,8 +19,8 @@ WaitRoom::WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidg
|
||||
w->getSettings()->setValue("netplay_name", player_name);
|
||||
|
||||
webSocket = socket;
|
||||
connect(webSocket, &QWebSocket::binaryMessageReceived,
|
||||
this, &WaitRoom::processBinaryMessage);
|
||||
connect(webSocket, &QWebSocket::textMessageReceived,
|
||||
this, &WaitRoom::processTextMessage);
|
||||
|
||||
connect(webSocket, &QWebSocket::pong, this, &WaitRoom::updatePing);
|
||||
|
||||
@@ -88,7 +88,7 @@ WaitRoom::WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidg
|
||||
json.insert("type", "request_players");
|
||||
json.insert("port", room_port);
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
|
||||
timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, this, &WaitRoom::sendPing);
|
||||
@@ -114,7 +114,7 @@ void WaitRoom::sendPing()
|
||||
json.insert("type", "request_motd");
|
||||
json.insert("room_name", room_name);
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
}
|
||||
webSocket->ping();
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void WaitRoom::startGame()
|
||||
json.insert("type", "request_begin_game");
|
||||
json.insert("port", room_port);
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void WaitRoom::sendChat()
|
||||
json.insert("player_name", player_name);
|
||||
json.insert("message", chatEdit->text());
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
webSocket->sendTextMessage(json_doc.toJson());
|
||||
chatEdit->clear();
|
||||
}
|
||||
}
|
||||
@@ -167,9 +167,9 @@ void WaitRoom::onFinished(int)
|
||||
webSocket->deleteLater();
|
||||
}
|
||||
|
||||
void WaitRoom::processBinaryMessage(QByteArray message)
|
||||
void WaitRoom::processTextMessage(QString message)
|
||||
{
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message);
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(message.toUtf8());
|
||||
QJsonObject json = json_doc.object();
|
||||
if (json.value("type").toString() == "reply_players")
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ class WaitRoom : public QDialog
|
||||
public:
|
||||
WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidget *parent = nullptr);
|
||||
private slots:
|
||||
void processBinaryMessage(QByteArray message);
|
||||
void processTextMessage(QString message);
|
||||
void onFinished(int);
|
||||
void sendChat();
|
||||
void startGame();
|
||||
|
||||
Reference in new issue
Block a user