Skip to content

Commit 8457704

Browse files
author
DBChoco
committed
Added quran quote | variable settings title size | user installtion instead of general installation
1 parent 7f93960 commit 8457704

File tree

5 files changed

+52
-44
lines changed

5 files changed

+52
-44
lines changed

pom.xml

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,15 @@
155155
<!-- https://github.com/fvarrui/JavaPackager/blob/master/docs/macosx-specific-properties.md -->
156156
<winConfig>
157157
<!-- general properties -->
158+
<generateMsi>false</generateMsi>
158159
<icoFile>src/main/resources/io/github/dbchoco/Salawat/images/icon.ico</icoFile>
159160

160161
<!-- exe creation properties -->
161162
<headerType>console</headerType>
162163
<originalFilename>${name}-${version}.exe</originalFilename>
163164

164165
<!-- setup generation properties -->
166+
<setupMode>installForCurrentUser</setupMode>
165167
<disableRunAfterInstall>false</disableRunAfterInstall>
166168
<createDesktopIconTask>false</createDesktopIconTask>
167169

@@ -172,7 +174,7 @@
172174
<key>HKCU:Software\Microsoft\Windows\CurrentVersion\Run</key>
173175
<valueName>Salawat</valueName>
174176
<valueType>REG_SZ</valueType>
175-
<valueData>C:\Program Files\Salawat\Salawat.exe</valueData>
177+
<valueData>%USERPROFILE%\AppData\Local\Programs\Salawat\Salawat.exe</valueData>
176178
</entry>
177179
</entries>
178180
</registry>
@@ -183,41 +185,4 @@
183185
</plugin>
184186
</plugins>
185187
</build>
186-
<profiles>
187-
<profile>
188-
<id>flatpak</id>
189-
<build>
190-
<plugins>
191-
<plugin>
192-
<groupId>io.github.fvarrui</groupId>
193-
<artifactId>javapackager</artifactId>
194-
<version>1.6.6</version>
195-
<executions>
196-
<execution>
197-
<configuration>
198-
<!-- mandatory -->
199-
<mainClass>io.github.dbchoco.Salawat.FakeMain</mainClass>
200-
<!-- optional -->
201-
<bundleJre>true</bundleJre>
202-
<copyDependencies>true</copyDependencies>
203-
<runnableJar>${project.build.directory}/${project.artifactId}-${project.version}.jar</runnableJar>
204-
<generateInstaller>true</generateInstaller>
205-
<administratorRequired>false</administratorRequired>
206-
<createTarball>false</createTarball>
207-
<platform>auto</platform>
208-
<additionalResources>Salawat.desktop</additionalResources>
209-
<linuxConfig>
210-
<pngFile>src/main/resources/io/github/dbchoco/Salawat/images/icon.png</pngFile>
211-
<generateDeb>false</generateDeb>
212-
<generateRpm>false</generateRpm>
213-
</linuxConfig>
214-
</configuration>
215-
</execution>
216-
</executions>
217-
</plugin>
218-
</plugins>
219-
</build>
220-
<!-- https://github.com/fvarrui/JavaPackager -->
221-
</profile>
222-
</profiles>
223188
</project>

src/main/java/io/github/dbchoco/Salawat/controllers/settings/HeaderController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.github.dbchoco.Salawat.app.I18N;
44
import io.github.dbchoco.Salawat.controllers.BaseController;
5+
import io.github.dbchoco.Salawat.helpers.FontBinder;
56
import io.github.dbchoco.Salawat.helpers.SizeBinder;
67
import javafx.scene.control.Label;
78
import javafx.scene.layout.FlowPane;
@@ -24,7 +25,8 @@ protected void translate() {
2425

2526
@Override
2627
protected void makeResizable() {
27-
SizeBinder.bindSize(hbox, 1280, 70, "settings");
28-
SizeBinder.bindSize(flowPane, 600, 70, "settings");
28+
SizeBinder.bindSize(hbox, 1280, 80, "settings");
29+
SizeBinder.bindSize(flowPane, 600, 80, "settings");
30+
FontBinder.bindFontSize(settingsLabel, "large");
2931
}
3032
}

src/main/java/io/github/dbchoco/Salawat/controllers/settings/SettingsController.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,47 @@
11
package io.github.dbchoco.Salawat.controllers.settings;
22

3+
import io.github.dbchoco.Salawat.app.I18N;
34
import io.github.dbchoco.Salawat.app.UserSettings;
45
import io.github.dbchoco.Salawat.controllers.BaseController;
56
import io.github.dbchoco.Salawat.helpers.Controllers;
7+
import io.github.dbchoco.Salawat.helpers.FontBinder;
68
import io.github.dbchoco.Salawat.helpers.SizeBinder;
79
import javafx.beans.property.ReadOnlyDoubleProperty;
10+
import javafx.scene.control.Label;
811
import javafx.scene.image.Image;
912
import javafx.scene.layout.*;
1013
import javafx.scene.paint.Color;
1114

15+
import java.awt.*;
16+
1217
public class SettingsController extends BaseController {
1318
public BorderPane borderPane;
1419
public GridPane gridPane;
1520
public AnchorPane root;
1621
public FlowPane mainSettings;
22+
public Label quranQuote;
23+
public Label quranSource;
1724

1825
public void initialize(){
1926
loadBackground();
2027
Controllers.setSettingsController(this);
2128
makeResizable();
29+
translate();
2230
}
2331

2432
@Override
2533
protected void translate() {
26-
34+
I18N.bindString(quranQuote, "quote");
35+
I18N.bindString(quranSource, "source");
2736
}
2837

2938
@Override
3039
protected void makeResizable() {
3140
//SizeBinder.bindSize(root, 1280, 720, "settings");
3241
SizeBinder.bindSize(borderPane, 1280, 720, "settings");
42+
SizeBinder.bindSize(gridPane, 1280, 500, "settings");
43+
FontBinder.bindFontSize(quranQuote, "small");
44+
FontBinder.bindFontSize(quranSource, "smaller");
3345
}
3446

3547
public ReadOnlyDoubleProperty getWidthProperty(){

src/main/java/io/github/dbchoco/Salawat/helpers/FontBinder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ public class FontBinder {
1414
private static final ObjectProperty<Font> fontLarge = new SimpleObjectProperty<Font>(font);
1515
static final ObjectProperty<Font> fontMedium = new SimpleObjectProperty<Font>(font);
1616
private static final ObjectProperty<Font> fontSmall = new SimpleObjectProperty<Font>(font);
17+
private static final ObjectProperty<Font> fontSmaller = new SimpleObjectProperty<Font>(font);
18+
19+
private static final Integer smallerFontRatio = 50;
1720
private static final Integer smallFontRatio = 35;
1821
private static final Integer mediumFontRatio = 25;
1922
private static final Integer largeFontRatio = 18;
2023
private static final Integer largerFontRatio = 10;
2124

2225
public static void init(){
26+
fontSmaller.set(FontChooser.getFont(StageController.getStage().heightProperty().doubleValue() / smallerFontRatio));
2327
fontSmall.set(FontChooser.getFont(StageController.getStage().heightProperty().doubleValue() / smallFontRatio));
2428
fontMedium.set(FontChooser.getFont(
2529
StageController.getStage().heightProperty().doubleValue() / mediumFontRatio));
@@ -28,6 +32,7 @@ public static void init(){
2832
StageController.getStage().heightProperty().addListener(new ChangeListener<Number>() {
2933
@Override
3034
public void changed(ObservableValue<? extends Number> observableValue, Number number, Number t1) {
35+
fontSmaller.set(FontChooser.getFont(t1.doubleValue() / smallerFontRatio));
3136
fontSmall.set(FontChooser.getFont(t1.doubleValue() / smallFontRatio));
3237
fontMedium.set(FontChooser.getFont(t1.doubleValue() / mediumFontRatio));
3338
fontLarge.set(FontChooser.getFont(t1.doubleValue() / largeFontRatio));
@@ -37,6 +42,7 @@ public void changed(ObservableValue<? extends Number> observableValue, Number nu
3742
}
3843

3944
public static void reloadFonts(){
45+
fontSmaller.set(FontChooser.getFont(StageController.getStage().heightProperty().doubleValue() / smallerFontRatio));
4046
fontSmall.set(FontChooser.getFont(StageController.getStage().heightProperty().doubleValue() / smallFontRatio));
4147
fontMedium.set(FontChooser.getFont(
4248
StageController.getStage().heightProperty().doubleValue() / mediumFontRatio));
@@ -46,6 +52,7 @@ public static void reloadFonts(){
4652

4753
public static void bindFontSize(Label label, String size){
4854
switch (size){
55+
case "smaller" -> label.fontProperty().bind(fontSmaller);
4956
case "small" -> label.fontProperty().bind(fontSmall);
5057
case "medium" -> label.fontProperty().bind(fontMedium);
5158
case "large" -> label.fontProperty().bind(fontLarge);

src/main/resources/io/github/dbchoco/Salawat/fxml/settings.fxml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3+
<?import javafx.geometry.Insets?>
4+
<?import javafx.scene.control.Label?>
35
<?import javafx.scene.layout.AnchorPane?>
46
<?import javafx.scene.layout.BorderPane?>
57
<?import javafx.scene.layout.ColumnConstraints?>
68
<?import javafx.scene.layout.FlowPane?>
79
<?import javafx.scene.layout.GridPane?>
810
<?import javafx.scene.layout.HBox?>
911
<?import javafx.scene.layout.RowConstraints?>
12+
<?import javafx.scene.layout.VBox?>
1013

1114
<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.github.dbchoco.Salawat.controllers.settings.SettingsController">
1215
<children>
@@ -22,22 +25,41 @@
2225
</FlowPane>
2326
</bottom>
2427
<center>
25-
<GridPane fx:id="gridPane" alignment="TOP_CENTER" pickOnBounds="false" prefHeight="582.0" prefWidth="669.0" BorderPane.alignment="CENTER">
28+
<GridPane fx:id="gridPane" alignment="TOP_CENTER" pickOnBounds="false" prefHeight="550.0" prefWidth="1280.0" BorderPane.alignment="CENTER">
2629
<columnConstraints>
2730
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
2831
</columnConstraints>
2932
<rowConstraints>
30-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
33+
<RowConstraints maxHeight="481.0" minHeight="10.0" prefHeight="448.0" vgrow="SOMETIMES" />
34+
<RowConstraints maxHeight="285.0" minHeight="10.0" prefHeight="134.0" vgrow="SOMETIMES" />
3135
</rowConstraints>
3236
<children>
3337
<HBox fx:id="innerHBox" alignment="TOP_CENTER" pickOnBounds="false" spacing="20.0">
3438
<children>
3539
<fx:include fx:id="sideBar" source="settings/sideBar.fxml" />
36-
<FlowPane fx:id="mainSettings" prefHeight="600" prefWidth="400.0">
40+
<FlowPane fx:id="mainSettings" prefHeight="585.0" prefWidth="400.0">
3741
<fx:include source="settings/tabs/general.fxml" />
3842
</FlowPane>
3943
</children>
44+
<GridPane.margin>
45+
<Insets top="30.0" />
46+
</GridPane.margin>
4047
</HBox>
48+
<VBox alignment="BOTTOM_CENTER" mouseTransparent="true" pickOnBounds="false" prefWidth="1280.0" GridPane.rowIndex="1">
49+
<children>
50+
<Label fx:id="quranQuote" alignment="CENTER" contentDisplay="CENTER" text="Quran Quote" wrapText="true">
51+
<VBox.margin>
52+
<Insets left="20.0" right="20.0" />
53+
</VBox.margin></Label>
54+
<Label fx:id="quranSource" text="Quran Source" />
55+
</children>
56+
<GridPane.margin>
57+
<Insets bottom="40.0" />
58+
</GridPane.margin>
59+
<opaqueInsets>
60+
<Insets />
61+
</opaqueInsets>
62+
</VBox>
4163
</children>
4264
</GridPane>
4365
</center>

0 commit comments

Comments
 (0)