From 19f6a1449fe2c8a9a3d2c0d41e28a61bacd8c4d4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 10 Apr 2021 22:19:43 +0200 Subject: [PATCH] update_check: add class for package update checks Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4dcb3b19869689059c44c461b518e4e59efb7208 Author: Thilo Graf Date: 2021-04-10 (Sat, 10 Apr 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/Makefile.am | 1 + src/gui/update_check_packages.cpp | 62 +++++++++++++++++++++++++++++++ src/gui/update_check_packages.h | 42 +++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/gui/update_check_packages.cpp create mode 100644 src/gui/update_check_packages.h diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 64ebc6ac9..e6d1fc937 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -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 \ diff --git a/src/gui/update_check_packages.cpp b/src/gui/update_check_packages.cpp new file mode 100644 index 000000000..ed00838ab --- /dev/null +++ b/src/gui/update_check_packages.cpp @@ -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 . + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "update_check_packages.h" +#include "opkg_manager.h" +#include "widget/msgbox.h" +#include +#include + +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); +} diff --git a/src/gui/update_check_packages.h b/src/gui/update_check_packages.h new file mode 100644 index 000000000..9be74c6c2 --- /dev/null +++ b/src/gui/update_check_packages.h @@ -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 . + */ + +#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__