Changed config keys to static constants
This commit is contained in:
parent
7949e1ac3d
commit
c4637d83d7
4 changed files with 72 additions and 67 deletions
|
|
@ -67,12 +67,12 @@ public class FTLModManager {
|
||||||
|
|
||||||
boolean writeConfig = false;
|
boolean writeConfig = false;
|
||||||
Properties config = new Properties();
|
Properties config = new Properties();
|
||||||
config.setProperty( "allow_zip", "false" );
|
config.setProperty( SlipstreamConfig.ALLOW_ZIP, "false" );
|
||||||
config.setProperty( "ftl_dats_path", "" );
|
config.setProperty( SlipstreamConfig.FTL_DATS_PATH, "" );
|
||||||
config.setProperty( "run_steam_ftl", "false" );
|
config.setProperty( SlipstreamConfig.RUN_STEAM_FTL, "false" );
|
||||||
config.setProperty( "never_run_ftl", "false" );
|
config.setProperty( SlipstreamConfig.NEVER_RUN_FTL, "false" );
|
||||||
config.setProperty( "use_default_ui", "false" );
|
config.setProperty( SlipstreamConfig.USE_DEFAULT_UI, "false" );
|
||||||
config.setProperty( "remember_geometry", "true" );
|
config.setProperty( SlipstreamConfig.REMEMBER_GEOMETRY, "true" );
|
||||||
// "update_catalog" doesn't have a default.
|
// "update_catalog" doesn't have a default.
|
||||||
// "update_app" doesn't have a default.
|
// "update_app" doesn't have a default.
|
||||||
// "manager_geometry" doesn't have a default.
|
// "manager_geometry" doesn't have a default.
|
||||||
|
|
@ -98,7 +98,7 @@ public class FTLModManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look-and-Feel.
|
// Look-and-Feel.
|
||||||
String useDefaultUI = config.getProperty( "use_default_ui", "false" );
|
String useDefaultUI = config.getProperty( SlipstreamConfig.USE_DEFAULT_UI, "false" );
|
||||||
|
|
||||||
if ( !useDefaultUI.equals("true") ) {
|
if ( !useDefaultUI.equals("true") ) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -107,15 +107,16 @@ public class FTLModManager {
|
||||||
}
|
}
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
log.error( "Error setting system Look and Feel.", e );
|
log.error( "Error setting system Look and Feel.", e );
|
||||||
log.info( "Setting 'useDefaultUI=true' in the config file will prevent this error." );
|
log.info( "Setting '"+ SlipstreamConfig.USE_DEFAULT_UI +"=true' in the config file will prevent this error." );
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
log.debug( "Using default Look and Feel." );
|
log.debug( "Using default Look and Feel." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// FTL Resources Path.
|
// FTL Resources Path.
|
||||||
File datsDir = null;
|
File datsDir = null;
|
||||||
String datsPath = config.getProperty( "ftl_dats_path", "" );
|
String datsPath = config.getProperty( SlipstreamConfig.FTL_DATS_PATH, "" );
|
||||||
|
|
||||||
if ( datsPath.length() > 0 ) {
|
if ( datsPath.length() > 0 ) {
|
||||||
log.info( "Using FTL dats path from config: "+ datsPath );
|
log.info( "Using FTL dats path from config: "+ datsPath );
|
||||||
|
|
@ -142,7 +143,7 @@ public class FTLModManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( datsDir != null ) {
|
if ( datsDir != null ) {
|
||||||
config.setProperty( "ftl_dats_path", datsDir.getAbsolutePath() );
|
config.setProperty( SlipstreamConfig.FTL_DATS_PATH, datsDir.getAbsolutePath() );
|
||||||
writeConfig = true;
|
writeConfig = true;
|
||||||
log.info( "FTL dats located at: "+ datsDir.getAbsolutePath() );
|
log.info( "FTL dats located at: "+ datsDir.getAbsolutePath() );
|
||||||
}
|
}
|
||||||
|
|
@ -159,8 +160,8 @@ public class FTLModManager {
|
||||||
|
|
||||||
// Prompt if update_catalog is invalid or hasn't been set.
|
// Prompt if update_catalog is invalid or hasn't been set.
|
||||||
boolean askAboutUpdates = false;
|
boolean askAboutUpdates = false;
|
||||||
String catalogUpdateInterval = config.getProperty( "update_catalog" );
|
String catalogUpdateInterval = config.getProperty( SlipstreamConfig.UPDATE_CATALOG );
|
||||||
String appUpdateInterval = config.getProperty( "update_app" );
|
String appUpdateInterval = config.getProperty( SlipstreamConfig.UPDATE_APP );
|
||||||
|
|
||||||
if ( catalogUpdateInterval == null || !catalogUpdateInterval.matches( "^\\d+$" ) )
|
if ( catalogUpdateInterval == null || !catalogUpdateInterval.matches( "^\\d+$" ) )
|
||||||
askAboutUpdates = true;
|
askAboutUpdates = true;
|
||||||
|
|
@ -176,11 +177,12 @@ public class FTLModManager {
|
||||||
|
|
||||||
int response = JOptionPane.showConfirmDialog( null, message, "Updates", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
int response = JOptionPane.showConfirmDialog( null, message, "Updates", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
||||||
if ( response == JOptionPane.YES_OPTION ) {
|
if ( response == JOptionPane.YES_OPTION ) {
|
||||||
config.setProperty( "update_catalog", "7" );
|
config.setProperty( SlipstreamConfig.UPDATE_CATALOG, "7" );
|
||||||
config.setProperty( "update_app", "4" );
|
config.setProperty( SlipstreamConfig.UPDATE_APP, "4" );
|
||||||
} else {
|
}
|
||||||
config.setProperty( "update_catalog", "0" );
|
else {
|
||||||
config.setProperty( "update_app", "0" );
|
config.setProperty( SlipstreamConfig.UPDATE_CATALOG, "0" );
|
||||||
|
config.setProperty( SlipstreamConfig.UPDATE_APP, "0" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import net.vhati.modmanager.core.ModUtilities;
|
||||||
import net.vhati.modmanager.core.Report;
|
import net.vhati.modmanager.core.Report;
|
||||||
import net.vhati.modmanager.core.Report.ReportFormatter;
|
import net.vhati.modmanager.core.Report.ReportFormatter;
|
||||||
import net.vhati.modmanager.core.Report.ReportMessage;
|
import net.vhati.modmanager.core.Report.ReportMessage;
|
||||||
|
import net.vhati.modmanager.core.SlipstreamConfig;
|
||||||
|
|
||||||
import org.apache.commons.cli.BasicParser;
|
import org.apache.commons.cli.BasicParser;
|
||||||
import org.apache.commons.cli.OptionBuilder;
|
import org.apache.commons.cli.OptionBuilder;
|
||||||
|
|
@ -170,7 +171,7 @@ public class SlipstreamCLI {
|
||||||
if ( cmdline.hasOption( "list-mods" ) ) { // Exits.
|
if ( cmdline.hasOption( "list-mods" ) ) { // Exits.
|
||||||
log.info( "Listing mods..." );
|
log.info( "Listing mods..." );
|
||||||
|
|
||||||
boolean allowZip = config.getProperty( "allow_zip", "false" ).equals( "true" );
|
boolean allowZip = config.getProperty( SlipstreamConfig.ALLOW_ZIP, "false" ).equals( "true" );
|
||||||
File[] modFiles = modsDir.listFiles( new ModAndDirFileFilter( allowZip, true ) );
|
File[] modFiles = modsDir.listFiles( new ModAndDirFileFilter( allowZip, true ) );
|
||||||
List<String> dirList = new ArrayList<String>();
|
List<String> dirList = new ArrayList<String>();
|
||||||
List<String> fileList = new ArrayList<String>();
|
List<String> fileList = new ArrayList<String>();
|
||||||
|
|
@ -305,7 +306,7 @@ public class SlipstreamCLI {
|
||||||
File exeFile = null;
|
File exeFile = null;
|
||||||
String[] exeArgs = null;
|
String[] exeArgs = null;
|
||||||
|
|
||||||
if ( config.getProperty( "run_steam_ftl", "false" ).equals( "true" ) ) {
|
if ( config.getProperty( SlipstreamConfig.RUN_STEAM_FTL, "false" ).equals( "true" ) ) {
|
||||||
exeFile = FTLUtilities.findSteamExe();
|
exeFile = FTLUtilities.findSteamExe();
|
||||||
exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL};
|
exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL};
|
||||||
|
|
||||||
|
|
@ -351,10 +352,10 @@ public class SlipstreamCLI {
|
||||||
private static Properties getConfig( File configFile ) {
|
private static Properties getConfig( File configFile ) {
|
||||||
|
|
||||||
Properties config = new Properties();
|
Properties config = new Properties();
|
||||||
config.setProperty( "allow_zip", "false" );
|
config.setProperty( SlipstreamConfig.ALLOW_ZIP, "false" );
|
||||||
config.setProperty( "ftl_dats_path", "" );
|
config.setProperty( SlipstreamConfig.FTL_DATS_PATH, "" );
|
||||||
config.setProperty( "never_run_ftl", "false" );
|
config.setProperty( SlipstreamConfig.NEVER_RUN_FTL, "false" );
|
||||||
config.setProperty( "use_default_ui", "false" );
|
config.setProperty( SlipstreamConfig.USE_DEFAULT_UI, "false" );
|
||||||
// "update_catalog" doesn't have a default.
|
// "update_catalog" doesn't have a default.
|
||||||
|
|
||||||
// Read the config file.
|
// Read the config file.
|
||||||
|
|
@ -384,7 +385,7 @@ public class SlipstreamCLI {
|
||||||
*/
|
*/
|
||||||
private static File getDatsDir( Properties config ) {
|
private static File getDatsDir( Properties config ) {
|
||||||
File datsDir = null;
|
File datsDir = null;
|
||||||
String datsPath = config.getProperty( "ftl_dats_path", "" );
|
String datsPath = config.getProperty( SlipstreamConfig.FTL_DATS_PATH, "" );
|
||||||
|
|
||||||
if ( datsPath.length() > 0 ) {
|
if ( datsPath.length() > 0 ) {
|
||||||
log.info( "Using FTL dats path from config: "+ datsPath );
|
log.info( "Using FTL dats path from config: "+ datsPath );
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
|
|
||||||
patchBtn = new JButton( "Patch" );
|
patchBtn = new JButton( "Patch" );
|
||||||
patchBtn.setMargin( actionInsets );
|
patchBtn.setMargin( actionInsets );
|
||||||
patchBtn.addMouseListener( new StatusbarMouseListener( this, "Incorporate all selected mods into the game." ) );
|
patchBtn.addMouseListener( new StatusbarMouseListener( this, "Incorporate all selected mods into the game. Or revert to vanilla, if none are." ) );
|
||||||
patchBtn.addActionListener( this );
|
patchBtn.addActionListener( this );
|
||||||
modActionsPanel.add( patchBtn );
|
modActionsPanel.add( patchBtn );
|
||||||
|
|
||||||
|
|
@ -264,12 +264,12 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
|
|
||||||
SlipstreamConfig appConfig = ManagerFrame.this.appConfig;
|
SlipstreamConfig appConfig = ManagerFrame.this.appConfig;
|
||||||
|
|
||||||
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) ) {
|
if ( appConfig.getProperty( SlipstreamConfig.REMEMBER_GEOMETRY ).equals( "true" ) ) {
|
||||||
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
if ( ManagerFrame.this.getExtendedState() == JFrame.NORMAL ) {
|
||||||
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
Rectangle managerBounds = ManagerFrame.this.getBounds();
|
||||||
int dividerLoc = splitPane.getDividerLocation();
|
int dividerLoc = splitPane.getDividerLocation();
|
||||||
String geometry = String.format( "x,%d;y,%d;w,%d;h,%d;divider,%d", managerBounds.x, managerBounds.y, managerBounds.width, managerBounds.height, dividerLoc );
|
String geometry = String.format( "x,%d;y,%d;w,%d;h,%d;divider,%d", managerBounds.x, managerBounds.y, managerBounds.width, managerBounds.height, dividerLoc );
|
||||||
appConfig.setProperty( "manager_geometry", geometry );
|
appConfig.setProperty( SlipstreamConfig.MANAGER_GEOMETRY, geometry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,14 +347,14 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
this.setMinimumSize( new Dimension( 300, modActionsPanel.getPreferredSize().height+90 ) );
|
this.setMinimumSize( new Dimension( 300, modActionsPanel.getPreferredSize().height+90 ) );
|
||||||
this.setLocationRelativeTo( null );
|
this.setLocationRelativeTo( null );
|
||||||
|
|
||||||
if ( appConfig.getProperty( "remember_geometry" ).equals( "true" ) )
|
if ( appConfig.getProperty( SlipstreamConfig.REMEMBER_GEOMETRY ).equals( "true" ) )
|
||||||
setGeometryFromConfig();
|
setGeometryFromConfig();
|
||||||
|
|
||||||
showAboutInfo();
|
showAboutInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGeometryFromConfig() {
|
private void setGeometryFromConfig() {
|
||||||
String geometry = appConfig.getProperty( "manager_geometry" );
|
String geometry = appConfig.getProperty( SlipstreamConfig.MANAGER_GEOMETRY );
|
||||||
if ( geometry != null ) {
|
if ( geometry != null ) {
|
||||||
int[] xywh = new int[4];
|
int[] xywh = new int[4];
|
||||||
int dividerLoc = -1;
|
int dividerLoc = -1;
|
||||||
|
|
@ -490,7 +490,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
modFileHashes.clear();
|
modFileHashes.clear();
|
||||||
modsTablePanel.clear();
|
modsTablePanel.clear();
|
||||||
|
|
||||||
boolean allowZip = appConfig.getProperty( "allow_zip", "false" ).equals( "true" );
|
boolean allowZip = appConfig.getProperty( SlipstreamConfig.ALLOW_ZIP, "false" ).equals( "true" );
|
||||||
File[] modFiles = modsDir.listFiles( new ModFileFilter( allowZip ) );
|
File[] modFiles = modsDir.listFiles( new ModFileFilter( allowZip ) );
|
||||||
|
|
||||||
List<ModFileInfo> unsortedMods = new ArrayList<ModFileInfo>();
|
List<ModFileInfo> unsortedMods = new ArrayList<ModFileInfo>();
|
||||||
|
|
@ -663,16 +663,16 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
modFiles.add( modFileInfo.getFile() );
|
modFiles.add( modFileInfo.getFile() );
|
||||||
}
|
}
|
||||||
|
|
||||||
File datsDir = new File( appConfig.getProperty( "ftl_dats_path" ) );
|
File datsDir = new File( appConfig.getProperty( SlipstreamConfig.FTL_DATS_PATH ) );
|
||||||
|
|
||||||
ModPatchDialog patchDlg = new ModPatchDialog( this, true );
|
ModPatchDialog patchDlg = new ModPatchDialog( this, true );
|
||||||
|
|
||||||
String neverRunFtl = appConfig.getProperty( "never_run_ftl", "false" );
|
String neverRunFtl = appConfig.getProperty( SlipstreamConfig.NEVER_RUN_FTL, "false" );
|
||||||
if ( !neverRunFtl.equals( "true" ) ) {
|
if ( !neverRunFtl.equals( "true" ) ) {
|
||||||
File exeFile = null;
|
File exeFile = null;
|
||||||
String[] exeArgs = null;
|
String[] exeArgs = null;
|
||||||
|
|
||||||
if ( appConfig.getProperty( "run_steam_ftl", "false" ).equals( "true" ) ) {
|
if ( appConfig.getProperty( SlipstreamConfig.RUN_STEAM_FTL, "false" ).equals( "true" ) ) {
|
||||||
exeFile = FTLUtilities.findSteamExe();
|
exeFile = FTLUtilities.findSteamExe();
|
||||||
exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL};
|
exeArgs = new String[] {"-applaunch", FTLUtilities.STEAM_APPID_FTL};
|
||||||
|
|
||||||
|
|
@ -680,6 +680,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
log.warn( "Steam executable could not be found; FTL will be launched directly" );
|
log.warn( "Steam executable could not be found; FTL will be launched directly" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Try to run directly.
|
||||||
if ( exeFile == null ) {
|
if ( exeFile == null ) {
|
||||||
exeFile = FTLUtilities.findGameExe( datsDir );
|
exeFile = FTLUtilities.findGameExe( datsDir );
|
||||||
exeArgs = new String[0];
|
exeArgs = new String[0];
|
||||||
|
|
@ -772,7 +773,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
|
|
||||||
File extractDir = extractChooser.getSelectedFile();
|
File extractDir = extractChooser.getSelectedFile();
|
||||||
|
|
||||||
File datsDir = new File( appConfig.getProperty( "ftl_dats_path" ) );
|
File datsDir = new File( appConfig.getProperty( SlipstreamConfig.FTL_DATS_PATH ) );
|
||||||
|
|
||||||
DatExtractDialog extractDlg = new DatExtractDialog( this, extractDir, datsDir );
|
DatExtractDialog extractDlg = new DatExtractDialog( this, extractDir, datsDir );
|
||||||
extractDlg.getWorkerThread().setDefaultUncaughtExceptionHandler( this );
|
extractDlg.getWorkerThread().setDefaultUncaughtExceptionHandler( this );
|
||||||
|
|
@ -781,7 +782,7 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
}
|
}
|
||||||
else if ( source == sandboxMenuItem ) {
|
else if ( source == sandboxMenuItem ) {
|
||||||
setStatusText( "" );
|
setStatusText( "" );
|
||||||
File datsDir = new File( appConfig.getProperty( "ftl_dats_path" ) );
|
File datsDir = new File( appConfig.getProperty( SlipstreamConfig.FTL_DATS_PATH ) );
|
||||||
|
|
||||||
ModXMLSandbox sandboxFrame = new ModXMLSandbox( datsDir );
|
ModXMLSandbox sandboxFrame = new ModXMLSandbox( datsDir );
|
||||||
sandboxFrame.addWindowListener( nerfListener );
|
sandboxFrame.addWindowListener( nerfListener );
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,15 @@ import net.vhati.modmanager.ui.FieldEditorPanel.ContentType;
|
||||||
|
|
||||||
|
|
||||||
public class SlipstreamConfigDialog extends JFrame implements ActionListener {
|
public class SlipstreamConfigDialog extends JFrame implements ActionListener {
|
||||||
protected static final String ALLOW_ZIP = "allow_zip";
|
|
||||||
protected static final String RUN_STEAM_FTL = "run_steam_ftl";
|
protected static final String ALLOW_ZIP = SlipstreamConfig.ALLOW_ZIP;
|
||||||
protected static final String NEVER_RUN_FTL = "never_run_ftl";
|
protected static final String RUN_STEAM_FTL = SlipstreamConfig.RUN_STEAM_FTL;
|
||||||
protected static final String USE_DEFAULT_UI = "use_default_ui";
|
protected static final String NEVER_RUN_FTL = SlipstreamConfig.NEVER_RUN_FTL;
|
||||||
protected static final String REMEMBER_GEOMETRY = "remember_geometry";
|
protected static final String USE_DEFAULT_UI = SlipstreamConfig.USE_DEFAULT_UI;
|
||||||
protected static final String UPDATE_CATALOG = "update_catalog";
|
protected static final String REMEMBER_GEOMETRY = SlipstreamConfig.REMEMBER_GEOMETRY;
|
||||||
protected static final String UPDATE_APP = "update_app";
|
protected static final String UPDATE_CATALOG = SlipstreamConfig.UPDATE_CATALOG;
|
||||||
protected static final String FTL_DATS_PATH = "ftl_dats_path";
|
protected static final String UPDATE_APP = SlipstreamConfig.UPDATE_APP;
|
||||||
|
protected static final String FTL_DATS_PATH = SlipstreamConfig.FTL_DATS_PATH;
|
||||||
|
|
||||||
protected SlipstreamConfig appConfig;
|
protected SlipstreamConfig appConfig;
|
||||||
|
|
||||||
|
|
@ -80,16 +81,16 @@ public class SlipstreamConfigDialog extends JFrame implements ActionListener {
|
||||||
editorPanel.addBlankRow();
|
editorPanel.addBlankRow();
|
||||||
editorPanel.addFillRow();
|
editorPanel.addFillRow();
|
||||||
|
|
||||||
editorPanel.getBoolean( ALLOW_ZIP ).setSelected( appConfig.getProperty( ALLOW_ZIP, "false" ).equals( "true" ) );
|
editorPanel.getBoolean( ALLOW_ZIP ).setSelected( appConfig.getProperty( SlipstreamConfig.ALLOW_ZIP, "false" ).equals( "true" ) );
|
||||||
editorPanel.getBoolean( RUN_STEAM_FTL ).setSelected( appConfig.getProperty( RUN_STEAM_FTL, "false" ).equals( "true" ) );
|
editorPanel.getBoolean( RUN_STEAM_FTL ).setSelected( appConfig.getProperty( SlipstreamConfig.RUN_STEAM_FTL, "false" ).equals( "true" ) );
|
||||||
editorPanel.getBoolean( NEVER_RUN_FTL ).setSelected( appConfig.getProperty( NEVER_RUN_FTL, "false" ).equals( "true" ) );
|
editorPanel.getBoolean( NEVER_RUN_FTL ).setSelected( appConfig.getProperty( SlipstreamConfig.NEVER_RUN_FTL, "false" ).equals( "true" ) );
|
||||||
editorPanel.getBoolean( USE_DEFAULT_UI ).setSelected( appConfig.getProperty( USE_DEFAULT_UI, "false" ).equals( "true" ) );
|
editorPanel.getBoolean( USE_DEFAULT_UI ).setSelected( appConfig.getProperty( SlipstreamConfig.USE_DEFAULT_UI, "false" ).equals( "true" ) );
|
||||||
editorPanel.getBoolean( REMEMBER_GEOMETRY ).setSelected( appConfig.getProperty( REMEMBER_GEOMETRY, "true" ).equals( "true" ) );
|
editorPanel.getBoolean( REMEMBER_GEOMETRY ).setSelected( appConfig.getProperty( SlipstreamConfig.REMEMBER_GEOMETRY, "true" ).equals( "true" ) );
|
||||||
editorPanel.getInt( UPDATE_CATALOG ).setText( Integer.toString(appConfig.getPropertyAsInt( UPDATE_CATALOG, 0 )) );
|
editorPanel.getInt( UPDATE_CATALOG ).setText( Integer.toString( appConfig.getPropertyAsInt( SlipstreamConfig.UPDATE_CATALOG, 0 ) ) );
|
||||||
editorPanel.getInt( UPDATE_APP ).setText( Integer.toString(appConfig.getPropertyAsInt( UPDATE_APP, 0 )) );
|
editorPanel.getInt( UPDATE_APP ).setText( Integer.toString( appConfig.getPropertyAsInt( SlipstreamConfig.UPDATE_APP, 0 ) ) );
|
||||||
|
|
||||||
JTextField ftlDatsPathField = editorPanel.getChooser( FTL_DATS_PATH ).getTextField();
|
JTextField ftlDatsPathField = editorPanel.getChooser( FTL_DATS_PATH ).getTextField();
|
||||||
ftlDatsPathField.setText( appConfig.getProperty( FTL_DATS_PATH, "" ) );
|
ftlDatsPathField.setText( appConfig.getProperty( SlipstreamConfig.FTL_DATS_PATH, "" ) );
|
||||||
ftlDatsPathField.setPreferredSize( new Dimension( 150, ftlDatsPathField.getPreferredSize().height ) );
|
ftlDatsPathField.setPreferredSize( new Dimension( 150, ftlDatsPathField.getPreferredSize().height ) );
|
||||||
editorPanel.getChooser( FTL_DATS_PATH ).getButton().addActionListener( this );
|
editorPanel.getChooser( FTL_DATS_PATH ).getButton().addActionListener( this );
|
||||||
|
|
||||||
|
|
@ -137,17 +138,17 @@ public class SlipstreamConfigDialog extends JFrame implements ActionListener {
|
||||||
|
|
||||||
if ( source == applyBtn ) {
|
if ( source == applyBtn ) {
|
||||||
String tmp;
|
String tmp;
|
||||||
appConfig.setProperty( ALLOW_ZIP, editorPanel.getBoolean( ALLOW_ZIP ).isSelected() ? "true" : "false" );
|
appConfig.setProperty( SlipstreamConfig.ALLOW_ZIP, editorPanel.getBoolean( ALLOW_ZIP ).isSelected() ? "true" : "false" );
|
||||||
appConfig.setProperty( RUN_STEAM_FTL, editorPanel.getBoolean( RUN_STEAM_FTL ).isSelected() ? "true" : "false" );
|
appConfig.setProperty( SlipstreamConfig.RUN_STEAM_FTL, editorPanel.getBoolean( RUN_STEAM_FTL ).isSelected() ? "true" : "false" );
|
||||||
appConfig.setProperty( NEVER_RUN_FTL, editorPanel.getBoolean( NEVER_RUN_FTL ).isSelected() ? "true" : "false" );
|
appConfig.setProperty( SlipstreamConfig.NEVER_RUN_FTL, editorPanel.getBoolean( NEVER_RUN_FTL ).isSelected() ? "true" : "false" );
|
||||||
appConfig.setProperty( USE_DEFAULT_UI, editorPanel.getBoolean( USE_DEFAULT_UI ).isSelected() ? "true" : "false" );
|
appConfig.setProperty( SlipstreamConfig.USE_DEFAULT_UI, editorPanel.getBoolean( USE_DEFAULT_UI ).isSelected() ? "true" : "false" );
|
||||||
appConfig.setProperty( REMEMBER_GEOMETRY, editorPanel.getBoolean( REMEMBER_GEOMETRY ).isSelected() ? "true" : "false" );
|
appConfig.setProperty( SlipstreamConfig.REMEMBER_GEOMETRY, editorPanel.getBoolean( REMEMBER_GEOMETRY ).isSelected() ? "true" : "false" );
|
||||||
|
|
||||||
tmp = editorPanel.getInt( UPDATE_CATALOG ).getText();
|
tmp = editorPanel.getInt( UPDATE_CATALOG ).getText();
|
||||||
try {
|
try {
|
||||||
int n = Integer.parseInt( tmp );
|
int n = Integer.parseInt( tmp );
|
||||||
n = Math.max( 0, n );
|
n = Math.max( 0, n );
|
||||||
appConfig.setProperty( UPDATE_CATALOG, Integer.toString( n ) );
|
appConfig.setProperty( SlipstreamConfig.UPDATE_CATALOG, Integer.toString( n ) );
|
||||||
}
|
}
|
||||||
catch ( NumberFormatException f ) {}
|
catch ( NumberFormatException f ) {}
|
||||||
|
|
||||||
|
|
@ -155,13 +156,13 @@ public class SlipstreamConfigDialog extends JFrame implements ActionListener {
|
||||||
try {
|
try {
|
||||||
int n = Integer.parseInt( tmp );
|
int n = Integer.parseInt( tmp );
|
||||||
n = Math.max( 0, n );
|
n = Math.max( 0, n );
|
||||||
appConfig.setProperty( UPDATE_APP, Integer.toString( n ) );
|
appConfig.setProperty( SlipstreamConfig.UPDATE_APP, Integer.toString( n ) );
|
||||||
}
|
}
|
||||||
catch ( NumberFormatException f ) {}
|
catch ( NumberFormatException f ) {}
|
||||||
|
|
||||||
tmp = editorPanel.getChooser( FTL_DATS_PATH ).getTextField().getText();
|
tmp = editorPanel.getChooser( FTL_DATS_PATH ).getTextField().getText();
|
||||||
if ( tmp.length() > 0 && FTLUtilities.isDatsDirValid( new File( tmp ) ) ) {
|
if ( tmp.length() > 0 && FTLUtilities.isDatsDirValid( new File( tmp ) ) ) {
|
||||||
appConfig.setProperty( FTL_DATS_PATH, tmp );
|
appConfig.setProperty( SlipstreamConfig.FTL_DATS_PATH, tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setVisible( false );
|
this.setVisible( false );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue