update_check: add class for package update checks

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4dcb3b1986
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:19:43 +02:00
committed by vanhofen
parent b2599f2134
commit 19f6a1449f
3 changed files with 105 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ libneutrino_gui_a_SOURCES = \
timeosd.cpp \
update.cpp \
update_check.cpp \
update_check_packages.cpp \
update_menue.cpp \
update_settings.cpp \
user_menue.cpp \

View File

@@ -0,0 +1,62 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Update check for Neutrino-GUI
Copyright (C) 2020 T. Graf 'dbt'
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, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "update_check_packages.h"
#include "opkg_manager.h"
#include "widget/msgbox.h"
#include <system/debug.h>
#include <system/helpers.h>
CUpdateCheck::CUpdateCheck():CComponentsTimer(1000*60/*1000*6*60*/)
{
tm_thread_name = "n:update_check";
//init slot for package check
OnTimer.connect(sigc::mem_fun(*this, &CUpdateCheck::check4PackageUpdates));
}
CUpdateCheck* CUpdateCheck::getInstance()
{
static CUpdateCheck * uc = NULL;
if (!uc)
uc = new CUpdateCheck();
return uc;
}
void CUpdateCheck::check4PackageUpdates()
{
if (!g_settings.softupdate_autocheck)
return;
COPKGManager man;
if (!man.hasOpkgSupport())
return;
man.setUpdateCheckResult(false);
}

View File

@@ -0,0 +1,42 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Update check for Neutrino-GUI
Copyright (C) 2020 T. Graf 'dbt'
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef __UPDATE_CHECK_PACKAGES_H__
#define __UPDATE_CHECK_PACKAGES_H__
#include "components/cc_timer.h"
class CUpdateCheck : public CComponentsTimer
{
private:
void check4PackageUpdates();
public:
CUpdateCheck();
virtual ~CUpdateCheck(){};
static CUpdateCheck* getInstance();
void startThread() {initThread();}
};
#endif // __UPDATE_CHECK_PACKAGES_H__