2021-02-05 Fred Gleason <fredg@paravelsystems.com>

* Removed 'Q3SocketDevice' dependencies from rmlsend(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-02-06 09:30:11 -05:00
parent dbf515a46e
commit e4d26cfca2
3 changed files with 16 additions and 24 deletions

View File

@ -21024,3 +21024,5 @@
* Removed dead method from 'RDCartDialog'. * Removed dead method from 'RDCartDialog'.
* Fixed a bug in rdlogedit(1) that made it impossible to select * Fixed a bug in rdlogedit(1) that made it impossible to select
a cart in the 'Select Cart' dialog. a cart in the 'Select Cart' dialog.
2021-02-05 Fred Gleason <fredg@paravelsystems.com>
* Removed 'Q3SocketDevice' dependencies from rmlsend(1).

View File

@ -2,7 +2,7 @@
// //
// A utility for sending RML Commands // A utility for sending RML Commands
// //
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -116,16 +116,11 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
quit->setDefault(true); quit->setDefault(true);
connect(quit,SIGNAL(clicked()),qApp,SLOT(quit())); connect(quit,SIGNAL(clicked()),qApp,SLOT(quit()));
udp_command=new Q3SocketDevice(Q3SocketDevice::Datagram); udp_command=new QUdpSocket(this);
udp_response=new Q3SocketDevice(Q3SocketDevice::Datagram); udp_response=new QUdpSocket(this);
udp_response->bind(QHostAddress(),RD_RML_REPLY_PORT); udp_response->bind(QHostAddress(),RD_RML_REPLY_PORT);
udp_response->setBlocking(false); connect(udp_response,SIGNAL(readyRead()),this,SLOT(readResponse()));
timer=new QTimer(this,"timer");
connect(timer,SIGNAL(timeout()),this,SLOT(readResponse()));
countdown=-1;
timer->start(100);
// //
// Populate Data // Populate Data
@ -208,8 +203,7 @@ void MainWidget::sendCommand()
host_addr.setAddress(host->text()); host_addr.setAddress(host->text());
} }
dcl_command=command->text(); dcl_command=command->text();
if(!udp_command->writeBlock(dcl_command.utf8(),dcl_command.utf8().length(), if(!udp_command->writeDatagram(dcl_command.utf8(),host_addr,(Q_UINT16)port)) {
host_addr,(Q_UINT16)port)) {
QMessageBox::warning(this,tr("RMLSend"),tr("Connection Failed!")); QMessageBox::warning(this,tr("RMLSend"),tr("Connection Failed!"));
return; return;
} }
@ -251,7 +245,6 @@ void MainWidget::destChangedData(int id)
port_edit_label->setDisabled(true); port_edit_label->setDisabled(true);
response->setEnabled(true); response->setEnabled(true);
response_label->setEnabled(true); response_label->setEnabled(true);
timer->start(100);
break; break;
case MainWidget::RmlNoEcho: case MainWidget::RmlNoEcho:
@ -260,7 +253,6 @@ void MainWidget::destChangedData(int id)
response->setText(""); response->setText("");
response->setDisabled(true); response->setDisabled(true);
response_label->setDisabled(true); response_label->setDisabled(true);
timer->stop();
break; break;
case MainWidget::Manual: case MainWidget::Manual:
@ -269,7 +261,6 @@ void MainWidget::destChangedData(int id)
response->setText(""); response->setText("");
response->setDisabled(true); response->setDisabled(true);
response_label->setDisabled(true); response_label->setDisabled(true);
timer->stop();
break; break;
} }
} }
@ -398,7 +389,7 @@ bool MainObject::GetNextChar(QChar *c)
void MainObject::ProcessCommands() void MainObject::ProcessCommands()
{ {
QChar c; QChar c;
Q3SocketDevice *udp_command=new Q3SocketDevice(Q3SocketDevice::Datagram); QUdpSocket *udp_command=new QUdpSocket(this);
QString rml=""; QString rml="";
bool active=false; bool active=false;
@ -406,10 +397,10 @@ void MainObject::ProcessCommands()
if(active) { if(active) {
if(c=='!') { if(c=='!') {
rml+=c; rml+=c;
udp_command->writeBlock(rml.utf8(),rml.utf8().length(), udp_command->writeDatagram(rml.utf8(),*dest_addr,dest_port);
*dest_addr,dest_port);
rml=""; rml="";
active=false; active=false;
qApp->processEvents();
} }
else { else {
rml+=c; rml+=c;

View File

@ -2,7 +2,7 @@
// //
// A utility for sending RML Commands // A utility for sending RML Commands
// //
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -21,12 +21,12 @@
#ifndef RMLSEND_H #ifndef RMLSEND_H
#define RMLSEND_H #define RMLSEND_H
#include <q3socketdevice.h>
#include <q3textstream.h> #include <q3textstream.h>
#include <qcombobox.h> #include <QComboBox>
#include <qlabel.h> #include <QLabel>
#include <qpushbutton.h> #include <QPushButton>
#include <QUdpSocket>
#include <rd.h> #include <rd.h>
#include <rdwidget.h> #include <rdwidget.h>
@ -59,9 +59,8 @@ class MainWidget : public RDWidget
QLabel *port_edit_label; QLabel *port_edit_label;
QComboBox *port_box; QComboBox *port_box;
QLineEdit *port_edit; QLineEdit *port_edit;
Q3SocketDevice *udp_command,*udp_response; QUdpSocket *udp_command,*udp_response;
QHostAddress host_addr; QHostAddress host_addr;
QTimer *timer;
int countdown; int countdown;
QFont main_font; QFont main_font;
QPixmap *rivendell_map; QPixmap *rivendell_map;