void ControllerWrapper::getBatteryStatus() { #ifdef Q_OS_SYMBIAN d_ptr->getBatteryStatus(); #elif defined(_SIMULATOR_STUB) emit batteryStatus(50); #endif }
void chargingScreen(void) { char first = 1; menu.push(); while(button.get() != FL_KEY && battery_status() > 0) { wdt_reset(); batteryStatus(0, first); first = 0; } menu.back(); }
int lockScreen() { lockscreenBg = sf2d_create_texture_mem_RGBA8(lockscreen_img.pixel_data, lockscreen_img.width, lockscreen_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); time_t unixTime = time(NULL); struct tm* timeStruct = gmtime((const time_t *)&unixTime); int hours = timeStruct->tm_hour; int minutes = timeStruct->tm_min; int day = timeStruct->tm_mday; sf2d_set_clear_color(RGBA8(0, 0, 0, 0)); while (1) { hidScanInput(); u32 kDown = hidKeysDown(); sf2d_start_frame(GFX_TOP, GFX_LEFT); sf2d_draw_texture(background, 0, 0); sf2d_draw_texture(lockscreenBg, 0, 0); sftd_draw_textf(roboto, 142, 20, RGBA8(255, 255, 255, 255), 34, "0%2d : %02d", hours, minutes); sftd_draw_textf(roboto, 140, 80, RGBA8(255, 255, 255, 255), 10, "Monday"); sftd_draw_textf(roboto, 200, 80, RGBA8(255, 255, 255, 255), 10, "%d", day); sftd_draw_textf(roboto, 220, 80, RGBA8(255, 255, 255, 255), 10, "October"); digitalTime(350, 2); batteryStatus(316, 2); cursorController(); sf2d_end_frame(); if ((touch.px >= 160 && touch.px <= 235 && touch.py >= 210 && touch.py <= 240) && (kDown & KEY_A)) { sf2d_free_texture(lockscreenBg); return 1; } sf2d_swapbuffers(); } sf2d_free_texture(lockscreenBg); return 0; }
void BatteryWatcher::update() { int c = left_; int status = status_; batteryStatus(c, status); // qDebug("voltage %d current %d status %d", voltage_, c, status); if (c != left_ || status != status_ || status & BATTERY_STATUS_DANGEROUS) { left_ = c; status_ = status; emit batteryChangedSignal(left_, status_); } }
int aboutMenu() { aboutBg = sf2d_create_texture_mem_RGBA8(about_img.pixel_data, about_img.width, about_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); highlight = sf2d_create_texture_mem_RGBA8(highlight_img.pixel_data, highlight_img.width, highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); sf2d_set_clear_color(RGBA8(0, 0, 0, 0)); while (aptMainLoop()) { hidScanInput(); u32 kDown = hidKeysDown(); sf2d_start_frame(GFX_TOP, GFX_LEFT); sf2d_draw_texture(aboutBg, 0, 0); sftd_draw_textf(roboto, 20, 68, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsAbout[language][0]); sftd_draw_textf(roboto, 20, 83, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsAbout[language][1]); sftd_draw_textf(roboto, 20, 116, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsAbout[language][2]); //sftd_draw_textf(roboto, 20, 132, RGBA8(0, 0, 0, 255), 12, "Model = NULL"); sftd_draw_textf(roboto, 20, 168, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsAbout[language][5]); //sftd_draw_textf(roboto, 20, 183, RGBA8(0, 0, 0, 255), 12, "NinjaHax version: NULL"); if (touch.px >= 0 && touch.px <= 480 && touch.py >= 58 && touch.py <= 105) { sf2d_draw_texture(highlight, 0, 56); sftd_draw_textf(roboto, 20, 68, RGBA8(0, 0, 0, 255), 12, "Cyanogen3DS Updates"); sftd_draw_textf(roboto, 20, 83, RGBA8(0, 0, 0, 255), 12, "Click for, view or isntall available updates"); } else if (touch.px >= 0 && touch.px <= 480 && touch.py >= 106 && touch.py <= 157) { sf2d_draw_texture(highlight, 0, 105); sftd_draw_textf(roboto, 20, 116, RGBA8(0, 0, 0, 255), 12, "Cyanogen3DS version: 0.01-20151019-UNOFFICIAL"); sftd_draw_textf(roboto, 20, 132, RGBA8(0, 0, 0, 255), 12, "Model = NULL"); } digitalTime(350, 2); batteryStatus(316, 2); androidQuickSettings(); cursorController(); sf2d_end_frame(); navbarControls(1); if (kDown & KEY_Y) powerMenu(); if (kDown & KEY_L) lockScreen(); if (kDown & KEY_B) { sf2d_free_texture(aboutBg); sf2d_free_texture(highlight); settingsMenu(); } if ((touch.px >= 44 && touch.px <= 119 && touch.py >= 201 && touch.py <= 240) && (kDown & KEY_A)) { sf2d_free_texture(aboutBg); sf2d_free_texture(highlight); settingsMenu(); } else if ((touch.px >= 120 && touch.px <= 195 && touch.py >= 201 && touch.py <= 240) && (kDown & KEY_A)) { sf2d_free_texture(aboutBg); sf2d_free_texture(highlight); home(); } sf2d_swapbuffers(); } sf2d_free_texture(aboutBg); sf2d_free_texture(highlight); return 0; }
int settingsMenu() { settingsBg = sf2d_create_texture_mem_RGBA8(settings_img.pixel_data, settings_img.width, settings_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); about_highlight = sf2d_create_texture_mem_RGBA8(about_highlight_img.pixel_data, about_highlight_img.width, about_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); display_highlight = sf2d_create_texture_mem_RGBA8(display_highlight_img.pixel_data, display_highlight_img.width, display_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); developeroptions_highlight = sf2d_create_texture_mem_RGBA8(developeroptions_highlight_img.pixel_data, developeroptions_highlight_img.width, developeroptions_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); performance_highlight = sf2d_create_texture_mem_RGBA8(performance_highlight_img.pixel_data, performance_highlight_img.width, performance_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); security_highlight = sf2d_create_texture_mem_RGBA8(security_highlight_img.pixel_data, security_highlight_img.width, security_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); wifi_highlight = sf2d_create_texture_mem_RGBA8(wifi_highlight_img.pixel_data, wifi_highlight_img.width, wifi_highlight_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); sf2d_set_clear_color(RGBA8(0, 0, 0, 0)); while (aptMainLoop()) { hidScanInput(); u32 kDown = hidKeysDown(); sf2d_start_frame(GFX_TOP, GFX_LEFT); sf2d_draw_texture(settingsBg, 0, 0); sftd_draw_textf(roboto, 48, 106, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][0]); sftd_draw_textf(roboto, 48, 153, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][1]); sftd_draw_textf(roboto, 48, 202, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][2]); sftd_draw_textf(roboto, 250, 106, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][3]); sftd_draw_textf(roboto, 250, 153, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][4]); sftd_draw_textf(roboto, 250, 202, RGBA8(0, 0, 0, 255), 12, "%s", lang_settingsMain[language][5]); settingsHighlight(); digitalTime(350, 2); batteryStatus(316, 2); androidQuickSettings(); cursorController(); sf2d_end_frame(); navbarControls(1); if (kDown & KEY_Y) powerMenu(); if (kDown & KEY_L) lockScreen(); if (kDown & KEY_B) { settingsUnload(); appDrawer(); } if ((touch.px >= 44 && touch.px <= 119 && touch.py >= 201 && touch.py <= 240) && (kDown & KEY_A)) { settingsUnload(); appDrawer(); } else if ((touch.px >= 120 && touch.px <= 195 && touch.py >= 201 && touch.py <= 240) && (kDown & KEY_A)) { settingsUnload(); home(); } sf2d_swapbuffers(); } settingsUnload(); return 0; }
int home() { sf2d_set_clear_color(RGBA8(0, 0, 0, 0)); ic_allapps_pressed = sf2d_create_texture_mem_RGBA8(ic_allapps_pressed_img.pixel_data, ic_allapps_pressed_img.width, ic_allapps_pressed_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); ic_launcher_browser = sf2d_create_texture_mem_RGBA8(ic_launcher_browser_img.pixel_data, ic_launcher_browser_img.width, ic_launcher_browser_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); ic_launcher_messenger = sf2d_create_texture_mem_RGBA8(ic_launcher_messenger_img.pixel_data, ic_launcher_messenger_img.width, ic_launcher_messenger_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); ic_launcher_apollo = sf2d_create_texture_mem_RGBA8(ic_launcher_apollo_img.pixel_data, ic_launcher_apollo_img.width, ic_launcher_apollo_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); ic_launcher_settings = sf2d_create_texture_mem_RGBA8(ic_launcher_settings_img.pixel_data, ic_launcher_settings_img.width, ic_launcher_settings_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM); // Main loop while (aptMainLoop()) { //Scan all the inputs. This should be done once for each frame hidScanInput(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kDown = hidKeysDown(); //hidKeysUp returns information about which buttons have been just released //u32 kUp = hidKeysUp(); sf2d_start_frame(GFX_TOP, GFX_LEFT); sf2d_draw_texture(background, 0, 0); sf2d_draw_texture(ic_launcher_browser, 49, 145); sf2d_draw_texture(ic_launcher_messenger, 114, 145); sf2d_draw_texture(ic_launcher_apollo, 241, 145); sf2d_draw_texture(ic_launcher_settings, 306, 145); appDrawerIcon(); dayNightWidget(); navbarControls(0); //Displays navbar digitalTime(350, 2); //Displays digital time batteryStatus(316, 2); //Displays battery status cursorController(); sf2d_end_frame(); if ((touch.px >= 170 && touch.px <= 210 && touch.py >= 148 && touch.py <= 190) && (kDown & KEY_A)) { sf2d_free_texture(ic_allapps_pressed); appDrawer(); //Open app drawer } if ((touch.px >= 306 && touch.px <= 351 && touch.py >= 145 && touch.py <= 190) && (kDown & KEY_A)) { sf2d_free_texture(ic_allapps_pressed); settingsMenu(); //Open settings menu } if (kDown & KEY_Y) powerMenu(); //Open power menu if (kDown & KEY_L) lockScreen(); //Locks the screen // Flush and swap framebuffers sf2d_swapbuffers(); } sf2d_free_texture(ic_allapps_pressed); return 0; }