Skip to content
Snippets Groups Projects
Commit 45a9891c authored by Jan Möbius's avatar Jan Möbius
Browse files

Moved some code to c files

parent 6010970d
No related branches found
No related tags found
1 merge request!122Enable automoc
......@@ -39,15 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 11127 $ *
* $LastChangedBy: moebius $ *
* $Date: 2011-03-15 16:18:28 +0100 (Di, 15 Mär 2011) $ *
* *
\*===========================================================================*/
#pragma once
/** \file AboutInfoInterface.hh
......
......@@ -39,16 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
......@@ -56,7 +46,6 @@
//
//=============================================================================
#define BASEOBJECT_C
//== INCLUDES =================================================================
......@@ -65,6 +54,9 @@
#include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <QJsonDocument>
#include <QJsonObject>
//== TYPEDEFS =================================================================
......@@ -829,6 +821,37 @@ deleteData() {
}
/** Returns a flat, human readable representation of all comments. */
const QString BaseObject::getAllCommentsFlat() const {
QStringList result;
result.append(QString("BEGIN Comments for object \"%1\"").arg(name()));
/*
* Compose JSON parsable object.
*/
QJsonObject comment_obj;
for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
it != it_end; ++it) {
QJsonParseError json_error;
QString test_json_str = QString::fromUtf8("{\"test\": %1}").arg(it.value());
QByteArray test_json_ba = test_json_str.toUtf8();
QJsonDocument test_json = QJsonDocument::fromJson(test_json_ba, &json_error);
if (json_error.error != QJsonParseError::NoError) {
comment_obj[it.key()] = it.value();
} else {
comment_obj[it.key()] = test_json.object().value("test");
}
}
result.append(QString::fromUtf8(QJsonDocument(comment_obj).toJson(QJsonDocument::Indented)));
result.append(QString("END Comments for object \"%1\"\n").arg(name()));
return result.join("\n");
}
QMap<QString, PerObjectData*>& BaseObject::getPerObjectDataMap() {
return dataMap_;
}
......
......@@ -39,16 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
......@@ -61,24 +51,24 @@
* This File contains the Basic object class for all Objects (Includes also non visual objects such as Groups).
*/
#ifndef BASEOBJECT_HH
#define BASEOBJECT_HH
#pragma once
//== INCLUDES =================================================================
#include <OpenFlipper/common/GlobalDefines.hh>
#include <OpenFlipper/common/DataTypes.hh>
#include <OpenFlipper/common/UpdateType.hh>
#include "perObjectData.hh"
#include <vector>
#include <QObject>
#include <QString>
#include <QList>
#include <QStringList>
#include <vector>
#include <QMap>
#include "perObjectData.hh"
#include <QJsonDocument>
#include <QJsonObject>
//== TYPEDEFS =================================================================
......@@ -588,34 +578,7 @@ class DLLEXPORT BaseObject : public QObject {
}
/** Returns a flat, human readable representation of all comments. */
const QString getAllCommentsFlat() const {
QStringList result;
result.append(QString("BEGIN Comments for object \"%1\"").arg(name()));
/*
* Compose JSON parsable object.
*/
QJsonObject comment_obj;
for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
it != it_end; ++it) {
QJsonParseError json_error;
QString test_json_str = QString::fromUtf8("{\"test\": %1}").arg(it.value());
QByteArray test_json_ba = test_json_str.toUtf8();
QJsonDocument test_json = QJsonDocument::fromJson(test_json_ba, &json_error);
if (json_error.error != QJsonParseError::NoError) {
comment_obj[it.key()] = it.value();
} else {
comment_obj[it.key()] = test_json.object().value("test");
}
}
result.append(QString::fromUtf8(QJsonDocument(comment_obj).toJson(QJsonDocument::Indented)));
result.append(QString("END Comments for object \"%1\"\n").arg(name()));
return result.join("\n");
}
const QString getAllCommentsFlat() const;
private:
QMap<QString, QString> commentsByKey_;
......@@ -624,7 +587,3 @@ class DLLEXPORT BaseObject : public QObject {
};
//=============================================================================
#endif // BASEOBJECT_HH defined
//=============================================================================
......@@ -39,17 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Global defines for OpenFlipper
......@@ -61,8 +50,7 @@
* This File contains the required defines for the OpenFlipper Framework
*/
#ifndef GLOBALDEFINES_HH
#define GLOBALDEFINES_HH
#pragma once
/**
......@@ -115,6 +103,3 @@
#endif
//=============================================================================
#endif // GLOBALDEFINES_HH defined
//=============================================================================
......@@ -39,17 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Types
......@@ -61,11 +50,7 @@
* This File contains the basic available datatypes in the Framework.
*/
#ifndef TYPES_HH
#define TYPES_HH
#pragma once
//== INCLUDES =================================================================
......@@ -80,6 +65,3 @@
#include "BaseObjectData.hh"
//=============================================================================
#endif // TYPES_HH defined
//=============================================================================
......@@ -39,17 +39,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Types
......@@ -61,9 +50,7 @@
* This File contains a basic data class used to attach data to objects.
*/
#ifndef PEROBJECTDATA_HH
#define PEROBJECTDATA_HH
#pragma once
//== INCLUDES =================================================================
......@@ -130,6 +117,3 @@ PER_OBJECT_DATA(UIntPerObjectData, unsigned int );
PER_OBJECT_DATA(FloatPerObjectData, float );
PER_OBJECT_DATA(DoublePerObjectData, double );
//=============================================================================
#endif // PEROBJECTDATA_HH defined
//=============================================================================
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment