Convert keyboardinput from class to regular header
No consistent state is needed so it doesn't make sense for it to be a class.
This commit is contained in:
@@ -36,44 +36,44 @@ void UtilitiesTabController::initStage2( OverlayController* var_parent,
|
||||
|
||||
void UtilitiesTabController::sendKeyboardInput( QString input )
|
||||
{
|
||||
keyboardInput.sendKeyboardInput( input );
|
||||
keyboardinput::sendKeyboardInput( input );
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardEnter()
|
||||
{
|
||||
keyboardInput.sendKeyboardEnter();
|
||||
keyboardinput::sendKeyboardEnter();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardAltEnter()
|
||||
{
|
||||
keyboardInput.sendKeyboardAltEnter();
|
||||
keyboardinput::sendKeyboardAltEnter();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardAltTab()
|
||||
{
|
||||
keyboardInput.sendKeyboardAltTab();
|
||||
keyboardinput::sendKeyboardAltTab();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardBackspace( const int count )
|
||||
{
|
||||
keyboardInput.sendKeyboardBackspace( count );
|
||||
keyboardinput::sendKeyboardBackspace( count );
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendMediaNextSong()
|
||||
{
|
||||
keyboardInput.sendMediaNextSong();
|
||||
keyboardinput::sendMediaNextSong();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaPreviousSong()
|
||||
{
|
||||
keyboardInput.sendMediaPreviousSong();
|
||||
keyboardinput::sendMediaPreviousSong();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaPausePlay()
|
||||
{
|
||||
keyboardInput.sendMediaPausePlay();
|
||||
keyboardinput::sendMediaPausePlay();
|
||||
}
|
||||
void UtilitiesTabController::sendMediaStopSong()
|
||||
{
|
||||
keyboardInput.sendMediaStopSong();
|
||||
keyboardinput::sendMediaStopSong();
|
||||
}
|
||||
|
||||
bool UtilitiesTabController::alarmEnabled() const
|
||||
|
||||
@@ -46,12 +46,6 @@ private:
|
||||
int m_batteryState[vr::k_unMaxTrackedDeviceCount];
|
||||
bool m_batteryVisible[vr::k_unMaxTrackedDeviceCount];
|
||||
|
||||
#ifdef WIN32
|
||||
KeyboardInputWindows keyboardInput;
|
||||
#else
|
||||
KeyboardInputDummy keyboardInput;
|
||||
#endif
|
||||
|
||||
public:
|
||||
void initStage1();
|
||||
void initStage2( OverlayController* var_parent, QQuickWindow* var_widget );
|
||||
|
||||
@@ -4,53 +4,53 @@
|
||||
// parameter. The cast is to get GCC to shut up about it.
|
||||
#define UNREFERENCED_PARAMETER( P ) static_cast<void>( ( P ) )
|
||||
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
void KeyboardInputDummy::sendKeyboardInput( QString input )
|
||||
void sendKeyboardInput( QString input )
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER( input );
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardEnter()
|
||||
void sendKeyboardEnter()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardBackspace( const int count )
|
||||
void sendKeyboardBackspace( const int count )
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER( count );
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardAltTab()
|
||||
void sendKeyboardAltTab()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardAltEnter()
|
||||
void sendKeyboardAltEnter()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaNextSong()
|
||||
void sendMediaNextSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaPreviousSong()
|
||||
void sendMediaPreviousSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaPausePlay()
|
||||
void sendMediaPausePlay()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendMediaStopSong()
|
||||
void sendMediaStopSong()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
} // namespace keyboardinput
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
#ifndef KEYBOARDINPUTDUMMY_H
|
||||
#define KEYBOARDINPUTDUMMY_H
|
||||
#pragma once
|
||||
|
||||
#include "KeyboardInput.h"
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
class KeyboardInputDummy
|
||||
{
|
||||
public:
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendMediaNextSong();
|
||||
void sendMediaPreviousSong();
|
||||
void sendMediaPausePlay();
|
||||
void sendMediaStopSong();
|
||||
};
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendMediaNextSong();
|
||||
void sendMediaPreviousSong();
|
||||
void sendMediaPausePlay();
|
||||
void sendMediaStopSong();
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
#endif // KEYBOARDINPUTDUMMY_H
|
||||
} // namespace keyboardinput
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <Windows.h>
|
||||
#include "easylogging++.h"
|
||||
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
/*!
|
||||
Represents the state of a keyboard button press. Can be either Up or Down.
|
||||
@@ -127,7 +127,7 @@ void sendKeyPressAndRelease( const WORD virtualKeyCode )
|
||||
sendKeyboardInputRaw( numberOfActions, actions );
|
||||
}
|
||||
|
||||
void KeyboardInputWindows::sendKeyboardInput( QString input )
|
||||
void sendKeyboardInput( QString input )
|
||||
{
|
||||
int len = input.length();
|
||||
if ( len > 0 )
|
||||
@@ -202,7 +202,7 @@ void KeyboardInputWindows::sendKeyboardInput( QString input )
|
||||
/*!
|
||||
Sends a single Enter keypress to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardEnter()
|
||||
void sendKeyboardEnter()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_RETURN );
|
||||
}
|
||||
@@ -211,7 +211,7 @@ void KeyboardInputWindows::sendKeyboardEnter()
|
||||
Sends count amount of backspaces to Windows. count of 0 or below will do
|
||||
nothing.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardBackspace( const int count )
|
||||
void sendKeyboardBackspace( const int count )
|
||||
{
|
||||
// We can only send a positive amount of key presses.
|
||||
if ( count <= 0 )
|
||||
@@ -232,7 +232,7 @@ Used for tabbing out of game windows blocking other programs on desktop while in
|
||||
VR. At least one use case was tabbing out of a fullscreen game to be able to use
|
||||
a music player.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardAltTab()
|
||||
void sendKeyboardAltTab()
|
||||
{
|
||||
constexpr auto altKey = VK_MENU;
|
||||
constexpr auto tabKey = VK_TAB;
|
||||
@@ -256,7 +256,7 @@ Sends an Alt + Tab combination to Windows.
|
||||
Used for toggling full screen on games and various applications that appear on
|
||||
the desktop.
|
||||
*/
|
||||
void KeyboardInputWindows::sendKeyboardAltEnter()
|
||||
void sendKeyboardAltEnter()
|
||||
{
|
||||
constexpr auto altKey = VK_MENU;
|
||||
constexpr auto enterKey = VK_RETURN;
|
||||
@@ -277,7 +277,7 @@ void KeyboardInputWindows::sendKeyboardAltEnter()
|
||||
/*!
|
||||
Sends a media key Next Song button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaNextSong()
|
||||
void sendMediaNextSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_NEXT_TRACK );
|
||||
}
|
||||
@@ -285,7 +285,7 @@ void KeyboardInputWindows::sendMediaNextSong()
|
||||
/*!
|
||||
Sends a media key Previous Song button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaPreviousSong()
|
||||
void sendMediaPreviousSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_PREV_TRACK );
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void KeyboardInputWindows::sendMediaPreviousSong()
|
||||
/*!
|
||||
Sends a media key Play/Pause button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaPausePlay()
|
||||
void sendMediaPausePlay()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_PLAY_PAUSE );
|
||||
}
|
||||
@@ -301,9 +301,9 @@ void KeyboardInputWindows::sendMediaPausePlay()
|
||||
/*!
|
||||
Sends a media key Stop button to Windows.
|
||||
*/
|
||||
void KeyboardInputWindows::sendMediaStopSong()
|
||||
void sendMediaStopSong()
|
||||
{
|
||||
sendKeyPressAndRelease( VK_MEDIA_STOP );
|
||||
}
|
||||
|
||||
} // namespace advsettings
|
||||
} // namespace keyboardinput
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
#ifndef KEYBOARDINPUTWINDOWS_H
|
||||
#define KEYBOARDINPUTWINDOWS_H
|
||||
#pragma once
|
||||
|
||||
#include "KeyboardInput.h"
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
// application namespace
|
||||
namespace advsettings
|
||||
namespace keyboardinput
|
||||
{
|
||||
class KeyboardInputWindows
|
||||
{
|
||||
public:
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendMediaNextSong();
|
||||
void sendMediaPreviousSong();
|
||||
void sendMediaPausePlay();
|
||||
void sendMediaStopSong();
|
||||
};
|
||||
void sendKeyboardInput( QString input );
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardBackspace( const int count );
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardAltEnter();
|
||||
void sendMediaNextSong();
|
||||
void sendMediaPreviousSong();
|
||||
void sendMediaPausePlay();
|
||||
void sendMediaStopSong();
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
#endif // KEYBOARDINPUTWINDOWS_H
|
||||
} // namespace keyboardinput
|
||||
|
||||
Reference in New Issue
Block a user