wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ICController Class Reference

Owns the IC management workflow: importing file-based ICs into the project directory, embedding/extracting blobs, and making a circuit self-contained. More...

#include <ICController.h>

Inheritance diagram for ICController:
[legend]

Public Member Functions

void addEmbeddedICFromFile ()
 Prompts for a .panda file and registers it as an embedded IC blob.
void addICFromFile ()
 Copies a chosen .panda file (and its dependencies) into the project's IC directory.
void embedICByFile (const QString &fileName)
 Embeds the file-based IC named fileName (drag-and-drop target).
void embedSelectedIC ()
 Embeds the currently selected file-backed IC as a blob in the circuit.
void extractICByBlobName (const QString &blobName)
 Extracts the embedded IC blob blobName to a user-chosen .panda file.
void extractSelectedIC ()
 Extracts the currently selected embedded IC back out to a .panda file.
 ICController (MainWindowHost &host, QObject *parent=nullptr)
void makeSelfContained ()
 Embeds every file-based IC in the circuit so it becomes self-contained.
void removeEmbeddedIC (const QString &blobName)
 Removes the embedded IC blob blobName from the current circuit.
void removeICFile (const QString &icFileName)
 Deletes icFileName from the project directory and any instances of it in the scene.
void showRemoveICHint ()
 Shows the "drag here to remove" hint for the file-based IC trash button.

Detailed Description

Owns the IC management workflow: importing file-based ICs into the project directory, embedding/extracting blobs, and making a circuit self-contained.

Extracted from MainWindow. Reaches circuit state (current tab, scene, IC registry, palette, status bar) through a MainWindowHost, so it never depends on a concrete MainWindow. Widget-state helpers for the IC tool buttons remain on MainWindow because they belong to its tab lifecycle.

Definition at line 27 of file ICController.h.

Constructor & Destructor Documentation

◆ ICController()

ICController::ICController ( MainWindowHost & host,
QObject * parent = nullptr )
explicit

Definition at line 31 of file ICController.cpp.

Member Function Documentation

◆ addEmbeddedICFromFile()

void ICController::addEmbeddedICFromFile ( )

Prompts for a .panda file and registers it as an embedded IC blob.

Definition at line 404 of file ICController.cpp.

References FileDialogProvider::getOpenFileName(), FileDialogs::provider(), and Scene::receiveCommand().

◆ addICFromFile()

void ICController::addICFromFile ( )

Copies a chosen .panda file (and its dependencies) into the project's IC directory.

Definition at line 56 of file ICController.cpp.

References Serialization::copyPandaFile(), FileUtils::filesHaveSameContent(), FileDialogProvider::getOpenFileName(), Application::guardedSlot(), FileDialogs::provider(), and sentryBreadcrumb().

◆ embedICByFile()

void ICController::embedICByFile ( const QString & fileName)

Embeds the file-based IC named fileName (drag-and-drop target).

Definition at line 265 of file ICController.cpp.

References Scene::contextDir(), Scene::icRegistry(), and Scene::receiveCommand().

◆ embedSelectedIC()

void ICController::embedSelectedIC ( )

Embeds the currently selected file-backed IC as a blob in the circuit.

Definition at line 200 of file ICController.cpp.

References Scene::contextDir(), ICRegistry::embedICsByFile(), Scene::icRegistry(), and sentryBreadcrumb().

◆ extractICByBlobName()

void ICController::extractICByBlobName ( const QString & blobName)

Extracts the embedded IC blob blobName to a user-chosen .panda file.

Definition at line 302 of file ICController.cpp.

References Scene::contextDir(), FileDialogResult::fileName, FileDialogProvider::getSaveFileName(), Scene::icRegistry(), and FileDialogs::provider().

◆ extractSelectedIC()

void ICController::extractSelectedIC ( )

Extracts the currently selected embedded IC back out to a .panda file.

Definition at line 233 of file ICController.cpp.

References Scene::contextDir(), ICRegistry::extractToFile(), FileDialogResult::fileName, FileDialogProvider::getSaveFileName(), Scene::icRegistry(), FileDialogs::provider(), and sentryBreadcrumb().

◆ makeSelfContained()

void ICController::makeSelfContained ( )

Embeds every file-based IC in the circuit so it becomes self-contained.

Definition at line 338 of file ICController.cpp.

References Scene::contextDir(), Scene::elements(), Scene::icRegistry(), and sentryBreadcrumb().

◆ removeEmbeddedIC()

void ICController::removeEmbeddedIC ( const QString & blobName)

Removes the embedded IC blob blobName from the current circuit.

Definition at line 433 of file ICController.cpp.

◆ removeICFile()

void ICController::removeICFile ( const QString & icFileName)

Deletes icFileName from the project directory and any instances of it in the scene.

Definition at line 123 of file ICController.cpp.

References PANDACEPTION.

◆ showRemoveICHint()

void ICController::showRemoveICHint ( )

Shows the "drag here to remove" hint for the file-based IC trash button.

Definition at line 115 of file ICController.cpp.

References Application::guardedSlot(), and sentryBreadcrumb().


The documentation for this class was generated from the following files: