- screensaver: formatting code using astyle

Conflicts:
	src/gui/screensaver.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-10-24 21:47:44 +02:00
committed by Thilo Graf
parent 73778cfb34
commit d16f52922c
2 changed files with 104 additions and 66 deletions

View File

@@ -43,6 +43,8 @@
#include <system/debug.h>
#include <gui/color_custom.h>
#include <gui/infoclock.h>
// #include <gui/infoicons.h>
#include <gui/infoviewer.h>
#include <zapit/zapit.h>
#include <driver/pictureviewer/pictureviewer.h>
#include <system/set_threadname.h>
@@ -62,6 +64,7 @@ CScreenSaver::CScreenSaver()
index = 0;
status_mute = CAudioMute::getInstance()->getStatus();
// status_icons = CInfoIcons::getInstance()->getStatus();
clr.i_color = COL_DARK_GRAY;
for (unsigned int i = 0; i < 3; i++)
@@ -79,7 +82,10 @@ CScreenSaver::~CScreenSaver()
{
thrExit();
if (scr_clock){
// delete m_viewer;
if (scr_clock)
{
delete scr_clock;
scr_clock = NULL;
}
@@ -119,7 +125,10 @@ void CScreenSaver::Start()
if (!CInfoClock::getInstance()->isBlocked())
CInfoClock::getInstance()->block();
#if 0
status_icons = CInfoIcons::getInstance()->getStatus();
CInfoIcons::getInstance()->enableInfoIcons(false);
#endif
if (g_RadiotextWin)
g_Radiotext->OnAfterDecodeLine.block();
@@ -128,7 +137,24 @@ void CScreenSaver::Start()
if (pip_channel_id[0])
g_Zapit->stopPip();
#endif
#if 0
m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling);
m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY);
if (g_settings.video_Format == 3)
m_viewer->SetAspectRatio(float(16.0 / 9));
else
m_viewer->SetAspectRatio(float(4.0 / 3));
m_viewer->Cleanup();
#if HAVE_ARM_HARDWARE
/*
Hack to get sure we have a blank screen.
stopFrame()-function seems not work correctly on ARM_HARDWARE
*/
m_frameBuffer->showFrame("blackscreen.jpg");
#endif
#endif
m_frameBuffer->stopFrame();
if (!thrScreenSaver)
@@ -152,7 +178,8 @@ void CScreenSaver::Stop()
resetIdleTime();
if (scr_clock){
if (scr_clock)
{
std::lock_guard<std::mutex> g(scr_mutex);
scr_clock->Stop();
delete scr_clock;
@@ -160,7 +187,8 @@ void CScreenSaver::Stop()
}
#if ENABLE_PIP
if(pip_channel_id[0]) {
if (pip_channel_id[0])
{
CNeutrinoApp::getInstance()->StartPip(pip_channel_id[0]);
pip_channel_id[0] = 0;
}
@@ -172,7 +200,9 @@ void CScreenSaver::Stop()
CInfoClock::getInstance()->ClearDisplay(); // provokes reinit
CInfoClock::getInstance()->enableInfoClock();
#if 0
CInfoIcons::getInstance()->enableInfoIcons(status_icons);
#endif
if (g_RadiotextWin)
g_Radiotext->OnAfterDecodeLine.unblock();
@@ -194,7 +224,8 @@ void CScreenSaver::ScreenSaverPrg(CScreenSaver *scr)
scr->paint();
int corr = 1;
#if HAVE_CST_HARDWARE //time offset
#if HAVE_CST_HARDWARE
// time offset
corr = 10;
#endif
int t = 1000 / corr * g_settings.screensaver_timeout; // sleep and exit handle
@@ -226,7 +257,8 @@ bool CScreenSaver::ReadDir()
{
struct dirent **coverlist;
int n = scandir(COVERDIR_TMP, &coverlist, 0, alphasort);
if (n > 2){ // we always have the "." and ".." entrys
if (n > 2) // we always have the "." and ".." entrys
{
show_audiocover = true;
}
if (n > -1)
@@ -261,13 +293,14 @@ bool CScreenSaver::ReadDir()
v_bg_files.clear();
/* open dir */
if((dir=opendir(dir_name)) == NULL) {
// open dir
if ((dir = opendir(dir_name)) == NULL)
{
fprintf(stderr, "[CScreenSaver] %s - %d : error open dir...\n", __func__, __LINE__);
return ret;
}
/* read complete dir */
// read complete dir
while ((dirpointer = readdir(dir)) != NULL) // TODO: use threadsave readdir_r instead readdir
{
int curr_lenght = strlen((*dirpointer).d_name);
@@ -301,7 +334,7 @@ bool CScreenSaver::ReadDir()
sort(v_bg_files.begin(), v_bg_files.end());
/* close pointer */
// close pointer
if (closedir(dir) == -1)
dprintf(DEBUG_NORMAL, "[CScreenSaver] %s - %d : Error no closed %s\n", __func__, __LINE__, dir_name);
@@ -375,7 +408,8 @@ void CScreenSaver::paint()
#endif
}
#if !HAVE_CST_HARDWARE
#if 0 //example for callback
#if 0
// example for callback
m_frameBuffer->OnFallbackShowFrame.connect(sigc::bind(sigc::mem_fun(CFrameBuffer::getInstance(),
&CFrameBuffer::paintBoxRel),
scr_clock->getXPos(), scr_clock->getYPos(),
@@ -427,7 +461,8 @@ void CScreenSaver::paint()
uint32_t brightness;
// sorcery, no darkness
do {
do
{
clr.i_color = rand_r(&seed[3]);
brightness = (unsigned int)clr.uc_color.r * 19595 + (unsigned int)clr.uc_color.g * 38469 + (unsigned int)clr.uc_color.b * 7471;
//printf("[%s] %s: brightness: %d\n", __file__, __FUNCTION__, brightness>> 16);
@@ -507,7 +542,7 @@ bool CScreenSaver::isActive()
bool CScreenSaver::ignoredMsg(neutrino_msg_t msg)
{
/* screensaver will ignore these msgs */
// screensaver will ignore these msgs
if (
msg == NeutrinoMessages::EVT_CURRENTEPG
|| msg == NeutrinoMessages::EVT_NEXTEPG
@@ -520,6 +555,7 @@ bool CScreenSaver::ignoredMsg(neutrino_msg_t msg)
|| msg == NeutrinoMessages::EVT_ZAP_GOTPIDS
|| msg == NeutrinoMessages::EVT_EIT_COMPLETE
|| msg == NeutrinoMessages::EVT_BACK_ZAP_COMPLETE
|| msg == CSectionsdClient::EVT_GOT_CN_EPG
)
return true;

View File

@@ -59,8 +59,10 @@ class CScreenSaver : public sigc::trackable
time_t idletime;
union u_color {
struct s_color {
union u_color
{
struct s_color
{
uint8_t b, g, r, a;
} uc_color;
unsigned int i_color;