diff --git a/stepmania/src/Bookkeeper.cpp b/stepmania/src/Bookkeeper.cpp index af6090000d..2bbbf4992f 100644 --- a/stepmania/src/Bookkeeper.cpp +++ b/stepmania/src/Bookkeeper.cpp @@ -25,7 +25,6 @@ Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program static const CString COINS_DAT = BASE_PATH "Data" SLASH "Coins.dat"; -static const CString COINS_HTML = BASE_PATH "Data" SLASH "Coins.html"; const int COINS_DAT_VERSION = 1; @@ -185,14 +184,14 @@ int Bookkeeper::GetCoinsForDay( int iDayOfYear ) } -void Bookkeeper::GetCoinsLast7Days( int coins[7] ) +void Bookkeeper::GetCoinsLastDays( int coins[NUM_LAST_DAYS] ) { UpdateLastSeenTime(); long lOldTime = m_iLastSeenTime; tm time = *localtime( &lOldTime ); - for( int i=0; i<7; i++ ) + for( int i=0; i ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program @@ -51,6 +53,7 @@ const int CATEGORY_RANKING_VERSION = 4; const int STEPS_SCORES_VERSION = 8; const int COURSE_SCORES_VERSION = 6; +#define STATS_TITLE THEME->GetMetric("ProfileManager","StatsTitle") static const char *MemCardDirs[NUM_PLAYERS] = { @@ -948,8 +951,8 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc ) f.PutLine( "" ); f.PutLine( "" ); f.PutLine( "" ); - f.PutLine( ssprintf("%s", PRODUCT_NAME_VER) ); - f.PutLine( "" ); + f.PutLine( ssprintf("%s", STATS_TITLE.c_str() ) ); + f.PutLine( ssprintf("",STYLE_CSS_FILE) ); f.PutLine( "" ); f.PutLine( "" ); } @@ -972,13 +975,20 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc ) // Print table of contents // { - f.Write( "

" PRODUCT_NAME_VER "

\n" ); - PRINT_SECTION_START( "Table of Contents" ); + CString sName = + pProfile->m_sLastUsedHighScoreName.empty() ? + pProfile->m_sName : + pProfile->m_sLastUsedHighScoreName; + time_t ltime = time( NULL ); + CString sTime = ctime( <ime ); + + f.Write( ssprintf("

%s for %s - %s

\n",STATS_TITLE.c_str(), sName.c_str(), sTime.c_str()) ); PRINT_DIV_START("Table of Contents"); PRINT_LINK( "Statistics", "#Statistics" ); PRINT_LINK( "Popularity Lists", "#Popularity Lists" ); PRINT_LINK( "Difficulty Table", "#Difficulty Table" ); PRINT_LINK( "Song/Steps List", "#Song/Steps List" ); + PRINT_LINK( "Bookkeeping", "#Bookkeeping" ); PRINT_DIV_END; } @@ -990,7 +1000,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc ) // Memory card stats { - PRINT_DIV_START( "Memory Card" ); + PRINT_DIV_START( "This Profile" ); PRINT_LINE_S( "Name", pProfile->m_sName ); PRINT_LINE_S( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName ); PRINT_LINE_B( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers ); @@ -1199,7 +1209,6 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc ) Steps* pSteps = vpSteps[j]; if( pSteps->IsAutogen() ) continue; // skip autogen - f.PutLine( "
\n" ); CString s = GAMEMAN->NotesTypeToString(pSteps->m_StepsType) + " - " + @@ -1213,13 +1222,65 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc ) PRINT_SECTION_END; } + // + // Print Bookkeeping + // + { + PRINT_SECTION_START( "Bookkeeping" ); + + // GetCoinsLastDays + { + int coins[NUM_LAST_DAYS]; + BOOKKEEPER->GetCoinsLastDays( coins ); + PRINT_DIV_START( ssprintf("Coins for Last %d Days",NUM_LAST_DAYS).c_str() ); + for( int i=0; iGetCoinsLastWeeks( coins ); + PRINT_DIV_START( ssprintf("Coins for Last %d Weeks",NUM_LAST_WEEKS).c_str() ); + for( int i=0; iGetCoinsByHour( coins ); + PRINT_DIV_START( ssprintf("Coins for Last %d Weeks",HOURS_PER_DAY).c_str() ); + for( int i=0; i" ); f.PutLine( "" ); // // Copy CSS file from theme. If the copy fails, oh well... // - CString sStyleFile = THEME->GetPathToO(STYLE_CSS_FILE); + CString sStyleFile = THEME->GetPathToO("ProfileManager style.css"); CopyFile2( sStyleFile, sDir+STYLE_CSS_FILE ); } diff --git a/stepmania/src/ScreenBookkeeping.cpp b/stepmania/src/ScreenBookkeeping.cpp index ddba1808b9..7b07ed110c 100644 --- a/stepmania/src/ScreenBookkeeping.cpp +++ b/stepmania/src/ScreenBookkeeping.cpp @@ -24,33 +24,6 @@ #include "RageDisplay.h" #include "Bookkeeper.h" -const CString LAST_7_DAYS_NAME[7] = -{ - "Yesterday", - "2 Days Ago", - "3 Days Ago", - "4 Days Ago", - "5 Days Ago", - "6 Days Ago", - "7 Days Ago", -}; - -const CString DAY_TO_NAME[DAYS_IN_WEEK] = -{ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", -}; - -CString HourToString( int iHourIndex ) -{ - return ssprintf("%02d:00", iHourIndex); -} - ScreenBookkeeping::ScreenBookkeeping( CString sClassName ) : Screen( sClassName ) { @@ -152,27 +125,27 @@ void ScreenBookkeeping::ChangeView( View newView ) switch( m_View ) { - case LAST_7_DAYS: + case VIEW_LAST_DAYS: { - m_textTitle.SetText( "Coin Data of Last 7 days" ); + m_textTitle.SetText( ssprintf("Coin Data of Last %d days", NUM_LAST_DAYS) ); - int coins[7]; - BOOKKEEPER->GetCoinsLast7Days( coins ); - int iTotalLast7 = 0; + int coins[NUM_LAST_DAYS]; + BOOKKEEPER->GetCoinsLastDays( coins ); + int iTotalLast = 0; CString sTitle, sData; - for( int i=0; i<7; i++ ) + for( int i=0; iGetCoinsLast52Weeks( coins ); + int coins[NUM_LAST_WEEKS]; + BOOKKEEPER->GetCoinsLastWeeks( coins ); CString sTitle, sData; for( int col=0; col<4; col++ ) @@ -204,7 +177,7 @@ void ScreenBookkeeping::ChangeView( View newView ) } } break; - case DAY_OF_WEEK: + case VIEW_DAY_OF_WEEK: { m_textTitle.SetText( "Day of week" ); @@ -226,7 +199,7 @@ void ScreenBookkeeping::ChangeView( View newView ) m_textCols[3].SetText( sData ); } break; - case HOUR_OF_DAY: + case VIEW_HOUR_OF_DAY: { m_textTitle.SetText( "Hour of day" ); diff --git a/stepmania/src/ScreenBookkeeping.h b/stepmania/src/ScreenBookkeeping.h index d992f169ea..9d0f2b1beb 100644 --- a/stepmania/src/ScreenBookkeeping.h +++ b/stepmania/src/ScreenBookkeeping.h @@ -35,7 +35,7 @@ public: virtual void MenuBack( PlayerNumber pn ); private: - enum View { LAST_7_DAYS, LAST_52_WEEKS, DAY_OF_WEEK, HOUR_OF_DAY, NUM_VIEWS }; + enum View { VIEW_LAST_DAYS, VIEW_LAST_WEEKS, VIEW_DAY_OF_WEEK, VIEW_HOUR_OF_DAY, NUM_VIEWS }; void ChangeView( View newView );