Ticket #11485 (new)
Maintenance issues from SliceViewer changes
| Reported by: | Owen Arnold | Owned by: | Nick Draper | 
|---|---|---|---|
| Priority: | major | Milestone: | Release 3.5 | 
| Component: | Framework | Keywords: | Maintenance | 
| Cc: | Blocked By: | #11341 | |
| Blocking: | Tester: | 
Description
1) SliceViewer.cpp is already too long. The code that applies icon switching should be refactored out into functions. Reading the function calls should make the behaviour a lot more readable than it currently is.
This is what it currently looks like in one place:
if (m_peaksPresenter->size()>0)  {
    icon.addFile(QString::fromStdString(g_iconPeakListOn),
                   QSize(), QIcon::Normal, QIcon::On);
    ui.btnPeakOverlay->setIcon(icon);
    ui.btnPeakOverlay->setChecked(true);
  }  else {
    icon.addFile(QString::fromStdString(g_iconPeakList),
                   QSize(), QIcon::Normal, QIcon::Off);
    ui.btnPeakOverlay->setIcon(icon);
    ui.btnPeakOverlay->setChecked(false);
  }
What it should look like is something of the form:
if (m_peaksPresenter->size()>0)  {
    selectPeakOverlayButton();
  }  else {
    unselectPeakOverlayButton();
  }
2) You have introduced a hard-coded magic number into SelectWorkspacesDialog.h. In the SliceViewer your are NOT using a QDialog in a polymorphic way. Therefore you can introduce new methods onto SelectWorkspacesDialog to indicate that a custom button is being used.
- Remove static const int CustomButton = 45654
 - Add a const method to SelectWorkspaceDialog to indicate the state that you want instead. This should make https://github.com/mantidproject/mantid/blob/master/Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp#L2217:L219 a lot more readable.
 
Change History
Note: See
        TracTickets for help on using
        tickets.
    
Moved to R3.5 at the R3.4 code freeze