Start splitting sub windows into different categories
This commit is contained in:
1 parent
2c71e84f09
commit
1af504d56f
10 files changed
+928
-712
No files matched your search
+3
-3
@@ -48,7 +48,7 @@ ADD_FEATURE_INFO(WErrors PLAYUVER_WERROR "Warnings as errors" )
|
||||
|
||||
IF( USE_QT4 )
|
||||
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT4" )
|
||||
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtNetwork QtWebKit )
|
||||
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtPrintSupport QtDBus QtNetwork QtWebKit )
|
||||
|
||||
SET( USE_QTDBUS TRUE )
|
||||
|
||||
@@ -65,11 +65,11 @@ IF( NOT USE_QT4 )
|
||||
|
||||
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" )
|
||||
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets )
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
||||
FIND_PACKAGE( Qt5DBus )
|
||||
|
||||
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets )
|
||||
IF( ${Qt5DBus_FOUND} )
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
|
||||
|
||||
+10
-1
@@ -9,12 +9,15 @@ set(plaYUver_App_SRCS
|
||||
# Main
|
||||
main.cpp
|
||||
plaYUVerApp.cpp
|
||||
SubWindowHandle.cpp
|
||||
ViewArea.cpp
|
||||
ModulesHandle.cpp
|
||||
PlaYUVerAppModuleIf.cpp
|
||||
GridManager.cpp
|
||||
Settings.cpp
|
||||
# Sub Window
|
||||
SubWindowHandle.cpp
|
||||
VideoSubWindow.cpp
|
||||
PlotSubWindow.cpp
|
||||
# Dialogs
|
||||
AboutDialog.cpp
|
||||
ConfigureFormatDialog.cpp
|
||||
@@ -34,6 +37,12 @@ IF( USE_QTDBUS )
|
||||
LIST( APPEND plaYUver_App_SRCS PlaYUVerAppAdaptor.cpp )
|
||||
ENDIF()
|
||||
|
||||
#Append External source code
|
||||
INCLUDE_DIRECTORIES( external )
|
||||
LIST( APPEND plaYUver_App_SRCS
|
||||
external/qcustomplot.cpp
|
||||
)
|
||||
|
||||
set(plaYUver_App_UI "" )
|
||||
|
||||
set(plaYUver_App_RCC
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 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 PlotWindowHandle.cpp
|
||||
* \brief Window to handle plots
|
||||
*/
|
||||
|
||||
#include "PlotWindowHandle.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
PlotWindowHandle::PlotWindowHandle( QWidget * parent ) :
|
||||
QMdiSubWindow( parent )
|
||||
{
|
||||
setParent( parent );
|
||||
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Light );
|
||||
setVisible( false );
|
||||
|
||||
m_cPlotArea = new QCustomPlot( this );
|
||||
setWidget( m_cPlotArea );
|
||||
}
|
||||
|
||||
PlotWindowHandle::~PlotWindowHandle()
|
||||
{
|
||||
delete m_cPlotArea;
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -0,0 +1,56 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 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 PlotWindowHandle.h
|
||||
* \brief Window to handle plots
|
||||
*/
|
||||
|
||||
#ifndef __PLOTWINDOWHANDLE_H__
|
||||
#define __PLOTWINDOWHANDLE_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "qcustomplot.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class PlotWindowHandle: public QMdiSubWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QCustomPlot* m_cPlotArea;
|
||||
|
||||
public:
|
||||
PlotWindowHandle( QWidget * parent = 0 );
|
||||
~PlotWindowHandle();
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __PLOTWINDOWHANDLE_H__
|
||||
|
||||
+2
-499
@@ -22,517 +22,20 @@
|
||||
* \brief Sub windows handling
|
||||
*/
|
||||
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "ViewArea.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array )
|
||||
{
|
||||
PlaYUVerStreamInfo d;
|
||||
out << array.size();
|
||||
for( Int i = 0; i < array.size(); i++ )
|
||||
{
|
||||
d = array.at( i );
|
||||
out << d.m_cFilename
|
||||
<< d.m_uiWidth
|
||||
<< d.m_uiHeight
|
||||
<< d.m_iPelFormat
|
||||
<< d.m_uiFrameRate;
|
||||
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
|
||||
{
|
||||
PlaYUVerStreamInfo d;
|
||||
Int array_size;
|
||||
in >> array_size;
|
||||
for( Int i = 0; i < array_size; i++ )
|
||||
{
|
||||
in >> d.m_cFilename;
|
||||
in >> d.m_uiWidth;
|
||||
in >> d.m_uiHeight;
|
||||
in >> d.m_iPelFormat;
|
||||
in >> d.m_uiFrameRate;
|
||||
array.append( d );
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename )
|
||||
{
|
||||
for( Int i = 0; i < array.size(); i++ )
|
||||
if( array.at( i ).m_cFilename == filename )
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
|
||||
SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
|
||||
QMdiSubWindow( parent ),
|
||||
m_pCurrStream( NULL ),
|
||||
m_pcCurrFrame( NULL ),
|
||||
m_pcCurrentModule( NULL ),
|
||||
m_pcReferenceSubWindow( NULL ),
|
||||
m_bIsPlaying( false ),
|
||||
m_bIsModule( isModule )
|
||||
m_uiCategory( category )
|
||||
{
|
||||
setParent( parent );
|
||||
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Light );
|
||||
setVisible( false );
|
||||
|
||||
// Create a new scroll area inside the sub-window
|
||||
m_cScrollArea = new QScrollArea( this );
|
||||
setWidget( m_cScrollArea );
|
||||
|
||||
// Create a new interface to show images
|
||||
m_cViewArea = new ViewArea( m_cScrollArea );
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( adjustScrollBarByZoom(double, QPoint) ) );
|
||||
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset(QPoint) ) );
|
||||
connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
|
||||
connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
|
||||
// Define the cViewArea as the widget inside the scroll area
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
m_cScrollArea->setWidgetResizable( true );
|
||||
|
||||
m_cWindowName = QString( " " );
|
||||
m_cLastScroll = QPoint();
|
||||
}
|
||||
|
||||
SubWindowHandle::~SubWindowHandle()
|
||||
{
|
||||
disableModule();
|
||||
delete m_cViewArea;
|
||||
delete m_cScrollArea;
|
||||
if( m_pCurrStream )
|
||||
delete m_pCurrStream;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::reloadFile()
|
||||
{
|
||||
Int currFrameNum = m_pCurrStream->getCurrFrameNum();
|
||||
loadFile( m_cFilename, false );
|
||||
seekAbsoluteEvent( currFrameNum );
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
||||
{
|
||||
UInt Width = 0, Height = 0, FrameRate = 30;
|
||||
Int InputFormat = -1;
|
||||
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
|
||||
|
||||
if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
|
||||
{
|
||||
ConfigureFormatDialog formatDialog( this );
|
||||
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, FrameRate ) == QDialog::Rejected )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate );
|
||||
|
||||
m_sStreamInfo.m_cFilename = cFilename;
|
||||
m_sStreamInfo.m_uiWidth = Width;
|
||||
m_sStreamInfo.m_uiHeight = Height;
|
||||
m_sStreamInfo.m_iPelFormat = InputFormat;
|
||||
m_sStreamInfo.m_uiFrameRate = FrameRate;
|
||||
|
||||
m_cViewArea->setInputStream( m_pCurrStream );
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
refreshFrame();
|
||||
|
||||
m_cFilename = cFilename;
|
||||
m_cWindowName = m_pCurrStream->getStreamInformationString();
|
||||
m_cWindowShortName = QFileInfo( cFilename ).fileName();
|
||||
setWindowTitle( m_cWindowName );
|
||||
qDebug() << "File " << m_cWindowName << "was successfully opened";
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo )
|
||||
{
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
|
||||
streamInfo->m_uiFrameRate ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_sStreamInfo = *streamInfo;
|
||||
|
||||
m_cViewArea->setInputStream( m_pCurrStream );
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
refreshFrame();
|
||||
|
||||
m_cFilename = streamInfo->m_cFilename;
|
||||
m_cWindowName = m_pCurrStream->getStreamInformationString();
|
||||
m_cWindowShortName = QFileInfo( streamInfo->m_cFilename ).fileName();
|
||||
setWindowTitle( m_cWindowName );
|
||||
return true;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::updateSelectedArea( QRect area )
|
||||
{
|
||||
m_cSelectedArea = area;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void SubWindowHandle::enableModule( PlaYUVerAppModuleIf* select_module )
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
disableModule();
|
||||
}
|
||||
m_pcCurrentModule = select_module;
|
||||
// refreshFrame();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::disableModule()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrentModule;
|
||||
m_pcCurrentModule = NULL;
|
||||
ModulesHandle::destroyModuleIf( pcCurrentModule );
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::swapModuleFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::swapModulesWindowsIf( m_pcCurrentModule );
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::applyModuleAllFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::applyAllModuleIf( m_pcCurrentModule );
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
|
||||
{
|
||||
m_pcCurrFrame = pcCurrFrame;
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
if( !isVisible() )
|
||||
{
|
||||
show();
|
||||
resize( sizeHint() );
|
||||
zoomToFit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::refreshFrame()
|
||||
{
|
||||
Bool bSetFrame = false;
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
m_pcCurrFrame = m_pCurrStream->getCurrFrame();
|
||||
bSetFrame = true;
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
|
||||
}
|
||||
}
|
||||
if( bSetFrame )
|
||||
{
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
}
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::save( QString filename )
|
||||
{
|
||||
Bool iRet = false;
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
PlaYUVerFrame* saveFrame = m_pcCurrFrame;
|
||||
if( m_cSelectedArea.isValid() )
|
||||
{
|
||||
saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(),
|
||||
m_cSelectedArea.width(), m_cSelectedArea.height() );
|
||||
}
|
||||
if( !saveFrame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
iRet = PlaYUVerStream::saveFrame( filename, saveFrame );
|
||||
QApplication::restoreOverrideCursor();
|
||||
return iRet;
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::play()
|
||||
{
|
||||
if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 )
|
||||
{
|
||||
m_bIsPlaying = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
}
|
||||
return m_bIsPlaying;
|
||||
}
|
||||
|
||||
Int SubWindowHandle::playEvent()
|
||||
{
|
||||
if( m_pCurrStream && m_bIsPlaying )
|
||||
{
|
||||
m_pCurrStream->setNextFrame();
|
||||
refreshFrame();
|
||||
if( m_pCurrStream->checkErrors( PlaYUVerStream::END_OF_SEQ ) )
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
m_pCurrStream->readFrame();
|
||||
if( m_pCurrStream->checkErrors( PlaYUVerStream::READING ) )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cFilename ) );
|
||||
return -3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -4;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::pause()
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::seekAbsoluteEvent( UInt new_frame_num )
|
||||
{
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
if( m_pCurrStream->seekInput( new_frame_num ) )
|
||||
{
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::seekRelativeEvent( Bool bIsFoward )
|
||||
{
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
if( m_pCurrStream->seekInput( m_pCurrStream->getCurrFrameNum() + ( bIsFoward ? 1 : -1 ) ) )
|
||||
{
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void SubWindowHandle::stop()
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
seekAbsoluteEvent( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::normalSize()
|
||||
{
|
||||
Double scaleFactor = 1.0;
|
||||
m_cViewArea->setZoomFactor( scaleFactor );
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::zoomToFit()
|
||||
{
|
||||
// Scale to a smaller size that the real to a nicer look
|
||||
QSize niceFit( m_cScrollArea->viewport()->size().width() - 5, m_cScrollArea->viewport()->size().height() - 5 );
|
||||
scaleView( niceFit );
|
||||
}
|
||||
|
||||
Void SubWindowHandle::scaleView( Double scale )
|
||||
{
|
||||
Q_ASSERT( m_cViewArea->image() );
|
||||
m_cViewArea->setZoomFactor( scale );
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::scaleView( Int width, Int height )
|
||||
{
|
||||
scaleView( QSize( width, height ) );
|
||||
}
|
||||
|
||||
Void SubWindowHandle::scaleView( const QSize & size )
|
||||
{
|
||||
QSize imgViewSize;
|
||||
if( m_pcCurrFrame )
|
||||
imgViewSize = QSize( m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight() );
|
||||
else
|
||||
imgViewSize = QSize( m_pCurrStream->getWidth(), m_pCurrStream->getHeight() );
|
||||
QSize newSize = imgViewSize;
|
||||
newSize.scale( size, Qt::KeepAspectRatio );
|
||||
|
||||
// Calc the zoom factor
|
||||
Double wfactor = 1;
|
||||
Double hfactor = 1;
|
||||
|
||||
wfactor = ( Double )newSize.width() / imgViewSize.width();
|
||||
hfactor = ( Double )newSize.height() / imgViewSize.height();
|
||||
|
||||
if( wfactor < hfactor )
|
||||
scaleView( wfactor );
|
||||
else
|
||||
scaleView( hfactor );
|
||||
}
|
||||
|
||||
Void SubWindowHandle::scaleViewByRatio( Double ratio )
|
||||
{
|
||||
Q_ASSERT( m_cViewArea->image() );
|
||||
m_cViewArea->zoomChangeEvent( ratio, QPoint() );
|
||||
}
|
||||
|
||||
void SubWindowHandle::adjustScrollBarByOffset( QPoint Offset )
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.x() ) );
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.y() ) );
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
// This function was developed with help of the schematics presented in
|
||||
// http://stackoverflow.com/questions/13155382/jscrollpane-zoom-relative-to-mouse-position
|
||||
void SubWindowHandle::adjustScrollBarByZoom( double factor, QPoint center )
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( factor * scrollBar->value() + ( ( factor - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Int x = center.x() - m_cLastScroll.x();
|
||||
Int value = int( factor * m_cLastScroll.x() + ( ( factor - 1 ) * x ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
}
|
||||
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( factor * scrollBar->value() + ( ( factor - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Int y = center.y() - m_cLastScroll.y();
|
||||
Int value = int( factor * m_cLastScroll.y() + ( ( factor - 1 ) * y ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
}
|
||||
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
void SubWindowHandle::updateLastScrollValue()
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
}
|
||||
|
||||
QSize SubWindowHandle::sizeHint() const
|
||||
{
|
||||
QSize maxSize; // The size of the parent (viewport widget
|
||||
// of the QMdiArea).
|
||||
|
||||
QWidget *p = parentWidget();
|
||||
if( p )
|
||||
{
|
||||
maxSize = p->size();
|
||||
}
|
||||
|
||||
QSize isize;
|
||||
if( m_pcCurrFrame )
|
||||
isize = QSize( m_pcCurrFrame->getWidth() + 50, m_pcCurrFrame->getHeight() + 50 );
|
||||
else if( m_pCurrStream )
|
||||
isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
|
||||
|
||||
// If the SubWindowHandle needs more space that the avaiable, we'll give
|
||||
// to the subwindow a reasonable size preserving the image aspect ratio.
|
||||
if( isize.width() < maxSize.width() && isize.height() < maxSize.height() )
|
||||
{
|
||||
return isize;
|
||||
}
|
||||
else
|
||||
{
|
||||
isize.scale( maxSize, Qt::KeepAspectRatio );
|
||||
maxSize = isize;
|
||||
}
|
||||
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::mayClose()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SubWindowHandle::closeEvent( QCloseEvent *event )
|
||||
{
|
||||
Bool bAccept = mayClose();
|
||||
bAccept = m_bIsPlaying ? false : bAccept;
|
||||
if( bAccept )
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
+8
-190
@@ -32,212 +32,30 @@
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include "ViewArea.h"
|
||||
#include "ModulesHandle.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class SubWindowHandle;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QString m_cFilename;
|
||||
UInt m_uiWidth;
|
||||
UInt m_uiHeight;
|
||||
Int m_iPelFormat;
|
||||
UInt m_uiFrameRate;
|
||||
}PlaYUVerStreamInfo;
|
||||
typedef QVector<PlaYUVerStreamInfo> PlaYUVerStreamInfoVector;
|
||||
|
||||
QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d);
|
||||
QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d);
|
||||
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename );
|
||||
|
||||
class SubWindowHandle: public QMdiSubWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
QScrollArea* m_cScrollArea;
|
||||
ViewArea* m_cViewArea;
|
||||
|
||||
PlaYUVerStreamInfo m_sStreamInfo;
|
||||
|
||||
PlaYUVerStream* m_pCurrStream;
|
||||
PlaYUVerFrame* m_pcCurrFrame;
|
||||
QRect m_cSelectedArea;
|
||||
|
||||
QString m_cFilename;
|
||||
PlaYUVerAppModuleIf* m_pcCurrentModule;
|
||||
|
||||
SubWindowHandle* m_pcReferenceSubWindow;
|
||||
|
||||
QString m_cWindowName;
|
||||
|
||||
QString m_cWindowShortName;
|
||||
QString m_cCurrFileName;
|
||||
|
||||
Bool m_bIsPlaying;
|
||||
Bool m_bIsModule;
|
||||
|
||||
QPoint m_cLastScroll;
|
||||
UInt m_uiCategory;
|
||||
|
||||
public:
|
||||
SubWindowHandle( QWidget * parent = 0, Bool isModule = false );
|
||||
enum SubWindowCategories
|
||||
{
|
||||
VIDEO_SUBWINDOW = 0,
|
||||
MODULE_SUBWINDOW,
|
||||
PLOT_SUBWINDOW,
|
||||
}
|
||||
SubWindowHandle( QWidget * parent, UInt category );
|
||||
~SubWindowHandle();
|
||||
|
||||
Bool mayClose();
|
||||
Bool loadFile( QString cFilename, Bool bForceDialog = false );
|
||||
Bool loadFile( PlaYUVerStreamInfo* streamInfo );
|
||||
Void reloadFile();
|
||||
Bool save( QString filename );
|
||||
|
||||
Bool play();
|
||||
Void pause();
|
||||
Int playEvent();
|
||||
Void stop();
|
||||
|
||||
Bool isPlaying()
|
||||
{
|
||||
return m_bIsPlaying;
|
||||
}
|
||||
|
||||
Void seekAbsoluteEvent( UInt new_frame_num );
|
||||
Void seekRelativeEvent( Bool bIsFoward );
|
||||
|
||||
QImage* FrameToQImage( PlaYUVerFrame* curr_frame );
|
||||
|
||||
Void refreshFrame();
|
||||
Void setCurrFrame( PlaYUVerFrame* pcCurrFrame );
|
||||
|
||||
PlaYUVerStreamInfo getStreamInfo()
|
||||
{
|
||||
return m_sStreamInfo;
|
||||
}
|
||||
|
||||
PlaYUVerStream* getInputStream()
|
||||
{
|
||||
return m_pCurrStream;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* getCurrFrame()
|
||||
{
|
||||
return m_pcCurrFrame;
|
||||
}
|
||||
|
||||
ViewArea* getViewArea()
|
||||
{
|
||||
return m_cViewArea;
|
||||
}
|
||||
|
||||
Double getZoomFactor()
|
||||
{
|
||||
return m_cViewArea->getZoomFactor();
|
||||
}
|
||||
|
||||
Void setModule( PlaYUVerAppModuleIf* pcCurrentModule )
|
||||
{
|
||||
m_pcCurrentModule = pcCurrentModule;
|
||||
}
|
||||
PlaYUVerAppModuleIf* getModule()
|
||||
{
|
||||
return m_pcCurrentModule;
|
||||
}
|
||||
|
||||
Void setRefSubWindow( SubWindowHandle* subWindow )
|
||||
{
|
||||
m_pcReferenceSubWindow = subWindow;
|
||||
}
|
||||
SubWindowHandle* getRefSubWindow()
|
||||
{
|
||||
return m_pcReferenceSubWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void enableModule( PlaYUVerAppModuleIf* select_module );
|
||||
Void disableModule();
|
||||
Void swapModuleFrames();
|
||||
Void applyModuleAllFrames();
|
||||
|
||||
/**
|
||||
* Show the image at its original size
|
||||
*/
|
||||
Void normalSize();
|
||||
/**
|
||||
* Scale the image (zoomed in or out) to fit on the window.
|
||||
*/
|
||||
Void zoomToFit();
|
||||
/**
|
||||
* Scale the image by a given factor
|
||||
* @param factor factor of scale. Ex: 1.2 scale the image up by 20% and
|
||||
* 0.8 scale the image down by 25%
|
||||
*/
|
||||
Void scaleView( Double scale );
|
||||
|
||||
/**
|
||||
* The current image size is scaled to a rectangle as large as possible
|
||||
* inside (@p width, @p height ) preserving the aspect ratio.
|
||||
*/
|
||||
Void scaleView( Int width, Int height );
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience.
|
||||
* Scales the image to a rectangle with the given size, preserving the
|
||||
* aspect ratio.
|
||||
*/
|
||||
Void scaleView( const QSize & size );
|
||||
|
||||
Void scaleViewByRatio( Double ratio );
|
||||
Double getScaleFactor()
|
||||
{
|
||||
return m_cViewArea->getZoomFactor();
|
||||
}
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
Void setWindowName( QString name )
|
||||
{
|
||||
m_cWindowName = name;
|
||||
setWindowTitle( m_cWindowName );
|
||||
}
|
||||
QString getWindowName()
|
||||
{
|
||||
return m_cWindowName;
|
||||
}
|
||||
QString getWindowShortName()
|
||||
{
|
||||
return m_cWindowShortName;
|
||||
}
|
||||
QString getCurrentFileName()
|
||||
{
|
||||
return m_cFilename;
|
||||
}
|
||||
|
||||
Bool getIsModule()
|
||||
{
|
||||
return m_bIsModule;
|
||||
}
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateSelectedArea( QRect area );
|
||||
void adjustScrollBarByZoom( double factor, QPoint center );
|
||||
void adjustScrollBarByOffset( QPoint Offset );
|
||||
void updateLastScrollValue();
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo);
|
||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector);
|
||||
|
||||
#endif // __SUBWINDOWHANDLE_H__
|
||||
|
||||
@@ -0,0 +1,538 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 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 VideoSubWindow.cpp
|
||||
* \brief Video Sub windows handling
|
||||
*/
|
||||
|
||||
#include "VideoSubWindow.h"
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "ViewArea.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array )
|
||||
{
|
||||
PlaYUVerStreamInfo d;
|
||||
out << array.size();
|
||||
for( Int i = 0; i < array.size(); i++ )
|
||||
{
|
||||
d = array.at( i );
|
||||
out << d.m_cFilename
|
||||
<< d.m_uiWidth
|
||||
<< d.m_uiHeight
|
||||
<< d.m_iPelFormat
|
||||
<< d.m_uiFrameRate;
|
||||
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
|
||||
{
|
||||
PlaYUVerStreamInfo d;
|
||||
Int array_size;
|
||||
in >> array_size;
|
||||
for( Int i = 0; i < array_size; i++ )
|
||||
{
|
||||
in >> d.m_cFilename;
|
||||
in >> d.m_uiWidth;
|
||||
in >> d.m_uiHeight;
|
||||
in >> d.m_iPelFormat;
|
||||
in >> d.m_uiFrameRate;
|
||||
array.append( d );
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename )
|
||||
{
|
||||
for( Int i = 0; i < array.size(); i++ )
|
||||
if( array.at( i ).m_cFilename == filename )
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) :
|
||||
SubWindowHandle( parent, SubWindowHandle::VIDEO_SUBWINDOW ),
|
||||
m_pCurrStream( NULL ),
|
||||
m_pcCurrFrame( NULL ),
|
||||
m_pcCurrentModule( NULL ),
|
||||
m_pcReferenceSubWindow( NULL ),
|
||||
m_bIsPlaying( false ),
|
||||
m_bIsModule( isModule )
|
||||
{
|
||||
setParent( parent );
|
||||
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Light );
|
||||
setVisible( false );
|
||||
|
||||
// Create a new scroll area inside the sub-window
|
||||
m_cScrollArea = new QScrollArea( this );
|
||||
setWidget( m_cScrollArea );
|
||||
|
||||
// Create a new interface to show images
|
||||
m_cViewArea = new ViewArea( m_cScrollArea );
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( adjustScrollBarByZoom(double, QPoint) ) );
|
||||
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset(QPoint) ) );
|
||||
connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
|
||||
connect( m_cScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
connect( m_cScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
|
||||
// Define the cViewArea as the widget inside the scroll area
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
m_cScrollArea->setWidgetResizable( true );
|
||||
|
||||
m_cWindowName = QString( " " );
|
||||
m_cLastScroll = QPoint();
|
||||
}
|
||||
|
||||
VideoSubWindow::~VideoSubWindow()
|
||||
{
|
||||
disableModule();
|
||||
delete m_cViewArea;
|
||||
delete m_cScrollArea;
|
||||
if( m_pCurrStream )
|
||||
delete m_pCurrStream;
|
||||
}
|
||||
|
||||
Void VideoSubWindow::reloadFile()
|
||||
{
|
||||
Int currFrameNum = m_pCurrStream->getCurrFrameNum();
|
||||
loadFile( m_cFilename, false );
|
||||
seekAbsoluteEvent( currFrameNum );
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
|
||||
{
|
||||
UInt Width = 0, Height = 0, FrameRate = 30;
|
||||
Int InputFormat = -1;
|
||||
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
|
||||
|
||||
if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
|
||||
{
|
||||
ConfigureFormatDialog formatDialog( this );
|
||||
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, FrameRate ) == QDialog::Rejected )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate );
|
||||
|
||||
m_sStreamInfo.m_cFilename = cFilename;
|
||||
m_sStreamInfo.m_uiWidth = Width;
|
||||
m_sStreamInfo.m_uiHeight = Height;
|
||||
m_sStreamInfo.m_iPelFormat = InputFormat;
|
||||
m_sStreamInfo.m_uiFrameRate = FrameRate;
|
||||
|
||||
m_cViewArea->setInputStream( m_pCurrStream );
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
refreshFrame();
|
||||
|
||||
m_cFilename = cFilename;
|
||||
m_cWindowName = m_pCurrStream->getStreamInformationString();
|
||||
m_cWindowShortName = QFileInfo( cFilename ).fileName();
|
||||
setWindowTitle( m_cWindowName );
|
||||
qDebug() << "File " << m_cWindowName << "was successfully opened";
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
|
||||
{
|
||||
if( !m_pCurrStream )
|
||||
{
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
|
||||
streamInfo->m_uiFrameRate ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_sStreamInfo = *streamInfo;
|
||||
|
||||
m_cViewArea->setInputStream( m_pCurrStream );
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
refreshFrame();
|
||||
|
||||
m_cFilename = streamInfo->m_cFilename;
|
||||
m_cWindowName = m_pCurrStream->getStreamInformationString();
|
||||
m_cWindowShortName = QFileInfo( streamInfo->m_cFilename ).fileName();
|
||||
setWindowTitle( m_cWindowName );
|
||||
return true;
|
||||
}
|
||||
|
||||
Void VideoSubWindow::updateSelectedArea( QRect area )
|
||||
{
|
||||
m_cSelectedArea = area;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* select_module )
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
disableModule();
|
||||
}
|
||||
m_pcCurrentModule = select_module;
|
||||
// refreshFrame();
|
||||
}
|
||||
|
||||
Void VideoSubWindow::disableModule()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrentModule;
|
||||
m_pcCurrentModule = NULL;
|
||||
ModulesHandle::destroyModuleIf( pcCurrentModule );
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::swapModuleFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::swapModulesWindowsIf( m_pcCurrentModule );
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::applyModuleAllFrames()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
ModulesHandle::applyAllModuleIf( m_pcCurrentModule );
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
|
||||
{
|
||||
m_pcCurrFrame = pcCurrFrame;
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
if( !isVisible() )
|
||||
{
|
||||
show();
|
||||
resize( sizeHint() );
|
||||
zoomToFit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::refreshFrame()
|
||||
{
|
||||
Bool bSetFrame = false;
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
m_pcCurrFrame = m_pCurrStream->getCurrFrame();
|
||||
bSetFrame = true;
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
bSetFrame = ModulesHandle::applyModuleIf( m_pcCurrentModule, m_bIsPlaying );
|
||||
}
|
||||
}
|
||||
if( bSetFrame )
|
||||
{
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
}
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::save( QString filename )
|
||||
{
|
||||
Bool iRet = false;
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
PlaYUVerFrame* saveFrame = m_pcCurrFrame;
|
||||
if( m_cSelectedArea.isValid() )
|
||||
{
|
||||
saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(),
|
||||
m_cSelectedArea.width(), m_cSelectedArea.height() );
|
||||
}
|
||||
if( !saveFrame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
iRet = PlaYUVerStream::saveFrame( filename, saveFrame );
|
||||
QApplication::restoreOverrideCursor();
|
||||
return iRet;
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::play()
|
||||
{
|
||||
if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 )
|
||||
{
|
||||
m_bIsPlaying = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
}
|
||||
return m_bIsPlaying;
|
||||
}
|
||||
|
||||
Int VideoSubWindow::playEvent()
|
||||
{
|
||||
if( m_pCurrStream && m_bIsPlaying )
|
||||
{
|
||||
m_pCurrStream->setNextFrame();
|
||||
refreshFrame();
|
||||
if( m_pCurrStream->checkErrors( PlaYUVerStream::END_OF_SEQ ) )
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
m_pCurrStream->readFrame();
|
||||
if( m_pCurrStream->checkErrors( PlaYUVerStream::READING ) )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cFilename ) );
|
||||
return -3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -4;
|
||||
}
|
||||
|
||||
Void VideoSubWindow::pause()
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
Void VideoSubWindow::seekAbsoluteEvent( UInt new_frame_num )
|
||||
{
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
if( m_pCurrStream->seekInput( new_frame_num ) )
|
||||
{
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::seekRelativeEvent( Bool bIsFoward )
|
||||
{
|
||||
if( m_pCurrStream )
|
||||
{
|
||||
if( m_pCurrStream->seekInput( m_pCurrStream->getCurrFrameNum() + ( bIsFoward ? 1 : -1 ) ) )
|
||||
{
|
||||
refreshFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::stop()
|
||||
{
|
||||
m_bIsPlaying = false;
|
||||
seekAbsoluteEvent( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
Void VideoSubWindow::normalSize()
|
||||
{
|
||||
Double scaleFactor = 1.0;
|
||||
m_cViewArea->setZoomFactor( scaleFactor );
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
Void VideoSubWindow::zoomToFit()
|
||||
{
|
||||
// Scale to a smaller size that the real to a nicer look
|
||||
QSize niceFit( m_cScrollArea->viewport()->size().width() - 5, m_cScrollArea->viewport()->size().height() - 5 );
|
||||
scaleView( niceFit );
|
||||
}
|
||||
|
||||
Void VideoSubWindow::scaleView( Double scale )
|
||||
{
|
||||
Q_ASSERT( m_cViewArea->image() );
|
||||
m_cViewArea->setZoomFactor( scale );
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
Void VideoSubWindow::scaleView( Int width, Int height )
|
||||
{
|
||||
scaleView( QSize( width, height ) );
|
||||
}
|
||||
|
||||
Void VideoSubWindow::scaleView( const QSize & size )
|
||||
{
|
||||
QSize imgViewSize;
|
||||
if( m_pcCurrFrame )
|
||||
imgViewSize = QSize( m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight() );
|
||||
else
|
||||
imgViewSize = QSize( m_pCurrStream->getWidth(), m_pCurrStream->getHeight() );
|
||||
QSize newSize = imgViewSize;
|
||||
newSize.scale( size, Qt::KeepAspectRatio );
|
||||
|
||||
// Calc the zoom factor
|
||||
Double wfactor = 1;
|
||||
Double hfactor = 1;
|
||||
|
||||
wfactor = ( Double )newSize.width() / imgViewSize.width();
|
||||
hfactor = ( Double )newSize.height() / imgViewSize.height();
|
||||
|
||||
if( wfactor < hfactor )
|
||||
scaleView( wfactor );
|
||||
else
|
||||
scaleView( hfactor );
|
||||
}
|
||||
|
||||
Void VideoSubWindow::scaleViewByRatio( Double ratio )
|
||||
{
|
||||
Q_ASSERT( m_cViewArea->image() );
|
||||
m_cViewArea->zoomChangeEvent( ratio, QPoint() );
|
||||
}
|
||||
|
||||
void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.x() ) );
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.y() ) );
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
// This function was developed with help of the schematics presented in
|
||||
// http://stackoverflow.com/questions/13155382/jscrollpane-zoom-relative-to-mouse-position
|
||||
void VideoSubWindow::adjustScrollBarByZoom( double factor, QPoint center )
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( factor * scrollBar->value() + ( ( factor - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Int x = center.x() - m_cLastScroll.x();
|
||||
Int value = int( factor * m_cLastScroll.x() + ( ( factor - 1 ) * x ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
}
|
||||
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( factor * scrollBar->value() + ( ( factor - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Int y = center.y() - m_cLastScroll.y();
|
||||
Int value = int( factor * m_cLastScroll.y() + ( ( factor - 1 ) * y ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
}
|
||||
|
||||
updateLastScrollValue();
|
||||
}
|
||||
|
||||
void VideoSubWindow::updateLastScrollValue()
|
||||
{
|
||||
QScrollBar *scrollBar = m_cScrollArea->horizontalScrollBar();
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
scrollBar = m_cScrollArea->verticalScrollBar();
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
}
|
||||
|
||||
QSize VideoSubWindow::sizeHint() const
|
||||
{
|
||||
QSize maxSize; // The size of the parent (viewport widget
|
||||
// of the QMdiArea).
|
||||
|
||||
QWidget *p = parentWidget();
|
||||
if( p )
|
||||
{
|
||||
maxSize = p->size();
|
||||
}
|
||||
|
||||
QSize isize;
|
||||
if( m_pcCurrFrame )
|
||||
isize = QSize( m_pcCurrFrame->getWidth() + 50, m_pcCurrFrame->getHeight() + 50 );
|
||||
else if( m_pCurrStream )
|
||||
isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
|
||||
|
||||
// If the VideoSubWindow needs more space that the avaiable, we'll give
|
||||
// to the subwindow a reasonable size preserving the image aspect ratio.
|
||||
if( isize.width() < maxSize.width() && isize.height() < maxSize.height() )
|
||||
{
|
||||
return isize;
|
||||
}
|
||||
else
|
||||
{
|
||||
isize.scale( maxSize, Qt::KeepAspectRatio );
|
||||
maxSize = isize;
|
||||
}
|
||||
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::mayClose()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void VideoSubWindow::closeEvent( QCloseEvent *event )
|
||||
{
|
||||
Bool bAccept = mayClose();
|
||||
bAccept = m_bIsPlaying ? false : bAccept;
|
||||
if( bAccept )
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -0,0 +1,244 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 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 VideoSubWindow.h
|
||||
* \brief Video Sub windows handling
|
||||
*/
|
||||
|
||||
#ifndef __VIDEOSUBWINDOW_H__
|
||||
#define __VIDEOSUBWINDOW_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include "ViewArea.h"
|
||||
#include "ModulesHandle.h"
|
||||
#include "SubWindowHandle.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class VideoSubWindow;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QString m_cFilename;
|
||||
UInt m_uiWidth;
|
||||
UInt m_uiHeight;
|
||||
Int m_iPelFormat;
|
||||
UInt m_uiFrameRate;
|
||||
}PlaYUVerStreamInfo;
|
||||
typedef QVector<PlaYUVerStreamInfo> PlaYUVerStreamInfoVector;
|
||||
|
||||
QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d);
|
||||
QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d);
|
||||
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename );
|
||||
|
||||
class VideoSubWindow: public SubWindowHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
QScrollArea* m_cScrollArea;
|
||||
ViewArea* m_cViewArea;
|
||||
|
||||
PlaYUVerStreamInfo m_sStreamInfo;
|
||||
|
||||
PlaYUVerStream* m_pCurrStream;
|
||||
PlaYUVerFrame* m_pcCurrFrame;
|
||||
QRect m_cSelectedArea;
|
||||
|
||||
QString m_cFilename;
|
||||
PlaYUVerAppModuleIf* m_pcCurrentModule;
|
||||
|
||||
VideoSubWindow* m_pcReferenceSubWindow;
|
||||
|
||||
QString m_cWindowName;
|
||||
|
||||
QString m_cWindowShortName;
|
||||
QString m_cCurrFileName;
|
||||
|
||||
Bool m_bIsPlaying;
|
||||
Bool m_bIsModule;
|
||||
|
||||
QPoint m_cLastScroll;
|
||||
|
||||
public:
|
||||
VideoSubWindow( QWidget * parent = 0, Bool isModule = false );
|
||||
~VideoSubWindow();
|
||||
|
||||
Bool mayClose();
|
||||
Bool loadFile( QString cFilename, Bool bForceDialog = false );
|
||||
Bool loadFile( PlaYUVerStreamInfo* streamInfo );
|
||||
Void reloadFile();
|
||||
Bool save( QString filename );
|
||||
|
||||
Bool play();
|
||||
Void pause();
|
||||
Int playEvent();
|
||||
Void stop();
|
||||
|
||||
Bool isPlaying()
|
||||
{
|
||||
return m_bIsPlaying;
|
||||
}
|
||||
|
||||
Void seekAbsoluteEvent( UInt new_frame_num );
|
||||
Void seekRelativeEvent( Bool bIsFoward );
|
||||
|
||||
QImage* FrameToQImage( PlaYUVerFrame* curr_frame );
|
||||
|
||||
Void refreshFrame();
|
||||
Void setCurrFrame( PlaYUVerFrame* pcCurrFrame );
|
||||
|
||||
PlaYUVerStreamInfo getStreamInfo()
|
||||
{
|
||||
return m_sStreamInfo;
|
||||
}
|
||||
|
||||
PlaYUVerStream* getInputStream()
|
||||
{
|
||||
return m_pCurrStream;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* getCurrFrame()
|
||||
{
|
||||
return m_pcCurrFrame;
|
||||
}
|
||||
|
||||
ViewArea* getViewArea()
|
||||
{
|
||||
return m_cViewArea;
|
||||
}
|
||||
|
||||
Double getZoomFactor()
|
||||
{
|
||||
return m_cViewArea->getZoomFactor();
|
||||
}
|
||||
|
||||
Void setModule( PlaYUVerAppModuleIf* pcCurrentModule )
|
||||
{
|
||||
m_pcCurrentModule = pcCurrentModule;
|
||||
}
|
||||
PlaYUVerAppModuleIf* getModule()
|
||||
{
|
||||
return m_pcCurrentModule;
|
||||
}
|
||||
|
||||
Void setRefSubWindow( VideoSubWindow* subWindow )
|
||||
{
|
||||
m_pcReferenceSubWindow = subWindow;
|
||||
}
|
||||
VideoSubWindow* getRefSubWindow()
|
||||
{
|
||||
return m_pcReferenceSubWindow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to enable a module in the
|
||||
* current SubWindow
|
||||
*/
|
||||
Void enableModule( PlaYUVerAppModuleIf* select_module );
|
||||
Void disableModule();
|
||||
Void swapModuleFrames();
|
||||
Void applyModuleAllFrames();
|
||||
|
||||
/**
|
||||
* Show the image at its original size
|
||||
*/
|
||||
Void normalSize();
|
||||
/**
|
||||
* Scale the image (zoomed in or out) to fit on the window.
|
||||
*/
|
||||
Void zoomToFit();
|
||||
/**
|
||||
* Scale the image by a given factor
|
||||
* @param factor factor of scale. Ex: 1.2 scale the image up by 20% and
|
||||
* 0.8 scale the image down by 25%
|
||||
*/
|
||||
Void scaleView( Double scale );
|
||||
|
||||
/**
|
||||
* The current image size is scaled to a rectangle as large as possible
|
||||
* inside (@p width, @p height ) preserving the aspect ratio.
|
||||
*/
|
||||
Void scaleView( Int width, Int height );
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience.
|
||||
* Scales the image to a rectangle with the given size, preserving the
|
||||
* aspect ratio.
|
||||
*/
|
||||
Void scaleView( const QSize & size );
|
||||
|
||||
Void scaleViewByRatio( Double ratio );
|
||||
Double getScaleFactor()
|
||||
{
|
||||
return m_cViewArea->getZoomFactor();
|
||||
}
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
Void setWindowName( QString name )
|
||||
{
|
||||
m_cWindowName = name;
|
||||
setWindowTitle( m_cWindowName );
|
||||
}
|
||||
QString getWindowName()
|
||||
{
|
||||
return m_cWindowName;
|
||||
}
|
||||
QString getWindowShortName()
|
||||
{
|
||||
return m_cWindowShortName;
|
||||
}
|
||||
QString getCurrentFileName()
|
||||
{
|
||||
return m_cFilename;
|
||||
}
|
||||
|
||||
Bool getIsModule()
|
||||
{
|
||||
return m_bIsModule;
|
||||
}
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateSelectedArea( QRect area );
|
||||
void adjustScrollBarByZoom( double factor, QPoint center );
|
||||
void adjustScrollBarByOffset( QPoint Offset );
|
||||
void updateLastScrollValue();
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo);
|
||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector);
|
||||
|
||||
#endif // __VIDEOSUBWINDOW_H__
|
||||
|
||||
+18
-18
@@ -155,13 +155,13 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
||||
|
||||
Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
{
|
||||
SubWindowHandle *interfaceChild = plaYUVerApp::findSubWindow( mdiArea, fileName );
|
||||
if( interfaceChild )
|
||||
VideoSubWindow *videoSubWindow = plaYUVerApp::findVideoSubWindow( mdiArea, fileName );
|
||||
if( videoSubWindow )
|
||||
{
|
||||
mdiArea->setActiveSubWindow( interfaceChild );
|
||||
mdiArea->setActiveSubWindow( videoSubWindow );
|
||||
return;
|
||||
}
|
||||
interfaceChild = new SubWindowHandle( this ); //createSubWindow();
|
||||
videoSubWindow = new VideoSubWindow( this ); //createSubWindow();
|
||||
if( !pStreamInfo )
|
||||
{
|
||||
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||
@@ -173,28 +173,28 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
Bool opened = false;
|
||||
|
||||
if( !pStreamInfo )
|
||||
opened = interfaceChild->loadFile( fileName );
|
||||
opened = videoSubWindow->loadFile( fileName );
|
||||
else
|
||||
opened = interfaceChild->loadFile( pStreamInfo );
|
||||
opened = videoSubWindow->loadFile( pStreamInfo );
|
||||
|
||||
if( opened )
|
||||
{
|
||||
statusBar()->showMessage( tr( "Loading file..." ) );
|
||||
mdiArea->addSubWindow( interfaceChild );
|
||||
interfaceChild->show();
|
||||
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this,
|
||||
mdiArea->addSubWindow( videoSubWindow );
|
||||
videoSubWindow->show();
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this,
|
||||
SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
|
||||
connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) );
|
||||
connect( interfaceChild->getViewArea(), SIGNAL( zoomFactorChanged( double , QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) );
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( zoomFactorChanged( double , QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
|
||||
interfaceChild->zoomToFit();
|
||||
interfaceChild->getViewArea()->setTool( m_appTool );
|
||||
videoSubWindow->zoomToFit();
|
||||
videoSubWindow->getViewArea()->setTool( m_appTool );
|
||||
updateZoomFactorSBox();
|
||||
|
||||
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||
if( idx >= 0 )
|
||||
m_aRecentFileStreamInfo.remove( idx );
|
||||
PlaYUVerStreamInfo streamInfo = interfaceChild->getStreamInfo();
|
||||
PlaYUVerStreamInfo streamInfo = videoSubWindow->getStreamInfo();
|
||||
m_aRecentFileStreamInfo.prepend( streamInfo );
|
||||
while( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES )
|
||||
m_aRecentFileStreamInfo.remove( m_aRecentFileStreamInfo.size() - 1 );
|
||||
@@ -204,12 +204,12 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
}
|
||||
else
|
||||
{
|
||||
interfaceChild->close();
|
||||
videoSubWindow->close();
|
||||
}
|
||||
}
|
||||
catch( const char *msg )
|
||||
{
|
||||
interfaceChild->close();
|
||||
videoSubWindow->close();
|
||||
QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + msg;
|
||||
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
|
||||
statusBar()->showMessage( warningMsg, 2000 );
|
||||
@@ -983,12 +983,12 @@ SubWindowHandle *plaYUVerApp::activeSubWindow()
|
||||
return 0;
|
||||
}
|
||||
|
||||
SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const QString& fileName )
|
||||
VideoSubWindow* plaYUVerApp::findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName )
|
||||
{
|
||||
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
|
||||
|
||||
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
|
||||
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
|
||||
VideoSubWindow *mdiChild = qobject_cast<VideoSubWindow *>( window);
|
||||
if( mdiChild->getCurrentFileName() == canonicalFilePath )
|
||||
return mdiChild;
|
||||
}
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ private:
|
||||
|
||||
SubWindowHandle *activeSubWindow();
|
||||
|
||||
static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const QString& fileName );
|
||||
static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName );
|
||||
static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow );
|
||||
|
||||
QVector<SubWindowHandle*> m_acPlayingSubWindows;
|
||||
|
||||
Reference in new issue
Block a user