From: giwoong.kim Date: Fri, 15 Jun 2012 04:55:20 +0000 (+0900) Subject: [Title] added log path to detail info dialog X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1581 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a21cfe8970ee406f2aa4f42730b86fd7725ae146;p=sdk%2Femulator%2Fqemu.git [Title] added log path to detail info dialog [Type] enhancement [Module] Emulator / skin [Priority] minor [Jira#] [Redmine#] [Problem] [Cause] usability [Solution] show log paht information [TestCase] --- diff --git a/tizen/src/debug_ch.c b/tizen/src/debug_ch.c index 7c2e372b19..32da4ecdf8 100644 --- a/tizen/src/debug_ch.c +++ b/tizen/src/debug_ch.c @@ -57,6 +57,11 @@ void set_log_path(char *path) strcpy(logpath, path); } +char *get_log_path(void) +{ + return logpath; +} + static inline int interlocked_xchg_add( int *dest, int incr ) { int ret; diff --git a/tizen/src/debug_ch.h b/tizen/src/debug_ch.h index 298b7c5bf9..71411b39fa 100644 --- a/tizen/src/debug_ch.h +++ b/tizen/src/debug_ch.h @@ -58,6 +58,7 @@ struct _debug_channel }; void set_log_path(char *path); +char *get_log_path(void); #ifndef NO_DEBUG #define MSGSIZE_MAX 2048 diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java index be8d2bd3fc..b01d402384 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java @@ -29,14 +29,18 @@ package org.tizen.emulator.skin.dialog; +import java.io.File; +import java.io.IOException; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map.Entry; +import java.util.logging.Level; import java.util.logging.Logger; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; @@ -66,6 +70,8 @@ public class DetailInfoDialog extends SkinDialog { private SocketCommunicator communicator; private EmulatorConfig config; + private Table table; + private LinkedHashMap refinedData; public DetailInfoDialog( Shell parent, String emulatorName, SocketCommunicator communicator, EmulatorConfig config ) { super( parent, "Detail Info" + " - " + emulatorName, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE @@ -85,7 +91,7 @@ public class DetailInfoDialog extends SkinDialog { Composite composite = new Composite( parent, SWT.NONE ); composite.setLayout( new FillLayout() ); - Table table = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION ); + table = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION ); table.setHeaderVisible( true ); table.setLinesVisible( true ); @@ -99,7 +105,7 @@ public class DetailInfoDialog extends SkinDialog { int index = 0; - LinkedHashMap refinedData = composeAndParseData( infoData ); + refinedData = composeAndParseData( infoData ); Iterator> iterator = refinedData.entrySet().iterator(); while ( iterator.hasNext() ) { @@ -114,9 +120,48 @@ public class DetailInfoDialog extends SkinDialog { column[0].pack(); column[1].pack(); - table.pack(); + /* browse the log path when log path item is selected */ + table.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + //do nothing + } + + @Override + public void widgetDefaultSelected(SelectionEvent event) { + if (table.getSelectionCount() > 1) { + return; + } + + TableItem tableItem = ((TableItem)table.getSelection()[0]); + final String logKey = "Log Path"; + + if (tableItem.getText().compareTo(logKey) == 0) { + String logPath = refinedData.get(logKey); + ProcessBuilder procBrowser = new ProcessBuilder(); + + if (SkinUtil.isLinuxPlatform()) { + procBrowser.command("nautilus", "--browser", logPath); + } else if (SkinUtil.isWindowsPlatform()) { + procBrowser.command("explorer", "\"" + logPath + "\""); + } else if (SkinUtil.isMacPlatform()) { + //TODO: + } + + if (procBrowser.command().isEmpty() == false) { + try { + procBrowser.start(); + } catch (Exception e) { + logger.log( Level.SEVERE, e.getMessage(), e); + } + } + } + + } + }); + return composite; } @@ -124,9 +169,9 @@ public class DetailInfoDialog extends SkinDialog { @Override protected void setShellSize() { if( SkinUtil.isLinuxPlatform() ) { - shell.setSize( (int) ( 380 * 1.618 ), 380 ); - }else { - shell.setSize( (int) ( 350 * 1.618 ), 350 ); + shell.setSize( (int) ( 402 * 1.618 ), 402 ); + } else { + shell.setSize( (int) ( 372 * 1.618 ), 372 ); } } @@ -161,7 +206,7 @@ public class DetailInfoDialog extends SkinDialog { String sharedPath = ""; boolean isHwVirtual = false; String hwVirtualCompare = ""; - String haxError = "hax_error="; + String logPath = ""; boolean isHaxError = false; if ( SkinUtil.isLinuxPlatform() ) { @@ -252,11 +297,20 @@ public class DetailInfoDialog extends SkinDialog { } else if ( hwVirtualCompare.equals( arg ) ) { isHwVirtual = true; - } else if ( arg.startsWith( haxError ) ) { + } else if ( arg.startsWith("hax_error=") ) { String[] sp = arg.split( "=" ); if( 1 < sp.length ) { isHaxError = Boolean.parseBoolean( sp[1] ); } + } else if (arg.startsWith("log_path=")) { + String[] sp = arg.split("="); + if( 1 < sp.length ) { + final String logSuffix = "/logs/"; + + logPath = sp[1]; + logPath = logPath.substring(0, logPath.lastIndexOf(logSuffix) + logSuffix.length()); + logger.info("log path = " + logPath); //without filename + } } } @@ -285,7 +339,7 @@ public class DetailInfoDialog extends SkinDialog { result.put( "RAM Size", ram ); - if( SkinUtil.isLinuxPlatform() ) { + if ( SkinUtil.isLinuxPlatform() ) { if ( StringUtil.isEmpty( sharedPath ) ) { result.put( "File Sharing", "Not Supported" ); result.put( "File Shared Path", "None" ); @@ -295,7 +349,7 @@ public class DetailInfoDialog extends SkinDialog { } } - if( isHwVirtual ) { + if ( isHwVirtual ) { if( isHaxError ) { result.put( "HW Virtualization State", "Disable(insufficient memory for driver)" ); }else { @@ -311,6 +365,17 @@ public class DetailInfoDialog extends SkinDialog { result.put( "Image Path", imagePath ); } + if (logPath.isEmpty() == false) { + File logFile = new File(logPath); + try { + logPath = logFile.getCanonicalPath(); + } catch (IOException e) { + logger.log(Level.SEVERE, e.getMessage(), e); + } + + result.put("Log Path", logPath); + } + return result; } diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c old mode 100644 new mode 100755 index 7a0ce1a32f..3d60e28857 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -281,12 +281,14 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { int total_len = 0; int delimiter_len = strlen( DATA_DELIMITER ); + /* collect QEMU information */ for ( i = 0; i < qemu_argc; i++ ) { total_len += strlen( qemu_argv[i] ); total_len += delimiter_len; } #ifdef _WIN32 + /* collect HAXM information */ const int HAX_LEN = 32; char hax_error[HAX_LEN]; memset( hax_error, 0, HAX_LEN ); @@ -300,10 +302,17 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { error = 1; } } - hax_err_len += sprintf( hax_error + hax_err_len, "%s", error ? "true" : "false" ); - total_len += hax_err_len; + hax_err_len += sprintf( hax_error + hax_err_len, "%s#", error ? "true" : "false" ); + total_len += (hax_err_len + 1); #endif + /* collect log path information */ +#define LOGPATH_TEXT "log_path=" + char* log_path = get_log_path(); + int log_path_len = strlen(LOGPATH_TEXT) + strlen(log_path) + delimiter_len; + total_len += (log_path_len + 1); + + /* memory allocation */ char* info_data = g_malloc0( total_len + 1 ); if ( !info_data ) { g_free( detail_info ); @@ -311,8 +320,10 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { return NULL; } + + /* write informations */ int len = 0; - total_len = 0; + total_len = 0; //recycle for ( i = 0; i < qemu_argc; i++ ) { len = strlen( qemu_argv[i] ); @@ -321,10 +332,13 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { } #ifdef _WIN32 - snprintf( info_data + total_len, total_len + 1, "%s", hax_error ); + snprintf( info_data + total_len, hax_err_len + 1, "%s#", hax_error ); total_len += hax_err_len; #endif + snprintf( info_data + total_len, log_path_len + 1, "%s%s#", LOGPATH_TEXT, log_path ); + total_len += log_path_len; + INFO( "################## detail info data ####################\n" ); INFO( "%s\n", info_data ); @@ -332,7 +346,6 @@ DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { detail_info->data_length = total_len; return detail_info; - } void free_detail_info( DetailInfo* detail_info ) { @@ -345,6 +358,7 @@ void free_detail_info( DetailInfo* detail_info ) { } void open_shell( void ) { + INFO("open shell\n"); } void onoff_usb_kbd( int on )