Added a custom reply dialog box so we can customize the text input validator (upper case text only)
This commit is contained in:
parent
15ee95360f
commit
38ddf11479
@ -305,6 +305,7 @@ set (wsjtx_CXXSRCS
|
||||
WsprTxScheduler.cpp
|
||||
varicode.cpp
|
||||
SelfDestructMessageBox.cpp
|
||||
messagereplydialog.cpp
|
||||
APRSISClient.cpp
|
||||
mainwindow.cpp
|
||||
Configuration.cpp
|
||||
@ -668,6 +669,7 @@ set (wsjtx_UISRCS
|
||||
widegraph.ui
|
||||
logqso.ui
|
||||
Configuration.ui
|
||||
messagereplydialog.ui
|
||||
)
|
||||
|
||||
set (UDP_library_CXXSRCS
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <fftw3.h>
|
||||
#include <QInputDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QRegExpValidator>
|
||||
#include <QRegExp>
|
||||
@ -63,6 +62,7 @@
|
||||
#include "CallsignValidator.hpp"
|
||||
#include "EqualizationToolsDialog.hpp"
|
||||
#include "SelfDestructMessageBox.h"
|
||||
#include "messagereplydialog.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "moc_mainwindow.cpp"
|
||||
@ -6126,9 +6126,6 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text)
|
||||
ui->startTxButton->setText("Send");
|
||||
ui->startTxButton->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int MainWindow::currentFreqOffset(){
|
||||
@ -9598,13 +9595,16 @@ void MainWindow::processAlertReplyForCommand(CommandDetail d, QString from, QStr
|
||||
}
|
||||
|
||||
if(btn == rb){
|
||||
bool ok = false;
|
||||
QString text = QInputDialog::getMultiLineText(this, "Message Reply", QString("Message to send to %1:").arg(from), "", &ok);
|
||||
if(ok && !text.isEmpty()){
|
||||
enqueueMessage(PriorityHigh, QString("%1%2%3").arg(from).arg(cmd).arg(text), d.freq, nullptr);
|
||||
}
|
||||
}
|
||||
auto diag = new MessageReplyDialog(this);
|
||||
diag->setWindowTitle("Message Reply");
|
||||
diag->setLabel(QString("Message to send to %1:").arg(from));
|
||||
|
||||
connect(diag, &MessageReplyDialog::accepted, this, [this, diag, from, cmd, d](){
|
||||
enqueueMessage(PriorityHigh, QString("%1%2%3").arg(from).arg(cmd).arg(diag->textValue()), d.freq, nullptr);
|
||||
});
|
||||
|
||||
diag->show();
|
||||
}
|
||||
});
|
||||
|
||||
auto wav = m_config.sound_am_path();
|
||||
|
52
messagereplydialog.cpp
Normal file
52
messagereplydialog.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "messagereplydialog.h"
|
||||
#include "ui_messagereplydialog.h"
|
||||
|
||||
#include "varicode.h"
|
||||
|
||||
MessageReplyDialog::MessageReplyDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MessageReplyDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MessageReplyDialog::~MessageReplyDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MessageReplyDialog::setLabel(QString value){
|
||||
ui->label->setText(value);
|
||||
}
|
||||
|
||||
void MessageReplyDialog::setTextValue(QString text){
|
||||
ui->textEdit->setPlainText(text);
|
||||
}
|
||||
|
||||
QString MessageReplyDialog::textValue() const {
|
||||
return ui->textEdit->toPlainText();
|
||||
}
|
||||
|
||||
void MessageReplyDialog::on_textEdit_textChanged(){
|
||||
auto text = ui->textEdit->toPlainText();
|
||||
|
||||
QString x;
|
||||
QString::const_iterator i;
|
||||
auto validChars = Varicode::huffValidChars();
|
||||
for(i = text.constBegin(); i != text.constEnd(); i++){
|
||||
auto ch = (*i).toUpper();
|
||||
if(validChars.contains(ch)){
|
||||
x += ch;
|
||||
}
|
||||
}
|
||||
|
||||
if(x != text){
|
||||
int pos = ui->textEdit->textCursor().position();
|
||||
int maxpos = x.size();
|
||||
ui->textEdit->setPlainText(x);
|
||||
QTextCursor c = ui->textEdit->textCursor();
|
||||
c.setPosition(pos < maxpos ? pos : maxpos, QTextCursor::MoveAnchor);
|
||||
|
||||
ui->textEdit->setTextCursor(c);
|
||||
}
|
||||
}
|
34
messagereplydialog.h
Normal file
34
messagereplydialog.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef MESSAGEREPLYDIALOG_H
|
||||
#define MESSAGEREPLYDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class MessageReplyDialog;
|
||||
}
|
||||
|
||||
class QTextEdit;
|
||||
|
||||
class MessageReplyDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MessageReplyDialog(QWidget *parent = 0);
|
||||
~MessageReplyDialog();
|
||||
|
||||
void setLabel(QString);
|
||||
void setTextValue(QString);
|
||||
QString textValue() const;
|
||||
|
||||
QTextEdit * textEdit();
|
||||
|
||||
|
||||
private slots:
|
||||
void on_textEdit_textChanged();
|
||||
|
||||
private:
|
||||
Ui::MessageReplyDialog *ui;
|
||||
};
|
||||
|
||||
#endif // MESSAGEREPLAYDIALOG_H
|
74
messagereplydialog.ui
Normal file
74
messagereplydialog.ui
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MessageReplyDialog</class>
|
||||
<widget class="QDialog" name="MessageReplyDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>260</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MessageReplyDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>MessageReplyDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -72,7 +72,8 @@ SOURCES += \
|
||||
NetworkMessage.cpp \
|
||||
MessageClient.cpp \
|
||||
SelfDestructMessageBox.cpp \
|
||||
APRSISClient.cpp
|
||||
APRSISClient.cpp \
|
||||
messagereplydialog.cpp
|
||||
|
||||
HEADERS += qt_helpers.hpp \
|
||||
pimpl_h.hpp pimpl_impl.hpp \
|
||||
@ -96,7 +97,8 @@ HEADERS += qt_helpers.hpp \
|
||||
NetworkMessage.hpp \
|
||||
MessageClient.hpp \
|
||||
SelfDestructMessageBox.h \
|
||||
APRSISClient.h
|
||||
APRSISClient.h \
|
||||
messagereplydialog.h
|
||||
|
||||
|
||||
INCLUDEPATH += qmake_only
|
||||
@ -108,7 +110,8 @@ HEADERS += OmniRigTransceiver.hpp
|
||||
|
||||
FORMS += mainwindow.ui about.ui Configuration.ui widegraph.ui astro.ui \
|
||||
logqso.ui wf_palette_design_dialog.ui messageaveraging.ui echograph.ui \
|
||||
fastgraph.ui
|
||||
fastgraph.ui \
|
||||
messagereplydialog.ui
|
||||
|
||||
RC_FILE = wsjtx.rc
|
||||
RESOURCES = wsjtx.qrc
|
||||
|
Loading…
Reference in New Issue
Block a user