Added visual strikethrough for transmitted text
This commit is contained in:
parent
335b6d13f6
commit
bb91fac20d
@ -252,6 +252,7 @@ set (wsjtx_CXXSRCS
|
||||
main.cpp
|
||||
wsprnet.cpp
|
||||
WSPRBandHopping.cpp
|
||||
TransmitTextEdit.cpp
|
||||
)
|
||||
|
||||
set (wsjt_CXXSRCS
|
||||
|
53
TransmitTextEdit.cpp
Normal file
53
TransmitTextEdit.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "TransmitTextEdit.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
TransmitTextEdit::TransmitTextEdit(QWidget *parent):
|
||||
QTextEdit(parent)
|
||||
{
|
||||
connect(this, &QTextEdit::selectionChanged, this, &TransmitTextEdit::on_selectionChanged);
|
||||
connect(this, &QTextEdit::cursorPositionChanged, this, &TransmitTextEdit::on_selectionChanged);
|
||||
}
|
||||
|
||||
void TransmitTextEdit::markCharsSent(int n){
|
||||
// update sent display
|
||||
auto c = textCursor();
|
||||
c.movePosition(QTextCursor::Start);
|
||||
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, n);
|
||||
|
||||
auto ch = c.charFormat();
|
||||
ch.setFontStrikeOut(true);
|
||||
c.mergeCharFormat(ch);
|
||||
|
||||
// keep track
|
||||
m_sent = n;
|
||||
}
|
||||
|
||||
// override
|
||||
void TransmitTextEdit::setPlainText(const QString &text){
|
||||
QTextEdit::setPlainText(text);
|
||||
m_sent = 0;
|
||||
}
|
||||
|
||||
// override
|
||||
void TransmitTextEdit::clear(){
|
||||
QTextEdit::clear();
|
||||
m_sent = 0;
|
||||
}
|
||||
|
||||
// slot
|
||||
void TransmitTextEdit::on_selectionChanged(){
|
||||
auto c = textCursor();
|
||||
int start = c.selectionStart();
|
||||
int end = c.selectionEnd();
|
||||
if(end < start){
|
||||
int x = end;
|
||||
end = start;
|
||||
start = x;
|
||||
}
|
||||
qDebug() << "selection" << start << end;
|
||||
|
||||
if(start <= m_sent){
|
||||
qDebug() << "selection in protected zone" << start << "<=" << m_sent;
|
||||
}
|
||||
}
|
22
TransmitTextEdit.h
Normal file
22
TransmitTextEdit.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef TRANSMITTEXTEDIT_H
|
||||
#define TRANSMITTEXTEDIT_H
|
||||
|
||||
#include <QTextEdit>
|
||||
|
||||
class TransmitTextEdit : public QTextEdit
|
||||
{
|
||||
public:
|
||||
TransmitTextEdit(QWidget *parent);
|
||||
|
||||
void markCharsSent(int n);
|
||||
void setPlainText(const QString &text);
|
||||
void clear();
|
||||
|
||||
public slots:
|
||||
void on_selectionChanged();
|
||||
|
||||
private:
|
||||
int m_sent;
|
||||
};
|
||||
|
||||
#endif // TRANSMITTEXTEDIT_H
|
@ -83,7 +83,8 @@ SOURCES += \
|
||||
Inbox.cpp \
|
||||
messagewindow.cpp \
|
||||
SpotClient.cpp \
|
||||
TCPClient.cpp
|
||||
TCPClient.cpp \
|
||||
TransmitTextEdit.cpp
|
||||
|
||||
HEADERS += qt_helpers.hpp \
|
||||
pimpl_h.hpp pimpl_impl.hpp \
|
||||
@ -118,7 +119,8 @@ HEADERS += qt_helpers.hpp \
|
||||
messagewindow.h \
|
||||
SpotClient.h \
|
||||
TCPClient.h \
|
||||
logbook/n3fjp.h
|
||||
logbook/n3fjp.h \
|
||||
TransmitTextEdit.h
|
||||
|
||||
|
||||
INCLUDEPATH += qmake_only
|
||||
|
@ -1918,6 +1918,9 @@ void MainWindow::initializeDummyData(){
|
||||
c.setCharFormat(f);
|
||||
#endif
|
||||
|
||||
ui->extFreeTextMsgEdit->setPlainText("HELLO BRAVE NEW WORLD");
|
||||
ui->extFreeTextMsgEdit->markCharsSent(6);
|
||||
|
||||
logHeardGraph("KN4CRD", "OH8STN");
|
||||
logHeardGraph("KN4CRD", "K0OG");
|
||||
logHeardGraph("K0OG", "KN4CRD");
|
||||
@ -5397,9 +5400,18 @@ void MainWindow::startTx2()
|
||||
void MainWindow::stopTx()
|
||||
{
|
||||
Q_EMIT endTransmitMessage ();
|
||||
|
||||
auto dt = DecodedText(m_currentMessage.trimmed(), m_currentMessageBits, m_nSubMode);
|
||||
last_tx_label.setText("Last Tx: " + dt.message()); //m_currentMessage.trimmed());
|
||||
|
||||
|
||||
// start message marker
|
||||
// - keep track of the total message sent so far, and mark it having been sent
|
||||
m_totalTxMessage.append(dt.message());
|
||||
ui->extFreeTextMsgEdit->markCharsSent(m_totalTxMessage.length());
|
||||
qDebug() << "total sent:\n" << m_totalTxMessage;
|
||||
// end message marker
|
||||
|
||||
m_btxok = false;
|
||||
m_transmitting = false;
|
||||
g_iptt=0;
|
||||
@ -6224,18 +6236,18 @@ QString MainWindow::createMessageTransmitQueue(QString const& text, bool reset){
|
||||
|
||||
auto frames = buildMessageFrames(text);
|
||||
|
||||
m_txFrameQueue.append(frames);
|
||||
m_txFrameCount = frames.length();
|
||||
|
||||
int freq = currentFreqOffset();
|
||||
qDebug() << "creating message for freq" << freq;
|
||||
|
||||
QStringList lines;
|
||||
foreach(auto frame, frames){
|
||||
auto dt = DecodedText(frame.first, frame.second, m_nSubMode);
|
||||
lines.append(dt.message());
|
||||
}
|
||||
|
||||
m_txFrameQueue.append(frames);
|
||||
m_txFrameCount = frames.length();
|
||||
|
||||
int freq = currentFreqOffset();
|
||||
qDebug() << "creating message for freq" << freq;
|
||||
|
||||
// TODO: jsherer - parse outgoing message so we can add it to the inbox as an outgoing message
|
||||
|
||||
auto joined = Varicode::rstrip(lines.join(""));
|
||||
@ -6265,6 +6277,9 @@ void MainWindow::resetMessageTransmitQueue(){
|
||||
m_txFrameCount = 0;
|
||||
m_txFrameQueue.clear();
|
||||
m_txMessageQueue.clear();
|
||||
|
||||
// reset the total message sent
|
||||
m_totalTxMessage.clear();
|
||||
}
|
||||
|
||||
QPair<QString, int> MainWindow::popMessageFrame(){
|
||||
@ -6382,6 +6397,11 @@ bool MainWindow::prepareNextMessageFrame()
|
||||
auto frame = f.first;
|
||||
auto bits = f.second;
|
||||
|
||||
// append this frame to the total message sent so far
|
||||
// auto dt = DecodedText(frame, bits, m_nSubMode);
|
||||
// m_totalTxMessage.append(dt.message());
|
||||
// qDebug() << "total sent" << m_totalTxMessage;
|
||||
|
||||
if(frame.isEmpty()){
|
||||
ui->nextFreeTextMsg->clear();
|
||||
updateTxButtonDisplay();
|
||||
|
@ -795,6 +795,7 @@ private:
|
||||
QString m_txTextDirtyLastText;
|
||||
QString m_txTextDirtyLastSelectedCall;
|
||||
QString m_lastTxMessage;
|
||||
QString m_totalTxMessage;
|
||||
QDateTime m_lastTxTime;
|
||||
int m_timeDeltaMsMMA;
|
||||
int m_timeDeltaMsMMA_N;
|
||||
|
@ -1133,7 +1133,7 @@ background-color:#6699ff;
|
||||
<string>Incoming and outgoing messages will appear here.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="extFreeTextMsgEdit">
|
||||
<widget class="TransmitTextEdit" name="extFreeTextMsgEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>4</horstretch>
|
||||
@ -5848,6 +5848,11 @@ list. The list can be maintained in Settings (F2).</string>
|
||||
<extends>QPushButton</extends>
|
||||
<header>DoubleClickablePushButton.hpp</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TransmitTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>TransmitTextEdit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>extFreeTextMsgEdit</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user