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 @@
/* The configuration file and directory */
#ifdef SYS_BEOS
# define CONFIG_DIR "config/settings"
# define CONFIG_DIR "config/settings/VideoLAN Client"
#elif SYS_DARWIN
# define CONFIG_DIR "Library/Preferences/VLC"
#elif defined( WIN32 ) || defined( UNDER_CE )
......
......@@ -2,10 +2,11 @@
* beos.cpp : BeOS plugin for vlc
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
* Stephan Aßmus <stippi@yellowbites.com>
*
* 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
......@@ -64,6 +65,14 @@ vlc_module_begin();
add_integer( "beos-messages-xpos", 0, NULL, "", "" );
add_integer( "beos-messages-ypos", 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();
set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* 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>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -128,6 +128,7 @@ class InterfaceWindow : public BWindow
PreferencesWindow* fPreferencesWindow;
MessagesWindow* fMessagesWindow;
BMenuBar* fMenuBar;
BMenuItem* fGotoMenuMI;
BMenuItem* fNextTitleMI;
BMenuItem* fPrevTitleMI;
BMenuItem* fNextChapterMI;
......
......@@ -2,7 +2,7 @@
* MsgVals.h
*****************************************************************************
* 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>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -47,6 +47,7 @@ const uint32 SELECT_SUBTITLE = 'subt';
const uint32 PREV_TITLE = 'prti';
const uint32 NEXT_TITLE = 'nxti';
const uint32 TOGGLE_TITLE = 'tgti';
const uint32 NAVIGATE_MENU = 'navm';
const uint32 PREV_CHAPTER = 'prch';
const uint32 NEXT_CHAPTER = 'nxch';
const uint32 TOGGLE_CHAPTER = 'tgch';
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* 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>
*
......@@ -25,45 +25,106 @@
#define BEOS_PREFERENCES_WINDOW_H
#include <Window.h>
#include <String.h>
#define PREFS_WINDOW_WIDTH 400
#define PREFS_WINDOW_HEIGHT 280
#define PREFS_OK 'prok'
#define PREFS_SAVE 'prsa'
#define PREFS_CANCEL 'prcb'
#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 SET_TRANSLATOR 'sttr'
#define SET_FOLDER 'stdr'
class BTabView;
class BCheckBox;
class BSlider;
class BStringView;
class BMenuField;
class BTextControl;
class PreferencesWindow : public BWindow
{
public:
PreferencesWindow( intf_thread_t * p_intf,
BRect frame,
const char * name );
virtual ~PreferencesWindow();
virtual void MessageReceived(BMessage *message);
void ReallyQuit();
private:
void SetDefaults();
void ApplyChanges();
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;
intf_thread_t * p_intf;
public:
PreferencesWindow( intf_thread_t* p_intf,
BRect frame,
const char* name );
virtual ~PreferencesWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage* message);
virtual void Show();
void ReallyQuit();
private:
void _SetGUI( bool dvdMenus,
int32 postProcessing,
float brightness,
float contrast,
int32 hue,
float saturation,
const char* screenShotPath,
uint32 screenShotTranslator );
void _SetDefaults();
void _SetToSettings();
void _RevertChanges();
void _ApplyChanges();
void _ApplyScreenShotSettings();
void _ApplyPictureSettings();
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
......@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -36,6 +36,7 @@
#include <Application.h>
#include <BitmapStream.h>
#include <Bitmap.h>
#include <Directory.h>
#include <DirectWindow.h>
#include <File.h>
#include <InterfaceKit.h>
......@@ -366,9 +367,11 @@ VideoWindow::MessageReceived( BMessage *p_message )
dst += dstBpr;
src += srcBpr;
}
_SaveScreenShot( temp,
strdup( DEFAULT_SCREEN_SHOT_PATH ),
DEFAULT_SCREEN_SHOT_FORMAT );
char* path = config_GetPsz( p_vout, "beos-screenshot-path" );
if ( !path )
path = strdup( DEFAULT_SCREEN_SHOT_PATH );
int32 format = config_GetInt( p_vout, "beos-screenshot-format" );
_SaveScreenShot( temp, path, format );
}
else
{
......@@ -892,6 +895,21 @@ VideoWindow::_save_screen_shot( void* cookie )
// taken the next screen shot already!)
// make sure we have a unique name for the screen shot
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() );
int32 appendedNumber = 0;
if ( entry.Exists() && !entry.IsSymLink() )
......@@ -900,7 +918,7 @@ VideoWindow::_save_screen_shot( void* cookie )
bool foundUniqueName = false;
appendedNumber = 1;
while ( !foundUniqueName ) {
BString newName( info->path );
BString newName( path.String() );
newName << " " << appendedNumber;
BEntry possiblyClobberedEntry( newName.String() );
if ( possiblyClobberedEntry.Exists()
......@@ -920,8 +938,6 @@ VideoWindow::_save_screen_shot( void* cookie )
// make colorspace converted copy of bitmap
BBitmap* converted = new BBitmap( BRect( 0.0, 0.0, info->width, info->height ),
B_RGB32 );
// if ( converted->IsValid() )
// memset( converted->Bits(), 0, converted->BitsLength() );
status_t status = convert_bitmap( info->bitmap, converted );
if ( status == B_OK )
{
......@@ -1021,7 +1037,7 @@ VideoWindow::_save_screen_shot( void* cookie )
if ( info )
{
delete info->bitmap;
delete[] info->path;
free( info->path );
}
delete info;
return B_OK;
......
......@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* 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>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -33,6 +33,7 @@
#include <vlc/vout.h>
extern "C"
{
#include <input_ext-plugins.h> // needed here when compiling without plugins
#include <audio_output.h>
#include <aout_internal.h>
}
......@@ -973,7 +974,7 @@ void VlcWrapper::FilterChange()
vout_thread_t * p_vout;
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,
FIND_ANYWHERE );
if( p_vout )
......@@ -982,7 +983,7 @@ void VlcWrapper::FilterChange()
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++ )
{
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