provide @2x start/stop/kill icons
@ -287,7 +287,7 @@
|
||||
<methods>;
|
||||
<fields>;
|
||||
}
|
||||
-keep class org.eclipse.swt.internal.image.*FileFormat
|
||||
-keep class org.eclipse.swt.internal.buttonImage.*FileFormat
|
||||
-keep class * {
|
||||
% *Proc(int);
|
||||
% *Proc(int, int);
|
||||
|
||||
|
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 724 B |
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.44.1"
|
||||
sodipodi:docbase="/mnt/work/svn_sf/ipscan/resources/images/buttons"
|
||||
sodipodi:docname="kill.svg"
|
||||
inkscape:export-filename="/mnt/work/svn_sf/ipscan/resources/images/buttons/kill.png"
|
||||
inkscape:export-xdpi="90.639999"
|
||||
inkscape:export-ydpi="90.639999">
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="kill.svg"
|
||||
inkscape:export-filename="/home/anton/dev/ipscan/resources/images/buttons/kill@2x.png"
|
||||
inkscape:export-xdpi="180"
|
||||
inkscape:export-ydpi="180"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs1874">
|
||||
<linearGradient
|
||||
@ -192,17 +192,18 @@
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.197802"
|
||||
inkscape:cx="8"
|
||||
inkscape:cy="4.2356563"
|
||||
inkscape:zoom="62.784865"
|
||||
inkscape:cx="8.4030845"
|
||||
inkscape:cy="5.8253905"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1012"
|
||||
inkscape:window-height="716"
|
||||
inkscape:window-width="2044"
|
||||
inkscape:window-height="1301"
|
||||
inkscape:window-x="6"
|
||||
inkscape:window-y="21" />
|
||||
inkscape:window-y="48"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata1877">
|
||||
<rdf:RDF>
|
||||
@ -218,26 +219,9 @@
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
id="path3507"
|
||||
d="M 2.3806403,4.3351339 L 4.9974297,1.7183444 L 8.8477198,5.5780768 L 12.719028,1.7067562 L 15.327877,4.3156056 L 11.448617,8.1789857 L 15.303628,12.033977 L 12.711087,14.626516 L 8.8477198,10.779874 L 4.9309049,14.696689 L 2.3220555,12.087839 L 6.2468104,8.1789857 L 2.3806403,4.3351339 z "
|
||||
style="fill:#b7a6a6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.78578949px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:url(#linearGradient2977);fill-opacity:1;fill-rule:evenodd;stroke:#551919;stroke-width:0.78578949px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1"
|
||||
d="M 1.9526587,4.5216941 L 4.3244204,2.1499324 L 7.8141816,5.6482519 L 11.323002,2.1394293 L 13.687567,4.5039944 L 10.171548,8.0056204 L 13.665589,11.499661 L 11.315805,13.849443 L 7.8141816,10.362989 L 4.2641247,13.913046 L 1.8995596,11.54848 L 5.4568131,8.0056204 L 1.9526587,4.5216941 z "
|
||||
id="path2969" />
|
||||
<path
|
||||
id="path2983"
|
||||
d="M 4.2641247,13.275856 L 2.7137464,11.619279 L 6.3063994,7.9348215 L 2.802245,4.5216941 L 4.5014175,2.9287199"
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#eab7b7;stroke-width:0.62863159;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#eda8a8;stroke-width:0.62863159;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 8.3245558,9.8957978 L 11.510504,13.038956"
|
||||
id="path2987" />
|
||||
<path
|
||||
id="path2989"
|
||||
d="M 8.3478962,6.0843261 L 11.533838,2.9411681"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#eda8a8;stroke-width:0.62863159;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 7.0 KiB |
BIN
resources/images/buttons/kill@2x.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 494 B |
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.44.1"
|
||||
sodipodi:docbase="/mnt/work/svn_sf/ipscan/resources/images/buttons"
|
||||
sodipodi:docname="start.svg"
|
||||
inkscape:export-filename="/mnt/work/svn_sf/ipscan/resources/images/buttons/start.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="start.svg"
|
||||
inkscape:export-filename="/home/anton/dev/ipscan/resources/images/buttons/start.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs1874">
|
||||
<linearGradient
|
||||
@ -172,17 +172,18 @@
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.197802"
|
||||
inkscape:cx="8"
|
||||
inkscape:cy="4.2356563"
|
||||
inkscape:zoom="88.791208"
|
||||
inkscape:cx="7.0178887"
|
||||
inkscape:cy="8.2098974"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1012"
|
||||
inkscape:window-height="716"
|
||||
inkscape:window-width="2364"
|
||||
inkscape:window-height="1503"
|
||||
inkscape:window-x="6"
|
||||
inkscape:window-y="21" />
|
||||
inkscape:window-y="48"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata1877">
|
||||
<rdf:RDF>
|
||||
@ -198,20 +199,10 @@
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
style="fill:#b8b8b8;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.84880513;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 1.2050968,5.8329871 L 1.2050968,12.324209 L 9.3185041,12.324209 L 9.3185041,15.112864 L 16.007791,8.9817273 L 9.3185041,3.0286874 L 9.3185041,5.8173413 L 1.2050968,5.8329871 z "
|
||||
id="path2316"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<path
|
||||
style="fill:url(#linearGradient2953);fill-opacity:1;fill-rule:evenodd;stroke:#113c18;stroke-width:0.8566674;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 0.48356757,4.4222692 L 0.48356757,10.91672 L 8.4783011,10.91672 L 8.4783011,13.706762 L 15.069746,7.5725767 L 8.4783011,1.6165739 L 8.4783011,4.4066158 L 0.48356757,4.4222692 z "
|
||||
id="path2945"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#bff3c1;stroke-width:0.91482568;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 1.3594592,10.504175 L 1.3594592,5.2964542 L 9.2337933,5.2964542 L 9.2337933,3.0285762"
|
||||
id="path2955"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
resources/images/buttons/start@2x.png
Normal file
|
After Width: | Height: | Size: 871 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 338 B |
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.44.1"
|
||||
sodipodi:docbase="/mnt/work/svn_sf/ipscan/resources/images/buttons"
|
||||
sodipodi:docname="stop.svg"
|
||||
inkscape:export-filename="/mnt/work/svn_sf/ipscan/resources/images/buttons/stop.png"
|
||||
inkscape:export-xdpi="90.639999"
|
||||
inkscape:export-ydpi="90.639999">
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16px"
|
||||
height="16px"
|
||||
id="svg1872"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="stop.svg"
|
||||
inkscape:export-filename="/mnt/work/svn_sf/ipscan/resources/images/buttons/stop.png"
|
||||
inkscape:export-xdpi="90.639999"
|
||||
inkscape:export-ydpi="90.639999"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs1874">
|
||||
<linearGradient
|
||||
@ -182,17 +182,18 @@
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.197802"
|
||||
inkscape:cx="8"
|
||||
inkscape:cy="4.2356563"
|
||||
inkscape:zoom="44.395604"
|
||||
inkscape:cx="14.383949"
|
||||
inkscape:cy="7.0687265"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1012"
|
||||
inkscape:window-height="716"
|
||||
inkscape:window-width="2105"
|
||||
inkscape:window-height="1286"
|
||||
inkscape:window-x="6"
|
||||
inkscape:window-y="21" />
|
||||
inkscape:window-y="48"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata1877">
|
||||
<rdf:RDF>
|
||||
@ -208,17 +209,9 @@
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
id="path3299"
|
||||
d="M 3.4558176,3.36694 L 3.4558176,14.973645 L 15.005065,14.973645 L 15.005065,3.4243982 L 3.4558176,3.36694 z "
|
||||
style="fill:#b7a6a6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.19625533px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:url(#linearGradient2965);fill-opacity:1;fill-rule:evenodd;stroke:#400;stroke-width:1.19625533px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1"
|
||||
d="M 2.6253205,2.5382265 L 2.6253205,13.424149 L 13.457353,13.424149 L 13.457353,2.5921172 L 2.6253205,2.5382265 z "
|
||||
id="path2957" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ff9c9c;stroke-width:0.81793904;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 3.5972584,12.822792 L 3.5972584,3.5634348 L 12.810368,3.5634348"
|
||||
id="path2967" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
resources/images/buttons/stop@2x.png
Normal file
|
After Width: | Height: | Size: 423 B |
@ -81,7 +81,7 @@ public final class Labels {
|
||||
instance.labels = instance.labelsFallback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves an InputStream to load the image, specified by a key in resource file.
|
||||
* @param key
|
||||
@ -90,7 +90,7 @@ public final class Labels {
|
||||
String imagePath = get(key);
|
||||
return getClass().getClassLoader().getResourceAsStream(imagePath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves a String specified by the label key
|
||||
* @param key
|
||||
|
||||
@ -19,13 +19,16 @@ import net.azib.ipscan.gui.menu.ResultsContextMenu;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.*;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.*;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import static net.azib.ipscan.gui.util.LayoutHelper.buttonImage;
|
||||
import static net.azib.ipscan.gui.util.LayoutHelper.formData;
|
||||
|
||||
/**
|
||||
@ -166,28 +169,19 @@ public class MainWindow {
|
||||
|
||||
prefsButton = createToolbarButton(controlsArea);
|
||||
ToolItem item = new ToolItem(prefsButton, SWT.PUSH);
|
||||
item.setImage(image("prefs"));
|
||||
item.setImage(buttonImage("prefs"));
|
||||
item.setToolTipText(Labels.getLabel("title.preferences"));
|
||||
item.addListener(SWT.Selection, preferencesListener);
|
||||
|
||||
fetchersButton = createToolbarButton(controlsArea);
|
||||
item = new ToolItem(fetchersButton, SWT.PUSH);
|
||||
item.setImage(image("fetchers"));
|
||||
item.setImage(buttonImage("fetchers"));
|
||||
item.setToolTipText(Labels.getLabel("title.fetchers.select"));
|
||||
item.addListener(SWT.Selection, chooseFetchersListsner);
|
||||
|
||||
feederSelectionListener.widgetSelected(null);
|
||||
}
|
||||
|
||||
private Image image(final String baseName) {
|
||||
return new Image(Display.getCurrent(), new ImageDataProvider() {
|
||||
@Override public ImageData getImageData(int zoom) {
|
||||
String suffix = zoom >= 200 ? "@2x.png" : ".png";
|
||||
return new ImageData(getClass().getResourceAsStream("/images/buttons/" + baseName + suffix));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ToolBar createToolbarButton(Composite controlsArea) {
|
||||
ToolBar bar = new ToolBar(controlsArea, SWT.FLAT);
|
||||
bar.setCursor(bar.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
|
||||
|
||||
@ -31,6 +31,8 @@ import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import static net.azib.ipscan.gui.util.LayoutHelper.buttonImage;
|
||||
|
||||
/**
|
||||
* Start/Stop button action class.
|
||||
* It listens to presses on the buttons as well as updates gui statuses
|
||||
@ -64,11 +66,11 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
this.display = display;
|
||||
|
||||
// preload button images
|
||||
buttonImages[ScanningState.IDLE.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.start.img"));
|
||||
buttonImages[ScanningState.SCANNING.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.stop.img"));
|
||||
buttonImages[ScanningState.IDLE.ordinal()] = buttonImage("start");
|
||||
buttonImages[ScanningState.SCANNING.ordinal()] = buttonImage("stop");
|
||||
buttonImages[ScanningState.STARTING.ordinal()] = buttonImages[ScanningState.SCANNING.ordinal()];
|
||||
buttonImages[ScanningState.RESTARTING.ordinal()] = buttonImages[ScanningState.SCANNING.ordinal()];
|
||||
buttonImages[ScanningState.STOPPING.ordinal()] = new Image(display, Labels.getInstance().getImageAsStream("button.kill.img"));
|
||||
buttonImages[ScanningState.STOPPING.ordinal()] = buttonImage("kill");
|
||||
buttonImages[ScanningState.KILLING.ordinal()] = buttonImages[ScanningState.STOPPING.ordinal()];
|
||||
|
||||
// preload button texts
|
||||
@ -98,7 +100,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
// add listeners to all state changes
|
||||
stateMachine.addTransitionListener(this);
|
||||
|
||||
// set the default image
|
||||
// set the default buttonImage
|
||||
ScanningState state = stateMachine.getState();
|
||||
button.setImage(buttonImages[state.ordinal()]);
|
||||
button.setText(buttonTexts[state.ordinal()]);
|
||||
@ -191,7 +193,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
statusBar.setStatusText(Labels.getLabel("state.killingThreads"));
|
||||
break;
|
||||
}
|
||||
// change button image
|
||||
// change button buttonImage
|
||||
button.setImage(buttonImages[state.ordinal()]);
|
||||
button.setText(buttonTexts[state.ordinal()]);
|
||||
}
|
||||
@ -255,7 +257,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
else
|
||||
statusBar.getShell().setText(mainWindowTitle);
|
||||
|
||||
// change button image according to the current state
|
||||
// change button buttonImage according to the current state
|
||||
button.setImage(buttonImages[stateMachine.getState().ordinal()]);
|
||||
}
|
||||
});
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
package net.azib.ipscan.gui.util;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.*;
|
||||
import org.eclipse.swt.layout.FormAttachment;
|
||||
import org.eclipse.swt.layout.FormData;
|
||||
import org.eclipse.swt.layout.FormLayout;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
@ -47,4 +47,13 @@ public class LayoutHelper {
|
||||
fontData.setHeight(fontData.getHeight() * 4/3);
|
||||
return new Font(shell.getDisplay(), fontData);
|
||||
}
|
||||
|
||||
public static Image buttonImage(final String baseName) {
|
||||
return new Image(Display.getCurrent(), new ImageDataProvider() {
|
||||
@Override public ImageData getImageData(int zoom) {
|
||||
String suffix = zoom >= 200 ? "@2x.png" : ".png";
|
||||
return new ImageData(getClass().getResourceAsStream("/images/buttons/" + baseName + suffix));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,25 +1,17 @@
|
||||
package net.azib.ipscan.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class LabelsTest {
|
||||
|
||||
@ -59,18 +51,18 @@ public class LabelsTest {
|
||||
// exception is good
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testImageAsStream() throws IOException {
|
||||
InputStream stream = Labels.getInstance().getImageAsStream("button.start.img");
|
||||
// Now check the first bytes of GIF image header
|
||||
// Now check the first bytes of GIF buttonImage header
|
||||
stream.read();
|
||||
assertEquals((int)'P', stream.read());
|
||||
assertEquals((int)'N', stream.read());
|
||||
assertEquals((int)'G', stream.read());
|
||||
stream.close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This test recursively processes all source files and tries
|
||||
* to resolve every label it finds.
|
||||
|
||||