Skip to content

Commit

Permalink
qmlui: improve project loading with Function editor open
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed Dec 22, 2024
1 parent 46f4109 commit ad4d7c3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
4 changes: 3 additions & 1 deletion qmlui/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ bool App::newWorkspace()

bool App::loadWorkspace(const QString &fileName)
{
m_contextManager->resetContexts();

/* Clear existing document data */
clearDocument();
m_docLoaded = false;
Expand All @@ -618,9 +620,9 @@ bool App::loadWorkspace(const QString &fileName)
m_docLoaded = true;
updateRecentFilesList(localFilename);
emit docLoadedChanged();
m_contextManager->resetContexts();
m_doc->resetModified();
m_videoProvider = new VideoProvider(this, m_doc);
m_contextManager->resetContexts();

// autostart Function if set
if (m_doc->startupFunction() != Function::invalidId())
Expand Down
5 changes: 4 additions & 1 deletion qmlui/contextmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ void ContextManager::resetContexts()
{
m_channelsMap.clear();
resetDumpValues();

for (quint32 &itemID : m_selectedFixtures)
setFixtureSelection(itemID, -1, false);

m_selectedFixtures.clear();

m_functionManager->setEditorFunction(-1, true, false);
m_functionManager->selectFunctionID(-1, false);
m_editingEnabled = false;

emit environmentSizeChanged();
Expand Down
7 changes: 7 additions & 0 deletions qmlui/functionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,13 @@ void FunctionManager::setEditorFunction(quint32 fID, bool requestUI, bool back)
if ((int)fID == -1)
{
emit isEditingChanged(false);

if (requestUI == true)
{
QQuickItem *rightPanel = qobject_cast<QQuickItem*>(m_view->rootObject()->findChild<QObject *>("funcRightPanel"));
if (rightPanel != nullptr)
QMetaObject::invokeMethod(rightPanel, "requestEditor", Q_ARG(QVariant, -1), Q_ARG(QVariant, 0));
}
return;
}

Expand Down
1 change: 1 addition & 0 deletions qmlui/qml/SidePanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Rectangle

function animatePanel(checked)
{
console.log("checked=" + checked + ", isOpen=" + isOpen)
if (checked === isOpen)
return

Expand Down
19 changes: 14 additions & 5 deletions qmlui/qml/fixturesfunctions/RightPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SidePanel
loaderSource = fEditor
animatePanel(true)
addFunction.checked = false
funcEditor.checked = true
funcManagerButton.checked = true
}
}

Expand All @@ -98,8 +98,17 @@ SidePanel
// reset the currently loaded item first
loaderSource = ""
itemID = funcID
loaderSource = functionManager.getEditorResource(funcID)
animatePanel(true)

if (funcID === -1)
{
animatePanel(false)
funcManagerButton.checked = false
}
else
{
loaderSource = functionManager.getEditorResource(funcID)
animatePanel(true)
}
}

onContentLoaded:
Expand Down Expand Up @@ -139,7 +148,7 @@ SidePanel

animatePanel(true)
addFunction.checked = false
funcEditor.checked = true
funcManagerButton.checked = true
}
}

Expand Down Expand Up @@ -168,7 +177,7 @@ SidePanel

IconButton
{
id: funcEditor
id: funcManagerButton
z: 2
width: iconSize
height: iconSize
Expand Down

0 comments on commit ad4d7c3

Please sign in to comment.