Merge branch 'master' into jfmcarreira-dev

This commit is contained in:
jfmcarreira committed 2014-03-23 16:09:49 +00:00
commit e2dda5ff3b
5 files changed
+51 -34

No files matched your search

+2
View File
@@ -45,6 +45,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
// Define the cViewArea as the widget inside the scroll area
m_cScrollArea->setWidget( m_cViewArea );
m_cScrollArea->setWidgetResizable(true);
m_pcCurrentModule = NULL;
@@ -98,6 +99,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();
+19 -15
View File
@@ -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 )
@@ -103,11 +104,10 @@ void ViewArea::setZoomFactor( double f )
//return;
m_zoomFactor = f;
emit( zoomFactorChanged( m_zoomFactor ) );
//emit( zoomFactorChanged( m_zoomFactor ) );
updateSize();
repaint();
updateGeometry();
update();
}
void ViewArea::setMode( ViewMode mode )
@@ -213,16 +213,7 @@ void ViewArea::updateSize()
int h = m_pixmap.height() * m_zoomFactor;
setMinimumSize( w, h );
QWidget *p = parentWidget();
if( p )
{
// If the parent size is bigger than the minimum area to view the
// image, resize() will call resizeEvent(); otherwise, we need to
// perform the necessary updates (updateOffset).
resize( p->width(), p->height() );
}
if( w <= width() && h <= height() )
updateOffset();
updateOffset();
}
void ViewArea::updateOffset()
@@ -249,12 +240,13 @@ void ViewArea::updateOffset()
////////////////////////////////////////////////////////////////////////////////
// Resize Event
////////////////////////////////////////////////////////////////////////////////
void ViewArea::resizeEvent( QResizeEvent */* event */)
void ViewArea::resizeEvent( QResizeEvent *event )
{
if( size().isEmpty() || m_pixmap.isNull() )
return;
updateOffset();
update();
}
////////////////////////////////////////////////////////////////////////////////
// Paint Event
@@ -501,7 +493,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 +742,16 @@ void ViewArea::updateMask( const QRect &rect )
}
}
void ViewArea::setInputStream( InputStream *stream )
{
m_pStream = stream;
}
InputStream* ViewArea::getInputStream()
{
return m_pStream;
}
} // NameSpace plaYUVer
+8 -2
View File
@@ -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
+20 -16
View File
@@ -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<QMdiSubWindow *>( 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<iWidth) && (posX>=0) && (posY<iHeight) && (posY>=0) )
{
iWidth = currentSubWindow->getInputStream()->getWidth();
iHeight = currentSubWindow->getInputStream()->getHeight();
if( (posX<iWidth) && (posX>=0) && (posY<iHeight) && (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
+2 -1
View File
@@ -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;