# HG changeset patch # User Santeri Piippo # Date 1372325394 -10800 # Node ID 401b9e3f2d10012e43bd9c45bdbdb825f2fe8c2e # Parent a808f95b653648da75ba1889a4a51ba5756912a1 Exported Rectifier interface to .ui file diff -r a808f95b6536 -r 401b9e3f2d10 src/extprogs.cpp --- 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* dsb_coplthres = new LabeledWidget ("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 }); diff -r a808f95b6536 -r 401b9e3f2d10 src/ui/rectifier.ui --- /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 @@ + + + RectifierUI + + + + 0 + 0 + 300 + 175 + + + + + 300 + 175 + + + + Rectifier + + + false + + + false + + + + + 10 + 140 + 281 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 0 + 0 + 301 + 131 + + + + + + + Condense triangles to quads + + + true + + + + + + + Substitute with rect primitives + + + true + + + + + + + Don't replace quads that have adj. cond. lines + + + + + + + Colorize result + + + + + + + + + Coplanarity threshold + + + + + + + 3 + + + 360.000000000000000 + + + 0.100000000000000 + + + + + + + + + + + + buttonBox + accepted() + RectifierUI + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + RectifierUI + reject() + + + 316 + 260 + + + 286 + 274 + + + + +