2015-05-28 19:22:17 -04:00
|
|
|
#include "MetaDataRegistry.hpp"
|
|
|
|
|
|
|
|
#include <QMetaType>
|
|
|
|
#include <QItemEditorFactory>
|
|
|
|
#include <QStandardItemEditorCreator>
|
|
|
|
|
|
|
|
#include "Radio.hpp"
|
|
|
|
#include "FrequencyList.hpp"
|
|
|
|
#include "AudioDevice.hpp"
|
|
|
|
#include "Configuration.hpp"
|
|
|
|
#include "StationList.hpp"
|
|
|
|
#include "Transceiver.hpp"
|
|
|
|
#include "TransceiverFactory.hpp"
|
|
|
|
#include "WFPalette.hpp"
|
|
|
|
|
|
|
|
#include "FrequencyLineEdit.hpp"
|
|
|
|
|
2015-05-31 07:51:31 -04:00
|
|
|
QItemEditorFactory * item_editor_factory ()
|
2015-05-28 19:22:17 -04:00
|
|
|
{
|
2015-05-31 07:51:31 -04:00
|
|
|
static QItemEditorFactory * our_item_editor_factory = new QItemEditorFactory;
|
|
|
|
return our_item_editor_factory;
|
|
|
|
}
|
2015-05-28 19:22:17 -04:00
|
|
|
|
2015-05-31 07:51:31 -04:00
|
|
|
void register_types ()
|
|
|
|
{
|
2016-04-06 13:11:27 -04: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
|
|
|
|
|
2015-05-28 19:22:17 -04:00
|
|
|
// Radio namespace
|
|
|
|
auto frequency_type_id = qRegisterMetaType<Radio::Frequency> ("Frequency");
|
2015-10-21 16:05:02 -04:00
|
|
|
qRegisterMetaType<Radio::Frequencies> ("Frequencies");
|
|
|
|
|
|
|
|
// This is required to preserve v1.5 "frequencies" setting for
|
|
|
|
// backwards compatibility, without it the setting gets trashed by
|
|
|
|
// later versions.
|
|
|
|
qRegisterMetaTypeStreamOperators<Radio::Frequencies> ("Frequencies");
|
|
|
|
|
2016-04-06 13:11:02 -04:00
|
|
|
item_editor_factory ()->registerEditor (frequency_type_id, new QStandardItemEditorCreator<FrequencyLineEdit> ());
|
2015-05-28 19:22:17 -04:00
|
|
|
auto frequency_delta_type_id = qRegisterMetaType<Radio::FrequencyDelta> ("FrequencyDelta");
|
2015-05-31 07:51:31 -04:00
|
|
|
item_editor_factory ()->registerEditor (frequency_delta_type_id, new QStandardItemEditorCreator<FrequencyDeltaLineEdit> ());
|
2015-05-28 19:22:17 -04:00
|
|
|
|
|
|
|
// Frequency list model
|
|
|
|
qRegisterMetaType<FrequencyList::Item> ("Item");
|
|
|
|
qRegisterMetaTypeStreamOperators<FrequencyList::Item> ("Item");
|
|
|
|
qRegisterMetaType<FrequencyList::FrequencyItems> ("FrequencyItems");
|
|
|
|
qRegisterMetaTypeStreamOperators<FrequencyList::FrequencyItems> ("FrequencyItems");
|
|
|
|
|
|
|
|
// Audio device
|
|
|
|
qRegisterMetaType<AudioDevice::Channel> ("AudioDevice::Channel");
|
|
|
|
|
|
|
|
// Configuration
|
2016-04-06 13:11:02 -04:00
|
|
|
#if QT_VERSION < 0x050500
|
2015-05-28 19:22:17 -04:00
|
|
|
qRegisterMetaType<Configuration::DataMode> ("Configuration::DataMode");
|
|
|
|
qRegisterMetaType<Configuration::Type2MsgGen> ("Configuration::Type2MsgGen");
|
2016-04-06 13:11:02 -04:00
|
|
|
#endif
|
|
|
|
qRegisterMetaTypeStreamOperators<Configuration::DataMode> ("Configuration::DataMode");
|
2015-05-28 19:22:17 -04:00
|
|
|
qRegisterMetaTypeStreamOperators<Configuration::Type2MsgGen> ("Configuration::Type2MsgGen");
|
|
|
|
|
|
|
|
// Station details
|
|
|
|
qRegisterMetaType<StationList::Station> ("Station");
|
|
|
|
qRegisterMetaType<StationList::Stations> ("Stations");
|
2016-04-06 13:11:02 -04:00
|
|
|
qRegisterMetaTypeStreamOperators<StationList::Station> ("Station");
|
2015-05-28 19:22:17 -04:00
|
|
|
qRegisterMetaTypeStreamOperators<StationList::Stations> ("Stations");
|
|
|
|
|
|
|
|
// Transceiver
|
|
|
|
qRegisterMetaType<Transceiver::TransceiverState> ("Transceiver::TransceiverState");
|
|
|
|
qRegisterMetaType<Transceiver::MODE> ("Transceiver::MODE");
|
|
|
|
|
|
|
|
// Transceiver factory
|
2016-04-06 13:11:02 -04:00
|
|
|
#if QT_VERSION < 0x050500
|
2015-05-28 19:22:17 -04:00
|
|
|
qRegisterMetaType<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits");
|
|
|
|
qRegisterMetaType<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits");
|
|
|
|
qRegisterMetaType<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake");
|
|
|
|
qRegisterMetaType<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod");
|
|
|
|
qRegisterMetaType<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource");
|
|
|
|
qRegisterMetaType<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
2016-04-06 13:11:02 -04:00
|
|
|
#endif
|
|
|
|
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 19:22:17 -04:00
|
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
|
|
|
|
|
|
|
// Waterfall palette
|
|
|
|
qRegisterMetaTypeStreamOperators<WFPalette::Colours> ("Colours");
|
|
|
|
}
|