mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
refs #279, added version info to FSUIPC class
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
// bug in FSUIPC_User.h, windows.h not included, so we have to import it first
|
||||
#include "FSUIPC/FSUIPC_User.h"
|
||||
#include <QDebug>
|
||||
#include <QLatin1Char>
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
@@ -30,13 +31,27 @@ namespace BlackSimPlugin
|
||||
if (FSUIPC_Open(SIM_ANY, &result))
|
||||
{
|
||||
this->m_connected = true;
|
||||
qDebug() << "FSUIPC connected";
|
||||
// KB_REMOVE: Remove this later
|
||||
int simIndex = static_cast<int>(FSUIPC_FS_Version);
|
||||
QString sim(
|
||||
(simIndex >= 0 && simIndex < CFsuipc::simulators().size()) ?
|
||||
CFsuipc::simulators().at(simIndex) :
|
||||
"Unknown FS");
|
||||
QString ver("%1.%2.%3.%4%5");
|
||||
ver = ver.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 28))))
|
||||
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 24))))
|
||||
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 20))))
|
||||
.arg(QLatin1Char(48 + (0x0f & (FSUIPC_Version >> 16))))
|
||||
.arg((FSUIPC_Version & 0xffff) ? "a" + (FSUIPC_Version & 0xff) - 1 : "");
|
||||
this->m_fsuipcVersion = QString("FSUIPC %1 (%2)").arg(ver).arg(sim);
|
||||
qDebug() << "FSUIPC connected" << this->m_fsuipcVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_connected = false;
|
||||
int index = static_cast<int>(result);
|
||||
this->m_lastErrorMessage = CFsuipc::errorMessages().at(index);
|
||||
// KB_REMOVE: Remove this later
|
||||
qDebug() << "FSUIPC" << this->m_lastErrorMessage;
|
||||
}
|
||||
return this->m_connected;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
static const QStringList sims(
|
||||
{
|
||||
"FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002", "FS2004"
|
||||
"any", "FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002", "FS2004", "FSX", "ESP", "P3D"
|
||||
}
|
||||
);
|
||||
return sims;
|
||||
@@ -76,7 +76,7 @@ namespace BlackSimPlugin
|
||||
private:
|
||||
bool m_connected;
|
||||
QString m_lastErrorMessage;
|
||||
|
||||
QString m_fsuipcVersion;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user