Skip to content

Commit

Permalink
2005-12-02 Pierre-Luc Paour <gallery@paour.com> (1.5.1-b2)
Browse files Browse the repository at this point in the history
	* Added settings to change the font and font size in slideshow.
	  There is no user-interface to set these, you have to change them
	  in the GalleryRemote.properties or GalleryRemoteApplet.properties
	  files.
	* Downloading the list of albums is slightly more robust.
	* The thumbs temporary directory is now postfixed with the
	  current username, so on multiuser systems different users
	  will be able to use GR concurrently. Thanks mattdm.
	* Reworked the way defaults and prefs are loaded to they can be more
	  flexibly overriden by the server, in the case of the applet.
  • Loading branch information
Pierre-Luc Paour committed Dec 2, 2005
1 parent 5cfe19c commit 336818e
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 46 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
2005-12-02 Pierre-Luc Paour <gallery@paour.com> (1.5.1-b2)

* Added settings to change the font and font size in slideshow.
There is no user-interface to set these, you have to change them
in the GalleryRemote.properties or GalleryRemoteApplet.properties
files.
* Downloading the list of albums is slightly more robust.
* The thumbs temporary directory is now postfixed with the
current username, so on multiuser systems different users
will be able to use GR concurrently. Thanks mattdm.
* Reworked the way defaults and prefs are loaded to they can be more
flexibly overriden by the server, in the case of the applet.

2005-09-23 Pierre-Luc Paour <gallery@paour.com> (1.5.1-b1)

* Fixed getting album list and creating albums when the names
Expand Down
7 changes: 6 additions & 1 deletion com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -789,7 +789,12 @@ private void list22() throws IOException, ModuleException {
// map album refs to parent refs
String parentName = p.getProperty(parentKey);

if (parentName.equals(name)) {
if (parentName == null) {
Log.log(Log.LEVEL_ERROR, MODULE, "Gallery error: the album " + name +
" doesn't have a parent. You should delete it, the album database " +
"is corrupted because of it.");

} else if (parentName.equals(name)) {
Log.log(Log.LEVEL_ERROR, MODULE, "Gallery error: the album " + name +
" is its own parent. You should delete it, the album database " +
"is corrupted because of it.");
Expand Down
16 changes: 9 additions & 7 deletions com/gallery/GalleryRemote/GalleryRemote.java
Expand Up @@ -35,7 +35,6 @@
* Main class and entry point of Gallery Remote
*
* @author paour
* @created 11 août 2002
*/
public abstract class GalleryRemote {
public static final String MODULE = "GalRem";
Expand Down Expand Up @@ -203,11 +202,11 @@ public static void setStaticProperties() {
}

public void createProperties() {
defaults = new PropertiesFile("defaults");
defaults.setReadOnly();
properties = defaults = new PropertiesFile("defaults");
properties.setReadOnly();
}

public PropertiesFile createAppletOverride(PropertiesFile p) {
/*public PropertiesFile createAppletOverride(PropertiesFile p) {
PropertiesFile override;
if (p == null) {
Expand All @@ -219,20 +218,23 @@ public PropertiesFile createAppletOverride(PropertiesFile p) {
override.setReadOnly();
return override;
}
}*/

public PropertiesFile getAppletOverrides(PropertiesFile p, String prefix) {
public PropertiesFile getAppletOverrides(PropertiesFile defaults, String prefix) {
Log.log(Log.LEVEL_TRACE, MODULE, "Getting applet parameters for prefix " + prefix);

PropertiesFile p = new PropertiesFile(defaults);

for (Enumeration e = p.propertyNames(); e.hasMoreElements();) {
String name = (String) e.nextElement();
String value = applet.getParameter(prefix + name);

if (value != null) {
if (value != null && value.length() != 0) {
Log.log(Log.LEVEL_TRACE, MODULE, "Got: " + name + "= |" + value + "|");
p.setProperty(name, value);
}
}
p.setReadOnly();

return p;
}
Expand Down
6 changes: 3 additions & 3 deletions com/gallery/GalleryRemote/GalleryRemoteMainFrame.java
Expand Up @@ -20,7 +20,7 @@ public void createProperties() {
super.createProperties();

if (isAppletMode()) {
getAppletOverrides(defaults, "GRDefault_");
properties = getAppletOverrides(properties, "GRDefault_");
}

File f = new File(System.getProperty("user.home")
Expand All @@ -39,10 +39,10 @@ public void createProperties() {
}
}

properties = new PropertiesFile(defaults, pf.getPath());
properties = new PropertiesFile(properties, pf.getPath());

if (isAppletMode()) {
properties = getAppletOverrides(createAppletOverride(properties), "GROverride_");
properties = getAppletOverrides(properties, "GROverride_");
}
}

Expand Down
6 changes: 3 additions & 3 deletions com/gallery/GalleryRemote/GalleryRemoteMini.java
Expand Up @@ -25,7 +25,7 @@ protected void initializeGR() {
public void createProperties() {
super.createProperties();

getAppletOverrides(defaults, "GRDefault_");
getAppletOverrides(properties, "GRDefault_");

File f = new File(System.getProperty("user.home")
+ File.separator + ".GalleryRemote"
Expand All @@ -43,9 +43,9 @@ public void createProperties() {
}
}

properties = new PropertiesFile(defaults, pf.getPath());
properties = new PropertiesFile(properties, pf.getPath());

properties = getAppletOverrides(createAppletOverride(properties), "GROverride_");
properties = getAppletOverrides(properties, "GROverride_");
}

public Frame getMainFrame() {
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/Log.java
Expand Up @@ -31,7 +31,6 @@
* Log manager
*
* @author paour
* @created August 18, 2002
*/
public class Log implements PreferenceNames, Runnable {
public final static int LEVEL_CRITICAL = 0;
Expand Down
20 changes: 10 additions & 10 deletions com/gallery/GalleryRemote/PreviewFrame.java
Expand Up @@ -335,17 +335,17 @@ public void pictureStartDownload(Picture picture) {}

public void pictureStartProcessing(Picture picture) {}

public static void paintOutline(Graphics g, String s, int textX, int textY) {
public static void paintOutline(Graphics g, String s, int textX, int textY, int width) {
g.setColor(darkGray);
g.drawString(s, textX + 1, textY + 1);
g.drawString(s, textX, textY + 1);
g.drawString(s, textX - 1, textY + 1);
g.drawString(s, textX + 1, textY);
g.drawString(s, textX + width, textY + width);
g.drawString(s, textX, textY + width);
g.drawString(s, textX - width, textY + width);
g.drawString(s, textX + width, textY);
g.drawString(s, textX, textY);
g.drawString(s, textX - 1, textY);
g.drawString(s, textX + 1, textY - 1);
g.drawString(s, textX, textY - 1);
g.drawString(s, textX - 1, textY - 1);
g.drawString(s, textX - width, textY);
g.drawString(s, textX + width, textY - width);
g.drawString(s, textX, textY - width);
g.drawString(s, textX - width, textY - width);
g.setColor(Color.white);
g.drawString(s, textX, textY);
}
Expand Down Expand Up @@ -435,7 +435,7 @@ public void paintInfo(Graphics g) {
}

g.setFont(g.getFont());
paintOutline(g, message, 5, getBounds().height - 5);
paintOutline(g, message, 5, getBounds().height - 5, 1);
}

public void updateRect() {
Expand Down
19 changes: 18 additions & 1 deletion com/gallery/GalleryRemote/SlideshowFrame.java
Expand Up @@ -577,8 +577,25 @@ public class FeedbackGlassPane extends JComponent {
Color background = new Color(100, 100, 100, 150);
Color normal = new Color(180, 180, 180, 180);
Color hilight = new Color(255, 255, 255, 180);
boolean firstPaint = true;

public void paint(Graphics g) {
if (firstPaint) {
firstPaint = false;
String fontName = GalleryRemote._().properties.getProperty(SLIDESHOW_FONTNAME);
int fontSize = GalleryRemote._().properties.getIntProperty(SLIDESHOW_FONTSIZE, getFont().getSize());
Font f = null;
if (fontName != null) {
f = new Font(fontName, 0, fontSize);
} else if (fontSize != getFont().getSize()) {
f = getFont().deriveFont(fontSize + 0.0f);
}

if (f != null) {
setFont(f);
}
}

if (feedback != FEEDBACK_NONE || controllerUntil > System.currentTimeMillis()) {
paintController(g);
}
Expand Down Expand Up @@ -694,7 +711,7 @@ public void paintInfo(Graphics g, String text, int position) {

y += fm.getAscent();

paintOutline(g, text, x, y);
paintOutline(g, text, x, y, 1);
}

private void drawText(Graphics g, Color hilight, FontMetrics fm, int x, int y, String text) {
Expand Down
5 changes: 0 additions & 5 deletions com/gallery/GalleryRemote/ThumbnailCache.java
Expand Up @@ -35,12 +35,10 @@
* the list of Pictures
*
* @author paour
* @created August 16, 2002
*/
public class ThumbnailCache implements Runnable {
public static final String MODULE = "ThumbCache";


boolean stillRunning = false;
Stack toLoad = new Stack();
HashMap thumbnails = new HashMap();
Expand Down Expand Up @@ -97,8 +95,6 @@ public void run() {

/**
* Ask for the thumbnail to be loaded as soon as possible
*
* @param filename path to the file
*/
public void preloadThumbnailFirst(Picture p) {
Log.log(Log.LEVEL_TRACE, MODULE, "preloadThumbnailFirst " + p);
Expand Down Expand Up @@ -164,7 +160,6 @@ void cancelLoad() {
/**
* Retrieves a thumbnail from the thumbnail cache
*
* @param filename path to the file
* @return The thumbnail object
*/
public ImageIcon getThumbnail(Picture p) {
Expand Down
20 changes: 18 additions & 2 deletions com/gallery/GalleryRemote/prefs/GalleryProperties.java
Expand Up @@ -34,7 +34,6 @@
* GalleryProperties: access property data with a higher level of abstraction
*
* @author paour
* @created 11 août 2002
*/
public class GalleryProperties extends Properties implements PreferenceNames {
public static final String MODULE = "GalProps";
Expand All @@ -55,13 +54,30 @@ public GalleryProperties(Properties p) {
public GalleryProperties() {
}

public String getProperty(String key) {
Object oval = super.get(key);
String sval = (oval instanceof String) ? (String)oval : null;
String value = ((sval == null || sval.length() == 0) && (defaults != null)) ? defaults.getProperty(key) : sval;

if (value == null || value.length() == 0) {
return null;
} else {
return value;
}
}

public void copyProperties(Properties source) {
Enumeration names = source.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = source.getProperty(name);
String currentValue = getProperty(name);

setProperty(name, value);
// don't override existing property with empty one
if ((currentValue == null || currentValue.length() == 0)
|| (value != null && value.length() != 0)) {
super.setProperty(name, value);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions com/gallery/GalleryRemote/prefs/PreferenceNames.java
Expand Up @@ -72,6 +72,8 @@ public interface PreferenceNames {
public static final String SLIDESHOW_COLOR = "slideshowColor";
public static final String SLIDESHOW_PRELOADALL = "slideshowPreloadAll";
public static final String SLIDESHOW_LOOP = "slideshowLoop";
public static final String SLIDESHOW_FONTNAME = "slideshowFontName";
public static final String SLIDESHOW_FONTSIZE = "slideshowFontSize";

// Other
public static final String SUPPRESS_WARNING_IM = "suppressWarningIM";
Expand Down
13 changes: 10 additions & 3 deletions com/gallery/GalleryRemote/prefs/PropertiesFile.java
Expand Up @@ -29,7 +29,6 @@
* Properties file for Gallery Remote
*
* @author paour
* @created 11 août 2002
*/
public class PropertiesFile extends GalleryProperties {
public static final String MODULE = "PropsFile";
Expand Down Expand Up @@ -79,8 +78,16 @@ public PropertiesFile(PropertiesFile p, String name) {
* Overrides default method to track dirty state
*/
public Object setProperty(String name, String value) {
if (readOnly && defaults!= null) {
defaults.setProperty(name, value);
// if we're read-only, see if our defaults can write
if (readOnly) {
if (defaults != null) {
defaults.setProperty(name, value);
} else {
Log.log(Log.LEVEL_ERROR, MODULE, "Read-only PropertyFile without a default: setProperty was attempted");
Log.logStack(Log.LEVEL_ERROR, MODULE);
}

return getProperty(name);
}

written = false;
Expand Down
@@ -1 +1 @@
Common.translator=Pierre-Luc Paour
Location: http://gallery.menalto.com/modules.php?oCommon.translator=Pierre-Luc Paour
10 changes: 7 additions & 3 deletions com/gallery/GalleryRemote/util/ImageUtils.java
Expand Up @@ -822,7 +822,7 @@ public static Dimension getPictureDimension(Picture p) {
}

static {
tmpDir = new File(System.getProperty("java.io.tmpdir"), "thumbs");
tmpDir = new File(System.getProperty("java.io.tmpdir"), "thumbs-" + System.getProperty("user.name"));

if (!tmpDir.exists()) {
tmpDir.mkdirs();
Expand All @@ -844,7 +844,9 @@ public static Dimension getPictureDimension(Picture p) {

// allow overriding from main property file
GalleryProperties p = new GalleryProperties(pt);
p.copyProperties(GalleryRemote._().properties);
GalleryRemote._().defaults.copyProperties(p);

p = GalleryRemote._().properties;

useIM = p.getBooleanProperty("im.enabled");
Log.log(Log.LEVEL_INFO, MODULE, "useIM: " + useIM);
Expand Down Expand Up @@ -924,7 +926,9 @@ public static Dimension getPictureDimension(Picture p) {

// allow overriding from main property file
GalleryProperties p = new GalleryProperties(pt);
p.copyProperties(GalleryRemote._().properties);
GalleryRemote._().defaults.copyProperties(p);

p = GalleryRemote._().properties;

useJpegtran = p.getBooleanProperty("jp.enabled");
useJpegtran = p.getBooleanProperty("jp.crop.enabled");
Expand Down

0 comments on commit 336818e

Please sign in to comment.