From cd62a41f22f45265700ac30d9615ca15c3c83567 Mon Sep 17 00:00:00 2001 From: Paulchen Panther Date: Sat, 1 May 2021 17:36:51 +0200 Subject: [PATCH 1/3] Global component states across instances --- libsrc/api/API.cpp | 16 ++++++++++++++-- libsrc/hyperion/HyperionIManager.cpp | 2 +- src/hyperiond/hyperiond.cpp | 3 +-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libsrc/api/API.cpp b/libsrc/api/API.cpp index b3413318..630133f6 100644 --- a/libsrc/api/API.cpp +++ b/libsrc/api/API.cpp @@ -205,8 +205,20 @@ bool API::setComponentState(const QString &comp, bool &compState, QString &reply if (component != COMP_INVALID) { - QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); - return true; + if (component == COMP_FORWARDER || + component == COMP_GRABBER || + component == COMP_V4L || + component == COMP_FLATBUFSERVER || + component == COMP_PROTOSERVER) + { + QMetaObject::invokeMethod(_instanceManager, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); + return true; + } + else + { + QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); + return true; + } } replyMsg = QString("Unknown component name: %1").arg(comp); return false; diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index 307bd073..72c03ece 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -88,9 +88,9 @@ bool HyperionIManager::startInstance(quint8 inst, bool block, QObject* caller, i // from Hyperion connect(hyperion, &Hyperion::settingsChanged, this, &HyperionIManager::settingsChanged); connect(hyperion, &Hyperion::videoMode, this, &HyperionIManager::requestVideoMode); - connect(hyperion, &Hyperion::compStateChangeRequest, this, &HyperionIManager::compStateChangeRequest); // to Hyperion connect(this, &HyperionIManager::newVideoMode, hyperion, &Hyperion::newVideoMode); + connect(this, &HyperionIManager::compStateChangeRequest, hyperion, &Hyperion::compStateChangeRequest); // add to queue and start _startQueue << inst; diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index ebc986f7..e5b62026 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -125,9 +125,8 @@ HyperionDaemon::HyperionDaemon(const QString& rootPath, QObject* parent, bool lo //Cleaning up Hyperion before quit connect(parent, SIGNAL(aboutToQuit()), this, SLOT(freeObjects())); - // pipe settings changes and component state changes from HyperionIManager to Daemon + // pipe settings changes from HyperionIManager to Daemon connect(_instanceManager, &HyperionIManager::settingsChanged, this, &HyperionDaemon::settingsChanged); - connect(_instanceManager, &HyperionIManager::compStateChangeRequest, this, &HyperionDaemon::compStateChangeRequest); // listen for setting changes of framegrabber and v4l2 connect(this, &HyperionDaemon::settingsChanged, this, &HyperionDaemon::handleSettingsUpdate); From b06126ee2866c6c7416d52dc8050fb64b743cb59 Mon Sep 17 00:00:00 2001 From: Paulchen Panther Date: Sun, 2 May 2021 15:47:14 +0200 Subject: [PATCH 2/3] Components divided on the dashboard --- assets/webconfig/content/dashboard.html | 22 ++++++++-- assets/webconfig/index.html | 8 ++-- assets/webconfig/js/content_dashboard.js | 53 +++++++++++++++++------- assets/webconfig/js/content_grabber.js | 12 +++--- assets/webconfig/js/content_index.js | 27 ++++++++++-- 5 files changed, 89 insertions(+), 33 deletions(-) diff --git a/assets/webconfig/content/dashboard.html b/assets/webconfig/content/dashboard.html index a83ef2e9..6c7bb44e 100644 --- a/assets/webconfig/content/dashboard.html +++ b/assets/webconfig/content/dashboard.html @@ -16,6 +16,20 @@ Status
+ + + + + + + +
+ + Components +
+ + + @@ -28,22 +42,22 @@ - + - + - + - + diff --git a/assets/webconfig/index.html b/assets/webconfig/index.html index e8154e01..747c2ed7 100644 --- a/assets/webconfig/index.html +++ b/assets/webconfig/index.html @@ -207,22 +207,22 @@
  • Dashboard
  • General
  • - Configuration + LED-Instances
  • Capturing Hardware
  • -
  • Network
  • +
  • Network
  • Remote Control
  • Effects Configurator
  • Support
  • System
  • '; - instances_html += ''; - instances_html += ''; + instances_html += ''; + instances_html += ''; instances_html += '
    protoproto unknown
    flatflat unknown
    jsonjson unknown
    websocketwebsocket unknown
    ' + $.i18n('conf_leds_contr_label_contrtype') + '' + window.serverConfig.device.type + '' + $.i18n('conf_leds_contr_label_contrtype') + '' + window.serverConfig.device.type + '
    '; instances_html += ''; @@ -50,28 +50,46 @@ $(document).ready(function () { instances_html += '' + $.i18n('dashboard_componentbox_label_title') + ''; instances_html += ''; - var tab_components = ""; + var instance_components = ""; + var global_components = ""; for (var idx = 0; idx < components.length; idx++) { if (components[idx].name != "ALL") { - var comp_enabled = components[idx].enabled ? "checked" : ""; - const general_comp = "general_comp_" + components[idx].name; - var componentBtn = ''; + if (components[idx].name != "FORWARDER" && components[idx].name != "GRABBER" && components[idx].name != "V4L") { + var comp_enabled = components[idx].enabled ? "checked" : ""; + const general_comp = "general_comp_" + components[idx].name; + var componentBtn = ''; - tab_components += ''; + instance_components += ''; + } else { + var comp_enabled = components[idx].enabled ? "checked" : ""; + const general_comp = "general_comp_" + components[idx].name; + var componentBtn = ''; + + global_components += ''; + } } } - instances_html += '' + tab_components + '
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '
    '; + instances_html += '' + instance_components + ''; instances_html += '
    '; $('.instances').prepend(instances_html); + $('.glob_components').html(global_components); + updateUiOnInstance(window.currentHyperionInstance); updateHyperionInstanceListing(); @@ -83,7 +101,10 @@ $(document).ready(function () { for (var idx = 0; idx < components.length; idx++) { if (components[idx].name != "ALL") { $("#general_comp_" + components[idx].name).bootstrapToggle(); - $("#general_comp_" + components[idx].name).bootstrapToggle(hyperion_enabled ? "enable" : "disable") + + if (components[idx].name != "FORWARDER" && components[idx].name != "GRABBER" && components[idx].name != "V4L") + $("#general_comp_" + components[idx].name).bootstrapToggle(hyperion_enabled ? "enable" : "disable") + $("#general_comp_" + components[idx].name).change(e => { requestSetComponentState(e.currentTarget.id.split('_')[2], e.currentTarget.checked); }); diff --git a/assets/webconfig/js/content_grabber.js b/assets/webconfig/js/content_grabber.js index 246f32e9..d5c15b33 100644 --- a/assets/webconfig/js/content_grabber.js +++ b/assets/webconfig/js/content_grabber.js @@ -182,26 +182,26 @@ $(document).ready(function () { if (window.showOptHelp) { // Instance Capture $('#conf_cont').append(createRow('conf_cont_instCapt')); - $('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); + $('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt', 'panel-system')); $('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title"))); // Framegrabber $('#conf_cont').append(createRow('conf_cont_fg')); - $('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); + $('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg', 'panel-system')); $('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"))); // V4L2 - hide if not available if (V4L2_AVAIL) { $('#conf_cont').append(createRow('conf_cont_v4l')); - $('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); + $('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2', 'panel-system')); $('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title"))); } } else { $('#conf_cont').addClass('row'); - $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); - $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); + $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt', 'panel-system')); + $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg', 'panel-system')); if (V4L2_AVAIL) { - $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); + $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2', 'panel-system')); } } diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index 124ca20c..a2428ef2 100755 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -307,12 +307,18 @@ $(document).ready(function () { window.scrollTo(0, 0); }); - $(window).scroll(function(){ + $(window).scroll(function() { if ($(window).scrollTop() > 65) $("#navbar_brand_logo").css("display", "none"); else $("#navbar_brand_logo").css("display", ""); }); + + $('#side-menu li a, #side-menu li ul li a').click(function() { + console.log('test'); + $('#side-menu').find('.active').toggleClass('inactive'); // find all active classes and set inactive; + $(this).addClass('active'); + }); }); function suppressDefaultPwWarning() { @@ -349,7 +355,7 @@ $("#btn_darkmode").off().on("click", function (e) { }); // Menuitem toggle; -function SwitchToMenuItem(target) { +function SwitchToMenuItem(target, item) { document.getElementById(target).click(); // Get Date: Sun, 2 May 2021 19:04:58 +0200 Subject: [PATCH 3/3] refactor --- assets/webconfig/content/dashboard.html | 26 +++++++++----- assets/webconfig/css/hyperion.css | 2 ++ assets/webconfig/index.html | 2 +- assets/webconfig/js/content_dashboard.js | 45 ++++++++++-------------- assets/webconfig/js/content_index.js | 2 +- assets/webconfig/js/content_remote.js | 2 +- libsrc/api/API.cpp | 16 ++------- libsrc/hyperion/HyperionIManager.cpp | 1 - 8 files changed, 42 insertions(+), 54 deletions(-) diff --git a/assets/webconfig/content/dashboard.html b/assets/webconfig/content/dashboard.html index 6c7bb44e..0b322fd0 100644 --- a/assets/webconfig/content/dashboard.html +++ b/assets/webconfig/content/dashboard.html @@ -20,16 +20,24 @@ - - Components + + Capturing Hardware - + + + + Screen Capture + unknown + + + + USB Capture + unknown + + - - - @@ -42,17 +50,17 @@ - + - + - + diff --git a/assets/webconfig/css/hyperion.css b/assets/webconfig/css/hyperion.css index ca9c6b20..9f2ce55b 100644 --- a/assets/webconfig/css/hyperion.css +++ b/assets/webconfig/css/hyperion.css @@ -76,9 +76,11 @@ table.input-group{width:100%} /*table*/ table.borderless td,table.borderless th{border: none !important;} +table.borderless td:first-child{width: 25px !important;} .borderless {margin-bottom:0px} table label{margin:0} table.first_cell_borderless td:first-child,table.first_cell_borderless th:first-child{border: none !important;} +table.first_cell_borderless td:first-child{width: 25px !important;} /*Header*/ .navbar-brand{padding-top:4px;padding-bottom:0px;padding-left:2;} diff --git a/assets/webconfig/index.html b/assets/webconfig/index.html index 747c2ed7..24b711a8 100644 --- a/assets/webconfig/index.html +++ b/assets/webconfig/index.html @@ -214,7 +214,7 @@
  • Image Processing
  • -
  • Capturing Hardware
  • +
  • Capturing Hardware
  • Network
  • Remote Control
  • Effects Configurator
  • diff --git a/assets/webconfig/js/content_dashboard.js b/assets/webconfig/js/content_dashboard.js index d672edaf..22722901 100644 --- a/assets/webconfig/js/content_dashboard.js +++ b/assets/webconfig/js/content_dashboard.js @@ -51,36 +51,23 @@ $(document).ready(function () { instances_html += ''; var instance_components = ""; - var global_components = ""; for (var idx = 0; idx < components.length; idx++) { if (components[idx].name != "ALL") { - if (components[idx].name != "FORWARDER" && components[idx].name != "GRABBER" && components[idx].name != "V4L") { - var comp_enabled = components[idx].enabled ? "checked" : ""; - const general_comp = "general_comp_" + components[idx].name; - var componentBtn = ''; + if (components[idx].name === "FORWARDER" && window.currentHyperionInstance != 0) + continue; - instance_components += ''; - } else { - var comp_enabled = components[idx].enabled ? "checked" : ""; - const general_comp = "general_comp_" + components[idx].name; - var componentBtn = ''; + var comp_enabled = components[idx].enabled ? "checked" : ""; + const general_comp = "general_comp_" + components[idx].name; + var componentBtn = ''; - global_components += ''; - } + instance_components += ''; } } @@ -88,7 +75,6 @@ $(document).ready(function () { instances_html += ''; $('.instances').prepend(instances_html); - $('.glob_components').html(global_components); updateUiOnInstance(window.currentHyperionInstance); updateHyperionInstanceListing(); @@ -113,6 +99,11 @@ $(document).ready(function () { } // add more info + var screenCapture = window.serverConfig.instCapture.systemEnable ? $.i18n('general_enabled') : $.i18n('general_disabled'); + $('#dash_screen_capture').html(screenCapture); + var usbCapture = window.serverConfig.instCapture.v4lEnable ? $.i18n('general_enabled') : $.i18n('general_disabled'); + $('#dash_usb_capture').html(usbCapture); + var fbPort = window.serverConfig.flatbufServer.enable ? window.serverConfig.flatbufServer.port : $.i18n('general_disabled'); $('#dash_fbPort').html(fbPort); var pbPort = window.serverConfig.protoServer.enable ? window.serverConfig.protoServer.port : $.i18n('general_disabled'); diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index a2428ef2..a7b9a5e6 100755 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -312,7 +312,7 @@ $(document).ready(function () { $("#navbar_brand_logo").css("display", "none"); else $("#navbar_brand_logo").css("display", ""); - }); + }); $('#side-menu li a, #side-menu li ul li a').click(function() { console.log('test'); diff --git a/assets/webconfig/js/content_remote.js b/assets/webconfig/js/content_remote.js index c5d58f25..cf446dbf 100644 --- a/assets/webconfig/js/content_remote.js +++ b/assets/webconfig/js/content_remote.js @@ -201,7 +201,7 @@ $(document).ready(function () { }); for (const comp of components) { - if (comp.name === "ALL") + if (comp.name === "ALL" || (comp.name === "FORWARDER" && window.currentHyperionInstance != 0)) continue; const enable_style = (comp.enabled ? "checked" : ""); diff --git a/libsrc/api/API.cpp b/libsrc/api/API.cpp index 630133f6..b3413318 100644 --- a/libsrc/api/API.cpp +++ b/libsrc/api/API.cpp @@ -205,20 +205,8 @@ bool API::setComponentState(const QString &comp, bool &compState, QString &reply if (component != COMP_INVALID) { - if (component == COMP_FORWARDER || - component == COMP_GRABBER || - component == COMP_V4L || - component == COMP_FLATBUFSERVER || - component == COMP_PROTOSERVER) - { - QMetaObject::invokeMethod(_instanceManager, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); - return true; - } - else - { - QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); - return true; - } + QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); + return true; } replyMsg = QString("Unknown component name: %1").arg(comp); return false; diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index 72c03ece..f1080156 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -90,7 +90,6 @@ bool HyperionIManager::startInstance(quint8 inst, bool block, QObject* caller, i connect(hyperion, &Hyperion::videoMode, this, &HyperionIManager::requestVideoMode); // to Hyperion connect(this, &HyperionIManager::newVideoMode, hyperion, &Hyperion::newVideoMode); - connect(this, &HyperionIManager::compStateChangeRequest, hyperion, &Hyperion::compStateChangeRequest); // add to queue and start _startQueue << inst;
    protoproto unknown
    flatflat unknown
    jsonjson unknown
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '
    ' + $.i18n('general_comp_' + components[idx].name) + '' + componentBtn + '