2021-08-11 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDDateEdit' widget.
	* Adjusted layout in the 'Test Import' dialog in rdadmin(1)
	to be compatible with short date format.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-08-11 17:19:36 -04:00
parent 5f75b9c9c3
commit 7adc95d383
9 changed files with 87 additions and 4 deletions

View File

@ -22227,3 +22227,7 @@
2021-08-11 Fred Gleason <fredg@paravelsystems.com>
* Adjusted layout in the 'Cut Info/Record' dialog in rdlibrary(1)
to be compatible with 12 hour time format.
2021-08-11 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDDateEdit' widget.
* Adjusted layout in the 'Test Import' dialog in rdadmin(1)
to be compatible with short date format.

View File

@ -104,6 +104,7 @@ dist_librd_la_SOURCES = dbversion.h\
rdcut_path.cpp rdcut_path.h\
rddatedecode.cpp rddatedecode.h\
rddatedialog.cpp rddatedialog.h\
rddateedit.cpp rddateedit.h\
rddatepicker.cpp rddatepicker.h\
rddb.h rddb.cpp\
rddbheartbeat.cpp rddbheartbeat.h\
@ -321,6 +322,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
moc_rdcutlistmodel.cpp\
moc_rddatapacer.cpp\
moc_rddatedialog.cpp\
moc_rddateedit.cpp\
moc_rddatepicker.cpp\
moc_rddbheartbeat.cpp\
moc_rddelete.cpp\

View File

@ -77,6 +77,7 @@ SOURCES += rdcut_dialog.cpp
SOURCES += rddatapacer.cpp
SOURCES += rddatedialog.cpp
SOURCES += rddatedecode.cpp
SOURCES += rddateedit.cpp
SOURCES += rddatepicker.cpp
SOURCES += rddatetime.cpp
SOURCES += rddb.cpp
@ -244,6 +245,7 @@ HEADERS += rdcutlistmodel.h
HEADERS += rddatapacer.h
HEADERS += rddiscrecord.h
HEADERS += rddisclookup.h
HEADERS += rddateedit.h
HEADERS += rdcheck_version.h
HEADERS += rdclock.h
HEADERS += rdclockmodel.h

View File

@ -330,12 +330,24 @@ bool RDCoreApplication::showTwelveHourTime() const
}
QString RDCoreApplication::longDateFormat() const
{
return app_long_date_format;
}
QString RDCoreApplication::longDateString(const QDate &date) const
{
return date.toString(app_long_date_format);
}
QString RDCoreApplication::shortDateFormat() const
{
return app_short_date_format;
}
QString RDCoreApplication::shortDateString(const QDate &date) const
{
return date.toString(app_short_date_format);

View File

@ -71,7 +71,9 @@ class RDCoreApplication : public QObject
RDSystem *system();
RDUser *user();
bool showTwelveHourTime() const;
QString longDateFormat() const;
QString longDateString(const QDate &date) const;
QString shortDateFormat() const;
QString shortDateString(const QDate &date) const;
QString timeString(const QTime &time) const;
QString tenthsTimeString(const QTime &time) const;

28
lib/rddateedit.cpp Normal file
View File

@ -0,0 +1,28 @@
// rddateedit.cpp
//
// QDateEdit with date-format awareness
//
// (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 "rdapplication.h"
#include "rddateedit.h"
RDDateEdit::RDDateEdit(QWidget *parent)
: QDateEdit(parent)
{
setDisplayFormat(rda->shortDateFormat());
}

34
lib/rddateedit.h Normal file
View File

@ -0,0 +1,34 @@
// rddateedit.h
//
// QDateEdit with date-format awareness
//
// (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 RDDATEEDIT_H
#define RDDATEEDIT_H
#include <QDateEdit>
class RDDateEdit : public QDateEdit
{
Q_OBJECT
public:
RDDateEdit(QWidget *parent=0);
};
#endif // RDDATEEDIT_H

View File

@ -60,8 +60,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent)
//
// Date Selector
//
test_date_edit=new QDateEdit(this);
test_date_edit->setDisplayFormat("MM/dd/yyyy");
test_date_edit=new RDDateEdit(this);
test_date_label=new QLabel(tr("Test Date:"),this);
test_date_label->setFont(labelFont());
test_date_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);

View File

@ -21,11 +21,11 @@
#ifndef TEST_IMPORT_H
#define TEST_IMPORT_H
#include <QDateTimeEdit>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <rddateedit.h>
#include <rddialog.h>
#include <rdlogimportmodel.h>
#include <rdsvc.h>
@ -54,7 +54,7 @@ class TestImport : public RDDialog
RDSvc *test_svc;
RDSvc::ImportSource test_src;
QLabel *test_date_label;
QDateEdit *test_date_edit;
RDDateEdit *test_date_edit;
QPushButton *test_import_button;
QLabel *test_events_label;
RDTableView *test_events_view;