Merge branch 'master' into develCommanline
This commit is contained in:
commit
d410ca950b
6 files changed
+108
-47
No files matched your search
@@ -49,7 +49,6 @@ Q_SIGNALS:
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
void closeEvent( QCloseEvent *event );
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
+62
-31
@@ -39,8 +39,8 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) :
|
||||
setWindowIcon( QIcon( ":/images/playuver.png" ) );
|
||||
|
||||
// Create a new scroll area inside the sub-window
|
||||
connect( horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
connect( verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateLastScrollValue() ) );
|
||||
connect( horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
|
||||
connect( verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
|
||||
|
||||
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
@@ -71,60 +71,91 @@ QSize SubWindowHandle::getScrollSize()
|
||||
|
||||
Void SubWindowHandle::adjustScrollBarByOffset( QPoint Offset )
|
||||
{
|
||||
QScrollBar *scrollBar = horizontalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.x() ) );
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
scrollBar = verticalScrollBar();
|
||||
scrollBar->setValue( int( scrollBar->value() + Offset.y() ) );
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
updateLastScrollValue();
|
||||
QPoint cLastScroll = m_cCurrScroll;
|
||||
QScrollBar *scrollBarH, *scrollBarV;
|
||||
Int valueX, valueY;
|
||||
|
||||
valueX = int( cLastScroll.x() + Offset.x() );
|
||||
valueY = int( cLastScroll.y() + Offset.y() );
|
||||
|
||||
scrollBarH = horizontalScrollBar();
|
||||
if( valueX > scrollBarH->maximum() )
|
||||
valueX = scrollBarH->maximum();
|
||||
if( valueX < scrollBarH->minimum() )
|
||||
valueX = scrollBarH->minimum();
|
||||
m_cCurrScroll.setX(valueX);
|
||||
|
||||
scrollBarV = verticalScrollBar();
|
||||
if( valueY > scrollBarV->maximum() )
|
||||
valueY = scrollBarV->maximum();
|
||||
if( valueY < scrollBarV->minimum() )
|
||||
valueY = scrollBarV->minimum();
|
||||
m_cCurrScroll.setY( valueY );
|
||||
|
||||
// Update window scroll
|
||||
scrollBarH->setValue( m_cCurrScroll.x() );
|
||||
scrollBarV->setValue( m_cCurrScroll.y() );
|
||||
}
|
||||
|
||||
// This function was developed with help of the schematics presented in
|
||||
// http://stackoverflow.com/questions/13155382/jscrollpane-zoom-relative-to-mouse-position
|
||||
Void SubWindowHandle::adjustScrollBarByScale( Double scale, QPoint center )
|
||||
{
|
||||
QScrollBar *scrollBar = horizontalScrollBar();
|
||||
QPoint cLastScroll = m_cCurrScroll;
|
||||
QScrollBar *scrollBarH, *scrollBarV;
|
||||
|
||||
scrollBarH = horizontalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( scale * scrollBar->value() + ( ( scale - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
m_cCurrScroll.setX(int( scale * cLastScroll.x() + ( ( scale - 1 ) * scrollBarH->pageStep() / 2 ) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Int x = center.x() - m_cLastScroll.x();
|
||||
Int value = int( scale * m_cLastScroll.x() + ( ( scale - 1 ) * x ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
Int x = center.x() - cLastScroll.x();
|
||||
Int value = int( scale * cLastScroll.x() + ( ( scale - 1 ) * x ) );
|
||||
if( value > scrollBarH->maximum() )
|
||||
value = scrollBarH->maximum();
|
||||
if( value < scrollBarH->minimum() )
|
||||
value = scrollBarH->minimum();
|
||||
m_cCurrScroll.setX(value);
|
||||
}
|
||||
|
||||
scrollBar = verticalScrollBar();
|
||||
scrollBarV = verticalScrollBar();
|
||||
if( center.isNull() )
|
||||
{
|
||||
scrollBar->setValue( int( scale * scrollBar->value() + ( ( scale - 1 ) * scrollBar->pageStep() / 2 ) ) );
|
||||
m_cCurrScroll.setY(int( scale * cLastScroll.y() + ( ( scale - 1 ) * scrollBarV->pageStep() / 2 ) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Int y = center.y() - m_cLastScroll.y();
|
||||
Int value = int( scale * m_cLastScroll.y() + ( ( scale - 1 ) * y ) );
|
||||
if( value > scrollBar->maximum() )
|
||||
value = scrollBar->maximum();
|
||||
if( value < scrollBar->minimum() )
|
||||
value = scrollBar->minimum();
|
||||
scrollBar->setValue( value );
|
||||
Int y = center.y() - cLastScroll.y();
|
||||
Int value = int( scale * cLastScroll.y() + ( ( scale - 1 ) * y ) );
|
||||
if( value > scrollBarV->maximum() )
|
||||
value = scrollBarV->maximum();
|
||||
if( value < scrollBarV->minimum() )
|
||||
value = scrollBarV->minimum();
|
||||
m_cCurrScroll.setY(value);
|
||||
}
|
||||
|
||||
updateLastScrollValue();
|
||||
// Update window scroll
|
||||
scrollBarH->setValue( m_cCurrScroll.x() );
|
||||
scrollBarV->setValue( m_cCurrScroll.y() );
|
||||
|
||||
}
|
||||
|
||||
Void SubWindowHandle::updateLastScrollValue()
|
||||
Void SubWindowHandle::updateCurScrollValues()
|
||||
{
|
||||
QScrollBar *scrollBar = horizontalScrollBar();
|
||||
m_cLastScroll.setX( scrollBar->value() );
|
||||
m_cCurrScroll.setX( scrollBar->value() );
|
||||
scrollBar = verticalScrollBar();
|
||||
m_cLastScroll.setY( scrollBar->value() );
|
||||
m_cCurrScroll.setY( scrollBar->value() );
|
||||
}
|
||||
|
||||
Void SubWindowHandle::setCurScrollValues()
|
||||
{
|
||||
QScrollBar *scrollBar = horizontalScrollBar();
|
||||
scrollBar->setValue(m_cCurrScroll.x() );
|
||||
scrollBar = verticalScrollBar();
|
||||
scrollBar->setValue(m_cCurrScroll.y() );
|
||||
}
|
||||
|
||||
Void SubWindowHandle::setWindowName( QString name )
|
||||
|
||||
@@ -44,6 +44,7 @@ Q_OBJECT
|
||||
|
||||
private:
|
||||
QPoint m_cLastScroll;
|
||||
QPoint m_cCurrScroll;
|
||||
|
||||
UInt m_uiCategory;
|
||||
QString m_cWindowName;
|
||||
@@ -134,10 +135,11 @@ Q_SIGNALS:
|
||||
void aboutToClose( SubWindowHandle* );
|
||||
|
||||
public Q_SLOTS:
|
||||
void onDestroyed();
|
||||
void onDestroyed();
|
||||
void adjustScrollBarByScale( double scale, QPoint center );
|
||||
void adjustScrollBarByOffset( QPoint Offset );
|
||||
void updateLastScrollValue();
|
||||
void updateCurScrollValues();
|
||||
void setCurScrollValues();
|
||||
|
||||
};
|
||||
|
||||
|
||||
+23
-2
@@ -314,15 +314,36 @@ 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() )
|
||||
{
|
||||
SubWindowHandle *subWindow;
|
||||
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
|
||||
|
||||
QScrollBar *scrollBar;
|
||||
scrollBar = m_pcCurrentVideoSubWindow->horizontalScrollBar();
|
||||
|
||||
// Do not move other images, if current image reached maximum or minimum scroll position
|
||||
if(scrollBar->value()==scrollBar->maximum() && offset.x()>0)
|
||||
newOffset.setX(0);
|
||||
if(scrollBar->value()==scrollBar->minimum() && offset.x()<0)
|
||||
newOffset.setX(0);
|
||||
|
||||
scrollBar = m_pcCurrentVideoSubWindow->verticalScrollBar();
|
||||
if(scrollBar->value()==scrollBar->maximum() && offset.y()>0)
|
||||
newOffset.setY(0);
|
||||
if(scrollBar->value()==scrollBar->minimum() && offset.y()<0)
|
||||
newOffset.setY(0);
|
||||
|
||||
for( Int i = 0; i < subWindowList.size(); i++ )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow == subWindowList.at( i ) )
|
||||
subWindow = subWindowList.at( i );
|
||||
if( m_pcCurrentVideoSubWindow == subWindow )
|
||||
continue;
|
||||
else
|
||||
subWindowList.at( i )->adjustScrollBarByOffset( offset );
|
||||
{
|
||||
subWindow->adjustScrollBarByOffset( newOffset );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-11
@@ -49,8 +49,6 @@ static const QColor eraserColor = Qt::red;
|
||||
ViewArea::ViewArea( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setAttribute( Qt::WA_StaticContents );
|
||||
// setAttribute( Qt::WA_NoBackground );
|
||||
setMouseTracking( true );
|
||||
|
||||
m_pcCurrFrame = NULL;
|
||||
@@ -116,7 +114,18 @@ Double ViewArea::scaleZoomFactor( Double scale, QPoint center, QSize minimumSize
|
||||
Double maxZoom = 100.0;
|
||||
Double minZoom = 0.01; //( 1.0 / m_pixmap.width() );
|
||||
Double new_scale = 1.0;
|
||||
Double zoomFactor = m_zoomFactor * scale;
|
||||
|
||||
if( ( m_zoomFactor == minZoom ) && ( scale < 1 ) )
|
||||
return new_scale;
|
||||
|
||||
if( ( m_zoomFactor == maxZoom ) && ( scale > 1 ) )
|
||||
return new_scale;
|
||||
|
||||
Double zoomFactor = m_zoomFactor * scale * 100.0;
|
||||
zoomFactor=round(zoomFactor);
|
||||
zoomFactor=zoomFactor/100.0;
|
||||
scale = zoomFactor/m_zoomFactor;
|
||||
|
||||
|
||||
if(!minimumSize.isNull())
|
||||
{
|
||||
@@ -142,18 +151,13 @@ Double ViewArea::scaleZoomFactor( Double scale, QPoint center, QSize minimumSize
|
||||
else
|
||||
scale = hfactor;
|
||||
|
||||
zoomFactor = zoomFactor * scale;
|
||||
zoomFactor = zoomFactor * scale * 100.0;
|
||||
zoomFactor=round(zoomFactor);
|
||||
zoomFactor=zoomFactor/100.0;
|
||||
scale = zoomFactor/m_zoomFactor;
|
||||
}
|
||||
}
|
||||
|
||||
if( ( m_zoomFactor == minZoom ) && ( scale < 1 ) )
|
||||
return new_scale;
|
||||
|
||||
if( ( m_zoomFactor == maxZoom ) && ( scale > 1 ) )
|
||||
return new_scale;
|
||||
|
||||
|
||||
new_scale = scale;
|
||||
|
||||
if( zoomFactor < minZoom )
|
||||
@@ -331,6 +335,9 @@ void ViewArea::paintEvent( QPaintEvent *event )
|
||||
{
|
||||
QRect winRect = event->rect();
|
||||
|
||||
if(visibleRegion().isEmpty())
|
||||
return;
|
||||
|
||||
if( size().isEmpty() || m_pixmap.isNull() )
|
||||
return;
|
||||
|
||||
|
||||
@@ -779,6 +779,7 @@ Void plaYUVerApp::createToolBars()
|
||||
m_arrayToolBars[VIEW_TOOLBAR] = new QToolBar( tr( "View" ) );
|
||||
m_pcZoomFactorSBox = new QDoubleSpinBox;
|
||||
m_pcZoomFactorSBox->setRange( 1.0, 10000.0 );
|
||||
m_pcZoomFactorSBox->setDecimals(0);
|
||||
m_pcZoomFactorSBox->setSingleStep( 10.0 );
|
||||
m_pcZoomFactorSBox->setValue( 100.0 );
|
||||
m_pcZoomFactorSBox->setSuffix( "%" );
|
||||
|
||||
Reference in new issue
Block a user