Basic document handling

This commit is contained in:
2026-07-19 21:26:27 +02:00
parent c5ab3329ae
commit 76bd313f79
32 changed files with 4843 additions and 67 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ComponentOptionsDialog</class>
<widget class="QDialog" name="ComponentOptionsDialog">
<property name="geometry"><rect><x>0</x><y>0</y><width>420</width><height>260</height></rect></property>
<property name="windowTitle"><string>Component Options</string></property>
<layout class="QVBoxLayout" name="dialogLayout">
<item>
<layout class="QFormLayout" name="optionsForm">
<item row="0" column="0"><widget class="QLabel" name="nameLabel"><property name="text"><string>Name:</string></property></widget></item>
<item row="0" column="1"><widget class="QLineEdit" name="nameEdit"/></item>
<item row="1" column="0"><widget class="QLabel" name="shapeLabel"><property name="text"><string>Icon shape:</string></property></widget></item>
<item row="1" column="1"><widget class="QComboBox" name="shapeCombo"><item><property name="text"><string>rectangle</string></property></item><item><property name="text"><string>ellipse</string></property></item></widget></item>
<item row="2" column="0"><widget class="QLabel" name="iconTextLabel"><property name="text"><string>Icon text:</string></property></widget></item>
<item row="2" column="1"><widget class="QLineEdit" name="iconTextEdit"/></item>
<item row="3" column="0"><widget class="QLabel" name="fillLabel"><property name="text"><string>Fill color:</string></property></widget></item>
<item row="3" column="1"><widget class="QLineEdit" name="fillEdit"><property name="placeholderText"><string>#dbeafe</string></property></widget></item>
<item row="4" column="0"><widget class="QLabel" name="borderLabel"><property name="text"><string>Border color:</string></property></widget></item>
<item row="4" column="1"><widget class="QLineEdit" name="borderEdit"><property name="placeholderText"><string>#303030</string></property></widget></item>
<item row="5" column="0" colspan="2"><widget class="QCheckBox" name="showSubtreeCheckBox"><property name="text"><string>Show contained components in the Libraries tree</string></property><property name="checked"><bool>true</bool></property></widget></item>
</layout>
</item>
<item><spacer name="optionsSpacer"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>40</height></size></property></spacer></item>
<item><widget class="QDialogButtonBox" name="buttonBox"><property name="standardButtons"><set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set></property></widget></item>
</layout>
</widget>
<resources/>
<connections>
<connection><sender>buttonBox</sender><signal>accepted()</signal><receiver>ComponentOptionsDialog</receiver><slot>accept()</slot><hints/></connection>
<connection><sender>buttonBox</sender><signal>rejected()</signal><receiver>ComponentOptionsDialog</receiver><slot>reject()</slot><hints/></connection>
</connections>
</ui>

View File

@@ -94,19 +94,91 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="panel_document">
<property name="minimumSize">
<size><width>220</width><height>91</height></size>
</property>
<property name="windowTitle"><string>Document</string></property>
<attribute name="dockWidgetArea"><number>1</number></attribute>
<widget class="QWidget" name="documentDockContents">
<layout class="QVBoxLayout" name="documentPanelLayout">
<property name="spacing"><number>0</number></property>
<property name="leftMargin"><number>0</number></property>
<property name="topMargin"><number>0</number></property>
<property name="rightMargin"><number>0</number></property>
<property name="bottomMargin"><number>0</number></property>
<item>
<widget class="QTreeView" name="documentTreeView">
<property name="alternatingRowColors"><bool>true</bool></property>
<property name="uniformRowHeights"><bool>true</bool></property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QWidget" name="workspace" native="true">
<widget class="QWidget" name="workspace">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QWidget#workspace {
background-color: rgb(198, 198, 198);
}</string>
</property>
<layout class="QVBoxLayout" name="workspaceEditorLayout">
<property name="spacing"><number>0</number></property>
<property name="leftMargin"><number>0</number></property>
<property name="topMargin"><number>0</number></property>
<property name="rightMargin"><number>0</number></property>
<property name="bottomMargin"><number>0</number></property>
<item>
<widget class="QFrame" name="workspaceHeader">
<property name="minimumSize"><size><width>0</width><height>34</height></size></property>
<property name="maximumSize"><size><width>16777215</width><height>34</height></size></property>
<property name="frameShape"><enum>QFrame::Shape::StyledPanel</enum></property>
<layout class="QHBoxLayout" name="workspaceHeaderLayout">
<property name="leftMargin"><number>6</number></property>
<property name="topMargin"><number>2</number></property>
<property name="rightMargin"><number>6</number></property>
<property name="bottomMargin"><number>2</number></property>
<item><widget class="QToolButton" name="navigateUpButton"><property name="text"><string>Up</string></property><property name="toolTip"><string>Open the containing graph</string></property></widget></item>
<item><widget class="QLabel" name="graphBreadcrumbLabel"><property name="text"><string>Untitled</string></property></widget></item>
<item><widget class="QLabel" name="workspaceModeLabel"><property name="text"><string>Graph</string></property></widget></item>
<item><spacer name="workspaceHeaderSpacer"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item>
<item><widget class="QPushButton" name="applyJsonButton"><property name="text"><string>Apply JSON</string></property><property name="visible"><bool>false</bool></property></widget></item>
<item><widget class="QToolButton" name="pointerToolButton"><property name="text"><string>Pointer</string></property><property name="checkable"><bool>true</bool></property><property name="checked"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
<item><widget class="QToolButton" name="inputToolButton"><property name="text"><string>Input</string></property><property name="toolTip"><string>Add an interface input</string></property><property name="checkable"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
<item><widget class="QToolButton" name="outputToolButton"><property name="text"><string>Output</string></property><property name="toolTip"><string>Add an interface output</string></property><property name="checkable"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
</layout>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="workspaceStack">
<property name="currentIndex"><number>0</number></property>
<widget class="QWidget" name="graphPage">
<layout class="QVBoxLayout" name="graphPageLayout">
<property name="leftMargin"><number>0</number></property><property name="topMargin"><number>0</number></property><property name="rightMargin"><number>0</number></property><property name="bottomMargin"><number>0</number></property>
<item><widget class="GraphWorkspaceView" name="graphView"/></item>
</layout>
</widget>
<widget class="QWidget" name="jsonPage">
<layout class="QVBoxLayout" name="jsonPageLayout">
<property name="leftMargin"><number>0</number></property><property name="topMargin"><number>0</number></property><property name="rightMargin"><number>0</number></property><property name="bottomMargin"><number>0</number></property>
<item><widget class="QPlainTextEdit" name="jsonEditor"><property name="lineWrapMode"><enum>QPlainTextEdit::LineWrapMode::NoWrap</enum></property><property name="placeholderText"><string>Component JSON</string></property></widget></item>
</layout>
</widget>
<widget class="QWidget" name="emptyPage">
<layout class="QVBoxLayout" name="emptyPageLayout">
<item>
<widget class="QLabel" name="emptyWorkspaceLabel">
<property name="text"><string>No document open</string></property>
<property name="alignment"><set>Qt::AlignmentFlag::AlignCenter</set></property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
@@ -131,6 +203,7 @@
<addaction name="actionSave"/>
<addaction name="actionSaveAs"/>
<addaction name="separator"/>
<addaction name="actionClose"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuEdit">
@@ -143,6 +216,8 @@
<addaction name="actionCopy"/>
<addaction name="actionCut"/>
<addaction name="actionPaste"/>
<addaction name="actionDelete"/>
<addaction name="actionSelectAll"/>
<addaction name="separator"/>
<addaction name="actionSettings"/>
</widget>
@@ -230,6 +305,12 @@
<addaction name="actionCut"/>
<addaction name="actionPaste"/>
</widget>
<widget class="QToolBar" name="transformToolbar">
<property name="windowTitle"><string>Transform</string></property>
<attribute name="toolBarArea"><enum>TopToolBarArea</enum></attribute>
<attribute name="toolBarBreak"><bool>false</bool></attribute>
<addaction name="actionRotateClockwise"/>
</widget>
<action name="actionNew">
<property name="icon">
<iconset resource="../resources/resources.qrc">
@@ -245,6 +326,15 @@
<string>Ctrl+N</string>
</property>
</action>
<action name="actionRotateClockwise">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/transform-rotate.png</normaloff>:/icons/icons/transform-rotate.png</iconset>
</property>
<property name="text"><string>Rotate Clockwise</string></property>
<property name="toolTip"><string>Rotate selected blocks clockwise by 90 degrees</string></property>
<property name="shortcut"><string>Ctrl+R</string></property>
</action>
<action name="actionOpen">
<property name="icon">
<iconset resource="../resources/resources.qrc">
@@ -295,6 +385,10 @@
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionClose">
<property name="text"><string>&amp;Close Document</string></property>
<property name="shortcut"><string>Ctrl+W</string></property>
</action>
<action name="actionUndo">
<property name="icon">
<iconset resource="../resources/resources.qrc">
@@ -363,6 +457,10 @@
<string>Ctrl+A</string>
</property>
</action>
<action name="actionDelete">
<property name="text"><string>&amp;Delete</string></property>
<property name="shortcut"><string>Del</string></property>
</action>
<action name="actionAbout">
<property name="text">
<string>&amp;About BEdit</string>
@@ -382,6 +480,13 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>GraphWorkspaceView</class>
<extends>QGraphicsView</extends>
<header>bedit.workspace.view</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources/resources.qrc"/>
</resources>

View File

@@ -73,6 +73,51 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="librariesTab">
<attribute name="title">
<string>Libraries</string>
</attribute>
<layout class="QVBoxLayout" name="librariesTabLayout">
<item>
<widget class="QLabel" name="libraryPathsLabel">
<property name="text">
<string>Load library JSON files from these files or folders at startup:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="libraryPathsList"/>
</item>
<item>
<layout class="QHBoxLayout" name="libraryPathButtonsLayout">
<item>
<widget class="QPushButton" name="addLibraryFileButton">
<property name="text"><string>Add File…</string></property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addLibraryFolderButton">
<property name="text"><string>Add Folder…</string></property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeLibraryPathButton">
<property name="text"><string>Remove</string></property>
</widget>
</item>
<item>
<spacer name="libraryButtonsSpacer">
<property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property>
<property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>