mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-17 16:11:12 +02:00
2021-01-26 Fred Gleason <fredg@paravelsystems.com>
* Added 'RDJackClientListModel'. * Refactored the 'Encoder 'Jack Configuration' dialog 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 Jack Client Configuration
|
||||
//
|
||||
// (C) Copyright 2012-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@@ -21,17 +21,19 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <globals.h>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <edit_jack_client.h>
|
||||
#include <rdescape_string.h>
|
||||
|
||||
#include "edit_jack_client.h"
|
||||
|
||||
EditJackClient::EditJackClient(RDStation *station,QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
QString sql;
|
||||
|
||||
edit_station=station;
|
||||
edit_id=0;
|
||||
|
||||
//
|
||||
// Fix the Window Size
|
||||
@@ -93,27 +95,48 @@ QSizePolicy EditJackClient::sizePolicy() const
|
||||
}
|
||||
|
||||
|
||||
int EditJackClient::exec(QString *desc,QString *cmd)
|
||||
int EditJackClient::exec(unsigned id)
|
||||
{
|
||||
edit_description=desc;
|
||||
edit_jack_description_edit->setText(*desc);
|
||||
edit_command_line=cmd;
|
||||
edit_jack_command_line_edit->setText(*cmd);
|
||||
QString sql;
|
||||
RDSqlQuery *q=NULL;
|
||||
|
||||
edit_id=id;
|
||||
|
||||
sql=QString("select ")+
|
||||
"DESCRIPTION," // 00
|
||||
"COMMAND_LINE "+ // 01
|
||||
"from JACK_CLIENTS where "+
|
||||
QString().sprintf("ID=%u",id);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
edit_jack_description_edit->setText(q->value(0).toString());
|
||||
edit_jack_command_line_edit->setText(q->value(1).toString());
|
||||
}
|
||||
delete q;
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void EditJackClient::okData()
|
||||
{
|
||||
*edit_description=edit_jack_description_edit->text();
|
||||
*edit_command_line=edit_jack_command_line_edit->text().trimmed();
|
||||
done(0);
|
||||
QString sql;
|
||||
|
||||
sql=QString("update JACK_CLIENTS set ")+
|
||||
"DESCRIPTION=\""+RDEscapeString(edit_jack_description_edit->text())+"\","+
|
||||
"COMMAND_LINE=\""+
|
||||
RDEscapeString(edit_jack_command_line_edit->text().trimmed())+"\" "+
|
||||
"where "+
|
||||
QString().sprintf("ID=%u",edit_id);
|
||||
RDSqlQuery::apply(sql);
|
||||
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void EditJackClient::cancelData()
|
||||
{
|
||||
done(-1);
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user