From 1fd1e4b5f2418e3ac2909658993bfedb615537ec Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 6 May 2021 21:56:40 -0700 Subject: Change brace style to on new line, add initial deliveries view when an order entry is selected --- core/src/UI/UI_Items.cpp | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'core/src/UI/UI_Items.cpp') diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp index 624f942..8633c1f 100644 --- a/core/src/UI/UI_Items.cpp +++ b/core/src/UI/UI_Items.cpp @@ -10,7 +10,8 @@ namespace { -enum class ActionResult { +enum class ActionResult +{ Confirmed, Canceled, Pending, @@ -19,9 +20,16 @@ enum class ActionResult { /// \param list Item list that the item is in. /// \param item A non-null pointer to the currently being edited item. It should not change until this function returns a non-\c ActionResult::Pending value. template -ActionResult ItemEditor(ItemList& list, T* item) { - constexpr bool kHasDescription = requires(T t) { t.GetDescription(); }; - constexpr bool kHasEmail = requires(T t) { t.GetEmail(); }; +ActionResult ItemEditor(ItemList& list, T* item) +{ + constexpr bool kHasDescription = requires(T t) + { + t.GetDescription(); + }; + constexpr bool kHasEmail = requires(T t) + { + t.GetEmail(); + }; auto ls = LocaleStrings::Instance.get(); auto& uis = UIState::GetInstance(); @@ -88,11 +96,24 @@ ActionResult ItemEditor(ItemList& list, T* item) { } template -void ItemListEntries(ItemList& list, int& selectedIdx) { - constexpr bool kHasDescription = requires(T t) { t.GetDescription(); }; - constexpr bool kHasEmail = requires(T t) { t.GetEmail(); }; - constexpr bool kHasStock = requires(T t) { t.GetPrice(); }; - constexpr bool kHasPrice = requires(T t) { t.GetPrice(); }; +void ItemListEntries(ItemList& list, int& selectedIdx) +{ + constexpr bool kHasDescription = requires(T t) + { + t.GetDescription(); + }; + constexpr bool kHasEmail = requires(T t) + { + t.GetEmail(); + }; + constexpr bool kHasStock = requires(T t) + { + t.GetPrice(); + }; + constexpr bool kHasPrice = requires(T t) + { + t.GetPrice(); + }; constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice; auto ls = LocaleStrings::Instance.get(); @@ -148,7 +169,8 @@ void ItemListEntries(ItemList& list, int& selectedIdx) { } template -void ItemListEditor(ItemList& list) { +void ItemListEditor(ItemList& list) +{ auto ls = LocaleStrings::Instance.get(); bool opened = true; @@ -216,7 +238,8 @@ void ItemListEditor(ItemList& list) { } } // namespace -void UI::ItemsTab() { +void UI::ItemsTab() +{ auto ls = LocaleStrings::Instance.get(); auto& uis = UIState::GetInstance(); -- cgit v1.2.3-70-g09d2