mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-09 16:13:49 +02:00
LICENSES
apis
cae
conf
debian
docs
helpers
icons
importers
ios
lib
rdadmin
rdairplay
rdcartslots
rdcastmanager
rdcatch
Makefile.am
add_recording.cpp
add_recording.h
catchtableview.cpp
catchtableview.h
colors.h
deckmon.cpp
deckmon.h
dowselector.cpp
dowselector.h
edit_cartevent.cpp
edit_cartevent.h
edit_download.cpp
edit_download.h
edit_playout.cpp
edit_playout.h
edit_recording.cpp
edit_recording.h
edit_switchevent.cpp
edit_switchevent.h
edit_upload.cpp
edit_upload.h
eventlight.cpp
eventlight.h
eventwidget.cpp
eventwidget.h
globals.h
list_reports.cpp
list_reports.h
rdcatch.cpp
rdcatch.h
rdcatch.pro
rdcatch_cs.ts
rdcatch_de.ts
rdcatch_es.ts
rdcatch_fr.ts
rdcatch_nb.ts
rdcatch_nn.ts
rdcatch_pt_BR.ts
recordlistmodel.cpp
recordlistmodel.h
vbox.cpp
vbox.h
rdcatchd
rdhpi
rdlibrary
rdlogedit
rdlogin
rdlogmanager
rdmonitor
rdpadd
rdpadengined
rdpanel
rdrepld
rdrssd
rdselect
rdservice
rdvairplayd
ripcd
scripts
systemd
tests
utils
versions
web
xdg
.gitignore
AUTHORS
CODINGSTYLE
ChangeLog
INSTALL
INSTALL-WINDOWS
Makefile.am
NEWS
README
UPGRADING
acinclude.m4
autogen.sh
build_debs.sh.in
configure.ac
configure_build.sh
get_distro.pl
get_target.sh
rivendell.ism
rivendell.pro
rivendell.spec.in
* Cleaned up deprecation warnings for 'QString::sprintf()'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
135 lines
3.4 KiB
C++
135 lines
3.4 KiB
C++
// dowselector.cpp
|
|
//
|
|
// Day of the week selector
|
|
//
|
|
// (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 <QDateTime>
|
|
|
|
#include <rdconf.h>
|
|
#include <rddb.h>
|
|
|
|
#include "dowselector.h"
|
|
|
|
DowSelector::DowSelector(QWidget *parent)
|
|
: RDWidget(parent)
|
|
{
|
|
d_group_box=new QGroupBox(tr("Active Days"),this);
|
|
d_group_box->setFont(labelFont());
|
|
|
|
QDate monday=QDate::currentDate();
|
|
while(monday.dayOfWeek()!=1) {
|
|
monday=monday.addDays(1);
|
|
}
|
|
|
|
for(int i=0;i<7;i++) {
|
|
d_labels[i]=new QLabel(monday.addDays(i).toString("dddd"),this);
|
|
d_labels[i]->setFont(defaultFont());
|
|
d_checks[i]=new QCheckBox(this);
|
|
d_checks[i]->setFont(defaultFont());
|
|
}
|
|
}
|
|
|
|
|
|
QSize DowSelector::sizeHint() const
|
|
{
|
|
return QSize(500,62);
|
|
}
|
|
|
|
|
|
QSizePolicy DowSelector::sizePolicy() const
|
|
{
|
|
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
|
}
|
|
|
|
|
|
bool DowSelector::dayOfWeekEnabled(int dow)
|
|
{
|
|
return d_checks[dow]->isChecked();
|
|
}
|
|
|
|
|
|
void DowSelector::toRecording(unsigned record_id) const
|
|
{
|
|
QString sql=QString("update `RECORDINGS` set ")+
|
|
"`MON`='"+RDYesNo(d_checks[0]->isChecked())+"',"+
|
|
"`TUE`='"+RDYesNo(d_checks[1]->isChecked())+"',"+
|
|
"`WED`='"+RDYesNo(d_checks[2]->isChecked())+"',"+
|
|
"`THU`='"+RDYesNo(d_checks[3]->isChecked())+"',"+
|
|
"`FRI`='"+RDYesNo(d_checks[4]->isChecked())+"',"+
|
|
"`SAT`='"+RDYesNo(d_checks[5]->isChecked())+"',"+
|
|
"`SUN`='"+RDYesNo(d_checks[6]->isChecked())+"' "+
|
|
"where "+
|
|
QString::asprintf("`ID`=%u",record_id);
|
|
RDSqlQuery::apply(sql);
|
|
}
|
|
|
|
|
|
void DowSelector::fromRecording(unsigned record_id)
|
|
{
|
|
QString sql=QString("select ")+
|
|
"`MON`,"+ // 00
|
|
"`TUE`,"+ // 01
|
|
"`WED`,"+ // 02
|
|
"`THU`,"+ // 03
|
|
"`FRI`,"+ // 04
|
|
"`SAT`,"+ // 05
|
|
"`SUN` "+ // 06
|
|
"from `RECORDINGS` where "+
|
|
QString::asprintf("`ID`=%u",record_id);
|
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
|
if(q->first()) {
|
|
for(int i=0;i<7;i++) {
|
|
d_checks[i]->setChecked(q->value(i).toString()=="Y");
|
|
}
|
|
}
|
|
delete q;
|
|
}
|
|
|
|
|
|
void DowSelector::enableDayOfWeek(int dow,bool state)
|
|
{
|
|
d_checks[dow]->setChecked(state);
|
|
}
|
|
|
|
|
|
void DowSelector::resizeEvent(QResizeEvent *e)
|
|
{
|
|
d_group_box->setGeometry(0,0,width(),height());
|
|
|
|
d_checks[0]->setGeometry(10,16,20,20);
|
|
d_labels[0]->setGeometry(30,16,115,20);
|
|
|
|
d_checks[1]->setGeometry(105,16,20,20);
|
|
d_labels[1]->setGeometry(125,16,115,20);
|
|
|
|
d_checks[2]->setGeometry(205,16,20,20);
|
|
d_labels[2]->setGeometry(225,16,115,20);
|
|
|
|
d_checks[3]->setGeometry(325,16,20,20);
|
|
d_labels[3]->setGeometry(345,16,115,20);
|
|
|
|
d_checks[4]->setGeometry(430,16,20,20);
|
|
d_labels[4]->setGeometry(450,16,40,20);
|
|
|
|
d_checks[5]->setGeometry(120,38,20,20);
|
|
d_labels[5]->setGeometry(140,38,60,20);
|
|
|
|
d_checks[6]->setGeometry(290,38,20,20);
|
|
d_labels[6]->setGeometry(310,38,60,20);
|
|
}
|