From e81256bf43b03391c8ecac4722853267c10aaa27 Mon Sep 17 00:00:00 2001
From: Fred Gleason <fredg@paravelsystems.com>
Date: Mon, 7 Oct 2019 16:52:13 -0400
Subject: [PATCH] 2019-10-07 Fred Gleason <fredg@paravelsystems.com> 	*
 Refactored rdcartslots(1) to use the 'RDDialog' and 'RDWidget' 	base
 classes.

---
 ChangeLog                   |  3 +++
 rdairplay/hourselector.cpp  | 14 +++-----------
 rdairplay/hourselector.h    | 12 +++---------
 rdcartslots/rdcartslots.cpp | 36 +++++++-----------------------------
 rdcartslots/rdcartslots.h   | 24 ++++--------------------
 5 files changed, 20 insertions(+), 69 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1c838e3d..62434cd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19184,3 +19184,6 @@
 2019-10-07 Fred Gleason <fredg@paravelsystems.com>
 	* Replaced references to 'helvetica' fonts to use font engine
 	values in 'lib/'.
+2019-10-07 Fred Gleason <fredg@paravelsystems.com>
+	* Refactored rdcartslots(1) to use the 'RDDialog' and 'RDWidget'
+	base classes.
diff --git a/rdairplay/hourselector.cpp b/rdairplay/hourselector.cpp
index d225fc11..0d1e6a61 100644
--- a/rdairplay/hourselector.cpp
+++ b/rdairplay/hourselector.cpp
@@ -2,7 +2,7 @@
 //
 // Hour Selector widget for RDAirPlay
 //
-//   (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com>
+//   (C) Copyright 2012-2019 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
@@ -18,19 +18,11 @@
 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 //
 
-#include <qsignalmapper.h>
-
 #include "hourselector.h"
 
 HourSelector::HourSelector(QWidget *parent)
-  : QWidget(parent)
+  : RDWidget(parent)
 {
-  //
-  // Fonts
-  //
-  QFont font("helvetica",16,QFont::Bold);
-  font.setPixelSize(16);
-
   //
   // Palettes
   //
@@ -44,7 +36,7 @@ HourSelector::HourSelector(QWidget *parent)
   connect(mapper,SIGNAL(mapped(int)),this,SLOT(hourClicked(int)));
   for(unsigned i=0;i<24;i++) {
     hour_button[i]=new QPushButton(this);
-    hour_button[i]->setFont(font);
+    hour_button[i]->setFont(bigButtonFont());
     hour_button[i]->setDisabled(true);
     mapper->setMapping(hour_button[i],i);
     connect(hour_button[i],SIGNAL(clicked()),mapper,SLOT(map()));
diff --git a/rdairplay/hourselector.h b/rdairplay/hourselector.h
index e7726772..40cc7c2d 100644
--- a/rdairplay/hourselector.h
+++ b/rdairplay/hourselector.h
@@ -2,7 +2,7 @@
 //
 // Hour Selector widget for RDAirPlay
 //
-//   (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com>
+//   (C) Copyright 2012-2019 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
@@ -21,16 +21,10 @@
 #ifndef HOURSELECTOR_H
 #define HOURSELECTOR_H
 
-#include <qwidget.h>
-#include <qpushbutton.h>
-#include <qtimer.h>
-
-#include <rdairplay_conf.h>
-#include <rdlistview.h>
-#include <rdlistviewitem.h>
 #include <rdlogplay.h>
+#include <rdwidget.h>
 
-class HourSelector : public QWidget
+class HourSelector : public RDWidget
 {
  Q_OBJECT
  public:
diff --git a/rdcartslots/rdcartslots.cpp b/rdcartslots/rdcartslots.cpp
index fdde06b7..133f9072 100644
--- a/rdcartslots/rdcartslots.cpp
+++ b/rdcartslots/rdcartslots.cpp
@@ -2,7 +2,7 @@
 //
 // A Dedicated Cart Slot Utility for Rivendell.
 //
-//   (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com>
+//   (C) Copyright 2012-2019 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
@@ -18,27 +18,10 @@
 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 //
 
-#include <stdlib.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-#include <qmessagebox.h>
 #include <qapplication.h>
-#include <qwindowsstyle.h>
+#include <qmessagebox.h>
 #include <qtranslator.h>
-#include <qtextcodec.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-//Added by qt3to4:
-#include <QCloseEvent>
-#include <QPaintEvent>
 
-#include <dbversion.h>
-#include <rd.h>
-#include <rdapplication.h>
-#include <rddbheartbeat.h>
 #include <rdescape_string.h>
 
 #include "rdcartslots.h"
@@ -48,18 +31,11 @@
 //
 #include "../icons/rdcartslots-22x22.xpm"
 
-MainWidget::MainWidget(QWidget *parent)
-  : QWidget(parent)
+MainWidget::MainWidget(RDConfig *c,QWidget *parent)
+  : RDWidget(c,parent)
 {
   QString err_msg;
 
-  //
-  // Force a reasonable default font.
-  //
-  QFont mfont("helvetica",12,QFont::Normal);
-  mfont.setPixelSize(12);
-  qApp->setFont(mfont);
-
   //
   // Open the Database
   //
@@ -261,7 +237,9 @@ int main(int argc,char *argv[])
 	     QTextCodec::locale(),".");
   a.installTranslator(&tr);
 
-  MainWidget *w=new MainWidget();
+  RDConfig *config=new RDConfig();
+  config->load();
+  MainWidget *w=new MainWidget(config);
   a.setMainWidget(w);
   w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
   w->show();
diff --git a/rdcartslots/rdcartslots.h b/rdcartslots/rdcartslots.h
index 4d457068..e4f8428b 100644
--- a/rdcartslots/rdcartslots.h
+++ b/rdcartslots/rdcartslots.h
@@ -2,7 +2,7 @@
 //
 // A Dedicated Cart Slot Utility for Rivendell.
 //
-//   (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com>
+//   (C) Copyright 2012-2019 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
@@ -21,24 +21,8 @@
 #ifndef RDCARTSLOTS_H
 #define RDCARTSLOTS_H
 
-#include <vector>
-
-#include <qwidget.h>
-#include <qtimer.h>
-#include <qpixmap.h>
-
-#include <rdstereometer.h>
-#include <rdcae.h>
-#include <rdsystem.h>
-#include <rdmacro.h>
-#include <rdconfig.h>
-#include <rdevent_player.h>
 #include <rdcartslot.h>
-#include <rdcart_dialog.h>
-#include <rdslotdialog.h>
-#include <rdcueeditdialog.h>
-#include <rdlistsvcs.h>
-#include <rdairplay_conf.h>
+#include <rdwidget.h>
 
 //
 // Settings
@@ -47,11 +31,11 @@
 #define METER_INTERVAL 50
 #define RDCARTSLOTS_USAGE "\n"
 
-class MainWidget : public QWidget
+class MainWidget : public RDWidget
 {
   Q_OBJECT
  public:
-  MainWidget(QWidget *parent=0);
+  MainWidget(RDConfig *c,QWidget *parent=0);
   QSize sizeHint() const;
   QSizePolicy sizePolicy() const;