1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-11 16:34:04 +02:00

Add a ScrollView to hold the list of supported sites in the About dialog (Fixes #2104) (#2114)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
metaprime
2025-04-17 21:54:28 -07:00
committed by GitHub
parent 32b70a6bf6
commit f480583d9a

View File

@@ -1125,56 +1125,63 @@ public final class MainWindow implements Runnable, RipStatusHandler {
trayMenuMain.addActionListener(arg0 -> toggleTrayClick()); trayMenuMain.addActionListener(arg0 -> toggleTrayClick());
MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle()); MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle());
trayMenuAbout.addActionListener(arg0 -> { trayMenuAbout.addActionListener(arg0 -> {
StringBuilder about = new StringBuilder();
about.append("<html><h1>").append(mainFrame.getTitle()).append("</h1>");
about.append("Download albums from various websites:");
try { try {
List<String> rippers = Utils.getListOfAlbumRippers(); List<String> albumRippers = Utils.getListOfAlbumRippers();
about.append("<ul>"); List<String> videoRippers = Utils.getListOfVideoRippers();
for (String ripper : rippers) {
about.append("<li>"); JTextArea aboutTextArea = new JTextArea();
aboutTextArea.setEditable(false);
aboutTextArea.setLineWrap(true);
aboutTextArea.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(aboutTextArea);
scrollPane.setPreferredSize(new Dimension(400, 300));
StringBuilder aboutContent = new StringBuilder();
aboutContent.append("Download albums from various websites:\n");
for (String ripper : albumRippers) {
ripper = ripper.substring(ripper.lastIndexOf('.') + 1); ripper = ripper.substring(ripper.lastIndexOf('.') + 1);
if (ripper.contains("Ripper")) { if (ripper.contains("Ripper")) {
ripper = ripper.substring(0, ripper.indexOf("Ripper")); ripper = ripper.substring(0, ripper.indexOf("Ripper"));
} }
about.append(ripper); aboutContent.append("- ").append(ripper).append("\n");
about.append("</li>");
} }
about.append("</ul>");
} catch (Exception e) {
LOGGER.warn(e.getMessage());
}
about.append("<br>And download videos from video sites:"); aboutContent.append("\nDownload videos from video sites:\n");
try { for (String ripper : videoRippers) {
List<String> rippers = Utils.getListOfVideoRippers();
about.append("<ul>");
for (String ripper : rippers) {
about.append("<li>");
ripper = ripper.substring(ripper.lastIndexOf('.') + 1); ripper = ripper.substring(ripper.lastIndexOf('.') + 1);
if (ripper.contains("Ripper")) { if (ripper.contains("Ripper")) {
ripper = ripper.substring(0, ripper.indexOf("Ripper")); ripper = ripper.substring(0, ripper.indexOf("Ripper"));
} }
about.append(ripper); aboutContent.append("- ").append(ripper).append("\n");
about.append("</li>"); }
aboutTextArea.setText(aboutContent.toString());
// Ensure the scroll pane starts at the top
SwingUtilities.invokeLater(() -> scrollPane.getVerticalScrollBar().setValue(0));
JPanel aboutPanel = new JPanel(new BorderLayout());
JLabel titleLabel = new JLabel("Download albums and videos from various websites", JLabel.CENTER);
titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 16));
aboutPanel.add(titleLabel, BorderLayout.NORTH);
aboutPanel.add(scrollPane, BorderLayout.CENTER);
JLabel footerLabel = new JLabel("Do you want to visit the project homepage on GitHub?", JLabel.CENTER);
aboutPanel.add(footerLabel, BorderLayout.SOUTH);
int response = JOptionPane.showConfirmDialog(null, aboutPanel, mainFrame.getTitle(),
JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon));
if (response == JOptionPane.YES_OPTION) {
try {
Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme"));
} catch (IOException e) {
LOGGER.error("Exception while opening project home page", e);
}
} }
about.append("</ul>");
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn(e.getMessage()); LOGGER.warn(e.getMessage());
} }
about.append("Do you want to visit the project homepage on Github?");
about.append("</html>");
int response = JOptionPane.showConfirmDialog(null, about.toString(), mainFrame.getTitle(),
JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon));
if (response == JOptionPane.YES_OPTION) {
try {
Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme"));
} catch (IOException e) {
LOGGER.error("Exception while opening project home page", e);
}
}
}); });
MenuItem trayMenuExit = new MenuItem(Utils.getLocalizedString("tray.exit")); MenuItem trayMenuExit = new MenuItem(Utils.getLocalizedString("tray.exit"));