Add stop function. Trying to implement a different playing behaviour with a direct connection to the SubWindow class
This commit is contained in:
1 parent
05e007c135
commit
3ee9a4b277
3 files changed
+42
-25
No files matched your search
+24
-11
@@ -47,6 +47,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
|
||||
m_cWindowName = QString( " " );
|
||||
m_bIsPlaying = true;
|
||||
m_dScaleFactor = 1;
|
||||
|
||||
}
|
||||
@@ -93,7 +94,7 @@ bool SubWindowHandle::loadFile( const QString &fileName )
|
||||
|
||||
normalSize();
|
||||
|
||||
m_cWindowName = QString("ola");
|
||||
m_cWindowName = QString( "ola" );
|
||||
m_cWindowName = m_currStream.getStreamInformationString();
|
||||
|
||||
m_cCurrFileName = fileName;
|
||||
@@ -133,23 +134,35 @@ bool SubWindowHandle::save()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SubWindowHandle::playEvent()
|
||||
int SubWindowHandle::playEvent()
|
||||
{
|
||||
m_currStream.readFrame();
|
||||
if( m_currStream.checkErrors( READING ) )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cCurrFileName ) );
|
||||
return false;
|
||||
}
|
||||
else if( m_currStream.checkErrors( END_OF_SEQ ) )
|
||||
if( m_bIsPlaying )
|
||||
{
|
||||
m_currStream.readFrame();
|
||||
if( m_currStream.checkErrors( READING ) )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cCurrFileName ) );
|
||||
return false;
|
||||
}
|
||||
else if( m_currStream.checkErrors( END_OF_SEQ ) )
|
||||
{
|
||||
m_cViewArea->setImage( QPixmap::fromImage( m_currStream.getFrameQImage() ) );
|
||||
return false;
|
||||
}
|
||||
m_cViewArea->setImage( QPixmap::fromImage( m_currStream.getFrameQImage() ) );
|
||||
return false;
|
||||
}
|
||||
m_cViewArea->setImage( QPixmap::fromImage( m_currStream.getFrameQImage() ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::stopEvent()
|
||||
{
|
||||
m_currStream.seekInput( 0 );
|
||||
m_currStream.readFrame();
|
||||
m_cViewArea->setImage( QPixmap::fromImage( m_currStream.getFrameQImage() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Void SubWindowHandle::normalSize()
|
||||
{
|
||||
m_dScaleFactor = 1.0;
|
||||
|
||||
@@ -57,6 +57,8 @@ private:
|
||||
|
||||
Double m_dScaleFactor;
|
||||
|
||||
Bool m_bIsPlaying;
|
||||
|
||||
public:
|
||||
SubWindowHandle( QWidget * parent = 0 );
|
||||
~SubWindowHandle();
|
||||
@@ -64,7 +66,7 @@ public:
|
||||
bool loadFile( const QString &fileName );
|
||||
bool save();
|
||||
|
||||
bool playEvent();
|
||||
Void stopEvent();
|
||||
|
||||
InputStream* getInputStream()
|
||||
{
|
||||
@@ -124,8 +126,8 @@ public:
|
||||
protected:
|
||||
Void closeEvent( QCloseEvent *event );
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
public Q_SLOTS:
|
||||
int playEvent();
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
+13
-11
@@ -68,8 +68,6 @@ plaYUVerApp::plaYUVerApp()
|
||||
setAcceptDrops( true );
|
||||
mdiArea->setAcceptDrops( true );
|
||||
|
||||
connect( playingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
|
||||
|
||||
}
|
||||
|
||||
Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
||||
@@ -136,14 +134,14 @@ void plaYUVerApp::save()
|
||||
|
||||
void plaYUVerApp::play()
|
||||
{
|
||||
UInt frameRate;
|
||||
UInt timeInterval;
|
||||
|
||||
frameRate = activeSubWindow()->getInputStream()->getFrameRate();
|
||||
timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 );
|
||||
|
||||
playingTimer->start( timeInterval );
|
||||
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
UInt frameRate = activeSubWindow()->getInputStream()->getFrameRate();
|
||||
UInt timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 );
|
||||
playingTimer->start( timeInterval );
|
||||
//connect( playingTimer, SIGNAL( timeout() ), activeSubWindow(), SLOT( playEvent() ) );
|
||||
connect( playingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void plaYUVerApp::pause()
|
||||
@@ -153,6 +151,10 @@ void plaYUVerApp::pause()
|
||||
|
||||
void plaYUVerApp::stop()
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->stopEvent();
|
||||
}
|
||||
playingTimer->stop();
|
||||
//disconnect( playingTimer, SIGNAL( timeout() ), 0, 0 );
|
||||
}
|
||||
@@ -251,7 +253,7 @@ void plaYUVerApp::updateWindowMenu()
|
||||
if( number_windows > 1 )
|
||||
{
|
||||
actionNext->setEnabled( true );
|
||||
actionPrevious->setEnabled( true );
|
||||
actionPrevious->setEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user