Skip to content

Commit

Permalink
GUI: Remove CONDITIONAL event visualization
Browse files Browse the repository at this point in the history
Since there's not yet INHIBIT gate,
CONDITIONAL event is phony and confusing.

Issue #29
Issue #132
  • Loading branch information
rakhimov committed Jan 31, 2018
1 parent 24c62ca commit 7e5cc38
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 55 deletions.
11 changes: 0 additions & 11 deletions gui/diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,6 @@ UndevelopedEvent::UndevelopedEvent(model::BasicEvent *event,
Event::setTypeGraphics(diamond);
}

ConditionalEvent::ConditionalEvent(model::BasicEvent *event,
QGraphicsItem *parent)
: Event(event, parent)
{
double d = int(m_size.height() - m_baseHeight) * units().height();
double minor = 0.70 * d;
Event::setTypeGraphics(new QGraphicsEllipseItem(-d / 2, 0, d, minor));
}

TransferIn::TransferIn(model::Gate *event, QGraphicsItem *parent)
: Event(event, parent)
{
Expand Down Expand Up @@ -192,8 +183,6 @@ Gate::Gate(model::Gate *event, model::Model *model,
return new BasicEvent(proxyEvent, m_parent);
case model::BasicEvent::Undeveloped:
return new UndevelopedEvent(proxyEvent, m_parent);
case model::BasicEvent::Conditional:
return new ConditionalEvent(proxyEvent, m_parent);
}
GUI_ASSERT(false && "Unexpected event flavor", nullptr);
}
Expand Down
9 changes: 0 additions & 9 deletions gui/diagram.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ class UndevelopedEvent : public Event
QGraphicsItem *parent = nullptr);
};

/// The event used in Inhibit gates.
class ConditionalEvent : public Event
{
public:
/// @copydoc Event::Event
explicit ConditionalEvent(model::BasicEvent *event,
QGraphicsItem *parent = nullptr);
};

/// An alias pointer to a gate.
class TransferIn : public Event
{
Expand Down
3 changes: 0 additions & 3 deletions gui/eventdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ EventDialog::EventDialog(mef::Model *model, QWidget *parent)
break;
case BasicEvent:
case Undeveloped:
case Conditional:
stackedWidgetType->setCurrentWidget(tabExpression);
break;
case Gate:
Expand Down Expand Up @@ -306,8 +305,6 @@ void EventDialog::setupData(const model::Gate &element)
->setRowHidden(ext::one_bit_index(HouseEvent), true);
static_cast<QListView *>(typeBox->view())
->setRowHidden(ext::one_bit_index(BasicEvent), true);
static_cast<QListView *>(typeBox->view())
->setRowHidden(ext::one_bit_index(Conditional), true);
static_cast<QListView *>(typeBox->view())
->setRowHidden(ext::one_bit_index(Undeveloped), true);
}
Expand Down
1 change: 0 additions & 1 deletion gui/eventdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class EventDialog : public QDialog, private Ui::EventDialog
HouseEvent = 1 << 0,
BasicEvent = 1 << 1,
Undeveloped = 1 << 2,
Conditional = 1 << 3,
Gate = 1 << 4
};

Expand Down
5 changes: 0 additions & 5 deletions gui/eventdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@
<string extracomment="The basic event flavor that indicates the further developement into a gate is possible.">Undeveloped</string>
</property>
</item>
<item>
<property name="text">
<string extracomment="Conditioning flavor for a basic event (used as a conditioning variable for conditional probabilities)">Conditional</string>
</property>
</item>
<item>
<property name="text">
<string extracomment="The intermediary w/ a Boolean formula as a definition. Defines the logic and interdependencies of the fault tree.">Gate</string>
Expand Down
12 changes: 0 additions & 12 deletions gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,6 @@ mef::BasicEventPtr MainWindow::extract(const EventDialog &dialog)
case EventDialog::Undeveloped:
basicEvent->AddAttribute({"flavor", "undeveloped", ""});
break;
case EventDialog::Conditional:
basicEvent->AddAttribute({"flavor", "conditional", ""});
break;
default:
GUI_ASSERT(false && "unexpected event type", nullptr);
}
Expand Down Expand Up @@ -1215,7 +1212,6 @@ void MainWindow::addElement()
break;
case EventDialog::BasicEvent:
case EventDialog::Undeveloped:
case EventDialog::Conditional:
m_undoStack->push(new model::Model::AddEvent<model::BasicEvent>(
extract<mef::BasicEvent>(dialog), m_guiModel.get()));
break;
Expand Down Expand Up @@ -1273,7 +1269,6 @@ void MainWindow::editElement(EventDialog *dialog, model::BasicEvent *element)
return;
case EventDialog::BasicEvent:
case EventDialog::Undeveloped:
case EventDialog::Conditional:
break;
case EventDialog::Gate:
m_undoStack->push(
Expand Down Expand Up @@ -1318,8 +1313,6 @@ void MainWindow::editElement(EventDialog *dialog, model::BasicEvent *element)
return EventDialog::BasicEvent;
case model::BasicEvent::Undeveloped:
return EventDialog::Undeveloped;
case model::BasicEvent::Conditional:
return EventDialog::Conditional;
}
assert(false);
};
Expand All @@ -1333,9 +1326,6 @@ void MainWindow::editElement(EventDialog *dialog, model::BasicEvent *element)
case EventDialog::Undeveloped:
return new model::BasicEvent::SetFlavor(
element, model::BasicEvent::Undeveloped);
case EventDialog::Conditional:
return new model::BasicEvent::SetFlavor(
element, model::BasicEvent::Conditional);
default:
GUI_ASSERT(false && "Unexpected event type", nullptr);
}
Expand All @@ -1351,7 +1341,6 @@ void MainWindow::editElement(EventDialog *dialog, model::HouseEvent *element)
break;
case EventDialog::BasicEvent:
case EventDialog::Undeveloped:
case EventDialog::Conditional:
m_undoStack->push(new model::Model::ChangeEventType<model::HouseEvent,
model::BasicEvent>(
element, extract<mef::BasicEvent>(*dialog), m_guiModel.get(),
Expand Down Expand Up @@ -1383,7 +1372,6 @@ void MainWindow::editElement(EventDialog *dialog, model::Gate *element)
return;
case EventDialog::BasicEvent:
case EventDialog::Undeveloped:
case EventDialog::Conditional:
m_undoStack->push(
new model::Model::ChangeEventType<model::Gate, model::BasicEvent>(
element, extract<mef::BasicEvent>(*dialog), m_guiModel.get(),
Expand Down
8 changes: 1 addition & 7 deletions gui/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ BasicEvent::BasicEvent(mef::BasicEvent *basicEvent)
{
if (basicEvent->HasAttribute("flavor")) {
const mef::Attribute &flavor = basicEvent->GetAttribute("flavor");
if (flavor.value == "undeveloped") {
if (flavor.value == "undeveloped")
m_flavor = Flavor::Undeveloped;
} else if (flavor.value == "conditional") {
m_flavor = Flavor::Conditional;
}
}
}

Expand Down Expand Up @@ -98,9 +95,6 @@ void BasicEvent::SetFlavor::redo()
case Undeveloped:
mefEvent->SetAttribute({"flavor", "undeveloped", ""});
break;
case Conditional:
mefEvent->SetAttribute({"flavor", "conditional", ""});
break;
}
m_basicEvent->m_flavor = m_flavor;
emit m_basicEvent->flavorChanged(m_flavor);
Expand Down
6 changes: 1 addition & 5 deletions gui/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class BasicEvent : public Element, public Proxy<BasicEvent, mef::BasicEvent>

public:
/// Basic event flavors.
enum Flavor { Basic = 0, Undeveloped, Conditional };
enum Flavor { Basic = 0, Undeveloped };

/// Converts a basic event flavor to a UI string.
static QString flavorToString(Flavor flavor)
Expand All @@ -193,10 +193,6 @@ class BasicEvent : public Element, public Proxy<BasicEvent, mef::BasicEvent>
return tr("Basic");
case Undeveloped:
return tr("Undeveloped");
case Conditional:
//: Actually, this is 'conditioning'
//: since the event is the condition for some sub-tree.
return tr("Conditional");
}
assert(false);
}
Expand Down
3 changes: 1 addition & 2 deletions gui/tests/testmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ void TestModel::testBasicEventFlavorToString()
using namespace gui::model;
TEST_EQ(BasicEvent::flavorToString(BasicEvent::Basic), "Basic");
TEST_EQ(BasicEvent::flavorToString(BasicEvent::Undeveloped), "Undeveloped");
TEST_EQ(BasicEvent::flavorToString(BasicEvent::Conditional), "Conditional");
}

void TestModel::testBasicEventSetFlavor()
Expand Down Expand Up @@ -462,7 +461,7 @@ void TestModel::testBasicEventConstructWithFlavor()
{
event.SetAttribute({"flavor", "conditional"});
QCOMPARE(gui::model::BasicEvent(&event).flavor(),
gui::model::BasicEvent::Conditional);
gui::model::BasicEvent::Basic);
}
}

Expand Down

0 comments on commit 7e5cc38

Please sign in to comment.