mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 12:23:37 -05:00
94cec5bdc1
Working frequencies can be for all regions or for individual IARU regions. This allows each mode band tuple to have one or more working frequencies which can include local ones only offered when the user configures their IARU region. Change working frequency default suggestions to better fit in FT8. General rule is FT8 is at JT65 -2kHz except where that is not possible e.g. where that would fall into a segment not allocated for narrow band data modes. For tight bands like top band sqeeze existing JT65 and JT allocations to allow space for FT8. NOTE: this change changes the WSPR frequency on 80m to allow access to JA stations that currently have no allocation where it was placed. ALSO NOTE: the JT65 and JT9 frequencies for 80m move down 6 kHz, again to accommodate region 3 users. Other appliactions not within our control should be asked to move in step when 1.8.0 is released. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7810 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
100 lines
2.2 KiB
C++
100 lines
2.2 KiB
C++
#include "IARURegions.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
#include <QString>
|
|
#include <QVariant>
|
|
#include <QModelIndex>
|
|
|
|
#include "moc_IARURegions.cpp"
|
|
|
|
namespace
|
|
{
|
|
// human readable strings for each Region enumeration value
|
|
char const * const region_names[] =
|
|
{
|
|
"All",
|
|
"Region 1",
|
|
"Region 2",
|
|
"Region 3",
|
|
};
|
|
std::size_t constexpr region_names_size = sizeof (region_names) / sizeof (region_names[0]);
|
|
}
|
|
|
|
IARURegions::IARURegions (QObject * parent)
|
|
: QAbstractListModel {parent}
|
|
{
|
|
static_assert (region_names_size == REGIONS_END_SENTINAL_AND_COUNT,
|
|
"region_names array must match Region enumeration");
|
|
}
|
|
|
|
char const * IARURegions::name (Region r)
|
|
{
|
|
return region_names[static_cast<int> (r)];
|
|
}
|
|
|
|
auto IARURegions::value (QString const& s) -> Region
|
|
{
|
|
auto end = region_names + region_names_size;
|
|
auto p = std::find_if (region_names, end
|
|
, [&s] (char const * const name) {
|
|
return name == s;
|
|
});
|
|
return p != end ? static_cast<Region> (p - region_names) : ALL;
|
|
}
|
|
|
|
QVariant IARURegions::data (QModelIndex const& index, int role) const
|
|
{
|
|
QVariant item;
|
|
|
|
if (index.isValid ())
|
|
{
|
|
auto const& row = index.row ();
|
|
switch (role)
|
|
{
|
|
case Qt::ToolTipRole:
|
|
case Qt::AccessibleDescriptionRole:
|
|
item = tr ("IARU Region");
|
|
break;
|
|
|
|
case Qt::EditRole:
|
|
item = static_cast<Region> (row);
|
|
break;
|
|
|
|
case Qt::DisplayRole:
|
|
case Qt::AccessibleTextRole:
|
|
item = region_names[row];
|
|
break;
|
|
|
|
case Qt::TextAlignmentRole:
|
|
item = Qt::AlignHCenter + Qt::AlignVCenter;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return item;
|
|
}
|
|
|
|
QVariant IARURegions::headerData (int section, Qt::Orientation orientation, int role) const
|
|
{
|
|
QVariant result;
|
|
|
|
if (Qt::DisplayRole == role && Qt::Horizontal == orientation)
|
|
{
|
|
result = tr ("IARU Region");
|
|
}
|
|
else
|
|
{
|
|
result = QAbstractListModel::headerData (section, orientation, role);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
#if !defined (QT_NO_DEBUG_STREAM)
|
|
ENUM_QDEBUG_OPS_IMPL (IARURegions, Region);
|
|
#endif
|
|
|
|
ENUM_QDATASTREAM_OPS_IMPL (IARURegions, Region);
|
|
ENUM_CONVERSION_OPS_IMPL (IARURegions, Region);
|