Commit ea3e2be6 authored by Stephan Assmus's avatar Stephan Assmus

modules/gui/beos/PreferenceWindow.h/.cpp

	- added settings for screenshot path and image format

	- removed "Save" button, added "Cancel" and "Revert" buttons

	- added revert functionality

	- changed class design for cleaner functionality,
		separated ApplyChanges() into more functions
		to have finer control

	- added more error checking and fixed memory leaks
		(config_GetPsz() returns char*, not const char*!)

	- all settings are now correctly saved and restored

	- some more cosmetic changes


modules/gui/beos/InterfaceWindow.h/.cpp

	- updated vlc way of saving settings to be on par with BeOS way
		and made it selectable in the code which way is used.
		However, the VideoSettings are still only savable in
		the BeOS way.

	- if dvd menus are used, the navigation menu enables a
		"Goto Menu" item. Unfortunately, I don't see a clean
		way to really detect the usage of dvd/dvdold in the
		currently playing stream. I wouldn't want to see
		if a playlist item has "dvd:" or "dvdold:" prepended
		at each interface update.
parent 0d558bdf
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
/* The configuration file and directory */ /* The configuration file and directory */
#ifdef SYS_BEOS #ifdef SYS_BEOS
# define CONFIG_DIR "config/settings" # define CONFIG_DIR "config/settings/VideoLAN Client"
#elif SYS_DARWIN #elif SYS_DARWIN
# define CONFIG_DIR "Library/Preferences/VLC" # define CONFIG_DIR "Library/Preferences/VLC"
#elif defined( WIN32 ) || defined( UNDER_CE ) #elif defined( WIN32 ) || defined( UNDER_CE )
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
* beos.cpp : BeOS plugin for vlc * beos.cpp : BeOS plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.5 2003/01/31 06:45:00 titer Exp $ * $Id: BeOS.cpp,v 1.6 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
* Stephan Aßmus <stippi@yellowbites.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -64,6 +65,14 @@ vlc_module_begin(); ...@@ -64,6 +65,14 @@ vlc_module_begin();
add_integer( "beos-messages-xpos", 0, NULL, "", "" ); add_integer( "beos-messages-xpos", 0, NULL, "", "" );
add_integer( "beos-messages-ypos", 0, NULL, "", "" ); add_integer( "beos-messages-ypos", 0, NULL, "", "" );
add_bool( "beos-messages-show", 0, NULL, "", "" ); add_bool( "beos-messages-show", 0, NULL, "", "" );
add_integer( "beos-settings-width", 0, NULL, "", "" );
add_integer( "beos-settings-height", 0, NULL, "", "" );
add_integer( "beos-settings-xpos", 0, NULL, "", "" );
add_integer( "beos-settings-ypos", 0, NULL, "", "" );
add_bool( "beos-settings-show", 0, NULL, "", "" );
add_integer( "beos-screenshot-format", 0, NULL, "", "" );
add_string( "beos-screenshot-path", 0, NULL, "", "" );
add_bool( "beos-use-dvd-menus", 0, NULL, "", "" );
add_submodule(); add_submodule();
set_capability( "video output", 100 ); set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) ); set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype * InterfaceWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.11 2003/02/01 12:01:11 stippi Exp $ * $Id: InterfaceWindow.h,v 1.12 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
...@@ -128,6 +128,7 @@ class InterfaceWindow : public BWindow ...@@ -128,6 +128,7 @@ class InterfaceWindow : public BWindow
PreferencesWindow* fPreferencesWindow; PreferencesWindow* fPreferencesWindow;
MessagesWindow* fMessagesWindow; MessagesWindow* fMessagesWindow;
BMenuBar* fMenuBar; BMenuBar* fMenuBar;
BMenuItem* fGotoMenuMI;
BMenuItem* fNextTitleMI; BMenuItem* fNextTitleMI;
BMenuItem* fPrevTitleMI; BMenuItem* fPrevTitleMI;
BMenuItem* fNextChapterMI; BMenuItem* fNextChapterMI;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MsgVals.h * MsgVals.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.6 2003/02/03 17:18:48 stippi Exp $ * $Id: MsgVals.h,v 1.7 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com> * Stephan Aßmus <stippi@yellowbites.com>
...@@ -47,6 +47,7 @@ const uint32 SELECT_SUBTITLE = 'subt'; ...@@ -47,6 +47,7 @@ const uint32 SELECT_SUBTITLE = 'subt';
const uint32 PREV_TITLE = 'prti'; const uint32 PREV_TITLE = 'prti';
const uint32 NEXT_TITLE = 'nxti'; const uint32 NEXT_TITLE = 'nxti';
const uint32 TOGGLE_TITLE = 'tgti'; const uint32 TOGGLE_TITLE = 'tgti';
const uint32 NAVIGATE_MENU = 'navm';
const uint32 PREV_CHAPTER = 'prch'; const uint32 PREV_CHAPTER = 'prch';
const uint32 NEXT_CHAPTER = 'nxch'; const uint32 NEXT_CHAPTER = 'nxch';
const uint32 TOGGLE_CHAPTER = 'tgch'; const uint32 TOGGLE_CHAPTER = 'tgch';
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.h * PreferencesWindow.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.8 2003/01/27 10:29:22 titer Exp $ * $Id: PreferencesWindow.h,v 1.9 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -25,45 +25,106 @@ ...@@ -25,45 +25,106 @@
#define BEOS_PREFERENCES_WINDOW_H #define BEOS_PREFERENCES_WINDOW_H
#include <Window.h> #include <Window.h>
#include <String.h>
#define PREFS_WINDOW_WIDTH 400 #define PREFS_WINDOW_WIDTH 400
#define PREFS_WINDOW_HEIGHT 280 #define PREFS_WINDOW_HEIGHT 280
#define PREFS_OK 'prok' #define PREFS_OK 'prok'
#define PREFS_SAVE 'prsa' #define PREFS_CANCEL 'prcb'
#define PREFS_DEFAULTS 'prde' #define PREFS_DEFAULTS 'prde'
#define SLIDER_UPDATE 'slup' #define PREFS_REVERT 'prrv'
#define FFMPEG_UPDATE 'ffup'
#define ADJUST_UPDATE 'ajst'
#define DVDMENUS_CHECK 'dvme' #define DVDMENUS_CHECK 'dvme'
#define SET_TRANSLATOR 'sttr'
#define SET_FOLDER 'stdr'
class BTabView;
class BCheckBox;
class BSlider;
class BStringView;
class BMenuField;
class BTextControl;
class PreferencesWindow : public BWindow class PreferencesWindow : public BWindow
{ {
public: public:
PreferencesWindow( intf_thread_t * p_intf, PreferencesWindow( intf_thread_t* p_intf,
BRect frame, BRect frame,
const char * name ); const char* name );
virtual ~PreferencesWindow(); virtual ~PreferencesWindow();
virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested();
virtual void MessageReceived(BMessage* message);
virtual void Show();
void ReallyQuit(); void ReallyQuit();
private: private:
void SetDefaults(); void _SetGUI( bool dvdMenus,
void ApplyChanges(); int32 postProcessing,
BView * fPrefsView; float brightness,
BTabView * fTabView; float contrast,
BView * fGeneralView; int32 hue,
BView * fAdjustView; float saturation,
BTab * fGeneralTab; const char* screenShotPath,
BTab * fAdjustTab; uint32 screenShotTranslator );
BCheckBox * fDvdMenusCheck; void _SetDefaults();
BSlider * fPpSlider; void _SetToSettings();
BSlider * fContrastSlider; void _RevertChanges();
BSlider * fBrightnessSlider;
BSlider * fHueSlider; void _ApplyChanges();
BSlider * fSaturationSlider;
BStringView * fRestartString; void _ApplyScreenShotSettings();
void _ApplyPictureSettings();
intf_thread_t * p_intf; void _ApplyFFmpegSettings();
void _ApplyDVDSettings();
BView* fPrefsView;
BTabView* fTabView;
BView* fGeneralView;
BView* fAdjustView;
BTab* fGeneralTab;
BTab* fAdjustTab;
BCheckBox* fDvdMenusCheck;
BSlider* fPpSlider;
BSlider* fContrastSlider;
BSlider* fBrightnessSlider;
BSlider* fHueSlider;
BSlider* fSaturationSlider;
BStringView* fRestartString;
BMenuField* fScreenShotFormatMF;
BTextControl* fScreenShotPathTC;
bool fDVDMenusBackup;
int32 fPostProcessingBackup;
float fBrightnessBackup;
float fContrastBackup;
int32 fHueBackup;
float fSaturationBackup;
BString fScreenShotPathBackup;
uint32 fScreenShotFormatBackup;
intf_thread_t* p_intf;
}; };
// some global support functions
int32
get_config_int( intf_thread_t* intf,
const char* field,
int32 defaultValue );
float
get_config_float( intf_thread_t* intf,
const char* field,
float defaultValue );
// don't leak the return value! (use free())
char*
get_config_string( intf_thread_t* intf,
const char* field,
const char* defaultString );
#endif // BEOS_PREFERENCES_WINDOW_H #endif // BEOS_PREFERENCES_WINDOW_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method * vout_beos.cpp: beos video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: VideoOutput.cpp,v 1.11 2003/02/01 12:01:11 stippi Exp $ * $Id: VideoOutput.cpp,v 1.12 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <Application.h> #include <Application.h>
#include <BitmapStream.h> #include <BitmapStream.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Directory.h>
#include <DirectWindow.h> #include <DirectWindow.h>
#include <File.h> #include <File.h>
#include <InterfaceKit.h> #include <InterfaceKit.h>
...@@ -366,9 +367,11 @@ VideoWindow::MessageReceived( BMessage *p_message ) ...@@ -366,9 +367,11 @@ VideoWindow::MessageReceived( BMessage *p_message )
dst += dstBpr; dst += dstBpr;
src += srcBpr; src += srcBpr;
} }
_SaveScreenShot( temp, char* path = config_GetPsz( p_vout, "beos-screenshot-path" );
strdup( DEFAULT_SCREEN_SHOT_PATH ), if ( !path )
DEFAULT_SCREEN_SHOT_FORMAT ); path = strdup( DEFAULT_SCREEN_SHOT_PATH );
int32 format = config_GetInt( p_vout, "beos-screenshot-format" );
_SaveScreenShot( temp, path, format );
} }
else else
{ {
...@@ -892,6 +895,21 @@ VideoWindow::_save_screen_shot( void* cookie ) ...@@ -892,6 +895,21 @@ VideoWindow::_save_screen_shot( void* cookie )
// taken the next screen shot already!) // taken the next screen shot already!)
// make sure we have a unique name for the screen shot // make sure we have a unique name for the screen shot
BString path( info->path ); BString path( info->path );
// create the folder if it doesn't exist
BString folder( info->path );
int32 pos = folder.FindLast("/");
if ( pos > 0 )
{
pos++; // leave the last '/' in the string
if ( pos == path.Length() )
path << "vlc screenshot";
else
{
int32 removeChars = folder.Length() - pos;
folder.Remove( pos, removeChars );
}
create_directory( folder.String(), 0777 );
}
BEntry entry( path.String() ); BEntry entry( path.String() );
int32 appendedNumber = 0; int32 appendedNumber = 0;
if ( entry.Exists() && !entry.IsSymLink() ) if ( entry.Exists() && !entry.IsSymLink() )
...@@ -900,7 +918,7 @@ VideoWindow::_save_screen_shot( void* cookie ) ...@@ -900,7 +918,7 @@ VideoWindow::_save_screen_shot( void* cookie )
bool foundUniqueName = false; bool foundUniqueName = false;
appendedNumber = 1; appendedNumber = 1;
while ( !foundUniqueName ) { while ( !foundUniqueName ) {
BString newName( info->path ); BString newName( path.String() );
newName << " " << appendedNumber; newName << " " << appendedNumber;
BEntry possiblyClobberedEntry( newName.String() ); BEntry possiblyClobberedEntry( newName.String() );
if ( possiblyClobberedEntry.Exists() if ( possiblyClobberedEntry.Exists()
...@@ -920,8 +938,6 @@ VideoWindow::_save_screen_shot( void* cookie ) ...@@ -920,8 +938,6 @@ VideoWindow::_save_screen_shot( void* cookie )
// make colorspace converted copy of bitmap // make colorspace converted copy of bitmap
BBitmap* converted = new BBitmap( BRect( 0.0, 0.0, info->width, info->height ), BBitmap* converted = new BBitmap( BRect( 0.0, 0.0, info->width, info->height ),
B_RGB32 ); B_RGB32 );
// if ( converted->IsValid() )
// memset( converted->Bits(), 0, converted->BitsLength() );
status_t status = convert_bitmap( info->bitmap, converted ); status_t status = convert_bitmap( info->bitmap, converted );
if ( status == B_OK ) if ( status == B_OK )
{ {
...@@ -1021,7 +1037,7 @@ VideoWindow::_save_screen_shot( void* cookie ) ...@@ -1021,7 +1037,7 @@ VideoWindow::_save_screen_shot( void* cookie )
if ( info ) if ( info )
{ {
delete info->bitmap; delete info->bitmap;
delete[] info->path; free( info->path );
} }
delete info; delete info;
return B_OK; return B_OK;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.cpp,v 1.25 2003/02/09 11:51:36 titer Exp $ * $Id: VlcWrapper.cpp,v 1.26 2003/02/09 17:10:52 stippi Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vlc/vout.h> #include <vlc/vout.h>
extern "C" extern "C"
{ {
#include <input_ext-plugins.h> // needed here when compiling without plugins
#include <audio_output.h> #include <audio_output.h>
#include <aout_internal.h> #include <aout_internal.h>
} }
...@@ -973,7 +974,7 @@ void VlcWrapper::FilterChange() ...@@ -973,7 +974,7 @@ void VlcWrapper::FilterChange()
vout_thread_t * p_vout; vout_thread_t * p_vout;
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
/* Warn the vout we are about to change the filter chain */ // Warn the vout we are about to change the filter chain
p_vout = (vout_thread_t*)vlc_object_find( p_intf, VLC_OBJECT_VOUT, p_vout = (vout_thread_t*)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_vout ) if( p_vout )
...@@ -982,7 +983,7 @@ void VlcWrapper::FilterChange() ...@@ -982,7 +983,7 @@ void VlcWrapper::FilterChange()
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
/* restart all video stream */ // restart all video stream
for( unsigned int i = 0; i < p_input->stream.i_es_number; i++ ) for( unsigned int i = 0; i < p_input->stream.i_es_number; i++ )
{ {
if( ( p_input->stream.pp_es[i]->i_cat == VIDEO_ES ) && if( ( p_input->stream.pp_es[i]->i_cat == VIDEO_ES ) &&
......
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