name/tab/string cleanup
This commit is contained in:
@@ -8,6 +8,10 @@ Sound Drivers cannot be empty.=Sound Drivers cannot be empty.
|
||||
Couldn't find 'Songs'=Couldn't find 'Songs'
|
||||
|
||||
[CSMPackageInstallDlg]
|
||||
You have chosen to install the package:=You have chosen to install the package:
|
||||
The package will be installed in the following program folder:=The package will be installed in the following program folder:
|
||||
Installing '%s'. Please wait...=Installing '%s'. Please wait...
|
||||
This package contains the following files:=This package contains the following files:
|
||||
'%s' is not a valid zip archive.='%s' is not a valid zip archive.
|
||||
Error copying file '%s'=Error copying file '%s'
|
||||
No Installations found. Exiting.=No Installations found. Exiting.
|
||||
|
||||
@@ -81,8 +81,9 @@ bool IniFile::WriteFile( const RString &sPath ) const
|
||||
}
|
||||
|
||||
bool bSuccess = IniFile::WriteFile( f );
|
||||
f.Close();
|
||||
return bSuccess && !f.GetError().empty();
|
||||
int iFlush = f.Flush();
|
||||
bSuccess &= (iFlush != -1);
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool IniFile::WriteFile( RageFileBasic &f ) const
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#define PRODUCT_XSTRINGIFY(x) PRODUCT_STRINGIFY(x)
|
||||
|
||||
#define PRODUCT_NAME PRODUCT_XSTRINGIFY(PRODUCT_NAME_BARE)
|
||||
#define PRODUCT_VER PRODUCT_XSTRINGIFY(PRODUCT_VER_BARE)
|
||||
#define PRODUCT_VER PRODUCT_XSTRINGIFY(PRODUCT_VER_BARE)
|
||||
#define PRODUCT_NAME_VER PRODUCT_NAME " " PRODUCT_VER
|
||||
#define PRODUCT_ID PRODUCT_XSTRINGIFY(PRODUCT_ID_BARE)
|
||||
#define PRODUCT_ID PRODUCT_XSTRINGIFY(PRODUCT_ID_BARE)
|
||||
|
||||
#define VIDEO_TROUBLESHOOTING_URL "http://www.stepmania.com/stepmania/mediawiki.php?title=Video_Driver_Troubleshooting"
|
||||
#define REPORT_BUG_URL "http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366"
|
||||
|
||||
@@ -60,7 +60,7 @@ BOOL EditInsallations::OnInitDialog()
|
||||
DialogUtil::LocalizeDialogAndContents( *this );
|
||||
|
||||
vector<RString> vs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( vs );
|
||||
SMPackageUtil::GetGameInstallDirs( vs );
|
||||
for( unsigned i=0; i<vs.size(); i++ )
|
||||
m_list.AddString( vs[i] );
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ BOOL MainMenuDlg::OnInitDialog()
|
||||
TCHAR szCurDir[MAX_PATH];
|
||||
GetCurrentDirectory( ARRAYSIZE(szCurDir), szCurDir );
|
||||
GetDlgItem( IDC_EDIT_INSTALLATION )->SetWindowText( szCurDir );
|
||||
SMPackageUtil::AddStepManiaInstallDir( szCurDir );
|
||||
SMPackageUtil::AddGameInstallDir( szCurDir );
|
||||
SMPackageUtil::SetDefaultInstallDir( szCurDir );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
afx_msg void OnChangeApi();
|
||||
afx_msg void OnCreateSong();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnOpenStepmaniaIni();
|
||||
afx_msg void OnOpenPreferencesIni();
|
||||
afx_msg void OnBnClickedClearKeymaps();
|
||||
afx_msg void OnBnClickedChangePreferences();
|
||||
afx_msg void OnBnClickedOpenPreferences();
|
||||
|
||||
@@ -70,7 +70,10 @@ static bool CompareStringNoCase( const RString &s1, const RString &s2 )
|
||||
return s1.CompareNoCase( s2 ) < 0;
|
||||
}
|
||||
|
||||
static LocalizedString IS_NOT_A_VALID_ZIP( "CSMPackageInstallDlg", "'%s' is not a valid zip archive." );
|
||||
static LocalizedString IS_NOT_A_VALID_ZIP ( "CSMPackageInstallDlg", "'%s' is not a valid zip archive." );
|
||||
static LocalizedString YOU_HAVE_CHOSEN_TO_INSTALL ( "CSMPackageInstallDlg", "You have chosen to install the package:" );
|
||||
static LocalizedString THIS_PACKAGE_CONTAINS ( "CSMPackageInstallDlg", "This package contains the following files:" );
|
||||
static LocalizedString THE_PACKAGE_WILL_BE_INSTALLED ( "CSMPackageInstallDlg", "The package will be installed in the following program folder:" );
|
||||
BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
@@ -95,11 +98,11 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
// Set the text of the first Edit box
|
||||
//
|
||||
RString sMessage1 = ssprintf(
|
||||
"You have chosen to install the Stepmania package:\r\n"
|
||||
YOU_HAVE_CHOSEN_TO_INSTALL.GetValue()+"\r\n"
|
||||
"\r\n"
|
||||
"\t%s\r\n"
|
||||
"\r\n"
|
||||
"This package contains the following files:\r\n",
|
||||
"\r\n" +
|
||||
THIS_PACKAGE_CONTAINS.GetValue()+"\r\n",
|
||||
m_sPackagePath
|
||||
);
|
||||
CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE1);
|
||||
@@ -121,7 +124,7 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
//
|
||||
// Set the text of the third Edit box
|
||||
//
|
||||
RString sMessage3 = "The package will be installed in the following Stepmania program folder:\r\n";
|
||||
RString sMessage3 = THE_PACKAGE_WILL_BE_INSTALLED.GetValue()+"\r\n";
|
||||
|
||||
// Set the message
|
||||
CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE3);
|
||||
@@ -241,6 +244,7 @@ bool CSMPackageInstallDlg::CheckPackages()
|
||||
}
|
||||
|
||||
static LocalizedString NO_INSTALLATIONS ("CSMPackageInstallDlg", "No Installations found. Exiting.");
|
||||
static LocalizedString INSTALLING_PLEASE_WAIT ("CSMPackageInstallDlg", "Installing '%s'. Please wait...");
|
||||
static LocalizedString ERROR_COPYING_FILE ("CSMPackageInstallDlg", "Error copying file '%s'");
|
||||
static LocalizedString PACKAGE_INSTALLED_SUCCESSFULLY ("CSMPackageInstallDlg","Package installed successfully!");
|
||||
void CSMPackageInstallDlg::OnOK()
|
||||
@@ -291,32 +295,32 @@ void CSMPackageInstallDlg::OnOK()
|
||||
return; // cancelled
|
||||
|
||||
|
||||
// Unzip the SMzip package into the Stepmania installation folder
|
||||
// Unzip the SMzip package into the installation folder
|
||||
vector<RString> vs;
|
||||
GetDirListingRecursive( TEMP_MOUNT_POINT, "*.*", vs );
|
||||
for( unsigned i=0; i<vs.size(); i++ )
|
||||
{
|
||||
// Throw some text up so the user has something to look at during the long pause.
|
||||
CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE1);
|
||||
pEdit1->SetWindowText( ssprintf("Installing '%s'. Please wait...", m_sPackagePath) );
|
||||
pEdit1->SetWindowText( ssprintf(INSTALLING_PLEASE_WAIT.GetValue(), m_sPackagePath) );
|
||||
CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE2);
|
||||
pEdit2->SetWindowText( "" );
|
||||
CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE3);
|
||||
pEdit3->SetWindowText( "" );
|
||||
CProgressCtrl* pProgress1 = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS1);
|
||||
//Show the hided progress bar
|
||||
if(!pProgress1->IsWindowVisible())
|
||||
{
|
||||
if(!pProgress1->IsWindowVisible())
|
||||
{
|
||||
pProgress1->ShowWindow(SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
//Initialize the progress bar and update the window 1 time (it's enough)
|
||||
if(!ProgressInit)
|
||||
if(!ProgressInit)
|
||||
{
|
||||
pProgress1->SetRange( 0, (short)vs.size() );
|
||||
pProgress1->SetStep(1);
|
||||
pProgress1->SetStep(1);
|
||||
pProgress1->SetPos(0);
|
||||
SendMessage( WM_PAINT );
|
||||
UpdateWindow(); // Force the silly thing to hadle WM_PAINT now!
|
||||
UpdateWindow(); // Force the silly thing to hadle WM_PAINT now!
|
||||
ProgressInit = 1;
|
||||
}
|
||||
|
||||
@@ -365,7 +369,7 @@ void CSMPackageInstallDlg::OnButtonEdit()
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
SMPackageUtil::WriteStepManiaInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
SMPackageUtil::WriteGameInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
RefreshInstallationList();
|
||||
}
|
||||
}
|
||||
@@ -376,7 +380,7 @@ void CSMPackageInstallDlg::RefreshInstallationList()
|
||||
m_comboDir.ResetContent();
|
||||
|
||||
vector<RString> asInstallDirs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( asInstallDirs );
|
||||
SMPackageUtil::GetGameInstallDirs( asInstallDirs );
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
m_comboDir.AddString( asInstallDirs[i] );
|
||||
m_comboDir.SetCurSel( 0 ); // guaranteed to be at least one item
|
||||
|
||||
@@ -9,39 +9,36 @@
|
||||
#include "resource.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
void SMPackageUtil::WriteStepManiaInstallDirs( const vector<RString>& asInstallDirsToWrite )
|
||||
static const RString SMPACKAGE_KEY = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage";
|
||||
static const RString INSTALLATIONS_KEY = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage\\Installations";
|
||||
|
||||
void SMPackageUtil::WriteGameInstallDirs( const vector<RString>& asInstallDirsToWrite )
|
||||
{
|
||||
RString sKey = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage\\Installations";
|
||||
|
||||
unsigned i;
|
||||
|
||||
for( i=0; i<100; i++ )
|
||||
for( unsigned i=0; i<100; i++ )
|
||||
{
|
||||
RString sName = ssprintf("%d",i);
|
||||
// Reg.DeleteKey( sName ); // delete key is broken in this library, so just write over it with ""
|
||||
RegistryAccess::SetRegValue( sKey, sName, RString() );
|
||||
RegistryAccess::SetRegValue( INSTALLATIONS_KEY, sName, RString() );
|
||||
}
|
||||
|
||||
for( i=0; i<asInstallDirsToWrite.size(); i++ )
|
||||
for( unsigned i=0; i<asInstallDirsToWrite.size(); i++ )
|
||||
{
|
||||
RString sName = ssprintf("%d",i);
|
||||
RegistryAccess::SetRegValue( sKey, sName, asInstallDirsToWrite[i] );
|
||||
RegistryAccess::SetRegValue( INSTALLATIONS_KEY, sName, asInstallDirsToWrite[i] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SMPackageUtil::GetStepManiaInstallDirs( vector<RString>& asInstallDirsOut )
|
||||
void SMPackageUtil::GetGameInstallDirs( vector<RString>& asInstallDirsOut )
|
||||
{
|
||||
asInstallDirsOut.clear();
|
||||
|
||||
RString sKey = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage\\Installations";
|
||||
|
||||
for( int i=0; i<100; i++ )
|
||||
{
|
||||
RString sName = ssprintf("%d",i);
|
||||
|
||||
RString sPath;
|
||||
if( !RegistryAccess::GetRegValue(sKey, sName, sPath) )
|
||||
if( !RegistryAccess::GetRegValue(INSTALLATIONS_KEY, sName, sPath) )
|
||||
continue;
|
||||
|
||||
if( sPath == "" ) // read failed
|
||||
@@ -55,13 +52,13 @@ void SMPackageUtil::GetStepManiaInstallDirs( vector<RString>& asInstallDirsOut )
|
||||
}
|
||||
|
||||
// while we're at it, write to clean up stale entries
|
||||
WriteStepManiaInstallDirs( asInstallDirsOut );
|
||||
WriteGameInstallDirs( asInstallDirsOut );
|
||||
}
|
||||
|
||||
void SMPackageUtil::AddStepManiaInstallDir( RString sNewInstallDir )
|
||||
void SMPackageUtil::AddGameInstallDir( RString sNewInstallDir )
|
||||
{
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
GetGameInstallDirs( asInstallDirs );
|
||||
|
||||
bool bAlreadyInList = false;
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
@@ -76,25 +73,25 @@ void SMPackageUtil::AddStepManiaInstallDir( RString sNewInstallDir )
|
||||
if( !bAlreadyInList )
|
||||
asInstallDirs.push_back( sNewInstallDir );
|
||||
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
WriteGameInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
void SMPackageUtil::SetDefaultInstallDir( int iInstallDirIndex )
|
||||
{
|
||||
// move the specified index to the top of the list
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
GetGameInstallDirs( asInstallDirs );
|
||||
ASSERT( iInstallDirIndex >= 0 && iInstallDirIndex < (int)asInstallDirs.size() );
|
||||
RString sDefaultInstallDir = asInstallDirs[iInstallDirIndex];
|
||||
asInstallDirs.erase( asInstallDirs.begin()+iInstallDirIndex );
|
||||
asInstallDirs.insert( asInstallDirs.begin(), sDefaultInstallDir );
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
WriteGameInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
void SMPackageUtil::SetDefaultInstallDir( RString sInstallDir )
|
||||
{
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
GetGameInstallDirs( asInstallDirs );
|
||||
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
{
|
||||
@@ -106,14 +103,14 @@ void SMPackageUtil::SetDefaultInstallDir( RString sInstallDir )
|
||||
}
|
||||
}
|
||||
|
||||
bool SMPackageUtil::GetPref( RString name, bool &val )
|
||||
bool SMPackageUtil::GetPref( const RString &name, bool &val )
|
||||
{
|
||||
return RegistryAccess::GetRegValue( "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage", name, val );
|
||||
return RegistryAccess::GetRegValue( SMPACKAGE_KEY, name, val );
|
||||
}
|
||||
|
||||
bool SMPackageUtil::SetPref( RString name, bool val )
|
||||
bool SMPackageUtil::SetPref( const RString &name, bool val )
|
||||
{
|
||||
return RegistryAccess::SetRegValue( "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage", name, val );
|
||||
return RegistryAccess::SetRegValue( SMPACKAGE_KEY, name, val );
|
||||
}
|
||||
|
||||
/* Get a package directory. For most paths, this is the first two components. For
|
||||
|
||||
@@ -386,7 +386,7 @@ void CSmpackageExportDlg::OnButtonEdit()
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
SMPackageUtil::WriteStepManiaInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
SMPackageUtil::WriteGameInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
RefreshInstallationList();
|
||||
RefreshTree();
|
||||
}
|
||||
@@ -397,7 +397,7 @@ void CSmpackageExportDlg::RefreshInstallationList()
|
||||
m_comboDir.ResetContent();
|
||||
|
||||
vector<RString> asInstallDirs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( asInstallDirs );
|
||||
SMPackageUtil::GetGameInstallDirs( asInstallDirs );
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
{
|
||||
m_comboDir.AddString( asInstallDirs[i] );
|
||||
|
||||
@@ -60,7 +60,7 @@ BOOL CSmpackageApp::InitInstance()
|
||||
{
|
||||
TCHAR szCurrentDirectory[MAX_PATH];
|
||||
GetCurrentDirectory( ARRAYSIZE(szCurrentDirectory), szCurrentDirectory );
|
||||
SMPackageUtil::AddStepManiaInstallDir( szCurrentDirectory ); // add this if it doesn't already exist
|
||||
SMPackageUtil::AddGameInstallDir( szCurrentDirectory ); // add this if it doesn't already exist
|
||||
}
|
||||
|
||||
// check if there's a .smzip command line argument
|
||||
|
||||
@@ -5,14 +5,14 @@ struct LanguageInfo;
|
||||
|
||||
namespace SMPackageUtil
|
||||
{
|
||||
void WriteStepManiaInstallDirs( const vector<RString>& asInstallDirsToWrite );
|
||||
void GetStepManiaInstallDirs( vector<RString>& asInstallDirsOut );
|
||||
void AddStepManiaInstallDir( RString sNewInstallDir );
|
||||
void WriteGameInstallDirs( const vector<RString>& asInstallDirsToWrite );
|
||||
void GetGameInstallDirs( vector<RString>& asInstallDirsOut );
|
||||
void AddGameInstallDir( RString sNewInstallDir );
|
||||
void SetDefaultInstallDir( int iInstallDirIndex );
|
||||
void SetDefaultInstallDir( RString sInstallDir );
|
||||
|
||||
bool GetPref( RString name, bool &val );
|
||||
bool SetPref( RString name, bool val );
|
||||
bool GetPref( const RString &name, bool &val );
|
||||
bool SetPref( const RString &name, bool val );
|
||||
|
||||
RString GetPackageDirectory(RString path);
|
||||
bool IsValidPackageDirectory(RString path);
|
||||
|
||||
Reference in New Issue
Block a user