since ScreenOptionsExportPackage doesn't really export packages anyways, no one should mind me committing wip code that splits things up into pages
This commit is contained in:
@@ -11,7 +11,9 @@
|
|||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
|
||||||
|
// main page (type list)
|
||||||
REGISTER_SCREEN_CLASS( ScreenOptionsExportPackage );
|
REGISTER_SCREEN_CLASS( ScreenOptionsExportPackage );
|
||||||
|
|
||||||
void ScreenOptionsExportPackage::Init()
|
void ScreenOptionsExportPackage::Init()
|
||||||
@@ -24,51 +26,130 @@ void ScreenOptionsExportPackage::Init()
|
|||||||
|
|
||||||
void ScreenOptionsExportPackage::BeginScreen()
|
void ScreenOptionsExportPackage::BeginScreen()
|
||||||
{
|
{
|
||||||
// Fill m_vsPossibleDirsToExport
|
// Fill m_vsPackageTypes:
|
||||||
// todo: Split these out over multiple screens so the scroller
|
m_vsPackageTypes.push_back("Themes");
|
||||||
// isn't so overloaded. (See ScreenOptionsToggleSongs) -freem
|
m_vsPackageTypes.push_back("NoteSkins");
|
||||||
|
m_vsPackageTypes.push_back("Courses");
|
||||||
|
m_vsPackageTypes.push_back("Songs");
|
||||||
|
// announcers, characters, others?
|
||||||
|
|
||||||
|
vector<OptionRowHandler*> OptionRowHandlers;
|
||||||
|
FOREACH_CONST( RString, m_vsPackageTypes, s )
|
||||||
{
|
{
|
||||||
// Add themes
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
||||||
{
|
OptionRowDefinition &def = pHand->m_Def;
|
||||||
GetDirListing( SpecialFiles::THEMES_DIR + "*", m_vsPossibleDirsToExport, true, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add NoteSkins
|
def.m_sName = *s;
|
||||||
{
|
def.m_bAllowExplanation = false;
|
||||||
vector<RString> vs;
|
//def.m_sExplanationName = "# files, # MB, # subdirs";
|
||||||
GetDirListing( SpecialFiles::NOTESKINS_DIR + "*", vs, true, true );
|
def.m_bAllowThemeTitle = false;
|
||||||
FOREACH_CONST( RString, vs, s )
|
def.m_bAllowThemeItems = false;
|
||||||
GetDirListing( *s + "*", m_vsPossibleDirsToExport, true, true );
|
def.m_layoutType = LAYOUT_SHOW_ALL_IN_ROW;
|
||||||
}
|
def.m_bOneChoiceForAllPlayers = true;
|
||||||
|
def.m_vsChoices.clear();
|
||||||
|
def.m_vsChoices.push_back( "" );
|
||||||
|
OptionRowHandlers.push_back( pHand );
|
||||||
|
}
|
||||||
|
ScreenOptions::InitMenu( OptionRowHandlers );
|
||||||
|
|
||||||
|
ScreenOptions::BeginScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input )
|
||||||
|
{
|
||||||
|
if( IsTransitioning() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// switch to the subpage with the specified type
|
||||||
|
//int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
|
||||||
|
int iRow = GetCurrentRow();
|
||||||
|
if( m_pRows[iRow]->GetRowType() == OptionRow::RowType_Exit )
|
||||||
|
{
|
||||||
|
ScreenOptions::ProcessMenuStart( input );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportPackages::m_sPackageType = m_vsPackageTypes[iRow];
|
||||||
|
SCREENMAN->SetNewScreen("ScreenOptionsExportPackageSubPage");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsExportPackage::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsExportPackage::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// subpage (has all folders for the specified type)
|
||||||
|
REGISTER_SCREEN_CLASS( ScreenOptionsExportPackageSubPage );
|
||||||
|
void ScreenOptionsExportPackageSubPage::Init()
|
||||||
|
{
|
||||||
|
ScreenOptions::Init();
|
||||||
|
|
||||||
|
SetNavigation( NAV_THREE_KEY_MENU );
|
||||||
|
SetInputMode( INPUTMODE_SHARE_CURSOR );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsExportPackageSubPage::BeginScreen()
|
||||||
|
{
|
||||||
|
// Check type and fill m_vsPossibleDirsToExport
|
||||||
|
const RString *s_packageType = &ExportPackages::m_sPackageType;
|
||||||
|
if( *s_packageType == "Themes" )
|
||||||
|
{
|
||||||
|
// add themes
|
||||||
|
GetDirListing( SpecialFiles::THEMES_DIR + "*", m_vsPossibleDirsToExport, true, true );
|
||||||
|
}
|
||||||
|
else if( *s_packageType == "NoteSkins" )
|
||||||
|
{
|
||||||
|
// add noteskins
|
||||||
|
vector<RString> vs;
|
||||||
|
GetDirListing( SpecialFiles::NOTESKINS_DIR + "*", vs, true, true );
|
||||||
|
FOREACH_CONST( RString, vs, s )
|
||||||
|
GetDirListing( *s + "*", m_vsPossibleDirsToExport, true, true );
|
||||||
|
}
|
||||||
|
else if( *s_packageType == "Courses" )
|
||||||
|
{
|
||||||
// Add courses. Only support courses that are in a group folder.
|
// Add courses. Only support courses that are in a group folder.
|
||||||
// Support for courses not in a group folder should be phased out.
|
// Support for courses not in a group folder should be phased out.
|
||||||
|
vector<RString> vs;
|
||||||
|
GetDirListing( SpecialFiles::COURSES_DIR + "*", vs, true, true );
|
||||||
|
StripCvsAndSvn( vs );
|
||||||
|
StripMacResourceForks( vs );
|
||||||
|
FOREACH_CONST( RString, vs, s )
|
||||||
{
|
{
|
||||||
vector<RString> vs;
|
m_vsPossibleDirsToExport.push_back( *s );
|
||||||
GetDirListing( SpecialFiles::COURSES_DIR + "*", vs, true, true );
|
GetDirListing( *s + "/*", m_vsPossibleDirsToExport, true, true );
|
||||||
StripCvsAndSvn( vs );
|
|
||||||
StripMacResourceForks( vs );
|
|
||||||
FOREACH_CONST( RString, vs, s )
|
|
||||||
{
|
|
||||||
m_vsPossibleDirsToExport.push_back( *s );
|
|
||||||
GetDirListing( *s + "/*", m_vsPossibleDirsToExport, true, true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add songs
|
|
||||||
{
|
|
||||||
vector<RString> vs;
|
|
||||||
GetDirListing( SpecialFiles::SONGS_DIR + "*", vs, true, true );
|
|
||||||
FOREACH_CONST( RString, vs, s )
|
|
||||||
{
|
|
||||||
m_vsPossibleDirsToExport.push_back( *s );
|
|
||||||
GetDirListing( *s + "/*", m_vsPossibleDirsToExport, true, true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StripCvsAndSvn( m_vsPossibleDirsToExport );
|
|
||||||
StripMacResourceForks( m_vsPossibleDirsToExport );
|
|
||||||
}
|
}
|
||||||
|
else if( *s_packageType == "Songs" )
|
||||||
|
{
|
||||||
|
// Add song groups
|
||||||
|
vector<RString> asAllGroups;
|
||||||
|
SONGMAN->GetSongGroupNames(asAllGroups);
|
||||||
|
FOREACH_CONST( RString, asAllGroups , s )
|
||||||
|
{
|
||||||
|
m_vsPossibleDirsToExport.push_back(*s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( *s_packageType == "SubGroup" )
|
||||||
|
{
|
||||||
|
//ExportPackages::m_sFolder
|
||||||
|
/*
|
||||||
|
vector<RString> vs;
|
||||||
|
GetDirListing( SpecialFiles::SONGS_DIR + "*", vs, true, true );
|
||||||
|
FOREACH_CONST( RString, vs, s )
|
||||||
|
{
|
||||||
|
m_vsPossibleDirsToExport.push_back( *s );
|
||||||
|
GetDirListing( *s + "/*", m_vsPossibleDirsToExport, true, true );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
StripCvsAndSvn( m_vsPossibleDirsToExport );
|
||||||
|
StripMacResourceForks( m_vsPossibleDirsToExport );
|
||||||
|
|
||||||
vector<OptionRowHandler*> OptionRowHandlers;
|
vector<OptionRowHandler*> OptionRowHandlers;
|
||||||
FOREACH_CONST( RString, m_vsPossibleDirsToExport, s )
|
FOREACH_CONST( RString, m_vsPossibleDirsToExport, s )
|
||||||
@@ -142,7 +223,7 @@ static bool ExportPackage( RString sPackageName, RString sDirToExport, RString &
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input )
|
void ScreenOptionsExportPackageSubPage::ProcessMenuStart( const InputEventPlus &input )
|
||||||
{
|
{
|
||||||
if( IsTransitioning() )
|
if( IsTransitioning() )
|
||||||
return;
|
return;
|
||||||
@@ -154,6 +235,17 @@ void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ExportPackages::m_sPackageType == "Courses"
|
||||||
|
|| ExportPackages::m_sPackageType == "NoteSkins"
|
||||||
|
|| ExportPackages::m_sPackageType == "Songs" )
|
||||||
|
{
|
||||||
|
// find folder name
|
||||||
|
ExportPackages::m_sPackageType = "SubGroup";
|
||||||
|
ExportPackages::m_sFolder = m_vsPossibleDirsToExport[iCurRow];
|
||||||
|
SCREENMAN->SetNewScreen("ScreenOptionsExportPackageSubPage");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RString sDirToExport = m_vsPossibleDirsToExport[ iCurRow ];
|
RString sDirToExport = m_vsPossibleDirsToExport[ iCurRow ];
|
||||||
RString sPackageName = ReplaceInvalidFileNameChars( sDirToExport + ".smzip" );
|
RString sPackageName = ReplaceInvalidFileNameChars( sDirToExport + ".smzip" );
|
||||||
|
|
||||||
@@ -164,12 +256,12 @@ void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
ScreenPrompt::Prompt( SM_None, ssprintf("Failed to export package: %s",sError.c_str()) );
|
ScreenPrompt::Prompt( SM_None, ssprintf("Failed to export package: %s",sError.c_str()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsExportPackage::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
void ScreenOptionsExportPackageSubPage::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsExportPackage::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
void ScreenOptionsExportPackageSubPage::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
|
|
||||||
class Course;
|
class Course;
|
||||||
|
|
||||||
|
// Can this be done any better? -aj
|
||||||
|
namespace ExportPackages
|
||||||
|
{
|
||||||
|
RString m_sPackageType;
|
||||||
|
RString m_sFolder; // used for more subpages
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief A menu for exporting packages. */
|
/** @brief A menu for exporting packages. */
|
||||||
class ScreenOptionsExportPackage : public ScreenOptions
|
class ScreenOptionsExportPackage : public ScreenOptions
|
||||||
{
|
{
|
||||||
@@ -13,6 +20,21 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
virtual void BeginScreen();
|
virtual void BeginScreen();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||||
|
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
|
virtual void ProcessMenuStart( const InputEventPlus &input );
|
||||||
|
|
||||||
|
vector<RString> m_vsPackageTypes;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ScreenOptionsExportPackageSubPage : public ScreenOptions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Init();
|
||||||
|
virtual void BeginScreen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||||
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||||
|
|||||||
Reference in New Issue
Block a user