setting-helpers: formatting code using astyle

Origin commit data
------------------
Commit: 47fb92bd31
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-11-19 (Fri, 19 Nov 2021)

Origin message was:
------------------
- setting-helpers: formatting code using astyle
This commit is contained in:
vanhofen
2021-11-19 23:05:40 +01:00
parent f4509f290f
commit 6c8913a53f
2 changed files with 227 additions and 192 deletions

View File

@@ -61,7 +61,6 @@
#include <driver/display.h>
#include <driver/volume.h>
#include <system/helpers.h>
// obsolete #include <gui/streaminfo.h>
#include <gui/widget/msgbox.h>
#include <gui/widget/hintbox.h>
@@ -253,7 +252,8 @@ void CColorSetupNotifier::setPalette()
{
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
SNeutrinoTheme &t = g_settings.theme;
//setting colors-..
// setting colors
frameBuffer->paletteGenFade(COL_MENUHEAD,
convertSetupColor2RGB(t.menu_Head_red, t.menu_Head_green, t.menu_Head_blue),
convertSetupColor2RGB(t.menu_Head_Text_red, t.menu_Head_Text_green, t.menu_Head_Text_blue),
@@ -264,7 +264,6 @@ void CColorSetupNotifier::setPalette()
convertSetupColor2RGB(t.menu_Content_Text_red, t.menu_Content_Text_green, t.menu_Content_Text_blue),
8, convertSetupAlpha2Alpha(t.menu_Content_alpha));
frameBuffer->paletteGenFade(COL_MENUCONTENTDARK,
convertSetupColor2RGB(int(t.menu_Content_red * 0.6), int(t.menu_Content_green * 0.6), int(t.menu_Content_blue * 0.6)),
convertSetupColor2RGB(t.menu_Content_Text_red, t.menu_Content_Text_green, t.menu_Content_Text_blue),
@@ -413,38 +412,56 @@ bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *)
bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void *)
{
//printf("notify: %d\n", OptionName);
#if 0 //FIXME to do ? manual audio delay
#if 0
// FIXME to do ? manual audio delay
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_PCMOFFSET))
{
}
#endif
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_ANALOG_MODE)) {
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_ANALOG_MODE))
{
g_Zapit->setAudioMode(g_settings.audio_AnalogMode);
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_ANALOG_OUT)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_ANALOG_OUT))
{
audioDecoder->EnableAnalogOut(g_settings.analog_out ? true : false);
#if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_AC3)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_AC3))
{
audioDecoder->SetHdmiDD(g_settings.ac3_pass ? true : false);
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_DTS)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_DTS))
{
audioDecoder->SetSpdifDD(g_settings.dts_pass ? true : false);
#else
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_HDMI_DD)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_HDMI_DD))
{
audioDecoder->SetHdmiDD((HDMI_ENCODED_MODE) g_settings.hdmi_dd);
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_SPDIF_DD)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_SPDIF_DD))
{
audioDecoder->SetSpdifDD(g_settings.spdif_dd ? true : false);
#endif
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_AVSYNC)) {
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_AVSYNC))
{
videoDecoder->SetSyncMode((AVSYNC_TYPE)g_settings.avsync);
audioDecoder->SetSyncMode((AVSYNC_TYPE)g_settings.avsync);
videoDemux->SetSyncMode((AVSYNC_TYPE)g_settings.avsync);
audioDemux->SetSyncMode((AVSYNC_TYPE)g_settings.avsync);
pcrDemux->SetSyncMode((AVSYNC_TYPE)g_settings.avsync);
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_CLOCKREC)) {
//.Clock recovery enable/disable
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_CLOCKREC))
{
// Clock recovery enable/disable
// FIXME add code here.
} else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIO_SRS_ALGO) ||
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIO_SRS_ALGO) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIO_SRS_NMGR) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIO_SRS_VOLUME)) {
ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIO_SRS_VOLUME))
{
audioDecoder->SetSRS(g_settings.srs_enable, g_settings.srs_nmgr_enable, g_settings.srs_algo, g_settings.srs_ref_volume);
}
return false;
@@ -453,13 +470,13 @@ bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void
// used in ./gui/osd_setup.cpp:
bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *)
{
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FONTSIZE_HINT)); // UTF-8
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FONTSIZE_HINT));
hintBox.paint();
CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT);
hintBox.hide();
/* recalculate infoclock/muteicon/volumebar */
// recalculate infoclock/muteicon/volumebar
CVolumeHelper::getInstance()->refresh();
return true;
}
@@ -467,18 +484,22 @@ bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *)
int CSubtitleChangeExec::exec(CMenuTarget * /*parent*/, const std::string &actionKey)
{
printf("CSubtitleChangeExec::exec: action %s\n", actionKey.c_str());
if(actionKey == "off") {
if (actionKey == "off")
{
tuxtx_stop_subtitle();
dvbsub_stop();
return menu_return::RETURN_EXIT;
}
if(!strncmp(actionKey.c_str(), "DVB", 3)) {
if (!strncmp(actionKey.c_str(), "DVB", 3))
{
char const *pidptr = strchr(actionKey.c_str(), ':');
int pid = atoi(pidptr + 1);
tuxtx_stop_subtitle();
dvbsub_pause();
dvbsub_start(pid);
} else {
}
else
{
char const *ptr = strchr(actionKey.c_str(), ':');
ptr++;
int pid = atoi(ptr);
@@ -597,16 +618,20 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
printf("CTZChangeNotifier::changeNotify: %s\n", (char *) Data);
xmlDocPtr parser = parseXmlFile("/etc/timezone.xml");
if (parser != NULL) {
if (parser != NULL)
{
xmlNodePtr search = xmlDocGetRootElement(parser);
search = xmlChildrenNode(search);
while (search) {
if (!strcmp(xmlGetName(search), "zone")) {
while (search)
{
if (!strcmp(xmlGetName(search), "zone"))
{
const char *nptr = xmlGetAttribute(search, "name");
if (nptr)
name = nptr;
if(g_settings.timezone == name) {
if (g_settings.timezone == name)
{
const char *zptr = xmlGetAttribute(search, "zone");
if (zptr)
zone = zptr;
@@ -619,7 +644,8 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
}
xmlFreeDoc(parser);
}
if(found) {
if (found)
{
printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str());
std::string cmd = TARGET_PREFIX "/share/zoneinfo/" + zone;
printf("symlink %s to /etc/localtime\n", cmd.c_str());
@@ -627,9 +653,10 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
perror("unlink failed");
if (symlink(cmd.c_str(), "/etc/localtime"))
perror("symlink failed");
/* for yocto tzdata compatibility */
// for yocto tzdata compatibility
FILE *f = fopen("/etc/timezone", "w");
if (f) {
if (f)
{
fprintf(f, "%s\n", zone.c_str());
fclose(f);
}
@@ -652,21 +679,23 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK
neutrino_locale_t msg = delete_all ? LOCALE_RESET_ALL : delete_chan ? LOCALE_RESET_CHANNELS : LOCALE_RESET_SETTINGS;
int ret = menu_return::RETURN_REPAINT;
/* no need to confirm if we only remove deleted channels */
if (!delete_removed) {
// no need to confirm if we only remove deleted channels
if (!delete_removed)
{
int result = ShowMsg(msg, g_Locale->getText(LOCALE_RESET_CONFIRM), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo);
if (result != CMsgBox::mbrYes)
return true;
}
if(delete_all) {
if (delete_all)
{
my_system(3, "/bin/sh", "-c", "rm -f " ZAPITDIR "/*.conf");
CServiceManager::getInstance()->SatelliteList().clear();
CZapit::getInstance()->LoadSettings();
CZapit::getInstance()->GetConfig(zapitCfg);
#ifdef BOXMODEL_CST_HD2
/* flag file to erase /var partition on factory reset,
will be done by init scripts */
// flag file to erase /var partition on factory reset
// will be done by init scripts
FILE *fp = fopen("/var_init/etc/.reset", "w");
if (fp)
fclose(fp);
@@ -674,7 +703,8 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK
g_RCInput->postMsg(NeutrinoMessages::REBOOT, 0);
ret = menu_return::RETURN_EXIT_ALL;
}
if(delete_set) {
if (delete_set)
{
unlink(NEUTRINO_SETTINGS_FILE);
//unlink(NEUTRINO_SCAN_SETTINGS_FILE);
CNeutrinoApp::getInstance()->loadSetup(NEUTRINO_SETTINGS_FILE);
@@ -685,11 +715,13 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK
CVFD::getInstance()->setlcdparameter();
CFrameBuffer::getInstance()->Clear();
}
if(delete_chan) {
if (delete_chan)
{
my_system(3, "/bin/sh", "-c", "rm -f " ZAPITDIR "/*.xml");
g_Zapit->reinitChannels();
}
if (delete_removed) {
if (delete_removed)
{
CHintBox chb(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SERVICEMENU_RELOAD_HINT));
chb.paint();
CServiceManager::getInstance()->SaveServices(true, false, true);
@@ -705,7 +737,8 @@ void CFanControlNotifier::setSpeed(unsigned int speed)
printf("FAN Speed %d\n", speed);
#ifndef BOXMODEL_CST_HD2
int cfd = open("/dev/cs_control", O_RDONLY);
if(cfd < 0) {
if (cfd < 0)
{
perror("Cannot open /dev/cs_control");
return;
}
@@ -754,11 +787,13 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi
memset(modes, 0, sizeof(modes));
for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) {
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key < 0) /* not available on this platform */
for (i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++)
{
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key < 0) // not available on this platform
continue;
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key >= VIDEO_STD_MAX) {
/* this must not happen */
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key >= VIDEO_STD_MAX)
{
// this must not happen
printf("CAutoModeNotifier::changeNotify VIDEOMODE_OPTIONS[%d].key = %d (>= %d)\n",
i, VIDEOMENU_VIDEOMODE_OPTIONS[i].key, VIDEO_STD_MAX);
continue;