From d8f526119e5647481803884ec66cd70314ed7f00 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 26 Jan 2021 20:37:26 -0500 Subject: [PATCH] 2021-01-26 Fred Gleason * Added 'RDTableView' and 'RDTreeView' base viewer classes. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ lib/Makefile.am | 4 ++++ lib/lib.pro | 4 ++++ lib/rdcart_dialog.cpp | 7 +------ lib/rdcart_dialog.h | 4 ++-- lib/rdcut_dialog.cpp | 2 +- lib/rdcut_dialog.h | 6 +++--- lib/rdlist_logs.cpp | 9 ++------- lib/rdlist_logs.h | 6 +++--- lib/rdtableview.cpp | 35 +++++++++++++++++++++++++++++++++ lib/rdtableview.h | 34 ++++++++++++++++++++++++++++++++ lib/rdtreeview.cpp | 29 +++++++++++++++++++++++++++ lib/rdtreeview.h | 34 ++++++++++++++++++++++++++++++++ rdadmin/edit_jack.cpp | 7 +------ rdadmin/edit_jack.h | 4 ++-- rdadmin/list_dropboxes.cpp | 7 +------ rdadmin/list_dropboxes.h | 4 ++-- rdadmin/list_feeds.cpp | 8 +------- rdadmin/list_feeds.h | 4 ++-- rdadmin/list_groups.cpp | 7 +------ rdadmin/list_groups.h | 4 ++-- rdadmin/list_pypads.cpp | 8 +------- rdadmin/list_pypads.h | 4 ++-- rdadmin/list_stations.cpp | 7 +------ rdadmin/list_stations.h | 8 ++------ rdadmin/list_svcs.cpp | 7 +------ rdadmin/list_svcs.h | 4 ++-- rdadmin/list_users.cpp | 7 +------ rdadmin/list_users.h | 4 ++-- rdadmin/test_import.cpp | 10 +--------- rdadmin/test_import.h | 4 ++-- rdairplay/list_logs.cpp | 9 ++------- rdairplay/list_logs.h | 6 +++--- rdairplay/logtableview.cpp | 2 +- rdairplay/logtableview.h | 6 +++--- rdcastmanager/list_casts.cpp | 8 +------- rdcastmanager/list_casts.h | 4 ++-- rdcastmanager/logdialog.cpp | 8 ++------ rdcastmanager/logdialog.h | 8 ++++---- rdcastmanager/rdcastmanager.cpp | 5 +---- rdcastmanager/rdcastmanager.h | 4 ++-- rdlibrary/audio_cart.cpp | 8 ++------ rdlibrary/audio_cart.h | 4 ++-- rdlibrary/libraryview.cpp | 4 ++-- rdlibrary/libraryview.h | 6 +++--- rdlogedit/edit_log.h | 3 +-- rdlogedit/logtableview.cpp | 2 +- rdlogedit/logtableview.h | 6 +++--- rdlogedit/rdlogedit.cpp | 12 ++++------- rdlogedit/rdlogedit.h | 4 ++-- 50 files changed, 222 insertions(+), 171 deletions(-) create mode 100644 lib/rdtableview.cpp create mode 100644 lib/rdtableview.h create mode 100644 lib/rdtreeview.cpp create mode 100644 lib/rdtreeview.h diff --git a/ChangeLog b/ChangeLog index 99b2e4e2..d4818635 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20920,3 +20920,5 @@ * Added 'RDLogImportModel'. * Refactored the 'Test Import' dialog in rdadmin(1) to use the model-based API. +2021-01-26 Fred Gleason + * Added 'RDTableView' and 'RDTreeView' base viewer classes. diff --git a/lib/Makefile.am b/lib/Makefile.am index eaf04769..40dadccd 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -241,6 +241,7 @@ dist_librd_la_SOURCES = dbversion.h\ rdsvc.cpp rdsvc.h\ rdsystem.cpp rdsystem.h\ rdsystemuser.cpp rdsystemuser.h\ + rdtableview.cpp rdtableview.h\ rdtempdirectory.cpp rdtempdirectory.h\ rdtextfile.cpp rdtextfile.h\ rdtextvalidator.cpp rdtextvalidator.h\ @@ -249,6 +250,7 @@ dist_librd_la_SOURCES = dbversion.h\ rdtimeevent.cpp rdtimeevent.h\ rdtransportbutton.cpp rdtransportbutton.h\ rdtransfer.cpp rdtransfer.h\ + rdtreeview.cpp rdtreeview.h\ rdtrimaudio.cpp rdtrimaudio.h\ rdtty.cpp rdtty.h\ rdttydevice.cpp rdttydevice.h\ @@ -372,10 +374,12 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\ moc_rdstationlistmodel.cpp\ moc_rdstereometer.cpp\ moc_rdsvc.cpp\ + moc_rdtableview.cpp\ moc_rdtimeedit.cpp\ moc_rdtimeengine.cpp\ moc_rdtransfer.cpp\ moc_rdtransportbutton.cpp\ + moc_rdtreeview.cpp\ moc_rdtrimaudio.cpp\ moc_rdttydevice.cpp\ moc_rdunixserver.cpp\ diff --git a/lib/lib.pro b/lib/lib.pro index 6e75d3a7..7b459649 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -176,12 +176,14 @@ SOURCES += rdstatus.cpp SOURCES += rdstereometer.cpp SOURCES += rdsvc.cpp SOURCES += rdsystem.cpp +SOURCES += rdtableview.cpp SOURCES += rdtempdirectory.cpp SOURCES += rdtextfile.cpp SOURCES += rdtextvalidator.cpp SOURCES += rdtimeedit.cpp SOURCES += rdtimeengine.cpp SOURCES += rdtransportbutton.cpp +SOURCES += rdtreeview.cpp SOURCES += rdtty.cpp SOURCES += rdttydevice.cpp SOURCES += rdttyout.cpp @@ -338,6 +340,7 @@ HEADERS += rdstatus.h HEADERS += rdstereometer.h HEADERS += rdsvc.h HEADERS += rdsystem.h +HEADERS += rdtableview.h HEADERS += rdtempdirectory.h HEADERS += rdtextfile.h HEADERS += rdtextvalidator.h @@ -345,6 +348,7 @@ HEADERS += rdtimeedit.h HEADERS += rdtimeedit.h HEADERS += rdtimeengine.h HEADERS += rdtransportbutton.h +HEADERS += rdtreeview.h HEADERS += rdtty.h HEADERS += rdttydevice.h HEADERS += rdttyout.h diff --git a/lib/rdcart_dialog.cpp b/lib/rdcart_dialog.cpp index 23e20027..9d086981 100644 --- a/lib/rdcart_dialog.cpp +++ b/lib/rdcart_dialog.cpp @@ -86,12 +86,7 @@ RDCartDialog::RDCartDialog(QString *filter,QString *group,QString *schedcode, // // Cart List // - cart_cart_view=new QTableView(this); - cart_cart_view->setSelectionBehavior(QAbstractItemView::SelectRows); - cart_cart_view->setSelectionMode(QAbstractItemView::SingleSelection); - cart_cart_view->setShowGrid(false); - cart_cart_view->setSortingEnabled(false); - cart_cart_view->setWordWrap(false); + cart_cart_view=new RDTableView(this); cart_cart_model=new RDLibraryModel(this); cart_cart_model->setFont(font()); cart_cart_model->setPalette(palette()); diff --git a/lib/rdcart_dialog.h b/lib/rdcart_dialog.h index 3e010d53..8c6ea44f 100644 --- a/lib/rdcart_dialog.h +++ b/lib/rdcart_dialog.h @@ -27,13 +27,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #define RDCART_DIALOG_STEP_SIZE 1000 @@ -78,7 +78,7 @@ class RDCartDialog : public RDDialog void SaveState(); int *cart_cartnum; RDCartFilter *cart_cart_filter; - QTableView *cart_cart_view; + RDTableView *cart_cart_view; RDLibraryModel *cart_cart_model; QPushButton *cart_ok_button; QPushButton *cart_cancel_button; diff --git a/lib/rdcut_dialog.cpp b/lib/rdcut_dialog.cpp index bc789a76..77016b09 100644 --- a/lib/rdcut_dialog.cpp +++ b/lib/rdcut_dialog.cpp @@ -89,7 +89,7 @@ RDCutDialog::RDCutDialog(QString *filter,QString *group,QString *schedcode, // // Cart List // - cart_cart_view=new QTreeView(this); + cart_cart_view=new RDTreeView(this); cart_cart_view->setSelectionBehavior(QAbstractItemView::SelectRows); cart_cart_view->setSelectionMode(QAbstractItemView::SingleSelection); cart_cart_view->setSortingEnabled(false); diff --git a/lib/rdcut_dialog.h b/lib/rdcut_dialog.h index 3be70ebc..822d06df 100644 --- a/lib/rdcut_dialog.h +++ b/lib/rdcut_dialog.h @@ -27,13 +27,13 @@ #include #include #include -#include #include #include -#include #include +#include #include +#include #define RDCUT_DIALOG_STEP_SIZE 1000 @@ -70,7 +70,7 @@ class RDCutDialog : public RDDialog void SaveState(); QString *cart_cutname; RDCartFilter *cart_cart_filter; - QTreeView *cart_cart_view; + RDTreeView *cart_cart_view; RDLibraryModel *cart_cart_model; QPushButton *cart_ok_button; QPushButton *cart_cancel_button; diff --git a/lib/rdlist_logs.cpp b/lib/rdlist_logs.cpp index f42d4d2f..8a6812ad 100644 --- a/lib/rdlist_logs.cpp +++ b/lib/rdlist_logs.cpp @@ -2,7 +2,7 @@ // // Select a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -44,12 +44,7 @@ RDListLogs::RDListLogs(QString *logname,RDLogFilter::FilterMode mode, // // Log List // - list_log_view=new QTableView(this); - list_log_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_log_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_log_view->setShowGrid(false); - list_log_view->setSortingEnabled(false); - list_log_view->setWordWrap(false); + list_log_view=new RDTableView(this); list_log_model=new RDLogListModel(this); list_log_model->setFont(defaultFont()); list_log_model->setPalette(palette()); diff --git a/lib/rdlist_logs.h b/lib/rdlist_logs.h index 726dec8c..dc304c62 100644 --- a/lib/rdlist_logs.h +++ b/lib/rdlist_logs.h @@ -2,7 +2,7 @@ // // Select a Rivendell Log // -// (C) Copyright 2007-2020 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // The RDListLogs class creates a basic dialog that displays a list of logs // (log name, description, and service) and allows the user to select one. If @@ -27,11 +27,11 @@ #define RDLIST_LOGS_H #include -#include #include #include #include +#include class RDListLogs : public RDDialog { @@ -53,7 +53,7 @@ class RDListLogs : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *list_log_view; + RDTableView *list_log_view; RDLogListModel *list_log_model; QString *list_logname; QPushButton *list_ok_button; diff --git a/lib/rdtableview.cpp b/lib/rdtableview.cpp new file mode 100644 index 00000000..c20c6c56 --- /dev/null +++ b/lib/rdtableview.cpp @@ -0,0 +1,35 @@ +// rdtableview.cpp +// +// QTableView widget with consistent Rivendell defaults +// +// (C) Copyright 2021 Fred Gleason +// +// 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 + +#include "rdtableview.h" + +RDTableView::RDTableView(QWidget *parent) + :QTableView(parent) +{ + setSelectionBehavior(QAbstractItemView::SelectRows); + setSelectionMode(QAbstractItemView::SingleSelection); + setShowGrid(false); + setSortingEnabled(false); + setWordWrap(false); + verticalHeader()->setVisible(false); + horizontalHeader()->setStretchLastSection(true); +} diff --git a/lib/rdtableview.h b/lib/rdtableview.h new file mode 100644 index 00000000..fe1c4fde --- /dev/null +++ b/lib/rdtableview.h @@ -0,0 +1,34 @@ +// rdtableview.h +// +// QTableView widget with consistent Rivendell defaults +// +// (C) Copyright 2021 Fred Gleason +// +// 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 RDTABLEVIEW_H +#define RDTABLEVIEW_H + +#include + +class RDTableView : public QTableView +{ + Q_OBJECT + public: + RDTableView(QWidget *parent=0); +}; + + +#endif // RDTABLEVIEW_H diff --git a/lib/rdtreeview.cpp b/lib/rdtreeview.cpp new file mode 100644 index 00000000..1e65cfbd --- /dev/null +++ b/lib/rdtreeview.cpp @@ -0,0 +1,29 @@ +// rdtreeview.cpp +// +// QTreeView widget with consistent Rivendell defaults +// +// (C) Copyright 2021 Fred Gleason +// +// 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 "rdtreeview.h" + +RDTreeView::RDTreeView(QWidget *parent) + : QTreeView(parent) +{ + setSelectionBehavior(QAbstractItemView::SelectRows); + setSortingEnabled(false); + setWordWrap(false); +} diff --git a/lib/rdtreeview.h b/lib/rdtreeview.h new file mode 100644 index 00000000..2420200e --- /dev/null +++ b/lib/rdtreeview.h @@ -0,0 +1,34 @@ +// rdtreeview.h +// +// QTreeView widget with consistent Rivendell defaults +// +// (C) Copyright 2021 Fred Gleason +// +// 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 RDTREEVIEW_H +#define RDTREEVIEW_H + +#include + +class RDTreeView : public QTreeView +{ + Q_OBJECT + public: + RDTreeView(QWidget *parent=0); +}; + + +#endif // RDTREEVIEW_H diff --git a/rdadmin/edit_jack.cpp b/rdadmin/edit_jack.cpp index 6961c2e1..b1aeb172 100644 --- a/rdadmin/edit_jack.cpp +++ b/rdadmin/edit_jack.cpp @@ -90,12 +90,7 @@ EditJack::EditJack(RDStation *station,QWidget *parent) // // JACK Client List // - edit_jack_client_view=new QTableView(this); - edit_jack_client_view->setSelectionBehavior(QAbstractItemView::SelectRows); - edit_jack_client_view->setSelectionMode(QAbstractItemView::SingleSelection); - edit_jack_client_view->setShowGrid(false); - edit_jack_client_view->setSortingEnabled(false); - edit_jack_client_view->setWordWrap(false); + edit_jack_client_view=new RDTableView(this); edit_jack_client_label= new QLabel(edit_jack_client_view,tr("JACK Clients to Start:"),this); edit_jack_client_label->setFont(labelFont()); diff --git a/rdadmin/edit_jack.h b/rdadmin/edit_jack.h index 0f4b25d4..bca94053 100644 --- a/rdadmin/edit_jack.h +++ b/rdadmin/edit_jack.h @@ -25,13 +25,13 @@ #include #include #include -#include #include #include #include #include #include +#include #define EDITJACK_DEFAULT_SERVERNAME QObject::tr("(default)") @@ -65,7 +65,7 @@ class EditJack : public RDDialog QLabel *edit_jack_audio_ports_label; QSpinBox *edit_jack_audio_ports_spin; QLabel *edit_jack_client_label; - QTableView *edit_jack_client_view; + RDTableView *edit_jack_client_view; RDJackClientListModel *edit_jack_client_model; RDStation *edit_station; QPushButton *edit_add_button; diff --git a/rdadmin/list_dropboxes.cpp b/rdadmin/list_dropboxes.cpp index 7b8e5450..c1ec4304 100644 --- a/rdadmin/list_dropboxes.cpp +++ b/rdadmin/list_dropboxes.cpp @@ -83,12 +83,7 @@ ListDropboxes::ListDropboxes(const QString &stationname,QWidget *parent) // // Dropbox List // - list_dropboxes_view=new QTableView(this); - list_dropboxes_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_dropboxes_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_dropboxes_view->setShowGrid(false); - list_dropboxes_view->setSortingEnabled(false); - list_dropboxes_view->setWordWrap(false); + list_dropboxes_view=new RDTableView(this); list_dropboxes_model=new RDDropboxListModel(stationname,this); list_dropboxes_model->setFont(defaultFont()); list_dropboxes_model->setPalette(palette()); diff --git a/rdadmin/list_dropboxes.h b/rdadmin/list_dropboxes.h index 4039cc48..1f87249e 100644 --- a/rdadmin/list_dropboxes.h +++ b/rdadmin/list_dropboxes.h @@ -22,11 +22,11 @@ #define LIST_DROPBOXES_H #include -#include #include #include #include +#include class ListDropboxes : public RDDialog { @@ -49,7 +49,7 @@ class ListDropboxes : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *list_dropboxes_view; + RDTableView *list_dropboxes_view; RDDropboxListModel *list_dropboxes_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_feeds.cpp b/rdadmin/list_feeds.cpp index 092871f8..7ad490d8 100644 --- a/rdadmin/list_feeds.cpp +++ b/rdadmin/list_feeds.cpp @@ -100,13 +100,7 @@ ListFeeds::ListFeeds(QWidget *parent) // // Feed List // - list_feeds_view=new QTableView(this); - list_feeds_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_feeds_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_feeds_view->setShowGrid(false); - list_feeds_view->setSortingEnabled(false); - list_feeds_view->setSortingEnabled(false); - list_feeds_view->setWordWrap(false); + list_feeds_view=new RDTableView(this); list_feeds_model=new RDFeedListModel(true,this); list_feeds_model->setFont(font()); list_feeds_model->setPalette(palette()); diff --git a/rdadmin/list_feeds.h b/rdadmin/list_feeds.h index f748a433..a48a3623 100644 --- a/rdadmin/list_feeds.h +++ b/rdadmin/list_feeds.h @@ -22,11 +22,11 @@ #define LIST_FEEDS_H #include -#include #include #include #include +#include class ListFeeds : public RDDialog { @@ -52,7 +52,7 @@ class ListFeeds : public RDDialog private: QLabel *list_box_label; - QTableView *list_feeds_view; + RDTableView *list_feeds_view; RDFeedListModel *list_feeds_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_groups.cpp b/rdadmin/list_groups.cpp index 333bd3ee..34fd6f9f 100644 --- a/rdadmin/list_groups.cpp +++ b/rdadmin/list_groups.cpp @@ -97,12 +97,7 @@ ListGroups::ListGroups(QWidget *parent) // // Group List // - list_groups_view=new QTableView(this); - list_groups_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_groups_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_groups_view->setShowGrid(false); - list_groups_view->setSortingEnabled(false); - list_groups_view->setWordWrap(false); + list_groups_view=new RDTableView(this); list_groups_model=new RDGroupListModel(false,true,this); list_groups_model->setFont(defaultFont()); list_groups_model->setPalette(palette()); diff --git a/rdadmin/list_groups.h b/rdadmin/list_groups.h index 2e83c0a7..c1c8219f 100644 --- a/rdadmin/list_groups.h +++ b/rdadmin/list_groups.h @@ -22,11 +22,11 @@ #define LIST_GROUPS_H #include -#include #include #include #include +#include class ListGroups : public RDDialog { @@ -52,7 +52,7 @@ class ListGroups : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *list_groups_view; + RDTableView *list_groups_view; RDGroupListModel *list_groups_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_pypads.cpp b/rdadmin/list_pypads.cpp index 98ad1124..41d5de81 100644 --- a/rdadmin/list_pypads.cpp +++ b/rdadmin/list_pypads.cpp @@ -50,13 +50,7 @@ ListPypads::ListPypads(RDStation *station,QWidget *parent) // // Instances List Box // - list_list_view=new QTableView(this); - list_list_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_list_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_list_view->setShowGrid(false); - list_list_view->setSortingEnabled(false); - list_list_view->setWordWrap(false); - list_list_view->verticalHeader()->setVisible(false); + list_list_view=new RDTableView(this); list_list_model=new RDPypadListModel(station->name(),this); list_list_view->setModel(list_list_model); connect(list_list_view,SIGNAL(doubleClicked(const QModelIndex &)), diff --git a/rdadmin/list_pypads.h b/rdadmin/list_pypads.h index a0cb1a72..a4bf2ab2 100644 --- a/rdadmin/list_pypads.h +++ b/rdadmin/list_pypads.h @@ -22,12 +22,12 @@ #define LIST_PYPADS_H #include -#include #include #include #include #include +#include class ListPypads : public RDDialog { @@ -49,7 +49,7 @@ class ListPypads : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *list_list_view; + RDTableView *list_list_view; RDPypadListModel *list_list_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_stations.cpp b/rdadmin/list_stations.cpp index 3d00b054..072d6c38 100644 --- a/rdadmin/list_stations.cpp +++ b/rdadmin/list_stations.cpp @@ -74,15 +74,10 @@ ListStations::ListStations(QWidget *parent) // // Station List Box // - list_stations_view=new QTableView(this); + list_stations_view=new RDTableView(this); list_title_label=new QLabel(list_stations_view,tr("H&osts:"),this); list_title_label->setFont(labelFont()); list_title_label->setGeometry(14,11,85,19); - list_stations_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_stations_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_stations_view->setShowGrid(false); - list_stations_view->setSortingEnabled(false); - list_stations_view->setWordWrap(false); list_stations_model=new RDStationListModel(false,"",this); list_stations_model->setFont(defaultFont()); list_stations_model->setPalette(palette()); diff --git a/rdadmin/list_stations.h b/rdadmin/list_stations.h index 46ba9639..e21506e5 100644 --- a/rdadmin/list_stations.h +++ b/rdadmin/list_stations.h @@ -21,14 +21,12 @@ #ifndef LIST_STATIONS_H #define LIST_STATIONS_H -//#include - #include #include -#include #include #include +#include class ListStations : public RDDialog { @@ -50,10 +48,8 @@ class ListStations : public RDDialog void resizeEvent(QResizeEvent *e); private: - // void RefreshList(QString stationname=""); QLabel *list_title_label; - // Q3ListBox *list_box; - QTableView *list_stations_view; + RDTableView *list_stations_view; RDStationListModel *list_stations_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_svcs.cpp b/rdadmin/list_svcs.cpp index 2044ad31..2355a87b 100644 --- a/rdadmin/list_svcs.cpp +++ b/rdadmin/list_svcs.cpp @@ -80,15 +80,10 @@ ListSvcs::ListSvcs(QWidget *parent) // // Services List Box // - list_services_view=new QTableView(this); + list_services_view=new RDTableView(this); list_title_label=new QLabel(list_services_view,tr("&Services:"),this); list_title_label->setFont(labelFont()); list_title_label->setGeometry(14,11,85,19); - list_services_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_services_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_services_view->setShowGrid(false); - list_services_view->setSortingEnabled(false); - list_services_view->setWordWrap(false); list_services_model=new RDServiceListModel(false,this); list_services_model->setFont(defaultFont()); list_services_model->setPalette(palette()); diff --git a/rdadmin/list_svcs.h b/rdadmin/list_svcs.h index ef6c8ef4..df18e5bf 100644 --- a/rdadmin/list_svcs.h +++ b/rdadmin/list_svcs.h @@ -23,10 +23,10 @@ #include #include -#include #include #include +#include class ListSvcs : public RDDialog { @@ -49,7 +49,7 @@ class ListSvcs : public RDDialog private: QLabel *list_title_label; - QTableView *list_services_view; + RDTableView *list_services_view; RDServiceListModel *list_services_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/list_users.cpp b/rdadmin/list_users.cpp index eb554c47..e19df729 100644 --- a/rdadmin/list_users.cpp +++ b/rdadmin/list_users.cpp @@ -79,12 +79,7 @@ ListUsers::ListUsers(const QString &admin_name,QWidget *parent) // // User List // - list_users_view=new QTableView(this); - list_users_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_users_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_users_view->setShowGrid(false); - list_users_view->setSortingEnabled(false); - list_users_view->setWordWrap(false); + list_users_view=new RDTableView(this); list_users_model=new RDUserListModel(this); list_users_model->setFont(defaultFont()); list_users_model->setPalette(palette()); diff --git a/rdadmin/list_users.h b/rdadmin/list_users.h index b1a6db83..05210fc6 100644 --- a/rdadmin/list_users.h +++ b/rdadmin/list_users.h @@ -23,11 +23,11 @@ #include #include -#include #include #include #include +#include #include class ListUsers : public RDDialog @@ -50,7 +50,7 @@ class ListUsers : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *list_users_view; + RDTableView *list_users_view; RDUserListModel *list_users_model; QPushButton *list_add_button; QPushButton *list_edit_button; diff --git a/rdadmin/test_import.cpp b/rdadmin/test_import.cpp index 07231d05..0dc52c0d 100644 --- a/rdadmin/test_import.cpp +++ b/rdadmin/test_import.cpp @@ -18,7 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include #include #include @@ -101,14 +100,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent) // // Events List // - test_events_view=new QTableView(this); - test_events_view->setSelectionBehavior(QAbstractItemView::SelectRows); - test_events_view->setSelectionMode(QAbstractItemView::NoSelection); - test_events_view->setShowGrid(false); - test_events_view->setSortingEnabled(false); - test_events_view->setWordWrap(false); - test_events_view->verticalHeader()->setVisible(false); - test_events_view->horizontalHeader()->setStretchLastSection(true); + test_events_view=new RDTableView(this); test_events_model=new RDLogImportModel(rda->station()->name(),getpid(),this); test_events_view->setModel(test_events_model); test_events_label=new QLabel(test_events_view,tr("Imported Events"),this); diff --git a/rdadmin/test_import.h b/rdadmin/test_import.h index e70f46bf..69d158cf 100644 --- a/rdadmin/test_import.h +++ b/rdadmin/test_import.h @@ -25,11 +25,11 @@ #include #include #include -#include #include #include #include +#include class TestImport : public RDDialog { @@ -57,7 +57,7 @@ class TestImport : public RDDialog QDateEdit *test_date_edit; QPushButton *test_import_button; QLabel *test_events_label; - QTableView *test_events_view; + RDTableView *test_events_view; RDLogImportModel *test_events_model; QLabel *test_filename_label; QLineEdit *test_filename_edit; diff --git a/rdairplay/list_logs.cpp b/rdairplay/list_logs.cpp index e0f60f95..690af0e6 100644 --- a/rdairplay/list_logs.cpp +++ b/rdairplay/list_logs.cpp @@ -2,7 +2,7 @@ // // Select a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -46,12 +46,7 @@ ListLogs::ListLogs(RDLogPlay *log,QWidget *parent) // // Log List // - list_log_view=new QTableView(this); - list_log_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_log_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_log_view->setShowGrid(false); - list_log_view->setSortingEnabled(false); - list_log_view->setWordWrap(false); + list_log_view=new RDTableView(this); list_log_model=new RDLogListModel(this); list_log_model->setFont(defaultFont()); list_log_model->setPalette(palette()); diff --git a/rdairplay/list_logs.h b/rdairplay/list_logs.h index 7d76f1de..c67e7d1a 100644 --- a/rdairplay/list_logs.h +++ b/rdairplay/list_logs.h @@ -2,7 +2,7 @@ // // Select a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -22,13 +22,13 @@ #define LIST_LOGS_H #include -#include #include #include #include #include #include +#include class ListLogs : public RDDialog { @@ -59,7 +59,7 @@ class ListLogs : public RDDialog private: bool TryLock(RDLogLock *lock); RDLogFilter *list_filter_widget; - QTableView *list_log_view; + RDTableView *list_log_view; RDLogListModel *list_log_model; QString *list_logname; QString *list_svcname; diff --git a/rdairplay/logtableview.cpp b/rdairplay/logtableview.cpp index 10d61b5a..105f78d6 100644 --- a/rdairplay/logtableview.cpp +++ b/rdairplay/logtableview.cpp @@ -25,7 +25,7 @@ #include "logtableview.h" LogTableView::LogTableView(QWidget *parent) - : QTableView(parent) + : RDTableView(parent) { setAcceptDrops(true); } diff --git a/rdairplay/logtableview.h b/rdairplay/logtableview.h index 72019b9f..50e2e557 100644 --- a/rdairplay/logtableview.h +++ b/rdairplay/logtableview.h @@ -2,7 +2,7 @@ // // The Log TableView widget for RDAirPlay // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -24,11 +24,11 @@ #include #include -#include #include +#include -class LogTableView : public QTableView +class LogTableView : public RDTableView { Q_OBJECT public: diff --git a/rdcastmanager/list_casts.cpp b/rdcastmanager/list_casts.cpp index 6d0b3f4b..7444f2e6 100644 --- a/rdcastmanager/list_casts.cpp +++ b/rdcastmanager/list_casts.cpp @@ -79,13 +79,7 @@ ListCasts::ListCasts(unsigned feed_id,QWidget *parent) new QLabel(list_feed->channelTitle(),this); list_casts_label->setFont(bigLabelFont()); list_casts_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); - list_casts_view=new QTableView(this); - list_casts_view->setSelectionBehavior(QAbstractItemView::SelectRows); - list_casts_view->setSelectionMode(QAbstractItemView::SingleSelection); - list_casts_view->setShowGrid(false); - list_casts_view->setSortingEnabled(false); - list_casts_view->setSortingEnabled(false); - list_casts_view->setWordWrap(false); + list_casts_view=new RDTableView(this); list_casts_model=new RDPodcastListModel(feed_id,this); list_casts_model->setFont(font()); list_casts_model->setPalette(palette()); diff --git a/rdcastmanager/list_casts.h b/rdcastmanager/list_casts.h index 8fed40a4..7f13e938 100644 --- a/rdcastmanager/list_casts.h +++ b/rdcastmanager/list_casts.h @@ -23,13 +23,13 @@ #include #include -#include #include #include #include #include #include +#include #include "render_dialog.h" @@ -62,7 +62,7 @@ class ListCasts : public RDDialog private: RDCutDialog *list_cut_dialog; QLabel *list_casts_label; - QTableView *list_casts_view; + RDTableView *list_casts_view; RDPodcastListModel *list_casts_model; QPushButton *list_cart_button; QPushButton *list_file_button; diff --git a/rdcastmanager/logdialog.cpp b/rdcastmanager/logdialog.cpp index 92a90196..4c77fcfc 100644 --- a/rdcastmanager/logdialog.cpp +++ b/rdcastmanager/logdialog.cpp @@ -2,7 +2,7 @@ // // Read-only log lister dialog for Rivendell // -// (C) Copyright 2020 Fred Gleason +// (C) Copyright 2020-2021 Fred Gleason // // 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 @@ -30,12 +30,8 @@ LogDialog::LogDialog(QWidget *parent) { setWindowTitle("RDCastManager - "+tr("List Log Events")); - d_log_view=new QTableView(this); - d_log_view->setSelectionBehavior(QAbstractItemView::SelectRows); + d_log_view=new RDTableView(this); d_log_view->setSelectionMode(QAbstractItemView::ContiguousSelection); - d_log_view->setShowGrid(false); - d_log_view->setSortingEnabled(false); - d_log_view->setWordWrap(false); d_model=NULL; d_ok_button=new QPushButton(tr("OK"),this); diff --git a/rdcastmanager/logdialog.h b/rdcastmanager/logdialog.h index 6edc5377..4b3412f7 100644 --- a/rdcastmanager/logdialog.h +++ b/rdcastmanager/logdialog.h @@ -2,7 +2,7 @@ // // Read-only log lister dialog for Rivendell // -// (C) Copyright 2020 Fred Gleason +// (C) Copyright 2020-2021 Fred Gleason // // 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,11 +21,11 @@ #ifndef LOGDIALOG_H #define LOGDIALOG_H -#include -#include +#include #include #include +#include class LogDialog : public RDDialog { @@ -46,7 +46,7 @@ class LogDialog : public RDDialog void resizeEvent(QResizeEvent *e); private: - QTableView *d_log_view; + RDTableView *d_log_view; QPushButton *d_ok_button; QPushButton *d_cancel_button; RDLogModel *d_model; diff --git a/rdcastmanager/rdcastmanager.cpp b/rdcastmanager/rdcastmanager.cpp index a58acc83..68ef841c 100644 --- a/rdcastmanager/rdcastmanager.cpp +++ b/rdcastmanager/rdcastmanager.cpp @@ -91,10 +91,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Feed List // - cast_feed_view=new QTreeView(this); - cast_feed_view->setSelectionBehavior(QAbstractItemView::SelectRows); - cast_feed_view->setSortingEnabled(false); - cast_feed_view->setWordWrap(false); + cast_feed_view=new RDTreeView(this); cast_feed_model=new RDFeedListModel(false,this); cast_feed_model->setFont(font()); cast_feed_model->setPalette(palette()); diff --git a/rdcastmanager/rdcastmanager.h b/rdcastmanager/rdcastmanager.h index a6e77607..c54e7a46 100644 --- a/rdcastmanager/rdcastmanager.h +++ b/rdcastmanager/rdcastmanager.h @@ -22,11 +22,11 @@ #define RDCASTMANAGER_H #include -#include #include #include #include +#include #include #define RDCASTMANAGER_USAGE "\n" @@ -54,7 +54,7 @@ class MainWidget : public RDWidget void resizeEvent(QResizeEvent *e); private: - QTreeView *cast_feed_view; + RDTreeView *cast_feed_view; RDFeedListModel *cast_feed_model; QPushButton *cast_open_button; QPushButton *cast_copy_button; diff --git a/rdlibrary/audio_cart.cpp b/rdlibrary/audio_cart.cpp index f2c449f5..7d8f82ec 100644 --- a/rdlibrary/audio_cart.cpp +++ b/rdlibrary/audio_cart.cpp @@ -100,13 +100,9 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, // // Cart Cut List // - rdcart_cut_view=new QTableView(this); - rdcart_cut_view->setGeometry(100,0,430,sizeHint().height()); - rdcart_cut_view->setSelectionBehavior(QAbstractItemView::SelectRows); + rdcart_cut_view=new RDTableView(this); rdcart_cut_view->setSelectionMode(QAbstractItemView::ExtendedSelection); - rdcart_cut_view->setShowGrid(false); - rdcart_cut_view->setSortingEnabled(false); - rdcart_cut_view->setWordWrap(false); + rdcart_cut_view->setGeometry(100,0,430,sizeHint().height()); rdcart_cut_model=NULL; connect(rdcart_cut_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdlibrary/audio_cart.h b/rdlibrary/audio_cart.h index aa3b7638..70b31a6c 100644 --- a/rdlibrary/audio_cart.h +++ b/rdlibrary/audio_cart.h @@ -22,10 +22,10 @@ #define AUDIO_CART_H #include -#include #include #include +#include #include #include "audio_controls.h" @@ -71,7 +71,7 @@ class AudioCart : public RDWidget private: QModelIndex SingleSelectedLine() const; RDCart *rdcart_cart; - QTableView *rdcart_cut_view; + RDTableView *rdcart_cut_view; RDCutListModel *rdcart_cut_model; unsigned rdcart_average_length; QString *rdcart_import_path; diff --git a/rdlibrary/libraryview.cpp b/rdlibrary/libraryview.cpp index b9f81662..5b821523 100644 --- a/rdlibrary/libraryview.cpp +++ b/rdlibrary/libraryview.cpp @@ -2,7 +2,7 @@ // // QTreeView widget that supports cart dragging. // -// (C) Copyright 2020 Fred Gleason +// (C) Copyright 2020-2021 Fred Gleason // // 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 @@ -28,7 +28,7 @@ #include "libraryview.h" LibraryView::LibraryView(QWidget *parent) - : QTreeView(parent) + : RDTreeView(parent) { } diff --git a/rdlibrary/libraryview.h b/rdlibrary/libraryview.h index 503b4707..a450cfd2 100644 --- a/rdlibrary/libraryview.h +++ b/rdlibrary/libraryview.h @@ -2,7 +2,7 @@ // // QTreeView widget that supports cart dragging. // -// (C) Copyright 2020 Fred Gleason +// (C) Copyright 2020-2021 Fred Gleason // // 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,9 +21,9 @@ #ifndef LIBRARYVIEW_H #define LIBRARYVIEW_H -#include +#include -class LibraryView : public QTreeView +class LibraryView : public RDTreeView { Q_OBJECT public: diff --git a/rdlogedit/edit_log.h b/rdlogedit/edit_log.h index ac5c6ff1..08fdf328 100644 --- a/rdlogedit/edit_log.h +++ b/rdlogedit/edit_log.h @@ -2,7 +2,7 @@ // // Edit a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -29,7 +29,6 @@ #include #include -#include #include "list_reports.h" #include "logmodel.h" diff --git a/rdlogedit/logtableview.cpp b/rdlogedit/logtableview.cpp index 02a2f156..52d9a22e 100644 --- a/rdlogedit/logtableview.cpp +++ b/rdlogedit/logtableview.cpp @@ -25,7 +25,7 @@ #include "logmodel.h" LogTableView::LogTableView(QWidget *parent) - : QTableView(parent) + : RDTableView(parent) { d_mouse_row=-1; diff --git a/rdlogedit/logtableview.h b/rdlogedit/logtableview.h index c2fec7ab..2c30a194 100644 --- a/rdlogedit/logtableview.h +++ b/rdlogedit/logtableview.h @@ -2,7 +2,7 @@ // // The Log TableView widget for RDLogEdit. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -25,11 +25,11 @@ #include #include #include -#include #include +#include -class LogTableView : public QTableView +class LogTableView : public RDTableView { Q_OBJECT public: diff --git a/rdlogedit/rdlogedit.cpp b/rdlogedit/rdlogedit.cpp index 999b4527..042d17d9 100644 --- a/rdlogedit/rdlogedit.cpp +++ b/rdlogedit/rdlogedit.cpp @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include #include @@ -113,12 +113,8 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Log List // - log_log_view=new QTableView(this); - log_log_view->setSelectionBehavior(QAbstractItemView::SelectRows); + log_log_view=new RDTableView(this); log_log_view->setSelectionMode(QAbstractItemView::ExtendedSelection); - log_log_view->setShowGrid(false); - log_log_view->setSortingEnabled(false); - log_log_view->setWordWrap(false); log_log_model=new RDLogListModel(this); log_log_model->setFont(defaultFont()); log_log_model->setPalette(palette()); diff --git a/rdlogedit/rdlogedit.h b/rdlogedit/rdlogedit.h index 9d35329a..13018571 100644 --- a/rdlogedit/rdlogedit.h +++ b/rdlogedit/rdlogedit.h @@ -22,12 +22,12 @@ #define RDLOGEDIT_H #include -#include #include #include #include #include +#include #include #define RDLOGEDIT_POSITION_FILENAME ".rdlogedit" @@ -74,7 +74,7 @@ class MainWidget : public RDWidget int log_card_no; int log_stream_no; RDLogFilter *log_filter_widget; - QTableView *log_log_view; + RDTableView *log_log_view; RDLogListModel *log_log_model; QList log_clipboard; QPushButton *log_add_button;