-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathOptDisplayDlgImpl.cpp
163 lines (133 loc) · 4.76 KB
/
OptDisplayDlgImpl.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
Copyright (C) 2000,2001 Stefan Duffner
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qcheckbox.h>
#include <qcolordialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include "OptDisplayDlgImpl.h"
#include "Options.h"
/**
* Constructs a OptDisplayDlgImpl which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
OptDisplayDlgImpl::OptDisplayDlgImpl(QWidget *parent, const char *name,
bool modal, Qt::WFlags fl)
: QDialog(parent, name, modal, fl) {
optDisplayDlg.setupUi(this);
optDisplayDlg.lb_gridcolor->setAutoFillBackground(true);
optDisplayDlg.lb_shadowcolor->setAutoFillBackground(true);
}
/**
* Destroys the object and frees any allocated resources
*/
OptDisplayDlgImpl::~OptDisplayDlgImpl() {
// no need to delete child widgets, Qt does it all for us
}
/**
* Initialises the dialog according to the current options @a opt.
*/
void OptDisplayDlgImpl::init(Options *opt) {
int gsize;
QString stext;
gridcolor = opt->getGridColor();
optDisplayDlg.lb_gridcolor->setBackgroundColor(gridcolor);
gsize = opt->getGridSize();
if (gsize < 3)
gsize = 3;
optDisplayDlg.sb_gridsize->setValue(gsize);
shadowcolor = opt->getStateShadowColor();
optDisplayDlg.lb_shadowcolor->setBackgroundColor(shadowcolor);
bshadows = opt->getStateShadows();
optDisplayDlg.cb_shadows->setChecked(bshadows);
btooltips = opt->getToolTips();
optDisplayDlg.cb_tooltips->setChecked(btooltips);
iomark = opt->getIOMark();
optDisplayDlg.cb_iomark->setChecked(iomark);
ionames = opt->getDisplayIONames();
optDisplayDlg.cb_ionames->setChecked(opt->getDisplayIONames());
bdrawbox = opt->getDrawBox();
optDisplayDlg.cb_drawbox->setChecked(opt->getDrawBox());
optDisplayDlg.le_start->setText(opt->getInitialDescriptor());
optDisplayDlg.le_inversion->setText(opt->getInversionDescriptor());
optDisplayDlg.le_any->setText(opt->getAnyInputDescriptor());
optDisplayDlg.le_default->setText(opt->getDefaultTransitionDescriptor());
}
/**
* Lets you choose a color used to draw the grid
*/
void OptDisplayDlgImpl::chooseGridColor() {
QColor c;
c = QColorDialog::getColor(gridcolor, this);
if (c.isValid()) {
/*
QPalette pal;
pal.setColor(lb_gridcolor->backgroundRole(), c);
lb_gridcolor->setPalette(pal);
*/
optDisplayDlg.lb_gridcolor->setBackgroundColor(c);
gridcolor = c;
}
}
/**
* Lets you choose a color used to draw the shadows
*/
void OptDisplayDlgImpl::chooseShadowColor() {
QColor c;
c = QColorDialog::getColor(shadowcolor, this);
if (c.isValid()) {
optDisplayDlg.lb_shadowcolor->setBackgroundColor(c);
shadowcolor = c;
}
}
/// Called when the 'display shadows' checkbox is clicked
void OptDisplayDlgImpl::shadowsClicked() {
bshadows = optDisplayDlg.cb_shadows->isChecked();
}
/// Called when the tooltips checkbox is clicked
void OptDisplayDlgImpl::tooltipsClicked() {
btooltips = optDisplayDlg.cb_tooltips->isChecked();
}
/// Called when the IO-mark checkbox is clicked
void OptDisplayDlgImpl::ioMarkClicked() {
iomark = optDisplayDlg.cb_iomark->isChecked();
}
/// Called when the start transition descriptor is changed
void OptDisplayDlgImpl::startDescChanged() {
initial_descriptor = optDisplayDlg.le_start->text();
}
/// Called when the inversion descriptor is changed
void OptDisplayDlgImpl::inversionDescChanged() {
inversion_descriptor = optDisplayDlg.le_inversion->text();
}
/// Called when the "any input" descriptor is changed
void OptDisplayDlgImpl::anyInputDescChanged() {
any_input_descriptor = optDisplayDlg.le_any->text();
}
/// Called when the default transition descriptor is changed
void OptDisplayDlgImpl::defaultDescChanged() {
default_descriptor = optDisplayDlg.le_default->text();
}
/// Called when the 'Display I/O names' checkbox is clicked
void OptDisplayDlgImpl::ioNamesClicked() {
ionames = optDisplayDlg.cb_ionames->isChecked();
}
/// Called when the 'Draw Box' checkbox is clicked
void OptDisplayDlgImpl::drawBoxClicked() {
bdrawbox = optDisplayDlg.cb_drawbox->isChecked();
}