Commit 717ef429 authored by Torsten Rahn's avatar Torsten Rahn Committed by Torsten Rahn
Browse files

Patch by Sergey Alirzaev to disable mouse rotation.

Differential Revision: https://phabricator.kde.org/D26070
parent 26493d12
......@@ -194,6 +194,9 @@
<entry key="inertialEarthRotation" type="Bool" >
<default>true</default>
</entry>
<entry key="mouseViewRotation" type="Bool" >
<default>true</default>
</entry>
<entry key="animateTargetVoyage" type="Bool" >
<label>Display animation on voyage to target.</label>
<default>false</default>
......
......@@ -1609,6 +1609,7 @@ void MarblePart::updateSettings()
// External map editor
m_controlView->setExternalMapEditor( m_externalEditorMapping[MarbleSettings::externalMapEditor()] );
m_controlView->marbleWidget()->inputHandler()->setInertialEarthRotationEnabled( MarbleSettings::inertialEarthRotation() );
m_controlView->marbleWidget()->inputHandler()->setMouseViewRotationEnabled( MarbleSettings::mouseViewRotation() );
CloudSyncManager* cloudSyncManager = m_controlView->cloudSyncManager();
cloudSyncManager->setOwncloudCredentials( MarbleSettings::owncloudServer(),
......
......@@ -1494,6 +1494,7 @@ void MainWindow::updateSettings()
m_controlView->marbleWidget()->setAnimationsEnabled( m_configDialog->animateTargetVoyage() );
m_controlView->marbleWidget()->inputHandler()->setInertialEarthRotationEnabled( m_configDialog->inertialEarthRotation() );
m_controlView->marbleWidget()->inputHandler()->setMouseViewRotationEnabled( m_configDialog->mouseViewRotation() );
if ( !m_configDialog->externalMapEditor().isEmpty() ) {
m_controlView->setExternalMapEditor( m_configDialog->externalMapEditor() );
}
......
......@@ -61,5 +61,6 @@ public:
void initializeCustomTimezone ();
QLocale::MeasurementSystem measurementSystem () const;
bool inertialEarthRotation () const;
bool mouseViewRotation () const;
};
};
......@@ -48,6 +48,7 @@ public:
qreal m_wheelZoomTargetDistance;
bool m_panViaArrowsEnabled;
bool m_inertialEarthRotation;
bool m_mouseViewRotation;
int m_steps;
const int m_discreteZoomSteps = 120;
};
......@@ -60,6 +61,7 @@ MarbleInputHandler::Protected::Protected(MarbleAbstractPresenter *marblePresente
m_wheelZoomTargetDistance( 0.0 ),
m_panViaArrowsEnabled( true ),
m_inertialEarthRotation( true ),
m_mouseViewRotation( true ),
m_steps(0)
{
}
......@@ -127,6 +129,16 @@ bool MarbleInputHandler::inertialEarthRotationEnabled() const
return d->m_inertialEarthRotation;
}
void MarbleInputHandler::setMouseViewRotationEnabled(bool enabled)
{
d->m_mouseViewRotation = enabled;
}
bool MarbleInputHandler::mouseViewRotationEnabled() const
{
return d->m_mouseViewRotation;
}
void MarbleInputHandler::stopInertialEarthRotation()
{
}
......@@ -837,7 +849,7 @@ bool MarbleDefaultInputHandler::handleMouseEvent(QMouseEvent *event)
MarbleInputHandler::d->m_marblePresenter->setRadius(d->m_startingRadius * pow(1.005, dy));
}
if (d->m_rightPressed)
if (d->m_rightPressed && MarbleInputHandler::d->m_mouseViewRotation)
{
qreal centerX, centerY;
MarbleInputHandler::d->m_marblePresenter->map()->screenCoordinates(
......
......@@ -76,6 +76,10 @@ class MARBLE_EXPORT MarbleInputHandler : public QObject
*/
bool inertialEarthRotationEnabled() const;
void setMouseViewRotationEnabled( bool enabled );
bool mouseViewRotationEnabled() const;
/// should the map do kinetic scrolling, this would stop the operation
virtual void stopInertialEarthRotation();
......
......@@ -90,6 +90,16 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_mouseViewRotation">
<property name="toolTip">
<string>Use right mouse button to rotate the camera around</string>
</property>
<property name="text">
<string>&amp;Mouse view rotation</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -300,6 +300,7 @@ void QtMarbleConfigDialog::readSettings()
d->ui_navigationSettings.kcfg_dragLocation->setCurrentIndex( Marble::KeepAxisVertically );
d->ui_navigationSettings.kcfg_onStartup->setCurrentIndex( onStartup() );
d->ui_navigationSettings.kcfg_inertialEarthRotation->setChecked( inertialEarthRotation() );
d->ui_navigationSettings.kcfg_mouseViewRotation->setChecked( mouseViewRotation() );
d->ui_navigationSettings.kcfg_animateTargetVoyage->setChecked( animateTargetVoyage() );
int editorIndex = 0;
if (externalMapEditor() == QLatin1String("potlatch")) {
......@@ -393,6 +394,7 @@ void QtMarbleConfigDialog::writeSettings()
d->m_settings.beginGroup( "Navigation" );
d->m_settings.setValue( "onStartup", d->ui_navigationSettings.kcfg_onStartup->currentIndex() );
d->m_settings.setValue( "inertialEarthRotation", d->ui_navigationSettings.kcfg_inertialEarthRotation->isChecked() );
d->m_settings.setValue( "mouseViewRotation", d->ui_navigationSettings.kcfg_mouseViewRotation->isChecked() );
d->m_settings.setValue( "animateTargetVoyage", d->ui_navigationSettings.kcfg_animateTargetVoyage->isChecked() );
if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 0 ) {
d->m_settings.setValue( "externalMapEditor", "" );
......@@ -509,6 +511,11 @@ bool QtMarbleConfigDialog::inertialEarthRotation() const
return d->m_settings.value( "Navigation/inertialEarthRotation", true ).toBool();
}
bool QtMarbleConfigDialog::mouseViewRotation() const
{
return d->m_settings.value( "Navigation/mouseViewRotation", true ).toBool();
}
int QtMarbleConfigDialog::volatileTileCacheLimit() const
{
int defaultValue = (MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen) ? 6 : 100;
......
......@@ -48,6 +48,7 @@ class MARBLE_EXPORT QtMarbleConfigDialog : public QDialog
bool animateTargetVoyage() const;
QString externalMapEditor() const;
bool inertialEarthRotation() const;
bool mouseViewRotation() const;
// Cache Settings
int volatileTileCacheLimit() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment