diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h index d9329f7144829ae550b54e047e56440b3d27c514..d1a4d3042e628ec26e154f221037afcc1e25f6f9 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.h @@ -80,9 +80,9 @@ namespace CustomInterfaces void setAvailablePeriods(const std::vector<std::string> &periods); void setTimeLimits(double tMin, double tMax); void setTimeRange (double tMin, double tMax); - void setWaitingCursor(); - void restoreCursor(); void help(); + void disableAll(); + void enableAll(); // -- End of IALCDataLoadingView interface ----------------------------------------------------- diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui index e42aeb104219368d0f519ce7ff6cef8d6a03773c..b99c1ebe7740a26e855601f7225a099e9c69852f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingView.ui @@ -383,7 +383,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> + <widget class="QGroupBox" name="calculationGroup"> <property name="title"> <string>Calculation</string> </property> diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h index 3c0ac04337d569a3eb59e1d323853755edc1721a..43c9bf2e2182991fd9f416eb280fe0c1c657127f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h @@ -119,15 +119,15 @@ namespace CustomInterfaces /// @param tMax :: Maximum X value available virtual void setTimeRange(double tMin, double tMax) = 0; - /// Set waiting cursor for long operation - virtual void setWaitingCursor() = 0; - - /// Restore the original cursor - virtual void restoreCursor() = 0; - /// Opens the Mantid Wiki web page virtual void help() = 0; + /// Disables all the widgets + virtual void disableAll() = 0; + + /// Enables all the widgets + virtual void enableAll() = 0; + signals: /// Request to load data void loadRequested(); diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp index 8f56ec1b0f6dda9ee3a374c3f34150efedfbb044..fd6b1326b51c74c93e0bb75c553d573bc568abfd 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp @@ -36,7 +36,7 @@ namespace CustomInterfaces void ALCDataLoadingPresenter::load() { - m_view->setWaitingCursor(); + m_view->disableAll(); try { @@ -116,7 +116,7 @@ namespace CustomInterfaces m_view->displayError(e.what()); } - m_view->restoreCursor(); + m_view->enableAll(); } void ALCDataLoadingPresenter::updateAvailableInfo() diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp index f2e6c9712f4cc86af3f1eea2f66670ae8ed47cac..7f1d5b578649dac18e4272bd25866676717e0341 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingView.cpp @@ -40,6 +40,18 @@ namespace CustomInterfaces m_dataCurve->setSymbol(QwtSymbol(QwtSymbol::Ellipse, QBrush(), QPen(), QSize(7,7))); m_dataCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true); m_dataCurve->attach(m_ui.dataPlot); + + // The following lines disable the groups' titles when the + // group is disabled + QPalette palette; + palette.setColor(QPalette::Disabled, QPalette::WindowText, + QApplication::palette().color(QPalette::Disabled, + QPalette::WindowText)); + m_ui.dataGroup->setPalette(palette); + m_ui.deadTimeGroup->setPalette(palette); + m_ui.detectorGroupingGroup->setPalette(palette); + m_ui.periodsGroup->setPalette(palette); + m_ui.calculationGroup->setPalette(palette); } std::string ALCDataLoadingView::firstRun() const @@ -221,14 +233,28 @@ namespace CustomInterfaces MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); } - void ALCDataLoadingView::setWaitingCursor() - { - QApplication::setOverrideCursor(Qt::WaitCursor); + void ALCDataLoadingView::disableAll() { + + // Disable all the widgets in the view + m_ui.dataGroup->setEnabled(false); + m_ui.deadTimeGroup->setEnabled(false); + m_ui.detectorGroupingGroup->setEnabled(false); + m_ui.periodsGroup->setEnabled(false); + m_ui.calculationGroup->setEnabled(false); + m_ui.load->setEnabled(false); + } - void ALCDataLoadingView::restoreCursor() - { - QApplication::restoreOverrideCursor(); + void ALCDataLoadingView::enableAll() { + + // Enable all the widgets in the view + m_ui.deadTimeGroup->setEnabled(true); + m_ui.dataGroup->setEnabled(true); + m_ui.detectorGroupingGroup->setEnabled(true); + m_ui.periodsGroup->setEnabled(true); + m_ui.calculationGroup->setEnabled(true); + m_ui.load->setEnabled(true); + } } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h index 86e42f3506fdad1ff4d89b1275cabaa82ce0b8a3..ff393f001040ee9c575bd02765bea5c3457bebce 100644 --- a/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h +++ b/MantidQt/CustomInterfaces/test/ALCDataLoadingPresenterTest.h @@ -51,8 +51,8 @@ public: MOCK_METHOD1(setAvailablePeriods, void(const std::vector<std::string>&)); MOCK_METHOD2(setTimeLimits, void(double,double)); MOCK_METHOD2(setTimeRange, void(double,double)); - MOCK_METHOD0(setWaitingCursor, void()); - MOCK_METHOD0(restoreCursor, void()); + MOCK_METHOD0(disableAll, void()); + MOCK_METHOD0(enableAll, void()); MOCK_METHOD0(help, void()); void requestLoading() { emit loadRequested(); } @@ -116,7 +116,7 @@ public: void test_defaultLoad() { InSequence s; - EXPECT_CALL(*m_view, setWaitingCursor()); + EXPECT_CALL(*m_view, disableAll()); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3), QwtDataX(0, 1350, 1E-8), @@ -130,7 +130,7 @@ public: VectorValue(1,1.284E-3,1E-6), VectorValue(2,1.280E-3,1E-6)))); - EXPECT_CALL(*m_view, restoreCursor()); + EXPECT_CALL(*m_view, enableAll()); m_view->requestLoading(); } @@ -232,7 +232,7 @@ public: ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromRunData")); EXPECT_CALL(*m_view, deadTimeType()).Times(2); EXPECT_CALL(*m_view, deadTimeFile()).Times(0); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size,3), QwtDataY(0, 0.150616, 1E-3), QwtDataY(1, 0.143444, 1E-3), @@ -251,7 +251,7 @@ public: ON_CALL(*m_view, deadTimeType()).WillByDefault(Return("FromSpecifiedFile")); EXPECT_CALL(*m_view, deadTimeType()).Times(2); EXPECT_CALL(*m_view, deadTimeFile()).Times(1); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); m_view->requestLoading(); } @@ -264,7 +264,7 @@ public: ON_CALL(*m_view, getBackwardGrouping()).WillByDefault(Return("1-32")); EXPECT_CALL(*m_view, getForwardGrouping()).Times(1); EXPECT_CALL(*m_view, getBackwardGrouping()).Times(1); - EXPECT_CALL(*m_view, restoreCursor()).Times(1); + EXPECT_CALL(*m_view, enableAll()).Times(1); EXPECT_CALL(*m_view, setDataCurve(AllOf(Property(&QwtData::size, 3), QwtDataX(0, 1350, 1E-8), QwtDataX(1, 1360, 1E-8),