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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "system.h"
#include "GUIWindowSystemInfo.h"
#include "utils/GUIInfoManager.h"
#include "GUIWindowManager.h"
#include "Key.h"
#include "LocalizeStrings.h"
#ifdef HAS_SYSINFO
#include "SystemInfo.h"
#endif
#include "MediaManager.h"
#define CONTROL_BT_STORAGE 94
#define CONTROL_BT_DEFAULT 95
#define CONTROL_BT_NETWORK 96
#define CONTROL_BT_VIDEO 97
#define CONTROL_BT_HARDWARE 98
#define CONTROL_START CONTROL_BT_STORAGE
#define CONTROL_END CONTROL_BT_HARDWARE
CGUIWindowSystemInfo::CGUIWindowSystemInfo(void)
:CGUIWindow(WINDOW_SYSTEM_INFORMATION, "SettingsSystemInfo.xml")
{
m_section = CONTROL_BT_DEFAULT;
}
CGUIWindowSystemInfo::~CGUIWindowSystemInfo(void)
{
}
bool CGUIWindowSystemInfo::OnAction(const CAction &action)
{
if (action.GetID() == ACTION_PREVIOUS_MENU)
{
g_windowManager.PreviousWindow();
return true;
}
return CGUIWindow::OnAction(action);
}
bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_INIT:
{
CGUIWindow::OnMessage(message);
ResetLabels();
SET_CONTROL_LABEL(52, "XBMC " + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION) +
" (Compiled : " + g_infoManager.GetLabel(SYSTEM_BUILD_DATE)+")");
return true;
}
break;
case GUI_MSG_WINDOW_DEINIT:
{
CGUIWindow::OnMessage(message);
m_diskUsage.clear();
return true;
}
break;
case GUI_MSG_FOCUSED:
{
CGUIWindow::OnMessage(message);
int focusedControl = GetFocusedControlID();
if (focusedControl >= CONTROL_START && focusedControl <= CONTROL_END)
m_section = focusedControl;
return true;
}
break;
}
return CGUIWindow::OnMessage(message);
}
void CGUIWindowSystemInfo::FrameMove()
{
ResetLabels();
int i = 2;
if (m_section == CONTROL_BT_DEFAULT)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20154));
SetControlLabel(i++, "%s: %s", 158, SYSTEM_FREE_MEMORY);
SetControlLabel(i++, "%s: %s", 150, NETWORK_IP_ADDRESS);
SetControlLabel(i++, "%s %s", 13287, SYSTEM_SCREEN_RESOLUTION);
#ifdef HAS_SYSINFO
SetControlLabel(i++, "%s %s", 13283, SYSTEM_KERNEL_VERSION);
#endif
SetControlLabel(i++, "%s: %s", 12390, SYSTEM_UPTIME);
SetControlLabel(i++, "%s: %s", 12394, SYSTEM_TOTALUPTIME);
}
else if (m_section == CONTROL_BT_STORAGE)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20155));
if (m_diskUsage.size() == 0)
m_diskUsage = g_mediaManager.GetDiskUsage();
for (size_t d = 0; d < m_diskUsage.size(); d++)
{
SET_CONTROL_LABEL(i++, m_diskUsage[d]);
}
}
else if (m_section == CONTROL_BT_NETWORK)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20158));
#ifdef HAS_SYSINFO
SET_CONTROL_LABEL(i++, g_infoManager.GetLabel(NETWORK_LINK_STATE));
SetControlLabel(i++, "%s: %s", 149, NETWORK_MAC_ADDRESS);
#endif
SetControlLabel(i++, "%s: %s", 150, NETWORK_IP_ADDRESS);
SetControlLabel(i++, "%s: %s", 13159, NETWORK_SUBNET_ADDRESS);
SetControlLabel(i++, "%s: %s", 13160, NETWORK_GATEWAY_ADDRESS);
SetControlLabel(i++, "%s: %s", 13161, NETWORK_DNS1_ADDRESS);
SetControlLabel(i++, "%s: %s", 20307, NETWORK_DNS2_ADDRESS);
SetControlLabel(i++, "%s %s", 13295, SYSTEM_INTERNET_STATE);
}
else if (m_section == CONTROL_BT_VIDEO)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20159));
#ifdef HAS_SYSINFO
SET_CONTROL_LABEL(i++,g_infoManager.GetLabel(SYSTEM_VIDEO_ENCODER_INFO));
SetControlLabel(i++, "%s %s", 13287, SYSTEM_SCREEN_RESOLUTION);
#endif
#ifndef HAS_DX
SetControlLabel(i++, "%s %s", 22007, SYSTEM_RENDER_VENDOR);
SetControlLabel(i++, "%s %s", 22009, SYSTEM_RENDER_VERSION);
#else
SetControlLabel(i++, "%s %s", 22023, SYSTEM_RENDER_VENDOR);
SetControlLabel(i++, "%s %s", 22024, SYSTEM_RENDER_VERSION);
#endif
SetControlLabel(i++, "%s %s", 22010, SYSTEM_GPU_TEMPERATURE);
}
else if (m_section == CONTROL_BT_HARDWARE)
{
SET_CONTROL_LABEL(40,g_localizeStrings.Get(20160));
#ifdef HAS_SYSINFO
SET_CONTROL_LABEL(i++, g_sysinfo.GetXBVerInfo());
SetControlLabel(i++, "%s %s", 22011, SYSTEM_CPU_TEMPERATURE);
SetControlLabel(i++, "%s %s", 13284, SYSTEM_CPUFREQUENCY);
#endif
SetControlLabel(i++, "%s %s", 13271, SYSTEM_CPU_USAGE);
i++; // empty line
SetControlLabel(i++, "%s: %s", 22012, SYSTEM_TOTAL_MEMORY);
SetControlLabel(i++, "%s: %s", 158, SYSTEM_FREE_MEMORY);
}
CGUIWindow::FrameMove();
}
void CGUIWindowSystemInfo::ResetLabels()
{
for (int i = 2; i < 12; i++)
{
SET_CONTROL_LABEL(i,"");
}
}
void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label, int info)
{
CStdString tmpStr;
tmpStr.Format(format, g_localizeStrings.Get(label).c_str(), g_infoManager.GetLabel(info).c_str());
SET_CONTROL_LABEL(id, tmpStr);
}
|