From 9b8d7a5e2ba223a8a0ab04b0e3fef0abef26adcb Mon Sep 17 00:00:00 2001 From: Exslims Date: Sat, 15 Apr 2017 20:57:44 +0400 Subject: [PATCH] Chat scanner improvements --- .../platform/core/MercuryConstants.java | 2 +- .../platform/shared/ConfigManager.java | 11 ++- .../platform/shared/UpdateManager.java | 4 +- .../ui/components/ComponentsFactory.java | 3 +- .../panel/chat/ChatMessagePanel.java | 12 +-- .../panel/chat/HtmlMessageBuilder.java | 3 +- .../panel/settings/SoundSettingsPanel.java | 66 +++++++-------- .../panel/settings/SupportPanel.java | 2 +- .../ui/frame/other/SetUpLocationFrame.java | 2 +- .../platform/ui/frame/other/TooltipFrame.java | 2 +- .../titled/AbstractTitledComponentFrame.java | 8 +- .../platform/ui/frame/titled/NotesFrame.java | 2 +- .../ui/frame/titled/chat/ChatFilterFrame.java | 76 +++++++++++++++++- .../titled/chat/ChatFilterSettingsFrame.java | 32 +++++++- .../resources/app/chat_scanner_response.png | Bin 0 -> 1052 bytes app-ui/src/main/resources/app/menu.png | Bin 0 -> 255 bytes app-ui/src/main/resources/app/minimize.png | Bin 0 -> 5133 bytes app-ui/src/main/resources/app/openChat.png | Bin 798 -> 828 bytes 18 files changed, 163 insertions(+), 62 deletions(-) create mode 100644 app-ui/src/main/resources/app/chat_scanner_response.png create mode 100644 app-ui/src/main/resources/app/menu.png create mode 100644 app-ui/src/main/resources/app/minimize.png diff --git a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java index e6522f55..93e1aa94 100644 --- a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java +++ b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java @@ -1,7 +1,7 @@ package com.mercury.platform.core; public class MercuryConstants { - public static final String APP_VERSION = "1.0.1.2"; + public static final String APP_VERSION = "1.0.1.3"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } diff --git a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java index 924618cd..36444741 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java @@ -77,6 +77,8 @@ private static class ConfigManagerHolder { private String dndResponseText = "Response text"; @Getter private String defaultWords = "!wtb, uber, boss, perandus"; + @Getter + private String quickResponse = "invite me pls"; public ConfigManager() { minimumFrameSize = new HashMap<>(); @@ -87,7 +89,7 @@ public ConfigManager() { minimumFrameSize.put("SettingsFrame",new Dimension(540,400)); minimumFrameSize.put("HistoryFrame",new Dimension(280,400)); minimumFrameSize.put("TimerFrame",new Dimension(240,102)); - minimumFrameSize.put("ChatFilterFrame",new Dimension(400,200)); + minimumFrameSize.put("ChatFilterFrame",new Dimension(400,100)); minimumFrameSize.put("ItemsGridFrame",new Dimension(150,150)); minimumFrameSize.put("NotesFrame",new Dimension(540,100)); minimumFrameSize.put("ChatFilterSettingsFrame",new Dimension(300,200)); @@ -113,6 +115,7 @@ public ConfigManager() { defaultAppSettings.put("showLeague",false); defaultAppSettings.put("dndResponseText","Response text"); defaultAppSettings.put("defaultWords","!wtb, uber, boss, perandus"); + defaultAppSettings.put("quickResponse","invite me pls"); } @@ -157,6 +160,7 @@ public void load() { saveProperty("inGameDnd", String.valueOf(defaultAppSettings.get("inGameDnd"))); saveProperty("dndResponseText", defaultAppSettings.get("dndResponseText")); saveProperty("defaultWords", defaultAppSettings.get("defaultWords")); + saveProperty("quickResponse", defaultAppSettings.get("quickResponse")); saveProperty("scaleData", defaultAppSettings.get("scaleData")); saveProperty("showLeague", String.valueOf(defaultAppSettings.get("showLeague"))); @@ -218,6 +222,7 @@ private void loadConfigFile(){ showLeague = Boolean.valueOf(loadProperty("showLeague")); dndResponseText = loadProperty("dndResponseText"); defaultWords = loadProperty("defaultWords"); + quickResponse = loadProperty("quickResponse"); } catch (Exception e) { logger.error("Error in loadConfigFile: ",e); } @@ -465,6 +470,10 @@ public void setDefaultWords(String defaultWords) { this.defaultWords = defaultWords; saveProperty("defaultWords",defaultWords); } + public void setQuickResponse(String quickResponse) { + this.quickResponse = quickResponse; + saveProperty("quickResponse",quickResponse); + } private List getDefaultButtons(){ List defaultButtons = new ArrayList<>(); diff --git a/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java b/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java index 4cc6f42c..c06d0100 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/UpdateManager.java @@ -6,9 +6,6 @@ import java.io.File; -/** - * Created by Константин on 21.02.2017. - */ public class UpdateManager { private final static Logger logger = LogManager.getLogger(UpdateManager.class.getSimpleName()); private final static String LOCAL_UPDATER_PATH = System.getenv("USERPROFILE") + "\\AppData\\Local\\MercuryTrade\\local-updater.jar"; @@ -19,6 +16,7 @@ public void doUpdate(){ logger.debug("Execute local updater, source path: {}",path); if(new File(JAR_FILE_PATH).exists()) { Runtime.getRuntime().exec("java -jar " + LOCAL_UPDATER_PATH + " " + "\"" + path + "\""); + System.exit(0); } } catch (Exception e1) { logger.error("Error while execute local-updater: ", e1); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java index 9c8aee14..c10ea946 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java @@ -376,6 +376,7 @@ public JTextField getTextField(String text, FontStyle style, float fontSize){ textField.setFont(getSelectedFont(style).deriveFont(scale*fontSize)); } textField.setForeground(AppThemeColor.TEXT_DEFAULT); + textField.setCaretColor(AppThemeColor.TEXT_DEFAULT); textField.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(AppThemeColor.TEXT_DEFAULT,1), BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT,3) @@ -541,7 +542,7 @@ public ImageIcon getImage(String iconPath){ public Dimension convertSize(Dimension initialSize){ return new Dimension((int)(initialSize.width * scale),(int)(initialSize.height*scale)); } - public JTextArea getSimpleTextAre(String text){ + public JTextArea getSimpleTextArea(String text){ JTextArea area = new JTextArea(text); area.setEditable(false); area.setWrapStyleWord(true); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java index 870c2f3d..a180d948 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/ChatMessagePanel.java @@ -1,6 +1,6 @@ package com.mercury.platform.ui.components.panel.chat; -import com.mercury.platform.shared.events.EventRouter; +import com.mercury.platform.shared.ConfigManager; import com.mercury.platform.shared.store.MercuryStore; import com.mercury.platform.ui.components.ComponentsFactory; import com.mercury.platform.ui.components.fields.font.FontStyle; @@ -45,12 +45,12 @@ public void createUI() { JPanel miscPanel = componentsFactory.getTransparentPanel(new BorderLayout()); JPanel operationsPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); - JButton invite = componentsFactory.getIconButton("app/invite.png", 16, AppThemeColor.SLIDE_BG, TooltipConstants.INVITE); - invite.addMouseListener(new MouseAdapter() { + JButton quickResponse = componentsFactory.getIconButton("app/chat_scanner_response.png", 17, AppThemeColor.SLIDE_BG, "Quick response"); + quickResponse.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if(SwingUtilities.isLeftMouseButton(e)) { - MercuryStore.INSTANCE.chatCommandSubject.onNext("/invite " + nickName); + MercuryStore.INSTANCE.chatCommandSubject.onNext("@" + nickName + " " + ConfigManager.INSTANCE.getQuickResponse()); } } }); @@ -73,9 +73,9 @@ public void mousePressed(MouseEvent e) { nickName); nicknameLabel.setPreferredSize(new Dimension(75,nicknameLabel.getPreferredSize().height)); nicknameLabel.setBorder(null); - invite.setBorder(null); + quickResponse.setBorder(null); openChat.setBorder(null); - operationsPanel.add(invite); + operationsPanel.add(quickResponse); operationsPanel.add(openChat); JPanel nicknamePanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java index defe315c..2ab32b73 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/chat/HtmlMessageBuilder.java @@ -17,11 +17,10 @@ public HtmlMessageBuilder() { * @param message source message * @return html equivalent */ - //RED - Navy public String build(String message) { List resultStrs = new ArrayList<>(); resultStrs.add(""); - String[] words = message.split("((?<= )|(?= )|(?<=\\.)|(?=\\.)|(?<=,)|(?<=\\?)|(?=\\?)|(?=,)|(?<=!)|(?=!)|(?<=/)|(?=/)|(?<=>)|(?=>))"); + String[] words = message.split("((?<=\\s)|(?=\\s)|(?<=\\.)|(?=\\.)|(?<=,)|(?<=\\?)|(?=\\?)|(?=,)|(?<=!)|(?=!)|(?<=/)|(?=/)|(?<=>)|(?=>))"); Arrays.stream(words).forEach(word -> { if(chunkStrings.stream().noneMatch(word::equalsIgnoreCase)){ resultStrs.add(word); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java index ae553a7f..005d5682 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SoundSettingsPanel.java @@ -116,45 +116,45 @@ public void mouseReleased(MouseEvent e) { private JPanel getSoundPickerPanel(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); - JLabel soundLabel = componentsFactory.getTextLabel(FontStyle.REGULAR, AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP, 17f, "Sound"); + JLabel soundLabel = componentsFactory.getTextLabel(FontStyle.REGULAR, AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP, 17f, "Sound (in next update)"); soundLabel.setBorder( new CompoundBorder( BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), BorderFactory.createEmptyBorder(3,5,3,5))); - JPanel container = componentsFactory.getTransparentPanel(new GridLayout(2, 2,0,1)); - container.setBackground(AppThemeColor.SETTINGS_BG); - container.setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), - BorderFactory.createEmptyBorder(3,0,3,0))); - - JComboBox notificationComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); - notificationComboBox.addItemListener(e -> { - switch (e.getStateChange()){ - case ItemEvent.SELECTED: { - if(notificationComboBox.getSelectedItem().equals("Browse")){ - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileFilter(new FileNameExtensionFilter("*.wav","wav")); - int returnVal = fileChooser.showOpenDialog(null); - if(returnVal == JFileChooser.APPROVE_OPTION) { - System.out.println(fileChooser.getSelectedFile().getPath()); - } - } - break; - } - } - }); - - - JComboBox chatScannerComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); - - - container.add(componentsFactory.getTextLabel("Notification:",FontStyle.REGULAR)); - container.add(notificationComboBox); - container.add(componentsFactory.getTextLabel("Chat Scanner",FontStyle.REGULAR)); - container.add(chatScannerComboBox); +// JPanel container = componentsFactory.getTransparentPanel(new GridLayout(2, 2,0,1)); +// container.setBackground(AppThemeColor.SETTINGS_BG); +// container.setBorder(new CompoundBorder( +// BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), +// BorderFactory.createEmptyBorder(3,0,3,0))); +// +// JComboBox notificationComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); +// notificationComboBox.addItemListener(e -> { +// switch (e.getStateChange()){ +// case ItemEvent.SELECTED: { +// if(notificationComboBox.getSelectedItem().equals("Browse")){ +// JFileChooser fileChooser = new JFileChooser(); +// fileChooser.setFileFilter(new FileNameExtensionFilter("*.wav","wav")); +// int returnVal = fileChooser.showOpenDialog(null); +// if(returnVal == JFileChooser.APPROVE_OPTION) { +// System.out.println(fileChooser.getSelectedFile().getPath()); +// } +// } +// break; +// } +// } +// }); +// +// +// JComboBox chatScannerComboBox = componentsFactory.getComboBox(new String[]{"Mercury Notification", "Mercury Chat Scanner", "Browse"}); +// +// +// container.add(componentsFactory.getTextLabel("Notification:",FontStyle.REGULAR)); +// container.add(notificationComboBox); +// container.add(componentsFactory.getTextLabel("Chat Scanner",FontStyle.REGULAR)); +// container.add(chatScannerComboBox); root.add(soundLabel,BorderLayout.PAGE_START); - root.add(container,BorderLayout.CENTER); +// root.add(container,BorderLayout.CENTER); return root; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java index 0125c34b..0131af77 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/SupportPanel.java @@ -58,7 +58,7 @@ public void mousePressed(MouseEvent e) { } } }); - JTextArea donateText = componentsFactory.getSimpleTextAre("We aimed to create a convenience tool in form of an easy-to-use application, primarily for trading purposes. If MercuryTrade successfully managed to save your time or improve your experience, you can thank us by donating and telling your friends."); + JTextArea donateText = componentsFactory.getSimpleTextArea("We aimed to create a convenience tool in form of an easy-to-use application, primarily for trading purposes. If MercuryTrade successfully managed to save your time or improve your experience, you can thank us by donating and telling your friends."); donateText.setPreferredSize(new Dimension(300,150)); JPanel donateTextPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); JPanel donateButtonPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java index 8ea0cde7..02de14ed 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/SetUpLocationFrame.java @@ -26,7 +26,7 @@ protected void initialize() { JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); root.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); root.setBackground(AppThemeColor.SLIDE_BG); - root.add(componentsFactory.getSimpleTextAre("Panels UNLOCKED Move them and click Lock when done."),BorderLayout.CENTER); + root.add(componentsFactory.getSimpleTextArea("Panels UNLOCKED Move them and click Lock when done."),BorderLayout.CENTER); JPanel miscPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); JButton restoreDefault = componentsFactory.getBorderedButton("Restore defaults"); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java index ce545a76..e246f4a9 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/other/TooltipFrame.java @@ -39,7 +39,7 @@ public void initHandlers() { JLabel tooltipLabel = componentsFactory.getTextLabel(FontStyle.REGULAR,AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP,16f,tooltip); this.add(tooltipLabel,BorderLayout.CENTER); }else { - JTextArea tooltipArea = componentsFactory.getSimpleTextAre(""); + JTextArea tooltipArea = componentsFactory.getSimpleTextArea(""); this.add(tooltipArea,BorderLayout.CENTER); tooltipArea.setText(tooltip); if(tooltip.toCharArray().length < 120){ diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java index c5d2f662..6a54ee1d 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/AbstractTitledComponentFrame.java @@ -8,16 +8,14 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -/** - * Created by Константин on 18.01.2017. - */ public abstract class AbstractTitledComponentFrame extends AbstractComponentFrame { protected JPanel miscPanel; protected JButton hideButton; + protected JPanel headerPanel; private JLabel frameTitleLabel; protected AbstractTitledComponentFrame(String title) { super(title); - miscPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + miscPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); } @Override @@ -28,7 +26,7 @@ protected void initialize() { private void initHeaderPanel(){ if(layout instanceof BorderLayout) { - JPanel headerPanel = new JPanel(new BorderLayout()); + headerPanel = new JPanel(new BorderLayout()); headerPanel.setBackground(AppThemeColor.HEADER); headerPanel.setPreferredSize(new Dimension(100,26)); headerPanel.setBorder(BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java index 9bb540f8..706bb1ce 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java @@ -214,7 +214,7 @@ private void renderCurrentNote(){ innerContent.setPreferredSize(new Dimension(530,270)); JLabel image = componentsFactory.getIconLabel(note.getImagePath()); - JTextArea textArea = componentsFactory.getSimpleTextAre(note.getText()); + JTextArea textArea = componentsFactory.getSimpleTextArea(note.getText()); switch (note.getLayout()){ case VERTICAL:{ innerContent.setLayout(new BoxLayout(innerContent,BoxLayout.Y_AXIS)); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java index e1907159..2c90b014 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterFrame.java @@ -2,9 +2,11 @@ import com.mercury.platform.core.utils.interceptor.MessageInterceptor; import com.mercury.platform.core.utils.interceptor.filter.MessageFilter; +import com.mercury.platform.shared.ConfigManager; import com.mercury.platform.shared.events.EventRouter; import com.mercury.platform.shared.entity.FrameSettings; import com.mercury.platform.shared.store.MercuryStore; +import com.mercury.platform.ui.components.fields.font.FontStyle; import com.mercury.platform.ui.components.panel.chat.ChatFilterPanel; import com.mercury.platform.ui.frame.titled.AbstractTitledComponentFrame; import com.mercury.platform.ui.misc.AppThemeColor; @@ -24,15 +26,21 @@ public class ChatFilterFrame extends AbstractTitledComponentFrame { private ChatFilterSettingsFrame settingsFrame; private ChatFilterPanel msgContainer; private MessageInterceptor interceptor; + private JPanel toolbar; private boolean soundEnable = false; private boolean scrollToBottom = true; + private boolean chatEnable = false; private JButton scrollEnd; public ChatFilterFrame() { super("MercuryTrade"); FrameSettings frameSettings = configManager.getFrameSettings(this.getClass().getSimpleName()); this.setPreferredSize(frameSettings.getFrameSize()); - this.settingsFrame = new ChatFilterSettingsFrame(this::performNewStrings); + this.settingsFrame = new ChatFilterSettingsFrame(strings -> { + if(chatEnable){ + performNewStrings(strings); + } + }); } @Override @@ -46,13 +54,73 @@ public void componentResized(ComponentEvent e) { } }); this.hideButton.setIcon(componentsFactory.getIcon("app/hide.png",14)); + this.hideButton.setBorder(BorderFactory.createEmptyBorder(0,2,0,2)); + this.headerPanel.add(getMenuButton(),BorderLayout.LINE_START); + this.miscPanel.add(getEnableButton(),0); +// this.miscPanel.add(getMinimizeButton(),1); + this.miscPanel.setBorder(BorderFactory.createEmptyBorder(-4,0,0,0)); this.settingsFrame.init(); this.msgContainer = new ChatFilterPanel(); + this.toolbar = getToolbar(); + toolbar.setVisible(false); + this.add(toolbar,BorderLayout.LINE_START); this.add(msgContainer,BorderLayout.CENTER); - this.add(getNavigationPanel(),BorderLayout.LINE_END); this.pack(); } + private JButton getEnableButton() { + JButton enableButton = componentsFactory.getBorderedButton("Start"); + enableButton.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(AppThemeColor.BORDER, 1), + BorderFactory.createMatteBorder(1,5,1,5,AppThemeColor.TRANSPARENT) + )); + enableButton.setFont(componentsFactory.getFont(FontStyle.BOLD,16f)); + enableButton.setPreferredSize(new Dimension(90,23)); + enableButton.setBackground(AppThemeColor.TRANSPARENT); + enableButton.setForeground(AppThemeColor.TEXT_SUCCESS); + + componentsFactory.setUpToggleCallbacks(enableButton, + () -> { + chatEnable = false; + if (interceptor != null) { + MercuryStore.INSTANCE.removeInterceptorSubject.onNext(interceptor); + } + enableButton.setText("Start"); + enableButton.setForeground(AppThemeColor.TEXT_SUCCESS); + repaint(); + }, + () -> { + chatEnable = true; + String chunkStr = StringUtils.deleteWhitespace(ConfigManager.INSTANCE.getDefaultWords()); + String[] split = chunkStr.split(","); + performNewStrings(split); + enableButton.setText("Stop"); + enableButton.setForeground(AppThemeColor.TEXT_IMPORTANT); + repaint(); + }, false); + return enableButton; + } + private JButton getMinimizeButton() { + JButton minimizer = componentsFactory.getIconButton("app/minimize.png", 14, AppThemeColor.FRAME_ALPHA, ""); + minimizer.addActionListener(action -> { + //todo + }); + return minimizer; + } + private JButton getMenuButton() { + JButton menu = componentsFactory.getIconButton("app/menu.png", 18, AppThemeColor.FRAME_ALPHA, "Menu"); + menu.setBorder(BorderFactory.createEmptyBorder(4,6,4,4)); + componentsFactory.setUpToggleCallbacks(menu, + () -> { + this.toolbar.setVisible(true); + repaint(); + }, + () -> { + this.toolbar.setVisible(false); + repaint(); + }, true); + return menu; + } private void performNewStrings(String[] strings){ List contains = new ArrayList<>(); List notContains = new ArrayList<>(); @@ -120,7 +188,7 @@ public void initHandlers() { }); } - private JPanel getNavigationPanel(){ + private JPanel getToolbar(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); root.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); @@ -136,7 +204,7 @@ private JPanel getNavigationPanel(){ "Chat Scanner settings"); edit.addActionListener( action -> this.settingsFrame.showAuxiliaryFrame( - new Point(this.getLocation().x+this.getSize().width/2,this.getLocation().y), + new Point(this.getLocation().x,this.getLocation().y), this.getPreferredSize().height)); JButton clear = componentsFactory.getIconButton( "app/clear-history.png", diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java index 0b110d33..39b99e84 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/chat/ChatFilterSettingsFrame.java @@ -12,6 +12,7 @@ public class ChatFilterSettingsFrame extends AbstractTitledComponentFrame { private ChatSettingsCallback callback; + private JTextField quickResponseField; public ChatFilterSettingsFrame(ChatSettingsCallback callback) { super("MercuryTrade"); @@ -37,7 +38,7 @@ protected void initialize() { 15f, "Show messages containing the following words:"); title.setBorder(BorderFactory.createEmptyBorder(2,0,6,0)); - JTextArea words = componentsFactory.getSimpleTextAre(ConfigManager.INSTANCE.getDefaultWords()); + JTextArea words = componentsFactory.getSimpleTextArea(ConfigManager.INSTANCE.getDefaultWords()); words.setEditable(true); words.setCaretColor(AppThemeColor.TEXT_DEFAULT); words.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); @@ -48,6 +49,8 @@ protected void initialize() { JButton save = componentsFactory.getBorderedButton("Save"); save.addActionListener(action -> { ConfigManager.INSTANCE.setDefaultWords(words.getText()); + ConfigManager.INSTANCE.setQuickResponse(quickResponseField.getText()); + String chunkStr = StringUtils.deleteWhitespace(words.getText()); String[] split = chunkStr.split(","); @@ -73,10 +76,35 @@ protected void initialize() { root.add(setupArea,BorderLayout.CENTER); root.add(getMemo(),BorderLayout.LINE_END); - root.add(navBar,BorderLayout.PAGE_END); + + JPanel padding = componentsFactory.getTransparentPanel(new BorderLayout()); + padding.setBorder(BorderFactory.createEmptyBorder(0,4,4,4)); + padding.add(getResponsePanel(),BorderLayout.CENTER); + root.add(padding,BorderLayout.PAGE_END); this.add(root,BorderLayout.CENTER); + this.add(navBar,BorderLayout.PAGE_END); this.pack(); } + private JPanel getResponsePanel(){ + JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); + JPanel setupArea = componentsFactory.getTransparentPanel(new BorderLayout()); + setupArea.setBorder(BorderFactory.createEmptyBorder(4,4,4,4)); + + root.setBorder(BorderFactory.createLineBorder(AppThemeColor.HEADER)); + root.setBackground(AppThemeColor.SLIDE_BG); + + JButton quickResponse = componentsFactory.getIconButton("app/chat_scanner_response.png", 18f, AppThemeColor.SLIDE_BG, "Quick response"); + quickResponseField = componentsFactory.getTextField(ConfigManager.INSTANCE.getQuickResponse(),FontStyle.REGULAR,16f); + quickResponseField.setBackground(AppThemeColor.SLIDE_BG); + quickResponseField.setBorder(BorderFactory.createCompoundBorder( + BorderFactory.createLineBorder(AppThemeColor.HEADER,1), + BorderFactory.createLineBorder(AppThemeColor.TRANSPARENT,3) + )); + setupArea.add(quickResponse,BorderLayout.LINE_START); + setupArea.add(quickResponseField,BorderLayout.CENTER); + root.add(setupArea,BorderLayout.CENTER); + return root; + } private JPanel getMemo(){ JPanel root = componentsFactory.getTransparentPanel(new BorderLayout()); diff --git a/app-ui/src/main/resources/app/chat_scanner_response.png b/app-ui/src/main/resources/app/chat_scanner_response.png new file mode 100644 index 0000000000000000000000000000000000000000..a9607e7c6959d86e418db27dd9285dd3b61669c0 GIT binary patch literal 1052 zcmeAS@N?(olHy`uVBq!ia0vp^89?m8!3HFyHf)#a~60+7BevL9R^{>)E81?Jr`;BhIQ^`*kr>D&eGFPk0gtK7=dy!CS`_e}FS zxi#!hMfZ#jkE*yF77x2+nZMT8{Qvw`_z%lvrnvf5@8x+T_i%X`NP1f;W;W`?F&;MO z^g4Iu!=#jrraX5Kg$D(-O;hRCO}rttYtqK!8-T*1JU0)83H3r}bq7I#D z2N-lcL^rfQd@2xmrj;>jf>r{*;_(SbWh54`u4MWqP$YKZks!nz4ol8WKe*U399K2i zw#YQGq>5s zwyb~$%{%8!`tsvJV)mk0?4=f}FF!Um*YJd1UZ8h$lAOFvN;`<@I%!_~hY7M_zRkN* zyrW`aOwU^)6({&sFLR9LQ$4A~e>3r_$%@mb{~J$tZE9A0DHUhuy2;{j^EC(4Z-?y7 zSN!UD<8@0UsN#auieqwhjrab^nOs)l|GDb6h=|1!Zo#${pPM+OT9&Z9 z%l*Cjx0dU(4ZAFwc-KsndZ4KCH~F*3TD>BN$rGj=*qd8l8n2pT6v2C{)pyNIsYi+` zs{R+VJUBB%CJF7>{&xL4?deuc9J5-Nu)H~Y|J@bar$PP#j)x~~X|TTi?$x}a71|vO zGCiUi=GyvSd^OMf?D<2>uEp?vy)akhP4rvS?V0Zwd!2<2tottFa-pWe^UmdOq2DJu zTRXBaJ5748nWf#4aN@$G4UhM-3i4#BzN};}Z?#slo?g(a(3GgF(z;+)LV~a7$F6L~ zwrdlvw8}Ku{uXjExS_mK+LC4WH}#H$ACjK2ClzmO_jhFBp5pP!kMH2Qzg$WYO720^ zi#Wc$ixxPjv|goDyFKCiKUP7V#VVz`?Fs+C3%G0$Q2p4JwriU68@rGnmUp}_SRa}& z`GPlxmdKI;Vst0CVTZD*ylh literal 0 HcmV?d00001 diff --git a/app-ui/src/main/resources/app/menu.png b/app-ui/src/main/resources/app/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..60cc9e1ef8167b62a301060860951825e4004c5d GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^S|H591|*LjJ{b+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