From 4fe9964e5a44d419e22e005f512cab358098bfef Mon Sep 17 00:00:00 2001 From: stojce Date: Mon, 28 Oct 2013 18:19:31 +0100 Subject: [PATCH] reset view - reset icon - resetView signal --- interface/resources/images/reset.png | Bin 0 -> 1355 bytes interface/src/Application.cpp | 4 +++- interface/src/Application.h | 2 +- interface/src/ui/RearMirrorTools.cpp | 15 +++++++++++---- interface/src/ui/RearMirrorTools.h | 3 ++- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 interface/resources/images/reset.png diff --git a/interface/resources/images/reset.png b/interface/resources/images/reset.png new file mode 100644 index 0000000000000000000000000000000000000000..30735e9ed9fc3c342b8934ea6c9267498b73377a GIT binary patch literal 1355 zcmeAS@N?(olHy`uVBq!ia0y~yV31{CV36TpV_;yIdw$C*1_lPs0*}aI1_o|n5N2eU zHAjMhf$?f)NJL45ua8x7ey(0(N`6wRUPW#J0|?kuSXJZ}^~=l4^~#O)@{7{-4J|D#^$m>ljf`}QQqpvbEAvVcD|GXUl_7?}%yCIAPA4$as*bm2-Y> zK~ZXPab|v=ov962C5jlr9*FvYjQo=P+|-hy%w*5JlGLJtqSTT^kn8M>pt^CZKsU?3 zC^Iz=s@o8%8(9ph-bNqfaioBNgfdt($i>Z$%SIm_Wp-S-tlaY$7?@=|T^vI^c%O!y z%@%ePnSWNzceb1JDpt`cK_?Ezd{K&12?!|qr1C{%A;+tQO-n?a>^!8BrIZ{UPad3H z@1QrSSzLcF$Ic3_dqPY<4>@})Y-oG7`d`}HHJfjHZrXaGn|t>6XWyUgy}!rYIA2*- zR(9g&I-Tdf9zXxd2ff}u#ayoczGSc4b`{T8H*&V+ce*@!p83dQxvj^=j4#49W)3SH z`W%+&=;~H(+rC|N^O5CBy+@PIAA9`K-MPR^=k`a1$NLVd$;`6zIGIw!r|QeS=){R% z*AomX6gO}xUS4we;fIw+lV*y$I?j}>DBobP{6yXnpNUF0Y)<`>YP`DO^y$+_o_`jc zetPNAW?#2$io7!x%}`pp)Hy)9SNXINCtGt$Zf4p1&)s+P zI;QoMzxn=~Wd~Q}+OVR6f&;Tx<~5%`?4k0=RO&{A_=LugG^3f`8rQv7aNGEOjas|R ziOET{eZK7V*K@4|{`jbbim0ZYne;P!b?8@vi$VSsDLJQYzr5J3w0nXG`$Mid^W^1w zgzLUm&0TPDvfJXqL&q4oEmGunY+T0WxiR1KjKHlG>e||qqfGWTIeD6YZ2a&#(J{f~ z>+2IA4ApM+PX1YFH~;##X~!#N3+GhaXP#UUGsRa*`^r02`b>=O%(*;u|2tnvE{}IOv%S^H(c8tn>sy(; zT>b6di+?L(bi}T%b9w*r-o1M*kyaHOWAyH)b-a7eWfbF@`F6q?y(vqBI^Vp1KRIl* zYt`O)1$_LMgj;j2-t#R~&g3ln_4WG08ir-zTB6I&P4Rf7w9n1{hD&T^d3m}0;SW&{?H`7*zFZ*xM4|&e=*PLPB8ThWBbMQ&7ckj`ESrRq9W5O36mt`^a%nH(O U0^9g(ltIOvr>mdKI;Vst09tV;<^TWy literal 0 HcmV?d00001 diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 36ffa179bb..0ac8a74827 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -685,7 +685,6 @@ void Application::keyPressEvent(QKeyEvent* event) { case Qt::Key_Space: resetSensors(); - _audio.reset(); break; case Qt::Key_G: @@ -1724,6 +1723,7 @@ void Application::init() { connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); + connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); } void Application::closeMirrorView() { @@ -3777,6 +3777,8 @@ void Application::resetSensors() { _myTransmitter.resetLevels(); _myAvatar.setVelocity(glm::vec3(0,0,0)); _myAvatar.setThrust(glm::vec3(0,0,0)); + + _audio.reset(); } static void setShortcutsEnabled(QWidget* widget, bool enabled) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 50ea7aa9e0..531ff1813b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -201,6 +201,7 @@ private slots: void closeMirrorView(); void restoreMirrorView(); void shrinkMirrorView(); + void resetSensors(); private: void resetCamerasOnResizeGL(Camera& camera, int width, int height); @@ -241,7 +242,6 @@ private: bool maybeEditVoxelUnderCursor(); void deleteVoxelUnderCursor(); void eyedropperVoxelUnderCursor(); - void resetSensors(); void injectVoxelAddedSoundEffect(); void setMenuShortcutsEnabled(bool enabled); diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index cc18a40e12..302c58d8a3 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -15,32 +15,39 @@ const int ICON_PADDING = 5; RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) : _parent(parent), _bounds(bounds), _windowed(false), _fullScreen(false) { switchToResourcesParentIfRequired(); _closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); - _shrinkTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); + _resetTextureId = _parent->bindTexture(QImage("./resources/images/reset.png")); }; void RearMirrorTools::render(bool fullScreen) { if (fullScreen) { _fullScreen = true; - displayIcon(_parent->geometry(), ICON_PADDING, ICON_PADDING, _shrinkTextureId); + displayIcon(_parent->geometry(), ICON_PADDING, ICON_PADDING, _closeTextureId); } else { // render rear view tools if mouse is in the bounds QPoint mousePosition = _parent->mapFromGlobal(QCursor::pos()); _windowed = _bounds.contains(mousePosition.x(), mousePosition.y()); if (_windowed) { - displayIcon(_bounds, _bounds.left() + ICON_PADDING, ICON_PADDING, _closeTextureId); + displayIcon(_bounds, _bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, _closeTextureId); + displayIcon(_bounds, _bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, _resetTextureId); } } } bool RearMirrorTools::mousePressEvent(int x, int y) { if (_windowed) { - QRect closeIconRect = QRect(ICON_PADDING + _bounds.left(), ICON_PADDING + _bounds.top(), ICON_SIZE, ICON_SIZE); + QRect closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); if (closeIconRect.contains(x, y)) { _windowed = false; emit closeView(); return true; } + QRect resetIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); + if (resetIconRect.contains(x, y)) { + emit resetView(); + return true; + } + if (_bounds.contains(x, y)) { _windowed = false; emit restoreView(); diff --git a/interface/src/ui/RearMirrorTools.h b/interface/src/ui/RearMirrorTools.h index 77c8b88f3a..b62731c8b2 100644 --- a/interface/src/ui/RearMirrorTools.h +++ b/interface/src/ui/RearMirrorTools.h @@ -23,13 +23,14 @@ public: signals: void closeView(); void shrinkView(); + void resetView(); void restoreView(); private: QGLWidget* _parent; QRect _bounds; GLuint _closeTextureId; - GLuint _shrinkTextureId; + GLuint _resetTextureId; bool _windowed; bool _fullScreen;