Set GTK+ GUI as a separate project.

This commit is contained in:
2019-07-14 00:32:23 +01:00
parent 337c4967c9
commit 5cd72cc738
9 changed files with 216 additions and 105 deletions

View File

@@ -36,7 +36,6 @@
<e p="Entropy.cs" t="Include" /> <e p="Entropy.cs" t="Include" />
<e p="ExtractFiles.cs" t="Include" /> <e p="ExtractFiles.cs" t="Include" />
<e p="Formats.cs" t="Include" /> <e p="Formats.cs" t="Include" />
<e p="Gui.cs" t="Include" />
<e p="ImageInfo.cs" t="Include" /> <e p="ImageInfo.cs" t="Include" />
<e p="ListDevices.cs" t="Include" /> <e p="ListDevices.cs" t="Include" />
<e p="ListEncodings.cs" t="Include" /> <e p="ListEncodings.cs" t="Include" />
@@ -62,7 +61,7 @@
<e p="bin" t="ExcludeRecursive" /> <e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive"> <e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include"> <e p="Debug" t="Include">
<e p="net461" t="Include"> <e p="netcoreapp2.0" t="Include">
<e p="DiscImageChef.AssemblyInfo.cs" t="Include" /> <e p="DiscImageChef.AssemblyInfo.cs" t="Include" />
</e> </e>
</e> </e>
@@ -1422,6 +1421,18 @@
</e> </e>
</e> </e>
</e> </e>
<e p="DiscImageChef.Gtk" t="IncludeRecursive">
<e p="DiscImageChef.Gtk.csproj" t="IncludeRecursive" />
<e p="Program.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
<e p="netcoreapp2.0" t="Include">
<e p="DiscImageChef.Gtk.AssemblyInfo.cs" t="Include" />
</e>
</e>
</e>
</e>
<e p="DiscImageChef.Gui" t="IncludeRecursive"> <e p="DiscImageChef.Gui" t="IncludeRecursive">
<e p="Assets" t="Include"> <e p="Assets" t="Include">
<e p="Icons" t="Include"> <e p="Icons" t="Include">

View File

@@ -1,22 +1,18 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="GUI" type="DotNetProject" factoryName=".NET Project"> <configuration default="false" name="GUI" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/DiscImageChef/bin/Debug/net461/DiscImageChef.exe" /> <option name="EXE_PATH" value="$PROJECT_DIR$/DiscImageChef.Gtk/bin/Debug/netcoreapp2.0/DiscImageChef.Gtk.dll" />
<option name="PROGRAM_PARAMETERS" value="gui -d" /> <option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/DiscImageChef" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/DiscImageChef.Gtk" />
<option name="PASS_PARENT_ENVS" value="1" /> <option name="PASS_PARENT_ENVS" value="1" />
<envs>
<env name="ASPNETCORE_ENVIRONMENT" value="Development" />
<env name="ASPNETCORE_URLS" value="http://localhost:5000" />
</envs>
<option name="USE_EXTERNAL_CONSOLE" value="0" /> <option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" /> <option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" /> <option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/DiscImageChef/DiscImageChef.csproj" /> <option name="PROJECT_PATH" value="$PROJECT_DIR$/DiscImageChef.Gtk/DiscImageChef.Gtk.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" /> <option name="PROJECT_EXE_PATH_TRACKING" value="0" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" /> <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" /> <option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" /> <option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETFramework,Version=v4.6.1" /> <option name="PROJECT_TFM" value=".NETCoreApp,Version=v2.0" />
<browser url="http://localhost:5000" /> <browser url="http://localhost:5000" />
<method v="2"> <method v="2">
<option name="Build" enabled="true" /> <option name="Build" enabled="true" />

View File

@@ -0,0 +1,106 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<SchemaVersion>2.0</SchemaVersion>
<Version>4.5.99.1693</Version>
<Company>Claunia.com</Company>
<Product>The Disc Image Chef</Product>
<Title>The Disc Image Chef</Title>
<ApplicationVersion>$(Version)</ApplicationVersion>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<ReleaseVersion>$(Version)</ReleaseVersion>
<Copyright>Copyright © {copyright:2011} Natalia Portillo</Copyright>
<AssemblyTitle>DiscImageChef</AssemblyTitle>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DiscImageChef.Core\DiscImageChef.Core.csproj"/>
<ProjectReference Include="..\DiscImageChef.Database\DiscImageChef.Database.csproj"/>
<ProjectReference Include="..\DiscImageChef.Gui\DiscImageChef.Gui.csproj"/>
<ProjectReference Include="..\DiscImageChef.Settings\DiscImageChef.Settings.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Gtk" Version="2.5.0-beta.1" />
<PackageReference Include="GtkSharp" Version="3.22.24.37" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Externalconsole>false</Externalconsole>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Externalconsole>false</Externalconsole>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<None Include="..\TODO.md">
<Link>TODO.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\README.md">
<Link>README.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\.travis.yml">
<Link>.travis.yml</Link>
</None>
<None Include="..\CONTRIBUTING.md">
<Link>CONTRIBUTING.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\DONATING.md">
<Link>DONATING.md</Link>
</None>
<None Include="..\NEEDINFO.md">
<Link>NEEDINFO.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\Changelog.md">
<Link>Changelog.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.MIT">
<Link>LICENSE.MIT</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="..\LICENSE.LGPL">
<Link>LICENSE.LGPL</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<Folder Include="..\LICENSE">
<Link>LICENSE</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Folder>
</ItemGroup>
<ItemGroup>
<None Include="..\.github\CODE_OF_CONDUCT.md"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\.github\ISSUE_TEMPLATE.md"/>
<Content Include="..\.github\PULL_REQUEST_TEMPLATE.md"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,78 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.Database;
using DiscImageChef.Gui.Forms;
using Eto;
using Eto.Forms;
using Microsoft.EntityFrameworkCore;
namespace DiscImageChef.Gtk
{
class Program
{
internal static bool Verbose;
internal static bool Debug;
internal static string AssemblyCopyright;
internal static string AssemblyTitle;
internal static AssemblyInformationalVersionAttribute AssemblyVersion;
[STAThread]
public static void Main(string[] args)
{
object[] attributes = typeof(Program).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
AssemblyTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
attributes = typeof(Program).Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
AssemblyVersion =
Attribute.GetCustomAttribute(typeof(Program).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
AssemblyInformationalVersionAttribute;
AssemblyCopyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
DicConsole.WriteLineEvent += System.Console.WriteLine;
DicConsole.WriteEvent += System.Console.Write;
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
Settings.Settings.LoadSettings();
DicContext ctx = DicContext.Create(Settings.Settings.LocalDbPath);
ctx.Database.Migrate();
ctx.SaveChanges();
// TODO: Update database on GUI
DicContext mctx = DicContext.Create(Settings.Settings.MasterDbPath);
mctx.Database.Migrate();
mctx.SaveChanges();
Statistics.LoadStats();
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.ShareStats)
Task.Run(() => { Statistics.SubmitStats(); });
foreach(string arg in args)
switch(arg.ToLowerInvariant())
{
case "-v":
case "--verbose":
Verbose = true;
break;
case "-d":
case "--debug":
Debug = true;
break;
}
new Application(Platforms.Gtk).Run(new frmMain(Debug, Verbose));
Statistics.SaveStats();
}
internal static void PrintCopyright()
{
DicConsole.WriteLine("{0} {1}", AssemblyTitle, AssemblyVersion?.InformationalVersion);
DicConsole.WriteLine("{0}", AssemblyCopyright);
DicConsole.WriteLine();
}
}
}

View File

@@ -20,8 +20,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Claunia.Encoding" Version="1.7.0" /> <PackageReference Include="Claunia.Encoding" Version="1.7.0" />
<PackageReference Include="Eto.Forms" Version="2.4.1" /> <PackageReference Include="Eto.Forms" Version="2.5.0-beta.1" />
<PackageReference Include="Eto.Serialization.Xaml" Version="2.4.1" /> <PackageReference Include="Eto.Serialization.Xaml" Version="2.5.0-beta.1" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" /> <PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -47,6 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Server.Task",
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Dto", "DiscImageChef.Dto\DiscImageChef.Dto.csproj", "{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Dto", "DiscImageChef.Dto\DiscImageChef.Dto.csproj", "{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Gtk", "DiscImageChef.Gtk\DiscImageChef.Gtk.csproj", "{13C642CB-817F-4C18-9CAD-0F9A24C4031A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -231,6 +233,14 @@ Global
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|Any CPU.Build.0 = Release|Any CPU {F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|Any CPU.Build.0 = Release|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.ActiveCfg = Release|Any CPU {F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.ActiveCfg = Release|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.Build.0 = Release|Any CPU {F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|x86.Build.0 = Release|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Debug|x86.ActiveCfg = Debug|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Debug|x86.Build.0 = Debug|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Release|Any CPU.Build.0 = Release|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Release|x86.ActiveCfg = Release|Any CPU
{13C642CB-817F-4C18-9CAD-0F9A24C4031A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -1,84 +0,0 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Gui.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Verbs.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements the 'gui' verb.
//
// --[ 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-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.Console;
using DiscImageChef.Gui.Forms;
using Eto;
using Eto.Forms;
using Mono.Options;
using Command = Mono.Options.Command;
namespace DiscImageChef.Commands
{
class GuiCommand : Command
{
bool showHelp;
public GuiCommand() : base("gui", "Opens the in-progress GUI.")
{
Options = new OptionSet
{
$"{MainClass.AssemblyTitle} {MainClass.AssemblyVersion?.InformationalVersion}",
$"{MainClass.AssemblyCopyright}",
"",
$"usage: DiscImageChef {Name}",
"",
Help,
{"help|h|?", "Show this message and exit.", v => showHelp = v != null}
};
}
public override int Invoke(IEnumerable<string> arguments)
{
List<string> extra = Options.Parse(arguments);
if(showHelp)
{
Options.WriteOptionDescriptions(CommandSet.Out);
return (int)ErrorNumber.HelpRequested;
}
if(extra.Count > 0)
{
MainClass.PrintCopyright();
DicConsole.ErrorWriteLine("Too many arguments.");
return (int)ErrorNumber.UnexpectedArgumentCount;
}
new Application(Platform.Detect).Run(new frmMain(MainClass.Debug, MainClass.Verbose));
return (int)ErrorNumber.NoError;
}
}
}

View File

@@ -10,7 +10,7 @@
<AssemblyName>DiscImageChef</AssemblyName> <AssemblyName>DiscImageChef</AssemblyName>
<ReleaseVersion>$(Version)</ReleaseVersion> <ReleaseVersion>$(Version)</ReleaseVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFramework>net461</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>4.5.99.1693</Version> <Version>4.5.99.1693</Version>
<Company>Claunia.com</Company> <Company>Claunia.com</Company>
@@ -53,7 +53,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Commands\ConvertImage.cs" /> <Compile Include="Commands\ConvertImage.cs" />
<Compile Include="Commands\Gui.cs" />
<Compile Include="Commands\ImageInfo.cs" /> <Compile Include="Commands\ImageInfo.cs" />
<Compile Include="Commands\ListNamespaces.cs" /> <Compile Include="Commands\ListNamespaces.cs" />
<Compile Include="Commands\ListOptions.cs" /> <Compile Include="Commands\ListOptions.cs" />
@@ -263,10 +262,6 @@
<Content Include="..\.github\PULL_REQUEST_TEMPLATE.md" /> <Content Include="..\.github\PULL_REQUEST_TEMPLATE.md" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.4.1" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.4.1" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.4.1" />
<PackageReference Include="Eto.Platform.Wpf" Version="2.4.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
<PackageReference Include="Mono.Options" Version="5.3.0.1" /> <PackageReference Include="Mono.Options" Version="5.3.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

View File

@@ -128,7 +128,6 @@ namespace DiscImageChef
commands.Add(new EntropyCommand()); commands.Add(new EntropyCommand());
commands.Add(new ExtractFilesCommand()); commands.Add(new ExtractFilesCommand());
commands.Add(new FormatsCommand()); commands.Add(new FormatsCommand());
commands.Add(new GuiCommand());
commands.Add(new ImageInfoCommand()); commands.Add(new ImageInfoCommand());
if(currentPlatform == PlatformID.FreeBSD || currentPlatform == PlatformID.Linux || if(currentPlatform == PlatformID.FreeBSD || currentPlatform == PlatformID.Linux ||