Squash of branch setup

This commit is contained in:
GW_MC
2026-01-27 19:15:44 +08:00
parent 64fe528abc
commit 3ce135a028
66 changed files with 10798 additions and 0 deletions

39
main/ui/app_registry.h Normal file
View File

@@ -0,0 +1,39 @@
#pragma once
#include "ui/ui_app.h"
#include <vector>
/**
* @brief Registry for all available apps
*
* This singleton class maintains a list of all registered
* AppDescriptor instances, allowing the UIHandler or other
* components to query available apps.
*/
class AppRegistry {
public:
static AppRegistry& instance() {
static AppRegistry registry;
return registry;
}
AppRegistry(const AppRegistry&) = delete;
void operator=(const AppRegistry&) = delete;
AppRegistry(AppRegistry&&) = delete;
void operator=(AppRegistry&&) = delete;
// Register a new app descriptor
// The registry takes ownership of the descriptor pointer.
void register_app(AppDescriptor* app_descriptor) {
_app_descriptors.push_back(app_descriptor);
}
const std::vector<AppDescriptor*>& get_app_descriptors() const {
return _app_descriptors;
}
private:
AppRegistry() = default;
~AppRegistry() = default;
std::vector<AppDescriptor*> _app_descriptors = {};
};