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,48 +1125,52 @@ public final class MainWindow implements Runnable, RipStatusHandler {
trayMenuMain.addActionListener(arg0 -> toggleTrayClick());
MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle());
trayMenuAbout.addActionListener(arg0 -> {
StringBuilder about = new StringBuilder();
about.append("<html><h1>").append(mainFrame.getTitle()).append("</h1>");
about.append("Download albums from various websites:");
try {
List<String> rippers = Utils.getListOfAlbumRippers();
about.append("<ul>");
for (String ripper : rippers) {
about.append("<li>");
List<String> albumRippers = Utils.getListOfAlbumRippers();
List<String> videoRippers = Utils.getListOfVideoRippers();
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);
if (ripper.contains("Ripper")) {
ripper = ripper.substring(0, ripper.indexOf("Ripper"));
}
about.append(ripper);
about.append("</li>");
}
about.append("</ul>");
} catch (Exception e) {
LOGGER.warn(e.getMessage());
aboutContent.append("- ").append(ripper).append("\n");
}
about.append("<br>And download videos from video sites:");
try {
List<String> rippers = Utils.getListOfVideoRippers();
about.append("<ul>");
for (String ripper : rippers) {
about.append("<li>");
aboutContent.append("\nDownload videos from video sites:\n");
for (String ripper : videoRippers) {
ripper = ripper.substring(ripper.lastIndexOf('.') + 1);
if (ripper.contains("Ripper")) {
ripper = ripper.substring(0, ripper.indexOf("Ripper"));
}
about.append(ripper);
about.append("</li>");
}
about.append("</ul>");
} catch (Exception e) {
LOGGER.warn(e.getMessage());
aboutContent.append("- ").append(ripper).append("\n");
}
about.append("Do you want to visit the project homepage on Github?");
about.append("</html>");
int response = JOptionPane.showConfirmDialog(null, about.toString(), mainFrame.getTitle(),
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 {
@@ -1175,6 +1179,9 @@ public final class MainWindow implements Runnable, RipStatusHandler {
LOGGER.error("Exception while opening project home page", e);
}
}
} catch (Exception e) {
LOGGER.warn(e.getMessage());
}
});
MenuItem trayMenuExit = new MenuItem(Utils.getLocalizedString("tray.exit"));