Search in sources :

Example 1 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class MainGui method addListeners.

private void addListeners() {
    WindowManager manager = new WindowManager(this);
    manager.addWindowOnTop(liveStreamsDialog);
    MainWindowListener mainWindowListener = new MainWindowListener();
    addWindowStateListener(mainWindowListener);
    addWindowListener(mainWindowListener);
    hotkeyManager.registerAction("custom.command", "Custom Command", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand(e.getActionCommand(), null, false);
        }
    });
    hotkeyManager.registerAction("tabs.next", "Tabs: Switch to next tab", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            channels.switchToNextChannel();
        }
    });
    hotkeyManager.registerAction("tabs.previous", "Tabs: Switch to previous tab", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            channels.switchToPreviousChannel();
        }
    });
    hotkeyManager.registerAction("tabs.close", "Tabs: Close tab/popout", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            client.closeChannel(channels.getActiveChannel().getChannel());
        }
    });
    addMenuAction("dialog.search", "Dialog: Open Search Dialog", KeyEvent.VK_F, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openSearchDialog();
        }
    });
    addMenuAction("dialog.addressbook", "Dialog: Addressbook (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleAddressbook();
        }
    });
    addMenuAction("dialog.autoModDialog", "Dialog: AutoMod Dialog (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleAutoModDialog();
        }
    });
    addMenuAction("dialog.moderationLog", "Dialog: Moderation Log (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleModerationLog();
        }
    });
    addMenuAction("dialog.channelInfo", "Dialog: Channel Info Dialog (toggle)", KeyEvent.VK_C, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleChannelInfoDialog();
        }
    });
    addMenuAction("dialog.channelAdmin", "Dialog: Channel Admin Dialog (toggle)", KeyEvent.VK_A, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleChannelAdminDialog();
        }
    });
    addMenuAction("dialog.chatRules", "Dialog: Chat Rules (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleChatRules();
        }
    });
    addMenuAction("dialog.toggleEmotes", "Dialog: Emotes Dialog (toggle)", KeyEvent.VK_E, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleEmotesDialog();
        }
    });
    addMenuAction("dialog.highlightedMessages", "Dialog: Highlighted Messages (toggle)", KeyEvent.VK_H, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleHighlightedMessages();
        }
    });
    addMenuAction("dialog.ignoredMessages", "Dialog: Ignored Messages (toggle)", KeyEvent.VK_I, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleIgnoredMessages();
        }
    });
    addMenuAction("dialog.streams", "Dialog: Live Channels Dialog (toggle)", KeyEvent.VK_L, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleLiveStreamsDialog();
        }
    });
    addMenuAction("dialog.followers", "Dialog: Followers List (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleFollowerDialog();
        }
    });
    addMenuAction("dialog.subscribers", "Dialog: Subscriber List (toggle)", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleSubscriberDialog();
        }
    });
    addMenuAction("dialog.joinChannel", "Dialog: Join Channel", KeyEvent.VK_J, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openJoinDialog();
        }
    });
    addMenuAction("about", "Open Help", KeyEvent.VK_H, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openHelp("");
        }
    });
    hotkeyManager.registerAction("selection.toggle", "User Selection: Toggle", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Channel channel = channels.getLastActiveChannel();
            channel.toggleUserSelection();
        }
    });
    hotkeyManager.registerAction("selection.next", "User Selection: Next", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Channel channel = channels.getLastActiveChannel();
            channel.selectNextUser();
        }
    });
    hotkeyManager.registerAction("selection.nextExitAtBottom", "User Selection: Next (Exit at bottom)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Channel channel = channels.getLastActiveChannel();
            channel.selectNextUserExitAtBottom();
        }
    });
    hotkeyManager.registerAction("selection.previous", "User Selection: Previous", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Channel channel = channels.getLastActiveChannel();
            channel.selectPreviousUser();
        }
    });
    hotkeyManager.registerAction("selection.exit", "User Selection: Exit", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Channel channel = channels.getLastActiveChannel();
            channel.exitUserSelection();
        }
    });
    hotkeyManager.registerAction("selection.timeout30", "User Selection: Timeout (30s)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand("timeout", "30", true);
        }
    });
    hotkeyManager.registerAction("selection.timeout600", "User Selection: Timeout (10m)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand("timeout", "600", true);
        }
    });
    hotkeyManager.registerAction("selection.timeout30m", "User Selection: Timeout (30m)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand("timeout", "1800", true);
        }
    });
    hotkeyManager.registerAction("selection.timeout24h", "User Selection: Timeout (24h)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand("timeout", "86400", true);
        }
    });
    hotkeyManager.registerAction("commercial.30", "Run commercial (30s)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runCommercial(30);
        }
    });
    hotkeyManager.registerAction("commercial.60", "Run commercial (60s)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runCommercial(60);
        }
    });
    hotkeyManager.registerAction("commercial.90", "Run commercial (90s)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runCommercial(90);
        }
    });
    hotkeyManager.registerAction("stream.addhighlight", "Add Stream Highlight", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            hotkeyCommand("addstreamhighlight", null, false);
        }
    });
    hotkeyManager.registerAction("window.toggleCompact", "Window: Toggle Compact Mode", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleCompact(false);
        }
    });
    hotkeyManager.registerAction("window.toggleCompactMaximized", "Window: Toggle Compact Mode (Maximized)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleCompact(true);
        }
    });
    hotkeyManager.registerAction("window.toggleInput", "Window: Toggle Input", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            channels.getActiveChannel().toggleInput();
        }
    });
    hotkeyManager.registerAction("window.toggleUserlist", "Window: Toggle Userlist", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            channels.getActiveChannel().toggleUserlist();
        }
    });
    hotkeyManager.registerAction("dialog.toggleHelp", "Window: Toggle Help", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            toggleHelp();
        }
    });
    addMenuAction("dialog.streamchat", "Window: Open StreamChat", KeyEvent.VK_O, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            openStreamChat();
        }
    });
    hotkeyManager.registerAction("notification.closeAll", "Close all shown/queued notifications", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            notificationWindowManager.clearAll();
        }
    });
    hotkeyManager.registerAction("notification.closeAllShown", "Close all shown notifications", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            notificationWindowManager.clearAllShown();
        }
    });
    addMenuAction("application.exit", "Exit Chatty", KeyEvent.VK_UNDEFINED, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            exit();
        }
    });
}
Also used : CommandActionEvent(chatty.gui.components.menus.CommandActionEvent) Channel(chatty.gui.components.Channel) AbstractAction(javax.swing.AbstractAction) NotificationWindowManager(chatty.gui.notifications.NotificationWindowManager)

Example 2 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class MainGui method removeUser.

/**
 * Removes a user from a channel, removing from the userlist
 *
 * @param channel
 * @param user
 */
public void removeUser(final User user) {
    SwingUtilities.invokeLater(() -> {
        if (shouldUpdateUser(user)) {
            Channel c = channels.getChannel(user.getRoom());
            c.removeUser(user);
            if (channels.getActiveChannel() == c) {
                state.update();
            }
        }
    });
}
Also used : Channel(chatty.gui.components.Channel)

Example 3 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class MainGui method hotkeyCommand.

/**
 * Perform a command executed by a hotkey. This means that the channel
 * context is the currently active channel and the selected user name is
 * added as command parameter if present.
 *
 * @param command The name of the command, leading / is removed if necessary
 * @param parameter2 Additional parameter after the username
 * @param selectedUserRequired Whether the command should only be executed
 * if a user is currently selected
 */
private void hotkeyCommand(String command, String parameter2, boolean selectedUserRequired) {
    Channel channel = channels.getLastActiveChannel();
    User selectedUser = channel.getSelectedUser();
    if (selectedUserRequired && selectedUser == null) {
        return;
    }
    String selectedUserName = selectedUser != null ? selectedUser.getName() : "";
    if (command.startsWith("/")) {
        command = command.substring(1);
    }
    String parameter = null;
    if (!selectedUserName.isEmpty() || parameter2 != null) {
        parameter = selectedUserName + (parameter2 != null ? " " + parameter2 : "");
    }
    client.command(channels.getLastActiveChannel().getRoom(), command, parameter);
}
Also used : User(chatty.User) Channel(chatty.gui.components.Channel)

Example 4 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class Channels method createChannel.

private Channel createChannel(Room room, Channel.Type type) {
    Channel channel = new Channel(room, type, gui, styleManager, contextMenuListener);
    channel.setUserlistWidth(defaultUserlistWidth, minUserlistWidth);
    channel.setMouseClickedListener(mouseClickedListener);
    channel.setScrollbarAlways(chatScrollbarAlaways);
    channel.setUserlistEnabled(defaultUserlistVisibleState);
    channel.setOnceOffEditListener(onceOffEditListener);
    if (type == Channel.Type.SPECIAL || type == Channel.Type.WHISPER) {
        channel.setUserlistEnabled(false);
    }
    if (!gui.getSettings().getBoolean("inputEnabled")) {
        channel.toggleInput();
    }
    return channel;
}
Also used : Channel(chatty.gui.components.Channel)

Example 5 with Channel

use of chatty.gui.components.Channel in project chatty by chatty.

the class Channels method updateRoom.

public void updateRoom(Room room) {
    Channel channel = channels.get(room.getChannel());
    if (channel != null) {
        if (channel.setRoom(room)) {
            System.out.println("Update Room");
            updateChannelTabName(channel);
        }
    }
}
Also used : Channel(chatty.gui.components.Channel)

Aggregations

Channel (chatty.gui.components.Channel)9 User (chatty.User)1 CommandActionEvent (chatty.gui.components.menus.CommandActionEvent)1 NotificationWindowManager (chatty.gui.notifications.NotificationWindowManager)1 AbstractAction (javax.swing.AbstractAction)1