~feng-kylin/youker-assistant/youker-assistant

« back to all changes in this revision

Viewing changes to qml/func/info/CpuInfo.qml

  • Committer: kobe
  • Date: 2015-02-13 07:37:10 UTC
  • Revision ID: xiangli@ubuntukylin.com-20150213073710-0jyp02ilyi5njj10
Qt Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; version 3.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 */
16
 
 
17
 
import QtQuick 1.1
18
 
import "../common" as Common
19
 
import "../bars" as Bars
20
 
import "../common/InfoGroup.js" as InfoGroup
21
 
 
22
 
Rectangle {
23
 
    id: home
24
 
    width: parent.width; height: 476
25
 
 
26
 
    property string homepath
27
 
    Component.onCompleted: {
28
 
        home.homepath = sessiondispatcher.getHomePath();
29
 
    }
30
 
 
31
 
 
32
 
    function init_data() {
33
 
        systemdispatcher.get_cpu_info_qt();//获取详细信息
34
 
        var cpuName = systemdispatcher.getHWSingleInfo("CpuVendor", "cpu");
35
 
        logo.source = InfoGroup.judgeName(cpuName.toUpperCase()) ? (home.homepath + "/.cache/youker-assistant/uk-img/Manufacturer/" + cpuName.toUpperCase() + ".jpg") : ("../../img/toolWidget/ubuntukylin.png");
36
 
        cpuversionText.text = systemdispatcher.getHWSingleInfo("CpuVersion", "cpu");
37
 
        cpuverdorText.text = cpuName;
38
 
        cpuserialText.text = systemdispatcher.getHWSingleInfo("CpuSerial", "cpu");
39
 
        slotText.text = systemdispatcher.getHWSingleInfo("CpuSlot", "cpu");
40
 
        maxText.text = systemdispatcher.getHWSingleInfo("CpuCapacity", "cpu");// + "MHz";
41
 
        curText.text = systemdispatcher.getHWSingleInfo("CpuSize", "cpu");// + "MHz";
42
 
        frontText.text = systemdispatcher.getHWSingleInfo("CpuClock", "cpu");// + "MHz";
43
 
        coresText.text = systemdispatcher.getHWSingleInfo("cpu_cores", "cpu") + qsTr("cores") + "/" + systemdispatcher.getHWSingleInfo("cpu_siblings", "cpu") + qsTr("thread");//核//线程
44
 
        cache1.text = systemdispatcher.getHWSingleInfo("clflush_size", "cpu") + "KB";
45
 
        cache2.text = systemdispatcher.getHWSingleInfo("cache_size", "cpu") + "KB";
46
 
    }
47
 
 
48
 
    Connections
49
 
    {
50
 
        target: sessiondispatcher
51
 
        onTellDetailPageUpdateData: {
52
 
            if (infoFlag == "cpu") {
53
 
                home.init_data();
54
 
            }
55
 
        }
56
 
    }
57
 
 
58
 
    Column {
59
 
        anchors {
60
 
            top: parent.top
61
 
            topMargin: 40
62
 
            left: parent.left
63
 
            leftMargin: 30
64
 
        }
65
 
        spacing: 20
66
 
 
67
 
        Row {
68
 
            Common.Label {
69
 
                id: bartitle
70
 
                text: qsTr("CPU Info")//处理器信息
71
 
                font.bold: true
72
 
                font.pixelSize: 14
73
 
                color: "#383838"
74
 
            }
75
 
            Common.Separator {
76
 
                anchors.verticalCenter: parent.verticalCenter
77
 
                width: home.width - bartitle.width - 30 * 2
78
 
            }
79
 
        }
80
 
        Column {
81
 
            anchors.left: parent.left
82
 
            anchors.leftMargin: 20
83
 
            spacing: 10
84
 
            Row {
85
 
                spacing: 10
86
 
                Common.Label {
87
 
                    text: qsTr("CPU: ")//处理器:
88
 
                    font.pixelSize: 14
89
 
                    color: "#7a7a7a"
90
 
                    width: 150
91
 
                }
92
 
                Text {
93
 
                    id: cpuversionText
94
 
                    text: ""
95
 
                    font.pixelSize: 14
96
 
                    color: "#7a7a7a"
97
 
                }
98
 
            }
99
 
            Row {
100
 
                spacing: 10
101
 
                Common.Label {
102
 
                    text: qsTr("Vendor: ")//制造商:
103
 
                    font.pixelSize: 14
104
 
                    color: "#7a7a7a"
105
 
                    width: 150
106
 
                }
107
 
                Text {
108
 
                    id: cpuverdorText
109
 
                    text: ""
110
 
                    font.pixelSize: 14
111
 
                    color: "#7a7a7a"
112
 
                }
113
 
            }
114
 
            Row {
115
 
                spacing: 10
116
 
                Common.Label {
117
 
                    text: qsTr("Serial Number: ")//序列号:
118
 
                    font.pixelSize: 14
119
 
                    color: "#7a7a7a"
120
 
                    width: 150
121
 
                }
122
 
                Text {
123
 
                    id: cpuserialText
124
 
                    text: ""
125
 
                    font.pixelSize: 14
126
 
                    color: "#7a7a7a"
127
 
                }
128
 
            }
129
 
            Row {
130
 
                spacing: 10
131
 
                Common.Label {
132
 
                    text: qsTr("Socket/Slot: ")//插座/插槽:
133
 
                    font.pixelSize: 14
134
 
                    color: "#7a7a7a"
135
 
                    width: 150
136
 
                }
137
 
                Text {
138
 
                    id: slotText
139
 
                    text: ""
140
 
                    font.pixelSize: 14
141
 
                    color: "#7a7a7a"
142
 
                }
143
 
            }
144
 
            Row {
145
 
                spacing: 10
146
 
                Common.Label {
147
 
                    text: qsTr("Maximum Frequency: ")//最大主频:
148
 
                    font.pixelSize: 14
149
 
                    color: "#7a7a7a"
150
 
                    width: 150
151
 
                }
152
 
                Text {
153
 
                    id: maxText
154
 
                    text: ""
155
 
                    font.pixelSize: 14
156
 
                    color: "#7a7a7a"
157
 
                }
158
 
            }
159
 
            Row {
160
 
                spacing: 10
161
 
                Common.Label {
162
 
                    text: qsTr("Current Frequency: ")//当前主频:
163
 
                    font.pixelSize: 14
164
 
                    color: "#7a7a7a"
165
 
                    width: 150
166
 
                }
167
 
                Text {
168
 
                    id: curText
169
 
                    text: ""
170
 
                    font.pixelSize: 14
171
 
                    color: "#7a7a7a"
172
 
                }
173
 
            }
174
 
            Row {
175
 
                spacing: 10
176
 
                Common.Label {
177
 
                    text: qsTr("FSB: ")//前端总线:
178
 
                    font.pixelSize: 14
179
 
                    color: "#7a7a7a"
180
 
                    width: 150
181
 
                }
182
 
                Text {
183
 
                    id: frontText
184
 
                    text: ""
185
 
                    font.pixelSize: 14
186
 
                    color: "#7a7a7a"
187
 
                }
188
 
            }
189
 
            Row {
190
 
                spacing: 10
191
 
                Common.Label {
192
 
                    text: qsTr("Core Number: ")//核心数目:
193
 
                    font.pixelSize: 14
194
 
                    color: "#7a7a7a"
195
 
                    width: 150
196
 
                }
197
 
                Text {
198
 
                    id: coresText
199
 
                    text: ""
200
 
                    font.pixelSize: 14
201
 
                    color: "#7a7a7a"
202
 
                }
203
 
            }
204
 
            Row {
205
 
                spacing: 10
206
 
                Common.Label {
207
 
                    text: qsTr("L1 Cache: ")//一级缓存:
208
 
                    font.pixelSize: 14
209
 
                    color: "#7a7a7a"
210
 
                    width: 150
211
 
                }
212
 
                Text {
213
 
                    id: cache1
214
 
                    text: ""
215
 
                    font.pixelSize: 14
216
 
                    color: "#7a7a7a"
217
 
                }
218
 
            }
219
 
            Row {
220
 
                spacing: 10
221
 
                Common.Label {
222
 
                    text: qsTr("L2 Cache: ")//二级缓存:
223
 
                    font.pixelSize: 14
224
 
                    color: "#7a7a7a"
225
 
                    width: 150
226
 
                }
227
 
                Text {
228
 
                    id: cache2
229
 
                    text: ""
230
 
                    font.pixelSize: 14
231
 
                    color: "#7a7a7a"
232
 
                }
233
 
            }
234
 
        }
235
 
    }
236
 
    //logo
237
 
    Image {
238
 
        id: logo
239
 
        source: ""
240
 
        opacity: 0.5
241
 
        anchors {
242
 
            top: parent.top
243
 
            topMargin: 80
244
 
            right: parent.right
245
 
            rightMargin: 30
246
 
        }
247
 
    }
248
 
}