Notify mapping window when changes occurs

Co-Authored-By: iTrooz <hey@itrooz.fr>
Co-Authored-By: Max Chateau <maxban.chateau@gmail.com>
Co-Authored-By: Damien R. <rodriguezdamien1677@gmail.com>
This commit is contained in:
Max Chateau 2025-10-18 22:57:26 +02:00 committed by iTrooz
parent 2a7dd35706
commit ac4eaec777
No known key found for this signature in database
GPG Key ID: 8B83F77667B1BC6A
6 changed files with 17 additions and 0 deletions

View File

@ -770,6 +770,9 @@ void IOWindow::UpdateExpression(std::string new_expression, UpdateMode mode)
const auto status = m_reference->GetParseStatus();
m_controller->UpdateSingleControlReference(g_controller_interface, m_reference);
// Emit signal that this IOWindow's expression changed.
emit ExpressionChanged(QString::fromStdString(m_reference->GetExpression()));
// This is the only place where we need to update the user variables. Keep the first 4 items.
while (m_variables_combo->count() > 4)
{

View File

@ -71,6 +71,7 @@ public:
signals:
void DetectInputComplete();
void TestOutputComplete();
void ExpressionChanged(const QString& expression);
private:
std::shared_ptr<ciface::Core::Device> GetSelectedDevice() const;

View File

@ -92,6 +92,12 @@ void MappingButton::AdvancedPressed()
IOWindow io(m_mapping_window, m_mapping_window->GetController(), m_reference,
m_reference->IsInput() ? IOWindow::Type::Input : IOWindow::Type::Output);
// Connect to IOWindow's ExpressionChanged signal
connect(&io, &IOWindow::ExpressionChanged, m_mapping_window, [this](const QString& expr) {
m_mapping_window->ExpressionChanged(1);
});
io.exec();
ConfigChanged();

View File

@ -133,6 +133,7 @@ public:
m_parent->GetController()->UpdateSingleControlReference(g_controller_interface,
control_reference);
m_parent->GetController()->GetConfig()->GenerateControllerTextures();
m_parent->ExpressionChanged(0);
}
void UpdateInputDetectionStartTimer()

View File

@ -616,3 +616,8 @@ void MappingWindow::ActivateExtensionTab()
{
m_tab_widget->setCurrentIndex(3);
}
void MappingWindow::ExpressionChanged(int source)
{
printf("ExpressionChanged(%d)\n", source);
}

View File

@ -56,6 +56,7 @@ public:
bool IsIterativeMappingEnabled() const;
void ShowExtensionMotionTabs(bool show);
void ActivateExtensionTab();
void ExpressionChanged(int source);
signals:
// Emitted when config has changed so widgets can update to reflect the change.