You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/core/settings/globalsettingsform.cpp

52 lines
1.2 KiB
C++

#include "globalsettingsform.h"
#include "ui_globalsettingsform.h"
#include "globalsettings.h"
#include "../settingsservice.h"
GlobalSettingsForm::GlobalSettingsForm(QWidget *parent) :
FormBinder<GlobalSettings>(parent),
ui(new Ui::GlobalSettingsForm)
{
ui->setupUi(this);
registerBinding(ui->firmName);
registerBinding(ui->street);
registerBinding(ui->houseNumber);
registerBinding(ui->zipCode);
registerBinding(ui->city);
registerBinding(ui->ic);
registerBinding(ui->vatPayer);
registerBinding(ui->dic);
registerBinding(ui->vatHigh);
registerBinding(ui->vatFirstLower);
registerBinding(ui->vatSecondLower);
}
GlobalSettingsForm::~GlobalSettingsForm()
{
delete ui;
}
bool GlobalSettingsForm::saveRecord()
{
bindToData();
SettingsService srv("CORE");
srv.saveSettings(entity());
return true;
}
void GlobalSettingsForm::loadEntity()
{
SettingsService srv("CORE");
QSharedPointer<GlobalSettings> settings = srv.loadSettings<GlobalSettings>();
setEntity(settings);
ui->grpVat->setEnabled(settings->vatPayer());
}
void GlobalSettingsForm::on_vatPayer_toggled(bool checked)
{
ui->grpVat->setEnabled(checked);
}