Merge branch 'master' of dev.vatsim-germany.org:vatpilotclient/client

This commit is contained in:
Klaus Basan
2014-02-08 01:46:33 +01:00
20 changed files with 33 additions and 302 deletions

View File

@@ -11,9 +11,6 @@ WITH_BLACKSOUND = ON
WITH_SAMPLES = ON WITH_SAMPLES = ON
WITH_UNITTESTS = ON WITH_UNITTESTS = ON
#WITH_DRIVER_FSX = ON
#WITH_DRIVER_FS9 = ON
#WITH_DRIVER_XPLANE = ON
#WITH_DOXYGEN = ON #WITH_DOXYGEN = ON
equals(WITH_BLACKMISC, ON) { equals(WITH_BLACKMISC, ON) {
@@ -33,18 +30,6 @@ equals(WITH_BLACKGUI, ON) {
SUBDIRS += src/blackgui SUBDIRS += src/blackgui
} }
equals(WITH_DRIVER_FSX, ON) {
SUBDIRS += src/driver/fsx/driver_fsx.pro
}
equals(WITH_DRIVER_FS9, ON) {
SUBDIRS += src/driver/fs9/driver_fs9.pro
}
equals(WITH_DRIVER_XPLANE, ON) {
SUBDIRS += src/driver/xplane/driver_xplane.pro
}
equals(WITH_SAMPLES, ON) { equals(WITH_SAMPLES, ON) {
SUBDIRS += samples/cli_client/sample_cli_client.pro SUBDIRS += samples/cli_client/sample_cli_client.pro
SUBDIRS += samples/interpolator/sample_interpolator.pro SUBDIRS += samples/interpolator/sample_interpolator.pro

View File

@@ -402,7 +402,7 @@ namespace BlackCore
// I could send the same message to n frequencies in one step // I could send the same message to n frequencies in one step
// if this is really required, I need to group by message // if this is really required, I need to group by message
// currently I send individual messages // currently I send individual messages
std::vector<INT> freqsVec; QVector<INT> freqsVec;
freqsVec.push_back(message.getFrequency().value(CFrequencyUnit::kHz())); freqsVec.push_back(message.getFrequency().value(CFrequencyUnit::kHz()));
m_net->SendRadioTextMessage(freqsVec.size(), freqsVec.data(), toFSD(message.getMessage())); m_net->SendRadioTextMessage(freqsVec.size(), freqsVec.data(), toFSD(message.getMessage()));
} }

View File

@@ -63,7 +63,7 @@ namespace BlackCore
} }
} }
const CPluginManager::PluginEntry &CPluginManager::getEntry(size_t index) const const CPluginManager::PluginEntry &CPluginManager::getEntry(int index) const
{ {
Q_ASSERT_X(index < getPluginCount(), "Plugin manager", "Plugin index out of bounds"); Q_ASSERT_X(index < getPluginCount(), "Plugin manager", "Plugin index out of bounds");
@@ -80,17 +80,17 @@ namespace BlackCore
return entry; return entry;
} }
const QString CPluginManager::getName(size_t index) const const QString CPluginManager::getName(int index) const
{ {
return getFactory(index)->getName(); return getFactory(index)->getName();
} }
const QString CPluginManager::getDescription(size_t index) const const QString CPluginManager::getDescription(int index) const
{ {
return getFactory(index)->getDescription(); return getFactory(index)->getDescription();
} }
BlackMisc::IPlugin *CPluginManager::constructPlugin(size_t index) BlackMisc::IPlugin *CPluginManager::constructPlugin(int index)
{ {
BlackMisc::IPlugin *plugin = getFactory(index)->create(BlackMisc::IContext::getInstance()); BlackMisc::IPlugin *plugin = getFactory(index)->create(BlackMisc::IContext::getInstance());
if (! plugin->isValid()) if (! plugin->isValid())

View File

@@ -45,7 +45,7 @@ namespace BlackCore
Return the total number of plugins loaded so far. Return the total number of plugins loaded so far.
\return \return
*/ */
size_t getPluginCount() const int getPluginCount() const
{ {
return m_plugins.size(); return m_plugins.size();
} }
@@ -55,14 +55,14 @@ namespace BlackCore
\param index the plugin's index in the vector of plugins. \param index the plugin's index in the vector of plugins.
\return \return
*/ */
const QString getName(size_t index) const; const QString getName(int index) const;
/*! /*!
Return the description of a plugin. Return the description of a plugin.
\param index the plugin's index in the vector of plugins. \param index the plugin's index in the vector of plugins.
\return \return
*/ */
const QString getDescription(size_t index) const; const QString getDescription(int index) const;
/*! /*!
Construct a plugin. Construct a plugin.
@@ -70,14 +70,14 @@ namespace BlackCore
\return a pointer to the newly created plugin. \return a pointer to the newly created plugin.
\warning You must release this pointer with IPluginFactory::destroy(). \warning You must release this pointer with IPluginFactory::destroy().
*/ */
BlackMisc::IPlugin *constructPlugin(size_t index); BlackMisc::IPlugin *constructPlugin(int index);
/*! /*!
Direct access to the factory. You don't usually need this. Direct access to the factory. You don't usually need this.
\param index \param index
\return \return
*/ */
BlackMisc::IPluginFactory *getFactory(size_t index) BlackMisc::IPluginFactory *getFactory(int index)
{ {
return const_cast<BlackMisc::IPluginFactory*>(static_cast<const CPluginManager*>(this)->getFactory(index)); return const_cast<BlackMisc::IPluginFactory*>(static_cast<const CPluginManager*>(this)->getFactory(index));
} }
@@ -87,7 +87,7 @@ namespace BlackCore
\param index \param index
\return \return
*/ */
const BlackMisc::IPluginFactory *getFactory(size_t index) const const BlackMisc::IPluginFactory *getFactory(int index) const
{ {
return getEntry(index).factory; return getEntry(index).factory;
} }
@@ -97,7 +97,7 @@ namespace BlackCore
\param index \param index
\return \return
*/ */
QPluginLoader *getLoader(size_t index) QPluginLoader *getLoader(int index)
{ {
return const_cast<QPluginLoader*>(static_cast<const CPluginManager*>(this)->getLoader(index)); return const_cast<QPluginLoader*>(static_cast<const CPluginManager*>(this)->getLoader(index));
} }
@@ -107,7 +107,7 @@ namespace BlackCore
\param index \param index
\return \return
*/ */
const QPluginLoader *getLoader(size_t index) const const QPluginLoader *getLoader(int index) const
{ {
return getEntry(index).loader.data(); return getEntry(index).loader.data();
} }
@@ -123,12 +123,12 @@ namespace BlackCore
QVector<PluginEntry> m_plugins; QVector<PluginEntry> m_plugins;
PluginEntry &getEntry(size_t index) PluginEntry &getEntry(int index)
{ {
return const_cast<PluginEntry&>(static_cast<const CPluginManager*>(this)->getEntry(index)); return const_cast<PluginEntry&>(static_cast<const CPluginManager*>(this)->getEntry(index));
} }
const PluginEntry &getEntry(size_t index) const; const PluginEntry &getEntry(int index) const;
}; };
} // namespace BlackCore } // namespace BlackCore

View File

@@ -93,8 +93,8 @@ namespace BlackMisc
*/ */
template <class T> bool hasObject(const QString &name = T::staticMetaObject.className()) const template <class T> bool hasObject(const QString &name = T::staticMetaObject.className()) const
{ {
QObject *qobj = getQObjectNothrow(name); const QObject *qobj = getQObjectNothrow(name);
return qobj && qobject_cast<T *>(qobj); return qobj && qobject_cast<const T *>(qobj);
} }
/*! /*!

View File

@@ -16,7 +16,7 @@ namespace BlackMisc
/* /*
* Get element by column / row * Get element by column / row
*/ */
template<class ImplMatrix, int Rows, int Columns> double CMatrixBase<ImplMatrix, Rows, Columns>::getElement(size_t row, size_t column) const template<class ImplMatrix, int Rows, int Columns> double CMatrixBase<ImplMatrix, Rows, Columns>::getElement(int row, int column) const
{ {
this->checkRange(row, column); this->checkRange(row, column);
return this->m_matrix(row, column); return this->m_matrix(row, column);
@@ -25,7 +25,7 @@ namespace BlackMisc
/* /*
* Set element by column / row * Set element by column / row
*/ */
template<class ImplMatrix, int Rows, int Columns> void CMatrixBase<ImplMatrix, Rows, Columns>::setElement(size_t row, size_t column, double value) template<class ImplMatrix, int Rows, int Columns> void CMatrixBase<ImplMatrix, Rows, Columns>::setElement(int row, int column, double value)
{ {
this->checkRange(row, column); this->checkRange(row, column);
this->m_matrix(row, column) = value; this->m_matrix(row, column) = value;
@@ -34,7 +34,7 @@ namespace BlackMisc
/* /*
* Check range * Check range
*/ */
template<class ImplMatrix, int Rows, int Columns> void CMatrixBase<ImplMatrix, Rows, Columns>::checkRange(size_t row, size_t column) const template<class ImplMatrix, int Rows, int Columns> void CMatrixBase<ImplMatrix, Rows, Columns>::checkRange(int row, int column) const
{ {
bool valid = (row < Rows && column < Columns); bool valid = (row < Rows && column < Columns);
Q_ASSERT_X(valid, "getElement()", "Row or column invalid"); Q_ASSERT_X(valid, "getElement()", "Row or column invalid");

View File

@@ -324,7 +324,7 @@ namespace BlackMisc
* \param column * \param column
* \return * \return
*/ */
double getElement(size_t row, size_t column) const; double getElement(int row, int column) const;
/*! /*!
* \brief Get element * \brief Get element
@@ -332,7 +332,7 @@ namespace BlackMisc
* \param column * \param column
* \param value * \param value
*/ */
void setElement(size_t row, size_t column, double value); void setElement(int row, int column, double value);
/*! /*!
* \brief Get element by operator () modifying * \brief Get element by operator () modifying
@@ -340,7 +340,7 @@ namespace BlackMisc
* \param column * \param column
* \return * \return
*/ */
double &operator()(size_t row, size_t column) double &operator()(int row, int column)
{ {
this->checkRange(row, column); this->checkRange(row, column);
return this->m_matrix(row, column); return this->m_matrix(row, column);
@@ -352,7 +352,7 @@ namespace BlackMisc
* \param column * \param column
* \return * \return
*/ */
double operator()(size_t row, size_t column) const double operator()(int row, int column) const
{ {
return this->getElement(row, column); return this->getElement(row, column);
} }
@@ -369,7 +369,7 @@ namespace BlackMisc
* \param column * \param column
* \throws std::range_error if index out of bounds * \throws std::range_error if index out of bounds
*/ */
void checkRange(size_t row, size_t column) const; void checkRange(int row, int column) const;
}; };
} // namespace } // namespace

View File

@@ -81,7 +81,7 @@ namespace BlackMisc
/* /*
* Element (return by reference) * Element (return by reference)
*/ */
template <class ImplVector> double &CVector3DBase<ImplVector>::getElement(size_t row) template <class ImplVector> double &CVector3DBase<ImplVector>::getElement(int row)
{ {
switch (row) switch (row)
{ {
@@ -100,7 +100,7 @@ namespace BlackMisc
/* /*
* Element * Element
*/ */
template <class ImplVector> double CVector3DBase<ImplVector>::getElement(size_t row) const template <class ImplVector> double CVector3DBase<ImplVector>::getElement(int row) const
{ {
return const_cast<CVector3DBase<ImplVector>*>(this)->getElement(row); return const_cast<CVector3DBase<ImplVector>*>(this)->getElement(row);
} }
@@ -108,7 +108,7 @@ namespace BlackMisc
/* /*
* Set given element * Set given element
*/ */
template <class ImplVector> void CVector3DBase<ImplVector>::setElement(size_t row, double value) template <class ImplVector> void CVector3DBase<ImplVector>::setElement(int row, double value)
{ {
switch (row) switch (row)
{ {

View File

@@ -71,7 +71,7 @@ namespace BlackMisc
* \param row * \param row
* \return Mutable reference * \return Mutable reference
*/ */
double &getElement(size_t row); double &getElement(int row);
/*! /*!
* \brief String for converter * \brief String for converter
@@ -152,28 +152,28 @@ namespace BlackMisc
* \param row * \param row
* \return * \return
*/ */
double getElement(size_t row) const; double getElement(int row) const;
/*! /*!
* \brief Set element * \brief Set element
* \param row * \param row
* \param value * \param value
*/ */
void setElement(size_t row, double value); void setElement(int row, double value);
/*! /*!
* \brief Operator [] * \brief Operator []
* \param row * \param row
* \return * \return
*/ */
double operator[](size_t row) const { return this->getElement(row); } double operator[](int row) const { return this->getElement(row); }
/*! /*!
* \brief Operator [] * \brief Operator []
* \param row * \param row
* \return Mutable reference * \return Mutable reference
*/ */
double &operator[](size_t row) { return this->getElement(row); } double &operator[](int row) { return this->getElement(row); }
/*! /*!
* \brief Equal operator == * \brief Equal operator ==

View File

@@ -1,3 +0,0 @@
IF(WITH_DRIVER_FSX)
ADD_SUBDIRECTORY(fsx)
ENDIF(WITH_DRIVER_FSX)

View File

@@ -1,33 +0,0 @@
#include "driver_fs9.h"
extern "C"
{
Q_DECL_EXPORT ISimulator* BB_createISimulatorInstance ()
{
return new CDriverFSX;
}
Q_DECL_EXPORT quint32 BB_InterfaceVersionMajor ()
{
return ISimulator::InterfaceVersionMajor;
}
Q_DECL_EXPORT quint32 BB_InterfaceVersionMinor ()
{
return ISimulator::InterfaceVersionMinor;
}
}
CDriverFS9::CDriverFS9()
{
}
void CDriverFS9::setLibraryContext(BlackMisc::IContext *context)
{
#ifdef Q_OS_WIN
bAssert(!BlackMisc::IContext::isContextInitialised());
#endif
m_libraryContext = new BlackMisc::CLibraryContext(*context);
}

View File

@@ -1,17 +0,0 @@
#ifndef DRIVER_FS9_H
#define DRIVER_FS9_H
#include <simulator.h>
class CDriverFS9 : public ISimulator
{
public:
CDriverFS9();
virtual int init() { return 1;}
protected:
BlackMisc::CLibraryContext *m_libraryContext;
};
#endif // DRIVER_FS9_H

View File

@@ -1,17 +0,0 @@
TARGET = bb_driver_fs9
TEMPLATE = lib
CONFIG += dll c++11
INCLUDEPATH += .. ../../
DESTDIR = ../../../bin
DEPENDPATH += .
HEADERS += *.h
SOURCES += *.cpp

View File

@@ -1,20 +0,0 @@
FILE(GLOB driver_fsx_SOURCES *.cpp)
FILE(GLOB driver_fsx_HEADERS *.h)
SET(driver_fsx_HEADERS_QOBJECT )
QT4_WRAP_CPP(driver_fsx_HEADERS_MOC ${driver_fsx_HEADERS_QOBJECT})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${driver_fsx_HEADERS_MOC})
SOURCE_GROUP (Headers FILES ${driver_fsx_HEADERS})
INCLUDE_DIRECTORIES(${SIMCONNECT_INCLUDE_DIR})
LINK_DIRECTORIES(${SIMCONNECT_LIBRARY_DIR})
IF(WITH_STATIC_DRIVERS)
ADD_LIBRARY(bb_driver_fsx STATIC ${driver_fsx_SOURCES} ${driver_fsx_HEADERS_MOC} )
ELSE(WITH_STATIC_DRIVERS)
ADD_LIBRARY(bb_driver_fsx SHARED ${driver_fsx_SOURCES} ${driver_fsx_HEADERS_MOC} )
ENDIF(WITH_STATIC_DRIVERS)
TARGET_LINK_LIBRARIES(bb_driver_fsx blackmisc blackcore SimConnect.lib ${QT_LIBRARIES})
SET_TARGET_PROPERTIES(bb_driver_fsx PROPERTIES PROJECT_LABEL "Driver - FSX")

View File

@@ -1,49 +0,0 @@
/***************************************************************************
* Copyright (C) 2013 by Roland Winklmeier *
* roland.m.winklmeier@googlemail.com *
* *
* For license information see LICENSE in the root folder of the *
* source code. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
***************************************************************************/
#include <QtCore/qglobal.h>
#include "driver_fsx.h"
extern "C"
{
Q_DECL_EXPORT ISimulator* BB_createISimulatorInstance ()
{
return new CDriverFSX;
}
Q_DECL_EXPORT quint32 BB_InterfaceVersionMajor ()
{
return ISimulator::InterfaceVersionMajor;
}
Q_DECL_EXPORT quint32 BB_InterfaceVersionMinor ()
{
return ISimulator::InterfaceVersionMinor;
}
}
CDriverFSX::CDriverFSX()
{
}
void CDriverFSX::setLibraryContext(BlackMisc::IContext *context)
{
#ifdef Q_OS_WIN
bAssert(!BlackMisc::IContext::isContextInitialised());
#endif
m_libraryContext = new BlackMisc::CLibraryContext(*context);
}

View File

@@ -1,35 +0,0 @@
/***************************************************************************
* Copyright (C) 2013 by Roland Winklmeier *
* roland.m.winklmeier@googlemail.com *
* *
* For license information see LICENSE in the root folder of the *
* source code. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
***************************************************************************/
#ifndef DRIVER_FSX_H
#define DRIVER_FSX_H
#include <blackmisc/context.h>
#include <blackcore/simulator.h>
class CDriverFSX : public BlackCore::ISimulator
{
public:
CDriverFSX();
virtual void setLibraryContext(BlackMisc::IContext *context);
virtual int init() { return 0; }
protected:
BlackMisc::CLibraryContext *m_libraryContext;
};
#endif // DRIVER_FSX_H

View File

@@ -1,17 +0,0 @@
TARGET = bb_driver_fsx
TEMPLATE = lib
CONFIG += dll c++11
INCLUDEPATH += .. ../../
DESTDIR = ../../../bin
DEPENDPATH += .
HEADERS += *.h
SOURCES += *.cpp

View File

@@ -1,31 +0,0 @@
#include "driver_xplane.h"
extern "C"
{
Q_DECL_EXPORT ISimulator* BB_createISimulatorInstance()
{
return new CDriverXPlane;
}
}
CDriverXPlane::CDriverXPlane()
{
}
CDriverXPlane::~CDriverXPlane()
{
}
int CDriverXPlane::init()
{
return 1;
}
void CDriverXPlane::setLibraryContext(BlackMisc::IContext *context)
{
#ifdef Q_OS_WIN
bAssert(!BlackMisc::IContext::isContextInitialised());
#endif
mLibraryContext = new BlackMisc::CLibraryContext(*context);
}

View File

@@ -1,15 +0,0 @@
#ifndef DRIVER_XPLANE_H
#define DRIVER_XPLANE_H
#include <simulator.h>
class CDriverXPlane : public ISimulator
{
public:
CDriverXPlane();
virtual ~CDriverXPlane();
virtual int init();
};
#endif // DRIVER_XPLANE_H

View File

@@ -1,17 +0,0 @@
TARGET = bb_driver_xplane
TEMPLATE = lib
CONFIG += dll c++11
INCLUDEPATH += .. ../../
DESTDIR = ../../../bin
DEPENDPATH += .
HEADERS += *.h
SOURCES += *.cpp