<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  @W@

  <Product
      Name="Sonic Visualiser" 
      Id="*"
      Language="1033"
      Codepage="1252" 
      Version="@VERSION@"
      UpgradeCode="D476941E-65F3-4962-9E72-B40FAAE5DBD0"
      Manufacturer="Queen Mary, University of London">
    
    <Package
        Id="*"
        Keywords="Installer"
        Description="Sonic Visualiser 32-bit Installer" 
        Comments="Copyright (c) 2020 Queen Mary, University of London and others."
        Manufacturer="Queen Mary, University of London" 
        InstallerVersion="100" 
        Languages="1033" 
        Compressed="yes" 
        SummaryCodepage="1252"/>

    <MajorUpgrade DowngradeErrorMessage="A later version of Sonic Visualiser is already installed. Setup will now exit."/>

    <Media Id="1" Cabinet="SonicVisualiser.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1"/>
    <Property Id="DiskPrompt" Value="Sonic Visualiser Installation [1]"/>

    <Directory Id="TARGETDIR" Name="SourceDir">

      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="VampPlugins" Name="Vamp Plugins">
          <Component
              Id="VampPlugins"
              Guid="E68E4E0B-3C63-49bd-AD2D-44431EABDA6A">
            <File
                Id="VampREADME"
                Name="README.txt"
                Source="..\deploy\win32\README-Vamp.txt"/>
          </Component>
        </Directory>
        <Directory Id="APPLICATIONFOLDER" Name="Sonic Visualiser">

          <Component
              Id="MainExecutable"
              Guid="2C02DFB7-3CDF-4F73-B9D1-846326EE417D">

            <File
                Id="SVExecutable"
                Name="Sonic Visualiser.exe"
                Source="release\Sonic Visualiser.exe"
                KeyPath="yes">

              <Shortcut
                  Id="SVStartEntry"
                  Directory="ProgramMenuDir"
                  Name="Sonic Visualiser"
                  WorkingDirectory="APPLICATIONFOLDER"
                  Icon="winicon.ico"
                  IconIndex="0"
                  Advertise="yes"/>

              <Shortcut
                  Id="SVDesktop"
                  Directory="DesktopFolder"
                  Name="Sonic Visualiser"
                  WorkingDirectory="APPLICATIONFOLDER"
                  Icon="winicon.ico"
                  IconIndex="0"
                  Advertise="yes"/>
            </File>

            <File
                Id="COPYING"
                Name="COPYING.txt"
                Source="..\COPYING"/>
            <File
                Id="README"
                Name="README.txt"
                Source="..\README.md"/>
            <File
                Id="CHANGELOG"
                Name="CHANGELOG.txt"
                Source="..\CHANGELOG"/>
            <File
                Id="CITATION"
                Name="CITATION.txt"
                Source="..\CITATION"/>

            <File
                Id="winicon.ico"
                Name="sv-winicon.ico"
                Source="..\icons/sv-winicon.ico"/>
          </Component>
          
          <Component
              Id="SVFileAssociation"
              Guid="DC6B3DD1-46DE-47FC-90FB-D8ACD5D1A88A">
            
            <CreateFolder/>

            <ProgId 
                Id='SonicVisualiser.svfile' 
                Description='Sonic Visualiser project file'
                Icon="SVExecutable">
              <Extension 
                  Id='sv' 
                  ContentType='application/sonicvisualiser'>
                <Verb 
                    Id='open' 
                    Command='Open' 
                    TargetFile='SVExecutable' 
                    Argument='"%1"' />
              </Extension>
            </ProgId>
            
          </Component>
          
          <Component
              Id="Qt5"
              Guid="316341D4-B7B2-411D-BCCE-879A11D5709F">
            <File
                Id="QtCore"
                Name="Qt5Core.dll"
                Source="release\Qt5Core.dll"
		KeyPath="yes"/>
            <File
                Id="QtGui"
                Name="Qt5Gui.dll"
                Source="release\Qt5Gui.dll"/>
            <File
                Id="QtNetwork"
                Name="Qt5Network.dll"
                Source="release\Qt5Network.dll"/>
            <File
                Id="QtWidgets"
                Name="Qt5Widgets.dll"
                Source="release\Qt5Widgets.dll"/>
            <File
                Id="QtXml"
                Name="Qt5Xml.dll"
                Source="release\Qt5Xml.dll"/>
            <File
                Id="QtSvg"
                Name="Qt5Svg.dll"
                Source="release\Qt5Svg.dll"/>
            <File
                Id="libgcc"
                Name="libgcc_s_dw2-1.dll"
                Source="release\libgcc_s_dw2-1.dll"/>
            <File
                Id="libstdcplusplus"
                Name="libstdc++-6.dll"
                Source="release\libstdc++-6.dll"/>
            <File
                Id="libwinpthread"
                Name="libwinpthread-1.dll"
                Source="release\libwinpthread-1.dll"/>
          </Component>

          <Component Id="OpenSSL"
                     Guid="dd5a0ca6-7b8d-4ecb-ae43-589c6e24b8b7">
            <File
                Id="libeay32"
                Name="libeay32.dll"
                Source="c:\OpenSSL-Win32\bin\libeay32.dll"
                KeyPath="yes"/>
            <File
                Id="ssleay32"
                Name="ssleay32.dll"
                Source="c:\OpenSSL-Win32\bin\ssleay32.dll"/>
          </Component>
	  
	  <Directory Id="Platforms" Name="platforms">
            <Component
                Id="Qt5PlatformPlugins"
                Guid="1EDCEA4B-C83F-430B-B09D-CB113DFD4E77">
	      <File
                  Id="qminimal"
                  Name="qminimal.dll"
                  Source="release\qminimal.dll"/>
	      <File
                  Id="qwindows"
                  Name="qwindows.dll"
                  Source="release\qwindows.dll"/>
            </Component>
	  </Directory>
	  
	  <Directory Id="Styles" Name="styles">
            <Component
                Id="Qt5StylePlugins"
                Guid="049AD156-CBC3-457A-980F-3C01FF89C054">
	      <File
                  Id="qwindowsvistastyle"
                  Name="qwindowsvistastyle.dll"
                  Source="release\qwindowsvistastyle.dll"/>
            </Component>
	  </Directory>

	  <Directory Id="Helpers" Name="helpers">
            <Component Id="Piper"
                       Guid="17F2AAFF-7B7B-4F20-B345-DEF0A54A84B1">
	      <File
		  Id="piperconv"
		  Name="piper-convert.exe"
		  Source="release\piper-convert.exe"/>
	      <File
		  Id="piper"
		  Name="piper-vamp-simple-server.exe"
		  Source="release\piper-vamp-simple-server.exe"/>
	      <File
                  Id="libgcc32"
                  Name="libgcc_s_dw2-1.dll"
                  Source="release\libgcc_s_dw2-1.dll"/>
	      <File
                  Id="libstdcplusplus32"
                  Name="libstdc++-6.dll"
                  Source="release\libstdc++-6.dll"/>
	      <File
                  Id="libwinpthread32"
                  Name="libwinpthread-1.dll"
                  Source="release\libwinpthread-1.dll"/>
	    </Component>
            <Component Id="Checker"
                       Guid="DB09B035-0594-4876-B494-4D25CED43601">
	      <File
		  Id="checker"
		  Name="vamp-plugin-load-checker.exe"
		  Source="release\vamp-plugin-load-checker.exe"/>
	    </Component>
	  </Directory> <!-- helpers -->
        </Directory> <!-- sv --> 
      </Directory> <!-- pfiles -->
      
      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="Sonic Visualiser">
          <Component Id="ProgramMenuDir" Guid="C1980FF3-D135-46F8-8542-F937748721E6">
            <RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
            <RegistryValue Root="HKMU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes"/>
          </Component>
        </Directory>
      </Directory>

      <Directory Id="DesktopFolder" Name="Desktop"/>

    </Directory>

    <Feature 
        Id="Complete"
        Title="Required files"
        Description="Installs the required files for running Sonic Visualiser."
        AllowAdvertise="no"
        Absent="disallow"
        ConfigurableDirectory="APPLICATIONFOLDER"
        Level="1">
      <ComponentRef Id="VampPlugins"/>
      <ComponentRef Id="MainExecutable"/>
      <ComponentRef Id="SVFileAssociation"/>
      <ComponentRef Id="Qt5"/>
      <ComponentRef Id="Qt5PlatformPlugins"/>
      <ComponentRef Id="Qt5StylePlugins"/>
      <ComponentRef Id="OpenSSL"/>
      <ComponentRef Id="Piper"/>
      <ComponentRef Id="Checker"/>
      <ComponentRef Id="ProgramMenuDir"/>
    </Feature>

    <UI>
      <UIRef Id="WixUI_InstallDir" />
      <UIRef Id="WixUI_ErrorProgressText" />
    </UI>

    <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
    <Property Id="WIXUI_DONTVALIDATEPATH" Value="1" />
    <Property Id="ApplicationFolderName" Value="Sonic Visualiser" />
    <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
    <WixVariable Id="WixUILicenseRtf" Value="..\deploy\win32\License.rtf" />
    
    <Icon Id="winicon.ico" SourceFile="..\icons\sv-winicon.ico"/>
    <Property Id="ARPPRODUCTICON" Value="winicon.ico" />

    <WixVariable Id="WixUIBannerBmp" Value="..\deploy\win32\top.bmp"/>
    <WixVariable Id="WixUIDialogBmp" Value="..\deploy\win32\main.bmp"/>

  </Product>
</Wix>

