|
wiRedPanda
Logic Circuit Simulator
|
The top-level application window hosting the tab bar, menus, element palette, and editor. More...
#include <MainWindow.h>
Public Member Functions | |
| void | createNewTab () |
| Creates a new empty circuit tab. | |
| QDir | currentDir () const override |
| Returns the directory of the currently active .panda file. | |
| QFileInfo | currentFile () const override |
| Returns the QFileInfo of the currently active .panda file. | |
| WorkSpace * | currentTab () const override |
| Returns the currently visible WorkSpace tab, or nullptr. | |
| QString | dolphinFileName () override |
| Returns the BeWavedDolphin file name associated with the current tab. | |
| DolphinHost * | dolphinHost () override |
| bool | event (QEvent *event) override |
| void | exportToArduino (QString fileName) |
| Generates Arduino sketch code for the current circuit. | |
| void | exportToSystemVerilog (QString fileName) |
| Generates SystemVerilog code for the current circuit. | |
| void | exportToWaveFormFile (const QString &fileName) |
| Saves the BeWavedDolphin waveform session to fileName. | |
| void | exportToWaveFormTerminal () |
| Exports the current waveform simulation to standard output (terminal). | |
| bool | hasModifiedFiles () |
| Returns true if any open workspace has unsaved changes or is a recovered autosave. | |
| void | loadPandaFile (const QString &fileName) |
| Loads a .panda circuit file into the current or a new tab. | |
| void | loadTranslation (const QString &language) |
| Loads and installs the Qt translation for language. | |
| MainWindow (const QString &fileName={}, QWidget *parent=nullptr) | |
| Constructs the MainWindow and optionally opens fileName on start. | |
| void | openICInTab (const QString &blobName, int icElementId, const QByteArray &blob) |
| Opens an embedded IC blob for editing in a new tab. | |
| ElementPalette * | palette () const override |
| void | populateLanguageMenu () |
| Populates the Language submenu with available translations. | |
| void | populateMenu (QSpacerItem *spacer, const QStringList &names, QLayout *layout) |
| Fills layout with ElementLabel buttons from names, preceded by spacer. | |
| void | refreshICButtonsEnabled () override |
| void | requestSave () override |
| void | retranslateUi () |
| Re-applies all translatable strings to the UI after a language change. | |
| void | save (const QString &fileName={}) override |
| Saves the current circuit to fileName (or prompts if empty). | |
| void | setDolphinFileName (const QString &fileName) override |
| Associates fileName as the BeWavedDolphin file for the current tab. | |
| void | setFastMode (const bool fastMode) |
| Enables or disables fast (non-antialiased) rendering for all views. | |
| void | setICButtonsVisible (bool visible) override |
| QString | shortcutsHelpHtml () const |
| void | show () |
| Shows the window and initializes child widget state. | |
| void | showStatusMessage (const QString &message, int timeout) override |
| QWidget * | widget () override |
| ~MainWindow () override | |
| Public Member Functions inherited from DolphinHost | |
| virtual | ~DolphinHost ()=default |
| Public Member Functions inherited from MainWindowHost | |
| virtual | ~MainWindowHost ()=default |
Protected Member Functions | |
| void | closeEvent (QCloseEvent *event) override |
Friends | |
| class | TestMainWindowGui |
The top-level application window hosting the tab bar, menus, element palette, and editor.
MainWindow orchestrates the full editing workflow: it owns the tab widget (each tab is a WorkSpace), connects undo/redo stacks, handles file open/save/export, manages translations, and integrates the element palette, element editor, and IC list panel.
Definition at line 46 of file MainWindow.h.
|
explicit |
Constructs the MainWindow and optionally opens fileName on start.
| fileName | Optional .panda file to load at startup. |
| parent | Optional parent widget. |
Definition at line 86 of file MainWindow.cpp.
References createNewTab(), AppVersion::current, currentTab(), WorkspaceManager::currentTabChanged(), Settings::fileName(), SceneUiBinder::loadFileRequested(), loadPandaFile(), WorkspaceManager::loadPandaFile(), Settings::minimapVisible(), WorkspaceManager::openICInTab(), SceneUiBinder::openICRequested(), qCDebug, WorkSpace::setMinimapVisible(), and WorkspaceManager::titleChanged().
|
override |
Definition at line 450 of file MainWindow.cpp.
|
overrideprotected |
| void MainWindow::createNewTab | ( | ) |
Creates a new empty circuit tab.
Definition at line 456 of file MainWindow.cpp.
Referenced by MainWindow().
|
overridevirtual |
Returns the directory of the currently active .panda file.
Implements DolphinHost.
Definition at line 723 of file MainWindow.cpp.
|
overridevirtual |
Returns the QFileInfo of the currently active .panda file.
Implements DolphinHost.
Definition at line 713 of file MainWindow.cpp.
|
overridevirtual |
Returns the currently visible WorkSpace tab, or nullptr.
Implements MainWindowHost.
Definition at line 770 of file MainWindow.cpp.
Referenced by main(), MainWindow(), refreshICButtonsEnabled(), and setFastMode().
|
overridevirtual |
Returns the BeWavedDolphin file name associated with the current tab.
Implements DolphinHost.
Definition at line 1281 of file MainWindow.cpp.
|
overridevirtual |
Implements MainWindowHost.
Definition at line 733 of file MainWindow.cpp.
|
override |
Definition at line 1346 of file MainWindow.cpp.
References event().
Referenced by closeEvent(), and event().
| void MainWindow::exportToArduino | ( | QString | fileName | ) |
Generates Arduino sketch code for the current circuit.
| fileName | Output .ino file path. |
Definition at line 865 of file MainWindow.cpp.
Referenced by main().
| void MainWindow::exportToSystemVerilog | ( | QString | fileName | ) |
Generates SystemVerilog code for the current circuit.
| fileName | Output .sv file path. |
Definition at line 870 of file MainWindow.cpp.
| void MainWindow::exportToWaveFormFile | ( | const QString & | fileName | ) |
Saves the BeWavedDolphin waveform session to fileName.
| fileName | Output .dolphin file path. |
Definition at line 875 of file MainWindow.cpp.
Referenced by main().
| void MainWindow::exportToWaveFormTerminal | ( | ) |
Exports the current waveform simulation to standard output (terminal).
Definition at line 880 of file MainWindow.cpp.
Referenced by main().
| bool MainWindow::hasModifiedFiles | ( | ) |
Returns true if any open workspace has unsaved changes or is a recovered autosave.
Definition at line 718 of file MainWindow.cpp.
| void MainWindow::loadPandaFile | ( | const QString & | fileName | ) |
Loads a .panda circuit file into the current or a new tab.
| fileName | Absolute path to the .panda file. |
Definition at line 552 of file MainWindow.cpp.
Referenced by main(), and MainWindow().
| void MainWindow::loadTranslation | ( | const QString & | language | ) |
Loads and installs the Qt translation for language.
| language | BCP-47 language code. |
Definition at line 1025 of file MainWindow.cpp.
| void MainWindow::openICInTab | ( | const QString & | blobName, |
| int | icElementId, | ||
| const QByteArray & | blob ) |
Opens an embedded IC blob for editing in a new tab.
Definition at line 557 of file MainWindow.cpp.
|
overridevirtual |
Implements MainWindowHost.
Definition at line 738 of file MainWindow.cpp.
| void MainWindow::populateLanguageMenu | ( | ) |
Populates the Language submenu with available translations.
Definition at line 1030 of file MainWindow.cpp.
References Settings::language().
| void MainWindow::populateMenu | ( | QSpacerItem * | spacer, |
| const QStringList & | names, | ||
| QLayout * | layout ) |
Fills layout with ElementLabel buttons from names, preceded by spacer.
| spacer | Spacer item to insert before the buttons. |
| names | Element type names to add. |
| layout | Target layout. |
Definition at line 1081 of file MainWindow.cpp.
References ElementFactory::pixmap(), and ElementFactory::textToType().
|
overridevirtual |
Implements MainWindowHost.
Definition at line 704 of file MainWindow.cpp.
References currentTab(), and WorkSpace::fileInfo().
|
overridevirtual |
Implements MainWindowHost.
Definition at line 743 of file MainWindow.cpp.
| void MainWindow::retranslateUi | ( | ) |
Re-applies all translatable strings to the UI after a language change.
Definition at line 977 of file MainWindow.cpp.
|
overridevirtual |
Saves the current circuit to fileName (or prompts if empty).
| fileName | Absolute path; empty triggers a Save-As dialog. |
Implements DolphinHost.
Definition at line 477 of file MainWindow.cpp.
|
overridevirtual |
Associates fileName as the BeWavedDolphin file for the current tab.
| fileName | Path to the .dolphin file. |
Implements DolphinHost.
Definition at line 1286 of file MainWindow.cpp.
| void MainWindow::setFastMode | ( | const bool | fastMode | ) |
Enables or disables fast (non-antialiased) rendering for all views.
| fastMode | true to use fast rendering. |
Definition at line 461 of file MainWindow.cpp.
References currentTab(), GraphicsView::setFastMode(), and WorkSpace::view().
|
overridevirtual |
Implements MainWindowHost.
Definition at line 697 of file MainWindow.cpp.
| QString MainWindow::shortcutsHelpHtml | ( | ) | const |
Rich-text body of the "Shortcuts and Tips" dialog, generated from this window's actions so the list can never drift from the real key bindings and picks up any action added later. Public so GUI tests can assert its completeness without opening a modal dialog.
Definition at line 585 of file MainWindow.cpp.
| void MainWindow::show | ( | ) |
Shows the window and initializes child widget state.
Definition at line 482 of file MainWindow.cpp.
References Application::interactiveMode, qCDebug, Settings::setWelcomeTourShown(), and Settings::welcomeTourShown().
|
overridevirtual |
Implements MainWindowHost.
Definition at line 748 of file MainWindow.cpp.
|
overridevirtual |
Implements MainWindowHost.
Definition at line 728 of file MainWindow.cpp.
|
friend |
Definition at line 49 of file MainWindow.h.
References TestMainWindowGui.
Referenced by TestMainWindowGui.