summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
index f61270b..2da549c 100644
--- a/libopie2/opienet/omanufacturerdb.cpp
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -21,50 +21,56 @@
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#include "omanufacturerdb.h" 31#include "omanufacturerdb.h"
32 32
33/* OPIE CORE */ 33#define OPIE_IMPROVE_GUI_LATENCY 1
34
35/* OPIE */
34#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37#ifdef OPIE_IMPROVE_GUI_LATENCY
38#include <qpe/global.h>
39#endif
35 40
36/* QT */ 41/* QT */
37#include <qapplication.h> 42#include <qapplication.h>
38#include <qstring.h> 43#include <qstring.h>
39#include <qfile.h> 44#include <qfile.h>
40#include <qtextstream.h> 45#include <qtextstream.h>
41 46
42#define OPIE_IMPROVE_GUI_LATENCY 1
43
44OManufacturerDB* OManufacturerDB::_instance = 0; 47OManufacturerDB* OManufacturerDB::_instance = 0;
45 48
46OManufacturerDB* OManufacturerDB::instance() 49OManufacturerDB* OManufacturerDB::instance()
47{ 50{
48 if ( !OManufacturerDB::_instance ) 51 if ( !OManufacturerDB::_instance )
49 { 52 {
50 odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; 53 odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl;
51 _instance = new OManufacturerDB(); 54 _instance = new OManufacturerDB();
52 } 55 }
53 return _instance; 56 return _instance;
54} 57}
55 58
56 59
57OManufacturerDB::OManufacturerDB() 60OManufacturerDB::OManufacturerDB()
58{ 61{
62 #ifdef OPIE_IMPROVE_GUI_LATENCY
63 Global::statusMessage( "Reading Manufacturers..." );
64 #endif
59 QString filename( "/etc/manufacturers" ); 65 QString filename( "/etc/manufacturers" );
60 odebug << "OManufacturerDB: trying to read " << filename << oendl; 66 odebug << "OManufacturerDB: trying to read " << filename << oendl;
61 if ( !QFile::exists( filename ) ) 67 if ( !QFile::exists( filename ) )
62 { 68 {
63 filename = "/opt/QtPalmtop/etc/manufacturers"; 69 filename = "/opt/QtPalmtop/etc/manufacturers";
64 odebug << "OManufacturerDB: trying to read " << filename << oendl; 70 odebug << "OManufacturerDB: trying to read " << filename << oendl;
65 if ( !QFile::exists( filename ) ) 71 if ( !QFile::exists( filename ) )
66 { 72 {
67 filename = "/usr/share/wellenreiter/manufacturers"; 73 filename = "/usr/share/wellenreiter/manufacturers";
68 odebug << "OManufacturerDB: trying to read " << filename << oendl; 74 odebug << "OManufacturerDB: trying to read " << filename << oendl;
69 } 75 }
70 } 76 }
@@ -95,24 +101,27 @@ OManufacturerDB::OManufacturerDB()
95 manufacturersExt.insert( addr, extManu ); 101 manufacturersExt.insert( addr, extManu );
96 // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; 102 // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl;
97 #ifdef OPIE_IMPROVE_GUI_LATENCY 103 #ifdef OPIE_IMPROVE_GUI_LATENCY
98 counter++; 104 counter++;
99 if ( counter == 50 ) 105 if ( counter == 50 )
100 { 106 {
101 qApp->processEvents(); 107 qApp->processEvents();
102 counter = 0; 108 counter = 0;
103 } 109 }
104 #endif 110 #endif
105 } 111 }
106 odebug << "OManufacturerDB: manufacturer list completed." << oendl; 112 odebug << "OManufacturerDB: manufacturer list completed." << oendl;
113 #ifdef OPIE_IMPROVE_GUI_LATENCY
114 Global::statusMessage( "Manufacturers Complete..." );
115 #endif
107 } 116 }
108} 117}
109 118
110 119
111OManufacturerDB::~OManufacturerDB() 120OManufacturerDB::~OManufacturerDB()
112{ 121{
113} 122}
114 123
115 124
116const QString& OManufacturerDB::lookup( const QString& macaddr ) const 125const QString& OManufacturerDB::lookup( const QString& macaddr ) const
117{ 126{
118 return manufacturers[macaddr.upper().left(8)]; 127 return manufacturers[macaddr.upper().left(8)];