-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: changed manager public function and callback
moved view ownership, improved ui structure: improved `UiBridge` `ViewManager` `BasicView` added `UiUtility` removed useless public function in slint BREAKING CHANGE:
- Loading branch information
Showing
31 changed files
with
419 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <Controller/Core/UiUtility.h> | ||
#include <set> | ||
#include <spdlog/spdlog.h> | ||
|
||
EVENTO_UI_START | ||
|
||
std::string UiUtility::getViewName(ViewName target) { | ||
return viewNameMapper.find(target) == viewNameMapper.end() ? "[Unknown View]" | ||
: viewNameMapper.at(target); | ||
} | ||
|
||
bool UiUtility::isTransparent(ViewName target) { | ||
static const std::set<ViewName> overlayList{ViewName::MenuOverlay, ViewName::LoginOverlay}; | ||
return overlayList.find(target) != overlayList.end(); | ||
} | ||
|
||
void UiUtility::StylishLog::viewActionTriggered(std::string origin, | ||
std::string actionName, | ||
std::string viewName) { | ||
spdlog::debug("{}: {}: triggered {}", origin, viewName, actionName); | ||
} | ||
|
||
void UiUtility::StylishLog::viewVisibilityChanged(std::string origin, | ||
std::string actionName, | ||
std::string viewName) { | ||
// TODO: better log | ||
spdlog::debug("{}: {} visibility changed: {}", origin, viewName, actionName); | ||
} | ||
|
||
EVENTO_UI_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <Controller/Core/BasicView.h> | ||
#include <Controller/Core/UiBase.h> | ||
|
||
EVENTO_UI_START | ||
|
||
class UiUtility { | ||
public: | ||
static std::string getViewName(ViewName target); | ||
static bool isTransparent(ViewName target); | ||
|
||
class StylishLog { | ||
public: | ||
static void viewActionTriggered(std::string origin, | ||
std::string actionName, | ||
std::string viewName = std::string("All-View")); | ||
static void viewVisibilityChanged(std::string origin, | ||
std::string actionName, | ||
std::string viewName); | ||
}; | ||
|
||
private: | ||
static inline const std::unordered_map<ViewName, std::string> viewNameMapper{ | ||
{ViewName::DiscoveryPage, "DiscoveryPage"}, | ||
{ViewName::SearchPage, "SearchPage"}, | ||
{ViewName::HistoryPage, "HistoryPage"}, | ||
{ViewName::MyEventPage, "MyEventPage"}, | ||
{ViewName::DetailPage, "DetailPage"}, | ||
{ViewName::AboutPage, "AboutPage"}, | ||
{ViewName::SettingPage, "SettingPage"}, | ||
{ViewName::LoginOverlay, "LoginOverlay"}, | ||
{ViewName::MenuOverlay, "MenuOverlay"}, | ||
}; | ||
}; | ||
|
||
EVENTO_UI_END |
Oops, something went wrong.