diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 6470667..27d1885 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -291,7 +291,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) } else { - windowName.append( pcVideoSubWindow->getWindowName() ); videoSubWindowList.append( pcVideoSubWindow ); } @@ -302,9 +301,8 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) return; } - windowName.append( " <" ); + windowName.append( QStringLiteral( "Module " ) ); windowName.append( pcCurrModuleIf->m_pcModule->m_pchModuleName ); - windowName.append( ">" ); for( Int i = 0; i < videoSubWindowList.size(); i++ ) { diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h index 69524b3..8ea117a 100644 --- a/app/PlaYUVerAppModuleIf.h +++ b/app/PlaYUVerAppModuleIf.h @@ -29,6 +29,7 @@ #include "PlaYUVerAppDefs.h" #include #include +#include #include "lib/PlaYUVerFrame.h" #include "lib/PlaYUVerStream.h" #include "ModuleHandleDock.h" @@ -88,6 +89,15 @@ public: { } + QList getSubWindowList() + { + QList arraySubWindows; + for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ ) + if( m_pcSubWindow[i] ) + arraySubWindows.append( m_pcSubWindow[i] ); + return arraySubWindows; + } + protected: virtual void run(); }; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 479590d..2ef2ec4 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -22,6 +22,7 @@ * \brief Video Sub windows handling */ +#include #include "VideoSubWindow.h" #include "ModulesHandle.h" #include "ConfigureFormatDialog.h" @@ -34,6 +35,10 @@ namespace plaYUVer { +/** + * \brief Functions to control data stream from stream information + */ + QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array ) { PlaYUVerStreamInfo d; @@ -78,14 +83,52 @@ Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) return -1; } +/** + * \class VideoInformation + * \brief Shows information about video sub window + */ + +class VideoInformation: public QWidget +{ +private: + QStringList m_cTopLeftTextLines; + QStaticText m_cTopLeftText; +public: + VideoInformation( QWidget *parent ) : + QWidget( parent ) + { + setPalette( Qt::transparent ); + setAttribute( Qt::WA_TransparentForMouseEvents ); + } + Void setInformationTopLeft( const QStringList& textLines ) + { + //m_cTopLeftText.setText( text ); + m_cTopLeftTextLines = textLines; + } +protected: + void paintEvent( QPaintEvent *event ) + { + QPainter painter( this ); + painter.setPen( QPen( Qt::white ) ); + if( !m_cTopLeftTextLines.isEmpty() && size().width() > 300 ) + { + QPoint topLeftCorner( 10, 20 ); + for( Int i = 0; i < m_cTopLeftTextLines.size(); i++ ) + { + painter.drawText( topLeftCorner, m_cTopLeftTextLines.at( i ) ); + topLeftCorner += QPoint( 0, 15 ); + } + } + } +}; + VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent ) : SubWindowAbstract( parent, SubWindowAbstract::VIDEO_SUBWINDOW | category ), m_pCurrStream( NULL ), m_pcCurrFrame( NULL ), m_pcCurrentDisplayModule( NULL ), m_pcReferenceSubWindow( NULL ), - m_bIsPlaying( false ), - m_bIsModule( category == MODULE_SUBWINDOW ) + m_bIsPlaying( false ) { // Create a new scroll area inside the sub-window @@ -108,8 +151,6 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget m_pcScrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); // Define the cViewArea as the widget inside the scroll area - // m_cViewArea->setMinimumSize( size() ); - m_pcScrollArea->setWidget( m_cViewArea ); m_pcScrollArea->setWidgetResizable( true ); @@ -119,6 +160,8 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget m_apcCurrentModule.clear(); + //! Add video information + m_pcVideoInfo = new VideoInformation( this ); } VideoSubWindow::~VideoSubWindow() @@ -244,6 +287,23 @@ Void VideoSubWindow::updateVideoWindowInfo() if( m_pcCurrentDisplayModule ) { m_cStreamInformation = "Module"; + QList arraySubWindows = m_pcCurrentDisplayModule->getSubWindowList(); + QStringList sourceWindowList; + if( arraySubWindows.size() > 0 ) + { + for( Int i = 0; i < arraySubWindows.size(); i++ ) + { + if( arraySubWindows.at( i )->getWindowName() != getWindowName() ) + { + sourceWindowList.append( QString( "Input %1 - " + arraySubWindows.at( i )->getWindowName() ).arg( i + 1 ) ); + } + } + } + qDebug( ) << sourceWindowList; + if( sourceWindowList.size() > 0 ) + { + m_pcVideoInfo->setInformationTopLeft( sourceWindowList ); + } } else if( m_pCurrStream ) { @@ -429,11 +489,11 @@ Void VideoSubWindow::associateModule( PlaYUVerAppModuleIf* pcModule ) Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) { - // if( m_pcCurrFrame ) +// if( m_pcCurrFrame ) { m_pcCurrFrame = pcCurrFrame; m_cViewArea->setImage( m_pcCurrFrame ); - updateVideoWindowInfo(); + //updateVideoWindowInfo(); } } @@ -593,7 +653,7 @@ Void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset ) valueY = scrollBarV->minimum(); m_cCurrScroll.setY( valueY ); - // Update window scroll +// Update window scroll scrollBarH->setValue( m_cCurrScroll.x() ); scrollBarV->setValue( m_cCurrScroll.y() ); } @@ -637,7 +697,7 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center ) m_cCurrScroll.setY( value ); } - // Update window scroll +// Update window scroll scrollBarH->setValue( m_cCurrScroll.x() ); scrollBarV->setValue( m_cCurrScroll.y() ); @@ -804,6 +864,11 @@ QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const return isize; } +Void VideoSubWindow::resizeEvent( QResizeEvent* event ) +{ + m_pcVideoInfo->resize( event->size() ); +} + //Void VideoSubWindow::closeEvent( QCloseEvent *event ) //{ // Bool bAccept = m_bIsPlaying ? false : true; diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 8654e00..9959f43 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -41,6 +41,7 @@ class QScrollArea; namespace plaYUVer { +class VideoInformation; class VideoSubWindow; class PlaYUVerAppModuleIf; @@ -72,6 +73,8 @@ private: ViewArea* m_cViewArea; + VideoInformation* m_pcVideoInfo; + QString m_cFilename; QString m_cStreamInformation; PlaYUVerStreamInfo m_sStreamInfo; @@ -89,7 +92,6 @@ private: QString m_cCurrFileName; Bool m_bIsPlaying; - Bool m_bIsModule; /** * Threads variables @@ -115,8 +117,8 @@ private: public: enum VideoSubWindowCategories { - VIDEO_STREAM_SUBWINDOW = 2, - MODULE_SUBWINDOW = 4, + VIDEO_STREAM_SUBWINDOW = SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, + MODULE_SUBWINDOW = SubWindowAbstract::MODULE_SUBWINDOW, }; VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent = 0 ); ~VideoSubWindow(); @@ -245,10 +247,11 @@ public: Bool getIsModule() { - return m_bIsModule; + return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; } -//protected: +protected: + Void resizeEvent( QResizeEvent* event ); //void closeEvent( QCloseEvent *event ); public Q_SLOTS: