config1digitsetandenablesetdlg.cpp 1.24 KB
#include "config1digitsetandenablesetdlg.h"
#include "ui_config1digitsetandenablesetdlg.h"
#include "soundplayer.h"

Config1DigitSetAndEnableSetDlg::Config1DigitSetAndEnableSetDlg(QWidget *parent, uint16_t val) :
    QDialog(parent),
    ui(new Ui::Config1DigitSetAndEnableSetDlg)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);

    foreach (QPushButton *button, findChildren<QPushButton *>())
        connect(button, &QPushButton::pressed, SoundPlayer::playClick);

    if(val < MIN_MONITORING_VALUE) val = MIN_MONITORING_VALUE;

    ui->ctrSpBxValue->setMaximum(MAX_MONITORING_VALUE);
    ui->ctrSpBxValue->setMinimum(MIN_MONITORING_VALUE);
    ui->ctrSpBxValue->setValue(val);

    ui->ctrSpBxValue->installEventFilter(this);
}

Config1DigitSetAndEnableSetDlg::~Config1DigitSetAndEnableSetDlg()
{
    delete ui;
}

void Config1DigitSetAndEnableSetDlg::on_ctrBtnOk_clicked()
{
    m_nResult = result_ok;
    close();
}



void Config1DigitSetAndEnableSetDlg::on_ctrBtnOk_2_clicked()
{
    m_nResult = result_disable;
    close();
}

void Config1DigitSetAndEnableSetDlg::on_ctrBtnCancel_clicked()
{
    m_nResult = result_rejected;
    close();
}

int Config1DigitSetAndEnableSetDlg::getValue(){
    return ui->ctrSpBxValue->value();
}