commit
9ac8b808bf
4 changed files with 62 additions and 7 deletions
|
@ -32,7 +32,7 @@ class MainPage : Application() {
|
|||
setUpApplicationIcon()
|
||||
|
||||
// Load the FXML.
|
||||
val scene = Scene(fxmlLoader.load(), 640.0, 760.0)
|
||||
val scene = Scene(fxmlLoader.load(), 740.0, 760.0)
|
||||
|
||||
// Initialize the controller.
|
||||
val mainPageController = fxmlLoader.getController<MainPageController>()
|
||||
|
|
|
@ -2,7 +2,7 @@ package dev.nuculabs.imagetagger.ui.controls
|
|||
|
||||
import dev.nuculabs.imagetagger.core.AnalyzedImage
|
||||
import dev.nuculabs.imagetagger.ui.alerts.ErrorAlert
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import javafx.fxml.FXML
|
||||
import javafx.fxml.FXMLLoader
|
||||
import javafx.scene.control.Button
|
||||
|
@ -14,6 +14,7 @@ import javafx.scene.input.Clipboard
|
|||
import javafx.scene.input.ClipboardContent
|
||||
import javafx.scene.input.MouseEvent
|
||||
import javafx.scene.layout.HBox
|
||||
import javafx.scene.layout.VBox
|
||||
import java.awt.Desktop
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
@ -51,6 +52,30 @@ class ImageTagsEntryControl(private val image: AnalyzedImage) : HBox() {
|
|||
@FXML
|
||||
private lateinit var copyTagsButton: Button
|
||||
|
||||
/**
|
||||
* Metadata related UI fields.
|
||||
*/
|
||||
@FXML
|
||||
private lateinit var metadataVbox: VBox
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataAuthor: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataCamera: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataLens: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataISO: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataAperture: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var metadataShutterSpeed: Label
|
||||
|
||||
init {
|
||||
val resource = ImageTagsEntryControl::class.java.getResource("image-tags-entry.fxml")
|
||||
logger.fine("Using resource URL: $resource")
|
||||
|
@ -65,8 +90,10 @@ class ImageTagsEntryControl(private val image: AnalyzedImage) : HBox() {
|
|||
setImage(image)
|
||||
if (image.hasError()) {
|
||||
setText(listOf(image.errorMessage()))
|
||||
metadataVbox.isVisible = false
|
||||
} else {
|
||||
setText(image.tags())
|
||||
setMetadata()
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,6 +126,20 @@ class ImageTagsEntryControl(private val image: AnalyzedImage) : HBox() {
|
|||
predictedImageTags.text = predictions.joinToString { it }
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets and displays the image metadata.
|
||||
*/
|
||||
private fun setMetadata() {
|
||||
val imageMetadata = image.metadata()
|
||||
metadataAuthor.text = "Author: ${imageMetadata.artist}"
|
||||
metadataCamera.text = "Camera: ${imageMetadata.cameraBrand} ${imageMetadata.cameraModel}"
|
||||
metadataLens.text = "Lens: ${imageMetadata.lensModel}"
|
||||
metadataISO.text = "ISO: ${imageMetadata.iso}"
|
||||
metadataAperture.text = "Aperture: ${imageMetadata.aperture}"
|
||||
metadataShutterSpeed.text = "Shutter Speed: ${imageMetadata.shutterSpeed}"
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter for setting the image.
|
||||
*/
|
||||
|
|
|
@ -14,9 +14,24 @@
|
|||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/>
|
||||
</padding>
|
||||
<Label fx:id="fileNameLabel"/>
|
||||
<Label text="Predicted tags:"/>
|
||||
<TextArea fx:id="predictedImageTags" editable="false" wrapText="true" prefColumnCount="20"/>
|
||||
<HBox>
|
||||
<VBox>
|
||||
<Label fx:id="fileNameLabel"/>
|
||||
<Label text="Predicted tags:"/>
|
||||
<TextArea fx:id="predictedImageTags" editable="false" wrapText="true" prefColumnCount="20"/>
|
||||
</VBox>
|
||||
<VBox fx:id="metadataVbox">
|
||||
<padding>
|
||||
<Insets left="10.0" top="35.0"/>
|
||||
</padding>
|
||||
<Label fx:id="metadataAuthor" text="Author: " />
|
||||
<Label fx:id="metadataCamera" text="Camera:" />
|
||||
<Label fx:id="metadataLens" text="Lens:" />
|
||||
<Label fx:id="metadataISO" text="ISO:" />
|
||||
<Label fx:id="metadataAperture" text="Aperture" />
|
||||
<Label fx:id="metadataShutterSpeed" text="Shutter Speed" />
|
||||
</VBox>
|
||||
</HBox>
|
||||
<HBox>
|
||||
<padding>
|
||||
<Insets top="5.0"/>
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
<?import org.kordamp.ikonli.javafx.FontIcon?>
|
||||
<?import dev.nuculabs.imagetagger.ui.controls.ApplicationMenuBar?>
|
||||
<BorderPane prefHeight="537.0" prefWidth="725.0"
|
||||
xmlns:fx="http://javafx.com/fxml/1"
|
||||
<BorderPane xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||
fx:controller="dev.nuculabs.imagetagger.ui.MainPageController"
|
||||
stylesheets="@main-window-view.css"
|
||||
|
|
Loading…
Reference in a new issue