This commit is contained in:
Klaus Basan
2018-08-20 18:11:52 +02:00
parent a06fb10adb
commit f1312bbb50
11 changed files with 22 additions and 25 deletions

View File

@@ -155,7 +155,6 @@ namespace BlackCore
virtual BlackMisc::Network::CUrl getDbServiceBaseUrl() const override;
private slots:
//! Read / re-read data file
void ps_read(BlackMisc::Network::CEntityFlags::Entity entities = BlackMisc::Network::CEntityFlags::DistributorLiveryModel,
BlackMisc::Db::CDbFlags::DataRetrievalModeFlag mode = BlackMisc::Db::CDbFlags::DbReading,

View File

@@ -224,7 +224,7 @@ namespace BlackCore
const int accessiblityInt = static_cast<int>(accessibility);
if (m_networkAccessibility == accessiblityInt) { return; }
// shift in thread
// shift to thread
if (!CThreadUtils::isCurrentThreadObjectThread(this))
{
QPointer<CNetworkWatchdog> myself(this);

View File

@@ -126,12 +126,13 @@ namespace BlackGui
void CInfoBarWebReadersStatusBase::setLedReadState(CLedWidget *led, CEntityFlags::ReadState readState)
{
Q_ASSERT_X(led, Q_FUNC_INFO, "no LED");
const int resetTimeMs = 2.5 * 1000;
const int resetTimeMs = qRound(2.5 * 1000);
switch (readState)
{
case CEntityFlags::ReadSkipped:
case CEntityFlags::ReadFinished:
case CEntityFlags::ReadFinishedRestricted:
led->setOn(false);
led->blink(resetTimeMs); // blink here (temp. "on"), since read from cache results in immediate ReadFinished
break;
case CEntityFlags::StartRead:

View File

@@ -23,8 +23,6 @@
#include <QScopedPointer>
#include <QTimer>
class QWidget;
namespace Ui { class CInfoBarWebReadersStatusComponent; }
namespace BlackGui
{

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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)