Commit 1b5ab075 authored by Eric Petit's avatar Eric Petit

* InterfaceWindow.cpp : fixed DVD drag & drop

 * PreferencesWindow.* : added the possibility not to use DVD menus
parent ba6cada9
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.17 2003/01/14 22:03:38 titer Exp $
* $Id: InterfaceWindow.cpp,v 1.18 2003/01/16 15:26:23 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -457,7 +457,72 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
BPath path( &ref );
if ( path.InitCheck() == B_OK )
files.AddItem( new BString( (char*)path.Path() ) );
{
bool add = true;
// has the user dropped a dvd disk icon?
BDirectory dir( &ref );
if ( dir.InitCheck() == B_OK && dir.IsRootDirectory() )
{
BVolumeRoster volRoster;
BVolume vol;
BDirectory volumeRoot;
status_t status = volRoster.GetNextVolume( &vol );
while( status == B_NO_ERROR )
{
if( vol.GetRootDirectory( &volumeRoot ) == B_OK
&& dir == volumeRoot )
{
BString volumeName;
BString deviceName;
bool isCDROM = false;
bool success = false;
deviceName = "";
volumeName = "";
char name[B_FILE_NAME_LENGTH];
if ( vol.GetName( name ) >= B_OK ) // disk is currently mounted
{
volumeName = name;
dev_t dev = vol.Device();
fs_info info;
if ( fs_stat_dev( dev, &info ) == B_OK )
{
success = true;
deviceName = info.device_name;
if ( vol.IsReadOnly() )
{
int i_dev = open( info.device_name, O_RDONLY );
if ( i_dev >= 0 )
{
device_geometry g;
if ( ioctl( i_dev, B_GET_GEOMETRY, &g, sizeof( g ) ) >= 0 )
isCDROM = ( g.device_type == B_CD );
close( i_dev );
}
}
}
}
if( success && isCDROM )
{
BMessage msg( OPEN_DVD );
msg.AddString( "device", deviceName.String() );
PostMessage( &msg );
add = false;
}
break;
}
else
{
vol.Unset();
status = volRoster.GetNextVolume( &vol );
}
}
}
if( add )
{
files.AddItem( new BString( (char*)path.Path() ) );
}
}
}
// give the list to VLC
p_wrapper->openFiles(&files, replace);
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.6 2003/01/14 16:00:49 titer Exp $
* $Id: PreferencesWindow.cpp,v 1.7 2003/01/16 15:26:23 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -57,14 +57,14 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
fTabView = new BTabView( rect, "preferences view" );
fTabView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fFfmpegView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fFfmpegView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fGeneralView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fGeneralView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fAdjustView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fAdjustView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
fFfmpegTab = new BTab();
fTabView->AddTab( fFfmpegView, fFfmpegTab );
fFfmpegTab->SetLabel( "Ffmpeg" );
fGeneralTab = new BTab();
fTabView->AddTab( fGeneralView, fGeneralTab );
fGeneralTab->SetLabel( "General" );
fAdjustTab = new BTab();
fTabView->AddTab( fAdjustView, fAdjustTab );
......@@ -72,8 +72,18 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
/* fills the tabs */
/* ffmpeg tab */
rect = fFfmpegView->Bounds();
rect = fGeneralView->Bounds();
rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 10;
fOldDvdCheck = new BCheckBox( rect, "olddvd", "Do not use DVD menus",
new BMessage( OLDDVD_CHECK ) );
fGeneralView->AddChild( fOldDvdCheck );
fprintf( stderr, "%s\n", config_GetPsz( p_intf, "access" ) );
if( config_GetPsz( p_intf, "access" ) &&
!strncmp( config_GetPsz( p_intf, "access" ), "dvdold,any", 10 ) )
fOldDvdCheck->SetValue( 1 );
rect.top = rect.bottom + 20;
rect.bottom = rect.top + 30;
fPpSlider = new BSlider( rect, "post-processing", "MPEG4 post-processing level",
new BMessage( SLIDER_UPDATE ),
......@@ -83,7 +93,7 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
fPpSlider->SetHashMarkCount( 7 );
fPpSlider->SetLimitLabels( "None", "Maximum" );
fPpSlider->SetValue( config_GetInt( p_intf, "ffmpeg-pp-q" ) );
fFfmpegView->AddChild( fPpSlider );
fGeneralView->AddChild( fPpSlider );
/* adjust tab */
......@@ -167,6 +177,7 @@ void PreferencesWindow::MessageReceived( BMessage * p_message )
{
switch ( p_message->what )
{
case OLDDVD_CHECK:
case SLIDER_UPDATE:
{
ApplyChanges();
......@@ -210,6 +221,7 @@ void PreferencesWindow::ReallyQuit()
*****************************************************************************/
void PreferencesWindow::SetDefaults()
{
fOldDvdCheck->SetValue( 0 );
fPpSlider->SetValue( 0 );
fBrightnessSlider->SetValue( 100 );
fContrastSlider->SetValue( 100 );
......@@ -222,6 +234,11 @@ void PreferencesWindow::SetDefaults()
*****************************************************************************/
void PreferencesWindow::ApplyChanges()
{
if( fOldDvdCheck->Value() )
config_PutPsz( p_intf, "access", "dvdold,any" );
else
config_PutPsz( p_intf, "access", NULL );
config_PutInt( p_intf, "ffmpeg-pp-q", fPpSlider->Value() );
config_PutFloat( p_intf, "brightness",
(float)fBrightnessSlider->Value() / 100 );
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.4 2003/01/14 16:00:49 titer Exp $
* $Id: PreferencesWindow.h,v 1.5 2003/01/16 15:26:23 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -33,6 +33,7 @@
#define PREFS_SAVE 'prsa'
#define PREFS_DEFAULTS 'prde'
#define SLIDER_UPDATE 'slup'
#define OLDDVD_CHECK 'olch'
class PreferencesWindow : public BWindow
{
......@@ -49,10 +50,11 @@ class PreferencesWindow : public BWindow
void ApplyChanges();
BView * fPrefsView;
BTabView * fTabView;
BView * fFfmpegView;
BView * fGeneralView;
BView * fAdjustView;
BTab * fFfmpegTab;
BTab * fGeneralTab;
BTab * fAdjustTab;
BCheckBox * fOldDvdCheck;
BSlider * fPpSlider;
BSlider * fContrastSlider;
BSlider * fBrightnessSlider;
......
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