29 #include "basics.h" |
29 #include "basics.h" |
30 #include "mainwindow.h" |
30 #include "mainwindow.h" |
31 #include "ldDocument.h" |
31 #include "ldDocument.h" |
32 #include "glRenderer.h" |
32 #include "glRenderer.h" |
33 |
33 |
34 CFGENTRY (String, DownloadFilePath, "") |
34 ConfigOption (QString DownloadFilePath) |
35 CFGENTRY (Bool, GuessDownloadPaths, true) |
35 ConfigOption (bool GuessDownloadPaths = true) |
36 CFGENTRY (Bool, AutoCloseDownloadDialog, true) |
36 ConfigOption (bool AutoCloseDownloadDialog = true) |
37 |
37 |
38 const QString g_unofficialLibraryURL ("http://ldraw.org/library/unofficial/"); |
38 const char* g_unofficialLibraryURL = "http://ldraw.org/library/unofficial/"; |
39 |
39 |
40 // ============================================================================= |
40 // ============================================================================= |
41 // |
41 // |
42 void PartDownloader::staticBegin() |
42 void PartDownloader::staticBegin() |
43 { |
43 { |
44 PartDownloader dlg; |
44 PartDownloader dlg (g_win); |
45 |
45 |
46 if (not dlg.checkValidPath()) |
46 if (not dlg.checkValidPath()) |
47 return; |
47 return; |
48 |
48 |
49 dlg.exec(); |
49 dlg.exec(); |
51 |
51 |
52 // ============================================================================= |
52 // ============================================================================= |
53 // |
53 // |
54 QString PartDownloader::getDownloadPath() |
54 QString PartDownloader::getDownloadPath() |
55 { |
55 { |
56 QString path = cfg::DownloadFilePath; |
56 QString path = m_config->downloadFilePath; |
57 |
57 |
58 if (DIRSLASH[0] != '/') |
58 if (DIRSLASH[0] != '/') |
59 path.replace (DIRSLASH, "/"); |
59 path.replace (DIRSLASH, "/"); |
60 |
60 |
61 return path; |
61 return path; |
63 |
63 |
64 // ============================================================================= |
64 // ============================================================================= |
65 // |
65 // |
66 PartDownloader::PartDownloader (QWidget* parent) : |
66 PartDownloader::PartDownloader (QWidget* parent) : |
67 QDialog (parent), |
67 QDialog (parent), |
|
68 HierarchyElement (parent), |
68 m_source (Source (0)) |
69 m_source (Source (0)) |
69 { |
70 { |
70 setForm (new Ui_DownloadFrom); |
71 setForm (new Ui_DownloadFrom); |
71 form()->setupUi (this); |
72 form()->setupUi (this); |
72 form()->fname->setFocus(); |
73 form()->fname->setFocus(); |
142 void PartDownloader::modifyDestination (QString& dest) const |
143 void PartDownloader::modifyDestination (QString& dest) const |
143 { |
144 { |
144 dest = dest.simplified(); |
145 dest = dest.simplified(); |
145 |
146 |
146 // If the user doesn't want us to guess, stop right here. |
147 // If the user doesn't want us to guess, stop right here. |
147 if (not cfg::GuessDownloadPaths) |
148 if (not m_config->guessDownloadPaths) |
148 return; |
149 return; |
149 |
150 |
150 // Ensure .dat extension |
151 // Ensure .dat extension |
151 if (dest.right (4) != ".dat") |
152 if (dest.right (4) != ".dat") |
152 { |
153 { |