Mercurial > cgi-bin > hgweb.cgi > JpegWasher
diff src/name/blackcap/exifwasher/WashDialog.kt @ 5:dc1f4359659d
Got it compiling.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 09 Apr 2020 18:20:34 -0700 |
parents | 19c381c536ec |
children | 65d14d44bc3f |
line wrap: on
line diff
--- a/src/name/blackcap/exifwasher/WashDialog.kt Wed Apr 08 21:31:30 2020 -0700 +++ b/src/name/blackcap/exifwasher/WashDialog.kt Thu Apr 09 18:20:34 2020 -0700 @@ -3,6 +3,7 @@ */ package name.blackcap.exifwasher +import java.awt.Dimension import java.awt.event.ActionEvent import java.awt.event.ActionListener import java.io.File @@ -57,7 +58,7 @@ /* initiates the washing of the Exif data */ fun wash(dirty: File) { - title = "Washing: ${image.name}" + title = "Washing: ${dirty.name}" selectAll.setSelected(false) washing = dirty useWaitCursor() @@ -65,13 +66,15 @@ inBackground { try { val image = Image(dirty.canonicalPath) - val meta = image.meta + val meta = image.metadata val keys = meta.keys keys.sort() - Array<Array<String>>(keys.size) { + Array<Array<Any>>(keys.size) { val key = keys[it] val value = meta[key] - arrayOf(!settingsDialog.whitelist.contains(key), key, value.type, value.value) + arrayOf( + !Application.settingsDialog.whitelist.contains(key), + key, value.type, value.value) } } catch (e: Exiv2Exception) { LOGGER.log(Level.SEVERE, "unable to read metadata", e) @@ -97,12 +100,12 @@ } } - private class MyTableModel : DefaultTableModel { + private class MyTableModel(tData: Array<Array<Any>>, cNames: Array<String>) : DefaultTableModel(tData, cNames) { override fun isCellEditable(row: Int, col: Int) = col == 0 override fun getColumnClass(col: Int) = if (col == 0) { - Boolean + Boolean::class.java } else { - String + String::class.java } } @@ -110,7 +113,7 @@ myTable.model.run { for (i in 0 .. rowCount - 1) { val key = getValueAt(i, 1) as String - setValueAt(!settingsDialog.whitelist.contains(key), i, 0) + setValueAt(!Application.settingsDialog.whitelist.contains(key), i, 0) } } myTable.validate() @@ -120,10 +123,10 @@ setVisible(false) /* get path to the directory we create */ - val outDir = if (settingsDialog.outputToInputDir) { + val outDir = if (Application.settingsDialog.outputToInputDir) { washing.canonicalFile.parent } else { - settingsDialog.outputTo + Application.settingsDialog.outputTo } /* get new file name */ @@ -141,9 +144,9 @@ } } val image = Image(newFile.canonicalPath) - val meta = image.meta + val meta = image.metadata meta.keys.forEach { - if (!settingsDialog.whitelist.contains(it)) { + if (!Application.settingsDialog.whitelist.contains(it)) { meta.erase(it) } }