2003-09-08 03:26:58 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ScreenProfileOptions
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
Chris POmez
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenProfileOptions.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "ProfileManager.h"
|
|
|
|
|
#include "RageSounds.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
|
|
|
|
|
|
2003-09-30 05:25:47 +00:00
|
|
|
static enum {
|
2003-09-08 03:26:58 +00:00
|
|
|
PO_PLAYER1,
|
|
|
|
|
PO_PLAYER2,
|
|
|
|
|
PO_CREATE_NEW,
|
|
|
|
|
PO_DELETE_,
|
2003-09-08 07:21:41 +00:00
|
|
|
PO_RENAME_,
|
2003-09-30 05:25:47 +00:00
|
|
|
NUM_PROFILE_OPTIONS_LINES
|
2003-09-08 03:26:58 +00:00
|
|
|
};
|
|
|
|
|
|
2003-09-30 05:25:47 +00:00
|
|
|
OptionRow g_ProfileOptionsLines[NUM_PROFILE_OPTIONS_LINES] = {
|
2003-09-08 03:26:58 +00:00
|
|
|
OptionRow( "Player1\nProfile", true ),
|
|
|
|
|
OptionRow( "Player2\nProfile", true ),
|
|
|
|
|
OptionRow( "Create\nNew", true, "PRESS START" ),
|
|
|
|
|
OptionRow( "Delete", true ),
|
2003-09-08 07:21:41 +00:00
|
|
|
OptionRow( "Rename", true ),
|
2003-09-08 03:26:58 +00:00
|
|
|
};
|
|
|
|
|
|
2003-09-27 22:30:51 +00:00
|
|
|
ScreenProfileOptions::ScreenProfileOptions( CString sClassName ) : ScreenOptions( sClassName )
|
2003-09-08 03:26:58 +00:00
|
|
|
{
|
|
|
|
|
LOG->Trace( "ScreenProfileOptions::ScreenProfileOptions()" );
|
|
|
|
|
|
|
|
|
|
g_ProfileOptionsLines[PO_PLAYER1].choices.clear();
|
2003-09-08 07:21:41 +00:00
|
|
|
g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" );
|
|
|
|
|
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER1].choices );
|
2003-09-08 03:26:58 +00:00
|
|
|
|
|
|
|
|
g_ProfileOptionsLines[PO_PLAYER2].choices.clear();
|
2003-09-08 07:21:41 +00:00
|
|
|
g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" );
|
|
|
|
|
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER2].choices );
|
2003-09-08 03:26:58 +00:00
|
|
|
|
|
|
|
|
g_ProfileOptionsLines[PO_DELETE_].choices.clear();
|
2003-09-08 07:21:41 +00:00
|
|
|
g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" );
|
|
|
|
|
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_DELETE_].choices );
|
|
|
|
|
|
|
|
|
|
g_ProfileOptionsLines[PO_RENAME_].choices.clear();
|
|
|
|
|
g_ProfileOptionsLines[PO_RENAME_].choices.push_back( "-NONE-" );
|
|
|
|
|
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_RENAME_].choices );
|
2003-09-08 03:26:58 +00:00
|
|
|
|
|
|
|
|
Init(
|
|
|
|
|
INPUTMODE_TOGETHER,
|
|
|
|
|
g_ProfileOptionsLines,
|
2003-09-30 05:25:47 +00:00
|
|
|
NUM_PROFILE_OPTIONS_LINES,
|
2003-09-08 03:26:58 +00:00
|
|
|
true );
|
|
|
|
|
m_Menu.m_MenuTimer.Disable();
|
|
|
|
|
|
|
|
|
|
SOUND->PlayMusic( THEME->GetPathToS("ScreenMachineOptions music") );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenProfileOptions::ImportOptions()
|
|
|
|
|
{
|
2003-09-08 07:21:41 +00:00
|
|
|
vector<CString> vsProfiles;
|
|
|
|
|
PROFILEMAN->GetProfiles( vsProfiles );
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
CStringArray::iterator iter;
|
|
|
|
|
|
|
|
|
|
iter = find(
|
2003-09-08 07:21:41 +00:00
|
|
|
vsProfiles.begin(),
|
|
|
|
|
vsProfiles.end(),
|
2003-09-08 03:26:58 +00:00
|
|
|
PREFSMAN->m_sDefaultProfile[PLAYER_1] );
|
2003-09-08 07:21:41 +00:00
|
|
|
if( iter != vsProfiles.end() )
|
|
|
|
|
m_iSelectedOption[0][PO_PLAYER1] = iter - vsProfiles.begin() + 1;
|
2003-09-08 03:26:58 +00:00
|
|
|
|
|
|
|
|
iter = find(
|
2003-09-08 07:21:41 +00:00
|
|
|
vsProfiles.begin(),
|
|
|
|
|
vsProfiles.end(),
|
|
|
|
|
PREFSMAN->m_sDefaultProfile[PO_PLAYER2] );
|
|
|
|
|
if( iter != vsProfiles.end() )
|
|
|
|
|
m_iSelectedOption[0][PO_PLAYER2] = iter - vsProfiles.begin() + 1;
|
2003-09-08 03:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenProfileOptions::ExportOptions()
|
|
|
|
|
{
|
2003-09-08 07:21:41 +00:00
|
|
|
vector<CString> vsProfiles;
|
|
|
|
|
PROFILEMAN->GetProfiles( vsProfiles );
|
|
|
|
|
|
|
|
|
|
if( m_iSelectedOption[0][PO_PLAYER1] > 0 )
|
|
|
|
|
PREFSMAN->m_sDefaultProfile[PLAYER_1] = vsProfiles[m_iSelectedOption[0][PO_PLAYER1]-1];
|
|
|
|
|
else
|
|
|
|
|
PREFSMAN->m_sDefaultProfile[PLAYER_1] = "";
|
|
|
|
|
|
|
|
|
|
if( m_iSelectedOption[0][PO_PLAYER2] > 0 )
|
|
|
|
|
PREFSMAN->m_sDefaultProfile[PLAYER_2] = vsProfiles[m_iSelectedOption[0][PO_PLAYER2]-1];
|
|
|
|
|
else
|
|
|
|
|
PREFSMAN->m_sDefaultProfile[PLAYER_2] = "";
|
2003-09-08 03:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenProfileOptions::GoToPrevState()
|
|
|
|
|
{
|
|
|
|
|
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-08 07:21:41 +00:00
|
|
|
void CreateProfile( CString sDisplayName )
|
|
|
|
|
{
|
|
|
|
|
PROFILEMAN->CreateProfile( sDisplayName );
|
|
|
|
|
SCREENMAN->SetNewScreen( "ScreenProfileOptions" );
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
void ScreenProfileOptions::GoToNextState()
|
|
|
|
|
{
|
|
|
|
|
PREFSMAN->SaveGlobalPrefsToDisk();
|
|
|
|
|
GoToPrevState();
|
|
|
|
|
}
|
2003-09-08 07:21:41 +00:00
|
|
|
|
|
|
|
|
void ScreenProfileOptions::MenuStart( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
vector<CString> vsProfiles;
|
|
|
|
|
PROFILEMAN->GetProfiles( vsProfiles );
|
|
|
|
|
|
|
|
|
|
switch( GetCurrentRow() )
|
|
|
|
|
{
|
|
|
|
|
case PO_CREATE_NEW:
|
|
|
|
|
SCREENMAN->TextEntry( SM_None, "Enter a profile name", "", CreateProfile );
|
|
|
|
|
return;
|
|
|
|
|
case PO_DELETE_:
|
|
|
|
|
{
|
|
|
|
|
CString sProfile;
|
|
|
|
|
if( m_iSelectedOption[0][PO_DELETE_] > 0 )
|
|
|
|
|
sProfile = vsProfiles[m_iSelectedOption[0][PO_DELETE_]-1];
|
|
|
|
|
else
|
|
|
|
|
sProfile = "";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PO_RENAME_:
|
|
|
|
|
{
|
|
|
|
|
CString sProfile;
|
|
|
|
|
if( m_iSelectedOption[0][PO_RENAME_] > 0 )
|
|
|
|
|
sProfile = vsProfiles[m_iSelectedOption[0][PO_RENAME_]-1];
|
|
|
|
|
else
|
|
|
|
|
sProfile = "";
|
|
|
|
|
|
|
|
|
|
// SCREENMAN->TextEntry( SM_None, "Enter a profile name", "NewProfile", SetProfile );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ScreenOptions::MenuStart( pn );
|
|
|
|
|
}
|
|
|
|
|
}
|