refactor ClientArgs ClientScrollDirection to enum class use Members Normal and Inverted for names
This commit is contained in:
parent
05e32497d1
commit
422b4c3a23
8 changed files with 12 additions and 12 deletions
|
|
@ -87,7 +87,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
|
||||||
} else if (isArg(i, argc, argv, nullptr, "--sync-language")) {
|
} else if (isArg(i, argc, argv, nullptr, "--sync-language")) {
|
||||||
args.m_enableLangSync = true;
|
args.m_enableLangSync = true;
|
||||||
} else if (isArg(i, argc, argv, nullptr, "--invert-scroll")) {
|
} 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")) {
|
} else if (isArg(i, argc, argv, nullptr, "client")) {
|
||||||
++i;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
#include "ArgsBase.h"
|
#include "ArgsBase.h"
|
||||||
|
|
||||||
namespace deskflow {
|
namespace deskflow {
|
||||||
enum ClientScrollDirection
|
enum class ClientScrollDirection
|
||||||
{
|
{
|
||||||
SERVER = 1,
|
Normal = 1, //!< Same direction as the server
|
||||||
INVERT_SERVER = -1
|
Inverted = -1 //!< Inverted scroll direction from the server
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClientArgs : public ArgsBase
|
class ClientArgs : public ArgsBase
|
||||||
|
|
@ -32,7 +32,7 @@ public:
|
||||||
* @brief m_clientScrollDirection
|
* @brief m_clientScrollDirection
|
||||||
* This option is responcible for scroll direction on client side.
|
* 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
|
* @brief m_serverAddress stores deskflow server address
|
||||||
|
|
|
||||||
|
|
@ -86,5 +86,5 @@ void PlatformScreen::pollPressedKeys(KeyButtonSet &pressedKeys) const
|
||||||
|
|
||||||
int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const
|
int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const
|
||||||
{
|
{
|
||||||
return (x * m_clientScrollDirection);
|
return (x * static_cast<int>(m_clientScrollDirection));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class PlatformScreen : public IPlatformScreen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlatformScreen(
|
PlatformScreen(
|
||||||
IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
|
IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
|
||||||
);
|
);
|
||||||
~PlatformScreen() override = default;
|
~PlatformScreen() override = default;
|
||||||
|
|
||||||
|
|
@ -111,5 +111,5 @@ private:
|
||||||
* This member contains client scroll direction.
|
* This member contains client scroll direction.
|
||||||
* This member is used only on client side.
|
* This member is used only on client side.
|
||||||
*/
|
*/
|
||||||
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER;
|
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::Normal;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class MSWindowsScreen : public PlatformScreen
|
||||||
public:
|
public:
|
||||||
MSWindowsScreen(
|
MSWindowsScreen(
|
||||||
bool isPrimary, bool noHooks, IEventQueue *events, bool enableLangSync = false,
|
bool isPrimary, bool noHooks, IEventQueue *events, bool enableLangSync = false,
|
||||||
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
|
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
|
||||||
);
|
);
|
||||||
~MSWindowsScreen() override;
|
~MSWindowsScreen() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class OSXScreen : public PlatformScreen
|
||||||
public:
|
public:
|
||||||
OSXScreen(
|
OSXScreen(
|
||||||
IEventQueue *events, bool isPrimary, bool enableLangSync = false,
|
IEventQueue *events, bool isPrimary, bool enableLangSync = false,
|
||||||
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER
|
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~OSXScreen();
|
virtual ~OSXScreen();
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class XWindowsScreen : public PlatformScreen
|
||||||
public:
|
public:
|
||||||
XWindowsScreen(
|
XWindowsScreen(
|
||||||
const char *displayName, bool isPrimary, int mouseScrollDelta, IEventQueue *events,
|
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;
|
~XWindowsScreen() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ void ArgParserTests::client_setInvertScroll()
|
||||||
|
|
||||||
m_parser.parseClientArgs(clientArgs, argc, kLangCmd.data());
|
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()
|
void ArgParserTests::client_commonArgs()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue