Remove complicated diagrams from project editor

This commit is contained in:
Alex Spataru 2024-09-19 18:47:15 -05:00
parent 9b16f64b4e
commit 347de31087
7 changed files with 233 additions and 34 deletions

View File

@ -104,9 +104,9 @@ jobs:
#
# macOS (arm64) build
#
build-mac:
build-mac-arm64:
runs-on: macos-latest
name: '🍎 macOS'
name: '🍎 macOS (arm64)'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v4
@ -165,12 +165,12 @@ jobs:
npm install --global create-dmg
rm LICENSE.md
create-dmg "${{env.APPLICATION}}.app" --dmg-title="${{env.APPLICATION}}"
mv "${{env.APPLICATION}} ${{env.VERSION}}.dmg" "${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg"
mv "${{env.APPLICATION}} ${{env.VERSION}}.dmg" "${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg"
- name: '📋 Notarize'
uses: alex-spataru/xcode-notarize@v2
with:
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg
appstore-connect-username: ${{secrets.NOTARIZATION_USERNAME}}
appstore-connect-teamid: ${{secrets.NOTARIZATION_TEAMID}}
appstore-connect-password: ${{secrets.NOTARIZATION_PASSWORD}}
@ -178,13 +178,98 @@ jobs:
- name: '📌 Staple'
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg
- name: '📤 Upload artifact: DMG'
uses: actions/upload-artifact@v4
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg
#
# macOS (Intel) build
#
build-mac-intel:
runs-on: macos-12
name: '🍎 macOS (Intel)'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v4
- name: '⚙️ Install Qt'
uses: jurplel/install-qt-action@v3
with:
version: ${{env.QT_VERSION_MACOS}}
modules: ${{env.QT_MODULES}}
arch: clang_64
cache: 'true'
- name: '⚙️ Install CMake'
uses: lukka/get-cmake@latest
with:
useLocalCache: true
- name: '⚙️ Install Node'
uses: actions/setup-node@v4
with:
node-version: 20
- name: '🚧 Configure with CMake'
run: |
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
- name: '🚧 Build application'
run: |
cd build
cmake --build . --config Release -j 10
- name: '📦 Package application'
run: |
cd build
cpack --verbose
- name: '🪪 Import Code Signing Certificate'
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{secrets.CERTIFICATES_P12}}
p12-password: ${{secrets.CERTIFICATES_P12_PASSWORD}}
- name: '💿 Mount DMG and copy application'
run: |
VOLUME=$(yes | hdiutil attach ./build/*.dmg -nobrowse | grep "Volumes" | awk '{print $3}')
cp -a "$VOLUME/${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app"
hdiutil detach "$VOLUME"
- name: '✍🏻 Sign Application'
run: codesign --force --deep --options runtime --sign "${{secrets.DEVELOPER_ID}}" "${{env.APPLICATION}}.app"
- name: '💽 Create nice DMG'
run: |
npm install --global create-dmg
rm LICENSE.md
create-dmg "${{env.APPLICATION}}.app" --dmg-title="${{env.APPLICATION}}"
mv "${{env.APPLICATION}} ${{env.VERSION}}.dmg" "${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg"
- name: '📋 Notarize'
uses: alex-spataru/xcode-notarize@v2
with:
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg
appstore-connect-username: ${{secrets.NOTARIZATION_USERNAME}}
appstore-connect-teamid: ${{secrets.NOTARIZATION_TEAMID}}
appstore-connect-password: ${{secrets.NOTARIZATION_PASSWORD}}
- name: '📌 Staple'
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg
- name: '📤 Upload artifact: DMG'
uses: actions/upload-artifact@v4
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg
#
# Windows build
@ -237,7 +322,8 @@ jobs:
upload:
name: '🗂 Create release and upload artifacts'
needs:
- build-mac
- build-mac-arm64
- build-mac-intel
- build-windows
- build-linux
runs-on: ubuntu-latest
@ -255,6 +341,7 @@ jobs:
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-arm64.dmg
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS-Intel.dmg
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe

View File

@ -24,6 +24,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import SerialStudio
import "../../Widgets" as Widgets
Widgets.Pane {
@ -61,11 +62,39 @@ Widgets.Pane {
TreeView {
id: treeView
focus: true
reuseItems: false
model: Cpp_Project_Model.treeModel
boundsBehavior: TreeView.StopAtBounds
selectionModel: Cpp_Project_Model.selectionModel
//
// Keyboard navigation
//
Keys.onPressed: (event) => {
// Move down to the next sibling (or parent if collapsed)
if (event.key === Qt.Key_Down) {
let nextIndex = treeView.index(treeView.currentRow + 1, treeView.currentColumn)
if (nextIndex.isValid)
treeView.selectionModel.setCurrentIndex(nextIndex, ItemSelectionModel.ClearAndSelect)
}
// Move up to the previous sibling (or parent)
else if (event.key === Qt.Key_Up) {
let prevIndex = treeView.index(treeView.currentRow - 1, treeView.currentColumn)
if (prevIndex.isValid)
treeView.selectionModel.setCurrentIndex(prevIndex, ItemSelectionModel.ClearAndSelect)
}
// Delete current item
else if (event.key === Qt.Key_Delete) {
if (Cpp_Project_Model.currentView === ProjectModel.DatasetView)
Cpp_Project_Model.deleteCurrentDataset()
else if (Cpp_Project_Model.currentView === ProjectModel.GroupView)
Cpp_Project_Model.deleteCurrentGroup()
}
}
//
// Set background item
//
@ -114,6 +143,7 @@ Widgets.Pane {
// Select the item and open the associated view automatically.
//
function onLabelClicked() {
treeView.forceActiveFocus()
let index = treeView.index(row, column)
treeView.selectionModel.setCurrentIndex(index, ItemSelectionModel.ClearAndSelect)
}
@ -123,6 +153,7 @@ Widgets.Pane {
// Otherwise, select the item and open the associated view.
//
function onLabelDoubleClicked() {
treeView.forceActiveFocus()
if (!toggleExpanded()) {
onLabelClicked()
}

View File

@ -227,19 +227,40 @@ Widgets.Pane {
anchors.topMargin: header.height
modelPointer: Cpp_Project_Model.groupModel
footerItem: Image {
readonly property real aspectRatio: 668 / 300
readonly property real idealWidth: delegate.width * 0.8
readonly property real idealHeight: delegate.height - delegate.tableHeight
readonly property real maxWidth: idealHeight * aspectRatio
readonly property real maxHeight: idealWidth / aspectRatio
readonly property real actualWidth: Math.min(idealWidth, maxWidth)
readonly property real actualHeight: Math.min(idealHeight, maxHeight)
footerItem: ColumnLayout {
spacing: 0
smooth: true
antialiasing: true
source: "qrc:/rcc/diagrams/group-dfd.svg"
sourceSize: Qt.size(actualWidth, actualHeight)
Image {
sourceSize: Qt.size(128, 128)
Layout.alignment: Qt.AlignHCenter
source: "qrc:/rcc/images/tree.svg"
}
Item {
height: 16
}
Label {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Let's Add Some Datasets")
horizontalAlignment: Label.AlignHCenter
font: Cpp_Misc_CommonFonts.customUiFont(24, true)
}
Item {
height: 8
}
Label {
opacity: 0.8
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Label.AlignHCenter
Layout.maximumWidth: delegate.width * 0.9
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
font: Cpp_Misc_CommonFonts.customUiFont(18, false)
text: qsTr("Datasets describe individual readings (e.g. X, Y, Z in an accelerometer).\n" +
"Use the toolbar buttons above to add a dataset to this group.")
}
}
}
}

View File

@ -43,19 +43,39 @@ Widgets.Pane {
anchors.bottomMargin: -9
modelPointer: Cpp_Project_Model.projectModel
footerItem: Image {
readonly property real aspectRatio: 696 / 280
readonly property real idealWidth: delegate.width * 0.8
readonly property real idealHeight: delegate.height - delegate.tableHeight
readonly property real maxWidth: idealHeight * aspectRatio
readonly property real maxHeight: idealWidth / aspectRatio
readonly property real actualWidth: Math.min(idealWidth, maxWidth)
readonly property real actualHeight: Math.min(idealHeight, maxHeight)
footerItem: ColumnLayout {
spacing: 0
smooth: true
antialiasing: true
source: "qrc:/rcc/diagrams/project-dfd.svg"
sourceSize: Qt.size(actualWidth, actualHeight)
Image {
sourceSize: Qt.size(128, 128)
Layout.alignment: Qt.AlignHCenter
source: "qrc:/rcc/images/soldering-iron.svg"
}
Item {
height: 16
}
Label {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Start Building Now!")
horizontalAlignment: Label.AlignHCenter
font: Cpp_Misc_CommonFonts.customUiFont(24, true)
}
Item {
height: 8
}
Label {
opacity: 0.8
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Label.AlignHCenter
Layout.maximumWidth: delegate.width * 0.9
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
font: Cpp_Misc_CommonFonts.customUiFont(18, false)
text: qsTr("Get started by adding a group with the toolbar buttons above.")
}
}
}
}

13
app/rcc/images/tree.svg Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="96pt" height="96pt" viewBox="0 0 96 96" version="1.1">
<g id="surface12551">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(54.509807%,71.764708%,94.117647%);fill-opacity:1;" d="M 59.40625 67.800781 L 93.007812 67.800781 L 93.007812 93 L 59.40625 93 Z M 59.40625 67.800781 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(30.588236%,47.843137%,70.980394%);fill-opacity:1;" d="M 92.40625 68.398438 L 92.40625 92.398438 L 60.007812 92.398438 L 60.007812 68.398438 L 92.40625 68.398438 M 93.605469 67.199219 L 58.804688 67.199219 L 58.804688 93.601562 L 93.605469 93.601562 Z M 93.605469 67.199219 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(54.509807%,71.764708%,94.117647%);fill-opacity:1;" d="M 59.40625 31.800781 L 93.007812 31.800781 L 93.007812 55.800781 L 59.40625 55.800781 Z M 59.40625 31.800781 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(30.588236%,47.843137%,70.980394%);fill-opacity:1;" d="M 92.40625 32.398438 L 92.40625 55.199219 L 60.007812 55.199219 L 60.007812 32.398438 L 92.40625 32.398438 M 93.605469 31.199219 L 58.804688 31.199219 L 58.804688 56.398438 L 93.605469 56.398438 Z M 93.605469 31.199219 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(96.862745%,56.078434%,56.078434%);fill-opacity:1;" d="M 3 3 L 36.601562 3 L 36.601562 28.199219 L 3 28.199219 Z M 3 3 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(78.039217%,26.274511%,26.274511%);fill-opacity:1;" d="M 36 3.601562 L 36 27.601562 L 3.601562 27.601562 L 3.601562 3.601562 L 36 3.601562 M 37.199219 2.402344 L 2.398438 2.402344 L 2.398438 28.800781 L 37.199219 28.800781 Z M 37.199219 2.402344 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(40.000001%,47.450981%,56.078434%);fill-opacity:1;" d="M 58.804688 80.398438 L 20.40625 80.398438 L 20.40625 28.800781 L 19.207031 28.800781 L 19.207031 81.601562 L 58.804688 81.601562 Z M 58.804688 80.398438 "/>
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(40.000001%,47.450981%,56.078434%);fill-opacity:1;" d="M 19.207031 44.398438 L 19.207031 43.199219 L 58.808594 43.199219 L 58.808594 44.398438 Z M 19.207031 44.398438 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -128,5 +128,6 @@
<file>themes/Outdoor Night.json</file>
<file>themes/Yaru Dark.json</file>
<file>themes/Yaru Light.json</file>
<file>images/tree.svg</file>
</qresource>
</RCC>

View File

@ -569,7 +569,33 @@ void Project::Model::deleteCurrentDataset()
void Project::Model::duplicateCurrentGroup() {}
void Project::Model::duplicateCurrentDataset() {}
void Project::Model::duplicateCurrentDataset()
{
// Initialize a new dataset
auto dataset = m_selectedDataset;
dataset.m_title = tr("%1 (Copy)").arg(dataset.title());
dataset.m_index = nextDatasetIndex();
dataset.m_datasetId = m_groups[dataset.groupId()].datasetCount();
// Register the dataset to the group
m_groups[dataset.groupId()].m_datasets.append(dataset);
// Build tree model & set modification flag
buildTreeModel();
setModified(true);
// Select dataset
for (auto i = m_datasetItems.begin(); i != m_datasetItems.end(); ++i)
{
if (i.value().groupId() == dataset.groupId()
&& i.value().datasetId() == dataset.datasetId())
{
m_selectionModel->setCurrentIndex(i.key()->index(),
QItemSelectionModel::ClearAndSelect);
break;
}
}
}
void Project::Model::changeDatasetParentGroup() {}