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,
|
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this,
|
||||||
SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
|
SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
|
||||||
connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) );
|
connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) );
|
||||||
|
connect( interfaceChild->getViewArea(), SIGNAL( zoomFactorChanged( double , QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
|
||||||
|
|
||||||
interfaceChild->zoomToFit();
|
interfaceChild->zoomToFit();
|
||||||
interfaceChild->getViewArea()->setTool( m_appTool );
|
interfaceChild->getViewArea()->setTool( m_appTool );
|
||||||
|
updateZoomFactorSBox( );
|
||||||
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
||||||
}
|
}
|
||||||
else
|
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 --------------------
|
// ----------------------- Playing Functions --------------------
|
||||||
|
|
||||||
UInt64 plaYUVerApp::getMaxFrameNumber()
|
UInt64 plaYUVerApp::getMaxFrameNumber()
|
||||||
@@ -647,13 +663,19 @@ Void plaYUVerApp::videoSelectionButtonEvent()
|
|||||||
Void plaYUVerApp::normalSize()
|
Void plaYUVerApp::normalSize()
|
||||||
{
|
{
|
||||||
if( activeSubWindow() )
|
if( activeSubWindow() )
|
||||||
|
{
|
||||||
activeSubWindow()->normalSize();
|
activeSubWindow()->normalSize();
|
||||||
|
updateZoomFactorSBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Void plaYUVerApp::zoomToFit()
|
Void plaYUVerApp::zoomToFit()
|
||||||
{
|
{
|
||||||
if( activeSubWindow() )
|
if( activeSubWindow() )
|
||||||
|
{
|
||||||
activeSubWindow()->zoomToFit();
|
activeSubWindow()->zoomToFit();
|
||||||
|
updateZoomFactorSBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Void plaYUVerApp::zoomToFitAll()
|
Void plaYUVerApp::zoomToFitAll()
|
||||||
@@ -666,17 +688,26 @@ Void plaYUVerApp::zoomToFitAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Void plaYUVerApp::scaleFrame( Int ratio )
|
Void plaYUVerApp::scaleFrame( int ratio )
|
||||||
{
|
{
|
||||||
if( activeSubWindow() )
|
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_IN_ACT]->setEnabled( activeSubWindow()->getScaleFactor() < 3.0 );
|
||||||
// m_arrayActions[ZOOM_OUT_ACT]->setEnabled( activeSubWindow()->getScaleFactor() > 0.333 );
|
// 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()
|
Void plaYUVerApp::chageSubWindowSelection()
|
||||||
{
|
{
|
||||||
SubWindowHandle *new_window = activeSubWindow();
|
SubWindowHandle *new_window = activeSubWindow();
|
||||||
@@ -689,6 +720,7 @@ Void plaYUVerApp::chageSubWindowSelection()
|
|||||||
updateTotalFrameNum();
|
updateTotalFrameNum();
|
||||||
updateStreamProperties();
|
updateStreamProperties();
|
||||||
updateFrameProperties();
|
updateFrameProperties();
|
||||||
|
updateZoomFactorSBox();
|
||||||
}
|
}
|
||||||
m_pcCurrentSubWindow = new_window;
|
m_pcCurrentSubWindow = new_window;
|
||||||
}
|
}
|
||||||
@@ -808,6 +840,7 @@ Void plaYUVerApp::updateMenus()
|
|||||||
m_arrayActions[ZOOM_OUT_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[ZOOM_OUT_ACT]->setEnabled( hasSubWindow );
|
||||||
m_arrayActions[ZOOM_NORMAL_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[ZOOM_NORMAL_ACT]->setEnabled( hasSubWindow );
|
||||||
m_arrayActions[ZOOM_FIT_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[ZOOM_FIT_ACT]->setEnabled( hasSubWindow );
|
||||||
|
m_pcZoomFactorSBox->setEnabled( hasSubWindow );
|
||||||
|
|
||||||
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
|
||||||
m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow );
|
||||||
@@ -1155,6 +1188,13 @@ Void plaYUVerApp::createToolBars()
|
|||||||
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[FILE_TOOLBAR] );
|
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[FILE_TOOLBAR] );
|
||||||
|
|
||||||
m_arrayToolBars[VIEW_TOOLBAR] = new QToolBar( tr( "View" ) );
|
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_IN_ACT] );
|
||||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
|
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
|
||||||
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_NORMAL_ACT] );
|
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_NORMAL_ACT] );
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ private Q_SLOTS:
|
|||||||
* @param factor factor of scale. Ex: 120 scale the image up by 20% and
|
* @param factor factor of scale. Ex: 120 scale the image up by 20% and
|
||||||
* 80 scale the image down by 25%
|
* 80 scale the image down by 25%
|
||||||
*/
|
*/
|
||||||
void scaleFrame( int ratio = 100 );
|
void scaleFrame( int ratio = 100.0 );
|
||||||
|
void setZoomFromSBox( double ratio );
|
||||||
|
|
||||||
void normalSize();
|
void normalSize();
|
||||||
void zoomToFit();
|
void zoomToFit();
|
||||||
@@ -104,6 +105,8 @@ private Q_SLOTS:
|
|||||||
void updateProperties();
|
void updateProperties();
|
||||||
void updatePropertiesSelectedArea( QRect area );
|
void updatePropertiesSelectedArea( QRect area );
|
||||||
|
|
||||||
|
void updateZoomFactorSBox();
|
||||||
|
|
||||||
void setAllSubWindowTool();
|
void setAllSubWindowTool();
|
||||||
void setNavigationTool();
|
void setNavigationTool();
|
||||||
void setSelectionTool();
|
void setSelectionTool();
|
||||||
@@ -150,6 +153,7 @@ private:
|
|||||||
QSlider *m_pcFrameSlider;
|
QSlider *m_pcFrameSlider;
|
||||||
QLabel *m_pcCurrFrameNumLabel;
|
QLabel *m_pcCurrFrameNumLabel;
|
||||||
QLabel *m_pcTotalFrameNumLabel;
|
QLabel *m_pcTotalFrameNumLabel;
|
||||||
|
QDoubleSpinBox *m_pcZoomFactorSBox;
|
||||||
|
|
||||||
QSignalMapper *mapperZoom;
|
QSignalMapper *mapperZoom;
|
||||||
QSignalMapper *mapperSeekVideo;
|
QSignalMapper *mapperSeekVideo;
|
||||||
|
|||||||
Reference in new issue
Block a user