Merge branch 'develop' of bitbucket.org:k1jt/wsjtx into develop

This commit is contained in:
Joe Taylor 2019-12-11 16:34:34 -05:00
commit 7d8cdd200c
13 changed files with 92 additions and 30 deletions

View File

@ -282,6 +282,7 @@ set (wsjt_qt_CXXSRCS
item_delegates/MaidenheadLocatorDelegate.cpp
item_delegates/FrequencyDelegate.cpp
item_delegates/FrequencyDeltaDelegate.cpp
item_delegates/SQLiteDateTimeDelegate.cpp
models/CabrilloLog.cpp
logbook/AD1CCty.cpp
logbook/WorkedBefore.cpp

View File

@ -0,0 +1,40 @@
#include "SQLiteDateTimeDelegate.hpp"
#include <QDateTimeEdit>
#include <QDateTime>
#include <QLocale>
SQLiteDateTimeDelegate::SQLiteDateTimeDelegate (QObject * parent)
: QStyledItemDelegate {parent}
{
}
QWidget * SQLiteDateTimeDelegate::createEditor (QWidget * parent, QStyleOptionViewItem const&
, QModelIndex const&) const
{
auto * editor = new QDateTimeEdit {parent};
editor->setCalendarPopup (true);
editor->setDisplayFormat (QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
editor->setFrame (false);
return editor;
}
void SQLiteDateTimeDelegate::setEditorData (QWidget * editor, QModelIndex const& index) const
{
auto const& value = index.model ()->data (index, Qt::EditRole);
if (value.isValid () && !value.isNull ())
{
static_cast<QDateTimeEdit *> (editor)->setDateTime (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC));
}
}
void SQLiteDateTimeDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const
{
QVariant data;
auto const& value = static_cast<QDateTimeEdit *> (editor)->dateTime ();
if (value.isValid () && !value.isNull ())
{
data = value.toMSecsSinceEpoch () / 1000ull;
}
model->setData (index, data, Qt::EditRole);
}

View File

@ -0,0 +1,23 @@
#ifndef SQLITE_DATE_TIME_DELEGATE_HPP_
#define SQLITE_DATE_TIME_DELEGATE_HPP_
#include <QStyledItemDelegate>
//
// Class SQLiteDateTimeDelegte
//
// Item delegate for editing a date and time stored as milliseconds
// since the Unix epoch and displayed or edited as a QDateTime
// showing UTC
//
class SQLiteDateTimeDelegate final
: public QStyledItemDelegate
{
public:
explicit SQLiteDateTimeDelegate (QObject * parent = nullptr);
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const&, QModelIndex const&) const override;
void setEditorData (QWidget * editor, QModelIndex const&) const override;
void setModelData (QWidget * editor, QAbstractItemModel *, QModelIndex const&) const override;
};
#endif

View File

@ -519,6 +519,8 @@ subroutine unpack77(c77,nrx,msg,unpk77_success)
' R'//crpt//' '//cfield
if(itu.eq.1 .and. ir.eq.1) msg='TU; '//trim(call_1)//' '//trim(call_2)// &
' R'//crpt//' '//cfield
else if(i3.ge.6) then ! i3 values 6 and 7 are not yet defined
unpk77_success=.false.
endif
! if(msg(1:4).eq.'CQ <') unpk77_success=.false.

View File

@ -61,6 +61,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
my_ft8%decoded = 0
my_ft4%decoded = 0
ncontest=iand(params%nexp_decode,7)
single_decode=iand(params%nexp_decode,32).ne.0
bVHF=iand(params%nexp_decode,64).ne.0
if(mod(params%nranera,2).eq.0) ntrials=10**(params%nranera/2)
@ -102,7 +103,6 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
call timer('decft8 ',0)
newdat=params%newdat
ncontest=iand(params%nexp_decode,7)
call my_ft8%decode(ft8_decoded,id2,params%nQSOProgress,params%nfqso, &
params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%ndepth,ncontest,logical(params%nagain), &

View File

@ -16,7 +16,7 @@ subroutine subtractft4(dd,itone,f0,dt)
integer itone(103)
logical first
data first/.true./
common/heap8/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX),xjunk(NFRAME)
common/heap4/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX),xjunk(NFRAME)
save first
nstart=dt*12000+1-NSPS

View File

@ -28,6 +28,7 @@ contains
use timer_module, only: timer
use packjt77
include 'ft4/ft4_params.f90'
parameter (MAXCAND=100)
class(ft4_decoder), intent(inout) :: this
procedure(ft4_decode_callback) :: callback
parameter (NSS=NSPS/NDOWN,NDMAX=NMAX/NDOWN)
@ -49,7 +50,7 @@ contains
real bitmetrics(2*NN,3)
real dd(NMAX)
real llr(2*ND),llra(2*ND),llrb(2*ND),llrc(2*ND),llrd(2*ND)
real candidate(2,100)
real candidate(2,MAXCAND)
real savg(NH1),sbase(NH1)
integer apbits(2*ND)
@ -185,7 +186,6 @@ contains
mycall0=mycall
hiscall0=hiscall
endif
maxcand=100
ndecodes=0
decodes=' '
fa=nfa
@ -222,7 +222,7 @@ contains
candidate=0.0
ncand=0
call timer('getcand4',0)
call getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
call getcandidates4(dd,fa,fb,syncmin,nfqso,MAXCAND,savg,candidate, &
ncand,sbase)
call timer('getcand4',1)
dobigfft=.true.
@ -429,7 +429,8 @@ contains
message77=mod(message77+rvec,2) ! remove rvec scrambling
write(c77,'(77i1)') message77(1:77)
call unpack77(c77,1,message,unpk77_success)
if(unpk77_success.and.dosubtract) then
if(.not.unpk77_success) exit
if(dosubtract) then
call get_ft4_tones_from_77bits(message77,i4tone)
dt=real(ibest)/666.67
call timer('subtract',0)

View File

@ -50,20 +50,17 @@ public:
else
{
value = QSqlTableModel::data (model_index, role);
if (model_index.column () == fieldIndex ("frequency") && Qt::DisplayRole == role)
if (Qt::DisplayRole == role)
{
value = Radio::frequency_MHz_string (value.value<Radio::Frequency> (), 3); // kHz precision
}
else if (model_index.column () == fieldIndex ("when")
&& (Qt::DisplayRole == role || Qt::EditRole == role))
{ // adjust date/time to Qt format
auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC);
if (Qt::DisplayRole == role)
if (model_index.column () == fieldIndex ("frequency"))
{
QLocale locale;
return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
value = Radio::frequency_MHz_string (value.value<Radio::Frequency> (), 3); // kHz precision
}
else if (model_index.column () == fieldIndex ("when"))
{ // adjust date/time to Qt format
QLocale locale;
value = locale.toString (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
}
value = t;
}
}
return value;

View File

@ -26,16 +26,10 @@ public:
QVariant data (QModelIndex const& index, int role) const
{
auto value = QSqlTableModel::data (index, role);
if (index.column () == fieldIndex ("when")
&& (Qt::DisplayRole == role || Qt::EditRole == role))
if (index.column () == fieldIndex ("when") && Qt::DisplayRole == role)
{
auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC);
if (Qt::DisplayRole == role)
{
QLocale locale;
return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
}
value = t;
QLocale locale;
value = locale.toString (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
}
return value;
}

View File

@ -9,6 +9,7 @@
#include "item_delegates/FrequencyDelegate.hpp"
#include "item_delegates/ForeignKeyDelegate.hpp"
#include "item_delegates/CallsignDelegate.hpp"
#include "item_delegates/SQLiteDateTimeDelegate.hpp"
#include "pimpl_impl.hpp"
#include "ui_CabrilloLogWindow.h"
@ -66,6 +67,7 @@ CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const
m_->ui_.log_table_view->setModel (&m_->format_model_);
set_log_view (m_->ui_.log_table_view);
m_->ui_.log_table_view->setItemDelegateForColumn (1, new FrequencyDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (3, new SQLiteDateTimeDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (4, new CallsignDelegate {this});
auto h_header = m_->ui_.log_table_view->horizontalHeader ();
h_header->moveSection (7, 1); // band to first column

View File

@ -15,6 +15,7 @@
#include "item_delegates/ForeignKeyDelegate.hpp"
#include "item_delegates/CallsignDelegate.hpp"
#include "item_delegates/MaidenheadLocatorDelegate.hpp"
#include "item_delegates/SQLiteDateTimeDelegate.hpp"
#include "pimpl_impl.hpp"
#include "ui_FoxLogWindow.h"
@ -41,6 +42,7 @@ FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configur
m_->ui_.setupUi (this);
m_->ui_.log_table_view->setModel (m_->log_->model ());
set_log_view (m_->ui_.log_table_view);
m_->ui_.log_table_view->setItemDelegateForColumn (1, new SQLiteDateTimeDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (2, new CallsignDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (3, new MaidenheadLocatorDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this});

View File

@ -940,7 +940,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_bDisplayedOnce=false;
m_wait=0;
m_isort=-3;
m_max_dB=30;
m_max_dB=70;
m_CQtype="CQ";
if(m_mode.startsWith ("WSPR") and m_pctx>0) {
@ -1072,7 +1072,7 @@ void MainWindow::writeSettings()
m_settings->setValue("HoundSort",ui->comboBoxHoundSort->currentIndex());
m_settings->setValue("FoxNlist",ui->sbNlist->value());
m_settings->setValue("FoxNslots",ui->sbNslots->value());
m_settings->setValue("FoxMaxDB",ui->sbMax_dB->value());
m_settings->setValue("FoxMaxDB_v2",ui->sbMax_dB->value()); // original key abandoned
m_settings->setValue ("SerialNumber",ui->sbSerialNumber->value ());
m_settings->endGroup();
@ -1152,7 +1152,7 @@ void MainWindow::readSettings()
ui->sbNlist->setValue(m_settings->value("FoxNlist",12).toInt());
m_Nslots=m_settings->value("FoxNslots",5).toInt();
ui->sbNslots->setValue(m_Nslots);
ui->sbMax_dB->setValue(m_settings->value("FoxMaxDB",30).toInt());
ui->sbMax_dB->setValue(m_settings->value("FoxMaxDB_v2",70).toInt());
ui->sbSerialNumber->setValue (m_settings->value ("SerialNumber", 1).toInt ());
m_settings->endGroup();

View File

@ -2213,7 +2213,7 @@ list. The list can be maintained in Settings (F2).</string>
<number>-15</number>
</property>
<property name="maximum">
<number>30</number>
<number>70</number>
</property>
<property name="value">
<number>30</number>