mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
filebrowser: make size, time and mode fields scale with fontsize
Origin commit data
------------------
Branch: ni/coolstream
Commit: b239ba0b84
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-11-24 (Sat, 24 Nov 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1233,7 +1233,7 @@ void CFileBrowser::hide()
|
|||||||
|
|
||||||
void CFileBrowser::paintItem(unsigned int pos)
|
void CFileBrowser::paintItem(unsigned int pos)
|
||||||
{
|
{
|
||||||
int colwidth1, colwidth2, colwidth3, colwidth1_dir, colwidth2_dir;
|
int colwidth1, colwidth2, colwidth3;
|
||||||
int c_rad_small;
|
int c_rad_small;
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
fb_pixel_t bgcolor;
|
fb_pixel_t bgcolor;
|
||||||
@@ -1241,9 +1241,6 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
CFile * actual_file = NULL;
|
CFile * actual_file = NULL;
|
||||||
std::string fileicon;
|
std::string fileicon;
|
||||||
|
|
||||||
colwidth2_dir = 180;
|
|
||||||
colwidth1_dir = width - 35 - colwidth2_dir - 10;
|
|
||||||
|
|
||||||
if (liststart + pos == selected)
|
if (liststart + pos == selected)
|
||||||
{
|
{
|
||||||
color = COL_MENUCONTENTSELECTED;
|
color = COL_MENUCONTENTSELECTED;
|
||||||
@@ -1271,15 +1268,10 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode))
|
if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode))
|
||||||
{
|
|
||||||
colwidth2 = 0;
|
colwidth2 = 0;
|
||||||
colwidth3 = 90;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
colwidth2 = fnt_item->getRenderWidth("rwxrwxrwx");
|
||||||
colwidth2 = 90;
|
colwidth3 = fnt_item->getRenderWidth("222.222G");
|
||||||
colwidth3 = 90;
|
|
||||||
}
|
|
||||||
colwidth1 = width - 35 - colwidth2 - colwidth3 - 10;
|
colwidth1 = width - 35 - colwidth2 - colwidth3 - 10;
|
||||||
|
|
||||||
if ( actual_file->Name.length() > 0 )
|
if ( actual_file->Name.length() > 0 )
|
||||||
@@ -1325,7 +1317,7 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
}
|
}
|
||||||
modestring[9] = 0;
|
modestring[9] = 0;
|
||||||
|
|
||||||
fnt_item->RenderString(x + 35 + colwidth1 , ypos+ fheight, colwidth2 - 10, modestring, color, 0, true); // UTF-8
|
fnt_item->RenderString(x + width - 25 - colwidth3 - colwidth2 , ypos+ fheight, colwidth2, modestring, color, 0, true); // UTF-8
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GIGABYTE 1073741824LL
|
#define GIGABYTE 1073741824LL
|
||||||
@@ -1358,18 +1350,20 @@ void CFileBrowser::paintItem(unsigned int pos)
|
|||||||
else
|
else
|
||||||
snprintf(tmpstr,sizeof(tmpstr),"%d", (int)actual_file->Size);
|
snprintf(tmpstr,sizeof(tmpstr),"%d", (int)actual_file->Size);
|
||||||
|
|
||||||
fnt_item->RenderString(x + 35 + colwidth1 + colwidth2, ypos+ fheight, colwidth3 - 10, tmpstr, color);
|
/* right align file size */
|
||||||
|
int sz_w = fnt_item->getRenderWidth(tmpstr);
|
||||||
|
fnt_item->RenderString(x + width - sz_w - 25, ypos+ fheight, sz_w, tmpstr, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( S_ISDIR(actual_file->Mode) )
|
if( S_ISDIR(actual_file->Mode) )
|
||||||
{
|
{
|
||||||
char timestring[18];
|
char timestring[18];
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
|
|
||||||
rawtime = actual_file->Time;
|
rawtime = actual_file->Time;
|
||||||
strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime));
|
strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime));
|
||||||
|
/* right align directory time */
|
||||||
fnt_item->RenderString(x + 35 + colwidth1_dir, ypos+ fheight, colwidth2_dir - 10, timestring, color);
|
int time_w = fnt_item->getRenderWidth(timestring);
|
||||||
|
fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user