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;
private SocketCommunicator communicator;
private EmulatorConfig config;
+ private Table table;
+ private LinkedHashMap<String, String> refinedData;
public DetailInfoDialog( Shell parent, String emulatorName, SocketCommunicator communicator, EmulatorConfig config ) {
super( parent, "Detail Info" + " - " + emulatorName, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE
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 );
int index = 0;
- LinkedHashMap<String, String> refinedData = composeAndParseData( infoData );
+ refinedData = composeAndParseData( infoData );
Iterator<Entry<String, String>> iterator = refinedData.entrySet().iterator();
while ( iterator.hasNext() ) {
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;
}
@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 );
}
}
String sharedPath = "";
boolean isHwVirtual = false;
String hwVirtualCompare = "";
- String haxError = "hax_error=";
+ String logPath = "";
boolean isHaxError = false;
if ( SkinUtil.isLinuxPlatform() ) {
} 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
+ }
}
}
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" );
}
}
- if( isHwVirtual ) {
+ if ( isHwVirtual ) {
if( isHaxError ) {
result.put( "HW Virtualization State", "Disable(insufficient memory for driver)" );
}else {
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;
}
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 );
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 );
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] );
}
#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 );
detail_info->data_length = total_len;
return detail_info;
-
}
void free_detail_info( DetailInfo* detail_info ) {
}
void open_shell( void ) {
+ INFO("open shell\n");
}
void onoff_usb_kbd( int on )