Subversion Repositories Kolibri OS

Rev

Rev 7590 | Rev 7795 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7590 Rev 7793
Line 12... Line 12...
12
 
12
 
13
#include "../lib/gui.h"
13
#include "../lib/gui.h"
14
#include "../lib/list_box.h"
14
#include "../lib/list_box.h"
15
#include "../lib/obj/box_lib.h"
15
#include "../lib/obj/box_lib.h"
-
 
16
#include "../lib/obj/libio.h"
16
#include "../lib/obj/libio.h"
17
#include "../lib/obj/libimg.h"
17
#include "../lib/obj/libini.h"
18
#include "../lib/obj/libini.h"
18
#include "../lib/collection.h"
19
#include "../lib/collection.h"
19
#include "../lib/io.h"
20
#include "../lib/io.h"
-
 
21
#include "../lib/patterns/select_list.h"
Line 20... Line 22...
20
#include "../lib/patterns/select_list.h"
22
#include "../lib/patterns/restart_process.h"
21
 
23
 
22
//===================================================//
24
//===================================================//
23
//                                                   //
25
//                                                   //
Line 32... Line 34...
32
	#define T_CAUTION_TITLE "…„“…†„…ˆ…"
34
	#define T_CAUTION_TITLE "…„“…†„…ˆ…"
33
	#define T_CAUTION_PARAGRAPH "“áâ ­®¢ª  ¤®¯®«­¨â¥«ì­ëå ¤à ©¢¥à®¢ ¬®¦¥â ­ ­¥á⨠¢à¥¤ áâ ¡¨«ì­®á⨠®¯¥à æ¨®­­®© á¨áâ¥¬ë ¨ ¯®â¥­æ¨ «ì­® ¯à¨¢¥á⨠ª ¯®àç¥ ®¡®à㤮¢ ­¨ï."
35
	#define T_CAUTION_PARAGRAPH "“áâ ­®¢ª  ¤®¯®«­¨â¥«ì­ëå ¤à ©¢¥à®¢ ¬®¦¥â ­ ­¥á⨠¢à¥¤ áâ ¡¨«ì­®á⨠®¯¥à æ¨®­­®© á¨áâ¥¬ë ¨ ¯®â¥­æ¨ «ì­® ¯à¨¢¥á⨠ª ¯®àç¥ ®¡®à㤮¢ ­¨ï."
34
	#define T_ASSEPT_RISK "Ÿ ¯à¨­¨¬ î à¨áª"
36
	#define T_ASSEPT_RISK "Ÿ ¯à¨­¨¬ î à¨áª"
35
	#define T_README "Readme"
37
	#define T_README "Readme"
36
	#define T_INSTALL "“áâ ­®¢¨âì"
38
	#define T_INSTALL "“áâ ­®¢¨âì"
-
 
39
	#define T_DRIVER_INSTALLARION_STARTED "' ç « áì ãáâ ­®¢ª  ¤à ©¢¥à .\n‹®£ ãáâ ­®¢ª¨ ­ å®¤¨âáï ¢ ¯à¨«®¦¥­¨¨ BOARD.'I"
37
	char description_name[] = "description_ru";
40
	char description_name[] = "description_ru";
38
#else
41
#else
39
	#define WINDOW_TITLE "Driver Installer"
42
	#define WINDOW_TITLE "Driver Installer"
40
	#define T_CAUTION_TITLE "CAUTION"
43
	#define T_CAUTION_TITLE "CAUTION"
41
	#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
44
	#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
42
	#define T_ASSEPT_RISK "I accept the risk"
45
	#define T_ASSEPT_RISK "I accept the risk"
43
	#define T_README "Readme"
46
	#define T_README "Readme"
44
	#define T_INSTALL "Install"
47
	#define T_INSTALL "Install"
-
 
48
	#define T_DRIVER_INSTALLARION_STARTED "'Driver installation started.\nInstallation log can be found in BOARD app.'I"
45
	char description_name[] = "description_en";
49
	char description_name[] = "description_en";
46
#endif
50
#endif
Line 47... Line 51...
47
 
51
 
48
#define BUTTON_ID_ASSEPT_RISK 10
52
#define BUTTON_ID_ASSEPT_RISK 10
Line 56... Line 60...
56
 
60
 
Line 57... Line 61...
57
collection ini_sections;
61
collection ini_sections;
58
 
62
 
-
 
63
char drvinf_path[4096] = "/kolibrios/drivers/drvinf.ini";
59
char drvinf_path[4096] = "/kolibrios/drivers/drvinf.ini";
64
char cur_version[64];
60
char cur_version[64];
65
char cur_type[12];
61
char cur_description[1024];
66
char cur_description[1024];
Line 62... Line 67...
62
char cur_readme_path[4096];
67
char cur_readme_path[4096];
Line 84... Line 89...
84
void main()
89
void main()
85
{
90
{
86
	load_dll(libio,  #libio_init,1);
91
	load_dll(libio,  #libio_init,1);
87
	load_dll(libini, #lib_init,1);
92
	load_dll(libini, #lib_init,1);
88
	load_dll(boxlib, #box_lib_init,0);
93
	load_dll(boxlib, #box_lib_init,0);
-
 
94
	load_dll(libimg, #libimg_init,1);
89
	GetIniData();
95
	GetIniData();
90
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
96
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
91
	loop() switch(WaitEvent())
97
	loop() switch(WaitEvent())
92
	{
98
	{
93
		case evMouse:
99
		case evMouse:
Line 134... Line 140...
134
void Draw_DriverListWindow()
140
void Draw_DriverListWindow()
135
{
141
{
136
	int PADDING = 12;
142
	int PADDING = 12;
137
	int right_frame_x = Form.cwidth*46/100;
143
	int right_frame_x = Form.cwidth*46/100;
138
	int readme_w = 0;
144
	int readme_w = 0;
-
 
145
	int icon_n = 38;
139
	//LEFT FRAME
146
	//LEFT FRAME
140
	SelectList_Init(PADDING, 
147
	SelectList_Init(PADDING, 
141
		PADDING, 
148
		PADDING, 
142
		right_frame_x - PADDING - PADDING - 8 - scroll1.size_x, 
149
		right_frame_x - PADDING - PADDING - 8 - scroll1.size_x, 
143
		Form.cheight - PADDING - PADDING, 
150
		Form.cheight - PADDING - PADDING, 
Line 145... Line 152...
145
	SelectList_Draw();
152
	SelectList_Draw();
146
	SelectList_DrawBorder();
153
	SelectList_DrawBorder();
147
	//RIGHT FRAME
154
	//RIGHT FRAME
148
	GetCurrentSectionData();
155
	GetCurrentSectionData();
149
	DrawBar(right_frame_x, PADDING+3, Form.cwidth - right_frame_x - PADDING, 80, system.color.work);
156
	DrawBar(right_frame_x, PADDING+3, Form.cwidth - right_frame_x - PADDING, 80, system.color.work);
-
 
157
	if (streq(#cur_type, "disk")) icon_n = 50;
-
 
158
	DrawIcon32(right_frame_x, PADDING, system.color.work, icon_n);	
150
	WriteTextB(right_frame_x, PADDING+3, 0x81, system.color.work_text, ini_sections.get(select_list.cur_y));
159
	WriteTextB(right_frame_x+44, PADDING+3, 0x81, system.color.work_text, ini_sections.get(select_list.cur_y));
151
	WriteText(right_frame_x, PADDING+23, 0x80, system.color.work_text, #cur_version);
160
	WriteText(right_frame_x+44, PADDING+23, 0x80, system.color.work_text, #cur_version);
152
	if(cur_readme_path[0]) readme_w = DrawStandartCaptButton(right_frame_x, PADDING+45, BUTTON_ID_README, T_README);
161
	if(cur_readme_path[0]) readme_w = DrawStandartCaptButton(right_frame_x, PADDING+45, BUTTON_ID_README, T_README);
153
	DrawStandartCaptButton(right_frame_x + readme_w, PADDING+45, BUTTON_ID_INSTALL, T_INSTALL);
162
	DrawStandartCaptButton(right_frame_x + readme_w, PADDING+45, BUTTON_ID_INSTALL, T_INSTALL);
154
	DrawTextViewArea(right_frame_x-2, PADDING+83, Form.cwidth - right_frame_x - PADDING, Form.cheight-PADDING-PADDING, 
163
	DrawTextViewArea(right_frame_x-2, PADDING+83, Form.cwidth - right_frame_x - PADDING, Form.cheight-PADDING-PADDING, 
155
		#cur_description, system.color.work, system.color.work_text);
164
		#cur_description, system.color.work, system.color.work_text);
156
}
165
}
Line 181... Line 190...
181
 
190
 
182
void GetCurrentSectionData()
191
void GetCurrentSectionData()
183
{
192
{
184
	dword section_name = ini_sections.get(select_list.cur_y);
193
	dword section_name = ini_sections.get(select_list.cur_y);
-
 
194
	ini_get_str stdcall (#drvinf_path, section_name, "ver", #cur_version, sizeof(cur_version), 0);
185
	ini_get_str stdcall (#drvinf_path, section_name, "ver", #cur_version, sizeof(cur_version), 0);
195
	ini_get_str stdcall (#drvinf_path, section_name, "type", #cur_type, sizeof(cur_type), 0);
186
	ini_get_str stdcall (#drvinf_path, section_name, #description_name, #cur_description, sizeof(cur_description), 0);
196
	ini_get_str stdcall (#drvinf_path, section_name, #description_name, #cur_description, sizeof(cur_description), 0);
187
	ini_get_str stdcall (#drvinf_path, section_name, "readme", #cur_readme_path, sizeof(cur_readme_path), 0);
197
	ini_get_str stdcall (#drvinf_path, section_name, "readme", #cur_readme_path, sizeof(cur_readme_path), 0);
188
	ini_get_str stdcall (#drvinf_path, section_name, "install", #cur_install_path, sizeof(cur_install_path), 0);
198
	ini_get_str stdcall (#drvinf_path, section_name, "install", #cur_install_path, sizeof(cur_install_path), 0);
Line 229... Line 239...
229
 
239
 
230
void Event_RunInstall()
240
void Event_RunInstall()
231
{
241
{
232
	int result;
242
	int result;
233
	result = io.run(#cur_install_path, NULL);
243
	result = io.run(#cur_install_path, NULL);
-
 
244
	if (result) notify(T_DRIVER_INSTALLARION_STARTED);
-
 
245
	pause(300);
-
 
246
	if (streq(#cur_type, "video")) {
-
 
247
		RestartProcessByName("/sys/@taskbar", SINGLE);
-
 
248
		RestartProcessByName("/sys/@docky", SINGLE);	
-
 
249
		RestartProcessByName("/sys/@icon", MOLTIPLE);	
234
	if (result) notify("'Driver installation started.\nPlease, open BOARD to check status.'I");
250
	}
235
}
251
}