Skip to content

Commit

Permalink
refs #3641. Fix enum usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Nov 7, 2011
1 parent a5f2d33 commit d4bd24c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MantidQt
{

/// Enum type to indicate requsts issued by the log view.
enum LogViewStatus{no_change=0, cancelling, saving, switching_mode};
enum LogViewStatus{no_change=0, cancelling_mode, saving_mode, switching_mode};
/// Map type linking a log name to a log value.
typedef std::map<std::string, std::string> LogDataMap;

Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/EditableLogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace MantidQt
layout->addWidget(btnOK);
this->setLayout(layout);
//Clean/reset output result.
m_status = LogViewStatus::no_change;
m_status = no_change;
}

/** Getter for the log data.
Expand All @@ -120,14 +120,14 @@ namespace MantidQt
void EditableLogView::cancel()
{
//Remove any new logs!
m_status = LogViewStatus::cancelling;
m_status = cancelling_mode;
m_presenter->update();
}

/// Listener for the edit button click event.
void EditableLogView::ok()
{
m_status = LogViewStatus::saving;
m_status = saving_mode;
m_presenter->update();
}

Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/LogPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ namespace MantidQt
std::vector<AbstractMementoItem_sptr> existingLogData = service.getLogData();

//Swap the views.
if(LogViewStatus::switching_mode == viewStatus)
if(switching_mode == viewStatus)
{
swapViews();
}
else if(LogViewStatus::cancelling == viewStatus)
else if(cancelling_mode == viewStatus)
{
std::vector<AbstractMementoItem_sptr>::iterator it = existingLogData.begin();
while(it != existingLogData.end())
Expand All @@ -75,7 +75,7 @@ namespace MantidQt
}
swapViews();
}
else if(LogViewStatus::saving == viewStatus)
else if(saving_mode == viewStatus)
{
LogDataMap logValues = m_currentView->getLogData();
size_t proposedSize = logValues.size();
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/StandardLogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace MantidQt
namespace CustomInterfaces
{
/// Constructor
StandardLogView::StandardLogView(boost::shared_ptr<LogPresenter> presenter) : m_presenter(presenter), m_status(LogViewStatus::no_change)
StandardLogView::StandardLogView(boost::shared_ptr<LogPresenter> presenter) : m_presenter(presenter), m_status(no_change)
{
presenter->acceptReadOnlyView(this);
}
Expand Down Expand Up @@ -63,7 +63,7 @@ namespace MantidQt
layout->addWidget(m_tableWidget);
layout->addWidget(btnEdit);
this->setLayout(layout);
m_status = LogViewStatus::no_change;
m_status = no_change;
}

/** Getter for the log data.
Expand Down Expand Up @@ -92,7 +92,7 @@ namespace MantidQt
/// Listener for the edit button click event.
void StandardLogView::edited()
{
m_status = LogViewStatus::switching_mode;
m_status = switching_mode;
m_presenter->update();
}

Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/MantidQt/CustomInterfaces/test/LogPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class LogPresenterTest : public CxxTest::TestSuite

MockLogView view;
EXPECT_CALL(view, initalize(_)).Times(AtLeast(1));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(LogViewStatus::cancelling)); //No change to status, but log value data is now different.
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(cancelling_mode)); //No change to status, but log value data is now different.
EXPECT_CALL(view, show()).Times(AnyNumber());
EXPECT_CALL(view, hide()).Times(AnyNumber());

Expand Down Expand Up @@ -203,7 +203,7 @@ class LogPresenterTest : public CxxTest::TestSuite

MockLogView view;
EXPECT_CALL(view, initalize(_)).Times(AtLeast(1));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(LogViewStatus::cancelling));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(cancelling_mode));
EXPECT_CALL(view, show()).Times(AnyNumber());
EXPECT_CALL(view, hide()).Times(AnyNumber());
WorkspaceMemento* wsMemento = makeMemento();
Expand Down Expand Up @@ -250,7 +250,7 @@ class LogPresenterTest : public CxxTest::TestSuite
MockLogView view;
EXPECT_CALL(view, initalize(_)).Times(AtLeast(1));
EXPECT_CALL(view, getLogData()).WillOnce(Return(logs));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(LogViewStatus::saving)); //No change to status, but log value data is now different.
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(saving_mode)); //No change to status, but log value data is now different.
EXPECT_CALL(view, show()).Times(AnyNumber());
EXPECT_CALL(view, hide()).Times(AnyNumber());

Expand Down Expand Up @@ -303,7 +303,7 @@ class LogPresenterTest : public CxxTest::TestSuite
MockLogView view;
EXPECT_CALL(view, initalize(_)).Times(AtLeast(1));
EXPECT_CALL(view, getLogData()).WillOnce(Return(logs));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(LogViewStatus::saving));
EXPECT_CALL(view, fetchStatus()).WillOnce(Return(saving_mode));
EXPECT_CALL(view, show()).Times(AnyNumber());
EXPECT_CALL(view, hide()).Times(AnyNumber());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void testOtherConstructor()
{
WorkspaceMementoItem<std::string> a(ws, Row(0), Column(2), true);
TS_ASSERT_EQUALS("val", a.getValue());
TS_ASSERT("New definition was set to true in constructor", true == a.getIsNewDefinition());
TSM_ASSERT("New definition was set to true in constructor", true == a.getIsNewDefinition());
}

void testEqualsThrows()
Expand Down

0 comments on commit d4bd24c

Please sign in to comment.