6#include <QDesktopServices>
8#include <QLoggingCategory>
32 auto *tab = m_host.currentTab();
37 if (fileName.isEmpty()) {
41 auto elements = tab->scene()->elements();
43 if (elements.isEmpty()) {
51 if (!fileName.endsWith(
".ino")) {
52 fileName.append(
".ino");
55 ArduinoCodeGen arduino(QDir::home().absoluteFilePath(fileName), elements);
57 m_host.showStatusMessage(tr(
"Arduino code successfully generated."), 4000);
59 qCDebug(zero) <<
"Arduino code successfully generated.";
64 auto *tab = m_host.currentTab();
69 if (fileName.isEmpty()) {
73 auto elements = tab->scene()->elements();
75 if (elements.isEmpty()) {
81 if (!fileName.endsWith(
".sv")) {
82 fileName.append(
".sv");
87 m_host.showStatusMessage(tr(
"SystemVerilog code successfully generated."), 4000);
89 qCDebug(zero) <<
"SystemVerilog code successfully generated.";
94 if (fileName.isEmpty()) {
100 BewavedDolphin bewavedDolphin(m_host.currentTab()->scene(),
false, m_host.dolphinHost());
102 bewavedDolphin.
print();
107 BewavedDolphin bewavedDolphin(m_host.currentTab()->scene(),
false, m_host.dolphinHost());
109 bewavedDolphin.
print();
116 if (!m_host.currentTab()) {
122 if (m_host.currentFile().exists()) {
123 path = m_host.currentFile().absolutePath();
128 if (!fileName.isEmpty()) {
138 if (!m_host.currentTab()) {
144 if (m_host.currentFile().exists()) {
145 path = m_host.currentFile().absolutePath();
150 if (!fileName.isEmpty()) {
160 auto *tab = m_host.currentTab();
166 tab->scene()->clearSelection();
168 const QString path = m_host.currentFile().exists() ? m_host.currentFile().absolutePath() : QString();
171 if (pdfFile.isEmpty()) {
175 if (!pdfFile.endsWith(
".pdf", Qt::CaseInsensitive)) {
176 pdfFile.append(
".pdf");
180 m_host.showStatusMessage(tr(
"Exported file successfully."), 4000);
181 QDesktopServices::openUrl(QUrl::fromLocalFile(pdfFile));
189 auto *tab = m_host.currentTab();
195 tab->scene()->clearSelection();
197 const QString path = m_host.currentFile().exists() ? m_host.currentFile().absolutePath() : QString();
200 if (pngFile.isEmpty()) {
204 if (!pngFile.endsWith(
".png", Qt::CaseInsensitive)) {
205 pngFile.append(
".png");
209 m_host.showStatusMessage(tr(
"Exported file successfully."), 4000);
210 QDesktopServices::openUrl(QUrl::fromLocalFile(pngFile));
Custom QApplication subclass with exception handling and main-window access.
Arduino sketch code generator: translates a circuit into an uploadable .ino file.
BewavedDolphin waveform editor: digital signal creation, display, and export.
CircuitExporter: render a Scene to PDF or PNG image.
Common logging utilities, the Pandaception error type, and helper macros.
#define PANDACEPTION(msg,...)
#define qCDebug(category)
ExportController: orchestrates exporting the current circuit to its output formats.
Abstract file dialog interface for testability.
MainWindowHost: the application context that MainWindow's extracted controllers depend on.
Main circuit editing scene with undo/redo and user interaction.
Lightweight Sentry helpers gated behind HAVE_SENTRY.
void sentryBreadcrumb(const char *category, const QString &message)
RAII guard that temporarily stops the simulation while in scope.
SystemVerilog code generator: translates a circuit into a synthesisable module.
WorkSpace widget: the complete circuit editing environment for one tab.
static void guardedSlot(const QObject *context, Body &&body) noexcept
Wraps a slot body in try/catch and reports any exception synchronously, inside the slot's own stack f...
Generates an Arduino sketch from a flattened list of circuit elements.
void generate()
Generates the Arduino sketch and writes it to the output file.
Waveform editor main window for creating and analyzing digital signal sequences.
void print()
Prints the waveform table to the system printer.
void createWaveform()
Initializes a blank waveform from the current scene's I/O elements.
ExportController(MainWindowHost &host, QObject *parent=nullptr)
void exportToArduino(QString fileName)
Generates an Arduino sketch for the current circuit at fileName.
void exportToWaveFormTerminal()
Prints the beWavedDolphin waveform of the current circuit to the terminal.
void exportArduinoDialog()
void exportSystemVerilogDialog()
void exportToWaveFormFile(const QString &fileName)
Writes the beWavedDolphin waveform of the current circuit to fileName.
void exportToSystemVerilog(QString fileName)
Generates SystemVerilog for the current circuit at fileName.
virtual FileDialogResult getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter)=0
Interface MainWindow provides to its extracted controllers (export, IC, …).
RAII guard that stops the simulation on construction and restarts it on destruction.
Generates a synthesisable SystemVerilog module from a circuit's element graph.
void generate()
Generates the SystemVerilog output file for the circuit.
void renderToImage(Scene *scene, const QString &filePath)
Renders scene to a PNG image file at filePath.
void renderToPdf(Scene *scene, const QString &filePath)
Renders scene to a PDF file at filePath.
FileDialogProvider * provider()
Returns the active provider. Never null.
QString fileName
Selected file path, empty if cancelled.