Skip to content

Commit 9ea61f0

Browse files
authored
Merge b5dedc9 into 32b70a6
2 parents 32b70a6 + b5dedc9 commit 9ea61f0

File tree

1 file changed

+42
-35
lines changed

1 file changed

+42
-35
lines changed

src/main/java/com/rarchives/ripme/ui/MainWindow.java

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,55 +1125,62 @@ public void windowIconified(WindowEvent e) {
11251125
trayMenuMain.addActionListener(arg0 -> toggleTrayClick());
11261126
MenuItem trayMenuAbout = new MenuItem("About " + mainFrame.getTitle());
11271127
trayMenuAbout.addActionListener(arg0 -> {
1128-
StringBuilder about = new StringBuilder();
1129-
1130-
about.append("<html><h1>").append(mainFrame.getTitle()).append("</h1>");
1131-
about.append("Download albums from various websites:");
11321128
try {
1133-
List<String> rippers = Utils.getListOfAlbumRippers();
1134-
about.append("<ul>");
1135-
for (String ripper : rippers) {
1136-
about.append("<li>");
1129+
List<String> albumRippers = Utils.getListOfAlbumRippers();
1130+
List<String> videoRippers = Utils.getListOfVideoRippers();
1131+
1132+
JTextArea aboutTextArea = new JTextArea();
1133+
aboutTextArea.setEditable(false);
1134+
aboutTextArea.setLineWrap(true);
1135+
aboutTextArea.setWrapStyleWord(true);
1136+
1137+
JScrollPane scrollPane = new JScrollPane(aboutTextArea);
1138+
scrollPane.setPreferredSize(new Dimension(400, 300));
1139+
1140+
StringBuilder aboutContent = new StringBuilder();
1141+
aboutContent.append("Download albums from various websites:\n");
1142+
for (String ripper : albumRippers) {
11371143
ripper = ripper.substring(ripper.lastIndexOf('.') + 1);
11381144
if (ripper.contains("Ripper")) {
11391145
ripper = ripper.substring(0, ripper.indexOf("Ripper"));
11401146
}
1141-
about.append(ripper);
1142-
about.append("</li>");
1147+
aboutContent.append("- ").append(ripper).append("\n");
11431148
}
1144-
about.append("</ul>");
1145-
} catch (Exception e) {
1146-
LOGGER.warn(e.getMessage());
1147-
}
11481149

1149-
about.append("<br>And download videos from video sites:");
1150-
try {
1151-
List<String> rippers = Utils.getListOfVideoRippers();
1152-
about.append("<ul>");
1153-
for (String ripper : rippers) {
1154-
about.append("<li>");
1150+
aboutContent.append("\nDownload videos from video sites:\n");
1151+
for (String ripper : videoRippers) {
11551152
ripper = ripper.substring(ripper.lastIndexOf('.') + 1);
11561153
if (ripper.contains("Ripper")) {
11571154
ripper = ripper.substring(0, ripper.indexOf("Ripper"));
11581155
}
1159-
about.append(ripper);
1160-
about.append("</li>");
1156+
aboutContent.append("- ").append(ripper).append("\n");
11611157
}
1162-
about.append("</ul>");
1163-
} catch (Exception e) {
1164-
LOGGER.warn(e.getMessage());
1165-
}
11661158

1167-
about.append("Do you want to visit the project homepage on Github?");
1168-
about.append("</html>");
1169-
int response = JOptionPane.showConfirmDialog(null, about.toString(), mainFrame.getTitle(),
1170-
JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon));
1171-
if (response == JOptionPane.YES_OPTION) {
1172-
try {
1173-
Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme"));
1174-
} catch (IOException e) {
1175-
LOGGER.error("Exception while opening project home page", e);
1159+
aboutTextArea.setText(aboutContent.toString());
1160+
1161+
// Ensure the scroll pane starts at the top
1162+
SwingUtilities.invokeLater(() -> scrollPane.getVerticalScrollBar().setValue(0));
1163+
1164+
JPanel aboutPanel = new JPanel(new BorderLayout());
1165+
JLabel titleLabel = new JLabel("Download albums and videos from various websites", JLabel.CENTER);
1166+
titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 16));
1167+
aboutPanel.add(titleLabel, BorderLayout.NORTH);
1168+
aboutPanel.add(scrollPane, BorderLayout.CENTER);
1169+
1170+
JLabel footerLabel = new JLabel("Do you want to visit the project homepage on GitHub?", JLabel.CENTER);
1171+
aboutPanel.add(footerLabel, BorderLayout.SOUTH);
1172+
1173+
int response = JOptionPane.showConfirmDialog(null, aboutPanel, mainFrame.getTitle(),
1174+
JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, new ImageIcon(mainIcon));
1175+
if (response == JOptionPane.YES_OPTION) {
1176+
try {
1177+
Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme"));
1178+
} catch (IOException e) {
1179+
LOGGER.error("Exception while opening project home page", e);
1180+
}
11761181
}
1182+
} catch (Exception e) {
1183+
LOGGER.warn(e.getMessage());
11771184
}
11781185
});
11791186

0 commit comments

Comments
 (0)