Skip to content

Commit 8d0cd21

Browse files
authored
Merge pull request #179 from doubleSlashde/feature/#178_heimatIntegration
Feature/#178 heimat integration
2 parents 1ef4b19 + e755888 commit 8d0cd21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3698
-397
lines changed

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Create projects and choose if they are counted as 'work time'. Select the projec
3535

3636
## Install
3737

38-
* Download keeptime-<version>.zip (see [releases](https://github.com/doubleSlashde/KeepTime/releases))
38+
* Download keeptime-\<version\>.zip (see [releases](https://github.com/doubleSlashde/KeepTime/releases))
3939
* Extract the downloaded .zip
4040
* Try starting the application by executing the *keeptime.bat* file. The start may take up to one minute.
4141

@@ -45,27 +45,34 @@ It is recommended to run the application at computer start, so you do not forget
4545

4646
You should put the .jar in an extra folder as a *logs* and a *db* folder will be created next to it.\
4747

48-
### Migrate from older version than v1.2.0
48+
## Update KeepTime
49+
1. Start your current version of KeepTime
50+
1. Open `Settings` -> `Import/Export` -> `Export` to export your data to an .sql file (Backup data)
51+
1. Stop KeepTime
52+
1. Download new version of KeepTime and extract it
53+
1. Start new version of KeepTime
54+
1. If your projects are available you are already done. But most likely your projects are missing. In this case follow the [Migrate](#Migrate) chapter
55+
- Missing data is expected behavior with most updates as updates often include database version update which require an import of data
56+
57+
### Migrate data
58+
1. Notice that your old data is not available after an update
59+
1. Open the new version of KeepTime
60+
1. Open `Settings` -> `Import/Export` -> `Import` and import the previously exported .sql file
61+
1. After the import KeepTime closes automatically
62+
1. Start KeepTime
63+
1. Your data is restored in the new version now
64+
65+
### Migrate from version older than v1.2.0
4966

5067
1. Download new version and replace the .jar file.
5168
2. Start new version of KeepTime. Notice that your old data is not available.
5269
3. Stop KeepTime
5370
4. Copy the files (not directories) of directory `db` (next to the .jar file) into `db/1.4.197/` (path now includes the database version).
5471
5. Start KeepTime again. Notice that your data is available again.
5572

56-
### Migrate from KeepTime v1.2.0
57-
58-
1. Start your current version of KeepTime (v1.2.0)
59-
2. Go to the settings and export your KeepTime data
60-
3. Download new version and replace the .jar file.
61-
4. Start new version of KeepTime. Notice that your old data is not available.
62-
5. Open the new version and import the exported sql script
63-
6. After the import KeepTime closes automatically
64-
7. To see the changes just start the new KeepTime again
65-
6673
## Requirements
6774
* Operating System
6875
* Windows 7, 10, 11
6976
* Linux (tested on Ubuntu 18.04)
7077
* Mac (tested on MacBook M2 Pro (ARM based CPU))
71-
* Java 17
78+
* Java >= 17

pom.xml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>3.1.10</version>
9+
<version>3.4.4</version>
1010
<relativePath />
1111
<!-- lookup parent from repository -->
1212
</parent>
@@ -39,7 +39,7 @@
3939
<java.version>17</java.version>
4040
<javafx.version>22</javafx.version>
4141

42-
<maven-dependency-check.version>9.1.0</maven-dependency-check.version>
42+
<maven-dependency-check.version>12.0.1</maven-dependency-check.version>
4343
<!-- USING HTML,XML (comma-separated list) did not work with plugin version 5.1.0 -->
4444
<maven-dependency-check.format>ALL</maven-dependency-check.format>
4545
<maven-dependency-check.failOnError>true</maven-dependency-check.failOnError>
@@ -51,12 +51,12 @@
5151
<dependency>
5252
<groupId>org.mapstruct</groupId>
5353
<artifactId>mapstruct</artifactId>
54-
<version>1.5.5.Final</version>
54+
<version>1.6.3</version>
5555
</dependency>
5656
<dependency>
5757
<groupId>org.mapstruct</groupId>
5858
<artifactId>mapstruct-processor</artifactId>
59-
<version>1.5.5.Final</version>
59+
<version>1.6.3</version>
6060
<scope>provided</scope>
6161
</dependency>
6262
<dependency>
@@ -103,17 +103,15 @@
103103
<dependency>
104104
<groupId>org.springdoc</groupId>
105105
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
106-
<version>2.5.0</version>
106+
<version>2.8.5</version>
107107
</dependency>
108108
<dependency>
109109
<groupId>org.springframework.boot</groupId>
110110
<artifactId>spring-boot-starter-validation</artifactId>
111111
</dependency>
112-
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
113112
<dependency>
114113
<groupId>org.springframework.boot</groupId>
115114
<artifactId>spring-boot-starter-security</artifactId>
116-
<version>3.1.3</version>
117115
</dependency>
118116

119117

@@ -162,6 +160,14 @@
162160
<artifactId>hamcrest-library</artifactId>
163161
<scope>test</scope>
164162
</dependency>
163+
164+
<!-- for HeimatTime LocalDate (de)serializiation -->
165+
<dependency>
166+
<groupId>com.fasterxml.jackson.datatype</groupId>
167+
<artifactId>jackson-datatype-jsr310</artifactId>
168+
<version>2.18.2</version>
169+
</dependency>
170+
165171
</dependencies>
166172
<build>
167173
<finalName>keeptime-${project.version}</finalName>

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

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Optional;
2525
import java.util.stream.Collectors;
2626

27+
import javafx.stage.Window;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930
import org.springframework.boot.SpringApplication;
@@ -78,6 +79,7 @@ public class App extends Application {
7879
private ViewController viewController;
7980

8081
private GlobalScreenListener globalScreenListener;
82+
private Settings settings;
8183

8284
@Override
8385
public void init() throws Exception {
@@ -95,6 +97,7 @@ public void init() throws Exception {
9597

9698
model = springContext.getBean(Model.class);
9799
controller = springContext.getBean(Controller.class);
100+
settings = springContext.getBean(Settings.class);
98101
controller.enableAutoSave();
99102
model.setSpringContext(springContext);
100103
}
@@ -108,36 +111,43 @@ public void start(final Stage primaryStage) {
108111
} catch (final Exception e) {
109112
LOG.error("There was an error while initialising the UI", e);
110113

111-
final Alert alert = new Alert(AlertType.ERROR);
112-
alert.setTitle("Error");
113-
alert.setHeaderText("Could not start application");
114-
alert.setContentText("Please send the error with your logs folder to a developer");
114+
showErrorDialogAndWait("Error", "Could not start application",
115+
"Please send the error with your logs folder to a developer", e, null);
116+
System.exit(1);
117+
}
118+
}
115119

116-
final StringWriter sw = new StringWriter();
117-
final PrintWriter pw = new PrintWriter(sw);
118-
e.printStackTrace(pw);
119-
final String exceptionText = sw.toString();
120+
public static void showErrorDialogAndWait(String title, String header, String content, final Exception e, Window window) {
121+
final Alert alert = new Alert(AlertType.ERROR);
122+
alert.setTitle(title);
123+
alert.setHeaderText(header);
124+
alert.setContentText(content);
125+
if(window != null) {
126+
alert.initOwner(window);
127+
}
128+
final StringWriter sw = new StringWriter();
129+
final PrintWriter pw = new PrintWriter(sw);
130+
e.printStackTrace(pw);
131+
final String exceptionText = sw.toString();
120132

121-
final Label label = new Label("The exception stacktrace was:");
133+
final Label label = new Label("The exception stacktrace was:");
122134

123-
final TextArea textArea = new TextArea(exceptionText);
124-
textArea.setEditable(false);
125-
textArea.setWrapText(true);
135+
final TextArea textArea = new TextArea(exceptionText);
136+
textArea.setEditable(false);
137+
textArea.setWrapText(true);
126138

127-
textArea.setMaxWidth(Double.MAX_VALUE);
128-
textArea.setMaxHeight(Double.MAX_VALUE);
129-
GridPane.setVgrow(textArea, Priority.ALWAYS);
130-
GridPane.setHgrow(textArea, Priority.ALWAYS);
139+
textArea.setMaxWidth(Double.MAX_VALUE);
140+
textArea.setMaxHeight(Double.MAX_VALUE);
141+
GridPane.setVgrow(textArea, Priority.ALWAYS);
142+
GridPane.setHgrow(textArea, Priority.ALWAYS);
131143

132-
final GridPane expContent = new GridPane();
133-
expContent.setMaxWidth(Double.MAX_VALUE);
134-
expContent.add(label, 0, 0);
135-
expContent.add(textArea, 0, 1);
144+
final GridPane expContent = new GridPane();
145+
expContent.setMaxWidth(Double.MAX_VALUE);
146+
expContent.add(label, 0, 0);
147+
expContent.add(textArea, 0, 1);
136148

137-
alert.getDialogPane().setExpandableContent(expContent);
138-
alert.showAndWait();
139-
System.exit(1);
140-
}
149+
alert.getDialogPane().setExpandableContent(expContent);
150+
alert.showAndWait();
141151
}
142152

143153
private void initialiseApplication(final Stage primaryStage) throws Exception {
@@ -183,27 +193,6 @@ private void initialiseApplication(final Stage primaryStage) throws Exception {
183193
private void readSettings() {
184194
LOG.debug("Reading configuration");
185195

186-
final List<Settings> settingsList = model.getSettingsRepository().findAll();
187-
final Settings settings;
188-
if (settingsList.isEmpty()) {
189-
LOG.info("Empty settings. Set default");
190-
settings = new Settings();
191-
settings.setTaskBarColor(model.taskBarColor.get());
192-
193-
settings.setDefaultBackgroundColor(Model.ORIGINAL_DEFAULT_BACKGROUND_COLOR);
194-
settings.setDefaultFontColor(Model.ORIGINAL_DEFAULT_FONT_COLOR);
195-
196-
settings.setHoverBackgroundColor(Model.ORIGINAL_HOVER_BACKGROUND_COLOR);
197-
settings.setHoverFontColor(Model.ORIGINAL_HOVER_Font_COLOR);
198-
settings.setUseHotkey(false);
199-
settings.setDisplayProjectsRight(false);
200-
settings.setHideProjectsOnMouseExit(false);
201-
model.getSettingsRepository().save(settings);
202-
} else {
203-
LOG.info("Got settings from database");
204-
settings = settingsList.get(0);
205-
}
206-
207196
model.defaultBackgroundColor.set(settings.getDefaultBackgroundColor());
208197
model.defaultFontColor.set(settings.getDefaultFontColor());
209198
model.hoverBackgroundColor.set(settings.getHoverBackgroundColor());

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@
1818

1919
import javafx.scene.paint.Color;
2020

21+
import java.util.Random;
22+
2123
public class ColorHelper {
2224

25+
private static final Random random = new Random();
26+
2327
private ColorHelper() {
2428
throw new IllegalStateException("Utility class: ColorHelper");
2529
}
2630

2731
public static Color randomColor() {
28-
return Color.BLACK;
32+
double hue = random.nextDouble() * 360;
33+
double saturation = 0.7 + random.nextDouble() * 0.3; // High saturation
34+
double brightness = 0.8 + random.nextDouble() * 0.2; // High brightness
35+
return Color.hsb(hue, saturation, brightness);
2936
}
3037

3138
public static String colorToCssRgba(final Color color) {

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public enum RESOURCE {
4040

4141
FXML_MANAGE_PROJECT("/layouts/manage-project.fxml"),
4242
FXML_MANAGE_WORK("/layouts/manage-work.fxml"),
43+
FXML_EXT_PROJECT_MAPPING("/layouts/externalProjectMapping.fxml"),
44+
FXML_EXT_PROJECT_SYNC("/layouts/externalProjectSync.fxml"),
4345

4446
SVG_CALENDAR_DAYS_ICON("/svgs/calendar-days.svg"),
4547

@@ -69,8 +71,20 @@ public enum RESOURCE {
6971

7072
SVG_MULTIPLE_CLIPBOARD_ICON("/svgs/copy.svg"),
7173

72-
ICON_MAIN("/icons/icon.png")
74+
SVG_SPINNER_SOLID("/svgs/spinner-solid.svg"),
7375

76+
SVG_XMARK_SOLID("/svgs/xmark-solid.svg"),
77+
78+
SVG_THUMBS_UP_SOLID("/svgs/thumbs-up-solid.svg"),
79+
80+
SVG_GLOBE_ICON("/svgs/globe-solid.svg"),
81+
82+
SVG_ROTATE_ICON("/svgs/rotate-solid.svg"),
83+
84+
ICON_MAIN("/icons/icon.png"),
85+
86+
/** CSS **/
87+
CSS_DS_STYLE("/css/dsStyles.css")
7488
;
7589

7690
String resourceLocation;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static String getSvgPathWithXMl(Resources.RESOURCE resource){
6565
return svgPath;
6666
}
6767

68-
public static SVGPath getSvgNodeWithScale(Resources.RESOURCE resource, Double scaleX, Double scaleY) {
68+
public static SVGPath getSvgNodeWithScale(Resources.RESOURCE resource, double scaleX, double scaleY) {
6969
SVGPath iconSvg = new SVGPath();
7070
iconSvg.setContent(getSvgPathWithXMl(resource));
7171
iconSvg.setScaleX(scaleX);

0 commit comments

Comments
 (0)