* add optional soundtypes keyword of .game config, affecting file types shown in sound browsing dialog
This commit is contained in:
parent
9eefda4fc5
commit
72248bd95f
|
|
@ -323,7 +323,7 @@ const char* browse_sound( GtkWidget* parent, const char* filepath ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* filename = file_dialog( parent, true, "Open Wav File", buffer.c_str(), "sound" );
|
const char* filename = file_dialog( parent, true, "Open Sound File", buffer.c_str(), "sound" );
|
||||||
if ( filename != 0 ) {
|
if ( filename != 0 ) {
|
||||||
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
|
const char* relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
|
||||||
if ( relative == filename ) {
|
if ( relative == filename ) {
|
||||||
|
|
|
||||||
|
|
@ -221,13 +221,31 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "stream/stringstream.h"
|
||||||
|
void SoundTypes_register(){
|
||||||
|
const char *names = GlobalRadiant().getGameDescriptionKeyValue( "soundtypes" );
|
||||||
|
if( string_empty( names ) ){
|
||||||
|
names = "wav";
|
||||||
|
}
|
||||||
|
else if( string_equal( names, "*" ) ){
|
||||||
|
names = "wav ogg mp3";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringTokeniser tokeniser( names );
|
||||||
|
const char* name;
|
||||||
|
while( !string_empty( name = tokeniser.getToken() ) )
|
||||||
|
{
|
||||||
|
GlobalFiletypes().addType( "sound", name, filetype_t( StringOutputStream()( name, " sound files" ), StringOutputStream()( "*.", name ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Radiant : public TypeSystemRef
|
class Radiant : public TypeSystemRef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Radiant(){
|
Radiant(){
|
||||||
Preferences_Init();
|
Preferences_Init();
|
||||||
|
|
||||||
GlobalFiletypes().addType( "sound", "wav", filetype_t( "PCM sound files", "*.wav" ) );
|
SoundTypes_register();
|
||||||
|
|
||||||
Selection_construct();
|
Selection_construct();
|
||||||
HomePaths_Construct();
|
HomePaths_Construct();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user