From 80d8ae5a6fef6c9a34e81e240539cb655dd99851 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 14 Apr 2021 15:09:13 -0700 Subject: Initial work on workflows --- core/src/UI/Localization.hpp | 1 + core/src/UI/UI.hpp | 2 +- core/src/UI/UI_DatabaseView.cpp | 18 +++++++++++++----- core/src/UI/UI_Export.cpp | 9 --------- core/src/UI/UI_Items.cpp | 2 +- core/src/UI/UI_MainWindow.cpp | 5 +++++ core/src/UI/UI_Workflows.cpp | 9 +++++++++ 7 files changed, 30 insertions(+), 16 deletions(-) delete mode 100644 core/src/UI/UI_Export.cpp create mode 100644 core/src/UI/UI_Workflows.cpp (limited to 'core/src/UI') diff --git a/core/src/UI/Localization.hpp b/core/src/UI/Localization.hpp index f476458..3f09fb2 100644 --- a/core/src/UI/Localization.hpp +++ b/core/src/UI/Localization.hpp @@ -27,6 +27,7 @@ public: BasicTranslation ProjectTab{ "MainWindow.Tab.Project"sv }; BasicTranslation DatabaseViewTab{ "MainWindow.Tab.DatabaseView"sv }; BasicTranslation ItemsTab{ "MainWindow.Tab.Items"sv }; + BasicTranslation WorkflowsTab{ "MainWindow.Tab.Workflows"sv }; /* Project tab */ diff --git a/core/src/UI/UI.hpp b/core/src/UI/UI.hpp index ab35321..9e97118 100644 --- a/core/src/UI/UI.hpp +++ b/core/src/UI/UI.hpp @@ -27,6 +27,6 @@ void MainWindow(); void SettingsTab(); void DatabaseViewTab(); void ItemsTab(); -void ExportTab(); +void WorkflowsTab(); } // namespace UI diff --git a/core/src/UI/UI_DatabaseView.cpp b/core/src/UI/UI_DatabaseView.cpp index 8791c5b..884ab51 100644 --- a/core/src/UI/UI_DatabaseView.cpp +++ b/core/src/UI/UI_DatabaseView.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -196,7 +197,7 @@ private: void UpdateLastPage() { mLastPage = mActiveEntries.empty() - ? 0 + ? 0 // TODO calc page : CalcPageForRowId(mActiveEntries.back()); } @@ -258,10 +259,17 @@ private: return ""; } - auto t = static_cast(epoch); - std::string str(29, '\0'); - std::strftime(str.data(), 21, "%Y-%m-%dT%H:%M:%S.", std::localtime(&t)); - return str; + namespace chrono = std::chrono; + using Clock = chrono::system_clock; + + chrono::milliseconds d{ epoch }; + chrono::time_point tp{ d }; + auto t = chrono::system_clock::to_time_t(tp); + + char data[32]; + std::strftime(data, sizeof(data), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); + + return std::string(data); }; int customerCol = stmt.getColumnIndex("Customer"); diff --git a/core/src/UI/UI_Export.cpp b/core/src/UI/UI_Export.cpp deleted file mode 100644 index 06b49f5..0000000 --- a/core/src/UI/UI_Export.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "UI.hpp" - -#include "UI/Localization.hpp" - -#include - -void UI::ExportTab() { - // TODO -} diff --git a/core/src/UI/UI_Items.cpp b/core/src/UI/UI_Items.cpp index a094f76..56d6c2a 100644 --- a/core/src/UI/UI_Items.cpp +++ b/core/src/UI/UI_Items.cpp @@ -93,7 +93,7 @@ void ItemListEntries(ItemList& list, int& selectedIdx) { 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; + constexpr int kColumns = 1 /* Name column */ + kHasDescription + kHasEmail + kHasStock + kHasPrice; auto ls = LocaleStrings::Instance.get(); auto& uis = UIState::GetInstance(); diff --git a/core/src/UI/UI_MainWindow.cpp b/core/src/UI/UI_MainWindow.cpp index 30505d6..f1d1e5e 100644 --- a/core/src/UI/UI_MainWindow.cpp +++ b/core/src/UI/UI_MainWindow.cpp @@ -223,6 +223,11 @@ void UI::MainWindow() { ImGui::EndTabItem(); } + if (ImGui::BeginTabItem()) { + UI::WorkflowsTab(); + ImGui::EndTabItem(); + } + endTab: ImGui::EndTabBar(); } diff --git a/core/src/UI/UI_Workflows.cpp b/core/src/UI/UI_Workflows.cpp new file mode 100644 index 0000000..2b0368e --- /dev/null +++ b/core/src/UI/UI_Workflows.cpp @@ -0,0 +1,9 @@ +#include "UI.hpp" + +#include "UI/Localization.hpp" + +#include + +void UI::WorkflowsTab() { + // TODO +} -- cgit v1.2.3-70-g09d2