Added crowding information

This commit is contained in:
Lenni0451 2024-11-18 21:09:01 +01:00
parent a5fd1de977
commit cf314b2308
No known key found for this signature in database
GPG Key ID: 5D59B86635AD3F2F
6 changed files with 52 additions and 20 deletions

View File

@ -0,0 +1,40 @@
/*
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
* Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.viaproxy.ui.elements;
import net.raphimc.viaproxy.ui.ViaProxyWindow;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class LinkLabel extends JLabel {
public LinkLabel(final String text, final String url) {
super("<html><a href=\"\">" + text + "</a></html>");
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
ViaProxyWindow.openURL(url);
}
});
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
}

View File

@ -30,6 +30,7 @@ import net.raphimc.viaproxy.saves.impl.accounts.ClassicAccount;
import net.raphimc.viaproxy.ui.I18n;
import net.raphimc.viaproxy.ui.UITab;
import net.raphimc.viaproxy.ui.ViaProxyWindow;
import net.raphimc.viaproxy.ui.elements.LinkLabel;
import net.raphimc.viaproxy.ui.events.UICloseEvent;
import net.raphimc.viaproxy.util.AddressUtil;
import net.raphimc.viaproxy.util.logging.Logger;
@ -38,8 +39,6 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
@ -77,14 +76,7 @@ public class GeneralTab extends UITab {
JPanel header = new JPanel();
header.setLayout(new GridBagLayout());
JLabel discord = new JLabel("<html><a href=\"\">Discord</a></html>");
discord.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
ViaProxyWindow.openURL("https://discord.gg/viaversion");
}
});
discord.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
LinkLabel discord = new LinkLabel("Discord", "https://discord.gg/viaversion");
GBC.create(header).grid(0, 0).width(0).insets(BORDER_PADDING, BORDER_PADDING, 0, 0).anchor(GBC.NORTHWEST).add(discord);
JLabel title = new JLabel("ViaProxy");

View File

@ -21,12 +21,14 @@ import net.lenni0451.commons.swing.GBC;
import net.raphimc.viaproxy.ui.I18n;
import net.raphimc.viaproxy.ui.UITab;
import net.raphimc.viaproxy.ui.ViaProxyWindow;
import net.raphimc.viaproxy.ui.elements.LinkLabel;
import net.raphimc.viaproxy.util.JarUtil;
import net.raphimc.viaproxy.util.logging.Logger;
import javax.swing.*;
import java.awt.*;
import static net.raphimc.viaproxy.ui.ViaProxyWindow.BODY_BLOCK_PADDING;
import static net.raphimc.viaproxy.ui.ViaProxyWindow.BORDER_PADDING;
public class UISettingsTab extends UITab {
@ -72,6 +74,8 @@ public class UISettingsTab extends UITab {
});
GBC.create(body).grid(0, gridy++).weightx(1).insets(0, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(language);
}
GBC.create(body).grid(0, gridy++).weightx(1).insets(BODY_BLOCK_PADDING, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(new JLabel("<html>" + I18n.get("tab.ui_settings.crowdin.info") + "</html>"));
GBC.create(body).grid(0, gridy++).weightx(1).insets(0, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(new LinkLabel(I18n.get("tab.ui_settings.crowdin.link"), "https://crowdin.com/project/viaproxy"));
contentPane.setLayout(new BorderLayout());
contentPane.add(body, BorderLayout.NORTH);

View File

@ -21,11 +21,10 @@ import net.lenni0451.commons.swing.GBC;
import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCode;
import net.raphimc.viaproxy.ui.I18n;
import net.raphimc.viaproxy.ui.ViaProxyWindow;
import net.raphimc.viaproxy.ui.elements.LinkLabel;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.function.Consumer;
@ -72,14 +71,7 @@ public class AddAccountPopup extends JDialog {
JLabel browserLabel = new JLabel("<html><p>" + I18n.get("popup.login_account.instructions.browser") + "</p></html>");
GBC.create(contentPane).grid(0, 0).weightx(1).insets(BORDER_PADDING, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(browserLabel);
JLabel urlLabel = new JLabel("<html><a href=\"\">" + this.deviceCode.getDirectVerificationUri() + "</a></html>");
urlLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
ViaProxyWindow.openURL(AddAccountPopup.this.deviceCode.getDirectVerificationUri());
}
});
GBC.create(contentPane).grid(0, 1).weightx(1).insets(0, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(urlLabel);
GBC.create(contentPane).grid(0, 1).weightx(1).insets(0, BORDER_PADDING, 0, BORDER_PADDING).fill(GBC.HORIZONTAL).add(new LinkLabel(this.deviceCode.getDirectVerificationUri(), AddAccountPopup.this.deviceCode.getDirectVerificationUri()));
JLabel closeInfo = new JLabel("<html><p>" + I18n.get("popup.login_account.instructions.close") + "</p></html>");
GBC.create(contentPane).grid(0, 2).weightx(1).insets(BODY_BLOCK_PADDING, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING).fill(GBC.HORIZONTAL).add(closeInfo);

View File

@ -95,3 +95,5 @@ popup.download.title=Lade herunter...
popup.update.info=Du verwendest eine alte Version von ViaProxy!\nAktuelle Version: %s\nNeueste Version: %s
popup.update.question=Möchtest du aktualisieren?
popup.update.success=Die neueste Version wurde heruntergeladen. ViaProxy startet jetzt neu!
tab.ui_settings.crowdin.info=Fehlt deine Sprache oder ist sie unvollständig? Hilf uns ViaProxy auf Crowdin zu übersetzen!
tab.ui_settings.crowdin.link=Klick hier um Crowdin zu öffnen

View File

@ -95,3 +95,5 @@ popup.download.title=Downloading...
popup.update.info=You are running an outdated version of ViaProxy!\nCurrent version: %s\nLatest version: %s
popup.update.question=Do you want to update?
popup.update.success=Downloaded the latest version of ViaProxy. ViaProxy will now restart!
tab.ui_settings.crowdin.info=Is your language missing or incomplete? Help us to translate ViaProxy on Crowdin!
tab.ui_settings.crowdin.link=Click here to go to Crowdin