- subchannel-select: formatting code using astyle; some manual code nicenings

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-12-06 05:18:19 +01:00
committed by Thilo Graf
parent 389772e1a8
commit b42885f423
2 changed files with 38 additions and 50 deletions

View File

@@ -2,7 +2,7 @@
Neutrino-GUI - DBoxII-Project Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
Rework: Rework:
Outsourced subchannel select modul for Neutrino-HD Outsourced subchannel select modul for Neutrino-HD
Copyright (C) 2011 T.Graf 'dbt' Copyright (C) 2011 T.Graf 'dbt'
@@ -11,21 +11,21 @@
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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, General Public License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version. or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 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. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. 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; You should have received a copy of the GNU General Public License along with this program;
if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
NOTE for ignorant distributors: NOTE for ignorant distributors:
It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL.
Please read it and understand it right! Please read it and understand it right!
This means for you: Hold it, if not, leave it! You could face legal action! This means for you: Hold it, if not, leave it! You could face legal action!
Otherwise ask the copyright owners, anything else would be theft! Otherwise ask the copyright owners, anything else would be theft!
*/ */
@@ -33,7 +33,6 @@
#include <config.h> #include <config.h>
#endif #endif
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <mymenu.h> #include <mymenu.h>
@@ -41,19 +40,17 @@
#include "subchannel_select.h" #include "subchannel_select.h"
#include <driver/record.h> #include <driver/record.h>
extern CRemoteControl * g_RemoteControl; extern CRemoteControl *g_RemoteControl;
CSubChannelSelectMenu::CSubChannelSelectMenu() CSubChannelSelectMenu::CSubChannelSelectMenu()
{ {
} }
CSubChannelSelectMenu::~CSubChannelSelectMenu() CSubChannelSelectMenu::~CSubChannelSelectMenu()
{ {
} }
int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu) int CSubChannelSelectMenu::getNVODMenu(CMenuWidget *menu)
{ {
if (menu == NULL) if (menu == NULL)
return false; return false;
@@ -65,44 +62,44 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu)
int count = 0; int count = 0;
char nvod_id[5]; char nvod_id[5];
for ( CSubServiceListSorted::iterator e=g_RemoteControl->subChannels.begin(); e!=g_RemoteControl->subChannels.end(); ++e) for (CSubServiceListSorted::iterator e = g_RemoteControl->subChannels.begin(); e != g_RemoteControl->subChannels.end(); ++e)
{ {
snprintf(nvod_id, sizeof(nvod_id), "%d", count); snprintf(nvod_id, sizeof(nvod_id), "%d", count);
t_channel_id subid = e->getChannelID(); t_channel_id subid = e->getChannelID();
bool enabled = CRecordManager::getInstance()->SameTransponder(subid); bool enabled = CRecordManager::getInstance()->SameTransponder(subid);
if ( !g_RemoteControl->are_subchannels ) if (!g_RemoteControl->are_subchannels)
{ {
char nvod_time_a[50], nvod_time_e[50], nvod_time_x[50]; char nvod_time_a[50], nvod_time_e[50], nvod_time_x[50];
char nvod_s[152]; char nvod_s[152];
struct tm *tmZeit; struct tm *tmZeit;
tmZeit= localtime(&e->startzeit); tmZeit = localtime(&e->startzeit);
snprintf(nvod_time_a, sizeof(nvod_time_a), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min); snprintf(nvod_time_a, sizeof(nvod_time_a), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
time_t endtime = e->startzeit+ e->dauer; time_t endtime = e->startzeit + e->dauer;
tmZeit= localtime(&endtime); tmZeit = localtime(&endtime);
snprintf(nvod_time_e, sizeof(nvod_time_e), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min); snprintf(nvod_time_e, sizeof(nvod_time_e), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
time_t jetzt=time(NULL); time_t jetzt = time(NULL);
if (e->startzeit > jetzt) if (e->startzeit > jetzt)
{ {
int mins=(e->startzeit- jetzt)/ 60; int mins = (e->startzeit - jetzt) / 60;
snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_STARTING), mins); snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_STARTING), mins);
} }
else if ( (e->startzeit<= jetzt) && (jetzt < endtime) ) else if ((e->startzeit <= jetzt) && (jetzt < endtime))
{ {
int proz=(jetzt- e->startzeit)*100/ e->dauer; int proz = (jetzt - e->startzeit) * 100 / e->dauer;
snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_PERCENTAGE), proz); snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_PERCENTAGE), proz);
} }
else else
nvod_time_x[0]= 0; nvod_time_x[0] = 0;
snprintf(nvod_s, sizeof(nvod_s), "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x); snprintf(nvod_s, sizeof(nvod_s), "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x);
menu->addItem(new CMenuForwarder(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel)); menu->addItem(new CMenuForwarder(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel));
} }
else else
{ {
menu->addItem(new CMenuForwarder(e->subservice_name.c_str(), enabled, NULL, &NVODChanger, nvod_id, CRCInput::convertDigitToKey(count)), (count == g_RemoteControl->selected_subchannel)); menu->addItem(new CMenuForwarder(e->subservice_name.c_str(), enabled, NULL, &NVODChanger, nvod_id, CRCInput::convertDigitToKey(count)), (count == g_RemoteControl->selected_subchannel));
} }
@@ -112,14 +109,11 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu)
break; break;
} }
if ( g_RemoteControl->are_subchannels ) { if (g_RemoteControl->are_subchannels)
{
menu->addItem(GenericMenuSeparatorLine); menu->addItem(GenericMenuSeparatorLine);
CMenuOptionChooser* oj = new CMenuOptionChooser(LOCALE_NVODSELECTOR_DIRECTORMODE, &g_RemoteControl->director_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); CMenuOptionChooser *oj = new CMenuOptionChooser(LOCALE_NVODSELECTOR_DIRECTORMODE, &g_RemoteControl->director_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
menu->addItem(oj); menu->addItem(oj);
} }
return true; return true;
} }

View File

@@ -2,7 +2,7 @@
Neutrino-GUI - DBoxII-Project Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Homepage: http://dbox.cyberphoria.org/
Rework: Rework:
Outsourced subchannel select modul for Neutrino-HD Outsourced subchannel select modul for Neutrino-HD
Copyright (C) 2011 T.Graf 'dbt' Copyright (C) 2011 T.Graf 'dbt'
@@ -11,46 +11,40 @@
License: GPL License: GPL
This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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, General Public License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version. or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 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. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. 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; You should have received a copy of the GNU General Public License along with this program;
if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
NOTE for ignorant distributors: NOTE for ignorant distributors:
It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL. It's not allowed to distribute any compiled parts of this code, if you don't accept the terms of GPL.
Please read it and understand it right! Please read it and understand it right!
This means for you: Hold it, if not, leave it! You could face legal action! This means for you: Hold it, if not, leave it! You could face legal action!
Otherwise ask the copyright owners, anything else would be theft! Otherwise ask the copyright owners, anything else would be theft!
*/ */
#ifndef __subchannel_selector__ #ifndef __subchannel_selector__
#define __subchannel_selector__ #define __subchannel_selector__
#include "widget/menue.h" #include "widget/menue.h"
class CSubChannelSelectMenu class CSubChannelSelectMenu
{ {
private: private:
CNVODChangeExec NVODChanger; CNVODChangeExec NVODChanger;
public: public:
CSubChannelSelectMenu(); CSubChannelSelectMenu();
~CSubChannelSelectMenu(); ~CSubChannelSelectMenu();
int getNVODMenu(CMenuWidget* menu);
int getNVODMenu(CMenuWidget *menu);
}; };
#endif #endif