Added playlist popup window but no functionality yet.
This commit is contained in:
parent
383f97ae93
commit
fe5b2a54ef
|
@ -108,10 +108,10 @@ public class HandieBot {
|
|||
log = new BotLog(window.getOutputArea());
|
||||
}
|
||||
|
||||
//log.log(BotLog.TYPE.INFO, resourceBundle.getString("log.loggingIn"));
|
||||
//client = new ClientBuilder().withToken(TOKEN).build();
|
||||
//client.getDispatcher().registerListener(new HandieBot());
|
||||
//client.login();
|
||||
log.log(BotLog.TYPE.INFO, resourceBundle.getString("log.loggingIn"));
|
||||
client = new ClientBuilder().withToken(TOKEN).build();
|
||||
client.getDispatcher().registerListener(new HandieBot());
|
||||
client.login();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package handiebot.command.commands.interfaceActions;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import static handiebot.HandieBot.resourceBundle;
|
||||
|
||||
/**
|
||||
* Author: Zino Holwerda
|
||||
* Date: 7/14/2017.
|
||||
*/
|
||||
public class PlaylistAction extends AbstractAction {
|
||||
|
||||
private static final String DEFAULT_SOURCE_CHOICE_LABEL = "Available Playlists";
|
||||
|
||||
public PlaylistAction() {
|
||||
super(resourceBundle.getString("action.menu.playlist"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFrame editPlaylist = new JFrame(resourceBundle.getString("action.menu.playlist"));
|
||||
editPlaylist.setLayout(new BorderLayout(5,5));
|
||||
|
||||
JPanel topSide = new JPanel(new FlowLayout());
|
||||
|
||||
JPanel leftSide = new JPanel(new BorderLayout(5,5));
|
||||
JLabel sourceLabel = new JLabel(DEFAULT_SOURCE_CHOICE_LABEL);
|
||||
JList<String> playlistList = new JList<>();
|
||||
leftSide.add(sourceLabel, BorderLayout.NORTH);
|
||||
JScrollPane scrollPane = new JScrollPane(playlistList);
|
||||
scrollPane.setPreferredSize(new Dimension(200, 200));
|
||||
leftSide.add(scrollPane, BorderLayout.SOUTH);
|
||||
topSide.add(leftSide);
|
||||
|
||||
JPanel rightSide = new JPanel(new BorderLayout(5,5));
|
||||
JButton addButton = new JButton(resourceBundle.getString("action.menu.playlist.add"));
|
||||
rightSide.add(addButton, BorderLayout.NORTH);
|
||||
addButton.addActionListener(null);
|
||||
JButton deleteButton = new JButton(resourceBundle.getString("action.menu.playlist.delete"));
|
||||
rightSide.add(deleteButton, BorderLayout.AFTER_LINE_ENDS);
|
||||
deleteButton.addActionListener(null);
|
||||
JButton editButton = new JButton(resourceBundle.getString("action.menu.playlist.edit"));
|
||||
rightSide.add(editButton, BorderLayout.AFTER_LAST_LINE);
|
||||
editButton.addActionListener(null);
|
||||
topSide.add(rightSide);
|
||||
editPlaylist.add(topSide, BorderLayout.PAGE_START);
|
||||
|
||||
JPanel bottomSide = new JPanel();
|
||||
bottomSide.add(new JScrollPane(playlistList));
|
||||
editPlaylist.add(bottomSide, BorderLayout.PAGE_END);
|
||||
|
||||
editPlaylist.pack();
|
||||
editPlaylist.setLocationRelativeTo(null);
|
||||
editPlaylist.setVisible(true);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package handiebot.command.commands.interfaceActions.PlaylistActions;
|
||||
|
||||
/**
|
||||
* Author: Zino
|
||||
* Date: 7/14/2017.
|
||||
*/
|
||||
public class DeletePlaylistAction {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package handiebot.command.commands.interfaceActions.PlaylistActions;
|
||||
|
||||
/**
|
||||
* Author: Zino
|
||||
* Date: 7/14/2017.
|
||||
*/
|
||||
public class EditPlaylistAction {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package handiebot.command.commands.interfaceActions.PlaylistActions;
|
||||
|
||||
/**
|
||||
* Author: Zino
|
||||
* Date: 7/14/2017.
|
||||
*/
|
||||
public class NewPlaylistAction {
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @author Andrew Lalis
|
||||
* @author Andrew Lalis & Zino Holwerda
|
||||
* Contains all Commands which can be executed from a Discord server or the Console.
|
||||
*/
|
||||
package handiebot.command.commands;
|
|
@ -33,7 +33,6 @@ public class BotWindow extends JFrame {
|
|||
public BotWindow(){
|
||||
super(HandieBot.APPLICATION_NAME);
|
||||
//Setup GUI
|
||||
|
||||
//Output area.
|
||||
outputArea = new JTextPane();
|
||||
outputArea.setBackground(Color.white);
|
||||
|
@ -45,16 +44,17 @@ public class BotWindow extends JFrame {
|
|||
//Playlist shower
|
||||
JPanel playlistSub = new JPanel(new BorderLayout());
|
||||
JTextPane textPane = new JTextPane();
|
||||
textPane.setEditable(false);
|
||||
JScrollPane playlist = new JScrollPane(textPane);
|
||||
playlist.setPreferredSize(new Dimension(200, 200));
|
||||
playlist.setPreferredSize(new Dimension(250, 200));
|
||||
playlistSub.add(playlist, BorderLayout.PAGE_END);
|
||||
getContentPane().add(playlistSub, BorderLayout.EAST);
|
||||
|
||||
//PlaylistList maker
|
||||
JList<String> list = setPlayListListArea(textPane);
|
||||
JScrollPane playlistList = new JScrollPane(list);
|
||||
playlistList.setPreferredSize(new Dimension(200, 1000));
|
||||
playlistList.setPreferredSize(new Dimension(250, 1000));
|
||||
playlistSub.add(playlistList, BorderLayout.CENTER);
|
||||
getContentPane().add(playlistSub, BorderLayout.EAST);
|
||||
|
||||
//Command field.
|
||||
JTextField commandField = new JTextField();
|
||||
|
@ -82,10 +82,11 @@ public class BotWindow extends JFrame {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setJMenuBar(new MenuBar());
|
||||
setJMenuBar(new MenuBar(this));
|
||||
SelectionController controller = new SelectionController();
|
||||
setPreferredSize(new Dimension(800, 600));
|
||||
pack();
|
||||
setLocationRelativeTo(null);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package handiebot.view;
|
||||
|
||||
import handiebot.command.Commands;
|
||||
import handiebot.command.commands.interfaceActions.PlaylistAction;
|
||||
import handiebot.view.actions.ActionItem;
|
||||
import handiebot.view.actions.CommandAction;
|
||||
|
||||
|
@ -9,16 +10,23 @@ import javax.swing.*;
|
|||
import static handiebot.HandieBot.resourceBundle;
|
||||
|
||||
/**
|
||||
* @author Andrew Lalis
|
||||
* @author Andrew Lalis & Zino Holwerda
|
||||
* Custom menu bar to be added to the console control panel.
|
||||
*/
|
||||
public class MenuBar extends JMenuBar {
|
||||
|
||||
public MenuBar(){
|
||||
JMenu fileMenu = new JMenu(resourceBundle.getString("menu.filemenu.title"));
|
||||
fileMenu.add(new ActionItem(resourceBundle.getString("menu.filemenu.quit"), new CommandAction(Commands.get("quit"))));
|
||||
private BotWindow window;
|
||||
private int language;
|
||||
|
||||
public MenuBar(BotWindow window){
|
||||
this.window = window;
|
||||
JMenu fileMenu = new JMenu(resourceBundle.getString("menu.fileMenu.title"));
|
||||
fileMenu.add(new ActionItem(resourceBundle.getString("menu.fileMenu.quit"), new CommandAction(Commands.get("quit"))));
|
||||
fileMenu.add(new PlaylistAction());
|
||||
this.add(fileMenu);
|
||||
|
||||
JMenu viewMenu = new JMenu(resourceBundle.getString("menu.viewMenu.view"));
|
||||
JMenu language = new JMenu(resourceBundle.getString("menu.viewMenu.language"));
|
||||
this.add(viewMenu);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#Strings for HandieBot:
|
||||
# The following strings are organized in a way that it should be intuitive how it will be used.
|
||||
#author: Andrew Lalis & Zino Holwerda
|
||||
#INFO Strings for HandieBot:
|
||||
#INFO The following strings are organized in a way that it should be intuitive how it will be used.
|
||||
#INFO Language: English
|
||||
|
||||
#Log
|
||||
log.loggingIn=Logging client in...
|
||||
log.init=HandieBot initialized.
|
||||
|
@ -11,8 +14,16 @@ log.newVoiceChannel=No voice channel found, creating a new one.
|
|||
window.close.question=Are you sure you want to exit and shutdown the bot?
|
||||
window.close.title=Confirm shutdown
|
||||
#MenuBar
|
||||
menu.filemenu.title=File
|
||||
menu.filemenu.quit=Quit
|
||||
menu.fileMenu.title=File
|
||||
menu.fileMenu.quit=Quit
|
||||
menu.editMenu.edit=Edit
|
||||
menu.viewMenu.view=View
|
||||
menu.viewMenu.language=Language
|
||||
#Actions
|
||||
action.menu.playlist=Edit playlists
|
||||
action.menu.playlist.add=Add
|
||||
action.menu.playlist.delete=Delete
|
||||
action.menu.playlist.edit=Edit
|
||||
#Generic Command Messages
|
||||
commands.noPermission.message=You do not have permission to use the command `{0}`.
|
||||
commands.noPermission.log=User {0} does not have permission to execute {1}
|
||||
|
@ -24,7 +35,7 @@ commands.command.setPrefix.loadedPrefixes=Loaded prefixes.
|
|||
commands.command.setPrefix.savedPrefixes=Saved prefixes.
|
||||
commands.command.help.description=Displays a list of commands and what they do.
|
||||
commands.command.info.description=Displays some common commands and information about the bot.
|
||||
commands.command.info.embed.description=HandieBot is a Discord bot created by Andrew Lalis. It can play music, manage playlists, and provide other assistance to users. Some useful commands are shown below.
|
||||
commands.command.info.embed.description=HandieBot is a Discord bot created by Andrew Lalis & Zino Holwerda. It can play music, manage playlists, and provide other assistance to users. Some useful commands are shown below.
|
||||
commands.command.info.embed.helpCommand=Receive a message with a detailed list of all commands and how to use them.
|
||||
commands.command.info.embed.playCommand=Play a song, or add it to the queue if one is already playing. A URL can be a YouTube or SoundCloud link.
|
||||
commands.command.info.embed.queueCommand=Show a list of songs that will soon be played.
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
#Strings for HandieBot:
|
||||
# The following strings are organized in a way that it should be intuitive how it will be used.
|
||||
#author: Zino Holwerda
|
||||
#INFO Strings for HandieBot:
|
||||
#INFO The following strings are organized in a way that it should be intuitive how it will be used.
|
||||
#INFO Language: Dutch
|
||||
|
||||
#Log
|
||||
log.loggingIn=Logging client in...
|
||||
log.init=HandieBot initialized.
|
||||
log.shuttingDown=Shutting down the bot.
|
||||
log.deleteMessageError=Unable to delete message. Please ensure that the bot has MANAGE_MESSAGES enabled, especially for this channel.
|
||||
log.creatingChatChannel=No chat channel found, creating a new one.
|
||||
log.newVoiceChannel=No voice channel found, creating a new one.
|
||||
log.loggingIn=Bezig met inloggen van de client...
|
||||
log.init=HandieBot geïnitialiseerd.
|
||||
log.shuttingDown=Bezig met het afsluiten van de bot.
|
||||
log.deleteMessageError=Niet mogelijk het bericht te vewijderen. Zorg er alstublieft voor dat de bot MANAGE_MESSAGES aan heeft, met name in dit kanaal.
|
||||
log.creatingChatChannel=Geen chat gevonden. Bezig met het maken er van.
|
||||
log.newVoiceChannel=Geen voice kanaal gevonden, Bezig met het maken er van.
|
||||
#Window
|
||||
window.close.question=Are you sure you want to exit and shutdown the bot?
|
||||
window.close.title=Confirm shutdown
|
||||
window.close.question=Weet je zeker dat je de bot wil afsluiten?
|
||||
window.close.title=Stopzetten Bevestigen.
|
||||
#MenuBar
|
||||
menu.filemenu.title=File
|
||||
menu.filemenu.quit=Quit
|
||||
menu.fileMenu.title=Bestand
|
||||
menu.fileMenu.quit=Verlaten
|
||||
menu.fileMenu.edit=Bewerken
|
||||
menu.fileMenu.view=Beeld
|
||||
#Generic Command Messages
|
||||
commands.noPermission.message=You do not have permission to use the command `{0}`.
|
||||
commands.noPermission.log=User {0} does not have permission to execute {1}
|
||||
commands.noPermission.subcommand=You don't have permission to do that.
|
||||
commands.noPermission.message=U hebt niet de toestemming om dit commando uit te voeren.`{0}`.
|
||||
commands.noPermission.log=Gebruiker {0} heeft niet de toestemming voor het uitvoeren van {1}
|
||||
commands.noPermission.subcommand=U hebt niet de toestemming om dat te doen.
|
||||
commands.invalidCommand.noContext=Invalid command issued: {0}
|
||||
commands.invalidCommand.context=Invalid command: {0} issued by: {1}
|
||||
#Messages for specific commands.
|
||||
|
|
Loading…
Reference in New Issue