summaryrefslogtreecommitdiffstats
path: root/dlgpreferences.cpp
blob: 9174401d33dee58fc39b1e45d9ec03518059ae9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "dlgpreferences.h"
#include "ui_dlgpreferences.h"

DlgPreferences::DlgPreferences(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgPreferences)
{
    ui->setupUi(this);

    QIntValidator *val = new QIntValidator(100,800,this);
    ui->lineEditHeight->setValidator(val);
    ui->lineEditWidth->setValidator(val);
}

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

/**
 * @brief DlgPreferences::setHeight
 * @param arg
 * The hight that will be displayed in the lineEditHeight.
 */
void DlgPreferences::setHeight(int arg)
{
    if (m_Height == arg)
        return;

    m_Height = arg;
    ui->lineEditHeight->setText(QString::number(m_Height));
    emit HeightChanged(arg);
}

/**
 * @brief DlgPreferences::setWidth
 * @param arg
 * The width that will be displayed in the lineEditWidth.
 */
void DlgPreferences::setWidth(int arg)
{
    if (m_Width == arg)
        return;

    m_Width = arg;
    ui->lineEditWidth->setText(QString::number(m_Width));
    emit WidthChanged(arg);
}


/**
 * @brief DlgPreferences::on_buttonOk_clicked
 */
void DlgPreferences::on_buttonOk_clicked()
{
    qDebug() << "Height: " << ui->lineEditHeight->text();
    qDebug() << "Width:" << ui->lineEditWidth->text();
}

/**
 * @brief DlgPreferences::accept
 */
void DlgPreferences::accept()
{
    setHeight(ui->lineEditHeight->text().toInt());
    setWidth(ui->lineEditWidth->text().toInt());

    QDialog::accept();
}

/**
 * @brief DlgPreferences::reject
 */
void DlgPreferences::reject()
{
    QDialog::reject();
}