mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-13 08:05:55 +01:00
2021-01-27 Fred Gleason <fredg@paravelsystems.com>
* Added 'RDEndpointListModel'. * Refactored the 'List Inputs'/'List Outputs dialogs in rdadmin(1) to use the model-based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Edit a Rivendell Endpoint
|
// Edit a Rivendell Endpoint
|
||||||
//
|
//
|
||||||
// (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
|
||||||
@@ -30,27 +30,6 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint,
|
|||||||
int *devicenum,QWidget *parent)
|
int *devicenum,QWidget *parent)
|
||||||
: RDDialog(parent)
|
: RDDialog(parent)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
edit_mtx=NULL;
|
|
||||||
edit_type=type;
|
|
||||||
edit_endpoint=endpoint;
|
|
||||||
edit_pointnum=pointnum;
|
|
||||||
edit_pointname=pointname;
|
|
||||||
edit_enginenum=enginenum;
|
|
||||||
edit_devicenum=devicenum;
|
|
||||||
|
|
||||||
switch(edit_endpoint) {
|
|
||||||
case RDMatrix::Input:
|
|
||||||
edit_table="INPUTS";
|
|
||||||
setWindowTitle("RDAdmin - "+tr("Edit Input"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RDMatrix::Output:
|
|
||||||
edit_table="OUTPUTS";
|
|
||||||
setWindowTitle("RDAdmin - "+tr("Edit Output"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//
|
//
|
||||||
// Fix the Window Size
|
// Fix the Window Size
|
||||||
//
|
//
|
||||||
@@ -80,7 +59,8 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint,
|
|||||||
//
|
//
|
||||||
edit_enginenum_edit=new QLineEdit(this);
|
edit_enginenum_edit=new QLineEdit(this);
|
||||||
edit_enginenum_edit->setGeometry(135,36,50,20);
|
edit_enginenum_edit->setGeometry(135,36,50,20);
|
||||||
edit_enginenum_label=new QLabel(edit_enginenum_edit,tr("Engine (Hex): "),this);
|
edit_enginenum_label=
|
||||||
|
new QLabel(edit_enginenum_edit,tr("Engine (Hex): "),this);
|
||||||
edit_enginenum_label->setGeometry(10,36,120,20);
|
edit_enginenum_label->setGeometry(10,36,120,20);
|
||||||
edit_enginenum_label->setFont(labelFont());
|
edit_enginenum_label->setFont(labelFont());
|
||||||
edit_enginenum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
edit_enginenum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
@@ -113,29 +93,6 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint,
|
|||||||
button->setFont(buttonFont());
|
button->setFont(buttonFont());
|
||||||
button->setText(tr("&Cancel"));
|
button->setText(tr("&Cancel"));
|
||||||
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||||
|
|
||||||
//
|
|
||||||
// Load Data
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
edit_endpoint_edit->setText(*edit_pointname);
|
|
||||||
if(*enginenum>=0) {
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
edit_enginenum_edit->setText(QString().sprintf("%04X",*enginenum));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edit_enginenum_edit->setText(QString().sprintf("%d",*enginenum));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*devicenum>=0) {
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
edit_devicenum_edit->setText(QString().sprintf("%04X",*devicenum));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edit_devicenum_edit->setText(QString().sprintf("%d",*devicenum));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,58 +166,7 @@ void EditEndpoint::okData()
|
|||||||
"where "+
|
"where "+
|
||||||
QString().sprintf("ID=%d",edit_endpoint_id);
|
QString().sprintf("ID=%d",edit_endpoint_id);
|
||||||
RDSqlQuery::apply(sql);
|
RDSqlQuery::apply(sql);
|
||||||
/*
|
|
||||||
bool ok;
|
|
||||||
int enginenum=-1;
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
enginenum=edit_enginenum_edit->text().toInt(&ok,16);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
enginenum=edit_enginenum_edit->text().toInt(&ok);
|
|
||||||
}
|
|
||||||
if(!ok) {
|
|
||||||
if(edit_enginenum_edit->text().isEmpty()) {
|
|
||||||
enginenum=-1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
QMessageBox::warning(this,tr("Invalid Number"),
|
|
||||||
tr("The Engine Number is Invalid!"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QMessageBox::warning(this,tr("Invalid Number"),
|
|
||||||
tr("The Provider ID is Invalid!"));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int devicenum=-1;
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
devicenum=edit_devicenum_edit->text().toInt(&ok,16);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
devicenum=edit_devicenum_edit->text().toInt(&ok);
|
|
||||||
}
|
|
||||||
if(!ok) {
|
|
||||||
if(edit_devicenum_edit->text().isEmpty()) {
|
|
||||||
devicenum=-1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(edit_type==RDMatrix::LogitekVguest) {
|
|
||||||
QMessageBox::warning(this,tr("Invalid Number"),
|
|
||||||
tr("The Device Number is Invalid!"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QMessageBox::warning(this,tr("Invalid Number"),
|
|
||||||
tr("The Service ID is Invalid!"));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*edit_pointname=edit_endpoint_edit->text();
|
|
||||||
*edit_enginenum=enginenum;
|
|
||||||
*edit_devicenum=devicenum;
|
|
||||||
*/
|
|
||||||
done(true);
|
done(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Edit a Rivendell Endpoint
|
// Edit a Rivendell Endpoint
|
||||||
//
|
//
|
||||||
// (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,10 +21,9 @@
|
|||||||
#ifndef EDIT_ENDPOINT_H
|
#ifndef EDIT_ENDPOINT_H
|
||||||
#define EDIT_ENDPOINT_H
|
#define EDIT_ENDPOINT_H
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <QLabel>
|
||||||
#include <qpushbutton.h>
|
#include <QLineEdit>
|
||||||
#include <qlineedit.h>
|
#include <QPushButton>
|
||||||
#include <qcombobox.h>
|
|
||||||
|
|
||||||
#include <rddialog.h>
|
#include <rddialog.h>
|
||||||
#include <rdmatrix.h>
|
#include <rdmatrix.h>
|
||||||
@@ -51,11 +50,6 @@ class EditEndpoint : public RDDialog
|
|||||||
RDMatrix *edit_mtx;
|
RDMatrix *edit_mtx;
|
||||||
RDMatrix::Endpoint edit_endpoint_type;
|
RDMatrix::Endpoint edit_endpoint_type;
|
||||||
int edit_pointnum;
|
int edit_pointnum;
|
||||||
/*
|
|
||||||
QString *edit_pointname;
|
|
||||||
int *edit_enginenum;
|
|
||||||
int *edit_devicenum;
|
|
||||||
*/
|
|
||||||
QString edit_table;
|
QString edit_table;
|
||||||
QLineEdit *edit_endpoint_edit;
|
QLineEdit *edit_endpoint_edit;
|
||||||
QLabel *edit_enginenum_label;
|
QLabel *edit_enginenum_label;
|
||||||
|
|||||||
Reference in New Issue
Block a user