mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02: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:
@@ -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
|
Reference in New Issue
Block a user