Starting to implement a new "ARRL_Digi" window.

This commit is contained in:
Joe Taylor 2022-03-11 13:11:39 -05:00
parent bc9e8f89bc
commit 658f23b813
8 changed files with 178 additions and 0 deletions

View File

@ -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

74
widgets/arrl_digi.cpp Normal file
View File

@ -0,0 +1,74 @@
#include "arrl_digi.h"
#include <QSettings>
#include <QApplication>
#include <QTextCharFormat>
#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);
}

34
widgets/arrl_digi.h Normal file
View File

@ -0,0 +1,34 @@
// -*- Mode: C++ -*-
#ifndef ARRL_DIGI_H_
#define ARRL_DIGI_H_
#include <QWidget>
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::ARRL_Digi> ui;
};
#endif

42
widgets/arrl_digi.ui Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ARRL_Digi</class>
<widget class="QWidget" name="ARRL_Digi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>529</height>
</rect>
</property>
<property name="windowTitle">
<string>Message Averaging</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPlainTextEdit" name="ARRL_DigiPlainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="header_label">
<property name="text">
<string>Points Call Grid AZ SNR Freq Band</string>
</property>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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);

View File

@ -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<HelpTextWindow> m_prefixes;
QScopedPointer<HelpTextWindow> m_mouseCmnds;
QScopedPointer<MessageAveraging> m_msgAvgWidget;
QScopedPointer<ARRL_Digi> m_ARRL_DigiWidget;
QScopedPointer<FoxLogWindow> m_foxLogWindow;
QScopedPointer<CabrilloLogWindow> m_contestLogWindow;
QScopedPointer<ColorHighlighting> m_colorHighlighting;

View File

@ -3016,6 +3016,7 @@ QLabel[oob=&quot;true&quot;] {
<addaction name="fox_log_action"/>
<addaction name="actionColors"/>
<addaction name="actionSWL_Mode"/>
<addaction name="actionARRL_Intl_Digi"/>
</widget>
<widget class="QMenu" name="menuDecode">
<property name="title">
@ -3627,6 +3628,11 @@ QLabel[oob=&quot;true&quot;] {
<string>Disable writing of ALL.TXT</string>
</property>
</action>
<action name="actionARRL_Intl_Digi">
<property name="text">
<string>ARRL Intl Digi Contest</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -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