mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
imageinfo-ni: formatting code using astyle
Origin commit data
------------------
Branch: ni/coolstream
Commit: 54b44d662e
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-11-07 (Sun, 07 Nov 2021)
Origin message was:
------------------
- imageinfo-ni: formatting code using astyle
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
imageinfo_ni
|
||||
|
||||
(C) 2009-2016 NG-Team
|
||||
(C) 2016,2017 NI-Team
|
||||
(C) 2016-2021 NI-Team
|
||||
|
||||
License: GPL
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -135,7 +134,8 @@ void CImageInfoNI::Init(void)
|
||||
max_text_width = xcpu - x - OFFSET_INNER_MID;
|
||||
|
||||
offset = 0;
|
||||
for (int i = 0; i < info_items_count; i++) {
|
||||
for (int i = 0; i < info_items_count; i++)
|
||||
{
|
||||
int tmpoffset = g_Font[font_info]->getRenderWidth(g_Locale->getText(info_items[i]));
|
||||
if (tmpoffset > offset)
|
||||
offset = tmpoffset;
|
||||
@@ -394,7 +394,8 @@ void* CImageInfoNI::InfoProc(void *arg)
|
||||
|
||||
CImageInfoNI *imageInfo = (CImageInfoNI *) arg;
|
||||
|
||||
while(1) {
|
||||
while (1)
|
||||
{
|
||||
imageInfo->paint_MEM_Info(imageInfo->x, imageInfo->ypos);
|
||||
imageInfo->paint_NET_Info(imageInfo->x, imageInfo->ypos);
|
||||
sleep(1);
|
||||
@@ -404,7 +405,8 @@ void* CImageInfoNI::InfoProc(void *arg)
|
||||
|
||||
void CImageInfoNI::StartInfoThread()
|
||||
{
|
||||
if(!InfoThread) {
|
||||
if (!InfoThread)
|
||||
{
|
||||
printf("CImageInfoNI::StartInfoThread\n");
|
||||
pthread_create(&InfoThread, NULL, InfoProc, (void *) this) ;
|
||||
pthread_detach(InfoThread);
|
||||
@@ -413,7 +415,8 @@ void CImageInfoNI::StartInfoThread()
|
||||
|
||||
void CImageInfoNI::StopInfoThread()
|
||||
{
|
||||
if(InfoThread) {
|
||||
if (InfoThread)
|
||||
{
|
||||
printf("CImageInfoNI::StopInfoThread\n");
|
||||
pthread_cancel(InfoThread);
|
||||
InfoThread = 0;
|
||||
@@ -602,10 +605,12 @@ int CImageInfoNI::y_cpu_pixel(int value, int max_value, int max_y)
|
||||
{
|
||||
int l;
|
||||
|
||||
if (!max_value) max_value = 1;
|
||||
if (!max_value)
|
||||
max_value = 1;
|
||||
|
||||
l = (max_y * value) / max_value;
|
||||
if (l > max_y) l = max_y;
|
||||
if (l > max_y)
|
||||
l = max_y;
|
||||
|
||||
return l;
|
||||
}
|
||||
@@ -630,7 +635,8 @@ void CImageInfoNI::get_DF_Info()
|
||||
|
||||
while ((read = getline(&buffer, &len, pipe_reader)) != -1)
|
||||
{
|
||||
if ((ptr = strstr(buffer, mtd_info[systemfs].dev))) {
|
||||
if ((ptr = strstr(buffer, mtd_info[systemfs].dev)))
|
||||
{
|
||||
sscanf(ptr + strlen(mtd_info[systemfs].dev), "%ld\t%ld\t%ld\t%i",
|
||||
&image_size.blocks,
|
||||
&image_size.used,
|
||||
@@ -672,16 +678,16 @@ void CImageInfoNI::paint_DF_Info(int posx)
|
||||
if (image_size.blocks > 1024)
|
||||
{
|
||||
if (image_size.used > 1024)
|
||||
buf << "Total: " << (image_size.blocks/1024.0) << " MB Used: " << (image_size.used/1024.0) << " MB";
|
||||
buf << "Total: " << (image_size.blocks / 1024.0) << " MB, Used: " << (image_size.used / 1024.0) << " MB";
|
||||
else
|
||||
buf << "Total: " << (image_size.blocks/1024.0) << " MB Used: " << image_size.used << " KB";
|
||||
buf << "Total: " << (image_size.blocks / 1024.0) << " MB, Used: " << image_size.used << " kB";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (image_size.used > 1024)
|
||||
buf << "Total: " << image_size.blocks << " KB Used: " << (image_size.used/1024.0) << " MB";
|
||||
buf << "Total: " << image_size.blocks << " kB, Used: " << (image_size.used / 1024.0) << " MB";
|
||||
else
|
||||
buf << "Total: " << image_size.blocks << " KB Used: " << image_size.used << " KB";
|
||||
buf << "Total: " << image_size.blocks << " kB, Used: " << image_size.used << " kB";
|
||||
}
|
||||
|
||||
ypos += sheight;
|
||||
@@ -691,7 +697,7 @@ void CImageInfoNI::paint_DF_Info(int posx)
|
||||
if (image_size.available > 1024)
|
||||
buf << "Free: " << (image_size.available / 1024.0) << " MB";
|
||||
else
|
||||
buf << "Free: " << image_size.available << " KB";
|
||||
buf << "Free: " << image_size.available << " kB";
|
||||
|
||||
ypos += sheight;
|
||||
paintLine(posx, font_small, buf.str());
|
||||
@@ -719,7 +725,8 @@ int CImageInfoNI::get_MEM_Info()
|
||||
sscanf(ptr + 9, "%i", &mem_info.free);
|
||||
else if ((ptr = strstr(buffer, "Buffers:")))
|
||||
sscanf(ptr + 9, "%i", &mem_info.buffers);
|
||||
else if ((ptr = strstr(buffer, "Cached:"))) {
|
||||
else if ((ptr = strstr(buffer, "Cached:")))
|
||||
{
|
||||
sscanf(ptr + 8, "%i", &mem_info.cached);
|
||||
break;
|
||||
}
|
||||
@@ -768,18 +775,18 @@ void CImageInfoNI::paint_MEM_Info(int posx, int posy)
|
||||
posy += sheight;
|
||||
buf.str("");
|
||||
buf.precision(2);
|
||||
buf << std::fixed << "Total: " << (mem_info.total/1024.0) << " MB Used: " << (mem_info.used/1024.0) << " MB";
|
||||
buf << std::fixed << "Total: " << (mem_info.total / 1024.0) << " MB, Used: " << (mem_info.used / 1024.0) << " MB";
|
||||
frameBuffer->paintBoxRel(posx, posy - sheight, max_text_width, sheight, COL_INFOBAR_PLUS_0);
|
||||
g_Font[font_small]->RenderString(posx, posy, max_text_width, buf.str().c_str(), COL_INFOBAR_TEXT);
|
||||
|
||||
posy += sheight;
|
||||
buf.str("");
|
||||
buf << "Free: " << (mem_info.tfree < 1024 ? mem_info.tfree : (mem_info.tfree / 1024.0))
|
||||
<< (mem_info.tfree < 1024?" KB ":" MB ")
|
||||
<< (mem_info.tfree < 1024 ? " kB " : " MB ")
|
||||
<< "(Buffers: " << (mem_info.buffers < 1024 ? mem_info.buffers : (mem_info.buffers / 1024.0))
|
||||
<< (mem_info.buffers < 1024?" KB, ":" MB, ")
|
||||
<< (mem_info.buffers < 1024 ? " kB, " : " MB, ")
|
||||
<< "Cached: " << (mem_info.cached < 1024 ? mem_info.cached : (mem_info.cached / 1024.0))
|
||||
<< (mem_info.cached < 1024?" KB":" MB)");
|
||||
<< (mem_info.cached < 1024 ? " kB" : " MB)");
|
||||
|
||||
frameBuffer->paintBoxRel(posx, posy - sheight, max_text_width, sheight, COL_INFOBAR_PLUS_0);
|
||||
g_Font[font_small]->RenderString(posx, posy, max_text_width, buf.str().c_str(), COL_INFOBAR_TEXT);
|
||||
@@ -883,8 +890,8 @@ void CImageInfoNI::paint_NET_Info(int posx, int posy)
|
||||
/*
|
||||
* 100 MBit
|
||||
* 12,5 MByte (MB)
|
||||
* 12800 KByte (KB)
|
||||
* 102400 KBit
|
||||
* 12800 kByte (kB)
|
||||
* 102400 kBit
|
||||
* 13107200 Byte
|
||||
* 104857600 Bit
|
||||
*/
|
||||
@@ -924,7 +931,7 @@ void CImageInfoNI::paint_NET_Info(int posx, int posy)
|
||||
|
||||
posy += sheight;
|
||||
|
||||
sprintf(temp_string,"Receive: %llu bit/s Transmit: %llu bit/s",(long long unsigned int)rbit_s,(long long unsigned int)wbit_s);
|
||||
sprintf(temp_string, "Receive: %llu bit/s, Transmit: %llu bit/s", (long long unsigned int)rbit_s, (long long unsigned int)wbit_s);
|
||||
frameBuffer->paintBoxRel(posx, posy - sheight, max_text_width, sheight, COL_INFOBAR_PLUS_0);
|
||||
g_Font[font_small]->RenderString(posx, posy, max_text_width, temp_string, COL_INFOBAR_TEXT);
|
||||
|
||||
|
@@ -63,7 +63,8 @@ class CImageInfoNI : public CMenuTarget
|
||||
void paintLine(int xpos, int font, std::string text);
|
||||
void clearLine(int xpos, int font);
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned long usr;
|
||||
unsigned int nice;
|
||||
unsigned long system;
|
||||
@@ -74,14 +75,16 @@ class CImageInfoNI : public CMenuTarget
|
||||
unsigned long old_idle;
|
||||
} _stat;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
unsigned long blocks;
|
||||
unsigned long used;
|
||||
unsigned long available;
|
||||
int percent;
|
||||
} image_size;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
int total;
|
||||
int free;
|
||||
int buffers;
|
||||
@@ -90,7 +93,8 @@ class CImageInfoNI : public CMenuTarget
|
||||
int used;
|
||||
} mem_info;
|
||||
|
||||
struct S_MTD_INFO {
|
||||
struct S_MTD_INFO
|
||||
{
|
||||
char dev[8];
|
||||
char size[9];
|
||||
char erasesize[9];
|
||||
@@ -145,7 +149,6 @@ class CImageInfoNI : public CMenuTarget
|
||||
std::string getYWebVersion();
|
||||
|
||||
public:
|
||||
|
||||
CImageInfoNI();
|
||||
~CImageInfoNI();
|
||||
|
||||
|
Reference in New Issue
Block a user