mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
#12 Fixing linux build
This commit is contained in:
@@ -8,6 +8,10 @@ INCLUDEPATH += ..
|
||||
|
||||
DEPENDPATH += . ..
|
||||
|
||||
linux-g++* {
|
||||
QMAKE_CXXFLAGS += -std=c++0x
|
||||
}
|
||||
|
||||
#PRECOMPILED_HEADER = stdpch.h
|
||||
|
||||
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "mathematics.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Constants
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace FSD
|
||||
class FSD_MSG : public BlackMisc::IMessage
|
||||
{
|
||||
public:
|
||||
FSD_MSG(QString& id) : IMessage(id)
|
||||
FSD_MSG(QString id) : IMessage(id)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace FSD
|
||||
class FSD_MSG_AddPilot : public FSD_MSG
|
||||
{
|
||||
public:
|
||||
FSD_MSG_AddPilot() : FSD_MSG(QString("#AP")), m_revision(VATSIM_PROTOCOL_REV),
|
||||
FSD_MSG_AddPilot() : FSD_MSG("#AP"), m_revision(VATSIM_PROTOCOL_REV),
|
||||
m_rating(1)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ double CMath::hypot(double x, double y)
|
||||
double CMath::cubicRootReal(const double x)
|
||||
{
|
||||
double result;
|
||||
result = std::pow(std::abs(x), (double)1/3);
|
||||
result = pow(abs(x), (double)1/3);
|
||||
|
||||
return x < 0 ? -result : result;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ namespace BlackCore {
|
||||
bool beaconLights; //!< true if beacon lights on
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
//! A callback that is called when the simulator is started.
|
||||
typedef std::tr1::function<void(const bool status)> cbSimStarted;
|
||||
|
||||
@@ -104,6 +106,20 @@ namespace BlackCore {
|
||||
//! A callback that is called when the user's plane changes its model.
|
||||
typedef std::tr1::function<void(const CPlaneModel &model)> cbChangedModel;
|
||||
|
||||
#else
|
||||
//! A callback that is called when the simulator is started.
|
||||
typedef std::function<void(const bool status)> cbSimStarted;
|
||||
|
||||
//! A callback that is called when the user's plane changes its avionics state.
|
||||
typedef std::function<void(const CAvionicsState &state)> cbChangedAvionicsState;
|
||||
|
||||
//! A callback that is called when the user's plane changes its animation state.
|
||||
typedef std::function<void(const CAnimationState &state)> cbChangedAnimationState;
|
||||
|
||||
//! A callback that is called when the user's plane changes its model.
|
||||
typedef std::function<void(const CPlaneModel &model)> cbChangedModel;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* The interface that is implemented by each simulator driver.
|
||||
*
|
||||
@@ -200,14 +216,25 @@ namespace BlackCore {
|
||||
virtual bool setAnimationState(const qint32 planeID, const CAnimationState &state) = 0;
|
||||
|
||||
//! Calls the supplied visitor function once for every model available in the simulator.
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
virtual void visitAllModels(const std::tr1::function<void(const CPlaneModel &)> &visitor) = 0;
|
||||
#else
|
||||
virtual void visitAllModels(const std::function<void(const CPlaneModel &)> &visitor) = 0;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Fills container with all models.
|
||||
* Class T must be a container of CPlaneModel objects and must support push_back.
|
||||
*/
|
||||
#ifdef Q_OS_WIN
|
||||
template <class T>
|
||||
void getAllModels(T &container) { visitAllModels(std::tr1::bind(T::push_back, container)); }
|
||||
#else
|
||||
template <class T>
|
||||
void getAllModels(T &container) { visitAllModels(std::bind(T::push_back, container)); }
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
BlackMisc::IContext *m_libraryContext; //!< The global context.
|
||||
|
||||
@@ -2,10 +2,6 @@ QT += core gui xml svg network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
|
||||
PRE_TARGETDEPS += ../../lib/blackmisc.lib \
|
||||
../../lib/blackcore.lib
|
||||
|
||||
TARGET = blackd
|
||||
TEMPLATE = app
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace BlackMisc
|
||||
do
|
||||
{
|
||||
qint32 sync = 0;
|
||||
stream >> (qint32)sync;
|
||||
stream >> sync;
|
||||
if (sync == Sync_Marker)
|
||||
found_sync = true;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace BlackMisc
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
qint32 message_length = 0;
|
||||
stream >> (qint32)message_length;
|
||||
stream >> message_length;
|
||||
|
||||
total_length += (int)sizeof(qint32); // Length
|
||||
total_length += message_length; // Data
|
||||
@@ -108,7 +108,7 @@ namespace BlackMisc
|
||||
|
||||
quint16 crc_calc = qChecksum (data.constData(), data.size());
|
||||
quint16 crc_recv = 0;
|
||||
stream >> (quint16)crc_recv;
|
||||
stream >> crc_recv;
|
||||
|
||||
total_length += (int)sizeof(quint16);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BlackMisc
|
||||
{
|
||||
}
|
||||
|
||||
void CConfigManager::setConfigPath(QString &path)
|
||||
void CConfigManager::setConfigPath(QString path)
|
||||
{
|
||||
m_config_path = QDir(path).absolutePath();
|
||||
|
||||
@@ -91,4 +91,4 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BlackMisc
|
||||
} // namespace BlackMisc
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
||||
/*!
|
||||
\param path absolute pathname
|
||||
*/
|
||||
void setConfigPath(QString &path);
|
||||
void setConfigPath(QString path);
|
||||
|
||||
int readConfig(bool forceReload = false);
|
||||
|
||||
@@ -56,4 +56,4 @@ namespace BlackMisc
|
||||
};
|
||||
} // namespace BlackLib
|
||||
|
||||
#endif // CONFIGMANAGER_H
|
||||
#endif // CONFIGMANAGER_H
|
||||
|
||||
@@ -49,33 +49,33 @@ namespace BlackMisc
|
||||
\param singletonName a reference to the singletones name.
|
||||
\return Returns a pointer to the singleton object.
|
||||
*/
|
||||
virtual void *singletonPointer(const QString &singletonName) = NULL;
|
||||
virtual void *singletonPointer(const QString &singletonName) = 0;
|
||||
|
||||
//! Pure virtual method sets the singletone pointer, given by its name.
|
||||
/*!
|
||||
\param singletonName a reference to the singletones name.
|
||||
\param object a pointer to the singletone object.
|
||||
*/
|
||||
virtual void setSingletonPointer(const QString &singletonName, void *object) = NULL;
|
||||
virtual void setSingletonPointer(const QString &singletonName, void *object) = 0;
|
||||
|
||||
//! Deallocates the object and removes the singletone pointer from the context map.
|
||||
/*!
|
||||
\param singletonName a reference to the singletones name.
|
||||
\param object a pointer to the singletone object.
|
||||
*/
|
||||
virtual void releaseSingletonPointer(const QString &singletonName, void *object) = NULL;
|
||||
virtual void releaseSingletonPointer(const QString &singletonName, void *object) = 0;
|
||||
|
||||
//! Pure virtual method returns the pointer to debug object
|
||||
/*!
|
||||
\return Pointer to CDebug object
|
||||
*/
|
||||
virtual CDebug *getDebug() = NULL;
|
||||
virtual CDebug *getDebug() = 0;
|
||||
|
||||
//! Pure virtual function to set the global error log object
|
||||
/*!
|
||||
\param Pointer to CDebug object
|
||||
*/
|
||||
virtual void setDebug(CDebug *debug) = NULL;
|
||||
virtual void setDebug(CDebug *debug) = 0;
|
||||
|
||||
protected:
|
||||
//! Method to register the context.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BlackMisc
|
||||
|
||||
}
|
||||
|
||||
void CDebug::create (QString &logPath, bool logInFile, bool eraseLastLog)
|
||||
void CDebug::create (const char *logPath, bool logInFile, bool eraseLastLog)
|
||||
{
|
||||
if (!m_isInitialized)
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace BlackMisc
|
||||
|
||||
if (logInFile)
|
||||
{
|
||||
QDir fileinfo(m_logPath);
|
||||
QDir fileinfo(m_logPath);
|
||||
QString fn;
|
||||
if ( !m_logPath.isEmpty() )
|
||||
{
|
||||
@@ -76,8 +76,8 @@ namespace BlackMisc
|
||||
m_assertLog->setLogInformation (line, file, function);
|
||||
BlackMisc::CLogMessage::getAssertMsgObj() << "ASSERT FAILED! STOP!";
|
||||
|
||||
#ifdef BB_GUI
|
||||
QMessageBox::critical(0, "ASSERT FAILED",
|
||||
#ifdef BB_GUI
|
||||
QMessageBox::critical(0, "ASSERT FAILED",
|
||||
QString("%1 %2 %3 () - failed assert: %4").
|
||||
arg(QString(file)).arg(line).arg(QString(function)).arg(QString(exp)));
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc
|
||||
|
||||
|
||||
// internal use only
|
||||
void create (QString &logPath = QString(""), bool logInFile = true, bool eraseLastLog = false);
|
||||
void create (const char *logPath = "", bool logInFile = true, bool eraseLastLog = false);
|
||||
|
||||
// init Debug
|
||||
void init(bool logInFile);
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include "blackmisc/context.h"
|
||||
#include "blackmisc/display.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -243,7 +247,7 @@ namespace BlackMisc
|
||||
if (m_file->handle() == -1)
|
||||
{
|
||||
if ( !m_file->open(QIODevice::WriteOnly) )
|
||||
printf ("Can't open log file '%s': %s\n", m_fileName.toLatin1(), strerror (errno));
|
||||
printf ("Can't open log file '%s': %s\n", m_fileName.toLatin1().constData(), strerror (errno));
|
||||
}
|
||||
|
||||
if (m_file->handle() != -1)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
/// Method to implement in the derived class
|
||||
virtual void doPrint(const CLog::SLogInformation &logInformation, const QString &message) = NULL;
|
||||
virtual void doPrint(const CLog::SLogInformation &logInformation, const QString &message) = 0;
|
||||
|
||||
// Return the header string with date (for the first line of the log)
|
||||
static QString headLine ();
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace BlackMisc
|
||||
#else
|
||||
//! Todo: Check if there a corresponding API in Linux and Mac
|
||||
//! For the time being, set it to unknown.
|
||||
if ((*m_applicationName).empty())
|
||||
if ((*m_applicationName).isEmpty())
|
||||
{
|
||||
*m_applicationName = "<Unknown>";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
IMessage::IMessage(QString& id)
|
||||
IMessage::IMessage(QString id)
|
||||
{
|
||||
m_message_id = id;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BlackMisc
|
||||
class IMessage : public ISerialize
|
||||
{
|
||||
public:
|
||||
IMessage(QString& id);
|
||||
IMessage(QString id);
|
||||
|
||||
QString getID() const;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
||||
class TestMessage : public IMessage
|
||||
{
|
||||
public:
|
||||
TestMessage() : IMessage(QString("MSG_ID_TestMessage"))
|
||||
TestMessage() : IMessage("MSG_ID_TestMessage")
|
||||
{
|
||||
testString = "This is a test message!";
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CTypeInfo::CTypeInfo(const type_info& info)
|
||||
CTypeInfo::CTypeInfo(const std::type_info& info)
|
||||
: m_typeinfo(info)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace BlackMisc
|
||||
class CTypeInfo
|
||||
{
|
||||
public:
|
||||
explicit CTypeInfo(const type_info& info);
|
||||
explicit CTypeInfo(const std::type_info& info);
|
||||
|
||||
bool operator < (const CTypeInfo& rhs) const;
|
||||
|
||||
private:
|
||||
const type_info& m_typeinfo;
|
||||
const std::type_info& m_typeinfo;
|
||||
};
|
||||
|
||||
} // namespace BlackMisc
|
||||
|
||||
Reference in New Issue
Block a user