11
11
#include < QLineEdit>
12
12
#include < QButtonGroup>
13
13
#include < QComboBox>
14
+ #include < QStandardItemModel>
14
15
#include < QLineEdit>
15
16
#include < QFileDialog>
16
17
#include < QMessageBox>
17
18
19
+ #include < iostream>
20
+ using namespace std ;
18
21
RtiPlanRow::RtiPlanRow (RtiParameters ¶m, QFrame *parent): QFrame(parent), parameters(param) {
19
22
QHBoxLayout *layout = new QHBoxLayout (this );
20
23
@@ -147,9 +150,11 @@ RtiPlanesRow::RtiPlanesRow(RtiParameters ¶meters, QFrame *parent): RtiPlanRo
147
150
nplanesbox = new QComboBox;
148
151
nplanesbox->setFixedWidth (100 );
149
152
for (int i = 0 ; i < 7 ; i++) {
150
- nplanesbox->addItem (QString::number (nimages[i]));
153
+ nplanesbox->addItem (QString::number (nimages[i]), QVariant (nimages[i]) );
151
154
}
152
- connect (nplanesbox, static_cast <void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged), [this ](int n) { setNPlanes (nimages[n]*3 , true ); });
155
+ connect (nplanesbox, static_cast <void (QComboBox::*)(int )>(&QComboBox::currentIndexChanged), [this ](int n) {
156
+ setNPlanes (nimages[n]*3 , true );
157
+ });
153
158
buttons->addWidget (nplanesbox);
154
159
155
160
buttons->addStretch (1 );
@@ -167,6 +172,17 @@ RtiPlanesRow::RtiPlanesRow(RtiParameters ¶meters, QFrame *parent): RtiPlanRo
167
172
setNChroma (parameters.nchroma );
168
173
}
169
174
175
+ void RtiPlanesRow::forceNPlanes (int nplanes) {
176
+ QStandardItemModel *model = qobject_cast<QStandardItemModel *>(nplanesbox->model ());
177
+ Q_ASSERT (model != nullptr );
178
+ for (int i = 0 ; i < 7 ; i++) {
179
+ QStandardItem *item = model->item (i);
180
+ bool disabled = nplanes >= 0 && nplanes != nimages[i]*3 ;
181
+ item->setFlags (disabled ? item->flags () & ~Qt::ItemIsEnabled
182
+ : item->flags () | Qt::ItemIsEnabled);
183
+ }
184
+ }
185
+
170
186
void RtiPlanesRow::setNPlanes (int nplanes, bool emitting) {
171
187
nchromabox->setEnabled (parameters.colorspace == Rti::YCC);
172
188
@@ -175,8 +191,8 @@ void RtiPlanesRow::setNPlanes(int nplanes, bool emitting) {
175
191
emit nplanesChanged ();
176
192
return ;
177
193
}
178
- for (int i = 0 ; i < 7 ; i++) {
179
- if (nimages[i] == nplanes/ 3 )
194
+ for (int i = 0 ; i < nplanesbox-> count () ; i++) {
195
+ if (nplanes/ 3 == nplanesbox-> itemData (i). toInt () )
180
196
nplanesbox->setCurrentIndex (i);
181
197
}
182
198
}
@@ -399,7 +415,7 @@ void RtiExportRow::suggestPath() {
399
415
400
416
switch (parameters.basis ) {
401
417
case Rti::PTM: filename = parameters.colorspace == Rti::RGB ? " ptm" : " lptm" ; break ;
402
- case Rti::HSH: filename = " hsh" ; break ;
418
+ case Rti::HSH: filename = parameters. colorspace == Rti::RGB ? " hsh" : " lhsh " ; break ;
403
419
case Rti::RBF: filename = " rbf" + QString::number (parameters.nplanes ); break ;
404
420
case Rti::BILINEAR: filename = " bln" + QString::number (parameters.nplanes ); break ;
405
421
default : filename = " rti" ; break ;
0 commit comments