15#include <QStandardItemModel>
59 QWidget *parent =
nullptr);
98 void setCellValue(
const int row,
const int col,
const int value);
104 void prepare(
const QString &fileName = {});
114 void setLength(
const int simLength,
const bool runSimulation =
false);
132 int inputRow(
const QString &label)
const;
157 bool eventFilter(QObject *watched, QEvent *event)
override;
165 const SignalModel* model()
const {
return m_model; }
167 const QVector<GraphicElement *>& outputElements()
const {
return m_outputs; }
169 const QVector<GraphicElementInput *>& inputElements()
const {
return m_inputs; }
171 int length()
const {
return m_length; }
178 void associateToWiRedPanda(
const QString &fileName);
180 void load(
const QString &fileName);
182 void applyWaveformData(
const DolphinSerializer::WaveformData &fileData);
188 bool elementsStillLive()
const;
193 void loadFromTerminal();
196 void loadNewTable(
const QStringList &inputLabels,
const QStringList &outputLabels);
199 void applyToSelectedCells(
const std::function<
int(
int)> &valueFn);
203 std::pair<QList<QPair<int, int>>, QList<int>> snapshotCells(
const QModelIndexList &indexes)
const;
207 QModelIndexList allCellIndexes(
int rows,
int cols)
const;
215 void on_actionAboutQt_triggered();
216 void on_actionAbout_triggered();
217 void on_actionAutoCrop_triggered();
218 void on_actionClear_triggered();
219 void on_actionCombinational_triggered();
220 void on_actionCopy_triggered();
221 void on_actionCut_triggered();
222 void on_actionExit_triggered();
223 void on_actionExportToPdf_triggered();
224 void on_actionExportToPng_triggered();
225 void on_actionFitScreen_triggered();
226 void on_actionInvert_triggered();
227 void on_actionLoad_triggered();
228 void on_actionPaste_triggered();
229 void on_actionResetZoom_triggered();
230 void on_actionSaveAs_triggered();
231 void on_actionSave_triggered();
232 void on_actionSetClockWave_triggered();
233 void on_actionSetLength_triggered();
234 void on_actionSetTo0_triggered();
235 void on_actionSetTo1_triggered();
236 void on_actionShowNumbers_triggered();
237 void on_actionShowWaveforms_triggered();
238 void on_actionZoomIn_triggered();
239 void on_actionZoomOut_triggered();
240 void on_tableView_cellDoubleClicked();
241 void on_tableView_selectionChanged();
245 std::unique_ptr<BewavedDolphinUi> m_ui;
246 QUndoStack m_undoStack;
247 DolphinHost *m_host =
nullptr;
248 QFileInfo m_currentFile;
249 SignalModel *m_model =
nullptr;
250 QTableView *m_signalTableView =
new QTableView();
251 SignalDelegate *m_delegate =
nullptr;
252 QVector<GraphicElement *> m_outputs;
253 QVector<GraphicElementInput *> m_inputs;
254 QVector<Status> m_oldInputValues;
255 Scene *m_externalScene =
nullptr;
256 Simulation *m_simulation =
nullptr;
257 std::unique_ptr<WaveformSimulator> m_simDriver;
258 std::unique_ptr<DolphinZoom> m_zoom;
259 bool m_edited =
false;
260 const bool m_askConnection;
261 int m_clockPeriod = 0;
262 int m_inputPorts = 0;
264 ExerciseOverlay *m_exerciseOverlay =
nullptr;
BewavedDolphinUi: hand-written UI class for the BeWavedDolphin main window.
Main circuit editing scene with undo/redo and user interaction.
SignalDelegate: paints digital waveform graphics into table cells.
SignalModel for the beWavedDolphin waveform table.
Waveform editor main window for creating and analyzing digital signal sequences.
void print()
Prints the waveform table to the system printer.
int inputRow(const QString &label) const
Returns the input row index whose element label equals label, or -1 (MCP access).
void run()
Runs the simulation for all input combinations and fills output rows.
void createWaveform()
Initializes a blank waveform from the current scene's I/O elements.
~BewavedDolphin() override
QTableView * signalTableView() const
Returns the waveform table view (for tour target resolution).
void setExerciseOverlay(ExerciseOverlay *overlay)
void setCellValue(const int row, const int col, const int value)
Sets a single cell value in the waveform table.
QAction * actionCombinational() const
Returns the combinational action (for tour button spotlighting).
void prepare(const QString &fileName={})
Prepares the waveform from fileName (or blank if empty).
friend class TestBewavedDolphinGui
void saveToTxt(QTextStream &stream)
Exports the waveform data as plain text to stream.
WaveformSnapshot snapshot(int duration) const
Returns the input/output signals over the first duration columns (MCP access).
bool exportToPng(const QString &filename)
Exports the waveform scene to a PNG image file.
QToolBar * mainToolBar() const
Returns the main toolbar (for tour target resolution).
void show()
Shows the window and loads the initial waveform.
void resizeEvent(QResizeEvent *event) override
bool eventFilter(QObject *watched, QEvent *event) override
void triggerCombinational()
Triggers the combinational input-pattern generator (for tour automation).
void closeEvent(QCloseEvent *event) override
BewavedDolphin(Scene *scene, const bool askConnection=true, DolphinHost *host=nullptr, QWidget *parent=nullptr)
Constructs the waveform editor.
void setLength(const int simLength, const bool runSimulation=false)
Sets the number of time-step columns.
Interface the host application (MainWindow) provides to BewavedDolphin.
Owns the waveform table's zoom state and the math that maps it to view metrics.
Semi-transparent overlay displayed at the bottom of the canvas during a circuit exercise.
Main circuit editing scene.
QStandardItemModel subclass that makes all cells non-editable.
Pure I/O functions for the beWavedDolphin waveform file formats.
A labelled waveform signal: a row label and its per-column 0/1 values.
QVector< int > values
Per-column logic values.
QString label
The signal's display label.