# HG changeset patch # User Santeri Piippo # Date 1372291200 -10800 # Node ID 08bd2c185b25ddfb99058144f34446a5117d7a89 # Parent ef51681bb978e13baf6b37128b2c771a98d1f67d Converted Isecalc front-end dialog to Designer UI diff -r ef51681bb978 -r 08bd2c185b25 src/extprogs.cpp --- a/src/extprogs.cpp Thu Jun 27 02:46:12 2013 +0300 +++ b/src/extprogs.cpp Thu Jun 27 03:00:00 2013 +0300 @@ -34,6 +34,8 @@ #include "widgets.h" #include "history.h" #include "labeledwidget.h" + +#include "ui_isecalc.h" #include "ui_edger2.h" // ============================================================================= @@ -586,26 +588,30 @@ if (!checkProgPath (prog_isecalc, Isecalc)) return; - QDialog dlg; - - LabeledWidget* cmb_col1 = buildColorSelector ("Shape 1"), - *cmb_col2 = buildColorSelector ("Shape 2"); + Ui::IsecalcUI ui; + QDialog* dlg = new QDialog; + ui.setupUi( dlg ); - QVBoxLayout* layout = new QVBoxLayout (&dlg); - layout->addWidget (cmb_col1); - layout->addWidget (cmb_col2); - layout->addWidget (makeButtonBox (dlg)); + makeColorSelector( ui.cmb_col1 ); + makeColorSelector( ui.cmb_col2 ); + + short in1Col, in2Col; -exec: - if (!dlg.exec ()) - return; - - const short in1Col = cmb_col1->w ()->itemData (cmb_col1->w ()->currentIndex ()).toInt (), - in2Col = cmb_col1->w ()->itemData (cmb_col2->w ()->currentIndex ()).toInt (); - - if (in1Col == in2Col) { - critical ("Cannot use the same color group for both input and cutter!"); - goto exec; + // Run the dialog and validate input + for( ;; ) + { + if (!dlg->exec ()) + return; + + in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex ()).toInt (), + in2Col = ui.cmb_col1->itemData (ui.cmb_col2->currentIndex ()).toInt (); + + if (in1Col == in2Col) { + critical ("Cannot use the same color group for both input and cutter!"); + continue; + } + + break; } QTemporaryFile in1dat, in2dat, outdat; diff -r ef51681bb978 -r 08bd2c185b25 src/ui/isecalc.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ui/isecalc.ui Thu Jun 27 03:00:00 2013 +0300 @@ -0,0 +1,112 @@ + + + IsecalcUI + + + + 0 + 0 + 240 + 120 + + + + + 240 + 120 + + + + + 10000 + 120 + + + + Isecalc + + + + + 30 + 80 + 201 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 221 + 61 + + + + + + + + + + + + + Shape 1: + + + + + + + Shape 2: + + + + + + + + + + buttonBox + accepted() + IsecalcUI + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + IsecalcUI + reject() + + + 316 + 260 + + + 286 + 274 + + + + +