StelActionService.cpp   StelActionService.cpp 
skipping to change at line 31 skipping to change at line 31
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelActionMgr.hpp" #include "StelActionMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QStringList> #include <QStringList>
StelActionService::StelActionService(const QByteArray &serviceName, QObject *parent) : AbstractAPIService(serviceName,parent) StelActionService::StelActionService(QObject *parent) : AbstractAPIService( parent)
{ {
//this is run in the main thread //this is run in the main thread
actionMgr = StelApp::getInstance().getStelActionManager(); actionMgr = StelApp::getInstance().getStelActionManager();
} }
void StelActionService::getImpl(const QByteArray& operation, const APIParam eters &parameters, APIServiceResponse &response) void StelActionService::get(const QByteArray& operation, const APIParameter s &parameters, APIServiceResponse &response)
{ {
Q_UNUSED(parameters); Q_UNUSED(parameters);
if(operation=="list") if(operation=="list")
{ {
//list all registered StelActions, this should be thread saf e //list all registered StelActions, this should be thread saf e
QJsonObject groupObject; QJsonObject groupObject;
foreach(QString group, actionMgr->getGroupList()) foreach(QString group, actionMgr->getGroupList())
{ {
QJsonArray itemArray; QJsonArray itemArray;
skipping to change at line 70 skipping to change at line 70
response.writeJSON(QJsonDocument(groupObject)); response.writeJSON(QJsonDocument(groupObject));
} }
else else
{ {
//TODO some sort of service description? //TODO some sort of service description?
response.writeRequestError("unsupported operation. GET: list POST: do"); response.writeRequestError("unsupported operation. GET: list POST: do");
} }
} }
void StelActionService::postImpl(const QByteArray& operation, const APIPara meters &parameters, const QByteArray &data, APIServiceResponse &response) void StelActionService::post(const QByteArray& operation, const APIParamete rs &parameters, const QByteArray &data, APIServiceResponse &response)
{ {
Q_UNUSED(data); Q_UNUSED(data);
if(operation == "do") if(operation == "do")
{ {
QString id = QString::fromUtf8(parameters.value("id")); QString id = QString::fromUtf8(parameters.value("id"));
StelAction* action = actionMgr->findAction(id); StelAction* action = actionMgr->findAction(id);
if(!action) if(!action)
{ {
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/