🥰💙😆 Compleate the settings system yoooo

This commit is contained in:
Anas Elgarhy 2022-08-19 18:02:19 +02:00
parent c1b4af4cb5
commit bf012bf694
2 changed files with 27 additions and 2 deletions

View file

@ -33,8 +33,12 @@ public class AyahSettingsConfigurable implements Configurable {
} }
@Override @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 @Override

View file

@ -10,6 +10,7 @@ import net.miginfocom.swing.MigLayout;
import javax.swing.*; import javax.swing.*;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
/** /**
* The settings UI. * The settings UI.
@ -133,4 +134,24 @@ public class SettingsComponent {
public JPanel getPanel() { public JPanel getPanel() {
return panel; 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();
}
} }