]> git.sesse.net Git - vlc/commitdiff
* open dialog: look for subtitles in the same directory as the movie
authorYoann Peronneau <yoann@videolan.org>
Mon, 26 Mar 2007 22:23:37 +0000 (22:23 +0000)
committerYoann Peronneau <yoann@videolan.org>
Mon, 26 Mar 2007 22:23:37 +0000 (22:23 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp

index d71feaf49f76ac0ece4dbf56a68182457d70047f..1612c68f401cec3334937cf3508e516e2e779c21 100644 (file)
@@ -122,7 +122,8 @@ void FileOpenPanel::browseFileSub()
 {
     // FIXME Handle selection of more than one subtitles file
     QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
-                                               EXT_FILTER_SUBTITLE );
+                            EXT_FILTER_SUBTITLE,
+                            dialogBox->directory().absolutePath() );
     ui.subInput->setEditText( files.join(" ") );
     updateMRL();
 }
index e64481d23b873c07e8cdeb5bb1ba3982743d02b6..33d93c6e393778acd5ec1075d86102b6e5f4e65f 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>
@@ -44,7 +45,7 @@
 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 */ );
@@ -195,7 +196,8 @@ void DialogsProvider::MLAppendDialog()
 }
 
 /**** Simple open ****/
-QStringList DialogsProvider::showSimpleOpen( QString help, int filters )
+QStringList DialogsProvider::showSimpleOpen( QString help, int filters,
+                                             QString path )
 {
     QString fileTypes = "";
     if( filters & EXT_FILTER_MEDIA ) {
@@ -216,10 +218,9 @@ QStringList DialogsProvider::showSimpleOpen( QString help, int filters )
     ADD_FILTER_ALL( fileTypes );
     fileTypes.replace(QString(";*"), QString(" *"));
     return QFileDialog::getOpenFileNames( NULL,
-                                          help.isNull() ?
-                                              qfu(I_OP_SEL_FILES ) : help,
-                                          qfu( p_intf->p_libvlc->psz_homedir ),
-                                          fileTypes );
+        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)
index a11c93590d3f6fdd189428893e88d9b2cc3e970d..d32ca26059af176c075d39906f3f10a4f035e7b8 100644 (file)
@@ -99,7 +99,8 @@ public:
     QStringList showSimpleOpen( QString help = QString(),
                                 int filters = EXT_FILTER_MEDIA |
                                 EXT_FILTER_VIDEO | EXT_FILTER_AUDIO |
-                                EXT_FILTER_PLAYLIST );
+                                EXT_FILTER_PLAYLIST,
+                                QString path = QString() );
 protected:
     friend class QVLCMenu;
     QSignalMapper *menusMapper;