diff --git a/src/drivers/Qt/TasEditor/greenzone.cpp b/src/drivers/Qt/TasEditor/greenzone.cpp index 7507fa30..837009ab 100644 --- a/src/drivers/Qt/TasEditor/greenzone.cpp +++ b/src/drivers/Qt/TasEditor/greenzone.cpp @@ -360,7 +360,7 @@ void GREENZONE::save(EMUFILE *os, int save_type) bool GREENZONE::load(EMUFILE *is, unsigned int offset) { int frame = 0, prev_frame = -1, size = 0; - int last_tick = 0; + int last_tick = -1; char save_id[GREENZONE_ID_LEN]; free(); @@ -414,6 +414,8 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset) goto error; } if (strcmp(greenzone_save_id, save_id)) goto error; // string is not valid + + setTasProjectProgressBarText("Loading Greenzone..."); // read LagLog lagLog.load(is); // read size @@ -438,6 +440,7 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset) // update TASEditor progressbar from time to time if (frame / PROGRESSBAR_UPDATE_RATE > last_tick) { + setTasProjectProgressBar( frame, greenzoneSize ); playback->setProgressbar(frame, greenzoneSize); last_tick = frame / PROGRESSBAR_UPDATE_RATE; } @@ -489,6 +492,10 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset) } } } + if ( greenzoneSize > 0 ) + { + setTasProjectProgressBar( greenzoneSize, greenzoneSize ); + } error: FCEU_printf("Error loading Greenzone\n"); reset(); diff --git a/src/drivers/Qt/TasEditor/history.cpp b/src/drivers/Qt/TasEditor/history.cpp index 748d6a19..b1b7bff0 100644 --- a/src/drivers/Qt/TasEditor/history.cpp +++ b/src/drivers/Qt/TasEditor/history.cpp @@ -1056,6 +1056,9 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset) if (!read32le(&historyTotalItems, is)) goto error; if (historyCursorPos > historyTotalItems) goto error; historyStartPos = 0; + + setTasProjectProgressBarText("Loading History..."); + setTasProjectProgressBar( 0, historySize ); // read items total = historyTotalItems; if (historyTotalItems > historySize) @@ -1087,6 +1090,7 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset) if (snapshots[i].load(is)) goto error; if (bookmarkBackups[i].load(is)) goto error; if (is->fread(¤tBranchNumberBackups[i], 1) != 1) goto error; + setTasProjectProgressBar( i, historyTotalItems ); playback->setProgressbar(i, historyTotalItems); } // skip redo items if needed @@ -1098,6 +1102,7 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset) } // everything went well + setTasProjectProgressBar( historyTotalItems, historyTotalItems ); // init vars undoHintPos = oldUndoHintPos = undoHintTimer = -1; oldShowUndoHint = showUndoHint = false; diff --git a/src/drivers/Qt/TasEditor/taseditor_project.cpp b/src/drivers/Qt/TasEditor/taseditor_project.cpp index 355e4536..1f59f62d 100644 --- a/src/drivers/Qt/TasEditor/taseditor_project.cpp +++ b/src/drivers/Qt/TasEditor/taseditor_project.cpp @@ -18,6 +18,7 @@ Project - Manager of working project #include #include +#include #include "fceu.h" #include "movie.h" @@ -144,6 +145,8 @@ bool TASEDITOR_PROJECT::save(const char* differentName, bool inputInBinary, bool progressDialog->setValue(0); // change cursor to hourglass + QGuiApplication::setOverrideCursor( QCursor(Qt::BusyCursor) ); + //SetCursor(LoadCursor(0, IDC_WAIT)); // save fm2 data to the project file currMovieData.loadFrameCount = currMovieData.records.size(); @@ -200,6 +203,8 @@ bool TASEDITOR_PROJECT::save(const char* differentName, bool inputInBinary, bool { delete progressDialog; progressDialog = NULL; } + QGuiApplication::setOverrideCursor( QCursor(Qt::ArrowCursor) ); + //taseditorWindow.mustUpdateMouseCursor = true; return true; } @@ -324,6 +329,17 @@ bool TASEDITOR_PROJECT::load(const char* fullName) return false; } + progressDialog = new QProgressDialog( QObject::tr("Loading TAS Project"), QObject::tr("Cancel"), 0, 100, tasWin ); + progressDialog->setWindowModality(Qt::WindowModal); + progressDialog->setWindowTitle( QObject::tr("Loading TAS Project") ); + progressDialog->setAutoReset(false); + progressDialog->setAutoClose(false); + progressDialog->setMinimumDuration(500); + progressDialog->setValue(0); + + // change cursor to hourglass + QGuiApplication::setOverrideCursor( QCursor(Qt::BusyCursor) ); + unsigned int savedStuff = 0; unsigned int numberOfPointers = 0; unsigned int dataOffset = 0; @@ -385,7 +401,13 @@ bool TASEDITOR_PROJECT::load(const char* fullName) splicer->reset(); reset(); renameProject(fullName, loadAll); + + if ( progressDialog ) + { + delete progressDialog; progressDialog = NULL; + } // restore mouse cursor shape + QGuiApplication::setOverrideCursor( QCursor(Qt::ArrowCursor) ); //taseditorWindow.mustUpdateMouseCursor = true; return true; } @@ -501,4 +523,5 @@ void setTasProjectProgressBar( int cur, int max ) } progressDialog->setValue(cur); } + //usleep(100000); // Uncomment to slow down save/load progress for debug purposes }