]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs_provider.cpp
Qt4 - wording corrections. By Llynix
[vlc] / modules / gui / qt4 / dialogs_provider.cpp
index ca2d503ecf4da6faadee3b8ed7070626c72f3699..c0d8141410f383a64afd522c758a14c14a411508 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * main_inteface.cpp : Main interface
- ****************************************************************************
+ *****************************************************************************
  * Copyright (C) 2006 the VideoLAN team
  * $Id$
  *
@@ -18,7 +18,8 @@
  *
  * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #include <QEvent>
 #include <QApplication>
 
 /* The dialogs */
 #include "dialogs/playlist.hpp"
-#include "dialogs/prefs_dialog.hpp"
+#include "dialogs/preferences.hpp"
 #include "dialogs/mediainfo.hpp"
 #include "dialogs/messages.hpp"
 #include "dialogs/extended.hpp"
 #include "dialogs/sout.hpp"
 #include "dialogs/open.hpp"
 #include "dialogs/help.hpp"
+#include "dialogs/gototime.hpp"
 
 DialogsProvider* DialogsProvider::instance = NULL;
 
 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
-                                      QObject( NULL ), p_intf( _p_intf )
+                                  QObject( NULL ), p_intf( _p_intf )
 {
     fixed_timer = new QTimer( this );
     fixed_timer->start( 150 /* milliseconds */ );
@@ -79,30 +81,39 @@ void DialogsProvider::customEvent( QEvent *event )
         DialogEvent *de = static_cast<DialogEvent*>(event);
         switch( de->i_dialog )
         {
+            case INTF_DIALOG_FILE_SIMPLE:
             case INTF_DIALOG_FILE:
+                openDialog(); break;
             case INTF_DIALOG_DISC:
+                openDiscDialog(); break;
             case INTF_DIALOG_NET:
+                openNetDialog(); break;
+            case INTF_DIALOG_SAT:
             case INTF_DIALOG_CAPTURE:
-                openDialog( de->i_dialog ); break;
+                openCaptureDialog(); break;
             case INTF_DIALOG_PLAYLIST:
                 playlistDialog(); break;
             case INTF_DIALOG_MESSAGES:
                 messagesDialog(); break;
+            case INTF_DIALOG_FILEINFO:
+               mediaInfoDialog(); break;
             case INTF_DIALOG_PREFS:
                prefsDialog(); break;
+            case INTF_DIALOG_BOOKMARKS:
+               bookmarksDialog(); break;
+            case INTF_DIALOG_EXTENDED:
+               extendedDialog(); break;
             case INTF_DIALOG_POPUPMENU:
             case INTF_DIALOG_AUDIOPOPUPMENU:
             case INTF_DIALOG_VIDEOPOPUPMENU:
             case INTF_DIALOG_MISCPOPUPMENU:
                popupMenu( de->i_dialog ); break;
-            case INTF_DIALOG_FILEINFO:
-               mediaInfoDialog(); break;
             case INTF_DIALOG_INTERACTION:
                doInteraction( de->p_arg ); break;
             case INTF_DIALOG_VLM:
-            case INTF_DIALOG_BOOKMARKS:
-               bookmarksDialog(); break;
             case INTF_DIALOG_WIZARD:
+            case INTF_DIALOG_UPDATEVLC:
+            case INTF_DIALOG_EXIT:
             default:
                msg_Warn( p_intf, "unimplemented dialog\n" );
         }
@@ -131,6 +142,11 @@ void DialogsProvider::messagesDialog()
     MessagesDialog::getInstance( p_intf )->toggleVisible();
 }
 
+void DialogsProvider::gotoTimeDialog()
+{
+    GotoTimeDialog::getInstance( p_intf )->toggleVisible();
+}
+
 void DialogsProvider::helpDialog()
 {
     HelpDialog::getInstance( p_intf )->toggleVisible();
@@ -146,6 +162,11 @@ void DialogsProvider::mediaInfoDialog()
     MediaInfoDialog::getInstance( p_intf )->toggleVisible();
 }
 
+void DialogsProvider::mediaCodecDialog()
+{
+    MediaInfoDialog::getInstance( p_intf )->showTab( 1 );
+}
+
 void DialogsProvider::bookmarksDialog()
 {
 }
@@ -158,43 +179,60 @@ void DialogsProvider::openDialog()
 {
     openDialog( 0 );
 }
-void DialogsProvider::PLAppendDialog()
+void DialogsProvider::openFileDialog()
 {
+    openDialog( 0 );
 }
-void DialogsProvider::MLAppendDialog()
+void DialogsProvider::openDiscDialog()
 {
+    openDialog( 1 );
+}
+void DialogsProvider::openNetDialog()
+{
+    openDialog( 2 );
+}
+void DialogsProvider::openCaptureDialog()
+{
+    openDialog( 3 );
 }
 void DialogsProvider::openDialog( int i_tab )
 {
-    OpenDialog::getInstance( p_intf->p_sys->p_mi  , p_intf )->showTab( i_tab );
+    OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
 }
 
-/**** Simple open ****/
+void DialogsProvider::PLAppendDialog()
+{
+}
+void DialogsProvider::MLAppendDialog()
+{
+}
 
-QStringList DialogsProvider::showSimpleOpen()
-{
-    QString FileTypes;
-    FileTypes = _("Media Files");
-    FileTypes += " ( ";
-    FileTypes += EXTENSIONS_MEDIA;
-    FileTypes += ");;";
-    FileTypes += _("Video Files");
-    FileTypes += " ( ";
-    FileTypes += EXTENSIONS_VIDEO;
-    FileTypes += ");;";
-    FileTypes += _("Sound Files");
-    FileTypes += " ( ";
-    FileTypes += EXTENSIONS_AUDIO;
-    FileTypes += ");;";
-    FileTypes += _("PlayList Files");
-    FileTypes += " ( ";
-    FileTypes += EXTENSIONS_PLAYLIST;
-    FileTypes += ");;";
-    FileTypes += _("All Files");
-    FileTypes += " (*.*)";
-    FileTypes.replace(QString(";*"), QString(" *"));
-    return QFileDialog::getOpenFileNames( NULL, qfu(I_OP_SEL_FILES ),
-                    p_intf->p_libvlc->psz_homedir, FileTypes );
+/**** Simple open ****/
+QStringList DialogsProvider::showSimpleOpen( QString help, int filters,
+                                             QString path )
+{
+    QString fileTypes = "";
+    if( filters & EXT_FILTER_MEDIA ) {
+        ADD_FILTER_MEDIA( fileTypes );
+    }
+    if( filters & EXT_FILTER_VIDEO ) {
+        ADD_FILTER_VIDEO( fileTypes );
+    }
+    if( filters & EXT_FILTER_AUDIO ) {
+        ADD_FILTER_AUDIO( fileTypes );
+    }
+    if( filters & EXT_FILTER_PLAYLIST ) {
+        ADD_FILTER_PLAYLIST( fileTypes );
+    }
+    if( filters & EXT_FILTER_SUBTITLE ) {
+        ADD_FILTER_SUBTITLE( fileTypes );
+    }
+    ADD_FILTER_ALL( fileTypes );
+    fileTypes.replace(QString(";*"), QString(" *"));
+    return QFileDialog::getOpenFileNames( NULL,
+        help.isNull() ? qfu(I_OP_SEL_FILES ) : help,
+        path.isNull() ? qfu( p_intf->p_libvlc->psz_homedir ) : path,
+        fileTypes );
 }
 
 void DialogsProvider::addFromSimple( bool pl, bool go)
@@ -209,7 +247,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
                       PLAYLIST_END,
-                      pl ? VLC_TRUE : VLC_FALSE );
+                      pl ? VLC_TRUE : VLC_FALSE, VLC_FALSE );
         i++;
     }
 }
@@ -231,7 +269,8 @@ void DialogsProvider::simpleOpenDialog()
 
 void DialogsProvider::openPlaylist()
 {
-    QStringList files = showSimpleOpen();
+    QStringList files = showSimpleOpen( qtr( "Open playlist file" ),
+                                        EXT_FILTER_PLAYLIST );
     foreach( QString file, files )
     {
         playlist_Import( THEPL, qtu(file) );
@@ -242,9 +281,9 @@ void DialogsProvider::savePlaylist()
 {
     QFileDialog *qfd = new QFileDialog( NULL,
                                    qtr("Choose a filename to save playlist"),
-                                   p_intf->p_libvlc->psz_homedir,
-                                   qfu("XSPF playlist (*.xspf);; ") +
-                                   qfu("M3U playlist (*.m3u);; Any (*.*) ") );
+                                   qfu( p_intf->p_libvlc->psz_homedir ),
+                                   qtr("XSPF playlist (*.xspf);; ") +
+                                   qtr("M3U playlist (*.m3u);; Any (*.*) ") );
     qfd->setFileMode( QFileDialog::AnyFile );
     qfd->setAcceptMode( QFileDialog::AcceptSave );
     qfd->setConfirmOverwrite( true );
@@ -288,7 +327,7 @@ static void openDirectory( intf_thread_t* p_intf, bool pl, bool go )
                                                0, NULL, -1 );
     playlist_AddInput( THEPL, p_input,
                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
-                       PLAYLIST_END, pl);
+                       PLAYLIST_END, pl, VLC_FALSE );
     input_Read( THEPL, p_input, VLC_FALSE );
 }
 
@@ -323,7 +362,7 @@ void DialogsProvider::streamingDialog()
 
             playlist_AddExt( THEPL, qtu( o->mrl ), "Streaming",
                              PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-                             -1, &psz_option, 1, VLC_TRUE );
+                             -1, &psz_option, 1, VLC_TRUE, VLC_FALSE );
         }
         delete s;
     }