From: giwoong.kim Date: Tue, 4 Sep 2012 13:33:17 +0000 (+0900) Subject: [Title] renewal about dialog X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91f14fafdda61a105eeebdd533b44128380a813d;p=sdk%2Femulator%2Fqemu.git [Title] renewal about dialog [Type] feature [Module] Emulator / menu [Priority] major [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/tizen/src/skin/client/build.xml b/tizen/src/skin/client/build.xml index d7764e3401..bebeec7f8c 100644 --- a/tizen/src/skin/client/build.xml +++ b/tizen/src/skin/client/build.xml @@ -30,7 +30,7 @@ - + diff --git a/tizen/src/skin/client/resource/images/about_Tizen_SDK.png b/tizen/src/skin/client/resource/images/about_Tizen_SDK.png new file mode 100755 index 0000000000..b276703a7a Binary files /dev/null and b/tizen/src/skin/client/resource/images/about_Tizen_SDK.png differ diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java index ddaeadf844..5413ec97fc 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java @@ -38,8 +38,8 @@ 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.graphics.Font; -import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -50,150 +50,201 @@ import org.eclipse.swt.widgets.Text; import org.tizen.emulator.skin.log.SkinLogger; import org.tizen.emulator.skin.util.IOUtil; import org.tizen.emulator.skin.util.StringUtil; -import org.tizen.emulator.skin.util.SwtUtil; public class AboutDialog extends SkinDialog { - + public static final String ABOUT_PROP_FILENAME = "about.properties"; - + public static final String PROP_KEY_VERSION = "version"; public static final String PROP_KEY_BUILD_TIME = "build_time"; public static final String PROP_KEY_GIT_VERSION = "build_git_commit"; - - private Logger logger = SkinLogger.getSkinLogger( AboutDialog.class ).getLogger(); - public AboutDialog( Shell parent ) { - super( parent, "About Tizen Emulator", SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL ); + private Logger logger = SkinLogger.getSkinLogger(AboutDialog.class).getLogger(); + + public AboutDialog(Shell parent) { + super(parent, "About Tizen Emulator", SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + } + + private GridLayout getNopaddedGridLayout(int numColumns, boolean makeColumnEqualWidth) { + GridLayout layout = new GridLayout(numColumns, makeColumnEqualWidth); + layout.marginLeft = layout.marginRight = 0; + layout.marginTop = layout.marginBottom = 0; + layout.marginWidth = layout.marginHeight = 0; + layout.horizontalSpacing = layout.verticalSpacing = 0; + + return layout; } @Override - protected Composite createArea( Composite parent ) { - Composite composite = displayInfo( parent ); + protected void createComposite() { + Composite parent = new Composite(shell, SWT.NONE); + parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + GridLayout gridLayout = getNopaddedGridLayout(1, true); + parent.setLayout(gridLayout); + + Composite area = createArea(parent); + if (null == area) { + return; + } + + /* bottom side */ + buttonComposite = new Composite(parent, SWT.NONE); + buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true)); + buttonComposite.setLayout(new GridLayout(1, false)); + + createButtons(buttonComposite); + } + + @Override + protected Composite createArea(Composite parent) { + Composite composite = displayInfo(parent); return composite; } - private Composite displayInfo( Composite parent ) { + private Composite displayInfo(Composite parent) { + Composite compositeBase = new Composite(parent, SWT.BORDER); + compositeBase.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + compositeBase.setLayout(getNopaddedGridLayout(2, false)); - Composite composite = new Composite( parent, SWT.NONE ); - - composite.setLayout( new GridLayout( 1, false ) ); + /* left side */ + Composite compositeLeft = new Composite(compositeBase, SWT.BORDER); + compositeLeft.setLayout(getNopaddedGridLayout(1, false)); - Label titleLabel = new Label( composite, SWT.NONE ); - GridData gridData = new GridData(); + Label imageLabel = new Label(compositeLeft, SWT.NONE); + Image aboutImage = new Image(shell.getDisplay(), + this.getClass().getClassLoader().getResourceAsStream("images/about_Tizen_SDK.png")); + imageLabel.setImage(aboutImage); + + /* right side */ + Composite compositeRight = new Composite(compositeBase, SWT.NONE); + compositeRight.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true)); + compositeRight.setLayout(getNopaddedGridLayout(1, false)); + + Label titleLabel = new Label(compositeRight, SWT.NONE); + /*GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.CENTER; - titleLabel.setLayoutData( gridData ); - - titleLabel.setText( "Tizen Emulator" ); - Font systemFont = shell.getDisplay().getSystemFont(); + titleLabel.setLayoutData(gridData);*/ + titleLabel.setText("\n Tizen SDK\n"); + /*Font systemFont = shell.getDisplay().getSystemFont(); FontData[] fontData = systemFont.getFontData(); - fontData[0].setStyle( SWT.BOLD ); - fontData[0].setHeight( 16 ); - Font font = new Font( shell.getDisplay(), fontData[0] ); - titleLabel.setFont( font ); - font.dispose(); + fontData[0].setStyle(SWT.BOLD); + fontData[0].setHeight(16); + Font font = new Font(shell.getDisplay(), fontData[0]); + titleLabel.setFont(font); + font.dispose();*/ Properties properties = getProperties(); - - Text versionText = new Text( composite, SWT.NONE ); - String version = getValue( properties, PROP_KEY_VERSION ); - if (SwtUtil.isWindowsPlatform()) { - versionText.setText("Version" + " : " + version); - } else { - versionText.setText("Version" + " : " + version); - } - versionText.setEditable( false ); - versionText.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); - Text buildText = new Text( composite, SWT.NONE ); - String time = getValue( properties, PROP_KEY_BUILD_TIME ); - buildText.setText( "Build time" + " : " + time + " (GMT)" ); - buildText.setEditable( false ); - buildText.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); - - Text gitText = new Text( composite, SWT.NONE ); - String gitVersion = getValue( properties, PROP_KEY_GIT_VERSION ); - gitText.setText( "Git version" + " : " + gitVersion ); - gitText.setEditable( false ); - gitText.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) ); + Text versionText = new Text(compositeRight, SWT.NONE); + String version = getValue(properties, PROP_KEY_VERSION); + versionText.setText(" Version : " + version); + versionText.setEditable(false); + versionText.setBackground( + shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + Text buildText = new Text(compositeRight, SWT.NONE); + String time = getValue(properties, PROP_KEY_BUILD_TIME); + buildText.setText(" Build id : " + time); + buildText.setEditable(false); + buildText.setBackground( + shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + /*Text gitText = new Text(compositeRight, SWT.NONE); + String gitVersion = getValue(properties, PROP_KEY_GIT_VERSION); + gitText.setText("Git version" + " : " + gitVersion); + gitText.setEditable(false); + gitText.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));*/ + + Label spaceLabel = new Label(compositeRight, SWT.NONE); + spaceLabel.setText("\n"); + + Text visitText = new Text(compositeRight, SWT.NONE); + visitText.setText(" Visit https://developer.tizen.org"); + visitText.setEditable(false); + visitText.setBackground( + shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + return compositeBase; + } - return composite; + private String getValue(Properties properties, String key) { + if (null != properties) { - } + String property = properties.getProperty(key); - private String getValue( Properties properties, String key ) { - - if( null != properties ) { + if (!StringUtil.isEmpty(property)) { - String property = properties.getProperty( key ); - - if( !StringUtil.isEmpty( property ) ) { - - if( !property.contains( key ) ) { + if (!property.contains(key)) { return property; - }else { - // ex) '${build_git_commit}' is default expression in build.xml + } else { + // ex) '${build_git_commit}' is default + // expression in build.xml return "Not identified"; } - - }else { + + } else { return "Not identified"; } - }else { + } else { return "Not identified"; } - } - + @Override - protected void createButtons( Composite parent ) { + protected void createButtons(Composite parent) { + super.createButtons(parent); + + Composite composite = new Composite(parent, SWT.NONE); + FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL); + composite.setLayout(fillLayout); - super.createButtons( parent ); + Button licenseButton = createButton(composite, "License"); - Button licenseButton = createButton( parent, "License" ); - licenseButton.addSelectionListener( new SelectionAdapter() { + licenseButton.addSelectionListener(new SelectionAdapter() { private boolean isOpen; @Override - public void widgetSelected( SelectionEvent e ) { - if ( !isOpen ) { + public void widgetSelected(SelectionEvent e) { + if (!isOpen) { isOpen = true; - LicenseDialog licenseDialog = new LicenseDialog( shell, "License" ); + LicenseDialog licenseDialog = new LicenseDialog(shell, "License"); licenseDialog.open(); isOpen = false; } } - } ); - - createOKButton( parent, true ); + }); + createOKButton(composite, true); } private Properties getProperties() { - InputStream is = null; Properties properties = null; - try { - is = this.getClass().getClassLoader().getResourceAsStream( ABOUT_PROP_FILENAME ); - if ( null == is ) { - logger.severe( "about properties file is null." ); + try { + is = this.getClass().getClassLoader().getResourceAsStream(ABOUT_PROP_FILENAME); + if (null == is) { + logger.severe("about properties file is null."); return null; } properties = new Properties(); - properties.load( is ); + properties.load(is); - } catch ( IOException e ) { - logger.log( Level.SEVERE, e.getMessage(), e ); + } catch (IOException e) { + logger.log(Level.SEVERE, e.getMessage(), e); return null; } finally { - IOUtil.close( is ); + IOUtil.close(is); } return properties; + } + protected void setShellSize() { + shell.setSize(436, shell.getSize().y); } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java index 16d142d071..9c4a677c2c 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java @@ -51,7 +51,7 @@ public abstract class SkinDialog extends Dialog { public static final String OK = " " + "OK" + " "; protected Shell shell; - private Composite buttonComposite; + protected Composite buttonComposite; private Shell parent; private String title; private int style; @@ -62,15 +62,8 @@ public abstract class SkinDialog extends Dialog { this.title = title; this.style = style; } - - public void open() { - - shell = new Shell( parent, style ); - shell.setText( title ); - shell.setImage( parent.getImage() ); - - shell.setLayout( new GridLayout( 1, true ) ); + protected void createComposite() { Composite parent = new Composite( shell, SWT.NONE ); parent.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); GridLayout gridLayout = new GridLayout( 1, true ); @@ -81,8 +74,8 @@ public abstract class SkinDialog extends Dialog { composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); composite.setLayout( new FillLayout( SWT.VERTICAL ) ); - Composite area = createArea( composite ); - if ( null == area ) { + Composite area = createArea(composite); + if (null == area) { return; } @@ -91,6 +84,16 @@ public abstract class SkinDialog extends Dialog { buttonComposite.setLayout( new FillLayout( SWT.HORIZONTAL ) ); createButtons( buttonComposite ); + } + + public void open() { + shell = new Shell( parent, style ); + shell.setText( title ); + shell.setImage( parent.getImage() ); + + shell.setLayout( new GridLayout( 1, true ) ); + + createComposite(); shell.pack();