Virtual machine Management Terminal User Interface
Revision | 52e9a543f94bb41c93cc3e508e82fa40360cf28d (tree) |
---|---|
Zeit | 2023-04-04 22:20:27 |
Autor | Koine Yuusuke(koinec) <koinec@user...> |
Commiter | Koine Yuusuke(koinec) |
Improve Guest line output in VMlist window.
@@ -192,10 +192,14 @@ int | ||
192 | 192 | VmList_Item *p_item; |
193 | 193 | char str_fmt[32]; |
194 | 194 | char str_stat[16]; |
195 | + char str_loader[32]; | |
196 | + char str_term[16]; | |
195 | 197 | char *pstr_con; |
196 | 198 | char *pstr_type; |
199 | + char *pstr_stat; | |
197 | 200 | char str_animation[5] = "-\\|/"; |
198 | 201 | chtype ch_line; |
202 | + KeyVal_Data t_kval; | |
199 | 203 | |
200 | 204 | i_err = TuiVmList_CreateList(); |
201 | 205 |
@@ -284,27 +288,41 @@ int | ||
284 | 288 | |
285 | 289 | switch( p_guest->dw_status ) { |
286 | 290 | case GUEST_STATUS_STOP: |
287 | - strncpy( str_stat, " Stop", 15 ); | |
291 | + pstr_stat = " Stop"; | |
288 | 292 | i_attr = COLOR_PAIR(1); // White-Black |
289 | 293 | break; |
290 | 294 | case GUEST_STATUS_RUN: |
291 | - strncpy( str_stat, "* RUN", 15 ); | |
295 | + pstr_stat = "* RUN"; | |
292 | 296 | i_attr = COL_CYAN; |
293 | 297 | break; |
294 | 298 | case GUEST_STATUS_WAIT: |
295 | - strncpy( str_stat, "- Wait", 15 ); | |
299 | + pstr_stat = "- Wait"; | |
296 | 300 | i_attr = COL_YELLOW; |
297 | 301 | break; |
298 | 302 | case GUEST_STATUS_UNKNOWN: |
299 | - strncpy( str_stat, "? UNKNOWN", 15 ); | |
303 | + pstr_stat = "? UNKNOWN"; | |
300 | 304 | i_attr = COL_MAGENTA; |
301 | 305 | break; |
302 | 306 | default: |
303 | - strncpy( str_stat, "! BUG!!", 15 ); | |
307 | + pstr_stat = "! BUG!!"; | |
304 | 308 | i_attr = COL_RED; |
305 | 309 | break; |
306 | 310 | } |
307 | 311 | |
312 | + i_err = KeyVal_GetData( &t_kval, &(p_guest->t_info), GUEST_LOADER_LOADER_KEY ); | |
313 | + if( 0x00 == i_err ) | |
314 | + { strncpy( str_loader, KEYVAL_DATA_STRING( t_kval ), sizeof(str_loader) ); } | |
315 | + else | |
316 | + { strncpy( str_loader, "UNKNOWN", sizeof(str_loader) ); } | |
317 | + | |
318 | + i_err = KeyVal_GetData( &t_kval, &(p_guest->t_info), GUEST_VNC_ENABLE_KEY ); | |
319 | + if(( 0x00 == i_err ) && KEYVAL_DATA_ISBOOL( t_kval ) ) | |
320 | + { strncpy( str_term, "[VNC/", sizeof(str_term) ); } | |
321 | + else | |
322 | + { strncpy( str_term, "[---/", sizeof(str_term) ); } | |
323 | + // XXX | |
324 | + strncat( str_term, "---/---]", sizeof(str_term) - 5 ); | |
325 | + | |
308 | 326 | if( gi_line_now == i_line ) |
309 | 327 | { wattrset( gp_vmlist_win, i_attr | A_REVERSE ); } |
310 | 328 | else |
@@ -312,9 +330,10 @@ int | ||
312 | 330 | |
313 | 331 | // Indent(2) + HyperName&fqdn(48+) + ConnectType(16) + State(10) |
314 | 332 | // ConnectType: "Local", "SSH(vmbhyve) |
315 | - snprintf( str_fmt, 32, " %%-%d.%ds %%-16s %%-14s", | |
316 | - (COLS - 4 - 16 - 14 - 2 - 2) , (COLS - 4 - 16 - 14 - 2 - 2) ); | |
317 | - mvwprintw( gp_vmlist_win, i_line, 1, str_fmt, p_guest->str_vmname, "type", str_stat ); | |
333 | + snprintf( str_fmt, 32, " %%-%d.%ds %%-16s %%-16s %%-14s", | |
334 | + (COLS - 4 -1 -16 -1 -16 -1 -14 -2) , (COLS -4 -1 -16 -1 -16 -1 -14 -2) ); | |
335 | + mvwprintw( gp_vmlist_win, i_line, 1, str_fmt, | |
336 | + p_guest->str_vmname, str_loader, str_term, pstr_stat ); | |
318 | 337 | |
319 | 338 | Guest_Release( p_guest ); |
320 | 339 |