Minor fixes: Formatting, string generation

This commit is contained in:
Klaus Basan
2017-01-05 02:12:19 +01:00
committed by Mathew Sutcliffe
parent 7e95d4a550
commit 5f18707c9c
10 changed files with 28 additions and 38 deletions

View File

@@ -739,7 +739,7 @@ namespace BlackCore
/********************************** shimlib callbacks ************************************/
/********************************** * * * * * * * * * * * * * * * * * * * ************************************/
//! Cast void* to a pointer of CNetworkVatlib
// Cast void* to a pointer of CNetworkVatlib
CNetworkVatlib *cbvar_cast(void *cbvar)
{
return static_cast<CNetworkVatlib *>(cbvar);

View File

@@ -86,7 +86,6 @@ namespace BlackCore
virtual void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data) override;
virtual void sendCustomFsinnQuery(const BlackMisc::Aviation::CCallsign &callsign) override;
virtual void sendCustomFsinnReponse(const BlackMisc::Aviation::CCallsign &callsign) override;
virtual void broadcastAircraftConfig(const QJsonObject &config) override;
virtual void sendAircraftConfigQuery(const BlackMisc::Aviation::CCallsign &callsign) override;
//! @}
@@ -118,7 +117,7 @@ namespace BlackCore
virtual void sendMetarQuery(const BlackMisc::Aviation::CAirportIcaoCode &airportIcao) override;
//! @}
//! Cmd.line options this library can handle
//! Cmd. line options this library can handle
static const QList<QCommandLineOption> &getCmdLineOptions();
//! Client id and key if any from command line arguments

View File

@@ -25,7 +25,6 @@ class QModelIndex;
class QObject;
namespace BlackMisc { namespace Simulation { class CAircraftModel; } }
namespace BlackGui
{
namespace Models

View File

@@ -10,7 +10,6 @@
#include "blackgui/models/serverlistmodel.h"
#include "blackgui/views/serverview.h"
using namespace BlackMisc;
using namespace BlackGui::Models;

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKGUI_SERVERVIEW_H
#define BLACKGUI_SERVERVIEW_H
#ifndef BLACKGUI_VIEWS_SERVERVIEW_H
#define BLACKGUI_VIEWS_SERVERVIEW_H
#include "blackgui/blackguiexport.h"
#include "blackgui/models/serverlistmodel.h"
@@ -20,7 +20,6 @@
class QWidget;
namespace BlackMisc { namespace Network { class CServer; } }
namespace BlackGui
{
namespace Views
@@ -28,12 +27,10 @@ namespace BlackGui
//! Network servers
class BLACKGUI_EXPORT CServerView : public CViewBase<Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>
{
public:
//! Constructor
explicit CServerView(QWidget *parent = nullptr);
};
}
}
} // ns
#endif // guard

View File

@@ -17,7 +17,6 @@ namespace BlackMisc
{
namespace Aviation
{
CAircraftEngine::CAircraftEngine(int number, bool on) : m_number(number), m_on(on)
{
Q_ASSERT_X(number > 0, "CAircraftEngine", "Engine number have to be > 1");
@@ -32,11 +31,8 @@ namespace BlackMisc
QString CAircraftEngine::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
QString s = QString::number(m_number);
s += " ";
s += BlackMisc::boolToOnOff(m_on);
return s;
static const QString s("%1 on: %2");
return s.arg(m_number).arg(BlackMisc::boolToOnOff(m_on));
}
} // namespace
} // namespace

View File

@@ -18,21 +18,21 @@ namespace BlackMisc
{
namespace Aviation
{
QString CHeading::convertToQString(bool i18n) const
{
QString s = CAngle::convertToQString(i18n).append(" ");
static const QString s("%1 %2");
if (i18n)
{
return s.append(this->isMagneticHeading() ?
QCoreApplication::translate("Aviation", "magnetic") :
QCoreApplication::translate("Aviation", "true"));
return s.arg(CAngle::convertToQString(i18n),
this->isMagneticHeading() ?
QCoreApplication::translate("Aviation", "magnetic") :
QCoreApplication::translate("Aviation", "true"));
}
else
{
return s.append(this->isMagneticHeading() ? "magnetic" : "true");
return s.arg(CAngle::convertToQString(i18n),
this->isMagneticHeading() ? "magnetic" : "true");
}
}
} // namespace
} // namespace

View File

@@ -35,19 +35,18 @@ namespace BlackMisc
QString CFsdSetup::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
QString s("Codec: ");
s.append(" ").append(this->m_textCodec);
s.append(" details:").append(sendReceiveDetailsToString(this->getSendReceiveDetails()));
static const QString s("Codec: '%1' details: '%2'");
s.arg(this->getTextCodec(), CFsdSetup::sendReceiveDetailsToString(this->getSendReceiveDetails()));
return s;
}
QString CFsdSetup::sendReceiveDetailsToString(SendReceiveDetails details)
{
QString ds("Send parts; %1 interim: %2 Receive parts: %3 interim: %4");
return ds.arg(boolToYesNo(details.testFlag(SendAircraftParts))).
arg(boolToYesNo(details.testFlag(SendIterimPositions))).
arg(boolToYesNo(details.testFlag(ReceiveAircraftParts))).
arg(boolToYesNo(details.testFlag(ReceiveInterimPositions)));
static const QString ds("Send parts; %1 interim: %2 Receive parts: %3 interim: %4");
return ds.arg(boolToYesNo(details.testFlag(SendAircraftParts)),
boolToYesNo(details.testFlag(SendIterimPositions)),
boolToYesNo(details.testFlag(ReceiveAircraftParts)),
boolToYesNo(details.testFlag(ReceiveInterimPositions)));
}
void CFsdSetup::setSendReceiveDetails(bool partsSend, bool partsReceive, bool interimSend, bool interimReceive)

View File

@@ -58,7 +58,7 @@ namespace BlackMisc
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::propertyByIndex(index); }
if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexAlias1: return CVariant::from(this->m_alias1);
@@ -76,7 +76,7 @@ namespace BlackMisc
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant); return; }
if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexAlias1:
@@ -101,7 +101,8 @@ namespace BlackMisc
{
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue); }
if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue); }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexAlias1: return this->m_alias1.compare(compareValue.m_alias1, Qt::CaseInsensitive);
@@ -118,7 +119,7 @@ namespace BlackMisc
QString CDistributor::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
QString s = QString("Id: %1").arg(m_dbKey);
QString s = QString("Id: '%1'").arg(m_dbKey);
if (this->hasAlias1()) { s.append(" ").append(m_alias1); }
if (this->hasAlias2()) { s.append(" ").append(m_alias2); }
return s;

View File

@@ -12,12 +12,12 @@
#ifndef BLACKMISC_SIMULATION_DISTRIBUTORLIST_H
#define BLACKMISC_SIMULATION_DISTRIBUTORLIST_H
#include "blackmisc/db/datastoreobjectlist.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/collection.h"
#include "blackmisc/db/datastoreobjectlist.h"
#include "blackmisc/orderablelist.h"
#include "blackmisc/sequence.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/variant.h"
#include <QMetaType>