From f5905315eb20878df718240f8ff706d0db539f8f Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 13 Oct 2020 14:41:44 -0400 Subject: [PATCH] 2020-10-13 Fred Gleason * Added an 'ENCODER_PRESETS' table to the database. * Incremented the database verssion to 343. * Added an 'Encoder Profiles' dialog to rdadmin(1). * Removed static content dependencies from the WebGet service. * Refactored the WebGet service to use Encoder Profiles. Signed-off-by: Fred Gleason --- ChangeLog | 9 +- docs/tables/Makefile.am | 1 + docs/tables/encoder_presets.txt | 16 + lib/dbversion.h | 2 +- lib/librd_cs.ts | 66 +++- lib/librd_de.ts | 66 +++- lib/librd_es.ts | 66 +++- lib/librd_fr.ts | 76 +++-- lib/librd_nb.ts | 66 +++- lib/librd_nn.ts | 66 +++- lib/librd_pt_BR.ts | 66 +++- lib/rdexport_settings_dialog.cpp | 301 ++++++++++++++---- lib/rdexport_settings_dialog.h | 72 +++-- lib/rdformpost.cpp | 10 + lib/rdformpost.h | 1 + lib/rdimport_audio.cpp | 4 +- lib/rdsettings.cpp | 145 ++++++++- lib/rdsettings.h | 10 + rdadmin/Makefile.am | 6 +- rdadmin/edit_feed.cpp | 5 +- rdadmin/edit_replicator.cpp | 4 +- .../{edit_settings.cpp => edit_system.cpp} | 47 ++- rdadmin/{edit_settings.h => edit_system.h} | 20 +- rdadmin/list_encoders.cpp | 200 ++++++++++++ rdadmin/list_encoders.h | 66 ++++ rdadmin/rdadmin.cpp | 10 +- rdadmin/rdadmin.pro | 6 +- rdadmin/rdadmin_cs.ts | 216 ++++++++++--- rdadmin/rdadmin_de.ts | 246 ++++++++------ rdadmin/rdadmin_es.ts | 220 +++++++++---- rdadmin/rdadmin_fr.ts | 262 ++++++++------- rdadmin/rdadmin_nb.ts | 246 ++++++++------ rdadmin/rdadmin_nn.ts | 246 ++++++++------ rdadmin/rdadmin_pt_BR.ts | 248 +++++++++------ rdcatch/edit_upload.cpp | 5 +- rdlogedit/render_dialog.cpp | 4 +- utils/rddbmgr/revertschema.cpp | 9 + utils/rddbmgr/schemamap.cpp | 2 +- utils/rddbmgr/updateschema.cpp | 22 ++ web/webget/Makefile.am | 9 - web/webget/webget.cpp | 121 +++++-- web/webget/webget.h | 1 + web/webget/webget.html | 106 ------ web/webget/webget.js | 187 ----------- 44 files changed, 2432 insertions(+), 1125 deletions(-) create mode 100644 docs/tables/encoder_presets.txt rename rdadmin/{edit_settings.cpp => edit_system.cpp} (93%) rename rdadmin/{edit_settings.h => edit_system.h} (88%) create mode 100644 rdadmin/list_encoders.cpp create mode 100644 rdadmin/list_encoders.h delete mode 100644 web/webget/webget.html delete mode 100644 web/webget/webget.js diff --git a/ChangeLog b/ChangeLog index 7dab256a..6182255a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2002-4-28 Fred Gleason +22002-4-28 Fred Gleason * Initial package creation * Created basic structure for Core Audio Engine (ALSA). PW and DC commands work. @@ -20456,6 +20456,11 @@ * Fixed a bug in rdairplay(1) where copying a log event using the 'Copy' button would result in the new event always getting a 'PLAY' transition. - 2020-10-11 Fred Gleason 2020-10-11 Fred Gleason * Fixed gcc(1) format-string warnings in 'lib/rdmulticaster.cpp'. +2020-10-13 Fred Gleason + * Added an 'ENCODER_PRESETS' table to the database. + * Incremented the database verssion to 343. + * Added an 'Encoder Profiles' dialog to rdadmin(1). + * Removed static content dependencies from the WebGet service. + * Refactored the WebGet service to use Encoder Profiles. diff --git a/docs/tables/Makefile.am b/docs/tables/Makefile.am index 87920c8d..8eaf6db7 100644 --- a/docs/tables/Makefile.am +++ b/docs/tables/Makefile.am @@ -40,6 +40,7 @@ EXTRA_DIST = audio_cards.txt\ dropbox_paths.txt\ dropbox_sched_codes.txt\ elr_lines.txt\ + encoder_presets.txt\ event_lines.txt\ event_perms.txt\ events.txt\ diff --git a/docs/tables/encoder_presets.txt b/docs/tables/encoder_presets.txt new file mode 100644 index 00000000..6f6a80ef --- /dev/null +++ b/docs/tables/encoder_presets.txt @@ -0,0 +1,16 @@ + ENCODER_PRESETS Table Layout for Rivendell + +The ENCODER_PRESETS table holds data concerning predefined sets if +encoder settings for subsystems such as WebGet. + +FIELD NAME TYPE REMARKS +--------------------------------------------------------------- +ID int(10) unsigned +NAME varchar(64) Unique +FORMAT int(10) unsigned RDSettings::Format +CHANNELS int(10) unsigned +SAMPLE_RATE int(10) unsigned Samples/sec +BIT_RATE int(10) unsigned Bits/second +QUALITY int(11) unsigned +NORMALIZATION_LEVEL int(11) signed dBFS +AUTOTRIM_LEVEL int(11) signed dBFS diff --git a/lib/dbversion.h b/lib/dbversion.h index 1ea01549..ec877276 100644 --- a/lib/dbversion.h +++ b/lib/dbversion.h @@ -24,7 +24,7 @@ /* * Current Database Version */ -#define RD_VERSION_DATABASE 342 +#define RD_VERSION_DATABASE 343 #endif // DBVERSION_H diff --git a/lib/librd_cs.ts b/lib/librd_cs.ts index ee491986..b48a9352 100644 --- a/lib/librd_cs.ts +++ b/lib/librd_cs.ts @@ -841,6 +841,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1835,23 +1839,23 @@ Přepsat? RDExportSettingsDialog Edit Export Settings - Upravit nastavení uložení v jiném formátu + Upravit nastavení uložení v jiném formátu &Channels: - &Kanály: + &Kanály: &Sample Rate: - &Vzorkovací kmitočet: + &Vzorkovací kmitočet: &Bitrate: - &Datový tok: + &Datový tok: &Quality: - &Kvalita: + &Kvalita: &OK @@ -1981,6 +1985,58 @@ Přepsat? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dbFS + RDGetAth diff --git a/lib/librd_de.ts b/lib/librd_de.ts index e6538792..7f678924 100644 --- a/lib/librd_de.ts +++ b/lib/librd_de.ts @@ -837,6 +837,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1826,23 +1830,23 @@ Overwrite? RDExportSettingsDialog Edit Export Settings - Exporteinstellungen editieren + Exporteinstellungen editieren &Channels: - &Kanäle: + &Kanäle: &Sample Rate: - &Sample Rate: + &Sample Rate: &Bitrate: - &Bitrate: + &Bitrate: &Quality: - &Qualität: + &Qualität: &OK @@ -1972,6 +1976,58 @@ Overwrite? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dBFS + RDGetAth diff --git a/lib/librd_es.ts b/lib/librd_es.ts index 685c5785..f3f568fd 100644 --- a/lib/librd_es.ts +++ b/lib/librd_es.ts @@ -837,6 +837,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1824,23 +1828,23 @@ Overwrite? RDExportSettingsDialog Edit Export Settings - Editar parám. exportación + Editar parám. exportación &Channels: - &Canales: + &Canales: &Sample Rate: - Tasa de &Muestreo: + Tasa de &Muestreo: &Bitrate: - &Tasa de bits: + &Tasa de bits: &Quality: - &Calidad: + &Calidad: &OK @@ -1970,6 +1974,58 @@ Overwrite? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dBFS + RDGetAth diff --git a/lib/librd_fr.ts b/lib/librd_fr.ts index 8df3baaf..3c9cb5f4 100644 --- a/lib/librd_fr.ts +++ b/lib/librd_fr.ts @@ -807,6 +807,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1581,26 +1585,6 @@ Are you sure you want to save? RDExportSettingsDialog - - Edit Export Settings - - - - &Channels: - - - - &Sample Rate: - - - - &Bitrate: - - - - &Quality: - - &OK &OK @@ -1729,6 +1713,58 @@ Are you sure you want to save? PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + + RDGetAth diff --git a/lib/librd_nb.ts b/lib/librd_nb.ts index 406f76ed..44d62f21 100644 --- a/lib/librd_nb.ts +++ b/lib/librd_nb.ts @@ -837,6 +837,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1824,23 +1828,23 @@ Skriv over? RDExportSettingsDialog Edit Export Settings - Rediger eksportinnstillingar + Rediger eksportinnstillingar &Channels: - &Kanalar: + &Kanalar: &Sample Rate: - &Punktprøverate: + &Punktprøverate: &Bitrate: - &Bitrate: + &Bitrate: &Quality: - &Kvalitet: + &Kvalitet: &OK @@ -1970,6 +1974,58 @@ Skriv over? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dBFS + RDGetAth diff --git a/lib/librd_nn.ts b/lib/librd_nn.ts index 406f76ed..44d62f21 100644 --- a/lib/librd_nn.ts +++ b/lib/librd_nn.ts @@ -837,6 +837,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1824,23 +1828,23 @@ Skriv over? RDExportSettingsDialog Edit Export Settings - Rediger eksportinnstillingar + Rediger eksportinnstillingar &Channels: - &Kanalar: + &Kanalar: &Sample Rate: - &Punktprøverate: + &Punktprøverate: &Bitrate: - &Bitrate: + &Bitrate: &Quality: - &Kvalitet: + &Kvalitet: &OK @@ -1970,6 +1974,58 @@ Skriv over? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dBFS + RDGetAth diff --git a/lib/librd_pt_BR.ts b/lib/librd_pt_BR.ts index a77f4081..d7a9faa1 100644 --- a/lib/librd_pt_BR.ts +++ b/lib/librd_pt_BR.ts @@ -837,6 +837,10 @@ whitespace is not permitted in service names + + new profile + + RDAddCart @@ -1830,23 +1834,23 @@ Sobreescrever? RDExportSettingsDialog Edit Export Settings - Editar Configuração de Exportação + Editar Configuração de Exportação &Channels: - &Canais: + &Canais: &Sample Rate: - &Taxa de Amostragem: + &Taxa de Amostragem: &Bitrate: - &Taxa de Bits: + &Taxa de Bits: &Quality: - &Qualidade: + &Qualidade: &OK @@ -1976,6 +1980,58 @@ Sobreescrever? PCM24 PCM24 + + Edit Audio Settings + + + + Name + + + + Format + + + + Channels + + + + Sample Rate + + + + Bitrate + + + + Quality + + + + Duplicate Name + + + + The name + + + + is already in use. + + + + Normalization Level + + + + Autotrim Level + + + + dBFS + dBFS + RDGetAth diff --git a/lib/rdexport_settings_dialog.cpp b/lib/rdexport_settings_dialog.cpp index a8cd73cc..26337f46 100644 --- a/lib/rdexport_settings_dialog.cpp +++ b/lib/rdexport_settings_dialog.cpp @@ -2,7 +2,7 @@ // // Edit Audio Export Settings // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // 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 @@ -18,125 +18,223 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include +#include +#include "rdescape_string.h" #include "rdexport_settings_dialog.h" -RDExportSettingsDialog::RDExportSettingsDialog(RDSettings *settings, +RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, QWidget *parent) : RDDialog(parent) { - lib_settings=settings; + lib_id=0; + lib_caption=caption; + lib_normalization_level_enabled=false; + lib_autotrim_level_enabled=false; // // Dialog Name // - setWindowTitle(tr("Edit Export Settings")); + setMinimumSize(sizeHint()); + setWindowTitle(caption+" - "+tr("Edit Audio Settings")); // - // Default Format + // Name + // + lib_name_edit=new QLineEdit(this); + lib_name_label=new QLabel(lib_name_edit,tr("Name")+":",this); + lib_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_name_label->setFont(labelFont()); + + // + // Format // lib_format_box=new QComboBox(this); - lib_format_box->setGeometry(100,10,150,19); connect(lib_format_box,SIGNAL(activated(const QString &)), this,SLOT(formatData(const QString &))); - QLabel *lib_format_label=new QLabel(lib_format_box,"Format:",this); - lib_format_label->setGeometry(25,10,70,19); + lib_format_label=new QLabel(lib_format_box,tr("Format")+":",this); lib_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_format_label->setFont(labelFont()); // - // Default Channels + // Channels // lib_channels_box=new QComboBox(this); - lib_channels_box->setGeometry(100,32,60,19); - QLabel *lib_channels_label= - new QLabel(lib_channels_box,tr("&Channels:"),this); - lib_channels_label->setGeometry(25,32,70,19); + lib_channels_label= + new QLabel(lib_channels_box,tr("Channels")+":",this); lib_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_channels_label->setFont(labelFont()); // - // Default Sample Rate + // Sample Rate // lib_samprate_box=new QComboBox(this); - lib_samprate_box->setGeometry(100,54,100,19); connect(lib_samprate_box,SIGNAL(activated(const QString &)), this,SLOT(samprateData(const QString &))); - QLabel *lib_samprate_label= - new QLabel(lib_samprate_box,tr("&Sample Rate:"),this); - lib_samprate_label->setGeometry(25,54,75,19); + lib_samprate_label= + new QLabel(lib_samprate_box,tr("Sample Rate")+":",this); lib_samprate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_samprate_label->setFont(labelFont()); // - // Default Bitrate + // Bitrate // lib_bitrate_box=new QComboBox(this); - lib_bitrate_box->setGeometry(100,76,100,19); connect(lib_bitrate_box,SIGNAL(activated(const QString &)), this,SLOT(bitrateData(const QString &))); - lib_bitrate_label=new QLabel(lib_bitrate_box,tr("&Bitrate:"),this); - lib_bitrate_label->setGeometry(25,76,70,19); + lib_bitrate_label=new QLabel(lib_bitrate_box,tr("Bitrate")+":",this); lib_bitrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_bitrate_label->setFont(labelFont()); // // Quality // lib_quality_spin=new QSpinBox(this); - lib_quality_spin->setGeometry(100,98,50,19); lib_quality_spin->setRange(0,10); - lib_quality_label=new QLabel(lib_quality_spin,tr("&Quality:"),this); - lib_quality_label->setGeometry(25,98,70,19); + lib_quality_label=new QLabel(lib_quality_spin,tr("Quality")+":",this); lib_quality_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_quality_label->setFont(labelFont()); + + // + // Normalization Level + // + lib_normalization_level_spin=new QSpinBox(this); + lib_normalization_level_spin->setRange(-100,0); + lib_normalization_level_label= + new QLabel(lib_normalization_level_spin,tr("Normalization Level")+":",this); + lib_normalization_level_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_normalization_level_label->setFont(labelFont()); + lib_normalization_level_label->hide(); + lib_normalization_level_spin->hide(); + lib_normalization_level_unit_label=new QLabel(tr("dBFS"),this); + lib_normalization_level_unit_label-> + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + lib_normalization_level_unit_label->setFont(labelFont()); + lib_normalization_level_label->hide(); + lib_normalization_level_spin->hide(); + lib_normalization_level_unit_label->hide(); + + // + // Autotrim Level + // + lib_autotrim_level_spin=new QSpinBox(this); + lib_autotrim_level_spin->setRange(-100,0); + lib_autotrim_level_label= + new QLabel(lib_autotrim_level_spin,tr("Autotrim Level")+":",this); + lib_autotrim_level_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_autotrim_level_label->setFont(labelFont()); + lib_autotrim_level_label->hide(); + lib_autotrim_level_spin->hide(); + lib_autotrim_level_unit_label=new QLabel(tr("dBFS"),this); + lib_autotrim_level_unit_label-> + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + lib_autotrim_level_unit_label->setFont(labelFont()); + lib_autotrim_level_label->hide(); + lib_autotrim_level_spin->hide(); + lib_autotrim_level_unit_label->hide(); // // Ok Button // - QPushButton *ok_button=new QPushButton(this); - ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); - ok_button->setDefault(true); - ok_button->setFont(buttonFont()); - ok_button->setText(tr("&OK")); - connect(ok_button,SIGNAL(clicked()),this,SLOT(okData())); + lib_ok_button=new QPushButton(this); + lib_ok_button->setDefault(true); + lib_ok_button->setFont(buttonFont()); + lib_ok_button->setText(tr("&OK")); + connect(lib_ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // - QPushButton *cancel_button=new QPushButton(this); - cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60, - 80,50); - cancel_button->setFont(buttonFont()); - cancel_button->setText(tr("&Cancel")); - connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); + lib_cancel_button=new QPushButton(this); + lib_cancel_button->setFont(buttonFont()); + lib_cancel_button->setText(tr("&Cancel")); + connect(lib_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); +} - // - // Populate Fields - // + +RDExportSettingsDialog::~RDExportSettingsDialog() +{ + delete lib_channels_box; + delete lib_samprate_box; + delete lib_bitrate_box; +} + + +QSize RDExportSettingsDialog::sizeHint() const +{ + return QSize(325,180); +} + + +QSizePolicy RDExportSettingsDialog::sizePolicy() const +{ + return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); +} + + +void RDExportSettingsDialog::setShowNormalizationLevel(bool state) +{ + lib_normalization_level_enabled=state; + lib_normalization_level_label->setVisible(state); + lib_normalization_level_spin->setVisible(state); + lib_normalization_level_unit_label->setVisible(state); +} + + +void RDExportSettingsDialog::setShowAutotrimLevel(bool state) +{ + lib_autotrim_level_enabled=state; + lib_autotrim_level_label->setVisible(state); + lib_autotrim_level_spin->setVisible(state); + lib_autotrim_level_unit_label->setVisible(state); +} + + +int RDExportSettingsDialog::exec(RDSettings *s,unsigned id) +{ + lib_settings=s; + lib_id=id; + + lib_format_box->clear(); + lib_channels_box->clear(); + + if(id==0) { + lib_name_label->hide(); + lib_name_edit->hide(); + } + else { + lib_name_label->show(); + lib_name_edit->show(); + lib_name_edit->setText(lib_settings->name()); + } lib_format_box->insertItem(tr("PCM16")); - if(settings->format()==RDSettings::Pcm16) { + if(lib_settings->format()==RDSettings::Pcm16) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } lib_format_box->insertItem(tr("PCM24")); - if(settings->format()==RDSettings::Pcm24) { + if(lib_settings->format()==RDSettings::Pcm24) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } if(rda->station()->haveCapability(RDStation::HaveFlac)) { lib_format_box->insertItem(tr("FLAC")); - if(settings->format()==RDSettings::Flac) { + if(lib_settings->format()==RDSettings::Flac) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } } lib_format_box->insertItem(tr("MPEG Layer 2")); - if(settings->format()==RDSettings::MpegL2) { + if(lib_settings->format()==RDSettings::MpegL2) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } if(rda->station()->haveCapability(RDStation::HaveLame)) { lib_format_box->insertItem(tr("MPEG Layer 3")); - if(settings->format()==RDSettings::MpegL3) { + if(lib_settings->format()==RDSettings::MpegL3) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } } if(rda->station()->haveCapability(RDStation::HaveOggenc)) { lib_format_box->insertItem(tr("OggVorbis")); - if(settings->format()==RDSettings::OggVorbis) { + if(lib_settings->format()==RDSettings::OggVorbis) { lib_format_box->setCurrentItem(lib_format_box->count()-1); } } @@ -156,26 +254,27 @@ RDExportSettingsDialog::RDExportSettingsDialog(RDSettings *settings, } ShowBitRates(lib_settings->format(),lib_settings->sampleRate(), lib_settings->bitRate(),lib_settings->quality()); -} + lib_normalization_level_spin->setValue(lib_settings->normalizationLevel()); + lib_autotrim_level_spin->setValue(lib_settings->autotrimLevel()); -RDExportSettingsDialog::~RDExportSettingsDialog() -{ - delete lib_channels_box; - delete lib_samprate_box; - delete lib_bitrate_box; -} + if(id==0) { + setMinimumHeight(sizeHint().height()); + setMaximumHeight(sizeHint().height()); + } + else { + int height=sizeHint().height()+22; + if(lib_normalization_level_enabled) { + height+=22; + } + if(lib_autotrim_level_enabled) { + height+=22; + } + setMinimumHeight(height); + setMaximumHeight(height); + } - -QSize RDExportSettingsDialog::sizeHint() const -{ - return QSize(275,190); -} - - -QSizePolicy RDExportSettingsDialog::sizePolicy() const -{ - return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + return RDDialog::exec(); } @@ -210,8 +309,27 @@ void RDExportSettingsDialog::bitrateData(const QString &str) void RDExportSettingsDialog::okData() { + QString sql; + RDSqlQuery *q=NULL; unsigned rate=0; + if(lib_id>0) { + sql=QString("select ")+ + "ID "+ // 00 + "from ENCODER_PRESETS where "+ + "NAME=\""+RDEscapeString(lib_name_edit->text())+"\" && "+ + QString().sprintf("ID!=%u",lib_id); + q=new RDSqlQuery(sql); + if(q->first()) { + QMessageBox::information(this,lib_caption+" - "+tr("Duplicate Name"), + tr("The name")+" \""+lib_name_edit->text()+"\" "+ + tr("is already in use.")); + delete q; + return; + } + delete q; + lib_settings->setName(lib_name_edit->text()); + } lib_settings->setFormat(GetFormat(lib_format_box->currentText())); lib_settings->setChannels(lib_channels_box->currentItem()+1); lib_settings->setSampleRate(lib_samprate_box->currentText().toInt()); @@ -251,13 +369,61 @@ void RDExportSettingsDialog::okData() lib_settings->setQuality(lib_quality_spin->value()); break; } - done(0); + lib_settings->setNormalizationLevel(lib_normalization_level_spin->value()); + lib_settings->setAutotrimLevel(lib_autotrim_level_spin->value()); + + done(true); } void RDExportSettingsDialog::cancelData() { - done(1); + done(false); +} + + +void RDExportSettingsDialog::resizeEvent(QResizeEvent *e) +{ + int ypos=2; + + if(lib_id>0) { + lib_name_label->setGeometry(10,ypos,135,19); + lib_name_edit->setGeometry(150,ypos,size().width()-160,19); + ypos+=22; + } + + lib_format_label->setGeometry(10,ypos,135,19); + lib_format_box->setGeometry(150,ypos,150,19); + ypos+=22; + + lib_channels_label->setGeometry(10,ypos,135,19); + lib_channels_box->setGeometry(150,ypos,60,19); + ypos+=22; + + lib_samprate_label->setGeometry(10,ypos,135,19); + lib_samprate_box->setGeometry(150,ypos,100,19); + ypos+=22; + + lib_bitrate_label->setGeometry(10,ypos,135,19); + lib_bitrate_box->setGeometry(150,ypos,100,19); + ypos+=22; + + lib_quality_label->setGeometry(10,ypos,135,19); + lib_quality_spin->setGeometry(150,ypos,50,19); + ypos+=22; + + lib_normalization_level_label->setGeometry(10,ypos,135,19); + lib_normalization_level_spin->setGeometry(150,ypos,50,19); + lib_normalization_level_unit_label->setGeometry(205,ypos,100,19); + ypos+=22; + + lib_autotrim_level_label->setGeometry(10,ypos,135,19); + lib_autotrim_level_spin->setGeometry(150,ypos,50,19); + lib_autotrim_level_unit_label->setGeometry(205,ypos,100,19); + ypos+=22; + + lib_ok_button->setGeometry(size().width()-180,size().height()-60,80,50); + lib_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50); } @@ -272,7 +438,7 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, lib_bitrate_box->clear(); switch(fmt) { case RDSettings::Pcm16: // PCM16 - case RDSettings::Pcm24: // PCM16 + case RDSettings::Pcm24: // PCM24 lib_channels_box->insertItem("1"); lib_channels_box->insertItem("2"); lib_samprate_box->insertItem("32000"); @@ -823,4 +989,3 @@ RDSettings::Format RDExportSettingsDialog::GetFormat(QString str) } return RDSettings::Pcm16; } - diff --git a/lib/rdexport_settings_dialog.h b/lib/rdexport_settings_dialog.h index 8250af55..2d6ea65d 100644 --- a/lib/rdexport_settings_dialog.h +++ b/lib/rdexport_settings_dialog.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -31,31 +32,56 @@ class RDExportSettingsDialog : public RDDialog { Q_OBJECT - public: - RDExportSettingsDialog(RDSettings *settings,QWidget *parent=0); - ~RDExportSettingsDialog(); - QSize sizeHint() const; - QSizePolicy sizePolicy() const; + public: + RDExportSettingsDialog(const QString &caption,QWidget *parent=0); + ~RDExportSettingsDialog(); + QSize sizeHint() const; + QSizePolicy sizePolicy() const; + void setShowNormalizationLevel(bool state); + void setShowAutotrimLevel(bool state); - private slots: - void formatData(const QString &); - void samprateData(const QString &); - void bitrateData(const QString &); - void okData(); - void cancelData(); + public slots: + int exec(RDSettings *s,unsigned id=0); - private: - void ShowBitRates(RDSettings::Format fmt,int samprate,int bitrate,int qual); - void SetCurrentItem(QComboBox *box,int value); - RDSettings::Format GetFormat(QString str); - RDSettings *lib_settings; - QComboBox *lib_format_box; - QComboBox *lib_channels_box; - QLabel *lib_bitrate_label; - QComboBox *lib_bitrate_box; - QComboBox *lib_samprate_box; - QLabel *lib_quality_label; - QSpinBox *lib_quality_spin; + private slots: + void formatData(const QString &); + void samprateData(const QString &); + void bitrateData(const QString &); + void okData(); + void cancelData(); + + protected: + void resizeEvent(QResizeEvent *e); + + private: + void ShowBitRates(RDSettings::Format fmt,int samprate,int bitrate,int qual); + void SetCurrentItem(QComboBox *box,int value); + RDSettings::Format GetFormat(QString str); + RDSettings *lib_settings; + QLabel *lib_name_label; + QLineEdit *lib_name_edit; + unsigned lib_id; + QString lib_caption; + QLabel *lib_format_label; + QComboBox *lib_format_box; + QLabel *lib_channels_label; + QComboBox *lib_channels_box; + QLabel *lib_bitrate_label; + QComboBox *lib_bitrate_box; + bool lib_normalization_level_enabled; + QLabel *lib_normalization_level_label; + QSpinBox *lib_normalization_level_spin; + QLabel *lib_normalization_level_unit_label; + bool lib_autotrim_level_enabled; + QLabel *lib_autotrim_level_label; + QSpinBox *lib_autotrim_level_spin; + QLabel *lib_autotrim_level_unit_label; + QLabel *lib_samprate_label; + QComboBox *lib_samprate_box; + QLabel *lib_quality_label; + QSpinBox *lib_quality_spin; + QPushButton *lib_ok_button; + QPushButton *lib_cancel_button; }; diff --git a/lib/rdformpost.cpp b/lib/rdformpost.cpp index 94013265..269aeb2f 100644 --- a/lib/rdformpost.cpp +++ b/lib/rdformpost.cpp @@ -221,6 +221,16 @@ bool RDFormPost::getValue(const QString &name,long *n,bool *ok) } +bool RDFormPost::getValue(const QString &name,unsigned *n,bool *ok) +{ + if(post_values.count(name)>0) { + *n=post_values.at(name).toUInt(ok); + return true; + } + return false; +} + + bool RDFormPost::getValue(const QString &name,QDateTime *datetime,bool *ok) { QString str; diff --git a/lib/rdformpost.h b/lib/rdformpost.h index 0fcba32f..9b3c9466 100644 --- a/lib/rdformpost.h +++ b/lib/rdformpost.h @@ -48,6 +48,7 @@ class RDFormPost bool getValue(const QString &name,QString *str,bool *ok=NULL); bool getValue(const QString &name,int *n,bool *ok=NULL); bool getValue(const QString &name,long *n,bool *ok=NULL); + bool getValue(const QString &name,unsigned *n,bool *ok=NULL); bool getValue(const QString &name,QDateTime *datetime,bool *ok=NULL); bool getValue(const QString &name,QDate *date,bool *ok=NULL); bool getValue(const QString &name,QTime *time,bool *ok=NULL); diff --git a/lib/rdimport_audio.cpp b/lib/rdimport_audio.cpp index 33fe0a4b..d44c5e14 100644 --- a/lib/rdimport_audio.cpp +++ b/lib/rdimport_audio.cpp @@ -451,8 +451,8 @@ void RDImportAudio::selectOutputFileData() void RDImportAudio::selectOutputFormatData() { RDExportSettingsDialog *dialog= - new RDExportSettingsDialog(import_settings,this); - dialog->exec(); + new RDExportSettingsDialog(import_caption,this); + dialog->exec(import_settings); delete dialog; import_format_edit->setText(import_settings->description()); import_out_filename_edit-> diff --git a/lib/rdsettings.cpp b/lib/rdsettings.cpp index f871b8f5..d317c967 100644 --- a/lib/rdsettings.cpp +++ b/lib/rdsettings.cpp @@ -18,6 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include + #include #include #include @@ -28,6 +30,18 @@ RDSettings::RDSettings() } +QString RDSettings::name() const +{ + return set_name; +} + + +void RDSettings::setName(const QString &str) +{ + set_name=str; +} + + RDSettings::Format RDSettings::format() const { return set_format; @@ -208,6 +222,75 @@ QString RDSettings::description() } +bool RDSettings::loadPreset(unsigned id) +{ + QString sql; + RDSqlQuery *q=NULL; + bool ret=false; + + sql=QString("select ")+ + "NAME,"+ // 00 + "FORMAT,"+ // 01 + "CHANNELS,"+ // 02 + "SAMPLE_RATE,"+ // 03 + "BIT_RATE,"+ // 04 + "QUALITY,"+ // 05 + "NORMALIZATION_LEVEL,"+ // 06 + "AUTOTRIM_LEVEL "+ // 07 + "from ENCODER_PRESETS where "+ + QString().sprintf("ID=%u",id); + q=new RDSqlQuery(sql); + if(q->first()) { + ret=true; + set_name=q->value(0).toString(); + set_format=(RDSettings::Format)q->value(1).toUInt(); + set_channels=q->value(2).toUInt(); + set_sample_rate=q->value(3).toUInt(); + set_bit_rate=q->value(4).toUInt(); + set_quality=q->value(5).toUInt(); + set_normalization_level=q->value(6).toInt(); + set_autotrim_level=q->value(7).toInt(); + } + delete q; + + return ret; +} + + +unsigned RDSettings::addPreset() +{ + QString sql; + + set_name=MakeNewName(); + sql=QString("insert into ENCODER_PRESETS set ")+ + SqlFields(); + return RDSqlQuery::run(sql).toUInt(); +} + + +bool RDSettings::savePreset(unsigned id) const +{ + QString sql; + + sql=QString("update ENCODER_PRESETS set ")+ + SqlFields()+" where "+ + QString().sprintf("ID=%u",id); + + return RDSqlQuery::apply(sql); +} + + +bool RDSettings::deletePreset(unsigned id) const +{ + QString sql; + + sql=QString("delete from ENCODER_PRESETS where ")+ + QString().sprintf("ID=%u",id); + + return RDSqlQuery::apply(sql); +} + + QString RDSettings::pathName(const QString &stationname,QString pathname, RDSettings::Format fmt) { @@ -317,8 +400,30 @@ unsigned RDSettings::bytesPerSec(const QString &stationname, } +QString RDSettings::dump() const +{ + QString ret; + + ret+="RDSettings:\n"; + ret+="name(): "+name()+"\n"; + ret+=QString().sprintf("format(): %u\n",format()); + ret+="formatName(): "+formatName()+"\n"; + ret+=QString().sprintf("channels(): %u\n",channels()); + ret+=QString().sprintf("sampleRate(): %u\n",sampleRate()); + ret+=QString().sprintf("layer(): %u\n",layer()); + ret+=QString().sprintf("bitRate(): %u\n",bitRate()); + ret+=QString().sprintf("quality(): %u\n",quality()); + ret+=QString().sprintf("normalizationLevel(): %d\n",normalizationLevel()); + ret+=QString().sprintf("autotrimLevel(): %d\n",autotrimLevel()); + ret+="Name: "+name()+"\n"; + + return ret; +} + + void RDSettings::clear() { + set_name="["+QObject::tr("new profile")+"]"; set_format=RDSettings::Pcm16; set_format_name=""; set_channels=2; @@ -327,5 +432,43 @@ void RDSettings::clear() set_quality=0; set_normalization_level=0; set_autotrim_level=0; - // set_custom_command_line=""; +} + + +QString RDSettings::SqlFields() const +{ + return QString("NAME=")+"\""+RDEscapeString(set_name)+"\","+ + QString().sprintf("FORMAT=%u,",set_format)+ + QString().sprintf("CHANNELS=%u,",set_channels)+ + QString().sprintf("SAMPLE_RATE=%u,",set_sample_rate)+ + QString().sprintf("BIT_RATE=%u,",set_bit_rate)+ + QString().sprintf("QUALITY=%u,",set_quality)+ + QString().sprintf("NORMALIZATION_LEVEL=%d,",set_normalization_level)+ + QString().sprintf("AUTOTRIM_LEVEL=%d ",set_autotrim_level); +} + + +QString RDSettings::MakeNewName() const +{ + QString sql; + RDSqlQuery *q=NULL; + bool unique=false; + int count=0; + QString ret="["+QObject::tr("new profile")+"]"; + + while(!unique) { + sql=QString("select ")+ + "ID "+ // 00 + "from ENCODER_PRESETS where "+ + "NAME=\""+RDEscapeString(ret)+"\""; + q=new RDSqlQuery(sql); + if(q->first()) { + ret="["+QObject::tr("new profile")+QString().sprintf(" %d]",++count); + } + else { + unique=true; + } + } + + return ret; } diff --git a/lib/rdsettings.h b/lib/rdsettings.h index 22d839aa..ffda5e29 100644 --- a/lib/rdsettings.h +++ b/lib/rdsettings.h @@ -29,6 +29,8 @@ class RDSettings enum Format {Pcm16=0,MpegL1=1,MpegL2=2,MpegL3=3,Flac=4,OggVorbis=5, MpegL2Wav=6,Pcm24=7}; RDSettings(); + QString name() const; + void setName(const QString &str); RDSettings::Format format() const; void setFormat(Format format); QString formatName() const; @@ -48,6 +50,10 @@ class RDSettings int autotrimLevel() const; void setAutotrimLevel(int level); QString description(); + bool loadPreset(unsigned id); + unsigned addPreset(); + bool savePreset(unsigned id) const; + bool deletePreset(unsigned id) const; static QString pathName(const QString &stationname,QString pathname, RDSettings::Format fmt); static QString defaultExtension(RDSettings::Format fmt); @@ -55,9 +61,13 @@ class RDSettings RDSettings::Format fmt); static unsigned bytesPerSec(const QString &stationname, RDSettings::Format fmt,unsigned quality); + QString dump() const; void clear(); private: + QString SqlFields() const; + QString MakeNewName() const; + QString set_name; Format set_format; QString set_format_name; unsigned set_channels; diff --git a/rdadmin/Makefile.am b/rdadmin/Makefile.am index acfca9a8..02badad9 100644 --- a/rdadmin/Makefile.am +++ b/rdadmin/Makefile.am @@ -87,11 +87,11 @@ dist_rdadmin_SOURCES = add_feed.cpp add_feed.h\ edit_report.cpp edit_report.h\ edit_sas_resource.cpp edit_sas_resource.h\ edit_schedcodes.cpp edit_schedcodes.h\ - edit_settings.cpp edit_settings.h\ edit_station.cpp edit_station.h\ edit_superfeed.cpp edit_superfeed.h\ edit_svc.cpp edit_svc.h\ edit_svc_perms.cpp edit_svc_perms.h\ + edit_system.cpp edit_system.h\ edit_ttys.cpp edit_ttys.h\ edit_user.cpp edit_user.h\ edit_user_perms.cpp edit_user_perms.h\ @@ -103,6 +103,7 @@ dist_rdadmin_SOURCES = add_feed.cpp add_feed.h\ info_dialog.cpp info_dialog.h\ license.cpp license.h\ list_dropboxes.cpp list_dropboxes.h\ + list_encoders.cpp list_encoders.h\ list_endpoints.cpp list_endpoints.h\ list_feeds.cpp list_feeds.h\ list_gpis.cpp list_gpis.h\ @@ -170,11 +171,11 @@ nodist_rdadmin_SOURCES = global_credits.c\ moc_edit_report.cpp\ moc_edit_sas_resource.cpp\ moc_edit_schedcodes.cpp\ - moc_edit_settings.cpp\ moc_edit_station.cpp\ moc_edit_superfeed.cpp\ moc_edit_svc.cpp\ moc_edit_svc_perms.cpp\ + moc_edit_system.cpp\ moc_edit_ttys.cpp\ moc_edit_user.cpp\ moc_edit_user_perms.cpp\ @@ -185,6 +186,7 @@ nodist_rdadmin_SOURCES = global_credits.c\ moc_info_dialog.cpp\ moc_license.cpp\ moc_list_dropboxes.cpp\ + moc_list_encoders.cpp\ moc_list_endpoints.cpp\ moc_list_feeds.cpp\ moc_list_gpis.cpp\ diff --git a/rdadmin/edit_feed.cpp b/rdadmin/edit_feed.cpp index 5f78c65b..5f7839b6 100644 --- a/rdadmin/edit_feed.cpp +++ b/rdadmin/edit_feed.cpp @@ -593,9 +593,8 @@ void EditFeed::selectSubfeedsData() void EditFeed::setFormatData() { - RDExportSettingsDialog *dialog= - new RDExportSettingsDialog(&feed_settings,this); - dialog->exec(); + RDExportSettingsDialog *dialog=new RDExportSettingsDialog("RDAdmin",this); + dialog->exec(&feed_settings); delete dialog; feed_format_edit->setText(feed_settings.description()); } diff --git a/rdadmin/edit_replicator.cpp b/rdadmin/edit_replicator.cpp index 601ca17e..0644faf2 100644 --- a/rdadmin/edit_replicator.cpp +++ b/rdadmin/edit_replicator.cpp @@ -274,8 +274,8 @@ QSizePolicy EditReplicator::sizePolicy() const void EditReplicator::setFormatData() { - RDExportSettingsDialog *dialog=new RDExportSettingsDialog(repl_settings,this); - dialog->exec(); + RDExportSettingsDialog *dialog=new RDExportSettingsDialog("RDAdmin",this); + dialog->exec(repl_settings); delete dialog; repl_format_edit->setText(repl_settings->description()); } diff --git a/rdadmin/edit_settings.cpp b/rdadmin/edit_system.cpp similarity index 93% rename from rdadmin/edit_settings.cpp rename to rdadmin/edit_system.cpp index 32a4bc44..0f19959e 100644 --- a/rdadmin/edit_settings.cpp +++ b/rdadmin/edit_system.cpp @@ -1,4 +1,4 @@ -// edit_settings.cpp +// edit_system.cpp // // Edit Rivendell System-Wide Configuration // @@ -27,10 +27,10 @@ #include #include -#include "edit_settings.h" +#include "edit_system.h" #include "globals.h" -EditSettings::EditSettings(QWidget *parent) +EditSystem::EditSystem(QWidget *parent) : RDDialog(parent) { QString sql; @@ -49,6 +49,7 @@ EditSettings::EditSettings(QWidget *parent) setWindowTitle("RDAdmin - "+tr("System-Wide Settings")); edit_system=new RDSystem(); + edit_encoders_dialog=new ListEncoders(this); // // System Sample Rate @@ -191,6 +192,14 @@ EditSettings::EditSettings(QWidget *parent) connect(edit_save_button,SIGNAL(clicked()),this,SLOT(saveData())); edit_save_button->hide(); + // + // Encoders Button + // + edit_encoders_button=new QPushButton(this); + edit_encoders_button->setFont(buttonFont()); + edit_encoders_button->setText(tr("Edit Encoder\nList")); + connect(edit_encoders_button,SIGNAL(clicked()),this,SLOT(encodersData())); + // // Ok Button // @@ -240,35 +249,36 @@ EditSettings::EditSettings(QWidget *parent) } -EditSettings::~EditSettings() +EditSystem::~EditSystem() { delete edit_system; + delete edit_encoders_dialog; delete edit_duplicate_carts_box; delete edit_duplicate_label; delete edit_duplicate_list; } -QSize EditSettings::sizeHint() const +QSize EditSystem::sizeHint() const { return QSize(500,284+y_pos); } -QSizePolicy EditSettings::sizePolicy() const +QSizePolicy EditSystem::sizePolicy() const { return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); } -void EditSettings::duplicatesCheckedData(bool state) +void EditSystem::duplicatesCheckedData(bool state) { edit_fix_duplicate_carts_box->setDisabled(state); edit_fix_duplicate_carts_label->setDisabled(state); } -void EditSettings::saveData() +void EditSystem::saveData() { QString filename=RDGetHomeDir(); filename=QFileDialog::getSaveFileName(this,"RDAdmin - "+tr("Save text file"), @@ -312,7 +322,13 @@ void EditSettings::saveData() } -void EditSettings::okData() +void EditSystem::encodersData() +{ + edit_encoders_dialog->exec(); +} + + +void EditSystem::okData() { QString sql; RDSqlQuery *q; @@ -428,13 +444,13 @@ void EditSettings::okData() } -void EditSettings::cancelData() +void EditSystem::cancelData() { done(-1); } -void EditSettings::BuildDuplicatesList(std::map *dups) +void EditSystem::BuildDuplicatesList(std::map *dups) { QString sql; RDSqlQuery *q; @@ -456,7 +472,7 @@ void EditSettings::BuildDuplicatesList(std::map *dups) } -void EditSettings::resizeEvent(QResizeEvent *e) +void EditSystem::resizeEvent(QResizeEvent *e) { edit_sample_rate_box->setGeometry(250,10,70,20); edit_sample_rate_label->setGeometry(10,10,235,20); @@ -485,10 +501,11 @@ void EditSettings::resizeEvent(QResizeEvent *e) edit_rss_processor_label->setGeometry(10,185,235,20); edit_rss_processor_box->setGeometry(250,185,200,20); - edit_duplicate_hidden_label->setGeometry(15,186,size().width()-30,50); - edit_duplicate_list->setGeometry(10,234,size().width()-20,215); - edit_save_button->setGeometry(size().width()-85,454,70,25); + edit_duplicate_hidden_label->setGeometry(15,207,size().width()-30,50); + edit_duplicate_list->setGeometry(10,255,size().width()-20,215); + edit_save_button->setGeometry(size().width()-85,475,70,25); + edit_encoders_button->setGeometry(10,size().height()-60,120,50); edit_ok_button->setGeometry(size().width()-180,size().height()-60,80,50); edit_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50); } diff --git a/rdadmin/edit_settings.h b/rdadmin/edit_system.h similarity index 88% rename from rdadmin/edit_settings.h rename to rdadmin/edit_system.h index 3dbc7090..715d8e58 100644 --- a/rdadmin/edit_settings.h +++ b/rdadmin/edit_system.h @@ -1,4 +1,4 @@ -// edit_settings.h +// edit_system.h // // Edit Rivendell System-wide Settings. // @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#ifndef EDIT_SETTINGS_H -#define EDIT_SETTINGS_H +#ifndef EDIT_SYSTEM_H +#define EDIT_SYSTEM_H #include @@ -35,12 +35,14 @@ #include #include -class EditSettings : public RDDialog +#include "list_encoders.h" + +class EditSystem : public RDDialog { Q_OBJECT public: - EditSettings(QWidget *parent=0); - ~EditSettings(); + EditSystem(QWidget *parent=0); + ~EditSystem(); QSize sizeHint() const; QSizePolicy sizePolicy() const; @@ -48,6 +50,7 @@ class EditSettings : public RDDialog void BuildDuplicatesList(std::map *dups); void duplicatesCheckedData(bool state); void saveData(); + void encodersData(); void okData(); void cancelData(); @@ -78,13 +81,14 @@ class EditSettings : public RDDialog QLineEdit *edit_notification_address_edit; QLabel *edit_rss_processor_label; QComboBox *edit_rss_processor_box; - QPushButton *edit_settings_button; QPushButton *edit_save_button; + QPushButton *edit_encoders_button; QPushButton *edit_ok_button; QPushButton *edit_cancel_button; RDSystem *edit_system; + ListEncoders *edit_encoders_dialog; int y_pos; }; -#endif // EDIT_SETTINGS_H +#endif // EDIT_SYSTEM_H diff --git a/rdadmin/list_encoders.cpp b/rdadmin/list_encoders.cpp new file mode 100644 index 00000000..34301eeb --- /dev/null +++ b/rdadmin/list_encoders.cpp @@ -0,0 +1,200 @@ +// list_encoders.cpp +// +// List Rivendell Encoder Profiles +// +// (C) Copyright 2020 Fred Gleason +// +// 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 +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#include + +#include + +#include "list_encoders.h" + +ListEncoders::ListEncoders(QWidget *parent) + : RDDialog(parent) +{ + // + // Basic Window Attributes + // + setMinimumSize(sizeHint()); + setWindowTitle("RDAdmin - "+tr("Encoder Profiles")); + + // + // Dialogs + // + c_settings_dialog=new RDExportSettingsDialog("RDAdmin",this); + c_settings_dialog->setShowNormalizationLevel(true); + c_settings_dialog->setShowAutotrimLevel(true); + + c_list_label=new QLabel(tr("Encoder Profiles"),this); + c_list_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + c_list_label->setFont(bigLabelFont()); + + c_list=new RDListView(this); + c_list->setAllColumnsShowFocus(true); + c_list->setItemMargin(5); + + c_list->addColumn("Name"); + c_list->setColumnAlignment(0,Qt::AlignLeft|Qt::AlignVCenter); + connect(c_list, + SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)), + this, + SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int))); + RefreshList(); + + c_add_button=new QPushButton(tr("Add"),this); + c_add_button->setFont(buttonFont()); + connect(c_add_button,SIGNAL(clicked()),this,SLOT(addData())); + + c_edit_button=new QPushButton(tr("Edit"),this); + c_edit_button->setFont(buttonFont()); + connect(c_edit_button,SIGNAL(clicked()),this,SLOT(editData())); + + c_delete_button=new QPushButton(tr("Delete"),this); + c_delete_button->setFont(buttonFont()); + connect(c_delete_button,SIGNAL(clicked()),this,SLOT(deleteData())); + + c_close_button=new QPushButton(tr("Close"),this); + c_close_button->setFont(buttonFont()); + connect(c_close_button,SIGNAL(clicked()),this,SLOT(closeData())); +} + + +ListEncoders::~ListEncoders() +{ + delete c_list; + delete c_list_label; + delete c_settings_dialog; +} + + +QSize ListEncoders::sizeHint() const +{ + return QSize(400,300); +} + + +int ListEncoders::exec() +{ + c_list->clear(); + RefreshList(); + + return RDDialog::exec(); +} + + +void ListEncoders::addData() +{ + unsigned id=0; + RDSettings *s=new RDSettings(); + + if((id=s->addPreset())>0) { + if(c_settings_dialog->exec(s,id)) { + s->savePreset(id); + RDListViewItem *item=new RDListViewItem(c_list); + item->setId(id); + item->setText(0,s->name()); + } + else { + s->deletePreset(id); + } + } + delete s; +} + + +void ListEncoders::editData() +{ + RDListViewItem *item=(RDListViewItem *)c_list->selectedItem(); + if(item!=NULL) { + RDSettings *s=new RDSettings(); + if(s->loadPreset(item->id())) { + if(c_settings_dialog->exec(s,item->id())) { + s->savePreset(item->id()); + item->setText(0,s->name()); + } + } + delete s; + } +} + + +void ListEncoders::deleteData() +{ + RDListViewItem *item=(RDListViewItem *)c_list->selectedItem(); + if(item!=NULL) { + RDSettings *s=new RDSettings(); + if(s->loadPreset(item->id())) { + if(QMessageBox::question(this,"RDAdmin - "+tr("Delete Preset"), + tr("Are you sure that you want to delete preset")+ + "\""+s->name()+"\"?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { + s->deletePreset(item->id()); + delete item; + } + delete s; + } + } +} + + +void ListEncoders::doubleClickedData(Q3ListViewItem *item,const QPoint &pt, + int col) +{ + editData(); +} + + +void ListEncoders::closeData() +{ + done(true); +} + + +void ListEncoders::resizeEvent(QResizeEvent *e) +{ + int w=size().width(); + int h=size().height(); + + c_list_label->setGeometry(10,2,w-20,20); + c_list->setGeometry(10,24,w-20,h-94); + + c_add_button->setGeometry(10,h-60,80,50); + c_edit_button->setGeometry(100,h-60,80,50); + c_delete_button->setGeometry(190,h-60,80,50); + c_close_button->setGeometry(w-90,h-60,80,50); +} + + +void ListEncoders::RefreshList() +{ + QString sql; + RDSqlQuery *q; + RDListViewItem *item; + + c_list->clear(); + sql=QString("select ")+ + "ID,"+ // 00 + "NAME "+ // 01 + "from ENCODER_PRESETS order by NAME"; + q=new RDSqlQuery(sql); + while(q->next()) { + item=new RDListViewItem(c_list); + item->setId(q->value(0).toInt()); + item->setText(0,q->value(1).toString()); + } + delete q; +} diff --git a/rdadmin/list_encoders.h b/rdadmin/list_encoders.h new file mode 100644 index 00000000..3c2ebe86 --- /dev/null +++ b/rdadmin/list_encoders.h @@ -0,0 +1,66 @@ +// list_encoders.h +// +// List Rivendell Encoder Profiles +// +// (C) Copyright 2020 Fred Gleason +// +// 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 +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#ifndef LIST_ENCODERS_H +#define LIST_ENCODERS_H + +#include +#include + +#include +#include +#include + +class ListEncoders : public RDDialog +{ + Q_OBJECT + public: + ListEncoders(QWidget *parent=0); + ~ListEncoders(); + QSize sizeHint() const; + + public slots: + int exec(); + + private slots: + void addData(); + void editData(); + void deleteData(); + void doubleClickedData(Q3ListViewItem *item,const QPoint &pt,int col); + void closeData(); + + protected: + void resizeEvent(QResizeEvent *e); + + private: + void RefreshList(); + QLabel *c_list_label; + RDListView *c_list; + QPushButton *c_add_button; + QPushButton *c_edit_button; + QPushButton *c_delete_button; + QPushButton *c_close_button; + RDExportSettingsDialog *c_settings_dialog; +}; + + +#endif // LIST_ENCODERS_H + + diff --git a/rdadmin/rdadmin.cpp b/rdadmin/rdadmin.cpp index 37ab30a5..f316e2ac 100644 --- a/rdadmin/rdadmin.cpp +++ b/rdadmin/rdadmin.cpp @@ -2,7 +2,7 @@ // // The Administrator Utility for Rivendell. // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // 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 @@ -40,7 +40,7 @@ #include #include -#include "edit_settings.h" +#include "edit_system.h" #include "globals.h" #include "info_dialog.h" #include "list_feeds.h" @@ -306,9 +306,9 @@ void MainWidget::manageStationsData() void MainWidget::systemSettingsData() { - EditSettings *edit_settings=new EditSettings(this); - edit_settings->exec(); - delete edit_settings; + EditSystem *edit_system=new EditSystem(this); + edit_system->exec(); + delete edit_system; } diff --git a/rdadmin/rdadmin.pro b/rdadmin/rdadmin.pro index 57ebff32..5b7e94b4 100644 --- a/rdadmin/rdadmin.pro +++ b/rdadmin/rdadmin.pro @@ -53,10 +53,10 @@ x11 { SOURCES += edit_rdpanel.cpp SOURCES += edit_replicator.cpp SOURCES += edit_report.cpp - SOURCES += edit_settings.cpp SOURCES += edit_station.cpp SOURCES += edit_svc.cpp SOURCES += edit_svc_perms.cpp + SOURCES += edit_system.cpp SOURCES += edit_ttys.cpp SOURCES += edit_user.cpp SOURCES += edit_user_perms.cpp @@ -64,6 +64,7 @@ x11 { SOURCES += info_dialog.cpp SOURCES += license.cpp SOURCES += list_dropboxes.cpp + SOURCES += list_encoders.cpp SOURCES += list_endpoints.cpp SOURCES += list_feeds.cpp SOURCES += list_gpis.cpp @@ -123,10 +124,10 @@ x11 { HEADERS += edit_rdpanel.h HEADERS += edit_replicator.h HEADERS += edit_report.h - HEADERS += edit_settings.h HEADERS += edit_station.h HEADERS += edit_svc.h HEADERS += edit_svc_perms.h + HEADERS += edit_system.h HEADERS += edit_ttys.h HEADERS += edit_user.h HEADERS += edit_user_perms.h @@ -134,6 +135,7 @@ x11 { HEADERS += info_dialog.h HEADERS += license.h HEADERS += list_dropboxes.h + HEADERS += list_encoders.h HEADERS += list_endpoints.h HEADERS += list_feeds.h HEADERS += list_gpis.h diff --git a/rdadmin/rdadmin_cs.ts b/rdadmin/rdadmin_cs.ts index 08a33c51..bf9725d7 100644 --- a/rdadmin/rdadmin_cs.ts +++ b/rdadmin/rdadmin_cs.ts @@ -3715,35 +3715,35 @@ in order to populate the audio resources database. EditSettings System-Wide Settings - Nastavení systému-wide + Nastavení systému-wide System Sample Rate: - Vzorkovací kmitočet systému: + Vzorkovací kmitočet systému: samples/second - vzorky/sekundy + vzorky/sekundy Allow Duplicate Cart Titles - Povolit zdvojené názvy vozíků + Povolit zdvojené názvy vozíků ISCI Cross Reference Path: - Cesta křížového odkazu ISCI: + Cesta křížového odkazu ISCI: Maximum Remote Post Length: - Největší délka vzdáleného vyvěšení: + Největší délka vzdáleného vyvěšení: Mbytes - MiB + MiB The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - Následující zdvojené názvy musí být opraveny před vypnutím Povolit zdvojené hodnoty. + Následující zdvojené názvy musí být opraveny před vypnutím Povolit zdvojené hodnoty. CART @@ -3755,83 +3755,55 @@ in order to populate the audio resources database. &Save List - &Uložit seznam + &Uložit seznam &OK - &OK + &OK &Cancel - Z&rušit + Z&rušit File Exists - Soubor existuje + Soubor existuje The file " - Soubor " + Soubor " " exists. Overwrite? - " existuje. + " existuje. Přepsat? File Error - Chyba v souboru + Chyba v souboru Unable to write file " - Nelze zapsat soubor " + Nelze zapsat soubor " Checking the Library for duplicates. - Přezkušuje se knihovna kvůli zdvojeným názvům. - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - + Přezkušuje se knihovna kvůli zdvojeným názvům. Cart - Vozík + Vozík Title - Název - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - + Název [none] - [žádný] - - - Process RSS Updates On - + [žádný] @@ -4381,6 +4353,126 @@ Custom Z&rušit + + EditSystem + + System-Wide Settings + Nastavení systému-wide + + + System Sample Rate: + Vzorkovací kmitočet systému: + + + samples/second + vzorky/sekundy + + + Allow Duplicate Cart Titles + Povolit zdvojené názvy vozíků + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + Cesta křížového odkazu ISCI: + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + Největší délka vzdáleného vyvěšení: + + + Mbytes + MiB + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + [žádný] + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + Následující zdvojené názvy musí být opraveny před vypnutím Povolit zdvojené hodnoty. + + + Cart + Vozík + + + Title + Název + + + &Save List + &Uložit seznam + + + &OK + &OK + + + &Cancel + Z&rušit + + + Save text file + + + + File Exists + Soubor existuje + + + The file " + Soubor " + + + " exists. + +Overwrite? + " existuje. + +Přepsat? + + + File Error + Chyba v souboru + + + Unable to write file " + Nelze zapsat soubor " + + + Progress + + + + Checking the Library for duplicates. + Přezkušuje se knihovna kvůli zdvojeným názvům. + + + Edit Encoder +List + + + EditTtys @@ -5057,6 +5149,34 @@ Stále ještě jej chcete smazat? Encoders on Kodéry na + + Encoder Profiles + + + + Add + Přidat + + + Edit + Upravit + + + Delete + Smazat + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdadmin/rdadmin_de.ts b/rdadmin/rdadmin_de.ts index 14587025..203d80c2 100644 --- a/rdadmin/rdadmin_de.ts +++ b/rdadmin/rdadmin_de.ts @@ -3535,115 +3535,25 @@ in order to populate the audio resources database. EditSettings - - System-Wide Settings - - - - System Sample Rate: - - - - samples/second - - - - Allow Duplicate Cart Titles - - - - ISCI Cross Reference Path: - - - - Maximum Remote Post Length: - - - - Mbytes - - - - The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - - - - &Save List - - &OK - &OK + &OK &Cancel - Abbre&chen - - - File Exists - - - - The file " - - - - " exists. - -Overwrite? - - - - File Error - - - - Checking the Library for duplicates. - - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - + Abbre&chen Cart - Cart + Cart Title - Titel - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - + Titel [none] - [keine] - - - Process RSS Updates On - + [keine] @@ -4190,6 +4100,124 @@ Custom Abbre&chen + + EditSystem + + System-Wide Settings + + + + System Sample Rate: + + + + samples/second + + + + Allow Duplicate Cart Titles + + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + + + + Mbytes + + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + [keine] + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + + + + Cart + Cart + + + Title + Titel + + + &Save List + + + + &OK + &OK + + + &Cancel + Abbre&chen + + + Save text file + + + + File Exists + + + + The file " + + + + " exists. + +Overwrite? + + + + File Error + + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + + + + Edit Encoder +List + + + EditTtys @@ -4839,6 +4867,34 @@ Do you still want to delete it? Wollen Sie ihn immernoch löschen? + + Encoder Profiles + + + + Add + Hinzufügen + + + Edit + Editieren + + + Delete + Löschen + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdadmin/rdadmin_es.ts b/rdadmin/rdadmin_es.ts index 06d4be91..89a6f51c 100644 --- a/rdadmin/rdadmin_es.ts +++ b/rdadmin/rdadmin_es.ts @@ -3722,35 +3722,35 @@ in order to populate the audio resources database. EditSettings System-Wide Settings - Parámetros de todo el Sistema + Parámetros de todo el Sistema System Sample Rate: - Tasa de Muestreo del Sistema: + Tasa de Muestreo del Sistema: samples/second - muestras/segundo + muestras/segundo Allow Duplicate Cart Titles - Permitir títulos duplicados de cartuchos + Permitir títulos duplicados de cartuchos ISCI Cross Reference Path: - Ubicac. de Ref. Cruzadas ISCI: + Ubicac. de Ref. Cruzadas ISCI: Maximum Remote Post Length: - Long. máx. de posts remotos: + Long. máx. de posts remotos: Mbytes - MBytes + MBytes The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - Los siguientes títulos duplicados deben ser corregidos antes de desactivar la opción respectiva. + Los siguientes títulos duplicados deben ser corregidos antes de desactivar la opción respectiva. CART @@ -3762,83 +3762,47 @@ in order to populate the audio resources database. &Save List - &Guardar lista + &Guardar lista &OK - &Aceptar + &Aceptar &Cancel - &Cancelar + &Cancelar File Exists - El archivo ya existe + El archivo ya existe The file " - El archivo " + El archivo " " exists. Overwrite? - " ya existe. + " ya existe. ¿Sobreescribir? File Error - Error de archivo + Error de archivo Checking the Library for duplicates. - Buscando duplicados en la biblioteca. - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - + Buscando duplicados en la biblioteca. Cart - Cartucho + Cartucho Title - Título - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - - - - [none] - - - - Process RSS Updates On - + Título @@ -4334,6 +4298,126 @@ Custom &Cancelar + + EditSystem + + System-Wide Settings + Parámetros de todo el Sistema + + + System Sample Rate: + Tasa de Muestreo del Sistema: + + + samples/second + muestras/segundo + + + Allow Duplicate Cart Titles + Permitir títulos duplicados de cartuchos + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + Ubicac. de Ref. Cruzadas ISCI: + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + Long. máx. de posts remotos: + + + Mbytes + MBytes + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + Los siguientes títulos duplicados deben ser corregidos antes de desactivar la opción respectiva. + + + Cart + Cartucho + + + Title + Título + + + &Save List + &Guardar lista + + + &OK + &Aceptar + + + &Cancel + &Cancelar + + + Save text file + + + + File Exists + El archivo ya existe + + + The file " + El archivo " + + + " exists. + +Overwrite? + " ya existe. + +¿Sobreescribir? + + + File Error + Error de archivo + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + Buscando duplicados en la biblioteca. + + + Edit Encoder +List + + + EditTtys @@ -5020,6 +5104,34 @@ Do you still want to delete it? Encoders on Codificad. en + + Encoder Profiles + + + + Add + Añadir + + + Edit + Editar + + + Delete + Borrar + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdadmin/rdadmin_fr.ts b/rdadmin/rdadmin_fr.ts index 46414eaf..6bf7fa8a 100644 --- a/rdadmin/rdadmin_fr.ts +++ b/rdadmin/rdadmin_fr.ts @@ -2943,119 +2943,6 @@ in order to populate the audio resources database. - - EditSettings - - System-Wide Settings - - - - System Sample Rate: - - - - samples/second - - - - Allow Duplicate Cart Titles - - - - ISCI Cross Reference Path: - - - - Maximum Remote Post Length: - - - - Mbytes - - - - The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - - - - &Save List - - - - &OK - - - - &Cancel - - - - File Exists - - - - The file " - - - - " exists. - -Overwrite? - - - - File Error - - - - Checking the Library for duplicates. - - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - - - - Cart - - - - Title - - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - - - - [none] - - - - Process RSS Updates On - - - EditStation @@ -3476,6 +3363,124 @@ Custom + + EditSystem + + System-Wide Settings + + + + System Sample Rate: + + + + samples/second + + + + Allow Duplicate Cart Titles + + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + + + + Mbytes + + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + + + + Cart + + + + Title + + + + &Save List + + + + &OK + + + + &Cancel + + + + Save text file + + + + File Exists + + + + The file " + + + + " exists. + +Overwrite? + + + + File Error + + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + + + + Edit Encoder +List + + + EditTtys @@ -3959,6 +3964,37 @@ Permissions + + ListEncoders + + Encoder Profiles + + + + Add + + + + Edit + + + + Delete + + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + + ListEndpoints diff --git a/rdadmin/rdadmin_nb.ts b/rdadmin/rdadmin_nb.ts index b0dbbd30..bc678268 100644 --- a/rdadmin/rdadmin_nb.ts +++ b/rdadmin/rdadmin_nb.ts @@ -3477,115 +3477,25 @@ in order to populate the audio resources database. EditSettings - - System-Wide Settings - - - - System Sample Rate: - - - - samples/second - - - - Allow Duplicate Cart Titles - - - - ISCI Cross Reference Path: - - - - Maximum Remote Post Length: - - - - Mbytes - - - - The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - - - - &Save List - - &OK - &OK + &OK &Cancel - &Avbryt - - - File Exists - - - - The file " - - - - " exists. - -Overwrite? - - - - File Error - - - - Checking the Library for duplicates. - - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - + &Avbryt Cart - Korg + Korg Title - Tittel - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - + Tittel [none] - [ingen] - - - Process RSS Updates On - + [ingen] @@ -4095,6 +4005,124 @@ Custom &Avbryt + + EditSystem + + System-Wide Settings + + + + System Sample Rate: + + + + samples/second + + + + Allow Duplicate Cart Titles + + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + + + + Mbytes + + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + [ingen] + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + + + + Cart + Korg + + + Title + Tittel + + + &Save List + + + + &OK + &OK + + + &Cancel + &Avbryt + + + Save text file + + + + File Exists + + + + The file " + + + + " exists. + +Overwrite? + + + + File Error + + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + + + + Edit Encoder +List + + + EditTtys @@ -4700,6 +4728,34 @@ Klikk på "Lisens"-knappen for fleire opplysningar. [none] [ingen] + + Encoder Profiles + + + + Add + + + + Edit + + + + Delete + + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdadmin/rdadmin_nn.ts b/rdadmin/rdadmin_nn.ts index b0dbbd30..bc678268 100644 --- a/rdadmin/rdadmin_nn.ts +++ b/rdadmin/rdadmin_nn.ts @@ -3477,115 +3477,25 @@ in order to populate the audio resources database. EditSettings - - System-Wide Settings - - - - System Sample Rate: - - - - samples/second - - - - Allow Duplicate Cart Titles - - - - ISCI Cross Reference Path: - - - - Maximum Remote Post Length: - - - - Mbytes - - - - The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - - - - &Save List - - &OK - &OK + &OK &Cancel - &Avbryt - - - File Exists - - - - The file " - - - - " exists. - -Overwrite? - - - - File Error - - - - Checking the Library for duplicates. - - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - + &Avbryt Cart - Korg + Korg Title - Tittel - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - + Tittel [none] - [ingen] - - - Process RSS Updates On - + [ingen] @@ -4095,6 +4005,124 @@ Custom &Avbryt + + EditSystem + + System-Wide Settings + + + + System Sample Rate: + + + + samples/second + + + + Allow Duplicate Cart Titles + + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + + + + Mbytes + + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + [ingen] + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + + + + Cart + Korg + + + Title + Tittel + + + &Save List + + + + &OK + &OK + + + &Cancel + &Avbryt + + + Save text file + + + + File Exists + + + + The file " + + + + " exists. + +Overwrite? + + + + File Error + + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + + + + Edit Encoder +List + + + EditTtys @@ -4700,6 +4728,34 @@ Klikk på "Lisens"-knappen for fleire opplysningar. [none] [ingen] + + Encoder Profiles + + + + Add + + + + Edit + + + + Delete + + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdadmin/rdadmin_pt_BR.ts b/rdadmin/rdadmin_pt_BR.ts index c5db71da..da165d07 100644 --- a/rdadmin/rdadmin_pt_BR.ts +++ b/rdadmin/rdadmin_pt_BR.ts @@ -3526,115 +3526,21 @@ in order to populate the audio resources database. EditSettings - - System-Wide Settings - - - - System Sample Rate: - - - - samples/second - - - - Allow Duplicate Cart Titles - - - - ISCI Cross Reference Path: - - - - Maximum Remote Post Length: - - - - Mbytes - - - - The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. - - - - &Save List - - - - &OK - - &Cancel - &Cancelar - - - File Exists - - - - The file " - - - - " exists. - -Overwrite? - - - - File Error - - - - Checking the Library for duplicates. - - - - Temporary Cart Group: - - - - Auto-Correct Duplicate Cart Titles - - - - Show User List in RDLogin - - - - Unable to write file " - + &Cancelar Cart - Cartão + Cartão Title - Título - - - Multicast Address for Notifications - - - - Save text file - - - - Progress - + Título [none] - [Nenhum] - - - Process RSS Updates On - + [Nenhum] @@ -4174,6 +4080,124 @@ Custom &Cancelar + + EditSystem + + System-Wide Settings + + + + System Sample Rate: + + + + samples/second + + + + Allow Duplicate Cart Titles + + + + Auto-Correct Duplicate Cart Titles + + + + ISCI Cross Reference Path: + + + + Multicast Address for Notifications + + + + Maximum Remote Post Length: + + + + Mbytes + + + + Temporary Cart Group: + + + + Show User List in RDLogin + + + + [none] + [Nenhum] + + + Process RSS Updates On + + + + The following duplicate titles must be corrected before "Allow Duplicate Values" can be turned off. + + + + Cart + Cartão + + + Title + Título + + + &Save List + + + + &OK + + + + &Cancel + &Cancelar + + + Save text file + + + + File Exists + + + + The file " + + + + " exists. + +Overwrite? + + + + File Error + + + + Unable to write file " + + + + Progress + + + + Checking the Library for duplicates. + + + + Edit Encoder +List + + + EditTtys @@ -4823,6 +4847,34 @@ Você ainda quer Deletar? [none] [Nenhum] + + Encoder Profiles + + + + Add + Adicionar + + + Edit + Editar + + + Delete + Deletar + + + Close + + + + Delete Preset + + + + Are you sure that you want to delete preset + + ListEndpoints diff --git a/rdcatch/edit_upload.cpp b/rdcatch/edit_upload.cpp index d4a20172..f60122b4 100644 --- a/rdcatch/edit_upload.cpp +++ b/rdcatch/edit_upload.cpp @@ -483,9 +483,8 @@ void EditUpload::selectCartData() void EditUpload::setFormatData() { - RDExportSettingsDialog *dialog= - new RDExportSettingsDialog(&edit_settings,this); - dialog->exec(); + RDExportSettingsDialog *dialog=new RDExportSettingsDialog("RDCatch",this); + dialog->exec(&edit_settings); delete dialog; edit_format_edit->setText(edit_settings.description()); } diff --git a/rdlogedit/render_dialog.cpp b/rdlogedit/render_dialog.cpp index 31a02182..2d8dac1a 100644 --- a/rdlogedit/render_dialog.cpp +++ b/rdlogedit/render_dialog.cpp @@ -245,8 +245,8 @@ void RenderDialog::starttimeSourceData(int item) void RenderDialog::audiosettingsData() { - RDExportSettingsDialog *d=new RDExportSettingsDialog(render_settings,this); - if(d->exec()==0) { + RDExportSettingsDialog *d=new RDExportSettingsDialog("RDLogEdit",this); + if(d->exec(render_settings)) { render_audiosettings_edit->setText(render_settings->description()); } delete d; diff --git a/utils/rddbmgr/revertschema.cpp b/utils/rddbmgr/revertschema.cpp index 5a8f4e76..b5c89c0f 100644 --- a/utils/rddbmgr/revertschema.cpp +++ b/utils/rddbmgr/revertschema.cpp @@ -40,6 +40,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) // NEW SCHEMA REVERSIONS GO HERE... + // + // Revert 343 + // + if((cur_schema==343)&&(set_schemacur_schema)) { + sql=QString("create table if not exists ENCODER_PRESETS (")+ + "ID int auto_increment not null primary key,"+ + "NAME varchar(64) not null,"+ + "FORMAT int unsigned not null,"+ + "CHANNELS int unsigned not null,"+ + "SAMPLE_RATE int unsigned not null,"+ + "BIT_RATE int unsigned not null,"+ + "QUALITY int unsigned not null,"+ + "NORMALIZATION_LEVEL int not null,"+ + "AUTOTRIM_LEVEL int not null,"+ + "unique index NAME_IDX (NAME))"+ + " charset utf8mb4 collate utf8mb4_general_ci"+ + db_table_create_postfix; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + WriteSchemaVersion(++cur_schema); + } + + // NEW SCHEMA UPDATES GO HERE... diff --git a/web/webget/Makefile.am b/web/webget/Makefile.am index 7de8877b..722417fd 100644 --- a/web/webget/Makefile.am +++ b/web/webget/Makefile.am @@ -27,16 +27,10 @@ moc_%.cpp: %.h install-exec-local: mkdir -p $(DESTDIR)@libexecdir@ - cp webget.html $(DESTDIR)@libexecdir@/ - cp webget.js $(DESTDIR)@libexecdir@/ install-exec-hook: if test -z $(DESTDIR) ; then chown root $(DESTDIR)$(libexecdir)/webget.cgi ; chmod 4755 $(DESTDIR)$(libexecdir)/webget.cgi ; fi -uninstall-local: - rm -f $(DESTDIR)@libexecdir@/webget.html - rm -f $(DESTDIR)@libexecdir@/webget.js - libexec_PROGRAMS = webget.cgi dist_webget_cgi_SOURCES = webget.cpp webget.h @@ -45,9 +39,6 @@ nodist_webget_cgi_SOURCES = moc_webget.cpp webget_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support -EXTRA_DIST = webget.html\ - webget.js - CLEANFILES = *~\ moc_* MAINTAINERCLEANFILES = *~\ diff --git a/web/webget/webget.cpp b/web/webget/webget.cpp index 74070545..8b312143 100644 --- a/web/webget/webget.cpp +++ b/web/webget/webget.cpp @@ -2,7 +2,7 @@ // // Rivendell download utility // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2020 Fred Gleason // // 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 @@ -40,6 +40,7 @@ MainObject::MainObject(QObject *parent) :QObject(parent) { QString err_msg; + webget_post=NULL; // // Open the Database @@ -78,8 +79,12 @@ MainObject::MainObject(QObject *parent) if(getenv("REQUEST_METHOD")==NULL) { XmlExit("missing REQUEST_METHOD",500,"webget.cpp",LINE_NUMBER); } + if(QString(getenv("REQUEST_METHOD")).lower()=="get") { + ServeForm(); + Exit(0); + } if(QString(getenv("REQUEST_METHOD")).lower()!="post") { - XmlExit("invalid web method",500,"webget.cpp",LINE_NUMBER); + XmlExit("invalid web method",400,"webget.cpp",LINE_NUMBER); } if(getenv("REMOTE_ADDR")!=NULL) { webget_remote_address.setAddress(getenv("REMOTE_ADDR")); @@ -124,6 +129,8 @@ MainObject::MainObject(QObject *parent) void MainObject::ripcConnectedData(bool state) { + bool ok=false; + if(!state) { XmlExit("unable to connect to ripc service",500,"webget.cpp",LINE_NUMBER); Exit(0); @@ -134,33 +141,12 @@ void MainObject::ripcConnectedData(bool state) XmlExit("missing \"title\"",400,"webget.cpp",LINE_NUMBER); } - int channels; - if(!webget_post->getValue("channels",&channels)) { - XmlExit("missing \"channels\"",400,"webget.cpp",LINE_NUMBER); + unsigned preset; + if(!webget_post->getValue("preset",&preset,&ok)) { + XmlExit("missing \"preset\"",400,"webget.cpp",LINE_NUMBER); } - - int samprate; - if(!webget_post->getValue("samprate",&samprate)) { - XmlExit("missing \"samprate\"",400,"webget.cpp",LINE_NUMBER); - } - - int format; - if(!webget_post->getValue("format",&format)) { - XmlExit("missing \"format\"",400,"webget.cpp",LINE_NUMBER); - } - - int bitrate=0; - if((format==RDSettings::MpegL2)||(format==RDSettings::MpegL3)) { - if(!webget_post->getValue("bitrate",&bitrate)) { - XmlExit("missing \"bitrate\"",400,"webget.cpp",LINE_NUMBER); - } - } - - int quality=0; - if(format==RDSettings::OggVorbis) { - if(!webget_post->getValue("quality",&quality)) { - XmlExit("missing \"quality\"",400,"webget.cpp",LINE_NUMBER); - } + if(!ok) { + XmlExit("invalid \"preset\" value",400,"webget.cpp",LINE_NUMBER); } unsigned cartnum=0; @@ -189,12 +175,13 @@ void MainObject::ripcConnectedData(bool state) // Audio Settings // RDSettings *settings=new RDSettings(); - settings->setFormat((RDSettings::Format)format); - settings->setChannels(channels); - settings->setSampleRate(samprate); - settings->setBitRate(bitrate); - settings->setQuality(quality); - settings->setNormalizationLevel(-1); + if(!settings->loadPreset(preset)) { + printf("Content-type: text/html\n"); + printf("Status: 400\n"); + printf("\n"); + printf("no such preset!\n"); + Exit(0); + } // // Generate Metadata @@ -303,12 +290,75 @@ void MainObject::ripcConnectedData(bool state) Exit(200); } else { - XmlExit(RDAudioConvert::errorText(conv_err),resp_code,"export.cpp", + XmlExit(RDAudioConvert::errorText(conv_err),resp_code,"webget.cpp", LINE_NUMBER,conv_err); } } +void MainObject::ServeForm() +{ + QString sql; + RDSqlQuery *q=NULL; + + printf("Content-type: text/html\n\n"); + + printf("\n"); + printf(" \n"); + printf(" Rivendell Webget\n"); + printf(" \n"); + printf(" \n"); + printf("
\n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf(" \n"); + printf("
Get audio from Rivendell

Cart Title:
 
Format:\n"); + printf(" \n"); + printf("
 
User Name:
Password:
 
 
\n"); + printf("
\n"); + printf(" \n"); + printf("\n"); +} + + bool MainObject::Authenticate() { QString name; @@ -346,6 +396,7 @@ void MainObject::XmlExit(const QString &str,int code,const QString &srcfile, if(webget_post!=NULL) { delete webget_post; } + #ifdef RDXPORT_DEBUG if(srcline>0) { RDXMLResult(str+" \""+srcfile+"\" "+QString().sprintf("line %d",srcline), diff --git a/web/webget/webget.h b/web/webget/webget.h index 16f2e1a9..e49b0f83 100644 --- a/web/webget/webget.h +++ b/web/webget/webget.h @@ -41,6 +41,7 @@ class MainObject : public QObject void ripcConnectedData(bool state); private: + void ServeForm(); bool Authenticate(); void Exit(int code); void XmlExit(const QString &msg,int code, diff --git a/web/webget/webget.html b/web/webget/webget.html deleted file mode 100644 index 38ca392e..00000000 --- a/web/webget/webget.html +++ /dev/null @@ -1,106 +0,0 @@ - - - Rivendell Webget - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Get audio from Rivendell

Cart Title:
 
Channels: - -
Sample Rate: - -
Format: - -
Bit Rate: - -
Quality: - -
 
User Name:
Password:
 
 
- - -
- - diff --git a/web/webget/webget.js b/web/webget/webget.js deleted file mode 100644 index 96f3e5db..00000000 --- a/web/webget/webget.js +++ /dev/null @@ -1,187 +0,0 @@ -// webget.js -// -// (C) Copyright 2018 Fred Gleason -// -// 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 -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -function Id(id) -{ - return document.getElementById(id); -} - - -function GetMpegVersion(samprate) -{ - mpeg_ver=1.0; - - switch(samprate) { - case 32000: - case 44100: - case 48000: - mpeg_ver=1.0; - break; - - case 16000: - case 22050: - case 24000: - mpeg_ver=2.0; - break; - - case 8000: - case 11025: - case 12000: - mpeg_ver=2.5; - break; - } - return mpeg_ver; -} - - -function SetLayerII() -{ - mpeg_ver=GetMpegVersion(parseInt(Id('samprate').value)); - if(mpeg_ver==1.0) { - if(Id('channels').value=='1') { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } - else { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } - } - if(mpeg_ver==2.0) { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } - if(mpeg_ver==2.5) { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } -} - - -function SetLayerIII() -{ - mpeg_ver=GetMpegVersion(parseInt(Id('samprate').value)); - if(mpeg_ver==1.0) { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } - if(mpeg_ver==2.0) { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } - if(mpeg_ver==2.5) { - Id('bitrate').innerHTML= - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'+ - '\n'; - } -} - - -function samplerateChanged() -{ - if(Id('format').value=='2') { - SetLayerII(); - } - if(Id('format').value=='3') { - SetLayerIII(); - } -} - - -function formatChanged() -{ - Id('bitrate').disabled= - !((Id('format').value=="2")|| - (Id('format').value=="3")); - Id('quality').disabled=Id('format').value!="5"; - samplerateChanged(); -}