Skip to content

Commit

Permalink
Refs #4474. Normalizing and adding doxygen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Feb 7, 2012
1 parent cc8a501 commit 11a884b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace SimpleGui
This class controls the color scale for the main level program viewed
datasets.
@author Michael Reuter
@date 07/06/2011
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand Down Expand Up @@ -48,21 +47,13 @@ class EXPORT_OPT_MANTIDVATES_SIMPLEGUI_VIEWWIDGETS ColorSelectionDialog : public
Q_OBJECT

public:
/**
* Default constructor.
* @param parent the parent widget of the mode control widget
*/
/// Default constructor.
ColorSelectionDialog(QWidget *parent = 0);
/// Default destructor.
virtual ~ColorSelectionDialog() {}

public slots:
/**
* Function to set the color scale range into the range widgets.
*
* @param min the minimum value of the color scale range
* @param max the maximum value of the color scale range
*/
/// Set the color scale range into the range widgets.
void setColorScaleRange(double min, double max);

signals:
Expand All @@ -89,49 +80,27 @@ public slots:
void logScale(int state);

protected slots:
/**
* Function that enables or diables the min and max line edits based on
* state of the automatic scaling checkbox.
*
* @param state the current state of the checkbox
*/
/// Set state of the automatic scaling checkbox.
void autoOrManualScaling(int state);
/**
* Function to get the new color scale range.
*/
/// Get the new color scale range.
void getColorScaleRange();
/**
* Function that presents the user with the available color presets and
* gets the
* result from the user.
*/
/// Show available color presets.
void loadPreset();
/**
* Function that sets the flag for using log color scaling based on the
* associated checkbox.
* @param state flag for whether or not to use log color scaling
*/
/// Set log color scaling.
void useLogScaling(int state);

private:
/**
* Function that sets up various colormaps. This is copied verbaitum from
* pqColorScaleEditor.
*/
/// Set up various color maps.
void loadBuiltinColorPresets();
/**
* Function that sets the status of the editor widgets.
*
* @param status the state to set the editor widgets to
*/
/// Set status of the color selection editor widgets.
void setEditorStatus(bool status);

pqColorPresetManager *presets; ///< Dialog for choosing color presets
Ui::ColorSelectionDialogClass ui; ///< The mode control widget's UI form
};

}
}
}
} // SimpleGui
} // Vates
} // Mantid

#endif // COLORSELECTIONWIDGET_H_
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ namespace Vates
namespace SimpleGui
{

/**
* This is the class constructor. It sets up the UI and all the necessary
* sub-components and connections.
* @param parent the parent widget of the mode control widget
*/
ColorSelectionDialog::ColorSelectionDialog(QWidget *parent) : QDialog(parent)
{
this->ui.setupUi(this);
Expand All @@ -42,6 +47,10 @@ ColorSelectionDialog::ColorSelectionDialog(QWidget *parent) : QDialog(parent)
this, SLOT(useLogScaling(int)));
}

/**
* This function sets the status of the color selection widgets.
* @param status the state to set the color selection widgets to
*/
void ColorSelectionDialog::setEditorStatus(bool status)
{
this->ui.maxValLabel->setEnabled(status);
Expand All @@ -50,6 +59,10 @@ void ColorSelectionDialog::setEditorStatus(bool status)
this->ui.minValLineEdit->setEnabled(status);
}

/**
* This function sets up various color maps. This is copied verbaitum from
* pqColorScaleEditor.
*/
void ColorSelectionDialog::loadBuiltinColorPresets()
{
pqColorMapModel colorMap;
Expand Down Expand Up @@ -105,6 +118,11 @@ void ColorSelectionDialog::loadBuiltinColorPresets()
model->addBuiltinColorMap(colorMap, "CIELab Blue to Red");
}

/**
* This function enables or diables the min and max line edits based on state
* of the automatic scaling checkbox.
* @param state the current state of the checkbox
*/
void ColorSelectionDialog::autoOrManualScaling(int state)
{
switch (state)
Expand All @@ -119,6 +137,10 @@ void ColorSelectionDialog::autoOrManualScaling(int state)
}
}

/**
* This function presents the user with the available color presets (maps) and
* gets the selection result from the user.
*/
void ColorSelectionDialog::loadPreset()
{
this->presets->setUsingCloseButton(false);
Expand All @@ -135,13 +157,22 @@ void ColorSelectionDialog::loadPreset()
}
}

/**
* This function gets the new color scale range from the value widgets and
* passes a signal along with that new range.
*/
void ColorSelectionDialog::getColorScaleRange()
{
double min = this->ui.minValLineEdit->text().toDouble();
double max = this->ui.maxValLineEdit->text().toDouble();
emit this->colorScaleChanged(min, max);
}

/**
* This function sets the color scale range into the range widgets.
* @param min the minimum value of the color scale range
* @param max the maximum value of the color scale range
*/
void ColorSelectionDialog::setColorScaleRange(double min, double max)
{
if (this->ui.autoColorScaleCheckBox->isChecked())
Expand All @@ -157,6 +188,11 @@ void ColorSelectionDialog::setColorScaleRange(double min, double max)
}
}

/**
* This function sets the flag for using log color scaling based on the
* associated checkbox.
* @param state flag for whether or not to use log color scaling
*/
void ColorSelectionDialog::useLogScaling(int state)
{
// Qt::Checked is 2, need it to be 1 for boolean true conversion
Expand All @@ -167,6 +203,6 @@ void ColorSelectionDialog::useLogScaling(int state)
emit this->logScale(state);
}

}
}
}
} // SimpleGui
} // Vates
} // Mantid

0 comments on commit 11a884b

Please sign in to comment.