• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 30712882626

01 Aug 2026 06:35PM UTC coverage: 15.224% (-0.04%) from 15.263%
30712882626

Pull #2170

github

web-flow
Merge 03b0da44d into 3ceec338e
Pull Request #2170: Make the X11-dependent parts optional (gfx, vst3, linuxcheck)

30381 of 199565 relevant lines covered (15.22%)

1075.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

49.33
/src/plugins/score-plugin-scenario/Scenario/Document/Event/EventModel.cpp
1
// This is an open source non-commercial project. Dear PVS-Studio, please check
2
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
3
#include "EventModel.hpp"
4

5
#include <State/Expression.hpp>
6

7
#include <Process/Style/ScenarioStyle.hpp>
8
#include <Process/TimeValue.hpp>
9

10
#include <Scenario/Document/Event/ExecutionStatus.hpp>
11
#include <Scenario/Document/State/StateModel.hpp>
12
#include <Scenario/Document/TimeSync/TimeSyncModel.hpp>
13
#include <Scenario/Document/VerticalExtent.hpp>
14
#include <Scenario/Process/ScenarioInterface.hpp>
15

16
#include <score/document/DocumentInterface.hpp>
17
#include <score/model/IdentifiedObject.hpp>
18
#include <score/model/Identifier.hpp>
19
#include <score/model/ModelMetadata.hpp>
20

21
#include <QObject>
22

23
#include <wobjectimpl.h>
24
W_OBJECT_IMPL(Scenario::EventModel)
1,202✔
25
namespace Scenario
26
{
27
EventModel::EventModel(
57✔
28
    const Id<EventModel>& id, const Id<TimeSyncModel>& timesync, const TimeVal& date,
29
    QObject* parent)
30
    : Entity{id, Metadata<ObjectKey_k, EventModel>::get(), parent}
57✔
31
    , m_timeSync{timesync}
32
    , m_condition{}
33
    , m_date{date}
34
    , m_offset{OffsetBehavior::True}
35
{
57✔
36
  metadata().setInstanceName(*this);
57✔
37
  metadata().setColor(&score::Skin::Emphasis4);
57✔
38
}
×
39

40
void EventModel::changeTimeSync(const Id<TimeSyncModel>& elt)
57✔
41
{
42
  auto old = m_timeSync;
57✔
43
  m_timeSync = elt;
57✔
44
  timeSyncChanged(old, elt);
57✔
45
}
57✔
46

47
const TimeVal& EventModel::date() const noexcept
346✔
48
{
49
  return m_date;
346✔
50
}
51

52
void EventModel::setDate(const TimeVal& date)
18✔
53
{
54
  if(m_date != date)
18✔
55
  {
56
    m_date = date;
18✔
57
    dateChanged(m_date);
18✔
58
  }
18✔
59
}
18✔
60

61
void EventModel::setStatus(ExecutionStatus status, const ScenarioInterface& scenar)
×
62
{
63
  if(m_status.get() == status)
×
64
    return;
×
65

66
  m_status.set(status);
×
67
  statusChanged(status);
×
68

69
  for(auto& state : m_states)
×
70
  {
71
    scenar.state(state).setStatus(status);
×
72
  }
73
}
×
74

75
void EventModel::setOffsetBehavior(OffsetBehavior f)
×
76
{
77
  if(m_offset != f)
×
78
  {
79
    m_offset = f;
×
80
    offsetBehaviorChanged(f);
×
81
  }
×
82
}
×
83

84
const QBrush& EventModel::color(const Process::Style& skin) const noexcept
×
85
{
86
  if(m_status.get() == ExecutionStatus::Editing)
×
87
    return metadata().getColor().getBrush();
×
88
  else
89
    return m_status.eventStatusColor(skin);
×
90
}
×
91

92
void EventModel::translate(const TimeVal& deltaTime)
×
93
{
94
  setDate(m_date + deltaTime);
×
95
}
×
96

97
ExecutionStatus EventModel::status() const noexcept
×
98
{
99
  return m_status.get();
×
100
}
101

102
bool EventModel::active() const noexcept
×
103
{
104
  return m_condition.childCount() > 0;
×
105
}
106

107
void EventModel::addState(const Id<StateModel>& ds)
57✔
108
{
109
  if(ossia::contains(m_states, ds))
57✔
110
    return;
×
111
  m_states.push_back(ds);
57✔
112
  statesChanged();
57✔
113
}
57✔
114

115
void EventModel::removeState(const Id<StateModel>& ds)
1✔
116
{
117
  auto it = ossia::find(m_states, ds);
1✔
118
  if(it != m_states.end())
1✔
119
  {
120
    m_states.erase(it);
1✔
121
    statesChanged();
1✔
122
  }
1✔
123
}
1✔
124

125
void EventModel::clearStates()
×
126
{
127
  m_states.clear();
×
128
  statesChanged();
×
129
}
×
130

131
const EventModel::StateIdVec& EventModel::states() const noexcept
392✔
132
{
133
  return m_states;
392✔
134
}
135

136
const State::Expression& EventModel::condition() const noexcept
54✔
137
{
138
  return m_condition;
54✔
139
}
140

141
OffsetBehavior EventModel::offsetBehavior() const noexcept
2✔
142
{
143
  return m_offset;
2✔
144
}
145

146
void EventModel::setCondition(const State::Expression& arg)
×
147
{
148
  if(m_condition != arg)
×
149
  {
150
    m_condition = arg;
×
151
    conditionChanged(arg);
×
152
  }
×
153
}
×
154
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc