QTfrontend/hwform.cpp
changeset 8307 8d7c52b24e28
parent 8302 a7934cd12469
child 8318 e2c01fbf36c0
equal deleted inserted replaced
8305:039ceb443aca 8307:8d7c52b24e28
  1877 }
  1877 }
  1878 
  1878 
  1879 // used for --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
  1879 // used for --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]
  1880 QString HWForm::getDemoArguments()
  1880 QString HWForm::getDemoArguments()
  1881 {
  1881 {
       
  1882 
       
  1883     QString prefix = datadir->absolutePath();
       
  1884     QString userPrefix = cfgdir->absolutePath();
  1882 #ifdef Q_WS_WIN
  1885 #ifdef Q_WS_WIN
  1883     QString userdir = cfgdir->absolutePath().replace("/","\\");
  1886     prefix = prefix.replace("/","\\");
  1884 #else
  1887     userPrefix = userPrefix.replace("/","\\");
  1885     QString userdir = cfgdir->absolutePath();
       
  1886 #endif
  1888 #endif
  1887 
  1889 
  1888     QRect resolution = config->vid_Resolution();
  1890     QRect resolution = config->vid_Resolution();
  1889     return QString("--user-dir " + userdir
  1891     return QString("--prefix " + prefix
       
  1892                    + " --user-prefix " + userPrefix
  1890                    + " --width " + QString::number(resolution.width())
  1893                    + " --width " + QString::number(resolution.width())
  1891                    + " --height " + QString::number(resolution.height())
  1894                    + " --height " + QString::number(resolution.height())
  1892                    + " --volume " + QString::number(config->volume())
  1895                    + " --volume " + QString::number(config->volume())
  1893                    + (config->isMusicEnabled() ? "" : " --nomusic")
  1896                    + (config->isMusicEnabled() ? "" : " --nomusic")
  1894                    + (config->isSoundEnabled() ? "" : " --nosound")
  1897                    + (config->isSoundEnabled() ? "" : " --nosound")
  1910     registry_hkcr.setValue(".hws/Default", "Hedgewars.Save");
  1913     registry_hkcr.setValue(".hws/Default", "Hedgewars.Save");
  1911     registry_hkcr.setValue("Hedgewars.Demo/Default", tr("Hedgewars Demo File", "File Types"));
  1914     registry_hkcr.setValue("Hedgewars.Demo/Default", tr("Hedgewars Demo File", "File Types"));
  1912     registry_hkcr.setValue("Hedgewars.Save/Default", tr("Hedgewars Save File", "File Types"));
  1915     registry_hkcr.setValue("Hedgewars.Save/Default", tr("Hedgewars Save File", "File Types"));
  1913     registry_hkcr.setValue("Hedgewars.Demo/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwdfile.ico\",0");
  1916     registry_hkcr.setValue("Hedgewars.Demo/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwdfile.ico\",0");
  1914     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1917     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1915     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" "+arguments);
  1918     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"%1\" "+arguments);
  1916     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" "+arguments);
  1919     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"%1\" "+arguments);
  1917 #elif defined __APPLE__
  1920 #elif defined __APPLE__
  1918     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1921     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1919     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hwd</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
  1922     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hwd</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
  1920     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hws</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
  1923     system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hws</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
  1921     system("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user");
  1924     system("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user");