open_panels.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * open.hpp : Panels for the open dialogs
00003  ****************************************************************************
00004  * Copyright (C) 2006-2009 the VideoLAN team
00005  * Copyright (C) 2007 Société des arts technologiques
00006  * Copyright (C) 2007 Savoir-faire Linux
00007  * $Id: 4d2d05b0a24fa16e7562ab0223f25a3e4157eddc $
00008  *
00009  * Authors: Clément Stenac <zorglub@videolan.org>
00010  *          Jean-Baptiste Kempf <jb@videolan.org>
00011  *          Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00026  *****************************************************************************/
00027 
00028 #ifndef _OPENPANELS_H_
00029 #define _OPENPANELS_H_
00030 
00031 #ifdef HAVE_CONFIG_H
00032 # include "config.h"
00033 #endif
00034 
00035 #include "components/preferences_widgets.hpp"
00036 
00037 #include "ui/open_file.h"
00038 #include "ui/open_disk.h"
00039 #include "ui/open_net.h"
00040 #include "ui/open_capture.h"
00041 
00042 #include <QFileDialog>
00043 
00044 #include <limits.h>
00045 
00046 #define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
00047     spinbox->setAccelerated( true ); }
00048 
00049 enum
00050 {
00051     V4L_DEVICE,
00052     V4L2_DEVICE,
00053     PVR_DEVICE,
00054     DVB_DEVICE,
00055     BDA_DEVICE,
00056     DSHOW_DEVICE,
00057     SCREEN_DEVICE,
00058     JACK_DEVICE
00059 };
00060 
00061 class QWidget;
00062 class QLineEdit;
00063 class QString;
00064 class QStringListModel;
00065 
00066 class OpenPanel: public QWidget
00067 {
00068     Q_OBJECT
00069 public:
00070     OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
00071     {
00072         p_intf = _p_intf;
00073     }
00074     virtual ~OpenPanel() {};
00075     virtual void clear() = 0;
00076 protected:
00077     intf_thread_t *p_intf;
00078 public slots:
00079     virtual void updateMRL() = 0;
00080 signals:
00081     void mrlUpdated( const QStringList&, const QString& );
00082     void methodChanged( const QString& method );
00083 };
00084 
00085 class FileOpenBox: public QFileDialog
00086 {
00087     Q_OBJECT
00088 public:
00089     FileOpenBox( QWidget *parent, const QString &caption,
00090                  const QString &directory, const QString &filter ):
00091                 QFileDialog( parent, caption, directory, filter ) {}
00092 public slots:
00093     void accept(){}
00094     void reject(){}
00095 };
00096 
00097 
00098 class FileOpenPanel: public OpenPanel
00099 {
00100     Q_OBJECT
00101 public:
00102     FileOpenPanel( QWidget *, intf_thread_t * );
00103     virtual ~FileOpenPanel();
00104     virtual void clear() ;
00105     virtual void accept() ;
00106 protected:
00107     bool eventFilter(QObject *obj, QEvent *event)
00108     {
00109         if( event->type() == QEvent::Hide ||
00110             event->type() == QEvent::HideToParent )
00111         {
00112             event->accept();
00113             return true;
00114         }
00115         return false;
00116     }
00117 private:
00118     Ui::OpenFile ui;
00119     FileOpenBox *dialogBox;
00120     void BuildOldPanel();
00121 public slots:
00122     virtual void updateMRL();
00123 private slots:
00124     void browseFileSub();
00125     void browseFile();
00126     void removeFile();
00127     void updateButtons();
00128     void toggleSubtitleFrame( bool );
00129 };
00130 
00131 class NetOpenPanel: public OpenPanel
00132 {
00133     Q_OBJECT
00134 public:
00135     NetOpenPanel( QWidget *, intf_thread_t * );
00136     virtual ~NetOpenPanel();
00137     virtual void clear() ;
00138 private:
00139     Ui::OpenNetwork ui;
00140     QStringListModel *mrlList;
00141 public slots:
00142     virtual void updateMRL();
00143 private slots:
00144     void updateCompleter();
00145 };
00146 
00147 class DiscOpenPanel: public OpenPanel
00148 {
00149     Q_OBJECT
00150 public:
00151     DiscOpenPanel( QWidget *, intf_thread_t * );
00152     virtual ~DiscOpenPanel();
00153     virtual void clear() ;
00154     virtual void accept() ;
00155 private:
00156     Ui::OpenDisk ui;
00157     char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
00158     bool b_firstdvd, b_firstvcd, b_firstcdda;
00159 public slots:
00160     virtual void updateMRL() ;
00161 private slots:
00162     void browseDevice();
00163     void updateButtons() ;
00164     void eject();
00165 };
00166 
00167 
00168 class CaptureOpenPanel: public OpenPanel
00169 {
00170     Q_OBJECT
00171 public:
00172     CaptureOpenPanel( QWidget *, intf_thread_t * );
00173     virtual ~CaptureOpenPanel();
00174     virtual void clear() ;
00175 private:
00176     Ui::OpenCapture ui;
00177     bool isInitialized;
00178 
00179     QString advMRL;
00180     QDialog *adv;
00181 #ifdef WIN32
00182     QRadioButton *bdas, *bdat, *bdac, *bdaa;
00183     QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
00184     QLabel *bdaSrateLabel, *bdaBandLabel;
00185     QComboBox *bdaBandBox;
00186     StringListConfigControl *vdevDshowW, *adevDshowW;
00187     QLineEdit *dshowVSizeLine;
00188 #else
00189     QRadioButton *dvbs, *dvbt, *dvbc;
00190     QLabel *dvbBandLabel, *dvbSrateLabel;
00191     QSpinBox  *v4lFreq, *pvrFreq, *pvrBitr;
00192     QLineEdit *v4lVideoDevice, *v4lAudioDevice;
00193     QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
00194     QLineEdit *pvrDevice, *pvrRadioDevice;
00195     QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox, *dvbBandBox;
00196     QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
00197     QSpinBox *jackChannels, *jackCaching;
00198     QCheckBox *jackPace, *jackConnect;
00199     QLineEdit *jackPortsSelected;
00200 #endif
00201     QDoubleSpinBox *screenFPS;
00202 
00203 public slots:
00204     virtual void updateMRL();
00205     void initialize();
00206 private slots:
00207     void updateButtons();
00208     void advancedDialog();
00209 };
00210 
00211 #endif

Generated on Tue May 25 08:04:57 2010 for VLC by  doxygen 1.5.6