diff options
author | rtk0c <[email protected]> | 2021-04-14 15:09:13 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-04-14 15:09:13 -0700 |
commit | 80d8ae5a6fef6c9a34e81e240539cb655dd99851 (patch) | |
tree | 062bb1590eaf030b75aae75acecc5706e16d9b0c /core/src/UI | |
parent | 568fcc1dfe40c37b57b7baa2dea93b291d3fa956 (diff) |
Initial work on workflows
Diffstat (limited to 'core/src/UI')
-rw-r--r-- | core/src/UI/Localization.hpp | 1 | ||||
-rw-r--r-- | core/src/UI/UI.hpp | 2 | ||||
-rw-r--r-- | core/src/UI/UI_DatabaseView.cpp | 18 | ||||
-rw-r--r-- | core/src/UI/UI_Items.cpp | 2 | ||||
-rw-r--r-- | core/src/UI/UI_MainWindow.cpp | 5 | ||||
-rw-r--r-- | core/src/UI/UI_Workflows.cpp (renamed from core/src/UI/UI_Export.cpp) | 2 |
6 files changed, 22 insertions, 8 deletions
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 <IconsFontAwesome.h> #include <SQLiteCpp/Statement.h> #include <imgui.h> +#include <chrono> #include <cstdint> #include <ctime> #include <memory> @@ -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<time_t>(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<chrono::system_clock> 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_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<T>& 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_Export.cpp b/core/src/UI/UI_Workflows.cpp index 06b49f5..2b0368e 100644 --- a/core/src/UI/UI_Export.cpp +++ b/core/src/UI/UI_Workflows.cpp @@ -4,6 +4,6 @@ #include <imgui.h> -void UI::ExportTab() { +void UI::WorkflowsTab() { // TODO } |