add possibility to signalize available online-updates in infoicons

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3294d9f74d
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-04 (Mon, 04 Sep 2017)

Origin message was:
------------------
- add possibility to signalize available online-updates in infoicons

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-09-04 17:17:27 +02:00
parent d044ada2b2
commit 660c17ad44
10 changed files with 177 additions and 9 deletions

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

View File

@@ -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

View File

@@ -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

View File

@@ -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 \

112
src/gui/update_check.cpp Normal file
View File

@@ -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 <config.h>
#endif
#include <pthread.h>
#include <unistd.h>
#include <global.h>
#include <neutrino.h>
#include <system/set_threadname.h>
#include <gui/update.h>
#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;
}

45
src/gui/update_check.h Normal file
View File

@@ -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__

View File

@@ -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();

View File

@@ -1 +1 @@
#define NEUTRINO_VERSION_PSEUDO "20170606215500"
#define NEUTRINO_VERSION_PSEUDO "20170904080000"