mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
lcd4linux: add slots for more user involvement
Keeps gui stuff away from parts of /src/driver and
callbacks with messages should inform the user about possible
operations during activation or deactivation of service.
Reason: long breaks are mediating
freeze or unknown status that leave the user in the dark.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 826d56a575
Author: Thilo Graf <dbt@novatux.de>
Date: 2021-06-30 (Wed, 30 Jun 2021)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
Homepage: http://www.neutrino-images.de/
|
Homepage: http://www.neutrino-images.de/
|
||||||
|
|
||||||
Copyright (C) 2016-2019 'TangoCash'
|
Copyright (C) 2016-2019 'TangoCash'
|
||||||
|
Copyright (C) 2021, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -153,6 +154,7 @@ void CLCD4l::InitLCD4l()
|
|||||||
|
|
||||||
void CLCD4l::StartLCD4l()
|
void CLCD4l::StartLCD4l()
|
||||||
{
|
{
|
||||||
|
OnBeforeStart();
|
||||||
if (!thrLCD4l)
|
if (!thrLCD4l)
|
||||||
{
|
{
|
||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] starting thread with mode %d \033[0m\n", __func__, __LINE__, g_settings.lcd4l_support);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] starting thread with mode %d \033[0m\n", __func__, __LINE__, g_settings.lcd4l_support);
|
||||||
@@ -161,12 +163,17 @@ void CLCD4l::StartLCD4l()
|
|||||||
thrLCD4l = new std::thread(LCD4lProc, this);
|
thrLCD4l = new std::thread(LCD4lProc, this);
|
||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_settings.lcd4l_support)
|
if (g_settings.lcd4l_support)
|
||||||
exec_initscript("lcd4linux", "start");
|
{
|
||||||
|
if (exec_initscript("lcd4linux", "start"))
|
||||||
|
OnAfterStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLCD4l::StopLCD4l()
|
void CLCD4l::StopLCD4l()
|
||||||
{
|
{
|
||||||
|
OnBeforeStop();
|
||||||
if (thrLCD4l)
|
if (thrLCD4l)
|
||||||
{
|
{
|
||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] stopping thread [%p]\033[0m\n", __func__, __LINE__, thrLCD4l);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] stopping thread [%p]\033[0m\n", __func__, __LINE__, thrLCD4l);
|
||||||
@@ -179,7 +186,9 @@ void CLCD4l::StopLCD4l()
|
|||||||
thrLCD4l = NULL;
|
thrLCD4l = NULL;
|
||||||
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l);
|
dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l);
|
||||||
}
|
}
|
||||||
exec_initscript("lcd4linux", "stop");
|
|
||||||
|
if (exec_initscript("lcd4linux", "stop"))
|
||||||
|
OnAfterStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLCD4l::SwitchLCD4l()
|
void CLCD4l::SwitchLCD4l()
|
||||||
@@ -843,7 +852,11 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun)
|
|||||||
m_Layout = Layout;
|
m_Layout = Layout;
|
||||||
|
|
||||||
if (!firstRun)
|
if (!firstRun)
|
||||||
exec_initscript("lcd4linux", "reload");
|
{
|
||||||
|
OnBeforeRestart();
|
||||||
|
if (exec_initscript("lcd4linux", "restart"))
|
||||||
|
OnAfterRestart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
Homepage: http://www.neutrino-images.de/
|
Homepage: http://www.neutrino-images.de/
|
||||||
|
|
||||||
Copyright (C) 2016-2019 'TangoCash'
|
Copyright (C) 2016-2019 'TangoCash'
|
||||||
|
Copyright (C) 2021, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <sigc++/signal.h>
|
||||||
|
|
||||||
class CLCD4l
|
class CLCD4l
|
||||||
{
|
{
|
||||||
@@ -63,6 +65,15 @@ class CLCD4l
|
|||||||
|
|
||||||
void ResetParseID() { m_ParseID = 0; }
|
void ResetParseID() { m_ParseID = 0; }
|
||||||
|
|
||||||
|
// use signal/slot handlers
|
||||||
|
// That is helping to keep the GUI code away from code inside ./src/driver.
|
||||||
|
sigc::signal<void> OnBeforeRestart,
|
||||||
|
OnAfterRestart,
|
||||||
|
OnBeforeStart,
|
||||||
|
OnAfterStart,
|
||||||
|
OnBeforeStop,
|
||||||
|
OnAfterStop;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::thread *thrLCD4l;
|
std::thread *thrLCD4l;
|
||||||
static void *LCD4lProc(void *arg);
|
static void *LCD4lProc(void *arg);
|
||||||
|
@@ -4,10 +4,11 @@
|
|||||||
Copyright (C) 2012 'defans'
|
Copyright (C) 2012 'defans'
|
||||||
Homepage: http://www.bluepeercrew.us/
|
Homepage: http://www.bluepeercrew.us/
|
||||||
|
|
||||||
Copyright (C) 2012-2018 'vanhofen'
|
Copyright (C) 2012-2021 'vanhofen'
|
||||||
Homepage: http://www.neutrino-images.de/
|
Homepage: http://www.neutrino-images.de/
|
||||||
|
|
||||||
Copyright (C) 2016-2018 'TangoCash'
|
Copyright (C) 2016-2018 'TangoCash'
|
||||||
|
(C) 2021, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -22,9 +23,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@@ -89,15 +88,24 @@ const CMenuOptionChooser::keyval LCD4L_SAMSUNG_SKIN_OPTIONS[] =
|
|||||||
};
|
};
|
||||||
#define LCD4L_SAMSUNG_SKIN_OPTION_COUNT (sizeof(LCD4L_SAMSUNG_SKIN_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
|
#define LCD4L_SAMSUNG_SKIN_OPTION_COUNT (sizeof(LCD4L_SAMSUNG_SKIN_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
|
||||||
|
|
||||||
|
using namespace sigc;
|
||||||
|
|
||||||
CLCD4lSetup::CLCD4lSetup()
|
CLCD4lSetup::CLCD4lSetup()
|
||||||
{
|
{
|
||||||
width = 40;
|
width = 40;
|
||||||
|
hint = NULL;
|
||||||
lcd4l_display_type_changed = false;
|
lcd4l_display_type_changed = false;
|
||||||
|
|
||||||
|
sl_start = bind(mem_fun(*this, &CLCD4lSetup::showHint), "Starting lcd service...");
|
||||||
|
sl_stop = bind(mem_fun(*this, &CLCD4lSetup::showHint), "Stopping lcd service...");
|
||||||
|
sl_restart = bind(mem_fun(*this, &CLCD4lSetup::showHint), "Restarting lcd service...");
|
||||||
|
sl_remove = mem_fun(*this, &CLCD4lSetup::removeHint);
|
||||||
|
connectSlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLCD4lSetup::~CLCD4lSetup()
|
CLCD4lSetup::~CLCD4lSetup()
|
||||||
{
|
{
|
||||||
|
removeHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLCD4lSetup* CLCD4lSetup::getInstance()
|
CLCD4lSetup* CLCD4lSetup::getInstance()
|
||||||
@@ -304,3 +312,32 @@ int CLCD4lSetup::showTypeSetup()
|
|||||||
|
|
||||||
return typeSetup->exec(NULL, "");
|
return typeSetup->exec(NULL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLCD4lSetup::showHint(const std::string &text)
|
||||||
|
{
|
||||||
|
removeHint();
|
||||||
|
hint = new CHint(text.c_str());
|
||||||
|
hint->paint();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLCD4lSetup::removeHint()
|
||||||
|
{
|
||||||
|
if (hint)
|
||||||
|
{
|
||||||
|
hint->hide();
|
||||||
|
delete hint;
|
||||||
|
hint = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLCD4lSetup::connectSlots()
|
||||||
|
{
|
||||||
|
CLCD4l::getInstance()->OnBeforeStart.connect(sl_start);
|
||||||
|
CLCD4l::getInstance()->OnBeforeStop.connect(sl_stop);
|
||||||
|
CLCD4l::getInstance()->OnBeforeRestart.connect(sl_restart);
|
||||||
|
|
||||||
|
CLCD4l::getInstance()->OnAfterStart.connect(sl_remove);
|
||||||
|
CLCD4l::getInstance()->OnAfterStop.connect(sl_remove);
|
||||||
|
CLCD4l::getInstance()->OnAfterRestart.connect(sl_remove);
|
||||||
|
}
|
||||||
|
@@ -4,10 +4,11 @@
|
|||||||
Copyright (C) 2012 'defans'
|
Copyright (C) 2012 'defans'
|
||||||
Homepage: http://www.bluepeercrew.us/
|
Homepage: http://www.bluepeercrew.us/
|
||||||
|
|
||||||
Copyright (C) 2012-2018 'vanhofen'
|
Copyright (C) 2012-2021 'vanhofen'
|
||||||
Homepage: http://www.neutrino-images.de/
|
Homepage: http://www.neutrino-images.de/
|
||||||
|
|
||||||
Copyright (C) 2016-2018 'TangoCash'
|
Copyright (C) 2016-2018 'TangoCash'
|
||||||
|
(C) 2021, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -22,16 +23,16 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __lcd4l_setup__
|
#ifndef __lcd4l_setup__
|
||||||
#define __lcd4l_setup__
|
#define __lcd4l_setup__
|
||||||
|
|
||||||
#include <gui/widget/menue.h>
|
#include "gui/widget/menue.h"
|
||||||
|
#include "gui/widget/hintbox.h"
|
||||||
|
#include <sigc++/signal.h>
|
||||||
|
|
||||||
class CLCD4lSetup : public CMenuTarget, CChangeObserver
|
class CLCD4lSetup : public CMenuTarget, CChangeObserver
|
||||||
{
|
{
|
||||||
@@ -45,12 +46,20 @@ class CLCD4lSetup : public CMenuTarget, CChangeObserver
|
|||||||
int show();
|
int show();
|
||||||
int showTypeSetup();
|
int showTypeSetup();
|
||||||
|
|
||||||
|
//messages
|
||||||
|
CHint *hint;
|
||||||
|
void removeHint();
|
||||||
|
void showHint(const std::string &text);
|
||||||
|
//slots
|
||||||
|
sigc::slot<void> sl_start, sl_stop, sl_restart, sl_remove;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CLCD4lSetup* getInstance();
|
static CLCD4lSetup* getInstance();
|
||||||
CLCD4lSetup();
|
CLCD4lSetup();
|
||||||
~CLCD4lSetup();
|
~CLCD4lSetup();
|
||||||
int exec(CMenuTarget *parent, const std::string &actionkey);
|
int exec(CMenuTarget *parent, const std::string &actionkey);
|
||||||
virtual bool changeNotify(const neutrino_locale_t OptionName, void * /*data*/);
|
virtual bool changeNotify(const neutrino_locale_t OptionName, void * /*data*/);
|
||||||
|
void connectSlots();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user