本文整理汇总了C++中Disk::guessIconName方法的典型用法代码示例。如果您正苦于以下问题:C++ Disk::guessIconName方法的具体用法?C++ Disk::guessIconName怎么用?C++ Disk::guessIconName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Disk
的用法示例。
在下文中一共展示了Disk::guessIconName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: t
DiskList::DiskList()
{
//FIXME bug prone
setenv( "LANG", "en_US", 1 );
setenv( "LC_ALL", "en_US", 1 );
setenv( "LC_MESSAGES", "en_US", 1 );
setenv( "LC_TYPE", "en_US", 1 );
setenv( "LANGUAGE", "en_US", 1 );
char buffer[4096];
FILE *df = popen( "env LC_ALL=POSIX df " DF_ARGS, "r" );
int const N = fread( (void*)buffer, sizeof(char), 4096, df );
buffer[ N ] = '\0';
pclose( df );
QString output = QString::fromLocal8Bit( buffer );
QTextStream t( &output, IO_ReadOnly );
QString const BLANK( QChar(' ') );
while (!t.atEnd()) {
QString s = t.readLine();
s = s.simplifyWhiteSpace();
if (s.isEmpty())
continue;
if (s.find( BLANK ) < 0) // devicename was too long, rest in next line
if (!t.eof()) { // just appends the next line
QString v = t.readLine();
s = s.append( v.latin1() );
s = s.simplifyWhiteSpace();
}
Disk disk;
disk.device = s.left( s.find( BLANK ) );
s = s.remove( 0, s.find( BLANK ) + 1 );
#ifndef NO_FS_TYPE
disk.type = s.left( s.find( BLANK ) );
s = s.remove( 0, s.find( BLANK ) + 1 );
#endif
int n = s.find( BLANK );
disk.size = s.left( n ).toInt();
s = s.remove( 0, n + 1 );
n = s.find( BLANK );
disk.used = s.left( n ).toInt();
s = s.remove( 0, n + 1 );
n = s.find( BLANK );
disk.free = s.left( n ).toInt();
s = s.remove( 0, n + 1 );
s = s.remove( 0, s.find( BLANK ) + 1 ); // delete the capacity 94%
disk.mount = s;
disk.guessIconName();
*this += disk;
}
}