1 #include "MatrixOptionsDialog.h" 6 #include <QApplication> 7 #include <QButtonGroup> 8 #include <QColorDialog> 10 #include <QGridLayout> 11 #include <QHBoxLayout> 12 #include <QHeaderView> 15 #include <QPushButton> 16 #include <QRadioButton> 17 #include <QSizePolicy> 19 #include <QSpacerItem> 22 #include <QVBoxLayout> 26 #include "MatrixOptions.h" 72 connect(parent, SIGNAL( elementClicked(QString) ),
77 setWindowTitle(
"Matrix Options");
81 QTabWidget *optionsTabs =
new QTabWidget();
82 optionsTabs->setGeometry( QRect(9, 9, 100, 100) );
90 QGridLayout *mainLayout =
new QGridLayout();
91 colorOptionsPage->setLayout(mainLayout);
92 QHBoxLayout *colorPageLayout =
new QHBoxLayout();
97 QVBoxLayout *colorToleranceLayout =
new QVBoxLayout();
99 m_colorToleranceRadioButton =
new QRadioButton();
100 m_colorToleranceRadioButton->setText(
"Pick Tolerance");
101 colorToleranceLayout->addWidget(m_colorToleranceRadioButton);
102 connect( m_colorToleranceRadioButton, SIGNAL( clicked() ),
105 QHBoxLayout *colorToleranceOptionsLayout =
new QHBoxLayout();
107 m_colorToleranceSlider =
new QSlider();
108 m_colorToleranceSlider->setOrientation(Qt::Vertical);
109 m_colorToleranceSlider->setRange(0, 1000);
110 colorToleranceOptionsLayout->addWidget(m_colorToleranceSlider);
111 connect( m_colorToleranceSlider, SIGNAL( valueChanged(
int) ),
114 QVBoxLayout *colorToleranceEditsLayout =
new QVBoxLayout();
115 QHBoxLayout *colorBadCorrLayout =
new QHBoxLayout();
117 QLabel *colorBadCorrLabel =
new QLabel();
118 colorBadCorrLabel->setText(
"Bad Correlation");
120 colorBadCorrLayout->addWidget(colorBadCorrLabel);
128 colorToleranceEditsLayout->addLayout(colorBadCorrLayout);
130 QHBoxLayout *colorEnterTolLayout =
new QHBoxLayout();
132 QLabel *colorTolLabel =
new QLabel();
133 colorTolLabel->setText(
"Tolerance");
134 colorEnterTolLayout->addWidget(colorTolLabel);
136 m_colorToleranceLineEdit =
new QLineEdit();
137 m_colorToleranceLineEdit->setValidator(
new QDoubleValidator(-1, 1, 10,
this) );
138 colorEnterTolLayout->addWidget(m_colorToleranceLineEdit);
139 connect( m_colorToleranceLineEdit, SIGNAL( textChanged(
const QString &) ),
142 colorToleranceEditsLayout->addLayout(colorEnterTolLayout);
144 QHBoxLayout *colorGoodCorrLayout =
new QHBoxLayout();
145 QLabel *colorGoodCorrLabel =
new QLabel();
146 colorGoodCorrLabel->setText(
"Good Correlation");
148 colorGoodCorrLayout->addWidget(colorGoodCorrLabel);
155 colorToleranceEditsLayout->addLayout(colorGoodCorrLayout);
157 colorToleranceOptionsLayout->addLayout(colorToleranceEditsLayout);
159 colorToleranceLayout->addLayout(colorToleranceOptionsLayout);
161 colorPageLayout->addLayout(colorToleranceLayout);
166 QVBoxLayout *colorGradientLayout =
new QVBoxLayout();
174 QSpacerItem *colorGradSpacer =
new QSpacerItem(20,
176 QSizePolicy::Minimum,
177 QSizePolicy::Expanding);
178 colorGradientLayout->addItem(colorGradSpacer);
180 colorPageLayout->addLayout(colorGradientLayout);
182 mainLayout->addLayout(colorPageLayout, 0, 1, 1, 1);
184 optionsTabs->addTab(colorOptionsPage, QString() );
185 optionsTabs->setTabText(optionsTabs->indexOf(colorOptionsPage),
"Color Options");
192 QHBoxLayout *focusPageLayout =
new QHBoxLayout();
193 focusPageLayout->setContentsMargins(0, 0, 0, 0);
194 QVBoxLayout *focusOptionsLayout =
new QVBoxLayout();
212 QVBoxLayout *focusSpecParamLayout =
new QVBoxLayout();
220 QLabel *focusSpecParam1Label =
new QLabel();
221 focusSpecParam1Label->setText(
"Image 1:");
222 focusSpecParamLayout->addWidget(focusSpecParam1Label);
224 QHBoxLayout *focusSpecParam1Layout =
new QHBoxLayout();
227 focusSpecParam1Layout->addWidget(m_image1ComboBox);
228 connect( m_image1ComboBox, SIGNAL( currentIndexChanged(
const QString &) ),
234 focusSpecParam1Layout->addWidget(m_parameter1ComboBox);
236 focusSpecParamLayout->addLayout(focusSpecParam1Layout);
238 QLabel *focusSpecParam2Label =
new QLabel();
239 focusSpecParam2Label->setText(
"Image 2:");
240 focusSpecParamLayout->addWidget(focusSpecParam2Label);
242 QHBoxLayout *focusSpecParam2Layout =
new QHBoxLayout();
245 focusSpecParam2Layout->addWidget(m_image2ComboBox);
246 connect( m_image2ComboBox, SIGNAL( currentIndexChanged(
const QString &) ),
250 focusSpecParam2Layout->addWidget(m_parameter2ComboBox);
252 focusSpecParamLayout->addLayout(focusSpecParam2Layout);
254 focusOptionsLayout->addLayout(focusSpecParamLayout);
256 focusPageLayout->addLayout(focusOptionsLayout);
261 QVBoxLayout *focusTolLayout =
new QVBoxLayout();
269 QHBoxLayout *focusTolEditLayout =
new QHBoxLayout();
271 QLabel *focusTolLabel =
new QLabel();
272 focusTolLabel->setText(
"Tolerance:");
273 focusTolEditLayout->addWidget(focusTolLabel);
275 m_focusToleranceLineEdit =
new QLineEdit();
276 m_focusToleranceLineEdit->setValidator(
new QDoubleValidator(-1, 1, 10,
this) );
277 focusTolEditLayout->addWidget(m_focusToleranceLineEdit);
281 focusTolLayout->addLayout(focusTolEditLayout);
283 QHBoxLayout *focusElementsLayout =
new QHBoxLayout();
284 QVBoxLayout *focusGoodElementsLayout =
new QVBoxLayout();
286 QLabel *focusGoodElementsLabel =
new QLabel();
287 focusGoodElementsLabel->setFocusPolicy(Qt::NoFocus);
288 focusGoodElementsLabel->setText(
"Good");
289 focusGoodElementsLayout->addWidget(focusGoodElementsLabel);
291 m_goodElementsComboBox =
new QComboBox();
292 focusGoodElementsLayout->addWidget(m_goodElementsComboBox);
294 focusElementsLayout->addLayout(focusGoodElementsLayout);
296 QVBoxLayout *focusBadElementsLayout =
new QVBoxLayout();
298 QLabel *focusBadElementsLabel =
new QLabel();
299 focusBadElementsLabel->setText(
"Bad");
300 focusBadElementsLayout->addWidget(focusBadElementsLabel);
303 focusBadElementsLayout->addWidget(m_badElementsComboBox);
305 focusElementsLayout->addLayout(focusBadElementsLayout);
307 focusTolLayout->addLayout(focusElementsLayout);
309 focusPageLayout->addLayout(focusTolLayout);
311 focusOptionsPage->setLayout(focusPageLayout);
312 optionsTabs->addTab( focusOptionsPage, QString() );
313 optionsTabs->setTabText(optionsTabs->indexOf(focusOptionsPage),
"Focus Options");
318 QVBoxLayout *m_currentElementData =
new QVBoxLayout();
319 m_currentElementData->setContentsMargins(0, 0, 0, 0);
323 QLabel *currentCorrLabel =
new QLabel();
324 currentCorrLabel->setText(
"Current Correlation Info:");
325 m_currentElementData->addWidget(currentCorrLabel);
328 m_currentValueLabel =
new QLabel();
329 m_currentValueLabel->setText(
"-");
330 m_currentElementData->addWidget(m_currentValueLabel);
359 optionsTabs->setCurrentIndex(0);
361 QPushButton *applyButton =
new QPushButton(
"&Apply");
362 applyButton->setIcon( QIcon::fromTheme(
"dialog-ok-apply") );
363 connect( applyButton, SIGNAL( clicked() ),
367 QVBoxLayout *topLayout =
new QVBoxLayout();
368 topLayout->addWidget(optionsTabs);
369 topLayout->addWidget(applyButton);
370 topLayout->addLayout(m_currentElementData);
371 setLayout(topLayout);
373 QMetaObject::connectSlotsByName(
this);
431 emit optionsUpdated();
453 QPalette colorPalette;
461 m_colorToleranceSlider->blockSignals(
true);
462 m_colorToleranceSlider->setValue( qRound( 1000 * m_colorToleranceLineEdit->text().toDouble() ) );
463 m_colorToleranceSlider->blockSignals(
false);
483 for (
int param = 0; param < img.value().size(); param++) {
484 m_parameter1ComboBox->addItem(img.value()[param]);
485 m_parameter2ComboBox->addItem(img.value()[param]);
487 while ( img.hasNext() ) {
488 m_image1ComboBox->addItem( img.key() );
489 m_image2ComboBox->addItem( img.key() );
504 m_currentValueLabel->setText(currentData);
534 m_colorToleranceLineEdit->setEnabled(enable);
537 m_colorToleranceSlider->setEnabled(enable);
549 m_focusToleranceLineEdit->setEnabled(enable);
550 m_goodElementsComboBox->setEnabled(enable);
551 m_badElementsComboBox->setEnabled(enable);
563 m_image1ComboBox->setEnabled(enable);
564 m_parameter1ComboBox->setEnabled(enable);
565 m_image2ComboBox->setEnabled(enable);
566 m_parameter2ComboBox->setEnabled(enable);
610 QPalette colorPalette( button->palette() );
612 QColor newColor = QColorDialog::getColor(colorPalette.color(QPalette::Button),
this);
614 if( newColor.isValid() ) {
615 colorPalette.setColor(QPalette::Button, newColor);
616 button->setPalette(colorPalette);
627 m_colorToleranceSlider->setValue( qRound( 1000 * value.toDouble() ) );
637 m_colorToleranceLineEdit->setText( QString::number(value / 1000.0) );
void askUserForBadColor()
slot called when user clicks on bad correlation color button
void updateCorrelationData(QString currentData)
Update the current correlation information.
void applyOptions()
Send changes back to scene widget (MatrixOptions) so it can redraw the elements in the right color...
QMap< QString, QStringList > matrixImgsAndParams()
This slot will be called when a matrix element is clicked on.
This class holds the matrix color and focus information.
void populateParameterComboBox(int index)
Update parameter combo boxes at real time, when the img combo boxes are changed.
void updateSpecParam2ComboBox(const QString &key)
when the img2 combo box is changed this slot will update the parameter combo box. ...
double colorTolerance()
Threshold for what is considered a bad correlation.
void setColorTolerance(double tolerance)
void updateToleranceSlider(const QString &value)
slot called when user modifies the color tolerance line edit text.
void setColorToleranceStatus(bool enable)
If the tolerance radiobutton is selected, this method will be called with true passed as the paramete...
QPointer< QRadioButton > m_focusToleranceRadioButton
Focus the matrix on a selected correlation value.
QPointer< QRadioButton > m_specificCorrelationRadioButton
Focus the matrix on the correlation corresponding to the specified images and parameters.
void updateSpecParam1ComboBox(const QString &key)
when the img1 combo box is changed this slot will update the parameter combo box. ...
void updateSpecificParameterComboBox(const QString &key, QComboBox *comboBox)
When the user switches the image combobox this slot will update the parameter combobox to be filled w...
void setFocusToleranceStatus(bool enable)
If the focus tolerance radio button is selected, the tolerance widgets will be enabled.
void refreshWidgetStates()
This method will enable and disable widgets depending on which radio button is selected.
void setSpecificParametersStatus(bool enable)
If the specific parameters radio button is selected, the image and parameter spinboxes will be enable...
QPointer< QPushButton > m_goodCorrelationColorButton
Color to use for matrix elements that are below the given threshold.
void askUserForGoodColor()
slot called when user clicks on good correlation color button
void updateToleranceLineEdit(int value)
slot called when user changes the slider position.
double focusValue()
The value of the spot on the matrix that we need to focus on.
QPointer< QRadioButton > m_worstCorrelationRadioButton
Focus the matrix on the worst correlation................. What if there is more than one...
void setBadCorrelationColor(QColor color)
QPointer< QPushButton > m_badCorrelationColorButton
Color to use when for matrix elements that are above the given threshold.
QPointer< QRadioButton > m_gradientRadioButton
Select a tolerance for the color values.
QColor badCorrelationColor()
The color selected for the correlation values that are above the given threshold. ...
MatrixOptions * m_options
This will be used to populate all the widgets.
void setGoodCorrelationColor(QColor color)
void readOptions()
Get the current options from the matrix scene widget.
Namespace for ISIS/Bullet specific routines.
bool colorScheme()
Use the green-red gradient if false.
MatrixOptionsDialog(MatrixOptions *options, QWidget *parent)
Main constructor.
void setColorScheme(bool tolerance)
FocusOption focusOption()
QPointer< QRadioButton > m_bestCorrelationRadioButton
Focus the matrix on the best correlation................. What if there is more than one...
QColor goodCorrelationColor()
The color selected for the correlation values that are below the given threshold. ...
void askUserForColor(QPushButton *button)
Prompt the user for a new color.
~MatrixOptionsDialog()
Default Destructor.