Map/Report automatisch öffnen einstellung

This commit is contained in:
Georg Reisinger 2021-04-17 18:17:51 +02:00
parent ad5d7d98c4
commit 63e736152b
7 changed files with 43 additions and 20 deletions

View File

@ -43,7 +43,7 @@ public class ConfigHelper {
try {
ini = new Wini(new File(filename));
} catch (IOException e) {
LogHelper.error(e.getMessage(), e.getClass().getName());
LogHelper.error(e);
}
assert ini != null;
return ini.get(sectionName, optionName, String.class);
@ -92,7 +92,7 @@ public class ConfigHelper {
ini.put(sectionName, optionName, value);
ini.store();
} catch (IOException e) {
LogHelper.error(e.getMessage(), e.getClass().getName());
LogHelper.error(e);
}
}

View File

@ -31,7 +31,9 @@ public class DirectionMap {
FileHelper.saveImage(this.map, "jpg", new File(this.file));
FileHelper.saveImage(this.mappdf, "jpg", new File(this.filepdf));
getDirections(start, ende);
FileHelper.openDefault(file);
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
FileHelper.openDefault(file);
}
}
/**

View File

@ -53,7 +53,9 @@ public class Reporter {
} catch (DocumentException | FileNotFoundException e) {
LogHelper.error(e.getMessage(), e.getClass().getName());
}
FileHelper.openDefault(file);
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1) {
FileHelper.openDefault(file);
}
}
/**
@ -109,7 +111,9 @@ public class Reporter {
} catch (DocumentException | FileNotFoundException e) {
LogHelper.error(e.getMessage(), e.getClass().getName());
}
FileHelper.openDefault(file);
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1) {
FileHelper.openDefault(file);
}
}
// iText allows to add metadata to the PDF which can be viewed in your Adobe

View File

@ -119,7 +119,9 @@ public class TourPlaner{
* @param tourname Tourname
*/
public static void openImage(String tourname){
FileHelper.openDefault(getImagePath(tourname));
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1) {
FileHelper.openDefault(getImagePath(tourname));
}
}
@ -181,17 +183,6 @@ public class TourPlaner{
return new DbConnect().editLog(tourname, log);
}
/**
* Exportiert die Daten
* @param path Path zu den Daten
* @throws IOException Fehler beim schreiben der Daten
*/
public static void exportData(String path) throws IOException {
Exporter exporter = new Exporter(path);
exporter.doExport();
FileHelper.openDefault(path);
}
/**
* Sucht alle touren die den gegebenen tournamen enthalten
* @param tourname Name der zu suchen ist

View File

@ -58,8 +58,8 @@
</Menu>
<Menu mnemonicParsing="false" text="Optionen">
<items>
<CheckMenuItem mnemonicParsing="false" text="Map automatisch öffnen" />
<CheckMenuItem mnemonicParsing="false" text="Report automatisch öffnen" />
<CheckMenuItem fx:id="openmap" mnemonicParsing="false" onAction="#openmapaction" text="Map automatisch öffnen" />
<CheckMenuItem fx:id="openpdf" mnemonicParsing="false" onAction="#openpdfaction" text="Report automatisch öffnen" />
<Menu mnemonicParsing="false" text="Sprache">
<items>
<RadioMenuItem mnemonicParsing="false" text="Deutsch" />

View File

@ -1,6 +1,8 @@
package tourplaner.ui;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Orientation;
@ -43,6 +45,8 @@ public class TourplanerController implements Initializable {
//Log -> rechts unten
public TableView<Log> logTableView;
public TableColumn<Log, String> logDauerCol, logStreckeCol, logDatumCol, logAvgCol, logHightCol, logPauseCol, logGegangenCol, logBemerkungCol;
//Menue
public CheckMenuItem openmap, openpdf;
@FXML
private void tourReport(){
@ -234,7 +238,30 @@ public class TourplanerController implements Initializable {
TourListView.setOrientation(Orientation.VERTICAL);
syncTourNamen();
deselectAll();
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf") == 1){
this.openpdf.setSelected(true);
}else {
this.openpdf.setSelected(false);
}
if(ConfigHelper.getIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap") == 1){
this.openmap.setSelected(true);
}else {
this.openmap.setSelected(false);
}
}
@FXML
private void openpdfaction(){
int selected = 0;
if(this.openpdf.isSelected()) selected = 1;
ConfigHelper.setIniInt(ConfigHelper.getStandartConfig(), "settings", "openpdf", selected);
}
@FXML
private void openmapaction(){
int selected = 0;
if(this.openmap.isSelected()) selected = 1;
ConfigHelper.setIniInt(ConfigHelper.getStandartConfig(), "settings", "openmap", selected);
}
private void deselectAll(){

View File

@ -612,7 +612,6 @@ public class ViewModel {
*/
public void exportData(){
String file = AlertHelper.fileChooser("Exportiere");
System.out.println("EXPORT: " + file);
if(file != null){
try {
new Exporter(file).doExport();