Skip to content

Commit 24acddd

Browse files
ddamkeddamke
authored andcommitted
add scg icons for settings
1 parent f6c64d4 commit 24acddd

File tree

4 files changed

+93
-31
lines changed

4 files changed

+93
-31
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public enum RESOURCE {
5757

5858
SVG_BUG_ICON("/svgs/bug.svg"),
5959

60+
SVG_LAYOUT_ICON("/svgs/border-all.svg"),
61+
62+
SVG_ABOUT_ICON("/svgs/info.svg"),
63+
64+
SVG_COLOR_ICON("/svgs/palette.svg"),
65+
66+
SVG_IMPORT_EXPORT_ICON("/svgs/sort.svg")
67+
6068
;
6169

6270
String resourceLocation;

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

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@
1717
package de.doubleslash.keeptime.view;
1818

1919
import java.io.File;
20-
import java.io.IOException;
21-
import java.net.URL;
22-
import java.nio.charset.Charset;
2320
import java.nio.file.Paths;
2421
import java.sql.SQLException;
2522
import java.util.Comparator;
26-
import java.time.LocalDate;
27-
import java.util.List;
28-
import java.util.stream.Collectors;
2923

3024
import de.doubleslash.keeptime.common.*;
3125
import de.doubleslash.keeptime.view.license.LicenseTableRow;
@@ -35,11 +29,7 @@
3529
import javafx.scene.control.cell.PropertyValueFactory;
3630
import javafx.scene.input.MouseButton;
3731
import javafx.scene.shape.SVGPath;
38-
import de.doubleslash.keeptime.Main;
39-
import de.doubleslash.keeptime.model.Project;
40-
import de.doubleslash.keeptime.model.Work;
4132
import javafx.application.Platform;
42-
import javafx.scene.control.*;
4333
import org.h2.tools.RunScript;
4434
import org.h2.tools.Script;
4535
import org.slf4j.Logger;
@@ -52,13 +42,10 @@
5242
import de.doubleslash.keeptime.common.Resources;
5343
import de.doubleslash.keeptime.common.Resources.RESOURCE;
5444
import de.doubleslash.keeptime.controller.Controller;
55-
import de.doubleslash.keeptime.exceptions.FXMLLoaderException;
5645
import de.doubleslash.keeptime.model.Model;
5746
import de.doubleslash.keeptime.model.Settings;
5847
import javafx.fxml.FXML;
5948
import javafx.fxml.FXMLLoader;
60-
import javafx.scene.Parent;
61-
import javafx.scene.Scene;
6249
import javafx.scene.control.Alert;
6350
import javafx.scene.control.Alert.AlertType;
6451
import javafx.scene.control.Button;
@@ -70,7 +57,6 @@
7057
import javafx.scene.paint.Color;
7158
import javafx.stage.FileChooser;
7259
import javafx.stage.FileChooser.ExtensionFilter;
73-
import javafx.stage.Modality;
7460
import javafx.stage.Stage;
7561

7662
@Component
@@ -149,6 +135,7 @@ public class SettingsController {
149135

150136
@FXML
151137
private SVGPath bugIcon;
138+
152139
@FXML
153140
private Label versionNumberLabel;
154141

@@ -158,6 +145,21 @@ public class SettingsController {
158145
@FXML
159146
private TableView<LicenseTableRow> licenseTableView;
160147

148+
@FXML
149+
private Region colorIcon;
150+
151+
@FXML
152+
private Region layoutIcon;
153+
154+
@FXML
155+
private Region generalIcon;
156+
157+
@FXML
158+
private Region aboutIcon;
159+
@FXML
160+
private Region importexportIcon;
161+
162+
161163
private final ApplicationProperties applicationProperties;
162164

163165
private static final Logger LOG = LoggerFactory.getLogger(SettingsController.class);
@@ -167,6 +169,7 @@ public class SettingsController {
167169

168170
private Stage thisStage;
169171

172+
170173
@Autowired
171174
ViewController mainscreen;
172175

@@ -193,6 +196,17 @@ private void initialize() {
193196
globalKeyloggerLabel.setDisable(true);
194197
}
195198

199+
200+
double REQUIRED_WIDTH = 15.0;
201+
double REQUIRED_HEIGHT = 15.0;
202+
203+
setTabSvg(colorIcon,REQUIRED_WIDTH, REQUIRED_HEIGHT,RESOURCE.SVG_COLOR_ICON);
204+
setTabSvg(layoutIcon,REQUIRED_WIDTH, REQUIRED_HEIGHT,RESOURCE.SVG_LAYOUT_ICON);
205+
setTabSvg(generalIcon,REQUIRED_WIDTH,REQUIRED_HEIGHT,RESOURCE.SVG_SETTINGS_ICON);
206+
setTabSvg(aboutIcon,REQUIRED_WIDTH,REQUIRED_HEIGHT,RESOURCE.SVG_ABOUT_ICON);
207+
setTabSvg(importexportIcon,REQUIRED_WIDTH,REQUIRED_HEIGHT,RESOURCE.SVG_IMPORT_EXPORT_ICON);
208+
209+
196210
initExportButton();
197211
initImportButton();
198212

@@ -275,6 +289,16 @@ private void initialize() {
275289
LOG.debug("aboutButton.setOnAction");
276290
initializeAbout();
277291
}
292+
293+
private static void setTabSvg(Region region, Double REQUIRED_WIDTH, Double REQUIRED_HEIGHT,RESOURCE resource) {
294+
295+
region.setShape(SvgNodeProvider.getSvgNodeWithScale(resource,1.0,1.0));
296+
region.setMinSize(REQUIRED_WIDTH, REQUIRED_HEIGHT);
297+
region.setPrefSize(REQUIRED_WIDTH, REQUIRED_HEIGHT);
298+
region.setMaxSize(REQUIRED_WIDTH, REQUIRED_HEIGHT);
299+
region.setStyle("-fx-background-color: black;");
300+
}
301+
278302
public void initializeAbout() {
279303
LOG.debug("set version label");
280304
versionNumberLabel.setText(applicationProperties.getBuildVersion());

src/main/resources/css/settingsv2.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@
2222
}
2323
.tab{
2424
-fx-background-insets: 0 1 0 1,0,0;
25-
-fx-tab-min-width: 40;
2625

2726
}
2827
.tab-pane .tab
2928
{
3029
-fx-background-color: white;
3130
-fx-pref-height: 100;
32-
-fx-pref-width: 60;
31+
-fx-pref-width: 70;
32+
}
3333

34+
.tab-pane .tab .HBox{
35+
-fx-spacing: 5;
3436
}
37+
38+
3539
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator {
3640
-fx-border-width: 1;
3741
-fx-border-color: none;

src/main/resources/layouts/settings.fxml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<?import javafx.scene.layout.AnchorPane?>
3131
<?import javafx.scene.layout.HBox?>
3232
<?import javafx.scene.layout.Pane?>
33+
<?import javafx.scene.layout.Region?>
3334
<?import javafx.scene.layout.VBox?>
3435
<?import javafx.scene.shape.Line?>
3536
<?import javafx.scene.shape.SVGPath?>
@@ -40,9 +41,9 @@
4041
<children>
4142
<TabPane prefHeight="516.0" prefWidth="606.0" side="LEFT" stylesheets="@../css/settingsv2.css" tabClosingPolicy="UNAVAILABLE" tabMinHeight="100.0" tabMinWidth="40.0">
4243
<tabs>
43-
<Tab>
44+
<Tab closable="false">
4445
<content>
45-
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
46+
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="436.0">
4647
<children>
4748
<VBox layoutX="20.0" layoutY="20.0" prefHeight="393.0" prefWidth="486.0" spacing="5.0" styleClass="menuBorder">
4849
<children>
@@ -169,7 +170,12 @@
169170
</AnchorPane>
170171
</content>
171172
<graphic>
172-
<Label text="Color" />
173+
<HBox spacing="5.0" styleClass="HBox" stylesheets="@../css/settingsv2.css">
174+
<children>
175+
<Region fx:id="colorIcon" prefHeight="25.0" prefWidth="25.0" />
176+
<Label prefWidth="75.0" text="Color" />
177+
</children>
178+
</HBox>
173179
</graphic>
174180
</Tab>
175181
<Tab>
@@ -248,7 +254,12 @@
248254
</AnchorPane>
249255
</content>
250256
<graphic>
251-
<Label text="Layout" />
257+
<HBox styleClass="HBox" stylesheets="@../css/settingsv2.css">
258+
<children>
259+
<Region fx:id="layoutIcon" prefHeight="25.0" prefWidth="25.0" />
260+
<Label prefWidth="75.0" text="Layout" />
261+
</children>
262+
</HBox>
252263
</graphic>
253264
</Tab>
254265
<Tab>
@@ -369,7 +380,12 @@
369380
</AnchorPane>
370381
</content>
371382
<graphic>
372-
<Label text="General" />
383+
<HBox styleClass="HBox" stylesheets="@../css/settingsv2.css">
384+
<children>
385+
<Region fx:id="generalIcon" prefHeight="25.0" prefWidth="25.0" />
386+
<Label prefWidth="75.0" text="General" />
387+
</children>
388+
</HBox>
373389
</graphic>
374390
</Tab>
375391
<Tab>
@@ -439,25 +455,30 @@
439455
</AnchorPane>
440456
</content>
441457
<graphic>
442-
<Label text="About" />
458+
<HBox styleClass="HBox" stylesheets="@../css/settingsv2.css">
459+
<children>
460+
<Region fx:id="aboutIcon" prefHeight="25.0" prefWidth="25.0" />
461+
<Label prefWidth="75.0" text="About" />
462+
</children>
463+
</HBox>
443464
</graphic>
444465
</Tab>
445466
<Tab>
446467
<content>
447-
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
468+
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="489.0" prefWidth="452.0">
448469
<children>
449-
<VBox layoutX="20.0" layoutY="20.0">
470+
<VBox layoutX="20.0" layoutY="20.0" prefHeight="328.0" prefWidth="458.0">
450471
<children>
451472
<Group>
452473
<children>
453-
<VBox alignment="BOTTOM_RIGHT" prefHeight="132.0" prefWidth="476.0" styleClass="settingsBorder" stylesheets="@../css/settingsv2.css">
474+
<VBox alignment="BOTTOM_RIGHT" layoutX="30.0" layoutY="81.0" prefHeight="148.0" prefWidth="460.0" styleClass="settingsBorder" stylesheets="@../css/settingsv2.css">
454475
<children>
455-
<HBox prefHeight="100.0" prefWidth="200.0">
476+
<HBox prefHeight="132.0" prefWidth="457.0">
456477
<children>
457-
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Import your prevously exportet Sql script " wrappingWidth="474.13671875" />
478+
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Import your prevously exportet Sql script " />
458479
</children>
459480
</HBox>
460-
<HBox alignment="BOTTOM_RIGHT" prefHeight="40.0" prefWidth="474.0">
481+
<HBox alignment="BOTTOM_RIGHT" prefHeight="38.0" prefWidth="432.0">
461482
<children>
462483
<Button fx:id="importButton" alignment="TOP_LEFT" mnemonicParsing="false" text="Import">
463484
<font>
@@ -472,9 +493,9 @@
472493
</Group>
473494
<Group layoutX="10.0" layoutY="10.0" styleClass="settingsBorder" stylesheets="@../css/settingsv2.css">
474495
<children>
475-
<VBox alignment="BOTTOM_RIGHT" prefHeight="144.0" prefWidth="477.0" styleClass="settingsBorder" stylesheets="@../css/settingsv2.css">
496+
<VBox alignment="BOTTOM_RIGHT" prefHeight="144.0" prefWidth="460.0" styleClass="settingsBorder" stylesheets="@../css/settingsv2.css">
476497
<children>
477-
<HBox prefHeight="100.0" prefWidth="200.0">
498+
<HBox prefHeight="119.0" prefWidth="456.0">
478499
<children>
479500
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Export your data to a Sql scrippt" />
480501
</children>
@@ -498,7 +519,12 @@
498519
</AnchorPane>
499520
</content>
500521
<graphic>
501-
<Label text="Import/Export" />
522+
<HBox prefHeight="24.0" styleClass="HBox" stylesheets="@../css/settingsv2.css">
523+
<children>
524+
<Region fx:id="importexportIcon" prefHeight="25.0" prefWidth="25.0" />
525+
<Label prefWidth="75.0" text="Import/Export" />
526+
</children>
527+
</HBox>
502528
</graphic>
503529
</Tab>
504530
</tabs>

0 commit comments

Comments
 (0)