From aeb559efb89065f3a37b3ee46e0d3a6d8ad9e0f7 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Mon, 16 Oct 2023 00:04:29 +0200 Subject: [PATCH] code review --- client/widgets/RadialMenu.cpp | 14 +++++++------- client/widgets/RadialMenu.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/widgets/RadialMenu.cpp b/client/widgets/RadialMenu.cpp index 3ceef75e3..ea8743b91 100644 --- a/client/widgets/RadialMenu.cpp +++ b/client/widgets/RadialMenu.cpp @@ -21,14 +21,14 @@ #include "../../lib/CGeneralTextHandler.h" -RadialMenuItem::RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function & callback, bool altLayout) +RadialMenuItem::RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function & callback, bool alternativeLayout) : callback(callback) , hoverText(hoverText) { OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; - inactiveImage = std::make_shared(ImagePath::builtin(altLayout ? "radialMenu/itemInactiveAlt" : "radialMenu/itemInactive"), Point(0, 0)); - selectedImage = std::make_shared(ImagePath::builtin(altLayout ? "radialMenu/itemEmptyAlt" : "radialMenu/itemEmpty"), Point(0, 0)); + inactiveImage = std::make_shared(ImagePath::builtin(alternativeLayout ? "radialMenu/itemInactiveAlt" : "radialMenu/itemInactive"), Point(0, 0)); + selectedImage = std::make_shared(ImagePath::builtin(alternativeLayout ? "radialMenu/itemEmptyAlt" : "radialMenu/itemEmpty"), Point(0, 0)); iconImage = std::make_shared(ImagePath::builtin("radialMenu/" + imageName), Point(0, 0)); @@ -42,13 +42,13 @@ void RadialMenuItem::setSelected(bool selected) inactiveImage->setEnabled(!selected); } -RadialMenu::RadialMenu(const Point & positionToCenter, const std::vector & menuConfig, bool altLayout): - centerPosition(positionToCenter), altLayout(altLayout) +RadialMenu::RadialMenu(const Point & positionToCenter, const std::vector & menuConfig, bool alternativeLayout): + centerPosition(positionToCenter), alternativeLayout(alternativeLayout) { OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; pos += positionToCenter; - Point itemSize = altLayout ? Point(80, 70) : Point(70, 80); + Point itemSize = alternativeLayout ? Point(80, 70) : Point(70, 80); moveBy(-itemSize / 2); pos.w = itemSize.x; pos.h = itemSize.y; @@ -72,7 +72,7 @@ void RadialMenu::addItem(const Point & offset, bool enabled, const std::string & if (!enabled) return; - auto item = std::make_shared(path, CGI->generaltexth->translate(hoverText), callback, altLayout); + auto item = std::make_shared(path, CGI->generaltexth->translate(hoverText), callback, alternativeLayout); item->moveBy(offset); diff --git a/client/widgets/RadialMenu.h b/client/widgets/RadialMenu.h index 6129d84c3..1b8462fd9 100644 --- a/client/widgets/RadialMenu.h +++ b/client/widgets/RadialMenu.h @@ -51,7 +51,7 @@ class RadialMenuItem : public CIntObject std::string hoverText; public: - RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function & callback, bool altLayout); + RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function & callback, bool alternativeLayout); void setSelected(bool selected); }; @@ -68,9 +68,9 @@ class RadialMenu : public CIntObject std::shared_ptr findNearestItem(const Point & cursorPosition) const; - bool altLayout; + bool alternativeLayout; public: - RadialMenu(const Point & positionToCenter, const std::vector & menuConfig, bool altLayout = false); + RadialMenu(const Point & positionToCenter, const std::vector & menuConfig, bool alternativeLayout = false); void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) override; void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;