30 #include <dtkConfig.h>
32 #include <dtkCoreSupport/dtkGlobal.h>
34 #include <dtkGuiSupport/dtkColorButton.h>
37 #include <dtkVr/dtkVrHeadRecognizer.h>
38 #include <dtkVr/dtkVrFlystickRecognizer.h>
39 #include <dtkVr/dtkVrGestureRecognizer.h>
42 class axlInspectorViewPrivate
47 dtkVrHeadRecognizer *head_recognizer;
48 dtkVrFlystickRecognizer *flystick_recognizer;
49 dtkVrGestureRecognizer *gesture_recognizer;
56 dtkColorButton *colorButton;
63 QFrame *box_background;
65 QCheckBox *switch_head;
66 QCheckBox *switch_flystick;
67 QCheckBox *switch_finger;
68 QCheckBox *checkBoxGradientBackground;
70 QLineEdit *head_address;
71 QLineEdit *flystick_address;
72 QLineEdit *finger_address;
74 QString head_address_url;
75 QString flystick_address_url;
76 QString finger_address_url;
82 d->head_recognizer =
new dtkVrHeadRecognizer;
83 d->flystick_recognizer =
new dtkVrFlystickRecognizer;
84 d->gesture_recognizer =
new dtkVrGestureRecognizer;
87 d->head_address_url =
"DTrackCW@is-sound";
88 d->flystick_address_url =
"DTrackCW@is-sound";
89 d->finger_address_url =
"DTrackCW@is-sound";
93 d->box_head =
new QFrame(
this);
94 d->head_address =
new QLineEdit(
"DTrackCW@is-sound", d->box_head);
95 d->switch_head =
new QCheckBox(
this);
97 d->colorButton =
new dtkColorButton(
this);
104 QVBoxLayout *box_head_layout =
new QVBoxLayout(d->box_head);
106 QHBoxLayout *box_head_layout_top =
new QHBoxLayout;
107 box_head_layout_top->addWidget(
new QLabel(
"Head tracking", d->box_head));
108 box_head_layout_top->addWidget(d->switch_head);
110 box_head_layout->addLayout(box_head_layout_top);
111 box_head_layout->addWidget(d->head_address);
113 d->box_flystick =
new QFrame(
this);
114 d->flystick_address =
new QLineEdit(
"DTrackCW@is-sound", d->box_flystick);
115 d->switch_flystick =
new QCheckBox(
this);
117 QVBoxLayout *box_flystick_layout =
new QVBoxLayout(d->box_flystick);
119 QHBoxLayout *box_flystick_layout_top =
new QHBoxLayout;
120 box_flystick_layout_top->addWidget(
new QLabel(
"Flystick tracking", d->box_flystick));
121 box_flystick_layout_top->addWidget(d->switch_flystick);
123 box_flystick_layout->addLayout(box_flystick_layout_top);
124 box_flystick_layout->addWidget(d->flystick_address);
126 d->box_finger =
new QFrame(
this);
127 d->finger_address =
new QLineEdit(
"DTrackCW@is-sound", d->box_finger);
128 d->switch_finger =
new QCheckBox(
this);
130 QVBoxLayout *box_finger_layout =
new QVBoxLayout(d->box_finger);
132 QHBoxLayout *box_finger_layout_top =
new QHBoxLayout;
133 box_finger_layout_top->addWidget(
new QLabel(
"Finger tracking", d->box_finger));
134 box_finger_layout_top->addWidget(d->switch_finger);
136 box_finger_layout->addLayout(box_finger_layout_top);
137 box_finger_layout->addWidget(d->finger_address);
139 d->box_background =
new QFrame(
this);
140 QVBoxLayout *box_background_layout =
new QVBoxLayout(d->box_background);
142 QHBoxLayout *layoutColorButton =
new QHBoxLayout;
144 layoutColorButton->addWidget(
new QLabel(
"Color",d->box_background));
145 layoutColorButton->addWidget(d->colorButton);
147 QHBoxLayout *layoutGradientCheckBox =
new QHBoxLayout;
148 d->checkBoxGradientBackground =
new QCheckBox(
this);
149 d->checkBoxGradientBackground->setChecked(
true);
150 QLabel *labelGradientBackground =
new QLabel(
"Gradient :", d->box_background);
151 layoutGradientCheckBox->addWidget(labelGradientBackground);
152 layoutGradientCheckBox->addWidget(d->checkBoxGradientBackground);
153 labelGradientBackground->setToolTip(
"Turn on/off the gradient background.");
155 box_background_layout->addWidget(
new QLabel(
"Background",
this));
156 box_background_layout->addLayout(layoutColorButton);
157 box_background_layout->addLayout(layoutGradientCheckBox);
159 QVBoxLayout *layout =
new QVBoxLayout(
this);
160 layout->setAlignment(Qt::AlignTop);
161 layout->setContentsMargins(0, 0, 0, 0);
162 layout->setSpacing(0);
163 layout->addWidget(d->box_head);
165 layout->addWidget(d->box_flystick);
167 layout->addWidget(d->box_finger);
170 layout->addWidget(d->box_background);
172 layout->addWidget(d->lightDialog);
174 layout->addWidget(d->inpectorCamera);
177 connect(d->head_address, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onHeadAddressChanged(
const QString&)));
178 connect(d->flystick_address, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onFlystickAddressChanged(
const QString&)));
179 connect(d->finger_address, SIGNAL(textChanged(
const QString&)),
this, SLOT(
onFingerAddressChanged(
const QString&)));
181 connect(d->switch_head, SIGNAL(toggled(
bool)),
this, SLOT(
onHeadToggled(
bool)));
182 connect(d->switch_flystick, SIGNAL(toggled(
bool)),
this, SLOT(
onFlystickToggled(
bool)));
183 connect(d->switch_finger, SIGNAL(toggled(
bool)),
this, SLOT(
onFingerToggled(
bool)));
190 delete d->head_recognizer;
191 delete d->flystick_recognizer;
192 delete d->gesture_recognizer;
194 delete d->lightDialog;
195 delete d->inpectorCamera;
205 d->lightDialog->setView(view);
206 d->inpectorCamera->setView(view);
208 c.setRgbF(d->view->getBackgroundColor()[0],d->view->getBackgroundColor()[1],d->view->getBackgroundColor()[2]);
209 d->colorButton->setColor(c);
210 connect(d->view, SIGNAL(lightPositionChanged(
double,
double,
double)), d->lightDialog, SLOT(onPositionChanged(
double,
double,
double)));
212 connect(d->checkBoxGradientBackground, SIGNAL(clicked(
bool)), d->view, SLOT(onBackgroundGradientChange(
bool)));
219 c.setRgbF(d->view->getBackgroundColor()[0],d->view->getBackgroundColor()[1],d->view->getBackgroundColor()[2]);
220 d->colorButton->setColor(c);
221 d->checkBoxGradientBackground->setChecked(d->view->getBackgroundGradient());
223 d->inpectorCamera->updateView();
228 d->view->setBackgroundColor(color.redF(), color.greenF(), color.blueF());
233 d->head_address_url = address;
238 d->flystick_address_url = address;
243 d->finger_address_url = address;
248 qDebug() << DTK_PRETTY_FUNCTION << toggled << QUrl(d->head_address_url);
251 d->head_recognizer->startConnection(QUrl(d->head_address_url));
253 d->head_recognizer->stopConnection();
255 d->head_recognizer->setView(d->view);
261 qDebug() << DTK_PRETTY_FUNCTION << toggled << QUrl(d->flystick_address_url);
264 d->flystick_recognizer->startConnection(QUrl(d->flystick_address_url));
266 d->flystick_recognizer->stopConnection();
274 d->gesture_recognizer->startConnection(QUrl(d->finger_address_url));
276 d->gesture_recognizer->stopConnection();
void onFingerToggled(bool)
void setView(axlAbstractView *view)
void onFingerAddressChanged(const QString &)
void onHeadAddressChanged(const QString &)
axlInspectorView(QWidget *parent=0)
void onFlystickAddressChanged(const QString &)
void onFlystickToggled(bool)
void onBackGroundColorChanged(QColor color)