- fixed: checking the hi-res option would not allow segment values over 16.

Tue, 30 Jul 2013 21:31:36 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 30 Jul 2013 21:31:36 +0300
changeset 408
81dc5f6b9c73
parent 407
c6530cdcd622
child 409
8da2563c645a

- fixed: checking the hi-res option would not allow segment values over 16.

changelog.txt file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/primitives.h file | annotate | diff | comparison | revisions
--- a/changelog.txt	Tue Jul 30 21:22:47 2013 +0300
+++ b/changelog.txt	Tue Jul 30 21:31:36 2013 +0300
@@ -6,6 +6,10 @@
 		- Added close, close all and save all actions.
 - Color icon border now reflects the color's edge color.
 - Changing to draw mode while in free camera now causes the camera to be changed to top.
+- Corrections to the primitive generator:
+	- Fixed: "Hi-Res" was not prepended to the names of 48/ primitives.
+	- Fixed: Checking the Hi-Res option would not allow segment values over 16.
+	- Added support for multiple spaces before the ring number.
 
 =================================================
 == Changes in version 0.2-alpha
--- a/src/primitives.cpp	Tue Jul 30 21:22:47 2013 +0300
+++ b/src/primitives.cpp	Tue Jul 30 21:31:36 2013 +0300
@@ -492,22 +492,20 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void generatePrimitive() {
-	QDialog* dlg = new QDialog (g_win);
-	Ui::MakePrimUI ui;
-	ui.setupUi (dlg);
+	PrimitivePrompt* dlg = new PrimitivePrompt( g_win );
 	
 	if (!dlg->exec())
 		return;
 	
-	int segs = ui.sb_segs->value();
-	int divs = ui.cb_hires->isChecked() ? hires : lores;
-	int num = ui.sb_ringnum->value();
+	int segs = dlg->ui->sb_segs->value();
+	int divs = dlg->ui->cb_hires->isChecked() ? hires : lores;
+	int num = dlg->ui->sb_ringnum->value();
 	PrimitiveType type =
-		ui.rb_circle->isChecked()   ? Circle :
-		ui.rb_cylinder->isChecked() ? Cylinder :
-		ui.rb_disc->isChecked()     ? Disc :
-		ui.rb_ndisc->isChecked()    ? DiscNeg :
-		ui.rb_ring->isChecked()     ? Ring : Cone;
+		dlg->ui->rb_circle->isChecked()   ? Circle :
+		dlg->ui->rb_cylinder->isChecked() ? Cylinder :
+		dlg->ui->rb_disc->isChecked()     ? Disc :
+		dlg->ui->rb_ndisc->isChecked()    ? DiscNeg :
+		dlg->ui->rb_ring->isChecked()     ? Ring : Cone;
 	
 	// Make the description
 	str frac = ftoa ( ( (float) segs) / divs);
@@ -546,4 +544,25 @@
 	
 	g_win->save (f, false);
 	delete f;
+}
+
+PrimitivePrompt::PrimitivePrompt (QWidget* parent, Qt::WindowFlags f) :
+	QDialog (parent, f)
+{
+	ui = new Ui_MakePrimUI;
+	ui->setupUi( this );
+	connect( ui->cb_hires, SIGNAL( toggled(bool) ), this, SLOT( hiResToggled( bool )));
+}
+
+PrimitivePrompt::~PrimitivePrompt() {
+	delete ui;
+}
+
+void PrimitivePrompt::hiResToggled( bool on ) {
+	ui->sb_segs->setMaximum( on ? hires : lores );
+	
+	// If the current value is 16 and we switch to hi-res, default the
+	// spinbox to 48.
+	if( on && ui->sb_segs->value() == lores )
+		ui->sb_segs->setValue( hires );
 }
\ No newline at end of file
--- a/src/primitives.h	Tue Jul 30 21:22:47 2013 +0300
+++ b/src/primitives.h	Tue Jul 30 21:31:36 2013 +0300
@@ -22,7 +22,9 @@
 #include "common.h"
 #include "types.h"
 #include <QRegExp>
+#include <QDialog>
 
+class Ui_MakePrimUI;
 class PrimitiveCategory;
 struct Primitive {
 	str name, title;
@@ -93,6 +95,18 @@
 };
 
 // =============================================================================
+class PrimitivePrompt : public QDialog {
+	Q_OBJECT
+	
+public:
+	explicit PrimitivePrompt( QWidget* parent = null, Qt::WindowFlags f = 0 );
+	virtual ~PrimitivePrompt();
+	Ui_MakePrimUI* ui;
+	
+public slots:
+	void hiResToggled( bool on );
+};
+
 void generatePrimitive();
 
 #endif // PRIMITIVES_H
\ No newline at end of file

mercurial