Browse Source

Implement progress failures

I took the liberty to improve the obvious failure cases where a red progress
bar would be useful.
Adam Johnson 12 years ago
parent
commit
6039d62bc2
  1. 21
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 3
      Sources/Plasma/Apps/plClient/plClient.h
  3. 1
      Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp
  4. 3
      Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp
  5. 6
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  6. 1
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp
  7. 1
      Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

21
Sources/Plasma/Apps/plClient/plClient.cpp

@ -868,8 +868,8 @@ hsBool plClient::MsgReceive(plMessage* msg)
// plResPatcherMsg
//============================================================================
if (plResPatcherMsg * resMsg = plResPatcherMsg::ConvertNoRef(msg)) {
plgDispatch::Dispatch()->UnRegisterForExactType(plResPatcherMsg::Index(), GetKey());
IOnAsyncInitComplete();
IHandlePatcherMsg(resMsg);
return true;
}
return hsKeyedObject::MsgReceive(msg);
@ -1300,7 +1300,10 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress)
if (gTaskbarList)
{
HWND hwnd = fInstance->GetWindowHandle(); // lazy
if (progress->IsLastUpdate())
if (progress->IsAborting())
// We'll assume this is fatal
gTaskbarList->SetProgressState(hwnd, TBPF_ERROR);
else if (progress->IsLastUpdate())
gTaskbarList->SetProgressState(hwnd, TBPF_NOPROGRESS);
else if (progress->GetMax() == 0.f)
gTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE);
@ -2550,6 +2553,18 @@ void plClient::IHandlePreloaderMsg (plPreloaderMsg * msg) {
IPatchGlobalAgeFiles();
}
//============================================================================
void plClient::IHandlePatcherMsg (plResPatcherMsg * msg) {
plgDispatch::Dispatch()->UnRegisterForExactType(plResPatcherMsg::Index(), GetKey());
if (!msg->Success()) {
plNetClientApp::GetInstance()->QueueDisableNet(true, msg->GetError());
return;
}
IOnAsyncInitComplete();
}
//============================================================================
void plClient::IHandleNetCommAuthMsg (plNetCommAuthMsg * msg) {

3
Sources/Plasma/Apps/plClient/plClient.h

@ -82,7 +82,7 @@ class plBinkPlayer;
class plPreloaderMsg;
class plNetCommAuthMsg;
class plAgeLoaded2Msg;
class plResPatcherMsg;
typedef void (*plMessagePumpProc)( void );
@ -179,6 +179,7 @@ protected:
void ICompleteInit ();
void IOnAsyncInitComplete ();
void IHandlePatcherMsg (plResPatcherMsg * msg);
void IHandlePreloaderMsg (plPreloaderMsg * msg);
void IHandleNetCommAuthMsg (plNetCommAuthMsg * msg);
bool IHandleAgeLoaded2Msg (plAgeLoaded2Msg * msg);

1
Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp

@ -300,6 +300,7 @@ void pfSecurePreloader::Start()
void pfSecurePreloader::Terminate()
{
FATAL("pfSecurePreloader failure");
fProgress->SetAborting();
plPreloaderMsg* msg = new plPreloaderMsg;
msg->fSuccess = false;

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

@ -277,7 +277,10 @@ void plResPatcher::Finish(bool success)
if (success)
PatcherLog(kHeader, "--- Patch Completed Successfully ---");
else
{
PatcherLog(kHeader, "--- Patch Killed by Error ---");
fProgress->SetAborting();
}
plResPatcherMsg* pMsg = new plResPatcherMsg(success, sLastError);
pMsg->Send(); // whoosh... off it goes

6
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -165,11 +165,9 @@ void plNetLinkingMgr::NCAgeJoinerCallback (
// Tell the user we failed to link.
// In the future, we might want to try graceful recovery (link back to Relto?)
if (!params->success) {
plNetClientMgr::StaticErrorMsg(params->msg);
hsMessageBox(params->msg, "Linking Error", hsMessageBoxNormal, hsMessageBoxIconError);
plNetClientApp::GetInstance()->ErrorMsg(params->msg);
#ifdef PLASMA_EXTERNAL_RELEASE
plClientMsg* clientMsg = new plClientMsg(plClientMsg::kQuit);
clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
plNetClientApp::GetInstance()->QueueDisableNet(true, params->msg);
#endif
return;
}

1
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp

@ -389,7 +389,6 @@ void plOperationProgress::SetAborting()
hsSetBits(fFlags, kAborting);
plProgressMgr::GetInstance()->IUpdateCallbackProc(this);
fMax = fValue = 0.f;
hsClearBits(fFlags, kAborting);
}
void plOperationProgress::SetRetry()

1
Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h

@ -153,6 +153,7 @@ class plOperationProgress
// progress bars above this one know to adjust their totals to not include any amount
// that wasn't completed, and will set this progress bar to zero
void SetAborting();
bool IsAborting() { return hsCheckBits(fFlags, kAborting); }
// If you're reusing an existing progress bar to retry a failed operation, call this.
// It will set the retry flag, and reset the progress bar so the next update will
// count as the first. If you set retry in RegisterOperation, don't use this too.

Loading…
Cancel
Save