refactor ClientArgs ClientScrollDirection to enum class use Members Normal and Inverted for names

This commit is contained in:
sithlord48
2025-07-08 09:41:24 -04:00
committed by Chris Rizzitello
parent 05e32497d1
commit 422b4c3a23
8 changed files with 12 additions and 12 deletions

View File

@ -87,7 +87,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
} else if (isArg(i, argc, argv, nullptr, "--sync-language")) {
args.m_enableLangSync = true;
} else if (isArg(i, argc, argv, nullptr, "--invert-scroll")) {
args.m_clientScrollDirection = deskflow::ClientScrollDirection::INVERT_SERVER;
args.m_clientScrollDirection = deskflow::ClientScrollDirection::Inverted;
} else if (isArg(i, argc, argv, nullptr, "client")) {
++i;
continue;

View File

@ -9,10 +9,10 @@
#include "ArgsBase.h"
namespace deskflow {
enum ClientScrollDirection
enum class ClientScrollDirection
{
SERVER = 1,
INVERT_SERVER = -1
Normal = 1, //!< Same direction as the server
Inverted = -1 //!< Inverted scroll direction from the server
};
class ClientArgs : public ArgsBase
@ -32,7 +32,7 @@ public:
* @brief m_clientScrollDirection
* This option is responcible for scroll direction on client side.
*/
ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::SERVER;
ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::Normal;
/**
* @brief m_serverAddress stores deskflow server address

View File

@ -86,5 +86,5 @@ void PlatformScreen::pollPressedKeys(KeyButtonSet &pressedKeys) const
int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const
{
return (x * m_clientScrollDirection);
return (x * static_cast<int>(m_clientScrollDirection));
}

View File

@ -22,7 +22,7 @@ class PlatformScreen : public IPlatformScreen
{
public:
PlatformScreen(
IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
);
~PlatformScreen() override = default;
@ -111,5 +111,5 @@ private:
* This member contains client scroll direction.
* This member is used only on client side.
*/
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER;
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::Normal;
};

View File

@ -32,7 +32,7 @@ class MSWindowsScreen : public PlatformScreen
public:
MSWindowsScreen(
bool isPrimary, bool noHooks, IEventQueue *events, bool enableLangSync = false,
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
);
~MSWindowsScreen() override;

View File

@ -46,7 +46,7 @@ class OSXScreen : public PlatformScreen
public:
OSXScreen(
IEventQueue *events, bool isPrimary, bool enableLangSync = false,
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
);
virtual ~OSXScreen();

View File

@ -29,7 +29,7 @@ class XWindowsScreen : public PlatformScreen
public:
XWindowsScreen(
const char *displayName, bool isPrimary, int mouseScrollDelta, IEventQueue *events,
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::Normal
);
~XWindowsScreen() override;

View File

@ -244,7 +244,7 @@ void ArgParserTests::client_setInvertScroll()
m_parser.parseClientArgs(clientArgs, argc, kLangCmd.data());
QCOMPARE(clientArgs.m_clientScrollDirection, deskflow::ClientScrollDirection::INVERT_SERVER);
QCOMPARE(clientArgs.m_clientScrollDirection, deskflow::ClientScrollDirection::Inverted);
}
void ArgParserTests::client_commonArgs()