!if "@MINGW@" == "1"
  !define mingw
  !define compiler "mingw"
!endif

!if "@MSVC@" == "1"
  !define msvc
  !define compiler "msvc"
!endif


!if "@ARCH@" == "x86"
  !define arch_x86
!else if "@ARCH@" == "i686"
  !define arch_x86
!else if "@ARCH@" == "i686-w64-mingw32.shared"
  !define arch_x86
!else if "@ARCH@" == "x64"
  !define arch_x64
!else if "@ARCH@" == "x86_64"
  !define arch_x64
!else if "@ARCH@" == "x86_64-w64-mingw32.shared"
  !define arch_x64
!else if "@ARCH@" == "arm64"
  !define arch_arm64
!else
  !error "Missing ARCH"
!endif

!ifdef arch_x86
  !define arch "x86"
!endif

!ifdef arch_x64
  !define arch "x64"
!endif

!ifdef arch_arm64
  !define arch "arm64"
!endif


!if "@CMAKE_BUILD_TYPE@" == "Release"
  !define release
!else if "@CMAKE_BUILD_TYPE@" == "RelWithDebInfo"
  !define release
!else if "@CMAKE_BUILD_TYPE@" == "Debug"
  !define debug
!else
  !error "Missing CMAKE_BUILD_TYPE"
!endif

!ifdef release
  !define build_type ""
!endif

!ifdef debug
  !define build_type "-Debug"
!endif


!ifndef compiler
  !error "Missing compiler."
!endif

!ifndef build_type
  !error "Missing build type."
!endif

!ifndef arch
  !error "Missing arch."
!endif



!ifdef debug
  !define PRODUCT_NAME "Strawberry Music Player Debug"
  !define PRODUCT_NAME_SHORT "Strawberry"
  !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}Debug"
  !ifdef arch_x86
    !define PRODUCT_INSTALL_DIR "$PROGRAMFILES\Strawberry Music Player Debug"
  !endif
  !ifdef arch_x64 || arch_arm64
    !define PRODUCT_INSTALL_DIR "$PROGRAMFILES64\Strawberry Music Player Debug"
  !endif
!else
  !define PRODUCT_NAME "Strawberry Music Player"
  !define PRODUCT_NAME_SHORT "Strawberry"
  !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME_SHORT}"
  !ifdef arch_x86
    !define PRODUCT_INSTALL_DIR "$PROGRAMFILES\Strawberry Music Player"
  !endif
  !ifdef arch_x64 || arch_arm64
    !define PRODUCT_INSTALL_DIR "$PROGRAMFILES64\Strawberry Music Player"
  !endif
!endif

!define PRODUCT_VERSION_MAJOR @STRAWBERRY_VERSION_MAJOR@
!define PRODUCT_VERSION_MINOR @STRAWBERRY_VERSION_MINOR@
!define PRODUCT_VERSION_PATCH @STRAWBERRY_VERSION_PATCH@
!define PRODUCT_DISPLAY_VERSION "@STRAWBERRY_VERSION_PACKAGE@"
!define PRODUCT_DISPLAY_VERSION_SHORT "@STRAWBERRY_VERSION_PACKAGE@"

!define PRODUCT_PUBLISHER "Jonas Kvinge"
!define PRODUCT_WEB_SITE "https://www.strawberrymusicplayer.org/"

!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; Set Application Capabilities info
!define CAPABILITIES_NAME "Strawberry Music Player"
!define CAPABILITIES_LOCAL_NAME "Strawberry"
!define CAPABILITIES_PROGID "Strawberry Music Player"
!define CAPABILITIES_PATH "Software\Clients\Media\Strawberry"
!define CAPABILITIES_DESCRIPTION "Strawberry Music Player"
!define CAPABILITIES_ICON "$INSTDIR\strawberry.ico"
!define CAPABILITIES_REINSTALL "Command to reinstall"
!define CAPABILITIES_HIDE_ICONS "Command to hide icons"
!define CAPABILITIES_SHOW_ICONS "Command to show icons"

Unicode True

!ifdef debug
SetCompressor lzma
!else
SetCompressor /SOLID lzma
!endif

!include "MUI2.nsh"
!include "FileAssociation.nsh"
!include "Capabilities.nsh"
!include LogicLib.nsh
!include Registry.nsh
!include x64.nsh

!define MUI_ICON "strawberry.ico"

!define MUI_COMPONENTSPAGE_SMALLDESC

!ifdef mingw
  ReserveFile "${NSISDIR}/Plugins/x86-unicode/LockedList.dll"
  ReserveFile "${NSISDIR}/Plugins/LockedList64.dll"
  ReserveFile "${NSISDIR}/Plugins/registry.dll"
  ReserveFile "${NSISDIR}/Plugins/x86-unicode/INetC.dll"
!endif

!ifdef msvc
  ReserveFile "${NSISDIR}\Plugins\x86-unicode\LockedList.dll"
  ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
  ReserveFile "${NSISDIR}\Plugins\registry.dll"
  ReserveFile "${NSISDIR}\Plugins\x86-unicode\INetC.dll"
!endif

; Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE COPYING
Page Custom LockedListPageShow
!insertmacro MUI_PAGE_DIRECTORY
!ifdef msvc
Page Custom InstallMSVCRuntime
!endif
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_CONFIRM
UninstPage custom un.LockedListPageShow
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE "English" ;first language is the default language

Name "${PRODUCT_NAME}"

OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}${build_type}-${compiler}-${arch}.exe"

InstallDir "${PRODUCT_INSTALL_DIR}"

; Get the path where Strawberry was installed previously and set it as default path
InstallDirRegKey ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString"

ShowInstDetails show
ShowUnInstDetails show
RequestExecutionLevel admin

Function LockedListPageShow
  LockedList::AddModule /NOUNLOAD \strawberry.exe
  LockedList::Dialog /heading "Checking for running programs:" /noprograms "No programs need to close." /searching "Searching for running programs..."
FunctionEnd

Function un.LockedListPageShow
  LockedList::AddModule /NOUNLOAD \strawberry.exe
  LockedList::Dialog /heading "Checking for running programs:" /noprograms "No programs need to close." /searching "Searching for running programs..."
FunctionEnd

; Check for previous installation, and call the uninstaller if any
Function CheckPreviousInstall

  ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString"
  StrCmp $R0 "" Done

${IfNot} ${Silent}
  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the previous version or `Cancel` to cancel this upgrade." IDOK Uninstall
  Abort
${EndIf}

  Uninstall:
  ClearErrors
  ${If} ${Silent}
  ExecWait '$R0 /S'
  ${Else}
  ExecWait '$R0'
  ${EndIf}

  Done:

FunctionEnd

!ifdef msvc
!define vc_redist_file "vc_redist.${arch}.exe"
Function InstallMSVCRuntime
  SetOutPath "$TEMP"
  File "${vc_redist_file}"
  ; ${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\${arch}" "Version" $R0 $R1
  ; ${If} $R0 == ""
    SetDetailsView hide
    ; inetc::get /caption "Downloading..." "https://aka.ms/vs/17/release/${vc_redist_file}" "$TEMP\${vc_redist_file}" /end
    ExecWait '"$TEMP\${vc_redist_file}" /install /passive /norestart'
    Delete "$TEMP\${vc_redist_file}"
    SetDetailsView show
  ; ${EndIf}
FunctionEnd
!endif

Function .onInit

  !insertmacro MUI_LANGDLL_DISPLAY

  Call CheckPreviousInstall

FunctionEnd

Section "Delete old files" oldfiles
SectionEnd

Section "Strawberry" Strawberry
  SetOutPath "$INSTDIR"

  ; Common executables

  File "strawberry.exe"
  File "strawberry.ico"
  File "sqlite3.exe"
  File "gst-launch-1.0.exe"
  File "gst-play-1.0.exe"
  File "gst-discoverer-1.0.exe"

  ; MinGW specific files

!ifdef mingw

!ifdef arch_x86
  File "libgcc_s_sjlj-1.dll"
  File "libcrypto-3.dll"
  File "libssl-3.dll"
!endif
!ifdef arch_x64
  File "libgcc_s_seh-1.dll"
  File "libcrypto-3-x64.dll"
  File "libssl-3-x64.dll"
!endif

  File "libFLAC-14.dll"
  File "libbrotlicommon.dll"
  File "libbrotlidec.dll"
  File "libbrotlienc.dll"
  File "libbs2b-0.dll"
  File "libbz2.dll"
  File "libchromaprint.dll"
  File "libdl.dll"
  File "libebur128.dll"
  File "libfaac-0.dll"
  File "libfaad-2.dll"
  File "libfdk-aac-2.dll"
  File "libffi-8.dll"
  File "libfreetype-6.dll"
  File "libgcrypt-20.dll"
  File "libgetopt.dll"
  File "libgio-2.0-0.dll"
  File "libglib-2.0-0.dll"
  File "libgme.dll"
  File "libgmodule-2.0-0.dll"
  File "libgmp-10.dll"
  File "libgnutls-30.dll"
  File "libgobject-2.0-0.dll"
  File "libgpg-error-0.dll"
  File "libgstadaptivedemux-1.0-0.dll"
  File "libgstapp-1.0-0.dll"
  File "libgstaudio-1.0-0.dll"
  File "libgstbadaudio-1.0-0.dll"
  File "libgstbase-1.0-0.dll"
  File "libgstcodecparsers-1.0-0.dll"
  File "libgstfft-1.0-0.dll"
  File "libgstisoff-1.0-0.dll"
  File "libgstmpegts-1.0-0.dll"
  File "libgstnet-1.0-0.dll"
  File "libgstpbutils-1.0-0.dll"
  File "libgstreamer-1.0-0.dll"
  File "libgstriff-1.0-0.dll"
  File "libgstrtp-1.0-0.dll"
  File "libgstrtsp-1.0-0.dll"
  File "libgstsdp-1.0-0.dll"
  File "libgsttag-1.0-0.dll"
  File "libgsturidownloader-1.0-0.dll"
  File "libgstvideo-1.0-0.dll"
  File "libharfbuzz-0.dll"
  File "libhogweed-6.dll"
  File "libiconv-2.dll"
  File "libidn2-0.dll"
  File "libintl-8.dll"
  File "libjpeg-9.dll"
  File "libkdsingleapplication-qt6.dll"
  File "liblzma-5.dll"
  File "libmp3lame-0.dll"
  File "libmpcdec.dll"
  File "libmpg123-0.dll"
  File "libnettle-8.dll"
  File "libnghttp2.dll"
  File "libogg-0.dll"
  File "libopenmpt-0.dll"
  File "libopus-0.dll"
  File "liborc-0.4-0.dll"
  File "libpng16-16.dll"
  File "libpsl-5.dll"
  File "libqtsparkle-qt6.dll"
  File "libsoup-3.0-0.dll"
  File "libspeex-1.dll"
  File "libsqlite3-0.dll"
  File "libssp-0.dll"
  File "libstdc++-6.dll"
  File "libtag.dll"
  File "libtasn1-6.dll"
  File "libtwolame-0.dll"
  File "libunistring-5.dll"
  File "libvorbis-0.dll"
  File "libvorbisenc-2.dll"
  File "libvorbisfile-3.dll"
  File "libwavpack-1.dll"
  File "libwinpthread-1.dll"
  File "libzstd.dll"
  File "zlib1.dll"

!ifdef debug
  File "gdb.exe"
  File "libexpat-1.dll"
  File "libmman.dll"
  File "libmpfr-6.dll"
  File "libpcre2-8d.dll"
  File "libpcre2-16d.dll"
  File "libreadline8.dll"
  File "libtermcap.dll"
!else
  File "libpcre2-8.dll"
  File "libpcre2-16.dll"
!endif

!endif ; MinGW

  ; MSVC specific files

!ifdef msvc

!ifdef arch_x86
  File "libcrypto-3.dll"
  File "libssl-3.dll"
!endif
!ifdef arch_x64
  File "libcrypto-3-x64.dll"
  File "libssl-3-x64.dll"
!endif
!ifdef arch_arm64
  File "libcrypto-3-arm64.dll"
  File "libssl-3-arm64.dll"
!endif

  File "FLAC.dll"
  File "brotlicommon.dll"
  File "brotlidec.dll"
  File "chromaprint.dll"
  File "ebur128.dll"
  File "faad-2.dll"
  File "fdk-aac.dll"
  File "ffi-7.dll"
  File "getopt.dll"
  File "gio-2.0-0.dll"
  File "glib-2.0-0.dll"
  File "gme.dll"
  File "gmodule-2.0-0.dll"
!ifndef arch_arm64
  File "gnutls.dll"
!endif
  File "gobject-2.0-0.dll"
  File "gstadaptivedemux-1.0-0.dll"
  File "gstapp-1.0-0.dll"
  File "gstaudio-1.0-0.dll"
  File "gstbadaudio-1.0-0.dll"
  File "gstbase-1.0-0.dll"
  File "gstcodecparsers-1.0-0.dll"
  File "gstfft-1.0-0.dll"
  File "gstisoff-1.0-0.dll"
  File "gstmpegts-1.0-0.dll"
  File "gstnet-1.0-0.dll"
  File "gstpbutils-1.0-0.dll"
  File "gstreamer-1.0-0.dll"
  File "gstriff-1.0-0.dll"
  File "gstrtp-1.0-0.dll"
  File "gstrtsp-1.0-0.dll"
  File "gstsdp-1.0-0.dll"
  File "gsttag-1.0-0.dll"
  File "gsturidownloader-1.0-0.dll"
  File "gstvideo-1.0-0.dll"
!ifdef arch_arm64
  File "gstwinrt-1.0-0.dll"
!endif
  File "harfbuzz.dll"
  File "intl-8.dll"
  File "jpeg62.dll"
  File "kdsingleapplication-qt6.dll"
  File "libbs2b.dll"
!ifndef arch_arm64
  File "libfaac_dll.dll"
!endif
  File "liblzma.dll"
  File "libmp3lame.dll"
  File "libopenmpt.dll"
  File "mpcdec.dll"
  File "mpg123.dll"
  File "nghttp2.dll"
  File "ogg.dll"
  File "opus.dll"
  File "orc-0.4-0.dll"
  File "psl-5.dll"
  File "qtsparkle-qt6.dll"
  File "soup-3.0-0.dll"
  File "sqlite3.dll"
  File "tag.dll"
  File "vorbis.dll"
  File "vorbisfile.dll"
  File "wavpackdll.dll"

!ifdef release
  File "freetype.dll"
  File "libiconv.dll"
  File "libpng16.dll"
  File "libspeex.dll"
  File "pcre2-8.dll"
  File "pcre2-16.dll"
!ifndef arch_arm64
  File "twolame.dll"
!endif
  File "zlib1.dll"
!endif
!ifdef debug
  File "freetyped.dll"
  File "libiconvd.dll"
  File "libpng16d.dll"
  File "libspeexd.dll"
  File "pcre2-8d.dll"
  File "pcre2-16d.dll"
!ifndef arch_arm64
  File "twolamed.dll"
!endif
  File "zlibd1.dll"
!endif

  ; Used by libfftw3-3.dll because fftw is compiled with MinGW.
!ifdef arch_x86
  File "libgcc_s_sjlj-1.dll"
  File "libwinpthread-1.dll"
!endif

!endif ; MSVC

  ; Common files

  File "icudt77.dll"
!ifdef msvc && arch_arm64
  File "fftw3.dll"
!else
  File "libfftw3-3.dll"
!endif
!ifdef msvc && debug
  File "icuin77d.dll"
  File "icuuc77d.dll"
  File "libxml2d.dll"
  File "Qt6Concurrentd.dll"
  File "Qt6Cored.dll"
  File "Qt6Guid.dll"
  File "Qt6Networkd.dll"
  File "Qt6Sqld.dll"
  File "Qt6Widgetsd.dll"
!else
  File "icuin77.dll"
  File "icuuc77.dll"
  File "libxml2.dll"
  File "Qt6Concurrent.dll"
  File "Qt6Core.dll"
  File "Qt6Gui.dll"
  File "Qt6Network.dll"
  File "Qt6Sql.dll"
  File "Qt6Widgets.dll"
!endif

  File "avcodec-61.dll"
  File "avfilter-10.dll"
  File "avformat-61.dll"
  File "avutil-59.dll"
  File "postproc-58.dll"
  File "swresample-5.dll"
  File "swscale-8.dll"

  ; Register Strawberry with Default Programs
  Var /GLOBAL AppIcon
  Var /GLOBAL AppExe
  StrCpy $AppExe "$INSTDIR\strawberry.exe"
  StrCpy $AppIcon "$INSTDIR\strawberry.ico"

  ${RegisterCapabilities}

  ${RegisterMediaType} ".mp3" $AppExe $AppIcon "MP3 Audio File"
  ${RegisterMediaType} ".flac" $AppExe $AppIcon "FLAC Audio File"
  ${RegisterMediaType} ".ogg" $AppExe $AppIcon "OGG Audio File"
  ${RegisterMediaType} ".spx" $AppExe $AppIcon "OGG Speex Audio File"
  ${RegisterMediaType} ".m4a" $AppExe $AppIcon "MP4 Audio File"
  ${RegisterMediaType} ".aac" $AppExe $AppIcon "AAC Audio File"
  ${RegisterMediaType} ".wma" $AppExe $AppIcon "WMA Audio File"
  ${RegisterMediaType} ".wav" $AppExe $AppIcon "WAV Audio File"

  ${RegisterMediaType} ".pls" $AppExe $AppIcon "PLS Audio File"
  ${RegisterMediaType} ".m3u" $AppExe $AppIcon "M3U Audio File"
  ${RegisterMediaType} ".xspf" $AppExe $AppIcon "XSPF Audio File"
  ${RegisterMediaType} ".asx" $AppExe $AppIcon "Windows Media Audio/Video playlist"

  ${RegisterMimeType} "audio/mp3" "mp3" "{cd3afa76-b84f-48f0-9393-7edc34128127}"
  ${RegisterMimeType} "audio/mp4" "m4a" "{cd3afa7c-b84f-48f0-9393-7edc34128127}"
  ${RegisterMimeType} "audio/x-ms-wma" "wma" "{cd3afa84-b84f-48f0-9393-7edc34128127}"
  ${RegisterMimeType} "audio/wav" "wav" "{cd3afa7b-b84f-48f0-9393-7edc34128127}"

  ${RegisterMimeType} "audio/mpegurl" "m3u" "{cd3afa78-b84f-48f0-9393-7edc34128127}"
  ${RegisterMimeType} "application/x-wmplayer" "asx" "{cd3afa96-b84f-48f0-9393-7edc34128127}"

SectionEnd

Section "GIO modules" gio-modules
  SetOutPath "$INSTDIR\gio-modules"
!ifdef mingw
  File "/oname=libgiognutls.dll" "gio-modules\libgiognutls.dll"
!endif
!ifdef msvc
!ifdef arch_arm64
  File "/oname=gioopenssl.dll" "gio-modules\gioopenssl.dll"
!else
  File "/oname=giognutls.dll" "gio-modules\giognutls.dll"
!endif
!endif
SectionEnd

Section "Qt Platform plugins" platforms
  SetOutPath "$INSTDIR\platforms"
!ifdef msvc && debug
  File "/oname=qwindowsd.dll" "platforms\qwindowsd.dll"
!else
  File "/oname=qwindows.dll" "platforms\qwindows.dll"
!endif
SectionEnd

Section "Qt styles" styles
  SetOutPath "$INSTDIR\styles"
!ifdef msvc && debug
  File "/oname=qmodernwindowsstyled.dll" "styles\qmodernwindowsstyled.dll"
!else
  File "/oname=qmodernwindowsstyle.dll" "styles\qmodernwindowsstyle.dll"
!endif
SectionEnd

Section "Qt TLS plugins" tls
  SetOutPath "$INSTDIR\tls"
!ifdef msvc && debug
  File "/oname=qschannelbackendd.dll" "tls\qschannelbackendd.dll"
  File "/oname=qopensslbackendd.dll" "tls\qopensslbackendd.dll"
!else
  File "/oname=qschannelbackend.dll" "tls\qschannelbackend.dll"
  File "/oname=qopensslbackend.dll" "tls\qopensslbackend.dll"
!endif
SectionEnd

Section "Qt SQL Drivers" sqldrivers
  SetOutPath "$INSTDIR\sqldrivers"
!ifdef msvc && debug
  File "/oname=qsqlited.dll" "sqldrivers\qsqlited.dll"
!else
  File "/oname=qsqlite.dll" "sqldrivers\qsqlite.dll"
!endif
SectionEnd

Section "Qt imageformats" imageformats
  SetOutPath "$INSTDIR\imageformats"
!ifdef msvc && debug
  File "/oname=qgifd.dll" "imageformats\qgifd.dll"
  File "/oname=qicod.dll" "imageformats\qicod.dll"
  File "/oname=qjpegd.dll" "imageformats\qjpegd.dll"
!else
  File "/oname=qgif.dll" "imageformats\qgif.dll"
  File "/oname=qico.dll" "imageformats\qico.dll"
  File "/oname=qjpeg.dll" "imageformats\qjpeg.dll"
!endif
SectionEnd

Section "Gstreamer plugins" gstreamer-plugins
  SetOutPath "$INSTDIR\gstreamer-plugins"

!ifdef mingw
  File "/oname=libgstadaptivedemux2.dll" "gstreamer-plugins\libgstadaptivedemux2.dll"
  File "/oname=libgstaes.dll" "gstreamer-plugins\libgstaes.dll"
  File "/oname=libgstaiff.dll" "gstreamer-plugins\libgstaiff.dll"
  File "/oname=libgstapetag.dll" "gstreamer-plugins\libgstapetag.dll"
  File "/oname=libgstapp.dll" "gstreamer-plugins\libgstapp.dll"
  File "/oname=libgstasf.dll" "gstreamer-plugins\libgstasf.dll"
  File "/oname=libgstasfmux.dll" "gstreamer-plugins\libgstasfmux.dll"
  File "/oname=libgstasio.dll" "gstreamer-plugins\libgstasio.dll"
  File "/oname=libgstaudioconvert.dll" "gstreamer-plugins\libgstaudioconvert.dll"
  File "/oname=libgstaudiofx.dll" "gstreamer-plugins\libgstaudiofx.dll"
  File "/oname=libgstaudioparsers.dll" "gstreamer-plugins\libgstaudioparsers.dll"
  File "/oname=libgstaudioresample.dll" "gstreamer-plugins\libgstaudioresample.dll"
  File "/oname=libgstautodetect.dll" "gstreamer-plugins\libgstautodetect.dll"
  File "/oname=libgstbs2b.dll" "gstreamer-plugins\libgstbs2b.dll"
  File "/oname=libgstcoreelements.dll" "gstreamer-plugins\libgstcoreelements.dll"
  File "/oname=libgstdash.dll" "gstreamer-plugins\libgstdash.dll"
  File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll"
  File "/oname=libgstdsd.dll" "gstreamer-plugins\libgstdsd.dll"
  File "/oname=libgstequalizer.dll" "gstreamer-plugins\libgstequalizer.dll"
  File "/oname=libgstfaac.dll" "gstreamer-plugins\libgstfaac.dll"
  File "/oname=libgstfaad.dll" "gstreamer-plugins\libgstfaad.dll"
  File "/oname=libgstfdkaac.dll" "gstreamer-plugins\libgstfdkaac.dll"
  File "/oname=libgstflac.dll" "gstreamer-plugins\libgstflac.dll"
  File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll"
  File "/oname=libgstgme.dll" "gstreamer-plugins\libgstgme.dll"
  File "/oname=libgsthls.dll" "gstreamer-plugins\libgsthls.dll"
  File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll"
  File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"
  File "/oname=libgstid3tag.dll" "gstreamer-plugins\libgstid3tag.dll"
  File "/oname=libgstisomp4.dll" "gstreamer-plugins\libgstisomp4.dll"
  File "/oname=libgstlame.dll" "gstreamer-plugins\libgstlame.dll"
  File "/oname=libgstlibav.dll" "gstreamer-plugins\libgstlibav.dll"
  File "/oname=libgstmpegpsdemux.dll" "gstreamer-plugins\libgstmpegpsdemux.dll"
  File "/oname=libgstmpegpsmux.dll" "gstreamer-plugins\libgstmpegpsmux.dll"
  File "/oname=libgstmpegtsdemux.dll" "gstreamer-plugins\libgstmpegtsdemux.dll"
  File "/oname=libgstmpegtsmux.dll" "gstreamer-plugins\libgstmpegtsmux.dll"
  File "/oname=libgstmpg123.dll" "gstreamer-plugins\libgstmpg123.dll"
  File "/oname=libgstmusepack.dll" "gstreamer-plugins\libgstmusepack.dll"
  File "/oname=libgstogg.dll" "gstreamer-plugins\libgstogg.dll"
  File "/oname=libgstopenmpt.dll" "gstreamer-plugins\libgstopenmpt.dll"
  File "/oname=libgstopus.dll" "gstreamer-plugins\libgstopus.dll"
  File "/oname=libgstopusparse.dll" "gstreamer-plugins\libgstopusparse.dll"
  File "/oname=libgstpbtypes.dll" "gstreamer-plugins\libgstpbtypes.dll"
  File "/oname=libgstplayback.dll" "gstreamer-plugins\libgstplayback.dll"
  File "/oname=libgstreplaygain.dll" "gstreamer-plugins\libgstreplaygain.dll"
  File "/oname=libgstrtp.dll" "gstreamer-plugins\libgstrtp.dll"
  File "/oname=libgstrtsp.dll" "gstreamer-plugins\libgstrtsp.dll"
  File "/oname=libgstsoup.dll" "gstreamer-plugins\libgstsoup.dll"
  File "/oname=libgstspectrum.dll" "gstreamer-plugins\libgstspectrum.dll"
  File "/oname=libgstspeex.dll" "gstreamer-plugins\libgstspeex.dll"
  File "/oname=libgsttaglib.dll" "gstreamer-plugins\libgsttaglib.dll"
  File "/oname=libgsttcp.dll" "gstreamer-plugins\libgsttcp.dll"
  File "/oname=libgsttwolame.dll" "gstreamer-plugins\libgsttwolame.dll"
  File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll"
  File "/oname=libgstudp.dll" "gstreamer-plugins\libgstudp.dll"
  File "/oname=libgstvolume.dll" "gstreamer-plugins\libgstvolume.dll"
  File "/oname=libgstvorbis.dll" "gstreamer-plugins\libgstvorbis.dll"
  File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll"
  File "/oname=libgstwaveform.dll" "gstreamer-plugins\libgstwaveform.dll"
  File "/oname=libgstwavenc.dll" "gstreamer-plugins\libgstwavenc.dll"
  File "/oname=libgstwavpack.dll" "gstreamer-plugins\libgstwavpack.dll"
  File "/oname=libgstwavparse.dll" "gstreamer-plugins\libgstwavparse.dll"
  File "/oname=libgstxingmux.dll" "gstreamer-plugins\libgstxingmux.dll"
!endif ; MinGW

!ifdef msvc
  File "/oname=gstadaptivedemux2.dll" "gstreamer-plugins\gstadaptivedemux2.dll"
  File "/oname=gstaes.dll" "gstreamer-plugins\gstaes.dll"
  File "/oname=gstaiff.dll" "gstreamer-plugins\gstaiff.dll"
  File "/oname=gstapetag.dll" "gstreamer-plugins\gstapetag.dll"
  File "/oname=gstapp.dll" "gstreamer-plugins\gstapp.dll"
  File "/oname=gstasf.dll" "gstreamer-plugins\gstasf.dll"
  File "/oname=gstasfmux.dll" "gstreamer-plugins\gstasfmux.dll"
  File "/oname=gstasio.dll" "gstreamer-plugins\gstasio.dll"
  File "/oname=gstaudioconvert.dll" "gstreamer-plugins\gstaudioconvert.dll"
  File "/oname=gstaudiofx.dll" "gstreamer-plugins\gstaudiofx.dll"
  File "/oname=gstaudioparsers.dll" "gstreamer-plugins\gstaudioparsers.dll"
  File "/oname=gstaudioresample.dll" "gstreamer-plugins\gstaudioresample.dll"
  File "/oname=gstautodetect.dll" "gstreamer-plugins\gstautodetect.dll"
  File "/oname=gstbs2b.dll" "gstreamer-plugins\gstbs2b.dll"
  File "/oname=gstcoreelements.dll" "gstreamer-plugins\gstcoreelements.dll"
  File "/oname=gstdash.dll" "gstreamer-plugins\gstdash.dll"
  File "/oname=gstdirectsound.dll" "gstreamer-plugins\gstdirectsound.dll"
  File "/oname=gstdsd.dll" "gstreamer-plugins\gstdsd.dll"
  File "/oname=gstequalizer.dll" "gstreamer-plugins\gstequalizer.dll"
  File "/oname=gstfaad.dll" "gstreamer-plugins\gstfaad.dll"
  File "/oname=gstfdkaac.dll" "gstreamer-plugins\gstfdkaac.dll"
  File "/oname=gstflac.dll" "gstreamer-plugins\gstflac.dll"
  File "/oname=gstgio.dll" "gstreamer-plugins\gstgio.dll"
  File "/oname=gstgme.dll" "gstreamer-plugins\gstgme.dll"
  File "/oname=gsthls.dll" "gstreamer-plugins\gsthls.dll"
  File "/oname=gsticydemux.dll" "gstreamer-plugins\gsticydemux.dll"
  File "/oname=gstid3demux.dll" "gstreamer-plugins\gstid3demux.dll"
  File "/oname=gstid3tag.dll" "gstreamer-plugins\gstid3tag.dll"
  File "/oname=gstisomp4.dll" "gstreamer-plugins\gstisomp4.dll"
  File "/oname=gstlame.dll" "gstreamer-plugins\gstlame.dll"
  File "/oname=gstlibav.dll" "gstreamer-plugins\gstlibav.dll"
  File "/oname=gstmpegpsdemux.dll" "gstreamer-plugins\gstmpegpsdemux.dll"
  File "/oname=gstmpegpsmux.dll" "gstreamer-plugins\gstmpegpsmux.dll"
  File "/oname=gstmpegtsdemux.dll" "gstreamer-plugins\gstmpegtsdemux.dll"
  File "/oname=gstmpegtsmux.dll" "gstreamer-plugins\gstmpegtsmux.dll"
  File "/oname=gstmpg123.dll" "gstreamer-plugins\gstmpg123.dll"
  File "/oname=gstmusepack.dll" "gstreamer-plugins\gstmusepack.dll"
  File "/oname=gstogg.dll" "gstreamer-plugins\gstogg.dll"
  File "/oname=gstopenmpt.dll" "gstreamer-plugins\gstopenmpt.dll"
  File "/oname=gstopus.dll" "gstreamer-plugins\gstopus.dll"
  File "/oname=gstopusparse.dll" "gstreamer-plugins\gstopusparse.dll"
  File "/oname=gstpbtypes.dll" "gstreamer-plugins\gstpbtypes.dll"
  File "/oname=gstplayback.dll" "gstreamer-plugins\gstplayback.dll"
  File "/oname=gstreplaygain.dll" "gstreamer-plugins\gstreplaygain.dll"
  File "/oname=gstrtp.dll" "gstreamer-plugins\gstrtp.dll"
  File "/oname=gstrtsp.dll" "gstreamer-plugins\gstrtsp.dll"
  File "/oname=gstsoup.dll" "gstreamer-plugins\gstsoup.dll"
  File "/oname=gstspectrum.dll" "gstreamer-plugins\gstspectrum.dll"
  File "/oname=gstspeex.dll" "gstreamer-plugins\gstspeex.dll"
  File "/oname=gsttaglib.dll" "gstreamer-plugins\gsttaglib.dll"
  File "/oname=gsttcp.dll" "gstreamer-plugins\gsttcp.dll"
  File "/oname=gsttypefindfunctions.dll" "gstreamer-plugins\gsttypefindfunctions.dll"
  File "/oname=gstudp.dll" "gstreamer-plugins\gstudp.dll"
  File "/oname=gstvolume.dll" "gstreamer-plugins\gstvolume.dll"
  File "/oname=gstvorbis.dll" "gstreamer-plugins\gstvorbis.dll"
  File "/oname=gstwasapi.dll" "gstreamer-plugins\gstwasapi.dll"
  File "/oname=gstwasapi2.dll" "gstreamer-plugins\gstwasapi2.dll"
  File "/oname=gstwaveform.dll" "gstreamer-plugins\gstwaveform.dll"
  File "/oname=gstwavenc.dll" "gstreamer-plugins\gstwavenc.dll"
  File "/oname=gstwavpack.dll" "gstreamer-plugins\gstwavpack.dll"
  File "/oname=gstwavparse.dll" "gstreamer-plugins\gstwavparse.dll"
  File "/oname=gstxingmux.dll" "gstreamer-plugins\gstxingmux.dll"
!ifndef arch_arm64
  File "/oname=gstfaac.dll" "gstreamer-plugins\gstfaac.dll"
  File "/oname=gsttwolame.dll" "gstreamer-plugins\gsttwolame.dll"
!endif
!ifdef arch_x64
  File "/oname=gstspotify.dll" "gstreamer-plugins\gstspotify.dll"
!endif
!endif ; MSVC

SectionEnd

Section "Start menu items" startmenu
  ; Create Start Menu folders and shortcuts.
  SetShellVarContext all

  CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\strawberry.exe"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"

SectionEnd

Section "Tidal URL Scheme"
  WriteRegStr HKCR "tidal" "URL Protocol" ""
  WriteRegStr HKCR "tidal" "" "URL:tidal"
  WriteRegStr HKCR 'tidal\shell\open\command' '' '"${PRODUCT_INSTALL_DIR}\strawberry.exe" "%1"'
SectionEnd

Section "Uninstaller"
  ; Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\strawberry.ico"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_DISPLAY_VERSION}"
  WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "VersionMajor" "${PRODUCT_VERSION_MAJOR}"
  WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "VersionMinor" "${PRODUCT_VERSION_MINOR}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"

SectionEnd

Section "Uninstall"

  ; Delete all the files

  Delete "$INSTDIR\strawberry.exe"
  Delete "$INSTDIR\strawberry.ico"
  Delete "$INSTDIR\sqlite3.exe"
  Delete "$INSTDIR\gst-launch-1.0.exe"
  Delete "$INSTDIR\gst-play-1.0.exe"
  Delete "$INSTDIR\gst-discoverer-1.0.exe"

  ; MinGW specific files

!ifdef mingw

!ifdef arch_x86
  Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
  Delete "$INSTDIR\libcrypto-3.dll"
  Delete "$INSTDIR\libssl-3.dll"
!endif

!ifdef arch_x64
  Delete "$INSTDIR\libgcc_s_seh-1.dll"
  Delete "$INSTDIR\libcrypto-3-x64.dll"
  Delete "$INSTDIR\libssl-3-x64.dll"
!endif

  Delete "$INSTDIR\libFLAC-14.dll"
  Delete "$INSTDIR\libbrotlicommon.dll"
  Delete "$INSTDIR\libbrotlidec.dll"
  Delete "$INSTDIR\libbrotlienc.dll"
  Delete "$INSTDIR\libbs2b-0.dll"
  Delete "$INSTDIR\libbz2.dll"
  Delete "$INSTDIR\libchromaprint.dll"
  Delete "$INSTDIR\libdl.dll"
  Delete "$INSTDIR\libebur128.dll"
  Delete "$INSTDIR\libfaac-0.dll"
  Delete "$INSTDIR\libfaad-2.dll"
  Delete "$INSTDIR\libfdk-aac-2.dll"
  Delete "$INSTDIR\libffi-8.dll"
  Delete "$INSTDIR\libfreetype-6.dll"
  Delete "$INSTDIR\libgcrypt-20.dll"
  Delete "$INSTDIR\libgetopt.dll"
  Delete "$INSTDIR\libgio-2.0-0.dll"
  Delete "$INSTDIR\libglib-2.0-0.dll"
  Delete "$INSTDIR\libgme.dll"
  Delete "$INSTDIR\libgmodule-2.0-0.dll"
  Delete "$INSTDIR\libgmp-10.dll"
  Delete "$INSTDIR\libgnutls-30.dll"
  Delete "$INSTDIR\libgobject-2.0-0.dll"
  Delete "$INSTDIR\libgpg-error-0.dll"
  Delete "$INSTDIR\libgstadaptivedemux-1.0-0.dll"
  Delete "$INSTDIR\libgstapp-1.0-0.dll"
  Delete "$INSTDIR\libgstaudio-1.0-0.dll"
  Delete "$INSTDIR\libgstbadaudio-1.0-0.dll"
  Delete "$INSTDIR\libgstbase-1.0-0.dll"
  Delete "$INSTDIR\libgstcodecparsers-1.0-0.dll"
  Delete "$INSTDIR\libgstfft-1.0-0.dll"
  Delete "$INSTDIR\libgstisoff-1.0-0.dll"
  Delete "$INSTDIR\libgstmpegts-1.0-0.dll"
  Delete "$INSTDIR\libgstnet-1.0-0.dll"
  Delete "$INSTDIR\libgstpbutils-1.0-0.dll"
  Delete "$INSTDIR\libgstreamer-1.0-0.dll"
  Delete "$INSTDIR\libgstriff-1.0-0.dll"
  Delete "$INSTDIR\libgstrtp-1.0-0.dll"
  Delete "$INSTDIR\libgstrtsp-1.0-0.dll"
  Delete "$INSTDIR\libgstsdp-1.0-0.dll"
  Delete "$INSTDIR\libgsttag-1.0-0.dll"
  Delete "$INSTDIR\libgsturidownloader-1.0-0.dll"
  Delete "$INSTDIR\libgstvideo-1.0-0.dll"
  Delete "$INSTDIR\libharfbuzz-0.dll"
  Delete "$INSTDIR\libhogweed-6.dll"
  Delete "$INSTDIR\libiconv-2.dll"
  Delete "$INSTDIR\libidn2-0.dll"
  Delete "$INSTDIR\libintl-8.dll"
  Delete "$INSTDIR\libjpeg-9.dll"
  Delete "$INSTDIR\libkdsingleapplication-qt6.dll"
  Delete "$INSTDIR\liblzma-5.dll"
  Delete "$INSTDIR\libmp3lame-0.dll"
  Delete "$INSTDIR\libmpcdec.dll"
  Delete "$INSTDIR\libmpg123-0.dll"
  Delete "$INSTDIR\libnettle-8.dll"
  Delete "$INSTDIR\libnghttp2.dll"
  Delete "$INSTDIR\libogg-0.dll"
  Delete "$INSTDIR\libopenmpt-0.dll"
  Delete "$INSTDIR\libopus-0.dll"
  Delete "$INSTDIR\liborc-0.4-0.dll"
  Delete "$INSTDIR\libpng16-16.dll"
  Delete "$INSTDIR\libpsl-5.dll"
  Delete "$INSTDIR\libqtsparkle-qt6.dll"
  Delete "$INSTDIR\libsoup-3.0-0.dll"
  Delete "$INSTDIR\libspeex-1.dll"
  Delete "$INSTDIR\libsqlite3-0.dll"
  Delete "$INSTDIR\libssp-0.dll"
  Delete "$INSTDIR\libstdc++-6.dll"
  Delete "$INSTDIR\libtag.dll"
  Delete "$INSTDIR\libtasn1-6.dll"
  Delete "$INSTDIR\libtwolame-0.dll"
  Delete "$INSTDIR\libunistring-5.dll"
  Delete "$INSTDIR\libvorbis-0.dll"
  Delete "$INSTDIR\libvorbisenc-2.dll"
  Delete "$INSTDIR\libvorbisfile-3.dll"
  Delete "$INSTDIR\libwavpack-1.dll"
  Delete "$INSTDIR\libwinpthread-1.dll"
  Delete "$INSTDIR\libzstd.dll"
  Delete "$INSTDIR\zlib1.dll"

!ifdef debug
  Delete "$INSTDIR\gdb.exe"
  Delete "$INSTDIR\libexpat-1.dll"
  Delete "$INSTDIR\libmman.dll"
  Delete "$INSTDIR\libmpfr-6.dll"
  Delete "$INSTDIR\libpcre2-8d.dll"
  Delete "$INSTDIR\libpcre2-16d.dll"
  Delete "$INSTDIR\libreadline8.dll"
  Delete "$INSTDIR\libtermcap.dll"
!else
  Delete "$INSTDIR\libpcre2-8.dll"
  Delete "$INSTDIR\libpcre2-16.dll"
!endif

!endif ; MinGW

; MSVC specific files

!ifdef msvc

!ifdef arch_x86
  Delete "$INSTDIR\libcrypto-3.dll"
  Delete "$INSTDIR\libssl-3.dll"
!endif
!ifdef arch_x64
  Delete "$INSTDIR\libcrypto-3-x64.dll"
  Delete "$INSTDIR\libssl-3-x64.dll"
!endif
!ifdef arch_arm64
  Delete "$INSTDIR\libcrypto-3-arm64.dll"
  Delete "$INSTDIR\libssl-3-arm64.dll"
!endif

  Delete "$INSTDIR\FLAC.dll"
  Delete "$INSTDIR\brotlicommon.dll"
  Delete "$INSTDIR\brotlidec.dll"
  Delete "$INSTDIR\chromaprint.dll"
  Delete "$INSTDIR\ebur128.dll"
  Delete "$INSTDIR\faad-2.dll"
  Delete "$INSTDIR\fdk-aac.dll"
  Delete "$INSTDIR\ffi-7.dll"
  Delete "$INSTDIR\getopt.dll"
  Delete "$INSTDIR\gio-2.0-0.dll"
  Delete "$INSTDIR\glib-2.0-0.dll"
  Delete "$INSTDIR\gme.dll"
  Delete "$INSTDIR\gmodule-2.0-0.dll"
!ifndef arch_arm64
  Delete "$INSTDIR\gnutls.dll"
!endif
  Delete "$INSTDIR\gobject-2.0-0.dll"
  Delete "$INSTDIR\gstadaptivedemux-1.0-0.dll"
  Delete "$INSTDIR\gstapp-1.0-0.dll"
  Delete "$INSTDIR\gstaudio-1.0-0.dll"
  Delete "$INSTDIR\gstbadaudio-1.0-0.dll"
  Delete "$INSTDIR\gstbase-1.0-0.dll"
  Delete "$INSTDIR\gstcodecparsers-1.0-0.dll"
  Delete "$INSTDIR\gstfft-1.0-0.dll"
  Delete "$INSTDIR\gstisoff-1.0-0.dll"
  Delete "$INSTDIR\gstmpegts-1.0-0.dll"
  Delete "$INSTDIR\gstnet-1.0-0.dll"
  Delete "$INSTDIR\gstpbutils-1.0-0.dll"
  Delete "$INSTDIR\gstreamer-1.0-0.dll"
  Delete "$INSTDIR\gstriff-1.0-0.dll"
  Delete "$INSTDIR\gstrtp-1.0-0.dll"
  Delete "$INSTDIR\gstrtsp-1.0-0.dll"
  Delete "$INSTDIR\gstsdp-1.0-0.dll"
  Delete "$INSTDIR\gsttag-1.0-0.dll"
  Delete "$INSTDIR\gsturidownloader-1.0-0.dll"
  Delete "$INSTDIR\gstvideo-1.0-0.dll"
!ifdef arch_arm64
  Delete "$INSTDIR\gstwinrt-1.0-0.dll"
!endif
  Delete "$INSTDIR\harfbuzz.dll"
  Delete "$INSTDIR\intl-8.dll"
  Delete "$INSTDIR\jpeg62.dll"
  Delete "$INSTDIR\kdsingleapplication-qt6.dll"
  Delete "$INSTDIR\libbs2b.dll"
!ifndef arch_arm64
  Delete "$INSTDIR\libfaac_dll.dll"
!endif
  Delete "$INSTDIR\liblzma.dll"
  Delete "$INSTDIR\libmp3lame.dll"
  Delete "$INSTDIR\libopenmpt.dll"
  Delete "$INSTDIR\mpcdec.dll"
  Delete "$INSTDIR\mpg123.dll"
  Delete "$INSTDIR\nghttp2.dll"
  Delete "$INSTDIR\ogg.dll"
  Delete "$INSTDIR\opus.dll"
  Delete "$INSTDIR\orc-0.4-0.dll"
  Delete "$INSTDIR\psl-5.dll"
  Delete "$INSTDIR\qtsparkle-qt6.dll"
  Delete "$INSTDIR\soup-3.0-0.dll"
  Delete "$INSTDIR\sqlite3.dll"
  Delete "$INSTDIR\tag.dll"
  Delete "$INSTDIR\vorbis.dll"
  Delete "$INSTDIR\vorbisfile.dll"
  Delete "$INSTDIR\wavpackdll.dll"

!ifdef release
  Delete "$INSTDIR\freetype.dll"
  Delete "$INSTDIR\libiconv.dll"
  Delete "$INSTDIR\libpng16.dll"
  Delete "$INSTDIR\libspeex.dll"
  Delete "$INSTDIR\pcre2-8.dll"
  Delete "$INSTDIR\pcre2-16.dll"
!ifndef arch_arm64
  Delete "$INSTDIR\twolame.dll"
!endif
  Delete "$INSTDIR\zlib1.dll"
!endif
!ifdef debug
  Delete "$INSTDIR\freetyped.dll"
  Delete "$INSTDIR\libiconvd.dll"
  Delete "$INSTDIR\libpng16d.dll"
  Delete "$INSTDIR\libspeexd.dll"
  Delete "$INSTDIR\pcre2-8d.dll"
  Delete "$INSTDIR\pcre2-16d.dll"
!ifndef arch_arm64
  Delete "$INSTDIR\twolamed.dll"
!endif
  Delete "$INSTDIR\zlibd1.dll"
!endif

!ifdef arch_x86
  Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
  Delete "$INSTDIR\libwinpthread-1.dll"
!endif

!endif ; MSVC

  ; Common files

  Delete "$INSTDIR\icudt77.dll"
!ifdef msvc && arch_arm64
  Delete "$INSTDIR\fftw3.dll"
!else
  Delete "$INSTDIR\libfftw3-3.dll"
!endif
!ifdef msvc && debug
  Delete "$INSTDIR\icuin77d.dll"
  Delete "$INSTDIR\icuuc77d.dll"
  Delete "$INSTDIR\libxml2d.dll"
  Delete "$INSTDIR\Qt6Concurrentd.dll"
  Delete "$INSTDIR\Qt6Cored.dll"
  Delete "$INSTDIR\Qt6Guid.dll"
  Delete "$INSTDIR\Qt6Networkd.dll"
  Delete "$INSTDIR\Qt6Sqld.dll"
  Delete "$INSTDIR\Qt6Widgetsd.dll"
!else
  Delete "$INSTDIR\icuin77.dll"
  Delete "$INSTDIR\icuuc77.dll"
  Delete "$INSTDIR\libxml2.dll"
  Delete "$INSTDIR\Qt6Concurrent.dll"
  Delete "$INSTDIR\Qt6Core.dll"
  Delete "$INSTDIR\Qt6Gui.dll"
  Delete "$INSTDIR\Qt6Network.dll"
  Delete "$INSTDIR\Qt6Sql.dll"
  Delete "$INSTDIR\Qt6Widgets.dll"
!endif

  Delete "$INSTDIR\avcodec-61.dll"
  Delete "$INSTDIR\avfilter-10.dll"
  Delete "$INSTDIR\avformat-61.dll"
  Delete "$INSTDIR\avutil-59.dll"
  Delete "$INSTDIR\postproc-58.dll"
  Delete "$INSTDIR\swresample-5.dll"
  Delete "$INSTDIR\swscale-8.dll"

!ifdef mingw
  Delete "$INSTDIR\gio-modules\libgiognutls.dll"
!endif
!ifdef msvc
!ifdef arch_arm64
  Delete "$INSTDIR\gio-modules\gioopenssl.dll"
!else
  Delete "$INSTDIR\gio-modules\giognutls.dll"
!endif
!endif

!ifdef msvc && debug
  Delete "$INSTDIR\platforms\qwindowsd.dll"
  Delete "$INSTDIR\styles\qmodernwindowsstyled.dll"
  Delete "$INSTDIR\tls\qschannelbackendd.dll"
  Delete "$INSTDIR\tls\qopensslbackendd.dll"
  Delete "$INSTDIR\sqldrivers\qsqlited.dll"
  Delete "$INSTDIR\imageformats\qgifd.dll"
  Delete "$INSTDIR\imageformats\qicod.dll"
  Delete "$INSTDIR\imageformats\qjpegd.dll"
!else
  Delete "$INSTDIR\platforms\qwindows.dll"
  Delete "$INSTDIR\styles\qmodernwindowsstyle.dll"
  Delete "$INSTDIR\tls\qschannelbackend.dll"
  Delete "$INSTDIR\tls\qopensslbackend.dll"
  Delete "$INSTDIR\sqldrivers\qsqlite.dll"
  Delete "$INSTDIR\imageformats\qgif.dll"
  Delete "$INSTDIR\imageformats\qico.dll"
  Delete "$INSTDIR\imageformats\qjpeg.dll"
!endif

  ; MinGW GStreamer plugins

!ifdef mingw
  Delete "$INSTDIR\gstreamer-plugins\libgstadaptivedemux2.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaes.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaiff.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstapetag.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstapp.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstasf.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstasfmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstasio.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaudioconvert.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaudiofx.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaudioparsers.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstaudioresample.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstautodetect.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstbs2b.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstcoreelements.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstdash.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstdirectsound.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstdsd.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstequalizer.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstfaac.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstfaad.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstfdkaac.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstflac.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstgio.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstgme.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsthls.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsticydemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstid3demux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstid3tag.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstisomp4.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstlame.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstlibav.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmpegpsdemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmpegpsmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmpegtsdemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmpegtsmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmpg123.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstmusepack.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstogg.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstopenmpt.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstopus.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstopusparse.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstpbtypes.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstplayback.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstreplaygain.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstrtp.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstrtsp.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstsoup.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstspectrum.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstspeex.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsttaglib.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsttcp.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsttwolame.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgsttypefindfunctions.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstudp.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstvolume.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstvorbis.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstwaveform.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstwavenc.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstwavpack.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstwavparse.dll"
  Delete "$INSTDIR\gstreamer-plugins\libgstxingmux.dll"
!endif ; mingw

  ; MSVC GStreamer plugins

!ifdef msvc
  Delete "$INSTDIR\gstreamer-plugins\gstadaptivedemux2.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaes.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaiff.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstapetag.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstapp.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstasf.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstasfmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstasio.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaudioconvert.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaudiofx.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaudioparsers.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstaudioresample.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstautodetect.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstbs2b.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstcoreelements.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstdash.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstdirectsound.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstdsd.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstequalizer.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstfaad.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstfdkaac.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstflac.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstgio.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstgme.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsthls.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsticydemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstid3demux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstid3tag.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstisomp4.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstlame.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstlibav.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmpegpsdemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmpegpsmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmpegtsdemux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmpegtsmux.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmpg123.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstmusepack.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstogg.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstopenmpt.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstopus.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstopusparse.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstpbtypes.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstplayback.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstreplaygain.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstrtp.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstrtsp.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstsoup.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstspectrum.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstspeex.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsttaglib.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsttcp.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsttypefindfunctions.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstudp.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstvolume.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstvorbis.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwasapi.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwasapi2.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwaveform.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwavenc.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwavpack.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstwavparse.dll"
  Delete "$INSTDIR\gstreamer-plugins\gstxingmux.dll"
!ifndef arch_arm64
  Delete "$INSTDIR\gstreamer-plugins\gstfaac.dll"
  Delete "$INSTDIR\gstreamer-plugins\gsttwolame.dll"
!endif
  !ifdef arch_x64
  Delete "$INSTDIR\gstreamer-plugins\gstspotify.dll"
!endif

!endif ; msvc

  Delete "$INSTDIR\Uninstall.exe"

  ; Remove the installation folders.
  RMDir "$INSTDIR\platforms"
  RMDir "$INSTDIR\styles"
  RMDir "$INSTDIR\tls"
  RMDir "$INSTDIR\sqldrivers"
  RMDir "$INSTDIR\imageformats"
  RMDir "$INSTDIR\gio-modules"
  RMDir "$INSTDIR\gstreamer-plugins"
  RMDir "$INSTDIR"

  ; Remove the Shortcuts
  SetShellVarContext all

  Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
  RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}"

  ; Remove the entry from 'installed programs list'
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"

  ; Unregister from Default Programs
  ${UnRegisterCapabilities}

SectionEnd
