|
wiRedPanda
Logic Circuit Simulator
|
Waveform editor main window for creating and analyzing digital signal sequences. More...
#include <BeWavedDolphin.h>
Classes | |
| struct | Signal |
| A labelled waveform signal: a row label and its per-column 0/1 values. More... | |
| struct | WaveformSnapshot |
| A read-only snapshot of the computed waveform, for automation/export consumers. More... | |
Public Member Functions | |
| QAction * | actionCombinational () const |
| Returns the combinational action (for tour button spotlighting). | |
| BewavedDolphin (Scene *scene, const bool askConnection=true, DolphinHost *host=nullptr, QWidget *parent=nullptr) | |
| Constructs the waveform editor. | |
| void | createWaveform () |
| Initializes a blank waveform from the current scene's I/O elements. | |
| void | createWaveform (const QString &fileName) |
| Initializes the waveform from fileName if it matches the current circuit. | |
| bool | exportToPng (const QString &filename) |
| Exports the waveform scene to a PNG image file. | |
| int | inputRow (const QString &label) const |
| Returns the input row index whose element label equals label, or -1 (MCP access). | |
| QToolBar * | mainToolBar () const |
| Returns the main toolbar (for tour target resolution). | |
| void | prepare (const QString &fileName={}) |
| Prepares the waveform from fileName (or blank if empty). | |
| void | print () |
| Prints the waveform table to the system printer. | |
| void | run () |
| Runs the simulation for all input combinations and fills output rows. | |
| void | saveToTxt (QTextStream &stream) |
| Exports the waveform data as plain text to stream. | |
| void | setCellValue (const int row, const int col, const int value) |
| Sets a single cell value in the waveform table. | |
| void | setExerciseOverlay (ExerciseOverlay *overlay) |
| void | setLength (const int simLength, const bool runSimulation=false) |
| Sets the number of time-step columns. | |
| void | show () |
| Shows the window and loads the initial waveform. | |
| QTableView * | signalTableView () const |
| Returns the waveform table view (for tour target resolution). | |
| WaveformSnapshot | snapshot (int duration) const |
| Returns the input/output signals over the first duration columns (MCP access). | |
| void | triggerCombinational () |
| Triggers the combinational input-pattern generator (for tour automation). | |
| ~BewavedDolphin () override | |
Protected Member Functions | |
| void | closeEvent (QCloseEvent *event) override |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| void | resizeEvent (QResizeEvent *event) override |
Friends | |
| class | TestBewavedDolphinGui |
Waveform editor main window for creating and analyzing digital signal sequences.
BewavedDolphin displays a table where rows represent circuit I/O signals and columns represent simulation time steps. Users can set input values and then run the associated wiRedPanda circuit to observe output responses. The waveform can be saved to a .dolphin file, printed, or exported to PDF/PNG.
A subset of methods is also accessible via the MCP server for automated testing.
Definition at line 42 of file BeWavedDolphin.h.
|
explicit |
Constructs the waveform editor.
| scene | Circuit scene whose I/O elements will be mapped to signals. |
| askConnection | If true, closing prompts to save unsaved changes (checkSave()). |
| host | Host application providing the circuit file context (a MainWindow in the app; a stub in tests). May be nullptr. |
| parent | Widget to parent this window to, so its Qt::WindowModal setting (see the constructor body) actually blocks it — separate from host since tests pass a non-QWidget stub host. May be nullptr. |
Definition at line 41 of file BeWavedDolphin.cpp.
References Settings::dolphinGeometry(), and Settings::labelsUnderIcons().
|
override |
Definition at line 116 of file BeWavedDolphin.cpp.
References Settings::setDolphinGeometry().
| QAction * BewavedDolphin::actionCombinational | ( | ) | const |
Returns the combinational action (for tour button spotlighting).
Definition at line 373 of file BeWavedDolphin.cpp.
|
overrideprotected |
Definition at line 343 of file BeWavedDolphin.cpp.
| void BewavedDolphin::createWaveform | ( | ) |
Initializes a blank waveform from the current scene's I/O elements.
Definition at line 155 of file BeWavedDolphin.cpp.
References prepare().
Referenced by ExportController::exportToWaveFormFile(), and ExportController::exportToWaveFormTerminal().
| void BewavedDolphin::createWaveform | ( | const QString & | fileName | ) |
Initializes the waveform from fileName if it matches the current circuit.
| fileName | Path to an existing .dolphin file. |
Definition at line 121 of file BeWavedDolphin.cpp.
|
overrideprotected |
Definition at line 311 of file BeWavedDolphin.cpp.
| bool BewavedDolphin::exportToPng | ( | const QString & | filename | ) |
Exports the waveform scene to a PNG image file.
| filename | Output file path. |
true on success. Definition at line 517 of file BeWavedDolphin.cpp.
References DolphinExporter::exportToPng().
| int BewavedDolphin::inputRow | ( | const QString & | label | ) | const |
Returns the input row index whose element label equals label, or -1 (MCP access).
Definition at line 413 of file BeWavedDolphin.cpp.
| QToolBar * BewavedDolphin::mainToolBar | ( | ) | const |
Returns the main toolbar (for tour target resolution).
Definition at line 368 of file BeWavedDolphin.cpp.
| void BewavedDolphin::prepare | ( | const QString & | fileName = {} | ) |
Prepares the waveform from fileName (or blank if empty).
| fileName | Optional .dolphin file to load. |
Definition at line 170 of file BeWavedDolphin.cpp.
References DolphinModelBuilder::collect(), and qCDebug.
Referenced by createWaveform(), and createWaveform().
| void BewavedDolphin::print | ( | ) |
Prints the waveform table to the system printer.
Definition at line 459 of file BeWavedDolphin.cpp.
References DolphinExporter::csvText().
Referenced by ExportController::exportToWaveFormFile(), and ExportController::exportToWaveFormTerminal().
|
overrideprotected |
Definition at line 355 of file BeWavedDolphin.cpp.
| void BewavedDolphin::run | ( | ) |
Runs the simulation for all input combinations and fills output rows.
Definition at line 278 of file BeWavedDolphin.cpp.
References qCDebug, and WaveformSimulator::restoreInputs().
Referenced by createWaveform(), and setLength().
| void BewavedDolphin::saveToTxt | ( | QTextStream & | stream | ) |
Exports the waveform data as plain text to stream.
| stream | Destination text stream. |
Definition at line 469 of file BeWavedDolphin.cpp.
References DolphinEdits::combinational(), SignalModel::kMaxColumns, PANDACEPTION, WaveformSimulator::restoreInputs(), SignalModel::setValue(), SignalModel::value(), and DolphinExporter::writeTruthTableText().
| void BewavedDolphin::setCellValue | ( | const int | row, |
| const int | col, | ||
| const int | value ) |
Sets a single cell value in the waveform table.
| row | Signal row index. |
| col | Time-step column index. |
| value | Logical value (0 or 1). |
Definition at line 406 of file BeWavedDolphin.cpp.
| void BewavedDolphin::setExerciseOverlay | ( | ExerciseOverlay * | overlay | ) |
Registers overlay so it is repositioned whenever the window is resized. Pass nullptr to detach. Does not take ownership.
Definition at line 363 of file BeWavedDolphin.cpp.
| void BewavedDolphin::setLength | ( | const int | simLength, |
| const bool | runSimulation = false ) |
Sets the number of time-step columns.
| simLength | Number of columns. |
| runSimulation | If true, immediately re-runs the simulation. |
Definition at line 667 of file BeWavedDolphin.cpp.
References DolphinEdits::growInputColumns(), qCDebug, and run().
| void BewavedDolphin::show | ( | ) |
Shows the window and loads the initial waveform.
Definition at line 453 of file BeWavedDolphin.cpp.
|
inline |
Returns the waveform table view (for tour target resolution).
Definition at line 141 of file BeWavedDolphin.h.
| BewavedDolphin::WaveformSnapshot BewavedDolphin::snapshot | ( | int | duration | ) | const |
Returns the input/output signals over the first duration columns (MCP access).
Definition at line 424 of file BeWavedDolphin.cpp.
References BewavedDolphin::WaveformSnapshot::inputs, BewavedDolphin::Signal::label, BewavedDolphin::WaveformSnapshot::outputs, and BewavedDolphin::Signal::values.
| void BewavedDolphin::triggerCombinational | ( | ) |
Triggers the combinational input-pattern generator (for tour automation).
Definition at line 378 of file BeWavedDolphin.cpp.
|
friend |
Definition at line 45 of file BeWavedDolphin.h.
References TestBewavedDolphinGui.
Referenced by TestBewavedDolphinGui.