QTfrontend/hwform.cpp
changeset 8766 ce153d705fff
parent 8722 2dead6b84bca
child 8792 af4ab297b2b7
child 8803 b3f37e7f9ff4
equal deleted inserted replaced
8763:988901d27abf 8766:ce153d705fff
  1926     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1926     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1927     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1927     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1928     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1928     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1929 
  1929 
  1930     // custom url scheme(s)
  1930     // custom url scheme(s)
  1931     registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Protocol\"");
  1931     registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Scheme\"");
  1932     registry_hkcr.setValue("hwplay/URL Protocol", "");
  1932     registry_hkcr.setValue("hwplay/URL Protocol", "");
  1933     registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0");
  1933     registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0");
  1934     registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\"  %1");
  1934     registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\"  %1");
  1935 #elif defined __APPLE__
  1935 #elif defined __APPLE__
  1936     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1936     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1945     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1945     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1946     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1946     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1947     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1947     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1948     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1948     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1949     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
  1949     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
       
  1950     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1950     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1951     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1951     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
  1952     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
       
  1953     if (success) success = system("xdg-mime default hedgewars.desktop x-scheme-handler/hwplay")==0;
  1952     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
  1954     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
  1953     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
  1955     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
  1954     // hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home.  This assumes no spaces in the data dir path
  1956     // hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home.  This assumes no spaces in the data dir path
  1955     if (success) success = system(("sed -i 's|^\\(Exec=.*\\) \\(%f\\)|\\1 \\2 "+arguments+"|' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
  1957     if (success) success = system(("sed -i 's|^\\(Exec=.*\\) \\(%f\\)|\\1 \\2 "+arguments+"|' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
  1956 #endif
  1958 #endif