From c222a88ee0cd389e20219331e69c0d6e334d4f7a Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 14 Apr 2015 01:28:32 +0100 Subject: [PATCH 01/10] Add overlapping information with the modules source window list --- app/ModulesHandle.cpp | 4 +- app/PlaYUVerAppModuleIf.h | 10 +++++ app/VideoSubWindow.cpp | 81 +++++++++++++++++++++++++++++++++++---- app/VideoSubWindow.h | 13 ++++--- 4 files changed, 92 insertions(+), 16 deletions(-) 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: From c24a4c081458420e21ffaad6e67601e08a0cec7b Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 14 Apr 2015 19:16:53 +0100 Subject: [PATCH 02/10] Decrease font size --- app/VideoSubWindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 2ef2ec4..229674d 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -93,12 +93,14 @@ class VideoInformation: public QWidget private: QStringList m_cTopLeftTextLines; QStaticText m_cTopLeftText; + QFont m_cTopLeftTextFont; public: VideoInformation( QWidget *parent ) : QWidget( parent ) { setPalette( Qt::transparent ); setAttribute( Qt::WA_TransparentForMouseEvents ); + m_cTopLeftTextFont.setPointSize( 8 ); } Void setInformationTopLeft( const QStringList& textLines ) { @@ -109,7 +111,8 @@ protected: void paintEvent( QPaintEvent *event ) { QPainter painter( this ); - painter.setPen( QPen( Qt::white ) ); + painter.setFont( m_cTopLeftTextFont ); + //painter.setPen( QPen( Qt::white ) ); if( !m_cTopLeftTextLines.isEmpty() && size().width() > 300 ) { QPoint topLeftCorner( 10, 20 ); From 6ae5b8b798b7ff61226eb56573aa54aab9dde298 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 14 Apr 2015 19:24:25 +0100 Subject: [PATCH 03/10] Change VideoInformation to use StaticText instead of QString --- app/VideoSubWindow.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 229674d..9a51129 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -91,8 +91,7 @@ Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) class VideoInformation: public QWidget { private: - QStringList m_cTopLeftTextLines; - QStaticText m_cTopLeftText; + QList m_cTopLeftTextList; QFont m_cTopLeftTextFont; public: VideoInformation( QWidget *parent ) : @@ -104,21 +103,23 @@ public: } Void setInformationTopLeft( const QStringList& textLines ) { - //m_cTopLeftText.setText( text ); - m_cTopLeftTextLines = textLines; + m_cTopLeftTextList.clear(); + for( Int i = 0; i < textLines.size(); i++ ) + { + m_cTopLeftTextList.append( textLines.at( i ) ); + } } protected: void paintEvent( QPaintEvent *event ) { QPainter painter( this ); painter.setFont( m_cTopLeftTextFont ); - //painter.setPen( QPen( Qt::white ) ); - if( !m_cTopLeftTextLines.isEmpty() && size().width() > 300 ) + if( !m_cTopLeftTextList.isEmpty() && size().width() > 300 ) { - QPoint topLeftCorner( 10, 20 ); - for( Int i = 0; i < m_cTopLeftTextLines.size(); i++ ) + QPoint topLeftCorner( 10, 10 ); + for( Int i = 0; i < m_cTopLeftTextList.size(); i++ ) { - painter.drawText( topLeftCorner, m_cTopLeftTextLines.at( i ) ); + painter.drawStaticText( topLeftCorner, m_cTopLeftTextList.at( i ) ); topLeftCorner += QPoint( 0, 15 ); } } From a772ca3ea3b3845116f6b94ec0b5048b544165ee Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 15 Apr 2015 15:08:59 +0100 Subject: [PATCH 04/10] Add go to dialog --- app/CMakeLists.txt | 1 + app/ModulesHandleOptDialog.cpp | 1 - app/VideoHandle.cpp | 34 ++++++++++++++++++++++++++++++++++ app/VideoHandle.h | 2 ++ app/VideoSubWindow.cpp | 2 +- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7eccdda..b7dd61c 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -71,6 +71,7 @@ set(plaYUVer_App_SRCS ConfigureFormatDialog.cpp DialogSubWindowSelector.cpp ProgressBar.cpp + SeekStreamDialog.cpp # Widgets HistogramWidget.cpp WidgetFrameNumber.cpp diff --git a/app/ModulesHandleOptDialog.cpp b/app/ModulesHandleOptDialog.cpp index 17e3ad3..1814f8d 100644 --- a/app/ModulesHandleOptDialog.cpp +++ b/app/ModulesHandleOptDialog.cpp @@ -70,7 +70,6 @@ ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget *parent, PlaYUVerAppModu { resize( 400, 10 ); setWindowTitle( "Select module parameters" ); - setWindowIcon( QIcon( ":/images/configureformat.png" ) ); const Options::OptionsList& moduleOptions = m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList(); diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 7d53411..98fbdb3 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -27,6 +27,7 @@ #include "VideoSubWindow.h" #include "PlaYUVerSubWindowHandle.h" #include "DialogSubWindowSelector.h" +#include "SeekStreamDialog.h" #include "FramePropertiesDock.h" #include "WidgetFrameNumber.h" #include @@ -90,6 +91,10 @@ Void VideoHandle::createActions() connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) ); m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 ); + m_arrayActions[VIDEO_GOTO_ACT] = new QAction( "Go to", this ); + m_arrayActions[VIDEO_GOTO_ACT]->setShortcut( tr( "Ctrl+G" ) ); + connect( m_arrayActions[VIDEO_GOTO_ACT], SIGNAL( triggered() ), this, SLOT( seekVideo() ) ); + m_arrayActions[VIDEO_LOOP_ACT] = new QAction( "Repeat", this ); m_arrayActions[VIDEO_LOOP_ACT]->setCheckable( true ); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( false ); @@ -117,6 +122,8 @@ QMenu* VideoHandle::createMenu() m_pcMenuVideo->addAction( m_arrayActions[STOP_ACT] ); m_pcMenuVideo->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] ); m_pcMenuVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] ); + m_pcMenuVideo->addAction( m_arrayActions[VIDEO_GOTO_ACT] ); + m_pcMenuVideo->addSeparator(); m_pcMenuVideo->addAction( m_arrayActions[VIDEO_LOOP_ACT] ); m_pcMenuVideo->addAction( m_arrayActions[VIDEO_ZOOM_LOCK_ACT] ); m_pcMenuVideo->addAction( m_arrayActions[VIDEO_LOCK_SELECTION_ACT] ); @@ -562,6 +569,33 @@ Void VideoHandle::seekEvent( Int direction ) } } +Void VideoHandle::seekVideo() +{ + if( m_pcCurrentVideoSubWindow ) + { + if( m_pcCurrentVideoSubWindow->getInputStream() ) + { + SeekStreamDialog* dialogSeekVideo = new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), this ); + Int newFrameNum = dialogSeekVideo->runDialog(); + if( newFrameNum >= 0 ) + { + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )newFrameNum ); + } + } + else + { + m_pcCurrentVideoSubWindow->seekAbsoluteEvent( ( UInt )newFrameNum ); + } + emit changed(); + } + } + } +} + Void VideoHandle::seekSliderEvent( Int new_frame_num ) { if( m_pcCurrentVideoSubWindow ) diff --git a/app/VideoHandle.h b/app/VideoHandle.h index 60d6c90..94e01dd 100644 --- a/app/VideoHandle.h +++ b/app/VideoHandle.h @@ -79,6 +79,7 @@ private: STOP_ACT, VIDEO_FORWARD_ACT, VIDEO_BACKWARD_ACT, + VIDEO_GOTO_ACT, VIDEO_LOOP_ACT, VIDEO_ZOOM_LOCK_ACT, VIDEO_LOCK_ACT, @@ -129,6 +130,7 @@ private Q_SLOTS: void playEvent(); void seekSliderEvent( int new_frame_num ); void seekEvent( int direction ); + void seekVideo(); void videoSelectionButtonEvent(); }; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 9a51129..bedf3d7 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -201,6 +201,7 @@ Void VideoSubWindow::refreshSubWindow() { refreshFrame(); } + updateVideoWindowInfo(); } Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) @@ -497,7 +498,6 @@ Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) { m_pcCurrFrame = pcCurrFrame; m_cViewArea->setImage( m_pcCurrFrame ); - //updateVideoWindowInfo(); } } From 10b6090e0b6eb6f5dfc7d4a934a2086e3abbdec5 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 15 Apr 2015 17:23:45 +0100 Subject: [PATCH 05/10] Add missing files --- app/SeekStreamDialog.cpp | 82 ++++++++++++++++++++++++++++++++++++++++ app/SeekStreamDialog.h | 54 ++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 app/SeekStreamDialog.cpp create mode 100644 app/SeekStreamDialog.h diff --git a/app/SeekStreamDialog.cpp b/app/SeekStreamDialog.cpp new file mode 100644 index 0000000..7e8d3e7 --- /dev/null +++ b/app/SeekStreamDialog.cpp @@ -0,0 +1,82 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file SeekStreamDialog.cpp + * \brief Dialog box to config modules opts + */ + +#include "SeekStreamDialog.h" +#include "lib/PlaYUVerStream.h" +#include +#include +#include +#include +#include + +namespace plaYUVer +{ + +SeekStreamDialog::SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *parent ) : + QDialog( parent ), + m_iSelectedFrameNum() +{ + + m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum(); + + setWindowTitle( "Go to frame" ); + + QLabel* pcLabel = new QLabel; + pcLabel->setText( QString( "Go to frame (0 - %1)" ).arg( pcCurrStream->getFrameNum() - 1 ) ); + + m_spinFrameNum = new QSpinBox; + m_spinFrameNum->setMinimumSize( 70, 5 ); + m_spinFrameNum->setMaximumSize( 70, 30 ); + m_spinFrameNum->setMinimum( 0 ); + m_spinFrameNum->setMaximum( pcCurrStream->getFrameNum() - 1 ); + m_spinFrameNum->setValue( m_iSelectedFrameNum ); + + QDialogButtonBox* dialogButtonOkCancel = new QDialogButtonBox(); + dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) ); + dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); + dialogButtonOkCancel->setCenterButtons( false ); + + QGridLayout* mainLayout = new QGridLayout; + mainLayout->addWidget( pcLabel, 0, 0 ); + mainLayout->addWidget( m_spinFrameNum, 0, 1 ); + mainLayout->addWidget( dialogButtonOkCancel, 1, 0, 1, 2, Qt::AlignRight ); + setLayout( mainLayout ); + + setFixedSize( 250, mainLayout->sizeHint().height() ); + + connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); + connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); +} + +Int SeekStreamDialog::runDialog() +{ + if( exec() == QDialog::Rejected ) + { + return -1; + } + m_iSelectedFrameNum = m_spinFrameNum->value(); + return m_iSelectedFrameNum; +} + +} // NAMESPACE diff --git a/app/SeekStreamDialog.h b/app/SeekStreamDialog.h new file mode 100644 index 0000000..c268ab6 --- /dev/null +++ b/app/SeekStreamDialog.h @@ -0,0 +1,54 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file SeekStreamDialog.h + * \brief Dialog box to config modules opts + */ + +#ifndef __SEEKSTREAMDIALOG_H__ +#define __SEEKSTREAMDIALOG_H__ + +#include "config.h" +#include "PlaYUVerAppDefs.h" +#include "PlaYUVerAppModuleIf.h" +#include +#include + +namespace plaYUVer +{ + +/** + * + */ +class SeekStreamDialog: public QDialog +{ +Q_OBJECT + +public: + SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *parent = 0 ); + Int runDialog(); +private: + QSpinBox* m_spinFrameNum; + Int m_iSelectedFrameNum; +}; + +} // NAMESPACE + +#endif // __MODULEHANDLEOPTDIALOG_H__ From d42b202b4c97292c5fea98dd2c738fc298d632fa Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 16 Apr 2015 17:45:40 +0100 Subject: [PATCH 06/10] Minor changes in histogram widget and seekstreamdialog --- app/FramePropertiesDock.cpp | 3 +-- app/HistogramWidget.cpp | 34 +++++++++++++++------------------- app/HistogramWidget.h | 3 --- app/SeekStreamDialog.cpp | 10 +++++++--- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/app/FramePropertiesDock.cpp b/app/FramePropertiesDock.cpp index dfa2c33..b26358d 100644 --- a/app/FramePropertiesDock.cpp +++ b/app/FramePropertiesDock.cpp @@ -134,8 +134,7 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc // ------------------------------------------------------------- - histogramWidget = new HistogramWidget( 256, 100 ); - histogramWidget->setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel ); + histogramWidget = new HistogramWidget( 100, 100 ); histogramWidget->setWhatsThis( tr( "

This is the histogram drawing of " "the selected image channel" ) ); diff --git a/app/HistogramWidget.cpp b/app/HistogramWidget.cpp index 3c8e40c..df87de3 100644 --- a/app/HistogramWidget.cpp +++ b/app/HistogramWidget.cpp @@ -177,7 +177,20 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) : setAttribute( Qt::WA_DeleteOnClose ); d = new HistogramWidgetPrivate; - setupWidget( width, height ); + + m_channelType = LumaHistogram; + m_scaleType = LogScaleHistogram; + m_colorType = FirstChannelColor; + m_renderingType = FullImageHistogram; + + setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel ); + + setMouseTracking( true ); + setMinimumSize( width, height ); + + d->blinkTimer = new QTimer( this ); + + connect( d->blinkTimer, SIGNAL( timeout() ), this, SLOT( slotBlinkTimerDone() ) ); m_imageHistogram = 0; m_selectionHistogram = 0; @@ -210,23 +223,6 @@ HistogramWidget::~HistogramWidget() // Setup Functions //////////////////////////////////////////////////////////////////////////////// -Void HistogramWidget::setupWidget( Int width, Int height, HistogramOptions options ) -{ - m_channelType = LumaHistogram; - m_scaleType = LogScaleHistogram; - m_colorType = FirstChannelColor; - m_renderingType = FullImageHistogram; - - setOptions( options ); - - setMouseTracking( true ); - setMinimumSize( width, height ); - - d->blinkTimer = new QTimer( this ); - - connect( d->blinkTimer, SIGNAL( timeout() ), this, SLOT( slotBlinkTimerDone() ) ); -} - Void HistogramWidget::setOptions( HistogramOptions options ) { d->statisticsVisible = ( bool )( options & ShowStatistics ); @@ -1037,7 +1033,7 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent * e ) { if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted ) { - setCursor( Qt::CrossCursor ); + setCursor( Qt::SizeHorCursor ); if( d->inSelected ) { diff --git a/app/HistogramWidget.h b/app/HistogramWidget.h index a5242ec..ead8a80 100644 --- a/app/HistogramWidget.h +++ b/app/HistogramWidget.h @@ -109,9 +109,6 @@ public : */ HistogramWidget( Int width, Int height, QWidget *parent = 0 ); - Void setupWidget( Int width, Int height, - HistogramOptions options = AllOptions ); - ~HistogramWidget(); /** Stop current histogram computations.*/ diff --git a/app/SeekStreamDialog.cpp b/app/SeekStreamDialog.cpp index 7e8d3e7..f6e6eac 100644 --- a/app/SeekStreamDialog.cpp +++ b/app/SeekStreamDialog.cpp @@ -34,16 +34,20 @@ namespace plaYUVer { SeekStreamDialog::SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *parent ) : - QDialog( parent ), + QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum() { m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum(); - setWindowTitle( "Go to frame" ); + setWindowModality( Qt::ApplicationModal ); + setWindowTitle( "Seek Video" ); + QFont labelFont; + labelFont.setStretch( 110 ); QLabel* pcLabel = new QLabel; pcLabel->setText( QString( "Go to frame (0 - %1)" ).arg( pcCurrStream->getFrameNum() - 1 ) ); + pcLabel->setFont( labelFont ); m_spinFrameNum = new QSpinBox; m_spinFrameNum->setMinimumSize( 70, 5 ); @@ -63,7 +67,7 @@ SeekStreamDialog::SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *paren mainLayout->addWidget( dialogButtonOkCancel, 1, 0, 1, 2, Qt::AlignRight ); setLayout( mainLayout ); - setFixedSize( 250, mainLayout->sizeHint().height() ); + setFixedSize( 220, mainLayout->sizeHint().height() ); connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); From b6e5d27a9a80c5568dcadc512ca10feaee3502b1 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 16 Apr 2015 18:04:41 +0100 Subject: [PATCH 07/10] Remove ffmpeg default on --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d82dffc..ac5c84d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ IF( USE_OPENCV ) ENDIF() SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in PlaYUVerFrame" TYPE OPTIONAL) -OPTION( USE_FFMPEG "Add FFMPEG support" ON ) +OPTION( USE_FFMPEG "Add FFMPEG support" OFF ) IF( USE_FFMPEG ) FIND_PACKAGE( FFmpeg ) SET(USE_FFMPEG ${FFMPEG_FOUND}) From e47d0df889716b2b68e68532d3fc1e8abf6ce059 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Fri, 17 Apr 2015 21:09:55 +0100 Subject: [PATCH 08/10] Restore threads to apply modules --- app/ModulesHandle.cpp | 76 +++++++-------------------------- app/ModulesHandle.h | 3 +- app/PlaYUVerAppModuleIf.cpp | 62 +++++++++++++++++++++++---- app/PlaYUVerAppModuleIf.h | 8 +++- app/PlaYUVerSubWindowHandle.cpp | 1 + app/VideoSubWindow.cpp | 3 ++ app/VideoSubWindow.h | 7 +++ 7 files changed, 87 insertions(+), 73 deletions(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 27d1885..45fcd8f 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -385,7 +385,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) } } - applyModuleIf( pcCurrModuleIf, false ); + applyModuleIf( pcCurrModuleIf, false, true ); QCoreApplication::processEvents(); if( pcModuleSubWindow ) @@ -400,40 +400,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( pcCurrModuleIf ) { - if( pcCurrModuleIf->m_pcModuleDock ) - { - pcCurrModuleIf->m_pcModuleDock->close(); - pcCurrModuleIf->m_pcModuleDock = NULL; - } - if( pcCurrModuleIf->m_pcDockWidget ) - { - pcCurrModuleIf->m_pcDockWidget->close(); - pcCurrModuleIf->m_pcDockWidget = NULL; - } - if( pcCurrModuleIf->m_pcDisplaySubWindow ) - pcCurrModuleIf->m_pcDisplaySubWindow->closeSubWindow(); - pcCurrModuleIf->m_pcDisplaySubWindow = NULL; - - for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ ) - { - if( pcCurrModuleIf->m_pcSubWindow[i] ) - { - pcCurrModuleIf->m_pcSubWindow[i]->disableModule( pcCurrModuleIf ); - pcCurrModuleIf->m_pcSubWindow[i] = NULL; - } - } - if( pcCurrModuleIf->m_pcModuleStream ) - { - pcCurrModuleIf->m_pcModuleStream->close(); - delete pcCurrModuleIf->m_pcModuleStream; - pcCurrModuleIf->m_pcModuleStream = NULL; - } - if( pcCurrModuleIf->m_pcModule ) - { - pcCurrModuleIf->m_pcModule->destroy(); - pcCurrModuleIf->m_pcModule->Delete(); - pcCurrModuleIf->m_pcModule = NULL; - } + pcCurrModuleIf->destroy(); } } @@ -462,10 +429,10 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isP { #ifdef PLAYUVER_THREADED_MODULES if( !disableThreads ) - pcCurrModuleIf->start(); + pcCurrModuleIf->start(); else #endif - pcCurrModuleIf->run(); + pcCurrModuleIf->run(); if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE ) { @@ -560,29 +527,26 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) } } -Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ) +Void ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { - Bool bRet = false; - //if( processedFrame ) + switch( pcCurrModuleIf->m_pcModule->m_iModuleType ) { + case FRAME_PROCESSING_MODULE: if( pcCurrModuleIf->m_pcDisplaySubWindow ) { - pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame ); - bRet = true; + pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame ); + pcCurrModuleIf->m_pcDisplaySubWindow->clearWindowBusy(); } else { - pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame ); + pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame ); + pcCurrModuleIf->m_pcSubWindow[0]->clearWindowBusy(); } + break; + case FRAME_MEASUREMENT_MODULE: + pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( pcCurrModuleIf->m_dMeasurementResult ); + break; } - return bRet; -} - -Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult ) -{ - Bool bRet = false; - pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( moduleResult ); - return bRet; } Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) @@ -605,15 +569,7 @@ Void ModulesHandle::customEvent( QEvent *event ) PlaYUVerAppModuleIf::EventData *eventData = ( PlaYUVerAppModuleIf::EventData* )event; if( eventData->m_bSuccess ) { - switch( eventData->m_pcModule->m_pcModule->m_iModuleType ) - { - case FRAME_PROCESSING_MODULE: - showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_pcProcessedFrame ); - break; - case FRAME_MEASUREMENT_MODULE: - showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_dMeasurementResult ); - break; - } + showModuleIf( eventData->m_pcModule ); } } diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h index 498a281..768552a 100644 --- a/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -65,8 +65,7 @@ public: static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf ); static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying = false, Bool disableThreads = false ); - static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ); - static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult ); + static Void showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ); private: QWidget* m_pcParent; diff --git a/app/PlaYUVerAppModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp index 1732cf9..a8cecd7 100644 --- a/app/PlaYUVerAppModuleIf.cpp +++ b/app/PlaYUVerAppModuleIf.cpp @@ -30,6 +30,7 @@ namespace plaYUVer { PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module ) : + m_bIsRunning( false ), m_pcModuleAction( action ), m_pcModule( module ), m_pcDisplaySubWindow( NULL ), @@ -46,11 +47,11 @@ PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaY } } -void PlaYUVerAppModuleIf::run() +Void PlaYUVerAppModuleIf::run() { - - m_pcProcessedFrame = NULL; - m_dMeasurementResult = 0; + m_bIsRunning = true; +// m_pcProcessedFrame = NULL; +// m_dMeasurementResult = 0; std::vector apcFrameList; for( UInt i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ ) @@ -84,15 +85,58 @@ void PlaYUVerAppModuleIf::run() { return; } - postProgress( true ); + m_bIsRunning = false; + EventData *eventData = new EventData( true, this ); + if( parent() ) + QCoreApplication::postEvent( parent(), eventData ); return; } -Void PlaYUVerAppModuleIf::postProgress( Bool success ) +Void PlaYUVerAppModuleIf::destroy() { - EventData *eventData = new EventData( success, this ); - if( parent() ) - QCoreApplication::postEvent( parent(), eventData ); + if( m_bIsRunning ) + { + QApplication::setOverrideCursor( Qt::WaitCursor ); + while( m_bIsRunning ) + { + } + QApplication::restoreOverrideCursor(); + } + if( m_pcModuleDock ) + { + m_pcModuleDock->close(); + m_pcModuleDock = NULL; + } + if( m_pcDockWidget ) + { + m_pcDockWidget->close(); + m_pcDockWidget = NULL; + } + if( m_pcDisplaySubWindow ) + m_pcDisplaySubWindow->closeSubWindow(); + m_pcDisplaySubWindow = NULL; + + for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ ) + { + if( m_pcSubWindow[i] ) + { + m_pcSubWindow[i]->disableModule( this ); + m_pcSubWindow[i] = NULL; + } + } + if( m_pcModuleStream ) + { + m_pcModuleStream->close(); + delete m_pcModuleStream; + m_pcModuleStream = NULL; + } + if( m_pcModule ) + { + m_pcModule->destroy(); + m_pcModule->Delete(); + m_pcModule = NULL; + } + } } // NAMESPACE diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h index 8ea117a..ada2167 100644 --- a/app/PlaYUVerAppModuleIf.h +++ b/app/PlaYUVerAppModuleIf.h @@ -40,13 +40,15 @@ class QAction; namespace plaYUVer { +#define PLAYUVER_THREADED_MODULES + class VideoSubWindow; class PlaYUVerAppModuleIf #ifdef PLAYUVER_THREADED_MODULES : public QThread #else - : public QObject +: public QObject #endif { friend class ModulesHandle; @@ -55,6 +57,8 @@ class PlaYUVerAppModuleIf private: + Bool m_bIsRunning; + QAction* m_pcModuleAction; PlaYUVerModuleIf* m_pcModule; @@ -69,7 +73,6 @@ private: PlaYUVerFrame* m_pcProcessedFrame; Double m_dMeasurementResult; - Void postProgress( Bool success ); public: class EventData: public QEvent { @@ -98,6 +101,7 @@ public: return arraySubWindows; } + Void destroy(); protected: virtual void run(); }; diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index f377814..1f31a0a 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -250,6 +250,7 @@ Void PlaYUVerSubWindowHandle::removeSubWindow( Int windowIdx ) PlaYUVerMdiSubWindow* mdiSubWindow = m_apcMdiSubWindowList.at( windowIdx ); m_apcMdiSubWindowList.removeAt( windowIdx ); m_pcMdiArea->removeSubWindow( m_apcSubWindowList.at( windowIdx ) ); + m_apcSubWindowList.at( windowIdx )->close(); mdiSubWindow->close(); m_apcSubWindowList.removeAt( windowIdx ); } diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index bedf3d7..d14a32a 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -128,6 +128,7 @@ protected: VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent ) : SubWindowAbstract( parent, SubWindowAbstract::VIDEO_SUBWINDOW | category ), + m_bWindowBusy( false ), m_pCurrStream( NULL ), m_pcCurrFrame( NULL ), m_pcCurrentDisplayModule( NULL ), @@ -511,6 +512,7 @@ Void VideoSubWindow::refreshFrameOperation() } if( m_pcCurrentDisplayModule ) { + m_bWindowBusy = true; ModulesHandle::applyModuleIf( m_pcCurrentDisplayModule, m_bIsPlaying ); bSetFrame = false; } @@ -520,6 +522,7 @@ Void VideoSubWindow::refreshFrameOperation() } for( Int i = 0; i < m_apcCurrentModule.size(); i++ ) { + m_bWindowBusy = true; ModulesHandle::applyModuleIf( m_apcCurrentModule.at( i ), m_bIsPlaying ); } } diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 9959f43..1a86bd5 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -67,6 +67,8 @@ Q_OBJECT private: + Bool m_bWindowBusy; + QScrollArea* m_pcScrollArea; QPoint m_cLastScroll; QPoint m_cCurrScroll; @@ -250,6 +252,11 @@ public: return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; } + Void clearWindowBusy() + { + m_bWindowBusy = false; + } + protected: Void resizeEvent( QResizeEvent* event ); //void closeEvent( QCloseEvent *event ); From fe05c30b22abf0bf0aec42b001c4ca1aee1898d8 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 18 Apr 2015 04:49:23 +0100 Subject: [PATCH 09/10] Fix bug in syncronized zoom - Window may not exist --- app/VideoHandle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 98fbdb3..3457193 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -99,11 +99,11 @@ Void VideoHandle::createActions() m_arrayActions[VIDEO_LOOP_ACT]->setCheckable( true ); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( false ); - m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Video Zoom Lock", this ); + m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Zoom Lock", this ); m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setCheckable( true ); m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked( false ); - m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Video Lock Window Selection", this ); + m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Playing Lock", this ); connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) ); m_pcFrameSlider = new QSlider; @@ -338,7 +338,7 @@ Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center ) Void VideoHandle::moveAllScrollBars( const QPoint offset ) { QPoint newOffset = offset; - if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() ) + if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow ) { VideoSubWindow *videoSubWindow; QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW ); From c6acb0ac0bf795e55ccfdc825daed6c55c30d829 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 18 Apr 2015 04:49:49 +0100 Subject: [PATCH 10/10] Add white fill when window is busy --- app/ModulesHandle.cpp | 10 ++++++++++ app/PlaYUVerSubWindowHandle.cpp | 1 + app/VideoSubWindow.cpp | 28 +++++++++++++++++++++++++++- app/VideoSubWindow.h | 4 ++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 45fcd8f..b407121 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -425,6 +425,14 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isP { Bool bRet = false; QApplication::setOverrideCursor( Qt::WaitCursor ); + if( pcCurrModuleIf->m_pcDisplaySubWindow ) + { + pcCurrModuleIf->m_pcDisplaySubWindow->setFillWindow( true ); + } + else + { + pcCurrModuleIf->m_pcSubWindow[0]->setFillWindow( true ); + } if( !( isPlaying && ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) ) { #ifdef PLAYUVER_THREADED_MODULES @@ -535,11 +543,13 @@ Void ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) if( pcCurrModuleIf->m_pcDisplaySubWindow ) { pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame ); + pcCurrModuleIf->m_pcDisplaySubWindow->setFillWindow( false ); pcCurrModuleIf->m_pcDisplaySubWindow->clearWindowBusy(); } else { pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame ); + pcCurrModuleIf->m_pcSubWindow[0]->setFillWindow( false ); pcCurrModuleIf->m_pcSubWindow[0]->clearWindowBusy(); } break; diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index 1f31a0a..6fc6399 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -116,6 +116,7 @@ Void PlaYUVerSubWindowHandle::resetWindowMode() m_apcMdiSubWindowList.clear(); if( m_pcMdiArea ) delete m_pcMdiArea; + m_pcMdiArea = NULL; if( m_pcWindowManagerLayout ) delete m_pcWindowManagerLayout; diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index d14a32a..7b1ca90 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -93,13 +93,17 @@ class VideoInformation: public QWidget private: QList m_cTopLeftTextList; QFont m_cTopLeftTextFont; + QFont m_cCenterTextFont; + Bool m_bBusyWindow; public: VideoInformation( QWidget *parent ) : - QWidget( parent ) + QWidget( parent ), + m_bBusyWindow( false ) { setPalette( Qt::transparent ); setAttribute( Qt::WA_TransparentForMouseEvents ); m_cTopLeftTextFont.setPointSize( 8 ); + m_cCenterTextFont.setPointSize( 12 ); } Void setInformationTopLeft( const QStringList& textLines ) { @@ -109,6 +113,10 @@ public: m_cTopLeftTextList.append( textLines.at( i ) ); } } + Void setBusyWindow( Bool bFlag ) + { + m_bBusyWindow = bFlag; + } protected: void paintEvent( QPaintEvent *event ) { @@ -123,6 +131,12 @@ protected: topLeftCorner += QPoint( 0, 15 ); } } + if( m_bBusyWindow ) + { + painter.setFont( m_cCenterTextFont ); + painter.drawText( rect(), Qt::AlignHCenter | Qt::AlignVCenter, QStringLiteral( "Refreshing..." ) ); + painter.fillRect( rect(), QBrush( QColor::fromRgb( 255, 255, 255, 50 ), Qt::SolidPattern ) ); + } } }; @@ -165,6 +179,10 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget m_apcCurrentModule.clear(); + m_pcUpdateTimer = new QTimer(); + m_pcUpdateTimer->setInterval( 800 ); + connect( m_pcUpdateTimer, SIGNAL( timeout() ), this, SLOT( updateWindowOnTimeout() ) ); + //! Add video information m_pcVideoInfo = new VideoInformation( this ); } @@ -493,6 +511,10 @@ Void VideoSubWindow::associateModule( PlaYUVerAppModuleIf* pcModule ) m_apcCurrentModule.append( pcModule ); } +Void VideoSubWindow::setFillWindow( Bool bFlag ) +{ + m_pcVideoInfo->setBusyWindow( bFlag ); +} Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) { // if( m_pcCurrFrame ) @@ -871,6 +893,10 @@ QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const return isize; } +Void VideoSubWindow::updateWindowOnTimeout() +{ + m_pcVideoInfo->update(); +} Void VideoSubWindow::resizeEvent( QResizeEvent* event ) { m_pcVideoInfo->resize( event->size() ); diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index 1a86bd5..d51ee5c 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -95,6 +95,7 @@ private: Bool m_bIsPlaying; + QTimer* m_pcUpdateTimer; /** * Threads variables * QtConcurrent @@ -257,11 +258,14 @@ public: m_bWindowBusy = false; } + Void setFillWindow( Bool bFlag ); + protected: Void resizeEvent( QResizeEvent* event ); //void closeEvent( QCloseEvent *event ); public Q_SLOTS: + void updateWindowOnTimeout(); void adjustScrollBarByScale( double scale, QPoint center ); void adjustScrollBarByOffset( QPoint Offset ); void updateCurScrollValues();