Skip to content

Commit

Permalink
Updated to v0.26-b2.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Oct 24, 2023
2 parents bb82611 + 02580df commit 66bc47a
Show file tree
Hide file tree
Showing 39 changed files with 1,119 additions and 201 deletions.
Binary file removed assets/lib/WebPDecoderJN-1.2.jar
Binary file not shown.
Binary file added assets/lib/WebPDecoderJN-1.3.jar
Binary file not shown.
Binary file removed assets/lib/src/WebPDecoderJN-1.2-sources.jar
Binary file not shown.
Binary file added assets/lib/src/WebPDecoderJN-1.3-sources.jar
Binary file not shown.
3 changes: 3 additions & 0 deletions src/chatty/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ public void defineSettings() {
settings.addString("locale", "");
settings.addString("timezone", "");

settings.addBoolean("macScreenMenuBar", true);
settings.addBoolean("macSystemAppearance", true);

settings.addLong("dialogFontSize", -1);

// Chat Appearance
Expand Down
3 changes: 3 additions & 0 deletions src/chatty/TwitchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import chatty.util.ffz.FrankerFaceZListener;
import chatty.util.ImageCache;
import chatty.util.LogUtil;
import chatty.util.MacAwtOptions;
import chatty.util.MiscUtil;
import chatty.util.OtherBadges;
import chatty.util.ProcessManager;
Expand Down Expand Up @@ -256,6 +257,8 @@ public TwitchClient(Map<String, String> args) {
settingsManager.backupFiles();
settingsManager.startAutoSave(this);

MacAwtOptions.setMacLookSettings(settings);

Chatty.setSettings(settings);

Language.setLanguage(settings.getString("language"));
Expand Down
4 changes: 2 additions & 2 deletions src/chatty/gui/Highlighter.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void setUsername(String username) {
usernameItem = null;
}
else {
HighlightItem newItem = new HighlightItem("w:"+username);
HighlightItem newItem = new HighlightItem("w:"+username, "noPresetsUsernameHighlight");
if (!newItem.hasError()) {
usernameItem = newItem;
} else {
Expand Down Expand Up @@ -714,7 +714,7 @@ public HighlightItem(String item, String type, boolean invalidRegexLog, Map<Stri
this.applyPresets = type == null || !type.isEmpty();

Map<String, CustomCommand> presets = getPresets();
if (presets != null && type != null && applyPresets) {
if (presets != null && type != null && !type.startsWith("noPresets") && applyPresets) {
CustomCommand ccf = presets.get("_global_"+type);
ccf = ccf != null ? ccf : presets.get("_global");
if (ccf != null) {
Expand Down
4 changes: 4 additions & 0 deletions src/chatty/gui/MainGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,7 @@ private void loadSettingsInternal() {
if (client.settings.getList("scopes").isEmpty()) {
client.api.checkToken();
}
client.api.getStreamLabels();

localEmotes.init();
emoticons.setLocalEmotes(localEmotes.getData());
Expand Down Expand Up @@ -2050,6 +2051,9 @@ else if (cmd.startsWith("msgColorSource.")) {
else if (cmd.startsWith("routingSource.")) {
getSettingsDialog(s -> s.showSettings("selectRouting", JSONValue.parse(cmd.substring("routingSource.".length()))));
}
else if (cmd.startsWith("notificationSource.")) {
getSettingsDialog(s -> s.showSettings("selectNotification", cmd.substring("notificationSource.".length())));
}
else {
nameBasedStuff(e, channels.getActiveChannel().getStreamName());
}
Expand Down
26 changes: 14 additions & 12 deletions src/chatty/gui/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Consumer;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
Expand Down Expand Up @@ -445,7 +446,7 @@ public void setUpdateNotification(boolean enabled) {

public void setSystemEventCount(int count) {
if (count > 0) {
notifyIcons.addItem("chattyInfo", 0, String.valueOf(count), "warning.png", id -> {
notifyIcons.addItem("chattyInfo", 0, "Events: "+String.valueOf(count), "warning.png", id -> {
actionListener.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "dialog.chattyInfo"));
});
}
Expand All @@ -459,17 +460,17 @@ private class NotifyIcons {
/**
* Associates an item id with a label.
*/
private final Map<String, JLabel> current = new HashMap<>();
private final Map<String, JMenu> current = new HashMap<>();

/**
* Stores the target position for an added label.
*/
private final Map<JLabel, Integer> targetPositions = new HashMap<>();
private final Map<JMenu, Integer> targetPositions = new HashMap<>();

/**
* Stores whether a label is currently flashing.
*/
private final Map<JLabel, Boolean> flashing = new HashMap<>();
private final Map<JMenu, Boolean> flashing = new HashMap<>();

/**
* For aligning to the right.
Expand All @@ -488,24 +489,25 @@ private class NotifyIcons {
* @param consumer Called when a click on this item occurs
*/
public void addItem(String id, int pos, String text, String imageFile, Consumer<String> consumer) {
JLabel label = current.get(id);
JMenu label = current.get(id);
if (label == null) {
label = new JLabel();
label = new JMenu();
int iconSize = label.getFontMetrics(label.getFont()).getHeight();
ImageIcon icon = GuiUtil.getScaledIcon(GuiUtil.getIcon(this, imageFile), iconSize, iconSize);
label.setIcon(icon);
label.setIconTextGap(0);
label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
label.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 4));
label.setToolTipText(Language.getStringNull("menubar.notification."+id));
label.addMouseListener(new MouseAdapter() {


JMenuItem item = new JMenuItem(new AbstractAction(Language.getString("menubar.notification.view")) {
@Override
public void mouseClicked(MouseEvent e) {
public void actionPerformed(ActionEvent e) {
consumer.accept(id);
}

});

label.add(item);
if (current.isEmpty()) {
add(glue);
}
Expand Down Expand Up @@ -546,7 +548,7 @@ private int findInsertionPos(int targetPos) {
*
* @param label
*/
private void flash(JLabel label) {
private void flash(JMenu label) {
Icon icon = label.getIcon();
if (icon != null && !flashing.containsKey(label)) {
flashing.put(label, Boolean.TRUE);
Expand Down Expand Up @@ -577,7 +579,7 @@ private void flash(JLabel label) {
* @param id The item id
*/
public void removeItem(String id) {
JLabel label = current.get(id);
JMenu label = current.get(id);
if (label != null) {
remove(label);
current.remove(id);
Expand Down
18 changes: 9 additions & 9 deletions src/chatty/gui/components/AutoModDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public void actionPerformed(ActionEvent e) {
timer.setRepeats(true);
timer.start();

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("A"), "automod.approve");
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt A"), "automod.approve");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("A"), "automod.approve");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("alt A"), "automod.approve");
list.getActionMap().put("automod.approve", new AbstractAction() {

@Override
Expand All @@ -176,8 +176,8 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("D"), "automod.deny");
list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt D"), "automod.deny");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("D"), "automod.deny");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("alt D"), "automod.deny");
list.getActionMap().put("automod.deny", new AbstractAction() {

@Override
Expand All @@ -186,7 +186,7 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("S"), "automod.next");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("S"), "automod.next");
list.getActionMap().put("automod.next", new AbstractAction() {

@Override
Expand All @@ -195,7 +195,7 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("W"), "automod.previous");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("W"), "automod.previous");
list.getActionMap().put("automod.previous", new AbstractAction() {

@Override
Expand All @@ -204,7 +204,7 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt S"), "automod.nextUnhandled");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("alt S"), "automod.nextUnhandled");
list.getActionMap().put("automod.nextUnhandled", new AbstractAction() {

@Override
Expand All @@ -213,7 +213,7 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt W"), "automod.previousUnhandled");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("alt W"), "automod.previousUnhandled");
list.getActionMap().put("automod.previousUnhandled", new AbstractAction() {

@Override
Expand All @@ -222,7 +222,7 @@ public void actionPerformed(ActionEvent e) {
}
});

list.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("Q"), "automod.close");
list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("Q"), "automod.close");
list.getActionMap().put("automod.close", new AbstractAction() {

@Override
Expand Down
52 changes: 52 additions & 0 deletions src/chatty/gui/components/ScrollPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

package chatty.gui.components;

import java.awt.Dimension;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import javax.swing.JPanel;
import javax.swing.Scrollable;

/**
*
* @author tduva
*/
public class ScrollPanel extends JPanel implements Scrollable {

public ScrollPanel() {

}

public ScrollPanel(LayoutManager layoutManager) {
super(layoutManager);
}

@Override
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}

@Override
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
return 20;
}

@Override
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
return 20;
}

/**
* Still resize horizontally despite this panel being in a scrollpane.
*/
@Override
public boolean getScrollableTracksViewportWidth() {
return true;
}

@Override
public boolean getScrollableTracksViewportHeight() {
return false;
}

}
7 changes: 4 additions & 3 deletions src/chatty/gui/components/admin/AdminDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public void stateChanged(ChangeEvent e) {
}
}
});
tabs.addTab(Language.getString("admin.tab.status"), statusPanel);
JScrollPane statusScroll = new JScrollPane(statusPanel);
tabs.addTab(Language.getString("admin.tab.status"), statusScroll);
tabs.addTab(Language.getString("admin.tab.commercial"), commercialPanel);
tabs.addTab("Blocked Terms", blockedTermsPanel);
gbc = makeGbc(0,0,2,1);
Expand Down Expand Up @@ -343,10 +344,10 @@ private void updateTabTitle() {
private void changeChannel(String channel) {
this.currentChannel = channel;
commercialPanel.changeChannel(channel);
if (tabs.getSelectedComponent() == statusPanel) {
if (tabs.getSelectedIndex() == 0) {
statusPanel.changeChannel(channel);
}
if (tabs.getSelectedComponent() == blockedTermsPanel) {
if (tabs.getSelectedIndex() == 2) {
blockedTermsPanel.changeStream(channel);
}
update();
Expand Down
Loading

0 comments on commit 66bc47a

Please sign in to comment.