Skip to content

Commit

Permalink
2005-05-04 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b17)
Browse files Browse the repository at this point in the history
	* GR and the GR applets are now able to run slideshows of G2
	  albums.
	* Slideshows can now start from a picture other than the first.
	  This is only available in the G2 applet right now.
	* Added debugging for thoses cases when some preferences are
	  missing.
  • Loading branch information
Pierre-Luc Paour committed May 4, 2005
1 parent b875f60 commit 205ae2a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 16 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2005-05-04 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b17)

* GR and the GR applets are now able to run slideshows of G2
albums.
* Slideshows can now start from a picture other than the first.
This is only available in the G2 applet right now.
* Added debugging for thoses cases when some preferences are
missing.

2005-05-02 Pierre-Luc Paour <gallery@paour.com> (1.4.2-b16)

* Added support for slideshows of G2 albums, a prelude to
Expand Down
4 changes: 4 additions & 0 deletions com/gallery/GalleryRemote/GRApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected AppletInfo getGRAppletInfo() {
String cookiePath = getParameter("gr_cookie_path");
String userAgent = getParameter("gr_user_agent");
String galleryVersion = getParameter("gr_gallery_version");
String slideshowFrom = getParameter("gr_slideshow_start_from");
//String cookie1Name = getParameter("gr_cookie1_name");
//String cookie1Value = getParameter("gr_cookie1_value");

Expand All @@ -113,6 +114,7 @@ protected AppletInfo getGRAppletInfo() {
Log.log(Log.LEVEL_INFO, MODULE, "gr_album: " + info.albumName);
Log.log(Log.LEVEL_INFO, MODULE, "gr_user_agent: " + userAgent);
Log.log(Log.LEVEL_INFO, MODULE, "gr_gallery_version: " + galleryVersion);
Log.log(Log.LEVEL_INFO, MODULE, "gr_slideshow_start_from: " + slideshowFrom);

if (cookieDomain == null || cookieDomain.length() < 1) {
try {
Expand Down Expand Up @@ -205,6 +207,7 @@ protected AppletInfo getGRAppletInfo() {
Log.logException(Log.LEVEL_ERROR, MODULE, e);
}
}
info.slideshowFrom = slideshowFrom;

CookieModule.discardAllCookies();
Cookie cookie = new Cookie(cookieName, cookieValue, cookieDomain, cookiePath, null, false);
Expand All @@ -227,5 +230,6 @@ protected AppletInfo getGRAppletInfo() {
class AppletInfo {
String albumName;
Gallery gallery;
String slideshowFrom;
}
}
21 changes: 18 additions & 3 deletions com/gallery/GalleryRemote/GRAppletSlideshow.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

/**
* Created by IntelliJ IDEA.
Expand All @@ -25,14 +26,15 @@ public class GRAppletSlideshow extends GRAppletMini implements GalleryRemoteCore
JButton jStart;
SlideshowPanel jSlidePanel;
SlideshowFrame slideshowFrame = null;
AppletInfo info;

public GRAppletSlideshow() {
coreClass = "com.gallery.GalleryRemote.GalleryRemoteMini";
}

public void startup() {
galleries = new DefaultComboBoxModel();
AppletInfo info = getGRAppletInfo();
info = getGRAppletInfo();

gallery = info.gallery;

Expand Down Expand Up @@ -112,9 +114,22 @@ public void contentsChanged(ListDataEvent e) {
new Thread() {
public void run() {
slideshowFrame = new SlideshowFrame();
int index = 0;
ArrayList picturesList = album.getPicturesList();

if (info.slideshowFrom != null) {
for (int i = 0; i < picturesList.size(); i++) {
if (info.slideshowFrom.equals(((Picture) picturesList.get(i)).getUniqueId())) {
Log.log(Log.LEVEL_TRACE, MODULE, "Starting slideshow from index " + i);
index = i;
slideshowFrame.wantIndex = i;
break;
}
}
}

if (album.getSize() > 0) {
ImageUtils.download((Picture) album.getPicturesList().get(0), getGraphicsConfiguration().getBounds().getSize(), GalleryRemote._().getCore().getMainStatusUpdate(), null);
if (album.getSize() > index) {
ImageUtils.download((Picture) picturesList.get(index), getGraphicsConfiguration().getBounds().getSize(), GalleryRemote._().getCore().getMainStatusUpdate(), null);
} else {
JOptionPane.showMessageDialog(GRAppletSlideshow.this, GRI18n.getString(MODULE, "emptyAlbum"));
}
Expand Down
12 changes: 10 additions & 2 deletions com/gallery/GalleryRemote/GalleryComm2.java
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,13 @@ private void fetch(Album a, String albumName, ArrayList newPictures)
height = p.getIntProperty("image.raw_height." + i, 0);
picture.setSizeFull(new Dimension(width, height));
picture.setFileSize(p.getIntProperty("image.raw_filesize." + i));

picture.setUniqueId(a.getName() + '_' + rawName);
}

String forceExtension = p.getProperty("image.forceExtension." + i);
if (forceExtension != null) {
picture.setForceExtension(forceExtension);
}

String resizedName = p.getProperty("image.resizedName." + i);
Expand Down Expand Up @@ -1154,7 +1161,7 @@ private void fetch(Album a, String albumName, ArrayList newPictures)
}
}

picture.setHidden(p.getBooleanProperty("image.hidden." + i));
picture.setHidden(p.getBooleanProperty("image.hidden." + i, false));

picture.setAlbumOnServer(a);
picture.setIndexOnServer(i - 1);
Expand Down Expand Up @@ -1284,7 +1291,8 @@ GalleryProperties requestResponse(NVPair form_data[], byte[] data, URL galUrl, b
GalleryProperties requestResponse(NVPair form_data[], byte[] data, URL galUrl, boolean checkResult, StatusUpdate su, GalleryComm2.GalleryTask task, boolean alreadyRetried) throws GR2Exception, ModuleException, IOException {
// assemble the URL
String urlPath = galUrl.getFile();
Log.log(Log.LEVEL_TRACE, MODULE, "Connecting to: " + urlPath);
Log.log(Log.LEVEL_TRACE, MODULE, "Connecting to: " + galUrl);
Log.log(Log.LEVEL_TRACE, MODULE, "Path: " + urlPath);

if (data != null) {
su.startProgress(StatusUpdate.LEVEL_UPLOAD_ONE, 0, 0, GRI18n.getString(MODULE, "upStart"), false);
Expand Down
11 changes: 9 additions & 2 deletions com/gallery/GalleryRemote/GalleryComm2_5.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public class GalleryComm2_5 extends GalleryComm2 {
/** Remote scriptname that provides version 2 of the protocol on the server. */
public static final String SCRIPT_NAME = "main.php?g2_controller=remote:GalleryRemote&g2_form[cmd]=no-op";

public static final boolean ZEND_DEBUG = true;
public static final boolean ZEND_DEBUG = false;

private static int[] capabilities2;
private static int[] capabilities3;
private static int[] capabilities4;

protected GalleryComm2_5(Gallery g) {
super(g);
Expand All @@ -35,9 +36,13 @@ protected GalleryComm2_5(Gallery g) {
CAPA_FETCH_HIERARCHICAL/*, CAPA_ALBUM_INFO, CAPA_NEW_ALBUM*/, CAPA_FETCH_ALBUMS_PRUNE};
capabilities3 = new int[]{CAPA_UPLOAD_FILES, CAPA_FETCH_ALBUMS, CAPA_UPLOAD_CAPTION,
CAPA_FETCH_HIERARCHICAL/*, CAPA_ALBUM_INFO*/, CAPA_NEW_ALBUM, CAPA_FETCH_ALBUMS_PRUNE};
capabilities4 = new int[]{CAPA_UPLOAD_FILES, CAPA_FETCH_ALBUMS, CAPA_UPLOAD_CAPTION,
CAPA_FETCH_HIERARCHICAL/*, CAPA_ALBUM_INFO*/, CAPA_NEW_ALBUM, CAPA_FETCH_ALBUMS_PRUNE,
CAPA_FETCH_ALBUM_IMAGES};

Arrays.sort(capabilities2);
Arrays.sort(capabilities3);
Arrays.sort(capabilities4);

g.setGalleryVersion(2);
}
Expand Down Expand Up @@ -86,7 +91,9 @@ public NVPair[] fudgeFormParameters(NVPair form_data[]) {
}

void handleCapabilities() {
if (serverMinorVersion >= 3) {
if (serverMinorVersion >= 4) {
capabilities = capabilities4;
} else if (serverMinorVersion >= 3) {
capabilities = capabilities3;
} else {
capabilities = capabilities2;
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/model/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void setSource(File source) {
}

setCaption(filename);
} else if (GalleryRemote._().properties.getBooleanProperty(SET_CAPTIONS_WITH_METADATA_COMMENT)
} else if (GalleryRemote._().properties.getBooleanProperty(SET_CAPTIONS_WITH_METADATA_COMMENT, false)
&& getExifData() != null && getExifData().getCaption() != null) {
setCaption(getExifData().getCaption());
}
Expand Down
12 changes: 6 additions & 6 deletions com/gallery/GalleryRemote/prefs/GalleryProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public Dimension getDimensionProperty(String key) {
return new Dimension(Integer.parseInt(st.nextToken()),
Integer.parseInt(st.nextToken()));
} else {
Log.log(Log.LEVEL_ERROR, MODULE, "Parameter " + key + " is missing or malformed (should be width,height)");
Log.log(Log.LEVEL_ERROR, MODULE, "Parameter " + key + " = " + value + " is missing or malformed (should be width,height)");
return null;
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ public Color getColorProperty(String key) {
Integer.parseInt(st.nextToken()),
Integer.parseInt(st.nextToken()));
} else {
Log.log(Log.LEVEL_ERROR, MODULE, "Parameter " + key + " is missing or malformed (should be red,green,blue)");
Log.log(Log.LEVEL_ERROR, MODULE, "Parameter " + key + " = " + value + " is missing or malformed (should be red,green,blue)");
return null;
}
}
Expand Down Expand Up @@ -385,7 +385,7 @@ public boolean getBooleanProperty(String key) {
}
}

throw new NumberFormatException("Parameter " + key + " is missing or malformed (should be true/yes or false/no)");
throw new NumberFormatException("Parameter " + key + " = " + booleanS + " is missing or malformed (should be true/yes or false/no)");
}

public boolean getBooleanProperty(String key, boolean defaultValue) {
Expand All @@ -406,7 +406,7 @@ public int getIntProperty(String key) {
try {
return Integer.valueOf(intS).intValue();
} catch (Exception e) {
throw new NumberFormatException("Parameter " + key + " is missing or malformed (should be an integer value)");
throw new NumberFormatException("Parameter " + key + " = " + intS + " is missing or malformed (should be an integer value)");
}
}

Expand All @@ -430,7 +430,7 @@ public String getBase64Property(String key) {
try {
return Base64.decode(base64S);
} catch (Error e) {
throw new NumberFormatException("Parameter " + key + " is missing or malformed (should be a Base64 value)");
throw new NumberFormatException("Parameter " + key + " = " + base64S + " is missing or malformed (should be a Base64 value)");
}
}

Expand All @@ -446,7 +446,7 @@ public Date getDateProperty(String key) {
try {
return dateFormat.parse(dateS);
} catch (ParseException e) {
throw new NumberFormatException("Parameter " + key + " is missing or malformed (should be a Date value (yyyy/mm/dd))");
throw new NumberFormatException("Parameter " + key + " = " + dateS + " is missing or malformed (should be a Date value (yyyy/mm/dd))");
}
}

Expand Down
4 changes: 2 additions & 2 deletions defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p
#
# --- Do not edit below this line ---
#
version=1.4.2-b16
releaseDate=2005/05/02
version=1.4.2-b17
releaseDate=2005/05/04
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

0 comments on commit 205ae2a

Please sign in to comment.