| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | #include "MetaDataRegistry.hpp"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QMetaType>
 | 
					
						
							|  |  |  | #include <QItemEditorFactory>
 | 
					
						
							|  |  |  | #include <QStandardItemEditorCreator>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Radio.hpp"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 17:49:45 +00:00
										 |  |  | #include "models/FrequencyList.hpp"
 | 
					
						
							| 
									
										
										
										
											2019-07-02 12:45:05 -05:00
										 |  |  | #include "Audio/AudioDevice.hpp"
 | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | #include "Configuration.hpp"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 17:49:45 +00:00
										 |  |  | #include "models/StationList.hpp"
 | 
					
						
							| 
									
										
										
										
											2019-07-02 10:19:43 -05:00
										 |  |  | #include "Transceiver/Transceiver.hpp"
 | 
					
						
							|  |  |  | #include "Transceiver/TransceiverFactory.hpp"
 | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | #include "WFPalette.hpp"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 17:49:45 +00:00
										 |  |  | #include "models/IARURegions.hpp"
 | 
					
						
							|  |  |  | #include "models/DecodeHighlightingModel.hpp"
 | 
					
						
							| 
									
										
										
										
											2019-05-03 10:21:50 +01:00
										 |  |  | #include "widgets/DateTimeEdit.hpp"
 | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-30 04:10:55 +01:00
										 |  |  | namespace | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-30 04:10:55 +01:00
										 |  |  |   class ItemEditorFactory final | 
					
						
							|  |  |  |     : public QItemEditorFactory | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   public: | 
					
						
							|  |  |  |     ItemEditorFactory () | 
					
						
							|  |  |  |       : default_factory_ {QItemEditorFactory::defaultFactory ()} | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QWidget * createEditor (int user_type, QWidget * parent) const override | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       auto editor = QItemEditorFactory::createEditor (user_type, parent); | 
					
						
							|  |  |  |       return editor ? editor : default_factory_->createEditor (user_type, parent); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private: | 
					
						
							|  |  |  |     QItemEditorFactory const * default_factory_; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2015-05-31 11:51:31 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-31 11:51:31 +00:00
										 |  |  | void register_types () | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-05-30 04:10:55 +01:00
										 |  |  |   auto item_editor_factory = new ItemEditorFactory; | 
					
						
							|  |  |  |   QItemEditorFactory::setDefaultFactory (item_editor_factory); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 10:08:35 +00:00
										 |  |  |   // types in Radio.hpp are registered in their own translation unit
 | 
					
						
							|  |  |  |   // as they are needed in the wsjtx_udp shared library too
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-06 17:11:27 +00:00
										 |  |  |   // we still have to register the fully qualified names of enum types
 | 
					
						
							|  |  |  |   // used as signal/slot connection arguments since the new Qt 5.5
 | 
					
						
							|  |  |  |   // Q_ENUM macro only seems to register the unqualified name
 | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2019-05-30 04:10:55 +01:00
										 |  |  |   item_editor_factory->registerEditor (qMetaTypeId<QDateTime> (), new QStandardItemEditorCreator<DateTimeEdit> ()); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Frequency list model
 | 
					
						
							| 
									
										
										
										
											2017-08-09 16:06:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<FrequencyList_v2::Item> ("Item_v2"); | 
					
						
							| 
									
										
										
										
											2020-09-26 13:57:21 +01:00
										 |  |  |   QMetaType::registerConverter<FrequencyList_v2::Item, QString> (&FrequencyList_v2::Item::toString); | 
					
						
							| 
									
										
										
										
											2017-08-09 16:06:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<FrequencyList_v2::FrequencyItems> ("FrequencyItems_v2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // defunct old versions
 | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<FrequencyList::Item> ("Item"); | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<FrequencyList::FrequencyItems> ("FrequencyItems"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Audio device
 | 
					
						
							|  |  |  |   qRegisterMetaType<AudioDevice::Channel> ("AudioDevice::Channel"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Configuration
 | 
					
						
							| 
									
										
										
										
											2016-04-06 17:11:02 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<Configuration::DataMode> ("Configuration::DataMode"); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<Configuration::Type2MsgGen> ("Configuration::Type2MsgGen"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Station details
 | 
					
						
							|  |  |  |   qRegisterMetaType<StationList::Station> ("Station"); | 
					
						
							| 
									
										
										
										
											2020-09-26 13:57:21 +01:00
										 |  |  |   QMetaType::registerConverter<StationList::Station, QString> (&StationList::Station::toString); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  |   qRegisterMetaType<StationList::Stations> ("Stations"); | 
					
						
							| 
									
										
										
										
											2016-04-06 17:11:02 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<StationList::Station> ("Station"); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<StationList::Stations> ("Stations"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Transceiver
 | 
					
						
							|  |  |  |   qRegisterMetaType<Transceiver::TransceiverState> ("Transceiver::TransceiverState"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Transceiver factory
 | 
					
						
							| 
									
										
										
										
											2016-04-06 17:11:02 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits"); | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits"); | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake"); | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod"); | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource"); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  |   qRegisterMetaTypeStreamOperators<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Waterfall palette
 | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<WFPalette::Colours> ("Colours"); | 
					
						
							| 
									
										
										
										
											2017-07-13 18:02:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // IARURegions
 | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<IARURegions::Region> ("IARURegions::Region"); | 
					
						
							| 
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // DecodeHighlightingModel
 | 
					
						
							|  |  |  |   qRegisterMetaTypeStreamOperators<DecodeHighlightingModel::HighlightInfo> ("HighlightInfo"); | 
					
						
							| 
									
										
										
										
											2020-09-26 13:57:21 +01:00
										 |  |  |   QMetaType::registerConverter<DecodeHighlightingModel::HighlightInfo, QString> (&DecodeHighlightingModel::HighlightInfo::toString); | 
					
						
							| 
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 |  |  |   qRegisterMetaTypeStreamOperators<DecodeHighlightingModel::HighlightItems> ("HighlightItems"); | 
					
						
							| 
									
										
										
										
											2015-05-28 23:22:17 +00:00
										 |  |  | } |