diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 2ed9c7e79..f464b07c1 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -220,7 +220,6 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) { return didProcessEvent || alphaLockWantsRedraw; } -// List of keys that are used to switch between apps, in order of app to go (eg. 0 : First App, 1 : Second App, 2 : Third App, ...) static constexpr Ion::Events::Event switch_events[] = { Ion::Events::ShiftSeven, Ion::Events::ShiftEight, Ion::Events::ShiftNine, Ion::Events::ShiftFour, Ion::Events::ShiftFive, Ion::Events::ShiftSix, @@ -232,17 +231,14 @@ bool AppsContainer::processEvent(Ion::Events::Event event) { // Warning: if the window is dirtied, you need to call window()->redraw() if (event == Ion::Events::USBPlug) { if (Ion::USB::isPlugged()) { - // If the exam mode is enabled, we ask to disable it, else, we enable USB if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) { displayExamModePopUp(GlobalPreferences::ExamMode::Off); window()->redraw(); } else { Ion::USB::enable(); } - // Update brightness when USB is plugged Ion::Backlight::setBrightness(GlobalPreferences::sharedGlobalPreferences()->brightnessLevel()); } else { - // If the USB isn't plugged in USBPlug event, we disable USB Ion::USB::disable(); } return true; @@ -273,38 +269,20 @@ bool AppsContainer::processEvent(Ion::Events::Event event) { return true; } - // Add Shift + Ans shortcut to go to the previous app - if (event == Ion::Events::ShiftAns) { - switchTo(appSnapshotAtIndex(m_lastAppIndex)); - return true; - } - - // If the event is the OnOff key, we suspend the calculator. if (event == Ion::Events::OnOff) { suspend(true); return true; } - // If the event is a brightness event, we update the brightness according to the event. if (event == Ion::Events::BrightnessPlus || event == Ion::Events::BrightnessMinus) { int delta = Ion::Backlight::MaxBrightness/GlobalPreferences::NumberOfBrightnessStates; int NumberOfStepsPerShortcut = GlobalPreferences::sharedGlobalPreferences()->brightnessShortcut(); int direction = (event == Ion::Events::BrightnessPlus) ? NumberOfStepsPerShortcut*delta : -delta*NumberOfStepsPerShortcut; GlobalPreferences::sharedGlobalPreferences()->setBrightnessLevel(GlobalPreferences::sharedGlobalPreferences()->brightnessLevel()+direction); } - // Else, the event was not processed. return false; } bool AppsContainer::switchTo(App::Snapshot * snapshot) { - // Get app index of the snapshot - int m_appIndexToSwitch = appIndexFromSnapshot(snapshot); - // If the app is home, skip app index saving - if (m_appIndexToSwitch != 0) { - // Save last app index - m_lastAppIndex = m_currentAppIndex; - // Save current app index - m_currentAppIndex = m_appIndexToSwitch; - } if (s_activeApp && snapshot != s_activeApp->snapshot()) { resetShiftAlphaStatus(); } diff --git a/apps/apps_container.h b/apps/apps_container.h index 07a642aee..f52d50b6c 100644 --- a/apps/apps_container.h +++ b/apps/apps_container.h @@ -28,7 +28,6 @@ public: static bool poincareCircuitBreaker(); virtual int numberOfApps() = 0; virtual App::Snapshot * appSnapshotAtIndex(int index) = 0; - virtual int appIndexFromSnapshot(App::Snapshot * snapshot) = 0; App::Snapshot * initialAppSnapshot(); App::Snapshot * hardwareTestAppSnapshot(); App::Snapshot * onBoardingAppSnapshot(); @@ -70,8 +69,6 @@ private: static KDColor k_promptFGColors[]; static KDColor k_promptBGColors[]; static int k_promptNumberOfMessages; - int m_currentAppIndex; // Home isn't included after the second app switching - int m_lastAppIndex; AppsWindow m_window; EmptyBatteryWindow m_emptyBatteryWindow; Shared::GlobalContext m_globalContext; diff --git a/apps/apps_container_storage.cpp b/apps/apps_container_storage.cpp index ad2dec619..2ef60aafa 100644 --- a/apps/apps_container_storage.cpp +++ b/apps/apps_container_storage.cpp @@ -36,20 +36,3 @@ App::Snapshot * AppsContainerStorage::appSnapshotAtIndex(int index) { assert(index >= 0 && index < k_numberOfCommonApps); return snapshots[index]; } - -// Get the index of the app from its snapshot -int AppsContainerStorage::appIndexFromSnapshot(App::Snapshot * snapshot) { - App::Snapshot * snapshots[] = { - homeAppSnapshot() - APPS_CONTAINER_SNAPSHOT_LIST - }; - assert(sizeof(snapshots)/sizeof(snapshots[0]) == k_numberOfCommonApps); - for (int i = 0; i < k_numberOfCommonApps; i++) { - if (snapshots[i] == snapshot) { - return i; - } - } - // Achievement unlock : how did you get here ? - assert(false); - return NULL; -} diff --git a/apps/apps_container_storage.h b/apps/apps_container_storage.h index c3191a751..9abd3c27a 100644 --- a/apps/apps_container_storage.h +++ b/apps/apps_container_storage.h @@ -12,7 +12,6 @@ public: AppsContainerStorage(); int numberOfApps() override; App::Snapshot * appSnapshotAtIndex(int index) override; - int appIndexFromSnapshot(App::Snapshot * snapshot) override; void * currentAppBuffer() override { return &m_apps; }; private: union Apps { diff --git a/ion/include/ion/events.h b/ion/include/ion/events.h index e7ae2feb2..51c8da397 100644 --- a/ion/include/ion/events.h +++ b/ion/include/ion/events.h @@ -185,7 +185,6 @@ constexpr Event ShiftSeven = Event::ShiftKey(Keyboard::Key::Seven); constexpr Event ShiftEight = Event::ShiftKey(Keyboard::Key::Eight); constexpr Event ShiftNine = Event::ShiftKey(Keyboard::Key::Nine); -constexpr Event ShiftAns = Event::ShiftKey(Keyboard::Key::Ans); constexpr Event ShiftEXE = Event::ShiftKey(Keyboard::Key::EXE); // Alpha