mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2021-08-03 Fred Gleason <fredg@paravelsystems.com>
* Added 'SYSTEM.LONG_DATE_FORMAT', 'SYSTEM.SHORT_DATE_FORMAT' and 'SYSTEM.TIME_FORMAT' fields to the database. * Incremented the database version to 351. * Added 'RDSystem::longDateFormat()', 'RDSystem'setLongDateFormat()', 'RDSystem::shortDateFormat()', 'RDSystem::setShortDateFormat()', 'RDSystem::timeFormat()' and 'RDSystem::setTimeFormat()' methods. * Added a 'Date/Time Formats' section to the 'System-Wide Settings' dialog in rdadmin(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -123,6 +123,7 @@ dist_rdadmin_SOURCES = add_feed.cpp add_feed.h\
|
||||
rdadmin.cpp rdadmin.h\
|
||||
rename_group.cpp rename_group.h\
|
||||
test_import.cpp test_import.h\
|
||||
test_datetimes.cpp test_datetimes.h\
|
||||
view_adapters.cpp view_adapters.h\
|
||||
view_node_info.cpp view_node_info.h\
|
||||
view_pypad_errors.cpp view_pypad_errors.h
|
||||
@@ -204,6 +205,7 @@ nodist_rdadmin_SOURCES = global_credits.c\
|
||||
moc_rdadmin.cpp\
|
||||
moc_rename_group.cpp\
|
||||
moc_test_import.cpp\
|
||||
moc_test_datetimes.cpp\
|
||||
moc_view_adapters.cpp\
|
||||
moc_view_node_info.cpp\
|
||||
moc_view_pypad_errors.cpp
|
||||
|
@@ -50,6 +50,11 @@ EditSystem::EditSystem(QWidget *parent)
|
||||
edit_encoders_dialog=new ListEncoders(this);
|
||||
edit_station_list_model=new RDStationListModel(true,"",this);
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
edit_test_datetimes_dialog=new TestDatetimes(this);
|
||||
|
||||
//
|
||||
// System Sample Rate
|
||||
//
|
||||
@@ -183,6 +188,45 @@ EditSystem::EditSystem(QWidget *parent)
|
||||
connect(edit_save_button,SIGNAL(clicked()),this,SLOT(saveData()));
|
||||
edit_save_button->hide();
|
||||
|
||||
//
|
||||
// Date/Time Formats
|
||||
//
|
||||
edit_datetime_group=new QGroupBox(tr("Date/Time Formats"),this);
|
||||
edit_datetime_group->setFont(labelFont());
|
||||
|
||||
edit_long_date_label=
|
||||
new QLabel(tr("Long Date Format")+":",edit_datetime_group);
|
||||
edit_long_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
edit_long_date_label->setFont(labelFont());
|
||||
edit_long_date_edit=new QLineEdit(edit_datetime_group);
|
||||
edit_long_date_edit->setFont(defaultFont());
|
||||
edit_long_date_edit->setMaxLength(32);
|
||||
|
||||
edit_short_date_label=
|
||||
new QLabel(tr("Short Date Format")+":",edit_datetime_group);
|
||||
edit_short_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
edit_short_date_label->setFont(labelFont());
|
||||
edit_short_date_edit=new QLineEdit(edit_datetime_group);
|
||||
edit_short_date_edit->setFont(defaultFont());
|
||||
edit_short_date_edit->setMaxLength(32);
|
||||
|
||||
edit_time_label=
|
||||
new QLabel(tr("Time Format")+":",edit_datetime_group);
|
||||
edit_time_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
edit_time_label->setFont(labelFont());
|
||||
edit_time_edit=new QLineEdit(edit_datetime_group);
|
||||
edit_time_edit->setFont(defaultFont());
|
||||
edit_time_edit->setMaxLength(32);
|
||||
|
||||
edit_datetime_test_button=new QPushButton(tr("Test"),edit_datetime_group);
|
||||
connect(edit_datetime_test_button,SIGNAL(clicked()),
|
||||
this,SLOT(datetimeTestData()));
|
||||
|
||||
edit_datetime_defaults_button=
|
||||
new QPushButton(tr("Restore\nDefaults"),edit_datetime_group);
|
||||
connect(edit_datetime_defaults_button,SIGNAL(clicked()),
|
||||
this,SLOT(datetimeDefaultsData()));
|
||||
|
||||
//
|
||||
// Encoders Button
|
||||
//
|
||||
@@ -207,6 +251,9 @@ EditSystem::EditSystem(QWidget *parent)
|
||||
edit_cancel_button->setText(tr("Cancel"));
|
||||
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||
|
||||
//
|
||||
// Load Values
|
||||
//
|
||||
edit_duplicate_carts_box->setChecked(edit_system->allowDuplicateCartTitles());
|
||||
edit_fix_duplicate_carts_box->
|
||||
setChecked(edit_system->fixDuplicateCartTitles());
|
||||
@@ -217,8 +264,9 @@ EditSystem::EditSystem(QWidget *parent)
|
||||
edit_notification_address_edit->
|
||||
setText(edit_system->notificationAddress().toString());
|
||||
edit_show_user_list_box->setChecked(edit_system->showUserList());
|
||||
|
||||
|
||||
edit_long_date_edit->setText(edit_system->longDateFormat());
|
||||
edit_short_date_edit->setText(edit_system->shortDateFormat());
|
||||
edit_time_edit->setText(edit_system->timeFormat());
|
||||
|
||||
QString station=edit_system->rssProcessorStation();
|
||||
for(int i=0;i<edit_rss_processor_box->count();i++) {
|
||||
@@ -246,12 +294,13 @@ EditSystem::~EditSystem()
|
||||
delete edit_duplicate_label;
|
||||
delete edit_duplicate_view;
|
||||
delete edit_duplicate_model;
|
||||
delete edit_test_datetimes_dialog;
|
||||
}
|
||||
|
||||
|
||||
QSize EditSystem::sizeHint() const
|
||||
{
|
||||
return QSize(500,306+y_pos);
|
||||
return QSize(500,406+y_pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -328,6 +377,29 @@ void EditSystem::encodersData()
|
||||
}
|
||||
|
||||
|
||||
void EditSystem::datetimeTestData()
|
||||
{
|
||||
edit_test_datetimes_dialog->exec(edit_long_date_edit->text(),
|
||||
edit_short_date_edit->text(),
|
||||
edit_time_edit->text());
|
||||
}
|
||||
|
||||
|
||||
void EditSystem::datetimeDefaultsData()
|
||||
{
|
||||
if(QMessageBox::warning(this,"RDAdmin - "+tr("Warning"),
|
||||
tr("This will reset all date/time display formats to default values!")+
|
||||
"\n"+
|
||||
tr("Proceed?"),
|
||||
QMessageBox::No,QMessageBox::Yes)!=QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
edit_long_date_edit->setText(RD_DEFAULT_LONG_DATE_FORMAT);
|
||||
edit_short_date_edit->setText(RD_DEFAULT_SHORT_DATE_FORMAT);
|
||||
edit_time_edit->setText(RD_DEFAULT_TIME_FORMAT);
|
||||
}
|
||||
|
||||
|
||||
void EditSystem::okData()
|
||||
{
|
||||
QString sql;
|
||||
@@ -439,14 +511,17 @@ void EditSystem::okData()
|
||||
else {
|
||||
edit_system->setRssProcessorStation(edit_rss_processor_box->currentText());
|
||||
}
|
||||
edit_system->setLongDateFormat(edit_long_date_edit->text());
|
||||
edit_system->setShortDateFormat(edit_short_date_edit->text());
|
||||
edit_system->setTimeFormat(edit_time_edit->text());
|
||||
|
||||
done(0);
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void EditSystem::cancelData()
|
||||
{
|
||||
done(-1);
|
||||
done(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,9 +579,19 @@ void EditSystem::resizeEvent(QResizeEvent *e)
|
||||
edit_rss_processor_label->setGeometry(10,207,235,20);
|
||||
edit_rss_processor_box->setGeometry(250,207,200,20);
|
||||
|
||||
edit_duplicate_hidden_label->setGeometry(15,229,size().width()-30,50);
|
||||
edit_duplicate_view->setGeometry(10,277,size().width()-20,215);
|
||||
edit_save_button->setGeometry(size().width()-85,497,70,25);
|
||||
edit_datetime_group->setGeometry(10,229,size().width()-20,100);
|
||||
edit_datetime_test_button->setGeometry(5,22,80,35);
|
||||
edit_datetime_defaults_button->setGeometry(5,60,80,35);
|
||||
edit_long_date_label->setGeometry(110,27,120,20);
|
||||
edit_long_date_edit->setGeometry(235,27,edit_datetime_group->width()-240,20);
|
||||
edit_short_date_label->setGeometry(110,49,120,20);
|
||||
edit_short_date_edit->setGeometry(235,49,edit_datetime_group->width()-240,20);
|
||||
edit_time_label->setGeometry(110,71,120,20);
|
||||
edit_time_edit->setGeometry(235,71,edit_datetime_group->width()-240,20);
|
||||
|
||||
edit_duplicate_hidden_label->setGeometry(15,329,size().width()-30,50);
|
||||
edit_duplicate_view->setGeometry(10,377,size().width()-20,215);
|
||||
edit_save_button->setGeometry(size().width()-85,597,70,25);
|
||||
|
||||
edit_encoders_button->setGeometry(10,size().height()-60,120,50);
|
||||
edit_ok_button->setGeometry(size().width()-180,size().height()-60,80,50);
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#define EDIT_SYSTEM_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include <rdtableview.h>
|
||||
|
||||
#include "list_encoders.h"
|
||||
#include "test_datetimes.h"
|
||||
|
||||
class EditSystem : public RDDialog
|
||||
{
|
||||
@@ -52,6 +54,8 @@ class EditSystem : public RDDialog
|
||||
void duplicatesCheckedData(bool state);
|
||||
void saveData();
|
||||
void encodersData();
|
||||
void datetimeTestData();
|
||||
void datetimeDefaultsData();
|
||||
void okData();
|
||||
void cancelData();
|
||||
|
||||
@@ -94,6 +98,16 @@ class EditSystem : public RDDialog
|
||||
ListEncoders *edit_encoders_dialog;
|
||||
int y_pos;
|
||||
RDStationListModel *edit_station_list_model;
|
||||
QGroupBox *edit_datetime_group;
|
||||
QLabel *edit_long_date_label;
|
||||
QLineEdit *edit_long_date_edit;
|
||||
QLabel *edit_short_date_label;
|
||||
QLineEdit *edit_short_date_edit;
|
||||
QLabel *edit_time_label;
|
||||
QLineEdit *edit_time_edit;
|
||||
QPushButton *edit_datetime_test_button;
|
||||
QPushButton *edit_datetime_defaults_button;
|
||||
TestDatetimes *edit_test_datetimes_dialog;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -82,6 +82,7 @@ x11 {
|
||||
SOURCES += rdadmin.cpp
|
||||
SOURCES += rename_group.cpp
|
||||
SOURCES += test_import.cpp
|
||||
SOURCES += test_datetimes.cpp
|
||||
SOURCES += view_adapters.cpp
|
||||
SOURCES += view_pypad_errors.cpp
|
||||
SOURCES += xpm_info_banner1.cpp
|
||||
@@ -151,6 +152,7 @@ x11 {
|
||||
HEADERS += rdadmin.h
|
||||
HEADERS += rename_group.h
|
||||
HEADERS += test_import.h
|
||||
HEADERS += test_datetimes.h
|
||||
HEADERS += view_adapters.h
|
||||
HEADERS += view_pypad_errors.h
|
||||
}
|
||||
|
97
rdadmin/test_datetimes.cpp
Normal file
97
rdadmin/test_datetimes.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
// test_datetimes.cpp
|
||||
//
|
||||
// Test Rivendell Date/Time Formats
|
||||
//
|
||||
// (C) Copyright 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
|
||||
// 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 "test_datetimes.h"
|
||||
|
||||
TestDatetimes::TestDatetimes(QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
setWindowTitle("RDAdmin - "+tr("Test Date/Time Formats"));
|
||||
|
||||
d_sample_datetime=QDateTime(QDate(2021,12,28),QTime(14,10,23));
|
||||
|
||||
d_sample_datetime_label_label=new QLabel(tr("Sample Date/Time")+":",this);
|
||||
d_sample_datetime_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
d_sample_datetime_label_label->setFont(labelFont());
|
||||
d_sample_datetime_label=new QLabel(this);
|
||||
d_sample_datetime_label->
|
||||
setText(d_sample_datetime.toString("dddd MMMM d yyyy - h:mm:ss AP"));
|
||||
|
||||
d_long_date_label_label=new QLabel(tr("Long Date")+":",this);
|
||||
d_long_date_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
d_long_date_label_label->setFont(labelFont());
|
||||
d_long_date_label=new QLabel(this);
|
||||
|
||||
d_short_date_label_label=new QLabel(tr("Short Date")+":",this);
|
||||
d_short_date_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
d_short_date_label_label->setFont(labelFont());
|
||||
d_short_date_label=new QLabel(this);
|
||||
|
||||
d_time_label_label=new QLabel(tr("Time")+":",this);
|
||||
d_time_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
d_time_label_label->setFont(labelFont());
|
||||
d_time_label=new QLabel(this);
|
||||
|
||||
d_close_button=new QPushButton(tr("Close"),this);
|
||||
d_close_button->setFont(buttonFont());
|
||||
connect(d_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
}
|
||||
|
||||
|
||||
QSize TestDatetimes::sizeHint() const
|
||||
{
|
||||
return QSize(400,150);
|
||||
}
|
||||
|
||||
|
||||
int TestDatetimes::exec(const QString &long_date_fmt,\
|
||||
const QString &short_date_fmt,
|
||||
const QString &time_fmt)
|
||||
{
|
||||
d_long_date_label->setText(d_sample_datetime.toString(long_date_fmt));
|
||||
d_short_date_label->setText(d_sample_datetime.toString(short_date_fmt));
|
||||
d_time_label->setText(d_sample_datetime.toString(time_fmt));
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void TestDatetimes::closeData()
|
||||
{
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void TestDatetimes::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
d_sample_datetime_label_label->setGeometry(10,2,120,20);
|
||||
d_sample_datetime_label->setGeometry(135,2,size().width()-145,20);
|
||||
|
||||
d_long_date_label_label->setGeometry(10,30,120,20);
|
||||
d_long_date_label->setGeometry(135,30,size().width()-145,20);
|
||||
|
||||
d_short_date_label_label->setGeometry(10,50,120,20);
|
||||
d_short_date_label->setGeometry(135,50,size().width()-145,20);
|
||||
|
||||
d_time_label_label->setGeometry(10,70,120,20);
|
||||
d_time_label->setGeometry(135,70,size().width()-145,20);
|
||||
|
||||
d_close_button->setGeometry(size().width()-90,size().height()-60,80,50);
|
||||
}
|
60
rdadmin/test_datetimes.h
Normal file
60
rdadmin/test_datetimes.h
Normal file
@@ -0,0 +1,60 @@
|
||||
// test_datetimes.h
|
||||
//
|
||||
// Test Rivendell Date/Time Formats
|
||||
//
|
||||
// (C) Copyright 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
|
||||
// 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 TEST_DATETIMES_H
|
||||
#define TEST_DATETIMES_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
|
||||
class TestDatetimes : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestDatetimes(QWidget *parent=0);
|
||||
QSize sizeHint() const;
|
||||
|
||||
public slots:
|
||||
int exec(const QString &long_date_fmt,const QString &short_date_fmt,
|
||||
const QString &time_fmt);
|
||||
|
||||
private slots:
|
||||
void closeData();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
QDateTime d_sample_datetime;
|
||||
QLabel *d_sample_datetime_label;
|
||||
QLabel *d_sample_datetime_label_label;
|
||||
QLabel *d_long_date_label;
|
||||
QLabel *d_long_date_label_label;
|
||||
QLabel *d_short_date_label;
|
||||
QLabel *d_short_date_label_label;
|
||||
QLabel *d_time_label;
|
||||
QLabel *d_time_label_label;
|
||||
QPushButton *d_close_button;
|
||||
};
|
||||
|
||||
|
||||
#endif // TEST_DATETIMES_H
|
Reference in New Issue
Block a user