DVB-Cube BETA <<< Das deutsche PC und DVB-Forum >>>

Diverse DVB Software für verschiedene Karten => # Linux DVB (vdr, kaffeine, ect.) => # Kaffeine => Thema gestartet von: mtron am 02 Juni, 2007, 13:54

Titel: Sat Auswahl in kaffeine (channeltree patch)
Beitrag von: mtron am 02 Juni, 2007, 13:54
Nachdem es momentan für rotor Besitzer keine zufriedenstellende Möglichkeit gibt die kanäle nach sat's zu ordnen, gibt's mehrere Möglichkeiten dies zu ändern.

Am einfachsten wäre es im kanalfilter oder der Kanalliste eine Checkbox "source" oder "Sats" einzubauen, die suche filtert dann nach Satnamen (nit so clever, denn sats werden auch umbenannt, wenn sie an einer neuen Position eingesetzt werden ) oder besser nach der Orbitalposition. (z.B. 19,2 zeigt dann alle astra kanäle)

Der Nachteil ist natürlich dass dann keine weitere Filtermöglichkeit der Kanäle besteht, also vielleicht wäre es besser neben dem Kanalfilter eine Drop-down box zu machen, die entweder alle sources oder nur den ausgewählten zeigt.

Andererseits gibt es natürlich noch die Möflichkeit die named in diesem Post (http://beta.dvbcube.org/index.php?topic=20132.msg80389#msg80389) beschreibt (Baumansicht der Kanalliste bei der man einem Sat einer Kategorie zuweisen. Der patch dafür:

Index: src/input/dvb/dvbpanel.h
===================================================================
--- src/input/dvb/dvbpanel.h (Revision 668581)
+++ src/input/dvb/dvbpanel.h (Arbeitskopie)
@@ -33,7 +33,7 @@
 #include <kpushbutton.h>
 #include <kled.h>
 #include <klistview.h>
-#include <kiconview.h>
+//#include <kiconview.h>
 #include <klineedit.h>
 
 #include "scandialog.h"
@@ -65,7 +65,7 @@ protected:
 };
 
 
-
+/*
 class DIconViewItem : public KIconViewItem
 {
 public:
@@ -75,7 +75,7 @@ protected:
 private:
  DvbPanel *panel;
 };
-
+*/
 
 
 class DvbPanel : public KaffeineInput
@@ -169,7 +169,7 @@ private:
  QPixmap tvPix, raPix, tvcPix, racPix;
  QSplitter *split;
  QFrame *panel;
- KIconView *iconView;
+ //KIconView *iconView;
  DListView *channelsCb;
  QComboBox *audioComb;
  QToolButton *broadcastBtn, *recordBtn;
@@ -215,8 +215,8 @@ private slots:
  void newTimer( QString channel, QString name, QDateTime begin, QTime duration, bool warn=true );
  void dumpEvents();
  void resetOSD();
- void catContextMenu( QIconViewItem*, const QPoint& );
- void catSelected( QIconViewItem* );
+ //void catContextMenu( QIconViewItem*, const QPoint& );
+ //void catSelected( QIconViewItem* );
  void channelNumberChanged( QListViewItem* );
  void pipeOpened();
  void setTuning();
Index: src/input/dvb/dvbpanel.cpp
===================================================================
--- src/input/dvb/dvbpanel.cpp (Revision 668581)
+++ src/input/dvb/dvbpanel.cpp (Arbeitskopie)
@@ -44,6 +44,7 @@
 #include <ktrader.h>
 #include <kxmlguifactory.h>
 #include <kparts/componentfactory.h>
+#include <klistviewsearchline.h>
 
 #include "kaffeineinput.h"
 #include "kaffeinedvbplugin.h"
@@ -58,7 +59,7 @@
 #define CHANICONSIZE 28
 
 
-
+/*
 DIconViewItem::DIconViewItem( DvbPanel *pan, QIconView *parent, const QString &text, const QPixmap &icon )
  : KIconViewItem( parent, text, icon )
 {
@@ -76,7 +77,7 @@ void DIconViewItem::dropped( QDropEvent
  if ( QTextDrag::decode( e, s ) )
  panel->moveChannel( text(), s );
 }
-
+*/
 
 
 DListView::DListView( QWidget *parent ) : KListView( parent )
@@ -113,7 +114,7 @@ DvbPanel::DvbPanel( QWidget *parent, QOb
  mainWidget->setSizePolicy( QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred) );
  split = new QSplitter( mainWidget );
  split->setOpaqueResize( true );
- pbox = new QVBox( split );
+ /*pbox = new QVBox( split );
  iconView = new KIconView( pbox );
  iconView->setVScrollBarMode( QScrollView::AlwaysOff );
  iconView->setHScrollBarMode( QScrollView::AlwaysOff );
@@ -125,8 +126,8 @@ DvbPanel::DvbPanel( QWidget *parent, QOb
  iconView->setSpacing(0);
  iconView->setItemsMovable(false);
  iconView->setResizeMode(QIconView::Adjust);
- iconView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) );
- playerBox = new QVBox( pbox );
+ iconView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ) );*/
+ playerBox = new QVBox( split );
  playerBox->setMinimumWidth( 200 );
  panel = new QFrame( split );
  panel->setLineWidth(1);
@@ -467,31 +468,10 @@ QWidget *DvbPanel::inputMainWidget()
 
 void DvbPanel::searchChannel( const QString &text )
 {
- int i, c=-1;
- QListViewItemIterator it( channelsCb );
- if ( !it.current() )
- return;
- for ( i=0; i<channelsCb->columns(); i++ ) {
- if ( channelsCb->columnText(i)==i18n("Name") ) {
- c = i;
- break;
- }
- }
- if ( c==-1 )
- return;
-
- channelsCb->visibleItems = 0;
-
- while ( it.current() ) {
- if ( text.isEmpty() || it.current()->text( c ).contains( text, false ) ) {
- it.current()->setVisible(true);
- ++channelsCb->visibleItems;
- }
- else {
- it.current()->setVisible(false);
- }
- ++it;
- }
+ KListViewSearchLine sl(0, channelsCb);
+ sl.setCaseSensitive(false);
+ sl.setKeepParentsVisible(true);
+ sl.updateSearch(text);
 }
 
 
@@ -537,7 +517,7 @@ void DvbPanel::channelNumberChanged( QLi
 }
 
 
-
+/*
 void DvbPanel::catSelected( QIconViewItem *it )
 {
  if ( !it ) return;
@@ -603,7 +583,7 @@ void DvbPanel::catContextMenu( QIconView
  }
  delete pop;
 }
-
+*/
 
 
 void DvbPanel::moveChannel( const QString &cat, const QString &name )
@@ -1016,18 +996,19 @@ void DvbPanel::setConfig()
 {
  int i;
  int error = 0;
- KIconViewItem* item = NULL;
+ //KIconViewItem* item = NULL;
  DvbStream *d;
 
  QString s = locateLocal("appdata", "");
  dvbConfig = new DVBconfig( s );
- item = new DIconViewItem(this, iconView, i18n("All"), KGlobal::iconLoader()->loadIcon(dvbConfig->allIcon, KIcon::NoGroup, KIcon::SizeSmallMedium));
+ /*item = new DIconViewItem(this, iconView, i18n("All"), KGlobal::iconLoader()->loadIcon(dvbConfig->allIcon, KIcon::NoGroup, KIcon::SizeSmallMedium));
  iconView->setFixedHeight( item->height()+iconView->horizontalScrollBar()->height() );
  item->setDropEnabled( true );
  item = new DIconViewItem(this, iconView, i18n("Radio"), KGlobal::iconLoader()->loadIcon(dvbConfig->radioIcon, KIcon::NoGroup, KIcon::SizeSmallMedium));
  item->setDropEnabled( false );
  item = new DIconViewItem(this, iconView, i18n("TV"), KGlobal::iconLoader()->loadIcon(dvbConfig->tvIcon, KIcon::NoGroup, KIcon::SizeSmallMedium));
  item->setDropEnabled( false );
+ */
 
  KTrader::OfferList offers = KTrader::self()->query("KaffeineDvbPlugin");
  KTrader::OfferList::Iterator it = offers.begin();
@@ -1044,10 +1025,10 @@ void DvbPanel::setConfig()
  }
  }
 
- for ( i=0; i<(int)dvbConfig->categories.count(); i++ ) {
+ /*for ( i=0; i<(int)dvbConfig->categories.count(); i++ ) {
  item = new DIconViewItem(this, iconView, dvbConfig->categories.at(i)->name, KGlobal::iconLoader()->loadIcon(dvbConfig->categories.at(i)->icon, KIcon::NoGroup, KIcon::SizeSmallMedium));
  item->setDropEnabled( true );
- }
+ }*/
 
  for ( i=0; i<(int)dvbConfig->devList.count(); i++ ) {
  d = new DvbStream( dvbConfig->devList.at(i), dvbConfig->defaultCharset );
@@ -2178,12 +2159,16 @@ bool DvbPanel::getChannelList()
  ChannelDesc *chan;
  QString src="";
  int ns;
- KListViewItem *it;
+ KListViewItem *it, *tv_it, *radio_it;
  QPixmap pix;
 
  maxChannelNumber = 0;
  minChannelNumber = -1;
 
+ channelsCb->setRootIsDecorated(true);
+ tv_it = new KListViewItem(channelsCb, "TV");
+ radio_it = new KListViewItem(channelsCb, "Radio");
+
  int sort = dvbConfig->readDvbChanOrder();
  if ( sort ) {
  int column = sort&1;
@@ -2414,8 +2421,18 @@ bool DvbPanel::getChannelList()
 
  chan->pix.load( dvbConfig->dvbConfigIconsDir+chan->name );
tsource=chan->tp.source;
- it = new KListViewItem( channelsCb, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
+ if ( chan->type==1 )
+ it = new KListViewItem( tv_it, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
+ else
+ it = new KListViewItem( radio_it, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
  it->setDragEnabled( true );
+ if ( chan->category != "" ) {
+ KListViewItem *parent = (KListViewItem*)channelsCb->findItem( chan->category, 0);
+ if ( !parent )
+ parent = new KListViewItem( channelsCb, chan->category );
+ it = new KListViewItem( parent, QString().sprintf("%04d", chan->num), chan->name, chan->tp.source );
+ it->setDragEnabled( true );
+ }
  if ( !chan->pix.isNull() )
  it->setPixmap( 1, chan->pix );
  else {

screenshot: -click- (http://mtrons.googlepages.com/channeltree.jpg)

Die kategorien im Screenshot (kultur, news, ect.) könnte man mit Gnumeric (siehe post von named) in die Sat's umbenennen, und man hätte die Kanalliste schön sortiert.

Aber vielleicht hat jemand eine Bessere Idee wie man das machen könnte?
Titel: Re: Sat Auswahl in kaffeine (channeltree patch)
Beitrag von: named am 02 Juni, 2007, 20:37
Could you update the patch?
Titel: Re: Sat Auswahl in kaffeine (channeltree patch)
Beitrag von: mtron am 02 Juni, 2007, 21:55
what do you mean?

I tried it against 2days svn, some offsets, but no rejects...

Work in progress though ;)
Titel: Re: Sat Auswahl in kaffeine (channeltree patch)
Beitrag von: named am 02 Juni, 2007, 22:49
I'm getting one reject with today's svn.
Titel: Re: Sat Auswahl in kaffeine (channeltree patch)
Beitrag von: mtron am 04 Juni, 2007, 13:04
ah, ok sorry. I'll fix it in the evening. Currently @ work on a windoze machine :(