src/ldDocument.cc

changeset 888
7ad8fb667084
parent 883
69b8adc9a669
child 889
ba9e4bcc2fcc
equal deleted inserted replaced
887:98fe1587dc43 888:7ad8fb667084
33 #include "glCompiler.h" 33 #include "glCompiler.h"
34 #include "partDownloader.h" 34 #include "partDownloader.h"
35 35
36 CFGENTRY (String, LDrawPath, "") 36 CFGENTRY (String, LDrawPath, "")
37 CFGENTRY (List, RecentFiles, {}) 37 CFGENTRY (List, RecentFiles, {})
38 CFGENTRY (Bool, TryDownloadMissingFiles, false)
38 EXTERN_CFGENTRY (String, DownloadFilePath) 39 EXTERN_CFGENTRY (String, DownloadFilePath)
39 EXTERN_CFGENTRY (Bool, UseLogoStuds) 40 EXTERN_CFGENTRY (Bool, UseLogoStuds)
40 41
41 static bool g_loadingMainFile = false; 42 static bool g_loadingMainFile = false;
42 static const int g_maxRecentFiles = 10; 43 static const int g_maxRecentFiles = 10;
754 continue; 755 continue;
755 756
756 unknowns << obj.staticCast<LDError>()->fileReferenced(); 757 unknowns << obj.staticCast<LDError>()->fileReferenced();
757 } 758 }
758 759
759 if (not unknowns.isEmpty()) 760 if (cfg::TryDownloadMissingFiles and not unknowns.isEmpty())
760 { 761 {
761 PartDownloader dl; 762 PartDownloader dl;
762 dl.setSource (PartDownloader::PartsTracker); 763
763 dl.setPrimaryFile (file); 764 if (dl.checkValidPath())
764 765 {
765 for (QString const& unknown : unknowns) 766 dl.setSource (PartDownloader::PartsTracker);
766 dl.downloadFromPartsTracker (unknown); 767 dl.setPrimaryFile (file);
767 768
768 dl.exec(); 769 for (QString const& unknown : unknowns)
769 dl.checkIfFinished(); 770 dl.downloadFromPartsTracker (unknown);
770 file->reloadAllSubfiles(); 771
772 dl.exec();
773 dl.checkIfFinished();
774 file->reloadAllSubfiles();
775 }
771 } 776 }
772 } 777 }
773 778
774 // ============================================================================= 779 // =============================================================================
775 // 780 //

mercurial