Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/MarbleInputHandler.cpp
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 121 | { | |||
---|---|---|---|---|---|
122 | d->m_inertialEarthRotation = enabled; | 122 | d->m_inertialEarthRotation = enabled; | ||
123 | } | 123 | } | ||
124 | 124 | | |||
125 | bool MarbleInputHandler::inertialEarthRotationEnabled() const | 125 | bool MarbleInputHandler::inertialEarthRotationEnabled() const | ||
126 | { | 126 | { | ||
127 | return d->m_inertialEarthRotation; | 127 | return d->m_inertialEarthRotation; | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | void MarbleInputHandler::stopInertialEarthRotation() | ||||
131 | { | ||||
132 | } | ||||
133 | | ||||
130 | class Q_DECL_HIDDEN MarbleDefaultInputHandler::Private | 134 | class Q_DECL_HIDDEN MarbleDefaultInputHandler::Private | ||
131 | { | 135 | { | ||
132 | public: | 136 | public: | ||
133 | Private(); | 137 | Private(); | ||
134 | ~Private(); | 138 | ~Private(); | ||
135 | 139 | | |||
136 | QPixmap m_curpmtl; | 140 | QPixmap m_curpmtl; | ||
137 | QPixmap m_curpmtc; | 141 | QPixmap m_curpmtc; | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 227 | { | |||
243 | connect(&d->m_pressAndHoldTimer, SIGNAL(timeout()), this, SLOT(handlePressAndHold())); | 247 | connect(&d->m_pressAndHoldTimer, SIGNAL(timeout()), this, SLOT(handlePressAndHold())); | ||
244 | } | 248 | } | ||
245 | 249 | | |||
246 | MarbleDefaultInputHandler::~MarbleDefaultInputHandler() | 250 | MarbleDefaultInputHandler::~MarbleDefaultInputHandler() | ||
247 | { | 251 | { | ||
248 | delete d; | 252 | delete d; | ||
249 | } | 253 | } | ||
250 | 254 | | |||
255 | void MarbleDefaultInputHandler::stopInertialEarthRotation() | ||||
256 | { | ||||
257 | d->m_kineticSpinning.stop(); | ||||
258 | } | ||||
259 | | ||||
251 | void MarbleDefaultInputHandler::lmbTimeout() | 260 | void MarbleDefaultInputHandler::lmbTimeout() | ||
252 | { | 261 | { | ||
253 | if (!selectionRubber()->isVisible()) | 262 | if (!selectionRubber()->isVisible()) | ||
254 | { | 263 | { | ||
255 | qreal clickedLon = 0; | 264 | qreal clickedLon = 0; | ||
256 | qreal clickedLat = 0; | 265 | qreal clickedLat = 0; | ||
257 | 266 | | |||
258 | bool isPointOnGlobe = MarbleInputHandler::d->m_marblePresenter->map()->geoCoordinates( d->m_leftPressedX, d->m_leftPressedY, | 267 | bool isPointOnGlobe = MarbleInputHandler::d->m_marblePresenter->map()->geoCoordinates( d->m_leftPressedX, d->m_leftPressedY, | ||
▲ Show 20 Lines • Show All 665 Lines • ▼ Show 20 Line(s) | |||||
924 | 933 | | |||
925 | bool MarbleDefaultInputHandler::handleKeyPress(QKeyEvent* event) | 934 | bool MarbleDefaultInputHandler::handleKeyPress(QKeyEvent* event) | ||
926 | { | 935 | { | ||
927 | if ( event->type() == QEvent::KeyPress ) { | 936 | if ( event->type() == QEvent::KeyPress ) { | ||
928 | MarbleAbstractPresenter *marblePresenter = MarbleInputHandler::d->m_marblePresenter; | 937 | MarbleAbstractPresenter *marblePresenter = MarbleInputHandler::d->m_marblePresenter; | ||
929 | bool handled = true; | 938 | bool handled = true; | ||
930 | switch ( event->key() ) { | 939 | switch ( event->key() ) { | ||
931 | case Qt::Key_Left: | 940 | case Qt::Key_Left: | ||
941 | stopInertialEarthRotation(); | ||||
932 | marblePresenter->moveByStep(-1, 0); | 942 | marblePresenter->moveByStep(-1, 0); | ||
933 | break; | 943 | break; | ||
934 | case Qt::Key_Right: | 944 | case Qt::Key_Right: | ||
945 | stopInertialEarthRotation(); | ||||
935 | marblePresenter->moveByStep(1, 0); | 946 | marblePresenter->moveByStep(1, 0); | ||
936 | break; | 947 | break; | ||
937 | case Qt::Key_Up: | 948 | case Qt::Key_Up: | ||
949 | stopInertialEarthRotation(); | ||||
938 | marblePresenter->moveByStep(0, -1); | 950 | marblePresenter->moveByStep(0, -1); | ||
939 | break; | 951 | break; | ||
940 | case Qt::Key_Down: | 952 | case Qt::Key_Down: | ||
953 | stopInertialEarthRotation(); | ||||
941 | marblePresenter->moveByStep(0, 1); | 954 | marblePresenter->moveByStep(0, 1); | ||
942 | break; | 955 | break; | ||
943 | case Qt::Key_Plus: | 956 | case Qt::Key_Plus: | ||
944 | if (event->modifiers() != Qt::ControlModifier) { | 957 | if (event->modifiers() != Qt::ControlModifier) { | ||
958 | stopInertialEarthRotation(); | ||||
945 | marblePresenter->zoomIn(); | 959 | marblePresenter->zoomIn(); | ||
946 | } | 960 | } | ||
947 | break; | 961 | break; | ||
948 | case Qt::Key_Minus: | 962 | case Qt::Key_Minus: | ||
949 | if (event->modifiers() != Qt::ControlModifier) { | 963 | if (event->modifiers() != Qt::ControlModifier) { | ||
964 | stopInertialEarthRotation(); | ||||
950 | marblePresenter->zoomOut(); | 965 | marblePresenter->zoomOut(); | ||
951 | } | 966 | } | ||
952 | break; | 967 | break; | ||
953 | case Qt::Key_Home: | 968 | case Qt::Key_Home: | ||
969 | stopInertialEarthRotation(); | ||||
954 | marblePresenter->goHome(); | 970 | marblePresenter->goHome(); | ||
955 | break; | 971 | break; | ||
956 | default: | 972 | default: | ||
957 | handled = false; | 973 | handled = false; | ||
958 | break; | 974 | break; | ||
959 | } | 975 | } | ||
960 | 976 | | |||
961 | return handled; | 977 | return handled; | ||
Show All 33 Lines |