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. 30
      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];
strcpy(name, &fProgressBar->GetTitle()[strlen("Loading ")]);
strcpy(name, &fProgressBar->GetTitle().c_str()[strlen("Loading ")]);
name[strlen(name)-3] = '\0';
// 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
if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "displaying messages");
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "displaying messages");
#endif // PLASMA_EXTERNAL_RELEASE
#endif
}
@ -1349,7 +1349,7 @@ void plClient::IStartProgress( const char *title, float len )
fProgressBar = plProgressMgr::GetInstance()->RegisterOperation(len, title, plProgressMgr::kNone, false, true);
#ifndef PLASMA_EXTERNAL_RELEASE
if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "starting");
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "starting");
#endif // PLASMA_EXTERNAL_RELEASE
((plResManager*)hsgResMgr::ResMgr())->SetProgressBarProc(IReadKeyedObjCallback);
@ -1371,7 +1371,7 @@ void plClient::IStopProgress( void )
{
#ifndef PLASMA_EXTERNAL_RELEASE
if (plDispatchLogBase::IsLogging())
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle(), "done");
plDispatchLogBase::GetInstance()->LogStatusBarChange(fProgressBar->GetTitle().c_str(), "done");
#endif // PLASMA_EXTERNAL_RELEASE
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) {
#ifndef PLASMA_EXTERNAL_RELEASE
if (s_instance)
s_instance->progressBar->SetStatusText(key->GetName().c_str());
s_instance->progressBar->SetStatusText(key->GetName());
#endif
}

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

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

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

@ -268,8 +268,6 @@ plOperationProgress::plOperationProgress( float length ) :
fRemainingSecs(0),
fAmtPerSec(0.f)
{
memset( fStatusText, 0, sizeof( fStatusText ) );
memset( fTitle, 0, sizeof( fTitle ) );
}
plOperationProgress::~plOperationProgress()
@ -347,28 +345,6 @@ void plOperationProgress::SetHowMuch( float howMuch )
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 ///////////////////////////////////////////////////////////////
void plOperationProgress::SetLength( float length )

30
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

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

Loading…
Cancel
Save