mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps] Remove AppsContainerStorage::sharedContainer
Use AppsContainer::sharedAppsContainer instead. The AppsContainerStorage is initialised in AppsContainer.
This commit is contained in:
committed by
EmilieNumworks
parent
055d601854
commit
e9d098bacb
@@ -38,7 +38,7 @@ snapshots_count = $(words $(apps))
|
||||
snapshot_includes = $(foreach i,$(app_headers),-include $(i) )
|
||||
epsilon_app_names = '$(foreach i,${EPSILON_APPS},"$(i)", )'
|
||||
|
||||
$(call object_for,apps/apps_container_storage.cpp apps/main.cpp): CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_APPS_DECLARATION="$(apps_declaration)" -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names)
|
||||
$(call object_for,apps/apps_container_storage.cpp apps/apps_container.cpp): CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_APPS_DECLARATION="$(apps_declaration)" -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names)
|
||||
|
||||
# I18n file generation
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "apps_container.h"
|
||||
#include "apps_container_storage.h"
|
||||
#include "global_preferences.h"
|
||||
#include <ion.h>
|
||||
#include <poincare/init.h>
|
||||
@@ -52,6 +53,11 @@ static KDColor sPromptColors[] = {
|
||||
|
||||
#endif
|
||||
|
||||
AppsContainer * AppsContainer::sharedAppsContainer() {
|
||||
static AppsContainerStorage appsContainerStorage;
|
||||
return &appsContainerStorage;
|
||||
}
|
||||
|
||||
AppsContainer::AppsContainer() :
|
||||
Container(),
|
||||
m_window(),
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
|
||||
class AppsContainer : public Container, ExamPopUpControllerDelegate, Ion::StorageDelegate {
|
||||
public:
|
||||
static AppsContainer * sharedAppsContainer() {
|
||||
return static_cast<AppsContainer *>(Container::sharedContainer());
|
||||
}
|
||||
static AppsContainer * sharedAppsContainer();
|
||||
AppsContainer();
|
||||
static bool poincareCircuitBreaker();
|
||||
virtual int numberOfApps() = 0;
|
||||
|
||||
@@ -14,11 +14,6 @@
|
||||
|
||||
constexpr int k_numberOfCommonApps = 1+APPS_CONTAINER_SNAPSHOT_COUNT; // Take the Home app into account
|
||||
|
||||
AppsContainerStorage * AppsContainerStorage::sharedContainer() {
|
||||
static AppsContainerStorage appsContainerStorage;
|
||||
return &appsContainerStorage;
|
||||
}
|
||||
|
||||
AppsContainerStorage::AppsContainerStorage() :
|
||||
AppsContainer()
|
||||
APPS_CONTAINER_SNAPSHOT_CONSTRUCTORS
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
class AppsContainerStorage : public AppsContainer {
|
||||
public:
|
||||
static AppsContainerStorage * sharedContainer();
|
||||
AppsContainerStorage();
|
||||
int numberOfApps() override;
|
||||
App::Snapshot * appSnapshotAtIndex(int index) override;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "apps_container_storage.h"
|
||||
#include "apps_container.h"
|
||||
#include "global_preferences.h"
|
||||
#include <poincare/init.h>
|
||||
|
||||
@@ -32,8 +32,8 @@ void ion_main(int argc, char * argv[]) {
|
||||
* $ ./epsilon.elf --code-script hello_world.py:print("hello") --code-lock-on-console
|
||||
*/
|
||||
const char * appNames[] = {"home", EPSILON_APPS_NAMES};
|
||||
for (int j = 0; j < AppsContainerStorage::sharedContainer()->numberOfApps(); j++) {
|
||||
App::Snapshot * snapshot = AppsContainerStorage::sharedContainer()->appSnapshotAtIndex(j);
|
||||
for (int j = 0; j < AppsContainer::sharedAppsContainer()->numberOfApps(); j++) {
|
||||
App::Snapshot * snapshot = AppsContainer::sharedAppsContainer()->appSnapshotAtIndex(j);
|
||||
int cmp = strcmp(argv[i]+2, appNames[j]);
|
||||
if (cmp == '-') {
|
||||
snapshot->setOpt(argv[i]+2+strlen(appNames[j])+1, argv[i+1]);
|
||||
@@ -42,5 +42,5 @@ void ion_main(int argc, char * argv[]) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
AppsContainerStorage::sharedContainer()->run();
|
||||
AppsContainer::sharedAppsContainer()->run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user