]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingsettingsdlg.cpp
Added base units & display style to drawing.
[architektonas] / src / drawingsettingsdlg.cpp
diff --git a/src/drawingsettingsdlg.cpp b/src/drawingsettingsdlg.cpp
new file mode 100644 (file)
index 0000000..ede8cb9
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// drawingsettingsdlg.cpp: Dialog for changing a drawing's settings
+//
+// Part of the Architektonas Project
+// (C) 2021 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO  WHEN        WHAT
+// ---  ----------  ------------------------------------------------------------
+// JLH  12/31/2021  Created this file
+
+#include "drawingsettingsdlg.h"
+
+DrawingSettingsDlg::DrawingSettingsDlg(QWidget * parent/*= 0*/): QDialog(parent), baseUnit(new QComboBox(this)), unitStyle(new QComboBox(this)), decimalPrecision(new QComboBox(this)), fractionalPrecision(new QComboBox(this))
+{
+       QStringList buList = { "Inch", "Foot", "Yard", "Mile", "mm", "cm", "m", "km" };
+       QStringList usList = { "Decimal", "Fractional" };
+       QStringList dpList = { "0.1", "0.01", "0.001", "0.0001", "0.00001", "0.000001" };
+       QStringList fpList = { "1/2", "1/4", "1/8", "1/16", "1/32", "1/64" };
+
+       baseUnit->insertItems(0, buList);
+       unitStyle->insertItems(0, usList);
+       decimalPrecision->insertItems(0, dpList);
+       fractionalPrecision->insertItems(0, fpList);
+
+       QFormLayout * fl = new QFormLayout;
+
+       fl->addRow(tr("Base Unit:"), baseUnit);
+       fl->addRow(tr("Unit Style:"), unitStyle);
+       fl->addRow(tr("Decimal Precision:"), decimalPrecision);
+       fl->addRow(tr("Fractional Precision:"), fractionalPrecision);
+
+       buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+       connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+       connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+       QVBoxLayout * mainLayout = new QVBoxLayout;
+       mainLayout->addLayout(fl);
+       mainLayout->addWidget(buttonBox);
+       setLayout(mainLayout);
+
+       setWindowTitle(tr("Drawing Settings"));
+}
+
+DrawingSettingsDlg::~DrawingSettingsDlg()
+{
+}