mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 22:48:01 +02:00
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'RDListView' class. * Removed the 'RDListViewItem' class. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
d3607fbe00
commit
cfd3d2ed09
@ -21126,3 +21126,6 @@
|
||||
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed the 'RDLogLine::listViewItem()' and
|
||||
'RDLogLine::setListViewItem()' methods.
|
||||
2021-02-14 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed the 'RDListView' class.
|
||||
* Removed the 'RDListViewItem' class.
|
||||
|
@ -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\
|
||||
|
@ -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
|
||||
|
@ -1,135 +0,0 @@
|
||||
// rdlistview.cpp
|
||||
//
|
||||
// A contiguous-selection only QListView widget for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2003,2016 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 <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include <rdlistview.h>
|
||||
#include <rdlistviewitem.h>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
// rdlistview.h
|
||||
//
|
||||
// A contiguous-selection only QListView widget for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2020 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 RDLISTVIEW_H
|
||||
#define RDLISTVIEW_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <q3listview.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
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<RDListView::SortType> sort_type;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDLISTVIEW_H
|
@ -1,262 +0,0 @@
|
||||
// rdlistviewitem.cpp
|
||||
//
|
||||
// A color-selectable QListViewItem class for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2020 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 <qpainter.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <rdconf.h>
|
||||
#include <rdlistviewitem.h>
|
||||
|
||||
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;i<parent->columns();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;i<list_parent->columns();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;i<item_text_color.size();i++) {
|
||||
item_text_color[i]=color;
|
||||
}
|
||||
listView()->repaintItem(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;i<listView()->columns();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(length<prev_length) {
|
||||
return -1;
|
||||
}
|
||||
if(length>prev_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()<prev_fields[0].toInt()) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case RDListView::NumericSort:
|
||||
this_num=text(col).toInt();
|
||||
that_num=i->text(col).toInt();
|
||||
if(this_num>that_num) {
|
||||
return 1;
|
||||
}
|
||||
if(this_num<that_num) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case RDListView::NormalSort:
|
||||
return Q3ListViewItem::compare(i,col,ascending);
|
||||
}
|
||||
}
|
||||
if(ascending) {
|
||||
int this_count=text(hard_column).toInt();
|
||||
if(this_count<0) {
|
||||
return 1;
|
||||
}
|
||||
int that_count=i->text(hard_column).toInt();
|
||||
if(that_count<0) {
|
||||
return -1;
|
||||
}
|
||||
if(this_count>that_count) {
|
||||
return 1;
|
||||
}
|
||||
if(this_count<that_count) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
int this_count=text(hard_column).toInt();
|
||||
if(this_count<0) {
|
||||
return -1;
|
||||
}
|
||||
int that_count=i->text(hard_column).toInt();
|
||||
if(that_count<0) {
|
||||
return 1;
|
||||
}
|
||||
if(this_count>that_count) {
|
||||
return -1;
|
||||
}
|
||||
if(this_count<that_count) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
// rdlistviewitem.h
|
||||
//
|
||||
// A color-selectable QListViewItem class for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2004,2016 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 RDLISTVIEWITEM_H
|
||||
#define RDLISTVIEWITEM_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <q3listview.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <rdlistview.h>
|
||||
|
||||
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<QColor> item_text_color;
|
||||
std::vector<int> item_text_weight;
|
||||
QColor item_background_color;
|
||||
RDListView *list_parent;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDLISTVIEWITEM_H
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdjackclientlistmodel.h>
|
||||
#include <rdlistview.h>
|
||||
#include <rdstation.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdfeedlistmodel.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
class ListFeeds : public RDDialog
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QPushButton>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdpypadlistmodel.h>
|
||||
#include <rdstation.h>
|
||||
#include <rdtableview.h>
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <rddb.h>
|
||||
#include <rddialog.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdtableview.h>
|
||||
#include <rduserlistmodel.h>
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdevent_line.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdpasswd.h>
|
||||
|
||||
#include "globals.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define EDIT_SCHEDRULES_H
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdlistview.h>
|
||||
#include <rdschedruleslist.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user