-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBalanceSheetDialog.cpp
146 lines (102 loc) · 2.66 KB
/
BalanceSheetDialog.cpp
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "BalanceSheetDialog.h"
#include "ui_BalanceSheetDialog.h"
#include <QSettings>
BalanceSheetDialog::BalanceSheetDialog(QWidget *parent) : QDialog(parent),
ui(new Ui::balanceSheet)
{
ui->setupUi(this);
vertPos = horizPos = BalancePos::Mid;
}
BalanceSheetDialog::~BalanceSheetDialog()
{
delete ui;
}
void BalanceSheetDialog::on_okButton_clicked()
{
this->hide();
balance(ui->spriteWidth->value(), ui->spriteHeight->value(), vertPos, horizPos);
}
void BalanceSheetDialog::on_cancelButton_clicked()
{
this->hide();
}
void BalanceSheetDialog::defaultWH(int w, int h)
{
ui->spriteWidth->setValue(w);
ui->spriteHeight->setValue(h);
}
void BalanceSheetDialog::clearIcons()
{
ui->pos_ul->setIcon(QIcon("://blank"));
ui->pos_ur->setIcon(QIcon("://blank"));
ui->pos_um->setIcon(QIcon("://blank"));
ui->pos_ml->setIcon(QIcon("://blank"));
ui->pos_mr->setIcon(QIcon("://blank"));
ui->pos_mm->setIcon(QIcon("://blank"));
ui->pos_bl->setIcon(QIcon("://blank"));
ui->pos_br->setIcon(QIcon("://blank"));
ui->pos_bm->setIcon(QIcon("://blank"));
}
void BalanceSheetDialog::on_pos_ul_clicked()
{
vertPos = BalancePos::Up;
horizPos = BalancePos::Left;
clearIcons();
ui->pos_ul->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_um_clicked()
{
vertPos = BalancePos::Up;
horizPos = BalancePos::Mid;
clearIcons();
ui->pos_um->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_ur_clicked()
{
vertPos = BalancePos::Up;
horizPos = BalancePos::Right;
clearIcons();
ui->pos_ur->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_ml_clicked()
{
vertPos = BalancePos::Mid;
horizPos = BalancePos::Left;
clearIcons();
ui->pos_ml->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_mm_clicked()
{
vertPos = BalancePos::Mid;
horizPos = BalancePos::Mid;
clearIcons();
ui->pos_mm->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_mr_clicked()
{
vertPos = BalancePos::Mid;
horizPos = BalancePos::Right;
clearIcons();
ui->pos_mr->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_bl_clicked()
{
vertPos = BalancePos::Down;
horizPos = BalancePos::Left;
clearIcons();
ui->pos_bl->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_bm_clicked()
{
vertPos = BalancePos::Down;
horizPos = BalancePos::Mid;
clearIcons();
ui->pos_bm->setIcon(QIcon("://stop"));
}
void BalanceSheetDialog::on_pos_br_clicked()
{
vertPos = BalancePos::Down;
horizPos = BalancePos::Right;
clearIcons();
ui->pos_br->setIcon(QIcon("://stop"));
}