From bf012bf6946c0d14f0f36bff036115d55983ab91 Mon Sep 17 00:00:00 2001 From: Anas Elgarhy Date: Fri, 19 Aug 2022 18:02:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=B0=F0=9F=92=99=F0=9F=98=86=20Compleat?= =?UTF-8?q?e=20the=20settings=20system=20yoooo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/AyahSettingsConfigurable.java | 8 +++++-- .../ayah/settings/SettingsComponent.java | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/anas/intellij/plugins/ayah/settings/AyahSettingsConfigurable.java b/src/main/java/com/anas/intellij/plugins/ayah/settings/AyahSettingsConfigurable.java index 89055c9..9e853ce 100644 --- a/src/main/java/com/anas/intellij/plugins/ayah/settings/AyahSettingsConfigurable.java +++ b/src/main/java/com/anas/intellij/plugins/ayah/settings/AyahSettingsConfigurable.java @@ -33,8 +33,12 @@ public class AyahSettingsConfigurable implements Configurable { } @Override - public void apply() throws ConfigurationException { - + public void apply() { + final var settingsState = AyahSettingsState.getInstance(); + settingsState.setBasmalhOnStart(settingsComponent.getBasmalhOnStart()); + settingsState.setIntervalTimeBetweenNotifications(settingsComponent.getIntervalTimeBetweenNotifications()); + settingsState.setAutoPlayAudio(settingsComponent.isAutoPlayAudio()); + settingsState.setPlayerId(settingsComponent.getPlayerId()); } @Override diff --git a/src/main/java/com/anas/intellij/plugins/ayah/settings/SettingsComponent.java b/src/main/java/com/anas/intellij/plugins/ayah/settings/SettingsComponent.java index 40c3a84..e38a1d8 100644 --- a/src/main/java/com/anas/intellij/plugins/ayah/settings/SettingsComponent.java +++ b/src/main/java/com/anas/intellij/plugins/ayah/settings/SettingsComponent.java @@ -10,6 +10,7 @@ import net.miginfocom.swing.MigLayout; import javax.swing.*; import java.io.IOException; +import java.util.Objects; /** * The settings UI. @@ -133,4 +134,24 @@ public class SettingsComponent { public JPanel getPanel() { return panel; } + + public BasmalhOnStart getBasmalhOnStart() { + final var b = new BasmalhOnStart(); + b.setActive(basmalhOnStartCheckBox.isSelected()); + b.setSoundActive(autoPlayBasmalhCheckBox.isSelected()); + b.setPlayerId(Objects.requireNonNull(basmalhPlayerIdComboBox.getSelectedItem()).toString()); + return b; + } + + public int getIntervalTimeBetweenNotifications() { + return notificationsIntervalSpinnerModel.getNumber().intValue(); + } + + public boolean isAutoPlayAudio() { + return notificationsAudioCheckBox.isSelected(); + } + + public String getPlayerId() { + return Objects.requireNonNull(ayahPlayerIdComboBox.getSelectedItem()).toString(); + } }