mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 15:20:29 +01:00
2021-08-12 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDDateTimeEdit' widget. * Adjusted layout in the 'Editing Item' dialog in rdcastmanager(1) to be compatible with short date format. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -22246,3 +22246,7 @@
|
||||
2021-08-12 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Adjusted layout in rdgpimon(1) to be compatible with short date
|
||||
format.
|
||||
2021-08-12 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'RDDateTimeEdit' widget.
|
||||
* Adjusted layout in the 'Editing Item' dialog in
|
||||
rdcastmanager(1) to be compatible with short date format.
|
||||
|
||||
@@ -105,6 +105,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rddatedecode.cpp rddatedecode.h\
|
||||
rddatedialog.cpp rddatedialog.h\
|
||||
rddateedit.cpp rddateedit.h\
|
||||
rddatetimeedit.cpp rddatetimeedit.h\
|
||||
rddatepicker.cpp rddatepicker.h\
|
||||
rddb.h rddb.cpp\
|
||||
rddbheartbeat.cpp rddbheartbeat.h\
|
||||
@@ -323,6 +324,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rddatapacer.cpp\
|
||||
moc_rddatedialog.cpp\
|
||||
moc_rddateedit.cpp\
|
||||
moc_rddatetimeedit.cpp\
|
||||
moc_rddatepicker.cpp\
|
||||
moc_rddbheartbeat.cpp\
|
||||
moc_rddelete.cpp\
|
||||
|
||||
@@ -80,6 +80,7 @@ SOURCES += rddatedecode.cpp
|
||||
SOURCES += rddateedit.cpp
|
||||
SOURCES += rddatepicker.cpp
|
||||
SOURCES += rddatetime.cpp
|
||||
SOURCES += rddatetimeedit.cpp
|
||||
SOURCES += rddb.cpp
|
||||
SOURCES += rddisclookup.cpp
|
||||
SOURCES += rddbheartbeat.cpp
|
||||
@@ -264,6 +265,7 @@ HEADERS += rddatedecode.h
|
||||
HEADERS += rddatedialog.h
|
||||
HEADERS += rddatepicker.h
|
||||
HEADERS += rddatetime.h
|
||||
HEADERS += rddatetimeedit.h
|
||||
HEADERS += rddb.h
|
||||
HEADERS += rddbheartbeat.h
|
||||
HEADERS += rddebug.h
|
||||
|
||||
120
lib/rddatetimeedit.cpp
Normal file
120
lib/rddatetimeedit.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
// rddatetimeedit.cpp
|
||||
//
|
||||
// QDateTimeEdit with date/time-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 <rddatetimeedit.h>
|
||||
|
||||
RDDateTimeEdit::RDDateTimeEdit(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
d_date_edit=new RDDateEdit(this);
|
||||
d_time_edit=new RDTimeEdit(this);
|
||||
}
|
||||
|
||||
|
||||
RDDateTimeEdit::~RDDateTimeEdit()
|
||||
{
|
||||
delete d_time_edit;
|
||||
delete d_date_edit;
|
||||
}
|
||||
|
||||
|
||||
QSize RDDateTimeEdit::sizeHint() const
|
||||
{
|
||||
return QSize(d_date_edit->sizeHint().width()+
|
||||
d_time_edit->sizeHint().width(),
|
||||
d_date_edit->sizeHint().height());
|
||||
}
|
||||
|
||||
|
||||
QSizePolicy RDDateTimeEdit::sizePolicy() const
|
||||
{
|
||||
return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
QDate RDDateTimeEdit::date() const
|
||||
{
|
||||
return d_date_edit->date();
|
||||
}
|
||||
|
||||
|
||||
QDateTime RDDateTimeEdit::dateTime() const
|
||||
{
|
||||
return QDateTime(d_date_edit->date(),d_time_edit->time());
|
||||
}
|
||||
|
||||
|
||||
bool RDDateTimeEdit::isReadOnly()
|
||||
{
|
||||
return d_date_edit->isReadOnly();
|
||||
}
|
||||
|
||||
|
||||
bool RDDateTimeEdit::showTenths() const
|
||||
{
|
||||
return d_time_edit->showTenths();
|
||||
}
|
||||
|
||||
|
||||
QTime RDDateTimeEdit::time() const
|
||||
{
|
||||
return d_time_edit->time();
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::setDate(const QDate &date)
|
||||
{
|
||||
d_date_edit->setDate(date);
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::setDateTime(const QDateTime &dt)
|
||||
{
|
||||
d_date_edit->setDate(dt.date());
|
||||
d_time_edit->setTime(dt.time());
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::setReadOnly(bool state)
|
||||
{
|
||||
d_date_edit->setReadOnly(state);
|
||||
d_time_edit->setReadOnly(state);
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::setShowTenths(bool state)
|
||||
{
|
||||
d_time_edit->setShowTenths(state);
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::setTime(const QTime &time)
|
||||
{
|
||||
d_time_edit->setTime(time);
|
||||
}
|
||||
|
||||
|
||||
void RDDateTimeEdit::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
d_date_edit->setGeometry(0,0,size().width()/2,size().height());
|
||||
d_time_edit->
|
||||
setGeometry(size().width()/2,0,size().width()/2,size().height());
|
||||
}
|
||||
|
||||
57
lib/rddatetimeedit.h
Normal file
57
lib/rddatetimeedit.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// rddatetimeedit.h
|
||||
//
|
||||
// QDateTimeEdit with date/time-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 RDDATETIMEEDIT_H
|
||||
#define RDDATETIMEEDIT_H
|
||||
|
||||
#include <rddateedit.h>
|
||||
#include <rdtimeedit.h>
|
||||
|
||||
class RDDateTimeEdit : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDDateTimeEdit(QWidget *parent=0);
|
||||
~RDDateTimeEdit();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
QDate date() const;
|
||||
QDateTime dateTime() const;
|
||||
bool isReadOnly();
|
||||
bool showTenths() const;
|
||||
QTime time() const;
|
||||
|
||||
public slots:
|
||||
void setDate(const QDate &date);
|
||||
void setDateTime(const QDateTime &dt);
|
||||
void setReadOnly(bool state);
|
||||
void setShowTenths(bool state);
|
||||
void setTime(const QTime &time);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
RDDateEdit *d_date_edit;
|
||||
RDTimeEdit *d_time_edit;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDDATEEDIT_H
|
||||
@@ -132,8 +132,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
|
||||
//
|
||||
// Effective DateTime
|
||||
//
|
||||
cast_item_effective_edit=new QDateTimeEdit(this);
|
||||
cast_item_effective_edit->setDisplayFormat("MM/dd/yyyy hh:mm:ss");
|
||||
cast_item_effective_edit=new RDDateTimeEdit(this);
|
||||
cast_item_effective_label=new QLabel(tr("Air Date/Time:"),this);
|
||||
cast_item_effective_label->setFont(labelFont());
|
||||
cast_item_effective_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
@@ -161,8 +160,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
|
||||
cast_item_expiration_box_label->
|
||||
setEnabled(cast_status!=RDPodcast::StatusExpired);
|
||||
|
||||
cast_item_expiration_edit=new QDateTimeEdit(this);
|
||||
cast_item_expiration_edit->setDisplayFormat("MM/dd/yyyy hh:mm:ss");
|
||||
cast_item_expiration_edit=new RDDateTimeEdit(this);
|
||||
cast_item_expiration_label=new QLabel(tr("at"),this);
|
||||
cast_item_expiration_label->setFont(labelFont());
|
||||
cast_item_expiration_label->setAlignment(Qt::AlignCenter);
|
||||
@@ -286,8 +284,8 @@ void EditCast::effectiveSelectData()
|
||||
QDate date=cast_item_effective_edit->date();
|
||||
|
||||
RDDateDialog *dd=
|
||||
new RDDateDialog(current_date.year(),current_date.year()+10,this);
|
||||
if(dd->exec(&date)==0) {
|
||||
new RDDateDialog(1970,current_date.year()+10,this);
|
||||
if(dd->exec(&date)) {
|
||||
cast_item_effective_edit->setDate(date);
|
||||
}
|
||||
delete dd;
|
||||
@@ -478,8 +476,8 @@ void EditCast::resizeEvent(QResizeEvent *e)
|
||||
// Air Date/Time
|
||||
//
|
||||
cast_item_effective_label->setGeometry(20,h-154,110,20);
|
||||
cast_item_effective_edit->setGeometry(135,h-154,150,20);
|
||||
cast_item_effective_button->setGeometry(295,h-156,75,24);
|
||||
cast_item_effective_edit->setGeometry(135,h-154,200,20);
|
||||
cast_item_effective_button->setGeometry(345,h-156,75,24);
|
||||
|
||||
//
|
||||
// Cast Expiration
|
||||
@@ -488,8 +486,8 @@ void EditCast::resizeEvent(QResizeEvent *e)
|
||||
cast_item_expiration_box->setGeometry(135,h-126,50,20);
|
||||
|
||||
cast_item_expiration_label->setGeometry(190,h-126,20,20);
|
||||
cast_item_expiration_edit->setGeometry(215,h-126,150,20);
|
||||
cast_item_expiration_button->setGeometry(375,h-128,75,24);
|
||||
cast_item_expiration_edit->setGeometry(215,h-126,200,20);
|
||||
cast_item_expiration_button->setGeometry(425,h-128,75,24);
|
||||
|
||||
//
|
||||
// Buttons
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#define EDIT_CAST_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include <rddatetimeedit.h>
|
||||
#include <rddialog.h>
|
||||
#include <rdfeed.h>
|
||||
#include <rdimagepickerbox.h>
|
||||
@@ -79,9 +79,9 @@ class EditCast : public RDDialog
|
||||
QCheckBox *cast_active_check;
|
||||
QLabel *cast_active_label;
|
||||
QPushButton *cast_item_expiration_button;
|
||||
QDateTimeEdit *cast_item_expiration_edit;
|
||||
RDDateTimeEdit *cast_item_expiration_edit;
|
||||
QLabel *cast_item_effective_label;
|
||||
QDateTimeEdit *cast_item_effective_edit;
|
||||
RDDateTimeEdit *cast_item_effective_edit;
|
||||
QPushButton *cast_item_effective_button;
|
||||
QPushButton *cast_ok_button;
|
||||
QPushButton *cast_cancel_button;
|
||||
|
||||
Reference in New Issue
Block a user