MCPcopy Create free account
hub / github.com/Vector35/debugger / notifyViewChanged

Method notifyViewChanged

ui/statusbar.cpp:184–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183
184void DebuggerStatusBarContainer::notifyViewChanged(ViewFrame* frame)
185{
186 // The "no active view" message widget is always located at index 0. If the
187 // frame passed is nullptr, show it.
188 if (!frame)
189 {
190 m_consoleStack->setCurrentIndex(0);
191 m_currentFrame = nullptr;
192
193 return;
194 }
195
196 // The notifyViewChanged event can fire multiple times for the same frame
197 // even if there is no apparent change. Compare the new frame to the
198 // current one before continuing to avoid unnecessary work.
199 if (frame == m_currentFrame)
200 return;
201 m_currentFrame = frame;
202
203 // Get the appropriate DebuggerConsole for this ViewFrame, or create a new one if it
204 // doesn't yet exist. The default value for non-existent keys of pointer
205 // types in Qt containers is nullptr, which allows this logic below to work.
206 auto* currentConsole = m_consoleMap.value(frame);
207 if (!currentConsole)
208 {
209 currentConsole = new DebuggerStatusBarWidget(this, frame, frame->getCurrentBinaryView());
210
211 // DockWidgets related to a ViewFrame are automatically cleaned up as
212 // part of the ViewFrame destructor. To ensure there is never a DebuggerConsole
213 // for a non-existent ViewFrame, the cleanup must be configured manually.
214 connect(frame, &QObject::destroyed, this, &DebuggerStatusBarContainer::freeDebuggerConsoleForView);
215
216 m_consoleMap.insert(frame, currentConsole);
217 m_consoleStack->addWidget(currentConsole);
218 }
219
220 m_consoleStack->setCurrentWidget(currentConsole);
221}

Callers 1

SetActiveFrameMethod · 0.45

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected