From cfd3d2ed0914d50be7a2eec023c41e0a15418f8b Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Sun, 14 Feb 2021 17:43:13 -0500 Subject: [PATCH] 2021-02-14 Fred Gleason * Removed the 'RDListView' class. * Removed the 'RDListViewItem' class. Signed-off-by: Fred Gleason --- ChangeLog | 3 + lib/Makefile.am | 3 - lib/lib.pro | 4 - lib/rdlistview.cpp | 135 ----------------- lib/rdlistview.h | 57 ------- lib/rdlistviewitem.cpp | 262 --------------------------------- lib/rdlistviewitem.h | 59 -------- rdadmin/edit_jack.h | 1 - rdadmin/list_feeds.h | 1 - rdadmin/list_pypads.h | 1 - rdadmin/list_users.h | 1 - rdadmin/test_import.cpp | 1 - rdlogmanager/edit_schedrules.h | 1 - 13 files changed, 3 insertions(+), 526 deletions(-) delete mode 100644 lib/rdlistview.cpp delete mode 100644 lib/rdlistview.h delete mode 100644 lib/rdlistviewitem.cpp delete mode 100644 lib/rdlistviewitem.h diff --git a/ChangeLog b/ChangeLog index 48e32247..b5fbc84a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21126,3 +21126,6 @@ 2021-02-14 Fred Gleason * Removed the 'RDLogLine::listViewItem()' and 'RDLogLine::setListViewItem()' methods. +2021-02-14 Fred Gleason + * Removed the 'RDListView' class. + * Removed the 'RDListViewItem' class. diff --git a/lib/Makefile.am b/lib/Makefile.am index aec26021..6964bd16 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -172,8 +172,6 @@ dist_librd_la_SOURCES = dbversion.h\ rdlist_groups.cpp rdlist_groups.h\ rdlist_logs.cpp rdlist_logs.h\ rdlistsvcs.cpp rdlistsvcs.h\ - rdlistview.cpp rdlistview.h\ - rdlistviewitem.cpp rdlistviewitem.h\ rdlivewire.cpp rdlivewire.h\ rdlivewiredestination.cpp rdlivewiredestination.h\ rdlivewiresource.cpp rdlivewiresource.h\ @@ -356,7 +354,6 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\ moc_rdlist_logs.cpp\ moc_rdlistselector.cpp\ moc_rdlistsvcs.cpp\ - moc_rdlistview.cpp\ moc_rdlivewire.cpp\ moc_rdlogfilter.cpp\ moc_rdlogimportmodel.cpp\ diff --git a/lib/lib.pro b/lib/lib.pro index 11b711bd..f9746c80 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -129,8 +129,6 @@ SOURCES += rdlineedit.cpp SOURCES += rdlist_logs.cpp SOURCES += rdlist_groups.cpp SOURCES += rdlistselector.cpp -SOURCES += rdlistview.cpp -SOURCES += rdlistviewitem.cpp SOURCES += rdlog.cpp SOURCES += rdlog_line.cpp SOURCES += rdlogedit_conf.cpp @@ -306,8 +304,6 @@ HEADERS += rdlineedit.h HEADERS += rdlist_groups.h HEADERS += rdlist_logs.h HEADERS += rdlistselector.h -HEADERS += rdlistview.h -HEADERS += rdlistviewitem.h HEADERS += rdlog.h HEADERS += rdlog_line.h HEADERS += rdlogedit_conf.h diff --git a/lib/rdlistview.cpp b/lib/rdlistview.cpp deleted file mode 100644 index 2d7164cc..00000000 --- a/lib/rdlistview.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// rdlistview.cpp -// -// A contiguous-selection only QListView widget for Rivendell -// -// (C) Copyright 2002-2003,2016 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 - -#include -#include - -RDListView::RDListView(QWidget *parent) - : Q3ListView(parent) -{ - list_contiguous=true; - list_hard_sort_column=-1; - connect(this, - SIGNAL(mouseButtonClicked(int,Q3ListViewItem *,const QPoint &,int)), - this, - SLOT(mouseButtonClickedData(int,Q3ListViewItem *,const QPoint &,int))); -} - -void RDListView::setContiguous(bool state) { - list_contiguous=state; -} - - -bool RDListView::contiguous() const -{ - return list_contiguous; -} - - -int RDListView::hardSortColumn() const -{ - return list_hard_sort_column; -} - - -void RDListView::setHardSortColumn(int col) -{ - list_hard_sort_column=col; -} - - -RDListView::SortType RDListView::columnSortType(int column) const -{ - return sort_type[column]; -} - - -void RDListView::setColumnSortType(int column,SortType type) -{ - sort_type[column]=type; -} - - -int RDListView::addColumn(const QString &label,int width) -{ - sort_type.push_back(RDListView::NormalSort); - return Q3ListView::addColumn(label,width); -} - - -int RDListView::addColumn(const QIcon &iconset,const QString &label, - int width) -{ - sort_type.push_back(RDListView::NormalSort); - return Q3ListView::addColumn(iconset,label,width); -} - - -void RDListView::selectLine(int line) -{ - RDListViewItem *item=(RDListViewItem *)firstChild(); - while(item!=NULL) { - if(item->line()==line) { - setSelected(item,true); - return; - } - item=(RDListViewItem *)item->nextSibling(); - } -} - - -void RDListView::mouseButtonClickedData(int button,Q3ListViewItem *item, - const QPoint &pt,int col) -{ - Q3ListViewItem *l; - bool contiguous; - - if((list_contiguous==false)||(selectionMode()!=Q3ListView::Extended)||(item==NULL)||(button!=1)) { - return; - } - - // - // Get Selected Range - // - l=item; - contiguous=true; - while((l=l->itemAbove())!=NULL) { - if(!l->isSelected()) { - contiguous=false; - } - if(!contiguous) { - setSelected(l,false); - } - } - l=item; - contiguous=true; - while((l=l->itemBelow())!=NULL) { - if(!l->isSelected()) { - contiguous=false; - } - if(!contiguous) { - setSelected(l,false); - } - } -} diff --git a/lib/rdlistview.h b/lib/rdlistview.h deleted file mode 100644 index e27769fb..00000000 --- a/lib/rdlistview.h +++ /dev/null @@ -1,57 +0,0 @@ -// rdlistview.h -// -// A contiguous-selection only QListView widget for Rivendell -// -// (C) Copyright 2002-2020 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 RDLISTVIEW_H -#define RDLISTVIEW_H - -#include - -#include -#include - -class RDListView : public Q3ListView -{ - Q_OBJECT - - public: - enum SortType {NormalSort=0,TimeSort=1,LineSort=2,GpioSort=3,NumericSort=4}; - RDListView(QWidget *parent); - int hardSortColumn() const; - void setHardSortColumn(int col); - void setContiguous(bool state); - bool contiguous() const; - RDListView::SortType columnSortType(int column) const; - void setColumnSortType(int column,SortType type); - int addColumn(const QString &label,int width=-1); - int addColumn(const QIcon &iconset,const QString &label,int width=-1); - void selectLine(int line); - - private slots: - void mouseButtonClickedData(int button,Q3ListViewItem *item,const QPoint &pt, - int col); - - private: - int list_hard_sort_column; - bool list_contiguous; - std::vector sort_type; -}; - - -#endif // RDLISTVIEW_H diff --git a/lib/rdlistviewitem.cpp b/lib/rdlistviewitem.cpp deleted file mode 100644 index 6ccf310c..00000000 --- a/lib/rdlistviewitem.cpp +++ /dev/null @@ -1,262 +0,0 @@ -// rdlistviewitem.cpp -// -// A color-selectable QListViewItem class for Rivendell -// -// (C) Copyright 2002-2020 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 - -#include -#include - -RDListViewItem::RDListViewItem(Q3ListView *parent) - : Q3ListViewItem(parent) -{ - item_line=-1; - item_id=-1; - list_parent=(RDListView *)parent; - item_background_color= - listView()->palette().color(QPalette::Active,QColorGroup::Base); - for(int i=0;icolumns();i++) { - item_text_color. - push_back(parent->palette().color(QPalette::Active,QColorGroup::Text)); - item_text_weight.push_back(parent->font().weight()); - } -} - -RDListViewItem::RDListViewItem(RDListViewItem *parent) - : Q3ListViewItem((Q3ListViewItem *)parent) -{ - item_line=-1; - item_id=-1; - list_parent=(RDListView *)listView(); - item_background_color= - list_parent->palette().color(QPalette::Active,QColorGroup::Base); - for(int i=0;icolumns();i++) { - item_text_color. - push_back(list_parent->palette().color(QPalette::Active,QColorGroup::Text)); - item_text_weight.push_back(list_parent->font().weight()); - } -} - -int RDListViewItem::line() const -{ - return item_line; -} - - -void RDListViewItem::setLine(int line) -{ - item_line=line; -} - - -int RDListViewItem::id() const -{ - return item_id; -} - - -void RDListViewItem::setId(int id) -{ - item_id=id; -} - - -QColor RDListViewItem::backgroundColor() const -{ - return item_background_color; -} - - -void RDListViewItem::setBackgroundColor(QColor color) -{ - item_background_color=color; - listView()->repaintItem(this); -} - - -void RDListViewItem::setTextColor(QColor color) -{ - for(unsigned i=0;irepaintItem(this); -} - - -QColor RDListViewItem::textColor(int column) const -{ - return item_text_color[column]; -} - - -void RDListViewItem::setTextColor(int column,QColor color,int weight) -{ - item_text_color[column]=color; - item_text_weight[column]=weight; - listView()->repaintItem(this); -} - - -void RDListViewItem::paintCell(QPainter *p,const QColorGroup &cg,int column, - int width,int align) -{ - QColor text_color=item_text_color[column]; - QColor back_color=item_background_color; - int x=0; - int y=0; - - if(item_text_weight[column]!=p->font().weight()) { - int pt_size=0; - if((pt_size=p->font().pointSize())<0) { - pt_size=p->font().pixelSize(); - } - QFont f(p->font().family(),pt_size,item_text_weight[column]); - f.setPixelSize(pt_size); - p->setFont(f); - } - if(isSelected()&&((column==0)||listView()->allColumnsShowFocus())) { - text_color=cg.highlightedText(); - back_color=cg.highlight(); - } - p->fillRect(0,0,width,height(),back_color); - if(pixmap(column)==NULL) { - for(int i=0;icolumns();i++) { - if(!text(i).isEmpty()) { - y=(height()+p->fontMetrics().boundingRect(text(i)).height())/2; - i=listView()->columns(); - } - } - x=listView()->itemMargin(); - if(((align&Qt::AlignHCenter)!=0)||((align&Qt::AlignCenter)!=0)) { - x=(width-p->fontMetrics().width(text(column)))/2; - } - if((align&Qt::AlignRight)!=0) { - x=width-p->fontMetrics().width(text(column))-listView()->itemMargin(); - } - p->setPen(text_color); - p->drawText(x,y,text(column)); - } - else { - x=listView()->itemMargin(); - y=(height()-pixmap(column)->height())/2; - if((align&Qt::AlignRight)!=0) { - x=width-pixmap(column)->width()-listView()->itemMargin(); - } - if(((align&Qt::AlignHCenter)!=0)||((align&Qt::AlignCenter)!=0)) { - x=(width-pixmap(column)->width())/2; - } - p->drawPixmap(x,y,*pixmap(column)); - } -} - - -int RDListViewItem::compare(Q3ListViewItem *i,int col,bool ascending) const -{ - int hard_column; - int prev_length; - int length; - QStringList fields; - QStringList prev_fields; - int this_num; - int that_num; - - if((hard_column=list_parent->hardSortColumn())<0) { - switch(list_parent->columnSortType(col)) { - case RDListView::TimeSort: - prev_length=RDSetTimeLength(i->text(col)); - length=RDSetTimeLength(text(col)); - if(lengthprev_length) { - return 1; - } - return 0; - - case RDListView::LineSort: - if(line()<((RDListViewItem *)i)->line()) { - return -1; - } - if(line()>((RDListViewItem *)i)->line()) { - return 1; - } - return 0; - - case RDListView::GpioSort: - fields=text(col).split("-"); - prev_fields=i->text(col).split("-"); - if(fields[0].toInt()>prev_fields[0].toInt()) { - return 1; - } - if(fields[0].toInt()text(col).toInt(); - if(this_num>that_num) { - return 1; - } - if(this_numtext(hard_column).toInt(); - if(that_count<0) { - return -1; - } - if(this_count>that_count) { - return 1; - } - if(this_counttext(hard_column).toInt(); - if(that_count<0) { - return 1; - } - if(this_count>that_count) { - return -1; - } - if(this_count -// -// 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 RDLISTVIEWITEM_H -#define RDLISTVIEWITEM_H - -#include - -#include -#include - -#include - -class RDListViewItem : public Q3ListViewItem -{ - public: - RDListViewItem(Q3ListView *parent); - RDListViewItem(RDListViewItem *parent); - int line() const; - void setLine(int line); - int id() const; - void setId(int id); - QColor backgroundColor() const; - void setBackgroundColor(QColor color); - QColor textColor(int column) const; - void setTextColor(QColor color); - void setTextColor(int column,QColor color,int weight); - void paintCell(QPainter *p,const QColorGroup &cg,int column, - int width,int align); - int compare(Q3ListViewItem *i,int col,bool ascending) const; - - private: - int item_line; - int item_id; - std::vector item_text_color; - std::vector item_text_weight; - QColor item_background_color; - RDListView *list_parent; -}; - - -#endif // RDLISTVIEWITEM_H diff --git a/rdadmin/edit_jack.h b/rdadmin/edit_jack.h index bca94053..33a21784 100644 --- a/rdadmin/edit_jack.h +++ b/rdadmin/edit_jack.h @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/rdadmin/list_feeds.h b/rdadmin/list_feeds.h index a48a3623..0e90ec9c 100644 --- a/rdadmin/list_feeds.h +++ b/rdadmin/list_feeds.h @@ -25,7 +25,6 @@ #include #include -#include #include class ListFeeds : public RDDialog diff --git a/rdadmin/list_pypads.h b/rdadmin/list_pypads.h index a4bf2ab2..2ca8b698 100644 --- a/rdadmin/list_pypads.h +++ b/rdadmin/list_pypads.h @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/rdadmin/list_users.h b/rdadmin/list_users.h index 05210fc6..750d6a99 100644 --- a/rdadmin/list_users.h +++ b/rdadmin/list_users.h @@ -26,7 +26,6 @@ #include #include -#include #include #include diff --git a/rdadmin/test_import.cpp b/rdadmin/test_import.cpp index 0dc52c0d..f32d9bdb 100644 --- a/rdadmin/test_import.cpp +++ b/rdadmin/test_import.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "globals.h" diff --git a/rdlogmanager/edit_schedrules.h b/rdlogmanager/edit_schedrules.h index f01501a6..83621196 100644 --- a/rdlogmanager/edit_schedrules.h +++ b/rdlogmanager/edit_schedrules.h @@ -23,7 +23,6 @@ #define EDIT_SCHEDRULES_H #include -#include #include #include