Fixed message reply dialog to be non-modal
This commit is contained in:
parent
fddca6522e
commit
9f25842c79
@ -306,6 +306,7 @@ set (wsjtx_CXXSRCS
|
||||
varicode.cpp
|
||||
SelfDestructMessageBox.cpp
|
||||
messagereplydialog.cpp
|
||||
keyeater.cpp
|
||||
APRSISClient.cpp
|
||||
mainwindow.cpp
|
||||
Configuration.cpp
|
||||
|
29
keyeater.cpp
Normal file
29
keyeater.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "keyeater.h"
|
||||
|
||||
bool EscapeKeyPressEater::eventFilter(QObject *obj, QEvent *event){
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if(keyEvent->key() == Qt::Key_Escape){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// standard event processing
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
bool EnterKeyPressEater::eventFilter(QObject *obj, QEvent *event){
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if(keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return){
|
||||
bool processed = false;
|
||||
emit this->enterKeyPressed(obj, keyEvent, &processed);
|
||||
if(processed){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// standard event processing
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
33
keyeater.h
Normal file
33
keyeater.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef KEYEATER_H
|
||||
#define KEYEATER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QKeyEvent>
|
||||
|
||||
class EscapeKeyPressEater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EscapeKeyPressEater(){}
|
||||
virtual ~EscapeKeyPressEater(){}
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
};
|
||||
|
||||
class EnterKeyPressEater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EnterKeyPressEater(){}
|
||||
virtual ~EnterKeyPressEater(){}
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
public:
|
||||
Q_SIGNAL void enterKeyPressed(QObject *obj, QKeyEvent *evt, bool *pProcessed);
|
||||
};
|
||||
|
||||
|
||||
#endif // KEYEATER_H
|
@ -8182,7 +8182,7 @@ void MainWindow::setXIT(int n, Frequency base)
|
||||
|
||||
void MainWindow::qsy(int hzDelta){
|
||||
setRig(m_freqNominal + hzDelta);
|
||||
setFreqOffsetForRestore(1500, false);
|
||||
setFreqOffsetForRestore(m_wideGraph->centerFreq(), false);
|
||||
}
|
||||
|
||||
void MainWindow::setFreqOffsetForRestore(int freq, bool shouldRestore){
|
||||
@ -9729,6 +9729,7 @@ void MainWindow::processAlertReplyForCommand(CommandDetail d, QString from, QStr
|
||||
QSound::play(wav);
|
||||
}
|
||||
|
||||
msgBox->setModal(false);
|
||||
msgBox->show();
|
||||
}
|
||||
|
||||
|
42
mainwindow.h
42
mainwindow.h
@ -45,6 +45,7 @@
|
||||
#include "varicode.h"
|
||||
#include "MessageClient.hpp"
|
||||
#include "APRSISClient.h"
|
||||
#include "keyeater.h"
|
||||
|
||||
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
|
||||
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
|
||||
@ -932,47 +933,6 @@ private:
|
||||
void writeFoxQSO(QString msg);
|
||||
};
|
||||
|
||||
class EscapeKeyPressEater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event){
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if(keyEvent->key() == Qt::Key_Escape){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// standard event processing
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
};
|
||||
|
||||
class EnterKeyPressEater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event){
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if(keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return){
|
||||
bool processed = false;
|
||||
emit this->enterKeyPressed(obj, keyEvent, &processed);
|
||||
if(processed){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// standard event processing
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
public:
|
||||
Q_SIGNAL void enterKeyPressed(QObject *obj, QKeyEvent *evt, bool *pProcessed);
|
||||
};
|
||||
|
||||
extern int killbyname(const char* progName);
|
||||
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
||||
int minChan[], int maxChan[],
|
||||
|
@ -10,6 +10,18 @@ MessageReplyDialog::MessageReplyDialog(QWidget *parent) :
|
||||
ui(new Ui::MessageReplyDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
auto enterFilter = new EnterKeyPressEater();
|
||||
connect(enterFilter, &EnterKeyPressEater::enterKeyPressed, this, [this](QObject *, QKeyEvent *, bool *pProcessed){
|
||||
if(QApplication::keyboardModifiers() & Qt::ShiftModifier){
|
||||
if(pProcessed) *pProcessed = false;
|
||||
return;
|
||||
}
|
||||
if(pProcessed) *pProcessed = true;
|
||||
|
||||
this->accept();
|
||||
});
|
||||
ui->textEdit->installEventFilter(enterFilter);
|
||||
}
|
||||
|
||||
MessageReplyDialog::~MessageReplyDialog()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MESSAGEREPLYDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "keyeater.h"
|
||||
|
||||
namespace Ui {
|
||||
class MessageReplyDialog;
|
||||
|
@ -215,7 +215,7 @@ void WideGraph::on_bppSpinBox_valueChanged(int n) //b
|
||||
}
|
||||
|
||||
void WideGraph::on_qsyPushButton_clicked(){
|
||||
int hzDelta = rxFreq() - ui->centerSpinBox->value();
|
||||
int hzDelta = rxFreq() - centerFreq();
|
||||
emit qsy(hzDelta);
|
||||
}
|
||||
|
||||
@ -269,6 +269,11 @@ int WideGraph::rxFreq() //rxFr
|
||||
return ui->widePlot->rxFreq();
|
||||
}
|
||||
|
||||
int WideGraph::centerFreq()
|
||||
{
|
||||
return ui->centerSpinBox->value();
|
||||
}
|
||||
|
||||
int WideGraph::nStartFreq() //nStartFreq
|
||||
{
|
||||
return ui->widePlot->startFreq();
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
void dataSink2(float s[], float df3, int ihsym, int ndiskdata);
|
||||
void setRxFreq(int n);
|
||||
int rxFreq();
|
||||
int centerFreq();
|
||||
int nStartFreq();
|
||||
int Fmin();
|
||||
int Fmax();
|
||||
|
@ -73,7 +73,8 @@ SOURCES += \
|
||||
MessageClient.cpp \
|
||||
SelfDestructMessageBox.cpp \
|
||||
APRSISClient.cpp \
|
||||
messagereplydialog.cpp
|
||||
messagereplydialog.cpp \
|
||||
keyeater.cpp
|
||||
|
||||
HEADERS += qt_helpers.hpp \
|
||||
pimpl_h.hpp pimpl_impl.hpp \
|
||||
@ -98,7 +99,8 @@ HEADERS += qt_helpers.hpp \
|
||||
MessageClient.hpp \
|
||||
SelfDestructMessageBox.h \
|
||||
APRSISClient.h \
|
||||
messagereplydialog.h
|
||||
messagereplydialog.h \
|
||||
keyeater.h
|
||||
|
||||
|
||||
INCLUDEPATH += qmake_only
|
||||
|
Loading…
Reference in New Issue
Block a user