mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Style
This commit is contained in:
@@ -33,7 +33,7 @@ namespace BlackMisc
|
||||
//! Value object for ICAO classification
|
||||
class BLACKMISC_EXPORT CAircraftIcaoCode :
|
||||
public CValueObject<CAircraftIcaoCode>,
|
||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey
|
||||
public Db::IDatastoreObjectWithIntegerKey
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackMisc
|
||||
if (i1 < 0) { return -1; }
|
||||
int i2 = ks.lastIndexOf(')');
|
||||
if (i2 <= i1 + 1) { return -1;}
|
||||
QString n(ks.mid(i1 + 1, i2 - i1 - 1));
|
||||
const QString n(ks.mid(i1 + 1, i2 - i1 - 1));
|
||||
ok = false;
|
||||
key = n.toInt(&ok);
|
||||
return ok ? key : -1;
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (!timestamp.isEmpty())
|
||||
{
|
||||
QString ts(timestamp.trimmed().remove(' ').remove('-').remove(':')); // normalize
|
||||
const QString ts(timestamp.trimmed().remove(' ').remove('-').remove(':')); // normalize
|
||||
QDateTime dt = QDateTime::fromString(ts, "yyyyMMddHHmmss");
|
||||
dt.setTimeZone(QTimeZone::utc());
|
||||
return dt;
|
||||
|
||||
@@ -47,9 +47,9 @@ namespace BlackMisc
|
||||
|
||||
//! Get data from a DB response
|
||||
static bool parseSwiftPublishResponse(const QString &jsonResponse,
|
||||
BlackMisc::Simulation::CAircraftModelList &publishedModels,
|
||||
BlackMisc::Simulation::CAircraftModelList &skippedModels,
|
||||
BlackMisc::CStatusMessageList &messages, bool &directWrite);
|
||||
Simulation::CAircraftModelList &publishedModels,
|
||||
Simulation::CAircraftModelList &skippedModels,
|
||||
CStatusMessageList &messages, bool &directWrite);
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace BlackMisc
|
||||
{
|
||||
CIdentifierList::CIdentifierList() { }
|
||||
|
||||
CIdentifierList::CIdentifierList(const CSequence<BlackMisc::CIdentifier> &other) :
|
||||
CSequence<BlackMisc::CIdentifier>(other)
|
||||
CIdentifierList::CIdentifierList(const CSequence<CIdentifier> &other) :
|
||||
CSequence<CIdentifier>(other)
|
||||
{ }
|
||||
|
||||
bool CIdentifierList::containsAnyNotIn(const CIdentifierList &other) const
|
||||
|
||||
@@ -12,13 +12,11 @@
|
||||
#ifndef BLACKMISC_IDENTIFIERLIST_H
|
||||
#define BLACKMISC_IDENTIFIERLIST_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/collection.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/timestampobjectlist.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include <QMetaType>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -27,7 +25,7 @@ namespace BlackMisc
|
||||
* Value object encapsulating a list of object identifiers
|
||||
*/
|
||||
class BLACKMISC_EXPORT CIdentifierList :
|
||||
public CSequence<BlackMisc::CIdentifier>,
|
||||
public CSequence<CIdentifier>,
|
||||
public Mixin::MetaType<CIdentifierList>,
|
||||
public ITimestampObjectList<CIdentifier, CIdentifierList>
|
||||
{
|
||||
@@ -38,7 +36,7 @@ namespace BlackMisc
|
||||
CIdentifierList();
|
||||
|
||||
//! Construct from a base class object.
|
||||
CIdentifierList(const CSequence<BlackMisc::CIdentifier> &other);
|
||||
CIdentifierList(const CSequence<CIdentifier> &other);
|
||||
|
||||
//! This list contains an identifier which is not contained in other.
|
||||
bool containsAnyNotIn(const CIdentifierList &other) const;
|
||||
|
||||
@@ -123,13 +123,14 @@ namespace BlackMisc
|
||||
|
||||
if (socket.state() != QTcpSocket::ConnectedState)
|
||||
{
|
||||
const QString error = timedOut ? QObject::tr("Timed out", "BlackMisc") : socket.errorString();
|
||||
message = QObject::tr("Connection failed : %1", "BlackMisc").arg(error);
|
||||
static const QString e("Connection failed: '%1'");
|
||||
message = timedOut ? e.arg("Timed out") : e.arg(socket.errorString());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = QObject::tr("OK, connected", "BlackMisc");
|
||||
static const QString ok("OK, connected");
|
||||
message = ok;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ namespace BlackMisc
|
||||
// starts/ends with
|
||||
float s1 = aStr.length();
|
||||
float s2 = bStr.length();
|
||||
if (aStr.endsWith(bStr, cs)) { return s1 / s2 * 100; }
|
||||
if (aStr.startsWith(bStr, cs)) { return s1 / s2 * 100; }
|
||||
if (aStr.endsWith(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||
if (aStr.startsWith(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||
|
||||
// contains
|
||||
if (aStr.contains(bStr, cs)) { return s1 / s2 * 100; }
|
||||
if (aStr.contains(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||
|
||||
// char by char
|
||||
float points = 0;
|
||||
@@ -125,7 +125,7 @@ namespace BlackMisc
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return points / s1 * 100;
|
||||
return qRound(points / s1 * 100);
|
||||
}
|
||||
|
||||
QString intToHex(int value, int digits)
|
||||
|
||||
Reference in New Issue
Block a user