Skip to content

Commit

Permalink
2004-02-10 Pierre-Luc Paour <gallery@paour.com> (1.3-b29)
Browse files Browse the repository at this point in the history
	* Added support for flushing caches. This is useful when uploading
	  from a removable media where the picture names may be the same.
	* Added support for limiting the number of images in a slideshow,
	  similar to the javascript version. Also for disabling recursion.
  • Loading branch information
Pierre-Luc Paour committed Feb 11, 2004
1 parent 2385937 commit 6fa825a
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 18 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2004-02-10 Pierre-Luc Paour <gallery@paour.com> (1.3-b29)

* Added support for flushing caches. This is useful when uploading
from a removable media where the picture names may be the same.
* Added support for limiting the number of images in a slideshow,
similar to the javascript version. Also for disabling recursion.

2004-02-09 Pierre-Luc Paour <gallery@paour.com> (1.3-b28)

* Fixed yet another concurrency problem in slideshow, when using
Expand Down
1 change: 1 addition & 0 deletions com/gallery/GalleryRemote/GRAppletMini.java
Expand Up @@ -195,6 +195,7 @@ public void keyPressed(KeyEvent e) {
public void jListKeyPressed(KeyEvent e) {
if (!inProgress) {
int vKey = e.getKeyCode();
Log.log(Log.LEVEL_TRACE, MODULE, "Key pressed: " + vKey);

switch (vKey) {
case KeyEvent.VK_DELETE:
Expand Down
8 changes: 6 additions & 2 deletions com/gallery/GalleryRemote/GRAppletSlideshow.java
Expand Up @@ -7,6 +7,7 @@
import com.gallery.GalleryRemote.model.Gallery;
import com.gallery.GalleryRemote.model.Picture;
import com.gallery.GalleryRemote.prefs.SlideshowPanel;
import com.gallery.GalleryRemote.prefs.PreferenceNames;

import javax.swing.*;
import javax.swing.event.ListDataListener;
Expand All @@ -32,7 +33,8 @@
* User: paour
* Date: Oct 30, 2003
*/
public class GRAppletSlideshow extends GRAppletMini implements GalleryRemoteCore, ActionListener, ListDataListener {
public class GRAppletSlideshow extends GRAppletMini implements GalleryRemoteCore, ActionListener, ListDataListener,
PreferenceNames {
public static final String MODULE = "AppletSlideshow";
JButton jStart;
SlideshowPanel jSlidePanel;
Expand All @@ -55,7 +57,9 @@ public void startup() {
album.setName(info.albumName);
album.addListDataListener(this);

album.fetchAlbumImages(jStatusBar, true);
album.fetchAlbumImages(jStatusBar,
GalleryRemote._().properties.getBooleanProperty(SLIDESHOW_RECURSIVE, true),
GalleryRemote._().properties.getIntProperty(SLIDESHOW_MAX_PICTURES, 0));
}

protected void jbInit() {
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/GalleryComm.java
Expand Up @@ -121,7 +121,7 @@ public String newAlbum(StatusUpdate su, Album parentAlbum,
throw new RuntimeException("This method is not available on this protocol");
}

public void fetchAlbumImages(StatusUpdate su, Album a, boolean recusive, boolean async) {
public void fetchAlbumImages(StatusUpdate su, Album a, boolean recusive, boolean async, int maxPictures) {
throw new RuntimeException("This method is not available on this protocol");
}

Expand Down
14 changes: 11 additions & 3 deletions com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -191,9 +191,9 @@ public String newAlbum(StatusUpdate su, Album parentAlbum,
return newAlbumTask.getNewAlbumName();
}

public void fetchAlbumImages(StatusUpdate su, Album a, boolean recusive, boolean async) {
public void fetchAlbumImages(StatusUpdate su, Album a, boolean recusive, boolean async, int maxPictures) {
FetchAlbumImagesTask fetchAlbumImagesTask = new FetchAlbumImagesTask(su,
a, recusive);
a, recusive, maxPictures);
doTask(fetchAlbumImagesTask, async);
}

Expand Down Expand Up @@ -1077,12 +1077,14 @@ public String getNewAlbumName() {
class FetchAlbumImagesTask extends GalleryTask {
Album a;
boolean recursive = false;
int maxPictures = 0;

FetchAlbumImagesTask(StatusUpdate su, Album a, boolean recursive) {
FetchAlbumImagesTask(StatusUpdate su, Album a, boolean recursive, int maxPictures) {
super(su);

this.a = a;
this.recursive = recursive;
this.maxPictures = maxPictures;
}

void runTask() {
Expand Down Expand Up @@ -1133,6 +1135,12 @@ private void fetch(Album a, String albumName, ArrayList newPictures)
int height;
ArrayList extraFields = a.getExtraFields();
for (int i = 1; i <= numImages; i++) {
if (maxPictures> 0 && newPictures.size() >= maxPictures) {
Log.log(Log.LEVEL_TRACE, MODULE, "Fetched maximum of " + maxPictures +
" pictures: stopping.");
break;
}

String subAlbumName = p.getProperty("album.name." + i);

if (subAlbumName != null) {
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/GalleryRemote.java
Expand Up @@ -205,7 +205,7 @@ public PropertiesFile getAppletOverrides(PropertiesFile p, String prefix) {
String value = applet.getParameter(prefix + name);

if (value != null) {
Log.log(Log.LEVEL_TRACE, MODULE, "Override: " + name + "= |" + value + "|");
Log.log(Log.LEVEL_TRACE, MODULE, "Got: " + name + "= |" + value + "|");
p.setProperty(name, value);
}
}
Expand Down
13 changes: 12 additions & 1 deletion com/gallery/GalleryRemote/MainFrame.java
Expand Up @@ -143,6 +143,8 @@ public class MainFrame extends JFrame
JCheckBoxMenuItem jCheckBoxMenuPreview = new JCheckBoxMenuItem();
JCheckBoxMenuItem jCheckBoxMenuPath = new JCheckBoxMenuItem();
JMenuItem jMenuItemPrefs = new JMenuItem();
JMenuItem jMenuItemClearCache = new JMenuItem();

JMenu jMenuHelp = new JMenu();
JMenuItem jMenuItemAbout = new JMenuItem();

Expand Down Expand Up @@ -726,7 +728,7 @@ public void fetchAlbums() {
public void fetchAlbumImages() {
Log.log(Log.LEVEL_INFO, MODULE, "fetchAlbumImages starting");

getCurrentAlbum().fetchAlbumImages(jStatusBar, false);
getCurrentAlbum().fetchAlbumImages(jStatusBar, false, 0);
}

public void newAlbum() {
Expand Down Expand Up @@ -805,6 +807,7 @@ public void setShowPreview(boolean show) {
GalleryRemote._().properties.setShowPreview(show);
if (show) {
previewFrame.show();
previewFrame.displayPicture((Picture) jPicturesList.getSelectedValue(), true);
} else {
previewFrame.hide();
}
Expand Down Expand Up @@ -975,6 +978,8 @@ private void jbInit()
jMenuItemPrefs.setText(GRI18n.getString(MODULE, "menuPref"));
jMenuItemPrefs.setActionCommand("Options.Prefs");
jMenuItemPrefs.setIcon(GalleryRemote.iPreferences);
jMenuItemClearCache.setText(GRI18n.getString(MODULE, "menuClearCache"));
jMenuItemClearCache.setActionCommand("Options.ClearCache");

jMenuHelp.setText(GRI18n.getString(MODULE, "menuHelp"));
jMenuItemAbout.setActionCommand("Help.About");
Expand Down Expand Up @@ -1058,6 +1063,8 @@ private void jbInit()
jMenuOptions.add(jCheckBoxMenuThumbnails);
jMenuOptions.add(jCheckBoxMenuPreview);
jMenuOptions.add(jCheckBoxMenuPath);
jMenuOptions.addSeparator();
jMenuOptions.add(jMenuItemClearCache);

if (!GalleryRemote.IS_MAC_OS_X) {
jMenuOptions.addSeparator();
Expand All @@ -1082,6 +1089,7 @@ private void jbInitEvents() {
//jGalleryCombo.addActionListener( this );
jAlbumTree.addTreeSelectionListener(this);
jMenuItemPrefs.addActionListener(this);
jMenuItemClearCache.addActionListener(this);
jMenuItemNew.addActionListener(this);
jMenuItemOpen.addActionListener(this);
jMenuItemSave.addActionListener(this);
Expand Down Expand Up @@ -1224,6 +1232,9 @@ public void actionPerformed(ActionEvent e) {
doPaste();
} else if (command.equals("Options.Prefs")) {
showPreferencesDialog();
} else if (command.equals("Options.ClearCache")) {
ImageUtils.purgeTemp();
flushMemory();
} else if (command.equals("Help.About")) {
showAboutBox();
} else if (command.equals("Fetch")) {
Expand Down
6 changes: 2 additions & 4 deletions com/gallery/GalleryRemote/SlideshowFrame.java
Expand Up @@ -15,8 +15,6 @@
import java.util.ArrayList;
import java.util.Collections;

import HTTPClient.TransferListener;

/**
* Created by IntelliJ IDEA.
* User: paour
Expand Down Expand Up @@ -402,10 +400,10 @@ public boolean dataTransferred(int transferred, int overall, double kbPerSecond,

public static class OutlineLabelUI extends BasicLabelUI {
protected static OutlineLabelUI labelUI = new OutlineLabelUI();
private static Rectangle paintIconR = new Rectangle();
/*private static Rectangle paintIconR = new Rectangle();
private static Rectangle paintTextR = new Rectangle();
private static Rectangle paintViewR = new Rectangle();
private static Insets paintViewInsets = new Insets(0, 0, 0, 0);
private static Insets paintViewInsets = new Insets(0, 0, 0, 0);*/

public static ComponentUI createUI(JComponent c) {
return labelUI;
Expand Down
4 changes: 3 additions & 1 deletion com/gallery/GalleryRemote/ThumbnailCache.java
Expand Up @@ -154,7 +154,9 @@ public void flushMemory() {
Iterator it = thumbnails.values().iterator();
while (it.hasNext()) {
ImageIcon i = (ImageIcon) it.next();
i.getImage().flush();
if (i.getImage() != null) {
i.getImage().flush();
}
}

thumbnails.clear();
Expand Down
4 changes: 2 additions & 2 deletions com/gallery/GalleryRemote/model/Album.java
Expand Up @@ -113,15 +113,15 @@ public void fetchAlbumProperties(StatusUpdate su) {
}
}

public void fetchAlbumImages(StatusUpdate su, boolean recursive) {
public void fetchAlbumImages(StatusUpdate su, boolean recursive, int maxPictures) {
if (getGallery().getComm(su).hasCapability(su, GalleryCommCapabilities.CAPA_FETCH_ALBUM_IMAGES)) {
if (su == null) {
su = new StatusUpdateAdapter() {
};
}

try {
gallery.getComm(su).fetchAlbumImages(su, this, recursive, true);
gallery.getComm(su).fetchAlbumImages(su, this, recursive, true, maxPictures);
} catch (RuntimeException e) {
Log.log(Log.LEVEL_INFO, MODULE, "Server probably doesn't support album-fetch-images");
Log.logException(Log.LEVEL_INFO, MODULE, e);
Expand Down
2 changes: 2 additions & 0 deletions com/gallery/GalleryRemote/prefs/PreferenceNames.java
Expand Up @@ -57,6 +57,8 @@ public interface PreferenceNames {
public static final String SLIDESHOW_DELAY = "slideshowDelay";
public static final String SLIDESHOW_LOWREZ = "slideshowLowRez";
public static final String SLIDESHOW_RANDOM = "slideshowRandom";
public static final String SLIDESHOW_MAX_PICTURES = "slideshowMaxPictures";
public static final String SLIDESHOW_RECURSIVE = "slideshowRecursive";

// Other
public static final String SUPPRESS_WARNING_IM = "suppressWarningIM";
Expand Down
1 change: 1 addition & 0 deletions com/gallery/GalleryRemote/resources/GRResources.properties
Expand Up @@ -42,6 +42,7 @@ MainFrame.menuPaste = Paste
MainFrame.menuHelp = Help
MainFrame.menuAbout = About Gallery Remote...
MainFrame.menuOptions = Options
MainFrame.menuClearCache = Clear Cache
MainFrame.cbmenuThumb = Show Thumbnails
MainFrame.cbmenuPreview = Show Preview
MainFrame.cbmenuPath = Show Path
Expand Down
13 changes: 10 additions & 3 deletions defaults.properties
Expand Up @@ -136,6 +136,13 @@ slideshowLowRez=true
# Shuffle images before displaying them (random order)
slideshowRandom=false

# Recursive slideshow
slideshowRecursive=false

# Maximum number of pics in a slideshow (0: disabled).
# Set to a reasonable number to limit the number of images and albums downloaded
slideshowMaxPictures=0

#
# --- Technical ---
#
Expand Down Expand Up @@ -171,6 +178,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p
#
# --- Do not edit below this line ---
#
version=1.3-b28
releaseDate=2004/02/08
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\nAmedeo Paglione\nChris Schwerdt\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJSX\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor
version=1.3-b29
releaseDate=2004/02/10
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\nChris Schwerdt\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJSX\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor

0 comments on commit 6fa825a

Please sign in to comment.