Update slot to use the frame instead of the stream

updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *)
This commit is contained in:
jfmcarreira committed 2014-04-17 20:31:59 +01:00
1 parent 9e666117b2
commit 9cc3c792e8
4 files changed
+18 -16

No files matched your search

+6 -5
View File
@@ -53,6 +53,7 @@ ViewArea::ViewArea( QWidget *parent ) :
// setAttribute( Qt::WA_NoBackground );
setMouseTracking( true );
m_pcCurrFrame = NULL;
m_pixmap = QPixmap();
m_grid = GridManager();
m_mask = QBitmap();
@@ -70,8 +71,9 @@ ViewArea::ViewArea( QWidget *parent ) :
void ViewArea::setImage( PlaYUVerFrame* pcFrame )
{
pcFrame->FrametoRGB8();
QImage qimg = QImage( pcFrame->getQImageBuffer(), pcFrame->getWidth(), pcFrame->getHeight(), QImage::Format_RGB888 );
m_pcCurrFrame = pcFrame;
m_pcCurrFrame->FrametoRGB8();
QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 );
setImage( QPixmap::fromImage( qimg ) );
}
@@ -363,7 +365,6 @@ void ViewArea::paintEvent( QPaintEvent *event )
{
Int imageWidth = m_pixmap.width();
Int imageHeight = m_pixmap.height();
PlaYUVerFrame *curFrame = getInputStream()->getCurrFrame();
Pixel sPixelValue;
QFont font("Helvetica");
@@ -378,7 +379,7 @@ void ViewArea::paintEvent( QPaintEvent *event )
for(Int j=vr.y() ; j<=vr.bottom() ; j++)
{
QPoint pixelTopLeft(i,j);
sPixelValue = curFrame->getPixelValue( pixelTopLeft, PlaYUVerFrame::COLOR_YUV );
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft, PlaYUVerFrame::COLOR_YUV );
QRect pixelRect(viewToWindow(pixelTopLeft), QSize(m_zoomFactor,m_zoomFactor));
if( sPixelValue.Luma < 128 )
@@ -611,7 +612,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event )
QPoint actualPos = windowToView( event->pos() );
QRect updateRect;
emit positionChanged( actualPos , getInputStream() );
emit positionChanged( actualPos , m_pcCurrFrame );
// If mouse left button pressed
if( event->buttons() == Qt::LeftButton && m_lastPos != QPoint( -1, -1 ) )
+2 -1
View File
@@ -110,7 +110,7 @@ public:
signals:
void selectionChanged( const QRect &rect );
void positionChanged( const QPoint &pos, InputStream *stream );
void positionChanged( const QPoint &pos, PlaYUVerFrame *frame );
void moveScroll( QPoint offset );
void zoomFactorChanged( double factor , QPoint center);
@@ -148,6 +148,7 @@ private:
QPoint viewToWindow( const QPoint& pt ) const;
QRect viewToWindow( const QRect& rc ) const;
PlaYUVerFrame *m_pcCurrFrame;
QPixmap m_pixmap;
QBitmap m_mask;
QRect m_selectedArea;
+9 -9
View File
@@ -147,10 +147,10 @@ Void plaYUVerApp::loadFile( QString fileName )
mdiArea->addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
// connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this,
// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
@@ -233,9 +233,9 @@ void plaYUVerApp::selectModule( QAction *curr_action )
mdiArea->addSubWindow( interfaceChild );
// connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this,
// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
// connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this,
// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
m_pcCurrentSubWindow->setModuleSubWindow( interfaceChild );
m_pcCurrentSubWindow->enableModule( pcCurrMod );
interfaceChild->show();
@@ -582,17 +582,17 @@ void plaYUVerApp::chageSubWindowSelection()
// ----------------------- Status bar Functions -----------------------
void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, InputStream* stream )
void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame )
{
Pixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strPixel;
QString strStatus = QString( "(%1,%2) " ).arg( posX ).arg( posY );
PlaYUVerFrame *curFrame = stream->getCurrFrame();
PlaYUVerFrame *curFrame = frame;
iWidth = stream->getWidth();
iHeight = stream->getHeight();
iWidth = frame->getWidth();
iHeight = frame->getHeight();
if( ( posX < iWidth ) && ( posX >= 0 ) && ( posY < iHeight ) && ( posY >= 0 ) )
{
+1 -1
View File
@@ -97,7 +97,7 @@ private Q_SLOTS:
void setActiveSubWindow( QWidget *window );
void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream);
void updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame );
void updatePropertiesSelectedArea( QRect area );