mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
retain old type name for FrequencyList_v2, use new type name for new class
This commit is contained in:
parent
a39a48d76a
commit
c185f8578f
@ -270,7 +270,7 @@ class FrequencyDialog final
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Item = FrequencyList_v2::Item;
|
using Item = FrequencyList_v2_101::Item;
|
||||||
|
|
||||||
explicit FrequencyDialog (IARURegions * regions_model, Modes * modes_model, QWidget * parent = nullptr)
|
explicit FrequencyDialog (IARURegions * regions_model, Modes * modes_model, QWidget * parent = nullptr)
|
||||||
: QDialog {parent}
|
: QDialog {parent}
|
||||||
@ -522,7 +522,7 @@ private:
|
|||||||
void insert_frequency ();
|
void insert_frequency ();
|
||||||
void size_frequency_table_columns();
|
void size_frequency_table_columns();
|
||||||
|
|
||||||
FrequencyList_v2::FrequencyItems read_frequencies_file (QString const&);
|
FrequencyList_v2_101::FrequencyItems read_frequencies_file (QString const&);
|
||||||
|
|
||||||
void delete_stations ();
|
void delete_stations ();
|
||||||
void insert_station ();
|
void insert_station ();
|
||||||
@ -614,8 +614,8 @@ private:
|
|||||||
IARURegions regions_;
|
IARURegions regions_;
|
||||||
IARURegions::Region region_;
|
IARURegions::Region region_;
|
||||||
Modes modes_;
|
Modes modes_;
|
||||||
FrequencyList_v2 frequencies_;
|
FrequencyList_v2_101 frequencies_;
|
||||||
FrequencyList_v2 next_frequencies_;
|
FrequencyList_v2_101 next_frequencies_;
|
||||||
StationList stations_;
|
StationList stations_;
|
||||||
StationList next_stations_;
|
StationList next_stations_;
|
||||||
FrequencyDelta current_offset_;
|
FrequencyDelta current_offset_;
|
||||||
@ -821,8 +821,8 @@ Bands const * Configuration::bands () const {return &m_->bands_;}
|
|||||||
StationList * Configuration::stations () {return &m_->stations_;}
|
StationList * Configuration::stations () {return &m_->stations_;}
|
||||||
StationList const * Configuration::stations () const {return &m_->stations_;}
|
StationList const * Configuration::stations () const {return &m_->stations_;}
|
||||||
IARURegions::Region Configuration::region () const {return m_->region_;}
|
IARURegions::Region Configuration::region () const {return m_->region_;}
|
||||||
FrequencyList_v2 * Configuration::frequencies () {return &m_->frequencies_;}
|
FrequencyList_v2_101 * Configuration::frequencies () {return &m_->frequencies_;}
|
||||||
FrequencyList_v2 const * Configuration::frequencies () const {return &m_->frequencies_;}
|
FrequencyList_v2_101 const * Configuration::frequencies () const {return &m_->frequencies_;}
|
||||||
QStringListModel * Configuration::macros () {return &m_->macros_;}
|
QStringListModel * Configuration::macros () {return &m_->macros_;}
|
||||||
QStringListModel const * Configuration::macros () const {return &m_->macros_;}
|
QStringListModel const * Configuration::macros () const {return &m_->macros_;}
|
||||||
QDir Configuration::save_directory () const {return m_->save_directory_;}
|
QDir Configuration::save_directory () const {return m_->save_directory_;}
|
||||||
@ -1090,7 +1090,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
|
|||||||
throw std::runtime_error {"Failed to create save directory"};
|
throw std::runtime_error {"Failed to create save directory"};
|
||||||
}
|
}
|
||||||
|
|
||||||
// we now have a deafult save path that exists
|
// we now have a default save path that exists
|
||||||
|
|
||||||
// make sure samples directory exists
|
// make sure samples directory exists
|
||||||
QString samples_dir {"samples"};
|
QString samples_dir {"samples"};
|
||||||
@ -1239,7 +1239,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
|
|||||||
//
|
//
|
||||||
// setup working frequencies table model & view
|
// setup working frequencies table model & view
|
||||||
//
|
//
|
||||||
frequencies_.sort (FrequencyList_v2::frequency_column);
|
frequencies_.sort (FrequencyList_v2_101::frequency_column);
|
||||||
|
|
||||||
ui_->frequencies_table_view->setModel (&next_frequencies_);
|
ui_->frequencies_table_view->setModel (&next_frequencies_);
|
||||||
ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
|
ui_->frequencies_table_view->horizontalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
|
||||||
@ -1248,14 +1248,14 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
|
|||||||
ui_->frequencies_table_view->horizontalHeader ()->moveSection(8, 3); // swap preferred to be in front of description
|
ui_->frequencies_table_view->horizontalHeader ()->moveSection(8, 3); // swap preferred to be in front of description
|
||||||
ui_->frequencies_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
|
ui_->frequencies_table_view->verticalHeader ()->setSectionResizeMode (QHeaderView::ResizeToContents);
|
||||||
ui_->frequencies_table_view->verticalHeader ()->setResizeContentsPrecision (0);
|
ui_->frequencies_table_view->verticalHeader ()->setResizeContentsPrecision (0);
|
||||||
ui_->frequencies_table_view->sortByColumn (FrequencyList_v2::frequency_column, Qt::AscendingOrder);
|
ui_->frequencies_table_view->sortByColumn (FrequencyList_v2_101::frequency_column, Qt::AscendingOrder);
|
||||||
ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2::frequency_mhz_column, true);
|
ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2_101::frequency_mhz_column, true);
|
||||||
ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2::source_column, true);
|
ui_->frequencies_table_view->setColumnHidden (FrequencyList_v2_101::source_column, true);
|
||||||
|
|
||||||
// delegates
|
// delegates
|
||||||
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::frequency_column, new FrequencyDelegate {this});
|
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::frequency_column, new FrequencyDelegate {this});
|
||||||
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::region_column, new ForeignKeyDelegate {®ions_, 0, this});
|
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::region_column, new ForeignKeyDelegate {®ions_, 0, this});
|
||||||
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2::mode_column, new ForeignKeyDelegate {&modes_, 0, this});
|
ui_->frequencies_table_view->setItemDelegateForColumn (FrequencyList_v2_101::mode_column, new ForeignKeyDelegate {&modes_, 0, this});
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
frequency_delete_action_ = new QAction {tr ("&Delete"), ui_->frequencies_table_view};
|
frequency_delete_action_ = new QAction {tr ("&Delete"), ui_->frequencies_table_view};
|
||||||
@ -1498,6 +1498,13 @@ void Configuration::impl::done (int r)
|
|||||||
void Configuration::impl::read_settings ()
|
void Configuration::impl::read_settings ()
|
||||||
{
|
{
|
||||||
SettingsGroup g {settings_, "Configuration"};
|
SettingsGroup g {settings_, "Configuration"};
|
||||||
|
LOG_INFO(QString{"Configuration Settings (%1)"}.arg(settings_->fileName()));
|
||||||
|
QStringList keys = settings_->allKeys();
|
||||||
|
//Q_FOREACH (auto const& item, keys)
|
||||||
|
//{
|
||||||
|
// LOG_INFO(QString{" %1 = %2"}.arg(item).arg(settings_->value(item).toString()));
|
||||||
|
//}
|
||||||
|
|
||||||
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
||||||
|
|
||||||
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
|
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
|
||||||
@ -1551,12 +1558,20 @@ void Configuration::impl::read_settings ()
|
|||||||
|
|
||||||
region_ = settings_->value ("Region", QVariant::fromValue (IARURegions::ALL)).value<IARURegions::Region> ();
|
region_ = settings_->value ("Region", QVariant::fromValue (IARURegions::ALL)).value<IARURegions::Region> ();
|
||||||
|
|
||||||
if (settings_->contains ("FrequenciesForRegionModes"))
|
LOG_INFO(QString{"Reading frequencies"});
|
||||||
|
|
||||||
|
if (settings_->contains ("FrequenciesForRegionModes_v2"))
|
||||||
{
|
{
|
||||||
auto const& v = settings_->value ("FrequenciesForRegionModes");
|
LOG_INFO(QString{"read_settings found FrequenciesForRegionModes_v2"});
|
||||||
|
if (settings_->contains ("FrequenciesForRegionModes"))
|
||||||
|
{
|
||||||
|
LOG_INFO(QString{"read_settings ALSO found FrequenciesForRegionModes"});
|
||||||
|
}
|
||||||
|
|
||||||
|
auto const& v = settings_->value ("FrequenciesForRegionModes_v2");
|
||||||
if (v.isValid ())
|
if (v.isValid ())
|
||||||
{
|
{
|
||||||
frequencies_.frequency_list (v.value<FrequencyList_v2::FrequencyItems> ());
|
frequencies_.frequency_list (v.value<FrequencyList_v2_101::FrequencyItems> ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1565,7 +1580,34 @@ void Configuration::impl::read_settings ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frequencies_.reset_to_defaults ();
|
LOG_INFO(QString{"read_settings looking for FrequenciesForRegionModes"});
|
||||||
|
if (settings_->contains ("FrequenciesForRegionModes")) // has the old ones.
|
||||||
|
{
|
||||||
|
LOG_INFO(QString{"found FrequenciesForRegionModes"});
|
||||||
|
auto const& v = settings_->value("FrequenciesForRegionModes");
|
||||||
|
LOG_INFO(QString{"v is %1"}.arg(v.typeName()));
|
||||||
|
if (v.isValid())
|
||||||
|
{
|
||||||
|
LOG_INFO(QString{"read_settings found VALID FrequenciesForRegionModes"});
|
||||||
|
FrequencyList_v2_101::FrequencyItems list;
|
||||||
|
FrequencyList_v2::FrequencyItems v100 = v.value<FrequencyList_v2::FrequencyItems>();
|
||||||
|
LOG_INFO(QString{"read_settings read %1 old_format items from FrequenciesForRegionModes"}.arg(v100.size()));
|
||||||
|
|
||||||
|
Q_FOREACH (auto const& item, v100)
|
||||||
|
{
|
||||||
|
list << FrequencyList_v2_101::Item{item.frequency_, item.mode_, item.region_, QString(), QString(), QDateTime(),
|
||||||
|
QDateTime(), false};
|
||||||
|
}
|
||||||
|
LOG_INFO(QString{"converted %1 items to FrequenciesForRegionModes_v2"}.arg(list.size()));
|
||||||
|
|
||||||
|
frequencies_.frequency_list(list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_INFO(QString{"read_settings INVALID FrequenciesForRegionModes"});
|
||||||
|
frequencies_.reset_to_defaults();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stations_.station_list (settings_->value ("stations").value<StationList::Stations> ());
|
stations_.station_list (settings_->value ("stations").value<StationList::Stations> ());
|
||||||
@ -1707,8 +1749,8 @@ void Configuration::impl::write_settings ()
|
|||||||
settings_->setValue ("After73", id_after_73_);
|
settings_->setValue ("After73", id_after_73_);
|
||||||
settings_->setValue ("TxQSYAllowed", tx_QSY_allowed_);
|
settings_->setValue ("TxQSYAllowed", tx_QSY_allowed_);
|
||||||
settings_->setValue ("Macros", macros_.stringList ());
|
settings_->setValue ("Macros", macros_.stringList ());
|
||||||
settings_->setValue ("FrequenciesForRegionModes", QVariant::fromValue (frequencies_.frequency_list ()));
|
|
||||||
settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ()));
|
settings_->setValue ("stations", QVariant::fromValue (stations_.station_list ()));
|
||||||
|
settings_->setValue ("FrequenciesForRegionModes_v2", QVariant::fromValue (frequencies_.frequency_list ()));
|
||||||
settings_->setValue ("DecodeHighlighting", QVariant::fromValue (decode_highlighing_model_.items ()));
|
settings_->setValue ("DecodeHighlighting", QVariant::fromValue (decode_highlighing_model_.items ()));
|
||||||
settings_->setValue ("HighlightByMode", highlight_by_mode_);
|
settings_->setValue ("HighlightByMode", highlight_by_mode_);
|
||||||
settings_->setValue ("OnlyFieldsSought", highlight_only_fields_);
|
settings_->setValue ("OnlyFieldsSought", highlight_only_fields_);
|
||||||
@ -2235,7 +2277,7 @@ void Configuration::impl::accept ()
|
|||||||
if (frequencies_.frequency_list () != next_frequencies_.frequency_list ())
|
if (frequencies_.frequency_list () != next_frequencies_.frequency_list ())
|
||||||
{
|
{
|
||||||
frequencies_.frequency_list (next_frequencies_.frequency_list ());
|
frequencies_.frequency_list (next_frequencies_.frequency_list ());
|
||||||
frequencies_.sort (FrequencyList_v2::frequency_column);
|
frequencies_.sort (FrequencyList_v2_101::frequency_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stations_.station_list () != next_stations_.station_list ())
|
if (stations_.station_list () != next_stations_.station_list ())
|
||||||
@ -2567,7 +2609,7 @@ void Configuration::impl::delete_frequencies ()
|
|||||||
auto selection_model = ui_->frequencies_table_view->selectionModel ();
|
auto selection_model = ui_->frequencies_table_view->selectionModel ();
|
||||||
selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
selection_model->select (selection_model->selection (), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||||
next_frequencies_.removeDisjointRows (selection_model->selectedRows ());
|
next_frequencies_.removeDisjointRows (selection_model->selectedRows ());
|
||||||
ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2::mode_column);
|
ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2_101::mode_column);
|
||||||
size_frequency_table_columns ();
|
size_frequency_table_columns ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2601,20 +2643,20 @@ void Configuration::impl::merge_frequencies ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FrequencyList_v2::FrequencyItems Configuration::impl::read_frequencies_file (QString const& file_name)
|
FrequencyList_v2_101::FrequencyItems Configuration::impl::read_frequencies_file (QString const& file_name)
|
||||||
{
|
{
|
||||||
QFile frequencies_file {file_name};
|
QFile frequencies_file {file_name};
|
||||||
frequencies_file.open (QFile::ReadOnly);
|
frequencies_file.open (QFile::ReadOnly);
|
||||||
QDataStream ids {&frequencies_file};
|
QDataStream ids {&frequencies_file};
|
||||||
FrequencyList_v2::FrequencyItems list;
|
FrequencyList_v2_101::FrequencyItems list;
|
||||||
FrequencyList_v2_100::FrequencyItems list_v100;
|
FrequencyList_v2::FrequencyItems list_v100;
|
||||||
|
|
||||||
// read file as json if ends with qrg.json.
|
// read file as json if ends with qrg.json.
|
||||||
if (file_name.endsWith(".qrg.json", Qt::CaseInsensitive))
|
if (file_name.endsWith(".qrg.json", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
list = FrequencyList_v2::from_json_file(&frequencies_file);
|
list = FrequencyList_v2_101::from_json_file(&frequencies_file);
|
||||||
}
|
}
|
||||||
catch (ReadFileException const &e)
|
catch (ReadFileException const &e)
|
||||||
{
|
{
|
||||||
@ -2647,7 +2689,7 @@ FrequencyList_v2::FrequencyItems Configuration::impl::read_frequencies_file (QSt
|
|||||||
ids >> list_v100;
|
ids >> list_v100;
|
||||||
Q_FOREACH (auto const& item, list_v100)
|
Q_FOREACH (auto const& item, list_v100)
|
||||||
{
|
{
|
||||||
list << FrequencyList_v2::Item{item.frequency_, item.mode_, item.region_, QString(), QString(), QDateTime(),
|
list << FrequencyList_v2_101::Item{item.frequency_, item.mode_, item.region_, QString(), QString(), QDateTime(),
|
||||||
QDateTime(), false};
|
QDateTime(), false};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2729,7 +2771,7 @@ void Configuration::impl::insert_frequency ()
|
|||||||
if (QDialog::Accepted == frequency_dialog_->exec ())
|
if (QDialog::Accepted == frequency_dialog_->exec ())
|
||||||
{
|
{
|
||||||
ui_->frequencies_table_view->setCurrentIndex (next_frequencies_.add (frequency_dialog_->item ()));
|
ui_->frequencies_table_view->setCurrentIndex (next_frequencies_.add (frequency_dialog_->item ()));
|
||||||
ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2::mode_column);
|
ui_->frequencies_table_view->resizeColumnToContents (FrequencyList_v2_101::mode_column);
|
||||||
size_frequency_table_columns();
|
size_frequency_table_columns();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class QAudioDeviceInfo;
|
|||||||
class QDir;
|
class QDir;
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class Bands;
|
class Bands;
|
||||||
class FrequencyList_v2;
|
class FrequencyList_v2_101;
|
||||||
class StationList;
|
class StationList;
|
||||||
class QStringListModel;
|
class QStringListModel;
|
||||||
class LotWUsers;
|
class LotWUsers;
|
||||||
@ -164,8 +164,8 @@ public:
|
|||||||
Bands * bands ();
|
Bands * bands ();
|
||||||
Bands const * bands () const;
|
Bands const * bands () const;
|
||||||
IARURegions::Region region () const;
|
IARURegions::Region region () const;
|
||||||
FrequencyList_v2 * frequencies ();
|
FrequencyList_v2_101 * frequencies ();
|
||||||
FrequencyList_v2 const * frequencies () const;
|
FrequencyList_v2_101 const * frequencies () const;
|
||||||
StationList * stations ();
|
StationList * stations ();
|
||||||
StationList const * stations () const;
|
StationList const * stations () const;
|
||||||
QStringListModel * macros ();
|
QStringListModel * macros ();
|
||||||
|
@ -52,9 +52,13 @@ void register_types ()
|
|||||||
|
|
||||||
item_editor_factory->registerEditor (qMetaTypeId<QDateTime> (), new QStandardItemEditorCreator<DateTimeEdit> ());
|
item_editor_factory->registerEditor (qMetaTypeId<QDateTime> (), new QStandardItemEditorCreator<DateTimeEdit> ());
|
||||||
|
|
||||||
// Frequency list model
|
// V101 Frequency list model
|
||||||
|
qRegisterMetaTypeStreamOperators<FrequencyList_v2_101::Item> ("Item_v2_101");
|
||||||
|
QMetaType::registerConverter<FrequencyList_v2_101::Item, QString> (&FrequencyList_v2_101::Item::toString);
|
||||||
|
qRegisterMetaTypeStreamOperators<FrequencyList_v2_101::FrequencyItems> ("FrequencyItems_v2_101");
|
||||||
|
|
||||||
|
// V100 Frequency list model
|
||||||
qRegisterMetaTypeStreamOperators<FrequencyList_v2::Item> ("Item_v2");
|
qRegisterMetaTypeStreamOperators<FrequencyList_v2::Item> ("Item_v2");
|
||||||
QMetaType::registerConverter<FrequencyList_v2::Item, QString> (&FrequencyList_v2::Item::toString);
|
|
||||||
qRegisterMetaTypeStreamOperators<FrequencyList_v2::FrequencyItems> ("FrequencyItems_v2");
|
qRegisterMetaTypeStreamOperators<FrequencyList_v2::FrequencyItems> ("FrequencyItems_v2");
|
||||||
|
|
||||||
// defunct old versions
|
// defunct old versions
|
||||||
|
@ -41,7 +41,7 @@ class QWidget;
|
|||||||
// storage using the provided QSettings object instance.
|
// storage using the provided QSettings object instance.
|
||||||
//
|
//
|
||||||
// A passed in Configuration object instance is used to query the
|
// A passed in Configuration object instance is used to query the
|
||||||
// FrequencyList_v2 model to determine working frequencies for each
|
// FrequencyList_v2_101 model to determine working frequencies for each
|
||||||
// band. The row index of this model is returned by this classes
|
// band. The row index of this model is returned by this classes
|
||||||
// hopping scheduling method so it may be conveniently used to select
|
// hopping scheduling method so it may be conveniently used to select
|
||||||
// a new working frequency by a client.
|
// a new working frequency by a client.
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
FrequencyList_v2::FrequencyItems const default_frequency_list =
|
FrequencyList_v2_101::FrequencyItems const default_frequency_list =
|
||||||
{
|
{
|
||||||
{198000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // BBC Radio 4 Droitwich
|
{198000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // BBC Radio 4 Droitwich
|
||||||
{4996000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // RWM time signal
|
{4996000, Modes::FreqCal, IARURegions::R1, "","", QDateTime(), QDateTime(), false}, // RWM time signal
|
||||||
@ -356,19 +356,19 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined (QT_NO_DEBUG_STREAM)
|
#if !defined (QT_NO_DEBUG_STREAM)
|
||||||
QDebug operator << (QDebug debug, FrequencyList_v2::Item const& item)
|
QDebug operator << (QDebug debug, FrequencyList_v2_101::Item const& item)
|
||||||
{
|
{
|
||||||
QDebugStateSaver saver {debug};
|
QDebugStateSaver saver {debug};
|
||||||
return debug.nospace () << item.toString ();
|
return debug.nospace () << item.toString ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
bool FrequencyList_v2::Item::isSane() const
|
bool FrequencyList_v2_101::Item::isSane() const
|
||||||
{
|
{
|
||||||
return frequency_ > 0.0 && (!start_time_.isValid() || !end_time_.isValid() || start_time_ < end_time_)
|
return frequency_ > 0.0 && (!start_time_.isValid() || !end_time_.isValid() || start_time_ < end_time_)
|
||||||
&& (region_ == IARURegions::ALL || region_ == IARURegions::R1 || region_ == IARURegions::R2 || region_ == IARURegions::R3);
|
&& (region_ == IARURegions::ALL || region_ == IARURegions::R1 || region_ == IARURegions::R2 || region_ == IARURegions::R3);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FrequencyList_v2::Item::toString () const
|
QString FrequencyList_v2_101::Item::toString () const
|
||||||
{
|
{
|
||||||
QString string;
|
QString string;
|
||||||
QTextStream qts {&string};
|
QTextStream qts {&string};
|
||||||
@ -384,7 +384,7 @@ QString FrequencyList_v2::Item::toString () const
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject FrequencyList_v2::Item::toJson() const {
|
QJsonObject FrequencyList_v2_101::Item::toJson() const {
|
||||||
return {{"frequency", Radio::frequency_MHz_string (frequency_) },
|
return {{"frequency", Radio::frequency_MHz_string (frequency_) },
|
||||||
{"mode", Modes::name (mode_) },
|
{"mode", Modes::name (mode_) },
|
||||||
{"region", IARURegions::name (region_)},
|
{"region", IARURegions::name (region_)},
|
||||||
@ -395,7 +395,7 @@ QJsonObject FrequencyList_v2::Item::toJson() const {
|
|||||||
{"preferred", preferred_}};
|
{"preferred", preferred_}};
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item)
|
QDataStream& operator << (QDataStream& os, FrequencyList_v2_101::Item const& item)
|
||||||
{
|
{
|
||||||
return os << item.frequency_
|
return os << item.frequency_
|
||||||
<< item.mode_
|
<< item.mode_
|
||||||
@ -407,7 +407,7 @@ QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item)
|
|||||||
<< item.preferred_;
|
<< item.preferred_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item)
|
QDataStream& operator >> (QDataStream& is, FrequencyList_v2_101::Item& item)
|
||||||
{
|
{
|
||||||
return is >> item.frequency_
|
return is >> item.frequency_
|
||||||
>> item.mode_
|
>> item.mode_
|
||||||
@ -419,7 +419,7 @@ QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item)
|
|||||||
>> item.preferred_;
|
>> item.preferred_;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FrequencyList_v2::impl final
|
class FrequencyList_v2_101::impl final
|
||||||
: public QAbstractTableModel
|
: public QAbstractTableModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -461,7 +461,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FrequencyList_v2::FrequencyList_v2 (Bands const * bands, QObject * parent)
|
FrequencyList_v2_101::FrequencyList_v2_101 (Bands const * bands, QObject * parent)
|
||||||
: QSortFilterProxyModel {parent}
|
: QSortFilterProxyModel {parent}
|
||||||
, m_ {bands, parent}
|
, m_ {bands, parent}
|
||||||
{
|
{
|
||||||
@ -469,21 +469,21 @@ FrequencyList_v2::FrequencyList_v2 (Bands const * bands, QObject * parent)
|
|||||||
setSortRole (SortRole);
|
setSortRole (SortRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrequencyList_v2::~FrequencyList_v2 ()
|
FrequencyList_v2_101::~FrequencyList_v2_101 ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
auto FrequencyList_v2_101::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
||||||
{
|
{
|
||||||
return m_->frequency_list (frequency_list);
|
return m_->frequency_list (frequency_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::frequency_list () const -> FrequencyItems const&
|
auto FrequencyList_v2_101::frequency_list () const -> FrequencyItems const&
|
||||||
{
|
{
|
||||||
return m_->frequency_list_;
|
return m_->frequency_list_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems
|
auto FrequencyList_v2_101::frequency_list (QModelIndexList const& model_index_list) const -> FrequencyItems
|
||||||
{
|
{
|
||||||
FrequencyItems list;
|
FrequencyItems list;
|
||||||
Q_FOREACH (auto const& index, model_index_list)
|
Q_FOREACH (auto const& index, model_index_list)
|
||||||
@ -493,13 +493,13 @@ auto FrequencyList_v2::frequency_list (QModelIndexList const& model_index_list)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::frequency_list_merge (FrequencyItems const& items)
|
void FrequencyList_v2_101::frequency_list_merge (FrequencyItems const& items)
|
||||||
{
|
{
|
||||||
m_->add (items);
|
m_->add (items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FrequencyList_v2::best_working_frequency (Frequency f) const
|
int FrequencyList_v2_101::best_working_frequency (Frequency f) const
|
||||||
{
|
{
|
||||||
int result {-1};
|
int result {-1};
|
||||||
auto const& target_band = m_->bands_->find (f);
|
auto const& target_band = m_->bands_->find (f);
|
||||||
@ -532,7 +532,7 @@ int FrequencyList_v2::best_working_frequency (Frequency f) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FrequencyList_v2::best_working_frequency (QString const& target_band) const
|
int FrequencyList_v2_101::best_working_frequency (QString const& target_band) const
|
||||||
{
|
{
|
||||||
int result {-1};
|
int result {-1};
|
||||||
if (!target_band.isEmpty ())
|
if (!target_band.isEmpty ())
|
||||||
@ -553,17 +553,17 @@ int FrequencyList_v2::best_working_frequency (QString const& target_band) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::reset_to_defaults ()
|
void FrequencyList_v2_101::reset_to_defaults ()
|
||||||
{
|
{
|
||||||
m_->frequency_list (default_frequency_list);
|
m_->frequency_list (default_frequency_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex FrequencyList_v2::add (Item f)
|
QModelIndex FrequencyList_v2_101::add (Item f)
|
||||||
{
|
{
|
||||||
return mapFromSource (m_->add (f));
|
return mapFromSource (m_->add (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::remove (Item f)
|
bool FrequencyList_v2_101::remove (Item f)
|
||||||
{
|
{
|
||||||
auto row = m_->frequency_list_.indexOf (f);
|
auto row = m_->frequency_list_.indexOf (f);
|
||||||
|
|
||||||
@ -575,7 +575,7 @@ bool FrequencyList_v2::remove (Item f)
|
|||||||
return m_->removeRow (row);
|
return m_->removeRow (row);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows)
|
bool FrequencyList_v2_101::removeDisjointRows (QModelIndexList rows)
|
||||||
{
|
{
|
||||||
bool result {true};
|
bool result {true};
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ bool FrequencyList_v2::removeDisjointRows (QModelIndexList rows)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::filter (Region region, Mode mode, bool filter_on_time)
|
void FrequencyList_v2_101::filter (Region region, Mode mode, bool filter_on_time)
|
||||||
{
|
{
|
||||||
m_->region_filter_ = region;
|
m_->region_filter_ = region;
|
||||||
m_->mode_filter_ = mode;
|
m_->mode_filter_ = mode;
|
||||||
@ -610,12 +610,12 @@ void FrequencyList_v2::filter (Region region, Mode mode, bool filter_on_time)
|
|||||||
invalidateFilter ();
|
invalidateFilter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::filter_refresh ()
|
void FrequencyList_v2_101::filter_refresh ()
|
||||||
{
|
{
|
||||||
invalidateFilter ();
|
invalidateFilter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const
|
bool FrequencyList_v2_101::filterAcceptsRow (int source_row, QModelIndex const& /* parent */) const
|
||||||
{
|
{
|
||||||
bool result {true};
|
bool result {true};
|
||||||
auto const& item = m_->frequency_list_[source_row];
|
auto const& item = m_->frequency_list_[source_row];
|
||||||
@ -638,7 +638,7 @@ bool FrequencyList_v2::filterAcceptsRow (int source_row, QModelIndex const& /* p
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto FrequencyList_v2::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
auto FrequencyList_v2_101::impl::frequency_list (FrequencyItems frequency_list) -> FrequencyItems
|
||||||
{
|
{
|
||||||
beginResetModel ();
|
beginResetModel ();
|
||||||
std::swap (frequency_list_, frequency_list);
|
std::swap (frequency_list_, frequency_list);
|
||||||
@ -647,7 +647,7 @@ auto FrequencyList_v2::impl::frequency_list (FrequencyItems frequency_list) -> F
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add a frequency returning the new model index
|
// add a frequency returning the new model index
|
||||||
QModelIndex FrequencyList_v2::impl::add (Item f)
|
QModelIndex FrequencyList_v2_101::impl::add (Item f)
|
||||||
{
|
{
|
||||||
// Any Frequency that isn't in the list may be added
|
// Any Frequency that isn't in the list may be added
|
||||||
if (!frequency_list_.contains (f))
|
if (!frequency_list_.contains (f))
|
||||||
@ -666,7 +666,7 @@ QModelIndex FrequencyList_v2::impl::add (Item f)
|
|||||||
return QModelIndex {};
|
return QModelIndex {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::impl::add (FrequencyItems items)
|
void FrequencyList_v2_101::impl::add (FrequencyItems items)
|
||||||
{
|
{
|
||||||
// Any Frequency that isn't in the list may be added
|
// Any Frequency that isn't in the list may be added
|
||||||
for (auto p = items.begin (); p != items.end ();)
|
for (auto p = items.begin (); p != items.end ();)
|
||||||
@ -691,17 +691,17 @@ void FrequencyList_v2::impl::add (FrequencyItems items)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FrequencyList_v2::impl::rowCount (QModelIndex const& parent) const
|
int FrequencyList_v2_101::impl::rowCount (QModelIndex const& parent) const
|
||||||
{
|
{
|
||||||
return parent.isValid () ? 0 : frequency_list_.size ();
|
return parent.isValid () ? 0 : frequency_list_.size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FrequencyList_v2::impl::columnCount (QModelIndex const& parent) const
|
int FrequencyList_v2_101::impl::columnCount (QModelIndex const& parent) const
|
||||||
{
|
{
|
||||||
return parent.isValid () ? 0 : num_cols;
|
return parent.isValid () ? 0 : num_cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags FrequencyList_v2::impl::flags (QModelIndex const& index) const
|
Qt::ItemFlags FrequencyList_v2_101::impl::flags (QModelIndex const& index) const
|
||||||
{
|
{
|
||||||
auto result = QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled;
|
auto result = QAbstractTableModel::flags (index) | Qt::ItemIsDropEnabled;
|
||||||
auto row = index.row ();
|
auto row = index.row ();
|
||||||
@ -723,7 +723,7 @@ Qt::ItemFlags FrequencyList_v2::impl::flags (QModelIndex const& index) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const
|
QVariant FrequencyList_v2_101::impl::data (QModelIndex const& index, int role) const
|
||||||
{
|
{
|
||||||
QVariant item;
|
QVariant item;
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const
|
|||||||
{
|
{
|
||||||
auto const& band = bands_->find (frequency_item.frequency_);
|
auto const& band = bands_->find (frequency_item.frequency_);
|
||||||
QString desc_text;
|
QString desc_text;
|
||||||
desc_text = frequency_item.description_.isEmpty() ? "" : " \u2016 " + frequency_item.description_;
|
desc_text = frequency_item.description_.isEmpty() ? "" : " \u2502 " + frequency_item.description_;
|
||||||
item = (frequency_item.preferred_ ? "\u2055 " : "") +
|
item = (frequency_item.preferred_ ? "\u2055 " : "") +
|
||||||
Radio::pretty_frequency_MHz_string(frequency_item.frequency_)
|
Radio::pretty_frequency_MHz_string(frequency_item.frequency_)
|
||||||
+ " MHz (" + (band.isEmpty() ? "OOB" : band) + ")" +
|
+ " MHz (" + (band.isEmpty() ? "OOB" : band) + ")" +
|
||||||
@ -981,7 +981,7 @@ QVariant FrequencyList_v2::impl::data (QModelIndex const& index, int role) const
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrequencyList_v2::impl::unprefer_all_but(Item &item, int const item_row, QVector<int> roles)
|
void FrequencyList_v2_101::impl::unprefer_all_but(Item &item, int const item_row, QVector<int> roles)
|
||||||
{
|
{
|
||||||
// un-prefer all of the other frequencies in this band
|
// un-prefer all of the other frequencies in this band
|
||||||
auto const band = bands_->find (item.frequency_);
|
auto const band = bands_->find (item.frequency_);
|
||||||
@ -1005,7 +1005,7 @@ void FrequencyList_v2::impl::unprefer_all_but(Item &item, int const item_row, QV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::impl::setData (QModelIndex const& model_index, QVariant const& value, int role)
|
bool FrequencyList_v2_101::impl::setData (QModelIndex const& model_index, QVariant const& value, int role)
|
||||||
{
|
{
|
||||||
bool changed {false};
|
bool changed {false};
|
||||||
auto const& row = model_index.row ();
|
auto const& row = model_index.row ();
|
||||||
@ -1159,7 +1159,7 @@ bool FrequencyList_v2::impl::setData (QModelIndex const& model_index, QVariant c
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orientation, int role) const
|
QVariant FrequencyList_v2_101::impl::headerData (int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
QVariant header;
|
QVariant header;
|
||||||
if (Qt::DisplayRole == role
|
if (Qt::DisplayRole == role
|
||||||
@ -1186,7 +1186,7 @@ QVariant FrequencyList_v2::impl::headerData (int section, Qt::Orientation orient
|
|||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::impl::removeRows (int row, int count, QModelIndex const& parent)
|
bool FrequencyList_v2_101::impl::removeRows (int row, int count, QModelIndex const& parent)
|
||||||
{
|
{
|
||||||
if (0 < count && (row + count) <= rowCount (parent))
|
if (0 < count && (row + count) <= rowCount (parent))
|
||||||
{
|
{
|
||||||
@ -1201,7 +1201,7 @@ bool FrequencyList_v2::impl::removeRows (int row, int count, QModelIndex const&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::impl::insertRows (int row, int count, QModelIndex const& parent)
|
bool FrequencyList_v2_101::impl::insertRows (int row, int count, QModelIndex const& parent)
|
||||||
{
|
{
|
||||||
if (0 < count)
|
if (0 < count)
|
||||||
{
|
{
|
||||||
@ -1216,14 +1216,14 @@ bool FrequencyList_v2::impl::insertRows (int row, int count, QModelIndex const&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FrequencyList_v2::impl::mimeTypes () const
|
QStringList FrequencyList_v2_101::impl::mimeTypes () const
|
||||||
{
|
{
|
||||||
QStringList types;
|
QStringList types;
|
||||||
types << mime_type;
|
types << mime_type;
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData * FrequencyList_v2::impl::mimeData (QModelIndexList const& items) const
|
QMimeData * FrequencyList_v2_101::impl::mimeData (QModelIndexList const& items) const
|
||||||
{
|
{
|
||||||
QMimeData * mime_data = new QMimeData {};
|
QMimeData * mime_data = new QMimeData {};
|
||||||
QByteArray encoded_data;
|
QByteArray encoded_data;
|
||||||
@ -1241,43 +1241,43 @@ QMimeData * FrequencyList_v2::impl::mimeData (QModelIndexList const& items) cons
|
|||||||
return mime_data;
|
return mime_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::const_iterator::operator * () const -> Item const&
|
auto FrequencyList_v2_101::const_iterator::operator * () const -> Item const&
|
||||||
{
|
{
|
||||||
return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
return parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::const_iterator::operator -> () const -> Item const *
|
auto FrequencyList_v2_101::const_iterator::operator -> () const -> Item const *
|
||||||
{
|
{
|
||||||
return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
return &parent_->frequency_list ().at(parent_->mapToSource (parent_->index (row_, 0)).row ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::const_iterator::operator != (const_iterator const& rhs) const
|
bool FrequencyList_v2_101::const_iterator::operator != (const_iterator const& rhs) const
|
||||||
{
|
{
|
||||||
return parent_ != rhs.parent_ || row_ != rhs.row_;
|
return parent_ != rhs.parent_ || row_ != rhs.row_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrequencyList_v2::const_iterator::operator == (const_iterator const& rhs) const
|
bool FrequencyList_v2_101::const_iterator::operator == (const_iterator const& rhs) const
|
||||||
{
|
{
|
||||||
return parent_ == rhs.parent_ && row_ == rhs.row_;
|
return parent_ == rhs.parent_ && row_ == rhs.row_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::const_iterator::operator ++ () -> const_iterator&
|
auto FrequencyList_v2_101::const_iterator::operator ++ () -> const_iterator&
|
||||||
{
|
{
|
||||||
++row_;
|
++row_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::begin () const -> const_iterator
|
auto FrequencyList_v2_101::begin () const -> const_iterator
|
||||||
{
|
{
|
||||||
return const_iterator (this, 0);
|
return const_iterator (this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::end () const -> const_iterator
|
auto FrequencyList_v2_101::end () const -> const_iterator
|
||||||
{
|
{
|
||||||
return const_iterator (this, rowCount ());
|
return const_iterator (this, rowCount ());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::find (Frequency f) const -> const_iterator
|
auto FrequencyList_v2_101::find (Frequency f) const -> const_iterator
|
||||||
{
|
{
|
||||||
int row {0};
|
int row {0};
|
||||||
for (; row < rowCount (); ++row)
|
for (; row < rowCount (); ++row)
|
||||||
@ -1290,7 +1290,7 @@ auto FrequencyList_v2::find (Frequency f) const -> const_iterator
|
|||||||
return const_iterator (this, row);
|
return const_iterator (this, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::filtered_bands () const -> BandSet
|
auto FrequencyList_v2_101::filtered_bands () const -> BandSet
|
||||||
{
|
{
|
||||||
BandSet result;
|
BandSet result;
|
||||||
for (auto const& item : *this)
|
for (auto const& item : *this)
|
||||||
@ -1300,7 +1300,7 @@ auto FrequencyList_v2::filtered_bands () const -> BandSet
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FrequencyList_v2::all_bands (Region region, Mode mode) const -> BandSet
|
auto FrequencyList_v2_101::all_bands (Region region, Mode mode) const -> BandSet
|
||||||
{
|
{
|
||||||
BandSet result;
|
BandSet result;
|
||||||
for (auto const& item : m_->frequency_list_)
|
for (auto const& item : m_->frequency_list_)
|
||||||
@ -1317,9 +1317,9 @@ auto FrequencyList_v2::all_bands (Region region, Mode mode) const -> BandSet
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrequencyList_v2::FrequencyItems FrequencyList_v2::from_json_file(QFile *input_file)
|
FrequencyList_v2_101::FrequencyItems FrequencyList_v2_101::from_json_file(QFile *input_file)
|
||||||
{
|
{
|
||||||
FrequencyList_v2::FrequencyItems list;
|
FrequencyList_v2_101::FrequencyItems list;
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(input_file->readAll());
|
QJsonDocument doc = QJsonDocument::fromJson(input_file->readAll());
|
||||||
if (doc.isNull())
|
if (doc.isNull())
|
||||||
{
|
{
|
||||||
@ -1341,7 +1341,7 @@ FrequencyList_v2::FrequencyItems FrequencyList_v2::from_json_file(QFile *input_f
|
|||||||
{
|
{
|
||||||
QString mode_s, region_s;
|
QString mode_s, region_s;
|
||||||
QJsonObject obj = item.toObject();
|
QJsonObject obj = item.toObject();
|
||||||
FrequencyList_v2::Item freq;
|
FrequencyList_v2_101::Item freq;
|
||||||
region_s = obj["region"].toString();
|
region_s = obj["region"].toString();
|
||||||
mode_s = obj["mode"].toString();
|
mode_s = obj["mode"].toString();
|
||||||
|
|
||||||
@ -1369,7 +1369,7 @@ FrequencyList_v2::FrequencyItems FrequencyList_v2::from_json_file(QFile *input_f
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
// write JSON format to a file
|
// write JSON format to a file
|
||||||
void FrequencyList_v2::to_json_file(QFile *output_file, QString magic_s, QString version_s,
|
void FrequencyList_v2_101::to_json_file(QFile *output_file, QString magic_s, QString version_s,
|
||||||
FrequencyItems const &frequency_items)
|
FrequencyItems const &frequency_items)
|
||||||
{
|
{
|
||||||
QJsonObject jobject{
|
QJsonObject jobject{
|
||||||
@ -1390,13 +1390,20 @@ void FrequencyList_v2::to_json_file(QFile *output_file, QString magic_s, QString
|
|||||||
}
|
}
|
||||||
|
|
||||||
// previous version 100 of the FrequencyList_v2 class
|
// previous version 100 of the FrequencyList_v2 class
|
||||||
QDataStream& operator >> (QDataStream& is, FrequencyList_v2_100::Item& item)
|
QDataStream& operator >> (QDataStream& is, FrequencyList_v2::Item& item)
|
||||||
{
|
{
|
||||||
return is >> item.frequency_
|
return is >> item.frequency_
|
||||||
>> item.mode_
|
>> item.mode_
|
||||||
>> item.region_;
|
>> item.region_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item)
|
||||||
|
{
|
||||||
|
return os << item.frequency_
|
||||||
|
<< item.mode_
|
||||||
|
<< item.region_;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Obsolete version of FrequencyList no longer used but needed to
|
// Obsolete version of FrequencyList no longer used but needed to
|
||||||
// allow loading and saving of old settings contents without damage
|
// allow loading and saving of old settings contents without damage
|
||||||
|
@ -42,7 +42,7 @@ class Bands;
|
|||||||
// Implements the QSortFilterProxyModel interface for a list of spot
|
// Implements the QSortFilterProxyModel interface for a list of spot
|
||||||
// frequencies.
|
// frequencies.
|
||||||
//
|
//
|
||||||
class FrequencyList_v2 final
|
class FrequencyList_v2_101 final
|
||||||
: public QSortFilterProxyModel
|
: public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
class const_iterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const_iterator (FrequencyList_v2 const * parent, int row)
|
const_iterator (FrequencyList_v2_101 const * parent, int row)
|
||||||
: parent_ {parent}
|
: parent_ {parent}
|
||||||
, row_ {row}
|
, row_ {row}
|
||||||
{
|
{
|
||||||
@ -89,13 +89,13 @@ public:
|
|||||||
const_iterator& operator ++ ();
|
const_iterator& operator ++ ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FrequencyList_v2 const * parent_;
|
FrequencyList_v2_101 const * parent_;
|
||||||
int row_;
|
int row_;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit FrequencyList_v2 (Bands const *, QObject * parent = nullptr);
|
explicit FrequencyList_v2_101 (Bands const *, QObject * parent = nullptr);
|
||||||
|
|
||||||
~FrequencyList_v2 ();
|
~FrequencyList_v2_101 ();
|
||||||
|
|
||||||
// Load and store underlying items
|
// Load and store underlying items
|
||||||
FrequencyItems frequency_list (FrequencyItems);
|
FrequencyItems frequency_list (FrequencyItems);
|
||||||
@ -157,7 +157,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool operator == (FrequencyList_v2::Item const& lhs, FrequencyList_v2::Item const& rhs)
|
bool operator == (FrequencyList_v2_101::Item const& lhs, FrequencyList_v2_101::Item const& rhs)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
lhs.frequency_ == rhs.frequency_
|
lhs.frequency_ == rhs.frequency_
|
||||||
@ -170,18 +170,19 @@ bool operator == (FrequencyList_v2::Item const& lhs, FrequencyList_v2::Item cons
|
|||||||
&& lhs.preferred_ == rhs.preferred_;
|
&& lhs.preferred_ == rhs.preferred_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator << (QDataStream&, FrequencyList_v2::Item const&);
|
QDataStream& operator << (QDataStream&, FrequencyList_v2_101::Item const&);
|
||||||
QDataStream& operator >> (QDataStream&, FrequencyList_v2::Item&);
|
QDataStream& operator >> (QDataStream&, FrequencyList_v2_101::Item&);
|
||||||
|
|
||||||
#if !defined (QT_NO_DEBUG_STREAM)
|
#if !defined (QT_NO_DEBUG_STREAM)
|
||||||
QDebug operator << (QDebug, FrequencyList_v2::Item const&);
|
QDebug operator << (QDebug, FrequencyList_v2_101::Item const&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_DECLARE_METATYPE (FrequencyList_v2::Item);
|
Q_DECLARE_METATYPE (FrequencyList_v2_101::Item);
|
||||||
Q_DECLARE_METATYPE (FrequencyList_v2::FrequencyItems);
|
Q_DECLARE_METATYPE (FrequencyList_v2_101::FrequencyItems);
|
||||||
|
|
||||||
class FrequencyList_v2_100 final
|
class FrequencyList_v2 final
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Frequency = Radio::Frequency;
|
using Frequency = Radio::Frequency;
|
||||||
using Mode = Modes::Mode;
|
using Mode = Modes::Mode;
|
||||||
@ -200,11 +201,11 @@ private:
|
|||||||
FrequencyItems frequency_list_;
|
FrequencyItems frequency_list_;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDataStream& operator << (QDataStream&, FrequencyList_v2_100::Item const&);
|
QDataStream& operator << (QDataStream&, FrequencyList_v2::Item const&);
|
||||||
QDataStream& operator >> (QDataStream&, FrequencyList_v2_100::Item&);
|
QDataStream& operator >> (QDataStream&, FrequencyList_v2::Item&);
|
||||||
|
|
||||||
Q_DECLARE_METATYPE (FrequencyList_v2_100::Item);
|
Q_DECLARE_METATYPE (FrequencyList_v2::Item);
|
||||||
Q_DECLARE_METATYPE (FrequencyList_v2_100::FrequencyItems);
|
Q_DECLARE_METATYPE (FrequencyList_v2::FrequencyItems);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Obsolete version of FrequencyList no longer used but needed to
|
// Obsolete version of FrequencyList no longer used but needed to
|
||||||
|
@ -527,7 +527,7 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act
|
|||||||
QDataStream stream {&encoded_data, QIODevice::ReadOnly};
|
QDataStream stream {&encoded_data, QIODevice::ReadOnly};
|
||||||
while (!stream.atEnd ())
|
while (!stream.atEnd ())
|
||||||
{
|
{
|
||||||
FrequencyList_v2::Item item;
|
FrequencyList_v2_101::Item item;
|
||||||
stream >> item;
|
stream >> item;
|
||||||
auto const& band = bands_->find (item.frequency_);
|
auto const& band = bands_->find (item.frequency_);
|
||||||
if (stations_.cend () == std::find_if (stations_.cbegin ()
|
if (stations_.cend () == std::find_if (stations_.cbegin ()
|
||||||
|
@ -1477,7 +1477,7 @@ Error: %2 - %3</translation>
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FrequencyList_v2</name>
|
<name>FrequencyList_v2_100</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../models/FrequencyList.cpp" line="680"/>
|
<location filename="../models/FrequencyList.cpp" line="680"/>
|
||||||
<location filename="../models/FrequencyList.cpp" line="836"/>
|
<location filename="../models/FrequencyList.cpp" line="836"/>
|
||||||
|
@ -1630,7 +1630,7 @@ Error: %2 - %3</translation>
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FrequencyList_v2</name>
|
<name>FrequencyList_v2_100</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../models/FrequencyList.cpp" line="680"/>
|
<location filename="../models/FrequencyList.cpp" line="680"/>
|
||||||
<location filename="../models/FrequencyList.cpp" line="836"/>
|
<location filename="../models/FrequencyList.cpp" line="836"/>
|
||||||
|
@ -1475,7 +1475,7 @@ Error: %2 - %3</source>
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FrequencyList_v2</name>
|
<name>FrequencyList_v2_100</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../models/FrequencyList.cpp" line="680"/>
|
<location filename="../models/FrequencyList.cpp" line="680"/>
|
||||||
<location filename="../models/FrequencyList.cpp" line="836"/>
|
<location filename="../models/FrequencyList.cpp" line="836"/>
|
||||||
|
@ -1475,7 +1475,7 @@ Error: %2 - %3</source>
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FrequencyList_v2</name>
|
<name>FrequencyList_v2_100</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../models/FrequencyList.cpp" line="680"/>
|
<location filename="../models/FrequencyList.cpp" line="680"/>
|
||||||
<location filename="../models/FrequencyList.cpp" line="836"/>
|
<location filename="../models/FrequencyList.cpp" line="836"/>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
LiveFrequencyValidator::LiveFrequencyValidator (QComboBox * combo_box
|
LiveFrequencyValidator::LiveFrequencyValidator (QComboBox * combo_box
|
||||||
, Bands const * bands
|
, Bands const * bands
|
||||||
, FrequencyList_v2 const * frequencies
|
, FrequencyList_v2_101 const * frequencies
|
||||||
, Frequency const * nominal_frequency
|
, Frequency const * nominal_frequency
|
||||||
, QWidget * parent)
|
, QWidget * parent)
|
||||||
: QRegExpValidator {
|
: QRegExpValidator {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "Radio.hpp"
|
#include "Radio.hpp"
|
||||||
|
|
||||||
class Bands;
|
class Bands;
|
||||||
class FrequencyList_v2;
|
class FrequencyList_v2_101;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
LiveFrequencyValidator (QComboBox * combo_box // associated combo box
|
LiveFrequencyValidator (QComboBox * combo_box // associated combo box
|
||||||
, Bands const * bands // bands model
|
, Bands const * bands // bands model
|
||||||
, FrequencyList_v2 const * frequencies // working frequencies model
|
, FrequencyList_v2_101 const * frequencies // working frequencies model
|
||||||
, Frequency const * nominal_frequency
|
, Frequency const * nominal_frequency
|
||||||
, QWidget * parent = nullptr);
|
, QWidget * parent = nullptr);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Bands const * bands_;
|
Bands const * bands_;
|
||||||
FrequencyList_v2 const * frequencies_;
|
FrequencyList_v2_101 const * frequencies_;
|
||||||
Frequency const * nominal_frequency_;
|
Frequency const * nominal_frequency_;
|
||||||
QComboBox * combo_box_;
|
QComboBox * combo_box_;
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ BandComboBox::BandComboBox (QWidget * parent)
|
|||||||
// item text.
|
// item text.
|
||||||
void BandComboBox::showPopup ()
|
void BandComboBox::showPopup ()
|
||||||
{
|
{
|
||||||
auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2::frequency_mhz_column);
|
auto minimum_width = view ()->sizeHintForColumn (FrequencyList_v2_101::frequency_mhz_column);
|
||||||
if (count () > maxVisibleItems ())
|
if (count () > maxVisibleItems ())
|
||||||
{
|
{
|
||||||
// for some as yet unknown reason, in FT8 mode the scrollbar
|
// for some as yet unknown reason, in FT8 mode the scrollbar
|
||||||
|
@ -783,7 +783,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
|
|
||||||
// Hook up working frequencies.
|
// Hook up working frequencies.
|
||||||
ui->bandComboBox->setModel (m_config.frequencies ());
|
ui->bandComboBox->setModel (m_config.frequencies ());
|
||||||
ui->bandComboBox->setModelColumn (FrequencyList_v2::frequency_mhz_column);
|
ui->bandComboBox->setModelColumn (FrequencyList_v2_101::frequency_mhz_column);
|
||||||
|
|
||||||
// Enable live band combo box entry validation and action.
|
// Enable live band combo box entry validation and action.
|
||||||
auto band_validator = new LiveFrequencyValidator {ui->bandComboBox
|
auto band_validator = new LiveFrequencyValidator {ui->bandComboBox
|
||||||
@ -7414,7 +7414,7 @@ void MainWindow::on_actionOpen_log_directory_triggered ()
|
|||||||
void MainWindow::on_bandComboBox_currentIndexChanged (int index)
|
void MainWindow::on_bandComboBox_currentIndexChanged (int index)
|
||||||
{
|
{
|
||||||
auto const& frequencies = m_config.frequencies ();
|
auto const& frequencies = m_config.frequencies ();
|
||||||
auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2::frequency_column));
|
auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column));
|
||||||
Frequency frequency {m_freqNominal};
|
Frequency frequency {m_freqNominal};
|
||||||
if (source_index.isValid ())
|
if (source_index.isValid ())
|
||||||
{
|
{
|
||||||
@ -7442,7 +7442,7 @@ void MainWindow::on_bandComboBox_editTextChanged (QString const& text)
|
|||||||
void MainWindow::on_bandComboBox_activated (int index)
|
void MainWindow::on_bandComboBox_activated (int index)
|
||||||
{
|
{
|
||||||
auto const& frequencies = m_config.frequencies ();
|
auto const& frequencies = m_config.frequencies ();
|
||||||
auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2::frequency_column));
|
auto const& source_index = frequencies->mapToSource (frequencies->index (index, FrequencyList_v2_101::frequency_column));
|
||||||
Frequency frequency {m_freqNominal};
|
Frequency frequency {m_freqNominal};
|
||||||
if (source_index.isValid ())
|
if (source_index.isValid ())
|
||||||
{
|
{
|
||||||
|
@ -477,7 +477,7 @@ private:
|
|||||||
qint32 m_k0;
|
qint32 m_k0;
|
||||||
qint32 m_kdone;
|
qint32 m_kdone;
|
||||||
qint32 m_nPick;
|
qint32 m_nPick;
|
||||||
FrequencyList_v2::const_iterator m_frequency_list_fcal_iter;
|
FrequencyList_v2_101::const_iterator m_frequency_list_fcal_iter;
|
||||||
qint32 m_nTx73;
|
qint32 m_nTx73;
|
||||||
qint32 m_UTCdisk;
|
qint32 m_UTCdisk;
|
||||||
qint32 m_wait;
|
qint32 m_wait;
|
||||||
|
Loading…
Reference in New Issue
Block a user