mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-04-29 12:11:26 +00:00
1.0.2 - Visual improvements, code refactoring
This commit is contained in:
parent
1ef33b85e8
commit
c0f340ecad
32 changed files with 100 additions and 486 deletions
|
|
@ -0,0 +1,52 @@
|
|||
package ee.carlrobert.chatgpt.settings;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import javax.swing.JComponent;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SettingsConfigurable implements Configurable {
|
||||
|
||||
private SettingsComponent settingsComponent;
|
||||
|
||||
@Nls(capitalization = Nls.Capitalization.Title)
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "ChatGPT: Settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return settingsComponent.getPreferredFocusedComponent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
settingsComponent = new SettingsComponent();
|
||||
return settingsComponent.getPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
SettingsState settings = SettingsState.getInstance();
|
||||
return !settingsComponent.getApiKeyField().equals(settings.secretKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
SettingsState settings = SettingsState.getInstance();
|
||||
settings.secretKey = settingsComponent.getApiKeyField();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
SettingsState settings = SettingsState.getInstance();
|
||||
settingsComponent.setApiKeyField(settings.secretKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
settingsComponent = null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue