| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | #ifndef RADIO_HPP__
 | 
					
						
							|  |  |  | #define RADIO_HPP__
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							|  |  |  | #include <QLocale>
 | 
					
						
							|  |  |  | #include <QList>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QVariant; | 
					
						
							|  |  |  | class QString; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Declarations common to radio software.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Radio | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   // Frequency types
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   using Frequency = quint64; | 
					
						
							|  |  |  |   using Frequencies = QList<Frequency>; | 
					
						
							|  |  |  |   using FrequencyDelta = qint64; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   // Qt type registration
 | 
					
						
							|  |  |  |   //
 | 
					
						
							| 
									
										
										
										
											2018-10-04 18:52:28 -04:00
										 |  |  |   void register_types (); | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   // Frequency type conversion.
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   //	QVariant argument is convertible to double and is assumed to
 | 
					
						
							|  |  |  |   //	be scaled by (10 ** -scale).
 | 
					
						
							|  |  |  |   //
 | 
					
						
							| 
									
										
										
										
											2018-10-04 18:51:11 -04:00
										 |  |  |   Frequency frequency (QVariant const&, int scale, | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |                                   bool * ok = nullptr, QLocale const& = QLocale ()); | 
					
						
							| 
									
										
										
										
											2018-10-04 18:51:11 -04:00
										 |  |  |   FrequencyDelta frequency_delta (QVariant const&, int scale, | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |                                              bool * ok = nullptr, QLocale const& = QLocale ()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   // Frequency type formatting
 | 
					
						
							|  |  |  |   //
 | 
					
						
							| 
									
										
										
										
											2018-10-04 18:51:11 -04:00
										 |  |  |   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 ()); | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   //
 | 
					
						
							|  |  |  |   // Callsigns
 | 
					
						
							|  |  |  |   //
 | 
					
						
							| 
									
										
										
										
											2018-10-04 18:51:11 -04:00
										 |  |  |   bool is_callsign (QString const&); | 
					
						
							|  |  |  |   bool is_compound_callsign (QString const&); | 
					
						
							|  |  |  |   QString base_callsign (QString); | 
					
						
							|  |  |  |   QString effective_prefix (QString); | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Q_DECLARE_METATYPE (Radio::Frequency); | 
					
						
							|  |  |  | Q_DECLARE_METATYPE (Radio::Frequencies); | 
					
						
							|  |  |  | Q_DECLARE_METATYPE (Radio::FrequencyDelta); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |