@@ -32,127 +32,125 @@ const ItemStateTable::ID ItemStateTable::sm_Invalid_Id = static_cast<ItemStateTa
32
32
33
33
bool ItemState::operator ==(const ItemState &other) const
34
34
{
35
- return (state== other.state && activity== other.activity );
35
+ return (state == other.state && activity == other.activity );
36
36
}
37
37
38
38
// //////////////////////////////////////////////////////////////////////////////
39
39
40
40
bool ItemState::operator !=(const ItemState &other) const
41
41
{
42
- return (state!= other.state || activity!= other.activity );
42
+ return (state != other.state || activity != other.activity );
43
43
}
44
44
45
45
// //////////////////////////////////////////////////////////////////////////////
46
46
47
47
void ItemState::GetStateName (EnumState state, QString &name)
48
48
{
49
- switch ( state )
50
- {
51
- case STATE_UNINITIALIZED: name= qApp->tr (" ..." ); return ;
52
- case STATE_CONNECTING: name= qApp->tr (" Connecting..." ); return ;
53
- case STATE_CONNECTED: name= qApp->tr (" Running" ); return ;
54
- case STATE_NOT_CONNECTED: name= qApp->tr (" Not Running" ); return ;
55
- }
56
-
57
- name = QString ();
49
+ switch ( state)
50
+ {
51
+ case STATE_UNINITIALIZED: name = qApp->tr (" ..." ); return ;
52
+ case STATE_CONNECTING: name = qApp->tr (" Connecting..." ); return ;
53
+ case STATE_CONNECTED: name = qApp->tr (" Running" ); return ;
54
+ case STATE_NOT_CONNECTED: name = qApp->tr (" Not Running" ); return ;
55
+ }
56
+
57
+ name = QString ();
58
58
}
59
59
60
60
// //////////////////////////////////////////////////////////////////////////////
61
61
62
62
void ItemState::GetStateColor (EnumState state, QColor &color)
63
63
{
64
- switch ( state )
65
- {
66
- case STATE_CONNECTING: color= WARNING_COLOR; return ;
67
- case STATE_CONNECTED: color= SUCCESS_COLOR; return ;
68
- case STATE_NOT_CONNECTED: color= ERROR_COLOR; return ;
69
- }
70
-
71
- color = MUTED_COLOR;
64
+ switch ( state)
65
+ {
66
+ case STATE_CONNECTING: color = WARNING_COLOR; return ;
67
+ case STATE_CONNECTED: color = SUCCESS_COLOR; return ;
68
+ case STATE_NOT_CONNECTED: color = ERROR_COLOR; return ;
69
+ }
70
+
71
+ color = MUTED_COLOR;
72
72
}
73
73
74
74
// //////////////////////////////////////////////////////////////////////////////
75
75
76
76
ItemStateTable::ItemStateTable ()
77
- : m_Dirty(false )
77
+ : m_Dirty(false )
78
78
{
79
79
}
80
80
81
81
// //////////////////////////////////////////////////////////////////////////////
82
82
83
83
void ItemStateTable::Clear ()
84
84
{
85
- m_List.clear ();
86
- m_Dirty = false ;
85
+ m_List.clear ();
86
+ m_Dirty = false ;
87
87
}
88
88
89
89
// //////////////////////////////////////////////////////////////////////////////
90
90
91
91
void ItemStateTable::Reset ()
92
92
{
93
- for (LIST::iterator i= m_List.begin (); i!= m_List.end (); i++)
94
- i->activity = i->dirty = false ;
95
- m_Dirty = false ;
93
+ for (LIST::iterator i = m_List.begin (); i != m_List.end (); i++)
94
+ i->activity = i->dirty = false ;
95
+ m_Dirty = false ;
96
96
}
97
97
98
98
// //////////////////////////////////////////////////////////////////////////////
99
99
100
100
void ItemStateTable::Deactivate ()
101
101
{
102
- ItemState deactivated;
103
- for (ID i= 0 ; i< m_List.size (); i++)
104
- Update (i, deactivated);
102
+ ItemState deactivated;
103
+ for (ID i = 0 ; i < m_List.size (); i++)
104
+ Update (i, deactivated);
105
105
}
106
106
107
107
// //////////////////////////////////////////////////////////////////////////////
108
108
109
109
void ItemStateTable::Flush (ItemStateTable &other)
110
110
{
111
- if ( other.m_Dirty )
112
- {
113
- for (ID i= 0 ; i< other.m_List .size (); i++)
114
- {
115
- ItemState &otherItemState = other.m_List [i];
116
- Update (i, otherItemState);
117
- otherItemState.dirty = false ;
118
- otherItemState.activity = false ;
119
- }
120
-
121
- other.m_Dirty = false ;
122
- }
111
+ if ( other.m_Dirty )
112
+ {
113
+ for (ID i = 0 ; i < other.m_List .size (); i++)
114
+ {
115
+ ItemState &otherItemState = other.m_List [i];
116
+ Update (i, otherItemState);
117
+ otherItemState.dirty = false ;
118
+ otherItemState.activity = false ;
119
+ }
120
+
121
+ other.m_Dirty = false ;
122
+ }
123
123
}
124
124
125
125
// //////////////////////////////////////////////////////////////////////////////
126
126
127
127
ItemStateTable::ID ItemStateTable::Register ()
128
128
{
129
- m_List.push_back ( ItemState () );
130
- return (m_List.size () - 1 );
129
+ m_List.push_back (ItemState ());
130
+ return (m_List.size () - 1 );
131
131
}
132
132
133
133
// //////////////////////////////////////////////////////////////////////////////
134
134
135
135
void ItemStateTable::Update (ID id, const ItemState &state)
136
136
{
137
- if (id < m_List.size ())
138
- {
139
- ItemState &itemState = m_List[id];
140
- if (itemState != state)
141
- {
142
- itemState = state;
143
- itemState.dirty = true ;
144
- m_Dirty = true ;
145
- }
146
- }
137
+ if (id < m_List.size ())
138
+ {
139
+ ItemState &itemState = m_List[id];
140
+ if (itemState != state)
141
+ {
142
+ itemState = state;
143
+ itemState.dirty = true ;
144
+ m_Dirty = true ;
145
+ }
146
+ }
147
147
}
148
148
149
149
// //////////////////////////////////////////////////////////////////////////////
150
150
151
- const ItemState* ItemStateTable::GetItemState (ID id) const
151
+ const ItemState * ItemStateTable::GetItemState (ID id) const
152
152
{
153
- return ((id<m_List.size ())
154
- ? (&(m_List[id]))
155
- : 0 );
153
+ return ((id < m_List.size ()) ? (&(m_List[id])) : 0 );
156
154
}
157
155
158
156
// //////////////////////////////////////////////////////////////////////////////
0 commit comments