Merge pull request #893 from wolsen/fix-bug-reporter
Update Bug report dialog
This commit is contained in:
commit
8519e831cf
@ -141,13 +141,13 @@ bugreport.dlg.but.Sendbugreport.Ttip = Automatically send the bug report to the
|
|||||||
bugreport.dlg.successmsg1 = Bug report successfully sent.
|
bugreport.dlg.successmsg1 = Bug report successfully sent.
|
||||||
bugreport.dlg.successmsg2 = Thank you for helping make OpenRocket better!
|
bugreport.dlg.successmsg2 = Thank you for helping make OpenRocket better!
|
||||||
bugreport.dlg.successmsg3 = Bug report sent
|
bugreport.dlg.successmsg3 = Bug report sent
|
||||||
bugreport.dlg.connectedInternet = <html>If connected to the Internet, you can simply click <em>Send bug report</em>.
|
bugreport.dlg.connectedInternet = <html>To submit a bug online, include the text below at:
|
||||||
bugreport.dlg.otherwise = Otherwise, send the text below to the address:
|
bugreport.dlg.otherwise = <html>To submit a bug via email, send the text below to:
|
||||||
bugreport.lbl.Theinformation = The information above may be included in a public bug report. Make sure it does not contain any sensitive information you do not want to be made public.
|
bugreport.lbl.Theinformation = The information above may be included in a public bug report. Make sure it does not contain any sensitive information you do not want to be made public.
|
||||||
bugreport.dlg.failedmsg1 = OpenRocket was unable to send the bug report:
|
bugreport.dlg.failedmsg1 = OpenRocket was unable to send the bug report:
|
||||||
bugreport.dlg.failedmsg2 = Please send the report manually to
|
bugreport.dlg.failedmsg2 = Please send the report manually to
|
||||||
bugreport.dlg.failedmsg3 = Error sending report
|
bugreport.dlg.failedmsg3 = Error sending report
|
||||||
bugreport.reportDialog.txt = <html><b>You can report a bug in OpenRocket by filling in and submitting the form below.</b><br>You can also report bugs and include attachments on the project web site.
|
bugreport.reportDialog.txt = <html><b>Bugs can be reported at the OpenRocket Github project site or by email.</b>
|
||||||
bugreport.reportDialog.txt2 = <html><b>Please include a short description about what you were doing when the exception occurred.</b>
|
bugreport.reportDialog.txt2 = <html><b>Please include a short description about what you were doing when the exception occurred.</b>
|
||||||
bugreport.dlg.provideDescription = Please provide a description of the bug first.
|
bugreport.dlg.provideDescription = Please provide a description of the bug first.
|
||||||
bugreport.dlg.provideDescription.title = Bug description missing
|
bugreport.dlg.provideDescription.title = Bug description missing
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
package net.sf.openrocket.gui.dialogs;
|
package net.sf.openrocket.gui.dialogs;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
|
||||||
import java.awt.Dialog;
|
import java.awt.Dialog;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
@ -21,31 +15,31 @@ import java.util.TreeSet;
|
|||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
import com.jogamp.opengl.JoglVersion;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.openrocket.communication.BugReporter;
|
|
||||||
import net.sf.openrocket.gui.components.SelectableLabel;
|
|
||||||
import net.sf.openrocket.gui.components.StyledLabel;
|
import net.sf.openrocket.gui.components.StyledLabel;
|
||||||
|
import net.sf.openrocket.gui.components.URLLabel;
|
||||||
import net.sf.openrocket.gui.util.GUIUtil;
|
import net.sf.openrocket.gui.util.GUIUtil;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.logging.LogLevelBufferLogger;
|
import net.sf.openrocket.logging.LogLevelBufferLogger;
|
||||||
import net.sf.openrocket.logging.LogLine;
|
import net.sf.openrocket.logging.LogLine;
|
||||||
import net.sf.openrocket.logging.LoggingSystemSetup;
|
import net.sf.openrocket.logging.LoggingSystemSetup;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.BugException;
|
|
||||||
import net.sf.openrocket.util.BuildProperties;
|
import net.sf.openrocket.util.BuildProperties;
|
||||||
import net.sf.openrocket.util.JarUtil;
|
import net.sf.openrocket.util.JarUtil;
|
||||||
|
|
||||||
import com.jogamp.opengl.JoglVersion;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class BugReportDialog extends JDialog {
|
public class BugReportDialog extends JDialog {
|
||||||
|
|
||||||
|
private static final String NEW_ISSUES_URL = "https://github.com/openrocket/openrocket/issues/new";
|
||||||
private static final String REPORT_EMAIL = "openrocket-bugs@lists.sourceforge.net";
|
private static final String REPORT_EMAIL = "openrocket-bugs@lists.sourceforge.net";
|
||||||
|
private static final String REPORT_EMAIL_URL = "mailto:" + REPORT_EMAIL;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
|
|
||||||
@ -65,26 +59,22 @@ public class BugReportDialog extends JDialog {
|
|||||||
//// <html>If connected to the Internet, you can simply click
|
//// <html>If connected to the Internet, you can simply click
|
||||||
//// <em>Send bug report</em>.
|
//// <em>Send bug report</em>.
|
||||||
label = new JLabel(trans.get("bugreport.dlg.connectedInternet"));
|
label = new JLabel(trans.get("bugreport.dlg.connectedInternet"));
|
||||||
d = label.getPreferredSize();
|
panel.add(label, "gapleft para, split 2, gapright rel");
|
||||||
d.width = 100000;
|
|
||||||
label.setMaximumSize(d);
|
panel.add(new URLLabel(NEW_ISSUES_URL), "growx, wrap para");
|
||||||
panel.add(label, "gapleft para, wrap");
|
|
||||||
|
|
||||||
//// Otherwise, send the text below to the address:
|
//// Otherwise, send the text below to the address:
|
||||||
panel.add(new JLabel(trans.get("bugreport.dlg.otherwise") + " "),
|
panel.add(new JLabel(trans.get("bugreport.dlg.otherwise") + " "),
|
||||||
"gapleft para, split 2, gapright rel");
|
"gapleft para, split 2, gapright rel");
|
||||||
panel.add(new SelectableLabel(REPORT_EMAIL), "growx, wrap para");
|
panel.add(new URLLabel(REPORT_EMAIL_URL, REPORT_EMAIL), "growx, wrap para");
|
||||||
|
|
||||||
|
|
||||||
final JTextArea textArea = new JTextArea(message, 20, 70);
|
final JTextArea textArea = new JTextArea(message, 20, 70);
|
||||||
textArea.setEditable(true);
|
textArea.setEditable(true);
|
||||||
panel.add(new JScrollPane(textArea), "grow, wrap");
|
panel.add(new JScrollPane(textArea), "grow, wrap");
|
||||||
|
|
||||||
|
|
||||||
panel.add(new StyledLabel(trans.get("bugreport.lbl.Theinformation"), -1), "wrap para");
|
panel.add(new StyledLabel(trans.get("bugreport.lbl.Theinformation"), -1), "wrap para");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////Close button
|
////Close button
|
||||||
JButton close = new JButton(trans.get("dlg.but.close"));
|
JButton close = new JButton(trans.get("dlg.but.close"));
|
||||||
close.addActionListener(new ActionListener() {
|
close.addActionListener(new ActionListener() {
|
||||||
@ -95,67 +85,6 @@ public class BugReportDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(close, "right, sizegroup buttons, split");
|
panel.add(close, "right, sizegroup buttons, split");
|
||||||
|
|
||||||
|
|
||||||
//// Mail button
|
|
||||||
// if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Action.MAIL)) {
|
|
||||||
// JButton mail = new JButton("Open email");
|
|
||||||
// mail.setToolTipText("Open email client with the suitable email ready.");
|
|
||||||
// mail.addActionListener(new ActionListener() {
|
|
||||||
// @Override
|
|
||||||
// public void actionPerformed(ActionEvent e) {
|
|
||||||
// String text = textArea.getText();
|
|
||||||
// openEmail(text);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// panel.add(mail, "right, sizegroup buttons");
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//// Send bug report button
|
|
||||||
JButton send = new JButton(trans.get("bugreport.dlg.but.Sendbugreport"));
|
|
||||||
//// Automatically send the bug report to the OpenRocket developers.
|
|
||||||
send.setToolTipText(trans.get("bugreport.dlg.but.Sendbugreport.Ttip"));
|
|
||||||
send.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
String text = textArea.getText();
|
|
||||||
if (text.equals(message) && !sendIfUnchanged) {
|
|
||||||
JOptionPane.showMessageDialog(BugReportDialog.this,
|
|
||||||
trans.get("bugreport.dlg.provideDescription"),
|
|
||||||
trans.get("bugreport.dlg.provideDescription.title"), JOptionPane.ERROR_MESSAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
BugReporter.sendBugReport(text);
|
|
||||||
|
|
||||||
// Success if we came here
|
|
||||||
//bugreport.dlg.successmsg
|
|
||||||
/*JOptionPane.showMessageDialog(BugReportDialog.this,
|
|
||||||
new Object[] { "Bug report successfully sent.",
|
|
||||||
"Thank you for helping make OpenRocket better!" },
|
|
||||||
"Bug report sent", JOptionPane.INFORMATION_MESSAGE);*/
|
|
||||||
JOptionPane.showMessageDialog(BugReportDialog.this,
|
|
||||||
new Object[] { trans.get("bugreport.dlg.successmsg1"),
|
|
||||||
trans.get("bugreport.dlg.successmsg2") },
|
|
||||||
trans.get("bugreport.dlg.successmsg3"), JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// Sending the message failed.
|
|
||||||
JOptionPane.showMessageDialog(BugReportDialog.this,
|
|
||||||
//// OpenRocket was unable to send the bug report:
|
|
||||||
new Object[] { trans.get("bugreport.dlg.failedmsg1"),
|
|
||||||
ex.getClass().getSimpleName() + ": " + ex.getMessage(), " ",
|
|
||||||
//// Please send the report manually to
|
|
||||||
trans.get("bugreport.dlg.failedmsg2") + " " + REPORT_EMAIL },
|
|
||||||
//// Error sending report
|
|
||||||
trans.get("bugreport.dlg.failedmsg3"), JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel.add(send, "right, sizegroup buttons");
|
|
||||||
|
|
||||||
this.add(panel);
|
this.add(panel);
|
||||||
|
|
||||||
this.validate();
|
this.validate();
|
||||||
@ -163,11 +92,9 @@ public class BugReportDialog extends JDialog {
|
|||||||
this.pack();
|
this.pack();
|
||||||
this.setLocationRelativeTo(parent);
|
this.setLocationRelativeTo(parent);
|
||||||
|
|
||||||
GUIUtil.setDisposableDialogOptions(this, send);
|
GUIUtil.setDisposableDialogOptions(this, close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a general bug report dialog allowing the user to input information about
|
* Show a general bug report dialog allowing the user to input information about
|
||||||
* the bug they encountered.
|
* the bug they encountered.
|
||||||
@ -272,7 +199,6 @@ public class BugReportDialog extends JDialog {
|
|||||||
reportDialog.setVisible(true);
|
reportDialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void addSystemInformation(StringBuilder sb) {
|
private static void addSystemInformation(StringBuilder sb) {
|
||||||
sb.append("OpenRocket version: " + BuildProperties.getVersion() + "\n");
|
sb.append("OpenRocket version: " + BuildProperties.getVersion() + "\n");
|
||||||
sb.append("OpenRocket source: " + BuildProperties.getBuildSource() + "\n");
|
sb.append("OpenRocket source: " + BuildProperties.getBuildSource() + "\n");
|
||||||
@ -301,7 +227,6 @@ public class BugReportDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void addErrorLog(StringBuilder sb) {
|
private static void addErrorLog(StringBuilder sb) {
|
||||||
LogLevelBufferLogger buffer = LoggingSystemSetup.getBufferLogger();
|
LogLevelBufferLogger buffer = LoggingSystemSetup.getBufferLogger();
|
||||||
List<LogLine> logs = buffer.getLogs();
|
List<LogLine> logs = buffer.getLogs();
|
||||||
@ -310,49 +235,4 @@ public class BugReportDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the default email client with the suitable bug report.
|
|
||||||
* Note that this does not work on some systems even if Desktop.isSupported()
|
|
||||||
* claims so.
|
|
||||||
*
|
|
||||||
* @param text the bug report text.
|
|
||||||
* @return whether opening the client succeeded.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private boolean openEmail(String text) {
|
|
||||||
String version;
|
|
||||||
|
|
||||||
try {
|
|
||||||
text = URLEncoder.encode(text, "UTF-8");
|
|
||||||
version = URLEncoder.encode(BuildProperties.getVersion(), "UTF-8");
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new BugException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String mailto = "mailto:" + REPORT_EMAIL
|
|
||||||
+ "?subject=Bug%20report%20for%20OpenRocket%20" + version
|
|
||||||
+ "?body=" + text;
|
|
||||||
URI uri;
|
|
||||||
try {
|
|
||||||
uri = new URI(mailto);
|
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Desktop desktop = Desktop.getDesktop();
|
|
||||||
try {
|
|
||||||
desktop.mail(uri);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user