~cyphermox/youker-assistant/dmidecode

« back to all changes in this revision

Viewing changes to info/sensorwidget.cpp

  • Committer: lixiang
  • Date: 2017-02-23 03:48:24 UTC
  • Revision ID: lixiang@kylinos.cn-20170223034824-vnh8hj1rftz1hyze
Multi screen display normal

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
void SensorWieget::updateTimeValue()
49
49
{
50
50
    QMap<QString, QVariant> tmpMap = systemproxy->get_sensor_info_qt();
51
 
    QMap<QString,QVariant>::iterator it;
52
 
    for (it = tmpMap.begin(); it != tmpMap.end(); ++it) {
53
 
        if (it.value().toString().length() > 0) {
54
 
            sensor_info_map.insert(it.key(), it.value());
55
 
        }
 
51
    if (tmpMap.isEmpty() || tmpMap.count() <= 0) {
 
52
 
56
53
    }
57
 
    if(sensor_info_map.count() > 0) {
58
 
        page->resetSensor(sensor_info_map);
 
54
    else {
 
55
        sensor_info_map.clear();
 
56
        QMap<QString,QVariant>::iterator it;
 
57
        for (it = tmpMap.begin(); it != tmpMap.end(); ++it) {
 
58
            if (it.value().toString().length() > 0) {
 
59
                sensor_info_map.insert(it.key(), it.value());
 
60
            }
 
61
        }
 
62
        if (!sensor_info_map.isEmpty() && sensor_info_map.count() > 0) {
 
63
            page->resetSensor(sensor_info_map);
 
64
        }
59
65
    }
60
66
}
61
67
 
62
68
void SensorWieget::initData()
63
69
{
64
70
    QMap<QString, QVariant> tmpMap = systemproxy->get_sensor_info_qt();
65
 
    QMap<QString,QVariant>::iterator it;
 
71
    if (tmpMap.isEmpty() || tmpMap.count() <= 0) {
 
72
        page = NULL;
 
73
    }
 
74
    else {
 
75
        QMap<QString,QVariant>::iterator it;
 
76
        for ( it = tmpMap.begin(); it != tmpMap.end(); ++it ) {
 
77
            if (it.value().toString().length() > 0) {
 
78
                sensor_info_map.insert(it.key(), it.value());
 
79
            }
 
80
        }
 
81
        if (sensor_info_map.isEmpty() || sensor_info_map.count() <= 0) {
 
82
            page = NULL;
 
83
        }
 
84
        else {
 
85
            page = new ComputerPage(scroll_widget->zone, tr("Hardware sensor information"));
 
86
            page->setMap(sensor_info_map, "");
 
87
            page->setsensor(true);
 
88
            page->initUI();
 
89
            scroll_widget->addScrollWidget(page);
 
90
            timer->start(1000*4);
 
91
        }
 
92
    }
 
93
    /*QMap<QString,QVariant>::iterator it;
66
94
    for ( it = tmpMap.begin(); it != tmpMap.end(); ++it ) {
67
95
        if (it.value().toString().length() > 0) {
68
96
            sensor_info_map.insert(it.key(), it.value());
79
107
        page->initUI();
80
108
        scroll_widget->addScrollWidget(page);
81
109
        timer->start(1000*4);
82
 
    }
 
110
    }*/
83
111
}