- merged with default experimental

Tue, 09 Sep 2014 01:15:24 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 09 Sep 2014 01:15:24 +0300
branch
experimental
changeset 889
ba9e4bcc2fcc
parent 885
9c4fc9b433ae (current diff)
parent 888
7ad8fb667084 (diff)
child 890
903ec1e46298

- merged with default

src/glCompiler.cc file | annotate | diff | comparison | revisions
src/ldDocument.cc file | annotate | diff | comparison | revisions
--- 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]);
--- 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<LDError>()->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();
+		}
 	}
 }
 
--- 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);
--- 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 <QDir>
 #include <QProgressBar>
 #include <QPushButton>
+#include <QFileDialog>
+#include <QMessageBox>
 #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();
--- 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);
--- 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 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>644</width>
+    <width>648</width>
     <height>370</height>
    </rect>
   </property>
@@ -995,6 +995,13 @@
              </layout>
             </item>
             <item>
+             <widget class="QCheckBox" name="configTryDownloadMissingFiles">
+              <property name="text">
+               <string>Attempt to download missing parts from the PT</string>
+              </property>
+             </widget>
+            </item>
+            <item>
              <widget class="QCheckBox" name="configGuessDownloadPaths">
               <property name="whatsThis">
                <string>&lt;p&gt;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 &lt;tt&gt;&quot;&amp;lt;dir&amp;gt;/&amp;lt;file&amp;gt;.dat&quot;&lt;/tt&gt; - with this set, input can be automatically completed.&lt;/p&gt;
--- 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 @@
           <rect>
            <x>0</x>
            <y>0</y>
-           <width>233</width>
-           <height>399</height>
+           <width>237</width>
+           <height>414</height>
           </rect>
          </property>
          <attribute name="label">
@@ -75,8 +75,8 @@
           <rect>
            <x>0</x>
            <y>0</y>
-           <width>256</width>
-           <height>121</height>
+           <width>237</width>
+           <height>414</height>
           </rect>
          </property>
          <attribute name="label">
@@ -157,8 +157,8 @@
           <rect>
            <x>0</x>
            <y>0</y>
-           <width>101</width>
-           <height>101</height>
+           <width>237</width>
+           <height>414</height>
           </rect>
          </property>
          <attribute name="label">
@@ -194,7 +194,7 @@
      <x>0</x>
      <y>0</y>
      <width>1010</width>
-     <height>27</height>
+     <height>26</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -286,7 +286,11 @@
     <addaction name="actionSelectByType"/>
     <addaction name="separator"/>
     <addaction name="actionModeSelect"/>
+    <addaction name="actionModeMagicWand"/>
     <addaction name="actionModeDraw"/>
+    <addaction name="actionModeRectangle"/>
+    <addaction name="actionModeCircle"/>
+    <addaction name="actionModeLinePath"/>
     <addaction name="separator"/>
     <addaction name="actionSetDrawDepth"/>
     <addaction name="separator"/>
@@ -400,9 +404,9 @@
    <addaction name="menuHelp"/>
   </widget>
   <widget class="QStatusBar" name="statusbar"/>
-  <widget class="QToolBar" name="toolBar">
+  <widget class="QToolBar" name="toolBarFile">
    <property name="windowTitle">
-    <string>toolBar</string>
+    <string>File</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -416,9 +420,9 @@
    <addaction name="actionSave"/>
    <addaction name="actionSaveAs"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_2">
+  <widget class="QToolBar" name="toolBarNewObject">
    <property name="windowTitle">
-    <string>toolBar_2</string>
+    <string>New Object</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -435,9 +439,9 @@
    <addaction name="actionNewBFC"/>
    <addaction name="actionNewVertex"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_3">
+  <widget class="QToolBar" name="toolBarBasicTools">
    <property name="windowTitle">
-    <string>toolBar_3</string>
+    <string>Basic tools</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -452,9 +456,9 @@
    <addaction name="actionPaste"/>
    <addaction name="actionDelete"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_4">
+  <widget class="QToolBar" name="toolBarSelect">
    <property name="windowTitle">
-    <string>toolBar_4</string>
+    <string>Select</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -466,9 +470,9 @@
    <addaction name="actionSelectByColor"/>
    <addaction name="actionSelectByType"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_5">
+  <widget class="QToolBar" name="toolBarGrid">
    <property name="windowTitle">
-    <string>toolBar_5</string>
+    <string>Grid</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -480,9 +484,9 @@
    <addaction name="actionGridMedium"/>
    <addaction name="actionGridFine"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_6">
+  <widget class="QToolBar" name="toolBarDisplay">
    <property name="windowTitle">
-    <string>toolBar_6</string>
+    <string>Display options</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -496,9 +500,9 @@
    <addaction name="actionRandomColors"/>
    <addaction name="actionDrawAngles"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_7">
+  <widget class="QToolBar" name="toolBarEditTools">
    <property name="windowTitle">
-    <string>toolBar_7</string>
+    <string>Editing tools</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -520,9 +524,9 @@
    <addaction name="actionVisibilityToggle"/>
    <addaction name="actionVisibilityReveal"/>
   </widget>
-  <widget class="QToolBar" name="toolBar_8">
+  <widget class="QToolBar" name="toolBarEditModes">
    <property name="windowTitle">
-    <string>toolBar_8</string>
+    <string>Editing modes</string>
    </property>
    <attribute name="toolBarArea">
     <enum>LeftToolBarArea</enum>
@@ -531,15 +535,15 @@
     <bool>false</bool>
    </attribute>
    <addaction name="actionModeSelect"/>
+   <addaction name="actionModeMagicWand"/>
    <addaction name="actionModeDraw"/>
    <addaction name="actionModeRectangle"/>
    <addaction name="actionModeCircle"/>
-   <addaction name="actionModeMagicWand"/>
    <addaction name="actionModeLinePath"/>
   </widget>
-  <widget class="QToolBar" name="colorToolbar">
+  <widget class="QToolBar" name="toolBarColors">
    <property name="windowTitle">
-    <string>toolBar_9</string>
+    <string>Colors</string>
    </property>
    <attribute name="toolBarArea">
     <enum>RightToolBarArea</enum>
@@ -548,9 +552,9 @@
     <bool>false</bool>
    </attribute>
   </widget>
-  <widget class="QToolBar" name="toolBar_9">
+  <widget class="QToolBar" name="toolBarExternalPrograms">
    <property name="windowTitle">
-    <string>toolBar_9</string>
+    <string>External Programs</string>
    </property>
    <attribute name="toolBarArea">
     <enum>TopToolBarArea</enum>
@@ -986,7 +990,7 @@
     <string>Select Mode</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+1</string>
+    <string>S</string>
    </property>
   </action>
   <action name="actionModeDraw">
@@ -1001,7 +1005,7 @@
     <string>Draw Mode</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+2</string>
+    <string>D</string>
    </property>
   </action>
   <action name="actionSetDrawDepth">
@@ -1021,7 +1025,7 @@
     <string>Set the color on given objects.</string>
    </property>
    <property name="shortcut">
-    <string>C</string>
+    <string>Shift+C</string>
    </property>
   </action>
   <action name="actionAutocolor">
@@ -1200,6 +1204,9 @@
    <property name="statusTip">
     <string>Flip coordinates.</string>
    </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+F</string>
+   </property>
   </action>
   <action name="actionDemote">
    <property name="text">
@@ -1500,9 +1507,6 @@
    <property name="text">
     <string>Save All</string>
    </property>
-   <property name="shortcut">
-    <string>Ctrl+Shift+S</string>
-   </property>
   </action>
   <action name="actionClose">
    <property name="text">
@@ -1562,7 +1566,7 @@
     <string>Circle Mode</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+4</string>
+    <string>C</string>
    </property>
   </action>
   <action name="actionVisibilityHide">
@@ -1682,7 +1686,7 @@
     <string>Magic wand</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+5</string>
+    <string>W</string>
    </property>
   </action>
   <action name="actionModeRectangle">
@@ -1697,7 +1701,7 @@
     <string>Rectangle Mode</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+3</string>
+    <string>R</string>
    </property>
   </action>
   <action name="actionModeLinePath">
@@ -1712,7 +1716,7 @@
     <string>Line Path Mode</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+6</string>
+    <string>P</string>
    </property>
   </action>
  </widget>

mercurial