update_check: handle update check with localized timer settings

Origin commit data
------------------
Branch: ni/coolstream
Commit: f7da4b368d
Author: Thilo Graf <dbt@novatux.de>
Date: 2021-04-10 (Sat, 10 Apr 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
2021-04-10 22:14:39 +02:00
committed by vanhofen
parent 374991dddf
commit 269fc08545
9 changed files with 95 additions and 22 deletions

View File

@@ -212,6 +212,12 @@ audioplayer.streamripper_start Streamripper starten
audioplayer.streamripper_stop Streamripper stoppen audioplayer.streamripper_stop Streamripper stoppen
audioplayer.title_artist Titel, Interpret audioplayer.title_artist Titel, Interpret
audioplayer_internetradio.name Audioplayer und Internetradio audioplayer_internetradio.name Audioplayer und Internetradio
auto_update_check_6_hours alle 6 Stunden
auto_update_check_daily täglich
auto_update_check_monthly monatlich
auto_update_check_off deaktiviert
auto_update_check_on_start_only nur bei Start
auto_update_check_weekly wöchentlich
blank_screen Blanker Bildschirm blank_screen Blanker Bildschirm
bookmarkmanager.delete Löschen bookmarkmanager.delete Löschen
bookmarkmanager.name Bookmarks bookmarkmanager.name Bookmarks
@@ -726,6 +732,7 @@ filesystem.is.utf8.option.utf8 UTF-8
flashupdate.actionreadflash lese Flash flashupdate.actionreadflash lese Flash
flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image übernommen werden? flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image übernommen werden?
flashupdate.autocheck Regelmäßig nach Updates suchen flashupdate.autocheck Regelmäßig nach Updates suchen
flashupdate.autocheck_packages Auf Paket-Updates prüfen
flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenfile kann Datei nicht öffnen
flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen
flashupdate.checkupdate_internet Online-Update flashupdate.checkupdate_internet Online-Update
@@ -1319,6 +1326,7 @@ menu.hint_audioplayer_streamripper_dir Wählen Sie das Aufnahmeverzeichnis für
menu.hint_audioplayer_title Aktivieren Sie die Titelsuche (SMS-Stil) in der Playliste menu.hint_audioplayer_title Aktivieren Sie die Titelsuche (SMS-Stil) in der Playliste
menu.hint_auto_lang Wählen Sie, ob automatisch ihre bevorzugte Tonspur ausgewählt wird, wenn sie vorhanden ist menu.hint_auto_lang Wählen Sie, ob automatisch ihre bevorzugte Tonspur ausgewählt wird, wenn sie vorhanden ist
menu.hint_auto_subs Automatische Anzeige der Untertitel in Ihrer bevorzugten Sprache menu.hint_auto_subs Automatische Anzeige der Untertitel in Ihrer bevorzugten Sprache
menu.hint_auto_update_check Prüfintervalle für Updates festlegen.
menu.hint_back Zurück zum vorherigen Menü.\nDie Taste 'Menü' schließt alle Menüs menu.hint_back Zurück zum vorherigen Menü.\nDie Taste 'Menü' schließt alle Menüs
menu.hint_back_brief Zurück zum vorherigen Menü. menu.hint_back_brief Zurück zum vorherigen Menü.
menu.hint_backlight Konfigurieren Sie die Hintergrundbeleuchtung der Buttons menu.hint_backlight Konfigurieren Sie die Hintergrundbeleuchtung der Buttons

View File

@@ -212,6 +212,12 @@ audioplayer.streamripper_start Start streamripper
audioplayer.streamripper_stop Stop streamripper audioplayer.streamripper_stop Stop streamripper
audioplayer.title_artist Title, artist audioplayer.title_artist Title, artist
audioplayer_internetradio.name Audioplayer and Internetradio audioplayer_internetradio.name Audioplayer and Internetradio
auto_update_check_6_hours every 6 hours
auto_update_check_daily daily
auto_update_check_monthly monthly
auto_update_check_off off
auto_update_check_on_start_only only on start
auto_update_check_weekly weekly
blank_screen Blank screen blank_screen Blank screen
bookmarkmanager.delete delete bookmarkmanager.delete delete
bookmarkmanager.name bookmarks bookmarkmanager.name bookmarks
@@ -725,7 +731,8 @@ filesystem.is.utf8.option.iso8859.1 ISO-8859-1
filesystem.is.utf8.option.utf8 UTF-8 filesystem.is.utf8.option.utf8 UTF-8
flashupdate.actionreadflash reading flashupdate.actionreadflash reading
flashupdate.apply_settings Import current settings into new image? flashupdate.apply_settings Import current settings into new image?
flashupdate.autocheck Check updates periodically flashupdate.autocheck Check for updates periodically
flashupdate.autocheck_packages Check for package updates
flashupdate.cantopenfile can't open file flashupdate.cantopenfile can't open file
flashupdate.cantopenmtd can't open MTD flashupdate.cantopenmtd can't open MTD
flashupdate.checkupdate_internet Online update flashupdate.checkupdate_internet Online update
@@ -1319,6 +1326,7 @@ menu.hint_audioplayer_streamripper_dir Default streamripper target directory
menu.hint_audioplayer_title Enable SMS-style title search in playlist menu.hint_audioplayer_title Enable SMS-style title search in playlist
menu.hint_auto_lang Auto-switch audio to preferred language menu.hint_auto_lang Auto-switch audio to preferred language
menu.hint_auto_subs Auto-start subtitles for preferred language menu.hint_auto_subs Auto-start subtitles for preferred language
menu.hint_auto_update_check Set interval mode for update checks.
menu.hint_back Return to previous menu\nPress menu key to close all menus menu.hint_back Return to previous menu\nPress menu key to close all menus
menu.hint_back_brief Return to previous menu menu.hint_back_brief Return to previous menu
menu.hint_backlight Configure buttons backlight menu.hint_backlight Configure buttons backlight

View File

@@ -32,26 +32,30 @@
#include <system/debug.h> #include <system/debug.h>
#include <system/helpers.h> #include <system/helpers.h>
CUpdateCheck::CUpdateCheck():CComponentsTimer(1000*60/*1000*6*60*/) CUpdateCheckPackages::CUpdateCheckPackages():CComponentsTimer(1000*60*60*(g_settings.softupdate_autocheck_packages <= 0 ? 1 : g_settings.softupdate_autocheck_packages))
{ {
tm_thread_name = "n:update_check"; tm_thread_name = "n:update_check";
check_done = false;
//init slot for package check //init slot for package check
OnTimer.connect(sigc::mem_fun(*this, &CUpdateCheck::check4PackageUpdates)); OnTimer.connect(sigc::mem_fun(*this, &CUpdateCheckPackages::check4PackageUpdates));
} }
CUpdateCheck* CUpdateCheck::getInstance() CUpdateCheckPackages* CUpdateCheckPackages::getInstance()
{ {
static CUpdateCheck * uc = NULL; static CUpdateCheckPackages * uc = NULL;
if (!uc) if (!uc)
uc = new CUpdateCheck(); uc = new CUpdateCheckPackages();
return uc; return uc;
} }
void CUpdateCheck::check4PackageUpdates() void CUpdateCheckPackages::check4PackageUpdates()
{ {
if (!g_settings.softupdate_autocheck_packages) if (!g_settings.softupdate_autocheck_packages) //disabled
return;
if (g_settings.softupdate_autocheck_packages == -1 && check_done) //only on start
return; return;
COPKGManager man; COPKGManager man;
@@ -59,4 +63,6 @@ void CUpdateCheck::check4PackageUpdates()
return; return;
man.setUpdateCheckResult(false); man.setUpdateCheckResult(false);
check_done = true;
} }

View File

@@ -27,15 +27,16 @@
#include "components/cc_timer.h" #include "components/cc_timer.h"
class CUpdateCheck : public CComponentsTimer class CUpdateCheckPackages : public CComponentsTimer
{ {
private: private:
void check4PackageUpdates(); void check4PackageUpdates();
bool check_done;
public: public:
CUpdateCheck(); CUpdateCheckPackages();
virtual ~CUpdateCheck(){}; virtual ~CUpdateCheckPackages(){};
static CUpdateCheck* getInstance(); static CUpdateCheckPackages* getInstance();
void startThread() {initThread();} void startThread() {initThread();}
}; };

View File

@@ -40,6 +40,7 @@
#include <gui/filebrowser.h> #include <gui/filebrowser.h>
#include <gui/update_check.h> #include <gui/update_check.h>
#include <gui/opkg_manager.h> #include <gui/opkg_manager.h>
#include <gui/update_check_packages.h>
#include <gui/update_ext.h> #include <gui/update_ext.h>
#include <gui/update_settings.h> #include <gui/update_settings.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
@@ -79,6 +80,17 @@ const CMenuOptionChooser::keyval SOFTUPDATE_NAME_MODE2_OPTIONS[SOFTUPDATE_NAME_M
}; };
#endif #endif
const CMenuOptionChooser::keyval AUTOUPDATE_CHECK_OPTIONS[] =
{
{ -1, LOCALE_AUTO_UPDATE_CHECK_ON_START_ONLY },
{ 0, LOCALE_AUTO_UPDATE_CHECK_OFF },
{ 6, LOCALE_AUTO_UPDATE_CHECK_6_HOURS },
{ 24, LOCALE_AUTO_UPDATE_CHECK_DAILY },
{ 168, LOCALE_AUTO_UPDATE_CHECK_WEEKLY },
{ 672, LOCALE_AUTO_UPDATE_CHECK_MONTHLY }
};
size_t auto_update_options_count = sizeof(AUTOUPDATE_CHECK_OPTIONS)/sizeof(AUTOUPDATE_CHECK_OPTIONS[0]);
int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey) int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey)
{ {
dprintf(DEBUG_DEBUG, "init software-update settings\n"); dprintf(DEBUG_DEBUG, "init software-update settings\n");
@@ -145,11 +157,20 @@ int CUpdateSettings::initMenu()
OnOffNotifier->addItem(apply_kernel); OnOffNotifier->addItem(apply_kernel);
#endif #endif
CMenuOptionChooser *autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); CMenuOptionChooser *autocheck = NULL;
CMenuOptionChooser *package_autocheck = new CMenuOptionChooser("Package update check", &g_settings.softupdate_autocheck_packages, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
// apply_settings->setHint("", LOCALE_MENU_HINT_XXX); autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK);
#if 0
CMenuOptionChooser *package_autocheck = NULL;
if (COPKGManager::hasOpkgSupport()){
package_autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES, &g_settings.softupdate_autocheck_packages, AUTOUPDATE_CHECK_OPTIONS, auto_update_options_count, true, this);
package_autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK);
}
#endif
w_upsettings.addItem(fw_update_dir); w_upsettings.addItem(fw_update_dir);
if (fw_url)
w_upsettings.addItem(fw_url); w_upsettings.addItem(fw_url);
#if ENABLE_EXTUPDATE #if ENABLE_EXTUPDATE
w_upsettings.addItem(name_backup); w_upsettings.addItem(name_backup);
@@ -159,8 +180,9 @@ int CUpdateSettings::initMenu()
w_upsettings.addItem(name_apply); w_upsettings.addItem(name_apply);
#endif #endif
#endif #endif
if (autocheck)
w_upsettings.addItem(autocheck); w_upsettings.addItem(autocheck);
if (COPKGManager::hasOpkgSupport()) if (package_autocheck)
w_upsettings.addItem(package_autocheck); w_upsettings.addItem(package_autocheck);
#if 0 #if 0
w_upsettings.addItem(apply_kernel); w_upsettings.addItem(apply_kernel);
@@ -174,11 +196,19 @@ int CUpdateSettings::initMenu()
bool CUpdateSettings::changeNotify(const neutrino_locale_t OptionName, void * /* data */) bool CUpdateSettings::changeNotify(const neutrino_locale_t OptionName, void * /* data */)
{ {
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK)) if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK) || ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES))
{ {
CFlashUpdateCheck::getInstance()->stopThread(); CFlashUpdateCheck::getInstance()->stopThread();
if (g_settings.softupdate_autocheck) if (g_settings.softupdate_autocheck)
CFlashUpdateCheck::getInstance()->startThread(); CFlashUpdateCheck::getInstance()->startThread();
#if 0
CUpdateCheck::getInstance()->stopTimer();
if (g_settings.softupdate_autocheck)
CUpdateCheck::getInstance()->startThread();
CUpdateCheckPackages::getInstance()->stopTimer();
if (g_settings.softupdate_autocheck_packages)
CUpdateCheckPackages::getInstance()->startThread();
#endif
} }
return false; return false;

View File

@@ -3145,8 +3145,12 @@ TIMER_STOP("################################## after all #######################
delete hintBox; delete hintBox;
#endif #endif
CFlashUpdateCheck::getInstance()->startThread(); CFlashUpdateCheck::getInstance()->startThread();
}
//CUpdateCheck::getInstance()->startThread(); //CUpdateCheck::getInstance()->startThread();
}
#if 0
if (g_settings.softupdate_autocheck_packages)
CUpdateCheckPackages::getInstance()->startThread();
#endif
for (std::list<std::string>::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++) for (std::list<std::string>::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++)
g_Sectionsd->readSIfromXMLTV((*it).c_str()); g_Sectionsd->readSIfromXMLTV((*it).c_str());

View File

@@ -239,6 +239,12 @@ typedef enum
LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP, LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP,
LOCALE_AUDIOPLAYER_TITLE_ARTIST, LOCALE_AUDIOPLAYER_TITLE_ARTIST,
LOCALE_AUDIOPLAYER_INTERNETRADIO_NAME, LOCALE_AUDIOPLAYER_INTERNETRADIO_NAME,
LOCALE_AUTO_UPDATE_CHECK_6_HOURS,
LOCALE_AUTO_UPDATE_CHECK_DAILY,
LOCALE_AUTO_UPDATE_CHECK_MONTHLY,
LOCALE_AUTO_UPDATE_CHECK_OFF,
LOCALE_AUTO_UPDATE_CHECK_ON_START_ONLY,
LOCALE_AUTO_UPDATE_CHECK_WEEKLY,
LOCALE_BLANK_SCREEN, LOCALE_BLANK_SCREEN,
LOCALE_BOOKMARKMANAGER_DELETE, LOCALE_BOOKMARKMANAGER_DELETE,
LOCALE_BOOKMARKMANAGER_NAME, LOCALE_BOOKMARKMANAGER_NAME,
@@ -753,6 +759,7 @@ typedef enum
LOCALE_FLASHUPDATE_ACTIONREADFLASH, LOCALE_FLASHUPDATE_ACTIONREADFLASH,
LOCALE_FLASHUPDATE_APPLY_SETTINGS, LOCALE_FLASHUPDATE_APPLY_SETTINGS,
LOCALE_FLASHUPDATE_AUTOCHECK, LOCALE_FLASHUPDATE_AUTOCHECK,
LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES,
LOCALE_FLASHUPDATE_CANTOPENFILE, LOCALE_FLASHUPDATE_CANTOPENFILE,
LOCALE_FLASHUPDATE_CANTOPENMTD, LOCALE_FLASHUPDATE_CANTOPENMTD,
LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET, LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET,
@@ -1346,6 +1353,7 @@ typedef enum
LOCALE_MENU_HINT_AUDIOPLAYER_TITLE, LOCALE_MENU_HINT_AUDIOPLAYER_TITLE,
LOCALE_MENU_HINT_AUTO_LANG, LOCALE_MENU_HINT_AUTO_LANG,
LOCALE_MENU_HINT_AUTO_SUBS, LOCALE_MENU_HINT_AUTO_SUBS,
LOCALE_MENU_HINT_AUTO_UPDATE_CHECK,
LOCALE_MENU_HINT_BACK, LOCALE_MENU_HINT_BACK,
LOCALE_MENU_HINT_BACK_BRIEF, LOCALE_MENU_HINT_BACK_BRIEF,
LOCALE_MENU_HINT_BACKLIGHT, LOCALE_MENU_HINT_BACKLIGHT,

View File

@@ -239,6 +239,12 @@ const char * locale_real_names[] =
"audioplayer.streamripper_stop", "audioplayer.streamripper_stop",
"audioplayer.title_artist", "audioplayer.title_artist",
"audioplayer_internetradio.name", "audioplayer_internetradio.name",
"auto_update_check_6_hours",
"auto_update_check_daily",
"auto_update_check_monthly",
"auto_update_check_off",
"auto_update_check_on_start_only",
"auto_update_check_weekly",
"blank_screen", "blank_screen",
"bookmarkmanager.delete", "bookmarkmanager.delete",
"bookmarkmanager.name", "bookmarkmanager.name",
@@ -753,6 +759,7 @@ const char * locale_real_names[] =
"flashupdate.actionreadflash", "flashupdate.actionreadflash",
"flashupdate.apply_settings", "flashupdate.apply_settings",
"flashupdate.autocheck", "flashupdate.autocheck",
"flashupdate.autocheck_packages",
"flashupdate.cantopenfile", "flashupdate.cantopenfile",
"flashupdate.cantopenmtd", "flashupdate.cantopenmtd",
"flashupdate.checkupdate_internet", "flashupdate.checkupdate_internet",
@@ -1346,6 +1353,7 @@ const char * locale_real_names[] =
"menu.hint_audioplayer_title", "menu.hint_audioplayer_title",
"menu.hint_auto_lang", "menu.hint_auto_lang",
"menu.hint_auto_subs", "menu.hint_auto_subs",
"menu.hint_auto_update_check",
"menu.hint_back", "menu.hint_back",
"menu.hint_back_brief", "menu.hint_back_brief",
"menu.hint_backlight", "menu.hint_backlight",