patrickfav/density-converter

View on GitHub
src/main/resources/main.fxml

Summary

Maintainability
Test Coverage
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane xmlns:fx="http://javafx.com/fxml" fx:controller="at.favre.tools.dconvert.ui.GUIController"
          fx:id="rootGridPane" stylesheets="flatten.css, style.css" maxHeight="Infinity"
          maxWidth="Infinity" alignment="CENTER" hgap="8" vgap="8">
    <padding>
        <Insets top="20" right="15" bottom="5" left="15"/>
    </padding>

    <GridPane fx:id="gridPaneToggleGroup" alignment="center" hgap="0" vgap="0" GridPane.columnIndex="0"
              GridPane.rowIndex="0" GridPane.columnSpan="4" maxWidth="Infinity">
        <padding>
            <Insets bottom="10"/>
        </padding>
        <ToggleButton fx:id="tgAndroid" text="Android" GridPane.columnIndex="0" maxWidth="Infinity"
                      styleClass="toggle-button-platform,toggle-button-platform-left,toggle-button-platform-android"/>
        <ToggleButton fx:id="tgIos" text="iOS" GridPane.columnIndex="1" maxWidth="Infinity"
                      styleClass="toggle-button-platform,toggle-button-platform-ios"/>
        <ToggleButton fx:id="tgWindows" text="Windows" GridPane.columnIndex="2" maxWidth="Infinity"
                      styleClass="toggle-button-platform,toggle-button-platform-win"/>
        <ToggleButton fx:id="tgWeb" text="Web" GridPane.columnIndex="3" maxWidth="Infinity"
                      styleClass="toggle-button-platform,toggle-button-platform-right,toggle-button-platform-web"/>
    </GridPane>

    <Label text="%main.label.source" styleClass="label, label_main" alignment="CENTER_RIGHT" maxWidth="Infinity"
           GridPane.rowIndex="1"/>
    <TextField fx:id="textFieldSrcPath" disable="true" GridPane.columnIndex="1"
               GridPane.rowIndex="1" maxWidth="Infinity" GridPane.hgrow="always"/>
    <Button fx:id="btnSrcFile" GridPane.columnIndex="2" GridPane.rowIndex="1" maxWidth="Infinity"
            GridPane.hgrow="always">
        <tooltip>
            <Tooltip text="%arg.descr.btnsrcFile"/>
        </tooltip>
    </Button>
    <Button fx:id="btnSrcFolder" GridPane.columnIndex="3" GridPane.rowIndex="1" maxWidth="Infinity"
            GridPane.hgrow="always">
        <tooltip>
            <Tooltip text="%arg.descr.btnsrcfolder"/>
        </tooltip>
    </Button>

    <Label text="%main.label.scaletype" styleClass="label, label_main" alignment="CENTER_RIGHT" maxWidth="Infinity"
           GridPane.columnIndex="0"
           GridPane.rowIndex="2"/>

    <GridPane alignment="CENTER_LEFT" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="Infinity"
              GridPane.columnSpan="3" hgap="3" vgap="3" style="-fx-padding: 10 0 5 0">
        <fx:define>
            <ToggleGroup fx:id="scaleTypeToggleGroup"/>
        </fx:define>
        <children>
            <RadioButton fx:id="rbFactor" text="%main.rb.factor" toggleGroup="$scaleTypeToggleGroup"
                         GridPane.columnIndex="0" selected="true" style="-fx-padding: 0 8 0 0">
                <tooltip>
                    <Tooltip text="%arg.descr.scalefactor"/>
                </tooltip>
            </RadioButton>
            <RadioButton fx:id="rbDpWidth" text="%main.rb.widthdp" style="-fx-padding: 0 8 0 0"
                         toggleGroup="$scaleTypeToggleGroup" GridPane.columnIndex="1">
                <tooltip>
                    <Tooltip text="%arg.descr.widthdp"/>
                </tooltip>
            </RadioButton>
            <RadioButton fx:id="rbDpHeight" text="%main.rb.heightdp"
                         toggleGroup="$scaleTypeToggleGroup" GridPane.columnIndex="2">
                <tooltip>
                    <Tooltip text="%arg.descr.heightdp"/>
                </tooltip>
            </RadioButton>
        </children>

    </GridPane>

    <Label text="%main.label.fixedW" styleClass="label, label_main" alignment="CENTER_RIGHT"
           maxWidth="Infinity" visible="false"
           fx:id="labelDpWidth" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
    <Label text="%main.label.fixedH" styleClass="label, label_main" alignment="CENTER_RIGHT"
           maxWidth="Infinity" visible="false"
           fx:id="labelDpHeight" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
    <TextField fx:id="textFieldDp" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="Infinity"
               alignment="CENTER_RIGHT" visible="false"/>
    <Label fx:id="labelDpPostFix" GridPane.columnIndex="2" text="%main.label.dp" GridPane.rowIndex="3"
           alignment="CENTER_RIGHT"
           visible="false"/>

    <GridPane fx:id="gridPaneScaleFactorLabel" alignment="CENTER_RIGHT" GridPane.columnIndex="0" GridPane.rowIndex="3"
              maxWidth="Infinity">
        <Label text="Factor (x3.00)" styleClass="label, label_main" alignment="CENTER_RIGHT"
               maxWidth="Infinity"
               fx:id="labelScale" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
        <Label text="xxhdpi / 3x / 480dpi" styleClass="label, footnote" alignment="CENTER_RIGHT"
               maxWidth="Infinity"
               fx:id="labelScaleSubtitle" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
    </GridPane>
    <Slider fx:id="scaleSlider" min="0.5" max="6" value="3" majorTickUnit="1" blockIncrement="0.25"
            GridPane.columnIndex="1" GridPane.rowIndex="3" showTickLabels="true" snapToTicks="true"
            showTickMarks="true" GridPane.columnSpan="3">
        <tooltip>
            <Tooltip
                    text="%arg.descr.scaleslider"/>
        </tooltip>
    </Slider>

    <Label text="%main.label.dst" style="-fx-font-style: italic" styleClass="label, label_main"
           alignment="CENTER_RIGHT"
           maxWidth="Infinity" GridPane.columnIndex="0"
           GridPane.rowIndex="4"/>
    <TextField fx:id="textFieldDstPath" disable="true" maxWidth="Infinity" GridPane.columnIndex="1"
               GridPane.rowIndex="4"/>
    <Button fx:id="btnDstFolderOpen" maxWidth="Infinity" GridPane.columnIndex="2" GridPane.rowIndex="4" disable="true">
        <tooltip>
            <Tooltip text="%arg.descr.btnopendstfolder"/>
        </tooltip>
    </Button>
    <Button fx:id="btnDstFolder" maxWidth="Infinity" GridPane.columnIndex="3" GridPane.rowIndex="4">
        <tooltip>
            <Tooltip text="%arg.descr.btndstfolder"/>
        </tooltip>
    </Button>

    <VBox minHeight="20" GridPane.columnIndex="0" GridPane.rowIndex="5" GridPane.columnSpan="4"/>

    <GridPane alignment="CENTER_LEFT" GridPane.columnIndex="0" GridPane.rowIndex="6" maxWidth="Infinity"
              GridPane.columnSpan="3" hgap="3" vgap="3">
        <fx:define>
            <ToggleGroup fx:id="optionTypeToggleGroup"/>
        </fx:define>
        <children>
            <RadioButton fx:id="rbOptSimple" text="%main.rb.simplopt" styleClass="radio-button-sm"
                         toggleGroup="$optionTypeToggleGroup"
                         GridPane.columnIndex="1" selected="true" style="-fx-padding: 0 8 0 0">
                <tooltip>
                    <Tooltip text="%arg.descr.scalefactor"/>
                </tooltip>
            </RadioButton>
            <RadioButton fx:id="rbOptAdvanced" text="%main.rb.advopt" styleClass="radio-button-sm"
                         style="-fx-padding: 0 8 0 0"
                         toggleGroup="$optionTypeToggleGroup" GridPane.columnIndex="2">
                <tooltip>
                    <Tooltip text="%arg.descr.widthdp"/>
                </tooltip>
            </RadioButton>
        </children>
    </GridPane>

    <Button fx:id="btnReset" text="%main.btn.reset" styleClass="button, button-sm" GridPane.columnIndex="3"
            GridPane.rowIndex="6" alignment="CENTER_RIGHT"
            GridPane.columnSpan="1" maxWidth="Infinity"/>

    <GridPane fx:id="gridPaneChoiceBoxes" alignment="center" hgap="5" vgap="5" GridPane.columnIndex="0"
              GridPane.rowIndex="7" GridPane.columnSpan="4" maxWidth="Infinity">

        <Label maxWidth="Infinity" GridPane.hgrow="always" styleClass="label" alignment="CENTER_RIGHT"
               text="%main.label.compression"
               GridPane.columnIndex="0"
               GridPane.rowIndex="2"/>
        <ChoiceBox fx:id="choiceCompression" GridPane.hgrow="always" maxWidth="Infinity" GridPane.columnIndex="1"
                   GridPane.rowIndex="2" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.compression"/>
            </tooltip>
        </ChoiceBox>

        <Label maxWidth="Infinity" styleClass="label" alignment="CENTER_RIGHT" text="%main.label.jpgquality"
               GridPane.columnIndex="2"
               GridPane.rowIndex="2"/>
        <ChoiceBox fx:id="choiceCompressionQuality" maxWidth="Infinity" GridPane.columnIndex="3"
                   GridPane.rowIndex="2" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.jpegquality"/>
            </tooltip>
        </ChoiceBox>

        <Label fx:id="labelDownScale" maxWidth="Infinity" styleClass="label" alignment="CENTER_RIGHT"
               text="%main.label.downscale"
               GridPane.columnIndex="0"
               GridPane.rowIndex="3" GridPane.hgrow="always"/>
        <ChoiceBox fx:id="choiceDownScale" maxWidth="Infinity" GridPane.columnIndex="1" GridPane.rowIndex="3"
                   GridPane.hgrow="always" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.scalingalgo"/>
            </tooltip>
        </ChoiceBox>

        <Label fx:id="labelUpScale" maxWidth="Infinity" styleClass="label" alignment="CENTER_RIGHT"
               text="%main.label.upscale"
               GridPane.columnIndex="2"
               GridPane.rowIndex="3" GridPane.hgrow="always"/>
        <ChoiceBox fx:id="choiceUpScale" maxWidth="Infinity" GridPane.columnIndex="3" GridPane.rowIndex="3"
                   GridPane.hgrow="always" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.scalingalgo"/>
            </tooltip>
        </ChoiceBox>

        <Label fx:id="labelRounding" maxWidth="Infinity" styleClass="label" alignment="CENTER_RIGHT"
               text="%main.label.rounding"
               GridPane.columnIndex="0"
               GridPane.rowIndex="4" GridPane.hgrow="always"/>
        <ChoiceBox fx:id="choiceRounding" maxWidth="Infinity" GridPane.columnIndex="1" GridPane.rowIndex="4"
                   GridPane.hgrow="always" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.rounding"/>
            </tooltip>
        </ChoiceBox>

        <Label fx:id="labelThreads" maxWidth="Infinity" styleClass="label" alignment="CENTER_RIGHT"
               text="%main.label.threads"
               GridPane.columnIndex="2"
               GridPane.rowIndex="4" GridPane.hgrow="always"/>
        <ChoiceBox fx:id="choiceThreads" maxWidth="Infinity" GridPane.columnIndex="3" GridPane.rowIndex="4"
                   GridPane.hgrow="always" styleClass="choice-box">
            <tooltip>
                <Tooltip text="%arg.descr.threads"/>
            </tooltip>
        </ChoiceBox>
    </GridPane>

    <VBox fx:id="vboxOptionsCheckboxes" minHeight="5" GridPane.columnIndex="0" GridPane.rowIndex="8"
          GridPane.columnSpan="4"/>

    <GridPane fx:id="gridPaneOptionsCheckboxes" alignment="center" hgap="5" vgap="5" GridPane.columnIndex="0"
              GridPane.rowIndex="9"
              GridPane.columnSpan="4" maxHeight="Infinity" maxWidth="Infinity" GridPane.hgrow="always">
        <CheckBox fx:id="cbSkipExisting" styleClass="check-box" alignment="CENTER_LEFT" maxWidth="Infinity"
                  text="%main.cb.skipexisting"
                  GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.hgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.skipexisting"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbSkipUpscaling" styleClass="check-box" maxWidth="Infinity" text="%main.cb.skipupscaling"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="0" GridPane.hgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.skipupscaling"/>
            </tooltip>
        </CheckBox>

        <CheckBox fx:id="cbDryRun" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.dryrun"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="1" GridPane.hgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.dryrun"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbAndroidIncludeLdpiTvdpi" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.androidldpi"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="1" GridPane.hgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.androidldpi"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbHaltOnError" styleClass="check-box" maxWidth="Infinity" text="%main.cb.halterror"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="2" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.halterror"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbMipmapInsteadDrawable" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.androidmipmap"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="2" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.androidmipmap"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbAntiAliasing" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.antialiasing"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="3" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.antialiasing"/>
            </tooltip>
        </CheckBox>

        <CheckBox fx:id="cbIosCreateImageset" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.ioimageset"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="3" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.iosimageset"/>
            </tooltip>
        </CheckBox>
        <CheckBox fx:id="cbCleanBeforeConvert" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.clean"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="4" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.clean"/>
            </tooltip>
        </CheckBox>
    </GridPane>

    <VBox fx:id="vboxPostProcessors" minHeight="5" GridPane.columnIndex="0" GridPane.rowIndex="10"
          GridPane.columnSpan="4"/>

    <Label text="%main.header.postprocessors" fx:id="labelPostProcessor" styleClass="label,label_main"
           maxWidth="Infinity" GridPane.columnIndex="0"
           GridPane.rowIndex="11" GridPane.columnSpan="2"/>
    <HBox fx:id="hboxWhy" GridPane.columnIndex="2" GridPane.rowIndex="11" alignment="CENTER_RIGHT"
          GridPane.columnSpan="2">
        <Label text="%main.label.whypostproc" fx:id="labelWhyPP" styleClass="label,label_main,why-info"
               maxWidth="Infinity"
               visible="true"/>
    </HBox>

    <GridPane fx:id="gridPanePostProcessors" alignment="center" hgap="5" vgap="5" GridPane.columnIndex="0"
              GridPane.rowIndex="12"
              GridPane.columnSpan="4" maxHeight="Infinity" maxWidth="Infinity" GridPane.hgrow="always">
        <CheckBox fx:id="cbEnablePngCrush" styleClass="check-box" maxWidth="Infinity" text="%main.cb.pngcrush"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="0" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.pngcrush"/>
            </tooltip>
        </CheckBox>

        <CheckBox fx:id="cbPostConvertWebp" styleClass="check-box" maxWidth="Infinity" text="%main.cb.webp"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="0" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.webp"/>
            </tooltip>
        </CheckBox>

        <CheckBox fx:id="cbEnableMozJpeg" styleClass="check-box" maxWidth="Infinity" text="%main.cb.mozjpeg"
                  GridPane.columnIndex="0" alignment="CENTER_LEFT"
                  GridPane.rowIndex="1" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.mozjpeg"/>
            </tooltip>
        </CheckBox>

        <CheckBox fx:id="cbKeepUnoptimized" styleClass="check-box" maxWidth="Infinity"
                  text="%main.cb.keepUnoptimized"
                  GridPane.columnIndex="1" alignment="CENTER_LEFT"
                  GridPane.rowIndex="1" GridPane.hgrow="always"
                  GridPane.vgrow="always">
            <tooltip>
                <Tooltip text="%arg.descr.keeporiginal"/>
            </tooltip>
        </CheckBox>
    </GridPane>

    <VBox fx:id="vboxFillFreeSpace" prefHeight="2000" GridPane.rowIndex="14" GridPane.columnSpan="4"/>

    <TextArea fx:id="textFieldConsole" styleClass="text-area, console" maxWidth="Infinity" GridPane.columnIndex="0"
              GridPane.columnSpan="4" minHeight="0"
              GridPane.rowIndex="16" visible="true" prefRowCount="250" prefColumnCount="80"/>

    <Button fx:id="btnConvert" styleClass="button, button-convert"
            maxWidth="Infinity" text="%main.btn.convert" GridPane.columnIndex="0"
            GridPane.rowIndex="17" GridPane.columnSpan="4"/>

    <ProgressBar fx:id="progressBar" maxWidth="Infinity" disable="true" GridPane.columnIndex="0"
                 GridPane.columnSpan="4" styleClass="progress-bar, progress-convert"
                 GridPane.rowIndex="17" progress="0"/>

    <Label fx:id="labelVersion" alignment="CENTER_LEFT" GridPane.columnIndex="0"
           GridPane.rowIndex="18"
           GridPane.columnSpan="1" styleClass="footnote"/>

    <Label fx:id="labelResult" alignment="CENTER_RIGHT" maxWidth="Infinity" GridPane.columnIndex="1"
           GridPane.rowIndex="18"
           GridPane.columnSpan="3" styleClass="footnote"/>
</GridPane>