# HG changeset patch # User Teemu Piippo # Date 1410214524 -10800 # Node ID ba9e4bcc2fccb2500a749a374eceb5d5d2e5750b # Parent 9c4fc9b433ae92fa5976d6b8ee4c94da4277288a# Parent 7ad8fb667084e454ff465445562c982c6e14142a - merged with default diff -r 9c4fc9b433ae -r ba9e4bcc2fcc src/glCompiler.cc --- a/src/glCompiler.cc Sun Sep 07 18:41:23 2014 +0300 +++ b/src/glCompiler.cc Tue Sep 09 01:15:24 2014 +0300 @@ -283,13 +283,16 @@ if (it.key() == null) { it = m_objectInfo.erase (it); + continue; } - elif (it.key().toStrongRef()->document() == CurrentDocument() + + if (it.key().toStrongRef()->document() == CurrentDocument() and not it.key().toStrongRef()->isHidden()) { vbodata += it->data[vbonum]; - ++it; } + + ++it; } glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); diff -r 9c4fc9b433ae -r ba9e4bcc2fcc src/ldDocument.cc --- a/src/ldDocument.cc Sun Sep 07 18:41:23 2014 +0300 +++ b/src/ldDocument.cc Tue Sep 09 01:15:24 2014 +0300 @@ -35,6 +35,7 @@ CFGENTRY (String, LDrawPath, "") CFGENTRY (List, RecentFiles, {}) +CFGENTRY (Bool, TryDownloadMissingFiles, false) EXTERN_CFGENTRY (String, DownloadFilePath) EXTERN_CFGENTRY (Bool, UseLogoStuds) @@ -762,18 +763,22 @@ unknowns << obj.staticCast()->fileReferenced(); } - if (not unknowns.isEmpty()) + if (cfg::TryDownloadMissingFiles and not unknowns.isEmpty()) { PartDownloader dl; - dl.setSource (PartDownloader::PartsTracker); - dl.setPrimaryFile (file); + + if (dl.checkValidPath()) + { + dl.setSource (PartDownloader::PartsTracker); + dl.setPrimaryFile (file); - for (QString const& unknown : unknowns) - dl.downloadFromPartsTracker (unknown); + for (QString const& unknown : unknowns) + dl.downloadFromPartsTracker (unknown); - dl.exec(); - dl.checkIfFinished(); - file->reloadAllSubfiles(); + dl.exec(); + dl.checkIfFinished(); + file->reloadAllSubfiles(); + } } } diff -r 9c4fc9b433ae -r ba9e4bcc2fcc src/mainWindow.cc --- a/src/mainWindow.cc Sun Sep 07 18:41:23 2014 +0300 +++ b/src/mainWindow.cc Tue Sep 09 01:15:24 2014 +0300 @@ -215,14 +215,16 @@ void MainWindow::updateColorToolbar() { m_colorButtons.clear(); - ui->colorToolbar->clear(); - ui->colorToolbar->addAction (ui->actionUncolor); - ui->colorToolbar->addSeparator(); + ui->toolBarColors->clear(); + ui->toolBarColors->addAction (ui->actionUncolor); + ui->toolBarColors->addSeparator(); for (LDQuickColor& entry : m_quickColors) { if (entry.isSeparator()) - ui->colorToolbar->addSeparator(); + { + ui->toolBarColors->addSeparator(); + } else { QToolButton* colorButton = new QToolButton; @@ -231,7 +233,7 @@ colorButton->setToolTip (entry.color().name()); connect (colorButton, SIGNAL (clicked()), this, SLOT (slot_quickColor())); - ui->colorToolbar->addWidget (colorButton); + ui->toolBarColors->addWidget (colorButton); m_colorButtons << colorButton; entry.setToolButton (colorButton); diff -r 9c4fc9b433ae -r ba9e4bcc2fcc src/partDownloader.cc --- a/src/partDownloader.cc Sun Sep 07 18:41:23 2014 +0300 +++ b/src/partDownloader.cc Tue Sep 09 01:15:24 2014 +0300 @@ -22,13 +22,14 @@ #include #include #include +#include +#include #include "partDownloader.h" #include "ui_downloadfrom.h" #include "basics.h" #include "mainWindow.h" #include "ldDocument.h" #include "glRenderer.h" -#include "configDialog.h" CFGENTRY (String, DownloadFilePath, "") CFGENTRY (Bool, GuessDownloadPaths, true) @@ -40,19 +41,12 @@ // void PartDownloader::staticBegin() { - QString path = getDownloadPath(); - - if (path.isEmpty() or not QDir (path).exists()) - { - Critical (PartDownloader::tr ("You need to specify a valid path for " - "downloaded files in the configuration to download paths.")); + PartDownloader dlg; - (new ConfigDialog (ConfigDialog::DownloadTab, null))->exec(); + if (not dlg.checkValidPath()) return; - } - PartDownloader* dlg = new PartDownloader; - dlg->exec(); + dlg.exec(); } // ============================================================================= @@ -102,6 +96,26 @@ // ============================================================================= // +bool PartDownloader::checkValidPath() +{ + QString path = getDownloadPath(); + + if (path.isEmpty() or not QDir (path).exists()) + { + QMessageBox::information(this, "Notice", "Please input a path for files to download."); + path = QFileDialog::getExistingDirectory (this, "Path for downloaded files:"); + + if (path.isEmpty()) + return false; + + cfg::DownloadFilePath = path; + } + + return true; +} + +// ============================================================================= +// QString PartDownloader::getURL() { const Source src = getSource(); diff -r 9c4fc9b433ae -r ba9e4bcc2fcc src/partDownloader.h --- a/src/partDownloader.h Sun Sep 07 18:41:23 2014 +0300 +++ b/src/partDownloader.h Tue Sep 09 01:15:24 2014 +0300 @@ -70,6 +70,7 @@ virtual ~PartDownloader(); void addFile (LDDocumentPtr f); + bool checkValidPath(); void downloadFile (QString dest, QString url, bool primary); void downloadFromPartsTracker (QString file); QPushButton* getButton (Button i); diff -r 9c4fc9b433ae -r ba9e4bcc2fcc ui/config.ui --- a/ui/config.ui Sun Sep 07 18:41:23 2014 +0300 +++ b/ui/config.ui Tue Sep 09 01:15:24 2014 +0300 @@ -6,7 +6,7 @@ 0 0 - 644 + 648 370 @@ -995,6 +995,13 @@ + + + Attempt to download missing parts from the PT + + + + <p>When this is set, LDForge tries to adjust and correct part paths based on the input. A full path given to the download prompt should be of form <tt>"&lt;dir&gt;/&lt;file&gt;.dat"</tt> - with this set, input can be automatically completed.</p> diff -r 9c4fc9b433ae -r ba9e4bcc2fcc ui/ldforge.ui --- a/ui/ldforge.ui Sun Sep 07 18:41:23 2014 +0300 +++ b/ui/ldforge.ui Tue Sep 09 01:15:24 2014 +0300 @@ -47,8 +47,8 @@ 0 0 - 233 - 399 + 237 + 414 @@ -75,8 +75,8 @@ 0 0 - 256 - 121 + 237 + 414 @@ -157,8 +157,8 @@ 0 0 - 101 - 101 + 237 + 414 @@ -194,7 +194,7 @@ 0 0 1010 - 27 + 26 @@ -286,7 +286,11 @@ + + + + @@ -400,9 +404,9 @@ - + - toolBar + File TopToolBarArea @@ -416,9 +420,9 @@ - + - toolBar_2 + New Object TopToolBarArea @@ -435,9 +439,9 @@ - + - toolBar_3 + Basic tools TopToolBarArea @@ -452,9 +456,9 @@ - + - toolBar_4 + Select TopToolBarArea @@ -466,9 +470,9 @@ - + - toolBar_5 + Grid TopToolBarArea @@ -480,9 +484,9 @@ - + - toolBar_6 + Display options TopToolBarArea @@ -496,9 +500,9 @@ - + - toolBar_7 + Editing tools TopToolBarArea @@ -520,9 +524,9 @@ - + - toolBar_8 + Editing modes LeftToolBarArea @@ -531,15 +535,15 @@ false + - - + - toolBar_9 + Colors RightToolBarArea @@ -548,9 +552,9 @@ false - + - toolBar_9 + External Programs TopToolBarArea @@ -986,7 +990,7 @@ Select Mode - Ctrl+1 + S @@ -1001,7 +1005,7 @@ Draw Mode - Ctrl+2 + D @@ -1021,7 +1025,7 @@ Set the color on given objects. - C + Shift+C @@ -1200,6 +1204,9 @@ Flip coordinates. + + Ctrl+Shift+F + @@ -1500,9 +1507,6 @@ Save All - - Ctrl+Shift+S - @@ -1562,7 +1566,7 @@ Circle Mode - Ctrl+4 + C @@ -1682,7 +1686,7 @@ Magic wand - Ctrl+5 + W @@ -1697,7 +1701,7 @@ Rectangle Mode - Ctrl+3 + R @@ -1712,7 +1716,7 @@ Line Path Mode - Ctrl+6 + P