Commit 2871c937 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

Integration of ActionPanel.java into the language system

parent c816c40c
......@@ -418,10 +418,8 @@ public class ActionEditor extends JFrame implements ActionListener{
JFrame.setDefaultLookAndFeelDecorated(true);
ActionEditor ae = new ActionEditor(null);
ae.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/*ae.editAction("none;dialogs.changeSkin();dialogs.fileSimple();dialogs.file();dialogs.directory();dialogs.disc();dialogs.net();dialogs.messages();dialogs.prefs();dialogs.fileInfo();dialogs.playlist();dialogs.streamingWizard();dialogs.popup();dialogs.audioPopup();dialogs.videoPopup();dialogs.miscPopup();equalizer.enable();equalizer.disable();vlc.play();vlc.pause();vlc.stop();vlc.faster();vlc.slower();vlc.mute();" +
ae.editAction("none;dialogs.changeSkin();dialogs.fileSimple();dialogs.file();dialogs.directory();dialogs.disc();dialogs.net();dialogs.messages();dialogs.prefs();dialogs.fileInfo();dialogs.playlist();dialogs.streamingWizard();dialogs.popup();dialogs.audioPopup();dialogs.videoPopup();dialogs.miscPopup();equalizer.enable();equalizer.disable();vlc.play();vlc.pause();vlc.stop();vlc.faster();vlc.slower();vlc.mute();" +
"vlc.volumeUp();vlc.volumeDown();vlc.fullscreen();vlc.snapshot();vlc.onTop();vlc.minimize();vlc.quit();playlist.add();playlist.del();playlist.next();playlist.previous();playlist.sort();playlist.setRandom(true);playlist.setLoop(true);playlist.setRepeat(true);playlist.load();playlist.save();dvd.nextTitle();dvd.previousTitle();dvd.nextChapter();dvd.previousChapter();dvd.rootMenu();WindowID.show();WindowID.hide();" +
"WindowID.maximize();WindowID.unmaximize();WindowID.setLayout(LayoutID)");
*/
ae.editAction("none");
"WindowID.maximize();WindowID.unmaximize();WindowID.setLayout(LayoutID)");
}
}
......@@ -57,110 +57,110 @@ public class ActionPanel extends JPanel {
if(action_type.equals("static")) { //static => the action has no parameters
JLabel desc = new JLabel(action);
if (action.equals("none")) desc.setText("Do nothing");
else if (action.equals("dialogs.changeSkin()")) desc.setText("Show a dialog box to load a new skin.");
else if (action.equals("dialogs.fileSimple()")) desc.setText("Show the simple \"Open File\" dialog box.");
else if (action.equals("dialogs.file()")) desc.setText("Show the extended \"Open File\" dialog box.");
else if (action.equals("dialogs.directory()")) desc.setText("Show the \"Open Directory\" dialog box.");
else if (action.equals("dialogs.disc()")) desc.setText("Show the \"Open Disc\" dialog box.");
else if (action.equals("dialogs.net()")) desc.setText("Show the \"Open Network Stream\" dialog box.");
else if (action.equals("dialogs.messages()")) desc.setText("Show the message log dialog box.");
else if (action.equals("dialogs.prefs()")) desc.setText("Show the preferences dialog box.");
else if (action.equals("dialogs.fileInfo()")) desc.setText("Show the file information dialog box.");
else if (action.equals("dialogs.playlist()")) desc.setText("Show the default (unskinned) playlist window.");
else if (action.equals("dialogs.streamingWizard()")) desc.setText("Show the \"Streaming Wizard\" dialog box.");
else if (action.equals("dialogs.popup()")) desc.setText("Show the full popup menu.");
else if (action.equals("dialogs.audioPopup()")) desc.setText("Show the audio settings popup menu.");
else if (action.equals("dialogs.videoPopup()")) desc.setText("Show the video settings popup menu.");
else if (action.equals("dialogs.miscPopup()")) desc.setText("Show a popup menu containing playback control and general options.");
else if (action.equals("equalizer.enable()")) desc.setText("Enable the equalizer audio filter.");
else if (action.equals("equalizer.disable()")) desc.setText("Disable the equalizer audio filter.");
else if (action.equals("vlc.play()")) desc.setText("Play the current playlist item.");
else if (action.equals("vlc.pause()")) desc.setText("Pause the current playlist item.");
else if (action.equals("vlc.stop()")) desc.setText("Stop playback of the current playlist item.");
else if (action.equals("vlc.faster()")) desc.setText("Play the current playlist item faster.");
else if (action.equals("vlc.slower()")) desc.setText("Play the current playlist item slower.");
else if (action.equals("vlc.mute()")) desc.setText("Toggle audio muting.");
else if (action.equals("vlc.volumeUp()")) desc.setText("Increase the volume.");
else if (action.equals("vlc.volumeDown()")) desc.setText("Reduce the volume.");
else if (action.equals("vlc.fullscreen()")) desc.setText("Toggle the fullscreen mode.");
else if (action.equals("vlc.snapshot()")) desc.setText("Take a snapshot.");
else if (action.equals("vlc.onTop()")) desc.setText("Toggle the \"always on top\" status.");
else if (action.equals("vlc.minimize()")) desc.setText("Minimize VLC.");
else if (action.equals("vlc.quit()")) desc.setText("Quit VLC.");
else if (action.equals("playlist.add()")) desc.setText("Add a new item to the playlist.");
else if (action.equals("playlist.del()")) desc.setText("Remove the selected items from the playlist.");
else if (action.equals("playlist.next()")) desc.setText("Play the next item in the playlist.");
else if (action.equals("playlist.previous()")) desc.setText("Play the previous item in the playlist.");
else if (action.equals("playlist.sort()")) desc.setText("Sort the playlist alphabetically.");
else if (action.equals("playlist.load()")) desc.setText("Load an external playlist file.");
else if (action.equals("playlist.save()")) desc.setText("Save the current playlist to a file.");
else if (action.equals("dvd.nextTitle()")) desc.setText("Go to the next title on the DVD.");
else if (action.equals("dvd.previousTitle()")) desc.setText("Go to the previous title on the DVD.");
else if (action.equals("dvd.nextChapter()")) desc.setText("Go to the next chapter of the DVD.");
else if (action.equals("dvd.previousChapter()")) desc.setText("Go to the previous chapter on the DVD.");
else if (action.equals("dvd.rootMenu()")) desc.setText("Go to the root menu of the DVD.");
if (action.equals("none")) desc.setText(Language.get("ACTION_DESC_NONE"));
else if (action.equals("dialogs.changeSkin()")) desc.setText(Language.get("ACTION_DESC_CHANGESKIN"));
else if (action.equals("dialogs.fileSimple()")) desc.setText(Language.get("ACTION_DESC_FILESIMPLE"));
else if (action.equals("dialogs.file()")) desc.setText(Language.get("ACTION_DESC_FILE"));
else if (action.equals("dialogs.directory()")) desc.setText(Language.get("ACTION_DESC_DIRECTORY"));
else if (action.equals("dialogs.disc()")) desc.setText(Language.get("ACTION_DESC_DISC"));
else if (action.equals("dialogs.net()")) desc.setText(Language.get("ACTION_DESC_NET"));
else if (action.equals("dialogs.messages()")) desc.setText(Language.get("ACTION_DESC_MSG"));
else if (action.equals("dialogs.prefs()")) desc.setText(Language.get("ACTION_DESC_PREFS"));
else if (action.equals("dialogs.fileInfo()")) desc.setText(Language.get("ACTION_DESC_FILEINFO"));
else if (action.equals("dialogs.playlist()")) desc.setText(Language.get("ACTION_DESC_PLAYLIST"));
else if (action.equals("dialogs.streamingWizard()")) desc.setText(Language.get("ACTION_DESC_WIZARD"));
else if (action.equals("dialogs.popup()")) desc.setText(Language.get("ACTION_DESC_POPUP"));
else if (action.equals("dialogs.audioPopup()")) desc.setText(Language.get("ACTION_DESC_AUDIOPU"));
else if (action.equals("dialogs.videoPopup()")) desc.setText(Language.get("ACTION_DESC_VIDEOPU"));
else if (action.equals("dialogs.miscPopup()")) desc.setText(Language.get("ACTION_DESC_MISCPU"));
else if (action.equals("equalizer.enable()")) desc.setText(Language.get("ACTION_DESC_EQENABLE"));
else if (action.equals("equalizer.disable()")) desc.setText(Language.get("ACTION_DESC_EQDISABLE"));
else if (action.equals("vlc.play()")) desc.setText(Language.get("ACTION_DESC_PLAY"));
else if (action.equals("vlc.pause()")) desc.setText(Language.get("ACTION_DESC_PAUSE"));
else if (action.equals("vlc.stop()")) desc.setText(Language.get("ACTION_DESC_STOP"));
else if (action.equals("vlc.faster()")) desc.setText(Language.get("ACTION_DESC_FASTER"));
else if (action.equals("vlc.slower()")) desc.setText(Language.get("ACTION_DESC_SLOWER"));
else if (action.equals("vlc.mute()")) desc.setText(Language.get("ACTION_DESC_MUTE"));
else if (action.equals("vlc.volumeUp()")) desc.setText(Language.get("ACTION_DESC_VOLUP"));
else if (action.equals("vlc.volumeDown()")) desc.setText(Language.get("ACTION_DESC_VOLDOWN"));
else if (action.equals("vlc.fullscreen()")) desc.setText(Language.get("ACTION_DESC_FULLSCREEN"));
else if (action.equals("vlc.snapshot()")) desc.setText(Language.get("ACTION_DESC_SNAPSHOT"));
else if (action.equals("vlc.onTop()")) desc.setText(Language.get("ACTION_DESC_ONTOP"));
else if (action.equals("vlc.minimize()")) desc.setText(Language.get("ACTION_DESC_MIN"));
else if (action.equals("vlc.quit()")) desc.setText(Language.get("ACTION_DESC_QUIT"));
else if (action.equals("playlist.add()")) desc.setText(Language.get("ACTION_PL_ADD"));
else if (action.equals("playlist.del()")) desc.setText(Language.get("ACTION_PL_DEL"));
else if (action.equals("playlist.next()")) desc.setText(Language.get("ACTION_PL_NEXT"));
else if (action.equals("playlist.previous()")) desc.setText(Language.get("ACTION_PL_PREV"));
else if (action.equals("playlist.sort()")) desc.setText(Language.get("ACTION_PL_SORT"));
else if (action.equals("playlist.load()")) desc.setText(Language.get("ACTION_PL_LOAD"));
else if (action.equals("playlist.save()")) desc.setText(Language.get("ACTION_PL_SAVE"));
else if (action.equals("dvd.nextTitle()")) desc.setText(Language.get("ACTION_DVD_NEXTT"));
else if (action.equals("dvd.previousTitle()")) desc.setText(Language.get("ACTION_DVD_PREVT"));
else if (action.equals("dvd.nextChapter()")) desc.setText(Language.get("ACTION_DVD_NEXTC"));
else if (action.equals("dvd.previousChapter()")) desc.setText(Language.get("ACTION_DVD_NEXTT"));
else if (action.equals("dvd.rootMenu()")) desc.setText(Language.get("ACTION_DVD_MENU"));
add(desc);
}
else { // dynamic action => it needs parameters
JLabel desc = new JLabel(action);
if (action.indexOf(".setRandom")!=-1) {
String[] bools = { "Activate", "Deactive" };
String[] bools = { Language.get("ACTION_ACTIVATE"), Language.get("ACTION_DEACTIVATE") };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the items in the playlist are played in random order.");
desc.setText(Language.get("ACTION_RANDOM"));
add(desc);
}
else if (action.indexOf(".setLoop")!=-1) {
String[] bools = { "Activate", "Deactive" };
String[] bools = { Language.get("ACTION_ACTIVATE"), Language.get("ACTION_DEACTIVATE") };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the playlist is repeated when its end is reached.");
desc.setText(Language.get("ACTION_LOOP"));
add(desc);
}
else if (action.indexOf(".setRepeat")!=-1) {
String[] bools = { "Activate", "Deactive" };
String[] bools = { Language.get("ACTION_ACTIVATE"), Language.get("ACTION_DEACTIVATE") };
bool_cb = new JComboBox(bools);
if(action.toUpperCase().indexOf("TRUE")!=-1) bool_cb.setSelectedIndex(0);
else bool_cb.setSelectedIndex(1);
add(bool_cb);
desc.setText(" that the current item is repeated after its end is reached");
desc.setText(Language.get("ACTION_REPEAT"));
add(desc);
}
else if (action.indexOf(".show()")!=-1) {
desc.setText("Show the window with the ID ");
desc.setText(Language.get("ACTION_SHOW"));
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".show()")));
}
else if (action.indexOf(".hide()")!=-1) {
desc.setText("Hide the window with the ID ");
desc.setText(Language.get("ACTION_HIDE"));
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".hide()")));
}
else if (action.indexOf(".maximize()")!=-1) {
desc.setText("Maximize the window with the ID ");
desc.setText(Language.get("ACTION_MAXIMIZE"));
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".maximize()")));
}
else if (action.indexOf(".unmaximize()")!=-1) {
desc.setText("Unmaximize the window with the ID ");
desc.setText(Language.get("ACTION_UNMAXIMIZE"));
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".unmaximize()")));
}
else if (action.indexOf(".setLayout")!=-1) {
desc.setText("Set the Layout of the window with the ID ");
desc.setText(Language.get("ACTION_LAYOUT_OF"));
add(desc);
add(windowid_tf);
windowid_tf.setText(action.substring(0,action.indexOf(".setLayout")));
add(new JLabel(" to "));
add(new JLabel(Language.get("ACTION_LAYOUT_TO")));
add(layoutid_tf);
layoutid_tf.setText(action.substring(action.indexOf("(")+1,action.indexOf(")")));
}
......
......@@ -134,15 +134,5 @@ public class BooleanExpressionEvaluator {
return (op2.equals("not"));
}
return false;
}
public static void main (String[] args) {
BooleanExpressionEvaluator bee = new BooleanExpressionEvaluator();
bee.parse("( bool1 and bool2 ) or not ( bool3 and bool4 )");
String token = bee.getToken();
while(!token.isEmpty()) {
System.out.println(token);
token = bee.getToken();
}
}
}
}
......@@ -156,7 +156,11 @@ public class Config {
update_cb.setSelected(Boolean.parseBoolean(Config.get("autoupdate")));
JLabel lang_l = new JLabel(Language.get("WIN_PREFS_LANG_L"));
File[] lang_files = new File("lang").listFiles();
File[] lang_files = new File("lang").listFiles(new FileFilter() {
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".txt");
}
});
String[] lang_choices = new String[lang_files.length];
int sel = 0;
for(int i=0;i<lang_files.length;i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment