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(); + } }