mirror of https://github.com/vitalif/openscad
Add on-launch code to set Document Icon in windows registry
Since OpenSCAD doesn't distribute with additional image files, this means a new icon needs to be built into the .exe. This is accomplished by adding a line to the end of openscad_win32.rc file consisting of something like the following: IDI_ICON2 ICON DISCARDABLE "icons/openscad_doc.ico" which will get built into the exe as icon index 1 (icon index 0 is the current app icon.) In the cmdline and gui functions in openscad.cc I added code to set the HKEY_CURRENT_USER/Software/Classes/OpenSCAD_File/DefaultIcon/Default value to the icon index 1 of openscad.exe modified: openscad_win32.rc modified: src/openscad.ccmaster
parent
9f6b7b170d
commit
ce5b38d96e
|
@ -33,5 +33,6 @@ VS_VERSION_INFO VERSIONINFO
|
||||||
/* End of Version info */
|
/* End of Version info */
|
||||||
|
|
||||||
IDI_ICON1 ICON DISCARDABLE "icons/openscad.ico"
|
IDI_ICON1 ICON DISCARDABLE "icons/openscad.ico"
|
||||||
|
IDI_ICON2 ICON DISCARDABLE "icons/openscad_doc.ico"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#include "CocoaUtils.h"
|
#include "CocoaUtils.h"
|
||||||
#include "FontCache.h"
|
#include "FontCache.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -318,6 +320,12 @@ int cmdline(const char *deps_output_file, const std::string &filename, Camera &c
|
||||||
parser_init();
|
parser_init();
|
||||||
localization_init();
|
localization_init();
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QSettings reg_setting(QLatin1String("HKEY_CURRENT_USER"), QSettings::NativeFormat);
|
||||||
|
QString appPath = QDir::toNativeSeparators(app.applicationFilePath() + QLatin1String(",1"));
|
||||||
|
reg_setting.setValue(QLatin1String("Software/Classes/OpenSCAD_File/DefaultIcon/Default"),QVariant(appPath));
|
||||||
|
#endif
|
||||||
|
|
||||||
Tree tree;
|
Tree tree;
|
||||||
#ifdef ENABLE_CGAL
|
#ifdef ENABLE_CGAL
|
||||||
GeometryEvaluator geomevaluator(tree);
|
GeometryEvaluator geomevaluator(tree);
|
||||||
|
@ -664,6 +672,12 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
|
||||||
installAppleEventHandlers();
|
installAppleEventHandlers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QSettings reg_setting(QLatin1String("HKEY_CURRENT_USER"), QSettings::NativeFormat);
|
||||||
|
QString appPath = QDir::toNativeSeparators(app.applicationFilePath() + QLatin1String(",1"));
|
||||||
|
reg_setting.setValue(QLatin1String("Software/Classes/OpenSCAD_File/DefaultIcon/Default"),QVariant(appPath));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef OPENSCAD_UPDATER
|
#ifdef OPENSCAD_UPDATER
|
||||||
AutoUpdater *updater = new SparkleAutoUpdater;
|
AutoUpdater *updater = new SparkleAutoUpdater;
|
||||||
AutoUpdater::setUpdater(updater);
|
AutoUpdater::setUpdater(updater);
|
||||||
|
@ -901,4 +915,3 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue