mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
Style
This commit is contained in:
@@ -155,7 +155,6 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Network::CUrl getDbServiceBaseUrl() const override;
|
virtual BlackMisc::Network::CUrl getDbServiceBaseUrl() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
//! Read / re-read data file
|
//! Read / re-read data file
|
||||||
void ps_read(BlackMisc::Network::CEntityFlags::Entity entities = BlackMisc::Network::CEntityFlags::DistributorLiveryModel,
|
void ps_read(BlackMisc::Network::CEntityFlags::Entity entities = BlackMisc::Network::CEntityFlags::DistributorLiveryModel,
|
||||||
BlackMisc::Db::CDbFlags::DataRetrievalModeFlag mode = BlackMisc::Db::CDbFlags::DbReading,
|
BlackMisc::Db::CDbFlags::DataRetrievalModeFlag mode = BlackMisc::Db::CDbFlags::DbReading,
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ namespace BlackCore
|
|||||||
const int accessiblityInt = static_cast<int>(accessibility);
|
const int accessiblityInt = static_cast<int>(accessibility);
|
||||||
if (m_networkAccessibility == accessiblityInt) { return; }
|
if (m_networkAccessibility == accessiblityInt) { return; }
|
||||||
|
|
||||||
// shift in thread
|
// shift to thread
|
||||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||||
{
|
{
|
||||||
QPointer<CNetworkWatchdog> myself(this);
|
QPointer<CNetworkWatchdog> myself(this);
|
||||||
|
|||||||
@@ -126,12 +126,13 @@ namespace BlackGui
|
|||||||
void CInfoBarWebReadersStatusBase::setLedReadState(CLedWidget *led, CEntityFlags::ReadState readState)
|
void CInfoBarWebReadersStatusBase::setLedReadState(CLedWidget *led, CEntityFlags::ReadState readState)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(led, Q_FUNC_INFO, "no LED");
|
Q_ASSERT_X(led, Q_FUNC_INFO, "no LED");
|
||||||
const int resetTimeMs = 2.5 * 1000;
|
const int resetTimeMs = qRound(2.5 * 1000);
|
||||||
switch (readState)
|
switch (readState)
|
||||||
{
|
{
|
||||||
case CEntityFlags::ReadSkipped:
|
case CEntityFlags::ReadSkipped:
|
||||||
case CEntityFlags::ReadFinished:
|
case CEntityFlags::ReadFinished:
|
||||||
case CEntityFlags::ReadFinishedRestricted:
|
case CEntityFlags::ReadFinishedRestricted:
|
||||||
|
led->setOn(false);
|
||||||
led->blink(resetTimeMs); // blink here (temp. "on"), since read from cache results in immediate ReadFinished
|
led->blink(resetTimeMs); // blink here (temp. "on"), since read from cache results in immediate ReadFinished
|
||||||
break;
|
break;
|
||||||
case CEntityFlags::StartRead:
|
case CEntityFlags::StartRead:
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Ui { class CInfoBarWebReadersStatusComponent; }
|
namespace Ui { class CInfoBarWebReadersStatusComponent; }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace BlackMisc
|
|||||||
//! Value object for ICAO classification
|
//! Value object for ICAO classification
|
||||||
class BLACKMISC_EXPORT CAircraftIcaoCode :
|
class BLACKMISC_EXPORT CAircraftIcaoCode :
|
||||||
public CValueObject<CAircraftIcaoCode>,
|
public CValueObject<CAircraftIcaoCode>,
|
||||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey
|
public Db::IDatastoreObjectWithIntegerKey
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Properties by index
|
//! Properties by index
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace BlackMisc
|
|||||||
if (i1 < 0) { return -1; }
|
if (i1 < 0) { return -1; }
|
||||||
int i2 = ks.lastIndexOf(')');
|
int i2 = ks.lastIndexOf(')');
|
||||||
if (i2 <= i1 + 1) { return -1;}
|
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;
|
ok = false;
|
||||||
key = n.toInt(&ok);
|
key = n.toInt(&ok);
|
||||||
return ok ? key : -1;
|
return ok ? key : -1;
|
||||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (!timestamp.isEmpty())
|
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");
|
QDateTime dt = QDateTime::fromString(ts, "yyyyMMddHHmmss");
|
||||||
dt.setTimeZone(QTimeZone::utc());
|
dt.setTimeZone(QTimeZone::utc());
|
||||||
return dt;
|
return dt;
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Get data from a DB response
|
//! Get data from a DB response
|
||||||
static bool parseSwiftPublishResponse(const QString &jsonResponse,
|
static bool parseSwiftPublishResponse(const QString &jsonResponse,
|
||||||
BlackMisc::Simulation::CAircraftModelList &publishedModels,
|
Simulation::CAircraftModelList &publishedModels,
|
||||||
BlackMisc::Simulation::CAircraftModelList &skippedModels,
|
Simulation::CAircraftModelList &skippedModels,
|
||||||
BlackMisc::CStatusMessageList &messages, bool &directWrite);
|
CStatusMessageList &messages, bool &directWrite);
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
CIdentifierList::CIdentifierList() { }
|
CIdentifierList::CIdentifierList() { }
|
||||||
|
|
||||||
CIdentifierList::CIdentifierList(const CSequence<BlackMisc::CIdentifier> &other) :
|
CIdentifierList::CIdentifierList(const CSequence<CIdentifier> &other) :
|
||||||
CSequence<BlackMisc::CIdentifier>(other)
|
CSequence<CIdentifier>(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool CIdentifierList::containsAnyNotIn(const CIdentifierList &other) const
|
bool CIdentifierList::containsAnyNotIn(const CIdentifierList &other) const
|
||||||
|
|||||||
@@ -12,13 +12,11 @@
|
|||||||
#ifndef BLACKMISC_IDENTIFIERLIST_H
|
#ifndef BLACKMISC_IDENTIFIERLIST_H
|
||||||
#define BLACKMISC_IDENTIFIERLIST_H
|
#define BLACKMISC_IDENTIFIERLIST_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
|
||||||
#include "blackmisc/collection.h"
|
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/sequence.h"
|
#include "blackmisc/sequence.h"
|
||||||
#include "blackmisc/timestampobjectlist.h"
|
#include "blackmisc/timestampobjectlist.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
@@ -27,7 +25,7 @@ namespace BlackMisc
|
|||||||
* Value object encapsulating a list of object identifiers
|
* Value object encapsulating a list of object identifiers
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CIdentifierList :
|
class BLACKMISC_EXPORT CIdentifierList :
|
||||||
public CSequence<BlackMisc::CIdentifier>,
|
public CSequence<CIdentifier>,
|
||||||
public Mixin::MetaType<CIdentifierList>,
|
public Mixin::MetaType<CIdentifierList>,
|
||||||
public ITimestampObjectList<CIdentifier, CIdentifierList>
|
public ITimestampObjectList<CIdentifier, CIdentifierList>
|
||||||
{
|
{
|
||||||
@@ -38,7 +36,7 @@ namespace BlackMisc
|
|||||||
CIdentifierList();
|
CIdentifierList();
|
||||||
|
|
||||||
//! Construct from a base class object.
|
//! 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.
|
//! This list contains an identifier which is not contained in other.
|
||||||
bool containsAnyNotIn(const CIdentifierList &other) const;
|
bool containsAnyNotIn(const CIdentifierList &other) const;
|
||||||
|
|||||||
@@ -123,13 +123,14 @@ namespace BlackMisc
|
|||||||
|
|
||||||
if (socket.state() != QTcpSocket::ConnectedState)
|
if (socket.state() != QTcpSocket::ConnectedState)
|
||||||
{
|
{
|
||||||
const QString error = timedOut ? QObject::tr("Timed out", "BlackMisc") : socket.errorString();
|
static const QString e("Connection failed: '%1'");
|
||||||
message = QObject::tr("Connection failed : %1", "BlackMisc").arg(error);
|
message = timedOut ? e.arg("Timed out") : e.arg(socket.errorString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message = QObject::tr("OK, connected", "BlackMisc");
|
static const QString ok("OK, connected");
|
||||||
|
message = ok;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,11 +93,11 @@ namespace BlackMisc
|
|||||||
// starts/ends with
|
// starts/ends with
|
||||||
float s1 = aStr.length();
|
float s1 = aStr.length();
|
||||||
float s2 = bStr.length();
|
float s2 = bStr.length();
|
||||||
if (aStr.endsWith(bStr, cs)) { return s1 / s2 * 100; }
|
if (aStr.endsWith(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||||
if (aStr.startsWith(bStr, cs)) { return s1 / s2 * 100; }
|
if (aStr.startsWith(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||||
|
|
||||||
// contains
|
// contains
|
||||||
if (aStr.contains(bStr, cs)) { return s1 / s2 * 100; }
|
if (aStr.contains(bStr, cs)) { return qRound(s1 / s2 * 100); }
|
||||||
|
|
||||||
// char by char
|
// char by char
|
||||||
float points = 0;
|
float points = 0;
|
||||||
@@ -125,7 +125,7 @@ namespace BlackMisc
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points / s1 * 100;
|
return qRound(points / s1 * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString intToHex(int value, int digits)
|
QString intToHex(int value, int digits)
|
||||||
|
|||||||
Reference in New Issue
Block a user