From d63dd8d081a6fcd0715cd13f26df59fb831769d2 Mon Sep 17 00:00:00 2001 From: "Iain R. Learmonth" Date: Sun, 18 Oct 2015 18:51:00 +0100 Subject: Imported Upstream version 1.5.0 --- Radio.hpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Radio.hpp (limited to 'Radio.hpp') diff --git a/Radio.hpp b/Radio.hpp new file mode 100644 index 00000000..3d3211bb --- /dev/null +++ b/Radio.hpp @@ -0,0 +1,54 @@ +#ifndef RADIO_HPP_ +#define RADIO_HPP_ + +#include +#include +#include + +class QVariant; +class QString; + +// +// Declarations common to radio software. +// + +namespace Radio +{ + // + // Frequency types + // + using Frequency = quint64; + using Frequencies = QList; + using FrequencyDelta = qint64; + + // + // Frequency type conversion. + // + // QVariant argument is convertible to double and is assumed to + // be scaled by (10 ** -scale). + // + Frequency frequency (QVariant const&, int scale); + FrequencyDelta frequency_delta (QVariant const&, int scale); + + // + // Frequency type formatting + // + QString frequency_MHz_string (Frequency, QLocale const& = QLocale ()); + QString frequency_MHz_string (FrequencyDelta, QLocale const& = QLocale ()); + QString pretty_frequency_MHz_string (Frequency, QLocale const& = QLocale ()); + QString pretty_frequency_MHz_string (double, int scale, QLocale const& = QLocale ()); + QString pretty_frequency_MHz_string (FrequencyDelta, QLocale const& = QLocale ()); + + // + // Callsigns + // + bool is_callsign (QString const&); + bool is_compound_callsign (QString const&); + QString base_callsign (QString); +} + +Q_DECLARE_METATYPE (Radio::Frequency); +Q_DECLARE_METATYPE (Radio::Frequencies); +Q_DECLARE_METATYPE (Radio::FrequencyDelta); + +#endif -- cgit v1.2.3