From 85723fc25e4f624ba2787cd63f9a84a55248edc9 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 22 Jun 2022 15:55:56 +0200 Subject: move logs to logs/ subfolder, and add "Show log directory" button to "about" configuration tab --- .../composites/configuration/AboutComposite.java | 21 +++++++++++++++++++++ .../at/asit/pdfover/gui/messages.properties | 1 + .../at/asit/pdfover/gui/messages_de.properties | 1 + pdf-over-gui/src/main/resources/logback.xml | 4 ++-- 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 7bd64ab4..a0a423c4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -1,6 +1,7 @@ package at.asit.pdfover.gui.composites.configuration; import java.awt.Desktop; +import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -10,6 +11,7 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Link; @@ -27,6 +29,7 @@ public class AboutComposite extends ConfigurationCompositeBase { private Link lnkAbout; private Link lnkDataProtection; private Label lblDataProtection; + private Button btnOpenLogDirectory; /** * @param parent * @param style @@ -49,6 +52,10 @@ public class AboutComposite extends ConfigurationCompositeBase { StateComposite.anchor(lnkDataProtection).top(lblDataProtection,10).left(0,5).right(100,-5).set(); StateComposite.setFontHeight(lnkDataProtection, Constants.TEXT_SIZE_NORMAL); + this.btnOpenLogDirectory = new Button(this, SWT.NONE); + StateComposite.anchor(btnOpenLogDirectory).bottom(100, -5).right(100, -5).set(); + StateComposite.setFontHeight(btnOpenLogDirectory, Constants.TEXT_SIZE_BUTTON); + this.lnkAbout.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -89,6 +96,19 @@ public class AboutComposite extends ConfigurationCompositeBase { } }); + this.btnOpenLogDirectory.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + try + { + if (Desktop.isDesktopSupported()) + Desktop.getDesktop().open(new File(Constants.CONFIG_DIRECTORY + File.separator + "logs")); + } catch (Exception ex) { + log.warn("Failed to open log directory: ", ex); + } + } + }); + // Load localized strings reloadResources(); } @@ -110,6 +130,7 @@ public class AboutComposite extends ConfigurationCompositeBase { this.lnkAbout.setText(Messages.getString("config.AboutText")); //$NON-NLS-1$ this.lblDataProtection.setText(Messages.getString("config.DataProtection")); this.lnkDataProtection.setText(Messages.getString("config.DataProtectionStatement")); + this.btnOpenLogDirectory.setText(Messages.getString("config.ShowLogDirectory")); } diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 00433fce..8745c8fc 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -123,6 +123,7 @@ config.DataProtectionURL=https://www.a-trust.at/MediaProvider/2357/datenschutzer config.Advanced=Ad&vanced config.Keystore=&Keystore config.Simple=Basi&c +config.ShowLogDirectory=Show Log Directory dataSourceSelection.DropLabel=Drag document here dataSourceSelection.DropLabel2=or... dataSourceSelection.browse=&Browse for PDF on your computer diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 96299f3e..00dd7958 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -114,6 +114,7 @@ config.DataProtectionURL=https://www.a-trust.at/MediaProvider/2357/datenschutzer config.Advanced=Er&weitert config.Keystore=&Keystore config.Simple=&Einfach +config.ShowLogDirectory=Logverzeichnis anzeigen dataSourceSelection.DropLabel=Dokument hierher ziehen dataSourceSelection.DropLabel2=oder... dataSourceSelection.browse=&Durchsuchen um ein Dokument zu wählen diff --git a/pdf-over-gui/src/main/resources/logback.xml b/pdf-over-gui/src/main/resources/logback.xml index 9d916a92..a2b5155e 100644 --- a/pdf-over-gui/src/main/resources/logback.xml +++ b/pdf-over-gui/src/main/resources/logback.xml @@ -8,14 +8,14 @@ - ${user.home}/.pdf-over/pdf-over.log + ${user.home}/.pdf-over/logs/pdf-over.log UTF-8 %-5p | %d | %t @ %c | %m%n 10 - ${user.home}/.pdf-over/pdf-over.log.%i + ${user.home}/.pdf-over/logs/pdf-over.log.%i 100KB -- cgit v1.2.3