mirror of
https://github.com/simple64/simple64.git
synced 2026-11-12 02:38:42 +01:00
update gui
This commit is contained in:
1 parent
40f9943404
commit
a79c4312e5
5 files changed
+3
-51
No files matched your search
@@ -18,7 +18,7 @@ endif()
|
||||
|
||||
include_directories(../mupen64plus-core/src/api)
|
||||
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x0602ff -DNETPLAY_VER=10)
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x0602ff -DNETPLAY_VER=11)
|
||||
|
||||
if (DEFINED ENV{SIMPLE64_AUTOUPDATE})
|
||||
add_definitions(-D_AUTOUPDATE)
|
||||
|
||||
@@ -365,7 +365,6 @@ void MainWindow::setupDiscord()
|
||||
if (discord_app.core)
|
||||
{
|
||||
discord_app.activities = discord_app.core->get_activity_manager(discord_app.core);
|
||||
discord_app.lobbies = discord_app.core->get_lobby_manager(discord_app.core);
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, this, &MainWindow::discordCallback);
|
||||
|
||||
@@ -25,7 +25,6 @@ class MainWindow;
|
||||
struct Discord_Application {
|
||||
struct IDiscordCore* core;
|
||||
struct IDiscordActivityManager* activities;
|
||||
struct IDiscordLobbyManager* lobbies;
|
||||
};
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
|
||||
@@ -66,23 +66,18 @@ WaitRoom::WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidg
|
||||
connect(chatEdit, &QLineEdit::returnPressed, this, &WaitRoom::sendChat);
|
||||
layout->addWidget(chatEdit, 10, 0, 1, 2);
|
||||
|
||||
discordCheckbox = new QCheckBox("Join Discord Voice Chat (must have Discord App running)", this);
|
||||
discordCheckbox->setEnabled(false);
|
||||
layout->addWidget(discordCheckbox, 11, 0, 1, 2);
|
||||
connect(discordCheckbox, &QCheckBox::stateChanged, this, &WaitRoom::discordCheck);
|
||||
|
||||
startGameButton = new QPushButton(this);
|
||||
startGameButton->setText("Start Game");
|
||||
startGameButton->setAutoDefault(0);
|
||||
connect(startGameButton, &QPushButton::released, this, &WaitRoom::startGame);
|
||||
layout->addWidget(startGameButton, 12, 0, 1, 2);
|
||||
layout->addWidget(startGameButton, 11, 0, 1, 2);
|
||||
|
||||
motd = new QLabel(this);
|
||||
motd->setTextFormat(Qt::RichText);
|
||||
motd->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
motd->setOpenExternalLinks(true);
|
||||
motd->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(motd, 13, 0, 1, 2);
|
||||
layout->addWidget(motd, 12, 0, 1, 2);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
@@ -110,29 +105,6 @@ WaitRoom::WaitRoom(QString filename, QJsonObject room, QWebSocket *socket, QWidg
|
||||
w->updateDiscordActivity(activity);
|
||||
}
|
||||
|
||||
static void discordConnectCallback(void*, enum EDiscordResult result, struct DiscordLobby* lobby)
|
||||
{
|
||||
if (result == DiscordResult_Ok)
|
||||
w->getDiscordApp()->lobbies->connect_voice(w->getDiscordApp()->lobbies, lobby->id, w->getDiscordApp(), nullptr);
|
||||
}
|
||||
|
||||
static void discordDisconnectCallback(void* _discord_id, enum EDiscordResult)
|
||||
{
|
||||
QString* id = (QString*) _discord_id;
|
||||
w->getDiscordApp()->lobbies->disconnect_lobby(w->getDiscordApp()->lobbies, id->toLongLong(), w->getDiscordApp(), nullptr);
|
||||
}
|
||||
|
||||
void WaitRoom::discordCheck(int state)
|
||||
{
|
||||
if (!w->getDiscordApp()->lobbies)
|
||||
return;
|
||||
|
||||
if (state == Qt::Checked)
|
||||
w->getDiscordApp()->lobbies->connect_lobby(w->getDiscordApp()->lobbies, discord_id.toLongLong(), discord_secret.toUtf8().data(), w->getDiscordApp(), discordConnectCallback);
|
||||
else if (state == Qt::Unchecked)
|
||||
w->getDiscordApp()->lobbies->disconnect_voice(w->getDiscordApp()->lobbies, discord_id.toLongLong(), &discord_id, discordDisconnectCallback);
|
||||
}
|
||||
|
||||
void WaitRoom::sendPing()
|
||||
{
|
||||
if (motd->text().isEmpty())
|
||||
@@ -143,14 +115,6 @@ void WaitRoom::sendPing()
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
}
|
||||
if (!discordCheckbox->isEnabled() && w->getDiscordApp()->lobbies)
|
||||
{
|
||||
QJsonObject json;
|
||||
json.insert("type", "get_discord_lobby");
|
||||
json.insert("port", room_port);
|
||||
QJsonDocument json_doc = QJsonDocument(json);
|
||||
webSocket->sendBinaryMessage(json_doc.toJson());
|
||||
}
|
||||
webSocket->ping();
|
||||
}
|
||||
|
||||
@@ -235,10 +199,4 @@ void WaitRoom::processBinaryMessage(QByteArray message)
|
||||
QString message = json.value("message").toString();
|
||||
motd->setText(message);
|
||||
}
|
||||
else if (json.value("type").toString() == "discord_lobby")
|
||||
{
|
||||
discord_id = json.value("id").toString();
|
||||
discord_secret = json.value("secret").toString();
|
||||
discordCheckbox->setEnabled(true);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ private slots:
|
||||
void startGame();
|
||||
void updatePing(quint64 elapsedTime, const QByteArray &payload);
|
||||
void sendPing();
|
||||
void discordCheck(int state);
|
||||
private:
|
||||
QWebSocket *webSocket = nullptr;
|
||||
QLabel *pName[4];
|
||||
@@ -39,9 +38,6 @@ private:
|
||||
QLabel *pingValue;
|
||||
QLabel *motd;
|
||||
QTimer *timer;
|
||||
QCheckBox *discordCheckbox;
|
||||
QString discord_id;
|
||||
QString discord_secret;
|
||||
int started;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user