Ejemplo n.º 1
0
void
SystemWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  AddButton("Reboot", *this, REBOOT);
  AddButton(IsKoboOTGKernel() ? "Disable USB-OTG" : "Enable USB-OTG",
            *this, SWITCH_KERNEL);

  AddButton("Export USB storage", *this, USB_STORAGE);
  SetRowEnabled(USB_STORAGE, !IsKoboOTGKernel());
}
Ejemplo n.º 2
0
void
SystemWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  AddButton("Reboot", *this, REBOOT);
  AddButton(IsKoboOTGKernel() ? "Disable USB-OTG" : "Enable USB-OTG",
            *this, SWITCH_KERNEL);
}
Ejemplo n.º 3
0
void
KoboMenuWidget::CreateButtons(WidgetDialog &buttons)
{
    buttons.AddButton(("Nickel"), dialog, LAUNCH_NICKEL)
    ->SetEnabled(!IsKoboOTGKernel());
    buttons.AddButton(("Tools"), *this, TOOLS);
    buttons.AddButton(_("Network"), *this, NETWORK);
    buttons.AddButton("System", *this, SYSTEM);
    buttons.AddButton(("Poweroff"), dialog, POWEROFF);
}
Ejemplo n.º 4
0
inline void
SystemWidget::SwitchKernel()
{
#ifdef KOBO
  KoboModel model = DetectKoboModel();
  if (model != KoboModel::MINI &&
      model != KoboModel::GLO &&
      model != KoboModel::TOUCH2 &&
      model != KoboModel::GLO_HD &&
      model != KoboModel::AURA2 &&
      ShowMessageBox(_T("This feature was designed for the Kobo Mini, Touch 2.0, Glo HD and Aura 2, but this is not one.  Use at your own risk.  Continue?"),
                     _T("USB-OTG"), MB_YESNO) != IDYES)
    return;

  const char *otg_kernel_image, *kobo_kernel_image;
  switch (model)
  {
  case KoboModel::GLO_HD:
  case KoboModel::TOUCH2:
    otg_kernel_image = "/opt/xcsoar/lib/kernel/uImage.glohd.otg";
    kobo_kernel_image = "/opt/xcsoar/lib/kernel/uImage.glohd";
    break;

  case KoboModel::AURA2:
    otg_kernel_image = "/opt/xcsoar/lib/kernel/uImage.aura2.otg";
    kobo_kernel_image = "/opt/xcsoar/lib/kernel/uImage.aura2";
    break;

  default:
    otg_kernel_image = "/opt/xcsoar/lib/kernel/uImage.otg";
    kobo_kernel_image = "/opt/xcsoar/lib/kernel/uImage.kobo";
  }

  const char *kernel_image = IsKoboOTGKernel()
    ? kobo_kernel_image
    : otg_kernel_image;

  if (!KoboInstallKernel(kernel_image)) {
      ShowMessageBox(_T("Failed to activate kernel."), _("Error"), MB_OK);
      return;
  }

  KoboReboot();
#endif
}
Ejemplo n.º 5
0
inline void
SystemWidget::SwitchKernel()
{
#ifdef KOBO
  const char *otg_kernel_image = "/opt/xcsoar/lib/kernel/uImage.otg";
  const char *kobo_kernel_image = "/opt/xcsoar/lib/kernel/uImage.kobo";

  const char *kernel_image = IsKoboOTGKernel()
    ? kobo_kernel_image
    : otg_kernel_image;

  if (!KoboInstallKernel(kernel_image)) {
      ShowMessageBox(_T("Failed to activate kernel."), _("Error"), MB_OK);
      return;
  }

  KoboReboot();
#endif
}
Ejemplo n.º 6
0
inline void
SystemWidget::SwitchKernel()
{
#ifdef KOBO
  if (DetectKoboModel() != KoboModel::MINI &&
      ShowMessageBox(_T("This feature was designed for the Kobo Mini, but this is not one.  Use at your own risk.  Continue?"),
                     _T("USB-OTG"), MB_YESNO) != IDYES)
    return;

  const char *otg_kernel_image = "/opt/xcsoar/lib/kernel/uImage.otg";
  const char *kobo_kernel_image = "/opt/xcsoar/lib/kernel/uImage.kobo";

  const char *kernel_image = IsKoboOTGKernel()
    ? kobo_kernel_image
    : otg_kernel_image;

  if (!KoboInstallKernel(kernel_image)) {
      ShowMessageBox(_T("Failed to activate kernel."), _("Error"), MB_OK);
      return;
  }

  KoboReboot();
#endif
}
Ejemplo n.º 7
0
static void OnSplashPaint(WindowControl * Sender, LKSurface& Surface) {

    TCHAR srcfile[MAX_PATH];

    if (RUN_MODE == RUN_SHUTDOWN) return;

    if(RUN_MODE == RUN_WELCOME) {
        if(!StartBitmap) {
            StartBitmap = LoadSplash(_T("LKSTART"));
        }
        if(StartBitmap) {
            DrawSplash(Surface, StartBitmap);
        }
    } else {
        if(!ProfileBitmap) {
            ProfileBitmap = LoadSplash(_T("LKPROFILE"));
        }
        if(ProfileBitmap) {
            DrawSplash(Surface, ProfileBitmap);
        }
    }

    if (RUN_MODE == RUN_WELCOME) {
        TCHAR mes[100];
        int pos = 0;
        switch (ScreenSize) {
            case ss480x272:
                if (ScreenSizeX == 854)
                    pos = 14;
                else
#ifdef __linux__
                    pos = 12;
#else
                    pos = 11;
#endif
                break;
                // --------- portrait -------------
            case ss240x320:
#ifdef __linux__
                pos = 19;
#else
                pos = 17;
#endif
                break;
            default:
                // customized definition
                if (ScreenLandscape) {
                    switch (ScreenGeometry) {
                        case SCREEN_GEOMETRY_43:
                            pos = 12;
                            break;
                        case SCREEN_GEOMETRY_53:
                            pos = 12;
                            break;
                        case SCREEN_GEOMETRY_169:
                            pos = 11;
                            break;
                        default:
                            pos = 11;
                            break;
                    }
                } else {
                    // Portrait
                    // try to get a rule for text position...
                    switch (ScreenGeometry) {
                        case SCREEN_GEOMETRY_43:
#ifdef __linux__
                            pos = 18;
#else
                            pos = 17;
#endif
                            break;
                        case SCREEN_GEOMETRY_53:
                            pos = 20;
                            break;
                        case SCREEN_GEOMETRY_169:
#ifdef __linux__
                            pos = 22;
#else
                            pos = 20;
#endif
                            break;
                        default:
                            pos = 21;
                            break;
                    }

                }
                break;
        }
        if (FullResetAsked) {
            _stprintf(mes, _T("*** %s ***"), MsgToken(1757));
            RawWrite(Surface, mes, pos, 1, RGBDARKWHITE, WTMODE_NORMAL);
        } else {
#ifndef LKCOMPETITION
            _stprintf(mes, _T("Version %s.%s (%s)"), _T(LKVERSION), _T(LKRELEASE), _T(__DATE__));
#else
            _stprintf(mes, _T("V%s.%s (%s) COMPETITION"), _T(LKVERSION), _T(LKRELEASE), _T(__DATE__));
#endif
            RawWrite(Surface, mes, pos, 1, RGBDARKWHITE, WTMODE_NORMAL);
#ifdef KOBO
            if(IsKoboOTGKernel()) {
                RawWrite(Surface, _T("- USB host kernel -"), pos+1, 1, RGBDARKWHITE, WTMODE_NORMAL);
            }
#endif
        }
    }

    if (RUN_MODE != RUN_WELCOME) {

        // FillRect(hDC,&ScreenSizeR, LKBrush_Black); // REMOVE

        TCHAR mes[100];
#ifndef LKCOMPETITION
        _stprintf(mes, _T("%s v%s.%s - %s"), _T(LKFORK), _T(LKVERSION), _T(LKRELEASE), MsgToken(2054));
#else
        _stprintf(mes, _T("%sC v%s.%s - %s"), _T(LKFORK), _T(LKVERSION), _T(LKRELEASE), MsgToken(2054));
#endif
        #ifdef DITHER
        RawWrite(Surface, mes, 1, 1, RGBLIGHTGREY, WTMODE_OUTLINED);
        #else
        RawWrite(Surface, mes, 1, 1, RGBLIGHTGREY, WTMODE_NORMAL);
        #endif

        size_t freeram = CheckFreeRam() / 1024;
        TCHAR buffer[MAX_PATH];
        LocalPath(buffer);
        size_t freestorage = FindFreeSpace(buffer);
        _stprintf(mes, _T("free ram %.1uM  storage %.1uM"), (unsigned int) freeram / 1024, (unsigned int) freestorage / 1024);
        #ifdef DITHER
        RawWrite(Surface, mes, 3, 0, RGBLIGHTGREY, WTMODE_OUTLINED);
        #else
        RawWrite(Surface, mes, 3, 0, RGBLIGHTGREY, WTMODE_NORMAL);
        #endif

        if (ScreenSize != ss320x240 && ScreenLandscape)
            RawWrite(Surface, _T("_______________________"), 2, 2, RGBLIGHTGREY, WTMODE_NORMAL);

        if (FullResetAsked) {
            _stprintf(mes, _T("%s"), MsgToken(1757)); // LK8000 PROFILES RESET
            RawWrite(Surface, mes, 5, 2, RGBICEWHITE, WTMODE_OUTLINED);
            _stprintf(mes, _T("%s"), MsgToken(1759)); // SELECTED IN SYSTEM
            RawWrite(Surface, mes, 6, 2, RGBICEWHITE, WTMODE_OUTLINED);
        } else {
            _stprintf(mes, _T("%s"), PilotName_Config);
            RawWrite(Surface, mes, 4, 2, RGBICEWHITE, WTMODE_OUTLINED);

            _stprintf(mes, _T("%s"), AircraftRego_Config);
            RawWrite(Surface, mes, 5, 2, RGBAMBER, WTMODE_OUTLINED);

            _stprintf(mes, _T("%s"), AircraftType_Config);
            RawWrite(Surface, mes, 6, 2, RGBAMBER, WTMODE_OUTLINED);

            LKASSERT(szPolarFile[0]);
            extern void LK_tsplitpath(const TCHAR* path, TCHAR* drv, TCHAR* dir, TCHAR* name, TCHAR * ext);
            LK_tsplitpath(szPolarFile, (TCHAR*) NULL, (TCHAR*) NULL, srcfile, (TCHAR*) NULL);

            _stprintf(mes, _T("%s %s"), MsgToken(528), srcfile); // polar file
            RawWrite(Surface, mes, 7, 2, RGBAMBER, WTMODE_OUTLINED);

            LKASSERT(startProfileFile[0]);
            LK_tsplitpath(startProfileFile, (TCHAR*) NULL, (TCHAR*) NULL, srcfile, (TCHAR*) NULL);
            _stprintf(mes, _T("%s: %s"), MsgToken(1746), srcfile);
            RawWrite(Surface, mes, 11, 1, RGBICEWHITE, WTMODE_NORMAL);
        }


        // RawWrite(hDC,_T("_______________________"),8,2, RGB_LIGHTGREY,WTMODE_NORMAL); // REMOVE FOR THE 3.0

        return;
    }

}