ObjectService.cpp   ObjectService.cpp 
skipping to change at line 27 skipping to change at line 27
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "ObjectService.hpp" #include "ObjectService.hpp"
#include "SearchDialog.hpp" #include "SearchDialog.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelModuleMgr.hpp"
#include "StelObjectMgr.hpp"
#include "LandscapeMgr.hpp"
#include <QEventLoop> #include <QEventLoop>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QSettings> #include <QSettings>
#include <QMutex> #include <QMutex>
#include <QThreadPool> #include <QThreadPool>
#include <QRunnable> #include <QRunnable>
#include <QWaitCondition> #include <QWaitCondition>
skipping to change at line 114 skipping to change at line 117
//return as json //return as json
response.writeJSON(QJsonDocument(QJsonArray::fromStringList( results))); response.writeJSON(QJsonDocument(QJsonArray::fromStringList( results)));
} }
else if (operation == "info") else if (operation == "info")
{ {
//retrieve HTML info string about a specific object //retrieve HTML info string about a specific object
//if no parameter is given, uses the currently selected obje ct //if no parameter is given, uses the currently selected obje ct
QString name = QString::fromUtf8(parameters.value("name")); QString name = QString::fromUtf8(parameters.value("name"));
QString formatStr = QString::fromUtf8(parameters.value("form
at"));
bool formatHtml;
if (formatStr == "map")
formatHtml=false;
else
formatHtml=true;
StelObjectP obj; StelObjectP obj;
if(!name.isEmpty()) if(!name.isEmpty())
{ {
QMetaObject::invokeMethod(this,"findObject",SERVICE_ DEFAULT_INVOKETYPE, QMetaObject::invokeMethod(this,"findObject",SERVICE_ DEFAULT_INVOKETYPE,
Q_RETURN_ARG(StelObjectP,o bj), Q_RETURN_ARG(StelObjectP,o bj),
Q_ARG(QString,name)); Q_ARG(QString,name));
if(!obj) if(!obj)
{ {
skipping to change at line 142 skipping to change at line 151
const QList<StelObjectP> selection = objMgr->getSele ctedObject(); const QList<StelObjectP> selection = objMgr->getSele ctedObject();
if(selection.isEmpty()) if(selection.isEmpty())
{ {
response.setStatus(404,"not found"); response.setStatus(404,"not found");
response.setData("no current selection, and no name parameter given"); response.setData("no current selection, and no name parameter given");
return; return;
} }
obj = selection[0]; obj = selection[0];
} }
QString infoStr; if (formatHtml)
QMetaObject::invokeMethod(this,"getInfoString",SERVICE_DEFAU {
LT_INVOKETYPE, QString infoStr;
Q_RETURN_ARG(QString,infoStr), QMetaObject::invokeMethod(this,"getInfoString",SERVI
Q_ARG(StelObjectP,obj)); CE_DEFAULT_INVOKETYPE,
Q_RETURN_ARG(QString,infoS
tr),
Q_ARG(StelObjectP,obj));
response.setData(infoStr.toUtf8());
}
else
{
QJsonObject infoObj;
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
StelObjectP obj = omgr->searchByName(name);
QVariantMap infoMap=StelObjectMgr::getObjectInfo(obj
);
QVariantMap::const_iterator i;
for (i=infoMap.constBegin(); i!=infoMap.constEnd();
++i)
infoObj.insert(i.key(), i.value().toString()
);
// We make use of 2 extra values for linked applicat
ions. These govern sky brightness and can be used for ambient settings.
LandscapeMgr *lmgr=GETSTELMODULE(LandscapeMgr);
infoObj.insert("ambientLum", QString().setNum(lmgr->
getAtmosphereAverageLuminance()));
infoObj.insert("ambientInt", QString().setNum(lmgr->
getCurrentLandscape()->getBrightness()));
response.writeJSON(QJsonDocument(infoObj));
response.setData(infoStr.toUtf8()); }
} }
else if (operation == "listobjecttypes") else if (operation == "listobjecttypes")
{ {
//lists the available types of objects //lists the available types of objects
QMap<QString,QString> map = objMgr->objectModulesMap(); QMap<QString,QString> map = objMgr->objectModulesMap();
QMapIterator<QString,QString> it(map); QMapIterator<QString,QString> it(map);
StelTranslator& trans = *StelTranslator::globalTranslator; StelTranslator& trans = *StelTranslator::globalTranslator;
QJsonArray arr; QJsonArray arr;
 End of changes. 4 change blocks. 
6 lines changed or deleted 43 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/