Add option to enable zoom and pan lock
This commit is contained in:
1 parent
40c5db6b2f
commit
1a52063259
5 files changed
+55
-43
No files matched your search
@@ -31,7 +31,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
|
||||
QScrollArea( parent )
|
||||
{
|
||||
setParent( parent );
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
setFocusPolicy( Qt::WheelFocus );
|
||||
setAttribute( Qt::WA_DeleteOnClose );
|
||||
setBackgroundRole( QPalette::Light );
|
||||
setWindowIcon( QIcon( ":/images/playuver.png" ) );
|
||||
|
||||
+47
-3
@@ -82,8 +82,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]->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_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
|
||||
connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) );
|
||||
|
||||
m_pcFrameSlider = new QSlider;
|
||||
@@ -103,6 +106,7 @@ QMenu* VideoHandle::createMenu()
|
||||
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] );
|
||||
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
|
||||
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] );
|
||||
return m_pcMenuVideo;
|
||||
}
|
||||
@@ -181,6 +185,7 @@ Void VideoHandle::updateMenus()
|
||||
m_arrayActions[VIDEO_BACKWARD_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_FORWARD_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_LOOP_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setEnabled( hasSubWindow );
|
||||
m_pcFrameSlider->setEnabled( hasSubWindow );
|
||||
if( !hasSubWindow )
|
||||
@@ -235,9 +240,9 @@ Void VideoHandle::update()
|
||||
else
|
||||
{
|
||||
m_pcFrameNumInfo->setCurrFrameNum( 0 );
|
||||
m_pcFormatCodeLabel->setText( QString( ""));
|
||||
m_pcFormatCodeLabel->setText( QString( "" ) );
|
||||
if( m_pcCurrentVideoSubWindow->getIsModule() )
|
||||
m_pcFormatCodeLabel->setText( QString( "Module"));
|
||||
m_pcFormatCodeLabel->setText( QString( "Module" ) );
|
||||
}
|
||||
|
||||
if( pcFrame )
|
||||
@@ -291,6 +296,45 @@ Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow )
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center )
|
||||
{
|
||||
Double factor;
|
||||
|
||||
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() )
|
||||
{
|
||||
|
||||
factor = m_pcCurrentVideoSubWindow->getScaleFactor();
|
||||
|
||||
SubWindowHandle *subWindow;
|
||||
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
subWindow = subWindowList.at( i );
|
||||
if( m_pcCurrentVideoSubWindow == subWindow )
|
||||
continue;
|
||||
else
|
||||
{
|
||||
subWindow->zoomToFactor( factor, center );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoHandle::moveAllScrollBars( const QPoint offset )
|
||||
{
|
||||
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() )
|
||||
{
|
||||
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow == subWindowList.at( i ) )
|
||||
continue;
|
||||
else
|
||||
subWindowList.at( i )->adjustScrollBarByOffset( offset );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UInt64 VideoHandle::getMaxFrameNumber()
|
||||
{
|
||||
UInt currFrames;
|
||||
|
||||
@@ -73,6 +73,7 @@ private:
|
||||
VIDEO_FORWARD_ACT,
|
||||
VIDEO_BACKWARD_ACT,
|
||||
VIDEO_LOOP_ACT,
|
||||
VIDEO_ZOOM_LOCK_ACT,
|
||||
VIDEO_LOCK_ACT,
|
||||
VIDEO_LOCK_SELECTION_ACT,
|
||||
TOTAL_ACT,
|
||||
@@ -109,6 +110,8 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void update();
|
||||
void updateSelectionArea( QRect area );
|
||||
void zoomToFactorAll( const double factor, const QPoint center = QPoint() );
|
||||
void moveAllScrollBars( const QPoint offset );
|
||||
void play();
|
||||
void stop();
|
||||
void playEvent();
|
||||
|
||||
+3
-36
@@ -179,11 +179,12 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
videoSubWindow->show();
|
||||
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
|
||||
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
|
||||
connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) );
|
||||
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
//connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( zoomToFactorAll( double, QPoint ) ) );
|
||||
//connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||
|
||||
|
||||
videoSubWindow->zoomToFit();
|
||||
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool )m_uiViewTool );
|
||||
@@ -406,28 +407,6 @@ Void plaYUVerApp::zoomToFitAll()
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::zoomToFactorAll( const Double scale, const QPoint center )
|
||||
{
|
||||
Double factor;
|
||||
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
factor = m_pcCurrentSubWindow->getScaleFactor();
|
||||
|
||||
SubWindowHandle *subWindow;
|
||||
QList<SubWindowHandle*> subWindowList = m_pcWindowHandle->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
subWindow = subWindowList.at( i );
|
||||
if( m_pcCurrentSubWindow == subWindow )
|
||||
continue;
|
||||
else
|
||||
{
|
||||
subWindow->zoomToFactor( factor, center );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::scaleFrame( int ratio )
|
||||
{
|
||||
@@ -458,18 +437,6 @@ Void plaYUVerApp::updateZoomFactorSBox()
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::moveAllScrollBars( const QPoint offset )
|
||||
{
|
||||
QList<SubWindowHandle*> subWindowList = m_pcWindowHandle->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
if( m_pcCurrentSubWindow == subWindowList.at( i ) )
|
||||
continue;
|
||||
else
|
||||
subWindowList.at( i )->adjustScrollBarByOffset( offset );
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- Drag and drop functions ----------------------
|
||||
|
||||
Void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
|
||||
|
||||
+1
-3
@@ -88,7 +88,7 @@ private Q_SLOTS:
|
||||
void normalSize();
|
||||
void zoomToFit();
|
||||
void zoomToFitAll();
|
||||
void zoomToFactorAll( const double factor, const QPoint center = QPoint() );
|
||||
|
||||
|
||||
void setTool( int idxTool );
|
||||
|
||||
@@ -99,8 +99,6 @@ private Q_SLOTS:
|
||||
void updateZoomFactorSBox();
|
||||
void updateStatusBar( const QString& );
|
||||
|
||||
void moveAllScrollBars( const QPoint offset );
|
||||
|
||||
private:
|
||||
|
||||
PlaYUVerAppAdaptor* m_pDBusAdaptor;
|
||||
|
||||
Reference in new issue
Block a user