summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2019-03-11 14:19:23 +0100
committerChristoph Berg <christoph.berg@credativ.de>2019-03-11 14:19:23 +0100
commit200de07a95209a55d6019ba87f0abc78d302bf4c (patch)
tree3b2922eb5d89b01ad214cae492e871c3bfb5df18 /widgets
parente0737c56c1e384e05064a0c6e1ac46979371041b (diff)
New upstream version 2.0.1+repackupstream/2.0.1+repack
Diffstat (limited to 'widgets')
-rw-r--r--widgets/FoxLogWindow.cpp45
-rw-r--r--widgets/FoxLogWindow.hpp4
-rw-r--r--widgets/about.cpp2
-rw-r--r--widgets/displaytext.cpp55
-rw-r--r--widgets/displaytext.h20
-rw-r--r--widgets/logqso.cpp64
-rw-r--r--widgets/logqso.h2
-rw-r--r--widgets/mainwindow.cpp248
-rw-r--r--widgets/mainwindow.h3
-rw-r--r--widgets/mainwindow.ui43
10 files changed, 313 insertions, 173 deletions
diff --git a/widgets/FoxLogWindow.cpp b/widgets/FoxLogWindow.cpp
index 4b8fbc25..36f20b85 100644
--- a/widgets/FoxLogWindow.cpp
+++ b/widgets/FoxLogWindow.cpp
@@ -1,15 +1,17 @@
#include "FoxLogWindow.hpp"
#include <QApplication>
-#include <QSqlTableModel>
#include <QAction>
#include <QFile>
#include <QDir>
+#include <QSqlTableModel>
+#include <QFileDialog>
#include "SettingsGroup.hpp"
#include "Configuration.hpp"
#include "MessageBox.hpp"
#include "models/Bands.hpp"
+#include "models/FoxLog.hpp"
#include "item_delegates/ForeignKeyDelegate.hpp"
#include "item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp"
#include "item_delegates/CallsignDelegate.hpp"
@@ -22,23 +24,23 @@
class FoxLogWindow::impl final
{
public:
- explicit impl (QSqlTableModel * log_model)
- : log_model_ {log_model}
+ explicit impl (FoxLog * log)
+ : log_ {log}
{
}
- QSqlTableModel * log_model_;
+ FoxLog * log_;
Ui::FoxLogWindow ui_;
};
FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configuration
- , QSqlTableModel * fox_log_model, QWidget * parent)
+ , FoxLog * fox_log, QWidget * parent)
: AbstractLogWindow {"Fox Log Window", settings, configuration, parent}
- , m_ {fox_log_model}
+ , m_ {fox_log}
{
setWindowTitle (QApplication::applicationName () + " - Fox Log");
m_->ui_.setupUi (this);
- m_->ui_.log_table_view->setModel (m_->log_model_);
+ 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 DateTimeAsSecsSinceEpochDelegate {this});
m_->ui_.log_table_view->setItemDelegateForColumn (2, new CallsignDelegate {this});
@@ -50,6 +52,31 @@ FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configur
m_->ui_.callers_label->setNum (0);
// actions
+ auto export_action = new QAction {tr ("&Export ADIF ..."), m_->ui_.log_table_view};
+ m_->ui_.log_table_view->insertAction (nullptr, export_action);
+ connect (export_action, &QAction::triggered, [this, configuration] (bool /*checked*/) {
+ auto file_name = QFileDialog::getSaveFileName (this
+ , tr ("Export ADIF Log File")
+ , configuration->writeable_data_dir ().absolutePath ()
+ , tr ("ADIF Log (*.adi)"));
+ if (file_name.size () && m_->log_)
+ {
+ QFile ADIF_file {file_name};
+ if (ADIF_file.open (QIODevice::WriteOnly | QIODevice::Text))
+ {
+ QTextStream output_stream {&ADIF_file};
+ m_->log_->export_qsos (output_stream);
+ }
+ else
+ {
+ MessageBox::warning_message (this
+ , tr ("Export ADIF File Error")
+ , tr ("Cannot open \"%1\" for writing: %2")
+ .arg (ADIF_file.fileName ()).arg (ADIF_file.errorString ()));
+ }
+ }
+ });
+
auto reset_action = new QAction {tr ("&Reset ..."), m_->ui_.log_table_view};
m_->ui_.log_table_view->insertAction (nullptr, reset_action);
connect (reset_action, &QAction::triggered, [this, configuration] (bool /*checked*/) {
@@ -88,10 +115,10 @@ void FoxLogWindow::log_model_changed (int row)
{
if (row >= 0)
{
- m_->log_model_->selectRow (row);
+ m_->log_->model ()->selectRow (row);
}
else
{
- m_->log_model_->select ();
+ m_->log_->model ()->select ();
}
}
diff --git a/widgets/FoxLogWindow.hpp b/widgets/FoxLogWindow.hpp
index 65bcb0bd..c9cc18a4 100644
--- a/widgets/FoxLogWindow.hpp
+++ b/widgets/FoxLogWindow.hpp
@@ -7,7 +7,7 @@
class QSettings;
class Configuration;
class QFont;
-class QSqlTableModel;
+class FoxLog;
class FoxLogWindow final
: public AbstractLogWindow
@@ -15,7 +15,7 @@ class FoxLogWindow final
Q_OBJECT
public:
- explicit FoxLogWindow (QSettings *, Configuration const *, QSqlTableModel * fox_log_model
+ explicit FoxLogWindow (QSettings *, Configuration const *, FoxLog * fox_log
, QWidget * parent = nullptr);
~FoxLogWindow ();
diff --git a/widgets/about.cpp b/widgets/about.cpp
index f0b51a77..7aec53c7 100644
--- a/widgets/about.cpp
+++ b/widgets/about.cpp
@@ -18,7 +18,7 @@ CAboutDlg::CAboutDlg(QWidget *parent) :
+ " " + revision ()}.simplified () + "</h2><br />"
"WSJT-X implements a number of digital modes designed for <br />"
"weak-signal Amateur Radio communication. <br /><br />"
- "&copy; 2001-2018 by Joe Taylor, K1JT, with grateful <br />"
+ "&copy; 2001-2019 by Joe Taylor, K1JT, with grateful <br />"
"acknowledgment for contributions from AC6SL, AE4JY, <br />"
"DJ0OT, G3WDG, G4KLA, G4WJS, IV3NWV, IW3RAB, K3WYC, K9AN, <br />"
"KA6MAL, KA9Q, KB1ZMX, KD6EKQ, KI7MT, KK1D, ND0B, PY2SDR, <br />"
diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp
index 73df8af6..ca3372f4 100644
--- a/widgets/displaytext.cpp
+++ b/widgets/displaytext.cpp
@@ -12,6 +12,8 @@
#include <QAction>
#include <QListIterator>
#include <QRegularExpression>
+#include <QScrollBar>
+#include <QDebug>
#include "Configuration.hpp"
#include "LotWUsers.hpp"
@@ -25,6 +27,8 @@ DisplayText::DisplayText(QWidget *parent)
: QTextEdit(parent)
, m_config {nullptr}
, erase_action_ {new QAction {tr ("&Erase"), this}}
+ , high_volume_ {false}
+ , modified_vertical_scrollbar_max_ {-1}
{
setReadOnly (true);
setUndoRedoEnabled (false);
@@ -68,14 +72,16 @@ void DisplayText::setContentFont(QFont const& font)
cursor.movePosition (QTextCursor::StartOfLine);
cursor.endEditBlock ();
- setTextCursor (cursor);
- ensureCursorVisible ();
+ if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
+ {
+ setTextCursor (cursor);
+ ensureCursorVisible ();
+ }
}
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
{
Q_EMIT selectCallsign(e->modifiers ());
- QTextEdit::mouseDoubleClickEvent(e);
}
void DisplayText::insertLineSpacer(QString const& line)
@@ -198,11 +204,44 @@ void DisplayText::appendText(QString const& text, QColor bg, QColor fg
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::StartOfLine);
- setTextCursor (cursor);
- ensureCursorVisible ();
+ if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
+ {
+ setTextCursor (cursor);
+ ensureCursorVisible ();
+ }
document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
}
+void DisplayText::extend_vertical_scrollbar (int min, int max)
+{
+ if (high_volume_
+ && m_config && m_config->decodes_from_top ())
+ {
+ if (max && max != modified_vertical_scrollbar_max_)
+ {
+ auto vp_margins = viewportMargins ();
+ // add enough to vertical scroll bar range to allow last
+ // decode to just scroll of the top of the view port
+ max += viewport ()->height () - vp_margins.top () - vp_margins.bottom ();
+ modified_vertical_scrollbar_max_ = max;
+ }
+ verticalScrollBar ()->setRange (min, max);
+ }
+}
+
+void DisplayText::new_period ()
+{
+ extend_vertical_scrollbar (verticalScrollBar ()->minimum (), verticalScrollBar ()->maximum ());
+ if (high_volume_ && m_config && m_config->decodes_from_top () && !vertical_scroll_connection_)
+ {
+ vertical_scroll_connection_ = connect (verticalScrollBar (), &QScrollBar::rangeChanged
+ , [this] (int min, int max) {
+ extend_vertical_scrollbar (min, max );
+ });
+ }
+ verticalScrollBar ()->setSliderPosition (verticalScrollBar ()->maximum ());
+}
+
QString DisplayText::appendWorkedB4 (QString message, QString call, QString const& grid,
QColor * bg, QColor * fg, LogBook const& logBook,
QString const& currentBand, QString const& currentMode)
@@ -400,7 +439,11 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
}
else
{
- highlight_types types {Highlight::CQ, Highlight::LotW};
+ highlight_types types {Highlight::CQ};
+ if (m_config && m_config->lotw_users ().user (decodedText.CQersCall()))
+ {
+ types.push_back (Highlight::LotW);
+ }
set_colours (m_config, &bg, &fg, types);
}
}
diff --git a/widgets/displaytext.h b/widgets/displaytext.h
index 1f20ac15..cd3426af 100644
--- a/widgets/displaytext.h
+++ b/widgets/displaytext.h
@@ -19,8 +19,13 @@ class DisplayText
{
Q_OBJECT
public:
- explicit DisplayText(QWidget *parent = 0);
- void set_configuration (Configuration const * configuration) {m_config = configuration;}
+ explicit DisplayText(QWidget *parent = nullptr);
+ void set_configuration (Configuration const * configuration, bool high_volume = false)
+ {
+ disconnect (vertical_scroll_connection_);
+ m_config = configuration;
+ high_volume_ = high_volume;
+ }
void setContentFont (QFont const&);
void insertLineSpacer(QString const&);
void displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode,
@@ -29,6 +34,7 @@ public:
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode);
void displayQSY(QString text);
void displayFoxToBeCalled(QString t, QColor bg = QColor {}, QColor fg = QColor {});
+ void new_period ();
Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers);
Q_SIGNAL void erased ();
@@ -38,10 +44,11 @@ public:
Q_SLOT void erase ();
Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_only);
-protected:
- void mouseDoubleClickEvent(QMouseEvent *e);
-
private:
+ void mouseDoubleClickEvent (QMouseEvent *) override;
+
+ void extend_vertical_scrollbar (int min, int max);
+
Configuration const * m_config;
bool m_bPrincipalPrefix;
QString appendWorkedB4(QString message, QString callsign
@@ -51,6 +58,9 @@ private:
QFont char_font_;
QAction * erase_action_;
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
+ bool high_volume_;
+ QMetaObject::Connection vertical_scroll_connection_;
+ int modified_vertical_scrollbar_max_;
};
extern QHash<QString,int> m_LoTW;
diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp
index da8d0081..acbb340b 100644
--- a/widgets/logqso.cpp
+++ b/widgets/logqso.cpp
@@ -61,13 +61,25 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
CabrilloLog * cabrillo_log)
{
if(!isHidden()) return;
- ui->call->setText(hisCall);
- ui->grid->setText(hisGrid);
- ui->name->setText("");
- ui->txPower->setText("");
- ui->comments->setText("");
- if (ui->cbTxPower->isChecked ()) ui->txPower->setText(m_txPower);
- if (ui->cbComments->isChecked ()) ui->comments->setText(m_comments);
+ ui->call->setText (hisCall);
+ ui->grid->setText (hisGrid);
+ ui->name->clear ();
+ if (ui->cbTxPower->isChecked ())
+ {
+ ui->txPower->setText (m_txPower);
+ }
+ else
+ {
+ ui->txPower->clear ();
+ }
+ if (ui->cbComments->isChecked ())
+ {
+ ui->comments->setText (m_comments);
+ }
+ else
+ {
+ ui->comments->clear ();
+ }
if (m_config->report_in_comments()) {
auto t=mode;
if(rptSent!="") t+=" Sent: " + rptSent;
@@ -112,20 +124,30 @@ void LogQSO::accept()
auto mode = ui->mode->text ();
auto rptSent = ui->sent->text ();
auto rptRcvd = ui->rcvd->text ();
- auto m_dateTimeOn = ui->start_date_time->dateTime ();
- auto m_dateTimeOff = ui->end_date_time->dateTime ();
+ auto dateTimeOn = ui->start_date_time->dateTime ();
+ auto dateTimeOff = ui->end_date_time->dateTime ();
auto band = ui->band->text ();
auto name = ui->name->text ();
- auto m_txPower = ui->txPower->text ();
- auto m_comments = ui->comments->text ();
+ m_txPower = ui->txPower->text ();
+ m_comments = ui->comments->text ();
auto strDialFreq = QString::number (m_dialFreq / 1.e6,'f',6);
auto operator_call = ui->loggedOperator->text ();
auto xsent = ui->exchSent->text ();
auto xrcvd = ui->exchRcvd->text ();
- // validate
using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config->special_op_id ();
+
+ if (special_op == SpOp::NA_VHF) {
+ if(xrcvd!="" and hisGrid!=xrcvd) hisGrid=xrcvd;
+ }
+
+ if ((special_op == SpOp::RTTY and xsent!="" and xrcvd!="")) {
+ if(rptSent=="" or !xsent.contains(rptSent+" ")) rptSent=xsent.split(" ",QString::SkipEmptyParts).at(0);
+ if(rptRcvd=="" or !xrcvd.contains(rptRcvd+" ")) rptRcvd=xrcvd.split(" ",QString::SkipEmptyParts).at(0);
+ }
+
+ // validate
if (SpOp::NONE < special_op && special_op < SpOp::FOX)
{
if (xsent.isEmpty () || xrcvd.isEmpty ())
@@ -136,7 +158,7 @@ void LogQSO::accept()
return; // without accepting
}
- if (!m_cabrilloLog->add_QSO (m_dialFreq, m_dateTimeOff, hisCall, xsent, xrcvd))
+ if (!m_cabrilloLog->add_QSO (m_dialFreq, dateTimeOff, hisCall, xsent, xrcvd))
{
show ();
MessageBox::warning_message (this, tr ("Invalid QSO Data"),
@@ -152,10 +174,10 @@ void LogQSO::accept()
tr ("Cannot open \"%1\" for append").arg (f.fileName ()),
tr ("Error: %1").arg (f.errorString ()));
} else {
- QString logEntry=m_dateTimeOn.date().toString("yyyy-MM-dd,") +
- m_dateTimeOn.time().toString("hh:mm:ss,") +
- m_dateTimeOff.date().toString("yyyy-MM-dd,") +
- m_dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," +
+ QString logEntry=dateTimeOn.date().toString("yyyy-MM-dd,") +
+ dateTimeOn.time().toString("hh:mm:ss,") +
+ dateTimeOff.date().toString("yyyy-MM-dd,") +
+ dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," +
hisGrid + "," + strDialFreq + "," + mode +
"," + rptSent + "," + rptRcvd + "," + m_txPower +
"," + m_comments + "," + name;
@@ -165,7 +187,7 @@ void LogQSO::accept()
}
//Clean up and finish logging
- Q_EMIT acceptQSO (m_dateTimeOff
+ Q_EMIT acceptQSO (dateTimeOff
, hisCall
, hisGrid
, m_dialFreq
@@ -175,7 +197,7 @@ void LogQSO::accept()
, m_txPower
, m_comments
, name
- , m_dateTimeOn
+ , dateTimeOn
, operator_call
, m_myCall
, m_myGrid
@@ -186,8 +208,8 @@ void LogQSO::accept()
, mode
, rptSent
, rptRcvd
- , m_dateTimeOn
- , m_dateTimeOff
+ , dateTimeOn
+ , dateTimeOff
, band
, m_comments
, name
diff --git a/widgets/logqso.h b/widgets/logqso.h
index 3363d2ea..82a75b7b 100644
--- a/widgets/logqso.h
+++ b/widgets/logqso.h
@@ -59,8 +59,6 @@ private:
Radio::Frequency m_dialFreq;
QString m_myCall;
QString m_myGrid;
- QDateTime m_dateTimeOn;
- QDateTime m_dateTimeOff;
CabrilloLog * m_cabrilloLog;
};
diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index 42dac2f5..02818ec5 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -32,6 +32,7 @@
#include <QCursor>
#include <QToolTip>
#include <QAction>
+#include <QButtonGroup>
#include <QActionGroup>
#include <QSplashScreen>
#include <QUdpSocket>
@@ -404,7 +405,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this});
ui->dxCallEntry->setValidator (new CallsignValidator {this});
ui->sbTR->values ({5, 10, 15, 30});
- ui->decodedTextBrowser->set_configuration (&m_config);
+ ui->decodedTextBrowser->set_configuration (&m_config, true);
ui->decodedTextBrowser2->set_configuration (&m_config);
m_baseCall = Radio::base_callsign (m_config.my_callsign ());
@@ -486,6 +487,17 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
});
// Network message handlers
+ connect (m_messageClient, &MessageClient::clear_decodes, [this] (quint8 window) {
+ ++window;
+ if (window & 1)
+ {
+ ui->decodedTextBrowser->erase ();
+ }
+ if (window & 2)
+ {
+ ui->decodedTextBrowser2->erase ();
+ }
+ });
connect (m_messageClient, &MessageClient::reply, this, &MainWindow::replyToCQ);
connect (m_messageClient, &MessageClient::replay, this, &MainWindow::replayDecodes);
connect (m_messageClient, &MessageClient::location, this, &MainWindow::locationChange);
@@ -772,8 +784,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
}
ui->labAz->setStyleSheet("border: 0px;");
-// ui->labDist->setStyleSheet("border: 0px;");
-
+ ui->labAz->setText("");
auto t = "UTC dB DT Freq Message";
ui->decodedTextLabel->setText(t);
ui->decodedTextLabel2->setText(t);
@@ -946,10 +957,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
splashTimer.setSingleShot (true);
splashTimer.start (20 * 1000);
- //if(QCoreApplication::applicationVersion().contains("-devel") or
- // QCoreApplication::applicationVersion().contains("-rc")) {
- QTimer::singleShot (0, this, SLOT (not_GA_warning_message ()));
- //}
+ //QTimer::singleShot (0, this, SLOT (not_GA_warning_message ()));
if(!ui->cbMenus->isChecked()) {
ui->cbMenus->setChecked(true);
@@ -961,8 +969,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
void MainWindow::not_GA_warning_message ()
{
-
-
MessageBox::critical_message (this,
"<b><p align=\"center\">"
"IMPORTANT: New protocols for the FT8 and MSK144 modes "
@@ -1236,7 +1242,18 @@ void MainWindow::set_application_font (QFont const& font)
qApp->setFont (font);
// set font in the application style sheet as well in case it has
// been modified in the style sheet which has priority
- qApp->setStyleSheet (qApp->styleSheet () + "* {" + font_as_stylesheet (font) + '}');
+ QString ss;
+ if (qApp->styleSheet ().size ())
+ {
+ auto sheet = qApp->styleSheet ();
+ sheet.remove ("file:///");
+ QFile sf {sheet};
+ if (sf.open (QFile::ReadOnly | QFile::Text))
+ {
+ ss = sf.readAll () + ss;
+ }
+ }
+ qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}');
for (auto& widget : qApp->topLevelWidgets ())
{
widget->updateGeometry ();
@@ -1596,7 +1613,8 @@ void MainWindow::fastSink(qint64 frames)
m_bDecoded=true;
auto_sequence (decodedtext, ui->sbFtol->value (), std::numeric_limits<unsigned>::max ());
if (m_mode != "ISCAT") postDecode (true, decodedtext.string ());
- writeAllTxt(message);
+// writeAllTxt(message);
+ write_all("Rx",message);
bool stdMsg = decodedtext.report(m_baseCall,
Radio::base_callsign(ui->dxCallEntry->text()),m_rptRcvd);
if (stdMsg) pskPost (decodedtext);
@@ -1852,6 +1870,7 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
}
int n;
+ bool bAltF1F5=m_config.alternate_bindings();
switch(e->key())
{
case Qt::Key_D:
@@ -1865,21 +1884,51 @@ void MainWindow::keyPressEvent (QKeyEvent * e)
}
break;
case Qt::Key_F1:
- on_actionOnline_User_Guide_triggered();
- return;
+ if(bAltF1F5) {
+ auto_tx_mode(true);
+ on_txb6_clicked();
+ return;
+ } else {
+ on_actionOnline_User_Guide_triggered();
+ return;
+ }
case Qt::Key_F2:
- on_actionSettings_triggered();
- return;
+ if(bAltF1F5) {
+ auto_tx_mode(true);
+ on_txb2_clicked();
+ return;
+ } else {
+ on_actionSettings_triggered();
+ return;
+ }
case Qt::Key_F3:
- on_actionKeyboard_shortcuts_triggered();
- return;
+ if(bAltF1F5) {
+ auto_tx_mode(true);
+ on_txb3_clicked();
+ return;
+ } else {
+ on_actionKeyboard_shortcuts_triggered();
+ return;
+ }
case Qt::Key_F4:
- clearDX ();
- ui->dxCallEntry->setFocus();
- return;
+ if(bAltF1F5) {
+ auto_tx_mode(true);
+ on_txb4_clicked();
+ return;
+ } else {
+ clearDX ();
+ ui->dxCallEntry->setFocus();
+ return;
+ }
case Qt::Key_F5:
- on_actionSpecial_mouse_commands_triggered();
- return;
+ if(bAltF1F5) {
+ auto_tx_mode(true);
+ on_txb5_clicked();
+ return;
+ } else {
+ on_actionSpecial_mouse_commands_triggered();
+ return;
+ }
case Qt::Key_F6:
if(e->modifiers() & Qt::ShiftModifier) {
on_actionDecode_remaining_files_in_directory_triggered();
@@ -2360,7 +2409,7 @@ void MainWindow::on_actionCopyright_Notice_triggered()
"\"The algorithms, source code, look-and-feel of WSJT-X and related "
"programs, and protocol specifications for the modes FSK441, FT8, JT4, "
"JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144 are Copyright (C) "
- "2001-2018 by one or more of the following authors: Joseph Taylor, "
+ "2001-2019 by one or more of the following authors: Joseph Taylor, "
"K1JT; Bill Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, "
"IV3NWV; Greg Beam, KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; "
"Philip Karn, KA9Q; and other members of the WSJT Development Group.\"");
@@ -2442,15 +2491,15 @@ void MainWindow::on_actionAstronomical_data_toggled (bool checked)
void MainWindow::on_fox_log_action_triggered()
{
- if (!m_foxLog) m_foxLog.reset (new FoxLog);
+ if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config});
if (!m_foxLogWindow)
{
- m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_foxLog->model ()});
+ m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_foxLog.data ()});
// Connect signals from fox log window
connect (this, &MainWindow::finished, m_foxLogWindow.data (), &FoxLogWindow::close);
connect (m_foxLogWindow.data (), &FoxLogWindow::reset_log_model, [this] () {
- if (!m_foxLog) m_foxLog.reset (new FoxLog);
+ if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config});
m_foxLog->reset ();
});
}
@@ -2530,17 +2579,16 @@ void MainWindow::read_wav_file (QString const& fname)
auto pos = fname.indexOf (".wav", 0, Qt::CaseInsensitive);
// global variables and threads do not mix well, this needs changing
dec_data.params.nutc = 0;
- if (pos > 0)
- {
- if (pos == fname.indexOf ('_', -11) + 7)
- {
- dec_data.params.nutc = fname.mid (pos - 6, 6).toInt ();
- }
- else
- {
- dec_data.params.nutc = 100 * fname.mid (pos - 4, 4).toInt ();
- }
+ if (pos > 0) {
+ if (pos == fname.indexOf ('_', -11) + 7) {
+ dec_data.params.nutc = fname.mid (pos - 6, 6).toInt ();
+ m_fileDateTime=fname.mid(pos-13,13);
+ } else {
+ dec_data.params.nutc = 100 * fname.mid (pos - 4, 4).toInt ();
+ m_fileDateTime=fname.mid(pos-11,11);
}
+ }
+
BWFFile file {QAudioFormat {}, fname};
bool ok=file.open (BWFFile::ReadOnly);
if(ok) {
@@ -2791,7 +2839,7 @@ void MainWindow::decode() //decode()
dec_data.params.ntol=20;
dec_data.params.naggressive=0;
}
- if(dec_data.params.nutc < m_nutc0) m_RxLog = 1; //Date and Time to ALL.TXT
+ if(dec_data.params.nutc < m_nutc0) m_RxLog = 1; //Date and Time to file "ALL.TXT".
if(dec_data.params.newdat==1 and !m_diskData) m_nutc0=dec_data.params.nutc;
dec_data.params.ntxmode=9;
if(m_modeTx=="JT65") dec_data.params.ntxmode=65;
@@ -2911,7 +2959,8 @@ void::MainWindow::fast_decode_done()
m_bDecoded=true;
}
postDecode (true, decodedtext.string ());
- writeAllTxt(message);
+// writeAllTxt(message);
+ write_all("Rx",message);
if(m_mode=="JT9" or m_mode=="MSK144") {
// find and extract any report for myCall
@@ -2929,27 +2978,6 @@ void::MainWindow::fast_decode_done()
m_bFastDone=false;
}
-void MainWindow::writeAllTxt(QString message)
-{
- // Write decoded text to file "ALL.TXT".
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- if(m_RxLog==1) {
- out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm")
- << " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
- << m_mode << endl;
- m_RxLog=0;
- }
- out << message << endl;
- f.close();
- } else {
- MessageBox::warning_message (this, tr ("File Open Error")
- , tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ()));
- }
-}
-
void MainWindow::decodeDone ()
{
dec_data.params.nagain=0;
@@ -3005,23 +3033,7 @@ void MainWindow::readFromStdout() //readFromStdout
if(navg>1 or line_read.indexOf("f*")>0) bAvgMsg=true;
}
}
-
- QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
- if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
- QTextStream out(&f);
- if(m_RxLog==1) {
- out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm")
- << " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
- << m_mode << endl;
- m_RxLog=0;
- }
- out << line_read.trimmed () << endl;
- f.close();
- } else {
- MessageBox::warning_message (this, tr ("File Open Error")
- , tr ("Cannot open \"%1\" for append: %2")
- .arg (f.fileName ()).arg (f.errorString ()));
- }
+ write_all("Rx",line_read.trimmed());
if (m_config.insert_blank () && m_blankLine && SpecOp::FOX != m_config.special_op_id()) {
QString band;
if((QDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*m_TRperiod/4) {
@@ -3162,8 +3174,8 @@ void MainWindow::readFromStdout() //readFromStdout
QString grid;
decodedtext.deCallAndGrid(/*out*/deCall,grid);
{
- QString t=Radio::base_callsign(ui->dxCallEntry->text());
- if((t==deCall or t=="") and rpt!="") m_rptRcvd=rpt;
+ auto t = Radio::base_callsign (ui->dxCallEntry->text ());
+ if ((t == deCall || ui->dxCallEntry->text () == deCall || !t.size ()) && rpt.size ()) m_rptRcvd = rpt;
}
// extract details and send to PSKreporter
int nsec=QDateTime::currentMSecsSinceEpoch()/1000-m_secBandChanged;
@@ -3309,7 +3321,7 @@ void MainWindow::on_EraseButton_clicked ()
void MainWindow::band_activity_cleared ()
{
- m_messageClient->clear_decodes ();
+ m_messageClient->decodes_cleared ();
QFile f(m_config.temp_dir ().absoluteFilePath ("decoded.txt"));
if(f.exists()) f.remove();
}
@@ -3322,7 +3334,14 @@ void MainWindow::rx_frequency_activity_cleared ()
void MainWindow::decodeBusy(bool b) //decodeBusy()
{
- if (!b) m_optimizingProgress.reset ();
+ if (!b) {
+ m_optimizingProgress.reset ();
+ } else {
+ if (!m_decoderBusy)
+ {
+ ui->decodedTextBrowser->new_period ();
+ }
+ }
m_decoderBusy=b;
ui->DecodeButton->setEnabled(!b);
ui->actionOpen->setEnabled(!b);
@@ -3671,7 +3690,7 @@ void MainWindow::guiUpdate()
m_currentMessageType = -1;
}
if(m_restart) {
- write_transmit_entry ("ALL.TXT");
+ write_all("Tx",m_currentMessage);
if (m_config.TX_messages ()) {
ui->decodedTextBrowser2->displayTransmittedText(m_currentMessage,m_modeTx,
ui->TxFreqSpinBox->value(),m_bFastMode);
@@ -3774,9 +3793,7 @@ void MainWindow::guiUpdate()
m_msgSent0 = current_message;
}
- if(!m_tune) {
- write_transmit_entry ("ALL.TXT");
- }
+ if(!m_tune) write_all("Tx",m_currentMessage);
if (m_config.TX_messages () && !m_tune && SpecOp::FOX!=m_config.special_op_id()) {
ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx,
@@ -3959,7 +3976,8 @@ void MainWindow::startTx2()
t=WSPR_hhmm(0) + ' ' + t.rightJustified (66, '-');
ui->decodedTextBrowser->appendText(t);
}
- write_transmit_entry ("ALL_WSPR.TXT");
+ write_all("Tx",m_currentMessage);
+// write_transmit_entry ("ALL_WSPR.TXT");
}
}
}
@@ -4002,6 +4020,7 @@ void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg()
int iz=ba.length();
for(int i=0; i<37; i++) {
if(i<iz) {
+ if(int(ba[i])>=97 and int(ba[i])<=122) ba[i]=int(ba[i])-32;
message[i]=ba[i];
} else {
message[i]=32;
@@ -4811,7 +4830,6 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
auto const& hisCall=ui->dxCallEntry->text();
if(!hisCall.size ()) {
ui->labAz->clear ();
-// ui->labDist->clear ();
ui->tx1->clear ();
ui->tx2->clear ();
ui->tx3->clear ();
@@ -4870,7 +4888,7 @@ void MainWindow::genStdMsgs(QString rpt, bool unconditional)
}
if(!bHisCall) {
t=t0a;
- msgtype(t0a, ui->tx1);
+ msgtype(t0a + my_grid, ui->tx1);
}
if(SpecOp::NA_VHF==m_config.special_op_id()) sent=my_grid;
if(SpecOp::FIELD_DAY==m_config.special_op_id()) sent=m_config.Field_Day_Exchange();
@@ -5033,6 +5051,7 @@ void MainWindow::TxAgain()
void MainWindow::clearDX ()
{
+ set_dateTimeQSO (-1);
if (m_QSOProgress != CALLING)
{
auto_tx_mode (false);
@@ -5263,8 +5282,11 @@ void MainWindow::on_tx6_editingFinished() //tx6 edited
QString t=ui->tx6->text().toUpper();
if(t.indexOf(" ")>0) {
QString t1=t.split(" ").at(1);
+ QRegExp AZ4("^[A-Z]{1,4}$");
+ QRegExp NN3("^[0-9]{1,3}$");
m_CQtype="CQ";
- if(t1.size()==2) m_CQtype="CQ " + t1;
+ if(t1.size()<=4 and t1.contains(AZ4)) m_CQtype="CQ " + t1;
+ if(t1.size()<=3 and t1.contains(NN3)) m_CQtype="CQ " + t1;
}
msgtype(t, ui->tx6);
}
@@ -6181,6 +6203,17 @@ void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
}
}
+void MainWindow::on_actionErase_WSPR_hashtable_triggered()
+{
+ int ret = MessageBox::query_message(this, tr ("Confirm Erase"),
+ tr ("Are you sure you want to erase the WSPR hashtable?"));
+ if(ret==MessageBox::Yes) {
+ QFile f {m_config.writeable_data_dir().absoluteFilePath("hashtable.txt")};
+ f.remove();
+ }
+}
+
+
void MainWindow::on_actionOpen_log_directory_triggered ()
{
QDesktopServices::openUrl (QUrl::fromLocalFile (m_config.writeable_data_dir ().absolutePath ()));
@@ -6626,6 +6659,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
|| !(ui->cbCQTx->isEnabled () && ui->cbCQTx->isVisible () && ui->cbCQTx->isChecked()))) {
m_lastDialFreq = m_freqNominal;
m_secBandChanged=QDateTime::currentMSecsSinceEpoch()/1000;
+ /*
if(s.frequency () < 30000000u && !m_mode.startsWith ("WSPR")) {
// Write freq changes to ALL.TXT only below 30 MHz.
QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
@@ -6641,6 +6675,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
.arg (f2.fileName ()).arg (f2.errorString ()));
}
}
+ */
if (m_config.spot_to_psk_reporter ()) {
pskSetLocal ();
@@ -8225,13 +8260,13 @@ list2Done:
m_hisGrid=m_foxQSO[hc1].grid;
m_rptSent=m_foxQSO[hc1].sent;
m_rptRcvd=m_foxQSO[hc1].rcvd;
- if (!m_foxLog) m_foxLog.reset (new FoxLog);
+ if (!m_foxLog) m_foxLog.reset (new FoxLog {&m_config});
if (!m_foxLogWindow) on_fox_log_action_triggered ();
if (m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, m_lastBand))
{
writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid)
.arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand));
- logQSOTimer.start(0);
+ on_logQSOButton_clicked ();
m_foxRateQueue.enqueue (now); //Add present time in seconds
//to Rate queue.
}
@@ -8440,3 +8475,36 @@ void MainWindow::foxTest()
}
}
}
+
+void MainWindow::write_all(QString txRx, QString message)
+{
+ QString line;
+ QString t;
+ QString msg=message.mid(6,-1);
+ msg=msg.mid(0,15) + msg.mid(18,-1);
+
+ t.sprintf("%5d",ui->TxFreqSpinBox->value());
+ if(txRx=="Tx") msg=" 0 0.0" + t + " " + message;
+ auto time = QDateTime::currentDateTimeUtc ();
+ time = time.addSecs (-(time.time ().second () % m_TRperiod));
+ t.sprintf("%10.3f ",m_freqNominal/1.e6);
+ if(m_diskData) {
+ line=m_fileDateTime + t + txRx + " " + m_mode.leftJustified(6,' ') + msg;
+ } else {
+ line=time.toString("yyMMdd_hhmmss") + t + txRx + " " + m_mode.leftJustified(6,' ') + msg;
+ }
+
+ QString file_name="ALL.TXT";
+ if(m_mode=="WSPR") file_name="ALL_WSPR.TXT";
+ QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)};
+ if(f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
+ QTextStream out(&f);
+ out << line << endl;
+ f.close();
+ } else {
+ auto const& message2 = tr ("Cannot open \"%1\" for append: %2")
+ .arg (f.fileName ()).arg (f.errorString ());
+ QTimer::singleShot (0, [=] { // don't block guiUpdate
+ MessageBox::warning_message(this, tr ("Log File Error"), message2); });
+ }
+}
diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h
index cfae4202..acabffe7 100644
--- a/widgets/mainwindow.h
+++ b/widgets/mainwindow.h
@@ -210,6 +210,7 @@ private slots:
void on_actionErase_ALL_TXT_triggered();
void on_reset_cabrillo_log_action_triggered ();
void on_actionErase_wsjtx_log_adi_triggered();
+ void on_actionErase_WSPR_hashtable_triggered();
void on_actionExport_Cabrillo_log_triggered();
void startTx2();
void startP1();
@@ -607,6 +608,7 @@ private:
QString m_currentBand;
QString m_nextCall;
QString m_nextGrid;
+ QString m_fileDateTime;
QSet<QString> m_pfx;
QSet<QString> m_sfx;
@@ -702,6 +704,7 @@ private:
void CQTxFreq();
void useNextCall();
void abortQSO();
+ void write_all(QString txRx, QString message);
bool isWorked(int itype, QString key, float fMHz=0, QString="");
QString save_wave_file (QString const& name
diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui
index 21799434..4e39e6d6 100644
--- a/widgets/mainwindow.ui
+++ b/widgets/mainwindow.ui
@@ -1523,9 +1523,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="shortcut">
<string>Ctrl+2</string>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="1" column="1">
@@ -1542,9 +1539,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="shortcut">
<string>Ctrl+1</string>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="2" column="2">
@@ -1602,9 +1596,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="checked">
<bool>true</bool>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="3" column="0">
@@ -1624,9 +1615,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="shortcut">
<string>Ctrl+5</string>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="3" column="1">
@@ -1643,9 +1631,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="shortcut">
<string>Ctrl+3</string>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="3" column="2">
@@ -1678,9 +1663,6 @@ QPushButton[state=&quot;ok&quot;] {
<property name="shortcut">
<string>Ctrl+4</string>
</property>
- <attribute name="buttonGroup">
- <string notr="true">buttonGroup</string>
- </attribute>
</widget>
</item>
<item row="4" column="2">
@@ -2654,6 +2636,7 @@ list. The list can be maintained in Settings (F2).</string>
<addaction name="actionDelete_all_wav_files_in_SaveDir"/>
<addaction name="actionErase_ALL_TXT"/>
<addaction name="actionErase_wsjtx_log_adi"/>
+ <addaction name="actionErase_WSPR_hashtable"/>
<addaction name="reset_cabrillo_log_action"/>
<addaction name="actionExport_Cabrillo_log"/>
<addaction name="actionOpen_log_directory"/>
@@ -2862,25 +2845,16 @@ list. The list can be maintained in Settings (F2).</string>
<property name="text">
<string>Online User Guide</string>
</property>
- <property name="shortcut">
- <string>F1</string>
- </property>
</action>
<action name="actionKeyboard_shortcuts">
<property name="text">
<string>Keyboard shortcuts</string>
</property>
- <property name="shortcut">
- <string>F3</string>
- </property>
</action>
<action name="actionSpecial_mouse_commands">
<property name="text">
<string>Special mouse commands</string>
</property>
- <property name="shortcut">
- <string>F5</string>
- </property>
</action>
<action name="actionJT9">
<property name="checkable">
@@ -3092,9 +3066,6 @@ list. The list can be maintained in Settings (F2).</string>
<property name="text">
<string>Settings...</string>
</property>
- <property name="shortcut">
- <string>F2</string>
- </property>
</action>
<action name="actionLocal_User_Guide">
<property name="text">
@@ -3362,6 +3333,11 @@ list. The list can be maintained in Settings (F2).</string>
<string>Contest log</string>
</property>
</action>
+ <action name="actionErase_WSPR_hashtable">
+ <property name="text">
+ <string>Erase WSPR hashtable</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
@@ -3475,11 +3451,4 @@ list. The list can be maintained in Settings (F2).</string>
</tabstops>
<resources/>
<connections/>
- <buttongroups>
- <buttongroup name="buttonGroup">
- <property name="exclusive">
- <bool>true</bool>
- </property>
- </buttongroup>
- </buttongroups>
</ui>