author | mickeyl <mickeyl> | 2004-01-03 18:33:43 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-03 18:33:43 (UTC) |
commit | 27b84ed363fd7fc52092e3c2d1e49dca079b7ffd (patch) (side-by-side diff) | |
tree | 932806dc83d84720bcb259df8711d894932580e1 /libopie2/opienet | |
parent | 3889c8f853aa2d128f54389b17f08fc7b9150788 (diff) | |
download | opie-27b84ed363fd7fc52092e3c2d1e49dca079b7ffd.zip opie-27b84ed363fd7fc52092e3c2d1e49dca079b7ffd.tar.gz opie-27b84ed363fd7fc52092e3c2d1e49dca079b7ffd.tar.bz2 |
slightly improve the speed reading the manufacturers list
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 595633d..f61270b 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp @@ -61,58 +61,67 @@ OManufacturerDB::OManufacturerDB() if ( !QFile::exists( filename ) ) { filename = "/opt/QtPalmtop/etc/manufacturers"; odebug << "OManufacturerDB: trying to read " << filename << oendl; if ( !QFile::exists( filename ) ) { filename = "/usr/share/wellenreiter/manufacturers"; odebug << "OManufacturerDB: trying to read " << filename << oendl; } } QFile file( filename ); bool hasFile = file.open( IO_ReadOnly ); if (!hasFile) { owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; } else { odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; QTextStream s( &file ); QString addr; QString manu; QString extManu; + #ifdef OPIE_IMPROVE_GUI_LATENCY + int counter = 0; + #endif while (!s.atEnd()) { s >> addr; s >> manu; s >> extManu; manufacturers.insert( addr, manu ); manufacturersExt.insert( addr, extManu ); - odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; + // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; #ifdef OPIE_IMPROVE_GUI_LATENCY - if ( qApp ) qApp->processEvents(); + counter++; + if ( counter == 50 ) + { + qApp->processEvents(); + counter = 0; + } #endif } + odebug << "OManufacturerDB: manufacturer list completed." << oendl; } } OManufacturerDB::~OManufacturerDB() { } const QString& OManufacturerDB::lookup( const QString& macaddr ) const { return manufacturers[macaddr.upper().left(8)]; } const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const { QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); return it == manufacturersExt.end() ? lookup( macaddr ) : *it; } |