Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

Commit

Permalink
In qt version mouse is now set to auto-hide after 3 seconds of no mov…
Browse files Browse the repository at this point in the history
…ement

git-svn-id: svn+ssh://svn.code.sf.net/p/yabause/code/trunk@3243 d7be59e3-070e-4b9a-85a1-4646befae34d
  • Loading branch information
cyberwarriorx authored and clobber committed Nov 25, 2014
1 parent 34334e6 commit 1e9fd82
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
33 changes: 25 additions & 8 deletions yabause/src/qt/ui/UIYabause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ UIYabause::UIYabause( QWidget* parent )
mLogDock->setVisible( false );
// create emulator thread
mYabauseThread = new YabauseThread( this );
// create hide mouse timer
hideMouseTimer = new QTimer();
// connectionsdd
connect( mYabauseThread, SIGNAL( requestSize( const QSize& ) ), this, SLOT( sizeRequested( const QSize& ) ) );
connect( mYabauseThread, SIGNAL( requestFullscreen( bool ) ), this, SLOT( fullscreenRequested( bool ) ) );
Expand All @@ -119,6 +121,7 @@ UIYabause::UIYabause( QWidget* parent )
connect( mYabauseThread, SIGNAL( error( const QString&, bool ) ), this, SLOT( errorReceived( const QString&, bool ) ) );
connect( mYabauseThread, SIGNAL( pause( bool ) ), this, SLOT( pause( bool ) ) );
connect( mYabauseThread, SIGNAL( reset() ), this, SLOT( reset() ) );
connect( hideMouseTimer, SIGNAL( timeout() ), this, SLOT( hideMouse() ));

// Load shortcuts
VolatileSettings* vs = QtYabause::volatileSettings();
Expand Down Expand Up @@ -202,18 +205,30 @@ void UIYabause::mouseReleaseEvent( QMouseEvent* e )
PerKeyUp( (1 << 31) | e->button() );
}

void UIYabause::hideMouse()
{
this->setCursor(Qt::BlankCursor);
hideMouseTimer->stop();
}

void UIYabause::mouseMoveEvent( QMouseEvent* e )
{
PerAxisMove((1 << 30), e->x()-oldMouseX, oldMouseY-e->y());
oldMouseX = e->x();
oldMouseY = e->y();
VolatileSettings* vs = QtYabause::volatileSettings();
if (isFullScreen() && vs->value( "View/Menubar" ).toInt() == BD_SHOWONFSHOVER )
if (isFullScreen())
{
if (e->y() < showMenuBarHeight)
menubar->show();
else
menubar->hide();
if (vs->value( "View/Menubar" ).toInt() == BD_SHOWONFSHOVER)
{
if (e->y() < showMenuBarHeight)
menubar->show();
else
menubar->hide();
}

hideMouseTimer->start(3 * 1000);
this->setCursor(Qt::ArrowCursor);
}
}

Expand Down Expand Up @@ -702,10 +717,12 @@ void UIYabause::on_aFileQuit_triggered()
void UIYabause::on_aEmulationRun_triggered()
{
if ( mYabauseThread->emulationPaused() )
{
{
mYabauseThread->pauseEmulation( false, false );
refreshStatesActions();
}
refreshStatesActions();
if (isFullScreen())
hideMouseTimer->start(3 * 1000);
}
}

void UIYabause::on_aEmulationPause_triggered()
Expand Down
3 changes: 3 additions & 0 deletions yabause/src/qt/ui/UIYabause.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "ui_UIYabause.h"
#include "../YabauseThread.h"
#include "UICheatSearch.h"
#include <QTimer>

extern "C" {
#include "../screen.h"
Expand Down Expand Up @@ -88,6 +89,7 @@ class UIYabause : public QMainWindow, public Ui::UIYabause
QList <supportedRes_struct> supportedResolutions;
int oldMouseX, oldMouseY;
int showMenuBarHeight;
QTimer* hideMouseTimer;
QList <translation_struct> translations;
virtual void showEvent( QShowEvent* event );
virtual void closeEvent( QCloseEvent* event );
Expand All @@ -101,6 +103,7 @@ public slots:
void appendLog( const char* msg );
void pause( bool paused );
void reset();
void hideMouse();

void breakpointHandlerMSH2(bool displayMessage);
void breakpointHandlerSSH2(bool displayMessage);
Expand Down

0 comments on commit 1e9fd82

Please sign in to comment.