Skip to content

Commit

Permalink
chore: add donate dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
DropSnorz committed Aug 26, 2024
1 parent bc91f0f commit 24092e6
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class LazyViewRegistry {
public static final String CRASH_RECOVERY_VIEW = "CRASH_RECOVERY_VIEW";
public static final String LIST_DIRECTORY_VIEW = "LIST_DIRECTORY_VIEW";
public static final String EXPORT_VIEW = "EXPORT_VIEW";
public static final String DONATE_VIEW = "DONATE_VIEW";


@Autowired
Expand All @@ -66,7 +67,7 @@ public void preload() {
preloadFxml(CRASH_RECOVERY_VIEW, "/fxml/dialogs/CrashRecoveryView.fxml");
preloadFxml(LIST_DIRECTORY_VIEW, "/fxml/dialogs/ListDirectoryView.fxml");
preloadFxml(EXPORT_VIEW, "/fxml/dialogs/ExportView.fxml");

preloadFxml(DONATE_VIEW, "/fxml/dialogs/DonateView.fxml");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.owlplug.controls.Dialog;
import com.owlplug.controls.DialogLayout;
import com.owlplug.core.components.ApplicationDefaults;
import com.owlplug.core.controllers.dialogs.DonateDialogController;
import com.owlplug.core.controllers.dialogs.ListDirectoryDialogController;
import com.owlplug.core.controllers.fragments.PluginPathFragmentController;
import com.owlplug.core.model.platform.OperatingSystem;
Expand Down Expand Up @@ -50,11 +51,12 @@ public class OptionsController extends BaseController {
private NativeHostService nativeHostService;
@Autowired
private ListDirectoryDialogController listDirectoryDialogController;
@Autowired
private DonateDialogController donateDialogController;
@FXML
private CheckBox pluginNativeCheckbox;
@FXML
private ComboBox<NativePluginLoader> pluginNativeComboBox;

@FXML
private CheckBox syncPluginsCheckBox;
@FXML
Expand Down Expand Up @@ -82,6 +84,8 @@ public class OptionsController extends BaseController {
private Hyperlink owlplugWebsiteLink;
@FXML
private VBox pluginPathContainer;
@FXML
private Button moreFeaturesButton;

private PluginPathFragmentController vst2PluginPathFragment;
private PluginPathFragmentController vst3PluginPathFragment;
Expand Down Expand Up @@ -213,6 +217,10 @@ public void initialize() {
PlatformUtils.openDefaultBrowser(owlplugWebsiteLink.getText());
});

moreFeaturesButton.setOnAction(e -> {
donateDialogController.show();
});

refreshView();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/* OwlPlug
* Copyright (C) 2021 Arthur <dropsnorz@gmail.com>
*
* This file is part of OwlPlug.
*
* OwlPlug is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* as published by the Free Software Foundation.
*
* OwlPlug is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OwlPlug. If not, see <https://www.gnu.org/licenses/>.
*/

package com.owlplug.core.controllers.dialogs;


import com.owlplug.core.components.LazyViewRegistry;
import com.owlplug.core.utils.PlatformUtils;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class DonateDialogController extends AbstractDialogController {

@Autowired
private LazyViewRegistry lazyViewRegistry;
@FXML
private Button donateButton;
@FXML
private Button roadmapButton;
@FXML
private Button featureRequestButton;
@FXML
private Button aboutButton;
@FXML
private Button cancelButton;

DonateDialogController() {
super(550, 480);
this.setOverlayClose(false);
}

/**
* FXML initialize.
*/
public void initialize() {

donateButton.setOnAction(e -> {
PlatformUtils.openDefaultBrowser(this.getApplicationDefaults().getEnvProperty("owlplug.donate.url"));
this.close();
this.getDialogManager()
.newSimpleInfoDialog("Thank you !", "Thank you so much for contributing to OwlPlug development.\nYour donation will help me to release new versions, stay tuned !")
.show();
});

roadmapButton.setOnAction(e -> {
PlatformUtils.openDefaultBrowser(this.getApplicationDefaults().getEnvProperty("owlplug.roadmap.url"));
});

featureRequestButton.setOnAction(e -> {
PlatformUtils.openDefaultBrowser(this.getApplicationDefaults().getEnvProperty("owlplug.github.issues.url"));
});

aboutButton.setOnAction(e -> {
PlatformUtils.openDefaultBrowser(this.getApplicationDefaults().getEnvProperty("owlplug.about.url"));
});

cancelButton.setOnAction(e -> {
this.close();
});

}

@Override
protected Node getBody() {
return lazyViewRegistry.get(LazyViewRegistry.DONATE_VIEW);
}

@Override
protected Node getHeading() {
Label title = new Label("Owlplug is free !");
title.getStyleClass().add("heading-3");
return title;
}

}
4 changes: 4 additions & 0 deletions owlplug-client/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ owlplugcentral.url=https://central.owlplug.com

owlplug.hub.url = http://hub.owlplug.com
owlplug.hub.updateDownloadUrl = https://github.com/DropSnorz/OwlPlug/releases
owlplug.github.issues.url = https://github.com/DropSnorz/OwlPlug/issues
owlplug.roadmap.url = https://owlplug.com/roadmap
owlplug.about.url = https://owlplug.com/about
owlplug.donate.url = https://www.paypal.com/donate?hosted_button_id=7MJGDTQXAPJ22

owlplug.registry.url = https://registry.owlplug.com/registry.min.json
studiorack.registry.url = https://owlplug.github.io/owlplug-studiorack-registry/registry.min.json
Expand Down
18 changes: 14 additions & 4 deletions owlplug-client/src/main/resources/fxml/OptionsView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>

<AnchorPane xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.owlplug.core.controllers.OptionsController">
<AnchorPane xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.owlplug.core.controllers.OptionsController">
<children>
<HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="20.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
Expand Down Expand Up @@ -100,8 +101,10 @@
<Label styleClass="heading-2" text="Danger Zone" />
<VBox spacing="5.0">
<children>
<Label text="Remove all stored user data including settings, remote sources and accounts. Plugins and projects files will not be deleted." wrapText="true" />
<Button fx:id="removeDataButton" minHeight="-Infinity" minWidth="-Infinity" text="Clear user data" />
<Label text="Permanently delete all stored user data including settings, remote sources and accounts. Plugins and projects files will not be deleted." wrapText="true" />
<Button fx:id="removeDataButton" minHeight="-Infinity" minWidth="-Infinity" text="Remove user data" />
<Label text="Remove the data cached by OwlPlug (screenshots, remote metadata, ...)" wrapText="true" />
<Button fx:id="clearCacheButton" minHeight="-Infinity" minWidth="-Infinity" text="Clear cache" />
</children>
</VBox>
</children>
Expand All @@ -127,7 +130,14 @@
</TextFlow>
<HBox alignment="BASELINE_RIGHT" HBox.hgrow="ALWAYS">
<children>
<Button fx:id="clearCacheButton" text="Clear cache" />
<Button fx:id="moreFeaturesButton" text="Get more features ...">
<graphic>
<ImageView fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/rocket-white-64.png" />
</image>
</ImageView>
</graphic></Button>
</children>
</HBox>
</children>
Expand Down
40 changes: 40 additions & 0 deletions owlplug-client/src/main/resources/fxml/dialogs/DonateView.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.*?>

<VBox prefWidth="500.0" spacing="10.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.owlplug.core.controllers.dialogs.DonateDialogController">
<children>
<VBox spacing="20.0">
<children>
<Label text="The OwlPlug app is completely free to use, offering all its features without any cost." wrapText="true" fx:id=""></Label>
<Label text="However, to keep improving and developing the app, I rely on the support of users. If you enjoy using the app and would like to help me add new features and make it better, please consider donating. Your financial contribution will directly support ongoing development and ensure that I can keep the app available for everyone." wrapText="true" />
<HBox alignment="CENTER" spacing="10.0" VBox.vgrow="NEVER">
<children>
<Button fx:id="roadmapButton" contentDisplay="TOP" prefHeight="78.0" prefWidth="115.0" text="Roadmap">
<graphic>
<SVGPath content="M19.957 4.035c-.345-.024-.682-.035-1.012-.035-7.167 0-11.248 5.464-12.732 9.861l3.939 3.938c4.524-1.619 9.848-5.549 9.848-12.639 0-.367-.014-.741-.043-1.125zm-9.398 11.815l-2.402-2.402c1.018-2.383 3.91-7.455 10.166-7.767-.21 4.812-3.368 8.276-7.764 10.169zm4.559 1.282c-.456.311-.908.592-1.356.842-.156.742-.552 1.535-1.126 2.21-.001-.48-.135-.964-.369-1.449-.413.187-.805.348-1.179.49.551 1.424-.01 2.476-.763 3.462 1.08-.081 2.214-.61 3.106-1.504.965-.962 1.64-2.352 1.687-4.051zm-9.849-5.392c-.482-.232-.965-.364-1.443-.367.669-.567 1.453-.961 2.188-1.121.262-.461.556-.915.865-1.361-1.699.046-3.09.723-4.054 1.686-.893.893-1.421 2.027-1.503 3.106.986-.753 2.039-1.313 3.463-.762.145-.391.305-.785.484-1.181zm6.448.553c-.326-.325-.326-.853 0-1.178.325-.326.853-.326 1.178 0 .326.326.326.854 0 1.179-.326.325-.853.325-1.178-.001zm4.124-4.125c-.65-.65-1.706-.65-2.356 0-.651.651-.651 1.707 0 2.357.65.651 1.706.651 2.357 0 .65-.65.65-1.706-.001-2.357zm-1.591 1.592c-.228-.228-.228-.598 0-.825.227-.228.598-.228.826 0 .227.227.226.597 0 .825-.228.227-.598.227-.826 0zm-12.609 10.555l-.755-.755 4.341-4.323.755.755-4.341 4.323zm4.148 1.547l-.755-.755 3.03-3.054.756.755-3.031 3.054zm-5.034 2.138l-.755-.755 5.373-5.364.756.755-5.374 5.364zm21.083-14.291c-.188.618-.673 1.102-1.291 1.291.618.188 1.103.672 1.291 1.291.189-.619.673-1.103 1.291-1.291-.618-.188-1.102-.672-1.291-1.291zm-14.655-6.504c-.247.81-.881 1.443-1.69 1.69.81.247 1.443.881 1.69 1.69.248-.809.881-1.443 1.69-1.69-.81-.247-1.442-.88-1.69-1.69zm-1.827-3.205c-.199.649-.706 1.157-1.356 1.355.65.199 1.157.707 1.356 1.355.198-.649.706-1.157 1.354-1.355-.648-.198-1.155-.706-1.354-1.355zm5.387 0c-.316 1.035-1.127 1.846-2.163 2.163 1.036.316 1.847 1.126 2.163 2.163.316-1.036 1.127-1.846 2.162-2.163-1.035-.317-1.845-1.128-2.162-2.163zm11.095 13.64c-.316 1.036-1.127 1.846-2.163 2.163 1.036.316 1.847 1.162 2.163 2.197.316-1.036 1.127-1.881 2.162-2.197-1.035-.317-1.846-1.127-2.162-2.163z" fill="WHITE" />
</graphic></Button>
<Button fx:id="featureRequestButton" contentDisplay="TOP" prefHeight="78.0" prefWidth="115.0" text="Feature requests">
<graphic>
<SVGPath content="M24 20h-3v4l-5.333-4h-7.667v-4h2v2h6.333l2.667 2v-2h3v-8.001h-2v-2h4v12.001zm-6-6h-9.667l-5.333 4v-4h-3v-14.001h18v14.001zm-9-4.084h-5v1.084h5v-1.084zm5-2.916h-10v1h10v-1zm0-3h-10v1h10v-1z" fill="WHITE" />
</graphic></Button>
<Button fx:id="aboutButton" contentDisplay="TOP" prefHeight="78.0" prefWidth="115.0" text="About OwlPlug">
<graphic>
<SVGPath content="M7 16h13v1h-13v-1zm13-3h-13v1h13v-1zm0-6h-5v1h5v-1zm0 3h-5v1h5v-1zm-17-8v17.199c0 .771-1 .771-1 0v-15.199h-2v15.98c0 1.115.905 2.02 2.02 2.02h19.958c1.117 0 2.022-.904 2.022-2.02v-17.98h-21zm19 17h-17v-15h17v15zm-9-12h-6v4h6v-4z" fill="WHITE" />
</graphic></Button>

</children>
</HBox>
<Label text="If you like OwlPlug or want to see new features implemented, you can help me by clicking on the Contribute button. It will redirect you to the donation page." wrapText="true" />
</children>
</VBox>
<HBox alignment="TOP_RIGHT" spacing="10.0" VBox.vgrow="NEVER">
<children>
<Button fx:id="donateButton" text="Contribute to OwlPlug" />
<Button fx:id="cancelButton" text="No, leave" />
</children>
</HBox>
</children>
</VBox>

0 comments on commit 24092e6

Please sign in to comment.