I try to find the path from GPL Ghostscript ..
I find the path ... and is installed 8.60.
Now how i can make QSettings read only...
to not make 39 new Regedit empty path?


Qt Code:
  1. /* find gpl GhostScript path or exe */
  2. QString PS_utils::getGSDefaultExeName()
  3. {
  4. QString gsName;
  5. #if defined Q_WS_WIN
  6. QFileInfo Pinfo;
  7. // Try to locate GhostScript thanks to the qsetting
  8. gsName = "gswin32c.exe";
  9. for(int i=0;i<99;i++) {
  10. /* loop all avaiable version on 8+ */
  11. QSettings gs_sett("HKEY_LOCAL_MACHINE\\Software\\GPL Ghostscript\\8."+QString("%1").arg(100 - i),QSettings::NativeFormat);
  12. if (gs_sett.allKeys().size() > 2) {
  13. if (gs_sett.value("GS_DLL").toString().size() > 4) {
  14. Pinfo.setFile(gs_sett.value("GS_DLL").toString());
  15. return gsName.prepend(Pinfo.absolutePath()+"/");
  16. }
  17. }
  18. }
  19. for(int e=0;e<99;e++) {
  20. /* loop all avaiable version on 7+ */
  21. QSettings gs_sett7("HKEY_LOCAL_MACHINE\\Software\\GPL Ghostscript\\7."+QString("%1").arg(100 - e),QSettings::NativeFormat);
  22. if (gs_sett7.allKeys().size() > 2) {
  23. if (gs_sett7.value("GS_DLL").toString().size() > 4) {
  24. Pinfo.setFile(gs_sett7.value("GS_DLL").toString());
  25. return gsName.prepend(Pinfo.absolutePath()+"/");
  26. }
  27. }
  28. }
  29. /* win not having GPL Ghostscript ! */
  30. gsName = "gs";
  31. #else
  32. gsName = "gs";
  33. #endif
  34. return gsName;
  35. }
To copy to clipboard, switch view to plain text mode