[loading window] Should really have included this in the initial design. Now it can be indeterminate too.

This commit is contained in:
Henrik Andersson
2011-06-05 11:32:51 +02:00
parent af62e62b42
commit 167cd9238a
6 changed files with 39 additions and 11 deletions
+9 -1
View File
@@ -260,9 +260,13 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
songCount += arraySongDirs.size();
}
if( songCount==0 ) return;
if( pLoadingWindow )
if( pLoadingWindow ) {
pLoadingWindow->SetIndeterminate( false );
pLoadingWindow->SetTotalWork( songCount );
}
groupIndex = 0;
songIndex = 0;
@@ -318,6 +322,10 @@ void SongManager::LoadStepManiaSongDir( RString sDir )
LoadGroupSymLinks(sDir, sGroupDirName);
}
if( pLoadingWindow ) {
pLoadingWindow->SetIndeterminate( true );
}
LoadEnabledSongsFromPref();
}
+4 -3
View File
@@ -1101,6 +1101,10 @@ int main(int argc, char* argv[])
pLoadingWindow->SetText("Initializing statics manager...");
STATSMAN = new StatsManager;
// Initialize which courses are ranking courses here.
pLoadingWindow->SetText("Updating cource rankings...");
SONGMAN->UpdateRankingCourses();
SAFE_DELETE( pLoadingWindow ); // destroy this before init'ing Display
/* If the user has tried to quit during the loading, do it before creating
@@ -1140,9 +1144,6 @@ int main(int argc, char* argv[])
CodeDetector::RefreshCacheItems();
// Initialize which courses are ranking courses here.
SONGMAN->UpdateRankingCourses();
if( GetCommandlineArgument("netip") )
NSMAN->DisplayStartupStatus(); // If we're using networking show what happened
+4 -1
View File
@@ -47,9 +47,12 @@ LoadingWindow *LoadingWindow::Create()
}
}
if( ret )
if( ret ) {
LOG->Info( "Loading window: %s", Driver.c_str() );
ret->SetIndeterminate(true);
}
return ret;
}
+2
View File
@@ -15,10 +15,12 @@ public:
virtual void SetIcon( const RageSurface *pIcon ) { }
virtual void SetProgress( const int progress ) { m_progress=progress; }
virtual void SetTotalWork( const int totalWork ) { m_totalWork=totalWork; }
virtual void SetIndeterminate( bool indeterminate ) { m_indeterminate=indeterminate; }
protected:
int m_progress;
int m_totalWork;
bool m_indeterminate;
};
extern LoadingWindow *pLoadingWindow;
+19 -6
View File
@@ -110,13 +110,11 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara
(LPARAM) (HANDLE) g_hBitmap );
SetWindowTextA( hWnd, PRODUCT_ID );
{
HWND progressCtrl=GetDlgItem( hWnd, IDC_PROGRESS );
SetWindowLong(progressCtrl,GWL_STYLE, PBS_MARQUEE | GetWindowLong(progressCtrl,GWL_STYLE));
SendMessage(progressCtrl,PBM_SETMARQUEE,1,0);
}
break;
case WM_CLOSE:
return FALSE;
case WM_DESTROY:
DeleteObject( g_hBitmap );
g_hBitmap = NULL;
@@ -229,7 +227,22 @@ void LoadingWindow_Win32::SetTotalWork(const int totalWork)
{
m_totalWork=totalWork;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
::SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
}
void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) {
m_indeterminate=indeterminate;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
if(indeterminate) {
SetWindowLong(hwndItem,GWL_STYLE, PBS_MARQUEE | GetWindowLong(hwndItem,GWL_STYLE));
SendMessage(hwndItem,PBM_SETMARQUEE,1,0);
} else {
SendMessage(hwndItem,PBM_SETMARQUEE,0,0);
SetWindowLong(hwndItem,GWL_STYLE, (~PBS_MARQUEE) & GetWindowLong(hwndItem,GWL_STYLE));
}
}
/*
@@ -17,6 +17,7 @@ public:
void SetIcon( const RageSurface *pIcon );
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
private:
AppInstance handle;