Changeset 10062 in josm for trunk/src


Ignore:
Timestamp:
2016-03-28T00:22:42+02:00 (9 years ago)
Author:
Don-vip
Message:

see #12652 - about dialog: replace old bug report link with new bug report button, remove unused code

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AboutAction.java

    r10055 r10062  
    1818import javax.swing.ImageIcon;
    1919import javax.swing.JLabel;
    20 import javax.swing.JOptionPane;
    2120import javax.swing.JPanel;
    2221import javax.swing.JScrollPane;
     
    2625import org.openstreetmap.josm.Main;
    2726import org.openstreetmap.josm.data.Version;
     27import org.openstreetmap.josm.gui.ExtendedDialog;
    2828import org.openstreetmap.josm.gui.util.GuiHelper;
    2929import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
     
    3434import org.openstreetmap.josm.tools.ImageProvider;
    3535import org.openstreetmap.josm.tools.Shortcut;
    36 import org.openstreetmap.josm.tools.Utils;
    37 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;
    3836
    3937/**
     
    9694        info.add(new UrlLabel(Main.getJOSMWebsite(), 2), GBC.eol().fill(GBC.HORIZONTAL));
    9795        info.add(GBC.glue(0, 5), GBC.eol());
    98         info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10, 0, 10, 0));
    99         info.add(BugReportExceptionHandler.getBugReportUrlLabel(Utils.strip(ShowStatusReportAction.getReportHeader())),
    100                 GBC.eol().fill(GBC.HORIZONTAL));
    10196
    10297        about.addTab(tr("Info"), info);
     
    109104        // Intermediate panel to allow proper optionPane resizing
    110105        JPanel panel = new JPanel(new GridBagLayout());
    111         panel.setPreferredSize(new Dimension(600, 300));
     106        panel.setPreferredSize(new Dimension(890, 300));
     107        panel.add(new JLabel("", new ImageIcon(ImageProvider.get("logo.svg").getImage().getScaledInstance(256, 258, Image.SCALE_SMOOTH)),
     108                JLabel.CENTER), GBC.std().insets(0, 5, 0, 0));
    112109        panel.add(about, GBC.std().fill());
    113110
    114111        GuiHelper.prepareResizeableOptionPane(panel, panel.getPreferredSize());
    115         JOptionPane.showMessageDialog(Main.parent, panel, tr("About JOSM..."), JOptionPane.INFORMATION_MESSAGE,
    116                 new ImageIcon(ImageProvider.get("logo.svg").getImage().getScaledInstance(256, 258, Image.SCALE_SMOOTH)));
     112        int ret = new ExtendedDialog(Main.parent, tr("About JOSM..."), new String[] {tr("OK"), tr("Report bug")})
     113            .setButtonIcons(new String[] {"ok", "bug"})
     114            .setContent(panel, false)
     115            .showDialog().getValue();
     116        if (2 == ret) {
     117            Main.main.menu.reportbug.actionPerformed(null);
     118        }
    117119    }
    118120
  • trunk/src/org/openstreetmap/josm/actions/ReportBugAction.java

    r10055 r10062  
    2222     */
    2323    public ReportBugAction() {
    24         this(ShowStatusReportAction.getReportHeader());
     24        this(null);
    2525    }
    2626
     
    3838    @Override
    3939    public void actionPerformed(ActionEvent e) {
    40         BugReportSender.reportBug(text);
     40        BugReportSender.reportBug(text == null ? ShowStatusReportAction.getReportHeader() : text);
    4141    }
    4242}
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java

    r10055 r10062  
    77import java.awt.GridBagConstraints;
    88import java.awt.GridBagLayout;
    9 import java.io.ByteArrayOutputStream;
    109import java.io.IOException;
    1110import java.io.PrintWriter;
    1211import java.io.StringWriter;
    13 import java.net.URL;
    14 import java.nio.ByteBuffer;
    15 import java.nio.charset.StandardCharsets;
    16 import java.util.zip.GZIPOutputStream;
    1712
    1813import javax.swing.JButton;
     
    3328import org.openstreetmap.josm.plugins.PluginDownloadTask;
    3429import org.openstreetmap.josm.plugins.PluginHandler;
    35 import org.openstreetmap.josm.tools.Base64;
    3630import org.openstreetmap.josm.tools.GBC;
    3731import org.openstreetmap.josm.tools.WikiReader;
     
    154148
    155149    /**
    156      * Handles the given throwable object
    157      * @param t The throwable object
    158      */
    159     public void handle(Throwable t) {
    160         handleException(t);
    161     }
    162 
    163     /**
    164150     * Handles the given exception
    165151     * @param e the exception
     
    253239        return handlingInProgress;
    254240    }
    255 
    256     /**
    257      * Replies the URL to create a JOSM bug report with the given debug text. GZip is used to reduce the length of the parameter.
    258      * @param debugText The debug text to provide us
    259      * @return The URL to create a JOSM bug report with the given debug text
    260      * @see BugReportSender#reportBug(String) if you want to send long debug texts along.
    261      * @since 5849
    262      */
    263     public static URL getBugReportUrl(String debugText) {
    264         try (
    265             ByteArrayOutputStream out = new ByteArrayOutputStream();
    266             GZIPOutputStream gzip = new GZIPOutputStream(out)
    267         ) {
    268             gzip.write(debugText.getBytes(StandardCharsets.UTF_8));
    269             gzip.finish();
    270 
    271             return new URL(Main.getJOSMWebsite()+"/josmticket?" +
    272                     "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true));
    273         } catch (IOException e) {
    274             Main.error(e);
    275             return null;
    276         }
    277     }
    278 
    279     /**
    280      * Replies the URL label to create a JOSM bug report with the given debug text
    281      * @param debugText The debug text to provide us
    282      * @return The URL label to create a JOSM bug report with the given debug text
    283      * @since 5849
    284      */
    285     public static UrlLabel getBugReportUrlLabel(String debugText) {
    286         URL url = getBugReportUrl(debugText);
    287         if (url != null) {
    288             return new UrlLabel(url.toString(), Main.getJOSMWebsite()+"/josmticket?...", 2);
    289         }
    290         return null;
    291     }
    292241}
Note: See TracChangeset for help on using the changeset viewer.