Added TAS project loading progress dialog for Qt GUI. Added busy mouse cursor during TAS project save/load.
This commit is contained in:
parent
d4e04fc0d3
commit
25a239b39f
|
@ -360,7 +360,7 @@ void GREENZONE::save(EMUFILE *os, int save_type)
|
||||||
bool GREENZONE::load(EMUFILE *is, unsigned int offset)
|
bool GREENZONE::load(EMUFILE *is, unsigned int offset)
|
||||||
{
|
{
|
||||||
int frame = 0, prev_frame = -1, size = 0;
|
int frame = 0, prev_frame = -1, size = 0;
|
||||||
int last_tick = 0;
|
int last_tick = -1;
|
||||||
char save_id[GREENZONE_ID_LEN];
|
char save_id[GREENZONE_ID_LEN];
|
||||||
|
|
||||||
free();
|
free();
|
||||||
|
@ -414,6 +414,8 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (strcmp(greenzone_save_id, save_id)) goto error; // string is not valid
|
if (strcmp(greenzone_save_id, save_id)) goto error; // string is not valid
|
||||||
|
|
||||||
|
setTasProjectProgressBarText("Loading Greenzone...");
|
||||||
// read LagLog
|
// read LagLog
|
||||||
lagLog.load(is);
|
lagLog.load(is);
|
||||||
// read size
|
// read size
|
||||||
|
@ -438,6 +440,7 @@ bool GREENZONE::load(EMUFILE *is, unsigned int offset)
|
||||||
// update TASEditor progressbar from time to time
|
// update TASEditor progressbar from time to time
|
||||||
if (frame / PROGRESSBAR_UPDATE_RATE > last_tick)
|
if (frame / PROGRESSBAR_UPDATE_RATE > last_tick)
|
||||||
{
|
{
|
||||||
|
setTasProjectProgressBar( frame, greenzoneSize );
|
||||||
playback->setProgressbar(frame, greenzoneSize);
|
playback->setProgressbar(frame, greenzoneSize);
|
||||||
last_tick = frame / PROGRESSBAR_UPDATE_RATE;
|
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:
|
error:
|
||||||
FCEU_printf("Error loading Greenzone\n");
|
FCEU_printf("Error loading Greenzone\n");
|
||||||
reset();
|
reset();
|
||||||
|
|
|
@ -1056,6 +1056,9 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset)
|
||||||
if (!read32le(&historyTotalItems, is)) goto error;
|
if (!read32le(&historyTotalItems, is)) goto error;
|
||||||
if (historyCursorPos > historyTotalItems) goto error;
|
if (historyCursorPos > historyTotalItems) goto error;
|
||||||
historyStartPos = 0;
|
historyStartPos = 0;
|
||||||
|
|
||||||
|
setTasProjectProgressBarText("Loading History...");
|
||||||
|
setTasProjectProgressBar( 0, historySize );
|
||||||
// read items
|
// read items
|
||||||
total = historyTotalItems;
|
total = historyTotalItems;
|
||||||
if (historyTotalItems > historySize)
|
if (historyTotalItems > historySize)
|
||||||
|
@ -1087,6 +1090,7 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset)
|
||||||
if (snapshots[i].load(is)) goto error;
|
if (snapshots[i].load(is)) goto error;
|
||||||
if (bookmarkBackups[i].load(is)) goto error;
|
if (bookmarkBackups[i].load(is)) goto error;
|
||||||
if (is->fread(¤tBranchNumberBackups[i], 1) != 1) goto error;
|
if (is->fread(¤tBranchNumberBackups[i], 1) != 1) goto error;
|
||||||
|
setTasProjectProgressBar( i, historyTotalItems );
|
||||||
playback->setProgressbar(i, historyTotalItems);
|
playback->setProgressbar(i, historyTotalItems);
|
||||||
}
|
}
|
||||||
// skip redo items if needed
|
// skip redo items if needed
|
||||||
|
@ -1098,6 +1102,7 @@ bool HISTORY::load(EMUFILE *is, unsigned int offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything went well
|
// everything went well
|
||||||
|
setTasProjectProgressBar( historyTotalItems, historyTotalItems );
|
||||||
// init vars
|
// init vars
|
||||||
undoHintPos = oldUndoHintPos = undoHintTimer = -1;
|
undoHintPos = oldUndoHintPos = undoHintTimer = -1;
|
||||||
oldShowUndoHint = showUndoHint = false;
|
oldShowUndoHint = showUndoHint = false;
|
||||||
|
|
|
@ -18,6 +18,7 @@ Project - Manager of working project
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
|
@ -144,6 +145,8 @@ bool TASEDITOR_PROJECT::save(const char* differentName, bool inputInBinary, bool
|
||||||
progressDialog->setValue(0);
|
progressDialog->setValue(0);
|
||||||
|
|
||||||
// change cursor to hourglass
|
// change cursor to hourglass
|
||||||
|
QGuiApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
|
||||||
|
|
||||||
//SetCursor(LoadCursor(0, IDC_WAIT));
|
//SetCursor(LoadCursor(0, IDC_WAIT));
|
||||||
// save fm2 data to the project file
|
// save fm2 data to the project file
|
||||||
currMovieData.loadFrameCount = currMovieData.records.size();
|
currMovieData.loadFrameCount = currMovieData.records.size();
|
||||||
|
@ -200,6 +203,8 @@ bool TASEDITOR_PROJECT::save(const char* differentName, bool inputInBinary, bool
|
||||||
{
|
{
|
||||||
delete progressDialog; progressDialog = NULL;
|
delete progressDialog; progressDialog = NULL;
|
||||||
}
|
}
|
||||||
|
QGuiApplication::setOverrideCursor( QCursor(Qt::ArrowCursor) );
|
||||||
|
|
||||||
//taseditorWindow.mustUpdateMouseCursor = true;
|
//taseditorWindow.mustUpdateMouseCursor = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -324,6 +329,17 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
|
||||||
return false;
|
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 savedStuff = 0;
|
||||||
unsigned int numberOfPointers = 0;
|
unsigned int numberOfPointers = 0;
|
||||||
unsigned int dataOffset = 0;
|
unsigned int dataOffset = 0;
|
||||||
|
@ -385,7 +401,13 @@ bool TASEDITOR_PROJECT::load(const char* fullName)
|
||||||
splicer->reset();
|
splicer->reset();
|
||||||
reset();
|
reset();
|
||||||
renameProject(fullName, loadAll);
|
renameProject(fullName, loadAll);
|
||||||
|
|
||||||
|
if ( progressDialog )
|
||||||
|
{
|
||||||
|
delete progressDialog; progressDialog = NULL;
|
||||||
|
}
|
||||||
// restore mouse cursor shape
|
// restore mouse cursor shape
|
||||||
|
QGuiApplication::setOverrideCursor( QCursor(Qt::ArrowCursor) );
|
||||||
//taseditorWindow.mustUpdateMouseCursor = true;
|
//taseditorWindow.mustUpdateMouseCursor = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -501,4 +523,5 @@ void setTasProjectProgressBar( int cur, int max )
|
||||||
}
|
}
|
||||||
progressDialog->setValue(cur);
|
progressDialog->setValue(cur);
|
||||||
}
|
}
|
||||||
|
//usleep(100000); // Uncomment to slow down save/load progress for debug purposes
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue