File: PhotoTableEntry.java

package info (click to toggle)
gpsprune 17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,984 kB
  • ctags: 5,218
  • sloc: java: 39,403; sh: 25; makefile: 17; python: 15
file content (97 lines) | stat: -rw-r--r-- 2,011 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package tim.prune.save;

import tim.prune.I18nManager;
import tim.prune.data.Photo;

/**
 * Class to represent a row of the photo table for saving exif
 */
public class PhotoTableEntry
{
	private Photo _photo = null;
	private String _photoName = null;
	private boolean _save = true;
	private String _status = null;

	/**
	 * Constructor
	 * @param inPhoto photo object
	 */
	public PhotoTableEntry(Photo inPhoto)
	{
		_photo = inPhoto;
		if (inPhoto != null)
		{
			_photoName = inPhoto.getName();
			_status = getStatusString(inPhoto.getOriginalStatus(), inPhoto.getCurrentStatus());
		}
	}


	/**
	 * Make a status string from the given status bytes
	 * @param inOriginalStatus original status of photo
	 * @param inCurrentStatus current status of photo
	 * @return status string for display
	 */
	private static String getStatusString (Photo.Status inOriginalStatus, Photo.Status inCurrentStatus)
	{
		if (inOriginalStatus != inCurrentStatus)
		{
			if (inOriginalStatus == Photo.Status.NOT_CONNECTED)
			{
				// originally didn't have a point, now it has
				return I18nManager.getText("dialog.saveexif.photostatus.connected");
			}
			if (inCurrentStatus == Photo.Status.NOT_CONNECTED)
			{
				// originally had a point, now it doesn't
				return I18nManager.getText("dialog.saveexif.photostatus.disconnected");
			}
			// originally had a point, now it has a different one
			return I18nManager.getText("dialog.saveexif.photostatus.modified");
		}
		// unrecognised status
		return null;
	}

	/**
	 * @return Photo object
	 */
	public Photo getPhoto()
	{
		return _photo;
	}

	/**
	 * @return photo filename
	 */
	public String getName()
	{
		return _photoName;
	}

	/**
	 * @return photo status as string
	 */
	public String getStatus()
	{
		return _status;
	}

	/**
	 * @param inFlag true to save exif, false otherwise
	 */
	public void setSaveFlag(boolean inFlag)
	{
		_save = inFlag;
	}

	/**
	 * @return true to save exif, false otherwise
	 */
	public boolean getSaveFlag()
	{
		return _save;
	}
}