Converted Ytruder interface to Designer UI

Sat, 06 Jul 2013 03:24:39 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jul 2013 03:24:39 +0300
changeset 345
1376ad3262ba
parent 344
55fcf67230fd
child 346
ba2db5e22f8b

Converted Ytruder interface to Designer UI

.gitignore file | annotate | diff | comparison | revisions
src/extprogs.cpp file | annotate | diff | comparison | revisions
src/ui/ytruder.ui file | annotate | diff | comparison | revisions
--- a/.gitignore	Sat Jul 06 03:06:00 2013 +0300
+++ b/.gitignore	Sat Jul 06 03:24:39 2013 +0300
@@ -3,4 +3,5 @@
 src/ui_*.h
 Makefile
 ldforge
-*.dat
\ No newline at end of file
+*.dat
+debug_lastOutput
\ No newline at end of file
--- a/src/extprogs.cpp	Sat Jul 06 03:06:00 2013 +0300
+++ b/src/extprogs.cpp	Sat Jul 06 03:24:39 2013 +0300
@@ -35,6 +35,7 @@
 #include "history.h"
 #include "labeledwidget.h"
 
+#include "ui_ytruder.h"
 #include "ui_intersector.h"
 #include "ui_rectifier.h"
 #include "ui_coverer.h"
@@ -284,36 +285,25 @@
 	if (!checkProgPath (prog_ytruder, Ytruder))
 		return;
 	
-	QDialog dlg;
-	
-	RadioBox* rb_mode = new RadioBox ("Extrusion mode", {"Distance", "Symmetry", "Projection", "Radial"}, 0, Qt::Horizontal);
-	RadioBox* rb_axis = new RadioBox ("Axis", {"X", "Y", "Z"}, 0, Qt::Horizontal);
-	LabeledWidget<QDoubleSpinBox>* dsb_depth = new LabeledWidget<QDoubleSpinBox> ("Plane depth"),
-		*dsb_condAngle = new LabeledWidget<QDoubleSpinBox> ("Conditional line threshold");
+	QDialog* dlg = new QDialog;
+	Ui::YtruderUI ui;
+	ui.setupUi( dlg );
 	
-	rb_axis->setValue (Y);
-	dsb_depth->w ()->setMinimum (-10000.0);
-	dsb_depth->w ()->setMaximum (10000.0);
-	dsb_depth->w ()->setDecimals (3);
-	dsb_condAngle->w ()->setValue (30.0f);
-	
-	QVBoxLayout* layout = new QVBoxLayout (&dlg);
-	layout->addWidget (rb_mode);
-	layout->addWidget (rb_axis);
-	layout->addWidget (dsb_depth);
-	layout->addWidget (dsb_condAngle);
-	layout->addWidget (makeButtonBox (dlg));
-	
-	dlg.setWindowIcon (getIcon ("extrude"));
-	
-	if (!dlg.exec ())
+	if (!dlg->exec ())
 		return;
 	
 	// Read the user's choices
-	const enum modetype { Distance, Symmetry, Projection, Radial } mode = (modetype) rb_mode->value ();
-	const Axis axis = (Axis) rb_axis->value ();
-	const double depth = dsb_depth->w ()->value (),
-		condAngle = dsb_condAngle->w ()->value ();
+	const enum { Distance, Symmetry, Projection, Radial } mode =
+		ui.mode_distance->isChecked()   ? Distance :
+		ui.mode_symmetry->isChecked()   ? Symmetry :
+		ui.mode_projection->isChecked() ? Projection : Radial;
+	
+	const Axis axis =
+		ui.axis_x->isChecked() ? X :
+		ui.axis_y->isChecked() ? Y : Z;
+	
+	const double depth = ui.planeDepth->value(),
+		condAngle = ui.condAngle->value();
 	
 	QTemporaryFile indat, outdat;
 	str inDATName, outDATName;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ui/ytruder.ui	Sat Jul 06 03:24:39 2013 +0300
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>YtruderUI</class>
+ <widget class="QDialog" name="YtruderUI">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>340</width>
+    <height>170</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Ytruder</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QGroupBox" name="groupBox">
+       <property name="title">
+        <string>Extrusion Mode</string>
+       </property>
+       <layout class="QVBoxLayout" name="verticalLayout_2">
+        <item>
+         <widget class="QRadioButton" name="mode_distance">
+          <property name="text">
+           <string>Distance</string>
+          </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="mode_symmetry">
+          <property name="text">
+           <string>Symmetry</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="mode_projection">
+          <property name="text">
+           <string>Projection</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="mode_radial">
+          <property name="text">
+           <string>Radial</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <widget class="QGroupBox" name="groupBox_2">
+         <property name="title">
+          <string>Axis</string>
+         </property>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <item>
+           <widget class="QRadioButton" name="axis_x">
+            <property name="text">
+             <string>X</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="axis_y">
+            <property name="text">
+             <string>Y</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="axis_z">
+            <property name="text">
+             <string>Z</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <layout class="QFormLayout" name="formLayout_2">
+         <item row="0" column="0">
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Plane depth:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Line threshold angle:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QDoubleSpinBox" name="planeDepth">
+           <property name="minimumSize">
+            <size>
+             <width>85</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="decimals">
+            <number>3</number>
+           </property>
+           <property name="maximum">
+            <double>10000.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QDoubleSpinBox" name="condAngle">
+           <property name="minimumSize">
+            <size>
+             <width>85</width>
+             <height>0</height>
+            </size>
+           </property>
+           <property name="suffix">
+            <string>°</string>
+           </property>
+           <property name="decimals">
+            <number>3</number>
+           </property>
+           <property name="maximum">
+            <double>360.000000000000000</double>
+           </property>
+           <property name="value">
+            <double>30.000000000000000</double>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>YtruderUI</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>YtruderUI</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