2018-03-11 07:57:57 +00:00
|
|
|
#include "newunitdialog.h"
|
|
|
|
#include "ui_newunitdialog.h"
|
|
|
|
|
|
|
|
NewUnitDialog::NewUnitDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::NewUnitDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
ui->typeComboBox->clear();
|
2018-03-11 08:33:48 +00:00
|
|
|
QStringList list({"Mass", "Volume", "Length", "Misc"});
|
|
|
|
ui->typeComboBox->insertItems(0, list);
|
2018-03-11 07:57:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
NewUnitDialog::~NewUnitDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
UnitOfMeasure NewUnitDialog::getUnit(){
|
|
|
|
return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(),
|
|
|
|
ui->pluralNameEdit->text().toLower().toStdString(),
|
2018-03-11 08:33:48 +00:00
|
|
|
ui->abbreviationEdit->text().toStdString(),
|
2018-03-11 07:57:57 +00:00
|
|
|
this->getSelectedType(),
|
|
|
|
ui->coefficientSpinBox->value());
|
|
|
|
}
|
|
|
|
|
|
|
|
int NewUnitDialog::getSelectedType(){
|
|
|
|
return ui->typeComboBox->currentIndex();
|
|
|
|
}
|