Skip to content

Commit

Permalink
Updated to v0.15-b8.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jun 20, 2021
2 parents 89dbf2a + 576822e commit 4e89482
Show file tree
Hide file tree
Showing 26 changed files with 212 additions and 46 deletions.
1 change: 1 addition & 0 deletions src/chatty/Chatty.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public static void main(String[] args) {
});

LogUtil.startMemoryUsageLogging();
LogUtil.startEdtLockDetection();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/chatty/SettingsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public void defineSettings() {
settings.addBoolean("ffzModIcon", true);
settings.addBoolean("bttvEmotes", true);
settings.addBoolean("showAnimatedEmotes", true);
settings.addBoolean("animatedEmotes", true);
settings.addList("ignoredEmotes", new ArrayList(), Setting.STRING);
settings.addList("favoriteEmotes", new ArrayList(), Setting.LIST);

Expand Down Expand Up @@ -622,7 +623,7 @@ public void defineSettings() {
settings.addBoolean("repeatMsg", false);
settings.addLong("repeatMsgSim", 80);
settings.addLong("repeatMsgRep", 2);
settings.addLong("repeatMsgLen", 20);
settings.addLong("repeatMsgLen", 0);
settings.addLong("repeatMsgTime", 3600);
settings.addLong("repeatMsgMethod", 1);
settings.addString("repeatMsgIgnored", "");
Expand Down
13 changes: 13 additions & 0 deletions src/chatty/TwitchClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;

Expand Down Expand Up @@ -1735,6 +1736,18 @@ public void run() {
ImageCache.deleteExpiredFiles();
} else if (command.equals("sha1")) {
g.printSystem(ImageCache.sha1(parameter));
} else if (command.equals("letstakeabreak")) {
try {
Thread.sleep(Integer.parseInt(parameter));
}
catch (InterruptedException ex) {
Logger.getLogger(TwitchClient.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (command.equals("infiniteloop")) {
while (true) {
}
} else if (command.equals("threadinfo")) {
LogUtil.logThreadInfo();
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/chatty/gui/MainGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ private void loadSettingsInternal() {
streamChat.setMessageTimeout((int)client.settings.getLong("streamChatMessageTimeout"));

emotesDialog.setEmoteScale((int)client.settings.getLong("emoteScaleDialog"));
emotesDialog.setEmoteImageType(Emoticon.makeImageType(client.settings.getBoolean("animatedEmotes")));
emotesDialog.setHiddenEmotesets(client.settings.getList("emoteHiddenSets"));
emotesDialog.setCloseOnDoubleClick(client.settings.getBoolean("closeEmoteDialogOnDoubleClick"));

Expand Down Expand Up @@ -2688,7 +2689,7 @@ else if (!Helper.isValidStream(username)) {
String[] split = args.split(" ", 2);
if (split.length == 2) {
command = split[0];
if (split[1].startsWith("-")) {
if (split[1].startsWith("-") && command.equals("load")) {
String[] optionsSplit = split[1].split(" ");
if (optionsSplit.length == 2) {
if (!optionsSplit[0].equals("--")) {
Expand Down Expand Up @@ -4897,6 +4898,8 @@ private void settingChangedInternal(String setting, int type, Object value) {
tokenDialog.setForeignToken(bool);
} else if (setting.equals("completionEnabled")) {
channels.setCompletionEnabled(bool);
} else if (setting.equals("animatedEmotes")) {
emotesDialog.setEmoteImageType(Emoticon.makeImageType(bool));
}
if (setting.startsWith("title") || setting.equals("tabsChanTitles")) {
updateState(true);
Expand Down
4 changes: 3 additions & 1 deletion src/chatty/gui/StyleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class StyleManager implements StyleServer {
"inputFont","emoteScale", "emoteMaxHeight", "botBadgeEnabled",
"filterCombiningCharacters", "pauseChatOnMouseMove",
"pauseChatOnMouseMoveCtrlRequired", "showAnimatedEmotes",
"animatedEmotes",
"banReasonAppended", "banDurationAppended",
"banDurationMessage", "banReasonMessage", "displayNamesMode",
"paragraphSpacing", "bufferSizes", "userlistFont",
Expand Down Expand Up @@ -219,7 +220,8 @@ private void makeStyles() {
addLongSetting(Setting.FILTER_COMBINING_CHARACTERS, "filterCombiningCharacters");
addBooleanSetting(Setting.PAUSE_ON_MOUSEMOVE, "pauseChatOnMouseMove");
addBooleanSetting(Setting.PAUSE_ON_MOUSEMOVE_CTRL_REQUIRED, "pauseChatOnMouseMoveCtrlRequired");
addBooleanSetting(Setting.EMOTICONS_SHOW_ANIMATED, "showAnimatedEmotes");
addBooleanSetting(Setting.EMOTICONS_BTTV_SHOW_ANIMATED, "showAnimatedEmotes");
addBooleanSetting(Setting.EMOTICONS_ANIMATED, "animatedEmotes");
addLongSetting(Setting.USERCOLOR_BACKGROUND, "nickColorBackground");
addLongSetting(Setting.BOTTOM_MARGIN, "bottomMargin");
addLongSetting(Setting.MENTIONS, "mentions");
Expand Down
5 changes: 4 additions & 1 deletion src/chatty/gui/components/ChannelCompletion.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import chatty.gui.MainGui;
import chatty.util.StringUtil;
import chatty.util.api.Emoticon;
import chatty.util.api.Emoticon.ImageType;
import chatty.util.api.Emoticons;
import chatty.util.settings.Settings;
import chatty.util.ForkUtil;
Expand Down Expand Up @@ -88,6 +89,7 @@ private String rus(String str) {

private Font currentFont;
private int currentEmoteScaling;
private ImageType currentEmoteImageType;

private Settings settings() {
return main.getSettings();
Expand All @@ -104,6 +106,7 @@ private void updateSettings() {
currentFont = input.getFont();
updateSizeSettings();
}
currentEmoteImageType = Emoticon.makeImageType(main.getSettings().getBoolean("animatedEmotes"));
}

private void updateSizeSettings() {
Expand Down Expand Up @@ -281,7 +284,7 @@ private CompletionItem createEmoteItem(String code, String info, Emoticon emote)
return new CompletionItem(code, info) {
public ImageIcon getImage(Component c) {
float scale = (float)(currentEmoteScaling / 100.0);
ImageIcon icon = emote.getIcon(scale, 0, new Emoticon.EmoticonUser() {
ImageIcon icon = emote.getIcon(scale, 0, currentEmoteImageType, new Emoticon.EmoticonUser() {

@Override
public void iconLoaded(Image oldImage, Image newImage, boolean sizeChanged) {
Expand Down
17 changes: 13 additions & 4 deletions src/chatty/gui/components/EmotesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import chatty.util.api.Emoticon;
import chatty.util.api.Emoticon.EmoticonImage;
import chatty.util.api.Emoticon.EmoticonUser;
import chatty.util.api.Emoticon.ImageType;
import chatty.util.api.Emoticons;
import chatty.util.colors.ColorCorrection;
import chatty.util.colors.ColorCorrectionNew;
Expand Down Expand Up @@ -135,6 +136,7 @@ public class EmotesDialog extends JDialog {
private String tempStream;
private Emoticon detailsEmote;
private float scale;
private ImageType imageType = ImageType.ANIMATED_DARK;
private boolean closeOnDoubleClick = true;
private boolean userEmotesAccess;
private final Set<String> hiddenEmotesets = new HashSet<>();
Expand Down Expand Up @@ -464,6 +466,13 @@ public void setEmoteScale(int percentage) {
}
}

public void setEmoteImageType(ImageType imageType) {
if (this.imageType != imageType) {
this.imageType = imageType;
update();
}
}

/**
* Set emotesets for hidden sections. Does not update already loaded pages.
*
Expand Down Expand Up @@ -572,10 +581,10 @@ private static class EmoteLabel extends JLabel {
public final boolean noInsert;

public EmoteLabel(Emoticon emote, MouseListener mouseListener, float scale,
EmoticonUser emoteUser) {
ImageType imageType, EmoticonUser emoteUser) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
addMouseListener(mouseListener);
EmoticonImage emoteImage = emote.getIcon(scale, 0, emoteUser);
EmoticonImage emoteImage = emote.getIcon(scale, 0, imageType, emoteUser);
this.code = emote.code;
this.emote = emoteImage;
setIcon(emoteImage.getImageIcon());
Expand Down Expand Up @@ -872,7 +881,7 @@ void addEmotesPanel(Collection<Emoticon> emotes) {
panel.add(makeSeparator());
}
prevEmoteset = emote.emoteset;
panel.add(new EmoteLabel(emote, mouseListener, scale, emoteUser));
panel.add(new EmoteLabel(emote, mouseListener, scale, imageType, emoteUser));
}
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = EMOTE_INSETS;
Expand Down Expand Up @@ -1507,7 +1516,7 @@ private void addScaledEmote(Emoticon emote, JPanel panel, float scale,
String label) {
lgbc.anchor = GridBagConstraints.CENTER;
lgbc.gridy = 0;
panel.add(new EmoteLabel(emote, mouseListener, scale, emoteUser), lgbc);
panel.add(new EmoteLabel(emote, mouseListener, scale, imageType, emoteUser), lgbc);

lgbc.gridy = 1;
JLabel title = new JLabel(label);
Expand Down
11 changes: 7 additions & 4 deletions src/chatty/gui/components/help/help-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ <h3>Startup</h3>
Channel Favorites/History dialog.</dd>
</dl>

<div class="moreInfo">More information: <a href="help.html#layouts">Layouts and Tabs</a></div>

<h3>Directory</h3>
<div class="moreInfo">More information: <a href="help-guide_folders.html">Settings and other files</a></div>

Expand Down Expand Up @@ -710,10 +712,9 @@ <h3><a name="RepeatMsg">Repeated Chat Message Detection</a></h3>
can be used in e.g. the Highlight list, Message Colors list or to restrict a Notification to trigger only on repeated messages.</p>

<p>Restricting detection uses <a href="#Highlight">Highlight Matching</a>,
so <code>!status:M</code> can be used to exclude mods, but a lot more
could be used, for example <code>mystatus:M</code> to restrict to
channels you are a mod in or <code>reg:.{10,}</code> to only check
for messages at least 10 characters long.</p>
for example <code>!status:M</code> to exclude mods or <code>mystatus:M</code>
to restrict to channels you are a mod in or even matching on the message
text.</p>

<p>Note that this feature may affect performance in very busy chats, since each
received message has to be compared against multiple messages (depending
Expand Down Expand Up @@ -1553,6 +1554,8 @@ <h2>
<a name="Tabs">Tabs</a>
<a href="#top" class="top">[back to menu]</a>
</h2>
<div class="moreInfo">See also: <a href="help.html#layouts">Layouts and Tabs</a></div>

<dl class="dl-settings">
<dt>Tab Order</dt>
<dd>Whether to show tabs in the order they were opened or alphabetically.</dd>
Expand Down
2 changes: 1 addition & 1 deletion src/chatty/gui/components/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1><a name="top">Chatty (Version: 0.15-b7)</a></h1>
<h1><a name="top">Chatty (Version: 0.15-b8)</a></h1>
<table>
<tr>
<td valign="top">
Expand Down
6 changes: 6 additions & 0 deletions src/chatty/gui/components/settings/EmoteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ protected EmoteSettings(SettingsDialog d) {
main.add(cheersType,
d.makeGbc(1, 6, 2, 1, GridBagConstraints.WEST));

//--------------------------
// Animated
//--------------------------
main.add(d.addSimpleBooleanSetting("animatedEmotes"),
d.makeGbc(0, 7, 3, 1, GridBagConstraints.WEST));

//==========
// FFZ/BTTV
//==========
Expand Down
8 changes: 4 additions & 4 deletions src/chatty/gui/components/settings/ModerationSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ public ModerationSettings(final SettingsDialog d) {
SettingsUtil.addLabeledComponent(repeatMsgPanel, "repeatMsgTime", 0, 2, 1, GridBagConstraints.EAST,
d.addSimpleLongSetting("repeatMsgTime", 4, true));

SettingsUtil.addLabeledComponent(repeatMsgPanel, "repeatMsgLen", 0, 3, 1, GridBagConstraints.EAST,
d.addSimpleLongSetting("repeatMsgLen", 4, true));

JTextField ignoredChars = d.addSimpleStringSetting("repeatMsgIgnored", 4, true);
((AbstractDocument) ignoredChars.getDocument()).setDocumentFilter(TestSimilarity.IGNORED_CHARS_FILTER);
SettingsUtil.addLabeledComponent(repeatMsgPanel, "repeatMsgIgnored", 0, 4, 1, GridBagConstraints.EAST,
SettingsUtil.addLabeledComponent(repeatMsgPanel, "repeatMsgIgnored", 0, 3, 1, GridBagConstraints.EAST,
ignoredChars);

SettingsUtil.addLabeledComponent(repeatMsgPanel, "repeatMsgLen", 0, 4, 1, GridBagConstraints.EAST,
d.addSimpleLongSetting("repeatMsgLen", 4, true));

EditorStringSetting editor = d.addEditorStringSetting("repeatMsgMatch", 10, true, "Restrict detection", false, SettingConstants.HTML_PREFIX+SettingsUtil.getInfo("info-restriction-repeat.html", null));
editor.setShowInfoByDefault(true);
editor.setLinkLabelListener(d.getLinkLabelListener());
Expand Down
2 changes: 1 addition & 1 deletion src/chatty/gui/components/settings/SettingConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public class SettingConstants {
requirementOptions.put("always", "Always");
}

protected static final String HTML_PREFIX = "<html><body style='width:300px;'>";
protected static final String HTML_PREFIX = "<html><body style='width:320px;'>";

}
2 changes: 1 addition & 1 deletion src/chatty/gui/components/settings/TabSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public TabSettings(final SettingsDialog d) {
orderPanel.add(d.addSimpleBooleanSetting("tabsAutoSort"),
SettingsDialog.makeGbc(0, 6, 2, 1, GridBagConstraints.WEST));

orderPanel.add(new JLabel(SettingConstants.HTML_PREFIX+"Tab order applies when opening new tabs and when tabs are resorted. Tabs can always be moved manually via drag and drop, however they may not keep their position when reopened or resorted."),
orderPanel.add(new JLabel(SettingConstants.HTML_PREFIX+"Tab order applies when opening new tabs and when tabs are resorted. Tabs can always be moved manually via drag&amp;drop, however they may not keep their position when reopened or resorted."),
SettingsDialog.makeGbc(0, 10, 2, 1, GridBagConstraints.CENTER));

//--------------------------
Expand Down
17 changes: 12 additions & 5 deletions src/chatty/gui/components/textpane/ChannelTextPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import chatty.util.api.Emoticon;
import chatty.util.api.Emoticon.EmoticonImage;
import chatty.util.api.Emoticon.EmoticonUser;
import chatty.util.api.Emoticon.ImageType;
import chatty.util.api.Emoticons;
import chatty.util.api.Emoticons.TagEmotes;
import chatty.util.api.pubsub.ModeratorActionData;
Expand Down Expand Up @@ -168,7 +169,8 @@ public enum Setting {
ACTION_COLORED, LINKS_CUSTOM_COLOR, BUFFER_SIZE, AUTO_SCROLL_TIME,
EMOTICON_MAX_HEIGHT, EMOTICON_SCALE_FACTOR, BOT_BADGE_ENABLED,
FILTER_COMBINING_CHARACTERS, PAUSE_ON_MOUSEMOVE,
PAUSE_ON_MOUSEMOVE_CTRL_REQUIRED, EMOTICONS_SHOW_ANIMATED,
PAUSE_ON_MOUSEMOVE_CTRL_REQUIRED, EMOTICONS_BTTV_SHOW_ANIMATED,
EMOTICONS_ANIMATED,
SHOW_TOOLTIPS, SHOW_TOOLTIP_IMAGES, BOTTOM_MARGIN,

DISPLAY_NAMES_MODE,
Expand Down Expand Up @@ -2736,7 +2738,7 @@ private void addTwitchTagsEmoticons(User user, Map<String, Emoticon> emoticons,
* Add emote from message alone
*/
String code = text.substring(start, end+1);
String url = Emoticon.getTwitchEmoteUrlById(id, 1);
String url = Emoticon.getTwitchEmoteUrlById(id, 1, styles.emoticonImageType());
Emoticon.Builder b = new Emoticon.Builder(
Emoticon.Type.TWITCH, code, url);
b.setStringId(id);
Expand Down Expand Up @@ -2782,7 +2784,7 @@ private void findEmoticons(User user, Set<Emoticon> emoticons, String text,
continue;
}
if (emoticon.isAnimated()
&& !styles.isEnabled(Setting.EMOTICONS_SHOW_ANIMATED)) {
&& !styles.isEnabled(Setting.EMOTICONS_BTTV_SHOW_ANIMATED)) {
continue;
}
Matcher m = emoticon.getMatcher(text);
Expand Down Expand Up @@ -3673,7 +3675,8 @@ private void setSettings() {
addSetting(Setting.BOT_BADGE_ENABLED, true);
addSetting(Setting.PAUSE_ON_MOUSEMOVE, true);
addSetting(Setting.PAUSE_ON_MOUSEMOVE_CTRL_REQUIRED, false);
addSetting(Setting.EMOTICONS_SHOW_ANIMATED, false);
addSetting(Setting.EMOTICONS_BTTV_SHOW_ANIMATED, false);
addSetting(Setting.EMOTICONS_ANIMATED, false);
addSetting(Setting.SHOW_TOOLTIPS, true);
addSetting(Setting.SHOW_TOOLTIP_IMAGES, true);
addSetting(Setting.LINKS_CUSTOM_COLOR, true);
Expand Down Expand Up @@ -4118,7 +4121,7 @@ public MutableAttributeSet emoticon(Emoticon emoticon) {
// Does this need any other attributes e.g. standard?
SimpleAttributeSet emoteStyle = new SimpleAttributeSet();
EmoticonImage emoteImage = emoticon.getIcon(
emoticonScaleFactor(), emoticonMaxHeight(), ChannelTextPane.this);
emoticonScaleFactor(), emoticonMaxHeight(), emoticonImageType(), ChannelTextPane.this);
StyleConstants.setIcon(emoteStyle, emoteImage.getImageIcon());

emoteStyle.addAttribute(Attribute.EMOTICON, emoteImage);
Expand All @@ -4127,6 +4130,10 @@ public MutableAttributeSet emoticon(Emoticon emoticon) {
return emoteStyle;
}

public ImageType emoticonImageType() {
return Emoticon.makeImageType(isEnabled(Setting.EMOTICONS_ANIMATED));
}

public SimpleDateFormat timestampFormat() {
return timestampFormat;
}
Expand Down
3 changes: 2 additions & 1 deletion src/chatty/gui/components/textpane/LinkController.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import chatty.util.TwitchEmotesApi.EmotesetInfo;
import chatty.util.api.Emoticon;
import chatty.util.api.Emoticon.EmoticonImage;
import chatty.util.api.Emoticon.ImageType;
import chatty.util.api.Emoticons;
import chatty.util.api.usericons.Usericon;
import java.awt.Color;
Expand Down Expand Up @@ -845,7 +846,7 @@ private static String makeEmoticonPopupText2(EmoticonImage emoticonImage, boolea
}

if (showImage && !emote.isAnimated()) {
EmoticonImage icon = emote.getIcon(2, 0, (o,n,c) -> {
EmoticonImage icon = emote.getIcon(2, 0, ImageType.STATIC, (o,n,c) -> {
// The set ImageIcon will have been updated
popup.forceUpdate();
});
Expand Down
2 changes: 1 addition & 1 deletion src/chatty/gui/components/userinfo/UserInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ public void show(Component owner, User user, String msgId, String autoModMsgId,
banReasons.reset();
singleMessage.setSelected(false);
setUser(user, msgId, autoModMsgId, localUsername);
closeButton.requestFocusInWindow();
setVisible(true);
closeButton.requestFocusInWindow();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/chatty/lang/Strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ settings.emoticons.cheers = Cheers (Bits):
settings.emoticons.cheers.option.text = Text Only
settings.emoticons.cheers.option.static = Static Images
settings.emoticons.cheers.option.animated = Animated
settings.boolean.animatedEmotes = Emote Animations
settings.boolean.animatedEmotes.tip = Show animations for animated emotes, otherwise a static image is shown instead (for now, this only applies to Twitch's Animated Emotes). Changing this only affects new lines.

!-- Third-Party Emoticons --!
settings.section.3rdPartyEmotes = Third-Party Emoticons
Expand Down
Loading

0 comments on commit 4e89482

Please sign in to comment.