From b78498f8063da93dd65e5d7de94f54e45fb7cd20 Mon Sep 17 00:00:00 2001 From: BPanther Date: Sat, 18 Jan 2020 23:06:12 +0100 Subject: [PATCH] move ci save pin code to each slot menu (but still only valid for slot 0) Conflicts: src/system/settings.h --- src/gui/cam_menu.cpp | 12 ++++++------ src/neutrino.cpp | 13 +++++++++---- src/system/settings.h | 6 ++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 9c9156387..369f20314 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -163,7 +163,6 @@ int CCAMMenuHandler::doMainMenu() #endif cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_RESET_STANDBY, &g_settings.ci_standby_reset, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); } - cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_SAVE_PINCODE, &g_settings.ci_save_pincode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); #if HAVE_LIBSTB_HAL cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_CHECK_LIVE_SLOT, &g_settings.ci_check_live, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); #endif @@ -224,6 +223,7 @@ if (i == 0) { // only for slot 0 valid - fix later cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_RPR, &g_settings.ci_rpr[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); #endif cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_IGNORE_MSG, &g_settings.ci_ignore_messages[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + cammenu->addItem(new CMenuOptionChooser(LOCALE_CI_SAVE_PINCODE, &g_settings.ci_save_pincode[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); } } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_CI_EMPTY), i); @@ -491,16 +491,16 @@ int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t std::string ENQAnswer; - if (/* !from_menu && */ g_settings.ci_save_pincode && pMmiEnquiry->blind != 0 && (int) g_settings.ci_pincode.length() == pMmiEnquiry->answerlen) { + if (/* !from_menu && */ g_settings.ci_save_pincode[curslot] && pMmiEnquiry->blind != 0 && (int) g_settings.ci_pincode[curslot].length() == pMmiEnquiry->answerlen) { static int acount = 0; static time_t last_ask = 0; - ENQAnswer = g_settings.ci_pincode; + ENQAnswer = g_settings.ci_pincode[curslot]; printf("CCAMMenuHandler::handleCamMsg: using saved answer [%s] (#%d, time diff %d)\n", ENQAnswer.c_str(), acount, (int) (time_monotonic() - last_ask)); if ((time_monotonic() - last_ask) < 10) { acount++; if (acount > 4) - g_settings.ci_pincode.clear(); + g_settings.ci_pincode[curslot].clear(); } else { last_ask = time_monotonic(); acount = 0; @@ -509,7 +509,7 @@ int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t CEnquiryInput *Inquiry = new CEnquiryInput((char *)convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str(), &ENQAnswer, pMmiEnquiry->answerlen, pMmiEnquiry->blind != 0, NONEXISTANT_LOCALE); Inquiry->exec(NULL, ""); delete Inquiry; - g_settings.ci_pincode = ENQAnswer; + g_settings.ci_pincode[curslot] = ENQAnswer; } printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", ENQAnswer.c_str()); @@ -642,7 +642,7 @@ bool CCAMMenuHandler::changeNotify(const neutrino_locale_t OptionName, void * Da int enabled = *(int *) Data; if (!enabled) { printf("CCAMMenuHandler::changeNotify: clear saved pincode\n"); - g_settings.ci_pincode.clear(); + g_settings.ci_pincode[CISlot].clear(); } } #if HAVE_LIBSTB_HAL diff --git a/src/neutrino.cpp b/src/neutrino.cpp index bfee3c310..a5e97e49f 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -489,10 +489,12 @@ int CNeutrinoApp::loadSetup(const char * fname) for (uint32_t i = 0; i < cCA::GetInstance()->GetNumberCISlots(); i++) { sprintf(cfg_key, "ci_ignore_messages_%d", i); g_settings.ci_ignore_messages[i] = configfile.getInt32(cfg_key, 0); + sprintf(cfg_key, "ci_save_pincode_%d", i); + g_settings.ci_save_pincode[i] = configfile.getInt32(cfg_key, 0); + sprintf(cfg_key, "ci_pincode_%d", i); + g_settings.ci_pincode[i] = configfile.getString(cfg_key, ""); } - g_settings.ci_save_pincode = configfile.getInt32("ci_save_pincode", 0); // TODO: for each slot g_settings.ci_check_live = configfile.getInt32("ci_check_live", 0); - g_settings.ci_pincode = configfile.getString("ci_pincode", ""); // TODO: for each slot g_settings.ci_tuner = configfile.getInt32("ci_tuner", -1); g_settings.ci_rec_zapto = configfile.getInt32("ci_rec_zapto", 0); //NI g_settings.ci_mode = configfile.getInt32("ci_mode", 0); //NI @@ -1428,10 +1430,13 @@ void CNeutrinoApp::saveSetup(const char * fname) for (uint32_t i = 0; i < cCA::GetInstance()->GetNumberCISlots(); i++) { sprintf(cfg_key, "ci_ignore_messages_%d", i); configfile.setInt32(cfg_key, g_settings.ci_ignore_messages[i]); + sprintf(cfg_key, "ci_save_pincode_%d", i); + configfile.setInt32(cfg_key, g_settings.ci_save_pincode[i]); + sprintf(cfg_key, "ci_pincode_%d", i); + configfile.setString(cfg_key, g_settings.ci_pincode[i]); } - configfile.setInt32("ci_save_pincode", g_settings.ci_save_pincode); // TODO: for each slot + configfile.setInt32("ci_check_live", g_settings.ci_check_live); - configfile.setString("ci_pincode", g_settings.ci_pincode); // TODO: for each slot configfile.setInt32("ci_tuner", g_settings.ci_tuner); configfile.setInt32("ci_rec_zapto", g_settings.ci_rec_zapto); configfile.setInt32("ci_mode", g_settings.ci_mode); diff --git a/src/system/settings.h b/src/system/settings.h index 384bbf221..faa4061f6 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -226,6 +226,7 @@ struct SNeutrinoSettings int infobar_show_channeldesc; int infobar_subchan_disp_pos; int infobar_buttons_usertitle; + int fan_speed; int infobar_show; int infobar_show_channellogo; @@ -290,12 +291,13 @@ struct SNeutrinoSettings int ci_rpr[4]; #endif int ci_ignore_messages[4]; - int ci_save_pincode; // TODO: for each slot + int ci_save_pincode[4]; + std::string ci_pincode[4]; int ci_check_live; int ci_tuner; int ci_rec_zapto; int ci_mode; - std::string ci_pincode; // TODO: for each slot + int radiotext_enable; int webradio_xml_auto; int webtv_xml_auto;