Exported Rectifier interface to .ui file

Thu, 27 Jun 2013 12:29:54 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 27 Jun 2013 12:29:54 +0300
changeset 305
401b9e3f2d10
parent 304
a808f95b6536
child 306
fef00a6cbff0

Exported Rectifier interface to .ui file

src/extprogs.cpp file | annotate | diff | comparison | revisions
src/ui/rectifier.ui file | annotate | diff | comparison | revisions
--- a/src/extprogs.cpp	Thu Jun 27 12:13:15 2013 +0300
+++ b/src/extprogs.cpp	Thu Jun 27 12:29:54 2013 +0300
@@ -36,6 +36,7 @@
 #include "labeledwidget.h"
 
 #include "ui_intersector.h"
+#include "ui_rectifier.h"
 #include "ui_coverer.h"
 #include "ui_isecalc.h"
 #include "ui_edger2.h"
@@ -89,7 +90,7 @@
 }
 
 // =============================================================================
-static str processErrorString (const extprog prog, QProcess& proc) {
+static str processErrorString (QProcess& proc) {
 	switch (proc.error()) {
 	case QProcess::FailedToStart:
 		return "Failed to start (check your permissions)";
@@ -228,7 +229,7 @@
 	str err = "";
 	
 	if ( proc.exitStatus() != QProcess::NormalExit )
-		err = processErrorString (prog, proc);
+		err = processErrorString (proc);
 	
 	// Check the return code
 	if (proc.exitCode() != 0)
@@ -356,37 +357,13 @@
 	if (!checkProgPath (prog_rectifier, Rectifier))
 		return;
 	
-	QDialog dlg;
-	QCheckBox* cb_condense = new QCheckBox ("Condense triangles to quads"),
-		*cb_subst = new QCheckBox ("Substitute rect primitives"),
-		*cb_condlineCheck = new QCheckBox ("Don't replace quads with adj. condlines"),
-		*cb_colorize = new QCheckBox ("Colorize resulting objects");
-	LabeledWidget<QDoubleSpinBox>* dsb_coplthres = new LabeledWidget<QDoubleSpinBox> ("Coplanarity threshold");
-	
-	dsb_coplthres->w ()->setMinimum (0.0f);
-	dsb_coplthres->w ()->setMaximum (360.0f);
-	dsb_coplthres->w ()->setDecimals (3);
-	dsb_coplthres->w ()->setValue (0.95f);
-	cb_condense->setChecked (true);
-	cb_subst->setChecked (true);
+	QDialog* dlg = new QDialog;
+	Ui::RectifierUI ui;
+	ui.setupUi (dlg);
 	
-	QVBoxLayout* layout = new QVBoxLayout (&dlg);
-	layout->addWidget (cb_condense);
-	layout->addWidget (cb_subst);
-	layout->addWidget (cb_condlineCheck);
-	layout->addWidget (cb_colorize);
-	layout->addWidget (dsb_coplthres);
-	layout->addWidget (makeButtonBox (dlg));
-	
-	if (!dlg.exec ())
+	if (!dlg->exec ())
 		return;
 	
-	const bool condense = cb_condense->isChecked (),
-		subst = cb_subst->isChecked (),
-		condlineCheck = cb_condlineCheck->isChecked (),
-		colorize = cb_colorize->isChecked ();
-	const double coplthres = dsb_coplthres->w ()->value ();
-	
 	QTemporaryFile indat, outdat;
 	str inDATName, outDATName;
 	
@@ -396,12 +373,12 @@
 	
 	// Compose arguments
 	str argv = join ({
-		(condense == false) ? "-q" : "",
-		(subst == false) ? "-r" : "",
-		(condlineCheck) ? "-a" : "",
-		(colorize) ? "-c" : "",
+		(!ui.cb_condense->isChecked ()) ? "-q" : "",
+		(!ui.cb_subst->isChecked ()) ? "-r" : "",
+		(ui.cb_condlineCheck->isChecked ()) ? "-a" : "",
+		(ui.cb_colorize->isChecked ()) ? "-c" : "",
 		"-t",
-		coplthres,
+		ui.dsb_coplthres->value (),
 		inDATName,
 		outDATName
 	});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ui/rectifier.ui	Thu Jun 27 12:29:54 2013 +0300
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RectifierUI</class>
+ <widget class="QDialog" name="RectifierUI">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>300</width>
+    <height>175</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>300</width>
+    <height>175</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Rectifier</string>
+  </property>
+  <property name="sizeGripEnabled">
+   <bool>false</bool>
+  </property>
+  <property name="modal">
+   <bool>false</bool>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>140</y>
+     <width>281</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>301</width>
+     <height>131</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
+    <item>
+     <widget class="QCheckBox" name="cb_condense">
+      <property name="text">
+       <string>Condense triangles to quads</string>
+      </property>
+      <property name="checked">
+       <bool>true</bool>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QCheckBox" name="cb_subst">
+      <property name="text">
+       <string>Substitute with rect primitives</string>
+      </property>
+      <property name="checked">
+       <bool>true</bool>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QCheckBox" name="cb_condlineCheck">
+      <property name="text">
+       <string>Don't replace quads that have adj. cond. lines</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QCheckBox" name="cb_colorize">
+      <property name="text">
+       <string>Colorize result</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Coplanarity threshold</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QDoubleSpinBox" name="dsb_coplthres">
+        <property name="decimals">
+         <number>3</number>
+        </property>
+        <property name="maximum">
+         <double>360.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>0.100000000000000</double>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>RectifierUI</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>RectifierUI</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

mercurial