50 explicit WorkSpace(QWidget *parent =
nullptr);
72 void load(
const QString &fileName);
74 void load(QDataStream &stream,
const QVersionNumber &version,
const QString &contextDir);
87 void save(QDataStream &stream);
97 void loadFromBlob(
const QByteArray &blob,
WorkSpace *parent,
int icElementId,
const QString &parentContextDir);
160 void showEvent(QShowEvent *event)
override;
180 void createVersionedBackup(
const QString &fileName,
const QVersionNumber &version);
181 void setAutosaveFileName();
184 void setCurrentFile(
const QString &filePath);
190 void applyMinimapGeometry();
193 void onMinimapGeometryChangeFinished(
const QRect &geometry);
199 QFileInfo m_fileInfo;
200 QString m_dolphinFileName;
201 QString m_autosaveFileName;
202 QTimer m_autosaveDebounceTimer;
203 QVersionNumber m_loadedVersion;
211 bool m_minimapPositioned =
false;
214 bool m_isInlineIC =
false;
215 QPointer<WorkSpace> m_parentWorkspace;
216 int m_parentICElementId = -1;
217 QString m_inlineBlobName;
218 QString m_untitledTitle;
219 bool m_isRecovered =
false;
Extended QGraphicsView with zoom, pan, and fast-rendering modes.
Main circuit editing scene with undo/redo and user interaction.
Typed wrappers around QSettings for all application preferences.
Semi-transparent overlay displayed at the bottom of the canvas during a circuit exercise.
Extended QGraphicsView with enhanced navigation capabilities.
Main circuit editing scene.
Manages the digital circuit simulation loop.
A widget containing a complete circuit editing environment.
void setLastId(int newLastId)
Forces the element-ID counter to newLastId.
void setDolphinFileName(const QString &fileName)
Sets the associated BeWavedDolphin waveform file path to fileName.
void icBlobSaved(int icElementId, const QByteArray &blob)
Emitted when an inline IC tab saves its blob (propagated to parent).
bool isFromNewerVersion() const
Returns true if the loaded file was saved by a newer version of wiRedPanda.
const QString & untitledTitle() const
bool isInlineIC() const
Returns true if this workspace is editing an embedded IC blob (not a file).
friend class TestWorkspaceUnit
void setAutosaveFile()
Creates or replaces the autosave temporary file.
void fileChanged(const QFileInfo &fileInfo)
Emitted whenever the file info of this workspace changes (load/save).
const QString & inlineBlobName() const
Returns the blob name being edited (for tab title).
Scene * scene()
Returns the Scene embedded in this workspace.
void onChildICBlobSaved(int icElementId, const QByteArray &blob)
Receives a saved blob from a child inline tab.
WorkSpace(QWidget *parent=nullptr)
Constructs the workspace with optional parent widget.
void setInlineBlobName(const QString &blobName)
void setMinimapVisible(bool visible)
void removeEmbeddedIC(const QString &blobName)
Removes all IC instances with the given blob name.
QString dolphinFileName() const
Returns the path of the associated BeWavedDolphin waveform file.
int lastId() const
Returns the highest element ID assigned in this workspace.
~WorkSpace() override
Flushes any pending debounced autosave on destruction.
int parentICElementId() const
Returns the element ID of the IC in the parent scene being edited.
void flushPendingAutosave()
Forces any pending debounced autosave to run synchronously.
void setExerciseOverlay(ExerciseOverlay *overlay)
void loadFromBlob(const QByteArray &blob, WorkSpace *parent, int icElementId, const QString &parentContextDir)
Loads a blob for editing in an inline tab.
void load(const QString &fileName)
Loads a circuit from the file at fileName.
void setRecovered(bool recovered)
WorkSpace * parentWorkspace() const
Returns the parent workspace (for inline IC tabs).
void resizeEvent(QResizeEvent *event) override
Simulation * simulation()
Returns the embedded Simulation.
GraphicsView * view()
Returns the GraphicsView embedded in this workspace.
void setUntitledTitle(const QString &title)
void showEvent(QShowEvent *event) override
SaveOutcome save(const QString &fileName)
Saves the current circuit to fileName.
QFileInfo fileInfo() const
Returns the file info for the currently open circuit file.