diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 2123565..61f918d 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -175,8 +175,13 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModul { interfaceChild = new VideoSubWindow( m_pcParent, true ); interfaceChild->setWindowName( windowName ); - connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), m_pcParent, - SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + + // connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), m_pcParent, +// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + + connect( interfaceChild, SIGNAL( updateStatusBar( const QString& ) ), m_pcParent, SLOT( updateStatusBar( const QString& ) ) ); + connect( interfaceChild, SIGNAL( zoomChanged() ), m_pcParent, SLOT( updateZoomFactorSBox() ) ); + pcCurrModuleIf->m_pcDisplaySubWindow = interfaceChild; pcCurrModuleIf->m_pcDisplaySubWindow->setModule( pcCurrModuleIf ); } diff --git a/app/SubWindowHandle.h b/app/SubWindowHandle.h index 82e7013..3a7050a 100644 --- a/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -84,6 +84,7 @@ public: Q_SIGNALS: void zoomChanged(); + void updateStatusBar( const QString& ); }; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index c56c84e..94503c2 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -37,11 +37,10 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array for( Int i = 0; i < array.size(); i++ ) { d = array.at( i ); - out << d.m_cFilename - << d.m_uiWidth - << d.m_uiHeight - << d.m_iPelFormat - << d.m_uiFrameRate; + out << d.m_cFilename << d.m_uiWidth + << d.m_uiHeight + << d.m_iPelFormat + << d.m_uiFrameRate; } return out; @@ -97,6 +96,7 @@ VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) : connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset(QPoint) ) ); connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) ); + connect( m_cViewArea, SIGNAL( positionChanged( const QPoint & ) ), this, SLOT( updatePixelValueStatusBar( const QPoint & ) ) ); connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) ); connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) ); @@ -113,7 +113,7 @@ VideoSubWindow::~VideoSubWindow() delete m_cViewArea; delete m_cScrollArea; if( m_pCurrStream ) - delete m_pCurrStream; + delete m_pCurrStream; } Void VideoSubWindow::reloadFile() @@ -129,9 +129,9 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) Int InputFormat = -1; if( !m_pCurrStream ) - { - m_pCurrStream = new PlaYUVerStream; - } + { + m_pCurrStream = new PlaYUVerStream; + } m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate ); @@ -173,8 +173,7 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo ) m_pCurrStream = new PlaYUVerStream; } - if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat, - streamInfo->m_uiFrameRate ) ) + if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat, streamInfo->m_uiFrameRate ) ) { return false; } @@ -287,8 +286,7 @@ Bool VideoSubWindow::save( QString filename ) PlaYUVerFrame* saveFrame = m_pcCurrFrame; if( m_cSelectedArea.isValid() ) { - saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), - m_cSelectedArea.width(), m_cSelectedArea.height() ); + saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), m_cSelectedArea.width(), m_cSelectedArea.height() ); } if( !saveFrame ) { @@ -472,6 +470,29 @@ void VideoSubWindow::updateLastScrollValue() m_cLastScroll.setY( scrollBar->value() ); } +Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos ) +{ + if( m_pcCurrFrame ) + { + PlaYUVerFrame::Pixel sPixelValue; + Int iWidth, iHeight; + Int posX = pos.x(); + Int posY = pos.y(); + QString strStatus; + + iWidth = m_pcCurrFrame->getWidth(); + iHeight = m_pcCurrFrame->getHeight(); + + if( ( posX < iWidth ) && ( posX >= 0 ) && ( posY < iHeight ) && ( posY >= 0 ) ) + { + strStatus = QString( "(%1,%2) " ).arg( posX ).arg( posY ); + sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y(), PlaYUVerFrame::COLOR_YUV ); + strStatus.append( QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() ) ); + emit updateStatusBar( strStatus ); + } + } +} + QSize VideoSubWindow::sizeHint() const { QSize maxSize; // The size of the parent (viewport widget diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 2bb5ca4..74999ce 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -204,6 +204,7 @@ public Q_SLOTS: void processZoomChanged( double , QPoint ); void adjustScrollBarByOffset( QPoint Offset ); void updateLastScrollValue(); + void updatePixelValueStatusBar( const QPoint& ); }; } // NAMESPACE diff --git a/app/ViewArea.cpp b/app/ViewArea.cpp index a70a2b4..3d8dd2e 100644 --- a/app/ViewArea.cpp +++ b/app/ViewArea.cpp @@ -638,7 +638,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event ) QPoint actualPos = windowToView( event->pos() ); QRect updateRect; - emit positionChanged( actualPos, m_pcCurrFrame ); + emit positionChanged( actualPos ); // If mouse left button pressed if( event->buttons() == Qt::LeftButton && m_lastPos != QPoint( -1, -1 ) ) diff --git a/app/ViewArea.h b/app/ViewArea.h index 70988b5..1e64a65 100644 --- a/app/ViewArea.h +++ b/app/ViewArea.h @@ -123,7 +123,7 @@ public: Q_SIGNALS: void selectionChanged( const QRect &rect ); - void positionChanged( const QPoint &pos, PlaYUVerFrame *frame ); + void positionChanged( const QPoint &pos ); void moveScroll( QPoint offset ); void zoomFactorChanged( double factor , QPoint center); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index e96bd15..83a7cb3 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -190,10 +190,10 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) statusBar()->showMessage( tr( "Loading file..." ) ); mdiArea->addSubWindow( videoSubWindow ); videoSubWindow->show(); - connect( videoSubWindow->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this, - SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); + connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) ); + connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) ); connect( subWindow, SIGNAL( zoomChanged() ), this, SLOT( updateZoomFactorSBox() ) ); videoSubWindow->zoomToFit(); @@ -811,6 +811,18 @@ Void plaYUVerApp::chageSubWindowSelection() // ----------------------- Status bar Functions ----------------------- +Void plaYUVerApp::updateStatusBar( const QString& statusBarString ) +{ + if( !statusBarString.isEmpty() ) + { + statusBar()->showMessage( statusBarString, 5000 ); + } + else + { + statusBar()->showMessage( " " ); + } +} + Void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame ) { PlaYUVerFrame::Pixel sPixelValue; diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 35110c9..22e0ae3 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -113,6 +113,7 @@ private Q_SLOTS: void setActiveSubWindow( QWidget *window ); void updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame ); + void updateStatusBar( const QString& ); void updatePropertiesSelectedArea( QRect area );