This commit is contained in:
Klaus Basan
2018-07-31 01:02:52 +02:00
parent 4ca6bb11aa
commit 418584c5e3
9 changed files with 43 additions and 61 deletions

View File

@@ -32,8 +32,7 @@ namespace BlackCore
/*!
* Manages plugins for the simulator context.
*/
class BLACKCORE_EXPORT CPluginManagerSimulator :
public BlackCore::IPluginManager
class BLACKCORE_EXPORT CPluginManagerSimulator : public BlackCore::IPluginManager
{
Q_OBJECT

View File

@@ -241,9 +241,7 @@ namespace BlackGui
{
case INetwork::LoginStealth: CLogMessage(this).info("login in stealth mode"); break;
case INetwork::LoginAsObserver: CLogMessage(this).info("login in observer mode"); break;
case INetwork::LoginNormal:
default:
break;
default: break; // INetwork::LoginNormal
}
// Server

View File

@@ -19,17 +19,13 @@
#include <QObject>
#include <QScopedPointer>
class QWidget;
namespace Ui { class CSettingsNetworkComponent; }
namespace BlackGui
{
namespace Components
{
//! General settings for network
class BLACKGUI_EXPORT CSettingsNetworkComponent :
public QFrame
class BLACKGUI_EXPORT CSettingsNetworkComponent : public QFrame
{
Q_OBJECT
@@ -38,7 +34,7 @@ namespace BlackGui
explicit CSettingsNetworkComponent(QWidget *parent = nullptr);
//! Destructor
~CSettingsNetworkComponent();
virtual ~CSettingsNetworkComponent();
private:
QScopedPointer<Ui::CSettingsNetworkComponent> ui;

View File

@@ -19,17 +19,13 @@
#include <QObject>
#include <QScopedPointer>
class QModelIndex;
class QWidget;
namespace Ui { class CSettingsNetworkServersComponent; }
namespace BlackGui
{
namespace Components
{
//! Settings for network servers
class BLACKGUI_EXPORT CSettingsNetworkServersComponent :
public QFrame
class BLACKGUI_EXPORT CSettingsNetworkServersComponent : public QFrame
{
Q_OBJECT

View File

@@ -24,52 +24,52 @@ namespace BlackGui
ui(new Ui::CSettingsVatsimReadersComponent)
{
ui->setupUi(this);
connect(ui->pb_Save, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::ps_save);
connect(ui->pb_Reload, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::ps_reload);
connect(ui->pb_Save, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::save);
connect(ui->pb_Reload, &QPushButton::clicked, this, &CSettingsVatsimReadersComponent::reload);
this->initValues();
}
CSettingsVatsimReadersComponent::~CSettingsVatsimReadersComponent()
{ }
void CSettingsVatsimReadersComponent::ps_settingsChanged()
void CSettingsVatsimReadersComponent::onSettingsChanged()
{
this->initValues();
}
void CSettingsVatsimReadersComponent::ps_save()
void CSettingsVatsimReadersComponent::save()
{
const int metarSec = this->m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
const int bookingsSec = this->m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
const int dataFileSec = this->m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
const int metarSec = m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
const int bookingsSec = m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
const int dataFileSec = m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
const int newMetarSec = ui->sb_Metar->value();
if (newMetarSec != metarSec)
{
this->m_settingsMetars.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newMetarSec), CTimeUnit::s()}));
m_settingsMetars.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newMetarSec), CTimeUnit::s()}));
}
const int newBookingsSec = ui->sb_Bookings->value();
if (newBookingsSec != bookingsSec)
{
this->m_settingsBookings.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newBookingsSec), CTimeUnit::s()}));
m_settingsBookings.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newBookingsSec), CTimeUnit::s()}));
}
const int newDataFileSec = ui->sb_DataFile->value();
if (newDataFileSec != dataFileSec)
{
this->m_settingsBookings.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newDataFileSec), CTimeUnit::s()}));
m_settingsBookings.setAndSaveProperty(CReaderSettings::IndexPeriodicTime, CVariant::fromValue(CTime{static_cast<double>(newDataFileSec), CTimeUnit::s()}));
}
}
void CSettingsVatsimReadersComponent::ps_reload()
void CSettingsVatsimReadersComponent::reload()
{
this->initValues();
}
void CSettingsVatsimReadersComponent::initValues()
{
const int metarSec = this->m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
const int bookingsSec = this->m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
const int dataFileSec = this->m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
const int metarSec = m_settingsMetars.get().getPeriodicTime().toMs() / 1000;
const int bookingsSec = m_settingsBookings.get().getPeriodicTime().toMs() / 1000;
const int dataFileSec = m_settingsDataFile.get().getPeriodicTime().toMs() / 1000;
ui->sb_Metar->setValue(metarSec);
ui->sb_Bookings->setValue(bookingsSec);

View File

@@ -36,18 +36,16 @@ namespace BlackGui
//! Destructor
virtual ~CSettingsVatsimReadersComponent();
private slots:
void ps_settingsChanged();
void ps_save();
void ps_reload();
private:
void onSettingsChanged();
void save();
void reload();
void initValues();
QScopedPointer<Ui::CSettingsVatsimReadersComponent> ui;
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimBookings> m_settingsBookings { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimDataFile> m_settingsDataFile { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimMetars> m_settingsMetars { this, &CSettingsVatsimReadersComponent::ps_settingsChanged };
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimBookings> m_settingsBookings { this, &CSettingsVatsimReadersComponent::onSettingsChanged };
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimDataFile> m_settingsDataFile { this, &CSettingsVatsimReadersComponent::onSettingsChanged };
BlackMisc::CSetting<BlackCore::Vatsim::TVatsimMetars> m_settingsMetars { this, &CSettingsVatsimReadersComponent::onSettingsChanged };
};
} // ns
} // ns

View File

@@ -10,6 +10,7 @@
#include "blackmisc/network/role.h"
#include <QJsonValue>
#include <QtGlobal>
#include <QStringBuilder>
namespace BlackMisc
{
@@ -22,8 +23,8 @@ namespace BlackMisc
QString CRole::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
return "Role: " + m_name +
" description: " + m_description +
return "Role: " % m_name %
" description: " % m_description %
this->getDbKeyAsStringInParentheses(" ");
}
@@ -31,34 +32,28 @@ namespace BlackMisc
{
if (index.isMyself()) { return CVariant::from(*this); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexName:
return CVariant::fromValue(this->m_name);
case IndexDescription:
return CVariant::fromValue(this->m_description);
default:
return CValueObject::propertyByIndex(index);
case IndexName: return CVariant::fromValue(m_name);
case IndexDescription: return CVariant::fromValue(m_description);
default: break;
}
return CValueObject::propertyByIndex(index);
}
void CRole::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CRole>(); return; }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexName:
this->setName(variant.value<QString>());
break;
case IndexDescription:
this->setDescription(variant.value<QString>());
default:
CValueObject::setPropertyByIndex(index, variant);
break;
case IndexName: this->setName(variant.value<QString>()); break;
case IndexDescription: this->setDescription(variant.value<QString>()); break;
default: break;
}
CValueObject::setPropertyByIndex(index, variant);
}
CRole CRole::fromDatabaseJson(const QJsonObject &json)

View File

@@ -25,9 +25,9 @@ namespace BlackMisc
{
namespace PhysicalQuantities
{
using CAnglePair = QPair<CAngle, CAngle>; //!< Pair of angle
using CLengthPair = QPair<CLength, CLength>; //!< Pair of length
using CSpeedPair = QPair<CSpeed, CSpeed>; //!< Pair of speed
using CAnglePair = QPair<CAngle, CAngle>; //!< Pair of angle
using CLengthPair = QPair<CLength, CLength>; //!< Pair of length
using CSpeedPair = QPair<CSpeed, CSpeed>; //!< Pair of speed
}
namespace Aviation
{

View File

@@ -36,9 +36,9 @@ namespace BlackMisc
CSimulatedAircraftList CRemoteAircraftProvider::getAircraftInRange() const
{
QReadLocker l(&m_lockAircraft);
const QList<CSimulatedAircraft> aircraft = m_aircraftInRange.values();
const QList<CSimulatedAircraft> aircraftInRange = m_aircraftInRange.values();
l.unlock();
return CSimulatedAircraftList(aircraft);
return CSimulatedAircraftList(aircraftInRange);
}
CCallsignSet CRemoteAircraftProvider::getAircraftInRangeCallsigns() const