no message
This commit is contained in:
parent
1e6ab8eeec
commit
fab76cb82e
2 changed files with 105 additions and 131 deletions
|
@ -49,6 +49,7 @@ import org.thdl.util.ThdlActionListener;
|
||||||
import org.thdl.util.ThdlAbstractAction;
|
import org.thdl.util.ThdlAbstractAction;
|
||||||
import org.thdl.util.ThdlOptions;
|
import org.thdl.util.ThdlOptions;
|
||||||
import org.thdl.util.SimpleSpinner;
|
import org.thdl.util.SimpleSpinner;
|
||||||
|
import org.thdl.util.ThdlI18n;
|
||||||
|
|
||||||
public class QD extends JDesktopPane {
|
public class QD extends JDesktopPane {
|
||||||
private final static JskadKeyboardManager keybdMgr
|
private final static JskadKeyboardManager keybdMgr
|
||||||
|
@ -79,10 +80,6 @@ public class QD extends JDesktopPane {
|
||||||
public Style componentStyle;
|
public Style componentStyle;
|
||||||
public DataFlavor timeFlavor;
|
public DataFlavor timeFlavor;
|
||||||
|
|
||||||
/** Either "qt4j" or "jmf", corresponding to the thdl.media.player
|
|
||||||
property. */
|
|
||||||
protected String thdl_mediaplayer_property = null;
|
|
||||||
|
|
||||||
//class fields because they are affected depending on whether we're
|
//class fields because they are affected depending on whether we're
|
||||||
//in read-only or edit mode
|
//in read-only or edit mode
|
||||||
protected JMenu editMenu, searchMenu;
|
protected JMenu editMenu, searchMenu;
|
||||||
|
@ -103,9 +100,12 @@ public class QD extends JDesktopPane {
|
||||||
protected KeyStroke insert1TimeKey, insert2TimesKey, insertSpeakerKey;
|
protected KeyStroke insert1TimeKey, insert2TimesKey, insertSpeakerKey;
|
||||||
protected KeyStroke findKey, replaceKey;
|
protected KeyStroke findKey, replaceKey;
|
||||||
|
|
||||||
|
protected JskadKeyboard activeKeyboard = null;
|
||||||
|
protected JskadKeyboard wylieKeyboard;
|
||||||
|
|
||||||
public QD(ResourceBundle messages) {
|
|
||||||
this.messages = messages;
|
public QD() {
|
||||||
|
messages = ThdlI18n.getResourceBundle();
|
||||||
|
|
||||||
setBackground(new JFrame().getBackground());
|
setBackground(new JFrame().getBackground());
|
||||||
setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
|
setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
|
||||||
|
@ -167,6 +167,10 @@ public QD(ResourceBundle messages) {
|
||||||
SpeakerData speakerData = new SpeakerData(speakers, keymap);
|
SpeakerData speakerData = new SpeakerData(speakers, keymap);
|
||||||
speakerTable = new SpeakerTable(speakerData);
|
speakerTable = new SpeakerTable(speakerData);
|
||||||
|
|
||||||
|
//FIXME when save/load bug is fixed
|
||||||
|
JskadKeyboard[] allKeyboards = JskadKeyboardFactory.getAllAvailableJskadKeyboards();
|
||||||
|
wylieKeyboard = allKeyboards[0];
|
||||||
|
|
||||||
pane = new DuffPane();
|
pane = new DuffPane();
|
||||||
pane.setKeymap(keymap);
|
pane.setKeymap(keymap);
|
||||||
new TimePointDropTarget(pane);
|
new TimePointDropTarget(pane);
|
||||||
|
@ -321,10 +325,8 @@ class TimePoint extends JLabel implements DragGestureListener, DragSourceListene
|
||||||
return String.valueOf(time);
|
return String.valueOf(time);
|
||||||
}
|
}
|
||||||
public void playSegment() {
|
public void playSegment() {
|
||||||
int i=pos.getOffset();
|
|
||||||
System.out.println(String.valueOf(i));
|
|
||||||
try {
|
try {
|
||||||
for (i++; i<doc.getLength(); i++) {
|
for (int i=pos.getOffset()+1; i<doc.getLength(); i++) {
|
||||||
AttributeSet attr = doc.getCharacterElement(i).getAttributes();
|
AttributeSet attr = doc.getCharacterElement(i).getAttributes();
|
||||||
Component comp;
|
Component comp;
|
||||||
if (null != (comp = StyleConstants.getComponent(attr)))
|
if (null != (comp = StyleConstants.getComponent(attr)))
|
||||||
|
@ -511,7 +513,7 @@ class TimeCodeManager extends JPanel {
|
||||||
JButton playPauseButton = new JButton(messages.getString("PlayPause"));
|
JButton playPauseButton = new JButton(messages.getString("PlayPause"));
|
||||||
playPauseButton.addActionListener(new ThdlActionListener() {
|
playPauseButton.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
if (player != null) {
|
if (player != null && player.getMediaURL() != null) {
|
||||||
try {
|
try {
|
||||||
if (player.isPlaying())
|
if (player.isPlaying())
|
||||||
player.cmd_stop();
|
player.cmd_stop();
|
||||||
|
@ -571,37 +573,23 @@ class Work {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaPlayerProperty(String property) {
|
public void setMediaPlayer(SmartMoviePanel smp) {
|
||||||
if (property.equals("org.thdl.media.SmartJMFPlayer") || property.equals("org.thdl.media.SmartQT4JPlayer"))
|
if (smp == null)
|
||||||
if (thdl_mediaplayer_property == null || !thdl_mediaplayer_property.equals(property)) {
|
player = null;
|
||||||
thdl_mediaplayer_property = new String(property);
|
else if (player == null || !player.equals(smp)) {
|
||||||
if (project != null) {
|
player = smp;
|
||||||
URL url = project.getMedia();
|
player.setParentContainer(QD.this);
|
||||||
if (url != null) {
|
if (project != null) {
|
||||||
project.setMedia(null);
|
URL url = project.getMedia();
|
||||||
project.setMedia(url);
|
if (url != null) {
|
||||||
}
|
project.setMedia(null);
|
||||||
|
project.setMedia(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public String getMediaPlayerProperty() {
|
|
||||||
//if already set, return current media player
|
|
||||||
if (thdl_mediaplayer_property == null) {
|
|
||||||
//else get default based on system, user prefs, etc.
|
|
||||||
String os;
|
|
||||||
try {
|
|
||||||
os = System.getProperty("os.name").toLowerCase();
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
os = "unknown";
|
|
||||||
}
|
|
||||||
if (os.indexOf("mac") != -1) //macs default to org.thdl.media.SmartQT4JPlayer
|
|
||||||
thdl_mediaplayer_property = ThdlOptions.getStringOption("thdl.media.player", "org.thdl.media.SmartQT4JPlayer");
|
|
||||||
else if (os.indexOf("windows") != -1)
|
|
||||||
thdl_mediaplayer_property = ThdlOptions.getStringOption("thdl.media.player", "org.thdl.media.SmartJMFPlayer");
|
|
||||||
else //put linux etc. here
|
|
||||||
thdl_mediaplayer_property = ThdlOptions.getStringOption("thdl.media.player", "org.thdl.media.SmartJMFPlayer");
|
|
||||||
}
|
}
|
||||||
return thdl_mediaplayer_property;
|
}
|
||||||
|
public SmartMoviePanel getMediaPlayer() {
|
||||||
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Project extends JPanel {
|
class Project extends JPanel {
|
||||||
|
@ -641,10 +629,14 @@ public URL getMedia() {
|
||||||
return media;
|
return media;
|
||||||
}
|
}
|
||||||
public void setMedia(URL url) {
|
public void setMedia(URL url) {
|
||||||
|
if (player == null) {
|
||||||
|
JOptionPane.showConfirmDialog(QD.this, messages.getString("SupportedMediaError"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
media = url;
|
media = url;
|
||||||
mediaField.setText("");
|
mediaField.setText("");
|
||||||
if (player != null) {
|
if (player.getMediaURL() != null) {
|
||||||
try {
|
try {
|
||||||
player.cmd_stop();
|
player.cmd_stop();
|
||||||
player.destroy();
|
player.destroy();
|
||||||
|
@ -656,7 +648,6 @@ public void setMedia(URL url) {
|
||||||
videoFrame.getContentPane().invalidate();
|
videoFrame.getContentPane().invalidate();
|
||||||
videoFrame.getContentPane().validate();
|
videoFrame.getContentPane().validate();
|
||||||
videoFrame.getContentPane().repaint();
|
videoFrame.getContentPane().repaint();
|
||||||
player = null;
|
|
||||||
videoFrame.setSize(new Dimension(QD.this.getSize().width / 2, 0));
|
videoFrame.setSize(new Dimension(QD.this.getSize().width / 2, 0));
|
||||||
jtp.remove(tcp);
|
jtp.remove(tcp);
|
||||||
tcp = null;
|
tcp = null;
|
||||||
|
@ -664,11 +655,10 @@ public void setMedia(URL url) {
|
||||||
actionFrame.setSize(new Dimension(actionFrame.getSize().width, QD.this.getSize().height));
|
actionFrame.setSize(new Dimension(actionFrame.getSize().width, QD.this.getSize().height));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (player != null) {
|
if (player.getMediaURL() != null) {
|
||||||
try {
|
try {
|
||||||
player.cmd_stop();
|
player.cmd_stop();
|
||||||
player.destroy();
|
player.destroy();
|
||||||
player = null;
|
|
||||||
} catch (SmartMoviePanelException smpe) {
|
} catch (SmartMoviePanelException smpe) {
|
||||||
smpe.printStackTrace();
|
smpe.printStackTrace();
|
||||||
ThdlDebug.noteIffyCode();
|
ThdlDebug.noteIffyCode();
|
||||||
|
@ -676,24 +666,12 @@ public void setMedia(URL url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class mediaClass = Class.forName(getMediaPlayerProperty());
|
player.loadMovie(url);
|
||||||
Class[] mediaArgsClass = new Class[] {Container.class, URL.class};
|
|
||||||
Object[] mediaArgs = new Object[] {QD.this, url};
|
|
||||||
Constructor mediaConstructor = mediaClass.getConstructor(mediaArgsClass);
|
|
||||||
player = (SmartMoviePanel)QD.createObject(mediaConstructor, mediaArgs);
|
|
||||||
if (null == player) throw new ClassNotFoundException("FIXME: the constructor failed.");
|
|
||||||
media = url;
|
media = url;
|
||||||
mediaField.setText(media.getPath());
|
mediaField.setText(media.getPath());
|
||||||
startTimer();
|
startTimer();
|
||||||
|
} catch (SmartMoviePanelException smpe) {
|
||||||
//FIXME if neither media player is supported then friendly error rather than just doing nothing
|
smpe.printStackTrace();
|
||||||
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException cnfe) {
|
|
||||||
cnfe.printStackTrace();
|
|
||||||
ThdlDebug.noteIffyCode();
|
|
||||||
} catch (NoSuchMethodException nsme) {
|
|
||||||
nsme.printStackTrace();
|
|
||||||
ThdlDebug.noteIffyCode();
|
ThdlDebug.noteIffyCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -766,16 +744,26 @@ public Project() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeKeyboard(JskadKeyboard kbd) {
|
public void changeKeyboard(JskadKeyboard kbd) {
|
||||||
|
activeKeyboard = kbd;
|
||||||
DuffPane dp = (DuffPane)pane;
|
DuffPane dp = (DuffPane)pane;
|
||||||
kbd.activate(dp);
|
activeKeyboard.activate(dp);
|
||||||
kbd.activate(sharedDP);
|
activeKeyboard.activate(sharedDP);
|
||||||
kbd.activate(sharedDP2);
|
activeKeyboard.activate(sharedDP2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveTranscript() {
|
public boolean saveTranscript() {
|
||||||
currentWork.stopWork();
|
currentWork.stopWork();
|
||||||
|
|
||||||
//URGENT!! fix saving problem (FIXME: grep for URGENT and fix or Fix or FIX)
|
//FIXME this should be replaced once the relevant bug in TibetanDocument is fixed
|
||||||
|
//FIXME: grep for URGENT and fix or Fix or FIX
|
||||||
|
|
||||||
|
DuffPane dp = (DuffPane)pane;
|
||||||
|
|
||||||
|
if (activeKeyboard != null) {
|
||||||
|
wylieKeyboard.activate(dp);
|
||||||
|
wylieKeyboard.activate(sharedDP);
|
||||||
|
wylieKeyboard.activate(sharedDP2);
|
||||||
|
}
|
||||||
|
|
||||||
org.jdom.Element title = new org.jdom.Element("title");
|
org.jdom.Element title = new org.jdom.Element("title");
|
||||||
title.setText(project.getTitle().trim());
|
title.setText(project.getTitle().trim());
|
||||||
|
@ -888,7 +876,14 @@ public boolean saveTranscript() {
|
||||||
File htmlOut = new File(f.substring(0, f.lastIndexOf('.')) + ".html");
|
File htmlOut = new File(f.substring(0, f.lastIndexOf('.')) + ".html");
|
||||||
transformer.transform(new JDOMSource(qdDoc), new StreamResult(new FileOutputStream(htmlOut)));
|
transformer.transform(new JDOMSource(qdDoc), new StreamResult(new FileOutputStream(htmlOut)));
|
||||||
|
|
||||||
//URGENT FIX SAVING PROBLEM (FIXME)
|
//FIXME this should be replaced once the relevant bug in TibetanDocument is fixed
|
||||||
|
//FIXME: grep for URGENT and fix or Fix or FIX
|
||||||
|
if (activeKeyboard != null) {
|
||||||
|
activeKeyboard.activate(dp);
|
||||||
|
activeKeyboard.activate(sharedDP);
|
||||||
|
activeKeyboard.activate(sharedDP2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
|
@ -948,22 +943,15 @@ public boolean loadTranscript(File t) {
|
||||||
clearProject();
|
clearProject();
|
||||||
project = new Project();
|
project = new Project();
|
||||||
|
|
||||||
//change keyboard back to wylie for a second
|
//FIXME this should be replaced once the relevant bug in TibetanDocument is fixed
|
||||||
// DuffPane dp = (DuffPane)pane;
|
//FIXME: grep for URGENT and fix or Fix or FIX
|
||||||
|
DuffPane dp = (DuffPane)pane;
|
||||||
|
|
||||||
//URGENT FIX LOADING PROBLEM
|
if (activeKeyboard != null) {
|
||||||
|
wylieKeyboard.activate(dp);
|
||||||
/*
|
wylieKeyboard.activate(sharedDP);
|
||||||
if (keyboard_url != null) {
|
wylieKeyboard.activate(sharedDP2);
|
||||||
|
}
|
||||||
dp.registerKeyboard();
|
|
||||||
// project.tName.setupKeyboard();
|
|
||||||
|
|
||||||
// project.tTask.setupKeyboard();
|
|
||||||
sharedDP.setupKeyboard();
|
|
||||||
sharedDP2.setupKeyboard();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
org.jdom.Document doc = builder.build(t);
|
org.jdom.Document doc = builder.build(t);
|
||||||
org.jdom.Element qd = doc.getRootElement();
|
org.jdom.Element qd = doc.getRootElement();
|
||||||
|
@ -1017,7 +1005,6 @@ if (keyboard_url != null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
org.jdom.Element text = qd.getChild("text");
|
org.jdom.Element text = qd.getChild("text");
|
||||||
DuffPane dp = (DuffPane)pane;
|
|
||||||
TibetanDocument tDoc = (TibetanDocument)dp.getDocument();
|
TibetanDocument tDoc = (TibetanDocument)dp.getDocument();
|
||||||
if (tDoc.getLength() > 0)
|
if (tDoc.getLength() > 0)
|
||||||
dp.setText("");
|
dp.setText("");
|
||||||
|
@ -1064,15 +1051,13 @@ if (keyboard_url != null) {
|
||||||
currentWork = new Work();
|
currentWork = new Work();
|
||||||
work.add(currentWork);
|
work.add(currentWork);
|
||||||
|
|
||||||
/* URGENT FIX LOADING PROBLEM
|
//FIXME this should be replaced once the relevant bug in TibetanDocument is fixed
|
||||||
if (keyboard_url != null) {
|
//FIXME: grep for URGENT and fix or Fix or FIX
|
||||||
dp.registerKeyboard(keyboard_url);
|
if (activeKeyboard != null) {
|
||||||
// project.tName.setupKeyboard();
|
activeKeyboard.activate(dp);
|
||||||
// project.tTask.setupKeyboard();
|
activeKeyboard.activate(sharedDP);
|
||||||
sharedDP.setupKeyboard();
|
activeKeyboard.activate(sharedDP2);
|
||||||
sharedDP2.setupKeyboard();
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
project.setTranscript(t);
|
project.setTranscript(t);
|
||||||
jtp.addTab(messages.getString("ProjectDetails"), project);
|
jtp.addTab(messages.getString("ProjectDetails"), project);
|
||||||
|
@ -1438,21 +1423,15 @@ class SpeakerTable extends JTable
|
||||||
|
|
||||||
public JMenuBar getTextMenuBar() {
|
public JMenuBar getTextMenuBar() {
|
||||||
JMenu modeMenu = new JMenu(messages.getString("Mode"));
|
JMenu modeMenu = new JMenu(messages.getString("Mode"));
|
||||||
JRadioButton editButton = new JRadioButton(messages.getString("Edit"));
|
JMenuItem editMenuItem = new JMenuItem(messages.getString("Edit"));
|
||||||
JRadioButton viewButton = new JRadioButton(messages.getString("ReadOnly"));
|
JMenuItem viewMenuItem = new JMenuItem(messages.getString("ReadOnly"));
|
||||||
editButton.setActionCommand("edit");
|
editMenuItem.setActionCommand("edit");
|
||||||
viewButton.setActionCommand("view");
|
viewMenuItem.setActionCommand("view");
|
||||||
RadioListener l = new RadioListener();
|
RadioListener l = new RadioListener();
|
||||||
editButton.addActionListener(l);
|
editMenuItem.addActionListener(l);
|
||||||
viewButton.addActionListener(l);
|
viewMenuItem.addActionListener(l);
|
||||||
editButton.setSelected(true);
|
modeMenu.add(editMenuItem);
|
||||||
ButtonGroup bg = new ButtonGroup();
|
modeMenu.add(viewMenuItem);
|
||||||
bg.add(editButton);
|
|
||||||
bg.add(viewButton);
|
|
||||||
JPanel buttons = new JPanel(new GridLayout(0,1));
|
|
||||||
buttons.add(editButton);
|
|
||||||
buttons.add(viewButton);
|
|
||||||
modeMenu.add(buttons);
|
|
||||||
|
|
||||||
JMenu viewMenu = new JMenu(messages.getString("View"));
|
JMenu viewMenu = new JMenu(messages.getString("View"));
|
||||||
JMenuItem previousItem = new JMenuItem(messages.getString("Previous"));
|
JMenuItem previousItem = new JMenuItem(messages.getString("Previous"));
|
||||||
|
|
|
@ -27,12 +27,14 @@ import java.awt.event.*;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
import javax.swing.text.rtf.*;
|
import javax.swing.text.rtf.*;
|
||||||
|
|
||||||
|
import org.thdl.media.*;
|
||||||
import org.thdl.util.ThdlDebug;
|
import org.thdl.util.ThdlDebug;
|
||||||
import org.thdl.util.ThdlActionListener;
|
import org.thdl.util.ThdlActionListener;
|
||||||
import org.thdl.util.ThdlOptions;
|
import org.thdl.util.ThdlOptions;
|
||||||
import org.thdl.tib.input.JskadKeyboardManager;
|
import org.thdl.tib.input.JskadKeyboardManager;
|
||||||
import org.thdl.tib.input.JskadKeyboardFactory;
|
import org.thdl.tib.input.JskadKeyboardFactory;
|
||||||
import org.thdl.tib.input.JskadKeyboard;
|
import org.thdl.tib.input.JskadKeyboard;
|
||||||
|
import org.thdl.util.ThdlI18n;
|
||||||
|
|
||||||
import org.thdl.savant.JdkVersionHacks;
|
import org.thdl.savant.JdkVersionHacks;
|
||||||
|
|
||||||
|
@ -59,15 +61,8 @@ public class QDShell extends JFrame {
|
||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
locale = new Locale(new String(args[0]), new String(args[1]));
|
locale = new Locale(new String(args[0]), new String(args[1]));
|
||||||
Locale[] locales = Locale.getAvailableLocales();
|
ThdlI18n.setLocale(locale);
|
||||||
for (int k=0; k<locales.length; k++)
|
|
||||||
if (locales[k].equals(locale)) {
|
|
||||||
JComponent.setDefaultLocale(locale);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
locale = Locale.getDefault();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
@ -75,15 +70,16 @@ public class QDShell extends JFrame {
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QDShell qdsh = new QDShell(locale);
|
QDShell qdsh = new QDShell();
|
||||||
qdsh.setVisible(true);
|
qdsh.setVisible(true);
|
||||||
} catch (NoClassDefFoundError err) {
|
} catch (NoClassDefFoundError err) {
|
||||||
ThdlDebug.handleClasspathError("QuillDriver's CLASSPATH", err);
|
ThdlDebug.handleClasspathError("QuillDriver's CLASSPATH", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QDShell(Locale locale) {
|
public QDShell() {
|
||||||
setTitle("QuillDriver");
|
setTitle("QuillDriver");
|
||||||
|
messages = ThdlI18n.getResourceBundle();
|
||||||
|
|
||||||
// Code for Merlin
|
// Code for Merlin
|
||||||
if (JdkVersionHacks.maximizedBothSupported(getToolkit())) {
|
if (JdkVersionHacks.maximizedBothSupported(getToolkit())) {
|
||||||
|
@ -102,9 +98,7 @@ public class QDShell extends JFrame {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
messages = ResourceBundle.getBundle("MessageBundle", locale);
|
qd = new QD();
|
||||||
|
|
||||||
qd = new QD(messages);
|
|
||||||
getContentPane().add(qd);
|
getContentPane().add(qd);
|
||||||
setJMenuBar(getQDShellMenu());
|
setJMenuBar(getQDShellMenu());
|
||||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
@ -277,26 +271,27 @@ public class QDShell extends JFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JMenu mediaPlayerMenu = new JMenu(messages.getString("MediaPlayer"));
|
JMenu mediaPlayerMenu = new JMenu(messages.getString("MediaPlayer"));
|
||||||
|
java.util.List moviePlayers = SmartPlayerFactory.getAllAvailableSmartPlayers();
|
||||||
JMenuItem jmfItem = new JMenuItem("Java Media Framework");
|
for (int i=0; i<moviePlayers.size(); i++) {
|
||||||
jmfItem.addActionListener(new ThdlActionListener() {
|
final SmartMoviePanel mPlayer = (SmartMoviePanel)moviePlayers.get(i);
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
JMenuItem mItem = new JMenuItem(mPlayer.getIdentifyingName());
|
||||||
qd.setMediaPlayerProperty("org.thdl.media.SmartJMFPlayer");
|
mItem.addActionListener(new ThdlActionListener() {
|
||||||
}
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
});
|
qd.setMediaPlayer(mPlayer);
|
||||||
|
}
|
||||||
JMenuItem qtItem = new JMenuItem("Quicktime for Java");
|
});
|
||||||
qtItem.addActionListener(new ThdlActionListener() {
|
mediaPlayerMenu.add(mItem);
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
}
|
||||||
qd.setMediaPlayerProperty("org.thdl.media.SmartQT4JPlayer");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JMenu preferencesMenu = new JMenu(messages.getString("Preferences"));
|
JMenu preferencesMenu = new JMenu(messages.getString("Preferences"));
|
||||||
preferencesMenu.add(keyboardMenu);
|
preferencesMenu.add(keyboardMenu);
|
||||||
preferencesMenu.add(mediaPlayerMenu);
|
if (moviePlayers.size() > 0) {
|
||||||
|
SmartMoviePanel defaultPlayer = (SmartMoviePanel)moviePlayers.get(0);
|
||||||
|
qd.setMediaPlayer(defaultPlayer); //set qd media player to default
|
||||||
|
if (moviePlayers.size() > 1)
|
||||||
|
preferencesMenu.add(mediaPlayerMenu);
|
||||||
|
}
|
||||||
|
|
||||||
JMenuBar bar = new JMenuBar();
|
JMenuBar bar = new JMenuBar();
|
||||||
bar.add(projectMenu);
|
bar.add(projectMenu);
|
||||||
|
|
Loading…
Reference in a new issue