diff --git a/apps/Makefile b/apps/Makefile index f66a8a5de..c6aeb8504 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -30,6 +30,8 @@ app_objs += $(addprefix apps/,\ variable_box_leaf_cell.o\ ) +app_images += apps/exam_icon.png + # Tracking which source file uses which image is painful. But we need to ensure # that a .png file has been inlined before building any source file that uses # said image (because it will expect the ".h" file to be there). diff --git a/apps/exam_icon.png b/apps/exam_icon.png new file mode 100644 index 000000000..e168f55bd Binary files /dev/null and b/apps/exam_icon.png differ diff --git a/apps/exam_pop_up_controller.cpp b/apps/exam_pop_up_controller.cpp index b66c280f6..6889faed1 100644 --- a/apps/exam_pop_up_controller.cpp +++ b/apps/exam_pop_up_controller.cpp @@ -58,6 +58,7 @@ ExamPopUpController::ContentView::ContentView(Responder * parentResponder) : } else { Ion::LED::setColor(KDColorBlack); } + container->refreshPreferences(); container->activeApp()->dismissModalViewController(); }, parentResponder), KDText::FontSize::Small)), m_warningTextView(MessageTextView(KDText::FontSize::Small, I18n::Message::Warning, 0.5, 0.5, KDColorWhite, KDColorBlack)), diff --git a/apps/title_bar_view.cpp b/apps/title_bar_view.cpp index 7aec661d5..e2010b3a7 100644 --- a/apps/title_bar_view.cpp +++ b/apps/title_bar_view.cpp @@ -1,4 +1,6 @@ #include "title_bar_view.h" +#include "exam_icon.h" +#include "global_preferences.h" extern "C" { #include } @@ -11,6 +13,7 @@ TitleBarView::TitleBarView() : m_titleView(KDText::FontSize::Small, I18n::Message::Default, 0.5f, 0.5f, KDColorWhite, Palette::YellowDark), m_preferenceView(KDText::FontSize::Small, 1.0f, 0.5, KDColorWhite, Palette::YellowDark) { + m_examModeIconView.setImage(ImageStore::ExamIcon); } void TitleBarView::setTitle(I18n::Message title) { @@ -26,7 +29,7 @@ bool TitleBarView::setIsCharging(bool isCharging) { } int TitleBarView::numberOfSubviews() const { - return 3; + return 4; } View * TitleBarView::subviewAtIndex(int index) { @@ -36,6 +39,9 @@ View * TitleBarView::subviewAtIndex(int index) { if (index == 1) { return &m_preferenceView; } + if (index == 2) { + return &m_examModeIconView; + } return &m_batteryView; } @@ -44,6 +50,11 @@ void TitleBarView::layoutSubviews() { m_preferenceView.setFrame(KDRect(0, 0, m_preferenceView.minimalSizeForOptimalDisplay())); KDSize batterySize = m_batteryView.minimalSizeForOptimalDisplay(); m_batteryView.setFrame(KDRect(bounds().width() - batterySize.width() - k_batteryLeftMargin, (bounds().height()- batterySize.height())/2, batterySize)); + if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) { + m_examModeIconView.setFrame(KDRect(k_examIconMargin, (bounds().height() - k_examIconHeight)/2, k_examIconWidth, k_examIconHeight)); + } else { + m_examModeIconView.setFrame(KDRectZero); + } } void TitleBarView::refreshPreferences() { @@ -62,5 +73,6 @@ void TitleBarView::refreshPreferences() { } buffer[numberOfChar] = 0; m_preferenceView.setText(buffer); + // Layout the exam mode icon if needed layoutSubviews(); } diff --git a/apps/title_bar_view.h b/apps/title_bar_view.h index b56cca6f3..21ea060f8 100644 --- a/apps/title_bar_view.h +++ b/apps/title_bar_view.h @@ -14,12 +14,16 @@ public: void refreshPreferences(); private: constexpr static KDCoordinate k_batteryLeftMargin = 5; + constexpr static KDCoordinate k_examIconWidth = 18; + constexpr static KDCoordinate k_examIconHeight = 9; + constexpr static KDCoordinate k_examIconMargin = 93; int numberOfSubviews() const override; void layoutSubviews() override; View * subviewAtIndex(int index) override; MessageTextView m_titleView; BatteryView m_batteryView; BufferTextView m_preferenceView; + ImageView m_examModeIconView; }; #endif