]> Shamusworld >> Repos - architektonas/blob - src/drawingsettingsdlg.cpp
Added base units & display style to drawing.
[architektonas] / src / drawingsettingsdlg.cpp
1 //
2 // drawingsettingsdlg.cpp: Dialog for changing a drawing's settings
3 //
4 // Part of the Architektonas Project
5 // (C) 2021 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
7 //
8 // JLH = James Hammons <jlhamm@acm.org>
9 //
10 // WHO  WHEN        WHAT
11 // ---  ----------  ------------------------------------------------------------
12 // JLH  12/31/2021  Created this file
13
14 #include "drawingsettingsdlg.h"
15
16 DrawingSettingsDlg::DrawingSettingsDlg(QWidget * parent/*= 0*/): QDialog(parent), baseUnit(new QComboBox(this)), unitStyle(new QComboBox(this)), decimalPrecision(new QComboBox(this)), fractionalPrecision(new QComboBox(this))
17 {
18         QStringList buList = { "Inch", "Foot", "Yard", "Mile", "mm", "cm", "m", "km" };
19         QStringList usList = { "Decimal", "Fractional" };
20         QStringList dpList = { "0.1", "0.01", "0.001", "0.0001", "0.00001", "0.000001" };
21         QStringList fpList = { "1/2", "1/4", "1/8", "1/16", "1/32", "1/64" };
22
23         baseUnit->insertItems(0, buList);
24         unitStyle->insertItems(0, usList);
25         decimalPrecision->insertItems(0, dpList);
26         fractionalPrecision->insertItems(0, fpList);
27
28         QFormLayout * fl = new QFormLayout;
29
30         fl->addRow(tr("Base Unit:"), baseUnit);
31         fl->addRow(tr("Unit Style:"), unitStyle);
32         fl->addRow(tr("Decimal Precision:"), decimalPrecision);
33         fl->addRow(tr("Fractional Precision:"), fractionalPrecision);
34
35         buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
36
37         connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
38         connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
39
40         QVBoxLayout * mainLayout = new QVBoxLayout;
41         mainLayout->addLayout(fl);
42         mainLayout->addWidget(buttonBox);
43         setLayout(mainLayout);
44
45         setWindowTitle(tr("Drawing Settings"));
46 }
47
48 DrawingSettingsDlg::~DrawingSettingsDlg()
49 {
50 }