summaryrefslogtreecommitdiff
path: root/libopie2/opienet/omanufacturerdb.cpp
Unidiff
Diffstat (limited to 'libopie2/opienet/omanufacturerdb.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/omanufacturerdb.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp
index 32bae0a..7e185a2 100644
--- a/libopie2/opienet/omanufacturerdb.cpp
+++ b/libopie2/opienet/omanufacturerdb.cpp
@@ -25,97 +25,97 @@
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27*/ 27*/
28 28
29#include "omanufacturerdb.h" 29#include "omanufacturerdb.h"
30 30
31#define OPIE_IMPROVE_GUI_LATENCY 1 31#define OPIE_IMPROVE_GUI_LATENCY 1
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#ifdef OPIE_IMPROVE_GUI_LATENCY 36#ifdef OPIE_IMPROVE_GUI_LATENCY
37#include <qpe/global.h> 37#include <qpe/global.h>
38#endif 38#endif
39 39
40 40
41 41
42/* QT */ 42/* QT */
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47using namespace Opie::Core; 47using namespace Opie::Core;
48namespace Opie { 48namespace Opie {
49namespace Net { 49namespace Net {
50 50
51OManufacturerDB* OManufacturerDB::_instance = 0; 51OManufacturerDB* OManufacturerDB::_instance = 0;
52 52
53OManufacturerDB* OManufacturerDB::instance() 53OManufacturerDB* OManufacturerDB::instance()
54{ 54{
55 if ( !OManufacturerDB::_instance ) 55 if ( !OManufacturerDB::_instance )
56 { 56 {
57 odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; 57 odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl;
58 _instance = new OManufacturerDB(); 58 _instance = new OManufacturerDB();
59 } 59 }
60 return _instance; 60 return _instance;
61} 61}
62 62
63 63
64OManufacturerDB::OManufacturerDB() 64OManufacturerDB::OManufacturerDB()
65{ 65{
66 #ifdef OPIE_IMPROVE_GUI_LATENCY 66 #ifdef OPIE_IMPROVE_GUI_LATENCY
67 Global::statusMessage( "Reading Manufacturers..." ); 67 Global::statusMessage( "Reading Manufacturers..." );
68 #endif 68 #endif
69 QString filename( "/etc/manufacturers" ); 69 QString filename( "/etc/manufacturers" );
70 odebug << "OManufacturerDB: trying to read " << filename << oendl; 70 odebug << "OManufacturerDB: trying to read " << filename << oendl;
71 if ( !QFile::exists( filename ) ) 71 if ( !QFile::exists( filename ) )
72 { 72 {
73 filename = QPEApplication::qpeDir()+"/etc/manufacturers"; 73 filename = QPEApplication::qpeDir()+"etc/manufacturers";
74 odebug << "OManufacturerDB: trying to read " << filename << oendl; 74 odebug << "OManufacturerDB: trying to read " << filename << oendl;
75 if ( !QFile::exists( filename ) ) 75 if ( !QFile::exists( filename ) )
76 { 76 {
77 filename = "/usr/share/wellenreiter/manufacturers"; 77 filename = "/usr/share/wellenreiter/manufacturers";
78 odebug << "OManufacturerDB: trying to read " << filename << oendl; 78 odebug << "OManufacturerDB: trying to read " << filename << oendl;
79 } 79 }
80 } 80 }
81 81
82 QFile file( filename ); 82 QFile file( filename );
83 bool hasFile = file.open( IO_ReadOnly ); 83 bool hasFile = file.open( IO_ReadOnly );
84 if (!hasFile) 84 if (!hasFile)
85 { 85 {
86 owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; 86 owarn << "OManufacturerDB: no valid manufacturer list found." << oendl;
87 } 87 }
88 else 88 else
89 { 89 {
90 odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; 90 odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl;
91 QTextStream s( &file ); 91 QTextStream s( &file );
92 QString addr; 92 QString addr;
93 QString manu; 93 QString manu;
94 QString extManu; 94 QString extManu;
95 #ifdef OPIE_IMPROVE_GUI_LATENCY 95 #ifdef OPIE_IMPROVE_GUI_LATENCY
96 int counter = 0; 96 int counter = 0;
97 #endif 97 #endif
98 while (!s.atEnd()) 98 while (!s.atEnd())
99 { 99 {
100 s >> addr; 100 s >> addr;
101 s >> manu; 101 s >> manu;
102 s >> extManu; 102 s >> extManu;
103 103
104 manufacturers.insert( addr, manu ); 104 manufacturers.insert( addr, manu );
105 manufacturersExt.insert( addr, extManu ); 105 manufacturersExt.insert( addr, extManu );
106 // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; 106 // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl;
107 #ifdef OPIE_IMPROVE_GUI_LATENCY 107 #ifdef OPIE_IMPROVE_GUI_LATENCY
108 counter++; 108 counter++;
109 if ( counter == 50 ) 109 if ( counter == 50 )
110 { 110 {
111 qApp->processEvents(); 111 qApp->processEvents();
112 counter = 0; 112 counter = 0;
113 } 113 }
114 #endif 114 #endif
115 } 115 }
116 odebug << "OManufacturerDB: manufacturer list completed." << oendl; 116 odebug << "OManufacturerDB: manufacturer list completed." << oendl;
117 #ifdef OPIE_IMPROVE_GUI_LATENCY 117 #ifdef OPIE_IMPROVE_GUI_LATENCY
118 Global::statusMessage( "Manufacturers Complete..." ); 118 Global::statusMessage( "Manufacturers Complete..." );
119 #endif 119 #endif
120 } 120 }
121} 121}