#include <FileItem.h>
Public Member Functions | |
FileItem (QListView *, QString, int, bool) | |
FileItem (QListViewItem *, QString, int, bool) | |
void | setProperties (QString, QString, QString, unsigned long long int, QDateTime, unsigned int) |
QString | getFileName (void) |
bool | isDir (void) |
QString | getPermissions (void) |
bool | canRead (void) |
bool | isLink (void) |
bool | isBrokenLink (void) |
unsigned long long int | getSize (void) |
QDateTime | getDate (void) |
QString | getOwner (void) |
QString | getGroup (void) |
int | getType (void) |
unsigned int | getExtType (void) |
CRioSession * | getSession (void) |
QString | getPath (void) |
Static Public Member Functions | |
static bool | getPathUntil (unsigned int, QString, QString *) |
Static Public Attributes | |
static const unsigned int | COLUMN_FILENAME = 0 |
static const unsigned int | COLUMN_SIZE = 1 |
static const unsigned int | COLUMN_DATE = 2 |
static const unsigned int | COLUMN_OWNER = 3 |
static const unsigned int | COLUMN_GROUP = 4 |
static const unsigned int | COLUMN_PERMISSIONS = 5 |
static const unsigned int | COLUMN_VIDEORATE = 6 |
static const unsigned int | ICONID_DIRECTORY = 0 |
static const unsigned int | ICONID_LOCKED_DIRECTORY = 1 |
static const unsigned int | ICONID_LOCKED_FILE = 2 |
static const unsigned int | ICONID_UNKNOWN_FILE = 3 |
static const unsigned int | ICONID_MPG = 4 |
static const unsigned int | ICONID_XML = 5 |
static const unsigned int | ICONID_BROWSER = 6 |
static const unsigned int | ICONID_RELATED_MEDIA = 7 |
static const unsigned int | ICONID_INDEX = 8 |
static const unsigned int | ICONID_TGIF = 9 |
static const unsigned int | ICONID_ZIP_FILE = 10 |
static const unsigned int | ICONID_DIR_LINK = 11 |
static const unsigned int | ICONID_BROKEN_LINK = 12 |
static const unsigned int | ICONID_UNKNOWN_FILE_LINK = 13 |
static const unsigned int | ICONID_MPG_LINK = 14 |
static const unsigned int | ICONID_BROWSER_LINK = 15 |
static const unsigned int | ICONID_XML_LINK = 16 |
static const unsigned int | ICONID_ZIP_FILE_LINK = 17 |
Private Member Functions | |
void | autoSetIcon (void) |
void | setUpData (QString, int, bool) |
int | compare (QListViewItem *, int, bool) const |
This function reimplements the comparison method Compares the object sizes numerically Compares the object dates chronologically. | |
Private Attributes | |
QString | fileName |
QString | owner |
QString | group |
QString | permissions |
unsigned long long int | size |
QDateTime | date |
int | type |
unsigned int | VideoRate |
bool | UseVideoRate |
Definition at line 26 of file FileItem.h.
FileItem::FileItem | ( | QListView * | parent, | |
QString | fileName, | |||
int | type, | |||
bool | UseVideoRate | |||
) |
Definition at line 42 of file FileItem.cpp.
00044 : QListViewItem( parent ) 00045 { 00046 setUpData( fileName, type, UseVideoRate ); 00047 }
FileItem::FileItem | ( | QListViewItem * | parent, | |
QString | fileName, | |||
int | type, | |||
bool | UseVideoRate | |||
) |
Definition at line 49 of file FileItem.cpp.
00051 : QListViewItem( parent ) 00052 { 00053 setUpData( fileName, type, UseVideoRate ); 00054 }
void FileItem::autoSetIcon | ( | void | ) | [private] |
Definition at line 237 of file FileItem.cpp.
00238 { 00239 switch( getExtType() ) 00240 { 00241 case ICONID_DIRECTORY: 00242 setPixmap( 0, QPixmap( (const char **) image_folder ) ); 00243 break; 00244 case ICONID_DIR_LINK: 00245 setPixmap( 0, QPixmap( (const char **) image_lfolder ) ); 00246 break; 00247 case ICONID_LOCKED_DIRECTORY: 00248 setPixmap( 0, QPixmap( (const char **) image_folder_locked ) ); 00249 break; 00250 case ICONID_UNKNOWN_FILE: 00251 setPixmap( 0, QPixmap( (const char **) image_unknown_file ) ); 00252 break; 00253 case ICONID_UNKNOWN_FILE_LINK: 00254 setPixmap( 0, QPixmap( (const char **) image_lunknown_file ) ); 00255 break; 00256 case ICONID_MPG: 00257 setPixmap( 0, QPixmap( (const char **) image_mpg ) ); 00258 break; 00259 case ICONID_MPG_LINK: 00260 setPixmap( 0, QPixmap( (const char **) image_lmpg ) ); 00261 break; 00262 case ICONID_XML: 00263 setPixmap( 0, QPixmap( (const char **) image_xml ) ); 00264 break; 00265 case ICONID_XML_LINK: 00266 setPixmap( 0, QPixmap( (const char **) image_lxml ) ); 00267 break; 00268 case ICONID_BROWSER: 00269 setPixmap( 0, QPixmap( (const char **) image_browser ) ); 00270 break; 00271 case ICONID_BROWSER_LINK: 00272 setPixmap( 0, QPixmap( (const char **) image_lbrowser ) ); 00273 break; 00274 case ICONID_INDEX: 00275 setPixmap( 0, QPixmap( (const char **) image_related_media ) ); 00276 break; 00277 case ICONID_ZIP_FILE: 00278 setPixmap( 0, QPixmap( (const char **) image_zip_file ) ); 00279 break; 00280 case ICONID_ZIP_FILE_LINK: 00281 setPixmap( 0, QPixmap( (const char **) image_lzip_file ) ); 00282 break; 00283 case ICONID_TGIF: 00284 setPixmap( 0, QPixmap( (const char **) image_related_media ) ); 00285 break; 00286 case ICONID_RELATED_MEDIA: 00287 setPixmap( 0, QPixmap( (const char **) image_related_media ) ); 00288 break; 00289 case ICONID_BROKEN_LINK: 00290 setPixmap( 0, QPixmap( (const char **) image_file_broken ) ); 00291 break; 00292 } 00293 }
bool FileItem::canRead | ( | void | ) |
Definition at line 117 of file FileItem.cpp.
int FileItem::compare | ( | QListViewItem * | item, | |
int | column, | |||
bool | ascending | |||
) | const [private] |
This function reimplements the comparison method Compares the object sizes numerically Compares the object dates chronologically.
Definition at line 323 of file FileItem.cpp.
00324 { 00325 FileItem *other_item = (FileItem *)item; 00326 00327 // These casts are needed, since column parameter must be int 00328 if( column == (int)COLUMN_SIZE ) 00329 { 00330 return size - other_item->getSize(); 00331 } 00332 else if( column == (int)COLUMN_DATE ) 00333 { 00334 return other_item->getDate().secsTo( date ); 00335 } 00336 else 00337 { 00338 return QListViewItem::compare( item, column, ascending ); 00339 } 00340 }
QDateTime FileItem::getDate | ( | void | ) |
Definition at line 139 of file FileItem.cpp.
00140 { 00141 return date; 00142 }
unsigned int FileItem::getExtType | ( | void | ) |
Definition at line 154 of file FileItem.cpp.
00155 { 00156 unsigned int ext; 00157 if( isDir() ) 00158 { 00159 if( canRead() ) 00160 { 00161 if( isLink() ) 00162 { 00163 if( isBrokenLink() ) 00164 ext = ICONID_BROKEN_LINK; 00165 else 00166 ext = ICONID_DIR_LINK; 00167 } 00168 else 00169 ext = ICONID_DIRECTORY; 00170 } 00171 else 00172 ext = ICONID_LOCKED_DIRECTORY; 00173 } 00174 else 00175 { 00176 QString ext_str; 00177 00178 ext_str = fileName.section( ".", -1 ); 00179 00180 if( isLink() ) 00181 { 00182 if( isBrokenLink() ) 00183 ext = ICONID_BROKEN_LINK; 00184 else if( ( ext_str == "mpg" ) || ( ext_str == "mpeg" ) ) 00185 ext = ICONID_MPG_LINK; 00186 else if( ext_str == "xml" ) 00187 ext = ICONID_XML_LINK; 00188 else if( ext_str == "browser" ) 00189 ext = ICONID_BROWSER_LINK; 00190 else if( ( ext_str == "zip" ) || ( ext_str == "gz" ) ) 00191 ext = ICONID_ZIP_FILE_LINK; 00192 else 00193 ext = ICONID_UNKNOWN_FILE_LINK; 00194 } 00195 else 00196 { 00197 if( ( ext_str == "mpg" ) || ( ext_str == "mpeg" ) ) 00198 ext = ICONID_MPG; 00199 else if( ext_str == "xml" ) 00200 ext = ICONID_XML; 00201 else if( ext_str == "browser" ) 00202 ext = ICONID_BROWSER; 00203 else if( ext_str == "index" ) 00204 ext = ICONID_INDEX; 00205 else if( ext_str == "tgif" ) 00206 ext = ICONID_TGIF; 00207 else if( ( ext_str == "zip" ) || ( ext_str == "gz" ) ) 00208 ext = ICONID_ZIP_FILE; 00209 else 00210 ext = ICONID_UNKNOWN_FILE; 00211 } 00212 } 00213 00214 return ext; 00215 }
QString FileItem::getFileName | ( | void | ) |
Definition at line 101 of file FileItem.cpp.
00102 { 00103 return fileName; 00104 }
QString FileItem::getGroup | ( | void | ) |
Definition at line 149 of file FileItem.cpp.
00150 { 00151 return group; 00152 }
QString FileItem::getOwner | ( | void | ) |
Definition at line 144 of file FileItem.cpp.
00145 { 00146 return owner; 00147 }
QString FileItem::getPath | ( | void | ) |
bool FileItem::getPathUntil | ( | unsigned | int, | |
QString | orignPath, | |||
QString * | destPath | |||
) | [static] |
Definition at line 308 of file FileItem.cpp.
QString FileItem::getPermissions | ( | void | ) |
Definition at line 112 of file FileItem.cpp.
00113 { 00114 return permissions; 00115 }
CRioSession * FileItem::getSession | ( | void | ) |
Definition at line 295 of file FileItem.cpp.
00296 { 00297 CRioSession * session; 00298 if( getType() == FileWindow::RIO ) 00299 { 00300 session = ((FileWindow *)listView())->getSession(); 00301 } 00302 else 00303 session = NULL; 00304 00305 return session; 00306 }
unsigned long long int FileItem::getSize | ( | void | ) |
Definition at line 134 of file FileItem.cpp.
00135 { 00136 return size; 00137 }
int FileItem::getType | ( | void | ) |
Definition at line 217 of file FileItem.cpp.
00218 { 00219 return ((FileWindow *)listView())->getType(); 00220 }
bool FileItem::isBrokenLink | ( | void | ) |
Definition at line 129 of file FileItem.cpp.
00130 { 00131 return ( type == ObjectInfo::FILE_TYPE_BROKEN_LINK ); 00132 }
bool FileItem::isDir | ( | void | ) |
Definition at line 106 of file FileItem.cpp.
00107 { 00108 return ( ( type == ObjectInfo::FILE_TYPE_DIRECTORY ) || 00109 ( type == ObjectInfo::FILE_TYPE_DIR_LINK ) ); 00110 }
bool FileItem::isLink | ( | void | ) |
Definition at line 122 of file FileItem.cpp.
00123 { 00124 return ( ( type == ObjectInfo::FILE_TYPE_BROKEN_LINK ) || 00125 ( type == ObjectInfo::FILE_TYPE_DIR_LINK ) || 00126 ( type == ObjectInfo::FILE_TYPE_DATA_LINK ) ); 00127 }
void FileItem::setProperties | ( | QString | owner, | |
QString | group, | |||
QString | permissions, | |||
unsigned long long int | size, | |||
QDateTime | date, | |||
unsigned int | VideoRate | |||
) |
Definition at line 72 of file FileItem.cpp.
00076 { 00077 this->owner = owner; 00078 this->group = group; 00079 this->permissions = permissions; 00080 this->size = size; 00081 this->date = date; 00082 this->VideoRate = VideoRate; 00083 00084 setText( COLUMN_DATE, date.toString( Qt::LocalDate ) ); 00085 setText( COLUMN_OWNER, owner ); 00086 setText( COLUMN_GROUP, group ); 00087 setText( COLUMN_SIZE, QString( RioExplorer::formatSize( size ) ) ); 00088 setText( COLUMN_PERMISSIONS, permissions ); 00089 // Novo campo com a taxa de transferencia. 00090 if( UseVideoRate ) 00091 { 00092 if( getExtType() == FileItem::ICONID_MPG) 00093 setText( COLUMN_VIDEORATE, QString( "%1 Kbps" ).arg( VideoRate ) ); 00094 else 00095 setText( COLUMN_VIDEORATE, QString( "-" ) ); 00096 } 00097 00098 autoSetIcon(); 00099 }
void FileItem::setUpData | ( | QString | fileName, | |
int | type, | |||
bool | UseVideoRate | |||
) | [private] |
Definition at line 56 of file FileItem.cpp.
00057 { 00058 this->fileName = fileName; 00059 this->type = type; 00060 // Novo parametro para indicar o uso ou nao do campo VideoRate. 00061 this->UseVideoRate = UseVideoRate; 00062 setDragEnabled( true ); 00063 00064 QString label = fileName; 00065 if( fileName != "/" ) 00066 label = fileName.section( "/", -1 ); 00067 setText( COLUMN_FILENAME, label ); 00068 00069 autoSetIcon(); 00070 }
const unsigned int FileItem::COLUMN_DATE = 2 [static] |
Definition at line 87 of file FileItem.h.
const unsigned int FileItem::COLUMN_FILENAME = 0 [static] |
Definition at line 85 of file FileItem.h.
const unsigned int FileItem::COLUMN_GROUP = 4 [static] |
Definition at line 89 of file FileItem.h.
const unsigned int FileItem::COLUMN_OWNER = 3 [static] |
Definition at line 88 of file FileItem.h.
const unsigned int FileItem::COLUMN_PERMISSIONS = 5 [static] |
Definition at line 90 of file FileItem.h.
const unsigned int FileItem::COLUMN_SIZE = 1 [static] |
Definition at line 86 of file FileItem.h.
const unsigned int FileItem::COLUMN_VIDEORATE = 6 [static] |
Definition at line 93 of file FileItem.h.
QDateTime FileItem::date [private] |
Definition at line 34 of file FileItem.h.
QString FileItem::fileName [private] |
Definition at line 29 of file FileItem.h.
QString FileItem::group [private] |
Definition at line 31 of file FileItem.h.
const unsigned int FileItem::ICONID_BROKEN_LINK = 12 [static] |
Definition at line 107 of file FileItem.h.
const unsigned int FileItem::ICONID_BROWSER = 6 [static] |
Definition at line 101 of file FileItem.h.
const unsigned int FileItem::ICONID_BROWSER_LINK = 15 [static] |
Definition at line 110 of file FileItem.h.
const unsigned int FileItem::ICONID_DIR_LINK = 11 [static] |
Definition at line 106 of file FileItem.h.
const unsigned int FileItem::ICONID_DIRECTORY = 0 [static] |
Definition at line 95 of file FileItem.h.
const unsigned int FileItem::ICONID_INDEX = 8 [static] |
Definition at line 103 of file FileItem.h.
const unsigned int FileItem::ICONID_LOCKED_DIRECTORY = 1 [static] |
Definition at line 96 of file FileItem.h.
const unsigned int FileItem::ICONID_LOCKED_FILE = 2 [static] |
Definition at line 97 of file FileItem.h.
const unsigned int FileItem::ICONID_MPG = 4 [static] |
Definition at line 99 of file FileItem.h.
const unsigned int FileItem::ICONID_MPG_LINK = 14 [static] |
Definition at line 109 of file FileItem.h.
const unsigned int FileItem::ICONID_RELATED_MEDIA = 7 [static] |
Definition at line 102 of file FileItem.h.
const unsigned int FileItem::ICONID_TGIF = 9 [static] |
Definition at line 104 of file FileItem.h.
const unsigned int FileItem::ICONID_UNKNOWN_FILE = 3 [static] |
Definition at line 98 of file FileItem.h.
const unsigned int FileItem::ICONID_UNKNOWN_FILE_LINK = 13 [static] |
Definition at line 108 of file FileItem.h.
const unsigned int FileItem::ICONID_XML = 5 [static] |
Definition at line 100 of file FileItem.h.
const unsigned int FileItem::ICONID_XML_LINK = 16 [static] |
Definition at line 111 of file FileItem.h.
const unsigned int FileItem::ICONID_ZIP_FILE = 10 [static] |
Definition at line 105 of file FileItem.h.
const unsigned int FileItem::ICONID_ZIP_FILE_LINK = 17 [static] |
Definition at line 112 of file FileItem.h.
QString FileItem::owner [private] |
Definition at line 30 of file FileItem.h.
QString FileItem::permissions [private] |
Definition at line 32 of file FileItem.h.
unsigned long long int FileItem::size [private] |
Definition at line 33 of file FileItem.h.
int FileItem::type [private] |
Definition at line 35 of file FileItem.h.
bool FileItem::UseVideoRate [private] |
Definition at line 40 of file FileItem.h.
unsigned int FileItem::VideoRate [private] |
Definition at line 37 of file FileItem.h.