Panel circle for visual feedback
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "WebSocketController.h"
|
||||
#include "GamesPanel.h"
|
||||
#include "LogPanel.h"
|
||||
#include "PanelsPanel.h"
|
||||
#include "PowerPanel.h"
|
||||
#include "SettingsTree.h"
|
||||
#include "VersionsPanel.h"
|
||||
@@ -27,10 +28,11 @@ void WebSocketController::setSettingsTree(SettingsTree *tree)
|
||||
this, &WebSocketController::onValueEdited);
|
||||
}
|
||||
|
||||
void WebSocketController::setGamesPanel(GamesPanel *panel) { m_gamesPanel = panel; }
|
||||
void WebSocketController::setVersionsPanel(VersionsPanel *p) { m_versionsPanel = p; }
|
||||
void WebSocketController::setPowerPanel(PowerPanel *panel) { m_powerPanel = panel; }
|
||||
void WebSocketController::setLogPanel(LogPanel *panel) { m_logPanel = panel; }
|
||||
void WebSocketController::setGamesPanel(GamesPanel *panel) { m_gamesPanel = panel; }
|
||||
void WebSocketController::setVersionsPanel(VersionsPanel *p) { m_versionsPanel = p; }
|
||||
void WebSocketController::setPowerPanel(PowerPanel *panel) { m_powerPanel = panel; }
|
||||
void WebSocketController::setLogPanel(LogPanel *panel) { m_logPanel = panel; }
|
||||
void WebSocketController::setPanelsPanel(PanelsPanel *panel) { m_panelsPanel = panel; }
|
||||
|
||||
bool WebSocketController::isConnected() const
|
||||
{
|
||||
@@ -53,6 +55,7 @@ void WebSocketController::closeConnection()
|
||||
m_rnpCount = -1;
|
||||
if (m_versionsPanel) m_versionsPanel->reset();
|
||||
if (m_powerPanel) m_powerPanel->reset();
|
||||
if (m_panelsPanel) m_panelsPanel->reset();
|
||||
m_socket.close();
|
||||
}
|
||||
|
||||
@@ -71,7 +74,7 @@ void WebSocketController::onConnected()
|
||||
|
||||
sendCommand(QStringLiteral("GBL List"));
|
||||
sendCommand(QStringLiteral("GAM list"));
|
||||
sendCommand(QStringLiteral("GAM listall")); // <-- fetch full catalogue
|
||||
sendCommand(QStringLiteral("GAM listall"));
|
||||
sendCommand(QStringLiteral("NAM"));
|
||||
sendCommand(QStringLiteral("VER"));
|
||||
sendCommand(QStringLiteral("UID"));
|
||||
@@ -80,6 +83,12 @@ void WebSocketController::onConnected()
|
||||
sendCommand(QStringLiteral("#P0-P RTV"));
|
||||
sendCommand(QStringLiteral("#P0-P VTG"));
|
||||
sendCommand(QStringLiteral("LOG"));
|
||||
sendCommand(QStringLiteral("GBL brightnessMin"));
|
||||
sendCommand(QStringLiteral("GBL brightnessMax"));
|
||||
sendCommand(QStringLiteral("GBL brightness"));
|
||||
sendCommand(QStringLiteral("GBL sound/volumeMin"));
|
||||
sendCommand(QStringLiteral("GBL sound/volumeMax"));
|
||||
sendCommand(QStringLiteral("GBL sound/volume"));
|
||||
}
|
||||
|
||||
void WebSocketController::onDisconnected()
|
||||
@@ -88,6 +97,7 @@ void WebSocketController::onDisconnected()
|
||||
m_statusLabel->setText("Disconnected");
|
||||
m_settingsKeys.clear();
|
||||
m_rnpCount = -1;
|
||||
if (m_panelsPanel) m_panelsPanel->reset();
|
||||
}
|
||||
|
||||
void WebSocketController::onTextMessageReceived(const QString &msg)
|
||||
@@ -114,7 +124,7 @@ void WebSocketController::handleProtocol(const QString &msg)
|
||||
if (tokens.isEmpty()) return;
|
||||
const QString cmd = tokens[0];
|
||||
|
||||
// ---- Power: #P0-P STA/RTV/VTG ----
|
||||
// ---- Power ----
|
||||
if (cmd == "#P0-P" && tokens.size() >= 2 && m_powerPanel) {
|
||||
const QString sub = tokens[1];
|
||||
if (sub == "STA" && tokens.size() >= 3) m_powerPanel->setStatus(tokens[2]);
|
||||
@@ -123,7 +133,7 @@ void WebSocketController::handleProtocol(const QString &msg)
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- LOG channel list ----
|
||||
// ---- LOG ----
|
||||
if (cmd == "LOG" && tokens.size() > 1 && m_logPanel) {
|
||||
bool isList = true;
|
||||
for (int i = 1; i < tokens.size(); ++i)
|
||||
@@ -140,15 +150,13 @@ void WebSocketController::handleProtocol(const QString &msg)
|
||||
|
||||
// ---- VER ----
|
||||
if (cmd == "VER" && tokens.size() >= 3) {
|
||||
if (m_versionsPanel)
|
||||
m_versionsPanel->setVersion(tokens[1], tokens.mid(2).join(' '));
|
||||
if (m_versionsPanel) m_versionsPanel->setVersion(tokens[1], tokens.mid(2).join(' '));
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- UID ----
|
||||
if (cmd == "UID" && tokens.size() >= 3) {
|
||||
if (m_versionsPanel)
|
||||
m_versionsPanel->setUid(tokens[1], tokens.mid(2).join(' '));
|
||||
if (m_versionsPanel) m_versionsPanel->setUid(tokens[1], tokens.mid(2).join(' '));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,6 +167,7 @@ void WebSocketController::handleProtocol(const QString &msg)
|
||||
if (ok && count > 0) {
|
||||
m_rnpCount = count;
|
||||
if (m_versionsPanel) m_versionsPanel->setRnpCount(count);
|
||||
if (m_panelsPanel) m_panelsPanel->setRnpCount(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
sendCommand(QString("VER %1").arg(i));
|
||||
sendCommand(QString("UID %1").arg(i));
|
||||
@@ -167,13 +176,13 @@ void WebSocketController::handleProtocol(const QString &msg)
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- GAM listall — full catalogue ----
|
||||
// ---- GAM listall ----
|
||||
if (cmd == "GAM" && tokens.size() >= 2 && tokens[1] == "listall") {
|
||||
if (m_gamesPanel) m_gamesPanel->loadAllFromResponse(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- GAM list — installed games ----
|
||||
// ---- GAM list ----
|
||||
if (cmd == "GAM" && tokens.size() >= 2 && tokens[1] == "list") {
|
||||
if (m_gamesPanel) m_gamesPanel->loadFromResponse(msg);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user