diff --git a/data/icons/status/info/Makefile.am b/data/icons/status/info/Makefile.am index 2753cb3d8..2f8451945 100644 --- a/data/icons/status/info/Makefile.am +++ b/data/icons/status/info/Makefile.am @@ -9,4 +9,6 @@ install_DATA = \ info2_off.png \ info2_on.png \ info3_off.png \ - info3_on.png + info3_on.png \ + info4_off.png \ + info4_on.png diff --git a/data/icons/status/info/info4_off.png b/data/icons/status/info/info4_off.png new file mode 100644 index 000000000..1b0cf0227 Binary files /dev/null and b/data/icons/status/info/info4_off.png differ diff --git a/data/icons/status/info/info4_on.png b/data/icons/status/info/info4_on.png new file mode 100644 index 000000000..11df1a313 Binary files /dev/null and b/data/icons/status/info/info4_on.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 87b048c50..46c1a0e73 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -647,7 +647,7 @@ 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 Regelmäßig nach Updates suchen flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.checkupdate_internet Online-Update diff --git a/data/locale/english.locale b/data/locale/english.locale index 448b5fbeb..ff05ac989 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -647,7 +647,7 @@ 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 updates periodically flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open MTD flashupdate.checkupdate_internet Online update diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index c698cbea2..fedf79f07 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -107,6 +107,7 @@ libneutrino_gui_a_SOURCES = \ timeosd.cpp \ tmdb.cpp \ update.cpp \ + update_check.cpp \ update_ext.cpp \ update_menue.cpp \ update_settings.cpp \ diff --git a/src/gui/update_check.cpp b/src/gui/update_check.cpp new file mode 100644 index 000000000..65019f960 --- /dev/null +++ b/src/gui/update_check.cpp @@ -0,0 +1,112 @@ +/* + update-check + + Copyright (C) 2017 'vanhofen' + Homepage: http://www.neutrino-images.de/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include + +#include +#include + +#include "update_check.h" + +#define C4U_SLEEP (6 * 60 * 60) // 6 hours +#define C4U_FLAGFILE FLAGDIR "/.update" + +/* ----------------------------------------------------------------- */ + +CFlashUpdateCheck::CFlashUpdateCheck() +{ + c4u_thread = 0; +} + +CFlashUpdateCheck::~CFlashUpdateCheck() +{ + stopThread(); +} + +CFlashUpdateCheck* CFlashUpdateCheck::getInstance() +{ + static CFlashUpdateCheck * c4u = NULL; + if (!c4u) + c4u = new CFlashUpdateCheck(); + + return c4u; +} + +void CFlashUpdateCheck::startThread() +{ + if (!c4u_thread) + { + printf("[CFlashUpdateCheck]: starting thread\n"); + pthread_create(&c4u_thread, NULL, c4u_proc, (void*) NULL); + pthread_detach(c4u_thread); + } +} + +void CFlashUpdateCheck::stopThread() +{ + if (c4u_thread) + { + printf("[CFlashUpdateCheck]: stopping thread\n"); + pthread_cancel(c4u_thread); + } + c4u_thread = 0; +} + +void* CFlashUpdateCheck::c4u_proc(void*) +{ + set_threadname("n:flashupdatecheck"); + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); + + //printf("[CFlashUpdateCheck] %s: starting loop\n", __FUNCTION__); + while(1) + { + CFlashUpdate flashupdate; + + //printf("[CFlashUpdateCheck]: check for updates\n"); + if (flashupdate.checkOnlineVersion()) + { + //printf("[CFlashUpdateCheck]: update available\n"); + if (FILE *f = fopen(C4U_FLAGFILE, "w")) + fclose(f); + } + else + { + if (access(C4U_FLAGFILE, F_OK) == 0) + unlink(C4U_FLAGFILE); + } + + sleep(C4U_SLEEP); + } + return 0; +} diff --git a/src/gui/update_check.h b/src/gui/update_check.h new file mode 100644 index 000000000..bd57c814b --- /dev/null +++ b/src/gui/update_check.h @@ -0,0 +1,45 @@ +/* + update-check + + Copyright (C) 2017 'vanhofen' + Homepage: http://www.neutrino-images.de/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __update_check__ +#define __update_check__ + +class CFlashUpdateCheck +{ + public: + CFlashUpdateCheck(); + ~CFlashUpdateCheck(); + static CFlashUpdateCheck* getInstance(); + + void startThread(); + void stopThread(); + + private: + + pthread_t c4u_thread; + static void* c4u_proc(void *arg); + +}; + +#endif // __update_check__ diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1f535cd19..e5faeb51b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -94,6 +94,7 @@ #include "gui/start_wizard.h" #include "gui/update_ext.h" #include "gui/update.h" +#include "gui/update_check.h" #include "gui/videosettings.h" #include "gui/audio_select.h" #include "gui/webtv_setup.h" //NI @@ -376,6 +377,7 @@ int CNeutrinoApp::loadSetup(const char * fname) else if (i==1) sprintf(cfg_value, "/var/etc/.call"); else if (i==2) sprintf(cfg_value, "/var/etc/.srv"); else if (i==3) sprintf(cfg_value, "/var/etc/.card"); + else if (i==4) sprintf(cfg_value, "/var/etc/.update"); else strcpy(cfg_value, ""); g_settings.mode_icons_flag[i] = configfile.getString(cfg_key, cfg_value); } @@ -1081,13 +1083,11 @@ void CNeutrinoApp::upgradeSetup(const char * fname) configfile.setString("usermenu_tv_yellow", g_settings.usermenu[SNeutrinoSettings::BUTTON_YELLOW]->items); } } - //NI if (g_settings.version_pseudo < "20160804110000") { if (g_settings.tmdb_api_key == "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") g_settings.tmdb_api_key = "7270f1b571c4ecbb5b204ddb7f8939b1"; } - //NI if (g_settings.version_pseudo < "20161411235900") { //convert and remove obsolete recording_tevents key @@ -1137,13 +1137,11 @@ void CNeutrinoApp::upgradeSetup(const char * fname) configfile.deleteKey("screen_width"); configfile.deleteKey("screen_height"); } - //NI if (g_settings.version_pseudo < "20170516150000") { if (g_settings.movieplayer_bisection_jump == 1) g_settings.movieplayer_bisection_jump = 5; } - //NI if (g_settings.version_pseudo < "20170606000000") { //remove CProgressBar::PB_GRAPHIC @@ -1153,13 +1151,18 @@ void CNeutrinoApp::upgradeSetup(const char * fname) g_settings.theme.progressbar_gradient = 1; } } - //NI if (g_settings.version_pseudo < "20170606215500") { //align fontsize.filebrowser_item to new default if (configfile.getInt32("fontsize.filebrowser_item", 16) == 16) configfile.setInt32("fontsize.filebrowser_item", 17); } + if (g_settings.version_pseudo < "20170904080000") + { + //add flagfile for periodically update-check + if (g_settings.mode_icons_flag[4].empty()) + g_settings.mode_icons_flag[4] = FLAGDIR "/.update"; + } g_settings.version_pseudo = NEUTRINO_VERSION_PSEUDO; configfile.setString("version_pseudo", g_settings.version_pseudo); @@ -2551,6 +2554,7 @@ TIMER_START(); TIMER_STOP("################################## after all ##################################"); if (g_settings.softupdate_autocheck) { +#if 0 hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET)); hintBox->paint(); CFlashUpdate flash; @@ -2561,6 +2565,8 @@ TIMER_STOP("################################## after all ####################### } hintBox->hide(); delete hintBox; +#endif + CFlashUpdateCheck::getInstance()->startThread(); } RealRun(); @@ -4720,6 +4726,8 @@ void stop_daemons(bool stopall, bool for_flash) cs_deregister_messenger(); } + delete CFlashUpdateCheck::getInstance(); + if (for_flash) { delete cHddStat::getInstance(); delete CRecordManager::getInstance(); diff --git a/version_pseudo.h b/version_pseudo.h index 8e3fea959..5540dd3fd 100644 --- a/version_pseudo.h +++ b/version_pseudo.h @@ -1 +1 @@ -#define NEUTRINO_VERSION_PSEUDO "20170606215500" +#define NEUTRINO_VERSION_PSEUDO "20170904080000"