Modified AVI RIFF viewer code to allow for multiple instances of the window.

This commit is contained in:
mjbudd77 2021-10-03 10:16:30 -04:00
parent c799d3f11e
commit a290718962
1 changed files with 2 additions and 5 deletions

View File

@ -37,15 +37,14 @@
#include "Qt/ConsoleUtilities.h" #include "Qt/ConsoleUtilities.h"
static bool showSizeHex = true; static bool showSizeHex = true;
static AviRiffViewerDialog *win = NULL;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int riffWalkCallback( int type, long long int fpos, const char *fourcc, size_t size, void *userData ) static int riffWalkCallback( int type, long long int fpos, const char *fourcc, size_t size, void *userData )
{ {
int ret = 0; int ret = 0;
if ( win ) if ( userData )
{ {
ret = win->riffWalkCallback( type, fpos, fourcc, size ); ret = static_cast <AviRiffViewerDialog*>(userData)->riffWalkCallback( type, fpos, fourcc, size );
} }
return ret; return ret;
} }
@ -61,7 +60,6 @@ AviRiffViewerDialog::AviRiffViewerDialog(QWidget *parent)
QPushButton *closeButton; QPushButton *closeButton;
QTreeWidgetItem *item; QTreeWidgetItem *item;
win = this;
avi = NULL; avi = NULL;
lastChunk = NULL; lastChunk = NULL;
memset( strhType, 0, sizeof(strhType) ); memset( strhType, 0, sizeof(strhType) );
@ -121,7 +119,6 @@ AviRiffViewerDialog::~AviRiffViewerDialog(void)
{ {
delete avi; avi = NULL; delete avi; avi = NULL;
} }
win = NULL;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void AviRiffViewerDialog::closeEvent(QCloseEvent *event) void AviRiffViewerDialog::closeEvent(QCloseEvent *event)