Skip to content

Commit

Permalink
Re #10474. Handle workspaces in DataController class.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jan 22, 2015
1 parent c0f1bcf commit fd9f3be
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 102 deletions.
Expand Up @@ -50,6 +50,7 @@ namespace CustomInterfaces
// Forward declarations
class PlotController;
class DatasetPlotData;
class DataController;

/**
* Class MultiDatasetFitDialog implements a dialog for setting up a multi-dataset fit
Expand Down Expand Up @@ -82,17 +83,11 @@ class MultiDatasetFit: public API::UserSubWindow
/// Check that the data sets in the table are valid
void checkDataSets();

signals:
void dataTableUpdated();

public slots:
void setLocalParameterValue(const QString& parName, int i, double value);
void reset();

private slots:
void addWorkspace();
void workspaceSelectionChanged();
void removeSelectedSpectra();
void fit();
void editLocalParameterValues(const QString& parName);
void finishFit(bool);
Expand All @@ -104,20 +99,20 @@ private slots:

private:
void createPlotToolbar();
void addWorkspaceSpectrum(const QString &wsName, int wsIndex);
boost::shared_ptr<Mantid::API::IFunction> createFunction() const;
void initLocalParameter(const QString& parName)const;
void updateParameters(const Mantid::API::IFunction& fun);
void showInfo(const QString& text);
bool eventFilter(QObject *widget, QEvent *evn);
void showFunctionBrowserInfo();
void showTableInfo();
void removeDataSets(std::vector<int>& rows);

/// The form generated by Qt Designer
Ui::MultiDatasetFit m_uiForm;
/// Controls the plot and plotted data.
PlotController *m_plotController;
/// Contains all logic of dealing with data sets.
DataController *m_dataController;
/// Function editor
MantidWidgets::FunctionBrowser *m_functionBrowser;
/// Name of the output workspace
Expand Down Expand Up @@ -218,7 +213,40 @@ private slots:
QString m_parName;
};

/*==========================================================================================*/
/**
* A class for controlling the plot widget and the displayed data.
*/
class DataController: public QObject
{
Q_OBJECT
public:
DataController(MultiDatasetFit *parent, QTableWidget *dataTable);
std::string getWorkspaceName(int i) const;
int getWorkspaceIndex(int i) const;
int getNumberOfSpectra() const;
void checkDataSets();

signals:
void dataTableUpdated();
void hasSelection(bool);

public slots:
private slots:
void addWorkspace();
void workspaceSelectionChanged();
void removeSelectedSpectra();
private:
MultiDatasetFit *owner() const {return static_cast<MultiDatasetFit*>(parent());}
void addWorkspaceSpectrum(const QString &wsName, int wsIndex);
void removeDataSets(std::vector<int>& rows);

/// Table with data set names and other data.
QTableWidget *m_dataTable;
};

} // CustomInterfaces
} // MantidQt


#endif /*MULTIDATASETFITDIALOG_H_*/

0 comments on commit fd9f3be

Please sign in to comment.