Changeset 23379 in osm


Ignore:
Timestamp:
2010-09-27T20:30:59+02:00 (14 years ago)
Author:
bastik
Message:

'remember selection of mtime (save to preference file)'

Location:
applications/editors/josm/plugins/photo_geotagging
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photo_geotagging/build.xml

    r23378 r23379  
    2525
    2626        <!-- enter the SVN commit message -->
    27         <property name="commit.message" value="update to josm latest; only recompile (setCancelButton)" />
     27        <property name="commit.message" value="remember selection of mtime (save to preference file)" />
    2828        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    2929        <property name="plugin.main.version" value="3408" />
  • applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java

    r23192 r23379  
    4141
    4242/**
    43  * The action to aks the user for confirmation and then do the tagging.
     43 * The action to ask the user for confirmation and then do the tagging.
    4444 */
    4545class GeotaggingAction extends AbstractAction implements LayerAction {
    4646    final static boolean debug = false;
    4747    final static String KEEP_BACKUP = "plugins.photo_geotagging.keep_backup";
     48    final static String CHANGE_MTIME = "plugins.photo_geotagging.change-mtime";
     49    final static String MTIME_MODE = "plugins.photo_geotagging.mtime-mode";
    4850    final static int MTIME_MODE_GPS = 1;
    4951    final static int MTIME_MODE_PREVIOUS_VALUE = 2;
     
    8991        settingsPanel.add(backups, GBC.eol().insets(3,3,0,0));
    9092
    91         final JCheckBox setMTime = new JCheckBox(tr("change file modification time:"), false);
     93        final JCheckBox setMTime = new JCheckBox(tr("change file modification time:"), Main.pref.getBoolean(CHANGE_MTIME, false));
    9294        settingsPanel.add(setMTime, GBC.std().insets(3,3,5,3));
    9395
    9496        final String[] mTimeModeArray = {"----", tr("to gps time"), tr("to previous value (unchanged mtime)")};
    9597        final JComboBox mTimeMode = new JComboBox(mTimeModeArray);
     98        {
     99            String mTimeModePref = Main.pref.get(MTIME_MODE, null);
     100            int mTimeIdx = 0;
     101            if ("gps".equals(mTimeModePref)) {
     102                mTimeIdx = 1;
     103            } else if ("previous".equals(mTimeModePref)) {
     104                mTimeIdx = 2;
     105            }
     106            mTimeMode.setSelectedIndex(setMTime.isSelected() ? mTimeIdx : 0);
     107        }
    96108        settingsPanel.add(mTimeMode, GBC.eol().insets(3,3,3,3));
    97109
     
    126138
    127139        final boolean keep_backup = backups.isSelected();
     140        final boolean change_mtime = setMTime.isSelected();
    128141        Main.pref.put(KEEP_BACKUP, keep_backup);
     142        Main.pref.put(CHANGE_MTIME, change_mtime);
     143        if (change_mtime) {
     144            String mTimeModePref;
     145            switch (mTimeMode.getSelectedIndex()) {
     146            case 1:
     147                mTimeModePref = "gps";
     148                break;
     149            case 2:
     150                mTimeModePref = "previous";
     151                break;
     152            default:
     153                mTimeModePref = null;
     154            }
     155            Main.pref.put(MTIME_MODE, mTimeModePref);
     156        }
    129157
    130158        Main.worker.execute(new GeoTaggingRunnable(images, keep_backup, mTimeMode.getSelectedIndex()));
Note: See TracChangeset for help on using the changeset viewer.