Add zoom spin box for precise zoom setting.
This commit is contained in:
1 parent
66e8e936ba
commit
2b3e0f5ffd
2 files changed
+48
-4
No files matched your search
@@ -173,9 +173,11 @@ Void plaYUVerApp::loadFile( QString fileName )
|
||||
connect( interfaceChild->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() ) );
|
||||
|
||||
interfaceChild->zoomToFit();
|
||||
interfaceChild->getViewArea()->setTool( m_appTool );
|
||||
updateZoomFactorSBox( );
|
||||
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
||||
}
|
||||
else
|
||||
@@ -340,6 +342,20 @@ Void plaYUVerApp::updatePropertiesSelectedArea( QRect area )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Void plaYUVerApp::updateZoomFactorSBox( )
|
||||
{
|
||||
if( m_pcCurrentSubWindow && m_pcCurrentSubWindow->getViewArea() )
|
||||
{
|
||||
Double factor = m_pcCurrentSubWindow->getViewArea()->getZoomFactor();
|
||||
m_pcZoomFactorSBox->setValue(factor*100);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcZoomFactorSBox->setValue(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- Playing Functions --------------------
|
||||
|
||||
UInt64 plaYUVerApp::getMaxFrameNumber()
|
||||
@@ -647,13 +663,19 @@ Void plaYUVerApp::videoSelectionButtonEvent()
|
||||
Void plaYUVerApp::normalSize()
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->normalSize();
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::zoomToFit()
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->zoomToFit();
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::zoomToFitAll()
|
||||
@@ -666,17 +688,26 @@ Void plaYUVerApp::zoomToFitAll()
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::scaleFrame( Int ratio )
|
||||
Void plaYUVerApp::scaleFrame( int ratio )
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->scaleViewByRatio( ( Double )( ratio ) / 100.0 );
|
||||
|
||||
activeSubWindow()->scaleViewByRatio( (Double)ratio / 100.0 );
|
||||
updateZoomFactorSBox();
|
||||
// m_arrayActions[ZOOM_IN_ACT]->setEnabled( activeSubWindow()->getScaleFactor() < 3.0 );
|
||||
// m_arrayActions[ZOOM_OUT_ACT]->setEnabled( activeSubWindow()->getScaleFactor() > 0.333 );
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::setZoomFromSBox( double zoom )
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
if(activeSubWindow()->getViewArea()->getZoomFactor() != ( zoom/100.0 ) )
|
||||
activeSubWindow()->getViewArea()->setZoomFactor( zoom/100.0 );
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::chageSubWindowSelection()
|
||||
{
|
||||
SubWindowHandle *new_window = activeSubWindow();
|
||||
@@ -689,6 +720,7 @@ Void plaYUVerApp::chageSubWindowSelection()
|
||||
updateTotalFrameNum();
|
||||
updateStreamProperties();
|
||||
updateFrameProperties();
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
m_pcCurrentSubWindow = new_window;
|
||||
}
|
||||
@@ -808,6 +840,7 @@ Void plaYUVerApp::updateMenus()
|
||||
m_arrayActions[ZOOM_OUT_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[ZOOM_NORMAL_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[ZOOM_FIT_ACT]->setEnabled( hasSubWindow );
|
||||
m_pcZoomFactorSBox->setEnabled( hasSubWindow );
|
||||
|
||||
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
|
||||
m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow );
|
||||
@@ -1155,6 +1188,13 @@ Void plaYUVerApp::createToolBars()
|
||||
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[FILE_TOOLBAR] );
|
||||
|
||||
m_arrayToolBars[VIEW_TOOLBAR] = new QToolBar( tr( "View" ) );
|
||||
m_pcZoomFactorSBox = new QDoubleSpinBox;
|
||||
m_pcZoomFactorSBox->setRange(0.0, 10000.0);
|
||||
m_pcZoomFactorSBox->setSingleStep(1.0);
|
||||
m_pcZoomFactorSBox->setValue(100.0);
|
||||
m_pcZoomFactorSBox->setSuffix("%");
|
||||
connect(m_pcZoomFactorSBox, SIGNAL( valueChanged(double) ), this, SLOT( setZoomFromSBox(double) ) );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addWidget( m_pcZoomFactorSBox );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_IN_ACT] );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
|
||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_NORMAL_ACT] );
|
||||
|
||||
Reference in new issue
Block a user