diff --git a/CMakeLists.txt b/CMakeLists.txt index d061b2146..730b4cc04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,6 +274,7 @@ set (wsjtx_CXXSRCS widgets/about.cpp widgets/astro.cpp widgets/messageaveraging.cpp + widgets/arrl_digi.cpp widgets/colorhighlighting.cpp WSPR/WsprTxScheduler.cpp widgets/mainwindow.cpp @@ -651,6 +652,7 @@ set (wsjtx_UISRCS widgets/echograph.ui widgets/fastgraph.ui widgets/messageaveraging.ui + widgets/arrl_digi.ui widgets/widegraph.ui widgets/logqso.ui Configuration.ui diff --git a/widgets/arrl_digi.cpp b/widgets/arrl_digi.cpp new file mode 100644 index 000000000..c7ed9fdda --- /dev/null +++ b/widgets/arrl_digi.cpp @@ -0,0 +1,74 @@ +#include "arrl_digi.h" + +#include +#include +#include + +#include "SettingsGroup.hpp" +#include "qt_helpers.hpp" +#include "ui_arrl_digi.h" + +#include "moc_arrl_digi.cpp" + +ARRL_Digi::ARRL_Digi(QSettings * settings, QFont const& font, QWidget *parent) : + QWidget(parent), + settings_ {settings}, + ui(new Ui::ARRL_Digi) +{ + ui->setupUi(this); + setWindowTitle (QApplication::applicationName () + " - " + tr ("ARRL International Digital Contest")); + ui->ARRL_DigiPlainTextEdit->setReadOnly (true); + changeFont (font); + read_settings (); + ui->header_label->setText("Points Call Grid Az S/N Freq Band"); +} + +ARRL_Digi::~ARRL_Digi() +{ + write_settings (); +} + +void ARRL_Digi::changeFont (QFont const& font) +{ + ui->header_label->setStyleSheet (font_as_stylesheet (font)); + ui->ARRL_DigiPlainTextEdit->setStyleSheet (font_as_stylesheet (font)); + setContentFont (font); + updateGeometry (); +} + + +void ARRL_Digi::setContentFont(QFont const& font) +{ + ui->ARRL_DigiPlainTextEdit->setFont (font); + QTextCharFormat charFormat; + charFormat.setFont (font); + ui->ARRL_DigiPlainTextEdit->selectAll (); + auto cursor = ui->ARRL_DigiPlainTextEdit->textCursor (); + cursor.mergeCharFormat (charFormat); + cursor.clearSelection (); + cursor.movePosition (QTextCursor::End); + + // position so viewport scrolled to left + cursor.movePosition (QTextCursor::Up); + cursor.movePosition (QTextCursor::StartOfLine); + + ui->ARRL_DigiPlainTextEdit->setTextCursor (cursor); + ui->ARRL_DigiPlainTextEdit->ensureCursorVisible (); +} + +void ARRL_Digi::read_settings () +{ + SettingsGroup group {settings_, "ARRL_Digi"}; + restoreGeometry (settings_->value ("window/geometry").toByteArray ()); +} + +void ARRL_Digi::write_settings () +{ + SettingsGroup group {settings_, "ARRL_Digi"}; + settings_->setValue ("window/geometry", saveGeometry ()); +} + +void ARRL_Digi::displayARRL_Digi(QString const& t) +{ + ui->ARRL_DigiPlainTextEdit->setPlainText(t); +} diff --git a/widgets/arrl_digi.h b/widgets/arrl_digi.h new file mode 100644 index 000000000..443803d30 --- /dev/null +++ b/widgets/arrl_digi.h @@ -0,0 +1,34 @@ +// -*- Mode: C++ -*- +#ifndef ARRL_DIGI_H_ +#define ARRL_DIGI_H_ + +#include + +class QSettings; +class QFont; + +namespace Ui { + class ARRL_Digi; +} + +class ARRL_Digi + : public QWidget +{ + Q_OBJECT + +public: + explicit ARRL_Digi(QSettings *, QFont const&, QWidget * parent = 0); + ~ARRL_Digi(); + void displayARRL_Digi(QString const&); + void changeFont (QFont const&); + +private: + void read_settings (); + void write_settings (); + void setContentFont (QFont const&); + QSettings * settings_; + + QScopedPointer ui; +}; + +#endif diff --git a/widgets/arrl_digi.ui b/widgets/arrl_digi.ui new file mode 100644 index 000000000..9a598b236 --- /dev/null +++ b/widgets/arrl_digi.ui @@ -0,0 +1,42 @@ + + + ARRL_Digi + + + + 0 + 0 + 405 + 529 + + + + Message Averaging + + + + + + + + QPlainTextEdit::NoWrap + + + + + + + Points Call Grid AZ SNR Freq Band + + + 3 + + + + + + + + + + diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 7c816f487..70d98198a 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -60,6 +60,7 @@ #include "fastgraph.h" #include "about.h" #include "messageaveraging.h" +#include "arrl_digi.h" #include "colorhighlighting.h" #include "widegraph.h" #include "sleep.h" @@ -2755,6 +2756,19 @@ void MainWindow::on_actionMessage_averaging_triggered() m_msgAvgWidget->activateWindow(); } +void MainWindow::on_actionARRL_Intl_Digi_triggered() +{ + if(m_ARRL_DigiWidget == NULL) { + m_ARRL_DigiWidget.reset (new ARRL_Digi {m_settings, m_config.decoded_text_font ()}); + + // Connect signals from Message Averaging window + connect (this, &MainWindow::finished, m_ARRL_DigiWidget.data (), &ARRL_Digi::close); + } + m_ARRL_DigiWidget->showNormal(); + m_ARRL_DigiWidget->raise(); + m_ARRL_DigiWidget->activateWindow(); +} + void MainWindow::on_actionOpen_triggered() //Open File { monitor (false); diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index e790e70d9..d4a61918d 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -78,6 +78,7 @@ class WideGraph; class LogQSO; class Transceiver; class MessageAveraging; +class ARRL_Digi; class FoxLogWindow; class CabrilloLogWindow; class ColorHighlighting; @@ -267,6 +268,7 @@ private slots: void stopTuneATU(); void auto_tx_mode(bool); void on_actionMessage_averaging_triggered(); + void on_actionARRL_Intl_Digi_triggered(); void on_contest_log_action_triggered (); void on_fox_log_action_triggered (); void on_actionColors_triggered(); @@ -398,6 +400,7 @@ private: QScopedPointer m_prefixes; QScopedPointer m_mouseCmnds; QScopedPointer m_msgAvgWidget; + QScopedPointer m_ARRL_DigiWidget; QScopedPointer m_foxLogWindow; QScopedPointer m_contestLogWindow; QScopedPointer m_colorHighlighting; diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index f70f93a93..0fa1dd191 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -3016,6 +3016,7 @@ QLabel[oob="true"] { + @@ -3627,6 +3628,11 @@ QLabel[oob="true"] { Disable writing of ALL.TXT + + + ARRL Intl Digi Contest + + diff --git a/widgets/widgets.pri b/widgets/widgets.pri index 6a623d825..61a8aef1c 100644 --- a/widgets/widgets.pri +++ b/widgets/widgets.pri @@ -4,6 +4,7 @@ SOURCES += \ widgets/meterwidget.cpp widgets/signalmeter.cpp \ widgets/plotter.cpp widgets/widegraph.cpp widgets/about.cpp \ widgets/mainwindow.cpp widgets/messageaveraging.cpp \ + widgets/arrl_digi.cpp \ widgets/echoplot.cpp widgets/echograph.cpp widgets/fastgraph.cpp \ widgets/fastplot.cpp widgets/MessageBox.cpp \ widgets/colorhighlighting.cpp widgets/ExportCabrillo.cpp \ @@ -19,6 +20,7 @@ HEADERS += \ widgets/displaytext.h widgets/logqso.h widgets/LettersSpinBox.hpp \ widgets/FrequencyLineEdit.hpp widgets/FrequencyDeltaLineEdit.hpp widgets/signalmeter.h \ widgets/meterwidget.h widgets/messageaveraging.h \ + widgets/arrl_digi.h \ widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \ widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \ widgets/ExportCabrillo.h widgets/AbstractLogWindow.hpp \ @@ -31,6 +33,7 @@ FORMS += \ widgets/mainwindow.ui widgets/about.ui \ widgets/widegraph.ui widgets/astro.ui \ widgets/logqso.ui widgets/messageaveraging.ui \ + widgets/arrl_digi.ui \ widgets/echograph.ui widgets/fastgraph.ui \ widgets/colorhighlighting.ui widgets/ExportCabrillo.ui \ widgets/FoxLogWindow.ui widgets/CabrilloLogWindow.ui