Browse Source

plString-ify plOperationProgress

Adam Johnson 11 years ago
parent
commit
7da0467609
  1. 8
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp
  3. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp
  4. 10
      Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp
  5. 24
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  6. 26
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

8
Sources/Plasma/Apps/plClient/plClient.cpp

@ -1196,7 +1196,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold)
}; };
char name[256]; char name[256];
strcpy(name, &fProgressBar->GetTitle()[strlen("Loading ")]); strcpy(name, &fProgressBar->GetTitle().c_str()[strlen("Loading ")]);
name[strlen(name)-3] = '\0'; name[strlen(name)-3] = '\0';
// Get the precalculated value for how many messages will be // Get the precalculated value for how many messages will be
@ -1222,7 +1222,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold)
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if (plDispatchLogBase::IsLogging()) if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "displaying messages"); plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "displaying messages");
#endif // PLASMA_EXTERNAL_RELEASE #endif // PLASMA_EXTERNAL_RELEASE
#endif #endif
} }
@ -1349,7 +1349,7 @@ void plClient::IStartProgress( const char *title, float len )
fProgressBar = plProgressMgr::GetInstance()->RegisterOperation(len, title, plProgressMgr::kNone, false, true); fProgressBar = plProgressMgr::GetInstance()->RegisterOperation(len, title, plProgressMgr::kNone, false, true);
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if (plDispatchLogBase::IsLogging()) if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "starting"); plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "starting");
#endif // PLASMA_EXTERNAL_RELEASE #endif // PLASMA_EXTERNAL_RELEASE
((plResManager*)hsgResMgr::ResMgr())->SetProgressBarProc(IReadKeyedObjCallback); ((plResManager*)hsgResMgr::ResMgr())->SetProgressBarProc(IReadKeyedObjCallback);
@ -1371,7 +1371,7 @@ void plClient::IStopProgress( void )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if (plDispatchLogBase::IsLogging()) if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "done"); plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "done");
#endif // PLASMA_EXTERNAL_RELEASE #endif // PLASMA_EXTERNAL_RELEASE
plDispatch::SetMsgRecieveCallback(nil); plDispatch::SetMsgRecieveCallback(nil);

2
Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp

@ -249,7 +249,7 @@ void plResPatcher::IssueRequest()
} }
} }
fProgress->SetTitle(title.c_str()); fProgress->SetTitle(title);
} }
} }

2
Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp

@ -188,7 +188,7 @@ void plNCAgeJoiner::IDispatchMsgReceiveCallback () {
void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) { void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if (s_instance) if (s_instance)
s_instance->progressBar->SetStatusText(key->GetName().c_str()); s_instance->progressBar->SetStatusText(key->GetName());
#endif #endif
} }

10
Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp

@ -245,16 +245,16 @@ bool plDTProgressMgr::IDrawTheStupidThing(plPipeline *p, plOperationProgress
if (drawText) if (drawText)
{ {
if (prog->GetTitle()) if (!prog->GetTitle().IsEmpty())
{ {
text.DrawString( x, y, prog->GetTitle(), (uint32_t)0xccb0b0b0 ); text.DrawString_TEMP( x, y, prog->GetTitle(), (uint32_t)0xccb0b0b0 );
x += (uint16_t)text.CalcStringWidth( prog->GetTitle() ); x += (uint16_t)text.CalcStringWidth_TEMP( prog->GetTitle() );
drew_something = true; drew_something = true;
} }
if (prog->GetStatusText()) if (!prog->GetStatusText().IsEmpty())
{ {
text.DrawString( x, y, prog->GetStatusText(), (uint32_t)0xccb0b0b0 ); text.DrawString_TEMP( x, y, prog->GetStatusText(), (uint32_t)0xccb0b0b0 );
drew_something = true; drew_something = true;
} }
} }

24
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp

@ -268,8 +268,6 @@ plOperationProgress::plOperationProgress( float length ) :
fRemainingSecs(0), fRemainingSecs(0),
fAmtPerSec(0.f) fAmtPerSec(0.f)
{ {
memset( fStatusText, 0, sizeof( fStatusText ) );
memset( fTitle, 0, sizeof( fTitle ) );
} }
plOperationProgress::~plOperationProgress() plOperationProgress::~plOperationProgress()
@ -347,28 +345,6 @@ void plOperationProgress::SetHowMuch( float howMuch )
plProgressMgr::GetInstance()->IUpdateCallbackProc( this ); plProgressMgr::GetInstance()->IUpdateCallbackProc( this );
} }
//// SetStatusText ///////////////////////////////////////////////////////////
void plOperationProgress::SetStatusText( const char *text )
{
if( text != nil )
strncpy( fStatusText, text, sizeof( fStatusText ) );
else
fStatusText[ 0 ] = 0;
}
//// SetTitle ////////////////////////////////////////////////////////////////
void plOperationProgress::SetTitle( const char *text )
{
if (text != nil)
{
strncpy(fTitle, text, sizeof(fTitle));
}
else
fTitle[0] = 0;
}
//// SetLength /////////////////////////////////////////////////////////////// //// SetLength ///////////////////////////////////////////////////////////////
void plOperationProgress::SetLength( float length ) void plOperationProgress::SetLength( float length )

26
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plProgressMgr_h #define _plProgressMgr_h
#include "HeadSpin.h" #include "HeadSpin.h"
#include "plString.h"
class plPipeline; class plPipeline;
class plPlate; class plPlate;
@ -74,8 +74,8 @@ class plOperationProgress
protected: protected:
float fValue, fMax; float fValue, fMax;
char fStatusText[ 256 ]; plString fTitle;
char fTitle[ 256 ]; plString fStatusText;
uint32_t fContext; uint32_t fContext;
double fStartTime; double fStartTime;
@ -109,11 +109,11 @@ class plOperationProgress
~plOperationProgress(); ~plOperationProgress();
float GetMax( void ) const { return fMax; } float GetMax() const { return fMax; }
float GetProgress( void ) const { return fValue; } float GetProgress() const { return fValue; }
const char * GetTitle( void ) const { return fTitle; } plString GetTitle() const { return fTitle; }
const char * GetStatusText( void ) const { return fStatusText; } plString GetStatusText() const { return fStatusText; }
uint32_t GetContext( void ) const { return fContext; } uint32_t GetContext() const { return fContext; }
uint32_t GetElapsedSecs() { return fElapsedSecs; } uint32_t GetElapsedSecs() { return fElapsedSecs; }
uint32_t GetRemainingSecs() { return fRemainingSecs; } uint32_t GetRemainingSecs() { return fRemainingSecs; }
float GetAmtPerSec() { return fAmtPerSec; } float GetAmtPerSec() { return fAmtPerSec; }
@ -127,16 +127,16 @@ class plOperationProgress
// Set the length // Set the length
void SetLength( float length ); void SetLength( float length );
// Sets the display text above the bar (nil for nothing) /** Sets the progress bar's status text */
void SetStatusText( const char *text ); void SetStatusText(const plString& status) { fStatusText = status; }
// Sets the title /** Sets the progress bar's title */
void SetTitle( const char *title ); void SetTitle(const plString& title) { fTitle = title; }
// Application data // Application data
void SetContext( uint32_t context ) { fContext = context;} void SetContext( uint32_t context ) { fContext = context;}
bool IsDone( void ) { return ( fValue < fMax ) ? false : true; } bool IsDone() { return ( fValue < fMax ) ? false : true; }
// True if this is the initial update (progress was just created) // True if this is the initial update (progress was just created)
bool IsInitUpdate() { return hsCheckBits(fFlags, kInitUpdate); } bool IsInitUpdate() { return hsCheckBits(fFlags, kInitUpdate); }

Loading…
Cancel
Save