[vlc-commits] Qt: probe the complete names for Volume in Disc open

Jean-Baptiste Kempf git at videolan.org
Wed Mar 16 23:02:47 CET 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Mar 16 23:01:07 2011 +0100| [83602675734db0687dbc5afa2a3a6c420f7556dd] | committer: Jean-Baptiste Kempf

Qt: probe the complete names for Volume in Disc open

This gets quite useful, when you have many drives

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=83602675734db0687dbc5afa2a3a6c420f7556dd
---

 modules/gui/qt4/components/open_panels.cpp |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 78ef67c..845317d 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -37,6 +37,9 @@
 #include "util/qt_dirs.hpp"
 #include <vlc_intf_strings.h>
 #include <vlc_modules.h>
+#ifdef WIN32
+  #include <vlc_charset.h> /* FromWide for Win32 */
+#endif
 
 #include <QFileDialog>
 #include <QDialogButtonBox>
@@ -346,17 +349,25 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
 
 #ifdef WIN32 /* Disc drives probing for Windows */
-    char szDrives[512];
+    wchar_t szDrives[512];
     szDrives[0] = '\0';
-    if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
+    if( GetLogicalDriveStringsW( sizeof( szDrives ) - 1, szDrives ) )
     {
-        char *drive = szDrives;
+        wchar_t *drive = szDrives;
         UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
         while( *drive )
         {
-            if( GetDriveTypeA(drive) == DRIVE_CDROM )
+            if( GetDriveTypeW(drive) == DRIVE_CDROM )
             {
-                ui.deviceCombo->addItem( drive );
+                wchar_t psz_name[512] = L"";
+                GetVolumeInformationW( drive, psz_name, 511, NULL, NULL, NULL, NULL, 0 );
+
+                QString displayName = FromWide( drive );
+                if( !EMPTY_STR(psz_name) ) {
+                    displayName = displayName + " - "  + FromWide( psz_name );
+                }
+
+                ui.deviceCombo->addItem( displayName, FromWide( drive ) );
             }
 
             /* go to next drive */



More information about the vlc-commits mailing list