Skip to content

Commit

Permalink
2003-09-25 Pierre-Luc Paour <gallery@paour.com> (1.2-b4)
Browse files Browse the repository at this point in the history
	* Implemented auto-rotate based on EXIF tag, if present. Now I need
	  protocol support to disable auto-rotate in the server when
	  uploading.
	* Implemented shutdown on upload completion. Thanks to Nick77.
  • Loading branch information
Pierre-Luc Paour committed Sep 25, 2003
1 parent 75a3665 commit 7de4650
Show file tree
Hide file tree
Showing 18 changed files with 341 additions and 68 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2003-09-25 Pierre-Luc Paour <gallery@paour.com> (1.2-b4)

* Implemented auto-rotate based on EXIF tag, if present. Now I need
protocol support to disable auto-rotate in the server when
uploading.
* Implemented shutdown on upload completion. Thanks to Nick77.

2003-09-22 Pierre-Luc Paour <gallery@paour.com> (1.2-b3)

* Fixed PHPNuke default URLs (thanks docmattman).
Expand Down
13 changes: 6 additions & 7 deletions build.xml
Expand Up @@ -28,8 +28,9 @@
includes="com/**,HTTPClient/**,edu/**"
listfiles="on" debug="on" source="1.3">
<classpath>
<pathelement path="lib/JSX1.0.7.4.jar"/>
<pathelement path="lib/AppleJavaExtensions.jar"/>
<pathelement location="lib/JSX1.0.7.4.jar"/>
<pathelement location="lib/AppleJavaExtensions.jar"/>
<pathelement location="lib/metadata-extractor-2.1.jar"/>
</classpath>
</javac>

Expand All @@ -49,6 +50,7 @@
<java classname="com.gallery.GalleryRemote.GalleryRemote" fork="true">
<classpath>
<pathelement location="lib/JSX1.0.7.4.jar"/>
<pathelement location="lib/metadata-extractor-2.1.jar"/>
<pathelement path="${build}"/>
<pathelement path="img"/>
</classpath>
Expand Down Expand Up @@ -81,11 +83,8 @@
<fileset dir="." includes="GalleryRemote.jar" />
<fileset dir="." includes="ReadMe.html" />
<zipfileset dir="./lib" includes="JSX1.0.7.4.jar" prefix="lib"/>
<zipfileset dir="./lib" includes="metadata-extractor-2.1.jar" prefix="lib"/>
<zipfileset dir="./img" includes="*" prefix="img"/>

<!-- temporary -->
<zipfileset dir="./jpegtran/win32" includes="jpegtran.exe" prefix="jpegtran/win32"/>
<zipfileset dir="./jpegtran/win32" includes="jpegtran.properties" prefix="jpegtran"/>
</zip>
</target>

Expand Down Expand Up @@ -135,7 +134,7 @@
name="Gallery Remote"
mainclass="com.gallery.GalleryRemote.GalleryRemote"
icon="rar_icon_128_gr1.icns"
jars="./GalleryRemote.jar ${lib}/JSX1.0.7.4.jar ./img.jar"
jars="./GalleryRemote.jar ${lib}/JSX1.0.7.4.jar ${lib}/metadata-extractor-2.1.jar ./img.jar"
version="1.1"
infostring="Gallery Remote 1.1, (c) 2003"
aboutmenuname="Gallery Remote"
Expand Down
16 changes: 8 additions & 8 deletions com/gallery/GalleryRemote/DroppableList.java
Expand Up @@ -61,7 +61,7 @@ public class DroppableList extends JList
{
private final static String MODULE = "Droplist";

MainFrame mDaddy = null;
MainFrame mf = null;
DragSource dragSource;
DropTarget dropTarget;
PictureSelection ps;
Expand All @@ -82,11 +82,11 @@ public DroppableList() {
/**
* Constructor for the DroppableList object
*
*@param daddy Description of Parameter
*@param mf Description of Parameter
*@since
*/
public void setMainFrame( MainFrame daddy ) {
mDaddy = daddy;
public void setMainFrame( MainFrame mf ) {
this.mf = mf;
}

int safeGetFixedCellHeight() {
Expand Down Expand Up @@ -173,7 +173,7 @@ public void dragExit( DropTargetEvent dropTargetEvent ) {
try {
java.util.List fileList = (java.util.List) ps.getTransferData( DataFlavor.javaFileListFlavor );
if ( !ps.isEmpty() ) {
mDaddy.addPictures( (File[]) fileList.toArray( new File[0] ) );
mf.addPictures( (File[]) fileList.toArray( new File[0] ) );
}
//kill dragEvent
//need to figure out why MainFrame becomes dropTarget for internal drops??!!
Expand Down Expand Up @@ -264,9 +264,9 @@ public synchronized void drop( DropTargetDropEvent dropTargetDropEvent ) {
Point dropLocation = dropTargetDropEvent.getLocation();
int listIndex = snapIndex( (int) dropLocation.getY() );

Log.log( Log.TRACE, MODULE, "Adding new image(s) to list at index:" + listIndex );
Log.log( Log.TRACE, MODULE, "Adding new image(s) to list at index " + listIndex );

mDaddy.addPictures( (File[]) fileList.toArray( new File[0] ), listIndex );
mf.addPictures( (File[]) fileList.toArray( new File[0] ), listIndex );

dropTargetDropEvent.getDropTargetContext().dropComplete( true );
} else {
Expand Down Expand Up @@ -367,7 +367,7 @@ public void dragGestureRecognized( DragGestureEvent event ) {
//pull out existing pictures
if ( !ps.isEmpty() ) {
dragSource.startDrag( event, DragSource.DefaultMoveDrop, ps, this );
mDaddy.deleteSelectedPictures();
mf.deleteSelectedPictures();

} else {
Log.log( Log.TRACE, MODULE, "nothing was selected" );
Expand Down
6 changes: 6 additions & 0 deletions com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -518,6 +518,12 @@ public void actionPerformed(ActionEvent e) {

if (allGood) {
su.stopProgress(StatusUpdate.LEVEL_UPLOAD_PROGRESS, "Upload complete");

if (su instanceof UploadProgress) {
if (((UploadProgress) su).isShutdown()) {
GalleryRemote.getInstance().mainFrame.shutdown(true);
}
}
} else {
su.stopProgress(StatusUpdate.LEVEL_UPLOAD_PROGRESS, "Upload failed");
}
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/GalleryFileFilter.java
Expand Up @@ -37,7 +37,7 @@ public class GalleryFileFilter extends FileFilter {
public static final List manipulateExtensions = Arrays.asList( ext1 );

public static String[] ext2
= { "jpg", "png" };
= { "jpg", "jpeg" };
public static final List manipulateJpegExtensions = Arrays.asList( ext2 );

// Accept all directories and all gif, jpg files.
Expand Down
12 changes: 4 additions & 8 deletions com/gallery/GalleryRemote/Log.java
Expand Up @@ -127,8 +127,7 @@ public static void log( String message ) {
log( TRACE, (String) null, message );
}

public static void logStack(int level, String module)
{
public static void logStack(int level, String module) {
if ( level <= maxLevel ) {
CharArrayWriter caw = new CharArrayWriter();
try {
Expand All @@ -141,8 +140,7 @@ public static void logStack(int level, String module)
}
}

public static void logException(int level, String module, Throwable t)
{
public static void logException(int level, String module, Throwable t) {
if ( level <= maxLevel ) {
//log(level, module, t.toString());

Expand All @@ -153,8 +151,7 @@ public static void logException(int level, String module, Throwable t)
}
}

public static String getShortClassName(Class c)
{
public static String getShortClassName(Class c) {
String name = c.getName();
int i = name.lastIndexOf(".");

Expand All @@ -165,8 +162,7 @@ public static String getShortClassName(Class c)
}
}

public static void shutdown()
{
public static void shutdown() {
singleton.running = false;
try {
singleton.join();
Expand Down
16 changes: 12 additions & 4 deletions com/gallery/GalleryRemote/MainFrame.java
Expand Up @@ -46,6 +46,7 @@
import com.gallery.GalleryRemote.model.Picture;
import com.gallery.GalleryRemote.util.ImageUtils;
import com.gallery.GalleryRemote.util.GRI18n;
import com.gallery.GalleryRemote.util.OsShutdown;
import com.gallery.GalleryRemote.prefs.PreferencesDialog;
import com.gallery.GalleryRemote.prefs.PropertiesFile;
import com.gallery.GalleryRemote.prefs.URLPanel;
Expand Down Expand Up @@ -131,7 +132,6 @@ public class MainFrame extends javax.swing.JFrame

public static GRI18n grRes = GRI18n.getInstance();


/**
* Constructor for the MainFrame object
*/
Expand Down Expand Up @@ -241,14 +241,18 @@ private void setGalleries(DefaultComboBoxModel galleries) {
*@param e Event
*/
void thisWindowClosing( java.awt.event.WindowEvent e ) {
shutdown(false);
shutdown(false, false);
}

public void shutdown() {
shutdown(false);
shutdown(false, false);
}

public void shutdown(boolean shutdownOs) {
shutdown(false, shutdownOs);
}

private void shutdown(boolean halt) {
private void shutdown(boolean halt, boolean shutdownOs) {
if (running) {
running = false;

Expand All @@ -274,6 +278,10 @@ private void shutdown(boolean halt) {
Log.log(Log.ERROR, MODULE, "Error while closing: " + t);
}

if (shutdownOs) {
OsShutdown.shutdown();
}

Log.log(Log.INFO, MODULE, "Shutting down log");
Log.shutdown();

Expand Down
33 changes: 21 additions & 12 deletions com/gallery/GalleryRemote/UploadProgress.java
@@ -1,6 +1,7 @@
package com.gallery.GalleryRemote;

import com.gallery.GalleryRemote.util.DialogUtil;
import com.gallery.GalleryRemote.util.OsShutdown;

import javax.swing.*;
import java.awt.*;
Expand All @@ -20,14 +21,15 @@ public class UploadProgress extends JDialog implements StatusUpdate, ActionListe
JProgressBar jProgressGlobal = new JProgressBar();
JLabel jLabelDetail = new JLabel();
JProgressBar jProgressDetail = new JProgressBar();
JButton jCancel = new JButton();
JPanel jPanel2 = new JPanel();

JLabel jLabel[] = new JLabel[NUM_LEVELS];
JProgressBar jProgress[] = new JProgressBar[NUM_LEVELS];

MainFrame mf;
ActionListener cancelListener = null;
JButton jCancel = new JButton();
JCheckBox jShutdown = new JCheckBox();

public UploadProgress(MainFrame mf) {
super(mf);
Expand Down Expand Up @@ -57,30 +59,33 @@ private void jbInit() {
jLabelGlobal.setText("Uploading image n of m");
jLabelDetail.setText("Uploading img.gif");

jCancel.setAlignmentX((float) 0.0);
jCancel.setRolloverEnabled(false);
jCancel.setText("Cancel");
jCancel.addActionListener(this);
jShutdown.setToolTipText("Shut down the computer when the transfer completes");
jShutdown.setText("Shutdown when done");

jPanel1.add(jComputer1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 0), 0, 0));
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 0), 0, 0));
jPanel1.add(jUploading, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
jPanel1.add(jComputer2, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 10), 0, 0));
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 10), 0, 0));
jPanel1.add(jLabelGlobal, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 0), 0, 0));
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 0), 0, 0));
jPanel1.add(jProgressGlobal, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 15, 0, 15), 0, 0));
jPanel1.add(jLabelDetail, new GridBagConstraints(0, 3, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0));
jPanel1.add(jProgressDetail, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 15, 0, 15), 0, 0));
jPanel1.add(jCancel, new GridBagConstraints(1, 5, 2, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 0, 10, 10), 0, 0));
jPanel1.add(jPanel2, new GridBagConstraints(0, 5, 1, 1, 0.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jPanel2, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

jCancel.addActionListener(this);
if (OsShutdown.canShutdown()) {
jPanel2.add(jShutdown, null);
}

jPanel2.add(jCancel, null);
}

/* level-bound methods */
Expand Down Expand Up @@ -197,4 +202,8 @@ public void run() {
public void setCancelListener(ActionListener cancelListener) {
this.cancelListener = cancelListener;
}

public boolean isShutdown() {
return jShutdown.isSelected();
}
}
37 changes: 29 additions & 8 deletions com/gallery/GalleryRemote/model/Album.java
Expand Up @@ -26,10 +26,8 @@

import javax.swing.*;

import com.gallery.GalleryRemote.GalleryCommCapabilities;
import com.gallery.GalleryRemote.Log;
import com.gallery.GalleryRemote.StatusUpdate;
import com.gallery.GalleryRemote.StatusUpdateAdapter;
import com.gallery.GalleryRemote.*;
import com.gallery.GalleryRemote.util.ImageUtils;

/**
* Album model
Expand Down Expand Up @@ -154,7 +152,7 @@ public Enumeration getPictures() {
*/
public void addPicture( Picture p ) {
p.setAlbum( this );
pictures.addElement( p );
addPictureInternal( p );

notifyListeners();
}
Expand All @@ -167,7 +165,7 @@ public void addPicture( Picture p ) {
public void addPicture( File file ) {
Picture p = new Picture( file );
p.setAlbum( this );
pictures.addElement( p );
addPictureInternal( p );

notifyListeners();
}
Expand All @@ -192,15 +190,38 @@ public void addPictures( File[] files, int index ) {
Picture p = new Picture( files[i] );
p.setAlbum( this );
if (index == -1) {
pictures.add( p );
addPictureInternal( p );
} else {
pictures.add( index++, p );
addPictureInternal( index++, p );
}
}

notifyListeners();
}

private void addPictureInternal(Picture p) {
addPictureInternal(-1, p);
}

private void addPictureInternal(int index, Picture p) {
// handle EXIF
if (GalleryRemote.getInstance().properties.getBooleanProperty(EXIF_AUTOROTATE)) {
ImageUtils.AngleFlip af = ImageUtils.getExifTargetOrientation(p.getSource().getPath());

if (af != null) {
p.setFlipped(af.flip);
p.setAngle(af.angle);
p.setSuppressServerAutoRotate(true);
}
}

if (index == -1) {
pictures.add(p);
} else {
pictures.add(index, p);
}
}

/**
* Number of pictures in the album
*
Expand Down

0 comments on commit 7de4650

Please sign in to comment.