30 #include "editHistory.h" |
30 #include "editHistory.h" |
31 #include "dialogs.h" |
31 #include "dialogs.h" |
32 #include "glRenderer.h" |
32 #include "glRenderer.h" |
33 #include "glCompiler.h" |
33 #include "glCompiler.h" |
34 |
34 |
35 CFGENTRY (String, ldrawPath, "") |
35 CFGENTRY (String, LDrawPath, "") |
36 CFGENTRY (List, recentFiles, {}) |
36 CFGENTRY (List, RecentFiles, {}) |
37 EXTERN_CFGENTRY (String, downloadFilePath) |
37 EXTERN_CFGENTRY (String, DownloadFilePath) |
38 EXTERN_CFGENTRY (Bool, useLogoStuds) |
38 EXTERN_CFGENTRY (Bool, UseLogoStuds) |
39 |
39 |
40 static bool g_loadingMainFile = false; |
40 static bool g_loadingMainFile = false; |
41 static const int g_maxRecentFiles = 10; |
41 static const int g_maxRecentFiles = 10; |
42 static bool g_aborted = false; |
42 static bool g_aborted = false; |
43 static LDDocumentPtr g_logoedStud; |
43 static LDDocumentPtr g_logoedStud; |
60 QString partsPath, primsPath; |
60 QString partsPath, primsPath; |
61 } pathInfo; |
61 } pathInfo; |
62 |
62 |
63 void initPaths() |
63 void initPaths() |
64 { |
64 { |
65 if (not tryConfigure (cfg::ldrawPath)) |
65 if (not tryConfigure (cfg::LDrawPath)) |
66 { |
66 { |
67 LDrawPathDialog dlg (false); |
67 LDrawPathDialog dlg (false); |
68 |
68 |
69 if (not dlg.exec()) |
69 if (not dlg.exec()) |
70 exit (0); |
70 exit (0); |
71 |
71 |
72 cfg::ldrawPath = dlg.filename(); |
72 cfg::LDrawPath = dlg.filename(); |
73 } |
73 } |
74 } |
74 } |
75 |
75 |
76 bool tryConfigure (QString path) |
76 bool tryConfigure (QString path) |
77 { |
77 { |
309 |
309 |
310 if (QFile::exists (relpath)) |
310 if (QFile::exists (relpath)) |
311 return relpath; |
311 return relpath; |
312 |
312 |
313 // Try with just the LDraw path first |
313 // Try with just the LDraw path first |
314 fullPath = format ("%1" DIRSLASH "%2", cfg::ldrawPath, relpath); |
314 fullPath = format ("%1" DIRSLASH "%2", cfg::LDrawPath, relpath); |
315 |
315 |
316 if (QFile::exists (fullPath)) |
316 if (QFile::exists (fullPath)) |
317 return fullPath; |
317 return fullPath; |
318 |
318 |
319 if (subdirs) |
319 if (subdirs) |
320 { |
320 { |
321 // Look in sub-directories: parts and p. Also look in net_downloadpath, since that's |
321 // Look in sub-directories: parts and p. Also look in net_downloadpath, since that's |
322 // where we download parts from the PT to. |
322 // where we download parts from the PT to. |
323 for (const QString& topdir : QList<QString> ({ cfg::ldrawPath, cfg::downloadFilePath })) |
323 for (const QString& topdir : QList<QString> ({ cfg::LDrawPath, cfg::DownloadFilePath })) |
324 { |
324 { |
325 for (const QString& subdir : QList<QString> ({ "parts", "p" })) |
325 for (const QString& subdir : QList<QString> ({ "parts", "p" })) |
326 { |
326 { |
327 fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath); |
327 fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath); |
328 |
328 |
654 |
654 |
655 // ============================================================================= |
655 // ============================================================================= |
656 // |
656 // |
657 void addRecentFile (QString path) |
657 void addRecentFile (QString path) |
658 { |
658 { |
659 auto& rfiles = cfg::recentFiles; |
659 auto& rfiles = cfg::RecentFiles; |
660 int idx = rfiles.indexOf (path); |
660 int idx = rfiles.indexOf (path); |
661 |
661 |
662 // If this file already is in the list, pop it out. |
662 // If this file already is in the list, pop it out. |
663 if (idx != -1) |
663 if (idx != -1) |
664 { |
664 { |
1320 LDObjectList LDDocument::inlineContents (bool deep, bool renderinline) |
1320 LDObjectList LDDocument::inlineContents (bool deep, bool renderinline) |
1321 { |
1321 { |
1322 // Possibly substitute with logoed studs: |
1322 // Possibly substitute with logoed studs: |
1323 // stud.dat -> stud-logo.dat |
1323 // stud.dat -> stud-logo.dat |
1324 // stud2.dat -> stud-logo2.dat |
1324 // stud2.dat -> stud-logo2.dat |
1325 if (cfg::useLogoStuds and renderinline) |
1325 if (cfg::UseLogoStuds and renderinline) |
1326 { |
1326 { |
1327 // Ensure logoed studs are loaded first |
1327 // Ensure logoed studs are loaded first |
1328 loadLogoedStuds(); |
1328 loadLogoedStuds(); |
1329 |
1329 |
1330 if (name() == "stud.dat" and g_logoedStud != null) |
1330 if (name() == "stud.dat" and g_logoedStud != null) |