Fixes the issue with the IARU Region setting not being saved and restored correctly

Use proper QDataStream insertor  and extractor for IARURegions::Region
enum. Unfortunately  this requires that  all will have to  reset their
region one more time even if it was working and correct.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7867 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-07-13 18:02:07 +00:00
parent 4dc1db0ef3
commit c71b72c824
5 changed files with 12 additions and 4 deletions

View File

@ -1270,7 +1270,7 @@ void Configuration::impl::read_settings ()
macros_.setStringList (settings_->value ("Macros", QStringList {"TNX 73 GL"}).toStringList ()); macros_.setStringList (settings_->value ("Macros", QStringList {"TNX 73 GL"}).toStringList ());
region_ = settings_->value ("Region", IARURegions::ALL).value<IARURegions::Region> (); region_ = settings_->value ("Region", QVariant::fromValue (IARURegions::ALL)).value<IARURegions::Region> ();
if (settings_->contains ("FrequenciesForRegionModes")) if (settings_->contains ("FrequenciesForRegionModes"))
{ {
@ -1434,7 +1434,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("CalibrationSlopePPM", frequency_calibration_slope_ppm_); settings_->setValue ("CalibrationSlopePPM", frequency_calibration_slope_ppm_);
settings_->setValue ("pwrBandTxMemory", pwrBandTxMemory_); settings_->setValue ("pwrBandTxMemory", pwrBandTxMemory_);
settings_->setValue ("pwrBandTuneMemory", pwrBandTuneMemory_); settings_->setValue ("pwrBandTuneMemory", pwrBandTuneMemory_);
settings_->setValue ("Region", region_); settings_->setValue ("Region", QVariant::fromValue (region_));
} }
void Configuration::impl::set_rig_invariants () void Configuration::impl::set_rig_invariants ()

View File

@ -5,6 +5,7 @@
#include <QString> #include <QString>
#include <QVariant> #include <QVariant>
#include <QModelIndex> #include <QModelIndex>
#include <QMetaType>
#include "moc_IARURegions.cpp" #include "moc_IARURegions.cpp"

View File

@ -66,7 +66,7 @@ public:
// that can be streamed and queued as a signal argument as well as // that can be streamed and queued as a signal argument as well as
// showing the human readable string when output to debug streams. // showing the human readable string when output to debug streams.
#if QT_VERSION < 0x050500 #if QT_VERSION < 0x050500
// Qt 5.6 introduces the Q_ENUM macro which automatically registers // Qt 5.5 introduces the Q_ENUM macro which automatically registers
// the meta-type // the meta-type
Q_DECLARE_METATYPE (IARURegions::Region); Q_DECLARE_METATYPE (IARURegions::Region);
#endif #endif

View File

@ -12,6 +12,7 @@
#include "Transceiver.hpp" #include "Transceiver.hpp"
#include "TransceiverFactory.hpp" #include "TransceiverFactory.hpp"
#include "WFPalette.hpp" #include "WFPalette.hpp"
#include "IARURegions.hpp"
#include "FrequencyLineEdit.hpp" #include "FrequencyLineEdit.hpp"
@ -79,4 +80,10 @@ void register_types ()
// Waterfall palette // Waterfall palette
qRegisterMetaTypeStreamOperators<WFPalette::Colours> ("Colours"); qRegisterMetaTypeStreamOperators<WFPalette::Colours> ("Colours");
// IARURegions
#if QT_VERSION < 0x050500
qRegisterMetaType<IARURegions::Region> ("IARURegions::Region");
#endif
qRegisterMetaTypeStreamOperators<IARURegions::Region> ("IARURegions::Region");
} }

View File

@ -73,7 +73,7 @@ public:
// be streamed and queued as a signal argument as well as showing the // be streamed and queued as a signal argument as well as showing the
// human readable string when output to debug streams. // human readable string when output to debug streams.
#if QT_VERSION < 0x050500 #if QT_VERSION < 0x050500
// Qt 5.6 introduces the Q_ENUM macro which automatically registers // Qt 5.5 introduces the Q_ENUM macro which automatically registers
// the meta-type // the meta-type
Q_DECLARE_METATYPE (Modes::Mode); Q_DECLARE_METATYPE (Modes::Mode);
#endif #endif