After opening config file saving would be performed to this file (if not 'Save as...')

Readme update
This commit is contained in:
Dmitry Isaenko 2019-10-20 00:19:28 +03:00
parent 9ae020f9b1
commit 1eb8b0e346
2 changed files with 10 additions and 4 deletions

View file

@ -6,6 +6,10 @@
LogiLed is a Logitech G513 Carbon GUI driver for adjusting backlight and effects. LogiLed is a Logitech G513 Carbon GUI driver for adjusting backlight and effects.
![Screenshot 1](https://live.staticflickr.com/65535/48925778631_57bb44c8fc_o.png)
![Screenshot 2](https://live.staticflickr.com/65535/48925778596_ccbe7d9212_o.png)
![Screenshot 3](https://live.staticflickr.com/65535/48925974837_c4a183a0d5_o.png)
#### License #### License
[GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.html) [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.html)

View file

@ -99,19 +99,21 @@ public class MainController implements Initializable {
* For 'Open' button * For 'Open' button
* */ * */
private void openConfig(){ private void openConfig(){
File congigFile = getOpenFileChooser(); File configFile = getOpenFileChooser();
if (congigFile == null) if (configFile == null)
return; return;
else else
recentPath = congigFile.getParentFile().getAbsolutePath(); recentPath = configFile.getParentFile().getAbsolutePath();
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
SettingsFileFormat setup; SettingsFileFormat setup;
try{ try{
setup = mapper.readerFor(SettingsFileFormat.class).readValue(new FileInputStream(congigFile)); setup = mapper.readerFor(SettingsFileFormat.class).readValue(new FileInputStream(configFile));
KeysLedsController.setConfig(setup.getKeyLedRule()); KeysLedsController.setConfig(setup.getKeyLedRule());
EffectsController.setConfig(setup.getEffectHumanReadable()); EffectsController.setConfig(setup.getEffectHumanReadable());
GameModeController.setConfig(setup.getGameModeKeyCodes()); GameModeController.setConfig(setup.getGameModeKeyCodes());
openedConfigFile = configFile;
} }
catch (IOException e){ catch (IOException e){
ServiceWindow.getErrorNotification(rb.getString("error_any_title"), rb.getString("error_any_body")); ServiceWindow.getErrorNotification(rb.getString("error_any_title"), rb.getString("error_any_body"));