mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add hyperion-remote instance cmd (#596)
* Add hyperion-remote instance cmd - Adds a new command to hyperion-remote that allows the selection of a instance by name - Fixed broken umlauts - Fixed wrong text placement inside icon tags * Add warning if selected instance is not found
This commit is contained in:
@@ -199,7 +199,14 @@ void JsonConnection::deleteEffect(const QString &effectName)
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
QString JsonConnection::getServerInfo()
|
||||
QString JsonConnection::getServerInfoString()
|
||||
{
|
||||
QJsonDocument doc(getServerInfo());
|
||||
QString info(doc.toJson(QJsonDocument::Indented));
|
||||
return info;
|
||||
}
|
||||
|
||||
QJsonObject JsonConnection::getServerInfo()
|
||||
{
|
||||
qDebug() << "Get server info";
|
||||
|
||||
@@ -218,12 +225,10 @@ QString JsonConnection::getServerInfo()
|
||||
throw std::runtime_error("No info available in result");
|
||||
}
|
||||
|
||||
QJsonDocument doc(reply["info"].toObject());
|
||||
QString info(doc.toJson(QJsonDocument::Indented));
|
||||
return info;
|
||||
return reply["info"].toObject();
|
||||
}
|
||||
|
||||
return QString();
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
QString JsonConnection::getSysInfo()
|
||||
@@ -562,6 +567,21 @@ void JsonConnection::setToken(const QString &token)
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
void JsonConnection::setInstance(const int &instance)
|
||||
{
|
||||
// create command
|
||||
QJsonObject command;
|
||||
command["command"] = QString("instance");
|
||||
command["subcommand"] = QString("switchTo");
|
||||
command["instance"] = instance;
|
||||
|
||||
// send command message
|
||||
QJsonObject reply = sendMessage(command);
|
||||
|
||||
// parse reply message
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
QJsonObject JsonConnection::sendMessage(const QJsonObject & message)
|
||||
{
|
||||
// serialize message
|
||||
@@ -607,7 +627,7 @@ QJsonObject JsonConnection::sendMessage(const QJsonObject & message)
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string("Error while parsing json reply: ")
|
||||
std::string("Error while parsing json reply: ")
|
||||
+ error.errorString().toStdString() );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user