Revert "[apps] Add Shift + Ans shortcut to go to the last application"

This commit is contained in:
Laury
2022-05-02 18:55:46 +02:00
parent 2be1a6e5a9
commit 0e0dc4a9c2
5 changed files with 0 additions and 44 deletions

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -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