SILICON
Loading...
Searching...
No Matches
windowActions.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 */
9
10#pragma once
11
12#include <initializer_list>
13#include <memory>
14#include <optional>
15
16#include <QObject>
17#include <QVector>
18
20#include <ui/actionGroups.hpp>
21#include <ui/shell/uiUtils.hpp>
22#ifdef __EMSCRIPTEN__
24#endif
25
26class QAction;
27class QMainWindow;
28class QMenu;
29class QToolBar;
30
31namespace SILICON::ui {
32class EditorWorkspace;
33struct ProjectSession;
34struct ShortcutSetting;
35
43class WindowActions : public QObject {
44public:
46 ~WindowActions() override;
47
48 void createActions();
49 void createMenus();
50 void createToolBar();
52 void updateEditActions();
54 void updateCodeAction();
57 void openSettings();
58 [[nodiscard]] std::optional<SILICON::project::DocumentType>
59 activeDocumentType() const noexcept;
60 static void setActionsEnabled(std::initializer_list<QAction*> actions, bool enabled);
61
63 QToolBar* toolBar = nullptr;
64 QAction* diagramToolsSeparator = nullptr;
65 QAction* documentToolsSeparator = nullptr;
66
68 QMenu* fileMenu = nullptr;
69
71 QMenu* editMenu = nullptr;
72
74 QMenu* helpMenu = nullptr;
75
78
81
84
87
90
93
94private:
95 [[nodiscard]] QVector<ShortcutSetting> shortcutSettings() const;
96 void bindEditorActions();
99
100 QMainWindow& window;
103#ifdef __EMSCRIPTEN__
104 std::unique_ptr<BrowserShortcutCapture> browserShortcuts;
105#endif
106};
107
108} // namespace SILICON::ui
Selects and hosts editors while preserving detached document preparation.
WaveformActions waveform
Commands owned by the waveform viewer.
std::optional< SILICON::project::DocumentType > activeDocumentType() const noexcept
QToolBar * toolBar
Main toolbar containing edit, mode, and simulation actions.
WindowActions(QMainWindow &window, ProjectSession &session, EditorWorkspace &workspace)
ArchitectureActions architecture
Commands owned by the architecture subsystem.
DocumentActions documents
Commands owned by the project document workflow.
CircuitActions circuit
Commands owned by the circuit editor.
ProjectActions project
Commands owned by the project and application shell.
EditActions edit
Commands owned by the active editor, whatever its kind.
static void setActionsEnabled(std::initializer_list< QAction * > actions, bool enabled)
QVector< ShortcutSetting > shortcutSettings() const
Shortcut row shown in the settings dialog.