diff --git a/source/SubWindowHandle.cpp b/source/SubWindowHandle.cpp index c8b6229..c595c59 100644 --- a/source/SubWindowHandle.cpp +++ b/source/SubWindowHandle.cpp @@ -98,6 +98,7 @@ bool SubWindowHandle::loadFile( const QString &fileName ) QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( fileName ) ); return false; } + m_cViewArea->setInputStream(m_pCurrStream); QApplication::restoreOverrideCursor(); diff --git a/source/ViewArea.cpp b/source/ViewArea.cpp index a474a2d..340523d 100755 --- a/source/ViewArea.cpp +++ b/source/ViewArea.cpp @@ -63,6 +63,7 @@ ViewArea::ViewArea( QWidget *parent ) : m_gridVisible = false; m_snapToGrid = false; m_blockTrackEnable = false; + m_pStream = NULL; } void ViewArea::setImage( const QPixmap &pixmap ) @@ -501,7 +502,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event ) QPoint actualPos = windowToView( event->pos() ); QRect updateRect; - emit positionChanged( actualPos ); + emit positionChanged( actualPos , getInputStream() ); // If mouse left button pressed if( event->buttons() == Qt::LeftButton && m_lastPos != QPoint( -1, -1 ) ) @@ -750,4 +751,16 @@ void ViewArea::updateMask( const QRect &rect ) } } + +void ViewArea::setInputStream( InputStream *stream ) +{ + m_pStream = stream; +} + +InputStream* ViewArea::getInputStream() +{ + return m_pStream; +} + + } // NameSpace plaYUVer diff --git a/source/ViewArea.h b/source/ViewArea.h index f29ee39..82d8469 100755 --- a/source/ViewArea.h +++ b/source/ViewArea.h @@ -35,6 +35,8 @@ namespace plaYUVer { +class InputStream; + /** * */ @@ -99,12 +101,14 @@ public: return m_maskColor; } + void setInputStream( InputStream *stream ); + InputStream* getInputStream(); + // QSize sizeHint() const; signals: void selectionChanged( const QRect &rect ); - void positionChanged( const QPoint &pos ); - void updateStatusBar( const QPoint &actualPos, int &luma, int &chromaU, int &chromaV ); + void positionChanged( const QPoint &pos, InputStream *stream ); void zoomFactorChanged( double ); public slots: @@ -158,6 +162,8 @@ private: bool m_snapToGrid; bool m_cursorInGrid; + InputStream *m_pStream; + }; } // NameSpace plaYUVer diff --git a/source/plaYUVerApp.cpp b/source/plaYUVerApp.cpp index f26352e..47f6ca5 100644 --- a/source/plaYUVerApp.cpp +++ b/source/plaYUVerApp.cpp @@ -125,7 +125,7 @@ void plaYUVerApp::open() addSubWindow( interfaceChild ); statusBar()->showMessage( tr( "File loaded" ), 2000 ); interfaceChild->show(); - connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &) ), this, SLOT( updatePixelValueStatusBar(const QPoint &) ) ); + connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this, SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); interfaceChild->zoomToFit(); } else @@ -630,27 +630,31 @@ void plaYUVerApp::setActiveSubWindow( QWidget *window ) mdiArea->setActiveSubWindow( qobject_cast( window ) ); } -void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos) +void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos, InputStream* stream) { - Pel pixel; + Pel luma, chromaU, chromaV; Int iWidth, iHeight; Int posX = pos.x(), posY = pos.y(); - QString strStatus = QString("X=%1 Y=%2 ").arg(posX).arg(posY); + QString strPixel; + QString strStatus = QString("(%1,%2) ").arg(posX).arg(posY); + PlaYUVerFrame *curFrame = stream->getCurrentFrame(); - SubWindowHandle *currentSubWindow = m_pcCurrentSubWindow; - if(currentSubWindow) + iWidth = stream->getWidth(); + iHeight = stream->getHeight(); + + if( (posX=0) && (posY=0) ) { - iWidth = currentSubWindow->getInputStream()->getWidth(); - iHeight = currentSubWindow->getInputStream()->getHeight(); - - if( (posX=0) && (posY=0) ) - { - pixel = currentSubWindow->getInputStream()->getCurrentFrame()->getPixelValueFromYUV(pos, LUMA); - QString strAux = QString("Luma= %1").arg(pixel); - strStatus.append(strAux); - statusBar()->showMessage( strStatus , 0 ); - } + luma = curFrame->getPixelValueFromYUV(pos, LUMA); + chromaU = curFrame->getPixelValueFromYUV(pos, CHROMA_U); + chromaV = curFrame->getPixelValueFromYUV(pos, CHROMA_V); + strPixel = QString("Y: %1 U: %2 V: %3").arg(luma).arg(chromaU).arg(chromaV); } + else + { + strPixel = QString("Y: U: V: "); + } + strStatus.append(strPixel); + statusBar()->showMessage( strStatus , 0 ); } } // NAMESPACE diff --git a/source/plaYUVerApp.h b/source/plaYUVerApp.h index 4a1feb9..1fdf557 100644 --- a/source/plaYUVerApp.h +++ b/source/plaYUVerApp.h @@ -40,6 +40,7 @@ namespace plaYUVer { class SubWindowHandle; +class InputStream; class plaYUVerApp: public QMainWindow { @@ -89,7 +90,7 @@ private Q_SLOTS: void dropEvent( QDropEvent *event ); void setActiveSubWindow( QWidget *window ); - void updatePixelValueStatusBar(const QPoint & pos); + void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream); private: QMdiArea *mdiArea;