]> git.sesse.net Git - vlc/commitdiff
Merge branch 'master' of git@git.videolan.org:vlc
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Apr 2009 20:27:33 +0000 (23:27 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Apr 2009 20:27:33 +0000 (23:27 +0300)
modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp
modules/video_output/xcb/window.c

index 0cbb871306084d38148a91d831d0cd492d21dbd5..325b38c3fac3725e7b8c8ecfe0cfdcf486172206 100644 (file)
@@ -113,7 +113,7 @@ inline void FileOpenPanel::BuildOldPanel()
 
     /* Make this QFileDialog a child of tempWidget from the ui. */
     dialogBox = new FileOpenBox( ui.tempWidget, NULL,
-            qfu( p_intf->p_sys->psz_filepath ), "" );
+                                 p_intf->p_sys->filepath, "" );
 
     dialogBox->setFileMode( QFileDialog::ExistingFiles );
     dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
@@ -190,7 +190,7 @@ void FileOpenPanel::browseFileSub()
 {
     // TODO Handle selection of more than one subtitles file
     QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
-                           EXT_FILTER_SUBTITLE, p_intf->p_sys->psz_filepath );
+                           EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath );
 
     if( files.isEmpty() ) return;
     ui.subInput->setText( files.join(" ") );
@@ -240,8 +240,7 @@ void FileOpenPanel::updateMRL()
 /* Function called by Open Dialog when clicke on Play/Enqueue */
 void FileOpenPanel::accept()
 {
-    //FIXME
- //   p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
+    p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
     ui.fileListWidg->clear();
 }
 
index 65f6e0b146c4c31acee816e8548f396a0379aecd..ed1af0b8aa8b83455b890f997dc18bb3c22cf05e 100644 (file)
@@ -277,7 +277,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
     if( p_arg->b_save )
     {
         QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
-                            qfu( p_intf->p_sys->psz_filepath ), extensions );
+                                        p_intf->p_sys->filepath, extensions );
         if( !file.isEmpty() )
         {
             p_arg->i_results = 1;
@@ -290,7 +290,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
     else /* non-save mode */
     {
         QStringList files = QFileDialog::getOpenFileNames( NULL,
-                p_arg->psz_title, qfu( p_intf->p_sys->psz_filepath ),
+                p_arg->psz_title, p_intf->p_sys->filepath,
                 extensions );
         p_arg->i_results = files.count();
         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
@@ -386,7 +386,7 @@ QStringList DialogsProvider::showSimpleOpen( QString help,
 
     return QFileDialog::getOpenFileNames( NULL,
         help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
-        path.isEmpty() ? qfu( p_intf->p_sys->psz_filepath ) : path,
+        path.isEmpty() ? p_intf->p_sys->filepath : path,
         fileTypes );
 }
 
@@ -512,7 +512,7 @@ void DialogsProvider::saveAPlaylist()
 {
     QFileDialog *qfd = new QFileDialog( NULL,
                                    qtr( "Save playlist as..." ),
-                                   qfu( p_intf->p_sys->psz_filepath ),
+                                   p_intf->p_sys->filepath,
                                    qtr( "XSPF playlist (*.xspf);; " ) +
                                    qtr( "M3U playlist (*.m3u);; " ) +
                                    qtr( "HTML playlist (*.html)" ) );
index c74fc208bbec6ca82c67f92be6674f98f591bed4..bddb8bd905f248a5a0597b084f4c89c444afacf6 100644 (file)
@@ -278,6 +278,7 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_intf, "Could not connect to X server" );
         return VLC_EGENERIC;
     }
+    XCloseDisplay( p_display );
 #endif
 
     /* Allocations of p_sys */
@@ -286,9 +287,6 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_popup_menu = NULL;
     p_sys->p_mi = NULL;
     p_sys->p_playlist = pl_Hold( p_intf );
-#ifdef Q_WS_X11
-    p_sys->display = p_display;
-#endif
 
     /* */
     if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
@@ -335,9 +333,6 @@ static void Close( vlc_object_t *p_this )
     QVLCApp::triggerQuit();
 
     vlc_join (p_sys->thread, NULL);
-#ifdef Q_WS_X11
-    XCloseDisplay ((Display *)p_sys->display);
-#endif
     pl_Release (p_this);
     delete p_sys;
 }
@@ -349,8 +344,8 @@ static void *Thread( void *obj )
 {
     intf_thread_t *p_intf = (intf_thread_t *)obj;
     MainInterface *p_mi;
-    char dummy[] = "";
-    char *argv[] = { dummy };
+    char dummy[] = "vlc"; /* for WM_CLASS */
+    char *argv[] = { dummy, NULL, };
     int argc = 1;
 
     Q_INIT_RESOURCE( vlc );
@@ -368,10 +363,15 @@ static void *Thread( void *obj )
 
     /* Start the QApplication here */
 #ifdef Q_WS_X11
-    QVLCApp app( (Display *)p_intf->p_sys->display, argc, argv );
-#else
-    QVLCApp app( argc, argv );
+    char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
+    if( display )
+    {
+        argv[argc++] = const_cast<char *>("-display");
+        argv[argc++] = display;
+        argv[argc] = NULL;
+    }
 #endif
+    QVLCApp app( argc, argv );
     p_intf->p_sys->p_app = &app;
 
 
@@ -460,9 +460,12 @@ static void *Thread( void *obj )
     app.setQuitOnLastWindowClosed( false );
 
     /* Retrieve last known path used in file browsing */
-    char *psz_path = config_GetPsz( p_intf, "qt-filedialog-path" );
-    p_intf->p_sys->psz_filepath = EMPTY_STR( psz_path ) ? config_GetHomeDir()
-                                                        : psz_path;
+    {
+        char *psz_path = config_GetPsz( p_intf, "qt-filedialog-path" );
+        p_intf->p_sys->filepath =
+            EMPTY_STR(psz_path) ? config_GetHomeDir() : qfu(psz_path);
+        free( psz_path );
+    }
 
     /* Launch */
     app.exec();
@@ -501,10 +504,11 @@ static void *Thread( void *obj )
 
 
     /* Save the path */
-    config_PutPsz( p_intf, "qt-filedialog-path", p_intf->p_sys->psz_filepath );
-    free( psz_path );
+    config_PutPsz( p_intf, "qt-filedialog-path",
+                   qtu(p_intf->p_sys->filepath) );
 
     /* Delete the application automatically */
+    free( display );
     return NULL;
 }
 
index 9077cb900d23a4a027e9abe291e8d3e1bb5963ad..e2f7ec5f51c94120348bd8289d58caba1fe11044 100644 (file)
@@ -34,6 +34,7 @@
 #include <vlc_playlist.h>  /* playlist_t */
 
 #include <QEvent>
+#include <QString>
 
 #if ( QT_VERSION < 0x040300 )
 # error Update your Qt version
@@ -72,12 +73,9 @@ struct intf_sys_t
 
     playlist_t *p_playlist;  /* Core Playlist discussion */
 
-    const char *psz_filepath; /* Last path used in dialogs */
+    QString filepath;        /* Last path used in dialogs */
 
     QMenu * p_popup_menu;    /* The right click menu */
-#ifdef Q_WS_X11 /* WTH is this included in ALL files? :( */
-    void *display;
-#endif
 };
 
 #define THEPL p_intf->p_sys->p_playlist
index e35fa6b1654e6162fa8d257e5ce23f66bd267b2a..c1d3e4410e3adb3beec968e0199b6539f9e78216 100644 (file)
@@ -147,7 +147,7 @@ static int Open (vlc_object_t *obj)
     set_ascii_prop (conn, window, XA_WM_ICON_NAME,
                     pgettext ("ASCII VLC", "VLC"));
     xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, XA_WM_CLASS,
-                         XA_STRING, 8, 8, "vlc\0VLC");
+                         XA_STRING, 8, 8, "vlc\0Vlc");
     set_hostname_prop (conn, window);
 
     wnd->handle.xid = window;