# HG changeset patch # User Santeri Piippo # Date 1375209096 -10800 # Node ID 81dc5f6b9c7371be8924c7c205d446869ca4f46f # Parent c6530cdcd622becaa0f7d07368d1a6cb654688cb - fixed: checking the hi-res option would not allow segment values over 16. diff -r c6530cdcd622 -r 81dc5f6b9c73 changelog.txt --- 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 diff -r c6530cdcd622 -r 81dc5f6b9c73 src/primitives.cpp --- 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 diff -r c6530cdcd622 -r 81dc5f6b9c73 src/primitives.h --- 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 +#include +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