diff --git a/cwsender.cpp b/cwsender.cpp index eb08fcf..87d91f2 100644 --- a/cwsender.cpp +++ b/cwsender.cpp @@ -26,17 +26,15 @@ cwSender::~cwSender() void cwSender::showEvent(QShowEvent *event) { + (void)event; emit getCWSettings(); QMainWindow::showEvent(event); - (void)event; } void cwSender::handleKeySpeed(unsigned char wpm) { - //qDebug(logCW()) << "Told that current WPM is" << wpm; if ((wpm >= 6) && (wpm <= 48)) { - //qDebug(logCW()) << "Setting WPM UI control to" << wpm; ui->wpmSpin->blockSignals(true); ui->wpmSpin->setValue(wpm); ui->wpmSpin->blockSignals(false); @@ -45,19 +43,23 @@ void cwSender::handleKeySpeed(unsigned char wpm) void cwSender::handleDashRatio(unsigned char ratio) { - if ((ratio >= 28) && (ratio <= 45)) + double calc = double(ratio/10); + if ((calc >= 2.8) && (ratio <= 4.5)) { ui->dashSpin->blockSignals(true); - ui->dashSpin->setValue(double(ratio/10)); + ui->dashSpin->setValue(calc); ui->dashSpin->blockSignals(false); } } void cwSender::handlePitch(unsigned char pitch) { quint16 cwPitch = round((((600.0 / 255.0) * pitch) + 300) / 5.0) * 5.0; - ui->pitchSpin->blockSignals(true); - ui->pitchSpin->setValue(cwPitch); - ui->pitchSpin->blockSignals(false); + if (cwPitch >= 300 && cwPitch <= 900) + { + ui->pitchSpin->blockSignals(true); + ui->pitchSpin->setValue(cwPitch); + ui->pitchSpin->blockSignals(false); + } } void cwSender::handleBreakInMode(unsigned char b) @@ -82,16 +84,16 @@ void cwSender::handleCurrentModeUpdate(mode_kind mode) void cwSender::textChanged(QString text) { - if (ui->sendImmediateChk->isChecked()) + if (ui->sendImmediateChk->isChecked() && text.size() && text.back() == ' ') { - if (text.back() == ' ') - { - int toSend = text.mid(0, 30).size(); - if (toSend > 0) { - emit sendCW(text.mid(0, 30)); - ui->transcriptText->appendPlainText(text.mid(0, 30)); - ui->textToSendEdit->clearEditText(); - } + int toSend = text.mid(0, 30).size(); + if (toSend > 0) { + emit sendCW(text.mid(0, 30)); + ui->textToSendEdit->clearEditText(); + + ui->transcriptText->moveCursor(QTextCursor::End); + ui->transcriptText->insertPlainText(text.mid(0, 30).toUpper()); + ui->transcriptText->moveCursor(QTextCursor::End); } } } @@ -102,12 +104,22 @@ void cwSender::on_sendBtn_clicked() (ui->textToSendEdit->currentText().length() <= 30) ) { emit sendCW(ui->textToSendEdit->currentText()); - ui->transcriptText->appendPlainText(ui->textToSendEdit->currentText()); - ui->textToSendEdit->addItem(ui->textToSendEdit->currentText()); - if (ui->textToSendEdit->count() > 5) { - ui->textToSendEdit->removeItem(0); + + ui->transcriptText->moveCursor(QTextCursor::End); + ui->transcriptText->insertPlainText(ui->textToSendEdit->currentText().toUpper()+"\n"); + ui->transcriptText->moveCursor(QTextCursor::End); + if (!ui->sendImmediateChk->isChecked()) + { + ui->textToSendEdit->addItem(ui->textToSendEdit->currentText()); + if (ui->textToSendEdit->count() > 5) { + ui->textToSendEdit->removeItem(0); + } + ui->textToSendEdit->setCurrentIndex(-1); + } else { + ui->textToSendEdit->clearEditText(); + ui->textToSendEdit->clear(); } - ui->textToSendEdit->setCurrentIndex(-1); + ui->textToSendEdit->setFocus(); ui->statusbar->showMessage("Sending CW", 3000); } @@ -242,7 +254,10 @@ void cwSender::runMacroButton(int buttonNumber) emit sendCW(outText.mid(i,30)); } - ui->transcriptText->appendPlainText(outText); + ui->transcriptText->moveCursor(QTextCursor::End); + ui->transcriptText->insertPlainText(outText.toUpper()+"\n"); + ui->transcriptText->moveCursor(QTextCursor::End); + ui->textToSendEdit->setFocus(); @@ -264,7 +279,7 @@ void cwSender::editMacroButton(int buttonNumber, QPushButton* btn) QString newMacroText = QInputDialog::getText(this, "Macro Edit", prompt, - QLineEdit::Normal, macroText[buttonNumber], &ok); + QLineEdit::Normal, macroText[buttonNumber], &ok).toUpper(); if(!ok) return; @@ -307,6 +322,26 @@ void cwSender::on_sequenceSpin_valueChanged(int newSeq) ui->textToSendEdit->setFocus(); } +bool cwSender::getCutNumbers() +{ + return ui->cutNumbersChk->isChecked(); +} + +bool cwSender::getSendImmediate() +{ + return ui->sendImmediateChk->isChecked(); +} + +void cwSender::setCutNumbers(bool val) +{ + ui->cutNumbersChk->setChecked(val); +} + +void cwSender::setSendImmediate(bool val) +{ + ui->sendImmediateChk->setChecked(val); +} + QStringList cwSender::getMacroText() { // This is for preference saving: diff --git a/cwsender.h b/cwsender.h index b767135..56165e0 100644 --- a/cwsender.h +++ b/cwsender.h @@ -25,6 +25,11 @@ public: ~cwSender(); QStringList getMacroText(); void setMacroText(QStringList macros); + void setCutNumbers(bool val); + void setSendImmediate(bool val); + bool getCutNumbers(); + bool getSendImmediate(); + signals: void sendCW(QString cwMessage); void stopCW(); diff --git a/cwsender.ui b/cwsender.ui index 20b8cc2..8d72739 100644 --- a/cwsender.ui +++ b/cwsender.ui @@ -6,7 +6,7 @@ 0 0 - 822 + 835 451 @@ -246,6 +246,9 @@ Type here to send text as CW + + Qt::ImhUppercaseOnly + true @@ -348,6 +351,9 @@ + + 1 + 2.800000000000000 @@ -357,6 +363,9 @@ 0.100000000000000 + + QAbstractSpinBox::DefaultStepType + 3.000000000000000 diff --git a/prefs.h b/prefs.h index b66f44c..4118cdd 100644 --- a/prefs.h +++ b/prefs.h @@ -70,6 +70,7 @@ struct preferences { QString clusterTcpPassword; int clusterTimeout; bool clusterSkimmerSpotsEnable; + }; #endif // PREFS_H diff --git a/wfmain.cpp b/wfmain.cpp index e3b9469..e060f64 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2437,6 +2437,8 @@ void wfmain::loadSettings() // CW Memory Load: settings->beginGroup("Keyer"); + cw->setCutNumbers(settings->value("CutNumbers", false).toBool()); + cw->setSendImmediate(settings->value("SendImmediate", false).toBool()); int numMemories = settings->beginReadArray("macros"); if(numMemories==10) { @@ -2965,6 +2967,8 @@ void wfmain::saveSettings() settings->endGroup(); settings->beginGroup("Keyer"); + settings->setValue("CutNumbers", cw->getCutNumbers()); + settings->setValue("SendImmediate", cw->getSendImmediate()); QStringList macroList = cw->getMacroText(); if(macroList.length() == 10) { @@ -9503,4 +9507,4 @@ void wfmain::receiveUsbSettings(quint8 bright, quint8 orient, quint8 speed, quin prefs.usbSpeed = speed; prefs.usbTimeout = timeout; prefs.usbColor = color; -} \ No newline at end of file +} diff --git a/wfserver.vcxproj.user b/wfserver.vcxproj.user index 5c869b5..bc8d004 100644 --- a/wfserver.vcxproj.user +++ b/wfserver.vcxproj.user @@ -2,15 +2,15 @@ - 2023-02-06T15:26:00.1276665Z + 2023-02-14T19:04:12.9338871Z - 2023-02-06T15:25:59.8598138Z + 2023-02-14T19:04:11.6802165Z - 2023-02-06T15:26:00.7293349Z + 2023-02-14T19:04:14.0213664Z - 2023-02-06T15:26:00.3825270Z + 2023-02-14T19:04:13.5068223Z \ No newline at end of file diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index 7c2d6bc..f9cc765 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -45,10 +45,10 @@ 2022-08-21T18:58:23.4329764Z - 2023-02-14T17:48:26.0594274Z + 2023-02-14T19:04:15.5036128Z - 2023-02-14T17:48:25.7629768Z + 2023-02-14T19:04:14.6701614Z 2022-08-22T10:47:49.1255783Z @@ -60,9 +60,9 @@ 2022-08-20T19:06:43.4553894Z - 2023-02-14T17:48:27.5731249Z + 2023-02-14T19:04:16.6120542Z - 2023-02-14T17:48:27.1219605Z + 2023-02-14T19:04:16.0046827Z \ No newline at end of file