Various fixes for Windows version

- new installer based on InnoSetup
- add MIT license
- produce WinExe output
- other small fixes
This commit is contained in:
Denys Konovalov 2024-09-15 14:38:59 +02:00
parent a115f37c95
commit a299ec043b
7 changed files with 97 additions and 97 deletions

21
LICENSE Normal file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Denys Konovalov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,74 +0,0 @@
Unicode true
!include "MUI2.nsh"
!include "x64.nsh"
!include "nsDialogs.nsh"
!include "FileFunc.nsh"
Function .onInit
${If} ${RunningX64}
# 64 bit code
SetRegView 64
${Else}
# 32 bit code
MessageBox MB_OK "Photomator unterstützt nur 64-Bit-Systeme."
Abort
${EndIf}
FunctionEnd
!define ARP "Software\Microsoft\Windows\CurrentVersion\Uninstall\Photomator"
Name "Photomator"
OutFile "photomator-setup.exe"
BrandingText "Copyright (c) 2024 Denys Konovalov"
InstallDir "$PROGRAMFILES\GCG\Photomator"
RequestExecutionLevel admin
!insertmacro MUI_LANGUAGE "German"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
Section "Install"
SetOutPath $INSTDIR
File /nonfatal /a /r "Photomator\bin\Release\net8.0\win-x64\publish\"
CreateShortcut "$SMPROGRAMS\Photomator.lnk" "$INSTDIR\bin\Photomator.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ARP}" "EstimatedSize" "$0"
WriteRegStr HKLM "${ARP}" "DisplayName" "Photomator"
WriteRegStr HKLM "${ARP}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "${ARP}" "Publisher" "Georg-Cantor-Gymnasium Halle (Saale)"
WriteRegStr HKLM "${ARP}" "VersionMajor" "0"
WriteRegStr HKLM "${ARP}" "VersionMinor" "01"
WriteRegStr HKLM "${ARP}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
SectionEnd
Section "uninstall"
SetRegView 64
Delete "$SMPROGRAMS\Photomator.lnk"
Delete "$INSTDIR\Uninstall.exe"
RMDir /R "$INSTDIR\bin\"
RMDir /R "$INSTDIR\lib\"
RMDir /R "$INSTDIR\share\"
DeleteRegKey HKLM "${ARP}"
RMDir /R $INSTDIR
SectionEnd

@ -5,7 +5,7 @@ public static class AppInfo {
public static readonly string IconName = "de.cantorgymnasium.Photomator"; public static readonly string IconName = "de.cantorgymnasium.Photomator";
public static readonly string Version = ThisAssembly.Git.Tag; public static readonly string Version = ThisAssembly.Git.Tag;
public static readonly string ReleaseNotes = @" public static readonly string ReleaseNotes = @"
<p><em>0.0.1</em></p> <p><em>v0.0.1</em></p>
<p>Initial release</p> <p>Initial release</p>
<ul> <ul>
<li>single-file and folder conversions</li> <li>single-file and folder conversions</li>

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -22,11 +22,10 @@
<RemoveDir Directories="$(PublishDir)" /> <RemoveDir Directories="$(PublishDir)" />
<Message Text="=== Compiling extra resources... ===" Importance="high"/> <Message Text="=== Compiling extra resources... ===" Importance="high"/>
<Exec Command="glib-compile-resources --sourcedir ./Resources ./Resources/de.cantorgymnasium.Photomator.gresource.xml --target=$(OutDir)/de.cantorgymnasium.Photomator.gresource" /> <Exec Command="glib-compile-resources --sourcedir ./Resources ./Resources/de.cantorgymnasium.Photomator.gresource.xml --target=$(OutDir)/de.cantorgymnasium.Photomator.gresource" />
<Message Text="=== Done ===" Importance="high"/>
</Target> </Target>
<Target Name="CopyFiles" AfterTargets="Publish" Condition="'$(RuntimeIdentifier)' == 'win-x64'"> <Target Name="CopyFiles" AfterTargets="Publish" Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<Message Text="=== Copying Gtk files for win-x65 runtime ===" Importance="high"/> <Message Text="=== Copying Gtk files for win-x64 runtime ... ===" Importance="high"/>
<ItemGroup> <ItemGroup>
<SourceFiles Include="$(PublishDir)\**\*.*" /> <SourceFiles Include="$(PublishDir)\**\*.*" />
<GtkDlls Include="libgtk-4-1.dll;libadwaita-1-0.dll;libappstream-5.dll;libbrotlicommon.dll;libbrotlidec.dll;libbz2-1.dll;libcairo-2.dll;libcairo-gobject-2.dll;libcairo-script-interpreter-2.dll;libcrypto-3-x64.dll;libcurl-4.dll;libdatrie-1.dll;libdeflate.dll;libepoxy-0.dll;libexpat-1.dll;libffi-8.dll;libfontconfig-1.dll;libfreetype-6.dll;libfribidi-0.dll;libgcc_s_seh-1.dll;libgdk_pixbuf-2.0-0.dll;libgio-2.0-0.dll;libglib-2.0-0.dll;libgmodule-2.0-0.dll;libgobject-2.0-0.dll;libgraphene-1.0-0.dll;libgraphite2.dll;libharfbuzz-0.dll;libharfbuzz-gobject-0.dll;libiconv-2.dll;libidn2-0.dll;libintl-8.dll;libjbig-0.dll;libjpeg-8.dll;libLerc.dll;liblzma-5.dll;liblzo2-2.dll;libnghttp2-14.dll;libnghttp3-9.dll;libpango-1.0-0.dll;libpangocairo-1.0-0.dll;libpangoft2-1.0-0.dll;libpangowin32-1.0-0.dll;libpcre2-8-0.dll;libpixman-1-0.dll;libpng16-16.dll;libpsl-5.dll;librsvg-2-2.dll;libsharpyuv-0.dll;libssh2-1.dll;libssl-3-x64.dll;libstdc++-6.dll;libthai-0.dll;libtiff-6.dll;libunistring-5.dll;libwebp-7.dll;libwinpthread-1.dll;libxml2-2.dll;libxmlb-2.dll;libyaml-0-2.dll;libzstd.dll;zlib1.dll;gdbus.exe"/> <GtkDlls Include="libgtk-4-1.dll;libadwaita-1-0.dll;libappstream-5.dll;libbrotlicommon.dll;libbrotlidec.dll;libbz2-1.dll;libcairo-2.dll;libcairo-gobject-2.dll;libcairo-script-interpreter-2.dll;libcrypto-3-x64.dll;libcurl-4.dll;libdatrie-1.dll;libdeflate.dll;libepoxy-0.dll;libexpat-1.dll;libffi-8.dll;libfontconfig-1.dll;libfreetype-6.dll;libfribidi-0.dll;libgcc_s_seh-1.dll;libgdk_pixbuf-2.0-0.dll;libgio-2.0-0.dll;libglib-2.0-0.dll;libgmodule-2.0-0.dll;libgobject-2.0-0.dll;libgraphene-1.0-0.dll;libgraphite2.dll;libharfbuzz-0.dll;libharfbuzz-gobject-0.dll;libiconv-2.dll;libidn2-0.dll;libintl-8.dll;libjbig-0.dll;libjpeg-8.dll;libLerc.dll;liblzma-5.dll;liblzo2-2.dll;libnghttp2-14.dll;libnghttp3-9.dll;libpango-1.0-0.dll;libpangocairo-1.0-0.dll;libpangoft2-1.0-0.dll;libpangowin32-1.0-0.dll;libpcre2-8-0.dll;libpixman-1-0.dll;libpng16-16.dll;libpsl-5.dll;librsvg-2-2.dll;libsharpyuv-0.dll;libssh2-1.dll;libssl-3-x64.dll;libstdc++-6.dll;libthai-0.dll;libtiff-6.dll;libunistring-5.dll;libwebp-7.dll;libwinpthread-1.dll;libxml2-2.dll;libxmlb-2.dll;libyaml-0-2.dll;libzstd.dll;zlib1.dll;gdbus.exe"/>
@ -39,6 +38,7 @@
<Copy SourceFiles=".\Resources\loaders.cache" DestinationFolder="$(PublishDir)\lib\gdk-pixbuf-2.0\2.10.0" /> <Copy SourceFiles=".\Resources\loaders.cache" DestinationFolder="$(PublishDir)\lib\gdk-pixbuf-2.0\2.10.0" />
<Copy SourceFiles="C:\msys64\mingw64\share\glib-2.0\schemas\gschemas.compiled" DestinationFolder="$(PublishDir)\share\glib-2.0\schemas" /> <Copy SourceFiles="C:\msys64\mingw64\share\glib-2.0\schemas\gschemas.compiled" DestinationFolder="$(PublishDir)\share\glib-2.0\schemas" />
<Copy SourceFiles="@(Icons)" DestinationFolder="$(PublishDir)\share\icons\%(RecursiveDir)" /> <Copy SourceFiles="@(Icons)" DestinationFolder="$(PublishDir)\share\icons\%(RecursiveDir)" />
<Message Text="=== Done ===" Importance="high"/> <Message Text="=== Building Windows installer ... ===" Importance="high"/>
<Exec Command='"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" Resources\Photomator.iss -DMyAppVersion=$(GitTag)' />
</Target> </Target>
</Project> </Project>

@ -24,7 +24,8 @@ public partial class Program {
"/usr" "/usr"
}; };
string? prefix = prefixes.Find(prefix => File.Exists(prefix + "/share/de.cantorgymnasium.Photomator/de.cantorgymnasium.Photomator.gresource")); string? prefix = prefixes.Find(prefix => File.Exists(prefix + "/share/de.cantorgymnasium.Photomator/de.cantorgymnasium.Photomator.gresource"));
Gio.Functions.ResourcesRegister(Gio.Functions.ResourceLoad(Path.GetFullPath(prefix + "/share/de.cantorgymnasium.Photomator/de.cantorgymnasium.Photomator.gresource"))); if (prefix != null)
Gio.Functions.ResourcesRegister(Gio.Functions.ResourceLoad(Path.GetFullPath(prefix + "/share/de.cantorgymnasium.Photomator/de.cantorgymnasium.Photomator.gresource")));
} }
_application.OnActivate += (_, _) => new MainWindow(_application).Start(); _application.OnActivate += (_, _) => new MainWindow(_application).Start();
} }

@ -0,0 +1,65 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Photomator"
#ifndef MyAppVersion
#define MyAppVersion "v0.0.0-dev"
#endif
#define MyAppPublisher "Georg-Cantor-Gymnasium Halle (Saale)"
#define MyAppURL "https://git.cantorgymnasium.de/gcg/photomator/"
#define MyAppSupportURL "https://git.cantorgymnasium.de/gcg/photomator/issues/"
#define MyAppUpdatesURL "https://git.cantorgymnasium.de/gcg/photomator/releases/"
#define MyAppExeName "Photomator.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{2F93EA62-DD17-4ACF-87B9-4B80B5217CC4}
AppName={#MyAppName}
;AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppSupportURL}
AppUpdatesURL={#MyAppUpdatesURL}
DefaultDirName={autopf}\{#MyAppName}
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
; on anything but x64 and Windows 11 on Arm.
ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
; meaning it should use the native 64-bit Program Files directory and
; the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64compatible
DisableProgramGroupPage=yes
LicenseFile=..\..\LICENSE
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=..\bin\Release\net8.0\win-x64\publish
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-win-x64-setup
SetupIconFile=de.cantorgymnasium.Photomator.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "..\bin\Release\net8.0\win-x64\publish\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\bin\Release\net8.0\win-x64\publish\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\bin\Release\net8.0\win-x64\publish\share\*"; DestDir: "{app}\share"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\bin\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

@ -9,7 +9,6 @@ namespace Photomator.Views;
public partial class StatusDialog : Adw.Window { public partial class StatusDialog : Adw.Window {
private readonly Adw.Application _application; private readonly Adw.Application _application;
private readonly Adw.ApplicationWindow _mainWindow; private readonly Adw.ApplicationWindow _mainWindow;
private readonly ViewStack _stack;
private readonly ProgressBar _progress; private readonly ProgressBar _progress;
public StatusDialog(Adw.Application application, Adw.ApplicationWindow parent) : base() { public StatusDialog(Adw.Application application, Adw.ApplicationWindow parent) : base() {
@ -22,14 +21,8 @@ public partial class StatusDialog : Adw.Window {
SetDeletable(true); SetDeletable(true);
SetDefaultSize(400, 500); SetDefaultSize(400, 500);
_stack = ViewStack.New();
_stack.SetVexpand(true);
StatusPage pageStatus = InitPageProgress(); StatusPage pageStatus = InitPageProgress();
_stack.AddNamed(pageStatus, "page-status"); SetContent(pageStatus);
_stack.SetChildVisible(true);
SetContent(_stack);
} }
public void Start() { public void Start() {
@ -92,9 +85,7 @@ public partial class StatusDialog : Adw.Window {
public void Success(int number, string dest) { public void Success(int number, string dest) {
StatusPage pageSuccess = InitPageSuccess(number, dest); StatusPage pageSuccess = InitPageSuccess(number, dest);
_stack.AddNamed(pageSuccess, "page-success"); SetContent(pageSuccess);
_stack.SetVisibleChildName("page-success");
_stack.SetChildVisible(true);
} }
private StatusPage InitPagePartial(int number, string dest, ConvertError[] convertErrors) { private StatusPage InitPagePartial(int number, string dest, ConvertError[] convertErrors) {
@ -158,9 +149,7 @@ public partial class StatusDialog : Adw.Window {
public void Partial(int number, string dest, ConvertError[] convertErrors) { public void Partial(int number, string dest, ConvertError[] convertErrors) {
StatusPage pagePartial = InitPagePartial(number, dest, convertErrors); StatusPage pagePartial = InitPagePartial(number, dest, convertErrors);
_stack.AddNamed(pagePartial, "page-partial"); SetContent(pagePartial);
_stack.SetVisibleChildName("page-partial");
_stack.SetChildVisible(true);
} }
private StatusPage InitPageError(string error) { private StatusPage InitPageError(string error) {
@ -208,8 +197,6 @@ public partial class StatusDialog : Adw.Window {
public void Error(string error) { public void Error(string error) {
StatusPage pageError = InitPageError(error); StatusPage pageError = InitPageError(error);
_stack.AddNamed(pageError, "page-error"); SetContent(pageError);
_stack.SetVisibleChildName("page-error");
_stack.SetChildVisible(true);
} }
} }