mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
119 lines
4.6 KiB
C++
119 lines
4.6 KiB
C++
/* Copyright (C) 2016
|
|
* swift project community / contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
|
* or distributed except according to the terms contained in the LICENSE file.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKGUI_SETTINGS_VIEWUPDATESETTINGS_H
|
|
#define BLACKGUI_SETTINGS_VIEWUPDATESETTINGS_H
|
|
|
|
#include "blackgui/blackguiexport.h"
|
|
#include "blackmisc/settingscache.h"
|
|
#include "blackmisc/pq/time.h"
|
|
#include "blackmisc/propertyindex.h"
|
|
#include "blackmisc/variant.h"
|
|
|
|
#include <QMap>
|
|
#include <QString>
|
|
#include <QMetaType>
|
|
|
|
namespace BlackGui
|
|
{
|
|
namespace Settings
|
|
{
|
|
//! Settings about view update rates
|
|
class BLACKGUI_EXPORT CViewUpdateSettings :
|
|
public BlackMisc::CValueObject<CViewUpdateSettings>
|
|
{
|
|
public:
|
|
//! Properties by index
|
|
enum ColumnIndex
|
|
{
|
|
IndexAtc = BlackMisc::CPropertyIndex::GlobalIndexCViewUpdateSettings,
|
|
IndexAircraft,
|
|
IndexRendering,
|
|
IndexUser
|
|
};
|
|
|
|
//! Default constructor
|
|
CViewUpdateSettings();
|
|
|
|
//! Reset to defaults
|
|
void reset();
|
|
|
|
//! Get time
|
|
const BlackMisc::PhysicalQuantities::CTime &getAtcUpdateTime() const { return m_updateAtc; }
|
|
|
|
//! Set time
|
|
void setAtcUpdateTime(const BlackMisc::PhysicalQuantities::CTime &time) { this->m_updateAtc = time; }
|
|
|
|
//! Get time
|
|
const BlackMisc::PhysicalQuantities::CTime &getAircraftUpdateTime() const { return m_updateAircraft; }
|
|
|
|
//! Set time
|
|
void setAircraftUpdateTime(const BlackMisc::PhysicalQuantities::CTime &time) { this->m_updateAircraft = time; }
|
|
|
|
//! Get time
|
|
const BlackMisc::PhysicalQuantities::CTime &getUserUpdateTime() const { return m_updateUser; }
|
|
|
|
//! Set time
|
|
void setUserUpdateTime(const BlackMisc::PhysicalQuantities::CTime &time) { this->m_updateUser = time; }
|
|
|
|
//! Get time
|
|
const BlackMisc::PhysicalQuantities::CTime &getRenderingUpdateTime() const { return m_updateRendering; }
|
|
|
|
//! Set time
|
|
void setRenderingUpdateTime(const BlackMisc::PhysicalQuantities::CTime &time) { this->m_updateRendering = time; }
|
|
|
|
//! Valid?
|
|
bool isValid() const;
|
|
|
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
|
QString convertToQString(bool i18n = false) const;
|
|
|
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
|
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
|
|
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
|
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
|
|
|
private:
|
|
BlackMisc::PhysicalQuantities::CTime m_updateAtc {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()};
|
|
BlackMisc::PhysicalQuantities::CTime m_updateAircraft {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()};
|
|
BlackMisc::PhysicalQuantities::CTime m_updateRendering {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()};
|
|
BlackMisc::PhysicalQuantities::CTime m_updateUser {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()};
|
|
|
|
BLACK_METACLASS(
|
|
CViewUpdateSettings,
|
|
BLACK_METAMEMBER(updateAtc),
|
|
BLACK_METAMEMBER(updateAircraft),
|
|
BLACK_METAMEMBER(updateRendering),
|
|
BLACK_METAMEMBER(updateUser)
|
|
);
|
|
};
|
|
|
|
//! Trait for settings about update rates
|
|
struct TViewUpdateSettings : public BlackMisc::TSettingTrait<CViewUpdateSettings>
|
|
{
|
|
//! \copydoc BlackMisc::TSettingTrait::key
|
|
static const char *key() { return "guiviewupdate"; }
|
|
|
|
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
|
static const QString &humanReadable() { static const QString name("View update"); return name; }
|
|
|
|
//! \copydoc BlackMisc::TSettingTrait::isValid
|
|
static bool isValid(const CViewUpdateSettings &settings) { return settings.isValid(); }
|
|
};
|
|
} // ns
|
|
} // ns
|
|
|
|
Q_DECLARE_METATYPE(BlackGui::Settings::CViewUpdateSettings)
|
|
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackGui::Settings::CViewUpdateSettings>)
|
|
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackGui::Settings::CViewUpdateSettings>)
|
|
|
|
#endif // guard
|