Skip to content

Commit

Permalink
Merge branch 'master' of github.com:SaptarshiSarkar12/Drifty into has…
Browse files Browse the repository at this point in the history
…nainmakada-99/master
  • Loading branch information
SaptarshiSarkar12 committed Jul 23, 2024
2 parents 99430fb + 8a7bbe9 commit 94fbe75
Show file tree
Hide file tree
Showing 44 changed files with 1,034 additions and 398 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ jobs:
gh release create v$VERSION --generate-notes --notes-start-tag ${{ env.PREVIOUS_RELEASE_VERSION }} 'linux/build/CLI/Drifty-CLI_linux#Drifty-CLI_linux' 'linux/build/GUI/Drifty-GUI_linux#Drifty-GUI_linux' 'macos/build/CLI/Drifty-CLI_macos#Drifty-CLI_macos' 'macos/build/GUI/Drifty-GUI.pkg#Drifty-GUI.pkg' 'windows/build/CLI/Drifty-CLI.exe#Drifty-CLI.exe' 'windows/build/GUI/Drifty-GUI.msi#Drifty-GUI.msi' 'windows/build/GUI/Drifty-GUI.exe#Drifty-GUI.exe' --title "Drifty v$VERSION Stable Release"
echo "[Released :white_check_mark: Drifty v$VERSION Stable](https://github.com/SaptarshiSarkar12/Drifty/releases/tag/v$VERSION) successfully :rocket:!" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/dev-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
docker compose build runner
docker compose build ${{ matrix.image_name_suffix }}
- name: Run Trivy security scan
uses: aquasecurity/trivy-action@0.19.0
uses: aquasecurity/trivy-action@0.24.0
continue-on-error: true
with:
image-ref: drifty-${{ matrix.image_name_suffix }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ jobs:
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.3.0
uses: docker/setup-buildx-action@v3.5.0

# Login to GitHub Container Registry
# https://github.com/docker/login-action
- name: Log into registry
uses: docker/login-action@v3.1.0
uses: docker/login-action@v3.3.0
if: github.event_name != 'pull_request_target'
with:
registry: ${{ env.REGISTRY }}
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v6.5.0
with:
context: build/${{ matrix.docker_context }}
push: ${{ github.event_name != 'pull_request_target' && github.repository == 'SaptarshiSarkar12/Drifty' && !contains(github.ref_name, 'dependabot') }}
Expand All @@ -182,7 +182,7 @@ jobs:
run: docker build -t ${{ matrix.image_name }} -f Docker/prod/${{ matrix.docker_context }}/Dockerfile build/${{ matrix.docker_context }}

- name: Run Trivy security scan
uses: aquasecurity/trivy-action@0.19.0
uses: aquasecurity/trivy-action@0.24.0
continue-on-error: true
with:
image-ref: ${{ matrix.image_name }}
Expand Down
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions CLI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.1</version>
<version>0.10.2</version>
<extensions>true</extensions>
<configuration>
<imageName>Drifty CLI</imageName>
Expand Down Expand Up @@ -85,7 +85,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.1</version>
<version>0.10.2</version>
<extensions>true</extensions>
<configuration>
<imageName>Drifty CLI</imageName>
Expand Down Expand Up @@ -125,7 +125,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.1</version>
<version>0.10.2</version>
<extensions>true</extensions>
<configuration>
<imageName>Drifty CLI</imageName>
Expand Down
2 changes: 1 addition & 1 deletion Core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
4 changes: 2 additions & 2 deletions Docker/macOS Docker Build Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ After the Docker image of Drifty GUI has been built/pulled, we need to provide a
> Why static IP address is preferred for running Drifty GUI in Docker on macOS?
> </summary>
> Now that the image is built/pulled, we need to talk about how the GUI itself is going to be shown on your desktop. The only real relevant issue here pertains to your local IP address assigned to your network interface card on your Mac. You see, in a Linux environment (which macOS is modeled after), programs that run in the Terminal do not have direct access to your graphical environment (Graphical User Interface), so we are going to have to provide the Docker instance with a pathway to access the GUI and that has to be done by telling it what your local IP address is.
>
>
> On most home networks, the typical setup is to have a router where your computer is connected to the LAN (Local Area network) side of the router either via Wi-Fi or an Ethernet cable. And most people just make that connection, find that they can access the Internet and don't look back.
>
> We, however, need to look back...
Expand Down Expand Up @@ -107,4 +107,4 @@ We have finally set up everything required to run the Docker image of **Drifty G
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"&
open -a Xquartz
docker compose run -e DISPLAY=192.168.1.10:0 gui
```
```
2 changes: 1 addition & 1 deletion GUI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.22</version>
<version>1.0.23</version>
<configuration>
<enableSWRendering>true</enableSWRendering>
<mainClass>${gui.main-class}</mainClass>
Expand Down
4 changes: 4 additions & 0 deletions GUI/src/main/java/gui/preferences/Clear.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public void mainAutoPaste() {
preferences.remove(MAIN_AUTO_PASTE.toString());
}

public void mainTheme() {
preferences.remove(MAIN_THEME.toString());
}

public void jobs() {
preferences.remove(JOBS.toString());
}
Expand Down
5 changes: 5 additions & 0 deletions GUI/src/main/java/gui/preferences/Get.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static Get getInstance() {
return INSTANCE;
}


public Folders folders() {
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = FxGson.addFxSupport(gsonBuilder).setPrettyPrinting().create();
Expand All @@ -41,6 +42,10 @@ public boolean mainAutoPaste() {
return preferences.getBoolean(MAIN_AUTO_PASTE.toString(), false);
}

public String mainTheme() {
return preferences.get(MAIN_THEME.toString(), "Light");
}

public Jobs jobs() {
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = FxGson.addFxSupport(gsonBuilder).setPrettyPrinting().create();
Expand Down
2 changes: 1 addition & 1 deletion GUI/src/main/java/gui/preferences/Labels.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package gui.preferences;

public enum Labels implements preferences.Labels {
FOLDERS, MAIN_AUTO_PASTE, JOBS, ALWAYS_AUTO_PASTE
FOLDERS, MAIN_AUTO_PASTE, JOBS, ALWAYS_AUTO_PASTE, MAIN_THEME
}
8 changes: 6 additions & 2 deletions GUI/src/main/java/gui/preferences/Set.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import java.nio.file.Paths;
import java.util.prefs.Preferences;

import static gui.preferences.Labels.FOLDERS;
import static gui.preferences.Labels.MAIN_AUTO_PASTE;
import static gui.preferences.Labels.*;
import static properties.Program.JOB_FILE;

public final class Set extends preferences.Set {
Expand All @@ -42,6 +41,11 @@ public void mainAutoPaste(boolean isMainAutoPasteEnabled) {
preferences.putBoolean(MAIN_AUTO_PASTE.toString(), isMainAutoPasteEnabled);
}

public void mainTheme(String theme) {
AppSettings.CLEAR.mainTheme();
preferences.put(MAIN_THEME.toString(), theme);
}

public void jobs(Jobs jobs) {
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = FxGson.addFxSupport(gsonBuilder).setPrettyPrinting().create();
Expand Down
52 changes: 37 additions & 15 deletions GUI/src/main/java/gui/support/Constants.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package gui.support;

import gui.init.Environment;
import gui.preferences.AppSettings;
import gui.utils.UIComponentBuilder;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
Expand All @@ -13,6 +15,17 @@
import java.util.Objects;

public class Constants extends support.Constants {
public static final UIComponentBuilder UI_COMPONENT_BUILDER_INSTANCE = UIComponentBuilder.getInstance();
public static final String BUTTON_RELEASED =
"-fx-text-fill: white;" +
"-fx-font-weight: Bold;" +
"-fx-background-color: linear-gradient(rgb(0, 53, 105) 20%, rgb(26, 21, 129) 65%, rgb(0, 0, 65) 100%);" +
"-fx-border-color: white;";
public static final String BUTTON_PRESSED =
"-fx-text-fill: white;" +
"-fx-font-weight: Bold;" +
" -fx-background-color: linear-gradient(rgb(11, 118, 220) 20%, rgb(33, 31, 131) 65%, rgb(2, 2, 168) 100%);\n" +
"-fx-border-color: white;";
public static final String GUI_APPLICATION_TERMINATED = "Drifty GUI (Graphical User Interface) Application Terminated!";
public static final String TRYING_TO_DOWNLOAD_F = "Trying to download \"%s\" ...";
public static final String WRITE_ACCESS_DENIED_F = "Write Access To \"%s\" DENIED!";
Expand All @@ -22,20 +35,25 @@ public class Constants extends support.Constants {
public static final double SCREEN_HEIGHT = SCREEN_SIZE.getHeight();

// Graphics Files
public static final URL DRIFTY_MAIN_PNG = Constants.class.getResource("/Backgrounds/DriftyMain.png");
public static final URL SAVE_UP_PNG = Constants.class.getResource("/Buttons/Save/SaveUp.png");
public static final URL SAVE_DOWN_PNG = Constants.class.getResource("/Buttons/Save/SaveDown.png");
public static final URL START_UP_PNG = Constants.class.getResource("/Buttons/Start/StartUp.png");
public static final URL START_DOWN_PNG = Constants.class.getResource("/Buttons/Start/StartDown.png");
public static final URL DRIFTY_MAIN_PNG = "Dark".equals(AppSettings.GET.mainTheme()) ? Constants.class.getResource("/Backgrounds/DriftyMainDark.png") : Constants.class.getResource("/Backgrounds/DriftyMainLight.png");
public static final URL SAVE_UP_LIGHT_PNG = Constants.class.getResource("/Buttons/Save/SaveUpLight.png");
public static final URL SAVE_UP_DARK_PNG = Constants.class.getResource("/Buttons/Save/SaveUpDark.png");
public static final URL SAVE_DOWN_LIGHT_PNG = Constants.class.getResource("/Buttons/Save/SaveDownLight.png");
public static final URL SAVE_DOWN_DARK_PNG = Constants.class.getResource("/Buttons/Save/SaveDownDark.png");
public static final URL START_UP_LIGHT_PNG = Constants.class.getResource("/Buttons/Start/StartUpLight.png");
public static final URL START_UP_DARK_PNG = Constants.class.getResource("/Buttons/Start/StartUpDark.png");
public static final URL START_DOWN_LIGHT_PNG = Constants.class.getResource("/Buttons/Start/StartDownLight.png");
public static final URL START_DOWN_DARK_PNG = Constants.class.getResource("/Buttons/Start/StartDownDark.png");
public static final URL LINK_PNG = Constants.class.getResource("/Labels/Link.png");
public static final URL AUTO_PASTE_PNG = Constants.class.getResource("/Labels/AutoPaste.png");
public static final URL DIRECTORY_PNG = Constants.class.getResource("/Labels/Directory.png");
public static final URL FILENAME_PNG = Constants.class.getResource("/Labels/Filename.png");
public static final URL DRIFTY_ICON = Constants.class.getResource("/Icons/AppIcon.png");
public static final URL SPLASH = Constants.class.getResource("/Splash.png");
public static final URL SPLASH = "Dark".equals(AppSettings.GET.mainTheme()) ? Constants.class.getResource("/SplashDark.png") : Constants.class.getResource("/SplashLight.png");

// Stylesheets
public static final URL SCENE_CSS = Constants.class.getResource("/CSS/Scene.css");
public static final URL LIGHT_THEME_CSS = Constants.class.getResource("/CSS/LightTheme.css");
public static final URL DARK_THEME_CSS = Constants.class.getResource("/CSS/DarkTheme.css");
public static final URL LIST_VIEW_CSS = Constants.class.getResource("/CSS/ListView.css");
public static final URL TEXT_FIELD_CSS = Constants.class.getResource("/CSS/TextField.css");
public static final URL CONTEXT_MENU_CSS = Constants.class.getResource("/CSS/ContextMenu.css");
Expand All @@ -51,18 +69,22 @@ public class Constants extends support.Constants {
public static final URL MONACO_TTF = Constants.class.getResource("/Fonts/Monaco.ttf");

// JavaFX Image Objects
public static final Image IMG_MAIN_GUI_BANNER = new Image(Objects.requireNonNull(DRIFTY_MAIN_PNG).toExternalForm());
public static final Image IMG_SPLASH = new Image(Objects.requireNonNull(SPLASH).toExternalForm());
public static Image imgMainGuiBanner = new Image(Objects.requireNonNull(DRIFTY_MAIN_PNG).toExternalForm());
public static Image imgSplash = new Image(Objects.requireNonNull(SPLASH).toExternalForm());
public static final Image IMG_LINK_LABEL = new Image(Objects.requireNonNull(LINK_PNG).toExternalForm());
public static final Image IMG_DIR_LABEL = new Image(Objects.requireNonNull(DIRECTORY_PNG).toExternalForm());
public static final Image IMG_FILENAME_LABEL = new Image(Objects.requireNonNull(FILENAME_PNG).toExternalForm());
public static final Image IMG_AUTO_PASTE_LABEL = new Image(Objects.requireNonNull(AUTO_PASTE_PNG).toExternalForm());
public static final Image IMG_START_UP = new Image(Objects.requireNonNull(START_UP_PNG).toExternalForm());
public static final Image IMG_START_DOWN = new Image(Objects.requireNonNull(START_DOWN_PNG).toExternalForm());
public static final Image IMG_SAVE_UP = new Image(Objects.requireNonNull(SAVE_UP_PNG).toExternalForm());
public static final Image IMG_SAVE_DOWN = new Image(Objects.requireNonNull(SAVE_DOWN_PNG).toExternalForm());
public static final Image IMG_START_UP_LIGHT = new Image(Objects.requireNonNull(START_UP_LIGHT_PNG).toExternalForm());
public static final Image IMG_START_UP_DARK = new Image(Objects.requireNonNull(START_UP_DARK_PNG).toExternalForm());
public static final Image IMG_START_DOWN_LIGHT = new Image(Objects.requireNonNull(START_DOWN_LIGHT_PNG).toExternalForm());
public static final Image IMG_START_DOWN_DARK = new Image(Objects.requireNonNull(START_DOWN_DARK_PNG).toExternalForm());
public static final Image IMG_SAVE_UP_LIGHT = new Image(Objects.requireNonNull(SAVE_UP_LIGHT_PNG).toExternalForm());
public static final Image IMG_SAVE_UP_DARK = new Image(Objects.requireNonNull(SAVE_UP_DARK_PNG).toExternalForm());
public static final Image IMG_SAVE_DOWN_LIGHT = new Image(Objects.requireNonNull(SAVE_DOWN_LIGHT_PNG).toExternalForm());
public static final Image IMG_SAVE_DOWN_DARK = new Image(Objects.requireNonNull(SAVE_DOWN_DARK_PNG).toExternalForm());

// Methods for obtaining consistent Stages and Scenes
// Methods for getting consistent Stages and Scenes
public static Stage getStage(String title, boolean isPrimaryStage) {
Stage stage = new Stage();
Image icon = new Image(Objects.requireNonNull(DRIFTY_ICON).toExternalForm());
Expand All @@ -82,7 +104,7 @@ public static Stage getStage(String title, boolean isPrimaryStage) {

public static Scene getScene(Parent root) {
Scene scene = new Scene(root);
addCSS(scene, CHECK_BOX_CSS, CONTEXT_MENU_CSS, LABEL_CSS, LIST_VIEW_CSS, MENU_CSS, PROGRESS_BAR_CSS, SCENE_CSS, SCROLL_PANE_CSS, TEXT_FIELD_CSS, V_BOX_CSS, BUTTON_CSS);
addCSS(scene, CHECK_BOX_CSS, CONTEXT_MENU_CSS, LABEL_CSS, LIST_VIEW_CSS, MENU_CSS, LIGHT_THEME_CSS, PROGRESS_BAR_CSS, SCROLL_PANE_CSS, TEXT_FIELD_CSS, V_BOX_CSS, BUTTON_CSS);
return scene;
}

Expand Down
72 changes: 72 additions & 0 deletions GUI/src/main/java/gui/utils/UIComponentBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package gui.utils;

import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import main.Drifty_GUI;

import java.util.Objects;

import static gui.support.Constants.MONACO_TTF;

public class UIComponentBuilder {
private static UIComponentBuilder instance;

public static UIComponentBuilder getInstance() {
if (instance == null) {
instance = new UIComponentBuilder();
}
return instance;
}

public Label buildLabel() {
Label label = new Label("");
label.setFont(new Font(Objects.requireNonNull(MONACO_TTF).toExternalForm(), 20 * .75));
label.prefWidth(Double.MAX_VALUE);
label.setAlignment(Pos.CENTER);
return label;
}

public Label buildLabel(String text, Font font, Paint textFill) {
Label label = new Label(text);
label.setAlignment(Pos.TOP_CENTER);
label.setFont(font);
label.setTextFill(textFill);
return label;
}

public HBox buildHBox(Node node) {
HBox hbox = new HBox(node);
hbox.setAlignment(Pos.CENTER);
return hbox;
}

public ImageView buildImageView(Image image, double scale) {
ImageView imageView = new ImageView(image);
imageView.setPreserveRatio(true);
imageView.setFitWidth(image.getWidth() * scale);
return imageView;
}

public TextField buildTextField() {
TextField tf = new TextField("");
tf.setPrefWidth(Double.MAX_VALUE);
return tf;
}

public Hyperlink buildHyperlink(String text, Font font, LinearGradient fill, String url) {
Hyperlink link = new Hyperlink(text);
link.setFont(font);
link.setTextFill(fill);
link.setOnAction(e -> Drifty_GUI.INSTANCE.openWebsite(url));
return link;
}
}
Loading

0 comments on commit 94fbe75

Please sign in to comment.