From 326a9634e1e06d6046b2c4a4c249898ebd8f1618 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 18 Jun 2017 00:04:40 +0200 Subject: [PATCH] CMenuSeparator: clean up multiple code parts --- src/gui/widget/menue.cpp | 14 ++++++++------ src/gui/widget/menue.h | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 768daf514..be765c30c 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -2231,18 +2231,20 @@ int CMenuForwarder::paint(bool selected) //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, bool IsStatic) : CMenuItem(false, CRCInput::RC_nokey, NULL, NULL, IsStatic) { - type = Type; - name = Text; - nameString = ""; + init(Type, Text, ""); } CMenuSeparator::CMenuSeparator(const int Type, const std::string &Text, bool IsStatic) : CMenuItem(false, CRCInput::RC_nokey, NULL, NULL, IsStatic) { - type = Type; - name = NONEXISTANT_LOCALE; - nameString = Text; + init(Type, NONEXISTANT_LOCALE, Text); } +void CMenuSeparator::init(const int& Type, const neutrino_locale_t& lText, const std::string &sText) +{ + type = Type; + name = lText; + nameString = sText; +} int CMenuSeparator::getHeight(void) { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 464be99f4..3b47f51de 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -202,6 +202,9 @@ class CMenuItem : public CComponentsSignals class CMenuSeparator : public CMenuItem { int type; + void init( const int& Type, + const neutrino_locale_t& lText, + const std::string& sText); public: