Skip to content

Commit

Permalink
Make reviewing faster with Ctrl+Alt+Enter
Browse files Browse the repository at this point in the history
Now toggling feature actually becomes useful, no need to use mouse any more...
New icons..
  • Loading branch information
DavidKarlas committed Dec 1, 2023
1 parent 29e3781 commit 98bf78e
Show file tree
Hide file tree
Showing 31 changed files with 686 additions and 334 deletions.
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id 'java'
id 'org.openstreetmap.josm' version '0.8.2'
}

josm {
debugPort = 2019
}
39 changes: 0 additions & 39 deletions build.gradle.kts

This file was deleted.

8 changes: 8 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugin.main.version = 18822
plugin.compile.version = 18822
plugin.canloadatruntime = true
plugin.author = David Karlaš
plugin.class = org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.JosmReviewPlugin
plugin.icon = images/dialogs/reviewPlugin/icon.svg
plugin.link = https://github.com/DavidKarlas/JosmReviewPlugin
plugin.description = JOSM plugin for reviewing changes before upload.
9 changes: 0 additions & 9 deletions images/dialogs/reviewPlugin/icon.svg

This file was deleted.

4 changes: 0 additions & 4 deletions images/reviewplugin/ReviewedItem.svg

This file was deleted.

3 changes: 0 additions & 3 deletions images/reviewplugin/UnReviewedItem.svg

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class NextItemAction extends JosmAction {

public NextItemAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/down-c"),
"Moves to next item in Review plugin list.",
Shortcut.registerShortcut("Moves to next item in Review plugin",
"Moves to next item in Review plugin list.",
KeyEvent.VK_DOWN, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.NextItem();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class NextUnreviewedItemAction extends JosmAction {

public NextUnreviewedItemAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/circle-double-down"),
"Moves to next unreviewed item in list.",
Shortcut.registerShortcut("Moves to next unreviewed item in Review plugin list.",
"Moves to next unreviewed item in Review plugin list.",
KeyEvent.VK_RIGHT, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.NextUnreviewedItem();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class PreviousItemAction extends JosmAction {

public PreviousItemAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/up-c"),
"Moves to previous item in Review plugin list.",
Shortcut.registerShortcut("Moves to previous item in Review plugin",
"Moves to previous item in Review plugin list.",
KeyEvent.VK_UP, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.PreviousItem();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class PreviousUnreviewedItemAction extends JosmAction {

public PreviousUnreviewedItemAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/circle-double-up"),
"Moves to previous unreviewed item in list.",
Shortcut.registerShortcut("Moves to previous unreviewed item in Review plugin list.",
"Moves to previous unreviewed item in Review plugin list.",
KeyEvent.VK_LEFT, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.PreviousUnreviewedItem();
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin;
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class StartReviewAction extends JosmAction {

public StartReviewAction() {
super("Start Review", new ImageProvider("dialogs/reviewPlugin/icon"),
"Shows 'Review Changes' pad and updates content with latest changes to be reviewed.",
Shortcut.registerShortcut("Start Review",
super(null, new ImageProvider("dialogs/reviewPlugin/icon"),
"Updates list with latest changes to be reviewed.",
Shortcut.registerShortcut("Start Review plugin",
"Shows 'Review Changes' pad and updates content with latest changes to be reviewed.",
KeyEvent.VK_R, Shortcut.CTRL_SHIFT),
KeyEvent.VK_R, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.StartReview();
reviewListDialog.buttonShown();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class ToggleAction extends JosmAction {

public ToggleAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/checklist"),
"Toggles review state of selected item.",
Shortcut.registerShortcut("Toggle item in Review plugin",
"Toggles review state of selected item.",
KeyEvent.VK_SPACE, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.ToggleReviewed(false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.Actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin.ReviewListDialog;
import org.openstreetmap.josm.tools.Shortcut;
import org.openstreetmap.josm.tools.ImageProvider;

public class ToggleMoveNextAction extends JosmAction {

public ToggleMoveNextAction() {
super(null, new ImageProvider("dialogs/reviewPlugin/check-one"),
"Marks selected item as reviewed and moves to next unreviewed item.",
Shortcut.registerShortcut("Review and move to next",
"Marks selected item as reviewed and moves to next unreviewed item.",
KeyEvent.VK_ENTER, Shortcut.ALT_CTRL),
false, "reviewChanges", true);
}

@Override
public void actionPerformed(ActionEvent event) {
ReviewListDialog reviewListDialog = MainApplication.getMap().getToggleDialog(ReviewListDialog.class);
reviewListDialog.ToggleReviewed(true);
reviewListDialog.NextUnreviewedItem();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.openstreetmap.josm.plugins.davidkarlas.JosmReviewPlugin;

import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.MapFrame;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;
Expand All @@ -12,13 +11,6 @@ public JosmReviewPlugin(PluginInformation info) {

@Override
public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
ReviewListDialog existingDialog = null;
if (oldFrame != null) {
existingDialog = oldFrame.getToggleDialog(ReviewListDialog.class);
}
if (existingDialog != null) {
oldFrame.removeToggleDialog(existingDialog);
}
if (newFrame != null) {
newFrame.addToggleDialog(new ReviewListDialog());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ReviewItem {

public ReviewItem(OsmPrimitive item) {
this.item = item;
}
}

public OsmPrimitive getItem() {
return item;
Expand All @@ -18,8 +18,9 @@ public boolean getReviewed() {
return reviewed;
}

public void ToggleReviewed() {
public boolean ToggleReviewed() {
reviewed = !reviewed;
return reviewed;
}

public String getChangeLabel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class ReviewItemRenderer implements ListCellRenderer<ReviewItem> {

private final DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer();
private final DefaultNameFormatter formatter = DefaultNameFormatter.getInstance();
private ImageIcon okImageIcon = new ImageProvider("reviewplugin/ReviewedItem").setSize(ImageSizes.SMALLICON).get();
private ImageIcon cancelImageIcon = new ImageProvider("reviewplugin/UnReviewedItem").setSize(ImageSizes.SMALLICON).get();
private ImageIcon reviewedImageIcon = new ImageProvider("reviewplugin/check-one").setSize(ImageSizes.SMALLICON).get();
private ImageIcon unreviewedImageIcon = new ImageProvider("reviewplugin/close-one").setSize(ImageSizes.SMALLICON).get();

@Override
public Component getListCellRendererComponent(JList<? extends ReviewItem> list, ReviewItem item, int index,
Expand All @@ -29,7 +29,7 @@ public Component getListCellRendererComponent(JList<? extends ReviewItem> list,
JLabel jlabel = (JLabel) comp;
jlabel.setText(item.getChangeLabel() + ": " + formatter.format(osm));
jlabel.setToolTipText(formatter.buildDefaultToolTip(osm));
jlabel.setIcon(item.getReviewed() ? okImageIcon : cancelImageIcon);
jlabel.setIcon(item.getReviewed() ? reviewedImageIcon : unreviewedImageIcon);
}
return comp;
}
Expand Down
Loading

0 comments on commit 98bf78e

Please sign in to comment.