diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 15cd71a12..6b405d02b 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -212,6 +212,12 @@ audioplayer.streamripper_dir Streamripper-Verzeichnis audioplayer.streamripper_start Streamripper starten audioplayer.streamripper_stop Streamripper stoppen audioplayer.title_artist Titel, Interpret +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 bookmarkmanager.delete Löschen bookmarkmanager.name Bookmarks bookmarkmanager.rename Umbenennen @@ -672,7 +678,8 @@ filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash lese Flash flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image übernommen werden? -flashupdate.autocheck Beim Start nach Updates suchen +flashupdate.autocheck Auf Flash-Updates prüfen +flashupdate.autocheck_packages Auf Paket-Updates prüfen flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.checkupdate_internet Online-Update @@ -1238,6 +1245,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_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_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_brief Zurück zum vorherigen Menü. menu.hint_backlight Konfigurieren Sie die Hintergrundbeleuchtung der Buttons diff --git a/data/locale/english.locale b/data/locale/english.locale index 8afb4640d..69b43d453 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -212,6 +212,12 @@ audioplayer.streamripper_dir Streamripper directory audioplayer.streamripper_start Start streamripper audioplayer.streamripper_stop Stop streamripper audioplayer.title_artist Title, artist +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 bookmarkmanager.delete delete bookmarkmanager.name bookmarks bookmarkmanager.rename rename @@ -672,7 +678,8 @@ filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash reading flashupdate.apply_settings Import current settings into new image? -flashupdate.autocheck Auto-check updates on boot +flashupdate.autocheck Check for flash updates +flashupdate.autocheck_packages Check for package updates flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open MTD flashupdate.checkupdate_internet Online update @@ -1238,6 +1245,7 @@ menu.hint_audioplayer_streamripper_dir Default streamripper target directory menu.hint_audioplayer_title Enable SMS-style title search in playlist menu.hint_auto_lang Auto-switch audio to 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_brief Return to previous menu menu.hint_backlight Configure buttons backlight diff --git a/src/gui/update_check_packages.cpp b/src/gui/update_check_packages.cpp index 3c91fbfff..bc30240d6 100644 --- a/src/gui/update_check_packages.cpp +++ b/src/gui/update_check_packages.cpp @@ -32,26 +32,30 @@ #include #include -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"; + check_done = false; //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) - uc = new CUpdateCheck(); + uc = new CUpdateCheckPackages(); 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; COPKGManager man; @@ -59,4 +63,6 @@ void CUpdateCheck::check4PackageUpdates() return; man.setUpdateCheckResult(false); + + check_done = true; } diff --git a/src/gui/update_check_packages.h b/src/gui/update_check_packages.h index 9be74c6c2..1cda56789 100644 --- a/src/gui/update_check_packages.h +++ b/src/gui/update_check_packages.h @@ -27,15 +27,16 @@ #include "components/cc_timer.h" -class CUpdateCheck : public CComponentsTimer +class CUpdateCheckPackages : public CComponentsTimer { private: void check4PackageUpdates(); + bool check_done; public: - CUpdateCheck(); - virtual ~CUpdateCheck(){}; - static CUpdateCheck* getInstance(); + CUpdateCheckPackages(); + virtual ~CUpdateCheckPackages(){}; + static CUpdateCheckPackages* getInstance(); void startThread() {initThread();} }; diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index bb5fe9ec5..17631d312 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,17 @@ const CMenuOptionChooser::keyval SOFTUPDATE_NAME_MODE2_OPTIONS[SOFTUPDATE_NAME_M }; #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) { dprintf(DEBUG_DEBUG, "init software-update settings\n"); @@ -147,9 +159,17 @@ int CUpdateSettings::initMenu() OnOffNotifier->addItem(apply_kernel); #endif - CMenuOptionChooser *autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); - CMenuOptionChooser *package_autocheck = new CMenuOptionChooser("Package update check", &g_settings.softupdate_autocheck_packages, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); -// apply_settings->setHint("", LOCALE_MENU_HINT_XXX); + CMenuOptionChooser *autocheck = NULL; +#if 0 + autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); + autocheck->setHint("", LOCALE_MENU_HINT_AUTO_UPDATE_CHECK); +#endif + + 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); + } w_upsettings.addItem(fw_update_dir); if (fw_url) @@ -162,8 +182,9 @@ int CUpdateSettings::initMenu() w_upsettings.addItem(name_apply); #endif #endif - w_upsettings.addItem(autocheck); - if (COPKGManager::hasOpkgSupport()) + if (autocheck) + w_upsettings.addItem(autocheck); + if (package_autocheck) w_upsettings.addItem(package_autocheck); #if 0 w_upsettings.addItem(apply_kernel); @@ -174,3 +195,20 @@ int CUpdateSettings::initMenu() return res; } + +bool CUpdateSettings::changeNotify(const neutrino_locale_t OptionName, void * /* data */) +{ + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK) || ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES)) + { +#if 0 + CUpdateCheck::getInstance()->stopTimer(); + if (g_settings.softupdate_autocheck) + CUpdateCheck::getInstance()->startThread(); +#endif + CUpdateCheckPackages::getInstance()->stopTimer(); + if (g_settings.softupdate_autocheck_packages) + CUpdateCheckPackages::getInstance()->startThread(); + } + + return false; +} diff --git a/src/gui/update_settings.h b/src/gui/update_settings.h index c4cfc520d..b459bed1b 100644 --- a/src/gui/update_settings.h +++ b/src/gui/update_settings.h @@ -55,20 +55,21 @@ class CUrlConfigSetupNotifier : public CChangeObserver bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); }; -class CUpdateSettings : public CMenuTarget +class CUpdateSettings : public CMenuTarget, CChangeObserver { private: int width; int initMenu(); - + #ifdef USE_SMS_INPUT CStringInputSMS *input_url_file; #endif - + public: CUpdateSettings(); ~CUpdateSettings(); int exec(CMenuTarget* parent, const std::string & actionKey); + bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); }; #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index ba85fe8ea..8a1bb8357 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3075,9 +3075,12 @@ TIMER_STOP("################################## after all ####################### } hintBox->hide(); delete hintBox; + + CUpdateCheck::getInstance()->startThread(); } #endif - CUpdateCheck::getInstance()->startThread(); + if (g_settings.softupdate_autocheck_packages) + CUpdateCheckPackages::getInstance()->startThread(); for (std::list::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); it++) g_Sectionsd->readSIfromXMLTV((*it).c_str()); diff --git a/src/system/locals.h b/src/system/locals.h index 07792501d..1f290f07b 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -239,6 +239,12 @@ typedef enum LOCALE_AUDIOPLAYER_STREAMRIPPER_START, LOCALE_AUDIOPLAYER_STREAMRIPPER_STOP, LOCALE_AUDIOPLAYER_TITLE_ARTIST, + 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_BOOKMARKMANAGER_DELETE, LOCALE_BOOKMARKMANAGER_NAME, LOCALE_BOOKMARKMANAGER_RENAME, @@ -700,6 +706,7 @@ typedef enum LOCALE_FLASHUPDATE_ACTIONREADFLASH, LOCALE_FLASHUPDATE_APPLY_SETTINGS, LOCALE_FLASHUPDATE_AUTOCHECK, + LOCALE_FLASHUPDATE_AUTOCHECK_PACKAGES, LOCALE_FLASHUPDATE_CANTOPENFILE, LOCALE_FLASHUPDATE_CANTOPENMTD, LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET, @@ -1265,6 +1272,7 @@ typedef enum LOCALE_MENU_HINT_AUDIOPLAYER_TITLE, LOCALE_MENU_HINT_AUTO_LANG, LOCALE_MENU_HINT_AUTO_SUBS, + LOCALE_MENU_HINT_AUTO_UPDATE_CHECK, LOCALE_MENU_HINT_BACK, LOCALE_MENU_HINT_BACK_BRIEF, LOCALE_MENU_HINT_BACKLIGHT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b68df15a8..cebfa957d 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -239,6 +239,12 @@ const char * locale_real_names[] = "audioplayer.streamripper_start", "audioplayer.streamripper_stop", "audioplayer.title_artist", + "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", "bookmarkmanager.delete", "bookmarkmanager.name", "bookmarkmanager.rename", @@ -700,6 +706,7 @@ const char * locale_real_names[] = "flashupdate.actionreadflash", "flashupdate.apply_settings", "flashupdate.autocheck", + "flashupdate.autocheck_packages", "flashupdate.cantopenfile", "flashupdate.cantopenmtd", "flashupdate.checkupdate_internet", @@ -1265,6 +1272,7 @@ const char * locale_real_names[] = "menu.hint_audioplayer_title", "menu.hint_auto_lang", "menu.hint_auto_subs", + "menu.hint_auto_update_check", "menu.hint_back", "menu.hint_back_brief", "menu.hint_backlight",