Skip to content

Commit

Permalink
Merge pull request #161 from michal-josef-spacek/gh-84
Browse files Browse the repository at this point in the history
GH#84: Add support for selected files in session file
  • Loading branch information
michal-josef-spacek authored Jul 10, 2021
2 parents de519e8 + a4ba597 commit 64c392b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/main/java/cuploader/PFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ public SessionFile returnData() {
coor.getHeading()
);
}
boolean selected = cUpload.isSelected() ? true : false;
SessionFile sessionFile = new SessionFile(
tDate.getText(), // date
file.getAbsolutePath(), // path
tCategories.getText(), // cats
tName.getText(), // name
coorToExport, // coordinates
tDesc.getText() // desc
tDesc.getText(), // desc
selected // selected
);
return sessionFile;
}
Expand Down Expand Up @@ -111,7 +113,7 @@ public PFile(File file, int number) {
//PromptSupport.setFocusBehavior(PromptSupport.FocusBehavior.HIDE_PROMPT, tName);
}

public PFile(File file, int number, boolean toUpload, boolean toEdit, String name, String desc, String date, String cats, Coord coor) {
public PFile(File file, int number, boolean toUpload, boolean toEdit, String name, String desc, String date, String cats, Coord coor, boolean selected) {
this.file = file;
this.number = number;

Expand Down Expand Up @@ -139,6 +141,8 @@ public PFile(File file, int number, boolean toUpload, boolean toEdit, String nam
this.coor = coor;
setCoordinates(this.coor);
}

selectToUpload(selected);

//generateThumbnail();
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/cuploader/SessionFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ public class SessionFile {
public String name = null;
public ImmutableCoordinate coor = null;
public String desc = null;
public boolean selected = false;

public SessionFile(String date, String path, String cats, String name,
ImmutableCoordinate coor, String desc) {
ImmutableCoordinate coor, String desc, boolean selected) {

this.date = date;
this.path = path;
this.cats = cats;
this.name = name;
this.coor = coor;
this.desc = desc;
this.selected = selected;
}

public String getDate() {
Expand All @@ -50,4 +52,8 @@ public ImmutableCoordinate getCoordinate() {
public String getDesc() {
return this.desc;
}

public boolean getSelected() {
return this.selected;
}
}
6 changes: 4 additions & 2 deletions src/main/java/cuploader/frames/FFileLoading.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public void run() {
if (sessionList == null) {
f = new PFile(file, Data.getFiles().size(), fUpload.get(i),
fEdit.get(i), fName.get(i), fDesc.get(i),
fDate.get(i), fCats.get(i), new Coord(fCoor.get(i)));
fDate.get(i), fCats.get(i), new Coord(fCoor.get(i)),
true);
} else {
SessionFile sessionFile = sessionList.getSessionFiles().get(i);
ImmutableCoordinate coordinate = sessionFile.getCoordinate();
Expand All @@ -147,7 +148,8 @@ public void run() {
sessionFile.getDesc(),
sessionFile.getDate(),
sessionFile.getCats(),
coord
coord,
sessionFile.getSelected()
);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cuploader/frames/FSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class FSettings extends javax.swing.JFrame {
private final QuickTemplatesModel model = new QuickTemplatesModel();
DefaultTableModel dm = new DefaultTableModel();

PFile exampleFile = new PFile(new File("Example file.jpg"), -1, false, false, "example-file.jpg", "Example file description.", "2016-01-01", "Example file category", null);
PFile exampleFile = new PFile(new File("Example file.jpg"), -1, false, false, "example-file.jpg", "Example file description.", "2016-01-01", "Example file category", null, true);
Settings previewSettings = new Settings();

public FSettings() {
Expand Down

0 comments on commit 64c392b

Please sign in to comment.