mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Show media type logo in GUI's media info.
This commit is contained in:
13
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
13
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -52,6 +52,7 @@
|
||||
<e p="Settings.StyleCop" t="Include" />
|
||||
<e p="StyleCop.Cache" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="foo.png" t="Include" />
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
<e p="net461" t="Include">
|
||||
@@ -1303,7 +1304,18 @@
|
||||
</e>
|
||||
</e>
|
||||
<e p="DiscImageChef.Gui" t="IncludeRecursive">
|
||||
<e p="Assets" t="Include">
|
||||
<e p="Logos" t="Include">
|
||||
<e p="Media" t="Include">
|
||||
<e p="CDROM.png" t="Include" />
|
||||
<e p="CDROM.svg" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
</e>
|
||||
<e p="ConsoleHandler.cs" t="Include" />
|
||||
<e p="Controls" t="Include">
|
||||
<e p="SvgImageView.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Dialogs" t="Include">
|
||||
<e p="dlgEncodings.xeto" t="Include" />
|
||||
<e p="dlgEncodings.xeto.cs" t="Include" />
|
||||
@@ -1323,6 +1335,7 @@
|
||||
<e p="pnlScsiInfo.xeto" t="Include" />
|
||||
<e p="pnlScsiInfo.xeto.cs" t="Include" />
|
||||
</e>
|
||||
<e p="ResourceHandler.cs" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
|
||||
BIN
DiscImageChef.Gui/Assets/Logos/Media/CDROM.png
Normal file
BIN
DiscImageChef.Gui/Assets/Logos/Media/CDROM.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
20
DiscImageChef.Gui/Assets/Logos/Media/CDROM.svg
Normal file
20
DiscImageChef.Gui/Assets/Logos/Media/CDROM.svg
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="2.25in" width="4.55in" version="1.0" viewBox="0 0 4.55 2.25">
|
||||
<defs>
|
||||
<style type="text/css"/>
|
||||
</defs>
|
||||
<g>
|
||||
<path d="m4.0664 0.32104c-0.0003 0.01278-0.0008 0.02329-0.0012 0.02705-0.0033 0.02882 0 0.04245-0.0831 0.04245s-0.0798-0.01363-0.0831-0.04245c-0.001-0.00938-0.002-0.06069-0.0019-0.0847s0.0009-0.07532 0.0019-0.0847c0.0033-0.02882 0-0.04244 0.0831-0.04244s0.0798 0.01362 0.0831 0.04244c0.0005 0.00393 0.0009 0.01524 0.0012 0.02881l0.1136-0.00001c-0.0007-0.02576-0.0019-0.04728-0.0032-0.0585-0.0065-0.057636 0.0162-0.11282-0.1946-0.11282-0.2107-0.000009-0.188 0.055188-0.1945 0.11282-0.0021 0.01876-0.0041 0.06639-0.0039 0.1144 0.0002 0.04802 0.0017 0.09564 0.0039 0.1144 0.0065 0.05764-0.0162 0.11283 0.1945 0.11283 0.2108-0.00001 0.1881-0.05519 0.1946-0.11283 0.0013-0.01096 0.0023-0.03177 0.003-0.05675h-0.1134z"/>
|
||||
<polygon points="2.7186 0.047689 2.6077 0.37168 2.4968 0.047689 2.3309 0.046823 2.3309 0.48172 2.4418 0.48172 2.4418 0.15772 2.5527 0.48172 2.6636 0.48172 2.7736 0.15772 2.7736 0.48172 2.8845 0.48172 2.8845 0.046823"/>
|
||||
<polygon points="4.2049 0.046823 4.5237 0.046823 4.5237 0.15772 4.4198 0.15772 4.4198 0.48172 4.3088 0.48172 4.3088 0.15772 4.2049 0.15772"/>
|
||||
<polygon points="3.35 0.48172 3.4772 0.046394 3.6425 0.046394 3.77 0.48172 3.6591 0.48172 3.6329 0.39176 3.4874 0.39176 3.508 0.32104 3.612 0.32104 3.5604 0.14375 3.4609 0.48172"/>
|
||||
<path d="m2.0638 0.13625c0.0831 0 0.0798 0.01362 0.0831 0.04244 0.0011 0.00938 0.0018 0.0607 0.0019 0.0847 0.0001 0.02401-0.0008 0.07532-0.0019 0.0847-0.0033 0.02882 0 0.04245-0.0831 0.04245s-0.0798-0.01363-0.0831-0.04245c-0.0011-0.00938-0.002-0.06069-0.0019-0.0847s0.0008-0.07532 0.0019-0.0847c0.0033-0.02882 0-0.04244 0.0831-0.04244l0.0001-0.10009c-0.2107 0.000001-0.188 0.055198-0.1945 0.11283-0.0022 0.01876-0.0041 0.06639-0.0039 0.1144 0.0002 0.04802 0.0017 0.09564 0.0039 0.1144 0.0065 0.05764-0.0162 0.11283 0.1945 0.11283s0.188-0.05519 0.1946-0.11283c0.0021-0.01876 0.0037-0.06638 0.0039-0.1144 0.0002-0.04801-0.0018-0.09563-0.0039-0.1144-0.0066-0.057636 0.0162-0.11282-0.1946-0.11282l-0.0001 0.10008z"/>
|
||||
<path d="m1.6893 0.32104c-0.0003 0.01278-0.0007 0.02329-0.0011 0.02705-0.0033 0.02882 0 0.04245-0.0831 0.04245s-0.0798-0.01363-0.0831-0.04245c-0.0011-0.00938-0.0021-0.06069-0.002-0.0847s0.0009-0.07532 0.002-0.0847c0.0033-0.02882 0-0.04244 0.0831-0.04244s0.0798 0.01362 0.0831 0.04244c0.0004 0.00393 0.0008 0.01524 0.0011 0.02881l0.1137-0.00001c-0.0007-0.02576-0.002-0.04728-0.0032-0.0585-0.0066-0.057636 0.0161-0.11282-0.1946-0.11282-0.2107-0.000009-0.188 0.055188-0.1946 0.11282-0.0021 0.01876-0.0041 0.06639-0.0039 0.1144 0.0002 0.04802 0.0018 0.09564 0.0039 0.1144 0.0066 0.05764-0.0161 0.11283 0.1946 0.11283 0.2107-0.00001 0.188-0.05519 0.1946-0.11283 0.0012-0.01096 0.0023-0.03177 0.003-0.05675h-0.1135z"/>
|
||||
<path d="m3.1546 0.38225l-0.0673-0.00003v-0.0992l0.0673-0.00041c0.083 0 0.0805-0.01362 0.0837-0.04244 0.0011-0.00938 0.0009-0.00167 0.0008-0.02568s0.0003-0.01577-0.0008-0.02514c-0.0032-0.02882-0.0007-0.04245-0.0837-0.04245l-0.0674 0.00018 0.0002 0.3342h-0.1112v-0.43446l0.1784-0.000001c0.2107 0 0.1876 0.055341 0.1953 0.11283 0.001 0.00681 0.001 0.03825 0.001 0.05519 0 0.01362 0 0.04506-0.001 0.05503-0.0053 0.05776 0.0154 0.11239-0.1953 0.11238z"/>
|
||||
<path d="m0.99776 2.1193l-0.69419-0.0008c-0.10045 0-0.18187-0.0815-0.18187-0.1819v-1.0567c0-0.10042 0.08142-0.18184 0.18187-0.18184l0.43447-0.00049c0.05217 0 0.09448-0.04229 0.09448-0.09448l0.00127-0.42249c0-0.02186 0.01773-0.03959 0.0396-0.03959h0.25471c0.0219 0 0.0396 0.01773 0.0396 0.0396l0.0026 1.8992c0 0.0219-0.0177 0.0396-0.0396 0.0396l-0.13294-0.0001-0.00323 0.0943h0.17377c0.0521 0 0.0944-0.0423 0.0944-0.0945v-1.9788c0-0.05222-0.0423-0.094515-0.0944-0.094515h-0.3342c-0.05217 0-0.09448 0.042299-0.09448 0.094465l0.00047 0.42355c0 0.02186-0.01773 0.03961-0.03961 0.03961l-0.39691-0.00073c-0.15312 0-0.27726 0.12412-0.27726 0.27725l0.000005 1.0567c0 0.1531 0.12414 0.2772 0.27726 0.2772l0.69095-0.0002 0.00323-0.0943z"/>
|
||||
<path d="m0.73961 1.7303v-0.6836c0-0.05727-0.04645-0.10371-0.10375-0.10371-0.05729 0-0.10373 0.04644-0.10373 0.10371v0.7379c0 0.0573 0.04644 0.1038 0.10373 0.1038 0.0573 0 0.10375-0.0465 0.10375-0.1038v-0.0543l0.0943 0.0033v0.051c0 0.1094-0.08867 0.1981-0.19805 0.1981-0.10936 0-0.19803-0.0887-0.19803-0.1981v-0.7379c0-0.10934 0.08867-0.19801 0.19803-0.19801 0.10938 0 0.19805 0.08867 0.19805 0.19801v0.6869l-0.0943-0.0033z"/>
|
||||
<path d="m1.6576 2.1193h-0.13c-0.0218 0-0.0396-0.0178-0.0396-0.0396l0.0016-1.3412c0-0.02187 0.0178-0.0396 0.0396-0.0396h0.2547c0.0219 0 0.0397 0.01773 0.0397 0.03961l0.0026 1.3411c0 0.0219-0.0178 0.0396-0.0396 0.0396l-0.129 0.0001v0.0939l0.1665 0.0002c0.0522 0 0.0945-0.0423 0.0945-0.0945v-1.4208c0-0.05212-0.0423-0.09442-0.0945-0.09442l-0.3342-0.00001c-0.0521 0-0.0944 0.04231-0.0944 0.09449l-0.0002 1.4204c0 0.0522 0.0419 0.0945 0.0941 0.0945l0.1682 0.0001v-0.0939z"/>
|
||||
<path d="m2.8575 0.96279l-0.2798-0.00038c-0.0861 0-0.1559 0.06979-0.1559 0.15589s0.0698 0.1559 0.1559 0.1559l0.3834 0.0011c0.1004 0 0.1818 0.0814 0.1818 0.1819l-0.0012 0.4772c0 0.1005-0.0815 0.1819-0.1819 0.1819l-0.761 0.0014c-0.0219 0-0.0397-0.0178-0.0397-0.0396v-0.1849c0-0.0219 0.0178-0.0396 0.0397-0.0396l0.5186-0.0017c0.0861 0 0.156-0.0698 0.156-0.1559s-0.0699-0.1559-0.156-0.1559l-0.3755-0.0015c-0.1004 0-0.1818-0.0814-0.1818-0.1819v-0.47677c0-0.10045 0.0814-0.18186 0.1818-0.18186l0.7055-0.0033c0.0218 0 0.0396 0.01775 0.0396 0.03961v0.18906c0 0.02187-0.0178 0.03961-0.0396 0.03961l-0.1899-0.00026-0.0032 0.09291 0.232 0.0001c0.0522 0 0.0945-0.042 0.0945-0.09413l0.0003-0.26484c0-0.05218-0.0423-0.09447-0.0944-0.09447l-0.7448 0.00033c-0.1531 0-0.2772 0.12412-0.2772 0.27724v0.47677c0 0.1531 0.1241 0.2773 0.2772 0.2773l0.3755-0.0007c0.0346 0 0.0627 0.0281 0.0627 0.0627s-0.0281 0.0627-0.0627 0.0627l-0.559-0.0001c-0.0522 0-0.0945 0.0423-0.0945 0.0945v0.2643c0 0.0521 0.0423 0.0944 0.0945 0.0944l0.8014-0.0001c0.1531 0 0.2772-0.1241 0.2772-0.2773l0.0013-0.4772c0-0.1531-0.1241-0.2773-0.2772-0.2773l-0.3834 0.0011c-0.0346 0-0.0627-0.028-0.0627-0.0627 0-0.0346 0.0281-0.0626 0.0627-0.0626h0.2766l0.0032-0.09291z"/>
|
||||
<path d="m4.2677 1.225h0.1202c0.0219 0 0.0396-0.0177 0.0396-0.0396l-0.0005-0.30546c0-0.10045-0.0814-0.18187-0.1819-0.18187h-0.6012c-0.1005 0-0.1819 0.08142-0.1819 0.18187v1.0567c0 0.1004 0.0814 0.1819 0.1819 0.1819h0.6012c0.1005 0 0.1819-0.0815 0.1819-0.1819l0.0005-0.2904c0-0.0219-0.0177-0.0396-0.0396-0.0396h-0.2268c-0.0219 0-0.0396 0.0177-0.0396 0.0396l0.0012 0.1384c0 0.1094-0.0688 0.1981-0.1782 0.1981s-0.1782-0.0887-0.1782-0.1981v-0.7379c0-0.10934 0.0688-0.19801 0.1782-0.19801s0.1782 0.08867 0.1782 0.19801l-0.0012 0.1387c0 0.0219 0.0177 0.0396 0.0396 0.0396h0.1066l-0.0032 0.0952h-0.1427c-0.0522 0-0.0945-0.0423-0.0945-0.0945l0.0011-0.179c0-0.05727-0.0266-0.10371-0.0839-0.10371s-0.0839 0.04645-0.0839 0.10371v0.7379c0 0.0573 0.0266 0.1038 0.0839 0.1038s0.0839-0.0465 0.0839-0.1038l-0.0011-0.1788c0-0.0522 0.0423-0.0945 0.0945-0.0945h0.3062c0.0522 0 0.0945 0.0423 0.0945 0.0945l-0.0001 0.3308c0 0.1531-0.1242 0.2772-0.2773 0.2772h-0.6012c-0.1531 0-0.2773-0.1241-0.2773-0.2772v-1.0567c0-0.1531 0.1242-0.27721 0.2773-0.27721h0.6012c0.1531 0 0.2773 0.12411 0.2773 0.27724l0.0001 0.34577c0 0.0522-0.0423 0.0945-0.0945 0.0945h-0.1635l0.0032-0.0952z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
62
DiscImageChef.Gui/Controls/SvgImageView.cs
Normal file
62
DiscImageChef.Gui/Controls/SvgImageView.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace DiscImageChef.Gui.Controls
|
||||
{
|
||||
public class SvgImageView : ImageView
|
||||
{
|
||||
Stream svgStream;
|
||||
|
||||
public new Image Image => base.Image;
|
||||
|
||||
byte[] cachedRender;
|
||||
|
||||
public Stream SvgStream
|
||||
{
|
||||
get => svgStream;
|
||||
set
|
||||
{
|
||||
if(svgStream == value) return;
|
||||
|
||||
svgStream = value;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if(Width == -1 || Height == -1 || svgStream== null) return;
|
||||
|
||||
svgStream.Position = 0;
|
||||
|
||||
// TODO: Upstream library not working property: https://github.com/mono/SkiaSharp.Extended/issues/51
|
||||
|
||||
/*SKSvg svg = new SKSvg();
|
||||
SKEncodedImageFormat skFormat = SKEncodedImageFormat.Png;
|
||||
svg.Load(svgStream);
|
||||
//SKRect svgSize = svg.Picture.CullRect;
|
||||
float canvasMin = Math.Min(Width, Height);
|
||||
float svgMax = Math.Max(svg.Picture.CullRect.Width, svg.Picture.CullRect.Height);
|
||||
float scale = canvasMin / svgMax;
|
||||
var matrix = SKMatrix.MakeScale(scale, scale);
|
||||
SKBitmap bitmap = new SKBitmap((int)Width, (int)Height);
|
||||
SKCanvas canvas = new SKCanvas(bitmap);
|
||||
canvas.DrawPicture(svg.Picture, ref matrix);
|
||||
canvas.Flush();
|
||||
SKImage image = SKImage.FromBitmap(bitmap);
|
||||
SKData data = image.Encode(skFormat, 100);
|
||||
MemoryStream outMs = new MemoryStream();
|
||||
data.SaveTo(outMs);
|
||||
cachedRender = outMs.ToArray();
|
||||
base.Image = new Bitmap(cachedRender);
|
||||
*/
|
||||
}
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,13 @@
|
||||
<ProjectReference Include="..\DiscImageChef.Core\DiscImageChef.Core.csproj" />
|
||||
<ProjectReference Include="..\DiscImageChef.Devices\DiscImageChef.Devices.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Assets\Logos\Media\CDROM.png" />
|
||||
<EmbeddedResource Include="Assets\Logos\Media\CDROM.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="DiscImageChef.Gui.config" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Update="libSkiaSharp-amd64.so" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Update="libHarfBuzzSharp-amd64.so" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -31,11 +31,17 @@
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
-->
|
||||
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DiscImageChef.Gui.Controls;assembly=DiscImageChef.Gui">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Center">
|
||||
<Label ID="lblMediaInfo" Text="Media information"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ImageView ID="imgMediaLogo" Visible="False"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<local:SvgImageView ID="svgMediaLogo" Visible="False"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True" VerticalAlignment="Stretch">
|
||||
<TabControl ID="tabInfos">
|
||||
<TabPage ID="tabGeneral" Text="General" Visible="False">
|
||||
|
||||
@@ -42,6 +42,8 @@ using DiscImageChef.Decoders.DVD;
|
||||
using DiscImageChef.Decoders.SCSI.MMC;
|
||||
using DiscImageChef.Decoders.SCSI.SSC;
|
||||
using DiscImageChef.Decoders.Xbox;
|
||||
using DiscImageChef.Gui.Controls;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using BCA = DiscImageChef.Decoders.Bluray.BCA;
|
||||
@@ -62,6 +64,24 @@ namespace DiscImageChef.Gui.Panels
|
||||
|
||||
this.scsiInfo = scsiInfo;
|
||||
|
||||
|
||||
Stream logo = ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.svg");
|
||||
/* if(logo != null)
|
||||
{
|
||||
svgMediaLogo.SvgStream = logo;
|
||||
svgMediaLogo.Visible = true;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
logo =
|
||||
ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.png");
|
||||
if(logo != null)
|
||||
{
|
||||
imgMediaLogo.Image = new Bitmap(logo);
|
||||
imgMediaLogo.Visible = true;
|
||||
}
|
||||
//}
|
||||
|
||||
switch(this.scsiInfo.MediaType)
|
||||
{
|
||||
case MediaType.HDDVDROM:
|
||||
@@ -794,6 +814,8 @@ namespace DiscImageChef.Gui.Panels
|
||||
Button btnSaveBlurayRawDfl;
|
||||
Button btnSaveBlurayPac;
|
||||
Button btnDump;
|
||||
ImageView imgMediaLogo;
|
||||
SvgImageView svgMediaLogo;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
|
||||
10
DiscImageChef.Gui/ResourceHandler.cs
Normal file
10
DiscImageChef.Gui/ResourceHandler.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace DiscImageChef.Gui
|
||||
{
|
||||
static class ResourceHandler
|
||||
{
|
||||
internal static Stream GetResourceStream(string resourcePath) => Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcePath);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user