diff --git a/ChangeLog b/ChangeLog index 11b105d..f5861fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-31 Pierre-Luc Paour (1.5.1-b39) + + * Users can select Gallery URLs that GR should automatically + log into on startup (thanks Brian Egge). + * Fixed minor issues with editing image properties and extra fields. + 2008-07-07 Pierre-Luc Paour (1.5.1-b38) * No longer loading thumbnails in the slideshow applet. diff --git a/com/gallery/GalleryRemote/MainFrame.java b/com/gallery/GalleryRemote/MainFrame.java index 16e0ecf..24f1ce6 100644 --- a/com/gallery/GalleryRemote/MainFrame.java +++ b/com/gallery/GalleryRemote/MainFrame.java @@ -295,6 +295,28 @@ private void setGalleries(DefaultComboBoxModel galleries) { jGalleryCombo.setModel(galleries); galleries.addListDataListener(this); + + boolean foundAutoLoad = false; + for (int i = 0; i < galleries.getSize(); i++) { + Gallery g = (Gallery) galleries.getElementAt(i); + + if (g.isAutoLoadOnStartup()) { + // load the Gallery + // login may have failed and caused getComm to be null. + GalleryComm comm = g.getComm(jStatusBar); + + // may have tried to connect and failed + if (comm != null && !GalleryComm.wasAuthFailure()) { + fetchAlbums(); + } + + if (!foundAutoLoad) { + jGalleryCombo.setSelectedIndex(i); + foundAutoLoad = true; + } + } + } + selectedGalleryChanged(); // We've been initalized, we are now clean. @@ -1053,8 +1075,12 @@ private void jbInit() , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 2, 2, 2), 0, 0)); jInspectorDivider.add(jInspectorPanel, JSplitPane.RIGHT); jInspectorDivider.add(jAlbumPictureDivider, JSplitPane.LEFT); - jInspectorPanel.add(new JScrollPane(jPictureInspector), CARD_PICTURE); - jInspectorPanel.add(new JScrollPane(jAlbumInspector), CARD_ALBUM); + JScrollPane pictureInspectorScroll = new JScrollPane(jPictureInspector); + pictureInspectorScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jInspectorPanel.add(pictureInspectorScroll, CARD_PICTURE); + JScrollPane albumInspectorScroll = new JScrollPane(jAlbumInspector); + albumInspectorScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jInspectorPanel.add(albumInspectorScroll, CARD_ALBUM); jAlbumPictureDivider.add(jPictureScroll, JSplitPane.RIGHT); jAlbumPictureDivider.add(jAlbumPanel, JSplitPane.LEFT); jAlbumPanel.add(jAlbumScroll, BorderLayout.CENTER); diff --git a/com/gallery/GalleryRemote/PictureInspector.java b/com/gallery/GalleryRemote/PictureInspector.java index c240c10..7a9e1d5 100644 --- a/com/gallery/GalleryRemote/PictureInspector.java +++ b/com/gallery/GalleryRemote/PictureInspector.java @@ -49,7 +49,7 @@ public class PictureInspector extends JPanel HashMap extraLabels = new HashMap(); HashMap extraTextAreas = new HashMap(); - String currentExtraFields = null; + ArrayList currentExtraFields = null; JLabel jLabel5 = new JLabel(); JLabel jLabel6 = new JLabel(); @@ -113,6 +113,7 @@ private void jbInit() { jSize.setFont(UIManager.getFont("Label.font")); jSize.setBackground(UIManager.getColor("TextField.inactiveBackground")); jCaption.setLineWrap(true); + jCaption.setWrapStyleWord(true); jCaption.setEditable(false); jCaption.setFont(UIManager.getFont("Label.font")); jCaption.setBackground(UIManager.getColor("TextField.inactiveBackground")); @@ -183,8 +184,8 @@ private void jbInit() { , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(1, 0, 0, 0), 2, 0)); add(jLabel2, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0)); - add(jSpacer, new GridBagConstraints(0, 20, 2, 1, 1.0, 0.1 - , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); + add(jSpacer, new GridBagConstraints(0, 99, 2, 1, 1.0, 0.1 + , GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); add(jIconAreaPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); @@ -460,6 +461,8 @@ void addExtraFields(Picture p) { JTextArea field = new JTextArea(); extraTextAreas.put(name, field); field.setFont(UIManager.getFont("Label.font")); + field.setLineWrap(true); + field.setWrapStyleWord(true); add(field, new GridBagConstraints(1, FIRST_ROW_EXTRA + i, 1, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 0, 0), 0, 0)); field.getDocument().addDocumentListener(this); @@ -467,13 +470,14 @@ void addExtraFields(Picture p) { i++; } + + currentExtraFields = newExtraFields; } Iterator it = newExtraFields.iterator(); while (it.hasNext()) { String name = (String) it.next(); String value = p.getExtraField(name); - JTextArea field = (JTextArea) extraTextAreas.get(name); if (value == null) { field.setText(""); @@ -499,6 +503,8 @@ void removeExtraFields() { extraLabels.clear(); extraTextAreas.clear(); + + currentExtraFields = null; } public void setEnabled(boolean enabled) { diff --git a/com/gallery/GalleryRemote/model/Gallery.java b/com/gallery/GalleryRemote/model/Gallery.java index d4bb313..8926b05 100644 --- a/com/gallery/GalleryRemote/model/Gallery.java +++ b/com/gallery/GalleryRemote/model/Gallery.java @@ -59,6 +59,7 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc String alias; String userAgent = "Gallery Remote " + GalleryRemote._().properties.getProperty("version"); int type = TYPE_STANDALONE; + boolean autoLoadOnStartup = false; transient GalleryComm comm = null; @@ -680,6 +681,7 @@ public static Gallery readFromProperties(GalleryProperties p, int prefsIndex, St g.forceGalleryVersion = p.getIntProperty(FORCE_GALLERY_VERSION + prefsIndex, 0); g.forceProtocolEncoding = p.getProperty(FORCE_PROTOCOL_ENCODING + prefsIndex); g.resizeJpegQuality = p.getIntProperty(RESIZE_JPEG_QUALITY + prefsIndex, -1); + g.autoLoadOnStartup = p.getBooleanProperty(AUTO_LOAD_ON_STARTUP + prefsIndex, false); g.setPrefsIndex(prefsIndex); @@ -724,6 +726,9 @@ public void writeToProperties(PropertiesFile p) { if (glGalleryUrlString != null) { p.setProperty(GL_GALLERY_URL + prefsIndex, glGalleryUrlString); } + if (autoLoadOnStartup) { + p.setBooleanProperty(AUTO_LOAD_ON_STARTUP + prefsIndex, autoLoadOnStartup); + } } public static void removeFromProperties(PropertiesFile p, int n) { @@ -738,6 +743,10 @@ public static void removeFromProperties(PropertiesFile p, int n) { p.setProperty(PHPN_LOGIN_URL + n, null); p.setProperty(PHPN_GALLERY_URL + n, null); p.setProperty(ALIAS + n, null); + p.setProperty(FORCE_GALLERY_VERSION + n, null); + p.setProperty(FORCE_PROTOCOL_ENCODING + n, null); + p.setProperty(RESIZE_JPEG_QUALITY + n, null); + p.setProperty(AUTO_LOAD_ON_STARTUP + n, null); } public void setPrefsIndex(int prefsIndex) { @@ -954,6 +963,18 @@ public void setAuthToken(String authToken) { this.authToken = authToken; } + public boolean isAutoLoadOnStartup() { + return autoLoadOnStartup; + } + + public void setAutoLoadOnStartup(boolean autoLoadOnStartup) { + this.autoLoadOnStartup = autoLoadOnStartup; + + if (!blockWrites) { + GalleryRemote._().properties.setBooleanProperty(AUTO_LOAD_ON_STARTUP + prefsIndex, autoLoadOnStartup); + } + } + class TreeEnumeration implements Enumeration { protected TreeNode root; protected Enumeration children; diff --git a/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java b/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java index 7250fb2..9c7d723 100644 --- a/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java +++ b/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java @@ -60,6 +60,8 @@ public class GalleryEditorDialog extends JDialog implements ActionListener { JPanel jStandalone = new JPanel(); JTextField jStandaloneUrl = new JTextField(); + + JCheckBox jAutoLogin = new JCheckBox(); JPanel jButtonPanel = new JPanel(); JButton jOk = new JButton(); @@ -139,17 +141,17 @@ private void jbInit() { jGlHelpLabel.setPreferredSize(new Dimension(300, 80)); jGlHelpLabel.setText(GRI18n.getString(MODULE, "glHelp")); jGlHelpLabel.setVerticalAlignment(SwingConstants.TOP); + + jAutoLogin.setText(GRI18n.getString(MODULE, "autoLogin")); this.getContentPane().add(jMainPanel, BorderLayout.CENTER); - jMainPanel.add(jStylePanel, new GridBagConstraints(0, 4, 4, 1, 1.0, 1.0 - , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); jMainPanel.add(jUsernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); jMainPanel.add(jAliasLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); jMainPanel.add(jPasswordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); - jMainPanel.add(jTypeLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 + jMainPanel.add(jTypeLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); jMainPanel.add(jAlias, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); @@ -157,9 +159,13 @@ private void jbInit() { , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); jMainPanel.add(jPassword, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); - jMainPanel.add(jType, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 + jMainPanel.add(jAutoLogin, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 + , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); + jMainPanel.add(jType, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); - jMainPanel.add(jButtonPanel, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0 + jMainPanel.add(jStylePanel, new GridBagConstraints(0, 5, 4, 1, 1.0, 1.0 + , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); + jMainPanel.add(jButtonPanel, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0)); jButtonPanel.add(jOk, null); jButtonPanel.add(jCancel, null); @@ -234,6 +240,8 @@ public void resetUIState() { jGlGalleryUrl.setText(gallery.getGlGalleryUrlString()); jGlLoginUrl.setText(gallery.getGlLoginUrlString()); + + jAutoLogin.setSelected(gallery.isAutoLoadOnStartup()); } public void readUIState() { @@ -253,6 +261,8 @@ public void readUIState() { gallery.setGlLoginUrlString(jGlLoginUrl.getText()); gallery.setGlGalleryUrlString(jGlGalleryUrl.getText()); + + gallery.setAutoLoadOnStartup(jAutoLogin.isSelected()); } public void actionPerformed(ActionEvent e) { diff --git a/com/gallery/GalleryRemote/prefs/PreferenceNames.java b/com/gallery/GalleryRemote/prefs/PreferenceNames.java index fe46547..2f59f51 100644 --- a/com/gallery/GalleryRemote/prefs/PreferenceNames.java +++ b/com/gallery/GalleryRemote/prefs/PreferenceNames.java @@ -57,6 +57,7 @@ public interface PreferenceNames { public static final String FORCE_GALLERY_VERSION = "forceGalleryVersion."; public static final String FORCE_PROTOCOL_ENCODING = "forceProtocolEncoding."; public static final String RESIZE_JPEG_QUALITY = "resizeJpegQuality."; + public static final String AUTO_LOAD_ON_STARTUP = "autoLoadOnStartup."; // Proxy panel public static final String USE_PROXY = "useProxy"; diff --git a/com/gallery/GalleryRemote/prefs/URLPanel.java b/com/gallery/GalleryRemote/prefs/URLPanel.java index e416d9b..8b40730 100644 --- a/com/gallery/GalleryRemote/prefs/URLPanel.java +++ b/com/gallery/GalleryRemote/prefs/URLPanel.java @@ -202,6 +202,10 @@ public void resetUIState() { username = "<Not set>"; } sb.append(GRI18n.getString(MODULE, "username")).append(username).append("
"); + + if (selectedGallery.isAutoLoadOnStartup()) { + sb.append(GRI18n.getString(MODULE, "autoLogin")).append("
"); + } sb.append(""); @@ -235,6 +239,12 @@ public Component getListCellRendererComponent( Gallery g = (Gallery) value; setText(g.toString()); + + if (g.isAutoLoadOnStartup()) { + setFont(getFont().deriveFont(Font.BOLD)); + } else { + setFont(getFont().deriveFont(Font.PLAIN)); + } return this; } diff --git a/com/gallery/GalleryRemote/resources/GRResources.properties b/com/gallery/GalleryRemote/resources/GRResources.properties index b1ef422..1152034 100644 --- a/com/gallery/GalleryRemote/resources/GRResources.properties +++ b/com/gallery/GalleryRemote/resources/GRResources.properties @@ -97,6 +97,7 @@ GEdiDlog.alias = Alias GEdiDlog.aliasTip = A short name to describe the Gallery.
It will be used in Gallery Remote to display a short \ name for the Gallery.
Leave empty to use the URL. +GEdiDlog.autoLogin = Automatically log in to this Gallery on startup #GeneralPa module GeneralPa.icon = General @@ -265,6 +266,7 @@ URLPa.phpnGllryURL = PHPNuke Gallery URL: URLPa.glLoginURL = Geeklog login URL: URLPa.glGllryURL = Geeklog Gallery URL: URLPa.username = Username: +URLPa.autoLogin = Automatically log in to this Gallery on startup #About module diff --git a/defaults.properties b/defaults.properties index 612bc69..1a54b78 100644 --- a/defaults.properties +++ b/defaults.properties @@ -322,6 +322,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p # # --- Do not edit below this line --- # -version=1.5.1-b38 -releaseDate=2008/07/07 +version=1.5.1-b39 +releaseDate=2008/07/31 aboutText=Gallery Remote\n \n \nA part of the Gallery Open-Source Project\nhttp://gallery.sourceforge.net\n \n \nMaintained by:\n \nPierre-Luc Paour\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\nChris Schwerdt\nSeth Ladd\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor\nSaverBeans