blob: ae07c6c8996b02a94ed89bb64836948b73827182 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#include <qfile.h>
#include <qtextstream.h>
#include "ohwinfo.h"
struct OHwInfoData {
QString m_vendorstr;
OHwVendor m_vendor;
QString m_modelstr;
OHwModel m_model;
};
OHwInfo *OHwInfo::inst ( )
{
static OHwInfo *inf = 0;
if ( !inf ) {
inf = new OHwInfo ( );
}
return inf;
}
OHwInfo::OHwInfo ( )
{
m_data = new OHwInfoData ( );
QFile f ( "/proc/hal/model" );
if ( f. open ( IO_ReadOnly )) {
QTextStream ts ( &f );
m_data-> m_modelstr = ts. readLine ( );
if ( m_data-> m_modelstr == "H3100" )
m_data-> m_model = OMODEL_iPAQ_H31xx;
else if ( m_data-> m_modelstr == "H3600" )
m_data-> m_model = OMODEL_iPAQ_H36xx;
else if ( m_data-> m_modelstr == "H3700" )
m_data-> m_model = OMODEL_iPAQ_H37xx;
else if ( m_data-> m_modelstr == "H3800" )
m_data-> m_model = OMODEL_iPAQ_H38xx;
else
m_data-> m_model = OMODEL_Unknown;
m_data-> m_vendorstr = "HP";
m_data-> m_vendor = OVENDOR_HP;
f. close ( );
}
else {
m_data-> m_modelstr = "Unknown";
m_data-> m_model = OMODEL_Unknown;
m_data-> m_vendorstr = "Unkown";
m_data-> m_vendor = OVENDOR_Unknown;
}
}
OHwInfo::~OHwInfo ( )
{
delete m_data;
}
QString OHwInfo::vendorString ( )
{
return m_data-> m_vendorstr;
}
OHwVendor OHwInfo::vendor ( )
{
return m_data-> m_vendor;
}
QString OHwInfo::modelString ( )
{
return m_data-> m_modelstr;
}
OHwModel OHwInfo::model ( )
{
return m_data-> m_model;
}
|