wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DolphinExporter Namespace Reference

Model → artifact conversions for the beWavedDolphin export paths. More...

Functions

static QChar cellChar (const int value)
QString csvText (const SignalModel *model)
void exportToPdf (const SignalModel *model, const PlotType plotType, const QString &fileName)
bool exportToPng (const SignalModel *model, const PlotType plotType, const QString &fileName)
QPixmap renderToPixmap (const SignalModel *model, const PlotType plotType, const int cellW, const int cellH)
void writeTruthTableText (QTextStream &out, const SignalModel *model, const int inputRowCount)

Detailed Description

Model → artifact conversions for the beWavedDolphin export paths.

No window or dialog state — every function takes a SignalModel and produces a pixmap, an image/PDF file, or text. The controller owns the file dialogs and (for the truth table) the simulation that fills the model before formatting.

Function Documentation

◆ cellChar()

QChar DolphinExporter::cellChar ( const int value)
static

One character per cell. The format writes cells with no separator, so every value must be exactly one character wide – a raw Status::Unknown (-1) would print as two and silently shift the column count, making the row unparseable. 'x' and 'E' follow the usual HDL convention for undefined and conflicting.

Definition at line 84 of file DolphinExporter.cpp.

Referenced by writeTruthTableText().

◆ csvText()

QString DolphinExporter::csvText ( const SignalModel * model)

Returns model encoded in the CSV-ish "rows,cols," + comma-separated values format used by the terminal (print) path.

Definition at line 115 of file DolphinExporter.cpp.

References SignalModel::value().

Referenced by BewavedDolphin::print().

◆ exportToPdf()

void DolphinExporter::exportToPdf ( const SignalModel * model,
PlotType plotType,
const QString & fileName )

Renders model with plotType and writes it to fileName as a landscape A4 PDF, scaled to fit the page. Throws if the PDF device cannot be opened.

Definition at line 58 of file DolphinExporter.cpp.

References PANDACEPTION_WITH_CONTEXT, and renderToPixmap().

◆ exportToPng()

bool DolphinExporter::exportToPng ( const SignalModel * model,
PlotType plotType,
const QString & fileName )

Renders model with plotType and saves it to fileName as a PNG. Returns true on success.

Definition at line 53 of file DolphinExporter.cpp.

References renderToPixmap().

Referenced by BewavedDolphin::exportToPng().

◆ renderToPixmap()

QPixmap DolphinExporter::renderToPixmap ( const SignalModel * model,
PlotType plotType,
int cellW,
int cellH )

Rasterizes model to a pixmap via a throwaway table view (the live view is untouched), using plotType for the cell rendering and cellW x cellH per cell.

Definition at line 26 of file DolphinExporter.cpp.

Referenced by exportToPdf(), and exportToPng().

◆ writeTruthTableText()

void DolphinExporter::writeTruthTableText ( QTextStream & out,
const SignalModel * model,
int inputRowCount )

Writes model to out as the truth-table text format: inputRowCount input rows, a blank line, then the output rows, each line followed by its : "label".

Definition at line 91 of file DolphinExporter.cpp.

References cellChar(), and SignalModel::value().

Referenced by BewavedDolphin::saveToTxt().