mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 08:41:01 +01:00
[usb | recovery] Make the code works
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
#include <apps/i18n.h>
|
||||
#include "../global_preferences.h"
|
||||
|
||||
namespace USB
|
||||
{
|
||||
static constexpr I18n::Message sUSBConnectedMessages[k_numberOfUSBMessages] = {
|
||||
namespace USB {
|
||||
|
||||
static constexpr I18n::Message sUSBConnectedMessages[] = {
|
||||
I18n::Message::USBConnected,
|
||||
I18n::Message::ConnectedMessage1,
|
||||
I18n::Message::ConnectedMessage2,
|
||||
@@ -33,35 +33,35 @@ USBConnectedController::USBConnectedController() :
|
||||
|
||||
}
|
||||
|
||||
USBConnectedController::ContentView::ContentView(KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) {
|
||||
USBConnectedController::ContentView::ContentView() {
|
||||
// We set the styles of the messages
|
||||
for (uint8_t i = 0; i < k_numberOfMessages; i++) {
|
||||
m_messageTextViews[i].setFont(i == 0 ? KDFont::LargeFont : KDFont::SmallFont);
|
||||
m_messageTextViews[i].setAlignment(0.5f, 0.5f);
|
||||
m_messageTextViews[i].setTextColor(fgcolors[i]);
|
||||
m_messageTextViews[i].setTextColor(sUSBConnectedFGColors[i]);
|
||||
m_messageTextViews[i].setBackgroundColor(Palette::BackgroundHard);
|
||||
}
|
||||
|
||||
// We set the texts of the firsts defaults messages
|
||||
for (uint8_t i = 0; i < k_numberOfUSBMessages; i++) {
|
||||
m_messageTextViews[i].setText(sUSBConnectedMessages[i]);
|
||||
m_messageTextViews[i].setText(I18n::translate(sUSBConnectedMessages[i]));
|
||||
}
|
||||
|
||||
// Last message, depending of the USB protection level
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->dfuStatus()) {
|
||||
m_messageTextViews[i].setText(DfuStatusUnprotected);
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->dfuUnlocked()) {
|
||||
m_messageTextViews[k_numberOfUSBMessages].setText(I18n::translate(I18n::Message::DfuStatusUnprotected));
|
||||
} else {
|
||||
int protectionLevel = GlobalPreferences::sharedGlobalPreferences()->getDfuLevel();
|
||||
int protectionLevel = GlobalPreferences::sharedGlobalPreferences()->dfuLevel();
|
||||
switch (protectionLevel) {
|
||||
case 0:
|
||||
m_messageTextViews[9].setText(USBProtectionLevel0);
|
||||
m_messageTextViews[9].setText(I18n::translate(I18n::Message::USBProtectionLevel0));
|
||||
break;
|
||||
case 1:
|
||||
m_messageTextViews[9].setText(USBProtectionLevel1);
|
||||
m_messageTextViews[9].setText(I18n::translate(I18n::Message::USBProtectionLevel1));
|
||||
break;
|
||||
default:
|
||||
assert(protectionLevel == 2);
|
||||
m_messageTextViews[9].setText(USBProtectionLevel2);
|
||||
m_messageTextViews[9].setText(I18n::translate(I18n::Message::USBProtectionLevel2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user