Hi,

since some months now, I've been using avicap-0.7.22 to successfully record 
movies from TV with my linux, but it always annoyed me, that Avicap doesn't 
include a sort of programmable timertable, like a VCR, so that I don't have 
to get up in the middle of the night to start/stop the recording or change 
channel.

I've now been able to compile Avicaps CVS-sourcecode myself, and so I've 
patched Avicap to have the features I like.

The patch in attachment contains my 'Timertable' patch.

A new entry will show up in Avicaps Popup-Menu ('Timertable').

Click it, and the Timertable window will open.

Click on 'new' to create a new entry, you can edit the start and stop 
time/date of your recording, the channel and the filename you wanna write to.

Click 'modify' to apply your changes to the list at the top of the window.

You can have an unlimited number of entries, each can be activated/deactivated 
by clicking the Checkbox of the entry.

When you click on 'start timer' , Avicap will search for the next recording in 
the future (that's enabled), and will wait till it is time.

10 seconds before the time you've given, the new recording will start.

An old recording, which you might have started manually via 'Capture AVI' is 
stopped before the new recording starts.

Avicap will continue recording until the end time is reached, it will then 
search for the next recording and wait for it.

Avicap will detect 'insane' timer programmings (when two programmed recordings 
overlap) and it will show a warning message for the _first_ conflict between 
recordings - there may be more conflicts, it's your turn to correct the 
entries, Avicap will record what you tell it.

If you want Avicap to shutdown your computer after the last recording is done, 
you have to activate 'shutdown when finished'.

After the last recording is done,  Avicap will show up a dialog with a 
critical message for 3 minutes, giving you time to abort the shutdown of your 
system.

After that time, Avicap calls system("sudo avicap-shutdown &") and exits 
Avicap.

avicap-shutdown then will shutdown and power-off your computer.

WARNING: do use this feature with caution, and only when your computer doesnt 
anything else except recording movies (like mine :-))
You also have to add avicap-shutdown to the sudoers file, like:
alex ALL= NOPASSWD: /home/alex/sbin/avicap-shutdown

What else?

The list of recordings gets saved into ~/.avm/default (via WI/WS), it looks 
like this:

[ AviCap ]
AudioDevice /dev/dsp
.....
Subtitles 0
TT-00-Active 0
TT-00-Channel 10
TT-00-Filename /windata20/record/ozzy.avi
TT-00-StartTime Wed Mar 12 21:55:18 2003
TT-00-StopTime 22:35:18
TT-01-Active 0
....

etc, works fine for me :-)

My patch is in sync with Avicaps current CVS - I hope you find it useful, I 
hope you'll add it to CVS :-)))

Please tell me what you don't like about, so that I can do improvements.

I will improve this patch even more, cause yet it isn't possible to change the 
codec or bitrate between recordings - that's on top of my todo-list.

I'd also like an option to send my computer in some sort of sleep- or 
low-power-consumption-mode _between_ recordings.

Does anyone of you know how or if it is possible with either apm or else to 
send the computer in sort of sleep mode, and re-activate it at a specific 
time?

I know that there are things like 'Wake-up on keypress' or 'Wake-up on LAN' or 
'Wake-up on modem ring' - but what about 'Wake-up on internal timer', is that 
possible with normal mainboards/bioses, or do I need special hardware for 
that?

Cause I'd like my computer to use as a full-featured VCR, and a vcr goes down 
to sleep between recordings....?


BTW: some of the _p.cpp source code files in the samples/qtvidcap dir seem to 
be auto-generated from a .ui File, but I didn't find these Gui-Designer 
Data-Files.

Please check them into CVS, because I'd like to add some more options or 
'comfort functions' ;-))



Alex

-- 
                   Alexander Rawass
          Email: [EMAIL PROTECTED]
http://tuxfleet.sourceforge.net http://qtreemap.sourceforge.net
...but some day you'll be a STAR in somebody else's SKY...


diff -N -c -r avifile0.7-0.7.33/include/version.h avifile0.7-0.7.33-alex/include/version.h
*** avifile0.7-0.7.33/include/version.h	2003-03-15 06:08:50.000000000 +0100
--- avifile0.7-0.7.33-alex/include/version.h	2003-03-15 05:52:16.000000000 +0100
***************
*** 3,7 ****
  #define AVIFILE_MINOR_VERSION 7
  #define AVIFILE_PATCHLEVEL 33
  #define AVIFILE_VERSION  ((AVIFILE_MAJOR_VERSION << 16) + (AVIFILE_MINOR_VERSION << 8) + AVIFILE_PATCHLEVEL)
! #define AVIFILE_BUILD "CVS-0.7.33-030315-05:13-3.2"
  #endif
--- 3,7 ----
  #define AVIFILE_MINOR_VERSION 7
  #define AVIFILE_PATCHLEVEL 33
  #define AVIFILE_VERSION  ((AVIFILE_MAJOR_VERSION << 16) + (AVIFILE_MINOR_VERSION << 8) + AVIFILE_PATCHLEVEL)
! #define AVIFILE_BUILD "CVS-0.7.33-030315-05:15-3.2"
  #endif
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/Makefile.am avifile0.7-0.7.33-alex/samples/qtvidcap/Makefile.am
*** avifile0.7-0.7.33/samples/qtvidcap/Makefile.am	2003-02-19 19:46:27.000000000 +0100
--- avifile0.7-0.7.33-alex/samples/qtvidcap/Makefile.am	2003-03-05 04:00:45.000000000 +0100
***************
*** 21,27 ****
   vidconf.h \
   vidconf_p.h \
   wintv.h \
!  deinterlace-yuv.h
  
  avicap_SOURCES = \
   avicapwnd.cpp \
--- 21,28 ----
   vidconf.h \
   vidconf_p.h \
   wintv.h \
!  deinterlace-yuv.h \
!  timertable.h
  
  avicap_SOURCES = \
   avicapwnd.cpp \
***************
*** 39,45 ****
   vidconf.cpp \
   vidconf_p.cpp \
   deinterlace-rgb.cpp \
!  deinterlace-yuv.c
  
  avicap_LDADD = \
  	../../libavqt/libqavm.la \
--- 40,47 ----
   vidconf.cpp \
   vidconf_p.cpp \
   deinterlace-rgb.cpp \
!  deinterlace-yuv.c \
!  timertable.cpp
  
  avicap_LDADD = \
  	../../libavqt/libqavm.la \
***************
*** 96,101 ****
--- 98,104 ----
  $(srcdir)/avicapwnd_p.cpp: avicapwnd_p.moc
  $(srcdir)/picprop_p.cpp: picprop_p.moc
  $(srcdir)/vidconf.cpp: vidconf.moc
+ $(srcdir)/timertable.cpp: timertable.moc
  
  CLEANFILES = *.moc
  MAINTAINERCLEANFILES = Makefile.in
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/Makefile.in avifile0.7-0.7.33-alex/samples/qtvidcap/Makefile.in
*** avifile0.7-0.7.33/samples/qtvidcap/Makefile.in	2003-03-15 06:07:20.000000000 +0100
--- avifile0.7-0.7.33-alex/samples/qtvidcap/Makefile.in	2003-03-15 05:24:25.000000000 +0100
***************
*** 157,163 ****
   vidconf.h \
   vidconf_p.h \
   wintv.h \
!  deinterlace-yuv.h
  
  
  avicap_SOURCES = \
--- 157,164 ----
   vidconf.h \
   vidconf_p.h \
   wintv.h \
!  deinterlace-yuv.h \
!  timertable.h
  
  
  avicap_SOURCES = \
***************
*** 176,182 ****
   vidconf.cpp \
   vidconf_p.cpp \
   deinterlace-rgb.cpp \
!  deinterlace-yuv.c
  
  
  avicap_LDADD = \
--- 177,184 ----
   vidconf.cpp \
   vidconf_p.cpp \
   deinterlace-rgb.cpp \
!  deinterlace-yuv.c \
!  timertable.cpp
  
  
  avicap_LDADD = \
***************
*** 240,246 ****
  	picprop.$(OBJEXT) picprop_p.$(OBJEXT) qtrenderer.$(OBJEXT) \
  	qt_visual.$(OBJEXT) v4lwindow.$(OBJEXT) v4lxif.$(OBJEXT) \
  	vidconf.$(OBJEXT) vidconf_p.$(OBJEXT) deinterlace-rgb.$(OBJEXT) \
! 	deinterlace-yuv.$(OBJEXT)
  avicap_OBJECTS = $(am_avicap_OBJECTS)
  avicap_DEPENDENCIES = ../../libavqt/libqavm.la ../../lib/libaviplay.la
  avicap_LDFLAGS =
--- 242,248 ----
  	picprop.$(OBJEXT) picprop_p.$(OBJEXT) qtrenderer.$(OBJEXT) \
  	qt_visual.$(OBJEXT) v4lwindow.$(OBJEXT) v4lxif.$(OBJEXT) \
  	vidconf.$(OBJEXT) vidconf_p.$(OBJEXT) deinterlace-rgb.$(OBJEXT) \
! 	deinterlace-yuv.$(OBJEXT) timertable.$(OBJEXT)
  avicap_OBJECTS = $(am_avicap_OBJECTS)
  avicap_DEPENDENCIES = ../../libavqt/libqavm.la ../../lib/libaviplay.la
  avicap_LDFLAGS =
***************
*** 270,277 ****
  @AMDEP_TRUE@	./$(DEPDIR)/kv4lsetup.Po ./$(DEPDIR)/main.Po \
  @AMDEP_TRUE@	./$(DEPDIR)/picprop.Po ./$(DEPDIR)/picprop_p.Po \
  @AMDEP_TRUE@	./$(DEPDIR)/qt_visual.Po ./$(DEPDIR)/qtrenderer.Po \
! @AMDEP_TRUE@	./$(DEPDIR)/v4lwindow.Po ./$(DEPDIR)/v4lxif.Po \
! @AMDEP_TRUE@	./$(DEPDIR)/vidconf.Po ./$(DEPDIR)/vidconf_p.Po
  COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
--- 272,280 ----
  @AMDEP_TRUE@	./$(DEPDIR)/kv4lsetup.Po ./$(DEPDIR)/main.Po \
  @AMDEP_TRUE@	./$(DEPDIR)/picprop.Po ./$(DEPDIR)/picprop_p.Po \
  @AMDEP_TRUE@	./$(DEPDIR)/qt_visual.Po ./$(DEPDIR)/qtrenderer.Po \
! @AMDEP_TRUE@	./$(DEPDIR)/timertable.Po ./$(DEPDIR)/v4lwindow.Po \
! @AMDEP_TRUE@	./$(DEPDIR)/v4lxif.Po ./$(DEPDIR)/vidconf.Po \
! @AMDEP_TRUE@	./$(DEPDIR)/vidconf_p.Po
  COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
***************
*** 363,368 ****
--- 366,372 ----
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
+ @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
  @AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
***************
*** 576,581 ****
--- 580,586 ----
  $(srcdir)/avicapwnd_p.cpp: avicapwnd_p.moc
  $(srcdir)/picprop_p.cpp: picprop_p.moc
  $(srcdir)/vidconf.cpp: vidconf.moc
+ $(srcdir)/timertable.cpp: timertable.moc
  
  ui:
  	$(UIC) ./capwindow.ui -o ./capwindow_p.h
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/avicapwnd.cpp avifile0.7-0.7.33-alex/samples/qtvidcap/avicapwnd.cpp
*** avifile0.7-0.7.33/samples/qtvidcap/avicapwnd.cpp	2002-11-01 13:12:56.000000000 +0100
--- avifile0.7-0.7.33-alex/samples/qtvidcap/avicapwnd.cpp	2003-03-12 18:16:46.000000000 +0100
***************
*** 32,41 ****
   *  Constructs a AviCapDialog which is a child of 'parent', with the
   *  name 'name' and widget flags set to 'f'
   */
! AviCapDialog::AviCapDialog( V4LWindow* pWnd )
      : AviCapDlg( 0 ),
      m_pWnd(pWnd), m_pProgress(0), m_bStarted(false)
  {
      connect(CloseButton, SIGNAL(clicked()), this, SLOT(close()));
      connect(StartButton, SIGNAL(clicked()), this, SLOT(start()));
      connect(SegmentButton, SIGNAL(clicked()), this, SLOT(segment()));
--- 32,43 ----
   *  Constructs a AviCapDialog which is a child of 'parent', with the
   *  name 'name' and widget flags set to 'f'
   */
! AviCapDialog::AviCapDialog( V4LWindow* pWnd ,CaptureConfig *conf)
      : AviCapDlg( 0 ),
      m_pWnd(pWnd), m_pProgress(0), m_bStarted(false)
  {
+   my_config=conf;
+ 
      connect(CloseButton, SIGNAL(clicked()), this, SLOT(close()));
      connect(StartButton, SIGNAL(clicked()), this, SLOT(start()));
      connect(SegmentButton, SIGNAL(clicked()), this, SLOT(segment()));
***************
*** 53,58 ****
--- 55,64 ----
   */
  AviCapDialog::~AviCapDialog()
  {
+   if(my_config){
+     delete my_config;
+     my_config=NULL;
+   }
  }
  
  
***************
*** 69,77 ****
--- 75,88 ----
      connect(StartButton, SIGNAL(clicked()), this, SLOT(stop()));
      try
      {
+       if(my_config==NULL){
  	CaptureConfig conf;
  	conf.load();
  	m_pCapproc = new CaptureProcess(m_pWnd->m_pDev, &conf, m_pCC);
+       }
+       else{
+ 	m_pCapproc = new CaptureProcess(m_pWnd->m_pDev, my_config, m_pCC);
+       }
      }
      catch (FatalError& e)
      {
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/avicapwnd.h avifile0.7-0.7.33-alex/samples/qtvidcap/avicapwnd.h
*** avifile0.7-0.7.33/samples/qtvidcap/avicapwnd.h	2001-08-28 22:48:17.000000000 +0200
--- avifile0.7-0.7.33-alex/samples/qtvidcap/avicapwnd.h	2003-03-12 18:13:48.000000000 +0100
***************
*** 6,11 ****
--- 6,14 ----
  class CaptureProcess;
  class CaptureProgress;
  class ClosedCaption;
+ 
+ struct CaptureConfig;
+ 
  class AviCapDialog : public AviCapDlg
  { 
      Q_OBJECT
***************
*** 16,25 ****
      ClosedCaption* m_pCC;
      bool m_bStarted;
      int m_eOldMode;
  public:
!     AviCapDialog(V4LWindow* pWnd);
      // QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
      ~AviCapDialog();
  public slots:
      void start();
      void segment();
--- 19,32 ----
      ClosedCaption* m_pCC;
      bool m_bStarted;
      int m_eOldMode;
+ 
+     CaptureConfig *my_config;
  public:
!     AviCapDialog(V4LWindow* pWnd,CaptureConfig *conf);
      // QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
      ~AviCapDialog();
+     CaptureProcess *getCaptureProcess() { return m_pCapproc; };
+ 
  public slots:
      void start();
      void segment();
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/capproc.h avifile0.7-0.7.33-alex/samples/qtvidcap/capproc.h
*** avifile0.7-0.7.33/samples/qtvidcap/capproc.h	2002-10-05 17:39:26.000000000 +0200
--- avifile0.7-0.7.33-alex/samples/qtvidcap/capproc.h	2003-03-12 18:11:36.000000000 +0100
***************
*** 205,210 ****
--- 205,211 ----
      void setChannels(Sound_Chans c);
      void setSamplesize(Sample_Sizes ss);
      void setFrequency(Sound_Freqs freq);
+   void setFilename(avm::string fname) { filename=fname; };
  };
  
  template <class Type> class lockqring : public avm::qring<Type>
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/timertable.cpp avifile0.7-0.7.33-alex/samples/qtvidcap/timertable.cpp
*** avifile0.7-0.7.33/samples/qtvidcap/timertable.cpp	1970-01-01 01:00:00.000000000 +0100
--- avifile0.7-0.7.33-alex/samples/qtvidcap/timertable.cpp	2003-03-15 05:43:43.000000000 +0100
***************
*** 0 ****
--- 1,689 ----
+ /*
+   TimerTable window for AviCap
+ 
+   written 2003 by Alexander Rawass ([EMAIL PROTECTED])
+ */
+ 
+ #include "vidconf.h"
+ #include "v4lwindow.h"
+ #include "capproc.h"
+ #include "codecdialog.h"
+ 
+ #include <avm_fourcc.h>
+ #include <utils.h>
+ #include <cpuinfo.h>
+ #include <creators.h>
+ #define DECLARE_REGISTRY_SHORTCUT
+ #include <configfile.h>
+ 
+ #include <qcheckbox.h>
+ #include <qcombobox.h>
+ #include <qfiledialog.h>
+ #include <qlabel.h>
+ #include <qlineedit.h>
+ #include <qpushbutton.h>
+ #include <qspinbox.h>
+ #include <qtabwidget.h>
+ #include <qlistview.h>
+ #include <qdatetimeedit.h>
+ #include <qcombobox.h>
+ #include <qsplitter.h>
+ #include <qgroupbox.h>
+ #include <qlayout.h>
+ #include <qpushbutton.h>
+ #include <qbuttongroup.h>
+ #include <qmessagebox.h>
+ 
+ #include <stdio.h>
+ #include <stdlib.h> // atof
+ #include <qtabwidget.h>
+ 
+ #include <stdio.h>
+ #include <stdlib.h> // atof
+ 
+ #include "avicapwnd.h"
+ #include "timertable.h"
+ 
+ void TimerTableItem::setTable(int ch,QDateTime start,QTime stop,QString fname) {
+   channel_nr=ch;
+   start_time=start;
+   stop_time=stop;
+   filename=fname;
+   
+   stop_datetime=timer_window->calc_stopDateTime(start_time,stop_time);
+ 
+   QString start_timestr=start_time.toString(my_dateformat);
+   QString stop_timestr=stop_time.toString(my_timeformat);
+ 
+   setText(0,QString::number(channel_nr));
+   setText(1,my_v4lwin->getXawtvStation(channel_nr).c_str());
+   setText(2,start_timestr);
+   setText(3,stop_timestr);
+   setText(4,filename);
+ 
+ }
+ 
+ TimerTableItem::TimerTableItem(QListView *parent,TimerTable *timer_win,V4LWindow *v4lw,int ch,QDateTime start,QTime stop,QString fname) : QCheckListItem(parent,"test",QCheckListItem::CheckBox){
+   timer_window=timer_win;
+   my_v4lwin=v4lw;
+ 
+   setTable(ch,start,stop,fname);
+ }
+ 
+ TimerTableItem::~TimerTableItem(){
+ }
+ 
+ TimerTable::TimerTable( QWidget* parent, v4lxif* v4l, V4LWindow* w)
+   : QDialog( NULL, "Avicap Timertable", false)
+ {
+ 
+   setMinimumSize(600,600);
+   setMaximumSize(800,800);
+   setCaption("AviCap Timertable");
+ 
+   timer_mode=TimerOff;
+   next_recording=NULL;
+   current_recording=NULL;
+   last_item_clicked=NULL;
+   shutdown_message=NULL;
+ 
+   my_v4lxif=v4l;
+   my_v4lw=w;
+ 
+   splitter1=new QSplitter(QSplitter::Vertical,this);
+   splitter1->setOpaqueResize(true);
+ 
+   table=new QListView(splitter1);
+   table->setBaseSize(600,200);
+   table->setMinimumSize(600,200);
+   table->setMaximumSize(800,800);
+   table->setSelectionMode(QListView::Single);
+   connect(table,SIGNAL(pressed(QListViewItem *)),this,SLOT(item_clicked(QListViewItem *)));
+ 
+   table->addColumn("ChNr.");
+   table->addColumn("Channel Name");
+   table->addColumn("Start Recording");
+   table->addColumn("End Recording");
+   table->setColumnAlignment(3,Qt::AlignRight);
+   table->addColumn("Filename");
+ 
+   all_box=new QGroupBox(1,Qt::Horizontal,splitter1);
+   all_box->setBaseSize(600,600);
+   all_box->setMinimumSize(600,600);
+   all_box->setMaximumSize(600,800);
+ 
+   splitter1->setResizeMode(all_box,QSplitter::Stretch);
+   splitter1->setResizeMode(table,QSplitter::Stretch);
+ 
+   //edit_box=new QGroupBox(2,Qt::Horizontal,all_box);
+   edit_box=new QWidget(all_box);
+   //edit_box=new QGroupBox(splitter1);
+   edit_box->setBaseSize(600,200);
+ 
+ 
+     QGridLayout* gl = new QGridLayout( edit_box, 1, 1 );
+     gl->setSpacing( 5 );
+     gl->setMargin( 5 );
+ 
+     int row=0;
+ 
+     QLabel *l=new QLabel("Start Date/Time:",edit_box);
+     gl->addWidget(l,row,0);
+ 
+   begin_timeedit=new QDateTimeEdit(edit_box,"start_time");
+   gl->addWidget(begin_timeedit,row,1);
+ 
+   row++;
+     QLabel *l2=new QLabel("End Time:",edit_box);
+     gl->addWidget(l2,row,0);
+   end_timeedit=new QTimeEdit(edit_box,"end_time");
+   gl->addWidget(end_timeedit,row,1);
+ 
+   row++;
+     QLabel *l3=new QLabel("Channel:",edit_box);
+     gl->addWidget(l3,row,0);
+   channelbox=new QComboBox(edit_box,"channel");
+   gl->addWidget(channelbox,row,1);
+ 
+     if (my_v4lw->getStationSize())
+     {
+ 	for (int i = 0; i < my_v4lw->getStationSize(); i++)
+ 	  channelbox->insertItem(my_v4lw->getXawtvStation(i).c_str());
+     }
+ 
+   row++;
+     QLabel *l4=new QLabel("Filename:",edit_box);
+     gl->addWidget(l4,row,0);
+   filename_edit=new QLineEdit(edit_box,"filename");
+   gl->addWidget(filename_edit,row,1);
+ 
+   edit_box->hide();
+ 
+     edit_buttons=new QButtonGroup(3,Qt::Horizontal,all_box);
+ 
+     new_button=new QPushButton("new",edit_buttons);
+     modify_button=new QPushButton("modify",edit_buttons);
+     remove_button=new QPushButton("remove",edit_buttons);
+ 
+     rec_buttons=new QButtonGroup(2,Qt::Horizontal,all_box);
+ 
+     rec_start_button=new QPushButton("start timer",rec_buttons);
+ 
+     shutdown_checkbox=new QCheckBox("shutdown when finished",rec_buttons);
+ 
+     connect(new_button,SIGNAL(pressed()),this,SLOT(button_new_pressed()));
+     connect(modify_button,SIGNAL(pressed()),this,SLOT(button_modify_pressed()));
+     connect(remove_button,SIGNAL(pressed()),this,SLOT(button_remove_pressed()));
+ 
+     connect(rec_start_button,SIGNAL(pressed()),this,SLOT(button_start_pressed()));
+ 
+     QWidget *wi=new QWidget(all_box);
+     QVBoxLayout *lo=new QVBoxLayout(wi);
+     status_label=new QLabel(wi);
+     lo->addWidget(status_label);
+ 
+ 
+     load();
+     if(table->childCount()>0){
+       edit_box->show();
+ 
+       TimerTableItem *first_item=(TimerTableItem *)table->firstChild();
+       table->setCurrentItem(first_item);
+       table->setSelected(first_item,true);
+       last_item_clicked=first_item;
+     }
+ 
+     init_entry_widgets();
+     set_status_label();
+ 
+     my_timer=new QTimer(this);
+     connect(my_timer,SIGNAL(timeout()),SLOT(timer()));
+     my_timer->start(1000);
+ }
+ 
+ TimerTable::~TimerTable(){
+   my_timer->stop();
+   save();
+ }
+ 
+ void TimerTable::add_current_time_info(char *bigbuf){
+   char sbuf[300];
+   
+   sprintf(sbuf,"Current Time : %s\n",QDateTime::currentDateTime().toString(my_dateformat).latin1());
+   strcat(bigbuf,sbuf);
+ }
+ 
+ void TimerTable::add_next_recording_info(char *bigbuf){
+   char sbuf[500];
+ 
+   QDateTime currenttime=QDateTime::currentDateTime();
+ 
+     if(next_recording){
+       QDateTime starttime=next_recording->getStartTime();
+ 
+       int diff_in_secs=currenttime.secsTo(starttime);
+       //printf("%d secs to wait\n",diff_in_secs);
+ 
+       QTime notime=QTime();
+ 
+       QTime eta=notime.addSecs(diff_in_secs);
+       
+       int chnr=next_recording->getChannel();
+       
+       avm::string chname=my_v4lw->getXawtvStation(chnr);
+       
+       QString fname=next_recording->getFilename();
+ 
+       sprintf(sbuf,"Next Recording starts at %s in %s\nChannel Nr %d  %s\nFilename %s\n",starttime.toString(my_dateformat).latin1(),eta.toString(my_timeformat).latin1(),chnr,chname.c_str(),fname.latin1());
+     }
+     else{
+       sprintf(sbuf,"No Next Recording\n");
+     }
+     strcat(bigbuf,sbuf);
+ }
+ 
+ void TimerTable::add_current_recording_info(char *bigbuf){
+   char sbuf[500];
+   QDateTime currenttime=QDateTime::currentDateTime();
+ 
+     if(current_recording){
+       QDateTime stoptime=current_recording->getStopDateTime();
+ 
+       int diff_in_secs=currenttime.secsTo(stoptime);
+       //printf("%d secs to go\n",diff_in_secs);
+ 
+       QTime notime=QTime();
+ 
+       QTime eta=notime.addSecs(diff_in_secs);
+       
+       int chnr=current_recording->getChannel();
+       
+       avm::string chname=my_v4lw->getXawtvStation(chnr);
+       
+       QString fname=current_recording->getFilename();
+ 
+       sprintf(sbuf,"Currently Recording: stops at %s in %s\nChannel Nr %d  %s\nFilename %s\n",stoptime.toString(my_dateformat).latin1(),eta.toString(my_timeformat).latin1(),chnr,chname.c_str(),fname.latin1());
+     }
+     else{
+       sprintf(sbuf,"No Current Recording\n");
+     }
+     strcat(bigbuf,sbuf);
+ }
+ 
+ void TimerTable::add_sanity_check_info(char *bigbuf){
+   char sbuf[400];
+ 
+   TimerTableItem *item1=(TimerTableItem *)table->firstChild();
+ 
+   bool insane=false;
+   while(!insane && item1!=NULL){
+     if(item1->isOn()){
+       TimerTableItem *item2=(TimerTableItem *)table->firstChild();
+ 
+       while(!insane && item2!=NULL){
+ 	if(item2!=item1 && item2->isOn()){
+ 	  QDateTime start1=item1->getStartTime();
+ 	  QDateTime stop1=item1->getStopDateTime();
+ 
+ 	  QDateTime start2=item2->getStartTime();
+ 	  QDateTime stop2=item2->getStopDateTime();
+ 	  
+ 	  if((start1<start2 && start2<stop1) || (start2<start1 && start1<stop2)){
+ 	    // do I have to do more sanity checks???
+ 	    avm::string chn1=my_v4lw->getXawtvStation(item1->getChannel());
+ 	    avm::string chn2=my_v4lw->getXawtvStation(item2->getChannel());
+ 
+ 	    sprintf(sbuf,"sanity check failed:\na) %10s from %s to %s\nb) %10s from %s to %s\n",chn1.c_str(), \
+ 		   item1->getStartTime().toString(my_dateformat).latin1(), \
+ 		   item1->getStopDateTime().toString(my_dateformat).latin1(),
+ 		   chn2.c_str(),
+ 		   item2->getStartTime().toString(my_dateformat).latin1(), \
+ 		   item2->getStopDateTime().toString(my_dateformat).latin1());
+ 	    strcat(bigbuf,sbuf);
+ 	    insane=true;
+ 	  }
+ 	}
+ 	item2=(TimerTableItem *)item2->nextSibling();
+       }
+     }
+ 
+     item1=(TimerTableItem *)item1->nextSibling();
+   }
+ }
+ 
+ void TimerTable::set_status_label(){
+     char bigbuf[1000];
+     bigbuf[0]='\0';
+ 
+     QDateTime currenttime=QDateTime::currentDateTime();
+ 
+     if(timer_mode==TimerOff){
+       sprintf(bigbuf,"Current Time: %s\nTimer not activated\n",currenttime.toString(my_dateformat).latin1());
+       status_label->setText(bigbuf);
+     }
+   else if(timer_mode==TimerWaiting){
+ 
+     add_current_time_info(bigbuf);
+     add_next_recording_info(bigbuf);
+     add_sanity_check_info(bigbuf);
+ 
+     status_label->setText(bigbuf);
+   }
+   else if(timer_mode==TimerRecording){
+ 
+     add_current_time_info(bigbuf);
+     add_current_recording_info(bigbuf);
+     add_next_recording_info(bigbuf);
+     add_sanity_check_info(bigbuf);
+ 
+     status_label->setText(bigbuf);
+   }
+ }
+ 
+ void TimerTable::init_entry_widgets(){
+   begin_timeedit->setDateTime(QDateTime::currentDateTime());
+ 
+   end_timeedit->setTime(QTime::currentTime());
+ 
+   filename_edit->setText("./movie.avi");
+ 
+   channelbox->setCurrentItem(0);
+ }
+ 
+ void TimerTable::item_clicked(QListViewItem *lvitem){
+   TimerTableItem *item=(TimerTableItem *)lvitem;
+ 
+   if(item!=NULL){
+     begin_timeedit->setDateTime(item->getStartTime());
+ 
+     end_timeedit->setTime(item->getStopTime());
+ 
+     filename_edit->setText(item->getFilename());
+ 
+     channelbox->setCurrentItem(item->getChannel());
+ 
+     last_item_clicked=item;
+   }
+ }
+ 
+ void TimerTable::button_new_pressed(){
+   edit_box->show();
+   init_entry_widgets();
+   TimerTableItem *newitem=set_tableitem(NULL);
+ 
+   table->setCurrentItem(newitem);
+   table->setSelected(newitem,true);
+   last_item_clicked=newitem;
+ }
+ 
+ TimerTableItem * TimerTable::set_tableitem(TimerTableItem *item){
+   QDateTime start_time=begin_timeedit->dateTime();
+   QTime stop_time=end_timeedit->time();
+ 
+   int channel_nr=channelbox->currentItem();
+ 
+   QString filename=filename_edit->text();
+ 
+   QString stationname=my_v4lw->getXawtvStation(channel_nr).c_str();
+ 
+   QString start_timestr=start_time.toString(my_dateformat);
+   QString stop_timestr=stop_time.toString(my_timeformat);
+ 
+   if(item!=NULL){
+     item->setTable(channel_nr,start_time,stop_time,filename);
+   }
+   else{
+     item=new TimerTableItem(table,this,my_v4lw,channel_nr,start_time,stop_time,filename);
+   }
+ 
+     return item;
+ }
+ 
+ void TimerTable::button_modify_pressed(){
+   //    TimerTableItem *item=(TimerTableItem *)table->currentItem();
+ 
+   TimerTableItem *item=last_item_clicked;
+ 
+     if(item!=NULL){
+       set_tableitem(item);
+     }
+ 
+     save();
+ }
+ 
+ 
+ void TimerTable::button_remove_pressed(){
+   TimerTableItem *item=(TimerTableItem *)table->currentItem();
+ 
+   if(item==current_recording){
+     printf("can't remove - it's the current recording\n");
+   }
+   else{
+     if(item==next_recording){
+       next_recording=NULL;
+     }
+     if(item==last_item_clicked){
+       last_item_clicked=NULL;
+     }
+     table->takeItem(item);
+     delete item;
+     save();
+   }
+ }
+ 
+ TimerTableItem  *TimerTable::find_first_recording(){
+   TimerTableItem *item=(TimerTableItem *)table->firstChild();
+ 
+   QDateTime currenttime=QDateTime::currentDateTime();
+   QDateTime found_date=currenttime;
+ 
+   TimerTableItem *found_item=NULL;
+ 
+   while(item!=NULL){
+     if(item->isOn()){
+       QDateTime new_date=item->getStartTime();
+ 
+       if(new_date>currenttime){
+ 	// we ignore recordings in the past
+ 	if(new_date<found_date || found_date==currenttime){
+ 	  found_date=new_date;
+ 	  found_item=item;
+ 	}
+       }
+     }
+     
+     item=(TimerTableItem *)item->nextSibling();
+   }
+ 
+   if(found_item){
+     if(found_date>currenttime){
+       return found_item;
+     }
+ 
+     return NULL;
+   }
+ 
+   return NULL;
+ }
+ 
+ void TimerTable::button_start_pressed(){
+   save();
+ 
+   if(timer_mode==TimerOff){
+     if(table->childCount()>0){
+ 
+       TimerTableItem *first_item=find_first_recording();
+ 
+       if(first_item!=NULL){
+ 	next_recording=first_item;
+ 
+ 	timer_mode=TimerWaiting;
+ 	rec_start_button->setText("Stop Timer");
+       }
+     }
+     else{
+       printf("no programs, timer not started\n");
+     }
+   }
+   else if(timer_mode==TimerRecording){
+     printf("can't switch off timer while recording with timer\n");
+   }
+   else if(timer_mode==TimerWaiting){
+     timer_mode=TimerOff;
+     rec_start_button->setText("Start Timer");
+     next_recording=NULL;
+   }
+   set_status_label();
+ }
+ 
+ void TimerTable::timer(){
+ 
+   next_recording=find_first_recording();
+ 
+   if(next_recording && timer_mode==TimerWaiting){
+     QDateTime  start_time=next_recording->getStartTime();
+ 
+     QDateTime currenttime=QDateTime::currentDateTime();
+ 
+     int secs_to_go=currenttime.secsTo(start_time);
+ 
+     if(secs_to_go<10){
+       // we start recording actually 10 secs before the time
+    
+       // stop old recording if necessary
+       stop_current_recording();
+ 
+ 
+    my_v4lw->setXawtv(next_recording->getChannel());
+ 
+    CaptureConfig *conf=new CaptureConfig();
+    conf->load();
+    conf->setFilename(next_recording->getFilename().latin1());
+ 
+    my_v4lw->captureAVI(conf); //make the new capture window
+ 
+    AviCapDialog *dialog=my_v4lw->getCaptureDialog();
+ 
+    if(dialog!=NULL){
+      dialog->start(); // run the thing
+      timer_mode=TimerRecording;
+      current_recording=next_recording;
+    }
+  }
+   }
+   else if(timer_mode==TimerRecording && current_recording){
+     //check if we have to switch off current recording
+     QDateTime  stop_time=current_recording->getStopDateTime();
+ 
+     QDateTime currenttime=QDateTime::currentDateTime();
+ 
+     //int secs_to_go=currenttime.secsTo(stop_time);
+ 
+     //printf("%d secs to go to stop recording\n",secs_to_go);
+     if(currenttime  > stop_time){
+       stop_current_recording();
+       current_recording=NULL;
+       timer_mode=TimerWaiting;
+     }
+ 
+   }
+   else if(timer_mode==TimerWaiting && next_recording==NULL && current_recording==NULL){
+     // no more recordings, can we shutdown?
+ 
+     bool shutdown=shutdown_checkbox->isChecked();
+     
+     if(shutdown && !shutdown_message){
+       // open up a new message
+       printf("shutdown!\n");
+       shutdown_message=new QMessageBox("AviCap Shutdown warning","System is going to shutdown\n\nin some seconds\n",QMessageBox::Critical,QMessageBox::Abort,QMessageBox::NoButton,QMessageBox::NoButton,this);
+       shutdown_message->show();
+       shutdown_time=QDateTime::currentDateTime();
+       shutdown_time=shutdown_time.addSecs(3*60);
+     }
+     else if(shutdown && shutdown_message){
+       QDateTime currenttime=QDateTime::currentDateTime();
+       int secsto=currenttime.secsTo(shutdown_time);
+       printf("secs to shutdown: %d res=%d\n",secsto,shutdown_message->result());
+       if(shutdown_message->result()==5){
+ 	// abort shutdown
+ 	delete shutdown_message;
+ 	shutdown_message=NULL;
+ 	shutdown_checkbox->setChecked(0);
+       }
+       else if(secsto>0){
+ 	char buf[300];
+ 	sprintf(buf,"System is going to shutdown\n\n in %d seconds\n",secsto);
+ 	shutdown_message->setText(buf);
+ 	shutdown_message->show();
+       }
+       else{
+ 	save();
+ 
+ 	// SHUTDOWN NOW
+ 
+ 	system("sudo avicap-shutdown &");
+ 
+ 	//exit avicap
+ 	exit(0);
+       }
+     }
+   }
+  set_status_label();
+ }
+ 
+ void TimerTable::stop_current_recording(){
+      // stop old recording
+    AviCapDialog *dialog_old=my_v4lw->getCaptureDialog();
+    if(dialog_old!=NULL){
+      CaptureProcess *capproc=dialog_old->getCaptureProcess();
+ 
+      if(capproc!=NULL){
+        // there's a recording running
+        dialog_old->stop();
+        dialog_old->close();
+      }
+    }
+ }
+ 
+ QDateTime TimerTable::calc_stopDateTime(QDateTime start_datetime,QTime stop_time){
+   QTime start_time=start_datetime.time();
+   QDate start_date=start_datetime.date();
+ 
+   QDateTime stop_datetime(start_date,stop_time);
+ 
+   if(start_time > stop_time ){
+     // the recording ends the next day
+     stop_datetime=stop_datetime.addDays(1);
+   }
+ 
+   return stop_datetime;
+ }
+ 
+ void TimerTable::load(){
+     int i=0;
+     char buf[300];
+ 
+     sprintf(buf,"TT-%02d-StartTime",i);
+     avm::string starttimestr=RS(buf,"NONE");
+ 
+     while(starttimestr!="NONE"){
+       QDateTime starttime=QDateTime::fromString(starttimestr.c_str());
+ 
+       sprintf(buf,"TT-%02d-StopTime",i);
+       avm::string stoptimestr=RS(buf,"NONE");
+       QTime stoptime=QTime::fromString(stoptimestr.c_str());
+ 
+       sprintf(buf,"TT-%02d-Channel",i);
+       int channel=RI(buf,0);
+ 
+       sprintf(buf,"TT-%02d-Filename",i);
+       avm::string filename=RS(buf,"./movie.avi");
+       
+       TimerTableItem *item=new TimerTableItem(table,this,my_v4lw,channel,starttime,stoptime,filename.c_str());
+ 
+       sprintf(buf,"TT-%02d-Active",i);
+       int ison=RI(buf,1);
+ 
+       item->setOn(ison);
+       
+       i++;
+ 
+       sprintf(buf,"TT-StartTime-%02d",i);
+       starttimestr=RS(buf,"NONE");
+ 
+     } 
+  
+ 
+ }
+ 
+ void TimerTable::save(){
+   int i=0;
+   char buf[200];
+ 
+   TimerTableItem *item=(TimerTableItem *)table->firstChild();
+ 
+   while(item!=NULL){
+     sprintf(buf,"TT-%02d-StartTime",i);
+     //WS(buf,item->getStartTime().toString(my_dateformat).latin1());
+     WS(buf,item->getStartTime().toString().latin1());
+     sprintf(buf,"TT-%02d-StopTime",i);
+     WS(buf,item->getStopTime().toString().latin1());
+     sprintf(buf,"TT-%02d-Channel",i);
+     WI(buf,item->getChannel());
+     sprintf(buf,"TT-%02d-Filename",i);
+     WS(buf,item->getFilename().latin1());
+     sprintf(buf,"TT-%02d-Active",i);
+     WI(buf,item->isOn());
+     
+     item=(TimerTableItem *)item->nextSibling();
+     i++;
+   }
+ 
+   // make sure that's the last one...
+ 
+     sprintf(buf,"TT-StartTime-%02d",i);
+     WS(buf,"NONE");
+ 
+ }
+ 		       
+ #include "timertable.moc"
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/timertable.h avifile0.7-0.7.33-alex/samples/qtvidcap/timertable.h
*** avifile0.7-0.7.33/samples/qtvidcap/timertable.h	1970-01-01 01:00:00.000000000 +0100
--- avifile0.7-0.7.33-alex/samples/qtvidcap/timertable.h	2003-03-13 06:52:04.000000000 +0100
***************
*** 0 ****
--- 1,146 ----
+ /*
+   TimerTable window for AviCap
+ 
+   written 2003 by Alexander Rawass ([EMAIL PROTECTED])
+ */
+ 
+ #ifndef timertable_h
+ #define timertable_h
+ 
+ #include <qwidget.h>
+ #include <qtimer.h>
+ #include <qlistview.h>
+ 
+ #include <avm_stl.h>
+ #include <avm_locker.h>
+ 
+ class v4lxif;
+ class V4LWindow;
+ 
+ class QPopupMenu;
+ class QLabel;
+ class QListView;
+ class QComboBox;
+ class QDateTimeEdit;
+ class QTimeEdit;
+ class QSplitter;
+ class QGroupBox;
+ class QPushButton;
+ class QButtonGroup;
+ class QLineEdit;
+ class QListViewItem;
+ class QFrame;
+ class QMessageBox;
+ 
+ class TimerTable;
+ 
+ static QString my_timeformat="hh:mm:ss";
+ static QString my_dateformat=("dd MMM yyyy    "+my_timeformat);
+ 
+ enum TimerMode { TimerOff,TimerWaiting,TimerRecording };
+ 
+ //#define my_tabletype QListView
+ //#define my_tableitemtype QListViewItem
+ 
+ class TimerTableItem: public QCheckListItem
+ {
+ 
+ public:
+   TimerTableItem(QListView *parent,TimerTable *timer_win,V4LWindow *v4lw,int ch,QDateTime start,QTime stop,QString fname);
+   //TimerTableItem(QWidget *parent);
+   ~TimerTableItem();
+ 
+   void  setTable(int ch,QDateTime start,QTime stop,QString fname);
+ 
+  private:
+   QDateTime start_time;
+   QTime  stop_time;
+   QDateTime stop_datetime;
+   int channel_nr;
+   QString filename;
+   TimerTable *timer_window;
+   V4LWindow *my_v4lwin;
+ 
+  public:
+   QDateTime getStartTime() { return start_time; };
+   QTime getStopTime() { return stop_time; };
+   QDateTime getStopDateTime() { return stop_datetime; };
+   QString getFilename() { return filename; };
+   int getChannel() { return channel_nr; };
+ 
+ 
+ };
+ 
+ class TimerTable: public QDialog
+ {
+     Q_OBJECT
+ public:
+ 
+     TimerTable( QWidget* parent, v4lxif* v4l, V4LWindow* w);
+     ~TimerTable();
+   void save();
+   void load();
+   QDateTime calc_stopDateTime(QDateTime start_datetime,QTime stop_time);
+ 
+ public slots:
+   void button_new_pressed();
+   void button_remove_pressed();
+   void button_modify_pressed();
+   void button_start_pressed();
+   void item_clicked(QListViewItem *item);
+   void timer();
+ 
+ protected:
+ 
+ private:
+   void   init_entry_widgets();
+   void   set_status_label();
+   TimerTableItem *find_first_recording();
+   TimerTableItem *   set_tableitem(TimerTableItem *item);
+   void stop_current_recording();
+   void  add_current_time_info(char *bigbuf);
+   void  add_current_recording_info(char *bigbuf);
+   void  add_next_recording_info(char *bigbuf);
+   void  add_sanity_check_info(char *bigbuf);
+ 
+   TimerMode timer_mode;
+ 
+  v4lxif *my_v4lxif;
+  V4LWindow *my_v4lw;
+ 
+  QSplitter *splitter1;
+  //QGroupBox  *edit_box;
+  QWidget  *edit_box;
+  QGroupBox  *all_box;
+ 
+  QListView *table;
+  QComboBox *channelbox;
+ 
+  QDateTimeEdit *begin_timeedit;
+  QTimeEdit *end_timeedit;
+  QLineEdit *filename_edit;
+ 
+  QButtonGroup *edit_buttons;
+  QPushButton *new_button;
+  QPushButton *modify_button;
+  QPushButton *remove_button;
+ 
+  QButtonGroup *rec_buttons;
+  QPushButton *rec_start_button;
+  QPushButton *rec_stop_button;
+  QCheckBox *shutdown_checkbox;
+ 
+  QFrame *status_frame;
+  QLabel *status_label;
+ 
+  QMessageBox *shutdown_message;
+  QDateTime shutdown_time;
+ 
+  TimerTableItem *next_recording;
+  TimerTableItem *current_recording;
+  TimerTableItem *last_item_clicked;
+ 
+  QTimer *my_timer;
+ };
+ 
+ #endif
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/v4lwindow.cpp avifile0.7-0.7.33-alex/samples/qtvidcap/v4lwindow.cpp
*** avifile0.7-0.7.33/samples/qtvidcap/v4lwindow.cpp	2002-10-05 17:39:26.000000000 +0200
--- avifile0.7-0.7.33-alex/samples/qtvidcap/v4lwindow.cpp	2003-03-12 20:28:21.000000000 +0100
***************
*** 36,41 ****
--- 36,43 ----
  #endif
  #include <unistd.h>
  
+ #include "timertable.h"
+ 
  #include "v4lwindow.moc"
  
  static inline void default_dimensions(int& w, int& h)
***************
*** 49,55 ****
      : QWidget(pParent, 0, 0),
      m_pDev(pDev), m_pRenderer(0), visibility(VisibilityFullyObscured),
      oc_count(0), m_eMode(Overlay), m_iPainter(0),
!     m_pPopup(0), m_pPicConfig(0),
      m_pCapDialog(0), m_pCC(0), m_pLabel(0),
      m_bForce4x3(true), m_bSubtitles(false),
      known_pos(false), m_bAutoRecord(false), m_bMoved(false)
--- 51,57 ----
      : QWidget(pParent, 0, 0),
      m_pDev(pDev), m_pRenderer(0), visibility(VisibilityFullyObscured),
      oc_count(0), m_eMode(Overlay), m_iPainter(0),
!       m_pPopup(0), m_pPicConfig(0),m_pTimerTable(0),
      m_pCapDialog(0), m_pCC(0), m_pLabel(0),
      m_bForce4x3(true), m_bSubtitles(false),
      known_pos(false), m_bAutoRecord(false), m_bMoved(false)
***************
*** 83,88 ****
--- 85,91 ----
      refresh_timer();
      WI("DisplayMode", m_eMode);
      WI("Subtitles", m_bSubtitles);
+     delete m_pTimerTable;
      delete m_pDev;
      delete m_pPicConfig;
  }
***************
*** 333,338 ****
--- 336,342 ----
      }
  
      m_pPopup->insertItem("Picture properties", this, SLOT(picprop()));
+     m_pPopup->insertItem("Timertable", this, SLOT(timertable()));
      m_pPopup->insertItem("Capture AVI", this, SLOT(captureAVI()));
      m_pPopup->insertItem("Capture BMP", this, SLOT(captureBMP()));
  //    m_pPopup->insertItem("Capture JPG", this, SLOT(captureJPG()));
***************
*** 593,603 ****
      }
  }
  
! void V4LWindow::captureAVI()
  {
      if(m_pCapDialog)
  	return;
!     m_pCapDialog=new AviCapDialog(this);
  //    QPoint pnt=mapToGlobal(QPoint(0,0));
  //    m_pCapDialog->move(pnt.x(), pnt.y()+height()+40);
      m_pDev->setCapture(0);
--- 597,612 ----
      }
  }
  
! void V4LWindow::captureAVI(){
!   // use the default config
!   captureAVI(NULL);
! }
! 
! void V4LWindow::captureAVI(CaptureConfig *capconf)
  {
      if(m_pCapDialog)
  	return;
!     m_pCapDialog=new AviCapDialog(this,capconf);
  //    QPoint pnt=mapToGlobal(QPoint(0,0));
  //    m_pCapDialog->move(pnt.x(), pnt.y()+height()+40);
      m_pDev->setCapture(0);
***************
*** 763,768 ****
--- 772,792 ----
      }
  }
  
+ void V4LWindow::timertable(){
+ 
+   if(!m_pTimerTable){
+     m_pTimerTable=new TimerTable(this,m_pDev,this);
+     QPoint pnt=mapToGlobal(QPoint(0,0));
+     m_pTimerTable->move(pnt.x(), pnt.y()+height()+20);
+   }
+ 
+     if (m_pTimerTable->isVisible())
+ 	m_pTimerTable->hide();
+     else
+ 	m_pTimerTable->show();
+ 
+ }
+ 
  void V4LWindow::picprop()
  {
      if (!m_pPicConfig)
diff -N -c -r avifile0.7-0.7.33/samples/qtvidcap/v4lwindow.h avifile0.7-0.7.33-alex/samples/qtvidcap/v4lwindow.h
*** avifile0.7-0.7.33/samples/qtvidcap/v4lwindow.h	2002-10-05 17:39:26.000000000 +0200
--- avifile0.7-0.7.33-alex/samples/qtvidcap/v4lwindow.h	2003-03-12 18:14:20.000000000 +0100
***************
*** 11,16 ****
--- 11,19 ----
  class ClosedCaption;
  class PicturePropDialog;
  class ShmRenderer;
+ class TimerTable;
+ 
+ struct CaptureConfig;
  
  class QPopupMenu;
  class QLabel;
***************
*** 32,37 ****
--- 35,42 ----
      ClosedCaption* getcc() { return m_pCC; }
      Modes getMode() const { return m_eMode; }
      void setMode(Modes m);
+     AviCapDialog *getCaptureDialog() { return m_pCapDialog; }
+     void captureAVI(CaptureConfig *capconf);
  
  public slots:
      void captureAVI();
***************
*** 43,48 ****
--- 48,54 ----
      void hidePopup();
      void overlay();
      void picprop();
+     void timertable();
      void preview();
      void preview_display();
      void setXawtv(int);
***************
*** 95,100 ****
--- 101,107 ----
      avm::PthreadMutex m_Mutex;
      QPopupMenu* m_pPopup;
      PicturePropDialog* m_pPicConfig;
+     TimerTable *m_pTimerTable;
      AviCapDialog* m_pCapDialog;
      ClosedCaption* m_pCC;
      QLabel* m_pLabel;
***************
*** 113,118 ****
--- 120,130 ----
      bool known_pos;
      bool m_bAutoRecord;
      bool m_bMoved;
+ 
+ 
+  public:
+     avm::string getXawtvStation(int i) { return xawtvstations[i].sname; }
+     int getStationSize() { return xawtvstations.size(); }
  };
  
  #endif

Reply via email to