Skip to content

Commit 69a4679

Browse files
authored
Merge pull request #44 from doubleSlashde/feature/#12_font_awesome_icons
Feature/#12 font awesome icons
2 parents a914e06 + 94528ca commit 69a4679

File tree

12 files changed

+62
-37
lines changed

12 files changed

+62
-37
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ If you want to contribute please follow this guideline.
66

77
For editing fxml files, use the "JavaFX Scene Builder" in version 8.5.0.
88
Layouting is generally done with fxml files.
9+
10+
For fontawesome support add Libraries
11+
`de.jensd:fontawsomefx-commons:8.15`
12+
`de.jensd:fontawsomefx-fontawsome:4.7.0-5`
13+
to the "JavaFX Scene Builder"
14+
15+
Scene Builder may sometimes delete unicode Charakters when fxml file is changed.
16+
reset Glyph Name to reset uniocode Charakter.

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@
9393
<version>3.1.1</version>
9494
<type>maven-plugin</type>
9595
</dependency>
96+
97+
<dependency>
98+
<groupId>de.jensd</groupId>
99+
<artifactId>fontawesomefx-commons</artifactId>
100+
<version>8.15</version>
101+
</dependency>
102+
103+
<dependency>
104+
<groupId>de.jensd</groupId>
105+
<artifactId>fontawesomefx-fontawesome</artifactId>
106+
<version>4.7.0-5</version>
107+
</dependency>
96108
</dependencies>
97109

98110
<build>

src/main/java/de/doubleslash/keeptime/Main.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ private void initialiseUI(final Stage primaryStage) throws IOException {
248248

249249
registerMinimizeEventlistener(mainScene, primaryStage);
250250
registerMaximizeEventlistener(mainScene, primaryStage);
251-
// Image(Resources.getResource(RESOURCE.ICON_MAIN).toString())); // TODO use an app icon
252251

253252
primaryStage.setTitle("KeepTime");
254253
primaryStage.setScene(mainScene);

src/main/java/de/doubleslash/keeptime/common/Resources.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public enum RESOURCE {
4141
FXML_MANAGE_PROJECT("/layouts/manage-project.fxml"),
4242
FXML_MANAGE_WORK("/layouts/manage-work.fxml"),
4343

44-
// icon
45-
ICON_MAIN("/icons/icon.png"),
46-
4744
;
4845

4946
String resourceLocation;

src/main/java/de/doubleslash/keeptime/view/AboutController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public ObservableList<LicenseTableRow> loadLicenseRows() {
140140
licenseRows.add(new LicenseTableRow("spring-boot-starter-data-jpa", Licenses.APACHEV2));
141141
licenseRows.add(new LicenseTableRow("mockito-core", Licenses.MIT));
142142
licenseRows.add(new LicenseTableRow("h2", Licenses.EPLV1));
143+
licenseRows.add(new LicenseTableRow("fontawesomefx", Licenses.APACHEV2));
143144

144145
licenseRows.sort(Comparator.comparing(LicenseTableRow::getName));
145146

@@ -154,7 +155,7 @@ private void showLicense(final Licenses license) {
154155
alert.setContentText(String.format(
155156
"We could not find the license file at \"%s\". Did you remove it?%nPlease redownload or visit \"%s\".",
156157
license.getPath(), license.getUrl()));
157-
158+
158159
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
159160

160161
alert.show();

src/main/java/de/doubleslash/keeptime/view/ViewController.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import de.doubleslash.keeptime.model.Model;
3737
import de.doubleslash.keeptime.model.Project;
3838
import de.doubleslash.keeptime.view.time.Interval;
39+
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
3940
import javafx.application.Platform;
4041
import javafx.beans.binding.Bindings;
4142
import javafx.beans.property.BooleanProperty;
@@ -61,8 +62,6 @@
6162
import javafx.scene.control.ListView;
6263
import javafx.scene.control.TextArea;
6364
import javafx.scene.control.TextField;
64-
import javafx.scene.effect.Light;
65-
import javafx.scene.effect.Lighting;
6665
import javafx.scene.image.Image;
6766
import javafx.scene.image.ImageView;
6867
import javafx.scene.image.WritableImage;
@@ -126,6 +125,18 @@ public class ViewController {
126125
@FXML
127126
private Canvas canvas;
128127

128+
@FXML
129+
private FontAwesomeIconView calendarIcon;
130+
131+
@FXML
132+
private FontAwesomeIconView settingsIcon;
133+
134+
@FXML
135+
private FontAwesomeIconView minimizeIcon;
136+
137+
@FXML
138+
private FontAwesomeIconView closeIcon;
139+
129140
private ColorTimeLine mainColorTimeLine;
130141

131142
private class Delta {
@@ -188,19 +199,14 @@ private void initialize() {
188199

189200
addNewProjectButton.textFillProperty().bind(fontColorProperty);
190201

191-
// Add a light to colorize buttons
192-
// TODO is there a nicer way for this? (see #12)
193-
final Lighting lighting = new Lighting();
194-
lighting.lightProperty().bind(Bindings.createObjectBinding(() -> {
195-
final Color color = fontColorProperty.get();
196-
return new Light.Distant(45, 45, color);
197-
}, fontColorProperty));
198-
199202
settingsButton.setOnAction(ae -> settingsClicked());
200-
settingsButton.setEffect(lighting);
201203

202204
calendarButton.setOnAction(ae -> calendarClicked());
203-
calendarButton.setEffect(lighting);
205+
206+
calendarIcon.fillProperty().bind(fontColorProperty);
207+
settingsIcon.fillProperty().bind(fontColorProperty);
208+
minimizeIcon.fillProperty().bind(fontColorProperty);
209+
closeIcon.fillProperty().bind(fontColorProperty);
204210

205211
final Runnable updateMainBackgroundColor = this::runUpdateMainBackgroundColor;
206212

src/main/resources/icons/icon.png

-15.5 KB
Binary file not shown.
-3.96 KB
Binary file not shown.
-10.4 KB
Binary file not shown.
-385 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)