[apps] Remove USBTimer.

Change-Id: Ibe2f49149ce144f9fd5476d0cc69a97406171ef1
This commit is contained in:
Léa Saviot
2018-04-04 14:43:45 +02:00
parent de25105f4a
commit 29df2e0acd
5 changed files with 2 additions and 63 deletions

View File

@@ -29,7 +29,6 @@ app_objs += $(addprefix apps/,\
shift_alpha_lock_view.o\
suspend_timer.o\
title_bar_view.o\
usb_timer.o\
variable_box_controller.o\
variable_box_leaf_cell.o\
)

View File

@@ -18,7 +18,6 @@ AppsContainer::AppsContainer() :
m_updateController(),
m_ledTimer(LedTimer()),
m_batteryTimer(BatteryTimer(this)),
m_USBTimer(USBTimer(this)),
m_suspendTimer(SuspendTimer(this)),
m_backlightDimmingTimer(),
m_homeSnapshot(),
@@ -211,11 +210,11 @@ Window * AppsContainer::window() {
}
int AppsContainer::numberOfContainerTimers() {
return 4+(GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate);
return 3+(GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate);
}
Timer * AppsContainer::containerTimerAtIndex(int i) {
Timer * timers[5] = {&m_batteryTimer, &m_USBTimer, &m_suspendTimer, &m_backlightDimmingTimer, &m_ledTimer};
Timer * timers[4] = {&m_batteryTimer, &m_suspendTimer, &m_backlightDimmingTimer, &m_ledTimer};
return timers[i];
}

View File

@@ -13,7 +13,6 @@
#include "exam_pop_up_controller.h"
#include "led_timer.h"
#include "battery_timer.h"
#include "usb_timer.h"
#include "suspend_timer.h"
#include "backlight_dimming_timer.h"
@@ -69,7 +68,6 @@ private:
OnBoarding::UpdateController m_updateController;
LedTimer m_ledTimer;
BatteryTimer m_batteryTimer;
USBTimer m_USBTimer;
SuspendTimer m_suspendTimer;
BacklightDimmingTimer m_backlightDimmingTimer;
Home::App::Snapshot m_homeSnapshot;

View File

@@ -1,39 +0,0 @@
#include "usb_timer.h"
#include "global_preferences.h"
#include "apps_container.h"
USBTimer::USBTimer(AppsContainer * container) :
Timer(1),
m_container(container),
m_previousPluggedState(false)
{
}
bool USBTimer::fire() {
bool needRedrawing = false;
if (Ion::USB::isPlugged()) {
if (!m_previousPluggedState) {
Ion::USB::removeSoftDisconnect();
}
if (!m_previousPluggedState && GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) {
m_container->displayExamModePopUp(false);
needRedrawing = true;
}
#if LED_WHILE_CHARGING
KDColor LEDColor = Ion::Battery::isCharging() ? KDColorYellow : KDColorGreen;
Ion::LED::setColor(LEDColor);
#endif
if (!m_previousPluggedState) {
Ion::Backlight::setBrightness(Ion::Backlight::MaxBrightness);
}
m_previousPluggedState = true;
} else {
if (m_previousPluggedState) {
#if LED_WHILE_CHARGING
Ion::LED::setColor(KDColorBlack);
#endif
m_previousPluggedState = false;
}
}
return needRedrawing;
}

View File

@@ -1,18 +0,0 @@
#ifndef APPS_USB_TIMER_H
#define APPS_USB_TIMER_H
#include <escher.h>
class AppsContainer;
class USBTimer : public Timer {
public:
USBTimer(AppsContainer * container);
private:
bool fire() override;
AppsContainer * m_container;
bool m_previousPluggedState;
};
#endif