2021-01-26 Fred Gleason <fredg@paravelsystems.com>

* Added 'RDTableView' and 'RDTreeView' base viewer classes.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-01-26 20:37:26 -05:00
parent 2ea048a80b
commit d8f526119e
50 changed files with 222 additions and 171 deletions

View File

@@ -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\

View File

@@ -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

View File

@@ -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());

View File

@@ -27,13 +27,13 @@
#include <QProgressDialog>
#include <QPushButton>
#include <QStringList>
#include <QTableView>
#include <rdbusydialog.h>
#include <rdcart.h>
#include <rddialog.h>
#include <rdcartfilter.h>
#include <rdlibrarymodel.h>
#include <rdtableview.h>
#include <rdsimpleplayer.h>
#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;

View File

@@ -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);

View File

@@ -27,13 +27,13 @@
#include <QProgressDialog>
#include <QPushButton>
#include <QStringList>
#include <QTreeView>
#include <rdbusydialog.h>
#include <rdcart.h>
#include <rddialog.h>
#include <rdcartfilter.h>
#include <rddialog.h>
#include <rdlibrarymodel.h>
#include <rdtreeview.h>
#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;

View File

@@ -2,7 +2,7 @@
//
// Select a Rivendell Log
//
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-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
@@ -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());

View File

@@ -2,7 +2,7 @@
//
// Select a Rivendell Log
//
// (C) Copyright 2007-2020 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2007-2021 Fred Gleason <fredg@paravelsystems.com>
//
// 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 <QPushButton>
#include <QTableView>
#include <rddialog.h>
#include <rdlogfilter.h>
#include <rdloglistmodel.h>
#include <rdtableview.h>
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;

35
lib/rdtableview.cpp Normal file
View File

@@ -0,0 +1,35 @@
// rdtableview.cpp
//
// QTableView widget with consistent Rivendell defaults
//
// (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 <QHeaderView>
#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);
}

34
lib/rdtableview.h Normal file
View File

@@ -0,0 +1,34 @@
// rdtableview.h
//
// QTableView widget with consistent Rivendell defaults
//
// (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 RDTABLEVIEW_H
#define RDTABLEVIEW_H
#include <QTableView>
class RDTableView : public QTableView
{
Q_OBJECT
public:
RDTableView(QWidget *parent=0);
};
#endif // RDTABLEVIEW_H

29
lib/rdtreeview.cpp Normal file
View File

@@ -0,0 +1,29 @@
// rdtreeview.cpp
//
// QTreeView widget with consistent Rivendell defaults
//
// (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 "rdtreeview.h"
RDTreeView::RDTreeView(QWidget *parent)
: QTreeView(parent)
{
setSelectionBehavior(QAbstractItemView::SelectRows);
setSortingEnabled(false);
setWordWrap(false);
}

34
lib/rdtreeview.h Normal file
View File

@@ -0,0 +1,34 @@
// rdtreeview.h
//
// QTreeView widget with consistent Rivendell defaults
//
// (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 RDTREEVIEW_H
#define RDTREEVIEW_H
#include <QTreeView>
class RDTreeView : public QTreeView
{
Q_OBJECT
public:
RDTreeView(QWidget *parent=0);
};
#endif // RDTREEVIEW_H