[mythtv] mythvideo patch

usenet at wingert.org usenet at wingert.org
Wed Mar 12 14:51:41 EST 2003


As promised.

This patch allows for selection from current directly to make a playlist
of videos.


<begin>
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/CVS/Entries	2003-03-12 22:44:53.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/CVS/Entries	2003-03-02 15:39:53.000000000 +0000
@@ -1,5 +1,5 @@
 /.cvsignore/1.1/Tue Dec 10 05:17:43 2002//
-/databasebox.cpp/1.9/Tue Mar  4 04:58:39 2003//
+/databasebox.cpp/1.8/Thu Feb 27 03:42:46 2003//
 /databasebox.h/1.5/Wed Feb  5 19:48:13 2003//
 /dirlist.cpp/1.6/Thu Feb 27 22:40:50 2003//
 /dirlist.h/1.3/Wed Feb  5 19:48:13 2003//
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/databasebox.cpp	2003-03-04 04:58:39.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/databasebox.cpp	2003-03-12 22:46:28.000000000 +0000
@@ -42,7 +42,7 @@
     connect(listview, SIGNAL(returnPressed(QListViewItem *)), this,
             SLOT(selected(QListViewItem *)));
     connect(listview, SIGNAL(spacePressed(QListViewItem *)), this,
-            SLOT(selected(QListViewItem *)));
+            SLOT(spaceselected(QListViewItem *)));
     cditem = NULL;
 
     fillList(listview, playlist);
@@ -118,6 +118,23 @@
     }
 }
 
+void DatabaseBox::spaceselected(QListViewItem *item)
+{
+    TreeCheckItem *tcitem = (TreeCheckItem *)item;
+    Metadata *mdata = tcitem->getMetadata();
+    if ( mdata->Length() == 1 )
+    {
+       mdata->setLength( 0 );
+    }
+    else
+    {
+       mdata->setLength( 1 );
+    }
+    listview->setCurrentItem(listview->currentItem()->itemBelow());
+    listview->setSelected(listview->currentItem(),TRUE);
+    listview->ensureItemVisible(listview->currentItem());
+}
+
 void DatabaseBox::selected(QListViewItem *item)
 {
     doSelected(item);
@@ -126,35 +143,96 @@
 void DatabaseBox::doSelected(QListViewItem *item)
 {
     TreeCheckItem *tcitem = (TreeCheckItem *)item;
+    Metadata      *mdata = tcitem->getMetadata();
+    int           numSelected = 0;
+    QListViewItem *it;
+    QListViewItem *top;
+    QString title;
 
-    Metadata *mdata = tcitem->getMetadata();
+    top = listview->currentItem();
+    while( 1 )
+    {
+       if ( top->itemAbove() )
+       {
+          top = top->itemAbove();
+       }
+       else
+       {
+          break;
+       }
+    }
 
-    if (mdata != NULL && mdata->Genre() != "dir")
+    it = top;
+    while ( it != 0 )
+    {
+       tcitem = (TreeCheckItem *)it;
+       mdata = tcitem->getMetadata();
+       // cout << mdata->Title() << endl;
+       if ( mdata != NULL )
+       {
+          if ( mdata->Length() > 0 )
+          {
+             numSelected++;
+          }
+       }
+       it = it->itemBelow();
+    }
+
+    if ( numSelected == 0 )
+    {
+       tcitem = (TreeCheckItem *)item;
+       mdata = tcitem->getMetadata();
+       if (mdata != NULL && mdata->Genre() != "dir")
+       {
+           QString filename = mdata->Filename();	  
+           QString title = mdata->Filename().section('/',-1);
+           QString ext = mdata->Filename().section('.',-1);
+           QString handler = gContext->GetSetting(QString("%1_helper").
+              arg(ext.lower()));
+           QString command = handler.replace(QRegExp("%s"), 
+             QString("'%1'").arg(filename));
+
+           system((QString("%1 ") .arg(command)).ascii() );
+           raise();
+           setActiveWindow();
+       }
+       else if (mdata != NULL && mdata->Genre() == "dir")
+       {
+           QString dirname = mdata->Filename();
+           Dirlist md(dirname);
+
+           QValueList<Metadata> playlist = md.GetPlaylist();
+           listview->clear();
+           fillList(listview, &playlist);
+       }
+    }
+    else
     {
-        QString filename = mdata->Filename();	  
-        QString title = mdata->Filename().section('/',-1);
-        QString ext = mdata->Filename().section('.',-1);
-	 
-        QString handler = gContext->GetSetting(QString("%1_helper").arg(ext.lower()));
- //	 cout << "handler for" << ext.ascii() << ":" << handler.ascii() << endl;
-        QString command = handler.replace(QRegExp("%s"), 
-                                          QString("'%1'").arg(filename));
- //	 cout << "command:" << command << endl;
-
-        system((QString("%1 ") .arg(command)).ascii() );
-
-        raise();
-        setActiveWindow();
-    }
-    else if (mdata != NULL && mdata->Genre() == "dir")
-    {
- //	 printf("got directory %s\n",mdata->Filename().ascii());
-        QString dirname = mdata->Filename();
-        Dirlist md(dirname);
-
-        QValueList<Metadata> playlist = md.GetPlaylist();
-        listview->clear();
-        fillList(listview, &playlist);
+       it = top;
+       while ( it != 0 )
+       {
+          tcitem = (TreeCheckItem *)it;
+          mdata = tcitem->getMetadata();
+          if ( mdata != NULL )
+          {
+             if ( mdata->Length() > 0 )
+             {
+                mdata->setLength( 0 );
+                QString filename = mdata->Filename();	  
+                QString title = mdata->Filename().section('/',-1);
+                QString ext = mdata->Filename().section('.',-1);
+                QString handler = gContext->GetSetting(QString("%1_helper").
+                   arg(ext.lower()));
+                QString command = handler.replace(QRegExp("%s"), 
+                  QString("'%1'").arg(filename));
+
+                system((QString("%1 ") .arg(command)).ascii() );
+                raise();
+                setActiveWindow();
+             }
+          }
+          it = it->itemBelow();
+       }
     }
 }
 
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/databasebox.h	2003-02-05 19:48:13.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/databasebox.h	2003-03-02 16:02:13.000000000 +0000
@@ -22,6 +22,7 @@
 
   public slots:
     void selected(QListViewItem *);
+    void spaceselected(QListViewItem *);
 
   private:
     void doSelected(QListViewItem *);
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/dirlist.cpp	2003-02-27 22:40:50.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/dirlist.cpp	2003-03-02 15:58:08.000000000 +0000
@@ -18,7 +18,7 @@
     QString s = filename.section( '/',-1); // s == "myapp"
 
     Metadata *retdata = new Metadata(filename, s, "album", "title", "genre",
-                                     1900, 3, 40);
+                                     1900, 3, 0);
     return(retdata);
 }
 
@@ -61,7 +61,7 @@
             else
             {
                 Metadata retdata(fi->absFilePath(), fi->absFilePath(), "album",
-                                 "(Up one level)", "dir",1900, 3, 40);
+                                 "(Up one level)", "dir",1900, 3, 0);
                 playlist.prepend(retdata);
                 ++it;
                 continue;
@@ -72,7 +72,7 @@
         if (fi->isDir())
         {
             QString s = filename.section( '/',-1);
-	    Metadata retdata(filename, filename, "album", s, "dir",1900, 3, 40);
+	    Metadata retdata(filename, filename, "album", s, "dir",1900, 3, 0);
             playlist.prepend(retdata);
         }
         else
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/main.cpp	2003-02-24 17:43:49.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/main.cpp	2003-03-02 15:49:38.000000000 +0000
@@ -93,6 +93,7 @@
                     gContext->GetSetting(gContext->GetSetting("LoadProfile")));
       
     QString startdir = gContext->GetSetting("StartDir");
+    cout << startdir;
     
     Dirlist md = Dirlist(startdir);
     QValueList<Metadata> playlist = md.GetPlaylist();
--- /src/mythtv/tmp/mythvideo-cvs/mythvideo/treecheckitem.cpp	2003-02-05 19:48:13.000000000 +0000
+++ /src/mythtv/mythvideo/mythvideo/treecheckitem.cpp	2003-03-02 15:59:06.000000000 +0000
@@ -27,6 +27,13 @@
         newCg.setColor(QColorGroup::Text, "Yellow");
         newCg.setColor(QColorGroup::HighlightedText, "Yellow");
     }
+    if (metadata->Length() == 1)
+    {
+//     cout << "Genre:" << metadata->Genre().ascii() << endl;
+        newCg.setColor(QColorGroup::Foreground, "Red");
+        newCg.setColor(QColorGroup::Text, "Red");
+        newCg.setColor(QColorGroup::HighlightedText, "Red");
+    }
     QListViewItem::paintCell(p,newCg,column,width,align);
 }
<end>
 



More information about the mythtv-dev mailing list