Commit 83602675 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: probe the complete names for Volume in Disc open

This gets quite useful, when you have many drives
parent 77360d65
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include "util/qt_dirs.hpp" #include "util/qt_dirs.hpp"
#include <vlc_intf_strings.h> #include <vlc_intf_strings.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#ifdef WIN32
#include <vlc_charset.h> /* FromWide for Win32 */
#endif
#include <QFileDialog> #include <QFileDialog>
#include <QDialogButtonBox> #include <QDialogButtonBox>
...@@ -346,17 +349,25 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ...@@ -346,17 +349,25 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) ); ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
#ifdef WIN32 /* Disc drives probing for Windows */ #ifdef WIN32 /* Disc drives probing for Windows */
char szDrives[512]; wchar_t szDrives[512];
szDrives[0] = '\0'; 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 ); UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
while( *drive ) 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 */ /* go to next drive */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment