<property name="jar.file" value="emulator-skin.jar" />
<property name="mainclass" value="org.tizen.emulator.skin.EmulatorSkinMain" />
-
+
<property name="swt.file" value="swt.jar" />
<path id="linux-classpath">
<delete file="${jar.file}" />
</target>
- <target name="linux-compile" depends="clean">
+ <target name="make-properties">
+ <echo message="Make properties..." />
+ <tstamp>
+ <format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT" locale="en" />
+ </tstamp>
+ <exec executable="cat" outputproperty="version">
+ <arg value="../../VERSION" />
+ </exec>
+ <exec executable="git" outputproperty="build_git_commit">
+ <arg value="rev-parse" />
+ <arg value="--short" />
+ <arg value="HEAD" />
+ </exec>
+
+ <propertyfile file="src/about.properties"
+ comment="Auto-generated properties - DO NOT EDIT">
+ <entry key="version" value="${version}" />
+ <entry key="build_time" value="${build_time}" />
+ <entry key="build_git_commit" value="${build_git_commit}" />
+ </propertyfile>
+ </target>
+
+ <target name="linux-compile" depends="make-properties, clean">
<echo message="compiling..." />
<mkdir dir="bin" />
<javac encoding="UTF-8" fork="true" srcdir="src" destdir="bin" debug="on" memorymaximumsize="128m">
</javac>
</target>
- <target name="windows-compile" depends="clean">
+ <target name="windows-compile" depends="make-properties, clean">
<echo message="compiling..." />
<mkdir dir="bin" />
<javac encoding="UTF-8" fork="true" srcdir="src" destdir="bin" debug="on" memorymaximumsize="128m">
</javac>
</target>
- <target name="mac-compile" depends="clean">
+ <target name="mac-compile" depends="make-properties, clean">
<echo message="compiling..." />
<mkdir dir="bin" />
<javac encoding="UTF-8" fork="true" srcdir="src" destdir="bin" debug="on" memorymaximumsize="128m">
<target name="linux-jar" depends="linux-compile">
<echo message="creating jar..." />
<jar jarfile="${jar.file}" basedir="bin" duplicate="add">
+ <fileset file="src/about.properties" />
<manifest>
<attribute name="Main-Class" value="${mainclass}"/>
<attribute name="Class-path" value="lib/swt/gtk-linux/${swt.file}"/>
import org.tizen.emulator.skin.dbi.RegionType;
import org.tizen.emulator.skin.dbi.RgbType;
import org.tizen.emulator.skin.dbi.RotationType;
+import org.tizen.emulator.skin.dialog.AboutDialog;
import org.tizen.emulator.skin.image.ImageRegistry;
import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
import org.tizen.emulator.skin.log.SkinLogger;
final MenuItem aboutItem = new MenuItem( menu, SWT.PUSH );
aboutItem.setText( "About" );
- aboutItem.setEnabled( false );
+ aboutItem.setEnabled( true );
aboutItem.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e ) {
- // TODO
+ AboutDialog dialog = new AboutDialog(shell);
+ dialog.open();
}
} );
--- /dev/null
+package org.tizen.emulator.skin.dialog;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public class AboutDialog {
+ MessageBox messageBox;
+ Properties properties;
+
+ public AboutDialog(Shell shell) {
+ if(!getProperties())
+ return;
+
+ messageBox = new MessageBox(shell);
+ messageBox.setText("About");
+
+ String message = makeMessage();
+ messageBox.setMessage(message);
+ }
+
+ private String makeMessage() {
+ String version = "Version : " + properties.getProperty("version");
+ String buildTime = "Build time : " + properties.getProperty("build_time");
+ String gitCommit = "Git : " + properties.getProperty("build_git_commit");
+
+ return version + "\n" + buildTime + "\n" + gitCommit;
+ }
+
+ private boolean getProperties() {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("about.properties");
+ if(is == null)
+ return false;
+
+ properties = new Properties();
+ try {
+ properties.load(is);
+ } catch (IOException e) {
+ e.printStackTrace();
+
+ return false;
+ }
+
+ return true;
+ }
+
+ public void open() {
+ messageBox.open();
+ }
+}