kopia lustrzana https://gitlab.com/eliggett/wfview
Added read/write for break in mode and key speed. Macro buttons working
although not saved.half-duplex
rodzic
23c191a091
commit
b3258c57a5
110
cwsender.cpp
110
cwsender.cpp
|
@ -19,6 +19,32 @@ cwSender::~cwSender()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void cwSender::showEvent(QShowEvent *event)
|
||||
{
|
||||
emit getCWSettings();
|
||||
(void)event;
|
||||
}
|
||||
|
||||
void cwSender::handleKeySpeed(unsigned char wpm)
|
||||
{
|
||||
if((wpm >= 6) && (wpm <=48))
|
||||
{
|
||||
ui->wpmSpin->blockSignals(true);
|
||||
ui->wpmSpin->setValue(wpm);
|
||||
ui->wpmSpin->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
void cwSender::handleBreakInMode(unsigned char b)
|
||||
{
|
||||
if(b < 3)
|
||||
{
|
||||
ui->breakinCombo->blockSignals(true);
|
||||
ui->breakinCombo->setCurrentIndex(b);
|
||||
ui->breakinCombo->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
void cwSender::on_sendBtn_clicked()
|
||||
{
|
||||
if( (ui->textToSendEdit->text().length() > 0) &&
|
||||
|
@ -51,3 +77,87 @@ void cwSender::on_wpmSpin_valueChanged(int wpm)
|
|||
{
|
||||
emit setKeySpeed((unsigned char)wpm);
|
||||
}
|
||||
|
||||
void cwSender::on_macro1btn_clicked()
|
||||
{
|
||||
processMacroButton(1);
|
||||
}
|
||||
|
||||
void cwSender::on_macro2btn_clicked()
|
||||
{
|
||||
processMacroButton(2);
|
||||
}
|
||||
|
||||
void cwSender::on_macro3btn_clicked()
|
||||
{
|
||||
processMacroButton(3);
|
||||
}
|
||||
|
||||
void cwSender::on_macro4btn_clicked()
|
||||
{
|
||||
processMacroButton(4);
|
||||
}
|
||||
|
||||
void cwSender::on_macro5btn_clicked()
|
||||
{
|
||||
processMacroButton(5);
|
||||
}
|
||||
|
||||
void cwSender::on_macro6btn_clicked()
|
||||
{
|
||||
processMacroButton(6);
|
||||
}
|
||||
|
||||
void cwSender::on_macro7btn_clicked()
|
||||
{
|
||||
processMacroButton(7);
|
||||
}
|
||||
|
||||
void cwSender::on_macro8btn_clicked()
|
||||
{
|
||||
processMacroButton(8);
|
||||
}
|
||||
|
||||
void cwSender::on_macro9btn_clicked()
|
||||
{
|
||||
processMacroButton(9);
|
||||
}
|
||||
|
||||
void cwSender::on_macro10btn_clicked()
|
||||
{
|
||||
processMacroButton(10);
|
||||
}
|
||||
|
||||
void cwSender::processMacroButton(int buttonNumber)
|
||||
{
|
||||
if(ui->macroEditChk->isChecked())
|
||||
{
|
||||
editMacroButton(buttonNumber);
|
||||
} else {
|
||||
runMacroButton(buttonNumber);
|
||||
}
|
||||
}
|
||||
|
||||
void cwSender::runMacroButton(int buttonNumber)
|
||||
{
|
||||
if(macroText[buttonNumber].isEmpty())
|
||||
return;
|
||||
emit sendCW(macroText[buttonNumber]);
|
||||
//ui->transcriptText->appendPlainText(macroText[buttonNumber]);
|
||||
//ui->textToSendEdit->setFocus();
|
||||
}
|
||||
|
||||
void cwSender::editMacroButton(int buttonNumber)
|
||||
{
|
||||
bool ok;
|
||||
QString prompt = QString("Please enter the text for macro %1, up to 30 characters.").arg(buttonNumber);
|
||||
QString newMacroText = QInputDialog::getText(this, "Macro Edit",
|
||||
prompt,
|
||||
QLineEdit::Normal, macroText[buttonNumber], &ok);
|
||||
if(!ok)
|
||||
return;
|
||||
if(newMacroText.length() > 30)
|
||||
return;
|
||||
|
||||
macroText[buttonNumber] = newMacroText;
|
||||
}
|
||||
|
|
32
cwsender.h
32
cwsender.h
|
@ -4,6 +4,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QInputDialog>
|
||||
#include "wfviewtypes.h"
|
||||
|
||||
|
||||
|
@ -23,9 +24,15 @@ signals:
|
|||
void stopCW();
|
||||
void setKeySpeed(unsigned char wpm);
|
||||
void setBreakInMode(unsigned char b);
|
||||
void getCWSettings();
|
||||
|
||||
public slots:
|
||||
void handleKeySpeed(unsigned char wpm);
|
||||
void handleBreakInMode(unsigned char b);
|
||||
|
||||
private slots:
|
||||
void on_sendBtn_clicked();
|
||||
void showEvent(QShowEvent* event);
|
||||
|
||||
void on_stopBtn_clicked();
|
||||
|
||||
|
@ -35,8 +42,33 @@ private slots:
|
|||
|
||||
void on_wpmSpin_valueChanged(int arg1);
|
||||
|
||||
void on_macro1btn_clicked();
|
||||
|
||||
void on_macro2btn_clicked();
|
||||
|
||||
void on_macro3btn_clicked();
|
||||
|
||||
void on_macro4btn_clicked();
|
||||
|
||||
void on_macro5btn_clicked();
|
||||
|
||||
void on_macro6btn_clicked();
|
||||
|
||||
void on_macro7btn_clicked();
|
||||
|
||||
void on_macro8btn_clicked();
|
||||
|
||||
void on_macro9btn_clicked();
|
||||
|
||||
void on_macro10btn_clicked();
|
||||
|
||||
private:
|
||||
Ui::cwSender *ui;
|
||||
void processMacroButton(int buttonNumber);
|
||||
void runMacroButton(int buttonNumber);
|
||||
void editMacroButton(int buttonNumber);
|
||||
QStringList macroTextList;
|
||||
QString macroText[11];
|
||||
};
|
||||
|
||||
#endif // CWSENDER_H
|
||||
|
|
17
cwsender.ui
17
cwsender.ui
|
@ -63,7 +63,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<widget class="QCheckBox" name="macroEditChk">
|
||||
<property name="toolTip">
|
||||
<string>Check this box to enter edit mode, where you can then press the macro buttons to edit the macros.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Mode</string>
|
||||
</property>
|
||||
|
@ -137,6 +140,18 @@
|
|||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="textToSendEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
|
|
|
@ -1585,8 +1585,8 @@ void rigCommander::parseLevels()
|
|||
state.set(MICGAIN, level, false);
|
||||
break;
|
||||
case '\x0C':
|
||||
// CW Keying Speed - ignore for now
|
||||
state.set(KEYSPD, level, false);
|
||||
emit haveKeySpeed((level/6.071)+6);
|
||||
break;
|
||||
case '\x0D':
|
||||
// Notch filder setting - ignore for now
|
||||
|
@ -2786,6 +2786,7 @@ void rigCommander::parseRegister16()
|
|||
state.set(FBKINFUNC, true, false);
|
||||
state.set(SBKINFUNC, false, false);
|
||||
}
|
||||
emit haveCWBreakMode(payloadIn.at(2));
|
||||
break;
|
||||
case '\x48': // Manual Notch
|
||||
state.set(MNFUNC, payloadIn.at(2) != 0, false);
|
||||
|
@ -4617,6 +4618,13 @@ void rigCommander::setKeySpeed(unsigned char wpm)
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getKeySpeed()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x14\x0C", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setManualNotch(bool enabled)
|
||||
{
|
||||
QByteArray payload("\x16\x48");
|
||||
|
|
|
@ -116,6 +116,7 @@ public slots:
|
|||
void setBreakIn(unsigned char type);
|
||||
void getBreakIn();
|
||||
void setKeySpeed(unsigned char wpm);
|
||||
void getKeySpeed();
|
||||
void setManualNotch(bool enabled);
|
||||
void getManualNotch();
|
||||
|
||||
|
@ -342,6 +343,11 @@ signals:
|
|||
void havePreamp(unsigned char pre);
|
||||
void haveAntenna(unsigned char ant,bool rx);
|
||||
|
||||
// CW:
|
||||
void haveKeySpeed(unsigned char wpm);
|
||||
void haveCWBreakMode(unsigned char bmode);
|
||||
|
||||
|
||||
// Rig State
|
||||
void stateInfo(rigstate* state);
|
||||
|
||||
|
|
24
wfmain.cpp
24
wfmain.cpp
|
@ -346,7 +346,13 @@ void wfmain::rigConnections()
|
|||
connect(this, SIGNAL(sendCW(QString)), rig, SLOT(sendCW(QString)));
|
||||
connect(this, SIGNAL(stopCW()), rig, SLOT(sendStopCW()));
|
||||
connect(this, SIGNAL(setKeySpeed(unsigned char)), rig, SLOT(setKeySpeed(unsigned char)));
|
||||
connect(this, SIGNAL(getKeySpeed()), rig, SLOT(getKeySpeed()));
|
||||
connect(this, SIGNAL(setCWBreakMode(unsigned char)), rig, SLOT(setBreakIn(unsigned char)));
|
||||
connect(this, SIGNAL(getCWBreakMode()), rig, SLOT(getBreakIn()));
|
||||
connect(this->rig, &rigCommander::haveKeySpeed,
|
||||
[=](const unsigned char &wpm) { cw->handleKeySpeed(wpm);});
|
||||
connect(this->rig, &rigCommander::haveCWBreakMode,
|
||||
[=](const unsigned char &bm) { cw->handleBreakInMode(bm);});
|
||||
|
||||
connect(rig, SIGNAL(haveBandStackReg(freqt,char,char,bool)), this, SLOT(receiveBandStackReg(freqt,char,char,bool)));
|
||||
connect(this, SIGNAL(setRitEnable(bool)), rig, SLOT(setRitEnable(bool)));
|
||||
|
@ -1074,6 +1080,11 @@ void wfmain::setupMainUI()
|
|||
[=](const unsigned char &bmode) { issueCmd(cmdSetBreakMode, bmode);});
|
||||
connect(this->cw, &cwSender::setKeySpeed,
|
||||
[=](const unsigned char &wpm) { issueCmd(cmdSetKeySpeed, wpm);});
|
||||
connect(this->cw, &cwSender::getCWSettings,
|
||||
[=]() { qInfo(logSystem()) << "Getting CW Settings for CW Sender";
|
||||
issueDelayedCommand(cmdGetKeySpeed);
|
||||
issueDelayedCommand(cmdGetBreakMode);});
|
||||
|
||||
}
|
||||
|
||||
void wfmain::prepareSettingsWindow()
|
||||
|
@ -8562,3 +8573,16 @@ void wfmain::on_autoSSBchk_clicked(bool checked)
|
|||
{
|
||||
prefs.automaticSidebandSwitching = checked;
|
||||
}
|
||||
|
||||
void wfmain::on_cwButton_clicked()
|
||||
{
|
||||
if(cw->isMinimized())
|
||||
{
|
||||
cw->raise();
|
||||
cw->activateWindow();
|
||||
return;
|
||||
}
|
||||
cw->show();
|
||||
cw->raise();
|
||||
cw->activateWindow();
|
||||
}
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -729,6 +729,8 @@ private slots:
|
|||
|
||||
void on_autoSSBchk_clicked(bool checked);
|
||||
|
||||
void on_cwButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
|
11
wfmain.ui
11
wfmain.ui
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mainTab">
|
||||
<attribute name="title">
|
||||
|
@ -1041,6 +1041,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cwButton">
|
||||
<property name="text">
|
||||
<string>CW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rptSetupBtn">
|
||||
<property name="toolTip">
|
||||
|
@ -5396,8 +5403,8 @@
|
|||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="pollingButtonGroup"/>
|
||||
<buttongroup name="underlayButtonGroup"/>
|
||||
<buttongroup name="pollingButtonGroup"/>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
Ładowanie…
Reference in New Issue