mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 12:45:40 +08:00
refs #507, split up blackmiscfreefunctions
* single register metadata functions * string utils * metadata utils * some formatting / license header where applicable
This commit is contained in:
29
src/blackmisc/audio/registermetadataaudio.cpp
Normal file
29
src/blackmisc/audio/registermetadataaudio.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadataaudio.h"
|
||||
#include "audio.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
//! Register metadata for audio / voice
|
||||
void registerMetadata()
|
||||
{
|
||||
CAudioDeviceInfo::registerMetadata();
|
||||
CAudioDeviceInfoList::registerMetadata();
|
||||
CVoiceRoom::registerMetadata();
|
||||
CVoiceRoomList::registerMetadata();
|
||||
Settings::CSettingsAudio::registerMetadata();
|
||||
qDBusRegisterMetaType<BlackMisc::Audio::CNotificationSounds::PlayMode>();
|
||||
qDBusRegisterMetaType<BlackMisc::Audio::CNotificationSounds::Notification>();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/audio/registermetadataaudio.h
Normal file
26
src/blackmisc/audio/registermetadataaudio.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_AUDIO_REGISTERMETADATAAUDIO_H
|
||||
#define BLACKMISC_AUDIO_REGISTERMETADATAAUDIO_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Audio
|
||||
{
|
||||
//! Register metadata for audio / voice
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "aircraftengine.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "aircraftlights.h"
|
||||
#include "blackmisc/variant.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "aircraftparts.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* Copyright (C) 2014
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/aviation/aviation.h"
|
||||
|
||||
/*
|
||||
* Metadata for aviation
|
||||
*
|
||||
* In a separate file to workaround a limitation of MinGW:
|
||||
* http://stackoverflow.com/q/16596876/1639256
|
||||
*/
|
||||
void BlackMisc::Aviation::registerMetadata()
|
||||
{
|
||||
CComSystem::registerMetadata();
|
||||
CNavSystem::registerMetadata();
|
||||
CAdfSystem::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CTransponder::registerMetadata();
|
||||
CHeading::registerMetadata();
|
||||
CTrack::registerMetadata();
|
||||
CInformationMessage::registerMetadata();
|
||||
CCallsign::registerMetadata();
|
||||
CCallsignSet::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
CAtcStationList::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAircraftSituation::registerMetadata();
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAircraftIcaoCode::registerMetadata();
|
||||
CAircraftIcaoCodeList::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CSelcal::registerMetadata();
|
||||
CFlightPlan::registerMetadata();
|
||||
CAircraftEngine::registerMetadata();
|
||||
CAircraftEngineList::registerMetadata();
|
||||
CAircraftLights::registerMetadata();
|
||||
CAircraftParts::registerMetadata();
|
||||
CAircraftPartsList::registerMetadata();
|
||||
CLivery::registerMetadata();
|
||||
CLiveryList::registerMetadata();
|
||||
}
|
||||
51
src/blackmisc/aviation/registermetadataaviation.cpp
Normal file
51
src/blackmisc/aviation/registermetadataaviation.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadataaviation.h"
|
||||
#include "aviation.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAdfSystem::registerMetadata();
|
||||
CAircraftEngine::registerMetadata();
|
||||
CAircraftEngineList::registerMetadata();
|
||||
CAircraftIcaoCode::registerMetadata();
|
||||
CAircraftIcaoCodeList::registerMetadata();
|
||||
CAircraftLights::registerMetadata();
|
||||
CAircraftParts::registerMetadata();
|
||||
CAircraftPartsList::registerMetadata();
|
||||
CAircraftSituation::registerMetadata();
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
CAtcStationList::registerMetadata();
|
||||
CCallsign::registerMetadata();
|
||||
CCallsignSet::registerMetadata();
|
||||
CComSystem::registerMetadata();
|
||||
CFlightPlan::registerMetadata();
|
||||
CHeading::registerMetadata();
|
||||
CInformationMessage::registerMetadata();
|
||||
CLivery::registerMetadata();
|
||||
CLiveryList::registerMetadata();
|
||||
CNavSystem::registerMetadata();
|
||||
CSelcal::registerMetadata();
|
||||
CTrack::registerMetadata();
|
||||
CTransponder::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/aviation/registermetadataaviation.h
Normal file
26
src/blackmisc/aviation/registermetadataaviation.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_AVIATION_REGISTERMETADATAAVIATION_H
|
||||
#define BLACKMISC_AVIATION_REGISTERMETADATAAVIATION_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
//! Register metadata for aviation
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -31,84 +31,6 @@
|
||||
#include <QProcess>
|
||||
#include <QBuffer>
|
||||
|
||||
void BlackMisc::Math::registerMetadata()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void BlackMisc::Geo::registerMetadata()
|
||||
{
|
||||
CCoordinateGeodetic::registerMetadata();
|
||||
CLatitude::registerMetadata();
|
||||
CLongitude::registerMetadata();
|
||||
}
|
||||
|
||||
void BlackMisc::Audio::registerMetadata()
|
||||
{
|
||||
CAudioDeviceInfo::registerMetadata();
|
||||
CAudioDeviceInfoList::registerMetadata();
|
||||
CVoiceRoom::registerMetadata();
|
||||
CVoiceRoomList::registerMetadata();
|
||||
Settings::CSettingsAudio::registerMetadata();
|
||||
qDBusRegisterMetaType<BlackMisc::Audio::CNotificationSounds::PlayMode>();
|
||||
qDBusRegisterMetaType<BlackMisc::Audio::CNotificationSounds::Notification>();
|
||||
}
|
||||
|
||||
void BlackMisc::Input::registerMetadata()
|
||||
{
|
||||
CKeyboardKey::registerMetadata();
|
||||
CKeyboardKeyList::registerMetadata();
|
||||
CJoystickButton::registerMetadata();
|
||||
CJoystickButtonList::registerMetadata();
|
||||
CActionHotkey::registerMetadata();
|
||||
CActionHotkeyList::registerMetadata();
|
||||
CHotkeyCombination::registerMetadata();
|
||||
qDBusRegisterMetaType<KeyCode>();
|
||||
}
|
||||
|
||||
void BlackMisc::registerMetadata()
|
||||
{
|
||||
CPropertyIndex::registerMetadata();
|
||||
CVariant::registerMetadata();
|
||||
CVariantList::registerMetadata();
|
||||
CVariantMap::registerMetadata();
|
||||
CValueCachePacket::registerMetadata();
|
||||
CPropertyIndex::registerMetadata();
|
||||
CPropertyIndexList::registerMetadata();
|
||||
CPropertyIndexVariantMap::registerMetadata();
|
||||
CNameVariantPair::registerMetadata();
|
||||
CNameVariantPairList::registerMetadata();
|
||||
CStatusMessage::registerMetadata();
|
||||
CStatusMessageList::registerMetadata();
|
||||
CIcon::registerMetadata();
|
||||
CIconList::registerMetadata();
|
||||
CLogCategory::registerMetadata();
|
||||
CLogCategoryList::registerMetadata();
|
||||
CLogPattern::registerMetadata();
|
||||
CPixmap::registerMetadata();
|
||||
CIdentifier::registerMetadata();
|
||||
CIdentifierList::registerMetadata();
|
||||
CRgbColor::registerMetadata();
|
||||
CCountry::registerMetadata();
|
||||
CCountryList::registerMetadata();
|
||||
|
||||
// sub namespaces
|
||||
PhysicalQuantities::registerMetadata();
|
||||
Aviation::registerMetadata();
|
||||
Math::registerMetadata();
|
||||
Geo::registerMetadata();
|
||||
Network::registerMetadata();
|
||||
Simulation::registerMetadata();
|
||||
Audio::registerMetadata();
|
||||
Weather::registerMetadata();
|
||||
Input::registerMetadata();
|
||||
|
||||
// needed by XBus proxy class
|
||||
qRegisterMetaType<CSequence<double>>();
|
||||
qRegisterMetaType<CSequence<double>>("CDoubleSequence");
|
||||
qDBusRegisterMetaType<CSequence<double>>();
|
||||
}
|
||||
|
||||
void BlackMisc::initResources()
|
||||
{
|
||||
initBlackMiscResources();
|
||||
@@ -152,158 +74,6 @@ uint BlackMisc::calculateHash(const QList<int> &values, const char *className)
|
||||
return calculateHash(list, className);
|
||||
}
|
||||
|
||||
QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type);
|
||||
|
||||
QVariant BlackMisc::fixQVariantFromDbusArgument(const QVariant &variant, int localUserType)
|
||||
{
|
||||
// my business?
|
||||
if (!variant.canConvert<QDBusArgument>()) { return variant; }
|
||||
|
||||
// complex, user type
|
||||
// it has to be made sure, that the cast works
|
||||
const QDBusArgument arg = variant.value<QDBusArgument>();
|
||||
const int userType = static_cast<int>(QVariant::UserType);
|
||||
if (localUserType < userType)
|
||||
{
|
||||
// complex Qt type, e.g. QDateTime
|
||||
return complexQtTypeFromDbusArgument(arg, localUserType);
|
||||
}
|
||||
else if (QMetaType(localUserType).flags() & QMetaType::IsEnumeration)
|
||||
{
|
||||
arg.beginStructure();
|
||||
int i;
|
||||
arg >> i;
|
||||
arg.endStructure();
|
||||
|
||||
QVariant valueVariant = QVariant::fromValue(i);
|
||||
bool ok = valueVariant.convert(localUserType);
|
||||
Q_ASSERT_X(ok, Q_FUNC_INFO, "int could not be converted to enum");
|
||||
Q_UNUSED(ok);
|
||||
return valueVariant;
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant valueVariant(localUserType, nullptr);
|
||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||
if (meta)
|
||||
{
|
||||
meta->unmarshall(arg, valueVariant.data());
|
||||
return valueVariant;
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "no meta");
|
||||
return valueVariant;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type)
|
||||
{
|
||||
// QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17,
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QMetaType::QDateTime:
|
||||
{
|
||||
QDateTime dt;
|
||||
argument >> dt;
|
||||
return QVariant::fromValue(dt);
|
||||
}
|
||||
case QMetaType::QDate:
|
||||
{
|
||||
QDate date;
|
||||
argument >> date;
|
||||
return QVariant::fromValue(date);
|
||||
}
|
||||
case QMetaType::QTime:
|
||||
{
|
||||
QTime time;
|
||||
argument >> time;
|
||||
return QVariant::fromValue(time);
|
||||
}
|
||||
default:
|
||||
{
|
||||
const char *name = QMetaType::typeName(type);
|
||||
qFatal("Type cannot be resolved: %s (%d)", name ? name : "", type);
|
||||
}
|
||||
}
|
||||
return QVariant(); // suppress compiler warning
|
||||
}
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
#include <crtdbg.h>
|
||||
|
||||
size_t BlackMisc::heapSizeOf(const QMetaType &metaType)
|
||||
{
|
||||
metaType.destroy(metaType.create()); // ignore one-off allocations of a class being instantiated for the first time
|
||||
_CrtMemState oldState, newState, diff;
|
||||
oldState.lTotalCount = newState.lTotalCount = diff.lTotalCount = 0; // avoid compiler warning
|
||||
diff.lSizes[_NORMAL_BLOCK] = 0;
|
||||
_CrtMemCheckpoint(&oldState);
|
||||
void *p = metaType.create();
|
||||
_CrtMemCheckpoint(&newState);
|
||||
metaType.destroy(p);
|
||||
_CrtMemDifference(&diff, &oldState, &newState);
|
||||
return diff.lSizes[_NORMAL_BLOCK];
|
||||
}
|
||||
|
||||
size_t BlackMisc::heapSizeOf(const QMetaObject &metaObject)
|
||||
{
|
||||
delete metaObject.newInstance(); //ignore one-off allocations of a class being instantiated for the first time
|
||||
_CrtMemState oldState, newState, diff;
|
||||
oldState.lTotalCount = newState.lTotalCount = diff.lTotalCount = 0; // avoid compiler warning
|
||||
diff.lSizes[_NORMAL_BLOCK] = 0;
|
||||
_CrtMemCheckpoint(&oldState);
|
||||
QObject *obj = metaObject.newInstance();
|
||||
_CrtMemCheckpoint(&newState);
|
||||
delete obj;
|
||||
_CrtMemDifference(&diff, &oldState, &newState);
|
||||
return diff.lSizes[_NORMAL_BLOCK];
|
||||
}
|
||||
|
||||
#else //!Q_CC_MSVC
|
||||
|
||||
size_t BlackMisc::heapSizeOf(const QMetaType &)
|
||||
{
|
||||
// qDebug() << "heapSizeOf not supported by your compiler toolchain";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t BlackMisc::heapSizeOf(const QMetaObject &)
|
||||
{
|
||||
// qDebug() << "heapSizeOf not supported by your compiler toolchain";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //!Q_CC_MSVC
|
||||
|
||||
void BlackMisc::displayAllUserMetatypesTypes(QTextStream &out)
|
||||
{
|
||||
out << getAllUserMetatypesTypes();
|
||||
}
|
||||
|
||||
QString BlackMisc::getAllUserMetatypesTypes(const QString &separator)
|
||||
{
|
||||
int fails = 0;
|
||||
QString meta;
|
||||
for (int mt = QMetaType::User; mt < QMetaType::User + 1000; mt++)
|
||||
{
|
||||
if (!QMetaType::isRegistered(mt))
|
||||
{
|
||||
fails++;
|
||||
// normally a consecutive order of metatypes, we allow a space before we break
|
||||
if (fails > 3) { return meta; }
|
||||
continue;
|
||||
}
|
||||
QMetaType metaType(mt);
|
||||
meta = meta.
|
||||
append("type: ").append(QString::number(mt)).
|
||||
append(" name: ").append(QMetaType::typeName(mt)).
|
||||
append(" | ").append(QString::number(QMetaType::sizeOf(mt))).
|
||||
append(" / ").append(QString::number(BlackMisc::heapSizeOf(metaType))).
|
||||
append(separator);
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
|
||||
const QString &BlackMisc::localHostName()
|
||||
{
|
||||
static const QString hostName = QHostInfo::localHostName();
|
||||
@@ -321,156 +91,3 @@ bool BlackMisc::Audio::startWindowsMixer()
|
||||
QStringList parameterlist;
|
||||
return QProcess::startDetached("SndVol.exe", parameterlist);
|
||||
}
|
||||
|
||||
QJsonObject BlackMisc::getIncrementalObject(const QJsonObject &previousObject, const QJsonObject ¤tObject)
|
||||
{
|
||||
QJsonObject incrementalObject = currentObject;
|
||||
for (const auto &key : previousObject.keys())
|
||||
{
|
||||
if (previousObject.value(key).isObject())
|
||||
{
|
||||
auto child = getIncrementalObject(previousObject.value(key).toObject(), currentObject.value(key).toObject());
|
||||
if (child.isEmpty()) incrementalObject.remove(key);
|
||||
else incrementalObject.insert(key, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentObject.value(key) == previousObject.value(key))
|
||||
incrementalObject.remove(key);
|
||||
}
|
||||
}
|
||||
return incrementalObject;
|
||||
}
|
||||
|
||||
QJsonObject BlackMisc::applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject)
|
||||
{
|
||||
QJsonObject currentObject = previousObject;
|
||||
for (const auto &key : incrementalObject.keys())
|
||||
{
|
||||
// If it is not an object, just insert the value
|
||||
if (!incrementalObject.value(key).isObject())
|
||||
{
|
||||
currentObject.insert(key, incrementalObject.value(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto child = applyIncrementalObject(currentObject.value(key).toObject(), incrementalObject.value(key).toObject());
|
||||
currentObject.insert(key, child);
|
||||
}
|
||||
}
|
||||
return currentObject;
|
||||
}
|
||||
|
||||
|
||||
QString BlackMisc::boolToOnOff(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "on" : "off";
|
||||
}
|
||||
|
||||
QString BlackMisc::boolToYesNo(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "yes" : "no";
|
||||
}
|
||||
|
||||
QString BlackMisc::boolToTrueFalse(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "true" : "false";
|
||||
}
|
||||
|
||||
bool BlackMisc::stringToBool(const QString &string)
|
||||
{
|
||||
QString s(string.trimmed().toLower());
|
||||
if (s.isEmpty()) { return false; }
|
||||
QChar c = s.at(0);
|
||||
|
||||
// explicit values
|
||||
if (c == '1' || c == 't' || c == 'y' || c == 'x') { return true; }
|
||||
if (c == '0' || c == 'f' || c == 'n' || c == '_') { return false; }
|
||||
return false;
|
||||
}
|
||||
|
||||
QString BlackMisc::intToHex(int value, int digits)
|
||||
{
|
||||
QString hex(QString::number(value, 16).toUpper());
|
||||
int l = hex.length();
|
||||
if (l >= digits) { return hex.right(digits); }
|
||||
int d = digits - l;
|
||||
return QString(d, '0') + hex;
|
||||
}
|
||||
|
||||
bool BlackMisc::pixmapToPngByteArray(const QPixmap &pixmap, QByteArray &array)
|
||||
{
|
||||
QBuffer buffer(&array);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
bool s = pixmap.save(&buffer, "PNG");
|
||||
buffer.close();
|
||||
return s;
|
||||
}
|
||||
|
||||
QString BlackMisc::bytesToHexString(const QByteArray &bytes)
|
||||
{
|
||||
QString h;
|
||||
for (int i = 0; i < bytes.size(); i++)
|
||||
{
|
||||
int b = static_cast<int>(bytes.at(i));
|
||||
h.append(intToHex(b, 2));
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
QByteArray BlackMisc::byteArrayFromHexString(const QString &hexString)
|
||||
{
|
||||
QByteArray ba;
|
||||
int pos = 0;
|
||||
while (pos + 1 < hexString.length())
|
||||
{
|
||||
bool ok;
|
||||
QString h = hexString.mid(pos, 2);
|
||||
int hex = h.toInt(&ok, 16);
|
||||
Q_ASSERT_X(ok, Q_FUNC_INFO, "Invalid hex");
|
||||
if (!ok) { return QByteArray(); }
|
||||
ba.push_back(static_cast<char>(hex));
|
||||
pos += 2;
|
||||
}
|
||||
return ba;
|
||||
}
|
||||
|
||||
QPixmap BlackMisc::pngByteArrayToPixmap(const QByteArray &array)
|
||||
{
|
||||
if (array.isEmpty()) { return QPixmap(); }
|
||||
QPixmap p;
|
||||
bool s = p.loadFromData(array, "PNG");
|
||||
return s ? p : QPixmap();
|
||||
}
|
||||
|
||||
bool BlackMisc::pngByteArrayToPixmapRef(const QByteArray &array, QPixmap &pixmap)
|
||||
{
|
||||
if (array.isEmpty()) { return false; }
|
||||
bool s = pixmap.loadFromData(array, "PNG");
|
||||
return s;
|
||||
}
|
||||
|
||||
QString BlackMisc::pixmapToPngHexString(const QPixmap &pixmap)
|
||||
{
|
||||
QByteArray ba;
|
||||
bool s = pixmapToPngByteArray(pixmap, ba);
|
||||
if (!s) { return QString(); }
|
||||
return bytesToHexString(ba);
|
||||
}
|
||||
|
||||
QPixmap BlackMisc::pngHexStringToPixmap(const QString &hexString)
|
||||
{
|
||||
if (hexString.isEmpty()) { return QPixmap(); }
|
||||
QByteArray ba(byteArrayFromHexString(hexString));
|
||||
return pngByteArrayToPixmap(ba);
|
||||
}
|
||||
|
||||
bool BlackMisc::pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixmap)
|
||||
{
|
||||
if (hexString.isEmpty()) { return false; }
|
||||
QByteArray ba(byteArrayFromHexString(hexString));
|
||||
return pngByteArrayToPixmapRef(ba, pixmap);
|
||||
}
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
#include "blackmisc/inheritance_traits.h"
|
||||
#include <QDir> // for Q_INIT_RESOURCE
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include <QMetaType>
|
||||
#include <QDBusArgument>
|
||||
#include <QTextStream>
|
||||
#include <QDataStream>
|
||||
#include <memory>
|
||||
|
||||
/*!
|
||||
@@ -39,83 +35,17 @@ inline void initBlackMiscResources()
|
||||
//! Free functions in BlackMisc
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
//! Register all metadata for PQs
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
} // PQ
|
||||
|
||||
namespace Aviation
|
||||
{
|
||||
//! Register metadata for aviation
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
} // Aviation
|
||||
|
||||
namespace Math
|
||||
{
|
||||
//! Register metadata for math (matrices, vectors)
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
} // Math
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
|
||||
//! Register metadata for geo (coordinates)
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
} // Geo
|
||||
|
||||
namespace Network
|
||||
{
|
||||
//! Register metadata for network (server, user)
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
}
|
||||
|
||||
namespace Audio
|
||||
{
|
||||
//! Register metadata for audio / voice
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
//! Start the Windows mixer
|
||||
BLACKMISC_EXPORT bool startWindowsMixer();
|
||||
}
|
||||
|
||||
namespace Input
|
||||
{
|
||||
//! Register metadata for Input
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
}
|
||||
|
||||
namespace Event
|
||||
{
|
||||
//! Register metadata for Event
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
}
|
||||
|
||||
namespace Simulation
|
||||
{
|
||||
//! Register metadata for Simulation
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
}
|
||||
|
||||
namespace Weather
|
||||
{
|
||||
//! Register metadata for Simulation
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
}
|
||||
|
||||
//! Register all relevant metadata in BlackMisc
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
|
||||
//! Init resources
|
||||
BLACKMISC_EXPORT void initResources();
|
||||
|
||||
namespace Mixin
|
||||
{
|
||||
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit common methods dealing with hashing instances by metatuple.
|
||||
*
|
||||
@@ -216,39 +146,6 @@ namespace BlackMisc
|
||||
|
||||
} // Mixin
|
||||
|
||||
//! Checked version from QVariant
|
||||
template <class T> void setFromQVariant(T *value, const QVariant &variant)
|
||||
{
|
||||
if (variant.canConvert<T>())
|
||||
{
|
||||
(*value) = variant.value<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString m = QString("Target type: %1 Variant type: %2 %3 %4").
|
||||
arg(qMetaTypeId<T>()).
|
||||
arg(static_cast<int>(variant.type())).arg(variant.userType()).arg(variant.typeName());
|
||||
Q_ASSERT_X(false, "setFromQVariant", m.toLocal8Bit().constData());
|
||||
Q_UNUSED(m);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Fix variant. Required if a variant "comes in" via DBus,
|
||||
* and represents a QDBusArgument rather than the real type.
|
||||
* \param variant
|
||||
* \param localUserType
|
||||
* \return
|
||||
*/
|
||||
BLACKMISC_EXPORT QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType);
|
||||
|
||||
//! Display all user metatypes
|
||||
//! \remarks Used in order to debug code, do not remove
|
||||
BLACKMISC_EXPORT void displayAllUserMetatypesTypes(QTextStream &out);
|
||||
|
||||
//! Get all user metatypes
|
||||
BLACKMISC_EXPORT QString getAllUserMetatypesTypes(const QString &separator = "\n");
|
||||
|
||||
/*!
|
||||
* \brief Calculate a single hash value based on a list of individual hash values
|
||||
* \param values
|
||||
@@ -260,40 +157,6 @@ namespace BlackMisc
|
||||
//! Hash value, but with int list
|
||||
BLACKMISC_EXPORT uint calculateHash(const QList<int> &values, const char *className);
|
||||
|
||||
//! Real heap size of an object
|
||||
BLACKMISC_EXPORT size_t heapSizeOf(const QMetaType &type);
|
||||
|
||||
//! Real heap size of an object
|
||||
BLACKMISC_EXPORT size_t heapSizeOf(const QMetaObject &objectType);
|
||||
|
||||
//! A map converted to string
|
||||
template<class K, class V> QString qmapToString(const QMap<K, V> &map)
|
||||
{
|
||||
QString s;
|
||||
const QString kv("%1: %2 ");
|
||||
QMapIterator<K, V> i(map);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
s.append(
|
||||
kv.arg(i.key()).arg(i.value())
|
||||
);
|
||||
}
|
||||
return s.trimmed();
|
||||
}
|
||||
|
||||
//! Bool to on/off
|
||||
BLACKMISC_EXPORT QString boolToOnOff(bool v, bool i18n = false);
|
||||
|
||||
//! Bool to yes / no
|
||||
BLACKMISC_EXPORT QString boolToYesNo(bool v, bool i18n = false);
|
||||
|
||||
//! Bool to true / false
|
||||
BLACKMISC_EXPORT QString boolToTrueFalse(bool v, bool i18n = false);
|
||||
|
||||
//! Convert string to bool
|
||||
BLACKMISC_EXPORT bool stringToBool(const QString &boolString);
|
||||
|
||||
//! Get local host name
|
||||
BLACKMISC_EXPORT const QString &localHostName();
|
||||
|
||||
@@ -306,40 +169,6 @@ namespace BlackMisc
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
//! Creates an incremental json object from two existing objects
|
||||
BLACKMISC_EXPORT QJsonObject getIncrementalObject(const QJsonObject &previousObject, const QJsonObject ¤tObject);
|
||||
|
||||
//! Merges an incremental json object into an existing one
|
||||
BLACKMISC_EXPORT QJsonObject applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject);
|
||||
|
||||
//! Int to hex value
|
||||
BLACKMISC_EXPORT QString intToHex(int value, int digits = 2);
|
||||
|
||||
//! Int to hex value (per byte, 2 digits)
|
||||
BLACKMISC_EXPORT QString bytesToHexString(const QByteArray &bytes);
|
||||
|
||||
//! Byte array from hex value string per byte, 2 digits
|
||||
BLACKMISC_EXPORT QByteArray byteArrayFromHexString(const QString &hexString);
|
||||
|
||||
//! Pixmap to PNG byte array
|
||||
BLACKMISC_EXPORT bool pixmapToPngByteArray(const QPixmap &pixmap, QByteArray &array);
|
||||
|
||||
//! Pixmap from PNG byte array
|
||||
BLACKMISC_EXPORT QPixmap pngByteArrayToPixmap(const QByteArray &array);
|
||||
|
||||
//! Pixmap from PNG byte array
|
||||
BLACKMISC_EXPORT bool pngByteArrayToPixmapRef(const QByteArray &array, QPixmap &pixmap);
|
||||
|
||||
//! Pixmap as HEX string (for PNG image)
|
||||
BLACKMISC_EXPORT QString pixmapToPngHexString(const QPixmap &pixmap);
|
||||
|
||||
//! Hex encoded pixmap string to Pixmap
|
||||
BLACKMISC_EXPORT QPixmap pngHexStringToPixmap(const QString &hexString);
|
||||
|
||||
//! Hex encoded pixmap string to Pixmap
|
||||
BLACKMISC_EXPORT bool pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixmap);
|
||||
|
||||
} // BlackMisc
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/* Copyright (C) 2014
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/network/network.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
/*
|
||||
* Metadata for Network
|
||||
*
|
||||
* In a separate file to workaround a limitation of MinGW:
|
||||
* http://stackoverflow.com/q/16596876/1639256
|
||||
*/
|
||||
void BlackMisc::Network::registerMetadata()
|
||||
{
|
||||
CAuthenticatedUser::registerMetadata();
|
||||
CClient::registerMetadata();
|
||||
CClientList::registerMetadata();
|
||||
CEntityFlags::registerMetadata();
|
||||
CRole::registerMetadata();
|
||||
CRoleList::registerMetadata();
|
||||
CServer::registerMetadata();
|
||||
CServerList::registerMetadata();
|
||||
CTextMessage::registerMetadata();
|
||||
CTextMessageList::registerMetadata();
|
||||
CUrl::registerMetadata();
|
||||
CUrlList::registerMetadata();
|
||||
CUser::registerMetadata();
|
||||
CUserList::registerMetadata();
|
||||
CVoiceCapabilities::registerMetadata();
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/* Copyright (C) 2014
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
|
||||
/*
|
||||
* Metadata for PQs
|
||||
*
|
||||
* In a separate file to workaround a limitation of MinGW:
|
||||
* http://stackoverflow.com/q/16596876/1639256
|
||||
*/
|
||||
void BlackMisc::PhysicalQuantities::registerMetadata()
|
||||
{
|
||||
CAcceleration::registerMetadata();
|
||||
CAccelerationUnit::registerMetadata();
|
||||
CAngle::registerMetadata();
|
||||
CAngleUnit::registerMetadata();
|
||||
CFrequency::registerMetadata();
|
||||
CFrequencyUnit::registerMetadata();
|
||||
CLength::registerMetadata();
|
||||
CLengthUnit::registerMetadata();
|
||||
CMass::registerMetadata();
|
||||
CMassUnit::registerMetadata();
|
||||
CPressure::registerMetadata();
|
||||
CPressureUnit::registerMetadata();
|
||||
CSpeed::registerMetadata();
|
||||
CSpeedUnit::registerMetadata();
|
||||
CTemperature::registerMetadata();
|
||||
CTemperatureUnit::registerMetadata();
|
||||
CTime::registerMetadata();
|
||||
CTimeUnit::registerMetadata();
|
||||
CPqString::registerMetadata();
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* Copyright (C) 2014
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/simulatorsetup.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
#include "blackmisc/simulation/fscommon/vpilotmodelruleset.h"
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Fsx;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
|
||||
/*
|
||||
* Metadata for simulation
|
||||
*
|
||||
* In a separate file to workaround a limitation of MinGW:
|
||||
* http://stackoverflow.com/q/16596876/1639256
|
||||
*/
|
||||
void BlackMisc::Simulation::registerMetadata()
|
||||
{
|
||||
CSimulatorPluginInfo::registerMetadata();
|
||||
CSimulatorPluginInfoList::registerMetadata();
|
||||
CAircraftCfgEntries::registerMetadata();
|
||||
CAircraftCfgEntriesList::registerMetadata();
|
||||
CSimConnectUtilities::registerMetadata();
|
||||
CAircraftModel::registerMetadata();
|
||||
CAircraftModelList::registerMetadata();
|
||||
CSimulatedAircraft::registerMetadata();
|
||||
CSimulatedAircraftList::registerMetadata();
|
||||
CDistributor::registerMetadata();
|
||||
CDistributorList::registerMetadata();
|
||||
CVPilotModelRule::registerMetadata();
|
||||
CVPilotModelRuleSet::registerMetadata();
|
||||
CSimulatorSetup::registerMetadata();
|
||||
CSimulatorInfo::registerMetadata();
|
||||
CAirspaceAircraftSnapshot::registerMetadata();
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "blackmisc/datastoreutility.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/worker.h"
|
||||
#include "fileutilities.h"
|
||||
#include "fileutils.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_CFILEUTILITIES_H
|
||||
#define BLACKMISC_CFILEUTILITIES_H
|
||||
#ifndef BLACKMISC_CFILEUTILS_H
|
||||
#define BLACKMISC_CFILEUTILS_H
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include <QObject>
|
||||
24
src/blackmisc/geo/registermetadatageo.cpp
Normal file
24
src/blackmisc/geo/registermetadatageo.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadatageo.h"
|
||||
#include "geo.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CCoordinateGeodetic::registerMetadata();
|
||||
CLatitude::registerMetadata();
|
||||
CLongitude::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/geo/registermetadatageo.h
Normal file
26
src/blackmisc/geo/registermetadatageo.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_GEO_REGISTERMETAGEO_H
|
||||
#define BLACKMISC_GEO_REGISTERMETAGEO_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
//! Register metadata for geo
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "icons.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/fileutilities.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
|
||||
59
src/blackmisc/imageutils.cpp
Normal file
59
src/blackmisc/imageutils.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "imageutils.h"
|
||||
#include "stringutils.h"
|
||||
#include "pixmap.h"
|
||||
#include <QBuffer>
|
||||
|
||||
bool BlackMisc::pixmapToPngByteArray(const QPixmap &pixmap, QByteArray &array)
|
||||
{
|
||||
QBuffer buffer(&array);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
bool s = pixmap.save(&buffer, "PNG");
|
||||
buffer.close();
|
||||
return s;
|
||||
}
|
||||
|
||||
QPixmap BlackMisc::pngByteArrayToPixmap(const QByteArray &array)
|
||||
{
|
||||
if (array.isEmpty()) { return QPixmap(); }
|
||||
QPixmap p;
|
||||
bool s = p.loadFromData(array, "PNG");
|
||||
return s ? p : QPixmap();
|
||||
}
|
||||
|
||||
bool BlackMisc::pngByteArrayToPixmapRef(const QByteArray &array, QPixmap &pixmap)
|
||||
{
|
||||
if (array.isEmpty()) { return false; }
|
||||
bool s = pixmap.loadFromData(array, "PNG");
|
||||
return s;
|
||||
}
|
||||
|
||||
QString BlackMisc::pixmapToPngHexString(const QPixmap &pixmap)
|
||||
{
|
||||
QByteArray ba;
|
||||
bool s = pixmapToPngByteArray(pixmap, ba);
|
||||
if (!s) { return QString(); }
|
||||
return bytesToHexString(ba);
|
||||
}
|
||||
|
||||
QPixmap BlackMisc::pngHexStringToPixmap(const QString &hexString)
|
||||
{
|
||||
if (hexString.isEmpty()) { return QPixmap(); }
|
||||
QByteArray ba(byteArrayFromHexString(hexString));
|
||||
return pngByteArrayToPixmap(ba);
|
||||
}
|
||||
|
||||
bool BlackMisc::pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixmap)
|
||||
{
|
||||
if (hexString.isEmpty()) { return false; }
|
||||
QByteArray ba(byteArrayFromHexString(hexString));
|
||||
return pngByteArrayToPixmapRef(ba, pixmap);
|
||||
}
|
||||
43
src/blackmisc/imageutils.h
Normal file
43
src/blackmisc/imageutils.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_IMAGEUTILS_H
|
||||
#define BLACKMISC_IMAGEUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
|
||||
//! Free functions in BlackMisc
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Pixmap to PNG byte array
|
||||
BLACKMISC_EXPORT bool pixmapToPngByteArray(const QPixmap &pixmap, QByteArray &array);
|
||||
|
||||
//! Pixmap from PNG byte array
|
||||
BLACKMISC_EXPORT QPixmap pngByteArrayToPixmap(const QByteArray &array);
|
||||
|
||||
//! Pixmap from PNG byte array
|
||||
BLACKMISC_EXPORT bool pngByteArrayToPixmapRef(const QByteArray &array, QPixmap &pixmap);
|
||||
|
||||
//! Pixmap as HEX string (for PNG image)
|
||||
BLACKMISC_EXPORT QString pixmapToPngHexString(const QPixmap &pixmap);
|
||||
|
||||
//! Hex encoded pixmap string to Pixmap
|
||||
BLACKMISC_EXPORT QPixmap pngHexStringToPixmap(const QString &hexString);
|
||||
|
||||
//! Hex encoded pixmap string to Pixmap
|
||||
BLACKMISC_EXPORT bool pngHexStringToPixmapRef(const QString &hexString, QPixmap &pixmap);
|
||||
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
29
src/blackmisc/input/registermetadatainput.cpp
Normal file
29
src/blackmisc/input/registermetadatainput.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadatainput.h"
|
||||
#include "input.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CActionHotkey::registerMetadata();
|
||||
CActionHotkeyList::registerMetadata();
|
||||
CHotkeyCombination::registerMetadata();
|
||||
CJoystickButton::registerMetadata();
|
||||
CJoystickButtonList::registerMetadata();
|
||||
CKeyboardKey::registerMetadata();
|
||||
CKeyboardKeyList::registerMetadata();
|
||||
qDBusRegisterMetaType<KeyCode>();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/input/registermetadatainput.h
Normal file
26
src/blackmisc/input/registermetadatainput.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_INPUT_REGISTERMETADATAINPUT_H
|
||||
#define BLACKMISC_INPUT_REGISTERMETADATAINPUT_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
//! Register metadata for input
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "json.h"
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "stringutils.h"
|
||||
#include "imageutils.h"
|
||||
#include <QJsonDocument>
|
||||
|
||||
const QJsonValue &operator >>(const QJsonValue &json, int &value)
|
||||
@@ -283,27 +285,72 @@ QJsonObject &operator<<(QJsonObject &json, const std::pair<QString, const QByteA
|
||||
return json;
|
||||
}
|
||||
|
||||
QJsonObject BlackMisc::Json::jsonObjectFromString(const QString &json)
|
||||
namespace BlackMisc
|
||||
{
|
||||
if (json.isEmpty()) { return QJsonObject();}
|
||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8()));
|
||||
return jsonDoc.object();
|
||||
}
|
||||
|
||||
QJsonArray BlackMisc::Json::jsonArrayFromString(const QString &json)
|
||||
{
|
||||
if (json.isEmpty()) { return QJsonArray();}
|
||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8()));
|
||||
return jsonDoc.array();
|
||||
}
|
||||
|
||||
QJsonObject &BlackMisc::Json::appendJsonObject(QJsonObject &target, const QJsonObject &toBeAppended)
|
||||
{
|
||||
if (toBeAppended.isEmpty()) return target;
|
||||
QStringList keys = toBeAppended.keys();
|
||||
foreach(const QString & key, keys)
|
||||
namespace Json
|
||||
{
|
||||
target.insert(key, toBeAppended.value(key));
|
||||
QJsonObject jsonObjectFromString(const QString &json)
|
||||
{
|
||||
if (json.isEmpty()) { return QJsonObject();}
|
||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8()));
|
||||
return jsonDoc.object();
|
||||
}
|
||||
|
||||
QJsonArray jsonArrayFromString(const QString &json)
|
||||
{
|
||||
if (json.isEmpty()) { return QJsonArray();}
|
||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8()));
|
||||
return jsonDoc.array();
|
||||
}
|
||||
|
||||
QJsonObject &appendJsonObject(QJsonObject &target, const QJsonObject &toBeAppended)
|
||||
{
|
||||
if (toBeAppended.isEmpty()) return target;
|
||||
QStringList keys = toBeAppended.keys();
|
||||
foreach(const QString & key, keys)
|
||||
{
|
||||
target.insert(key, toBeAppended.value(key));
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
QJsonObject getIncrementalObject(const QJsonObject &previousObject, const QJsonObject ¤tObject)
|
||||
{
|
||||
QJsonObject incrementalObject = currentObject;
|
||||
for (const auto &key : previousObject.keys())
|
||||
{
|
||||
if (previousObject.value(key).isObject())
|
||||
{
|
||||
auto child = getIncrementalObject(previousObject.value(key).toObject(), currentObject.value(key).toObject());
|
||||
if (child.isEmpty()) incrementalObject.remove(key);
|
||||
else incrementalObject.insert(key, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentObject.value(key) == previousObject.value(key))
|
||||
incrementalObject.remove(key);
|
||||
}
|
||||
}
|
||||
return incrementalObject;
|
||||
}
|
||||
|
||||
QJsonObject applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject)
|
||||
{
|
||||
QJsonObject currentObject = previousObject;
|
||||
for (const auto &key : incrementalObject.keys())
|
||||
{
|
||||
// If it is not an object, just insert the value
|
||||
if (!incrementalObject.value(key).isObject())
|
||||
{
|
||||
currentObject.insert(key, incrementalObject.value(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto child = applyIncrementalObject(currentObject.value(key).toObject(), incrementalObject.value(key).toObject());
|
||||
currentObject.insert(key, child);
|
||||
}
|
||||
}
|
||||
return currentObject;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -155,6 +155,12 @@ namespace BlackMisc
|
||||
//! \ingroup JSON
|
||||
BLACKMISC_EXPORT QJsonArray jsonArrayFromString(const QString &json);
|
||||
|
||||
//! Creates an incremental json object from two existing objects
|
||||
BLACKMISC_EXPORT QJsonObject getIncrementalObject(const QJsonObject &previousObject, const QJsonObject ¤tObject);
|
||||
|
||||
//! Merges an incremental json object into an existing one
|
||||
BLACKMISC_EXPORT QJsonObject applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject);
|
||||
|
||||
} // Json
|
||||
|
||||
namespace Mixin
|
||||
|
||||
91
src/blackmisc/metadatautils.cpp
Normal file
91
src/blackmisc/metadatautils.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "metadatautils.h"
|
||||
#include <QMetaType>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
void displayAllUserMetatypesTypes(QTextStream &out)
|
||||
{
|
||||
out << getAllUserMetatypesTypes();
|
||||
}
|
||||
|
||||
QString getAllUserMetatypesTypes(const QString &separator)
|
||||
{
|
||||
int fails = 0;
|
||||
QString meta;
|
||||
for (int mt = QMetaType::User; mt < QMetaType::User + 1000; mt++)
|
||||
{
|
||||
if (!QMetaType::isRegistered(mt))
|
||||
{
|
||||
fails++;
|
||||
// normally a consecutive order of metatypes, we allow a space before we break
|
||||
if (fails > 3) { return meta; }
|
||||
continue;
|
||||
}
|
||||
QMetaType metaType(mt);
|
||||
meta = meta.
|
||||
append("type: ").append(QString::number(mt)).
|
||||
append(" name: ").append(QMetaType::typeName(mt)).
|
||||
append(" | ").append(QString::number(QMetaType::sizeOf(mt))).
|
||||
append(" / ").append(QString::number(BlackMisc::heapSizeOf(metaType))).
|
||||
append(separator);
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
#include <crtdbg.h>
|
||||
|
||||
size_t heapSizeOf(const QMetaType &metaType)
|
||||
{
|
||||
metaType.destroy(metaType.create()); // ignore one-off allocations of a class being instantiated for the first time
|
||||
_CrtMemState oldState, newState, diff;
|
||||
oldState.lTotalCount = newState.lTotalCount = diff.lTotalCount = 0; // avoid compiler warning
|
||||
diff.lSizes[_NORMAL_BLOCK] = 0;
|
||||
_CrtMemCheckpoint(&oldState);
|
||||
void *p = metaType.create();
|
||||
_CrtMemCheckpoint(&newState);
|
||||
metaType.destroy(p);
|
||||
_CrtMemDifference(&diff, &oldState, &newState);
|
||||
return diff.lSizes[_NORMAL_BLOCK];
|
||||
}
|
||||
|
||||
size_t heapSizeOf(const QMetaObject &metaObject)
|
||||
{
|
||||
delete metaObject.newInstance(); //ignore one-off allocations of a class being instantiated for the first time
|
||||
_CrtMemState oldState, newState, diff;
|
||||
oldState.lTotalCount = newState.lTotalCount = diff.lTotalCount = 0; // avoid compiler warning
|
||||
diff.lSizes[_NORMAL_BLOCK] = 0;
|
||||
_CrtMemCheckpoint(&oldState);
|
||||
QObject *obj = metaObject.newInstance();
|
||||
_CrtMemCheckpoint(&newState);
|
||||
delete obj;
|
||||
_CrtMemDifference(&diff, &oldState, &newState);
|
||||
return diff.lSizes[_NORMAL_BLOCK];
|
||||
}
|
||||
|
||||
#else //!Q_CC_MSVC
|
||||
|
||||
size_t heapSizeOf(const QMetaType &)
|
||||
{
|
||||
// qDebug() << "heapSizeOf not supported by your compiler toolchain";
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t heapSizeOf(const QMetaObject &)
|
||||
{
|
||||
// qDebug() << "heapSizeOf not supported by your compiler toolchain";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //!Q_CC_MSVC
|
||||
|
||||
} // ns
|
||||
37
src/blackmisc/metadatautils.h
Normal file
37
src/blackmisc/metadatautils.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_METADATAUTILS_H
|
||||
#define BLACKMISC_METADATAUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QTextStream>
|
||||
#include <QString>
|
||||
|
||||
//! Metadata util functions
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Display all user metatypes
|
||||
//! \remarks Used in order to debug code, do not remove
|
||||
BLACKMISC_EXPORT void displayAllUserMetatypesTypes(QTextStream &out);
|
||||
|
||||
//! Get all user metatypes
|
||||
BLACKMISC_EXPORT QString getAllUserMetatypesTypes(const QString &separator = "\n");
|
||||
|
||||
//! Real heap size of an object
|
||||
BLACKMISC_EXPORT size_t heapSizeOf(const QMetaType &type);
|
||||
|
||||
//! Real heap size of an object
|
||||
BLACKMISC_EXPORT size_t heapSizeOf(const QMetaObject &objectType);
|
||||
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "blackmisc/network/authenticateduser.h"
|
||||
#include "blackmisc/network/client.h"
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/role.h"
|
||||
#include "blackmisc/network/rolelist.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
|
||||
36
src/blackmisc/network/registermetadatanetwork.cpp
Normal file
36
src/blackmisc/network/registermetadatanetwork.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadatanetwork.h"
|
||||
#include "network.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAuthenticatedUser::registerMetadata();
|
||||
CClient::registerMetadata();
|
||||
CClientList::registerMetadata();
|
||||
CEntityFlags::registerMetadata();
|
||||
CRole::registerMetadata();
|
||||
CRoleList::registerMetadata();
|
||||
CServer::registerMetadata();
|
||||
CServerList::registerMetadata();
|
||||
CTextMessage::registerMetadata();
|
||||
CTextMessageList::registerMetadata();
|
||||
CUrl::registerMetadata();
|
||||
CUrlList::registerMetadata();
|
||||
CUser::registerMetadata();
|
||||
CUserList::registerMetadata();
|
||||
CVoiceCapabilities::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/network/registermetadatanetwork.h
Normal file
26
src/blackmisc/network/registermetadatanetwork.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_NETWORK_REGISTERMETADATANETWORK_H
|
||||
#define BLACKMISC_NETWORK_REGISTERMETADATANETWORK_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
//! Register metadata for network
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -20,15 +20,15 @@
|
||||
// http://www.parashift.com/c++-faq-lite/separate-template-fn-defn-from-decl.html
|
||||
// http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
|
||||
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/acceleration.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/pressure.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/mass.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
#include "blackmisc/pq/pressure.h"
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/pq/temperature.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/pq/acceleration.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*!
|
||||
* Physical unit distance
|
||||
*/
|
||||
@@ -35,10 +34,9 @@ namespace BlackMisc
|
||||
//! \copydoc CPhysicalQuantity(const QString &unitString)
|
||||
CPressure(const QString &unitString) : CPhysicalQuantity(unitString) {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CPressure)
|
||||
|
||||
#endif // BLACKMISC_PQPRESSURE_H
|
||||
#endif // guard
|
||||
|
||||
40
src/blackmisc/pq/registermetadatapq.cpp
Normal file
40
src/blackmisc/pq/registermetadatapq.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadatapq.h"
|
||||
#include "pq.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAcceleration::registerMetadata();
|
||||
CAccelerationUnit::registerMetadata();
|
||||
CAngle::registerMetadata();
|
||||
CAngleUnit::registerMetadata();
|
||||
CFrequency::registerMetadata();
|
||||
CFrequencyUnit::registerMetadata();
|
||||
CLength::registerMetadata();
|
||||
CLengthUnit::registerMetadata();
|
||||
CMass::registerMetadata();
|
||||
CMassUnit::registerMetadata();
|
||||
CPqString::registerMetadata();
|
||||
CPressure::registerMetadata();
|
||||
CPressureUnit::registerMetadata();
|
||||
CSpeed::registerMetadata();
|
||||
CSpeedUnit::registerMetadata();
|
||||
CTemperature::registerMetadata();
|
||||
CTemperatureUnit::registerMetadata();
|
||||
CTime::registerMetadata();
|
||||
CTimeUnit::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/pq/registermetadatapq.h
Normal file
26
src/blackmisc/pq/registermetadatapq.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_PQ_REGISTERMETADATAPQ_H
|
||||
#define BLACKMISC_PQ_REGISTERMETADATAPQ_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
//! Register metadata for PQs
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -8,12 +8,14 @@
|
||||
*/
|
||||
|
||||
#include "project.h"
|
||||
#include "blackmisc/fileutilities.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcessEnvironment>
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
|
||||
|
||||
#define BLACK_VERSION_STR_X(v) #v
|
||||
#define BLACK_VERSION_STR(v) BLACK_VERSION_STR_X(v)
|
||||
|
||||
76
src/blackmisc/registermetadata.cpp
Normal file
76
src/blackmisc/registermetadata.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadata.h"
|
||||
#include "audio/registermetadataaudio.h"
|
||||
#include "aviation/registermetadataaviation.h"
|
||||
#include "geo/registermetadatageo.h"
|
||||
#include "input/registermetadatainput.h"
|
||||
#include "network/registermetadatanetwork.h"
|
||||
#include "pq/registermetadatapq.h"
|
||||
#include "simulation/registermetadatasimulation.h"
|
||||
#include "weather/registermetadataweather.h"
|
||||
#include "propertyindexlist.h"
|
||||
#include "propertyindexvariantmap.h"
|
||||
#include "namevariantpairlist.h"
|
||||
#include "variantlist.h"
|
||||
#include "variantmap.h"
|
||||
#include "valuecache.h"
|
||||
#include "rgbcolor.h"
|
||||
#include "countrylist.h"
|
||||
#include "statusmessagelist.h"
|
||||
#include "pixmap.h"
|
||||
#include "iconlist.h"
|
||||
#include "identifierlist.h"
|
||||
#include "logpattern.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CCountry::registerMetadata();
|
||||
CCountryList::registerMetadata();
|
||||
CIcon::registerMetadata();
|
||||
CIconList::registerMetadata();
|
||||
CIdentifier::registerMetadata();
|
||||
CIdentifierList::registerMetadata();
|
||||
CLogCategory::registerMetadata();
|
||||
CLogCategoryList::registerMetadata();
|
||||
CLogPattern::registerMetadata();
|
||||
CNameVariantPair::registerMetadata();
|
||||
CNameVariantPairList::registerMetadata();
|
||||
CPixmap::registerMetadata();
|
||||
CPropertyIndex::registerMetadata();
|
||||
CPropertyIndex::registerMetadata();
|
||||
CPropertyIndexList::registerMetadata();
|
||||
CPropertyIndexVariantMap::registerMetadata();
|
||||
CRgbColor::registerMetadata();
|
||||
CStatusMessage::registerMetadata();
|
||||
CStatusMessageList::registerMetadata();
|
||||
CValueCachePacket::registerMetadata();
|
||||
CVariant::registerMetadata();
|
||||
CVariantList::registerMetadata();
|
||||
CVariantMap::registerMetadata();
|
||||
|
||||
// sub namespaces
|
||||
Audio::registerMetadata();
|
||||
Aviation::registerMetadata();
|
||||
Geo::registerMetadata();
|
||||
Input::registerMetadata();
|
||||
Network::registerMetadata();
|
||||
PhysicalQuantities::registerMetadata();
|
||||
Simulation::registerMetadata();
|
||||
Weather::registerMetadata();
|
||||
|
||||
// needed by XBus proxy class
|
||||
qRegisterMetaType<CSequence<double>>();
|
||||
qRegisterMetaType<CSequence<double>>("CDoubleSequence");
|
||||
qDBusRegisterMetaType<CSequence<double>>();
|
||||
}
|
||||
} // ns
|
||||
24
src/blackmisc/registermetadata.h
Normal file
24
src/blackmisc/registermetadata.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_REGISTERMETADATA_H
|
||||
#define BLACKMISC_REGISTERMETADATA_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
//! Register metadata
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Register all relevant metadata in BlackMisc
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/rgbcolor.h"
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "stringutils.h"
|
||||
#include "comparefunctions.h"
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
41
src/blackmisc/simulation/registermetadatasimulation.cpp
Normal file
41
src/blackmisc/simulation/registermetadatasimulation.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadatasimulation.h"
|
||||
#include "simulation.h"
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Fsx;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CAircraftCfgEntries::registerMetadata();
|
||||
CAircraftCfgEntriesList::registerMetadata();
|
||||
CAircraftModel::registerMetadata();
|
||||
CAircraftModelList::registerMetadata();
|
||||
CAirspaceAircraftSnapshot::registerMetadata();
|
||||
CDistributor::registerMetadata();
|
||||
CDistributorList::registerMetadata();
|
||||
CSimConnectUtilities::registerMetadata();
|
||||
CSimulatedAircraft::registerMetadata();
|
||||
CSimulatedAircraftList::registerMetadata();
|
||||
CSimulatorInfo::registerMetadata();
|
||||
CSimulatorPluginInfo::registerMetadata();
|
||||
CSimulatorPluginInfoList::registerMetadata();
|
||||
CSimulatorSetup::registerMetadata();
|
||||
CVPilotModelRule::registerMetadata();
|
||||
CVPilotModelRuleSet::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/simulation/registermetadatasimulation.h
Normal file
26
src/blackmisc/simulation/registermetadatasimulation.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_SIMULATION_REGISTERMETADATASIMULATION_H
|
||||
#define BLACKMISC_SIMULATION_REGISTERMETADATASIMULATION_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
//! Register metadata for simulation
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "simulatedaircraft.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
|
||||
|
||||
29
src/blackmisc/simulation/simulation.h
Normal file
29
src/blackmisc/simulation/simulation.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_SIMULATION_SIMULATION_H
|
||||
#define BLACKMISC_SIMULATION_SIMULATION_H
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::Simulation
|
||||
* \brief Generic simulation related class, but not OS or driver dependent
|
||||
*/
|
||||
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/simulatorsetup.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgentrieslist.h"
|
||||
#include "blackmisc/simulation/fscommon/vpilotmodelruleset.h"
|
||||
|
||||
#endif // guard
|
||||
79
src/blackmisc/stringutils.cpp
Normal file
79
src/blackmisc/stringutils.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "stringutils.h"
|
||||
#include "pixmap.h"
|
||||
#include <QBuffer>
|
||||
|
||||
QString BlackMisc::boolToOnOff(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "on" : "off";
|
||||
}
|
||||
|
||||
QString BlackMisc::boolToYesNo(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "yes" : "no";
|
||||
}
|
||||
|
||||
QString BlackMisc::boolToTrueFalse(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "true" : "false";
|
||||
}
|
||||
|
||||
bool BlackMisc::stringToBool(const QString &string)
|
||||
{
|
||||
QString s(string.trimmed().toLower());
|
||||
if (s.isEmpty()) { return false; }
|
||||
QChar c = s.at(0);
|
||||
|
||||
// explicit values
|
||||
if (c == '1' || c == 't' || c == 'y' || c == 'x') { return true; }
|
||||
if (c == '0' || c == 'f' || c == 'n' || c == '_') { return false; }
|
||||
return false;
|
||||
}
|
||||
|
||||
QString BlackMisc::intToHex(int value, int digits)
|
||||
{
|
||||
QString hex(QString::number(value, 16).toUpper());
|
||||
int l = hex.length();
|
||||
if (l >= digits) { return hex.right(digits); }
|
||||
int d = digits - l;
|
||||
return QString(d, '0') + hex;
|
||||
}
|
||||
|
||||
QString BlackMisc::bytesToHexString(const QByteArray &bytes)
|
||||
{
|
||||
QString h;
|
||||
for (int i = 0; i < bytes.size(); i++)
|
||||
{
|
||||
int b = static_cast<int>(bytes.at(i));
|
||||
h.append(intToHex(b, 2));
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
QByteArray BlackMisc::byteArrayFromHexString(const QString &hexString)
|
||||
{
|
||||
QByteArray ba;
|
||||
int pos = 0;
|
||||
while (pos + 1 < hexString.length())
|
||||
{
|
||||
bool ok;
|
||||
QString h = hexString.mid(pos, 2);
|
||||
int hex = h.toInt(&ok, 16);
|
||||
Q_ASSERT_X(ok, Q_FUNC_INFO, "Invalid hex");
|
||||
if (!ok) { return QByteArray(); }
|
||||
ba.push_back(static_cast<char>(hex));
|
||||
pos += 2;
|
||||
}
|
||||
return ba;
|
||||
}
|
||||
62
src/blackmisc/stringutils.h
Normal file
62
src/blackmisc/stringutils.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_STRINGUTILS_H
|
||||
#define BLACKMISC_STRINGUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QMap>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
//! Free functions in BlackMisc
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! A map converted to string
|
||||
template<class K, class V> QString qmapToString(const QMap<K, V> &map)
|
||||
{
|
||||
QString s;
|
||||
const QString kv("%1: %2 ");
|
||||
QMapIterator<K, V> i(map);
|
||||
while (i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
s.append(
|
||||
kv.arg(i.key()).arg(i.value())
|
||||
);
|
||||
}
|
||||
return s.trimmed();
|
||||
}
|
||||
|
||||
//! Bool to on/off
|
||||
BLACKMISC_EXPORT QString boolToOnOff(bool v, bool i18n = false);
|
||||
|
||||
//! Bool to yes / no
|
||||
BLACKMISC_EXPORT QString boolToYesNo(bool v, bool i18n = false);
|
||||
|
||||
//! Bool to true / false
|
||||
BLACKMISC_EXPORT QString boolToTrueFalse(bool v, bool i18n = false);
|
||||
|
||||
//! Convert string to bool
|
||||
BLACKMISC_EXPORT bool stringToBool(const QString &boolString);
|
||||
|
||||
//! Int to hex value
|
||||
BLACKMISC_EXPORT QString intToHex(int value, int digits = 2);
|
||||
|
||||
//! Int to hex value (per byte, 2 digits)
|
||||
BLACKMISC_EXPORT QString bytesToHexString(const QByteArray &bytes);
|
||||
|
||||
//! Byte array from hex value string per byte, 2 digits
|
||||
BLACKMISC_EXPORT QByteArray byteArrayFromHexString(const QString &hexString);
|
||||
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "threadutilities.h"
|
||||
#include "threadutils.h"
|
||||
#include <QThread>
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_CTHREADUTILITIES_H
|
||||
#define BLACKMISC_CTHREADUTILITIES_H
|
||||
#ifndef BLACKMISC_CTHREADUTILS_H
|
||||
#define BLACKMISC_CTHREADUTILS_H
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include <QObject>
|
||||
@@ -238,6 +238,10 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
// 2 functions required for unmarshallFromDbus
|
||||
QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType);
|
||||
QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type);
|
||||
|
||||
void CVariant::unmarshallFromDbus(const QDBusArgument &arg)
|
||||
{
|
||||
QString typeName;
|
||||
@@ -337,4 +341,78 @@ namespace BlackMisc
|
||||
return toIcon().toPixmap();
|
||||
}
|
||||
|
||||
QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType)
|
||||
{
|
||||
// my business?
|
||||
if (!variant.canConvert<QDBusArgument>()) { return variant; }
|
||||
|
||||
// complex, user type
|
||||
// it has to be made sure, that the cast works
|
||||
const QDBusArgument arg = variant.value<QDBusArgument>();
|
||||
const int userType = static_cast<int>(QVariant::UserType);
|
||||
if (localUserType < userType)
|
||||
{
|
||||
// complex Qt type, e.g. QDateTime
|
||||
return complexQtTypeFromDbusArgument(arg, localUserType);
|
||||
}
|
||||
else if (QMetaType(localUserType).flags() & QMetaType::IsEnumeration)
|
||||
{
|
||||
arg.beginStructure();
|
||||
int i;
|
||||
arg >> i;
|
||||
arg.endStructure();
|
||||
|
||||
QVariant valueVariant = QVariant::fromValue(i);
|
||||
bool ok = valueVariant.convert(localUserType);
|
||||
Q_ASSERT_X(ok, Q_FUNC_INFO, "int could not be converted to enum");
|
||||
Q_UNUSED(ok);
|
||||
return valueVariant;
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant valueVariant(localUserType, nullptr);
|
||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||
if (meta)
|
||||
{
|
||||
meta->unmarshall(arg, valueVariant.data());
|
||||
return valueVariant;
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "no meta");
|
||||
return valueVariant;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type)
|
||||
{
|
||||
// QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17,
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QMetaType::QDateTime:
|
||||
{
|
||||
QDateTime dt;
|
||||
argument >> dt;
|
||||
return QVariant::fromValue(dt);
|
||||
}
|
||||
case QMetaType::QDate:
|
||||
{
|
||||
QDate date;
|
||||
argument >> date;
|
||||
return QVariant::fromValue(date);
|
||||
}
|
||||
case QMetaType::QTime:
|
||||
{
|
||||
QTime time;
|
||||
argument >> time;
|
||||
return QVariant::fromValue(time);
|
||||
}
|
||||
default:
|
||||
{
|
||||
const char *name = QMetaType::typeName(type);
|
||||
qFatal("Type cannot be resolved: %s (%d)", name ? name : "", type);
|
||||
}
|
||||
}
|
||||
return QVariant(); // suppress compiler warning
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -32,6 +32,23 @@ namespace BlackMisc
|
||||
template <typename T>
|
||||
void registerMetaValueType();
|
||||
|
||||
//! Checked version from QVariant
|
||||
template <class T> void setFromQVariant(T *value, const QVariant &variant)
|
||||
{
|
||||
if (variant.canConvert<T>())
|
||||
{
|
||||
(*value) = variant.value<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString m = QString("Target type: %1 Variant type: %2 %3 %4").
|
||||
arg(qMetaTypeId<T>()).
|
||||
arg(static_cast<int>(variant.type())).arg(variant.userType()).arg(variant.typeName());
|
||||
Q_ASSERT_X(false, "setFromQVariant", m.toLocal8Bit().constData());
|
||||
Q_UNUSED(m);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Private
|
||||
{
|
||||
//! \private Needed so we can copy forward-declared CVariant.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/weather/weather.h"
|
||||
|
||||
/*
|
||||
* Metadata for aviation
|
||||
*
|
||||
* In a separate file to workaround a limitation of MinGW:
|
||||
* http://stackoverflow.com/q/16596876/1639256
|
||||
*/
|
||||
void BlackMisc::Weather::registerMetadata()
|
||||
{
|
||||
CMetar::registerMetadata();
|
||||
CMetarSet::registerMetadata();
|
||||
CPresentWeather::registerMetadata();
|
||||
CPresentWeatherList::registerMetadata();
|
||||
CCloudLayer::registerMetadata();
|
||||
CCloudLayerList::registerMetadata();
|
||||
CWindLayer::registerMetadata();
|
||||
}
|
||||
28
src/blackmisc/weather/registermetadataweather.cpp
Normal file
28
src/blackmisc/weather/registermetadataweather.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "registermetadataweather.h"
|
||||
#include "weather.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Weather
|
||||
{
|
||||
void registerMetadata()
|
||||
{
|
||||
CCloudLayer::registerMetadata();
|
||||
CCloudLayerList::registerMetadata();
|
||||
CMetar::registerMetadata();
|
||||
CMetarSet::registerMetadata();
|
||||
CPresentWeather::registerMetadata();
|
||||
CPresentWeatherList::registerMetadata();
|
||||
CWindLayer::registerMetadata();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
26
src/blackmisc/weather/registermetadataweather.h
Normal file
26
src/blackmisc/weather/registermetadataweather.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#ifndef BLACKMISC_WEATHER_REGISTERMETADATAWEATHER_H
|
||||
#define BLACKMISC_WEATHER_REGISTERMETADATAWEATHER_H
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Weather
|
||||
{
|
||||
//! Register metadata for weather
|
||||
BLACKMISC_EXPORT void registerMetadata();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -9,20 +9,20 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_wEATHER_wEATHER_H
|
||||
#define BLACKMISC_wEATHER_wEATHER_H
|
||||
#ifndef BLACKMISC_WEATHER_WEATHER_H
|
||||
#define BLACKMISC_WEATHER_WEATHER_H
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::Weather
|
||||
* \brief Weather and Metar classes
|
||||
*/
|
||||
|
||||
#include "blackmisc/weather/cloudlayer.h"
|
||||
#include "blackmisc/weather/cloudlayerlist.h"
|
||||
#include "blackmisc/weather/metar.h"
|
||||
#include "blackmisc/weather/metarset.h"
|
||||
#include "blackmisc/weather/presentweather.h"
|
||||
#include "blackmisc/weather/presentweatherlist.h"
|
||||
#include "blackmisc/weather/cloudlayer.h"
|
||||
#include "blackmisc/weather/cloudlayerlist.h"
|
||||
#include "blackmisc/weather/windlayer.h"
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user