Implement image conversion on GUI.

This commit is contained in:
2018-10-23 23:59:33 +01:00
parent a49ada2ce0
commit 0c839c0f05
5 changed files with 1519 additions and 0 deletions

View File

@@ -1623,6 +1623,8 @@
<e p="frmDump.xeto.cs" t="Include" />
<e p="frmImageChecksum.xeto" t="Include" />
<e p="frmImageChecksum.xeto.cs" t="Include" />
<e p="frmImageConvert.xeto" t="Include" />
<e p="frmImageConvert.xeto.cs" t="Include" />
<e p="frmImageEntropy.xeto" t="Include" />
<e p="frmImageEntropy.xeto.cs" t="Include" />
<e p="frmImageVerify.xeto" t="Include" />

View File

@@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?><!--
// /***************************************************************************
// The Disc Image Chef
// ============================================================================
//
// Filename : frmImageConvert.xeto
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Image conversion window.
//
// ==[ Description ] ==========================================================
//
// Defines the structure for the image conversion GUI window.
//
// ==[ License ] ==============================================================
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General public License for more details.
//
// You should have received a copy of the GNU General public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ============================================================================
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
-->
<Form xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Convert image" ClientSize="800, 600" Padding="10">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<Label Text="Source image"/>
<TextBox ID="txtSource" ReadOnly="True"/>
<Label Text="Output format"/>
<ComboBox ID="cmbFormat" ReadOnly="True" SelectedIndexChanged="OnCmbFormatSelectedIndexChanged"/>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<StackLayoutItem Expand="True">
<TextBox ID="txtDestination" ReadOnly="True"/>
</StackLayoutItem>
<Button ID="btnDestination" Text="Choose..." Click="OnBtnDestinationClick" Enabled="False"/>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ID="stkOptions">
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<NumericStepper ID="numCount" MinValue="1" MaxValue="16384" Value="64"/>
<Label ID="txtCount" Text="How many sectors to convert at once."/>
</StackLayout>
<CheckBox ID="chkForce"
Text="Continue conversion even if sector or media tags will be lost in the process."/>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblCreator" Text="Who (person) created the image?"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtCreator"/>
</StackLayoutItem>
<Button ID="btnCreator" Text="Get from source image" Click="OnBtnCreator"/>
</StackLayout>
<GroupBox ID="grpMetadata" Text="Metadata">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<TabControl>
<TabPage Text="Media">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaTitle" Text="Title"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaTitle"/>
</StackLayoutItem>
<Button ID="btnMediaTitle" Text="Get from source image" Click="OnBtnMediaTitle"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaManufacturer" Text="Manufacturer"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaManufacturer"/>
</StackLayoutItem>
<Button ID="btnMediaManufacturer" Text="Get from source image"
Click="OnBtnMediaManufacturer"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaModel" Text="Model"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaModel"/>
</StackLayoutItem>
<Button ID="btnMediaModel" Text="Get from source image" Click="OnBtnMediaModel"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaSerialNumber" Text="Serial number"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaSerialNumber"/>
</StackLayoutItem>
<Button ID="btnMediaSerialNumber" Text="Get from source image"
Click="OnBtnMediaSerialNumber"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaBarcode" Text="Barcode"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaBarcode"/>
</StackLayoutItem>
<Button ID="btnMediaBarcode" Text="Get from source image"
Click="OnBtnMediaBarcode"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaPartNumber" Text="Part number"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtMediaPartNumber"/>
</StackLayoutItem>
<Button ID="btnMediaPartNumber" Text="Get from source image"
Click="OnBtnMediaPartNumber"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblMediaSequence" Text="Number in sequence"/>
<NumericStepper ID="numMediaSequence" MinValue="0"/>
<Button ID="btnMediaSequence" Text="Get from source image"
Click="OnBtnMediaSequence"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblLastMediaSequence" Text="Last media of the sequence"/>
<NumericStepper ID="numLastMediaSequence" MinValue="0"/>
<Button ID="btnLastMediaSequence" Text="Get from source image"
Click="OnBtnLastMediaSequence"/>
</StackLayout>
</StackLayout>
</TabPage>
<TabPage Text="Drive">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblDriveManufacturer" Text="Manufacturer"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtDriveManufacturer"/>
</StackLayoutItem>
<Button ID="btnDriveManufacturer" Text="Get from source image"
Click="OnBtnDriveManufacturer"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblDriveModel" Text="Model"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtDriveModel"/>
</StackLayoutItem>
<Button ID="btnDriveModel" Text="Get from source image" Click="OnBtnDriveModel"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblDriveSerialNumber" Text="Serial number"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtDriveSerialNumber"/>
</StackLayoutItem>
<Button ID="btnDriveSerialNumber" Text="Get from source image"
Click="OnBtnDriveSerialNumber"/>
</StackLayout>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<Label ID="lblDriveFirmwareRevision" Text="Firmware revision"/>
<StackLayoutItem Expand="True">
<TextBox ID="txtDriveFirmwareRevision"/>
</StackLayoutItem>
<Button ID="btnDriveFirmwareRevision" Text="Get from source image"
Click="OnBtnDriveFirmwareRevision"/>
</StackLayout>
</StackLayout>
</TabPage>
<TabPage Text="Comments">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<StackLayoutItem Expand="True">
<TextArea ID="txtComments"/>
</StackLayoutItem>
<Button ID="btnComments" Text="Get from source image" Click="OnBtnComments"/>
</StackLayout>
</TabPage>
</TabControl>
<Label Text="Existing CICM XML sidecar"/>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<StackLayoutItem Expand="True">
<TextBox ID="txtCicmXml" ReadOnly="True"/>
</StackLayoutItem>
<Button ID="btnCicmXmlFromImage" Text="From image..." Click="OnBtnCicmXmlFromImageClick"/>
<Button ID="btnCicmXml" Text="Choose..." Click="OnBtnCicmXmlClick"/>
</StackLayout>
<Label Text="Existing resume file"/>
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<StackLayoutItem Expand="True">
<TextBox ID="txtResumeFile" ReadOnly="True"/>
</StackLayoutItem>
<Button ID="btnResumeFileFromImage" Text="From image..." Click="OnBtnResumeFileFromImageClick"/>
<Button ID="btnResumeFile" Text="Choose..." Click="OnBtnResumeFileClick"/>
</StackLayout>
</StackLayout>
</GroupBox>
<GroupBox ID="grpOptions" Text="Options" Visible="False"/>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ID="stkProgress" Visible="False">
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ID="stkProgress1">
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
<Label ID="lblProgress"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
<ProgressBar ID="prgProgress"/>
</StackLayoutItem>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
ID="stkProgress2">
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
<Label ID="lblProgress2"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Center" Expand="True">
<ProgressBar ID="prgProgress2"/>
</StackLayoutItem>
</StackLayout>
</StackLayout>
<StackLayoutItem HorizontalAlignment="Right" Expand="True">
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Right" VerticalContentAlignment="Bottom">
<Button ID="btnStart" Text="Start" Click="OnBtnStart"/>
<Button ID="btnClose" Text="Close" Click="OnBtnClose"/>
<Button ID="btnStop" Text="Stop" Enabled="False" Visible="False" Click="OnBtnStop"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</Form>

File diff suppressed because it is too large Load Diff

View File

@@ -116,6 +116,7 @@
<Button ID="btnEntropy" Text="Calculate entropy" Click="OnBtnEntropy"/>
<Button ID="btnVerify" Text="Verify" Click="OnBtnVerify"/>
<Button ID="btnChecksum" Text="Checksum" Click="OnBtnChecksum"/>
<Button ID="btnConvert" Text="Convert to..." Click="OnBtnConvert"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>

View File

@@ -56,12 +56,15 @@ namespace DiscImageChef.Gui.Panels
public class pnlImageInfo : Panel
{
frmImageChecksum frmImageChecksum;
frmImageConvert frmImageConvert;
frmImageEntropy frmImageEntropy;
frmImageVerify frmImageVerify;
IMediaImage imageFormat;
string imagePath;
public pnlImageInfo(string imagePath, IFilter filter, IMediaImage imageFormat)
{
this.imagePath = imagePath;
this.imageFormat = imageFormat;
XamlReader.Load(this);
@@ -826,6 +829,19 @@ namespace DiscImageChef.Gui.Panels
frmImageChecksum.Show();
}
protected void OnBtnConvert(object sender, EventArgs e)
{
if(frmImageConvert != null)
{
frmImageConvert.Show();
return;
}
frmImageConvert = new frmImageConvert(imageFormat, imagePath);
frmImageConvert.Closed += (s, ea) => { frmImageConvert = null; };
frmImageConvert.Show();
}
#region XAML controls
#pragma warning disable 169
#pragma warning disable 649
@@ -874,6 +890,7 @@ namespace DiscImageChef.Gui.Panels
Button btnEntropy;
Button btnVerify;
Button btnChecksum;
Button btnConvert;
#pragma warning restore 169
#pragma warning restore 649
#endregion