From a6fe516e35221f25796a0482b426a8fcfa9a02ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Wed, 3 May 2023 19:12:39 +0200 Subject: [PATCH 01/30] Initial framework for formatting & indentation check. --- unittest.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unittest.sh b/unittest.sh index dd2bc852f5..91d15fcd50 100755 --- a/unittest.sh +++ b/unittest.sh @@ -5,6 +5,9 @@ TESTPREFIX="" SLEEPCMD="" RUN_UI_TESTS="0" THISCMD=`basename "$0"` +THISDIR=`dirname "$0"` + +cd "$THISDIR" TARGET=${1:-} @@ -45,6 +48,20 @@ else fi fi +############################################################################# +# Indentation check +############################################################################# + +find engine/ -name '*.cpp' -or -name '*.h' | while read FILE; do + indent -st -npro -gnu "$FILE" | diff -u "$FILE" - + RET=$? + if [ $RET -ne 0 ]; then + echo >&2 "$FILE: Error in formatting." + exit $RET + fi +done || exit $? +exit 0 + ############################################################################# # Fixture definitions check with xmllint ############################################################################# From 3f52a1dad2ddb03f09a1118d72d34ce88e29028e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Thu, 4 May 2023 18:09:15 +0200 Subject: [PATCH 02/30] a few steps to configure indent --- .github/workflows/build.yml | 1 + .indent.pro | 38 +++++++++++++++++++++++++++++++++++++ unittest.sh | 3 +-- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .indent.pro diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 336b80ed35..cb482e2994 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: libxml2-utils xvfb ccache + indent wget PACKAGES_QML_BASE: libpulse-dev diff --git a/.indent.pro b/.indent.pro new file mode 100644 index 0000000000..d8dea39159 --- /dev/null +++ b/.indent.pro @@ -0,0 +1,38 @@ +--no-tabs +--no-blank-lines-after-declarations +--blank-lines-after-procedures +--no-blank-lines-after-commas +--break-before-boolean-operator +--honour-newlines +--braces-on-struct-decl-line +--comment-indentation33 +--declaration-comment-column33 +--no-comment-delimiters-on-blank-lines +--dont-cuddle-else +--single-line-conditionals +--continuation-indentation4 +--case-indentation0 +--line-comments-indentation0 +--declaration-indentation1 +--leave-preprocessor-space +--preprocessor-indentation0 +--dont-format-first-column-comments +--indent-level4 +--parameter-indentation0 +--line-length120 +--dont-line-up-parentheses +--no-space-after-function-call-names +--no-space-after-parentheses +--dont-break-procedure-type +--space-after-if +--space-after-for +--space-after-while +--no-space-after-casts +--dont-star-comments +--leave-optional-blank-lines +--dont-format-comments +--else-endif-column33 +--space-special-semicolon +--tab-size4 +--indent-label1 +--verbose diff --git a/unittest.sh b/unittest.sh index 91d15fcd50..b183738a8a 100755 --- a/unittest.sh +++ b/unittest.sh @@ -53,14 +53,13 @@ fi ############################################################################# find engine/ -name '*.cpp' -or -name '*.h' | while read FILE; do - indent -st -npro -gnu "$FILE" | diff -u "$FILE" - + INDENT_PROFILE="$THISDIR/.indent.pro" indent -st "$FILE" | diff -u "$FILE" - RET=$? if [ $RET -ne 0 ]; then echo >&2 "$FILE: Error in formatting." exit $RET fi done || exit $? -exit 0 ############################################################################# # Fixture definitions check with xmllint From 8c172ad40f91191d1ba95c72ca0ceaabe7841141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Fri, 12 May 2023 21:25:18 +0200 Subject: [PATCH 03/30] Add current version of indent.pro --- .indent.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/.indent.pro b/.indent.pro index d8dea39159..f93bffec04 100644 --- a/.indent.pro +++ b/.indent.pro @@ -35,4 +35,3 @@ --space-special-semicolon --tab-size4 --indent-label1 ---verbose From f4f87d222b00c8aae524f00312f43dc05f8030a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Fri, 12 May 2023 21:31:38 +0200 Subject: [PATCH 04/30] Mograte from indent to clang-format for more options and better fit. --- .github/workflows/build.yml | 2 +- .indent.pro | 37 ------------------------------------- unittest.sh | 3 ++- 3 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 .indent.pro diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb482e2994..656695ec89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: libxml2-utils xvfb ccache - indent + clang-format wget PACKAGES_QML_BASE: libpulse-dev diff --git a/.indent.pro b/.indent.pro deleted file mode 100644 index f93bffec04..0000000000 --- a/.indent.pro +++ /dev/null @@ -1,37 +0,0 @@ ---no-tabs ---no-blank-lines-after-declarations ---blank-lines-after-procedures ---no-blank-lines-after-commas ---break-before-boolean-operator ---honour-newlines ---braces-on-struct-decl-line ---comment-indentation33 ---declaration-comment-column33 ---no-comment-delimiters-on-blank-lines ---dont-cuddle-else ---single-line-conditionals ---continuation-indentation4 ---case-indentation0 ---line-comments-indentation0 ---declaration-indentation1 ---leave-preprocessor-space ---preprocessor-indentation0 ---dont-format-first-column-comments ---indent-level4 ---parameter-indentation0 ---line-length120 ---dont-line-up-parentheses ---no-space-after-function-call-names ---no-space-after-parentheses ---dont-break-procedure-type ---space-after-if ---space-after-for ---space-after-while ---no-space-after-casts ---dont-star-comments ---leave-optional-blank-lines ---dont-format-comments ---else-endif-column33 ---space-special-semicolon ---tab-size4 ---indent-label1 diff --git a/unittest.sh b/unittest.sh index b183738a8a..b9f50d0118 100755 --- a/unittest.sh +++ b/unittest.sh @@ -6,6 +6,7 @@ SLEEPCMD="" RUN_UI_TESTS="0" THISCMD=`basename "$0"` THISDIR=`dirname "$0"` +DIFFARG="-u" cd "$THISDIR" @@ -53,7 +54,7 @@ fi ############################################################################# find engine/ -name '*.cpp' -or -name '*.h' | while read FILE; do - INDENT_PROFILE="$THISDIR/.indent.pro" indent -st "$FILE" | diff -u "$FILE" - + clang-format -style=file engine/src/rgbscript.cpp "$FILE" | diff $DIFFARG "$FILE" - RET=$? if [ $RET -ne 0 ]; then echo >&2 "$FILE: Error in formatting." From 53dbb892000768ca55b79e261e196974136855c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Fri, 12 May 2023 21:57:44 +0200 Subject: [PATCH 05/30] Apply unified formatting rules. --- .clang-format | 191 ++ engine/audio/plugins/mad/audiodecoder_mad.cpp | 115 +- engine/audio/plugins/mad/audiodecoder_mad.h | 26 +- .../plugins/sndfile/audiodecoder_sndfile.cpp | 57 +- .../plugins/sndfile/audiodecoder_sndfile.h | 10 +- engine/audio/src/audio.cpp | 69 +- engine/audio/src/audio.h | 12 +- engine/audio/src/audiocapture.cpp | 52 +- engine/audio/src/audiocapture.h | 39 +- engine/audio/src/audiocapture_alsa.cpp | 65 +- engine/audio/src/audiocapture_alsa.h | 6 +- engine/audio/src/audiocapture_portaudio.cpp | 58 +- engine/audio/src/audiocapture_portaudio.h | 2 +- engine/audio/src/audiocapture_qt5.cpp | 15 +- engine/audio/src/audiocapture_qt5.h | 6 +- engine/audio/src/audiocapture_qt6.cpp | 17 +- engine/audio/src/audiocapture_qt6.h | 6 +- engine/audio/src/audiocapture_wavein.cpp | 23 +- engine/audio/src/audiocapture_wavein.h | 6 +- engine/audio/src/audiodecoder.h | 12 +- engine/audio/src/audioparameters.cpp | 29 +- engine/audio/src/audioparameters.h | 16 +- engine/audio/src/audioplugincache.cpp | 62 +- engine/audio/src/audioplugincache.h | 6 +- engine/audio/src/audiorenderer.cpp | 28 +- engine/audio/src/audiorenderer.h | 16 +- engine/audio/src/audiorenderer_alsa.cpp | 107 +- engine/audio/src/audiorenderer_alsa.h | 14 +- engine/audio/src/audiorenderer_coreaudio.cpp | 24 +- engine/audio/src/audiorenderer_coreaudio.h | 10 +- engine/audio/src/audiorenderer_null.cpp | 3 +- engine/audio/src/audiorenderer_null.h | 28 +- engine/audio/src/audiorenderer_portaudio.cpp | 66 +- engine/audio/src/audiorenderer_portaudio.h | 14 +- engine/audio/src/audiorenderer_qt5.cpp | 50 +- engine/audio/src/audiorenderer_qt5.h | 8 +- engine/audio/src/audiorenderer_qt6.cpp | 42 +- engine/audio/src/audiorenderer_qt6.h | 8 +- engine/audio/src/audiorenderer_waveout.cpp | 143 +- engine/audio/src/audiorenderer_waveout.h | 4 +- engine/src/avolitesd4parser.cpp | 330 ++- engine/src/avolitesd4parser.h | 28 +- engine/src/bus.cpp | 9 +- engine/src/bus.h | 14 +- engine/src/channelmodifier.cpp | 30 +- engine/src/channelmodifier.h | 17 +- engine/src/channelsgroup.cpp | 57 +- engine/src/channelsgroup.h | 16 +- engine/src/chaser.cpp | 52 +- engine/src/chaser.h | 28 +- engine/src/chaserrunner.cpp | 287 +- engine/src/chaserrunner.h | 42 +- engine/src/chaserstep.cpp | 20 +- engine/src/chaserstep.h | 23 +- engine/src/collection.cpp | 69 +- engine/src/collection.h | 16 +- engine/src/cue.cpp | 20 +- engine/src/cue.h | 30 +- engine/src/cuestack.cpp | 69 +- engine/src/cuestack.h | 36 +- engine/src/dmxdumpfactoryproperties.cpp | 1 - engine/src/dmxsource.h | 15 +- engine/src/doc.cpp | 259 +- engine/src/doc.h | 80 +- engine/src/efx.cpp | 152 +- engine/src/efx.h | 93 +- engine/src/efxfixture.cpp | 120 +- engine/src/efxfixture.h | 40 +- engine/src/fadechannel.cpp | 21 +- engine/src/fadechannel.h | 28 +- engine/src/fixture.cpp | 279 +- engine/src/fixture.h | 77 +- engine/src/fixturegroup.cpp | 23 +- engine/src/fixturegroup.h | 18 +- engine/src/function.cpp | 227 +- engine/src/function.h | 105 +- engine/src/functionparent.h | 5 +- engine/src/genericdmxsource.cpp | 16 +- engine/src/genericdmxsource.h | 6 +- engine/src/genericfader.cpp | 40 +- engine/src/genericfader.h | 14 +- engine/src/gradient.cpp | 18 +- engine/src/gradient.h | 2 +- engine/src/grandmaster.cpp | 29 +- engine/src/grandmaster.h | 6 +- engine/src/grouphead.cpp | 7 +- engine/src/inputoutputmap.cpp | 188 +- engine/src/inputoutputmap.h | 42 +- engine/src/inputpatch.cpp | 36 +- engine/src/inputpatch.h | 11 +- engine/src/ioplugincache.cpp | 24 +- engine/src/ioplugincache.h | 4 +- engine/src/keypadparser.cpp | 70 +- engine/src/keypadparser.h | 2 +- engine/src/mastertimer-unix.cpp | 41 +- engine/src/mastertimer-unix.h | 8 +- engine/src/mastertimer-win32.cpp | 11 +- engine/src/mastertimer.cpp | 46 +- engine/src/mastertimer.h | 24 +- engine/src/monitorproperties.cpp | 117 +- engine/src/monitorproperties.h | 222 +- engine/src/outputpatch.cpp | 8 +- engine/src/outputpatch.h | 6 +- engine/src/qlccapability.cpp | 120 +- engine/src/qlccapability.h | 47 +- engine/src/qlcchannel.cpp | 928 +++---- engine/src/qlcchannel.h | 63 +- engine/src/qlcclipboard.cpp | 7 +- engine/src/qlcclipboard.h | 22 +- engine/src/qlcfile.cpp | 51 +- engine/src/qlcfile.h | 34 +- engine/src/qlcfixturedef.cpp | 130 +- engine/src/qlcfixturedef.h | 30 +- engine/src/qlcfixturedefcache.cpp | 63 +- engine/src/qlcfixturedefcache.h | 13 +- engine/src/qlcfixturehead.cpp | 33 +- engine/src/qlcfixturehead.h | 26 +- engine/src/qlcfixturemode.cpp | 83 +- engine/src/qlcfixturemode.h | 48 +- engine/src/qlcinputchannel.cpp | 71 +- engine/src/qlcinputchannel.h | 33 +- engine/src/qlcinputprofile.cpp | 32 +- engine/src/qlcinputprofile.h | 18 +- engine/src/qlcinputsource.cpp | 14 +- engine/src/qlcinputsource.h | 12 +- engine/src/qlcmodifierscache.cpp | 16 +- engine/src/qlcmodifierscache.h | 2 +- engine/src/qlcpalette.cpp | 286 +- engine/src/qlcpalette.h | 32 +- engine/src/qlcphysical.cpp | 24 +- engine/src/qlcphysical.h | 38 +- engine/src/qlcpoint.cpp | 2 +- engine/src/qlcpoint.h | 2 +- engine/src/rgbalgorithm.cpp | 8 +- engine/src/rgbalgorithm.h | 43 +- engine/src/rgbaudio.cpp | 31 +- engine/src/rgbaudio.h | 16 +- engine/src/rgbimage.cpp | 86 +- engine/src/rgbimage.h | 17 +- engine/src/rgbmatrix.cpp | 142 +- engine/src/rgbmatrix.h | 34 +- engine/src/rgbplain.cpp | 16 +- engine/src/rgbplain.h | 10 +- engine/src/rgbscript.cpp | 84 +- engine/src/rgbscript.h | 16 +- engine/src/rgbscriptproperty.h | 4 +- engine/src/rgbscriptscache.cpp | 6 +- engine/src/rgbscriptscache.h | 2 +- engine/src/rgbscriptv4.cpp | 81 +- engine/src/rgbscriptv4.h | 16 +- engine/src/rgbtext.cpp | 31 +- engine/src/rgbtext.h | 19 +- engine/src/scene.cpp | 102 +- engine/src/scene.h | 24 +- engine/src/scenevalue.cpp | 12 +- engine/src/scenevalue.h | 16 +- engine/src/script.cpp | 88 +- engine/src/script.h | 28 +- engine/src/scriptrunner.cpp | 60 +- engine/src/scriptrunner.h | 14 +- engine/src/scriptv4.cpp | 75 +- engine/src/scriptv4.h | 20 +- engine/src/sequence.cpp | 25 +- engine/src/sequence.h | 4 +- engine/src/show.cpp | 85 +- engine/src/show.h | 16 +- engine/src/showfunction.cpp | 28 +- engine/src/showfunction.h | 10 +- engine/src/showrunner.cpp | 50 +- engine/src/showrunner.h | 7 +- engine/src/track.cpp | 39 +- engine/src/track.h | 20 +- engine/src/universe.cpp | 177 +- engine/src/universe.h | 104 +- engine/src/utils.h | 1 - engine/src/video.cpp | 118 +- engine/src/video.h | 8 +- engine/test/bus/bus_test.cpp | 4 +- engine/test/chaser/chaser_test.cpp | 12 +- .../test/chaserrunner/chaserrunner_test.cpp | 2 +- engine/test/chaserrunner/chaserrunner_test.h | 16 +- engine/test/chaserstep/chaserstep_test.cpp | 3 +- engine/test/collection/collection_test.cpp | 14 +- engine/test/cue/cue_test.cpp | 2 +- engine/test/cuestack/cuestack_test.cpp | 29 +- engine/test/doc/doc_test.cpp | 149 +- engine/test/doc/doc_test.h | 8 +- engine/test/efx/efx_test.cpp | 2378 ++++++++--------- engine/test/efxfixture/efxfixture_test.cpp | 36 +- engine/test/fadechannel/fadechannel_test.cpp | 10 +- engine/test/fixture/fixture_test.cpp | 20 +- .../test/fixturegroup/fixturegroup_test.cpp | 3 +- engine/test/function/function_stub.cpp | 15 +- engine/test/function/function_stub.h | 5 +- engine/test/function/function_test.cpp | 26 +- .../test/genericfader/genericfader_test.cpp | 14 +- engine/test/grandmaster/grandmaster_test.h | 3 +- .../inputoutputmap/inputoutputmap_test.cpp | 88 +- .../test/inputoutputmap/inputoutputmap_test.h | 2 - engine/test/inputpatch/inputpatch_test.cpp | 4 +- engine/test/iopluginstub/iopluginstub.cpp | 6 +- engine/test/iopluginstub/iopluginstub.h | 4 +- engine/test/keypadparser/keypadparser_test.h | 2 +- engine/test/mastertimer/dmxsource_stub.cpp | 6 +- engine/test/mastertimer/mastertimer_stub.cpp | 4 +- engine/test/mastertimer/mastertimer_stub.h | 7 +- engine/test/mastertimer/mastertimer_test.cpp | 6 +- engine/test/outputpatch/outputpatch_test.cpp | 36 +- .../test/qlccapability/qlccapability_test.cpp | 6 +- engine/test/qlcchannel/qlcchannel_test.cpp | 11 +- engine/test/qlcfile/qlcfile_test.cpp | 57 +- .../qlcfixturedefcache_test.cpp | 11 +- .../qlcfixturedefcache_test.h | 2 +- .../qlcfixturehead/qlcfixturehead_test.cpp | 21 +- .../qlcfixturemode/qlcfixturemode_test.cpp | 8 +- .../qlcinputchannel/qlcinputchannel_test.cpp | 52 +- engine/test/qlcphysical/qlcphysical_test.cpp | 5 +- engine/test/rgbalgorithm/rgbalgorithm_test.h | 3 +- engine/test/rgbmatrix/rgbmatrix_test.cpp | 3 +- engine/test/rgbscript/rgbscript_test.cpp | 69 +- engine/test/rgbscript/rgbscript_test.h | 2 +- engine/test/rgbtext/rgbtext_test.cpp | 4 +- engine/test/rgbtext/rgbtext_test.h | 2 +- engine/test/scene/scene_test.cpp | 120 +- engine/test/script/script_test.cpp | 34 +- engine/test/sequence/sequence_test.cpp | 20 +- engine/test/universe/universe_test.cpp | 40 +- engine/test/universe/universe_test.h | 5 +- launcher/launcher.cpp | 7 +- launcher/main.cpp | 6 +- qmlui/app.cpp | 110 +- qmlui/app.h | 112 +- qmlui/audioeditor.cpp | 18 +- qmlui/audioeditor.h | 4 +- qmlui/chasereditor.cpp | 271 +- qmlui/chasereditor.h | 15 +- qmlui/collectioneditor.cpp | 10 +- qmlui/collectioneditor.h | 6 +- qmlui/colorfilters.cpp | 24 +- qmlui/colorfilters.h | 10 +- qmlui/contextmanager.cpp | 258 +- qmlui/contextmanager.h | 47 +- qmlui/efxeditor.cpp | 117 +- qmlui/efxeditor.h | 17 +- qmlui/fixturebrowser.cpp | 24 +- qmlui/fixturebrowser.h | 15 +- qmlui/fixtureeditor/channeledit.cpp | 48 +- qmlui/fixtureeditor/channeledit.h | 12 +- qmlui/fixtureeditor/editorview.cpp | 86 +- qmlui/fixtureeditor/editorview.h | 26 +- qmlui/fixtureeditor/fixtureeditor.cpp | 15 +- qmlui/fixtureeditor/fixtureeditor.h | 8 +- qmlui/fixtureeditor/modeedit.cpp | 31 +- qmlui/fixtureeditor/modeedit.h | 22 +- qmlui/fixtureeditor/physicaledit.cpp | 8 +- qmlui/fixtureeditor/physicaledit.h | 5 +- qmlui/fixturegroupeditor.cpp | 144 +- qmlui/fixturegroupeditor.h | 10 +- qmlui/fixturemanager.cpp | 603 ++--- qmlui/fixturemanager.h | 76 +- qmlui/fixtureutils.cpp | 418 +-- qmlui/fixtureutils.h | 18 +- qmlui/functioneditor.cpp | 38 +- qmlui/functioneditor.h | 10 +- qmlui/functionmanager.cpp | 308 ++- qmlui/functionmanager.h | 92 +- qmlui/importmanager.cpp | 233 +- qmlui/importmanager.h | 34 +- qmlui/inputoutputmanager.cpp | 95 +- qmlui/inputoutputmanager.h | 4 +- qmlui/listmodel.cpp | 15 +- qmlui/listmodel.h | 16 +- qmlui/main.cpp | 38 +- qmlui/mainview2d.cpp | 208 +- qmlui/mainview2d.h | 21 +- qmlui/mainview3d.cpp | 485 ++-- qmlui/mainview3d.h | 104 +- qmlui/mainviewdmx.cpp | 42 +- qmlui/mainviewdmx.h | 8 +- qmlui/modelselector.cpp | 20 +- qmlui/modelselector.h | 10 +- qmlui/palettemanager.cpp | 61 +- qmlui/palettemanager.h | 39 +- qmlui/previewcontext.cpp | 57 +- qmlui/previewcontext.h | 38 +- qmlui/rgbmatrixeditor.cpp | 161 +- qmlui/rgbmatrixeditor.h | 10 +- qmlui/sceneeditor.cpp | 91 +- qmlui/sceneeditor.h | 16 +- qmlui/scripteditor.cpp | 4 +- qmlui/scripteditor.h | 4 +- qmlui/showmanager.cpp | 99 +- qmlui/showmanager.h | 37 +- qmlui/simpledesk.cpp | 86 +- qmlui/simpledesk.h | 30 +- qmlui/tardis/networkmanager.cpp | 96 +- qmlui/tardis/networkmanager.h | 20 +- qmlui/tardis/networkpacketizer.cpp | 110 +- qmlui/tardis/networkpacketizer.h | 11 +- qmlui/tardis/simplecrypt.cpp | 85 +- qmlui/tardis/simplecrypt.h | 89 +- qmlui/tardis/tardis.cpp | 529 ++-- qmlui/tardis/tardis.h | 34 +- qmlui/treemodel.cpp | 152 +- qmlui/treemodel.h | 36 +- qmlui/treemodelitem.cpp | 10 +- qmlui/treemodelitem.h | 10 +- qmlui/uimanager.cpp | 35 +- qmlui/uimanager.h | 8 +- qmlui/videoeditor.cpp | 22 +- qmlui/videoeditor.h | 6 +- qmlui/videoprovider.cpp | 77 +- qmlui/videoprovider.h | 34 +- qmlui/virtualconsole/vcbutton.cpp | 71 +- qmlui/virtualconsole/vcbutton.h | 48 +- qmlui/virtualconsole/vcclock.cpp | 83 +- qmlui/virtualconsole/vcclock.h | 86 +- qmlui/virtualconsole/vccuelist.cpp | 232 +- qmlui/virtualconsole/vccuelist.h | 45 +- qmlui/virtualconsole/vcframe.cpp | 252 +- qmlui/virtualconsole/vcframe.h | 78 +- qmlui/virtualconsole/vclabel.cpp | 14 +- qmlui/virtualconsole/vclabel.h | 10 +- qmlui/virtualconsole/vcpage.cpp | 69 +- qmlui/virtualconsole/vcpage.h | 23 +- qmlui/virtualconsole/vcslider.cpp | 258 +- qmlui/virtualconsole/vcslider.h | 94 +- qmlui/virtualconsole/vcsoloframe.cpp | 28 +- qmlui/virtualconsole/vcsoloframe.h | 8 +- qmlui/virtualconsole/vcwidget.cpp | 221 +- qmlui/virtualconsole/vcwidget.h | 121 +- qmlui/virtualconsole/virtualconsole.cpp | 348 +-- qmlui/virtualconsole/virtualconsole.h | 58 +- ui/src/aboutbox.cpp | 17 +- ui/src/addchannelsgroup.cpp | 63 +- ui/src/addchannelsgroup.h | 6 +- ui/src/addfixture.cpp | 92 +- ui/src/addfixture.h | 14 +- ui/src/addresstool.cpp | 71 +- ui/src/addresstool.h | 22 +- ui/src/addrgbpanel.cpp | 30 +- ui/src/addrgbpanel.h | 20 +- ui/src/app.cpp | 189 +- ui/src/app.h | 21 +- ui/src/apputil.cpp | 29 +- ui/src/apputil.h | 80 +- ui/src/assignhotkey.cpp | 9 +- ui/src/audiobar.cpp | 55 +- ui/src/audiobar.h | 38 +- ui/src/audioeditor.cpp | 43 +- ui/src/audioeditor.h | 2 +- ui/src/audiotriggerwidget.cpp | 24 +- ui/src/audiotriggerwidget.h | 8 +- ui/src/channelmodifiereditor.cpp | 68 +- ui/src/channelmodifiereditor.h | 8 +- ui/src/channelmodifiergraphicsview.cpp | 161 +- ui/src/channelmodifiergraphicsview.h | 49 +- ui/src/channelsselection.cpp | 123 +- ui/src/channelsselection.h | 6 +- ui/src/chasereditor.cpp | 260 +- ui/src/chasereditor.h | 4 +- ui/src/clickandgoslider.cpp | 19 +- ui/src/clickandgoslider.h | 43 +- ui/src/clickandgowidget.cpp | 167 +- ui/src/clickandgowidget.h | 13 +- ui/src/collectioneditor.cpp | 24 +- ui/src/collectioneditor.h | 1 - ui/src/consolechannel.cpp | 126 +- ui/src/consolechannel.h | 8 +- ui/src/createfixturegroup.cpp | 4 +- ui/src/ctkrangeslider.cpp | 975 ++++--- ui/src/ctkrangeslider.h | 281 +- ui/src/cuestackmodel.cpp | 70 +- ui/src/cuestackmodel.h | 16 +- ui/src/debugbox.cpp | 7 +- ui/src/debugbox.h | 1 + ui/src/dmxdumpfactory.cpp | 89 +- ui/src/dmxdumpfactory.h | 7 +- ui/src/docbrowser.cpp | 47 +- ui/src/efxeditor.cpp | 224 +- ui/src/efxeditor.h | 10 +- ui/src/efxpreviewarea.cpp | 16 +- ui/src/efxpreviewarea.h | 8 +- ui/src/fixtureconsole.cpp | 106 +- ui/src/fixtureconsole.h | 6 +- ui/src/fixturegroupeditor.cpp | 65 +- ui/src/fixturemanager.cpp | 471 ++-- ui/src/fixturemanager.h | 4 +- ui/src/fixtureremap.cpp | 309 +-- ui/src/fixtureremap.h | 22 +- ui/src/fixtureselection.cpp | 27 +- ui/src/fixtureselection.h | 22 +- ui/src/fixturetreewidget.cpp | 55 +- ui/src/fixturetreewidget.h | 46 +- ui/src/flowlayout.cpp | 78 +- ui/src/flowlayout.h | 14 +- ui/src/functionliveeditdialog.cpp | 32 +- ui/src/functionliveeditdialog.h | 5 +- ui/src/functionmanager.cpp | 213 +- ui/src/functionmanager.h | 1 - ui/src/functionselection.cpp | 67 +- ui/src/functionselection.h | 18 +- ui/src/functionstreewidget.cpp | 63 +- ui/src/functionstreewidget.h | 18 +- ui/src/functionwizard.cpp | 238 +- ui/src/functionwizard.h | 19 +- ui/src/grandmasterslider.cpp | 99 +- ui/src/groupsconsole.cpp | 20 +- ui/src/groupsconsole.h | 8 +- ui/src/inputchanneleditor.cpp | 51 +- ui/src/inputchanneleditor.h | 6 +- ui/src/inputoutputmanager.cpp | 79 +- ui/src/inputoutputmanager.h | 14 +- ui/src/inputoutputpatcheditor.cpp | 215 +- ui/src/inputoutputpatcheditor.h | 8 +- ui/src/inputprofileeditor.cpp | 136 +- ui/src/inputprofileeditor.h | 4 +- ui/src/inputselectionwidget.cpp | 44 +- ui/src/inputselectionwidget.h | 2 +- ui/src/knobwidget.cpp | 35 +- ui/src/knobwidget.h | 9 +- ui/src/monitor/monitor.cpp | 115 +- ui/src/monitor/monitor.h | 15 +- ui/src/monitor/monitorbackgroundselection.cpp | 50 +- ui/src/monitor/monitorbackgroundselection.h | 8 +- ui/src/monitor/monitorfixture.cpp | 28 +- ui/src/monitor/monitorfixture.h | 6 +- ui/src/monitor/monitorfixtureitem.cpp | 241 +- ui/src/monitor/monitorfixtureitem.h | 77 +- .../monitorfixturepropertieseditor.cpp | 36 +- .../monitor/monitorfixturepropertieseditor.h | 10 +- ui/src/monitor/monitorgraphicsview.cpp | 61 +- ui/src/monitor/monitorgraphicsview.h | 34 +- ui/src/monitor/monitorlayout.cpp | 25 +- ui/src/monitor/monitorlayout.h | 8 +- ui/src/palettegenerator.cpp | 297 +- ui/src/palettegenerator.h | 28 +- ui/src/playbackslider.cpp | 8 +- ui/src/positiontool.cpp | 14 +- ui/src/positiontool.h | 11 +- ui/src/rdmmanager.cpp | 232 +- ui/src/rdmmanager.h | 22 +- ui/src/remapwidget.cpp | 14 +- ui/src/remapwidget.h | 10 +- ui/src/rgbitem.cpp | 6 +- ui/src/rgbmatrixeditor.cpp | 230 +- ui/src/rgbmatrixeditor.h | 10 +- ui/src/sceneeditor.cpp | 455 ++-- ui/src/sceneeditor.h | 16 +- ui/src/scripteditor.cpp | 121 +- ui/src/selectinputchannel.cpp | 60 +- ui/src/selectinputchannel.h | 8 +- ui/src/showmanager/audioitem.cpp | 69 +- ui/src/showmanager/audioitem.h | 24 +- ui/src/showmanager/efxitem.cpp | 10 +- ui/src/showmanager/efxitem.h | 10 +- ui/src/showmanager/headeritems.cpp | 40 +- ui/src/showmanager/headeritems.h | 15 +- ui/src/showmanager/multitrackview.cpp | 200 +- ui/src/showmanager/multitrackview.h | 66 +- ui/src/showmanager/rgbmatrixitem.cpp | 10 +- ui/src/showmanager/rgbmatrixitem.h | 10 +- ui/src/showmanager/sequenceitem.cpp | 17 +- ui/src/showmanager/sequenceitem.h | 10 +- ui/src/showmanager/showeditor.cpp | 37 +- ui/src/showmanager/showitem.cpp | 44 +- ui/src/showmanager/showitem.h | 27 +- ui/src/showmanager/showmanager.cpp | 379 ++- ui/src/showmanager/showmanager.h | 26 +- ui/src/showmanager/timingstool.cpp | 14 +- ui/src/showmanager/timingstool.h | 13 +- ui/src/showmanager/trackitem.cpp | 26 +- ui/src/showmanager/trackitem.h | 42 +- ui/src/showmanager/videoitem.cpp | 30 +- ui/src/showmanager/videoitem.h | 12 +- ui/src/simpledesk.cpp | 302 +-- ui/src/simpledesk.h | 66 +- ui/src/simpledeskengine.cpp | 48 +- ui/src/simpledeskengine.h | 19 +- ui/src/speeddial.cpp | 78 +- ui/src/speeddial.h | 18 +- ui/src/speeddialwidget.cpp | 9 +- ui/src/speeddialwidget.h | 7 +- ui/src/universeitemwidget.cpp | 43 +- ui/src/universeitemwidget.h | 7 +- ui/src/videoeditor.cpp | 47 +- ui/src/videoprovider.cpp | 95 +- ui/src/videoprovider.h | 18 +- ui/src/virtualconsole/addvcbuttonmatrix.cpp | 11 +- ui/src/virtualconsole/addvcbuttonmatrix.h | 4 +- ui/src/virtualconsole/addvcslidermatrix.cpp | 4 +- ui/src/virtualconsole/vcaudiotriggers.cpp | 109 +- ui/src/virtualconsole/vcaudiotriggers.h | 36 +- .../vcaudiotriggersproperties.cpp | 112 +- .../vcaudiotriggersproperties.h | 11 +- ui/src/virtualconsole/vcbutton.cpp | 107 +- ui/src/virtualconsole/vcbutton.h | 41 +- ui/src/virtualconsole/vcbuttonproperties.cpp | 19 +- ui/src/virtualconsole/vcbuttonproperties.h | 5 +- ui/src/virtualconsole/vcclock.cpp | 61 +- ui/src/virtualconsole/vcclock.h | 54 +- ui/src/virtualconsole/vcclockproperties.cpp | 56 +- ui/src/virtualconsole/vcclockproperties.h | 8 +- ui/src/virtualconsole/vccuelist.cpp | 334 ++- ui/src/virtualconsole/vccuelist.h | 74 +- ui/src/virtualconsole/vccuelistproperties.cpp | 4 +- ui/src/virtualconsole/vccuelistproperties.h | 10 +- ui/src/virtualconsole/vcdockarea.cpp | 7 +- ui/src/virtualconsole/vcframe.cpp | 152 +- ui/src/virtualconsole/vcframe.h | 52 +- ui/src/virtualconsole/vcframepageshortcut.cpp | 8 +- ui/src/virtualconsole/vcframepageshortcut.h | 10 +- ui/src/virtualconsole/vcframeproperties.cpp | 36 +- ui/src/virtualconsole/vcframeproperties.h | 12 +- ui/src/virtualconsole/vclabel.cpp | 18 +- ui/src/virtualconsole/vclabel.h | 6 +- ui/src/virtualconsole/vcmatrix.cpp | 203 +- ui/src/virtualconsole/vcmatrix.h | 45 +- ui/src/virtualconsole/vcmatrixcontrol.cpp | 99 +- ui/src/virtualconsole/vcmatrixcontrol.h | 21 +- .../vcmatrixpresetselection.cpp | 51 +- .../virtualconsole/vcmatrixpresetselection.h | 8 +- ui/src/virtualconsole/vcmatrixproperties.cpp | 208 +- ui/src/virtualconsole/vcmatrixproperties.h | 6 +- ui/src/virtualconsole/vcproperties.cpp | 36 +- ui/src/virtualconsole/vcproperties.h | 30 +- ui/src/virtualconsole/vcpropertieseditor.cpp | 32 +- ui/src/virtualconsole/vcpropertieseditor.h | 23 +- ui/src/virtualconsole/vcslider.cpp | 240 +- ui/src/virtualconsole/vcslider.h | 83 +- ui/src/virtualconsole/vcsliderproperties.cpp | 217 +- ui/src/virtualconsole/vcsliderproperties.h | 6 +- ui/src/virtualconsole/vcsoloframe.cpp | 34 +- ui/src/virtualconsole/vcsoloframe.h | 8 +- .../virtualconsole/vcsoloframeproperties.cpp | 6 +- ui/src/virtualconsole/vcsoloframeproperties.h | 5 +- ui/src/virtualconsole/vcspeeddial.cpp | 111 +- ui/src/virtualconsole/vcspeeddial.h | 64 +- ui/src/virtualconsole/vcspeeddialfunction.cpp | 25 +- ui/src/virtualconsole/vcspeeddialfunction.h | 14 +- ui/src/virtualconsole/vcspeeddialpreset.cpp | 16 +- ui/src/virtualconsole/vcspeeddialpreset.h | 12 +- .../virtualconsole/vcspeeddialproperties.cpp | 177 +- ui/src/virtualconsole/vcspeeddialproperties.h | 20 +- ui/src/virtualconsole/vcwidget.cpp | 194 +- ui/src/virtualconsole/vcwidget.h | 102 +- ui/src/virtualconsole/vcwidgetproperties.cpp | 11 +- ui/src/virtualconsole/vcwidgetproperties.h | 20 +- ui/src/virtualconsole/vcwidgetselection.cpp | 34 +- ui/src/virtualconsole/vcwidgetselection.h | 6 +- ui/src/virtualconsole/vcxypad.cpp | 231 +- ui/src/virtualconsole/vcxypad.h | 60 +- ui/src/virtualconsole/vcxypadarea.cpp | 54 +- ui/src/virtualconsole/vcxypadarea.h | 7 +- ui/src/virtualconsole/vcxypadfixture.cpp | 41 +- ui/src/virtualconsole/vcxypadfixture.h | 66 +- .../virtualconsole/vcxypadfixtureeditor.cpp | 11 +- ui/src/virtualconsole/vcxypadfixtureeditor.h | 6 +- ui/src/virtualconsole/vcxypadpreset.cpp | 43 +- ui/src/virtualconsole/vcxypadpreset.h | 28 +- ui/src/virtualconsole/vcxypadproperties.cpp | 235 +- ui/src/virtualconsole/vcxypadproperties.h | 32 +- ui/src/virtualconsole/virtualconsole.cpp | 135 +- ui/src/virtualconsole/virtualconsole.h | 31 +- ui/test/addfixture/addfixture_test.cpp | 6 +- ui/test/assignhotkey/assignhotkey_test.cpp | 16 +- .../efxpreviewarea/efxpreviewarea_test.cpp | 6 +- .../functionselection_test.cpp | 4 +- .../monitorfixture/monitorfixture_test.cpp | 11 +- .../monitorfixtureitem_test.cpp | 259 +- .../palettegenerator_test.cpp | 14 +- ui/test/vcbutton/vcbutton_test.cpp | 24 +- ui/test/vccuelist/vccuelist_test.cpp | 86 +- ui/test/vcframe/vcframe_test.cpp | 16 +- ui/test/vclabel/vclabel_test.cpp | 2 +- ui/test/vcwidget/stubwidget.cpp | 11 +- ui/test/vcwidget/stubwidget.h | 6 +- ui/test/vcwidget/vcwidget_test.cpp | 42 +- ui/test/vcxypad/vcxypad_test.cpp | 42 +- ui/test/vcxypadarea/vcxypadarea_test.cpp | 14 +- .../vcxypadfixture/vcxypadfixture_test.cpp | 68 +- .../vcxypadfixtureeditor_test.cpp | 6 +- unittest.sh | 16 +- webaccess/src/commonjscss.h | 44 +- webaccess/src/qhttpserver/http_parser.h | 554 ++-- webaccess/src/qhttpserver/qhttpconnection.cpp | 95 +- webaccess/src/qhttpserver/qhttpconnection.h | 39 +- webaccess/src/qhttpserver/qhttprequest.cpp | 32 +- webaccess/src/qhttpserver/qhttprequest.h | 48 +- webaccess/src/qhttpserver/qhttpresponse.cpp | 101 +- webaccess/src/qhttpserver/qhttpresponse.h | 17 +- webaccess/src/qhttpserver/qhttpserver.cpp | 32 +- webaccess/src/qhttpserver/qhttpserver.h | 12 +- webaccess/src/webaccess.cpp | 776 +++--- webaccess/src/webaccess.h | 52 +- webaccess/src/webaccessauth.cpp | 68 +- webaccess/src/webaccessauth.h | 55 +- webaccess/src/webaccessconfiguration.cpp | 204 +- webaccess/src/webaccessconfiguration.h | 8 +- webaccess/src/webaccessnetwork.cpp | 74 +- webaccess/src/webaccessnetwork.h | 12 +- webaccess/src/webaccesssimpledesk.cpp | 42 +- webaccess/src/webaccesssimpledesk.h | 8 +- 603 files changed, 19430 insertions(+), 19728 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..5dfc0a9d4e --- /dev/null +++ b/.clang-format @@ -0,0 +1,191 @@ +--- +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Allman +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +QualifierAlignment: Leave +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +PackConstructorInitializers: BinPack +BasedOnStyle: '' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +AllowAllConstructorInitializersOnNextLine: true +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseLabels: false +IndentCaseBlocks: true +IndentGotoLabels: false +IndentPPDirectives: BeforeHash +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Left +PPIndentWidth: 2 +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: Never +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + BeforeNonEmptyParentheses: false +SpaceAroundPointerQualifiers: Default +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +BitFieldColonSpacing: Both +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 4 +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: + - STRINGIZE + - PP_STRINGIZE + - BOOST_PP_STRINGIZE + - NS_SWIFT_NAME + - CF_SWIFT_NAME +... + diff --git a/engine/audio/plugins/mad/audiodecoder_mad.cpp b/engine/audio/plugins/mad/audiodecoder_mad.cpp index 003527fa83..aef0536722 100644 --- a/engine/audio/plugins/mad/audiodecoder_mad.cpp +++ b/engine/audio/plugins/mad/audiodecoder_mad.cpp @@ -33,7 +33,7 @@ #include "audiodecoder_mad.h" #define XING_MAGIC (('X' << 24) | ('i' << 16) | ('n' << 8) | 'g') -#define INPUT_BUFFER_SIZE (32*1024) +#define INPUT_BUFFER_SIZE (32 * 1024) #define USE_DITHERING AudioDecoderMAD::~AudioDecoderMAD() @@ -42,15 +42,15 @@ AudioDecoderMAD::~AudioDecoderMAD() if (m_input_buf != NULL) { qDebug("AudioDecoderMAD: deleting input_buf"); - delete [] m_input_buf; + delete[] m_input_buf; m_input_buf = NULL; } } -AudioDecoder *AudioDecoderMAD::createCopy() +AudioDecoder* AudioDecoderMAD::createCopy() { AudioDecoderMAD* copy = new AudioDecoderMAD(); - return qobject_cast(copy); + return qobject_cast(copy); } int AudioDecoderMAD::priority() const @@ -58,7 +58,7 @@ int AudioDecoderMAD::priority() const return 20; } -bool AudioDecoderMAD::initialize(const QString &path) +bool AudioDecoderMAD::initialize(const QString& path) { m_inited = false; m_totalTime = 0; @@ -101,7 +101,7 @@ bool AudioDecoderMAD::initialize(const QString &path) { if (!m_input.open(QIODevice::ReadOnly)) { - qWarning("DecoderMAD: %s", qPrintable(m_input.errorString ())); + qWarning("DecoderMAD: %s", qPrintable(m_input.errorString())); return false; } } @@ -115,9 +115,9 @@ bool AudioDecoderMAD::initialize(const QString &path) qDebug("DecoderMAD: Can't find a valid MPEG header."); return false; } - mad_stream_buffer(&m_stream, (unsigned char *) m_input_buf, m_input_bytes); + mad_stream_buffer(&m_stream, (unsigned char*)m_input_buf, m_input_bytes); m_stream.error = MAD_ERROR_BUFLEN; - mad_frame_mute (&m_frame); + mad_frame_mute(&m_frame); m_stream.next_frame = 0; m_stream.sync = 0; configure(m_freq, m_channels, PCM_S16LE); @@ -228,7 +228,7 @@ bool AudioDecoderMAD::findHeader() if (m_stream.next_frame) { remaining = m_stream.bufend - m_stream.next_frame; - memmove (m_input_buf, m_stream.next_frame, remaining); + memmove(m_input_buf, m_stream.next_frame, remaining); } m_input_bytes = m_input.read(m_input_buf + remaining, INPUT_BUFFER_SIZE - remaining); @@ -243,16 +243,15 @@ bool AudioDecoderMAD::findHeader() return false; } - mad_stream_buffer(&m_stream, (unsigned char *) m_input_buf + remaining, m_input_bytes); + mad_stream_buffer(&m_stream, (unsigned char*)m_input_buf + remaining, m_input_bytes); m_stream.error = MAD_ERROR_NONE; } if (mad_header_decode(&header, &m_stream) < 0) { - if(m_stream.error == MAD_ERROR_LOSTSYNC) + if (m_stream.error == MAD_ERROR_LOSTSYNC) { - uint tagSize = findID3v2((uchar *)m_stream.this_frame, - (ulong) (m_stream.bufend - m_stream.this_frame)); + uint tagSize = findID3v2((uchar*)m_stream.this_frame, (ulong)(m_stream.bufend - m_stream.this_frame)); if (tagSize > 0) { mad_stream_skip(&m_stream, tagSize); @@ -266,7 +265,7 @@ bool AudioDecoderMAD::findHeader() } else { - qDebug ("DecoderMAD: Can't decode header: %s", mad_stream_errorstr(&m_stream)); + qDebug("DecoderMAD: Can't decode header: %s", mad_stream_errorstr(&m_stream)); break; } } @@ -274,18 +273,17 @@ bool AudioDecoderMAD::findHeader() result = true; count++; - //qDebug() << "Detecting header" << count << m_stream.error << m_stream.sync << header.bitrate << header.layer; + // qDebug() << "Detecting header" << count << m_stream.error << m_stream.sync << header.bitrate << header.layer; // try to detect xing header if (count == 1) { m_frame.header = header; - if (mad_frame_decode(&m_frame, &m_stream) != -1 && - findXingHeader(m_stream.anc_ptr, m_stream.anc_bitlen)) + if (mad_frame_decode(&m_frame, &m_stream) != -1 && findXingHeader(m_stream.anc_ptr, m_stream.anc_bitlen)) { is_vbr = true; - qDebug ("DecoderMAD: Xing header detected"); + qDebug("DecoderMAD: Xing header detected"); if (xing.flags & XING_FRAMES) { @@ -296,12 +294,12 @@ bool AudioDecoderMAD::findHeader() } } - //try to detect VBR + // try to detect VBR if (!is_vbr && !(count > 15)) { if (m_bitrate && header.bitrate != m_bitrate) { - qDebug ("DecoderMAD: VBR detected"); + qDebug("DecoderMAD: VBR detected"); is_vbr = true; } else @@ -309,10 +307,10 @@ bool AudioDecoderMAD::findHeader() } else if (!is_vbr) { - qDebug ("DecoderMAD: Fixed rate detected"); + qDebug("DecoderMAD: Fixed rate detected"); break; } - mad_timer_add (&duration, header.duration); + mad_timer_add(&duration, header.duration); } if (!result) @@ -334,7 +332,7 @@ bool AudioDecoderMAD::findHeader() } m_totalTime = mad_timer_count(duration, MAD_UNITS_MILLISECONDS); - qDebug ("DecoderMAD: Total time: %ld", long(m_totalTime)); + qDebug("DecoderMAD: Total time: %ld", long(m_totalTime)); m_freq = header.samplerate; m_channels = MAD_NCHANNELS(&header); m_bitrate = header.bitrate / 1000; @@ -356,32 +354,32 @@ int AudioDecoderMAD::bitrate() return int(m_bitrate); } -qint64 AudioDecoderMAD::read(char *data, qint64 size) +qint64 AudioDecoderMAD::read(char* data, qint64 size) { forever { - if(((m_stream.error == MAD_ERROR_BUFLEN) || !m_stream.buffer) && !m_eof) + if (((m_stream.error == MAD_ERROR_BUFLEN) || !m_stream.buffer) && !m_eof) { m_eof = !fillBuffer(); } - if(mad_frame_decode(&m_frame, &m_stream) < 0) + if (mad_frame_decode(&m_frame, &m_stream) < 0) { - switch((int) m_stream.error) + switch ((int)m_stream.error) { case MAD_ERROR_LOSTSYNC: - { - //skip ID3v2 tag - uint tagSize = findID3v2((uchar *)m_stream.this_frame, - (ulong) (m_stream.bufend - m_stream.this_frame)); - if (tagSize > 0) { - mad_stream_skip(&m_stream, tagSize); - qDebug("DecoderMAD: %d bytes skipped", tagSize); + // skip ID3v2 tag + uint tagSize = + findID3v2((uchar*)m_stream.this_frame, (ulong)(m_stream.bufend - m_stream.this_frame)); + if (tagSize > 0) + { + mad_stream_skip(&m_stream, tagSize); + qDebug("DecoderMAD: %d bytes skipped", tagSize); + } + continue; } - continue; - } case MAD_ERROR_BUFLEN: - if(m_eof) + if (m_eof) return 0; continue; default: @@ -391,7 +389,7 @@ qint64 AudioDecoderMAD::read(char *data, qint64 size) continue; } } - if(m_skip_frames) + if (m_skip_frames) { m_skip_frames--; continue; @@ -402,7 +400,7 @@ qint64 AudioDecoderMAD::read(char *data, qint64 size) } void AudioDecoderMAD::seek(qint64 pos) { - if(m_totalTime > 0) + if (m_totalTime > 0) { qint64 seek_pos = qint64(pos * m_input.size() / m_totalTime); m_input.seek(seek_pos); @@ -428,34 +426,34 @@ bool AudioDecoderMAD::fillBuffer() { if (m_stream.next_frame) { - m_input_bytes = &m_input_buf[m_input_bytes] - (char *) m_stream.next_frame; + m_input_bytes = &m_input_buf[m_input_bytes] - (char*)m_stream.next_frame; memmove(m_input_buf, m_stream.next_frame, m_input_bytes); } - int len = m_input.read((char *) m_input_buf + m_input_bytes, INPUT_BUFFER_SIZE - m_input_bytes); + int len = m_input.read((char*)m_input_buf + m_input_bytes, INPUT_BUFFER_SIZE - m_input_bytes); if (!len) { qDebug("DecoderMAD: end of file"); return false; } - else if(len < 0) + else if (len < 0) { qWarning("DecoderMAD: error"); return false; } m_input_bytes += len; - mad_stream_buffer(&m_stream, (unsigned char *) m_input_buf, m_input_bytes); + mad_stream_buffer(&m_stream, (unsigned char*)m_input_buf, m_input_bytes); return true; } -uint AudioDecoderMAD::findID3v2(uchar *data, ulong size) //retuns ID3v2 tag size +uint AudioDecoderMAD::findID3v2(uchar* data, ulong size) // retuns ID3v2 tag size { if (size < 10) return 0; - if (((data[0] == 'I' && data[1] == 'D' && data[2] == '3') || //ID3v2 tag - (data[0] == '3' && data[1] == 'D' && data[2] == 'I')) && //ID3v2 footer - data[3] < 0xff && data[4] < 0xff && data[6] < 0x80 && - data[7] < 0x80 && data[8] < 0x80 && data[9] < 0x80) + if (((data[0] == 'I' && data[1] == 'D' && data[2] == '3') || // ID3v2 tag + (data[0] == '3' && data[1] == 'D' && data[2] == 'I')) && // ID3v2 footer + data[3] < 0xff && + data[4] < 0xff && data[6] < 0x80 && data[7] < 0x80 && data[8] < 0x80 && data[9] < 0x80) { quint32 id3v2_size = (data[6] << 21) + (data[7] << 14) + (data[8] << 7) + data[9]; return id3v2_size; @@ -469,12 +467,12 @@ unsigned long AudioDecoderMAD::prng(unsigned long state) // 32-bit pseudo-random } // gather signal statistics while clipping -void AudioDecoderMAD::clip(mad_fixed_t *sample) +void AudioDecoderMAD::clip(mad_fixed_t* sample) { enum { MIN = -MAD_F_ONE, - MAX = MAD_F_ONE - 1 + MAX = MAD_F_ONE - 1 }; if (*sample > MAX) @@ -483,8 +481,7 @@ void AudioDecoderMAD::clip(mad_fixed_t *sample) *sample = MIN; } -long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, - struct audio_dither *dither) +long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither* dither) { unsigned int scalebits; mad_fixed_t output, mask, random; @@ -502,7 +499,7 @@ long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, mask = (1L << scalebits) - 1; /* dither */ - random = prng(dither->random); + random = prng(dither->random); output += (random & mask) - (dither->random & mask); dither->random = random; @@ -520,7 +517,7 @@ long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, return output >> scalebits; } -//generic linear sample quantize routine +// generic linear sample quantize routine long AudioDecoderMAD::audio_linear_round(unsigned int bits, mad_fixed_t sample) { /* round */ @@ -533,7 +530,7 @@ long AudioDecoderMAD::audio_linear_round(unsigned int bits, mad_fixed_t sample) return sample >> (MAD_F_FRACBITS + 1 - bits); } -qint64 AudioDecoderMAD::madOutput(char *data, qint64 size) +qint64 AudioDecoderMAD::madOutput(char* data, qint64 size) { unsigned int samples, channels; mad_fixed_t const *left, *right; @@ -546,9 +543,10 @@ qint64 AudioDecoderMAD::madOutput(char *data, qint64 size) m_output_at = 0; m_output_bytes = 0; - if(samples * channels * 2 > size) + if (samples * channels * 2 > size) { - qWarning() << "DecoderMad: input buffer is too small. Required: " << (samples * channels * 2) << ", available: " << size; + qWarning() << "DecoderMad: input buffer is too small. Required: " << (samples * channels * 2) + << ", available: " << size; samples = size / channels / 2; } @@ -556,7 +554,7 @@ qint64 AudioDecoderMAD::madOutput(char *data, qint64 size) { signed int sample; #ifdef USE_DITHERING - sample = audio_linear_dither(16, *left++, &m_left_dither); + sample = audio_linear_dither(16, *left++, &m_left_dither); #else sample = audio_linear_round(16, *left++); #endif @@ -578,4 +576,3 @@ qint64 AudioDecoderMAD::madOutput(char *data, qint64 size) } return m_output_bytes; } - diff --git a/engine/audio/plugins/mad/audiodecoder_mad.h b/engine/audio/plugins/mad/audiodecoder_mad.h index 9134697c5e..416d9d8316 100644 --- a/engine/audio/plugins/mad/audiodecoder_mad.h +++ b/engine/audio/plugins/mad/audiodecoder_mad.h @@ -36,7 +36,7 @@ extern "C" { - #include +#include } /** @addtogroup engine_audio Audio @@ -53,13 +53,13 @@ class AudioDecoderMAD : public AudioDecoder virtual ~AudioDecoderMAD(); /** @reimpl */ - AudioDecoder *createCopy(); + AudioDecoder* createCopy(); /** @reimp */ int priority() const; /** @reimp */ - bool initialize(const QString &path); + bool initialize(const QString& path); /** @reimp */ qint64 totalTime(); @@ -68,7 +68,7 @@ class AudioDecoderMAD : public AudioDecoder int bitrate(); /** @reimp */ - qint64 read(char *data, qint64 size); + qint64 read(char* data, qint64 size); /** @reimp */ void seek(qint64); @@ -78,12 +78,12 @@ class AudioDecoderMAD : public AudioDecoder private: // helper functions - qint64 madOutput(char *data, qint64 size); + qint64 madOutput(char* data, qint64 size); bool fillBuffer(); void deinit(); bool findHeader(); bool findXingHeader(struct mad_bitptr, unsigned int); - uint findID3v2(uchar *data, ulong size); + uint findID3v2(uchar* data, ulong size); QFile m_input; bool m_inited, m_eof; @@ -94,7 +94,7 @@ class AudioDecoderMAD : public AudioDecoder qint64 m_output_bytes, m_output_at; // file input buffer - char *m_input_buf; + char* m_input_buf; qint64 m_input_bytes; // MAD decoder @@ -110,9 +110,9 @@ class AudioDecoderMAD : public AudioDecoder enum { XING_FRAMES = 0x0001, - XING_BYTES = 0x0002, - XING_TOC = 0x0004, - XING_SCALE = 0x0008 + XING_BYTES = 0x0002, + XING_TOC = 0x0004, + XING_SCALE = 0x0008 }; struct audio_dither @@ -126,10 +126,10 @@ class AudioDecoderMAD : public AudioDecoder struct mad_synth m_synth; struct audio_dither m_left_dither, m_right_dither; - //converter functions + // converter functions unsigned long prng(unsigned long state); - void clip(mad_fixed_t *sample); - long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither); + void clip(mad_fixed_t* sample); + long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither* dither); long audio_linear_round(unsigned int bits, mad_fixed_t sample); }; diff --git a/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp b/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp index 69ab00ae88..b4b1ffe890 100644 --- a/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp +++ b/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp @@ -41,10 +41,10 @@ AudioDecoderSndFile::~AudioDecoderSndFile() m_sndfile = NULL; } -AudioDecoder *AudioDecoderSndFile::createCopy() +AudioDecoder* AudioDecoderSndFile::createCopy() { AudioDecoderSndFile* copy = new AudioDecoderSndFile(); - return qobject_cast(copy); + return qobject_cast(copy); } int AudioDecoderSndFile::priority() const @@ -52,7 +52,7 @@ int AudioDecoderSndFile::priority() const return 10; } -bool AudioDecoderSndFile::initialize(const QString &path) +bool AudioDecoderSndFile::initialize(const QString& path) { m_path = path; m_bitrate = 0; @@ -64,7 +64,7 @@ bool AudioDecoderSndFile::initialize(const QString &path) if (path.isEmpty()) return false; - memset (&snd_info, 0, sizeof(snd_info)); + memset(&snd_info, 0, sizeof(snd_info)); snd_info.format = 0; m_sndfile = sf_open(m_path.toLocal8Bit(), SFM_READ, &snd_info); if (!m_sndfile) @@ -76,27 +76,37 @@ bool AudioDecoderSndFile::initialize(const QString &path) m_freq = snd_info.samplerate; int chan = snd_info.channels; m_totalTime = snd_info.frames * 1000 / m_freq; - m_bitrate = QFileInfo(m_path).size () * 8.0 / m_totalTime + 0.5; + m_bitrate = QFileInfo(m_path).size() * 8.0 / m_totalTime + 0.5; - if((snd_info.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT) + if ((snd_info.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT) { qDebug() << "DecoderSndFile: Float audio format"; - sf_command (m_sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE); + sf_command(m_sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE); } AudioFormat pcmFormat = PCM_S16LE; - switch(snd_info.format & SF_FORMAT_SUBMASK) + switch (snd_info.format & SF_FORMAT_SUBMASK) { - case SF_FORMAT_PCM_S8: pcmFormat = PCM_S8; break; - case SF_FORMAT_PCM_16: pcmFormat = PCM_S16LE; break; - case SF_FORMAT_PCM_24: pcmFormat = PCM_S24LE; break; - case SF_FORMAT_PCM_32: pcmFormat = PCM_S32LE; break; - default: pcmFormat = PCM_S16LE; break; + case SF_FORMAT_PCM_S8: + pcmFormat = PCM_S8; + break; + case SF_FORMAT_PCM_16: + pcmFormat = PCM_S16LE; + break; + case SF_FORMAT_PCM_24: + pcmFormat = PCM_S24LE; + break; + case SF_FORMAT_PCM_32: + pcmFormat = PCM_S32LE; + break; + default: + pcmFormat = PCM_S16LE; + break; } configure(m_freq, chan, pcmFormat); - qDebug() << "DecoderSndFile: detected format: Sample Rate:" << m_freq << - ",Channels: " << chan << ", PCM Format: " << pcmFormat /*snd_info.format*/; + qDebug() << "DecoderSndFile: detected format: Sample Rate:" << m_freq << ",Channels: " << chan + << ", PCM Format: " << pcmFormat /*snd_info.format*/; return true; } @@ -111,28 +121,28 @@ int AudioDecoderSndFile::bitrate() return m_bitrate; } -qint64 AudioDecoderSndFile::read(char *audio, qint64 maxSize) +qint64 AudioDecoderSndFile::read(char* audio, qint64 maxSize) { - return sizeof(short)* sf_read_short (m_sndfile, (short *)audio, maxSize / sizeof(short)); + return sizeof(short) * sf_read_short(m_sndfile, (short*)audio, maxSize / sizeof(short)); } void AudioDecoderSndFile::seek(qint64 pos) { - sf_seek(m_sndfile, m_freq * pos/1000, SEEK_SET); + sf_seek(m_sndfile, m_freq * pos / 1000, SEEK_SET); } QStringList AudioDecoderSndFile::supportedFormats() { QStringList caps; SF_FORMAT_INFO format_info; - int k, count ; + int k, count; - sf_command (0, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ; + sf_command(0, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof(int)); - for (k = 0 ; k < count ; k++) + for (k = 0; k < count; k++) { format_info.format = k; - sf_command (0, SFC_GET_SIMPLE_FORMAT, &format_info, sizeof (format_info)); + sf_command(0, SFC_GET_SIMPLE_FORMAT, &format_info, sizeof(format_info)); qDebug("%08x %s %s", format_info.format, format_info.name, format_info.extension); QString ext = QString(format_info.extension); if (ext == "aiff" && !caps.contains("*.aiff")) @@ -142,7 +152,8 @@ QStringList AudioDecoderSndFile::supportedFormats() else if (ext == "flac" && !caps.contains("*.flac")) caps << "*.flac"; else if ((ext == "ogg" || ext == "oga") && !caps.contains("*.ogg")) - caps << "*.oga" << "*.ogg"; + caps << "*.oga" + << "*.ogg"; else if (ext == "wav" && !caps.contains("*.wav")) caps << "*.wav"; } diff --git a/engine/audio/plugins/sndfile/audiodecoder_sndfile.h b/engine/audio/plugins/sndfile/audiodecoder_sndfile.h index f6ab35c918..16af3b2545 100644 --- a/engine/audio/plugins/sndfile/audiodecoder_sndfile.h +++ b/engine/audio/plugins/sndfile/audiodecoder_sndfile.h @@ -33,7 +33,7 @@ extern "C" { - #include +#include } /** @addtogroup engine_audio Audio @@ -50,13 +50,13 @@ class AudioDecoderSndFile : public AudioDecoder virtual ~AudioDecoderSndFile(); /** @reimpl */ - AudioDecoder *createCopy(); + AudioDecoder* createCopy(); /** @reimp */ int priority() const; /** @reimp */ - bool initialize(const QString &path); + bool initialize(const QString& path); /** @reimp */ qint64 totalTime(); @@ -65,7 +65,7 @@ class AudioDecoderSndFile : public AudioDecoder int bitrate(); /** @reimp */ - qint64 read(char *audio, qint64 maxSize); + qint64 read(char* audio, qint64 maxSize); /** @reimp */ void seek(qint64 time); @@ -74,7 +74,7 @@ class AudioDecoderSndFile : public AudioDecoder QStringList supportedFormats(); private: - SNDFILE *m_sndfile; + SNDFILE* m_sndfile; int m_bitrate; quint32 m_freq; qint64 m_totalTime; diff --git a/engine/audio/src/audio.cpp b/engine/audio/src/audio.cpp index e20ef9e318..020ce961af 100644 --- a/engine/audio/src/audio.cpp +++ b/engine/audio/src/audio.cpp @@ -28,17 +28,17 @@ #include "audioplugincache.h" #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #if defined(__APPLE__) || defined(Q_OS_MAC) - #include "audiorenderer_portaudio.h" - #elif defined(WIN32) || defined(Q_OS_WIN) - #include "audiorenderer_waveout.h" - #else - #include "audiorenderer_alsa.h" - #endif + #if defined(__APPLE__) || defined(Q_OS_MAC) + #include "audiorenderer_portaudio.h" + #elif defined(WIN32) || defined(Q_OS_WIN) + #include "audiorenderer_waveout.h" + #else + #include "audiorenderer_alsa.h" + #endif #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - #include "audiorenderer_qt5.h" + #include "audiorenderer_qt5.h" #else - #include "audiorenderer_qt6.h" + #include "audiorenderer_qt6.h" #endif #include "audio.h" @@ -53,21 +53,20 @@ *****************************************************************************/ Audio::Audio(Doc* doc) - : Function(doc, Function::AudioType) - , m_doc(doc) - , m_decoder(NULL) - , m_audio_out(NULL) - , m_audioDevice(QString()) - , m_sourceFileName("") - , m_audioDuration(0) - , m_volume(1.0) + : Function(doc, Function::AudioType) + , m_doc(doc) + , m_decoder(NULL) + , m_audio_out(NULL) + , m_audioDevice(QString()) + , m_sourceFileName("") + , m_audioDuration(0) + , m_volume(1.0) { setName(tr("New Audio")); setRunOrder(Audio::SingleShot); // Listen to member Function removals - connect(doc, SIGNAL(functionRemoved(quint32)), - this, SLOT(slotFunctionRemoved(quint32))); + connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); } Audio::~Audio() @@ -111,7 +110,7 @@ Function* Audio::createCopy(Doc* doc, bool addToDoc) bool Audio::copyFrom(const Function* function) { - const Audio* aud = qobject_cast (function); + const Audio* aud = qobject_cast(function); if (aud == NULL) return false; @@ -164,7 +163,7 @@ bool Audio::setSourceFileName(QString filename) { doc()->appendToErrorLog(tr("Audio file %1 not found").arg(m_sourceFileName)); setName(tr("File not found")); - //m_audioDuration = 0; + // m_audioDuration = 0; emit changed(id()); return true; } @@ -187,7 +186,7 @@ QString Audio::getSourceFileName() return m_sourceFileName; } -AudioDecoder *Audio::getAudioDecoder() +AudioDecoder* Audio::getAudioDecoder() { return m_decoder; } @@ -244,7 +243,7 @@ void Audio::slotFunctionRemoved(quint32 fid) * Save & Load *********************************************************************/ -bool Audio::saveXML(QXmlStreamWriter *doc) +bool Audio::saveXML(QXmlStreamWriter* doc) { Q_ASSERT(doc != NULL); @@ -278,7 +277,7 @@ bool Audio::saveXML(QXmlStreamWriter *doc) return true; } -bool Audio::loadXML(QXmlStreamReader &root) +bool Audio::loadXML(QXmlStreamReader& root) { if (root.name() != KXMLQLCFunction) { @@ -288,8 +287,7 @@ bool Audio::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::AudioType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() - << "is not Audio"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not Audio"; return false; } @@ -328,9 +326,7 @@ bool Audio::loadXML(QXmlStreamReader &root) return true; } -void Audio::postLoad() -{ -} +void Audio::postLoad() {} /********************************************************************* * Running @@ -351,14 +347,14 @@ void Audio::preRun(MasterTimer* timer) m_decoder->seek(elapsed()); AudioParameters ap = m_decoder->audioParameters(); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #if defined(__APPLE__) || defined(Q_OS_MAC) - //m_audio_out = new AudioRendererCoreAudio(); + #if defined(__APPLE__) || defined(Q_OS_MAC) + // m_audio_out = new AudioRendererCoreAudio(); m_audio_out = new AudioRendererPortAudio(m_audioDevice); - #elif defined(WIN32) || defined(Q_OS_WIN) + #elif defined(WIN32) || defined(Q_OS_WIN) m_audio_out = new AudioRendererWaveOut(m_audioDevice); - #else + #else m_audio_out = new AudioRendererAlsa(m_audioDevice); - #endif + #endif m_audio_out->moveToThread(QCoreApplication::instance()->thread()); #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) m_audio_out = new AudioRendererQt5(m_audioDevice, doc()); @@ -371,8 +367,7 @@ void Audio::preRun(MasterTimer* timer) m_audio_out->setFadeIn(elapsed() ? 0 : fadeIn); m_audio_out->setLooped(runOrder() == Audio::Loop); m_audio_out->start(); - connect(m_audio_out, SIGNAL(endOfStreamReached()), - this, SLOT(slotEndOfStream())); + connect(m_audio_out, SIGNAL(endOfStreamReached()), this, SLOT(slotEndOfStream())); } Function::preRun(timer); @@ -394,7 +389,7 @@ void Audio::setPause(bool enable) } } -void Audio::write(MasterTimer* timer, QList universes) +void Audio::write(MasterTimer* timer, QList universes) { Q_UNUSED(timer) Q_UNUSED(universes) diff --git a/engine/audio/src/audio.h b/engine/audio/src/audio.h index b1263438d6..5b241734e2 100644 --- a/engine/audio/src/audio.h +++ b/engine/audio/src/audio.h @@ -48,7 +48,7 @@ class Audio : public Function QIcon getIcon() const; private: - Doc *m_doc; + Doc* m_doc; /********************************************************************* * Copying *********************************************************************/ @@ -128,9 +128,9 @@ protected slots: private: /** Instance of an AudioDecoder to perform actual audio decoding */ - AudioDecoder *m_decoder; + AudioDecoder* m_decoder; /** output interface to render audio data got from m_decoder */ - AudioRenderer *m_audio_out; + AudioRenderer* m_audio_out; /** Audio device to use for rendering */ QString m_audioDevice; /** Name of the source audio file */ @@ -145,10 +145,10 @@ protected slots: *********************************************************************/ public: /** Save function's contents to an XML document */ - bool saveXML(QXmlStreamWriter *doc); + bool saveXML(QXmlStreamWriter* doc); /** Load function's contents from an XML document */ - bool loadXML(QXmlStreamReader &root); + bool loadXML(QXmlStreamReader& root); /** @reimp */ void postLoad(); @@ -167,7 +167,7 @@ protected slots: void write(MasterTimer* timer, QList universes); /** @reimpl */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer* timer, QList universes); }; /** @} */ diff --git a/engine/audio/src/audiocapture.cpp b/engine/audio/src/audiocapture.cpp index 17e6d4245d..6d69a544ad 100644 --- a/engine/audio/src/audiocapture.cpp +++ b/engine/audio/src/audiocapture.cpp @@ -25,15 +25,15 @@ #include "audiocapture.h" #ifdef HAS_FFTW3 -#include "fftw3.h" + #include "fftw3.h" #endif #define USE_HANNING #define CLEAR_FFT_NOISE -#define M_2PI 6.28318530718 /* 2*pi */ +#define M_2PI 6.28318530718 /* 2*pi */ -AudioCapture::AudioCapture (QObject* parent) - : QThread (parent) +AudioCapture::AudioCapture(QObject* parent) + : QThread(parent) , m_userStop(true) , m_pause(false) , m_captureSize(0) @@ -165,8 +165,9 @@ double AudioCapture::fillBandsData(int number) { if (i == bufferSize) break; - magnitudeSum += qSqrt((((fftw_complex*)m_fftOutputBuffer)[i][0] * ((fftw_complex*)m_fftOutputBuffer)[i][0]) + - (((fftw_complex*)m_fftOutputBuffer)[i][1] * ((fftw_complex*)m_fftOutputBuffer)[i][1])); + magnitudeSum += + qSqrt((((fftw_complex*)m_fftOutputBuffer)[i][0] * ((fftw_complex*)m_fftOutputBuffer)[i][0]) + + (((fftw_complex*)m_fftOutputBuffer)[i][1] * ((fftw_complex*)m_fftOutputBuffer)[i][1])); } double bandMagnitude = (magnitudeSum / (subBandWidth * M_2PI)); m_fftMagnitudeMap[number].m_fftMagnitudeBuffer[b] = bandMagnitude; @@ -188,7 +189,7 @@ void AudioCapture::processData() // 1 ********* Initialize FFTW fftw_plan plan_forward; - plan_forward = fftw_plan_dft_r2c_1d(bufferSize, m_fftInputBuffer, (fftw_complex*)m_fftOutputBuffer , 0); + plan_forward = fftw_plan_dft_r2c_1d(bufferSize, m_fftInputBuffer, (fftw_complex*)m_fftOutputBuffer, 0); // 2 ********* Apply a window to audio data // *********** and convert it to doubles @@ -199,25 +200,26 @@ void AudioCapture::processData() m_audioMixdown[i] = 0; for (j = 0; j < m_channels; j++) { - m_audioMixdown[i] += m_audioBuffer[i*m_channels + j] / m_channels; + m_audioMixdown[i] += m_audioBuffer[i * m_channels + j] / m_channels; } } for (i = 0; i < bufferSize; i++) { -#ifdef USE_BLACKMAN - double a0 = (1-0.16)/2; + #ifdef USE_BLACKMAN + double a0 = (1 - 0.16) / 2; double a1 = 0.5; - double a2 = 0.16/2; - m_fftInputBuffer[i] = m_audioMixdown[i] * (a0 - a1 * qCos((M_2PI * i) / (bufferSize - 1)) + - a2 * qCos((2 * M_2PI * i) / (bufferSize - 1))) / 32768.; -#endif -#ifdef USE_HANNING + double a2 = 0.16 / 2; + m_fftInputBuffer[i] = + m_audioMixdown[i] * + (a0 - a1 * qCos((M_2PI * i) / (bufferSize - 1)) + a2 * qCos((2 * M_2PI * i) / (bufferSize - 1))) / 32768.; + #endif + #ifdef USE_HANNING m_fftInputBuffer[i] = m_audioMixdown[i] * (0.5 * (1.00 - qCos((M_2PI * i) / (bufferSize - 1)))) / 32768.; -#endif -#ifdef USE_NO_WINDOW + #endif + #ifdef USE_NO_WINDOW m_fftInputBuffer[i] = (double)m_audioMixdown[i] / 32768.; -#endif + #endif } // 3 ********* Perform FFT @@ -225,17 +227,17 @@ void AudioCapture::processData() fftw_destroy_plan(plan_forward); // 4 ********* Clear FFT noise -#ifdef CLEAR_FFT_NOISE - //We delete some values since these will ruin our output + #ifdef CLEAR_FFT_NOISE + // We delete some values since these will ruin our output for (int n = 0; n < 5; n++) { ((fftw_complex*)m_fftOutputBuffer)[n][0] = 0; ((fftw_complex*)m_fftOutputBuffer)[n][1] = 0; } -#endif + #endif // 5 ********* Calculate the average signal power - foreach(int barsNumber, m_fftMagnitudeMap.keys()) + foreach (int barsNumber, m_fftMagnitudeMap.keys()) { maxMagnitude = fillBandsData(barsNumber); pwrSum = 0.; @@ -245,8 +247,7 @@ void AudioCapture::processData() } m_signalPower = 32768 * pwrSum * qSqrt(M_2PI) / (double)barsNumber; emit dataProcessed(m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.data(), - m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.size(), - maxMagnitude, m_signalPower); + m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.size(), maxMagnitude, m_signalPower); } #endif } @@ -274,10 +275,9 @@ void AudioCapture::run() } else { - //qDebug() << "Error reading data from audio source"; + // qDebug() << "Error reading data from audio source"; QThread::msleep(5); } - } else { diff --git a/engine/audio/src/audiocapture.h b/engine/audio/src/audiocapture.h index 58a9484101..a322329378 100644 --- a/engine/audio/src/audiocapture.h +++ b/engine/audio/src/audiocapture.h @@ -27,17 +27,17 @@ #include #include -#define SETTINGS_AUDIO_INPUT_DEVICE "audio/input" -#define SETTINGS_AUDIO_INPUT_SRATE "audio/samplerate" +#define SETTINGS_AUDIO_INPUT_DEVICE "audio/input" +#define SETTINGS_AUDIO_INPUT_SRATE "audio/samplerate" #define SETTINGS_AUDIO_INPUT_CHANNELS "audio/channels" -#define AUDIO_DEFAULT_SAMPLE_RATE 44100 -#define AUDIO_DEFAULT_CHANNELS 1 -#define AUDIO_DEFAULT_BUFFER_SIZE 2048 // bytes per channel +#define AUDIO_DEFAULT_SAMPLE_RATE 44100 +#define AUDIO_DEFAULT_CHANNELS 1 +#define AUDIO_DEFAULT_BUFFER_SIZE 2048 // bytes per channel -#define FREQ_SUBBANDS_MAX_NUMBER 32 -#define FREQ_SUBBANDS_DEFAULT_NUMBER 16 -#define SPECTRUM_MAX_FREQUENCY 5000 +#define FREQ_SUBBANDS_MAX_NUMBER 32 +#define FREQ_SUBBANDS_DEFAULT_NUMBER 16 +#define SPECTRUM_MAX_FREQUENCY 5000 /** @addtogroup engine_audio Audio * @{ @@ -73,11 +73,14 @@ class AudioCapture : public QThread * Cancel a previous request of bars */ void unregisterBandsNumber(int number); - //int bandsNumber(); + // int bandsNumber(); - static int maxFrequency() { return SPECTRUM_MAX_FREQUENCY; } + static int maxFrequency() + { + return SPECTRUM_MAX_FREQUENCY; + } - protected: +protected: /*! * Prepares object for usage and setups required audio parameters. * Subclass should reimplement this function. @@ -115,7 +118,7 @@ class AudioCapture : public QThread * Thread functions *********************************************************************/ /** @reimpl */ - void run(); //thread run function + void run(); // thread run function protected: void stop(); @@ -134,7 +137,7 @@ class AudioCapture : public QThread bool m_userStop, m_pause; signals: - void dataProcessed(double *spectrumBands, int size, double maxMagnitude, quint32 power); + void dataProcessed(double* spectrumBands, int size, double maxMagnitude, quint32 power); protected: /*! @@ -149,17 +152,17 @@ class AudioCapture : public QThread unsigned int bufferSize, m_captureSize, m_sampleRate, m_channels; /** Data buffer for audio data coming from the sound card */ - int16_t *m_audioBuffer; - int16_t *m_audioMixdown; + int16_t* m_audioBuffer; + int16_t* m_audioMixdown; quint32 m_signalPower; /** **************** FFT variables ********************** */ - double *m_fftInputBuffer; - void *m_fftOutputBuffer; + double* m_fftInputBuffer; + void* m_fftOutputBuffer; /** Map of the registered clients (key is the number of bands) */ - QMap m_fftMagnitudeMap; + QMap m_fftMagnitudeMap; }; /** @} */ diff --git a/engine/audio/src/audiocapture_alsa.cpp b/engine/audio/src/audiocapture_alsa.cpp index db5a518d5a..15ed43937d 100644 --- a/engine/audio/src/audiocapture_alsa.cpp +++ b/engine/audio/src/audiocapture_alsa.cpp @@ -22,7 +22,7 @@ #include "audiocapture_alsa.h" -AudioCaptureAlsa::AudioCaptureAlsa(QObject * parent) +AudioCaptureAlsa::AudioCaptureAlsa(QObject* parent) : AudioCapture(parent) , m_captureHandle(NULL) { @@ -36,7 +36,7 @@ AudioCaptureAlsa::~AudioCaptureAlsa() bool AudioCaptureAlsa::initialize() { - snd_pcm_hw_params_t *hw_params = NULL; + snd_pcm_hw_params_t* hw_params = NULL; QString dev_name = "default"; int err; @@ -51,27 +51,27 @@ bool AudioCaptureAlsa::initialize() Q_ASSERT(m_captureHandle == NULL); - if ((err = snd_pcm_open (&m_captureHandle, pcm_name, SND_PCM_STREAM_CAPTURE, 0)) < 0) - qWarning("cannot open audio device (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) - qWarning("cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_any (m_captureHandle, hw_params)) < 0) - qWarning("cannot initialize hardware parameter structure (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_set_access (m_captureHandle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) - qWarning("cannot set access type (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_set_format (m_captureHandle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) - qWarning("cannot set sample format (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_set_rate_near (m_captureHandle, hw_params, &m_sampleRate, 0)) < 0) - qWarning("cannot set sample rate (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_hw_params_set_channels (m_captureHandle, hw_params, m_channels)) < 0) - qWarning("cannot set channel count to %d (%s)\n", m_channels, snd_strerror (err)); - else if ((err = snd_pcm_hw_params (m_captureHandle, hw_params)) < 0) - qWarning("cannot set parameters (%s)\n", snd_strerror (err)); - else if ((err = snd_pcm_prepare (m_captureHandle)) < 0) - qWarning("cannot prepare audio interface for use (%s)\n", snd_strerror (err)); + if ((err = snd_pcm_open(&m_captureHandle, pcm_name, SND_PCM_STREAM_CAPTURE, 0)) < 0) + qWarning("cannot open audio device (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) + qWarning("cannot allocate hardware parameter structure (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_any(m_captureHandle, hw_params)) < 0) + qWarning("cannot initialize hardware parameter structure (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_set_access(m_captureHandle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) + qWarning("cannot set access type (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_set_format(m_captureHandle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) + qWarning("cannot set sample format (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_set_rate_near(m_captureHandle, hw_params, &m_sampleRate, 0)) < 0) + qWarning("cannot set sample rate (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_hw_params_set_channels(m_captureHandle, hw_params, m_channels)) < 0) + qWarning("cannot set channel count to %d (%s)\n", m_channels, snd_strerror(err)); + else if ((err = snd_pcm_hw_params(m_captureHandle, hw_params)) < 0) + qWarning("cannot set parameters (%s)\n", snd_strerror(err)); + else if ((err = snd_pcm_prepare(m_captureHandle)) < 0) + qWarning("cannot prepare audio interface for use (%s)\n", snd_strerror(err)); if (hw_params) - snd_pcm_hw_params_free (hw_params); + snd_pcm_hw_params_free(hw_params); if (err < 0) { @@ -98,38 +98,23 @@ qint64 AudioCaptureAlsa::latency() return 0; // TODO } -void AudioCaptureAlsa::suspend() -{ -} +void AudioCaptureAlsa::suspend() {} -void AudioCaptureAlsa::resume() -{ -} +void AudioCaptureAlsa::resume() {} bool AudioCaptureAlsa::readAudio(int maxSize) { Q_ASSERT(m_captureHandle != NULL); int read; - if ((read = snd_pcm_readi (m_captureHandle, m_audioBuffer, maxSize)) != maxSize) + if ((read = snd_pcm_readi(m_captureHandle, m_audioBuffer, maxSize)) != maxSize) { qWarning() << "[ALSA readAudio] read from audio interface failed (" << snd_strerror(read) << ")"; return false; } - //qDebug() << "Audio sample #0:" << m_audioBuffer[0] << ", #max:" << m_audioBuffer[m_captureSize - 1]; + // qDebug() << "Audio sample #0:" << m_audioBuffer[0] << ", #max:" << m_audioBuffer[m_captureSize - 1]; qDebug() << "[ALSA readAudio] " << maxSize << "bytes read"; return true; } - - - - - - - - - - - diff --git a/engine/audio/src/audiocapture_alsa.h b/engine/audio/src/audiocapture_alsa.h index 0910984e30..548dbcc1c5 100644 --- a/engine/audio/src/audiocapture_alsa.h +++ b/engine/audio/src/audiocapture_alsa.h @@ -35,7 +35,7 @@ class AudioCaptureAlsa : public AudioCapture { Q_OBJECT public: - AudioCaptureAlsa(QObject * parent = 0); + AudioCaptureAlsa(QObject* parent = 0); ~AudioCaptureAlsa(); /** @reimpl */ @@ -58,8 +58,8 @@ class AudioCaptureAlsa : public AudioCapture bool readAudio(int maxSize); private: - snd_pcm_t *m_captureHandle; - char *pcm_name; + snd_pcm_t* m_captureHandle; + char* pcm_name; }; /** @} */ diff --git a/engine/audio/src/audiocapture_portaudio.cpp b/engine/audio/src/audiocapture_portaudio.cpp index 47c46acdce..8860b1db8d 100644 --- a/engine/audio/src/audiocapture_portaudio.cpp +++ b/engine/audio/src/audiocapture_portaudio.cpp @@ -26,9 +26,9 @@ // Since only one instance of this class is allowed, I can // afford to do this -static PaStream *stream = NULL; +static PaStream* stream = NULL; -AudioCapturePortAudio::AudioCapturePortAudio(QObject * parent) +AudioCapturePortAudio::AudioCapturePortAudio(QObject* parent) : AudioCapture(parent) { } @@ -45,7 +45,7 @@ bool AudioCapturePortAudio::initialize() PaStreamParameters inputParameters; err = Pa_Initialize(); - if( err != paNoError ) + if (err != paNoError) return false; QSettings settings; @@ -64,30 +64,30 @@ bool AudioCapturePortAudio::initialize() inputParameters.channelCount = m_channels; inputParameters.sampleFormat = paInt16; - inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency; + inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency; inputParameters.hostApiSpecificStreamInfo = NULL; // ensure initialize() has not been called multiple times Q_ASSERT(stream == NULL); /* -- setup stream -- */ - err = Pa_OpenStream( &stream, &inputParameters, NULL, m_sampleRate, paFramesPerBufferUnspecified, - paClipOff, /* we won't output out of range samples so don't bother clipping them */ - NULL, /* no callback, use blocking API */ - NULL ); /* no callback, so no callback userData */ - if( err != paNoError ) + err = Pa_OpenStream(&stream, &inputParameters, NULL, m_sampleRate, paFramesPerBufferUnspecified, + paClipOff, /* we won't output out of range samples so don't bother clipping them */ + NULL, /* no callback, use blocking API */ + NULL); /* no callback, so no callback userData */ + if (err != paNoError) { - qWarning("Cannot open audio input stream (%s)\n", Pa_GetErrorText(err)); + qWarning("Cannot open audio input stream (%s)\n", Pa_GetErrorText(err)); Pa_Terminate(); return false; } /* -- start capture -- */ - err = Pa_StartStream( stream ); - if( err != paNoError ) + err = Pa_StartStream(stream); + if (err != paNoError) { - qWarning("Cannot start stream capture (%s)\n", Pa_GetErrorText(err)); - Pa_CloseStream( stream ); + qWarning("Cannot start stream capture (%s)\n", Pa_GetErrorText(err)); + Pa_CloseStream(stream); stream = NULL; Pa_Terminate(); return false; @@ -103,19 +103,19 @@ void AudioCapturePortAudio::uninitialize() PaError err; /* -- Now we stop the stream -- */ - err = Pa_StopStream( stream ); - if( err != paNoError ) - qDebug() << "PortAudio error: " << Pa_GetErrorText( err ); + err = Pa_StopStream(stream); + if (err != paNoError) + qDebug() << "PortAudio error: " << Pa_GetErrorText(err); /* -- don't forget to cleanup! -- */ - err = Pa_CloseStream( stream ); - if( err != paNoError ) - qDebug() << "PortAudio error: " << Pa_GetErrorText( err ); + err = Pa_CloseStream(stream); + if (err != paNoError) + qDebug() << "PortAudio error: " << Pa_GetErrorText(err); stream = NULL; err = Pa_Terminate(); - if( err != paNoError ) - qDebug() << "PortAudio error: " << Pa_GetErrorText( err ); + if (err != paNoError) + qDebug() << "PortAudio error: " << Pa_GetErrorText(err); } qint64 AudioCapturePortAudio::latency() @@ -123,22 +123,18 @@ qint64 AudioCapturePortAudio::latency() return 0; // TODO } -void AudioCapturePortAudio::suspend() -{ -} +void AudioCapturePortAudio::suspend() {} -void AudioCapturePortAudio::resume() -{ -} +void AudioCapturePortAudio::resume() {} bool AudioCapturePortAudio::readAudio(int maxSize) { Q_ASSERT(stream != NULL); - int err = Pa_ReadStream( stream, m_audioBuffer, maxSize ); - if( err ) + int err = Pa_ReadStream(stream, m_audioBuffer, maxSize); + if (err) { - qWarning("read from audio interface failed (%s)\n", Pa_GetErrorText (err)); + qWarning("read from audio interface failed (%s)\n", Pa_GetErrorText(err)); return false; } diff --git a/engine/audio/src/audiocapture_portaudio.h b/engine/audio/src/audiocapture_portaudio.h index c3cf3c64bc..b0ec5edd5d 100644 --- a/engine/audio/src/audiocapture_portaudio.h +++ b/engine/audio/src/audiocapture_portaudio.h @@ -30,7 +30,7 @@ class AudioCapturePortAudio : public AudioCapture { Q_OBJECT public: - AudioCapturePortAudio(QObject * parent = 0); + AudioCapturePortAudio(QObject* parent = 0); ~AudioCapturePortAudio(); /** @reimpl */ diff --git a/engine/audio/src/audiocapture_qt5.cpp b/engine/audio/src/audiocapture_qt5.cpp index 79920b42e3..2279e99d59 100644 --- a/engine/audio/src/audiocapture_qt5.cpp +++ b/engine/audio/src/audiocapture_qt5.cpp @@ -23,7 +23,7 @@ #include "audiocapture_qt5.h" -AudioCaptureQt6::AudioCaptureQt6(QObject * parent) +AudioCaptureQt6::AudioCaptureQt6(QObject* parent) : AudioCapture(parent) , m_audioInput(NULL) , m_input(NULL) @@ -46,7 +46,7 @@ bool AudioCaptureQt6::initialize() if (var.isValid() == true) { devName = var.toString(); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) + foreach (const QAudioDeviceInfo& deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) { if (deviceInfo.deviceName() == devName) { @@ -118,13 +118,9 @@ void AudioCaptureQt6::setVolume(qreal volume) m_audioInput->setVolume(volume); } -void AudioCaptureQt6::suspend() -{ -} +void AudioCaptureQt6::suspend() {} -void AudioCaptureQt6::resume() -{ -} +void AudioCaptureQt6::resume() {} bool AudioCaptureQt6::readAudio(int maxSize) { @@ -136,7 +132,8 @@ bool AudioCaptureQt6::readAudio(int maxSize) QByteArray readBuffer = m_input->readAll(); m_currentReadBuffer += readBuffer; - // qDebug() << "[QT readAudio] " << readBuffer.size() << "bytes read -> (" << m_currentReadBuffer.size() << "/" << bufferSize << ")"; + // qDebug() << "[QT readAudio] " << readBuffer.size() << "bytes read -> (" << m_currentReadBuffer.size() << "/" << + // bufferSize << ")"; if (m_currentReadBuffer.size() < bufferSize) { diff --git a/engine/audio/src/audiocapture_qt5.h b/engine/audio/src/audiocapture_qt5.h index 9a4e7d76bc..45d9543486 100644 --- a/engine/audio/src/audiocapture_qt5.h +++ b/engine/audio/src/audiocapture_qt5.h @@ -32,7 +32,7 @@ class AudioCaptureQt6 : public AudioCapture { Q_OBJECT public: - AudioCaptureQt6(QObject * parent = 0); + AudioCaptureQt6(QObject* parent = 0); ~AudioCaptureQt6(); /** @reimpl */ @@ -58,8 +58,8 @@ class AudioCaptureQt6 : public AudioCapture bool readAudio(int maxSize); private: - QAudioInput *m_audioInput; - QIODevice *m_input; + QAudioInput* m_audioInput; + QIODevice* m_input; QAudioFormat m_format; qreal m_volume; QByteArray m_currentReadBuffer; diff --git a/engine/audio/src/audiocapture_qt6.cpp b/engine/audio/src/audiocapture_qt6.cpp index 3911c90301..c1abafaeb3 100644 --- a/engine/audio/src/audiocapture_qt6.cpp +++ b/engine/audio/src/audiocapture_qt6.cpp @@ -25,7 +25,7 @@ #include "audiocapture_qt6.h" -AudioCaptureQt6::AudioCaptureQt6(QObject * parent) +AudioCaptureQt6::AudioCaptureQt6(QObject* parent) : AudioCapture(parent) , m_audioSource(NULL) , m_input(NULL) @@ -48,7 +48,7 @@ bool AudioCaptureQt6::initialize() if (var.isValid() == true) { devName = var.toString(); - foreach (const QAudioDevice &deviceInfo, QMediaDevices::audioInputs()) + foreach (const QAudioDevice& deviceInfo, QMediaDevices::audioInputs()) { if (deviceInfo.description() == devName) { @@ -61,7 +61,7 @@ bool AudioCaptureQt6::initialize() m_format.setSampleRate(m_sampleRate); m_format.setChannelCount(m_channels); m_format.setSampleFormat(QAudioFormat::Int16); - //m_format.setCodec("audio/pcm"); + // m_format.setCodec("audio/pcm"); if (!audioDevice.isFormatSupported(m_format)) { @@ -118,13 +118,9 @@ void AudioCaptureQt6::setVolume(qreal volume) m_audioSource->setVolume(volume); } -void AudioCaptureQt6::suspend() -{ -} +void AudioCaptureQt6::suspend() {} -void AudioCaptureQt6::resume() -{ -} +void AudioCaptureQt6::resume() {} bool AudioCaptureQt6::readAudio(int maxSize) { @@ -136,7 +132,8 @@ bool AudioCaptureQt6::readAudio(int maxSize) QByteArray readBuffer = m_input->readAll(); m_currentReadBuffer += readBuffer; - // qDebug() << "[QT readAudio] " << readBuffer.size() << "bytes read -> (" << m_currentReadBuffer.size() << "/" << bufferSize << ")"; + // qDebug() << "[QT readAudio] " << readBuffer.size() << "bytes read -> (" << m_currentReadBuffer.size() << "/" << + // bufferSize << ")"; if (m_currentReadBuffer.size() < bufferSize) { diff --git a/engine/audio/src/audiocapture_qt6.h b/engine/audio/src/audiocapture_qt6.h index ffdad57e6c..49ea1f0db6 100644 --- a/engine/audio/src/audiocapture_qt6.h +++ b/engine/audio/src/audiocapture_qt6.h @@ -33,7 +33,7 @@ class AudioCaptureQt6 : public AudioCapture { Q_OBJECT public: - AudioCaptureQt6(QObject * parent = 0); + AudioCaptureQt6(QObject* parent = 0); ~AudioCaptureQt6(); /** @reimpl */ @@ -59,8 +59,8 @@ class AudioCaptureQt6 : public AudioCapture bool readAudio(int maxSize); private: - QAudioSource *m_audioSource; - QIODevice *m_input; + QAudioSource* m_audioSource; + QIODevice* m_input; QAudioFormat m_format; qreal m_volume; QByteArray m_currentReadBuffer; diff --git a/engine/audio/src/audiocapture_wavein.cpp b/engine/audio/src/audiocapture_wavein.cpp index c89fd85d8d..f1401f1cd8 100644 --- a/engine/audio/src/audiocapture_wavein.cpp +++ b/engine/audio/src/audiocapture_wavein.cpp @@ -26,11 +26,10 @@ static HWAVEIN deviceHandle = NULL; static WAVEHDR waveHeaders[HEADERS_NUMBER]; -AudioCaptureWaveIn::AudioCaptureWaveIn(QObject * parent) +AudioCaptureWaveIn::AudioCaptureWaveIn(QObject* parent) : AudioCapture(parent) , m_currentBufferIndex(0) { - } AudioCaptureWaveIn::~AudioCaptureWaveIn() @@ -47,13 +46,11 @@ bool AudioCaptureWaveIn::initialize() format.wBitsPerSample = 16; format.nChannels = m_channels; format.nSamplesPerSec = m_sampleRate; - format.nAvgBytesPerSec = format.nSamplesPerSec * - format.nChannels * - (format.wBitsPerSample / 8); - format.nBlockAlign = format.nChannels*format.wBitsPerSample/8; - format.cbSize=0; + format.nAvgBytesPerSec = format.nSamplesPerSec * format.nChannels * (format.wBitsPerSample / 8); + format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8; + format.cbSize = 0; - result = waveInOpen(&deviceHandle, WAVE_MAPPER, &format, 0L, 0L, CALLBACK_NULL|WAVE_FORMAT_DIRECT); + result = waveInOpen(&deviceHandle, WAVE_MAPPER, &format, 0L, 0L, CALLBACK_NULL | WAVE_FORMAT_DIRECT); switch (result) { case MMSYSERR_ALLOCATED: @@ -133,13 +130,9 @@ qint64 AudioCaptureWaveIn::latency() return 0; // TODO } -void AudioCaptureWaveIn::suspend() -{ -} +void AudioCaptureWaveIn::suspend() {} -void AudioCaptureWaveIn::resume() -{ -} +void AudioCaptureWaveIn::resume() {} bool AudioCaptureWaveIn::readAudio(int maxSize) { @@ -154,7 +147,7 @@ bool AudioCaptureWaveIn::readAudio(int maxSize) return false; } - while ( (waveHeaders[m_currentBufferIndex].dwFlags & WHDR_DONE) == 0) + while ((waveHeaders[m_currentBufferIndex].dwFlags & WHDR_DONE) == 0) usleep(100); memcpy(m_audioBuffer, m_internalBuffers[m_currentBufferIndex], maxSize * 2); diff --git a/engine/audio/src/audiocapture_wavein.h b/engine/audio/src/audiocapture_wavein.h index 73678d15bd..adfd057d27 100644 --- a/engine/audio/src/audiocapture_wavein.h +++ b/engine/audio/src/audiocapture_wavein.h @@ -28,13 +28,13 @@ * @{ */ -#define HEADERS_NUMBER 2 +#define HEADERS_NUMBER 2 class AudioCaptureWaveIn : public AudioCapture { Q_OBJECT public: - AudioCaptureWaveIn(QObject * parent = 0); + AudioCaptureWaveIn(QObject* parent = 0); ~AudioCaptureWaveIn(); /** @reimpl */ @@ -58,7 +58,7 @@ class AudioCaptureWaveIn : public AudioCapture private: int m_currentBufferIndex; - char *m_internalBuffers[HEADERS_NUMBER]; + char* m_internalBuffers[HEADERS_NUMBER]; }; /** @} */ diff --git a/engine/audio/src/audiodecoder.h b/engine/audio/src/audiodecoder.h index 3e3db7c470..ad44507ccf 100644 --- a/engine/audio/src/audiodecoder.h +++ b/engine/audio/src/audiodecoder.h @@ -39,7 +39,7 @@ * @author Brad Hughes * @author Ilya Kotov */ -class AudioDecoder: public QObject +class AudioDecoder : public QObject { Q_OBJECT @@ -47,9 +47,11 @@ class AudioDecoder: public QObject /*! * Destructor. */ - virtual ~AudioDecoder() { /* NOP */ } + virtual ~AudioDecoder() + { /* NOP */ + } - virtual AudioDecoder *createCopy() = 0; + virtual AudioDecoder* createCopy() = 0; /*! * Returns the plugin priority @@ -65,7 +67,7 @@ class AudioDecoder: public QObject * Prepares decoder for usage. * Subclass should reimplement this function. */ - virtual bool initialize(const QString &path) = 0; + virtual bool initialize(const QString& path) = 0; /*! * Returns the total time in milliseconds. * Subclass should reimplement this function. @@ -80,7 +82,7 @@ class AudioDecoder: public QObject * Returns the number of bytes read, or -1 if an error occurred. * In most cases subclass should reimplement this function. */ - virtual qint64 read(char *data, qint64 maxSize) = 0; + virtual qint64 read(char* data, qint64 maxSize) = 0; /*! * Returns current bitrate (in kbps). * Subclass should reimplement this function. diff --git a/engine/audio/src/audioparameters.cpp b/engine/audio/src/audioparameters.cpp index 3d0bc07843..cc92d11657 100644 --- a/engine/audio/src/audioparameters.cpp +++ b/engine/audio/src/audioparameters.cpp @@ -32,33 +32,33 @@ AudioParameters::AudioParameters() { } -AudioParameters::AudioParameters(const AudioParameters &other) +AudioParameters::AudioParameters(const AudioParameters& other) : m_srate(other.sampleRate()) , m_chan(other.channels()) , m_format(other.format()) { } -AudioParameters::AudioParameters(quint32 srate, int chan, AudioFormat format) +AudioParameters::AudioParameters(quint32 srate, int chan, AudioFormat format) : m_srate(srate) , m_chan(chan) , m_format(format) { } -void AudioParameters::operator=(const AudioParameters &p) +void AudioParameters::operator=(const AudioParameters& p) { m_srate = p.sampleRate(); m_chan = p.channels(); m_format = p.format(); } -bool AudioParameters::operator==(const AudioParameters &p) const +bool AudioParameters::operator==(const AudioParameters& p) const { return m_srate == p.sampleRate() && m_chan == p.channels() && m_format == p.format(); } -bool AudioParameters::operator!=(const AudioParameters &p) const +bool AudioParameters::operator!=(const AudioParameters& p) const { return !operator==(p); } @@ -85,17 +85,16 @@ int AudioParameters::sampleSize() const int AudioParameters::sampleSize(AudioFormat format) { - switch(format) + switch (format) { - case PCM_S8: - return 1; - case PCM_S16LE: - case PCM_UNKNOWN: - return 2; - case PCM_S24LE: - case PCM_S32LE: - return 4; + case PCM_S8: + return 1; + case PCM_S16LE: + case PCM_UNKNOWN: + return 2; + case PCM_S24LE: + case PCM_S32LE: + return 4; } return 2; } - diff --git a/engine/audio/src/audioparameters.h b/engine/audio/src/audioparameters.h index b49342425f..48736642e1 100644 --- a/engine/audio/src/audioparameters.h +++ b/engine/audio/src/audioparameters.h @@ -39,10 +39,10 @@ enum AudioFormat { PCM_UNKNOWN = -1, /*!< Unknown format */ - PCM_S8 = 0, /*!< Signed 8 bit */ - PCM_S16LE, /*!< Signed 16 bit Little Endian */ - PCM_S24LE, /*!< Signed 24 bit Little Endian using low three bytes in 32-bit word */ - PCM_S32LE /*!< Signed 32 bit Little Endian */ + PCM_S8 = 0, /*!< Signed 8 bit */ + PCM_S16LE, /*!< Signed 16 bit Little Endian */ + PCM_S24LE, /*!< Signed 24 bit Little Endian using low three bytes in 32-bit word */ + PCM_S32LE /*!< Signed 32 bit Little Endian */ }; /*! @brief The AudioParameters class keeps information about audio settings. @@ -65,19 +65,19 @@ class AudioParameters /*! * Constructs a copy of \b other. */ - AudioParameters(const AudioParameters &other); + AudioParameters(const AudioParameters& other); /*! * Assigns audio parameters \b p to this parameters. */ - void operator=(const AudioParameters &p); + void operator=(const AudioParameters& p); /*! * Returns \b true if parameters \b p is equal to this parameters; otherwise returns \b false. */ - bool operator==(const AudioParameters &p) const; + bool operator==(const AudioParameters& p) const; /*! * Returns \b true if parameters \b p is not equal to this parameters; otherwise returns \b false. */ - bool operator!=(const AudioParameters &p) const; + bool operator!=(const AudioParameters& p) const; /*! * Returns sample rate in Hz. */ diff --git a/engine/audio/src/audioplugincache.cpp b/engine/audio/src/audioplugincache.cpp index 617eaa0f8b..23a8e5adf7 100644 --- a/engine/audio/src/audioplugincache.cpp +++ b/engine/audio/src/audioplugincache.cpp @@ -19,7 +19,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -#include + #include #endif #include @@ -28,46 +28,44 @@ #include "qlcfile.h" #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #if defined( __APPLE__) || defined(Q_OS_MAC) - #include "audiorenderer_portaudio.h" - #elif defined(WIN32) || defined(Q_OS_WIN) - #include "audiorenderer_waveout.h" - #else - #include "audiorenderer_alsa.h" - #endif + #if defined(__APPLE__) || defined(Q_OS_MAC) + #include "audiorenderer_portaudio.h" + #elif defined(WIN32) || defined(Q_OS_WIN) + #include "audiorenderer_waveout.h" + #else + #include "audiorenderer_alsa.h" + #endif #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - #include "audiorenderer_qt5.h" + #include "audiorenderer_qt5.h" #else - #include "audiorenderer_qt6.h" + #include "audiorenderer_qt6.h" #endif -AudioPluginCache::AudioPluginCache(QObject *parent) +AudioPluginCache::AudioPluginCache(QObject* parent) : QObject(parent) { #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #if defined( __APPLE__) || defined(Q_OS_MAC) + #if defined(__APPLE__) || defined(Q_OS_MAC) m_audioDevicesList = AudioRendererPortAudio::getDevicesInfo(); - #elif defined(WIN32) || defined(Q_OS_WIN) + #elif defined(WIN32) || defined(Q_OS_WIN) m_audioDevicesList = AudioRendererWaveOut::getDevicesInfo(); - #else + #else m_audioDevicesList = AudioRendererAlsa::getDevicesInfo(); - #endif + #endif #else - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) m_audioDevicesList = AudioRendererQt5::getDevicesInfo(); m_outputDevicesList = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); - #else + #else m_audioDevicesList = AudioRendererQt6::getDevicesInfo(); m_outputDevicesList = QMediaDevices::audioOutputs(); - #endif + #endif #endif } -AudioPluginCache::~AudioPluginCache() -{ -} +AudioPluginCache::~AudioPluginCache() {} -void AudioPluginCache::load(const QDir &dir) +void AudioPluginCache::load(const QDir& dir) { qDebug() << Q_FUNC_INFO << dir.path(); @@ -84,7 +82,7 @@ void AudioPluginCache::load(const QDir &dir) QString path = dir.absoluteFilePath(fileName); QPluginLoader loader(path, this); - AudioDecoder* ptr = qobject_cast (loader.instance()); + AudioDecoder* ptr = qobject_cast(loader.instance()); if (ptr != NULL) { qDebug() << "Loaded audio decoder plugin from" << fileName; @@ -102,10 +100,10 @@ void AudioPluginCache::load(const QDir &dir) QStringList AudioPluginCache::getSupportedFormats() { QStringList caps; - foreach(QString path, m_pluginsMap.values()) + foreach (QString path, m_pluginsMap.values()) { QPluginLoader loader(path, this); - AudioDecoder* ptr = qobject_cast (loader.instance()); + AudioDecoder* ptr = qobject_cast(loader.instance()); if (ptr != NULL) { ptr->initialize(""); @@ -117,24 +115,24 @@ QStringList AudioPluginCache::getSupportedFormats() return caps; } -AudioDecoder *AudioPluginCache::getDecoderForFile(const QString &filename) +AudioDecoder* AudioPluginCache::getDecoderForFile(const QString& filename) { QFile fn(filename); if (fn.exists() == false) return NULL; - foreach(QString path, m_pluginsMap.values()) + foreach (QString path, m_pluginsMap.values()) { QPluginLoader loader(path, this); - AudioDecoder* ptr = qobject_cast (loader.instance()); + AudioDecoder* ptr = qobject_cast(loader.instance()); if (ptr != NULL) { ptr->initialize(""); - AudioDecoder* copy = qobject_cast (ptr->createCopy()); + AudioDecoder* copy = qobject_cast(ptr->createCopy()); if (copy->initialize(filename) == false) { loader.unload(); - //delete copy; + // delete copy; continue; } return copy; @@ -152,7 +150,7 @@ QList AudioPluginCache::audioDevicesList() const #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QAudioDeviceInfo AudioPluginCache::getOutputDeviceInfo(QString devName) const { - foreach (const QAudioDeviceInfo &deviceInfo, m_outputDevicesList) + foreach (const QAudioDeviceInfo& deviceInfo, m_outputDevicesList) { if (deviceInfo.deviceName() == devName) return deviceInfo; @@ -163,7 +161,7 @@ QAudioDeviceInfo AudioPluginCache::getOutputDeviceInfo(QString devName) const #else QAudioDevice AudioPluginCache::getOutputDeviceInfo(QString devName) const { - foreach (const QAudioDevice &deviceInfo, m_outputDevicesList) + foreach (const QAudioDevice& deviceInfo, m_outputDevicesList) { if (deviceInfo.description() == devName) return deviceInfo; diff --git a/engine/audio/src/audioplugincache.h b/engine/audio/src/audioplugincache.h index fe5827b6ee..51a38a4df7 100644 --- a/engine/audio/src/audioplugincache.h +++ b/engine/audio/src/audioplugincache.h @@ -22,9 +22,9 @@ #include #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - #include + #include #else - #include + #include #endif #include #include @@ -55,7 +55,7 @@ class AudioPluginCache : public QObject /** Get an audio decoder instance suitable for the given $filename. * If $filename can't be decoded, this method returns NULL */ - AudioDecoder *getDecoderForFile(const QString& filename); + AudioDecoder* getDecoderForFile(const QString& filename); /** Get the list of cached audio devices detected on creation */ QList audioDevicesList() const; diff --git a/engine/audio/src/audiorenderer.cpp b/engine/audio/src/audiorenderer.cpp index a1863026be..ea821d0aa7 100644 --- a/engine/audio/src/audiorenderer.cpp +++ b/engine/audio/src/audiorenderer.cpp @@ -23,8 +23,8 @@ #include "audiorenderer.h" #include "qlcmacros.h" -AudioRenderer::AudioRenderer (QObject* parent) - : QThread (parent) +AudioRenderer::AudioRenderer(QObject* parent) + : QThread(parent) , m_fadeStep(0.0) , m_userStop(true) , m_pause(false) @@ -37,7 +37,7 @@ AudioRenderer::AudioRenderer (QObject* parent) { } -void AudioRenderer::setDecoder(AudioDecoder *adec) +void AudioRenderer::setDecoder(AudioDecoder* adec) { m_adec = adec; } @@ -66,7 +66,7 @@ void AudioRenderer::setFadeIn(uint fadeTime) void AudioRenderer::setFadeOut(uint fadeTime) { - if (fadeTime == 0 || m_fadeStep != 0 || m_adec == NULL) + if (fadeTime == 0 || m_fadeStep != 0 || m_adec == NULL) return; quint32 sampleRate = m_adec->audioParameters().sampleRate(); @@ -103,10 +103,10 @@ void AudioRenderer::run() audioDataWritten = 0; if (m_pause == false) { - //qDebug() << "Pending audio bytes: " << pendingAudioBytes; + // qDebug() << "Pending audio bytes: " << pendingAudioBytes; if (pendingAudioBytes == 0) { - audioDataRead = m_adec->read((char *)audioData, 8192); + audioDataRead = m_adec->read((char*)audioData, 8192); if (audioDataRead == 0) { if (m_looped) @@ -122,7 +122,7 @@ void AudioRenderer::run() } if (m_intensity != 1.0 || m_fadeStep != 0) { - for (int i = 0; i < audioDataRead; i+=sampleSize) + for (int i = 0; i < audioDataRead; i += sampleSize) { qreal scaleFactor = m_intensity; if (m_fadeStep != 0) @@ -131,21 +131,20 @@ void AudioRenderer::run() scaleFactor = m_currentIntensity; if ((m_fadeStep > 0 && m_currentIntensity >= m_intensity) || (m_fadeStep < 0 && m_currentIntensity <= 0)) - m_fadeStep = 0; + m_fadeStep = 0; } if (sampleSize >= 2) { - short sample = ((short)audioData[i+1] << 8) + (short)audioData[i]; + short sample = ((short)audioData[i + 1] << 8) + (short)audioData[i]; sample *= scaleFactor; - audioData[i+1] = (sample >> 8) & 0x00FF; + audioData[i + 1] = (sample >> 8) & 0x00FF; audioData[i] = sample & 0x00FF; } /* else if (sampleSize == 3) { - long sample = ((long)audioData[i+2] << 16) + ((long)audioData[i+1] << 8) + (short)audioData[i]; - sample *= scaleFactor; - audioData[i+2] = (sample >> 16) & 0x000000FF; + long sample = ((long)audioData[i+2] << 16) + ((long)audioData[i+1] << 8) + + (short)audioData[i]; sample *= scaleFactor; audioData[i+2] = (sample >> 16) & 0x000000FF; audioData[i+1] = (sample >> 8) & 0x000000FF; audioData[i] = sample & 0x000000FF; } @@ -180,7 +179,8 @@ void AudioRenderer::run() if (audioDataWritten == 0) usleep(15000); } - //qDebug() << "[Cycle] read:" << audioDataRead << ", written:" << audioDataWritten << ", pending:" << pendingAudioBytes; + // qDebug() << "[Cycle] read:" << audioDataRead << ", written:" << audioDataWritten << ", pending:" << + // pendingAudioBytes; } else { diff --git a/engine/audio/src/audiorenderer.h b/engine/audio/src/audiorenderer.h index 6c49e4a1e9..35ca573963 100644 --- a/engine/audio/src/audiorenderer.h +++ b/engine/audio/src/audiorenderer.h @@ -29,8 +29,8 @@ * @{ */ -#define AUDIO_CAP_INPUT 1 -#define AUDIO_CAP_OUTPUT 2 +#define AUDIO_CAP_INPUT 1 +#define AUDIO_CAP_OUTPUT 2 #define SETTINGS_AUDIO_OUTPUT_DEVICE "audio/output" @@ -49,11 +49,11 @@ class AudioRenderer : public QThread * Object contsructor. * @param parent Parent object. */ - AudioRenderer(QObject * parent = 0); + AudioRenderer(QObject* parent = 0); - ~AudioRenderer() { } + ~AudioRenderer() {} - void setDecoder(AudioDecoder *adec); + void setDecoder(AudioDecoder* adec); /*! * Prepares object for usage and setups required audio parameters. * Subclass should reimplement this function. @@ -112,7 +112,7 @@ class AudioRenderer : public QThread *********************************************************************/ public: /** @reimpl */ - virtual void run(); //thread run function + virtual void run(); // thread run function void stop(); @@ -131,14 +131,14 @@ class AudioRenderer : public QThread * Returns the number of bytes written, or -1 if an error occurred. * Subclass should reimplement this function. */ - virtual qint64 writeAudio(unsigned char *data, qint64 maxSize) = 0; + virtual qint64 writeAudio(unsigned char* data, qint64 maxSize) = 0; signals: void endOfStreamReached(); private: /** Reference to the decoder to be used as data source */ - AudioDecoder *m_adec; + AudioDecoder* m_adec; QMutex m_mutex; /** Data buffer for audio */ diff --git a/engine/audio/src/audiorenderer_alsa.cpp b/engine/audio/src/audiorenderer_alsa.cpp index 043fdccaf1..76a3e660c4 100644 --- a/engine/audio/src/audiorenderer_alsa.cpp +++ b/engine/audio/src/audiorenderer_alsa.cpp @@ -30,7 +30,7 @@ #include "audiorenderer_alsa.h" -AudioRendererAlsa::AudioRendererAlsa(QString device, QObject * parent) +AudioRendererAlsa::AudioRendererAlsa(QString device, QObject* parent) : AudioRenderer(parent) { QString dev_name = "default"; @@ -58,7 +58,7 @@ AudioRendererAlsa::~AudioRendererAlsa() { qDebug() << Q_FUNC_INFO; uninitialize(); - free (pcm_name); + free(pcm_name); } bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) @@ -70,27 +70,27 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) if (snd_pcm_open(&pcm_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0) { - qWarning ("OutputALSA: Error opening PCM device %s", pcm_name); + qWarning("OutputALSA: Error opening PCM device %s", pcm_name); // if it fails, fallback to the default device pcm_name = strdup("default"); if (snd_pcm_open(&pcm_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0) { - qWarning ("OutputALSA: Error opening default PCM device. Giving up."); + qWarning("OutputALSA: Error opening default PCM device. Giving up."); return false; } } - uint rate = freq; /* Sample rate */ - uint exact_rate = freq; /* Sample rate returned by */ + uint rate = freq; /* Sample rate */ + uint exact_rate = freq; /* Sample rate returned by */ uint buffer_time = 500000; uint period_time = 100000; - snd_pcm_hw_params_t *hwparams = 0; - snd_pcm_sw_params_t *swparams = 0; - int err; //alsa error code + snd_pcm_hw_params_t* hwparams = 0; + snd_pcm_sw_params_t* swparams = 0; + int err; // alsa error code - //hw params + // hw params snd_pcm_hw_params_alloca(&hwparams); if ((err = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) { @@ -147,7 +147,8 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) } if (rate != exact_rate) { - qWarning("OutputALSA: The rate %d Hz is not supported by your hardware.\n==> Using %d Hz instead.", rate, exact_rate); + qWarning("OutputALSA: The rate %d Hz is not supported by your hardware.\n==> Using %d Hz instead.", rate, + exact_rate); } uint c = chan; if ((err = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0) @@ -155,12 +156,12 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) qWarning("OutputALSA: Error setting channels: %s", snd_strerror(err)); return false; } - if ((err = snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_time ,0)) < 0) + if ((err = snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_time, 0)) < 0) { qWarning("OutputALSA: Error setting period time: %s", snd_strerror(err)); return false; } - if ((err = snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buffer_time ,0)) < 0) + if ((err = snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buffer_time, 0)) < 0) { qWarning("OutputALSA: Error setting buffer time: %s", snd_strerror(err)); return false; @@ -170,7 +171,7 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) qWarning("OutputALSA: Error setting HW params: %s", snd_strerror(err)); return false; } - //read some alsa parameters + // read some alsa parameters snd_pcm_uframes_t buffer_size = 0; snd_pcm_uframes_t period_size = 0; if ((err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size)) < 0) @@ -183,27 +184,26 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) qWarning("OutputALSA: Error reading period size: %s", snd_strerror(err)); return false; } - //swparams + // swparams snd_pcm_sw_params_alloca(&swparams); snd_pcm_sw_params_current(pcm_handle, swparams); - if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, - buffer_size - period_size)) < 0) + if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, buffer_size - period_size)) < 0) qWarning("OutputALSA: Error setting threshold: %s", snd_strerror(err)); if ((err = snd_pcm_sw_params(pcm_handle, swparams)) < 0) { qWarning("OutputALSA: Error setting SW params: %s", snd_strerror(err)); return false; } - //setup needed values + // setup needed values m_bits_per_frame = snd_pcm_format_physical_width(alsa_format) * chan; m_chunk_size = period_size; m_can_pause = snd_pcm_hw_params_can_pause(hwparams); qDebug("OutputALSA: can pause: %d", m_can_pause); - //create alsa prebuffer; + // create alsa prebuffer; m_prebuf_size = m_bits_per_frame * m_chunk_size / 8; - m_prebuf = (uchar *)malloc(m_prebuf_size); + m_prebuf = (uchar*)malloc(m_prebuf_size); m_inited = true; return true; @@ -211,7 +211,7 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) qint64 AudioRendererAlsa::latency() { - //return m_prebuf_fill * 1000 / sampleRate() / channels() / sampleSize(); + // return m_prebuf_fill * 1000 / sampleRate() / channels() / sampleSize(); return 0; } @@ -220,10 +220,10 @@ QList AudioRendererAlsa::getDevicesInfo() QList devList; int cardIdx = -1; - while( snd_card_next( &cardIdx ) == 0 && cardIdx >= 0 ) + while (snd_card_next(&cardIdx) == 0 && cardIdx >= 0) { - snd_ctl_t *cardHandle; - snd_ctl_card_info_t *cardInfo; + snd_ctl_t* cardHandle; + snd_ctl_card_info_t* cardInfo; char str[64]; int devIdx = -1; int err; @@ -249,31 +249,31 @@ QList AudioRendererAlsa::getDevicesInfo() qDebug() << "[getDevicesInfo] Card" << cardIdx << "=" << snd_ctl_card_info_get_name(cardInfo); - while( snd_ctl_pcm_next_device( cardHandle, &devIdx ) == 0 && devIdx >= 0 ) + while (snd_ctl_pcm_next_device(cardHandle, &devIdx) == 0 && devIdx >= 0) { - snd_pcm_info_t *pcmInfo; + snd_pcm_info_t* pcmInfo; int tmpCaps = 0; - snd_pcm_info_alloca( &pcmInfo ); + snd_pcm_info_alloca(&pcmInfo); - snprintf( str, sizeof (str), "plughw:%d,%d", cardIdx, devIdx ); + snprintf(str, sizeof(str), "plughw:%d,%d", cardIdx, devIdx); /* Obtain info about this particular device */ - snd_pcm_info_set_device( pcmInfo, devIdx ); - snd_pcm_info_set_subdevice( pcmInfo, 0 ); - snd_pcm_info_set_stream( pcmInfo, SND_PCM_STREAM_CAPTURE ); - if( snd_ctl_pcm_info( cardHandle, pcmInfo ) >= 0 ) + snd_pcm_info_set_device(pcmInfo, devIdx); + snd_pcm_info_set_subdevice(pcmInfo, 0); + snd_pcm_info_set_stream(pcmInfo, SND_PCM_STREAM_CAPTURE); + if (snd_ctl_pcm_info(cardHandle, pcmInfo) >= 0) tmpCaps |= AUDIO_CAP_INPUT; - snd_pcm_info_set_stream( pcmInfo, SND_PCM_STREAM_PLAYBACK ); - if( snd_ctl_pcm_info( cardHandle, pcmInfo ) >= 0 ) + snd_pcm_info_set_stream(pcmInfo, SND_PCM_STREAM_PLAYBACK); + if (snd_ctl_pcm_info(cardHandle, pcmInfo) >= 0) tmpCaps |= AUDIO_CAP_OUTPUT; if (tmpCaps != 0) { AudioDeviceInfo info; - info.deviceName = QString(snd_ctl_card_info_get_name(cardInfo)) + " - " + - QString (snd_pcm_info_get_name( pcmInfo )); + info.deviceName = + QString(snd_ctl_card_info_get_name(cardInfo)) + " - " + QString(snd_pcm_info_get_name(pcmInfo)); info.privateName = QString(str); info.capabilities = tmpCaps; devList.append(info); @@ -292,12 +292,12 @@ QList AudioRendererAlsa::getDevicesInfo() return devList; } -qint64 AudioRendererAlsa::writeAudio(unsigned char *data, qint64 maxSize) +qint64 AudioRendererAlsa::writeAudio(unsigned char* data, qint64 maxSize) { if (pcm_handle == NULL || m_prebuf == NULL) return 0; - if((maxSize = qMin(maxSize, m_prebuf_size - m_prebuf_fill)) > 0) + if ((maxSize = qMin(maxSize, m_prebuf_size - m_prebuf_fill)) > 0) { memmove(m_prebuf + m_prebuf_fill, data, maxSize); m_prebuf_fill += maxSize; @@ -314,7 +314,7 @@ qint64 AudioRendererAlsa::writeAudio(unsigned char *data, qint64 maxSize) l -= m; m = snd_pcm_frames_to_bytes(pcm_handle, m); // convert frames to bytes m_prebuf_fill -= m; - memmove(m_prebuf, m_prebuf + m, m_prebuf_fill); //move data to begin + memmove(m_prebuf, m_prebuf + m, m_prebuf_fill); // move data to begin } else return -1; @@ -322,19 +322,19 @@ qint64 AudioRendererAlsa::writeAudio(unsigned char *data, qint64 maxSize) return maxSize; } -long AudioRendererAlsa::alsa_write(unsigned char *data, long size) +long AudioRendererAlsa::alsa_write(unsigned char* data, long size) { long m = snd_pcm_avail_update(pcm_handle); - if(m >= 0 && m < size) + if (m >= 0 && m < size) { snd_pcm_wait(pcm_handle, 500); return 0; } if (m_use_mmap) - m = snd_pcm_mmap_writei (pcm_handle, data, size); + m = snd_pcm_mmap_writei(pcm_handle, data, size); else - m = snd_pcm_writei (pcm_handle, data, size); + m = snd_pcm_writei(pcm_handle, data, size); if (m == -EAGAIN) { @@ -351,11 +351,10 @@ long AudioRendererAlsa::alsa_write(unsigned char *data, long size) } else if (m == -EPIPE) { - qDebug ("OutputALSA: buffer underrun!"); + qDebug("OutputALSA: buffer underrun!"); if ((m = snd_pcm_prepare(pcm_handle)) < 0) { - qDebug ("OutputALSA: Can't recover after underrun: %s", - snd_strerror(m)); + qDebug("OutputALSA: Can't recover after underrun: %s", snd_strerror(m)); /* TODO: reopen the device */ return -1; } @@ -364,25 +363,23 @@ long AudioRendererAlsa::alsa_write(unsigned char *data, long size) #ifdef ESTRPIPE else if (m == -ESTRPIPE) { - qDebug ("OutputALSA: Suspend, trying to resume"); - while ((m = snd_pcm_resume(pcm_handle)) - == -EAGAIN) - sleep (1); + qDebug("OutputALSA: Suspend, trying to resume"); + while ((m = snd_pcm_resume(pcm_handle)) == -EAGAIN) + sleep(1); if (m < 0) { - qDebug ("OutputALSA: Failed, restarting"); + qDebug("OutputALSA: Failed, restarting"); if ((m = snd_pcm_prepare(pcm_handle)) < 0) { - qDebug ("OutputALSA: Failed to restart device: %s.", - snd_strerror(m)); + qDebug("OutputALSA: Failed to restart device: %s.", snd_strerror(m)); return -1; } } return 0; } #endif - qDebug ("OutputALSA: error: %s", snd_strerror(m)); - return snd_pcm_prepare (pcm_handle); + qDebug("OutputALSA: error: %s", snd_strerror(m)); + return snd_pcm_prepare(pcm_handle); } void AudioRendererAlsa::drain() diff --git a/engine/audio/src/audiorenderer_alsa.h b/engine/audio/src/audiorenderer_alsa.h index 1308ad3541..f901f67fe1 100644 --- a/engine/audio/src/audiorenderer_alsa.h +++ b/engine/audio/src/audiorenderer_alsa.h @@ -43,7 +43,7 @@ class AudioRendererAlsa : public AudioRenderer { Q_OBJECT public: - AudioRendererAlsa(QString device, QObject * parent = 0); + AudioRendererAlsa(QString device, QObject* parent = 0); ~AudioRendererAlsa(); /** @reimpl */ @@ -56,7 +56,7 @@ class AudioRendererAlsa : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); /** @reimpl */ void drain(); @@ -72,7 +72,7 @@ class AudioRendererAlsa : public AudioRenderer private: // helper functions - long alsa_write(unsigned char *data, long size); + long alsa_write(unsigned char* data, long size); void uninitialize(); @@ -80,12 +80,12 @@ class AudioRendererAlsa : public AudioRenderer bool m_use_mmap; // ALSA specific - snd_pcm_t *pcm_handle; - char *pcm_name; + snd_pcm_t* pcm_handle; + char* pcm_name; snd_pcm_uframes_t m_chunk_size; size_t m_bits_per_frame; - //prebuffer - uchar *m_prebuf; + // prebuffer + uchar* m_prebuf; qint64 m_prebuf_size; qint64 m_prebuf_fill; bool m_can_pause; diff --git a/engine/audio/src/audiorenderer_coreaudio.cpp b/engine/audio/src/audiorenderer_coreaudio.cpp index 7797bd7fa8..8a636f5fc3 100644 --- a/engine/audio/src/audiorenderer_coreaudio.cpp +++ b/engine/audio/src/audiorenderer_coreaudio.cpp @@ -23,20 +23,18 @@ #include "audiodecoder.h" #include "audiorenderer_coreaudio.h" -AudioRendererCoreAudio::AudioRendererCoreAudio(QObject * parent) +AudioRendererCoreAudio::AudioRendererCoreAudio(QObject* parent) : AudioRenderer(parent) { m_buffersFilled = 0; m_bufferIndex = 0; } -AudioRendererCoreAudio::~AudioRendererCoreAudio() -{ -} +AudioRendererCoreAudio::~AudioRendererCoreAudio() {} -void AudioRendererCoreAudio::inCallback(void *inUserData, AudioQueueRef, AudioQueueBufferRef) +void AudioRendererCoreAudio::inCallback(void* inUserData, AudioQueueRef, AudioQueueBufferRef) { - AudioRendererCoreAudio *CAobj = (AudioRendererCoreAudio *)inUserData; + AudioRendererCoreAudio* CAobj = (AudioRendererCoreAudio*)inUserData; qDebug() << "inCallback called !!"; CAobj->m_buffersFilled--; } @@ -69,11 +67,11 @@ bool AudioRendererCoreAudio::initialize(quint32 freq, int chan, AudioFormat form qWarning("AudioRendererCoreAudio: unsupported format detected"); return false; } - fmt.mBytesPerFrame = fmt.mChannelsPerFrame * fmt.mBitsPerChannel/8; + fmt.mBytesPerFrame = fmt.mChannelsPerFrame * fmt.mBitsPerChannel / 8; fmt.mBytesPerPacket = fmt.mBytesPerFrame * fmt.mFramesPerPacket; status = AudioQueueNewOutput(&fmt, AudioRendererCoreAudio::inCallback, this, CFRunLoopGetMain(), - kCFRunLoopCommonModes, 0, &m_queue); + kCFRunLoopCommonModes, 0, &m_queue); if (status == kAudioFormatUnsupportedDataFormatError) { @@ -85,7 +83,7 @@ bool AudioRendererCoreAudio::initialize(quint32 freq, int chan, AudioFormat form for (int i = 0; i < AUDIO_BUFFERS_NUM; i++) { - status = AudioQueueAllocateBuffer (m_queue, AUDIO_BUFFER_SIZE, &m_buffer[i]); + status = AudioQueueAllocateBuffer(m_queue, AUDIO_BUFFER_SIZE, &m_buffer[i]); qDebug() << Q_FUNC_INFO << "Buffer #" << i << " allocate status: " << status; } @@ -104,9 +102,9 @@ qint64 AudioRendererCoreAudio::latency() return 0; } -qint64 AudioRendererCoreAudio::writeAudio(unsigned char *data, qint64 maxSize) +qint64 AudioRendererCoreAudio::writeAudio(unsigned char* data, qint64 maxSize) { - if(m_buffersFilled == AUDIO_BUFFERS_NUM) + if (m_buffersFilled == AUDIO_BUFFERS_NUM) return 0; qint64 size = maxSize; @@ -125,9 +123,7 @@ qint64 AudioRendererCoreAudio::writeAudio(unsigned char *data, qint64 maxSize) return size; } -void AudioRendererCoreAudio::drain() -{ -} +void AudioRendererCoreAudio::drain() {} void AudioRendererCoreAudio::reset() { diff --git a/engine/audio/src/audiorenderer_coreaudio.h b/engine/audio/src/audiorenderer_coreaudio.h index a2fdab43d3..9a5cde9b12 100644 --- a/engine/audio/src/audiorenderer_coreaudio.h +++ b/engine/audio/src/audiorenderer_coreaudio.h @@ -31,14 +31,14 @@ * @{ */ -#define AUDIO_BUFFER_SIZE 8192 -#define AUDIO_BUFFERS_NUM 4 +#define AUDIO_BUFFER_SIZE 8192 +#define AUDIO_BUFFERS_NUM 4 class AudioRendererCoreAudio : public AudioRenderer { Q_OBJECT public: - AudioRendererCoreAudio(QObject * parent = 0); + AudioRendererCoreAudio(QObject* parent = 0); ~AudioRendererCoreAudio(); /** @reimpl */ @@ -49,7 +49,7 @@ class AudioRendererCoreAudio : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); /** @reimpl */ void drain(); @@ -64,7 +64,7 @@ class AudioRendererCoreAudio : public AudioRenderer void resume(); private: - static void inCallback (void *inUserData, AudioQueueRef queue, AudioQueueBufferRef buf_ref); + static void inCallback(void* inUserData, AudioQueueRef queue, AudioQueueBufferRef buf_ref); AudioQueueRef m_queue; AudioQueueBufferRef m_buffer[AUDIO_BUFFERS_NUM]; diff --git a/engine/audio/src/audiorenderer_null.cpp b/engine/audio/src/audiorenderer_null.cpp index d4b1036606..e0ac109ed3 100644 --- a/engine/audio/src/audiorenderer_null.cpp +++ b/engine/audio/src/audiorenderer_null.cpp @@ -19,8 +19,7 @@ #include "audiorenderer_null.h" -AudioRendererNull::AudioRendererNull(QObject * parent) +AudioRendererNull::AudioRendererNull(QObject* parent) : AudioRenderer(parent) { } - diff --git a/engine/audio/src/audiorenderer_null.h b/engine/audio/src/audiorenderer_null.h index 9b7341f554..dd1a37b9cf 100644 --- a/engine/audio/src/audiorenderer_null.h +++ b/engine/audio/src/audiorenderer_null.h @@ -31,32 +31,40 @@ class AudioRendererNull : public AudioRenderer { Q_OBJECT public: - AudioRendererNull(QObject * parent = 0); + AudioRendererNull(QObject* parent = 0); - ~AudioRendererNull() { } + ~AudioRendererNull() {} /** @reimpl */ - bool initialize(quint32, int, AudioFormat) { return true; } + bool initialize(quint32, int, AudioFormat) + { + return true; + } /** @reimpl */ - qint64 latency() { return 0; } // not bad for a null device huh ? ;) + qint64 latency() + { + return 0; + } // not bad for a null device huh ? ;) protected: /** @reimpl */ - qint64 writeAudio(unsigned char *, qint64 maxSize) { return maxSize; } + qint64 writeAudio(unsigned char*, qint64 maxSize) + { + return maxSize; + } /** @reimpl */ - void drain() { } + void drain() {} /** @reimpl */ - void reset() { } + void reset() {} /** @reimpl */ - void suspend() { } + void suspend() {} /** @reimpl */ - void resume() { } - + void resume() {} }; /** @} */ diff --git a/engine/audio/src/audiorenderer_portaudio.cpp b/engine/audio/src/audiorenderer_portaudio.cpp index 25ea4484f6..9328557b56 100644 --- a/engine/audio/src/audiorenderer_portaudio.cpp +++ b/engine/audio/src/audiorenderer_portaudio.cpp @@ -25,7 +25,7 @@ #include "audiodecoder.h" #include "audiorenderer_portaudio.h" -AudioRendererPortAudio::AudioRendererPortAudio(QString device, QObject * parent) +AudioRendererPortAudio::AudioRendererPortAudio(QString device, QObject* parent) : AudioRenderer(parent) , m_paStream(NULL) , m_device(device) @@ -41,17 +41,14 @@ AudioRendererPortAudio::~AudioRendererPortAudio() PaError err; err = Pa_Terminate(); - if( err != paNoError ) - qDebug() << "PortAudio error: " << Pa_GetErrorText( err ); + if (err != paNoError) + qDebug() << "PortAudio error: " << Pa_GetErrorText(err); } -int AudioRendererPortAudio::dataCallback ( const void *, void *outputBuffer, - unsigned long frameCount, - const PaStreamCallbackTimeInfo*, - PaStreamCallbackFlags , - void *userData ) +int AudioRendererPortAudio::dataCallback(const void*, void* outputBuffer, unsigned long frameCount, + const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void* userData) { - AudioRendererPortAudio *PAobj = (AudioRendererPortAudio *)userData; + AudioRendererPortAudio* PAobj = (AudioRendererPortAudio*)userData; unsigned long requestedData = frameCount * PAobj->m_frameSize * PAobj->m_channels; @@ -81,7 +78,7 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form PaStreamFlags flags = paNoFlag; err = Pa_Initialize(); - if( err != paNoError ) + if (err != paNoError) return false; if (m_device.isEmpty()) @@ -104,8 +101,8 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form m_channels = chan; - outputParameters.channelCount = chan; /* stereo output */ - outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency; + outputParameters.channelCount = chan; /* stereo output */ + outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; switch (format) @@ -131,15 +128,15 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form return false; } - err = Pa_OpenStream( &m_paStream, NULL, &outputParameters, - freq, paFramesPerBufferUnspecified, flags, dataCallback, this ); + err = Pa_OpenStream(&m_paStream, NULL, &outputParameters, freq, paFramesPerBufferUnspecified, flags, dataCallback, + this); - if( err != paNoError ) + if (err != paNoError) return false; - err = Pa_StartStream( m_paStream ); + err = Pa_StartStream(m_paStream); - if( err != paNoError ) + if (err != paNoError) return false; return true; @@ -157,19 +154,19 @@ QList AudioRendererPortAudio::getDevicesInfo() int numDevices, err, i; err = Pa_Initialize(); - if( err != paNoError ) + if (err != paNoError) return devList; numDevices = Pa_GetDeviceCount(); - if( numDevices < 0 ) + if (numDevices < 0) { - qWarning("ERROR: Pa_CountDevices returned 0x%x\n", numDevices ); + qWarning("ERROR: Pa_CountDevices returned 0x%x\n", numDevices); return devList; } for (i = 0; i < numDevices; i++) { - const PaDeviceInfo *deviceInfo = Pa_GetDeviceInfo( i ); + const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo(i); if (deviceInfo != NULL) { AudioDeviceInfo info; @@ -185,20 +182,20 @@ QList AudioRendererPortAudio::getDevicesInfo() } err = Pa_Terminate(); - if( err != paNoError ) - qDebug() << "PortAudio error: " << Pa_GetErrorText( err ); + if (err != paNoError) + qDebug() << "PortAudio error: " << Pa_GetErrorText(err); return devList; } -qint64 AudioRendererPortAudio::writeAudio(unsigned char *data, qint64 maxSize) +qint64 AudioRendererPortAudio::writeAudio(unsigned char* data, qint64 maxSize) { if (m_buffer.size() > (8192 * 4)) return 0; qDebug() << "writeAudio called !! - " << maxSize; QMutexLocker locker(&m_paMutex); - m_buffer.append((const char *)data, maxSize); + m_buffer.append((const char*)data, maxSize); return maxSize; } @@ -211,26 +208,21 @@ void AudioRendererPortAudio::drain() void AudioRendererPortAudio::reset() { QMutexLocker locker(&m_paMutex); - if ( m_paStream == NULL) + if (m_paStream == NULL) return; PaError err; - err = Pa_StopStream( m_paStream ); - if( err != paNoError ) + err = Pa_StopStream(m_paStream); + if (err != paNoError) qDebug() << "PortAudio Error: Stop stream failed!"; - err = Pa_CloseStream( m_paStream ); - if( err != paNoError ) + err = Pa_CloseStream(m_paStream); + if (err != paNoError) qDebug() << "PortAudio Error: Close stream failed!"; m_buffer.clear(); m_paStream = NULL; } -void AudioRendererPortAudio::suspend() -{ -} +void AudioRendererPortAudio::suspend() {} -void AudioRendererPortAudio::resume() -{ - -} +void AudioRendererPortAudio::resume() {} diff --git a/engine/audio/src/audiorenderer_portaudio.h b/engine/audio/src/audiorenderer_portaudio.h index 40a6bb2136..9a206e4b8e 100644 --- a/engine/audio/src/audiorenderer_portaudio.h +++ b/engine/audio/src/audiorenderer_portaudio.h @@ -33,7 +33,7 @@ class AudioRendererPortAudio : public AudioRenderer { Q_OBJECT public: - AudioRendererPortAudio(QString device, QObject * parent = 0); + AudioRendererPortAudio(QString device, QObject* parent = 0); ~AudioRendererPortAudio(); /** @reimpl */ @@ -46,7 +46,7 @@ class AudioRendererPortAudio : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); int getPendingDataSize(); @@ -63,13 +63,11 @@ class AudioRendererPortAudio : public AudioRenderer void resume(); private: - static int dataCallback ( const void *inputBuffer, void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void *userData ); + static int dataCallback(const void* inputBuffer, void* outputBuffer, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, + void* userData); - PaStream *m_paStream; + PaStream* m_paStream; QMutex m_paMutex; QByteArray m_buffer; QString m_device; diff --git a/engine/audio/src/audiorenderer_qt5.cpp b/engine/audio/src/audiorenderer_qt5.cpp index db182a1230..e243aa84b1 100644 --- a/engine/audio/src/audiorenderer_qt5.cpp +++ b/engine/audio/src/audiorenderer_qt5.cpp @@ -25,7 +25,7 @@ #include "audiorenderer_qt5.h" #include "audioplugincache.h" -AudioRendererQt5::AudioRendererQt5(QString device, Doc *doc, QObject *parent) +AudioRendererQt5::AudioRendererQt5(QString device, Doc* doc, QObject* parent) : AudioRenderer(parent) , m_audioOutput(NULL) , m_output(NULL) @@ -64,28 +64,28 @@ bool AudioRendererQt5::initialize(quint32 freq, int chan, AudioFormat format) switch (format) { - case PCM_S8: - m_format.setSampleSize(8); - m_format.setSampleType(QAudioFormat::SignedInt); + case PCM_S8: + m_format.setSampleSize(8); + m_format.setSampleType(QAudioFormat::SignedInt); break; - case PCM_S16LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); + case PCM_S16LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); break; - case PCM_S24LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); + case PCM_S24LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); break; - case PCM_S32LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); + case PCM_S32LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); break; - default: - qWarning("AudioRendererQt5: unsupported format detected"); - return false; + default: + qWarning("AudioRendererQt5: unsupported format detected"); + return false; } if (!m_deviceInfo.isFormatSupported(m_format)) @@ -108,11 +108,11 @@ QList AudioRendererQt5::getDevicesInfo() QStringList outDevs, inDevs; // create a preliminary list of input devices only - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) + foreach (const QAudioDeviceInfo& deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) inDevs.append(deviceInfo.deviceName()); // loop through output devices and check if they're input devices too - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) + foreach (const QAudioDeviceInfo& deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { outDevs.append(deviceInfo.deviceName()); AudioDeviceInfo info; @@ -129,7 +129,7 @@ QList AudioRendererQt5::getDevicesInfo() } // add the devices left in the input list. These don't have output capabilities - foreach(QString dev, inDevs) + foreach (QString dev, inDevs) { AudioDeviceInfo info; info.deviceName = dev; @@ -142,13 +142,13 @@ QList AudioRendererQt5::getDevicesInfo() return devList; } -qint64 AudioRendererQt5::writeAudio(unsigned char *data, qint64 maxSize) +qint64 AudioRendererQt5::writeAudio(unsigned char* data, qint64 maxSize) { if (m_audioOutput == NULL || m_audioOutput->bytesFree() < maxSize) return 0; - //qDebug() << "writeAudio called !! - " << maxSize; - qint64 written = m_output->write((const char *)data, maxSize); + // qDebug() << "writeAudio called !! - " << maxSize; + qint64 written = m_output->write((const char*)data, maxSize); if (written != maxSize) qDebug() << "[writeAudio] expexcted to write" << maxSize << "but wrote" << written; diff --git a/engine/audio/src/audiorenderer_qt5.h b/engine/audio/src/audiorenderer_qt5.h index df6377f408..b14065dfa6 100644 --- a/engine/audio/src/audiorenderer_qt5.h +++ b/engine/audio/src/audiorenderer_qt5.h @@ -35,7 +35,7 @@ class AudioRendererQt5 : public AudioRenderer { Q_OBJECT public: - AudioRendererQt5(QString device, Doc *doc, QObject *parent = 0); + AudioRendererQt5(QString device, Doc* doc, QObject* parent = 0); ~AudioRendererQt5(); /** @reimpl */ @@ -48,7 +48,7 @@ class AudioRendererQt5 : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); /** @reimpl */ void drain(); @@ -70,8 +70,8 @@ class AudioRendererQt5 : public AudioRenderer void run(); private: - QAudioOutput *m_audioOutput; - QIODevice *m_output; + QAudioOutput* m_audioOutput; + QIODevice* m_output; QAudioFormat m_format; QString m_device; QAudioDeviceInfo m_deviceInfo; diff --git a/engine/audio/src/audiorenderer_qt6.cpp b/engine/audio/src/audiorenderer_qt6.cpp index 289ec588aa..1f06141777 100644 --- a/engine/audio/src/audiorenderer_qt6.cpp +++ b/engine/audio/src/audiorenderer_qt6.cpp @@ -26,7 +26,7 @@ #include "audiorenderer_qt6.h" #include "audioplugincache.h" -AudioRendererQt6::AudioRendererQt6(QString device, Doc *doc, QObject *parent) +AudioRendererQt6::AudioRendererQt6(QString device, Doc* doc, QObject* parent) : AudioRenderer(parent) , m_audioSink(NULL) , m_output(NULL) @@ -61,23 +61,23 @@ bool AudioRendererQt6::initialize(quint32 freq, int chan, AudioFormat format) { m_format.setChannelCount(chan); m_format.setSampleRate(freq); - //m_format.setCodec("audio/pcm"); + // m_format.setCodec("audio/pcm"); switch (format) { - case PCM_S8: - m_format.setSampleFormat(QAudioFormat::UInt8); + case PCM_S8: + m_format.setSampleFormat(QAudioFormat::UInt8); break; - case PCM_S16LE: - case PCM_S24LE: - m_format.setSampleFormat(QAudioFormat::Int16); + case PCM_S16LE: + case PCM_S24LE: + m_format.setSampleFormat(QAudioFormat::Int16); break; - case PCM_S32LE: - m_format.setSampleFormat(QAudioFormat::Int32); + case PCM_S32LE: + m_format.setSampleFormat(QAudioFormat::Int32); break; - default: - qWarning("AudioRendererQt6: unsupported format detected"); - return false; + default: + qWarning("AudioRendererQt6: unsupported format detected"); + return false; } if (!m_deviceInfo.isFormatSupported(m_format)) @@ -100,16 +100,16 @@ QList AudioRendererQt6::getDevicesInfo() QStringList outDevs, inDevs; // create a preliminary list of input devices only - foreach (const QAudioDevice &deviceInfo, QMediaDevices::audioInputs()) + foreach (const QAudioDevice& deviceInfo, QMediaDevices::audioInputs()) inDevs.append(deviceInfo.description()); // loop through output devices and check if they're input devices too - foreach (const QAudioDevice &deviceInfo, QMediaDevices::audioOutputs()) + foreach (const QAudioDevice& deviceInfo, QMediaDevices::audioOutputs()) { outDevs.append(deviceInfo.description()); AudioDeviceInfo info; info.deviceName = deviceInfo.description(); - info.privateName = deviceInfo.description(); //QString::number(i); + info.privateName = deviceInfo.description(); // QString::number(i); info.capabilities = 0; info.capabilities |= AUDIO_CAP_OUTPUT; if (inDevs.contains(deviceInfo.description())) @@ -121,11 +121,11 @@ QList AudioRendererQt6::getDevicesInfo() } // add the devices left in the input list. These don't have output capabilities - foreach(QString dev, inDevs) + foreach (QString dev, inDevs) { AudioDeviceInfo info; info.deviceName = dev; - info.privateName = dev; //QString::number(i); + info.privateName = dev; // QString::number(i); info.capabilities = 0; info.capabilities |= AUDIO_CAP_INPUT; devList.append(info); @@ -134,20 +134,20 @@ QList AudioRendererQt6::getDevicesInfo() return devList; } -qint64 AudioRendererQt6::writeAudio(unsigned char *data, qint64 maxSize) +qint64 AudioRendererQt6::writeAudio(unsigned char* data, qint64 maxSize) { qsizetype bFree = m_audioSink->bytesFree(); if (m_audioSink == NULL || bFree < maxSize) return 0; - //qDebug() << "writeAudio called !! - " << maxSize << m_outputBuffer.length() << bFree; + // qDebug() << "writeAudio called !! - " << maxSize << m_outputBuffer.length() << bFree; - m_outputBuffer.append((char *)data, maxSize); + m_outputBuffer.append((char*)data, maxSize); if (m_outputBuffer.length() >= bFree) { - qint64 written = m_output->write(m_outputBuffer.data(), bFree); + qint64 written = m_output->write(m_outputBuffer.data(), bFree); if (written != bFree) qDebug() << "[writeAudio] expexcted to write" << bFree << "but wrote" << written; diff --git a/engine/audio/src/audiorenderer_qt6.h b/engine/audio/src/audiorenderer_qt6.h index 5573844a8f..3ba0647c48 100644 --- a/engine/audio/src/audiorenderer_qt6.h +++ b/engine/audio/src/audiorenderer_qt6.h @@ -37,7 +37,7 @@ class AudioRendererQt6 : public AudioRenderer { Q_OBJECT public: - AudioRendererQt6(QString device, Doc *doc, QObject * parent = 0); + AudioRendererQt6(QString device, Doc* doc, QObject* parent = 0); ~AudioRendererQt6(); /** @reimpl */ @@ -50,7 +50,7 @@ class AudioRendererQt6 : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); /** @reimpl */ void drain(); @@ -72,8 +72,8 @@ class AudioRendererQt6 : public AudioRenderer void run(); private: - QAudioSink *m_audioSink; - QIODevice *m_output; + QAudioSink* m_audioSink; + QIODevice* m_output; QAudioFormat m_format; QString m_device; QAudioDevice m_deviceInfo; diff --git a/engine/audio/src/audiorenderer_waveout.cpp b/engine/audio/src/audiorenderer_waveout.cpp index 263248f63c..fade04a484 100644 --- a/engine/audio/src/audiorenderer_waveout.cpp +++ b/engine/audio/src/audiorenderer_waveout.cpp @@ -33,16 +33,16 @@ #include "audiorenderer_waveout.h" -#define MAX_WAVEBLOCKS 256 +#define MAX_WAVEBLOCKS 256 -static CRITICAL_SECTION cs; -static HWAVEOUT dev = NULL; -static unsigned int ScheduledBlocks = 0; -static int PlayedWaveHeadersCount = 0; // free index -static WAVEHDR* PlayedWaveHeaders [MAX_WAVEBLOCKS]; +static CRITICAL_SECTION cs; +static HWAVEOUT dev = NULL; +static unsigned int ScheduledBlocks = 0; +static int PlayedWaveHeadersCount = 0; // free index +static WAVEHDR* PlayedWaveHeaders[MAX_WAVEBLOCKS]; -static void CALLBACK wave_callback (HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) +static void CALLBACK wave_callback(HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) { Q_UNUSED(hWave) Q_UNUSED(dwInstance) @@ -50,36 +50,35 @@ static void CALLBACK wave_callback (HWAVE hWave, UINT uMsg, DWORD dwInstance, DW if (uMsg == WOM_DONE) { - EnterCriticalSection (&cs); - PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1; - LeaveCriticalSection (&cs); + EnterCriticalSection(&cs); + PlayedWaveHeaders[PlayedWaveHeadersCount++] = (WAVEHDR*)dwParam1; + LeaveCriticalSection(&cs); } } -static void -free_memory (void) +static void free_memory(void) { - WAVEHDR* wh; - HGLOBAL hg; + WAVEHDR* wh; + HGLOBAL hg; - EnterCriticalSection (&cs); - wh = PlayedWaveHeaders [--PlayedWaveHeadersCount]; - ScheduledBlocks--; // decrease the number of USED blocks - LeaveCriticalSection (&cs); + EnterCriticalSection(&cs); + wh = PlayedWaveHeaders[--PlayedWaveHeadersCount]; + ScheduledBlocks--; // decrease the number of USED blocks + LeaveCriticalSection(&cs); - waveOutUnprepareHeader (dev, wh, sizeof (WAVEHDR)); + waveOutUnprepareHeader(dev, wh, sizeof(WAVEHDR)); - hg = GlobalHandle (wh -> lpData); // Deallocate the buffer memory - GlobalUnlock (hg); - GlobalFree (hg); + hg = GlobalHandle(wh->lpData); // Deallocate the buffer memory + GlobalUnlock(hg); + GlobalFree(hg); - hg = GlobalHandle (wh); // Deallocate the header memory - GlobalUnlock (hg); - GlobalFree (hg); + hg = GlobalHandle(wh); // Deallocate the header memory + GlobalUnlock(hg); + GlobalFree(hg); } -AudioRendererWaveOut::AudioRendererWaveOut(QString device, QObject * parent) - : AudioRenderer(parent) +AudioRendererWaveOut::AudioRendererWaveOut(QString device, QObject* parent) + : AudioRenderer(parent) { deviceID = WAVE_MAPPER; if (device.isEmpty()) @@ -102,7 +101,7 @@ bool AudioRendererWaveOut::initialize(quint32 freq, int chan, AudioFormat format { Q_UNUSED(format) - if (!waveOutGetNumDevs ()) + if (!waveOutGetNumDevs()) { qWarning("AudioRendererWaveOut: no audio device found"); return false; @@ -110,13 +109,13 @@ bool AudioRendererWaveOut::initialize(quint32 freq, int chan, AudioFormat format WAVEFORMATEX fmt; fmt.wFormatTag = WAVE_FORMAT_PCM; - fmt.wBitsPerSample = 16; - fmt.nChannels = chan; - fmt.nSamplesPerSec = (unsigned long)(freq); - fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample/8; - fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nChannels * fmt.wBitsPerSample/8; + fmt.wBitsPerSample = 16; + fmt.nChannels = chan; + fmt.nSamplesPerSec = (unsigned long)(freq); + fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; + fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nChannels * fmt.wBitsPerSample / 8; - switch (waveOutOpen (&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION)) + switch (waveOutOpen(&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION)) { case MMSYSERR_ALLOCATED: qWarning("AudioRendererWaveOut: Device is already open."); @@ -143,8 +142,8 @@ bool AudioRendererWaveOut::initialize(quint32 freq, int chan, AudioFormat format break; } - waveOutReset (dev); - InitializeCriticalSection (&cs); + waveOutReset(dev); + InitializeCriticalSection(&cs); return true; } @@ -173,9 +172,9 @@ QList AudioRendererWaveOut::getDevicesInfo() if (!waveInGetDevCaps(i, &wic, sizeof(WAVEINCAPS))) { /* Display its Device ID and name */ - //printf("Device ID #%u: %s\r\n", i, wic.szPname); + // printf("Device ID #%u: %s\r\n", i, wic.szPname); AudioDeviceInfo info; - info.deviceName = QString((const QChar *)wic.szPname); + info.deviceName = QString((const QChar*)wic.szPname); info.privateName = QString::number(i); info.capabilities = AUDIO_CAP_INPUT; devList.append(info); @@ -192,9 +191,9 @@ QList AudioRendererWaveOut::getDevicesInfo() if (!waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))) { /* Display its Device ID and name */ - //printf("Device ID #%u: %s\r\n", i, woc.szPname); + // printf("Device ID #%u: %s\r\n", i, woc.szPname); AudioDeviceInfo info; - info.deviceName = QString((const QChar *)woc.szPname); + info.deviceName = QString((const QChar*)woc.szPname); info.privateName = QString::number(i); info.capabilities = AUDIO_CAP_OUTPUT; devList.append(info); @@ -204,57 +203,57 @@ QList AudioRendererWaveOut::getDevicesInfo() return devList; } -qint64 AudioRendererWaveOut::writeAudio(unsigned char *data, qint64 len) +qint64 AudioRendererWaveOut::writeAudio(unsigned char* data, qint64 len) { - HGLOBAL hg; - HGLOBAL hg2; - LPWAVEHDR wh; - void* allocptr; + HGLOBAL hg; + HGLOBAL hg2; + LPWAVEHDR wh; + void* allocptr; len = qMin(len, (qint64)1024); while (PlayedWaveHeadersCount > 0) // free used blocks ... - free_memory (); + free_memory(); - if (ScheduledBlocks >= sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders)) // wait for a free block ... + if (ScheduledBlocks >= sizeof(PlayedWaveHeaders) / sizeof(*PlayedWaveHeaders)) // wait for a free block ... { usleep(500); return 0; } - if ((hg2 = GlobalAlloc (GMEM_MOVEABLE, len)) == NULL) // allocate some memory for a copy of the buffer + if ((hg2 = GlobalAlloc(GMEM_MOVEABLE, len)) == NULL) // allocate some memory for a copy of the buffer { qWarning("AudioRendererWaveOut: GlobalAlloc failed"); return 0; } - allocptr = GlobalLock (hg2); - CopyMemory (allocptr, data, len); // Here we can call any modification output functions we want.... + allocptr = GlobalLock(hg2); + CopyMemory(allocptr, data, len); // Here we can call any modification output functions we want.... - if ((hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL) // now make a header and WRITE IT! + if ((hg = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(WAVEHDR))) == NULL) // now make a header and WRITE IT! return -1; - wh = (wavehdr_tag*)GlobalLock (hg); - wh->dwBufferLength = len; - wh->lpData = (CHAR *)allocptr; + wh = (wavehdr_tag*)GlobalLock(hg); + wh->dwBufferLength = len; + wh->lpData = (CHAR*)allocptr; - if (waveOutPrepareHeader (dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR) + if (waveOutPrepareHeader(dev, wh, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) { - GlobalUnlock (hg); - GlobalFree (hg); + GlobalUnlock(hg); + GlobalFree(hg); return -1; } - if (waveOutWrite (dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR) + if (waveOutWrite(dev, wh, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) { - GlobalUnlock (hg); - GlobalFree (hg); + GlobalUnlock(hg); + GlobalFree(hg); return -1; } - EnterCriticalSection (&cs); + EnterCriticalSection(&cs); ScheduledBlocks++; - LeaveCriticalSection (&cs); + LeaveCriticalSection(&cs); return len; } @@ -264,7 +263,7 @@ void AudioRendererWaveOut::drain() while (ScheduledBlocks > 0) { Sleep(ScheduledBlocks); - while (PlayedWaveHeadersCount > 0) // free used blocks ... + while (PlayedWaveHeadersCount > 0) // free used blocks ... free_memory(); } } @@ -281,9 +280,9 @@ void AudioRendererWaveOut::resume() void AudioRendererWaveOut::reset() { - while (PlayedWaveHeadersCount > 0) // free used blocks ... - free_memory (); - waveOutReset (dev); + while (PlayedWaveHeadersCount > 0) // free used blocks ... + free_memory(); + waveOutReset(dev); } void AudioRendererWaveOut::uninitialize() @@ -292,17 +291,17 @@ void AudioRendererWaveOut::uninitialize() { while (ScheduledBlocks > 0) { - Sleep (ScheduledBlocks); - while (PlayedWaveHeadersCount > 0) // free used blocks ... - free_memory (); + Sleep(ScheduledBlocks); + while (PlayedWaveHeadersCount > 0) // free used blocks ... + free_memory(); } - waveOutReset (dev); // reset the device - waveOutClose (dev); // close the device + waveOutReset(dev); // reset the device + waveOutClose(dev); // close the device dev = 0; } - DeleteCriticalSection (&cs); + DeleteCriticalSection(&cs); ScheduledBlocks = 0; return; } diff --git a/engine/audio/src/audiorenderer_waveout.h b/engine/audio/src/audiorenderer_waveout.h index ebd55a51d4..ac7d7df03e 100644 --- a/engine/audio/src/audiorenderer_waveout.h +++ b/engine/audio/src/audiorenderer_waveout.h @@ -42,7 +42,7 @@ class AudioRendererWaveOut : public AudioRenderer { Q_OBJECT public: - AudioRendererWaveOut(QString device, QObject * parent = 0); + AudioRendererWaveOut(QString device, QObject* parent = 0); ~AudioRendererWaveOut(); /** @reimpl */ @@ -55,7 +55,7 @@ class AudioRendererWaveOut : public AudioRenderer protected: /** @reimpl */ - qint64 writeAudio(unsigned char *data, qint64 maxSize); + qint64 writeAudio(unsigned char* data, qint64 maxSize); /** @reimpl */ void drain(); diff --git a/engine/src/avolitesd4parser.cpp b/engine/src/avolitesd4parser.cpp index b465c6a0b0..4fd742da85 100644 --- a/engine/src/avolitesd4parser.cpp +++ b/engine/src/avolitesd4parser.cpp @@ -32,78 +32,78 @@ #include "qlcfile.h" // Channel groups -#define KD4GroupSpecial "S" +#define KD4GroupSpecial "S" #define KD4GroupIntensity "I" -#define KD4GroupPanTilt "P" -#define KD4GroupColour "C" -#define KD4GroupGobo "G" -#define KD4GroupBeam "B" -#define KD4GroupEffect "E" +#define KD4GroupPanTilt "P" +#define KD4GroupColour "C" +#define KD4GroupGobo "G" +#define KD4GroupBeam "B" +#define KD4GroupEffect "E" // Channels -#define KD4TagFixture QString("Fixture") -#define KD4TagName QString("Name") +#define KD4TagFixture QString("Fixture") +#define KD4TagName QString("Name") #define KD4TagShortName QString("ShortName") -#define KD4TagCompany QString("Company") -#define KD4TagControl QString("Control") -#define KD4TagID QString("ID") -#define KD4TagGroup QString("Group") -#define KD4TagSpeed QString("Speed") -#define KD4TagMacro QString("Macro") -#define KD4TagReserved QString("Reserved") -#define KD4TagShutter QString("Shutter") -#define KD4TagPan QString("Pan") -#define KD4TagTilt QString("Tilt") -#define KD4TagCyan QString("Cyan") -#define KD4TagMagenta QString("Magenta") -#define KD4TagYellow QString("Yellow") -#define KD4TagRed QString("Red") -#define KD4TagBlue QString("Blue") -#define KD4TagGreen QString("Green") -#define KD4TagPrism QString("Prism") -#define KD4TagEffect QString("Effect") +#define KD4TagCompany QString("Company") +#define KD4TagControl QString("Control") +#define KD4TagID QString("ID") +#define KD4TagGroup QString("Group") +#define KD4TagSpeed QString("Speed") +#define KD4TagMacro QString("Macro") +#define KD4TagReserved QString("Reserved") +#define KD4TagShutter QString("Shutter") +#define KD4TagPan QString("Pan") +#define KD4TagTilt QString("Tilt") +#define KD4TagCyan QString("Cyan") +#define KD4TagMagenta QString("Magenta") +#define KD4TagYellow QString("Yellow") +#define KD4TagRed QString("Red") +#define KD4TagBlue QString("Blue") +#define KD4TagGreen QString("Green") +#define KD4TagPrism QString("Prism") +#define KD4TagEffect QString("Effect") #define KD4TagAttribute QString("Attribute") -#define KD4TagUpdate QString("Update") +#define KD4TagUpdate QString("Update") // Capabilities -#define KD4TagFunction QString("Function") -#define KD4TagFunctionName QString("Name") -#define KD4TagFunctionDmx QString("Dmx") +#define KD4TagFunction QString("Function") +#define KD4TagFunctionName QString("Name") +#define KD4TagFunctionDmx QString("Dmx") #define KD4TagFunctionDmxValueSeparator '~' // Mode section -#define KD4TagMode QString("Mode") -#define KD4TagModeName QString("Name") -#define KD4TagModeInclude QString("Include") -#define KD4TagModeAttribute QString("Attribute") -#define KD4TagModeChannelOffset QString("ChannelOffset") -#define KD4TagModeID QString("ID") +#define KD4TagMode QString("Mode") +#define KD4TagModeName QString("Name") +#define KD4TagModeInclude QString("Include") +#define KD4TagModeAttribute QString("Attribute") +#define KD4TagModeChannelOffset QString("ChannelOffset") +#define KD4TagModeID QString("ID") #define KD4TagModeChannelSeparator ',' // Palettes section -#define KD4TagPalettes QString("Palettes") -#define KD4TagPalette QString("Palette") +#define KD4TagPalettes QString("Palettes") +#define KD4TagPalette QString("Palette") // Physical section -#define KD4TagPhysical QString("Physical") -#define KD4TagPhysicalBulb QString("Bulb") -#define KD4TagPhysicalBulbType QString("Type") -#define KD4TagPhysicalBulbLumens QString("Lumens") -#define KD4TagPhysicalBulbColourTemp QString("ColourTemp") -#define KD4TagPhysicalLens QString("Lens") -#define KD4TagPhysicalLensName QString("Name") -#define KD4TagPhysicalLensDegrees QString("Degrees") +#define KD4TagPhysical QString("Physical") +#define KD4TagPhysicalBulb QString("Bulb") +#define KD4TagPhysicalBulbType QString("Type") +#define KD4TagPhysicalBulbLumens QString("Lumens") +#define KD4TagPhysicalBulbColourTemp QString("ColourTemp") +#define KD4TagPhysicalLens QString("Lens") +#define KD4TagPhysicalLensName QString("Name") +#define KD4TagPhysicalLensDegrees QString("Degrees") #define KD4TagPhysicalLensDegreesSeparator QString('~') -#define KD4TagPhysicalWeight QString("Weight") -#define KD4TagPhysicalWeightKg QString("Kg") -#define KD4TagPhysicalSize QString("Size") -#define KD4TagPhysicalSizeHeight QString("Height") -#define KD4TagPhysicalSizeWidth QString("Width") -#define KD4TagPhysicalSizeDepth QString("Depth") -#define KD4TagPhysicalFocus QString("Focus") -#define KD4TagPhysicalFocusType QString("Type") -#define KD4TagPhysicalFocusPanMax QString("PanMax") -#define KD4TagPhysicalFocusTiltMax QString("TiltMax") +#define KD4TagPhysicalWeight QString("Weight") +#define KD4TagPhysicalWeightKg QString("Kg") +#define KD4TagPhysicalSize QString("Size") +#define KD4TagPhysicalSizeHeight QString("Height") +#define KD4TagPhysicalSizeWidth QString("Width") +#define KD4TagPhysicalSizeDepth QString("Depth") +#define KD4TagPhysicalFocus QString("Focus") +#define KD4TagPhysicalFocusType QString("Type") +#define KD4TagPhysicalFocusPanMax QString("PanMax") +#define KD4TagPhysicalFocusTiltMax QString("TiltMax") // Static attibute map shared between instances of the parser, initialized only // once per application. @@ -124,11 +124,9 @@ AvolitesD4Parser::AvolitesD4Parser() } } -AvolitesD4Parser::~AvolitesD4Parser() -{ -} +AvolitesD4Parser::~AvolitesD4Parser() {} -bool AvolitesD4Parser::loadXML(const QString& path, QLCFixtureDef *fixtureDef) +bool AvolitesD4Parser::loadXML(const QString& path, QLCFixtureDef* fixtureDef) { m_lastError = QString(); m_channels.clear(); @@ -139,7 +137,7 @@ bool AvolitesD4Parser::loadXML(const QString& path, QLCFixtureDef *fixtureDef) return false; } - QXmlStreamReader *doc = QLCFile::getXMLReader(path); + QXmlStreamReader* doc = QLCFile::getXMLReader(path); if (doc == NULL || doc->device() == NULL || doc->hasError()) { m_lastError = QString("Unable to read from %1").arg(path); @@ -212,83 +210,68 @@ QLCChannel::Group AvolitesD4Parser::getGroup(QString ID, QString name, QString g switch (stringToAttributeEnum(group)) { - case AvolitesD4Parser::SPECIAL: - if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) || - name.contains(KD4TagSpeed, Qt::CaseInsensitive)) - return QLCChannel::Speed; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || - name.contains(KD4TagMacro, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) || - name.contains(KD4TagReserved, Qt::CaseInsensitive)) - return QLCChannel::NoGroup; - else - return QLCChannel::Maintenance; + case AvolitesD4Parser::SPECIAL: + if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) || name.contains(KD4TagSpeed, Qt::CaseInsensitive)) + return QLCChannel::Speed; + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) || name.contains(KD4TagReserved, Qt::CaseInsensitive)) + return QLCChannel::NoGroup; + else + return QLCChannel::Maintenance; break; - default: - case AvolitesD4Parser::INTENSITY: - if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) || - name.contains(KD4TagShutter, Qt::CaseInsensitive)) - return QLCChannel::Shutter; - else - return QLCChannel::Intensity; + default: + case AvolitesD4Parser::INTENSITY: + if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) || name.contains(KD4TagShutter, Qt::CaseInsensitive)) + return QLCChannel::Shutter; + else + return QLCChannel::Intensity; break; - case AvolitesD4Parser::PANTILT: - if (ID.contains(KD4TagPan, Qt::CaseInsensitive) || - name.contains(KD4TagPan, Qt::CaseInsensitive)) - return QLCChannel::Pan; - else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) || - name.contains(KD4TagTilt, Qt::CaseInsensitive)) - return QLCChannel::Tilt; - else - return QLCChannel::NoGroup; + case AvolitesD4Parser::PANTILT: + if (ID.contains(KD4TagPan, Qt::CaseInsensitive) || name.contains(KD4TagPan, Qt::CaseInsensitive)) + return QLCChannel::Pan; + else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) || name.contains(KD4TagTilt, Qt::CaseInsensitive)) + return QLCChannel::Tilt; + else + return QLCChannel::NoGroup; break; - case AvolitesD4Parser::COLOUR: - if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || - name.contains(KD4TagCyan, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || - name.contains(KD4TagMagenta, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || - name.contains(KD4TagYellow, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || - name.contains(KD4TagRed, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || - name.contains(KD4TagGreen, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || - name.contains(KD4TagBlue, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else - return QLCChannel::Colour; + case AvolitesD4Parser::COLOUR: + if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else + return QLCChannel::Colour; break; - case AvolitesD4Parser::GOBO: - return QLCChannel::Gobo; + case AvolitesD4Parser::GOBO: + return QLCChannel::Gobo; break; - case AvolitesD4Parser::BEAM: - return QLCChannel::Beam; + case AvolitesD4Parser::BEAM: + return QLCChannel::Beam; break; - case AvolitesD4Parser::EFFECT: - if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) || - name.contains(KD4TagPrism, Qt::CaseInsensitive)) - return QLCChannel::Prism; - else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) || - name.contains(KD4TagEffect, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || - name.contains(KD4TagMacro, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else - return QLCChannel::NoGroup; + case AvolitesD4Parser::EFFECT: + if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) || name.contains(KD4TagPrism, Qt::CaseInsensitive)) + return QLCChannel::Prism; + else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) || name.contains(KD4TagEffect, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else + return QLCChannel::NoGroup; break; } @@ -300,24 +283,18 @@ QLCChannel::PrimaryColour AvolitesD4Parser::getColour(QString ID, QString name, if (group.compare(KD4GroupColour, Qt::CaseInsensitive) != 0) return QLCChannel::NoColour; - if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || - name.contains(KD4TagCyan, Qt::CaseInsensitive)) - return QLCChannel::Cyan; - else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || - name.contains(KD4TagMagenta, Qt::CaseInsensitive)) - return QLCChannel::Magenta; - else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || - name.contains(KD4TagYellow, Qt::CaseInsensitive)) - return QLCChannel::Yellow; - else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || - name.contains(KD4TagRed, Qt::CaseInsensitive)) - return QLCChannel::Red; - else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || - name.contains(KD4TagGreen, Qt::CaseInsensitive)) - return QLCChannel::Green; - else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || - name.contains(KD4TagBlue, Qt::CaseInsensitive)) - return QLCChannel::Blue; + if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) + return QLCChannel::Cyan; + else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) + return QLCChannel::Magenta; + else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) + return QLCChannel::Yellow; + else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) + return QLCChannel::Red; + else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) + return QLCChannel::Green; + else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) + return QLCChannel::Blue; else return QLCChannel::NoColour; } @@ -360,7 +337,7 @@ bool AvolitesD4Parser::is16Bit(QString dmx) const return false; } -QLCCapability *AvolitesD4Parser::getCapability(QString dmx, QString name, bool isFine) +QLCCapability* AvolitesD4Parser::getCapability(QString dmx, QString name, bool isFine) { if (dmx.isEmpty()) return NULL; @@ -399,12 +376,12 @@ QLCCapability *AvolitesD4Parser::getCapability(QString dmx, QString name, bool i if (isFine) name += " Fine"; - QLCCapability *cap = new QLCCapability(minValue, maxValue, name); + QLCCapability* cap = new QLCCapability(minValue, maxValue, name); return cap; } -bool AvolitesD4Parser::parseChannel(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef) +bool AvolitesD4Parser::parseChannel(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef) { if (doc->name() != KD4TagControl) return false; @@ -432,8 +409,8 @@ bool AvolitesD4Parser::parseChannel(QXmlStreamReader *doc, QLCFixtureDef *fixtur return true; } -bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, - QLCChannel *channel, QString ID, QString group) +bool AvolitesD4Parser::parseFunction(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef, QLCChannel* channel, QString ID, + QString group) { QXmlStreamAttributes attrs = doc->attributes(); QString name = attrs.value(KD4TagFunctionName).toString(); @@ -444,7 +421,7 @@ bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtu } QString dmx = attrs.value(KD4TagFunctionDmx).toString(); - QLCCapability *cap = getCapability(dmx, name); + QLCCapability* cap = getCapability(dmx, name); if (cap != NULL) { @@ -456,24 +433,24 @@ bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtu if (is16Bit(dmx)) { - QLCChannel *fineChan = new QLCChannel(); + QLCChannel* fineChan = new QLCChannel(); fineChan->setName(name + " Fine"); fineChan->setGroup(getGroup(ID, name, group)); fineChan->setColour(getColour(ID, name, group)); fineChan->setControlByte(QLCChannel::LSB); - QLCCapability *fineCap = getCapability(dmx, name, true); + QLCCapability* fineCap = getCapability(dmx, name, true); if (fineCap != NULL) fineChan->addCapability(fineCap); fixtureDef->addChannel(fineChan); m_channels.insert(ID + " Fine", fineChan); } - //qDebug() << "Capability found" << cap->name() << cap->min() << cap->max(); + // qDebug() << "Capability found" << cap->name() << cap->min() << cap->max(); doc->skipCurrentElement(); return true; } -bool AvolitesD4Parser::parseAttribute(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef) +bool AvolitesD4Parser::parseAttribute(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef) { if (doc->name() != KD4TagAttribute) return false; @@ -483,7 +460,7 @@ bool AvolitesD4Parser::parseAttribute(QXmlStreamReader *doc, QLCFixtureDef *fixt QString name = attrs.value(KD4TagName).toString(); QString group = attrs.value(KD4TagGroup).toString(); - QLCChannel *chan = new QLCChannel(); + QLCChannel* chan = new QLCChannel(); chan->setName(name); chan->setGroup(getGroup(ID, name, group)); chan->setColour(getColour(ID, name, group)); @@ -518,7 +495,7 @@ bool AvolitesD4Parser::parseAttribute(QXmlStreamReader *doc, QLCFixtureDef *fixt return true; } -bool AvolitesD4Parser::parseMode(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef) +bool AvolitesD4Parser::parseMode(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef) { if (doc->name() != KD4TagMode) return false; @@ -528,7 +505,7 @@ bool AvolitesD4Parser::parseMode(QXmlStreamReader *doc, QLCFixtureDef *fixtureDe if (name.isEmpty()) return false; - QLCFixtureMode *mode = new QLCFixtureMode(fixtureDef); + QLCFixtureMode* mode = new QLCFixtureMode(fixtureDef); mode->setName(name); while (doc->readNextStartElement()) @@ -555,28 +532,25 @@ bool AvolitesD4Parser::parseMode(QXmlStreamReader *doc, QLCFixtureDef *fixtureDe return true; } -bool AvolitesD4Parser::comparePhysical(const QLCPhysical &globalPhy, const QLCPhysical &modePhy) const +bool AvolitesD4Parser::comparePhysical(const QLCPhysical& globalPhy, const QLCPhysical& modePhy) const { if (globalPhy.isEmpty()) return true; if (globalPhy.bulbLumens() != modePhy.bulbLumens() || globalPhy.bulbColourTemperature() != modePhy.bulbColourTemperature() || - globalPhy.weight() != modePhy.weight() || - globalPhy.width() != modePhy.width() || - globalPhy.height() != modePhy.height() || - globalPhy.depth() != modePhy.depth() || + globalPhy.weight() != modePhy.weight() || globalPhy.width() != modePhy.width() || + globalPhy.height() != modePhy.height() || globalPhy.depth() != modePhy.depth() || globalPhy.lensDegreesMin() != modePhy.lensDegreesMin() || - globalPhy.lensDegreesMax() != modePhy.lensDegreesMax() || - globalPhy.focusPanMax() != modePhy.focusPanMax() || + globalPhy.lensDegreesMax() != modePhy.lensDegreesMax() || globalPhy.focusPanMax() != modePhy.focusPanMax() || globalPhy.focusTiltMax() != modePhy.focusTiltMax() || globalPhy.powerConsumption() != modePhy.powerConsumption()) - return false; + return false; return true; } -void AvolitesD4Parser::parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCFixtureMode *mode) +void AvolitesD4Parser::parsePhysical(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef, QLCFixtureMode* mode) { if (doc->name() != KD4TagPhysical) return; @@ -614,7 +588,8 @@ void AvolitesD4Parser::parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtu phys.setLensDegreesMin(deg.value(0).toInt()); phys.setLensDegreesMax(deg.value(1).toInt()); } - } else if (deg.size() == 1) + } + else if (deg.size() == 1) { phys.setLensDegreesMax(deg.value(0).toInt()); phys.setLensDegreesMin(deg.value(0).toInt()); @@ -655,12 +630,12 @@ void AvolitesD4Parser::parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtu mode->setPhysical(phys); } -void AvolitesD4Parser::parseInclude(QXmlStreamReader *doc, QLCFixtureMode *mode) +void AvolitesD4Parser::parseInclude(QXmlStreamReader* doc, QLCFixtureMode* mode) { if (doc->name() != KD4TagModeInclude) return; - QMap channelList; + QMap channelList; // loop through Attribute tags while (doc->readNextStartElement()) @@ -684,7 +659,8 @@ void AvolitesD4Parser::parseInclude(QXmlStreamReader *doc, QLCFixtureMode *mode) { // 16 bit address, we need to add 2 channels, this one, and we need the fine one QStringList offsetValues = offset.split(KD4TagModeChannelSeparator); - // if there's more than 2 addresses, or less than 2, bail out, don't know how to handle this, shouldn't happen ever. + // if there's more than 2 addresses, or less than 2, bail out, don't know how to handle this, + // shouldn't happen ever. if (offsetValues.size() > 2 || offsetValues.size() < 2) continue; @@ -693,11 +669,11 @@ void AvolitesD4Parser::parseInclude(QXmlStreamReader *doc, QLCFixtureMode *mode) QString name = m_channels.value(modeID)->name(); // Search for the fine one - QMapIterator it(m_channels); + QMapIterator it(m_channels); while (it.hasNext() == true) { it.next(); - QLCChannel *ch(it.value()); + QLCChannel* ch(it.value()); Q_ASSERT(ch != NULL); if (ch->name() == QString(name + " Fine")) @@ -717,7 +693,7 @@ void AvolitesD4Parser::parseInclude(QXmlStreamReader *doc, QLCFixtureMode *mode) doc->skipCurrentElement(); } - QMapIterator it(channelList); + QMapIterator it(channelList); while (it.hasNext() == true) { it.next(); @@ -738,7 +714,7 @@ AvolitesD4Parser::Attributes AvolitesD4Parser::stringToAttributeEnum(const QStri return AvolitesD4Parser::SPECIAL; } -QLCFixtureDef::FixtureType AvolitesD4Parser::guessType(QLCFixtureDef *def) const +QLCFixtureDef::FixtureType AvolitesD4Parser::guessType(QLCFixtureDef* def) const { Q_ASSERT(def != NULL); @@ -748,10 +724,10 @@ QLCFixtureDef::FixtureType AvolitesD4Parser::guessType(QLCFixtureDef *def) const int haze = 0, smoke = 0; int strobe = 0; - QListIterator it(def->channels()); + QListIterator it(def->channels()); while (it.hasNext() == true) { - const QLCChannel *ch(it.next()); + const QLCChannel* ch(it.next()); if (ch->group() == QLCChannel::Pan) { pan++; @@ -779,7 +755,7 @@ QLCFixtureDef::FixtureType AvolitesD4Parser::guessType(QLCFixtureDef *def) const } else if (ch->group() == QLCChannel::Shutter) { - if (ch->searchCapability(/*S/s*/"trobe", false) != NULL) + if (ch->searchCapability(/*S/s*/ "trobe", false) != NULL) strobe++; } else if (ch->group() == QLCChannel::Gobo) diff --git a/engine/src/avolitesd4parser.h b/engine/src/avolitesd4parser.h index e32b6744e3..5d62d58d62 100644 --- a/engine/src/avolitesd4parser.h +++ b/engine/src/avolitesd4parser.h @@ -54,7 +54,7 @@ class AvolitesD4Parser * * @return true if successful, otherwise false (see lastError() for a possible cause) */ - bool loadXML(const QString& path, QLCFixtureDef *fixtureDef); + bool loadXML(const QString& path, QLCFixtureDef* fixtureDef); /** * Get the last error encountered while loading/parsing a file. @@ -79,45 +79,45 @@ class AvolitesD4Parser EFFECT }; - typedef QMap StringToEnumMap; - typedef QMap ChannelsMap; + typedef QMap StringToEnumMap; + typedef QMap ChannelsMap; private: /** Check if the given XML element contains an avolites function */ - //bool isFunction(const QDomElement& elem) const; + // bool isFunction(const QDomElement& elem) const; /** Check if the given XML element contains a 16bit function */ bool is16Bit(QString dmx) const; - QLCCapability *getCapability(QString dmx, QString name, bool isFine = false); + QLCCapability* getCapability(QString dmx, QString name, bool isFine = false); /** Parse all channels from $elem into $fixtureDef */ - bool parseChannel(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef); + bool parseChannel(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef); /** Parse a Function tag defining a channel capability */ - bool parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, - QLCChannel *channel, QString ID, QString group); + bool parseFunction(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef, QLCChannel* channel, QString ID, + QString group); /** Parse the capabilities from one channel contained in $elem into $chan (must exist) */ - bool parseAttribute(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef); + bool parseAttribute(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef); /** Parse a mode contained under $elem into $fixtureDef */ - bool parseMode(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef); + bool parseMode(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef); /** Compare global vs. mode physical to detect override */ - bool comparePhysical(const QLCPhysical &globalPhy, const QLCPhysical &modePhy) const; + bool comparePhysical(const QLCPhysical& globalPhy, const QLCPhysical& modePhy) const; /** Parse the fixture's/mode's physical properties from $elem into $mode */ - void parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCFixtureMode *mode); + void parsePhysical(QXmlStreamReader* doc, QLCFixtureDef* fixtureDef, QLCFixtureMode* mode); /** Parse a mode Include tag */ - void parseInclude(QXmlStreamReader *doc, QLCFixtureMode *mode); + void parseInclude(QXmlStreamReader* doc, QLCFixtureMode* mode); /** Convert string $attr into an Attributes enum */ Attributes stringToAttributeEnum(const QString& attr); /** Attempt to guess the fixture type from the channels/capabilities in $def */ - QLCFixtureDef::FixtureType guessType(QLCFixtureDef *def) const; + QLCFixtureDef::FixtureType guessType(QLCFixtureDef* def) const; private: QString m_lastError; diff --git a/engine/src/bus.cpp b/engine/src/bus.cpp index 16b2e1f7c8..e7d1040ca0 100644 --- a/engine/src/bus.cpp +++ b/engine/src/bus.cpp @@ -52,9 +52,7 @@ class BusEntry value = 0; } - ~BusEntry() - { - } + ~BusEntry() {} BusEntry(const BusEntry& entry) { @@ -86,7 +84,8 @@ Bus* Bus::instance() return s_instance; } -Bus::Bus(QObject* parent) : QObject(parent) +Bus::Bus(QObject* parent) + : QObject(parent) { for (quint32 i = 0; i < Bus::count(); i++) m_buses.append(new BusEntry); @@ -209,7 +208,7 @@ void Bus::tap(quint32 bus) * Load & Save ****************************************************************************/ -bool Bus::loadXML(QXmlStreamReader &doc) +bool Bus::loadXML(QXmlStreamReader& doc) { if (doc.name() != KXMLQLCBus) { diff --git a/engine/src/bus.h b/engine/src/bus.h index 022de0dbe5..7a7296b0c2 100644 --- a/engine/src/bus.h +++ b/engine/src/bus.h @@ -32,11 +32,11 @@ class BusEntry; * @{ */ -#define KXMLQLCBus QString("Bus") -#define KXMLQLCBusID QString("ID") -#define KXMLQLCBusName QString("Name") -#define KXMLQLCBusValue QString("Value") -#define KXMLQLCBusLowLimit QString("LowLimit") +#define KXMLQLCBus QString("Bus") +#define KXMLQLCBusID QString("ID") +#define KXMLQLCBusName QString("Name") +#define KXMLQLCBusValue QString("Value") +#define KXMLQLCBusLowLimit QString("LowLimit") #define KXMLQLCBusHighLimit QString("HighLimit") #define KXMLQLCBusRole QString("Role") @@ -128,7 +128,7 @@ class Bus : public QObject Bus(QObject* parent); protected: - QList m_buses; + QList m_buses; static Bus* s_instance; /******************************************************************** @@ -217,7 +217,7 @@ class Bus : public QObject ********************************************************************/ public: /** Load all buses from an XML document */ - bool loadXML(QXmlStreamReader &doc); + bool loadXML(QXmlStreamReader& doc); }; /** @} */ diff --git a/engine/src/channelmodifier.cpp b/engine/src/channelmodifier.cpp index 2524a8f156..2390cbc9bc 100644 --- a/engine/src/channelmodifier.cpp +++ b/engine/src/channelmodifier.cpp @@ -51,7 +51,7 @@ ChannelModifier::Type ChannelModifier::type() const return m_type; } -void ChannelModifier::setModifierMap(QList > map) +void ChannelModifier::setModifierMap(QList> map) { m_map = map; m_values.fill(0, 256); @@ -80,15 +80,15 @@ void ChannelModifier::setModifierMap(QList > map) } lastDMXPair = dmxPair; } -// Enable the following to display the template full range of value -/* - qDebug() << "Template:" << m_name; - for (int d = 0; d < m_values.count(); d++) - qDebug() << "Pos:" << d << "val:" << QString::number((uchar)m_values.at(d)); -*/ + // Enable the following to display the template full range of value + /* + qDebug() << "Template:" << m_name; + for (int d = 0; d < m_values.count(); d++) + qDebug() << "Pos:" << d << "val:" << QString::number((uchar)m_values.at(d)); + */ } -QList< QPair > ChannelModifier::modifierMap() const +QList> ChannelModifier::modifierMap() const { return m_map; } @@ -98,7 +98,7 @@ uchar ChannelModifier::getValue(uchar dmxValue) return m_values.at(dmxValue); } -QFile::FileError ChannelModifier::saveXML(const QString &fileName) +QFile::FileError ChannelModifier::saveXML(const QString& fileName) { QFile::FileError error; @@ -120,7 +120,7 @@ QFile::FileError ChannelModifier::saveXML(const QString &fileName) doc.writeTextElement(KXMLQLCChannelModName, m_name); qDebug() << "Got map with" << m_map.count() << "handlers"; - for(int i = 0; i < m_map.count(); i++) + for (int i = 0; i < m_map.count(); i++) { QPair mapElement = m_map.at(i); doc.writeStartElement(KXMLQLCChannelModHandler); @@ -137,14 +137,14 @@ QFile::FileError ChannelModifier::saveXML(const QString &fileName) return error; } -QFile::FileError ChannelModifier::loadXML(const QString &fileName, Type type) +QFile::FileError ChannelModifier::loadXML(const QString& fileName, Type type) { QFile::FileError error = QFile::NoError; if (fileName.isEmpty() == true) return QFile::OpenError; - QXmlStreamReader *doc = QLCFile::getXMLReader(fileName); + QXmlStreamReader* doc = QLCFile::getXMLReader(fileName); if (doc == NULL || doc->device() == NULL || doc->hasError()) { qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName; @@ -162,7 +162,7 @@ QFile::FileError ChannelModifier::loadXML(const QString &fileName, Type type) return QFile::ResourceError; } - QList< QPair > modMap; + QList> modMap; if (doc->dtdName() == KXMLQLCChannelModifierDocument) { @@ -177,9 +177,9 @@ QFile::FileError ChannelModifier::loadXML(const QString &fileName, Type type) { setName(doc->readElementText()); } - else if(doc->name() == KXMLQLCChannelModHandler) + else if (doc->name() == KXMLQLCChannelModHandler) { - QPair dmxPair(0, 0); + QPair dmxPair(0, 0); QXmlStreamAttributes attrs = doc->attributes(); if (attrs.hasAttribute(KXMLQLCChannelModOriginalDMX)) dmxPair.first = attrs.value(KXMLQLCChannelModOriginalDMX).toString().toUInt(); diff --git a/engine/src/channelmodifier.h b/engine/src/channelmodifier.h index 60eaaf5b34..6121c2fd80 100644 --- a/engine/src/channelmodifier.h +++ b/engine/src/channelmodifier.h @@ -32,17 +32,18 @@ #define KXMLQLCChannelModifierDocument QString("ChannelModifier") // Channel modifier tags and attributes -#define KXMLQLCChannelModName QString("Name") -#define KXMLQLCChannelModHandler QString("Handler") -#define KXMLQLCChannelModOriginalDMX QString("Original") -#define KXMLQLCChannelModModifiedDMX QString("Modified") +#define KXMLQLCChannelModName QString("Name") +#define KXMLQLCChannelModHandler QString("Handler") +#define KXMLQLCChannelModOriginalDMX QString("Original") +#define KXMLQLCChannelModModifiedDMX QString("Modified") class ChannelModifier { public: ChannelModifier(); - enum Type { + enum Type + { SystemTemplate = 0, UserTemplate = 1 }; @@ -55,9 +56,9 @@ class ChannelModifier Type type() const; - void setModifierMap(QList< QPair > map); + void setModifierMap(QList> map); - QList< QPair > modifierMap() const; + QList> modifierMap() const; uchar getValue(uchar dmxValue); @@ -74,7 +75,7 @@ class ChannelModifier private: QString m_name; Type m_type; - QList< QPair > m_map; + QList> m_map; QByteArray m_values; }; diff --git a/engine/src/channelsgroup.cpp b/engine/src/channelsgroup.cpp index 7b165e25e7..ca4178f296 100644 --- a/engine/src/channelsgroup.cpp +++ b/engine/src/channelsgroup.cpp @@ -27,12 +27,12 @@ #include "fixture.h" #include "doc.h" -#define KXMLQLCChannelsGroupID "ID" -#define KXMLQLCChannelsGroupName "Name" +#define KXMLQLCChannelsGroupID "ID" +#define KXMLQLCChannelsGroupName "Name" #define KXMLQLCChannelsGroupValue "Value" #define KXMLQLCChannelsGroupInputUniverse "InputUniverse" -#define KXMLQLCChannelsGroupInputChannel "InputChannel" +#define KXMLQLCChannelsGroupInputChannel "InputChannel" ChannelsGroup::ChannelsGroup(Doc* doc) @@ -58,14 +58,11 @@ ChannelsGroup::ChannelsGroup(Doc* doc, const ChannelsGroup* chg) init(); } -ChannelsGroup::~ChannelsGroup() -{ -} +ChannelsGroup::~ChannelsGroup() {} void ChannelsGroup::init() { - connect(m_doc, SIGNAL(fixtureRemoved(quint32)), - this, SLOT(slotFixtureRemoved(quint32))); + connect(m_doc, SIGNAL(fixtureRemoved(quint32)), this, SLOT(slotFixtureRemoved(quint32))); } void ChannelsGroup::slotFixtureRemoved(quint32 fixtureId) @@ -141,7 +138,7 @@ bool ChannelsGroup::addChannel(quint32 fxid, quint32 channel) } -QList ChannelsGroup::getChannels() const +QList ChannelsGroup::getChannels() const { return m_channels; } @@ -149,7 +146,7 @@ QList ChannelsGroup::getChannels() const /********************************************************************* * Status *********************************************************************/ -QString ChannelsGroup::status(Doc *doc) const +QString ChannelsGroup::status(Doc* doc) const { QString info; @@ -170,20 +167,19 @@ QString ChannelsGroup::status(Doc *doc) const foreach (SceneValue value, m_channels) { - Fixture *fixture = doc->fixture(value.fxi); + Fixture* fixture = doc->fixture(value.fxi); if (fixture == NULL) return QString(); - const QLCFixtureMode *mode = fixture->fixtureMode(); + const QLCFixtureMode* mode = fixture->fixtureMode(); QString chInfo("%1%2%3"); if (mode != NULL) { - info += chInfo.arg(fixture->name()).arg(value.channel + 1) - .arg(mode->channels().at(value.channel)->name()); + info += chInfo.arg(fixture->name()).arg(value.channel + 1).arg(mode->channels().at(value.channel)->name()); } else { - info += chInfo.arg(fixture->name()).arg(value.channel + 1) - .arg(QString(tr("Channel %1")).arg(value.channel)); + info += + chInfo.arg(fixture->name()).arg(value.channel + 1).arg(QString(tr("Channel %1")).arg(value.channel)); } } @@ -199,15 +195,15 @@ QString ChannelsGroup::status(Doc *doc) const void ChannelsGroup::setInputSource(QSharedPointer const& source) { if (!m_input.isNull() && m_input->isValid()) - disconnect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32,quint32,uchar)), - this, SLOT(slotInputValueChanged(quint32,quint32,uchar))); + disconnect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32, quint32, uchar)), this, + SLOT(slotInputValueChanged(quint32, quint32, uchar))); m_input = source; // Connect when the first valid input source is set if (!source.isNull() && source->isValid()) - connect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32,quint32,uchar)), - this, SLOT(slotInputValueChanged(quint32,quint32,uchar))); + connect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32, quint32, uchar)), this, + SLOT(slotInputValueChanged(quint32, quint32, uchar))); } QSharedPointer const& ChannelsGroup::inputSource() const @@ -223,11 +219,9 @@ void ChannelsGroup::slotInputValueChanged(quint32 universe, quint32 channel, uch if (m_doc->mode() == Doc::Operate) return; - //qDebug() << Q_FUNC_INFO << "universe: " << universe << ", channel: " << channel << ", value: " << value; + // qDebug() << Q_FUNC_INFO << "universe: " << universe << ", channel: " << channel << ", value: " << value; - if (inputSource() != NULL && - inputSource()->universe() == universe && - inputSource()->channel() == channel) + if (inputSource() != NULL && inputSource()->universe() == universe && inputSource()->channel() == channel) { emit valueChanged(channel, value); } @@ -236,7 +230,7 @@ void ChannelsGroup::slotInputValueChanged(quint32 universe, quint32 channel, uch /***************************************************************************** * Load & Save *****************************************************************************/ -bool ChannelsGroup::loader(QXmlStreamReader &xmlDoc, Doc* doc) +bool ChannelsGroup::loader(QXmlStreamReader& xmlDoc, Doc* doc) { bool result = false; @@ -258,12 +252,12 @@ bool ChannelsGroup::loader(QXmlStreamReader &xmlDoc, Doc* doc) return result; } -bool ChannelsGroup::saveXML(QXmlStreamWriter *doc) +bool ChannelsGroup::saveXML(QXmlStreamWriter* doc) { Q_ASSERT(doc != NULL); QString str; - foreach(SceneValue value, this->getChannels()) + foreach (SceneValue value, this->getChannels()) { if (str.isEmpty() == false) str.append(","); @@ -278,7 +272,7 @@ bool ChannelsGroup::saveXML(QXmlStreamWriter *doc) if (!m_input.isNull() && m_input->isValid()) { - doc->writeAttribute(KXMLQLCChannelsGroupInputUniverse,QString("%1").arg(m_input->universe())); + doc->writeAttribute(KXMLQLCChannelsGroupInputUniverse, QString("%1").arg(m_input->universe())); doc->writeAttribute(KXMLQLCChannelsGroupInputChannel, QString("%1").arg(m_input->channel())); } if (str.isEmpty() == false) @@ -289,7 +283,7 @@ bool ChannelsGroup::saveXML(QXmlStreamWriter *doc) return true; } -bool ChannelsGroup::loadXML(QXmlStreamReader &xmlDoc) +bool ChannelsGroup::loadXML(QXmlStreamReader& xmlDoc) { if (xmlDoc.name() != KXMLQLCChannelsGroup) { @@ -319,10 +313,9 @@ bool ChannelsGroup::loadXML(QXmlStreamReader &xmlDoc) if (chansValues.isEmpty() == false) { QStringList varray = chansValues.split(","); - for (int i = 0; i < varray.count(); i+=2) + for (int i = 0; i < varray.count(); i += 2) { - SceneValue scv(QString(varray.at(i)).toUInt(), - QString(varray.at(i + 1)).toUInt(), 0); + SceneValue scv(QString(varray.at(i)).toUInt(), QString(varray.at(i + 1)).toUInt(), 0); Fixture* fxi = m_doc->fixture(scv.fxi); if (fxi == NULL) { diff --git a/engine/src/channelsgroup.h b/engine/src/channelsgroup.h index e1c0d30209..091c6c28aa 100644 --- a/engine/src/channelsgroup.h +++ b/engine/src/channelsgroup.h @@ -43,7 +43,7 @@ class ChannelsGroup : public QObject ************************************************************************/ public: /** Create a new ChannelsGroup with empty/invalid values */ - ChannelsGroup(Doc *doc); + ChannelsGroup(Doc* doc); /** Copy constructor */ ChannelsGroup(Doc* doc, const ChannelsGroup* chg); @@ -52,7 +52,7 @@ class ChannelsGroup : public QObject ~ChannelsGroup(); protected: - Doc * m_doc; + Doc* m_doc; void init(); @@ -67,11 +67,11 @@ public slots: * Load & Save *********************************************************************/ public: - static bool loader(QXmlStreamReader &xmlDoc, Doc* doc); + static bool loader(QXmlStreamReader& xmlDoc, Doc* doc); - bool saveXML(QXmlStreamWriter *doc); + bool saveXML(QXmlStreamWriter* doc); - bool loadXML(QXmlStreamReader &xmlDoc); + bool loadXML(QXmlStreamReader& xmlDoc); /************************************************************************ * ID @@ -109,7 +109,7 @@ public slots: bool addChannel(quint32 fxid, quint32 channel); /** Returns the current list of channels of this group */ - QList getChannels() const; + QList getChannels() const; /********************************************************************* * Status @@ -120,7 +120,7 @@ public slots: * * @return A sort-of HTML-RTF-gibberish for Fixture Manager */ - QString status(Doc *doc) const; + QString status(Doc* doc) const; /********************************************************************* * External input @@ -157,7 +157,7 @@ protected slots: QString m_name; uchar m_masterValue; - QList m_channels; + QList m_channels; QSharedPointer m_input; }; diff --git a/engine/src/chaser.cpp b/engine/src/chaser.cpp index 2952ffd3c0..13dad79493 100644 --- a/engine/src/chaser.cpp +++ b/engine/src/chaser.cpp @@ -48,7 +48,7 @@ * Initialization *****************************************************************************/ -Chaser::Chaser(Doc *doc) +Chaser::Chaser(Doc* doc) : Function(doc, Function::ChaserType) , m_legacyHoldBus(Bus::invalid()) , m_fadeInMode(Default) @@ -62,8 +62,7 @@ Chaser::Chaser(Doc *doc) setName(tr("New Chaser")); // Listen to member Function removals - connect(doc, SIGNAL(functionRemoved(quint32)), - this, SLOT(slotFunctionRemoved(quint32))); + connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); m_startupAction.m_action = ChaserNoAction; m_startupAction.m_masterIntensity = 1.0; @@ -72,9 +71,7 @@ Chaser::Chaser(Doc *doc) m_startupAction.m_stepIndex = -1; } -Chaser::~Chaser() -{ -} +Chaser::~Chaser() {} QIcon Chaser::getIcon() const { @@ -106,7 +103,7 @@ Function* Chaser::createCopy(Doc* doc, bool addToDoc) bool Chaser::copyFrom(const Function* function) { - const Chaser *chaser = qobject_cast (function); + const Chaser* chaser = qobject_cast(function); if (chaser == NULL) return false; @@ -206,7 +203,7 @@ int Chaser::stepsCount() const return m_steps.count(); } -ChaserStep *Chaser::stepAt(int idx) +ChaserStep* Chaser::stepAt(int idx) { if (idx >= 0 && idx < m_steps.count()) return &(m_steps[idx]); @@ -214,7 +211,7 @@ ChaserStep *Chaser::stepAt(int idx) return NULL; } -QList Chaser::steps() const +QList Chaser::steps() const { return m_steps; } @@ -237,7 +234,7 @@ void Chaser::setTotalDuration(quint32 msec) { uint origDuration = m_steps[i].duration; m_steps[i].duration = ((double)m_steps[i].duration * msec) / dtDuration; - if(m_steps[i].hold) + if (m_steps[i].hold) m_steps[i].hold = ((double)m_steps[i].hold * (double)m_steps[i].duration) / (double)origDuration; m_steps[i].fadeIn = m_steps[i].duration - m_steps[i].hold; if (m_steps[i].fadeOut) @@ -335,7 +332,7 @@ Chaser::SpeedMode Chaser::stringToSpeedMode(const QString& str) * Save & Load *****************************************************************************/ -bool Chaser::saveXML(QXmlStreamWriter *doc) +bool Chaser::saveXML(QXmlStreamWriter* doc) { Q_ASSERT(doc != NULL); @@ -371,7 +368,7 @@ bool Chaser::saveXML(QXmlStreamWriter *doc) return true; } -bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root) +bool Chaser::loadXMLSpeedModes(QXmlStreamReader& root) { QXmlStreamAttributes attrs = root.attributes(); QString str; @@ -389,7 +386,7 @@ bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root) return true; } -bool Chaser::loadXML(QXmlStreamReader &root) +bool Chaser::loadXML(QXmlStreamReader& root) { if (root.name() != KXMLQLCFunction) { @@ -399,8 +396,7 @@ bool Chaser::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ChaserType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() - << "is not a Chaser"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a Chaser"; return false; } @@ -444,7 +440,9 @@ bool Chaser::loadXML(QXmlStreamReader &root) else if (root.name() == KXMLQLCChaserLegacySequence) { doc()->appendToErrorLog(QString("Unsupported sequences found. Please convert your project " - "at http://www.qlcplus.org/sequence_migration.php")); + "at http://www.qlcplus.org/" + "sequence_migration.php")); root.skipCurrentElement(); } else @@ -465,14 +463,14 @@ void Chaser::postLoad() setDuration((value / MasterTimer::frequency()) * 1000); } - Doc *doc = this->doc(); + Doc* doc = this->doc(); Q_ASSERT(doc != NULL); - QMutableListIterator it(m_steps); + QMutableListIterator it(m_steps); while (it.hasNext() == true) { ChaserStep step(it.next()); - Function *function = doc->function(step.fid); + Function* function = doc->function(step.fid); if (function == NULL) it.remove(); @@ -493,7 +491,7 @@ void Chaser::tap() m_runner->tap(); } -void Chaser::setAction(ChaserAction &action) +void Chaser::setAction(ChaserAction& action) { QMutexLocker runnerLocker(&m_runnerMutex); if (m_runner != NULL) @@ -568,7 +566,7 @@ ChaserRunnerStep Chaser::currentRunningStep() const #endif if (m_runner != NULL) { - ChaserRunnerStep *step = m_runner->currentRunningStep(); + ChaserRunnerStep* step = m_runner->currentRunningStep(); if (step != NULL) ret = *step; } @@ -578,12 +576,12 @@ ChaserRunnerStep Chaser::currentRunningStep() const bool Chaser::contains(quint32 functionId) { - Doc *doc = this->doc(); + Doc* doc = this->doc(); Q_ASSERT(doc != NULL); - foreach(ChaserStep step, m_steps) + foreach (ChaserStep step, m_steps) { - Function *function = doc->function(step.fid); + Function* function = doc->function(step.fid); // contains() can be called during init, function may be NULL if (function == NULL) continue; @@ -601,7 +599,7 @@ QList Chaser::components() { QList ids; - foreach(ChaserStep step, m_steps) + foreach (ChaserStep step, m_steps) ids.append(step.fid); return ids; @@ -649,7 +647,7 @@ void Chaser::setPause(bool enable) Function::setPause(enable); } -void Chaser::write(MasterTimer* timer, QList universes) +void Chaser::write(MasterTimer* timer, QList universes) { if (isPaused() && m_startupAction.m_action != ChaserPauseRequest) return; @@ -673,7 +671,7 @@ void Chaser::write(MasterTimer* timer, QList universes) incrementElapsed(); } -void Chaser::postRun(MasterTimer* timer, QList universes) +void Chaser::postRun(MasterTimer* timer, QList universes) { { QMutexLocker runnerLocker(&m_runnerMutex); diff --git a/engine/src/chaser.h b/engine/src/chaser.h index e7d0ebc511..2c688fca3c 100644 --- a/engine/src/chaser.h +++ b/engine/src/chaser.h @@ -129,14 +129,14 @@ class Chaser : public Function * * @return The requested Chaser Step */ - ChaserStep *stepAt(int idx); + ChaserStep* stepAt(int idx); /** * Get the chaser's list of steps * * @return List of function Chaser Steps */ - QList steps() const; + QList steps() const; /** @reimpl */ void setTotalDuration(quint32 msec); @@ -159,17 +159,18 @@ public slots: void stepChanged(int index); protected: - QList m_steps; + QList m_steps; QMutex m_stepListMutex; /********************************************************************* * Speed modes *********************************************************************/ public: - enum SpeedMode { + enum SpeedMode + { Default = 0, //! Use step function's own speed setting - Common, //! Impose a common chaser-specific speed to all steps - PerStep //! Impose a step-specific speed to each step + Common, //! Impose a common chaser-specific speed to all steps + PerStep //! Impose a step-specific speed to each step }; #if QT_VERSION >= 0x050500 Q_ENUM(SpeedMode) @@ -196,14 +197,14 @@ public slots: * Save & Load *********************************************************************/ protected: - bool loadXMLSpeedModes(QXmlStreamReader &root); + bool loadXMLSpeedModes(QXmlStreamReader& root); public: /** @reimpl */ - virtual bool saveXML(QXmlStreamWriter *doc); + virtual bool saveXML(QXmlStreamWriter* doc); /** @reimpl */ - virtual bool loadXML(QXmlStreamReader &root); + virtual bool loadXML(QXmlStreamReader& root); /** @reimp */ virtual void postLoad(); @@ -227,7 +228,7 @@ public slots: /** Set an action to be performed on steps. * Depending on the action type, it might be applied immediately * or deferred to the next write() call */ - void setAction(ChaserAction &action); + void setAction(ChaserAction& action); /** Get the current step number */ int currentStepIndex() const; @@ -273,10 +274,10 @@ public slots: void setPause(bool enable); /** @reimp */ - void write(MasterTimer* timer, QList universes); + void write(MasterTimer* timer, QList universes); /** @reimp */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer* timer, QList universes); signals: /** Tells that the current step number has changed. */ @@ -298,8 +299,7 @@ public slots: int adjustAttribute(qreal fraction, int attributeId); /** Adjust the intensities of chaser steps. */ - void adjustStepIntensity(qreal fraction, int stepIndex = -1, - FadeControlMode fadeControl = FromFunction); + void adjustStepIntensity(qreal fraction, int stepIndex = -1, FadeControlMode fadeControl = FromFunction); }; /** @} */ diff --git a/engine/src/chaserrunner.cpp b/engine/src/chaserrunner.cpp index e3b778d03b..f78638d955 100644 --- a/engine/src/chaserrunner.cpp +++ b/engine/src/chaserrunner.cpp @@ -21,7 +21,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) -#include + #include #endif #include @@ -36,7 +36,7 @@ #include "scene.h" #include "doc.h" -ChaserRunner::ChaserRunner(const Doc *doc, const Chaser *chaser, quint32 startTime) +ChaserRunner::ChaserRunner(const Doc* doc, const Chaser* chaser, quint32 startTime) : QObject(NULL) , m_doc(doc) , m_chaser(chaser) @@ -60,7 +60,7 @@ ChaserRunner::ChaserRunner(const Doc *doc, const Chaser *chaser, quint32 startTi qDebug() << "[ChaserRunner] startTime:" << startTime; int idx = 0; quint32 stepsTime = 0; - foreach(ChaserStep step, chaser->steps()) + foreach (ChaserStep step, chaser->steps()) { uint duration = m_chaser->durationMode() == Chaser::Common ? m_chaser->duration() : step.duration; @@ -99,7 +99,7 @@ void ChaserRunner::slotChaserChanged() // Handle (possible) speed change on the next write() pass m_updateOverrideSpeeds = true; QList delList; - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) { if (!m_chaser->steps().contains(ChaserStep(step->m_function->id()))) { @@ -114,7 +114,7 @@ void ChaserRunner::slotChaserChanged() step->m_duration = stepDuration(step->m_index); } } - foreach(ChaserRunnerStep *step, delList) + foreach (ChaserRunnerStep* step, delList) { step->m_function->stop(functionParent()); delete step; @@ -136,22 +136,22 @@ uint ChaserRunner::stepFadeIn(int stepIdx) const { switch (m_chaser->fadeInMode()) { - case Chaser::Common: - // All steps' fade in speed is dictated by the chaser - speed = m_chaser->fadeInSpeed(); + case Chaser::Common: + // All steps' fade in speed is dictated by the chaser + speed = m_chaser->fadeInSpeed(); break; - case Chaser::PerStep: - // Each step specifies its own fade in speed - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).fadeIn; - else - speed = Function::defaultSpeed(); - break; - default: - case Chaser::Default: - // Don't touch members' fade in speed at all + case Chaser::PerStep: + // Each step specifies its own fade in speed + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).fadeIn; + else speed = Function::defaultSpeed(); break; + default: + case Chaser::Default: + // Don't touch members' fade in speed at all + speed = Function::defaultSpeed(); + break; } } @@ -172,22 +172,22 @@ uint ChaserRunner::stepFadeOut(int stepIdx) const { switch (m_chaser->fadeOutMode()) { - case Chaser::Common: - // All steps' fade out speed is dictated by the chaser - speed = m_chaser->fadeOutSpeed(); - break; - case Chaser::PerStep: - // Each step specifies its own fade out speed - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).fadeOut; - else - speed = Function::defaultSpeed(); + case Chaser::Common: + // All steps' fade out speed is dictated by the chaser + speed = m_chaser->fadeOutSpeed(); break; - default: - case Chaser::Default: - // Don't touch members' fade out speed at all + case Chaser::PerStep: + // Each step specifies its own fade out speed + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).fadeOut; + else speed = Function::defaultSpeed(); break; + default: + case Chaser::Default: + // Don't touch members' fade out speed at all + speed = Function::defaultSpeed(); + break; } } @@ -208,18 +208,18 @@ uint ChaserRunner::stepDuration(int stepIdx) const { switch (m_chaser->durationMode()) { - default: - case Chaser::Default: - case Chaser::Common: - // All steps' duration is dictated by the chaser - speed = m_chaser->duration(); + default: + case Chaser::Default: + case Chaser::Common: + // All steps' duration is dictated by the chaser + speed = m_chaser->duration(); break; - case Chaser::PerStep: - // Each step specifies its own duration - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).duration; - else - speed = m_chaser->duration(); + case Chaser::PerStep: + // Each step specifies its own duration + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).duration; + else + speed = m_chaser->duration(); break; } } @@ -231,26 +231,28 @@ uint ChaserRunner::stepDuration(int stepIdx) const * Step control ****************************************************************************/ -void ChaserRunner::setAction(ChaserAction &action) +void ChaserRunner::setAction(ChaserAction& action) { // apply the actions that can be applied immediately switch (action.m_action) { - case ChaserNoAction: - m_pendingAction.m_masterIntensity = action.m_masterIntensity; - m_pendingAction.m_stepIntensity = action.m_stepIntensity; + case ChaserNoAction: + m_pendingAction.m_masterIntensity = action.m_masterIntensity; + m_pendingAction.m_stepIntensity = action.m_stepIntensity; break; - case ChaserStopStep: + case ChaserStopStep: { bool stopped = false; - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) { if (action.m_stepIndex == step->m_index) { - qDebug() << "[ChaserRunner] Stopping step idx:" << action.m_stepIndex << "(running:" << m_runnerSteps.count() << ")"; - m_lastFunctionID = step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); + qDebug() << "[ChaserRunner] Stopping step idx:" << action.m_stepIndex + << "(running:" << m_runnerSteps.count() << ")"; + m_lastFunctionID = step->m_function->type() == Function::SceneType ? step->m_function->id() + : Function::invalidId(); step->m_function->stop(functionParent()); m_runnerSteps.removeOne(step); delete step; @@ -260,20 +262,20 @@ void ChaserRunner::setAction(ChaserAction &action) if (stopped && m_runnerSteps.size() == 1) { - ChaserRunnerStep *lastStep = m_runnerSteps.at(0); + ChaserRunnerStep* lastStep = m_runnerSteps.at(0); m_lastRunStepIdx = lastStep->m_index; emit currentStepChanged(m_lastRunStepIdx); } } break; - // copy to pending action. Will be processed at the next write call - default: - m_pendingAction.m_stepIndex = action.m_stepIndex; - m_pendingAction.m_masterIntensity = action.m_masterIntensity; - m_pendingAction.m_stepIntensity = action.m_stepIntensity; - m_pendingAction.m_fadeMode = action.m_fadeMode; - m_pendingAction.m_action = action.m_action; + // copy to pending action. Will be processed at the next write call + default: + m_pendingAction.m_stepIndex = action.m_stepIndex; + m_pendingAction.m_masterIntensity = action.m_masterIntensity; + m_pendingAction.m_stepIntensity = action.m_stepIntensity; + m_pendingAction.m_fadeMode = action.m_fadeMode; + m_pendingAction.m_action = action.m_action; break; } } @@ -294,7 +296,7 @@ int ChaserRunner::runningStepsNumber() const return m_runnerSteps.count(); } -ChaserRunnerStep *ChaserRunner::currentRunningStep() const +ChaserRunnerStep* ChaserRunner::currentRunningStep() const { if (m_runnerSteps.count() > 0) return m_runnerSteps.at(0); @@ -378,25 +380,25 @@ int ChaserRunner::computeNextStep(int currentStep) const return nextStep; } -void ChaserRunner::shuffle(QVector & data) +void ChaserRunner::shuffle(QVector& data) { - int n = data.size(); - for (int i = n - 1; i > 0; --i) - { + int n = data.size(); + for (int i = n - 1; i > 0; --i) + { #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) - qSwap(data[i], data[qrand() % (i + 1)]); + qSwap(data[i], data[qrand() % (i + 1)]); #else - qSwap(data[i], data[QRandomGenerator::global()->generate() % (i + 1)]); + qSwap(data[i], data[QRandomGenerator::global()->generate() % (i + 1)]); #endif - } + } } int ChaserRunner::randomStepIndex(int step) const { - if (m_chaser->runOrder() == Function::Random && step >= 0 && step < m_order.size()) - return m_order[step]; + if (m_chaser->runOrder() == Function::Random && step >= 0 && step < m_order.size()) + return m_order[step]; - return step; + return step; } void ChaserRunner::fillOrder() @@ -406,11 +408,11 @@ void ChaserRunner::fillOrder() void ChaserRunner::fillOrder(int size) { - m_order.resize(size); - for (int i = 0; i < size; ++i) - m_order[i] = i; + m_order.resize(size); + for (int i = 0; i < size; ++i) + m_order[i] = i; - shuffle(m_order); + shuffle(m_order); } /**************************************************************************** @@ -421,7 +423,7 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i { fraction = CLAMP(fraction, qreal(0.0), qreal(1.0)); - //qDebug() << "Adjust intensity" << fraction << "step:" << requestedStepIndex << "fade:" << fadeControl; + // qDebug() << "Adjust intensity" << fraction << "step:" << requestedStepIndex << "fade:" << fadeControl; int stepIndex = requestedStepIndex; if (stepIndex == -1) @@ -431,13 +433,13 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i m_pendingAction.m_masterIntensity = fraction; } - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) { if (stepIndex == step->m_index && step->m_function != NULL) { if (requestedStepIndex == -1 && step->m_function->type() == Function::SceneType) { - Scene *scene = qobject_cast(step->m_function); + Scene* scene = qobject_cast(step->m_function); scene->adjustAttribute(fraction, step->m_pIntensityOverrideId); } else @@ -467,22 +469,23 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i void ChaserRunner::clearRunningList() { // empty the running queue - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) { if (step->m_function) { // restore the original Function fade out time step->m_function->setOverrideFadeOutSpeed(stepFadeOut(step->m_index)); step->m_function->stop(functionParent(), m_chaser->type() == Function::SequenceType); - m_lastFunctionID = step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); + m_lastFunctionID = + step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); } delete step; } m_runnerSteps.clear(); } -void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, - int fadeControl, quint32 elapsed) +void ChaserRunner::startNewStep(int index, MasterTimer* timer, qreal mIntensity, qreal sIntensity, int fadeControl, + quint32 elapsed) { if (m_chaser == NULL || m_chaser->stepsCount() == 0) return; @@ -491,53 +494,51 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, index = 0; // fallback to the first step ChaserStep step(m_chaser->steps().at(index)); - Function *func = m_doc->function(step.fid); + Function* func = m_doc->function(step.fid); if (func == NULL) return; - ChaserRunnerStep *newStep = new ChaserRunnerStep(); + ChaserRunnerStep* newStep = new ChaserRunnerStep(); newStep->m_index = index; // check if blending between Scenes is needed - if (m_lastFunctionID != Function::invalidId() && - func->type() == Function::SceneType) + if (m_lastFunctionID != Function::invalidId() && func->type() == Function::SceneType) { - Scene *scene = qobject_cast(func); + Scene* scene = qobject_cast(func); scene->setBlendFunctionID(m_lastFunctionID); } // this happens only during crossfades if (m_runnerSteps.count()) { - ChaserRunnerStep *lastStep = m_runnerSteps.last(); - if (lastStep->m_function && - lastStep->m_function->type() == Function::SceneType && + ChaserRunnerStep* lastStep = m_runnerSteps.last(); + if (lastStep->m_function && lastStep->m_function->type() == Function::SceneType && func->type() == Function::SceneType) { - Scene *lastScene = qobject_cast(lastStep->m_function); + Scene* lastScene = qobject_cast(lastStep->m_function); lastScene->setBlendFunctionID(Function::invalidId()); - Scene *scene = qobject_cast(func); + Scene* scene = qobject_cast(func); scene->setBlendFunctionID(lastStep->m_function->id()); } } switch (fadeControl) { - case Chaser::FromFunction: - newStep->m_fadeIn = stepFadeIn(index); - newStep->m_fadeOut = stepFadeOut(index); + case Chaser::FromFunction: + newStep->m_fadeIn = stepFadeIn(index); + newStep->m_fadeOut = stepFadeOut(index); break; - case Chaser::Blended: - newStep->m_fadeIn = stepFadeIn(index); - newStep->m_fadeOut = stepFadeOut(index); + case Chaser::Blended: + newStep->m_fadeIn = stepFadeIn(index); + newStep->m_fadeOut = stepFadeOut(index); break; - case Chaser::Crossfade: - newStep->m_fadeIn = 0; - newStep->m_fadeOut = 0; + case Chaser::Crossfade: + newStep->m_fadeIn = 0; + newStep->m_fadeOut = 0; break; - case Chaser::BlendedCrossfade: - newStep->m_fadeIn = 0; - newStep->m_fadeOut = 0; + case Chaser::BlendedCrossfade: + newStep->m_fadeIn = 0; + newStep->m_fadeOut = 0; break; } @@ -555,22 +556,21 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, if (m_chaser->type() == Function::SequenceType) { - Scene *s = qobject_cast(func); + Scene* s = qobject_cast(func); // blind == true is a workaround to reuse the same scene // without messing up the previous values for (int i = 0; i < step.values.count(); i++) s->setValue(step.values.at(i), true); } - qDebug() << "[ChaserRunner] Starting step" << index << "fade in" << newStep->m_fadeIn - << "fade out" << newStep->m_fadeOut << "intensity" << mIntensity - << "fadeMode" << fadeControl; + qDebug() << "[ChaserRunner] Starting step" << index << "fade in" << newStep->m_fadeIn << "fade out" + << newStep->m_fadeOut << "intensity" << mIntensity << "fadeMode" << fadeControl; // Set intensity before starting the function. Otherwise the intensity // might momentarily jump too high. if (func->type() == Function::SceneType) { - Scene *scene = qobject_cast(func); + Scene* scene = qobject_cast(func); newStep->m_intensityOverrideId = func->requestAttributeOverride(Function::Intensity, sIntensity); newStep->m_pIntensityOverrideId = scene->requestAttributeOverride(Scene::ParentIntensity, mIntensity); qDebug() << "[ChaserRunner] Set step intensity:" << sIntensity << ", master:" << mIntensity; @@ -581,8 +581,8 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, } // Start the fire up ! - func->start(timer, functionParent(), 0, newStep->m_fadeIn, newStep->m_fadeOut, - func->defaultSpeed(), m_chaser->tempoType()); + func->start(timer, functionParent(), 0, newStep->m_fadeIn, newStep->m_fadeOut, func->defaultSpeed(), + m_chaser->tempoType()); m_runnerSteps.append(newStep); m_roundTime->restart(); } @@ -601,13 +601,11 @@ int ChaserRunner::getNextStepIndex() } } - if (currentStepIndex == -1 && - m_chaser->direction() == Function::Backward) - currentStepIndex = m_chaser->stepsCount(); + if (currentStepIndex == -1 && m_chaser->direction() == Function::Backward) + currentStepIndex = m_chaser->stepsCount(); // Handle reverse Ping Pong at boundaries - if (m_chaser->runOrder() == Function::PingPong && - m_pendingAction.m_action == ChaserPreviousStep) + if (m_chaser->runOrder() == Function::PingPong && m_pendingAction.m_action == ChaserPreviousStep) { if (currentStepIndex == 0) m_direction = Function::Backward; @@ -681,8 +679,7 @@ int ChaserRunner::getNextStepIndex() currentStepIndex = 0; } // Don't run the same function 2 times in a row - while (currentStepIndex < m_chaser->stepsCount() - && randomStepIndex(currentStepIndex) == m_lastRunStepIdx) + while (currentStepIndex < m_chaser->stepsCount() && randomStepIndex(currentStepIndex) == m_lastRunStepIdx) ++currentStepIndex; currentStepIndex = randomStepIndex(currentStepIndex); } @@ -707,7 +704,7 @@ int ChaserRunner::getNextStepIndex() return currentStepIndex; } -void ChaserRunner::setPause(bool enable, QList universes) +void ChaserRunner::setPause(bool enable, QList universes) { // Nothing to do if (m_chaser->stepsCount() == 0) @@ -715,15 +712,15 @@ void ChaserRunner::setPause(bool enable, QList universes) qDebug() << "[ChaserRunner] processing pause request:" << enable; - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) step->m_function->setPause(enable); // there might be a Scene fading out, so request pause // to faders bound to the Scene ID running on universes - Function *f = m_doc->function(m_lastFunctionID); + Function* f = m_doc->function(m_lastFunctionID); if (f != NULL && f->type() == Function::SceneType) { - foreach (Universe *universe, universes) + foreach (Universe* universe, universes) universe->setFaderPause(m_lastFunctionID, enable); } } @@ -733,7 +730,7 @@ FunctionParent ChaserRunner::functionParent() const return FunctionParent(FunctionParent::Function, m_chaser->id()); } -bool ChaserRunner::write(MasterTimer *timer, QList universes) +bool ChaserRunner::write(MasterTimer* timer, QList universes) { // Nothing to do if (m_chaser->stepsCount() == 0) @@ -741,37 +738,38 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) switch (m_pendingAction.m_action) { - case ChaserNextStep: - case ChaserPreviousStep: - clearRunningList(); - // the actual action will be performed below, on startNewStep + case ChaserNextStep: + case ChaserPreviousStep: + clearRunningList(); + // the actual action will be performed below, on startNewStep break; - case ChaserSetStepIndex: - if (m_pendingAction.m_stepIndex != -1) - { - clearRunningList(); - m_lastRunStepIdx = m_pendingAction.m_stepIndex; - qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" << m_startOffset; - startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, - m_pendingAction.m_stepIntensity, m_pendingAction.m_fadeMode); - emit currentStepChanged(m_lastRunStepIdx); - } + case ChaserSetStepIndex: + if (m_pendingAction.m_stepIndex != -1) + { + clearRunningList(); + m_lastRunStepIdx = m_pendingAction.m_stepIndex; + qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" << m_startOffset; + startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, m_pendingAction.m_stepIntensity, + m_pendingAction.m_fadeMode); + emit currentStepChanged(m_lastRunStepIdx); + } break; - case ChaserPauseRequest: - setPause(m_pendingAction.m_fadeMode ? true : false, universes); + case ChaserPauseRequest: + setPause(m_pendingAction.m_fadeMode ? true : false, universes); break; - default: + default: break; } quint32 prevStepRoundElapsed = 0; - foreach(ChaserRunnerStep *step, m_runnerSteps) + foreach (ChaserRunnerStep* step, m_runnerSteps) { if (m_chaser->tempoType() == Function::Beats && timer->isBeat()) { step->m_elapsedBeats += 1000; - qDebug() << "[ChaserRunner] Function" << step->m_function->name() << "duration:" << step->m_duration << "beats:" << step->m_elapsedBeats; + qDebug() << "[ChaserRunner] Function" << step->m_function->name() << "duration:" << step->m_duration + << "beats:" << step->m_elapsedBeats; } if (step->m_duration != Function::infiniteSpeed() && @@ -781,7 +779,8 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) if (step->m_duration != 0) prevStepRoundElapsed = step->m_elapsed % step->m_duration; - m_lastFunctionID = step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); + m_lastFunctionID = + step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); step->m_function->stop(functionParent(), m_chaser->type() == Function::SequenceType); delete step; m_runnerSteps.removeOne(step); @@ -813,8 +812,8 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) { int blend = m_pendingAction.m_action == ChaserNoAction ? Chaser::FromFunction : m_pendingAction.m_fadeMode; - startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, - m_pendingAction.m_stepIntensity, blend, prevStepRoundElapsed); + startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, m_pendingAction.m_stepIntensity, + blend, prevStepRoundElapsed); emit currentStepChanged(m_lastRunStepIdx); } else @@ -828,7 +827,7 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) return true; } -void ChaserRunner::postRun(MasterTimer *timer, QList universes) +void ChaserRunner::postRun(MasterTimer* timer, QList universes) { Q_UNUSED(universes); Q_UNUSED(timer); diff --git a/engine/src/chaserrunner.h b/engine/src/chaserrunner.h index 7db03df267..7c00f2c1c7 100644 --- a/engine/src/chaserrunner.h +++ b/engine/src/chaserrunner.h @@ -42,16 +42,16 @@ class Doc; typedef struct { - int m_index; //! Index of the step from the original Chaser - Function *m_function; //! Currently active function - quint32 m_elapsed; //! Elapsed milliseconds - quint32 m_elapsedBeats; //! Elapsed beats - uint m_fadeIn; //! Step fade in in ms - uint m_fadeOut; //! Step fade out in ms - uint m_duration; //! Step hold in ms - Universe::BlendMode m_blendMode; //! The original Function blend mode - int m_intensityOverrideId; //! An ID to control the step intensity - int m_pIntensityOverrideId; //! An ID to control the step parent intensity + int m_index; //! Index of the step from the original Chaser + Function* m_function; //! Currently active function + quint32 m_elapsed; //! Elapsed milliseconds + quint32 m_elapsedBeats; //! Elapsed beats + uint m_fadeIn; //! Step fade in in ms + uint m_fadeOut; //! Step fade out in ms + uint m_duration; //! Step hold in ms + Universe::BlendMode m_blendMode; //! The original Function blend mode + int m_intensityOverrideId; //! An ID to control the step intensity + int m_pIntensityOverrideId; //! An ID to control the step parent intensity } ChaserRunnerStep; class ChaserRunner : public QObject @@ -66,8 +66,8 @@ private slots: void slotChaserChanged(); private: - const Doc *m_doc; - const Chaser *m_chaser; + const Doc* m_doc; + const Chaser* m_chaser; /************************************************************************ * Speed @@ -89,7 +89,7 @@ private slots: * Step control ************************************************************************/ public: - void setAction(ChaserAction &action); + void setAction(ChaserAction& action); /** * Produce a tap event to the runner, possibly producing a next() call. @@ -119,13 +119,13 @@ private slots: * Get the first step of the running list. * If none is running this returns NULL */ - ChaserRunnerStep *currentRunningStep() const; + ChaserRunnerStep* currentRunningStep() const; private: /** * Shuffle the current steps order */ - static void shuffle(QVector & data); + static void shuffle(QVector& data); /** * Retrieve the randomized index of a @@ -151,12 +151,12 @@ private slots: private: Function::Direction m_direction; //! Run-time direction (reversed by ping-pong) - QList m_runnerSteps; //! Queue of the currently running steps + QList m_runnerSteps; //! Queue of the currently running steps quint32 m_startOffset; //! Start step offset time in milliseconds ChaserAction m_pendingAction; //! Action to be performed on steps at the next write call int m_lastRunStepIdx; //! Index of the last step ran quint32 m_lastFunctionID; //! ID of the last Function ran (Scene only) - QElapsedTimer *m_roundTime; //! Counts the time between steps + QElapsedTimer* m_roundTime; //! Counts the time between steps QVector m_order; //! Array of step indices in a randomized order /************************************************************************ @@ -186,8 +186,8 @@ private slots: * - Chaser::LinkedCrossfade is like Crossfade, and the Function will also be requested * to use the Universe::AdditiveBlend mode */ - void startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, - int fadeControl, quint32 elapsed = 0); + void startNewStep(int index, MasterTimer* timer, qreal mIntensity, qreal sIntensity, int fadeControl, + quint32 elapsed = 0); /** * Get the index of the next step that should be started, @@ -209,7 +209,7 @@ private slots: bool write(MasterTimer* timer, QList universes); /** If running, pauses the runner and all the current running steps. */ - void setPause(bool enable, QList universes); + void setPause(bool enable, QList universes); /** * Perform postRun operations. Call this from the parent function's postRun(). @@ -217,7 +217,7 @@ private slots: * @param timer The MasterTimer that runs the show * @param universes DMX address space */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer* timer, QList universes); }; /** @} */ diff --git a/engine/src/chaserstep.cpp b/engine/src/chaserstep.cpp index 750b9fb4af..08170819b9 100644 --- a/engine/src/chaserstep.cpp +++ b/engine/src/chaserstep.cpp @@ -50,7 +50,7 @@ ChaserStep::ChaserStep(const ChaserStep& cs) { } -ChaserStep &ChaserStep::operator=(const ChaserStep &step) +ChaserStep& ChaserStep::operator=(const ChaserStep& step) { if (this != &step) { @@ -79,7 +79,7 @@ Function* ChaserStep::resolveFunction(const Doc* doc) const return doc->function(fid); } -int ChaserStep::setValue(SceneValue value, int index, bool *created) +int ChaserStep::setValue(SceneValue value, int index, bool* created) { if (index == -1) { @@ -141,7 +141,7 @@ int ChaserStep::unSetValue(SceneValue value, int index) QVariant ChaserStep::toVariant() const { - QList list; + QList list; list << fid; list << fadeIn; list << hold; @@ -154,7 +154,7 @@ QVariant ChaserStep::toVariant() const ChaserStep ChaserStep::fromVariant(const QVariant& var) { ChaserStep cs; - QList list(var.toList()); + QList list(var.toList()); if (list.size() == 6) { cs.fid = list.takeFirst().toUInt(); @@ -167,7 +167,7 @@ ChaserStep ChaserStep::fromVariant(const QVariant& var) return cs; } -bool ChaserStep::loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc) +bool ChaserStep::loadXML(QXmlStreamReader& root, int& stepNumber, Doc* doc) { bool holdFound = false; if (root.name() != KXMLQLCFunctionStep) @@ -206,7 +206,7 @@ bool ChaserStep::loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc) // split the string by Fixture chunks QStringList fxArray = stepValues.split(":"); - for (int f = 0; f < fxArray.count(); f+=2) + for (int f = 0; f < fxArray.count(); f += 2) { if (f + 1 >= fxArray.count()) break; @@ -217,7 +217,7 @@ bool ChaserStep::loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc) // now split the chunk into channel/values QStringList varray = fxArray.at(f + 1).split(","); - for (int i = 0; i < varray.count(); i+=2) + for (int i = 0; i < varray.count(); i += 2) { quint32 chIndex = QString(varray.at(i)).toUInt(); SceneValue scv = SceneValue(fxID, chIndex, uchar(QString(varray.at(i + 1)).toInt())); @@ -235,7 +235,7 @@ bool ChaserStep::loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc) values.append(scv); } } - //qSort(values.begin(), values.end()); + // qSort(values.begin(), values.end()); } } else @@ -263,7 +263,7 @@ bool ChaserStep::loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc) return true; } -bool ChaserStep::saveXML(QXmlStreamWriter *doc, int stepNumber, bool isSequence) const +bool ChaserStep::saveXML(QXmlStreamWriter* doc, int stepNumber, bool isSequence) const { /* Step tag */ doc->writeStartElement(KXMLQLCFunctionStep); @@ -284,7 +284,7 @@ bool ChaserStep::saveXML(QXmlStreamWriter *doc, int stepNumber, bool isSequence) doc->writeAttribute(KXMLQLCSequenceSceneValues, QString::number(values.count())); QString stepValues; quint32 fixtureID = Fixture::invalidId(); - foreach(SceneValue scv, values) + foreach (SceneValue scv, values) { // step values are saved as a string with the following syntax: // fixtureID:channel,value,channel,value:fixtureID:channel,value ... etc diff --git a/engine/src/chaserstep.h b/engine/src/chaserstep.h index eb2919da0f..969f095f6d 100644 --- a/engine/src/chaserstep.h +++ b/engine/src/chaserstep.h @@ -43,8 +43,7 @@ class ChaserStep ***********************************************************************/ public: /** Construct a new ChaserStep with the given attributes */ - ChaserStep(quint32 aFid = Function::invalidId(), - uint aFadeIn = 0, uint aHold = 0, uint aFadeOut = 0); + ChaserStep(quint32 aFid = Function::invalidId(), uint aFadeIn = 0, uint aHold = 0, uint aFadeOut = 0); /** Copy constructor */ ChaserStep(const ChaserStep& cs); @@ -57,7 +56,7 @@ class ChaserStep /** Return the actual function pointer for $fid from $doc */ Function* resolveFunction(const Doc* doc) const; - int setValue(SceneValue value, int index = -1, bool *created = NULL); + int setValue(SceneValue value, int index = -1, bool* created = NULL); int unSetValue(SceneValue value, int index = -1); @@ -77,19 +76,19 @@ class ChaserStep ***********************************************************************/ public: /** Load ChaserStep contents from $root and return step index in $stepNumber. - * $doc is used to check fixture existance. If NULL the check is skipped */ - bool loadXML(QXmlStreamReader &root, int& stepNumber, Doc *doc); + * $doc is used to check fixture existance. If NULL the check is skipped */ + bool loadXML(QXmlStreamReader& root, int& stepNumber, Doc* doc); /** Save ChaserStep contents to $doc, with $stepNumber */ - bool saveXML(QXmlStreamWriter *doc, int stepNumber, bool isSequence) const; + bool saveXML(QXmlStreamWriter* doc, int stepNumber, bool isSequence) const; public: - quint32 fid; //! The function ID - uint fadeIn; //! Fade in speed - uint hold; //! Hold time - uint fadeOut; //! Fade out speed - uint duration; //! Duration - QList values; //! specific DMX values for this step (chaser in sequence mode) + quint32 fid; //! The function ID + uint fadeIn; //! Fade in speed + uint hold; //! Hold time + uint fadeOut; //! Fade out speed + uint duration; //! Duration + QList values; //! specific DMX values for this step (chaser in sequence mode) QString note; }; diff --git a/engine/src/collection.cpp b/engine/src/collection.cpp index 818a6e8abd..25e5a1c535 100644 --- a/engine/src/collection.cpp +++ b/engine/src/collection.cpp @@ -46,13 +46,10 @@ Collection::Collection(Doc* doc) setName(tr("New Collection")); // Listen to member Function removals - connect(doc, SIGNAL(functionRemoved(quint32)), - this, SLOT(slotFunctionRemoved(quint32))); + connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); } -Collection::~Collection() -{ -} +Collection::~Collection() {} QIcon Collection::getIcon() const { @@ -63,7 +60,7 @@ quint32 Collection::totalDuration() { quint32 totalDuration = 0; - foreach(QVariant fid, functions()) + foreach (QVariant fid, functions()) { Function* function = doc()->function(fid.toUInt()); totalDuration += function->totalDuration(); @@ -97,7 +94,7 @@ Function* Collection::createCopy(Doc* doc, bool addToDoc) bool Collection::copyFrom(const Function* function) { - const Collection* coll = qobject_cast (function); + const Collection* coll = qobject_cast(function); if (coll == NULL) return false; @@ -168,7 +165,7 @@ void Collection::slotFunctionRemoved(quint32 fid) * Load & Save *****************************************************************************/ -bool Collection::saveXML(QXmlStreamWriter *doc) +bool Collection::saveXML(QXmlStreamWriter* doc) { int i = 0; @@ -181,7 +178,7 @@ bool Collection::saveXML(QXmlStreamWriter *doc) saveXMLCommon(doc); /* Steps */ - QListIterator it(m_functions); + QListIterator it(m_functions); while (it.hasNext() == true) { /* Step tag */ @@ -201,7 +198,7 @@ bool Collection::saveXML(QXmlStreamWriter *doc) return true; } -bool Collection::loadXML(QXmlStreamReader &root) +bool Collection::loadXML(QXmlStreamReader& root) { if (root.name() != KXMLQLCFunction) { @@ -211,8 +208,7 @@ bool Collection::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::CollectionType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() - << "is not a collection"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a collection"; return false; } @@ -233,7 +229,7 @@ bool Collection::loadXML(QXmlStreamReader &root) void Collection::postLoad() { - Doc* doc = qobject_cast (parent()); + Doc* doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); /* Check that all member functions exist (nonexistent functions can @@ -251,7 +247,7 @@ void Collection::postLoad() bool Collection::contains(quint32 functionId) { - Doc* doc = qobject_cast (parent()); + Doc* doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); foreach (quint32 fid, m_functions) @@ -284,19 +280,20 @@ FunctionParent Collection::functionParent() const return FunctionParent(FunctionParent::Function, id()); } -void Collection::preRun(MasterTimer *timer) +void Collection::preRun(MasterTimer* timer) { - Doc *doc = this->doc(); + Doc* doc = this->doc(); Q_ASSERT(doc != NULL); { QMutexLocker locker(&m_functionListMutex); m_runningChildren.clear(); foreach (quint32 fid, m_functions) { - Function *function = doc->function(fid); + Function* function = doc->function(fid); Q_ASSERT(function != NULL); - m_intensityOverrideIds << function->requestAttributeOverride(Function::Intensity, getAttributeValue(Function::Intensity)); + m_intensityOverrideIds << function->requestAttributeOverride(Function::Intensity, + getAttributeValue(Function::Intensity)); // Append the IDs of all functions started by this collection // to a set so that we can track which of them are still controlled @@ -305,16 +302,15 @@ void Collection::preRun(MasterTimer *timer) // Listen to the children's stopped signals so that this Collection // can give up its rights to stop the function later. - connect(function, SIGNAL(stopped(quint32)), - this, SLOT(slotChildStopped(quint32))); + connect(function, SIGNAL(stopped(quint32)), this, SLOT(slotChildStopped(quint32))); // Listen to the children's stopped signals so that this collection // can give up its rights to stop the function later. - connect(function, SIGNAL(running(quint32)), - this, SLOT(slotChildStarted(quint32))); + connect(function, SIGNAL(running(quint32)), this, SLOT(slotChildStarted(quint32))); - //function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity); - function->start(timer, functionParent(), 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration()); + // function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity); + function->start(timer, functionParent(), 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), + overrideDuration()); } m_tick = 1; } @@ -323,18 +319,18 @@ void Collection::preRun(MasterTimer *timer) void Collection::setPause(bool enable) { - Doc *doc = this->doc(); + Doc* doc = this->doc(); Q_ASSERT(doc != NULL); foreach (quint32 fid, m_runningChildren) { - Function *function = doc->function(fid); + Function* function = doc->function(fid); Q_ASSERT(function != NULL); function->setPause(enable); } Function::setPause(enable); } -void Collection::write(MasterTimer *timer, QList universes) +void Collection::write(MasterTimer* timer, QList universes) { Q_UNUSED(timer); Q_UNUSED(universes); @@ -348,19 +344,18 @@ void Collection::write(MasterTimer *timer, QList universes) else if (m_tick == 2) { m_tick = 0; - Doc *doc = this->doc(); + Doc* doc = this->doc(); Q_ASSERT(doc != NULL); QMutexLocker locker(&m_functionListMutex); foreach (quint32 fid, m_runningChildren) { - Function *function = doc->function(fid); + Function* function = doc->function(fid); Q_ASSERT(function != NULL); // First tick may correspond to this collection starting the function // Now that first tick is over, stop listening to running signal - disconnect(function, SIGNAL(running(quint32)), - this, SLOT(slotChildStarted(quint32))); + disconnect(function, SIGNAL(running(quint32)), this, SLOT(slotChildStarted(quint32))); } } @@ -375,16 +370,16 @@ void Collection::write(MasterTimer *timer, QList universes) stop(functionParent()); } -void Collection::postRun(MasterTimer* timer, QList universes) +void Collection::postRun(MasterTimer* timer, QList universes) { - Doc* doc = qobject_cast (parent()); + Doc* doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); { QMutexLocker locker(&m_functionListMutex); /** Stop the member functions only if they have been started by this collection. */ - QSetIterator it(m_runningChildren); + QSetIterator it(m_runningChildren); while (it.hasNext() == true) { Function* function = doc->function(it.next()); @@ -399,12 +394,10 @@ void Collection::postRun(MasterTimer* timer, QList universes) Function* function = doc->function(m_functions.at(i)); Q_ASSERT(function != NULL); - disconnect(function, SIGNAL(stopped(quint32)), - this, SLOT(slotChildStopped(quint32))); + disconnect(function, SIGNAL(stopped(quint32)), this, SLOT(slotChildStopped(quint32))); if (m_tick == 2) { - disconnect(function, SIGNAL(running(quint32)), - this, SLOT(slotChildStarted(quint32))); + disconnect(function, SIGNAL(running(quint32)), this, SLOT(slotChildStarted(quint32))); } } diff --git a/engine/src/collection.h b/engine/src/collection.h index 6aaac62f08..a285982a0e 100644 --- a/engine/src/collection.h +++ b/engine/src/collection.h @@ -92,7 +92,7 @@ class Collection : public Function /** * Get this function's list of member functions */ - QList functions() const; + QList functions() const; signals: void functionsChanged(); @@ -104,10 +104,10 @@ public slots: protected: /** The list of Function IDs added to this Collection */ - QList m_functions; + QList m_functions; /** A list of intesity attribute override IDs populated when this Collection is * started and cleaned when it's stopped */ - QList m_intensityOverrideIds; + QList m_intensityOverrideIds; #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) mutable QMutex m_functionListMutex; @@ -120,10 +120,10 @@ public slots: *********************************************************************/ public: /** Save function's contents to an XML document */ - bool saveXML(QXmlStreamWriter *doc); + bool saveXML(QXmlStreamWriter* doc); /** Load function's contents from an XML document */ - bool loadXML(QXmlStreamReader &root); + bool loadXML(QXmlStreamReader& root); /** @reimp */ void postLoad(); @@ -149,10 +149,10 @@ public slots: void setPause(bool enable); /** @reimpl */ - void write(MasterTimer* timer, QList universes); + void write(MasterTimer* timer, QList universes); /** @reimpl */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer* timer, QList universes); protected slots: /** Called whenever one of this function's child functions stops */ @@ -163,7 +163,7 @@ protected slots: protected: /** Number of currently running children */ - QSet m_runningChildren; + QSet m_runningChildren; unsigned int m_tick; /************************************************************************* diff --git a/engine/src/cue.cpp b/engine/src/cue.cpp index 04e58546a4..6ffba0bf03 100644 --- a/engine/src/cue.cpp +++ b/engine/src/cue.cpp @@ -32,7 +32,7 @@ Cue::Cue(const QString& name) { } -Cue::Cue(const QHash values) +Cue::Cue(const QHash values) : m_name(QString()) , m_values(values) , m_fadeInSpeed(0) @@ -50,11 +50,9 @@ Cue::Cue(const Cue& cue) { } -Cue::~Cue() -{ -} +Cue::~Cue() {} -Cue &Cue::operator=(const Cue &cue) +Cue& Cue::operator=(const Cue& cue) { if (this != &cue) { @@ -105,7 +103,7 @@ uchar Cue::value(uint channel) const return 0; } -QHash Cue::values() const +QHash Cue::values() const { return m_values; } @@ -148,7 +146,7 @@ uint Cue::duration() const * Load & Save ****************************************************************************/ -bool Cue::loadXML(QXmlStreamReader &root) +bool Cue::loadXML(QXmlStreamReader& root) { qDebug() << Q_FUNC_INFO; @@ -183,7 +181,7 @@ bool Cue::loadXML(QXmlStreamReader &root) return true; } -bool Cue::saveXML(QXmlStreamWriter *doc) const +bool Cue::saveXML(QXmlStreamWriter* doc) const { qDebug() << Q_FUNC_INFO; Q_ASSERT(doc != NULL); @@ -191,7 +189,7 @@ bool Cue::saveXML(QXmlStreamWriter *doc) const doc->writeStartElement(KXMLQLCCue); doc->writeAttribute(KXMLQLCCueName, name()); - QHashIterator it(values()); + QHashIterator it(values()); while (it.hasNext() == true) { it.next(); @@ -209,7 +207,7 @@ bool Cue::saveXML(QXmlStreamWriter *doc) const return true; } -bool Cue::loadXMLSpeed(QXmlStreamReader &speedRoot) +bool Cue::loadXMLSpeed(QXmlStreamReader& speedRoot) { if (speedRoot.name() != KXMLQLCCueSpeed) return false; @@ -222,7 +220,7 @@ bool Cue::loadXMLSpeed(QXmlStreamReader &speedRoot) return true; } -bool Cue::saveXMLSpeed(QXmlStreamWriter *doc) const +bool Cue::saveXMLSpeed(QXmlStreamWriter* doc) const { doc->writeStartElement(KXMLQLCCueSpeed); doc->writeAttribute(KXMLQLCCueSpeedFadeIn, QString::number(fadeInSpeed())); diff --git a/engine/src/cue.h b/engine/src/cue.h index ed05c11932..0937838065 100644 --- a/engine/src/cue.h +++ b/engine/src/cue.h @@ -33,21 +33,21 @@ class QXmlStreamWriter; * @{ */ -#define KXMLQLCCue QString("Cue") -#define KXMLQLCCueName QString("Name") -#define KXMLQLCCueValue QString("Value") -#define KXMLQLCCueValueChannel QString("Channel") - -#define KXMLQLCCueSpeed QString("Speed") -#define KXMLQLCCueSpeedFadeIn QString("FadeIn") -#define KXMLQLCCueSpeedFadeOut QString("FadeOut") +#define KXMLQLCCue QString("Cue") +#define KXMLQLCCueName QString("Name") +#define KXMLQLCCueValue QString("Value") +#define KXMLQLCCueValueChannel QString("Channel") + +#define KXMLQLCCueSpeed QString("Speed") +#define KXMLQLCCueSpeedFadeIn QString("FadeIn") +#define KXMLQLCCueSpeedFadeOut QString("FadeOut") #define KXMLQLCCueSpeedDuration QString("Duration") class Cue { public: Cue(const QString& name = QString()); - Cue(const QHash values); + Cue(const QHash values); Cue(const Cue& cue); ~Cue(); @@ -71,10 +71,10 @@ class Cue void unsetValue(uint channel); uchar value(uint channel) const; - QHash values() const; + QHash values() const; private: - QHash m_values; + QHash m_values; /************************************************************************ * Speed @@ -98,12 +98,12 @@ class Cue * Load & Save ************************************************************************/ public: - bool loadXML(QXmlStreamReader &root); - bool saveXML(QXmlStreamWriter *doc) const; + bool loadXML(QXmlStreamReader& root); + bool saveXML(QXmlStreamWriter* doc) const; private: - bool loadXMLSpeed(QXmlStreamReader &speedRoot); - bool saveXMLSpeed(QXmlStreamWriter *doc) const; + bool loadXMLSpeed(QXmlStreamReader& speedRoot); + bool saveXMLSpeed(QXmlStreamWriter* doc) const; }; /** @} */ diff --git a/engine/src/cuestack.cpp b/engine/src/cuestack.cpp index a4e449491e..3449905a0a 100644 --- a/engine/src/cuestack.cpp +++ b/engine/src/cuestack.cpp @@ -50,13 +50,13 @@ CueStack::CueStack(Doc* doc) , m_previous(false) , m_next(false) { - //qDebug() << Q_FUNC_INFO << (void*) this; + // qDebug() << Q_FUNC_INFO << (void*) this; Q_ASSERT(doc != NULL); } CueStack::~CueStack() { - //qDebug() << Q_FUNC_INFO << (void*) this; + // qDebug() << Q_FUNC_INFO << (void*) this; Q_ASSERT(isStarted() == false); Q_ASSERT(isFlashing() == false); m_cues.clear(); // Crashes without this, WTF?! @@ -64,7 +64,7 @@ CueStack::~CueStack() Doc* CueStack::doc() const { - return qobject_cast (parent()); + return qobject_cast(parent()); } /**************************************************************************** @@ -198,8 +198,8 @@ void CueStack::replaceCue(int index, const Cue& cue) if (index >= 0 && index < m_cues.size()) { - m_cues[index] = cue; - cueChanged = true; + m_cues[index] = cue; + cueChanged = true; } } @@ -231,16 +231,16 @@ void CueStack::removeCue(int index) } } -void CueStack::removeCues(const QList & indexes) +void CueStack::removeCues(const QList& indexes) { qDebug() << Q_FUNC_INFO; // Sort the list so that the items can be removed in reverse order. // This way, the indices are always correct. - QList indexList = indexes; + QList indexList = indexes; std::sort(indexList.begin(), indexList.end()); - QListIterator it(indexList); + QListIterator it(indexList); it.toBack(); QMutexLocker locker(&m_mutex); @@ -262,7 +262,7 @@ void CueStack::removeCues(const QList & indexes) } } -QList CueStack::cues() const +QList CueStack::cues() const { return m_cues; } @@ -300,7 +300,7 @@ void CueStack::nextCue() * Save & Load ****************************************************************************/ -uint CueStack::loadXMLID(QXmlStreamReader &root) +uint CueStack::loadXMLID(QXmlStreamReader& root) { qDebug() << Q_FUNC_INFO; @@ -318,7 +318,7 @@ uint CueStack::loadXMLID(QXmlStreamReader &root) return UINT_MAX; } -bool CueStack::loadXML(QXmlStreamReader &root) +bool CueStack::loadXML(QXmlStreamReader& root) { qDebug() << Q_FUNC_INFO; @@ -355,7 +355,7 @@ bool CueStack::loadXML(QXmlStreamReader &root) return true; } -bool CueStack::saveXML(QXmlStreamWriter *doc, uint id) const +bool CueStack::saveXML(QXmlStreamWriter* doc, uint id) const { qDebug() << Q_FUNC_INFO; Q_ASSERT(doc != NULL); @@ -435,7 +435,7 @@ bool CueStack::isFlashing() const return m_flashing; } -void CueStack::writeDMX(MasterTimer *timer, QList ua) +void CueStack::writeDMX(MasterTimer* timer, QList ua) { Q_UNUSED(timer); if (m_cues.isEmpty()) @@ -445,7 +445,7 @@ void CueStack::writeDMX(MasterTimer *timer, QList ua) { if (m_fadersMap.isEmpty()) { - QHashIterator it(m_cues.first().values()); + QHashIterator it(m_cues.first().values()); while (it.hasNext() == true) { it.next(); @@ -469,7 +469,7 @@ void CueStack::writeDMX(MasterTimer *timer, QList ua) } else { - QMapIterator > it(m_fadersMap); + QMapIterator> it(m_fadersMap); while (it.hasNext() == true) { it.next(); @@ -526,21 +526,21 @@ void CueStack::write(QList ua) m_next = false; emit currentCueChanged(m_currentIndex); } -/* - else if (m_elapsed >= duration()) - { - // Duration expired - m_elapsed = 0; - switchCue(next(), ua); - emit currentCueChanged(m_currentIndex); - } -*/ - //m_fader->write(ua); + /* + else if (m_elapsed >= duration()) + { + // Duration expired + m_elapsed = 0; + switchCue(next(), ua); + emit currentCueChanged(m_currentIndex); + } + */ + // m_fader->write(ua); m_elapsed += MasterTimer::tick(); } -void CueStack::postRun(MasterTimer* timer, QList ua) +void CueStack::postRun(MasterTimer* timer, QList ua) { qDebug() << Q_FUNC_INFO; @@ -551,7 +551,7 @@ void CueStack::postRun(MasterTimer* timer, QList ua) * when done */ if (fadeOutSpeed() == 0) { - QMapIterator > it(m_fadersMap); + QMapIterator> it(m_fadersMap); while (it.hasNext() == true) { it.next(); @@ -594,7 +594,7 @@ int CueStack::previous() return m_currentIndex; } -FadeChannel *CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) +FadeChannel* CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) { // get the universe Fader first. If doesn't exist, create it QSharedPointer fader = m_fadersMap.value(universeID, QSharedPointer()); @@ -608,7 +608,7 @@ FadeChannel *CueStack::getFader(QList universes, quint32 universeID, return fader->getChannelFader(doc(), universes[universeID], fixtureID, channel); } -void CueStack::updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime) +void CueStack::updateFaderValues(FadeChannel* fc, uchar value, uint fadeTime) { fc->setStart(fc->current()); fc->setTarget(value); @@ -632,7 +632,7 @@ int CueStack::next() return m_currentIndex; } -void CueStack::switchCue(int from, int to, const QList ua) +void CueStack::switchCue(int from, int to, const QList ua) { qDebug() << Q_FUNC_INFO; @@ -649,27 +649,26 @@ void CueStack::switchCue(int from, int to, const QList ua) } // Fade out the HTP channels of the previous cue - QHashIterator oldit(oldCue.values()); + QHashIterator oldit(oldCue.values()); while (oldit.hasNext() == true) { oldit.next(); uint absChannel = oldit.key(); quint32 universe = (absChannel >> 9); - FadeChannel *fc = getFader(ua, universe, Fixture::invalidId(), absChannel); + FadeChannel* fc = getFader(ua, universe, Fixture::invalidId(), absChannel); if (fc->flags() & FadeChannel::Intensity) updateFaderValues(fc, 0, oldCue.fadeOutSpeed()); } // Fade in all channels of the new cue - QHashIterator newit(newCue.values()); + QHashIterator newit(newCue.values()); while (newit.hasNext() == true) { newit.next(); uint absChannel = newit.key(); quint32 universe = (absChannel >> 9); - FadeChannel *fc = getFader(ua, universe, Fixture::invalidId(), absChannel); + FadeChannel* fc = getFader(ua, universe, Fixture::invalidId(), absChannel); updateFaderValues(fc, newit.value(), newCue.fadeInSpeed()); } } - diff --git a/engine/src/cuestack.h b/engine/src/cuestack.h index 9c3dd92cc4..3508330845 100644 --- a/engine/src/cuestack.h +++ b/engine/src/cuestack.h @@ -41,11 +41,11 @@ class Doc; * @{ */ -#define KXMLQLCCueStack QString("CueStack") -#define KXMLQLCCueStackID QString("ID") -#define KXMLQLCCueStackSpeed QString("Speed") -#define KXMLQLCCueStackSpeedFadeIn QString("FadeIn") -#define KXMLQLCCueStackSpeedFadeOut QString("FadeOut") +#define KXMLQLCCueStack QString("CueStack") +#define KXMLQLCCueStackID QString("ID") +#define KXMLQLCCueStackSpeed QString("Speed") +#define KXMLQLCCueStackSpeedFadeIn QString("FadeIn") +#define KXMLQLCCueStackSpeedFadeOut QString("FadeOut") #define KXMLQLCCueStackSpeedDuration QString("Duration") class CueStack : public QObject, public DMXSource @@ -176,10 +176,10 @@ class CueStack : public QObject, public DMXSource void removeCue(int index); /** Remove cues from the given $indexes */ - void removeCues(const QList & indexes); + void removeCues(const QList& indexes); /** Get a list of all cues */ - QList cues() const; + QList cues() const; signals: void added(int index); @@ -187,16 +187,16 @@ class CueStack : public QObject, public DMXSource void changed(int index); private: - QList m_cues; + QList m_cues; QMutex m_mutex; /************************************************************************ * Load & Save ************************************************************************/ public: - static uint loadXMLID(QXmlStreamReader &root); - bool loadXML(QXmlStreamReader &root); - bool saveXML(QXmlStreamWriter *doc, uint id) const; + static uint loadXMLID(QXmlStreamReader& root); + bool loadXML(QXmlStreamReader& root); + bool saveXML(QXmlStreamWriter* doc, uint id) const; /************************************************************************ * Running @@ -232,7 +232,7 @@ class CueStack : public QObject, public DMXSource void setFlashing(bool enable); bool isFlashing() const; - void writeDMX(MasterTimer* timer, QList ua); + void writeDMX(MasterTimer* timer, QList ua); private: bool m_flashing; @@ -244,19 +244,19 @@ class CueStack : public QObject, public DMXSource bool isStarted() const; void preRun(); - void write(QList ua); - void postRun(MasterTimer *timer, QList ua); + void write(QList ua); + void postRun(MasterTimer* timer, QList ua); private: int next(); int previous(); - FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); - void updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime); - void switchCue(int from, int to, const QList ua); + FadeChannel* getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); + void updateFaderValues(FadeChannel* fc, uchar value, uint fadeTime); + void switchCue(int from, int to, const QList ua); private: /** Map used to lookup a GenericFader instance for a Universe ID */ - QMap > m_fadersMap; + QMap> m_fadersMap; uint m_elapsed; bool m_previous; bool m_next; diff --git a/engine/src/dmxdumpfactoryproperties.cpp b/engine/src/dmxdumpfactoryproperties.cpp index 7ab05f22e4..ce219cbabb 100644 --- a/engine/src/dmxdumpfactoryproperties.cpp +++ b/engine/src/dmxdumpfactoryproperties.cpp @@ -88,4 +88,3 @@ DmxDumpFactoryProperties::TargetType DmxDumpFactoryProperties::selectedTarget() { return m_selectedTarget; } - diff --git a/engine/src/dmxsource.h b/engine/src/dmxsource.h index a36cc997eb..0fe9e47889 100644 --- a/engine/src/dmxsource.h +++ b/engine/src/dmxsource.h @@ -35,7 +35,10 @@ class Universe; class DMXSource { public: - DMXSource() { m_changed = false; } + DMXSource() + { + m_changed = false; + } virtual ~DMXSource() {} /** @@ -47,8 +50,14 @@ class DMXSource virtual void writeDMX(MasterTimer* timer, QList universes) = 0; /** Get/Set if the DMX source has changed */ - bool hasChanged() { return m_changed; } - void setChanged(bool changed) { m_changed = changed; } + bool hasChanged() + { + return m_changed; + } + void setChanged(bool changed) + { + m_changed = changed; + } protected: bool m_changed; diff --git a/engine/src/doc.cpp b/engine/src/doc.cpp index b99545b8d9..a235d317b9 100644 --- a/engine/src/doc.cpp +++ b/engine/src/doc.cpp @@ -27,7 +27,7 @@ #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) -#include + #include #endif #include "qlcfixturemode.h" @@ -52,17 +52,17 @@ #include "bus.h" #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #if defined(__APPLE__) || defined(Q_OS_MAC) - #include "audiocapture_portaudio.h" - #elif defined(WIN32) || defined (Q_OS_WIN) - #include "audiocapture_wavein.h" - #else - #include "audiocapture_alsa.h" - #endif + #if defined(__APPLE__) || defined(Q_OS_MAC) + #include "audiocapture_portaudio.h" + #elif defined(WIN32) || defined(Q_OS_WIN) + #include "audiocapture_wavein.h" + #else + #include "audiocapture_alsa.h" + #endif #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - #include "audiocapture_qt5.h" + #include "audiocapture_qt5.h" #else - #include "audiocapture_qt6.h" + #include "audiocapture_qt6.h" #endif Doc::Doc(QObject* parent, int universes) @@ -93,7 +93,6 @@ Doc::Doc(QObject* parent, int universes) #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) qsrand(QTime::currentTime().msec()); #endif - } Doc::~Doc() @@ -106,7 +105,7 @@ Doc::~Doc() if (isKiosk() == false) { // TODO: is this still needed ?? - //m_ioMap->saveDefaults(); + // m_ioMap->saveDefaults(); } delete m_ioMap; m_ioMap = NULL; @@ -133,7 +132,7 @@ void Doc::clearContents() destroyAudioCapture(); // Delete all function instances - QListIterator funcit(m_functions.keys()); + QListIterator funcit(m_functions.keys()); while (funcit.hasNext() == true) { Function* func = m_functions.take(funcit.next()); @@ -144,16 +143,16 @@ void Doc::clearContents() } // Delete all palettes - QListIterator palIt(m_palettes.keys()); + QListIterator palIt(m_palettes.keys()); while (palIt.hasNext() == true) { - QLCPalette *palette = m_palettes.take(palIt.next()); + QLCPalette* palette = m_palettes.take(palIt.next()); emit paletteRemoved(palette->id()); delete palette; } // Delete all channel groups - QListIterator grpchans(m_channelsGroups.keys()); + QListIterator grpchans(m_channelsGroups.keys()); while (grpchans.hasNext() == true) { ChannelsGroup* grp = m_channelsGroups.take(grpchans.next()); @@ -162,7 +161,7 @@ void Doc::clearContents() } // Delete all fixture groups - QListIterator grpit(m_fixtureGroups.keys()); + QListIterator grpit(m_fixtureGroups.keys()); while (grpit.hasNext() == true) { FixtureGroup* grp = m_fixtureGroups.take(grpit.next()); @@ -172,7 +171,7 @@ void Doc::clearContents() } // Delete all fixture instances - QListIterator fxit(m_fixtures.keys()); + QListIterator fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { Fixture* fxi = m_fixtures.take(fxit.next()); @@ -239,7 +238,7 @@ QLCFixtureDefCache* Doc::fixtureDefCache() const return m_fixtureDefCache; } -void Doc::setFixtureDefinitionCache(QLCFixtureDefCache *cache) +void Doc::setFixtureDefinitionCache(QLCFixtureDefCache* cache) { m_fixtureDefCache = cache; } @@ -259,7 +258,7 @@ IOPluginCache* Doc::ioPluginCache() const return m_ioPluginCache; } -AudioPluginCache *Doc::audioPluginCache() const +AudioPluginCache* Doc::audioPluginCache() const { return m_audioPluginCache; } @@ -281,19 +280,19 @@ QSharedPointer Doc::audioInputCapture() qDebug() << "Creating new audio capture"; m_inputCapture = QSharedPointer( #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#if defined(__APPLE__) || defined(Q_OS_MAC) + #if defined(__APPLE__) || defined(Q_OS_MAC) new AudioCapturePortAudio() -#elif defined(WIN32) || defined (Q_OS_WIN) + #elif defined(WIN32) || defined(Q_OS_WIN) new AudioCaptureWaveIn() -#else + #else new AudioCaptureAlsa() -#endif + #endif #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0) new AudioCaptureQt6() #else new AudioCaptureQt6() #endif - ); + ); } return m_inputCapture; } @@ -346,7 +345,7 @@ void Doc::setMode(Doc::Mode mode) // Run startup function if (m_mode == Operate && m_startupFunctionId != Function::invalidId()) { - Function *func = function(m_startupFunctionId); + Function* func = function(m_startupFunctionId); if (func != NULL) { qDebug() << Q_FUNC_INFO << "Starting startup function. (" << m_startupFunctionId << ")"; @@ -381,7 +380,7 @@ bool Doc::isKiosk() const * Clipboard *********************************************************************/ -QLCClipboard *Doc::clipboard() +QLCClipboard* Doc::clipboard() { return m_clipboard; } @@ -395,8 +394,7 @@ quint32 Doc::createFixtureId() /* This results in an endless loop if there are UINT_MAX-1 fixtures. That, however, seems a bit unlikely. Are there even 4294967295-1 fixtures in total in the whole world? */ - while (m_fixtures.contains(m_latestFixtureId) == true || - m_latestFixtureId == Fixture::invalidId()) + while (m_fixtures.contains(m_latestFixtureId) == true || m_latestFixtureId == Fixture::invalidId()) { m_latestFixtureId++; } @@ -422,12 +420,12 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) } /* Check for overlapping address */ - for (i = fixture->universeAddress(); - i < fixture->universeAddress() + fixture->channels(); i++) + for (i = fixture->universeAddress(); i < fixture->universeAddress() + fixture->channels(); i++) { if (m_addresses.contains(i)) { - qWarning() << Q_FUNC_INFO << "fixture" << id << "overlapping with fixture" << m_addresses[i] << "@ channel" << i; + qWarning() << Q_FUNC_INFO << "fixture" << id << "overlapping with fixture" << m_addresses[i] << "@ channel" + << i; return false; } } @@ -437,12 +435,10 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) m_fixturesListCacheUpToDate = false; /* Patch fixture change signals thru Doc */ - connect(fixture, SIGNAL(changed(quint32)), - this, SLOT(slotFixtureChanged(quint32))); + connect(fixture, SIGNAL(changed(quint32)), this, SLOT(slotFixtureChanged(quint32))); /* Keep track of fixture addresses */ - for (i = fixture->universeAddress(); - i < fixture->universeAddress() + fixture->channels(); i++) + for (i = fixture->universeAddress(); i < fixture->universeAddress() + fixture->channels(); i++) { m_addresses[i] = id; } @@ -455,7 +451,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) } // Add the fixture channels capabilities to the universe they belong - QList universes = inputOutputMap()->claimUniverses(); + QList universes = inputOutputMap()->claimUniverses(); QList forcedHTP = fixture->forcedHTPChannels(); QList forcedLTP = fixture->forcedLTPChannels(); @@ -463,7 +459,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) for (i = 0; i < fixture->channels(); i++) { - const QLCChannel *channel(fixture->channel(i)); + const QLCChannel* channel(fixture->channel(i)); // Inform Universe of any HTP/LTP forcing if (forcedHTP.contains(int(i))) @@ -477,7 +473,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) universes.at(uni)->setChannelDefaultValue(fxAddress + i, channel->defaultValue()); // Apply a channel modifier, if defined - ChannelModifier *mod = fixture->channelModifier(i); + ChannelModifier* mod = fixture->channelModifier(i); universes.at(uni)->setChannelModifier(fxAddress + i, mod); } inputOutputMap()->releaseUniverses(true); @@ -497,7 +493,7 @@ bool Doc::deleteFixture(quint32 id) m_fixturesListCacheUpToDate = false; /* Keep track of fixture addresses */ - QMutableHashIterator it(m_addresses); + QMutableHashIterator it(m_addresses); while (it.hasNext() == true) { it.next(); @@ -526,53 +522,50 @@ bool Doc::deleteFixture(quint32 id) bool Doc::replaceFixtures(QList newFixturesList) { // Delete all fixture instances - QListIterator fxit(m_fixtures.keys()); + QListIterator fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { Fixture* fxi = m_fixtures.take(fxit.next()); - disconnect(fxi, SIGNAL(changed(quint32)), - this, SLOT(slotFixtureChanged(quint32))); + disconnect(fxi, SIGNAL(changed(quint32)), this, SLOT(slotFixtureChanged(quint32))); delete fxi; m_fixturesListCacheUpToDate = false; } m_latestFixtureId = 0; m_addresses.clear(); - foreach(Fixture *fixture, newFixturesList) + foreach (Fixture* fixture, newFixturesList) { quint32 id = fixture->id(); // create a copy of the original cause remapping will // destroy it later - Fixture *newFixture = new Fixture(this); + Fixture* newFixture = new Fixture(this); newFixture->setID(id); newFixture->setName(fixture->name()); newFixture->setAddress(fixture->address()); newFixture->setUniverse(fixture->universe()); - if (fixture->fixtureDef() == NULL || - (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && - fixture->fixtureDef()->model() == KXMLFixtureGeneric)) + if (fixture->fixtureDef() == NULL || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && + fixture->fixtureDef()->model() == KXMLFixtureGeneric)) { // Generic dimmers just need to know the number of channels newFixture->setChannels(fixture->channels()); } - else if (fixture->fixtureDef() == NULL || - (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && - fixture->fixtureDef()->model() == KXMLFixtureRGBPanel)) + else if (fixture->fixtureDef() == NULL || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && + fixture->fixtureDef()->model() == KXMLFixtureRGBPanel)) { // RGB Panels definitions are not cached or shared, so // let's make a deep copy of them - QLCFixtureDef *fixtureDef = new QLCFixtureDef(); + QLCFixtureDef* fixtureDef = new QLCFixtureDef(); *fixtureDef = *fixture->fixtureDef(); - QLCFixtureMode *mode = new QLCFixtureMode(fixtureDef); + QLCFixtureMode* mode = new QLCFixtureMode(fixtureDef); *mode = *fixture->fixtureMode(); newFixture->setFixtureDefinition(fixtureDef, mode); } else { - QLCFixtureDef *def = fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(), - fixture->fixtureDef()->model()); - QLCFixtureMode *mode = NULL; + QLCFixtureDef* def = + fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(), fixture->fixtureDef()->model()); + QLCFixtureMode* mode = NULL; if (def != NULL) mode = def->mode(fixture->fixtureMode()->name()); newFixture->setFixtureDefinition(def, mode); @@ -586,12 +579,10 @@ bool Doc::replaceFixtures(QList newFixturesList) m_fixturesListCacheUpToDate = false; /* Patch fixture change signals thru Doc */ - connect(newFixture, SIGNAL(changed(quint32)), - this, SLOT(slotFixtureChanged(quint32))); + connect(newFixture, SIGNAL(changed(quint32)), this, SLOT(slotFixtureChanged(quint32))); /* Keep track of fixture addresses */ - for (uint i = newFixture->universeAddress(); - i < newFixture->universeAddress() + newFixture->channels(); i++) + for (uint i = newFixture->universeAddress(); i < newFixture->universeAddress() + newFixture->channels(); i++) { m_addresses[i] = id; } @@ -607,8 +598,8 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi Fixture* fixture = m_fixtures[id]; // get exclusive access to the universes list - QList universes = inputOutputMap()->claimUniverses(); - Universe *universe = universes.at(fixture->universe()); + QList universes = inputOutputMap()->claimUniverses(); + Universe* universe = universes.at(fixture->universe()); quint32 fxAddress = fixture->address(); // Set forced HTP channels @@ -618,9 +609,9 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi fixture->setForcedLTPChannels(forcedLTP); // Update the Fixture Universe with the current channel states - for (quint32 i = 0 ; i < fixture->channels(); i++) + for (quint32 i = 0; i < fixture->channels(); i++) { - const QLCChannel *channel(fixture->channel(i)); + const QLCChannel* channel(fixture->channel(i)); // Inform Universe of any HTP/LTP forcing if (forcedHTP.contains(int(i))) @@ -634,7 +625,7 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi universe->setChannelDefaultValue(fxAddress + i, channel->defaultValue()); // Apply a channel modifier, if defined - ChannelModifier *mod = fixture->channelModifier(i); + ChannelModifier* mod = fixture->channelModifier(i); universe->setChannelModifier(fxAddress + i, mod); } @@ -648,8 +639,8 @@ QList const& Doc::fixtures() const if (!m_fixturesListCacheUpToDate) { // Sort fixtures by id - QMap fixturesMap; - QHashIterator hashIt(m_fixtures); + QMap fixturesMap; + QHashIterator hashIt(m_fixtures); while (hashIt.hasNext()) { hashIt.next(); @@ -678,7 +669,7 @@ int Doc::totalPowerConsumption(int& fuzzy) const // Make sure fuzzy starts from zero fuzzy = 0; - QListIterator fxit(fixtures()); + QListIterator fxit(fixtures()); while (fxit.hasNext() == true) { Fixture* fxi(fxit.next()); @@ -707,7 +698,7 @@ void Doc::slotFixtureChanged(quint32 id) Fixture* fxi = fixture(id); // remove it - QMutableHashIterator it(m_addresses); + QMutableHashIterator it(m_addresses); while (it.hasNext() == true) { it.next(); @@ -756,8 +747,7 @@ bool Doc::addFixtureGroup(FixtureGroup* grp, quint32 id) m_fixtureGroups[id] = grp; /* Patch fixture group change signals thru Doc */ - connect(grp, SIGNAL(changed(quint32)), - this, SLOT(slotFixtureGroupChanged(quint32))); + connect(grp, SIGNAL(changed(quint32)), this, SLOT(slotFixtureGroupChanged(quint32))); emit fixtureGroupAdded(id); setModified(); @@ -794,7 +784,7 @@ FixtureGroup* Doc::fixtureGroup(quint32 id) const return NULL; } -QList Doc::fixtureGroups() const +QList Doc::fixtureGroups() const { return m_fixtureGroups.values(); } @@ -822,7 +812,7 @@ void Doc::slotFixtureGroupChanged(quint32 id) /********************************************************************* * Channels groups *********************************************************************/ -bool Doc::addChannelsGroup(ChannelsGroup *grp, quint32 id) +bool Doc::addChannelsGroup(ChannelsGroup* grp, quint32 id) { Q_ASSERT(grp != NULL); @@ -830,15 +820,15 @@ bool Doc::addChannelsGroup(ChannelsGroup *grp, quint32 id) if (id == ChannelsGroup::invalidId()) id = createChannelsGroupId(); - grp->setId(id); - m_channelsGroups[id] = grp; - if (m_orderedGroups.contains(id) == false) + grp->setId(id); + m_channelsGroups[id] = grp; + if (m_orderedGroups.contains(id) == false) m_orderedGroups.append(id); - emit channelsGroupAdded(id); - setModified(); + emit channelsGroupAdded(id); + setModified(); - return true; + return true; } bool Doc::deleteChannelsGroup(quint32 id) @@ -892,9 +882,9 @@ ChannelsGroup* Doc::channelsGroup(quint32 id) const return NULL; } -QList Doc::channelsGroups() const +QList Doc::channelsGroups() const { - QList orderedList; + QList orderedList; for (int i = 0; i < m_orderedGroups.count(); i++) { @@ -918,7 +908,7 @@ quint32 Doc::createChannelsGroupId() * Palettes *********************************************************************/ -bool Doc::addPalette(QLCPalette *palette, quint32 id) +bool Doc::addPalette(QLCPalette* palette, quint32 id) { Q_ASSERT(palette != NULL); @@ -947,7 +937,7 @@ bool Doc::deletePalette(quint32 id) { if (m_palettes.contains(id) == true) { - QLCPalette *palette = m_palettes.take(id); + QLCPalette* palette = m_palettes.take(id); Q_ASSERT(palette != NULL); emit paletteRemoved(id); @@ -963,7 +953,7 @@ bool Doc::deletePalette(quint32 id) } } -QLCPalette *Doc::palette(quint32 id) const +QLCPalette* Doc::palette(quint32 id) const { if (m_palettes.contains(id) == true) return m_palettes[id]; @@ -971,15 +961,14 @@ QLCPalette *Doc::palette(quint32 id) const return NULL; } -QList Doc::palettes() const +QList Doc::palettes() const { return m_palettes.values(); } quint32 Doc::createPaletteId() { - while (m_palettes.contains(m_latestPaletteId) == true || - m_latestPaletteId == FixtureGroup::invalidId()) + while (m_palettes.contains(m_latestPaletteId) == true || m_latestPaletteId == FixtureGroup::invalidId()) { m_latestPaletteId++; } @@ -996,8 +985,7 @@ quint32 Doc::createFunctionId() /* This results in an endless loop if there are UINT_MAX-1 functions. That, however, seems a bit unlikely. Are there even 4294967295-1 functions in total in the whole world? */ - while (m_functions.contains(m_latestFunctionId) == true || - m_latestFunctionId == Fixture::invalidId()) + while (m_functions.contains(m_latestFunctionId) == true || m_latestFunctionId == Fixture::invalidId()) { m_latestFunctionId++; } @@ -1020,16 +1008,13 @@ bool Doc::addFunction(Function* func, quint32 id) else { // Listen to function changes - connect(func, SIGNAL(changed(quint32)), - this, SLOT(slotFunctionChanged(quint32))); + connect(func, SIGNAL(changed(quint32)), this, SLOT(slotFunctionChanged(quint32))); // Listen to function name changes - connect(func, SIGNAL(nameChanged(quint32)), - this, SLOT(slotFunctionNameChanged(quint32))); + connect(func, SIGNAL(nameChanged(quint32)), this, SLOT(slotFunctionNameChanged(quint32))); // Make the function listen to fixture removals - connect(this, SIGNAL(fixtureRemoved(quint32)), - func, SLOT(slotFixtureRemoved(quint32))); + connect(this, SIGNAL(fixtureRemoved(quint32)), func, SLOT(slotFixtureRemoved(quint32))); // Place the function in the map and assign it the new ID m_functions[id] = func; @@ -1041,15 +1026,15 @@ bool Doc::addFunction(Function* func, quint32 id) } } -QList Doc::functions() const +QList Doc::functions() const { return m_functions.values(); } -QList Doc::functionsByType(Function::Type type) const +QList Doc::functionsByType(Function::Type type) const { - QList list; - foreach(Function *f, m_functions) + QList list; + foreach (Function* f, m_functions) { if (f != NULL && f->type() == type) list.append(f); @@ -1057,9 +1042,9 @@ QList Doc::functionsByType(Function::Type type) const return list; } -Function *Doc::functionByName(QString name) +Function* Doc::functionByName(QString name) { - foreach(Function *f, m_functions) + foreach (Function* f, m_functions) { if (f != NULL && f->name() == name) return f; @@ -1101,8 +1086,7 @@ Function* Doc::function(quint32 id) const quint32 Doc::nextFunctionID() { quint32 tmpFID = m_latestFunctionId; - while (m_functions.contains(tmpFID) == true || - tmpFID == Fixture::invalidId()) + while (m_functions.contains(tmpFID) == true || tmpFID == Fixture::invalidId()) { tmpFID++; } @@ -1124,16 +1108,16 @@ QList Doc::getUsage(quint32 fid) { QList usageList; - foreach (Function *f, m_functions) + foreach (Function* f, m_functions) { if (f->id() == fid) continue; - switch(f->type()) + switch (f->type()) { - case Function::CollectionType: + case Function::CollectionType: { - Collection *c = qobject_cast(f); + Collection* c = qobject_cast(f); int pos = c->functions().indexOf(fid); if (pos != -1) { @@ -1142,13 +1126,13 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::ChaserType: + case Function::ChaserType: { - Chaser *c = qobject_cast(f); + Chaser* c = qobject_cast(f); for (int i = 0; i < c->stepsCount(); i++) { - ChaserStep *cs = c->stepAt(i); + ChaserStep* cs = c->stepAt(i); if (cs->fid == fid) { usageList.append(f->id()); @@ -1157,9 +1141,9 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::SequenceType: + case Function::SequenceType: { - Sequence *s = qobject_cast(f); + Sequence* s = qobject_cast(f); if (s->boundSceneID() == fid) { usageList.append(f->id()); @@ -1167,15 +1151,16 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::ScriptType: + case Function::ScriptType: { - Script *s = qobject_cast" - "
" - + tr("Loading project...") + - "
").toUtf8(); + QString("\n\n" + "" + "
" + + tr("Loading project...") + "
") + .toUtf8(); resp->setHeader("Content-Type", "text/html"); resp->setHeader("Content-Length", QString::number(postReply.size())); @@ -184,7 +184,7 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) } else if (reqUrl == "/loadFixture") { - if(m_auth && user.level < SUPER_ADMIN_LEVEL) + if (m_auth && user.level < SUPER_ADMIN_LEVEL) { m_auth->sendUnauthorizedResponse(resp); return; @@ -202,11 +202,14 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) m_doc->fixtureDefCache()->storeFixtureDef(fxName, QString(fixtureXML).toUtf8()); QByteArray postReply = - QString("\n\n" - "").toUtf8(); + QString("\n\n" + "") + .toUtf8(); resp->setHeader("Content-Type", "text/html"); resp->setHeader("Content-Length", QString::number(postReply.size())); @@ -217,7 +220,7 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) } else if (reqUrl == "/config") { - if(m_auth && user.level < SUPER_ADMIN_LEVEL) + if (m_auth && user.level < SUPER_ADMIN_LEVEL) { m_auth->sendUnauthorizedResponse(resp); return; @@ -226,7 +229,7 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) } else if (reqUrl == "/simpleDesk") { - if(m_auth && user.level < SIMPLE_DESK_AND_VC_LEVEL) + if (m_auth && user.level < SIMPLE_DESK_AND_VC_LEVEL) { m_auth->sendUnauthorizedResponse(resp); return; @@ -236,7 +239,7 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) #if defined(Q_WS_X11) || defined(Q_OS_LINUX) else if (reqUrl == "/system") { - if(m_auth && user.level < SUPER_ADMIN_LEVEL) + if (m_auth && user.level < SUPER_ADMIN_LEVEL) { m_auth->sendUnauthorizedResponse(resp); return; @@ -261,22 +264,28 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) else if (reqUrl.endsWith(".css")) { QString clUri = reqUrl.mid(1); - if (sendFile(resp, QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()) - .arg(QDir::separator()).arg(clUri), "text/css") == true) + if (sendFile( + resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/css") == true) return; } else if (reqUrl.endsWith(".js")) { QString clUri = reqUrl.mid(1); - if (sendFile(resp, QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()) - .arg(QDir::separator()).arg(clUri), "text/javascript") == true) + if (sendFile( + resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/javascript") == true) return; } else if (reqUrl.endsWith(".html")) { QString clUri = reqUrl.mid(1); - if (sendFile(resp, QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()) - .arg(QDir::separator()).arg(clUri), "text/html") == true) + if (sendFile( + resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/html") == true) return; } else if (reqUrl != "/") @@ -302,7 +311,7 @@ void WebAccess::slotHandleRequest(QHttpRequest *req, QHttpResponse *resp) return; } -void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) +void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) { if (conn == NULL) return; @@ -315,19 +324,19 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) if (cmdList.isEmpty()) return; - if(cmdList[0] == "QLC+CMD") + if (cmdList[0] == "QLC+CMD") { if (cmdList.count() < 2) return; - if(cmdList[1] == "opMode") + if (cmdList[1] == "opMode") emit toggleDocMode(); return; } else if (cmdList[0] == "QLC+IO") { - if(m_auth && user && user->level < SUPER_ADMIN_LEVEL) + if (m_auth && user && user->level < SUPER_ADMIN_LEVEL) return; if (cmdList.count() < 3) @@ -352,10 +361,11 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (cmdList[1] == "PROFILE") { - InputPatch *inPatch = m_doc->inputOutputMap()->inputPatch(universe); + InputPatch* inPatch = m_doc->inputOutputMap()->inputPatch(universe); if (inPatch != NULL) { - m_doc->inputOutputMap()->setInputPatch(universe, inPatch->pluginName(), "", inPatch->input(), cmdList[3]); + m_doc->inputOutputMap()->setInputPatch(universe, inPatch->pluginName(), "", inPatch->input(), + cmdList[3]); m_doc->inputOutputMap()->saveDefaults(); } } @@ -392,9 +402,9 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; } - else if(cmdList[0] == "QLC+AUTH" && m_auth) + else if (cmdList[0] == "QLC+AUTH" && m_auth) { - if(user && user->level < SUPER_ADMIN_LEVEL) + if (user && user->level < SUPER_ADMIN_LEVEL) return; if (cmdList.at(1) == "ADD_USER") @@ -402,13 +412,13 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) QString username = cmdList.at(2); QString password = cmdList.at(3); int level = cmdList.at(4).toInt(); - if(username.isEmpty() || password.isEmpty()) + if (username.isEmpty() || password.isEmpty()) { QString wsMessage = QString("ALERT|" + tr("Username and password are required fields.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); return; } - if(level <= 0) + if (level <= 0) { QString wsMessage = QString("ALERT|" + tr("User level has to be a positive integer.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); @@ -420,20 +430,20 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) else if (cmdList.at(1) == "DEL_USER") { QString username = cmdList.at(2); - if(! username.isEmpty()) + if (!username.isEmpty()) m_auth->deleteUser(username); } else if (cmdList.at(1) == "SET_USER_LEVEL") { QString username = cmdList.at(2); int level = cmdList.at(3).toInt(); - if(username.isEmpty()) + if (username.isEmpty()) { QString wsMessage = QString("ALERT|" + tr("Username is required.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); return; } - if(level <= 0) + if (level <= 0) { QString wsMessage = QString("ALERT|" + tr("User level has to be a positive integer.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); @@ -445,7 +455,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) else qDebug() << "[webaccess] Command" << cmdList[1] << "not supported!"; - if(! m_auth->savePasswordsFile()) + if (!m_auth->savePasswordsFile()) { QString wsMessage = QString("ALERT|" + tr("Error while saving passwords file.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); @@ -453,16 +463,17 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } } #if defined(Q_WS_X11) || defined(Q_OS_LINUX) - else if(cmdList[0] == "QLC+SYS") + else if (cmdList[0] == "QLC+SYS") { - if(m_auth && user && user->level < SUPER_ADMIN_LEVEL) + if (m_auth && user && user->level < SUPER_ADMIN_LEVEL) return; if (cmdList.at(1) == "NETWORK") { if (m_netConfig->updateNetworkFile(cmdList) == true) { - QString wsMessage = QString("ALERT|" + tr("Network configuration changed. Reboot to apply the changes.")); + QString wsMessage = + QString("ALERT|" + tr("Network configuration changed. Reboot to apply the changes.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); return; } @@ -487,19 +498,19 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (cmdList.at(1) == "REBOOT") { - QProcess *rebootProcess = new QProcess(); + QProcess* rebootProcess = new QProcess(); rebootProcess->start("reboot", QStringList()); } else if (cmdList.at(1) == "HALT") { - QProcess *haltProcess = new QProcess(); + QProcess* haltProcess = new QProcess(); haltProcess->start("halt", QStringList()); } } #endif else if (cmdList[0] == "QLC+API") { - if(m_auth && user && user->level < VC_ONLY_LEVEL) + if (m_auth && user && user->level < VC_ONLY_LEVEL) return; if (cmdList.count() < 2) @@ -525,7 +536,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (apiCmd == "getFunctionsList") { - foreach(Function *f, m_doc->functions()) + foreach (Function* f, m_doc->functions()) wsAPIMessage.append(QString("%1|%2|").arg(f->id()).arg(f->name())); // remove trailing separator wsAPIMessage.truncate(wsAPIMessage.length() - 1); @@ -536,7 +547,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; quint32 fID = cmdList[2].toUInt(); - Function *f = m_doc->function(fID); + Function* f = m_doc->function(fID); if (f != NULL) wsAPIMessage.append(m_doc->function(fID)->typeString()); else @@ -548,7 +559,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; quint32 fID = cmdList[2].toUInt(); - Function *f = m_doc->function(fID); + Function* f = m_doc->function(fID); if (f != NULL) { if (f->isRunning()) @@ -559,14 +570,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) else wsAPIMessage.append(Function::typeToString(Function::Undefined)); } - else if (apiCmd == "setFunctionStatus") - { + else if (apiCmd == "setFunctionStatus") + { if (cmdList.count() < 4) return; quint32 fID = cmdList[2].toUInt(); quint32 newStatus = cmdList[3].toUInt(); - Function *f = m_doc->function(fID); + Function* f = m_doc->function(fID); if (f != NULL) { @@ -579,14 +590,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (apiCmd == "getWidgetsNumber") { - VCFrame *mainFrame = m_vc->contents(); - QList chList = mainFrame->findChildren(); + VCFrame* mainFrame = m_vc->contents(); + QList chList = mainFrame->findChildren(); wsAPIMessage.append(QString::number(chList.count())); } else if (apiCmd == "getWidgetsList") { - VCFrame *mainFrame = m_vc->contents(); - foreach(VCWidget *widget, mainFrame->findChildren()) + VCFrame* mainFrame = m_vc->contents(); + foreach (VCWidget* widget, mainFrame->findChildren()) wsAPIMessage.append(QString("%1|%2|").arg(widget->id()).arg(widget->caption())); // remove trailing separator wsAPIMessage.truncate(wsAPIMessage.length() - 1); @@ -597,7 +608,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; quint32 wID = cmdList[2].toUInt(); - VCWidget *widget = m_vc->widget(wID); + VCWidget* widget = m_vc->widget(wID); if (widget != NULL) wsAPIMessage.append(widget->typeToString(widget->type())); else @@ -609,14 +620,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; quint32 wID = cmdList[2].toUInt(); - VCWidget *widget = m_vc->widget(wID); + VCWidget* widget = m_vc->widget(wID); if (widget != NULL) { - switch(widget->type()) + switch (widget->type()) { - case VCWidget::ButtonWidget: + case VCWidget::ButtonWidget: { - VCButton *button = qobject_cast(widget); + VCButton* button = qobject_cast(widget); if (button->state() == VCButton::Active) wsAPIMessage.append("255"); else if (button->state() == VCButton::Monitoring) @@ -625,17 +636,17 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) wsAPIMessage.append("0"); } break; - case VCWidget::SliderWidget: + case VCWidget::SliderWidget: { - VCSlider *slider = qobject_cast(widget); + VCSlider* slider = qobject_cast(widget); wsAPIMessage.append(QString::number(slider->sliderValue())); } break; - case VCWidget::CueListWidget: + case VCWidget::CueListWidget: { - VCCueList *cue = qobject_cast(widget); + VCCueList* cue = qobject_cast(widget); quint32 chaserID = cue->chaserID(); - Function *f = m_doc->function(chaserID); + Function* f = m_doc->function(chaserID); if (f != NULL && f->isRunning()) wsAPIMessage.append(QString("PLAY|%2|").arg(cue->getCurrentIndex())); else @@ -647,7 +658,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (apiCmd == "getChannelsValues") { - if(m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) + if (m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) return; if (cmdList.count() < 4) @@ -663,7 +674,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) } else if (apiCmd == "sdResetChannel") { - if(m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) + if (m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) return; if (cmdList.count() < 3) @@ -673,28 +684,27 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) m_sd->resetChannel(chNum); wsAPIMessage = "QLC+API|getChannelsValues|"; wsAPIMessage.append(WebAccessSimpleDesk::getChannelsMessage( - m_doc, m_sd, m_sd->getCurrentUniverseIndex(), - (m_sd->getCurrentPage() - 1) * m_sd->getSlidersNumber(), m_sd->getSlidersNumber())); + m_doc, m_sd, m_sd->getCurrentUniverseIndex(), (m_sd->getCurrentPage() - 1) * m_sd->getSlidersNumber(), + m_sd->getSlidersNumber())); } else if (apiCmd == "sdResetUniverse") { - if(m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) + if (m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) return; m_sd->resetUniverse(); wsAPIMessage = "QLC+API|getChannelsValues|"; - wsAPIMessage.append(WebAccessSimpleDesk::getChannelsMessage( - m_doc, m_sd, m_sd->getCurrentUniverseIndex(), - 0, m_sd->getSlidersNumber())); + wsAPIMessage.append(WebAccessSimpleDesk::getChannelsMessage(m_doc, m_sd, m_sd->getCurrentUniverseIndex(), 0, + m_sd->getSlidersNumber())); } - //qDebug() << "Simple desk channels:" << wsAPIMessage; + // qDebug() << "Simple desk channels:" << wsAPIMessage; conn->webSocketWrite(QHttpConnection::TextFrame, wsAPIMessage.toUtf8()); return; } - else if(cmdList[0] == "CH") + else if (cmdList[0] == "CH") { - if(m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) + if (m_auth && user && user->level < SIMPLE_DESK_AND_VC_LEVEL) return; if (cmdList.count() < 3) @@ -706,13 +716,13 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) return; } - else if(cmdList[0] == "POLL") + else if (cmdList[0] == "POLL") return; if (data.contains("|") == false) return; - if(m_auth && user && user->level < VC_ONLY_LEVEL) + if (m_auth && user && user->level < VC_ONLY_LEVEL) return; /** Handle direct widget operations; @@ -720,43 +730,43 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) * followed by specific parameters */ quint32 widgetID = cmdList[0].toUInt(); - VCWidget *widget = m_vc->widget(widgetID); + VCWidget* widget = m_vc->widget(widgetID); uchar value = 0; if (cmdList.count() > 1) value = (uchar)cmdList[1].toInt(); if (widget != NULL) { - switch(widget->type()) + switch (widget->type()) { - case VCWidget::ButtonWidget: + case VCWidget::ButtonWidget: { - VCButton *button = qobject_cast(widget); - if(value) + VCButton* button = qobject_cast(widget); + if (value) button->pressFunction(); else button->releaseFunction(); } break; - case VCWidget::SliderWidget: + case VCWidget::SliderWidget: { - VCSlider *slider = qobject_cast(widget); + VCSlider* slider = qobject_cast(widget); slider->setSliderValue(value, false, true); slider->updateFeedback(); } break; - case VCWidget::AudioTriggersWidget: + case VCWidget::AudioTriggersWidget: { - VCAudioTriggers *triggers = qobject_cast(widget); + VCAudioTriggers* triggers = qobject_cast(widget); triggers->toggleEnableButton(value ? true : false); } break; - case VCWidget::CueListWidget: + case VCWidget::CueListWidget: { if (cmdList.count() < 2) return; - VCCueList *cue = qobject_cast(widget); + VCCueList* cue = qobject_cast(widget); if (cmdList[1] == "PLAY") cue->slotPlayback(); else if (cmdList[1] == "STOP") @@ -769,34 +779,34 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) cue->playCueAtIndex(cmdList[2].toInt()); } break; - case VCWidget::FrameWidget: - case VCWidget::SoloFrameWidget: + case VCWidget::FrameWidget: + case VCWidget::SoloFrameWidget: { - VCFrame *frame = qobject_cast(widget); + VCFrame* frame = qobject_cast(widget); if (cmdList[1] == "NEXT_PG") frame->slotNextPage(); else if (cmdList[1] == "PREV_PG") frame->slotPreviousPage(); } break; - case VCWidget::ClockWidget: + case VCWidget::ClockWidget: { - VCClock *clock = qobject_cast(widget); + VCClock* clock = qobject_cast(widget); if (cmdList[1] == "S") clock->playPauseTimer(); else if (cmdList[1] == "R") clock->resetTimer(); } break; - default: + default: break; } } } -void WebAccess::slotHandleWebSocketClose(QHttpConnection *conn) +void WebAccess::slotHandleWebSocketClose(QHttpConnection* conn) { - if(conn->userData) + if (conn->userData) { WebAccessUser* user = static_cast(conn->userData); delete user; @@ -806,13 +816,13 @@ void WebAccess::slotHandleWebSocketClose(QHttpConnection *conn) m_webSocketsList.removeOne(conn); } -bool WebAccess::sendFile(QHttpResponse *response, QString filename, QString contentType) +bool WebAccess::sendFile(QHttpResponse* response, QString filename, QString contentType) { QFile resFile(filename); if (resFile.open(QIODevice::ReadOnly)) { QByteArray resContent = resFile.readAll(); - //qDebug() << "Resource file length:" << resContent.length(); + // qDebug() << "Resource file length:" << resContent.length(); resFile.close(); response->setHeader("Content-Type", contentType); @@ -830,11 +840,11 @@ bool WebAccess::sendFile(QHttpResponse *response, QString filename, QString cont void WebAccess::sendWebSocketMessage(QByteArray message) { - foreach(QHttpConnection *conn, m_webSocketsList) + foreach (QHttpConnection* conn, m_webSocketsList) conn->webSocketWrite(QHttpConnection::TextFrame, message); } -QString WebAccess::getWidgetBackgroundImage(VCWidget *widget) +QString WebAccess::getWidgetBackgroundImage(VCWidget* widget) { if (widget == NULL || widget->backgroundImage().isEmpty()) return QString(); @@ -842,29 +852,37 @@ QString WebAccess::getWidgetBackgroundImage(VCWidget *widget) QString str = QString("background-image: url(%1); ").arg(widget->backgroundImage()); str += "background-position: center; "; str += "background-repeat: no-repeat; "; - //str += "background-size: cover; "; + // str += "background-size: cover; "; return str; } -QString WebAccess::getWidgetHTML(VCWidget *widget) +QString WebAccess::getWidgetHTML(VCWidget* widget) { QString str = "
x()) + "px; " - "top: " + QString::number(widget->y()) + "px; " - "width: " + QString::number(widget->width()) + "px; " - "height: " + QString::number(widget->height()) + "px; " - "background-color: " + widget->backgroundColor().name() + ";" + - getWidgetBackgroundImage(widget) + "\">\n"; - - str += tr("Widget not supported (yet) for web access") + "
\n"; + "left: " + + QString::number(widget->x()) + + "px; " + "top: " + + QString::number(widget->y()) + + "px; " + "width: " + + QString::number(widget->width()) + + "px; " + "height: " + + QString::number(widget->height()) + + "px; " + "background-color: " + + widget->backgroundColor().name() + ";" + getWidgetBackgroundImage(widget) + "\">\n"; + + str += tr("Widget not supported (yet) for web access") + "\n"; return str; } void WebAccess::slotFramePageChanged(int pageNum) { - VCWidget *frame = qobject_cast(sender()); + VCWidget* frame = qobject_cast(sender()); if (frame == NULL) return; @@ -874,32 +892,36 @@ void WebAccess::slotFramePageChanged(int pageNum) sendWebSocketMessage(ba); } -QString WebAccess::getFrameHTML(VCFrame *frame) +QString WebAccess::getFrameHTML(VCFrame* frame) { QColor border(90, 90, 90); QSize origSize = frame->originalSize(); int w = frame->isCollapsed() ? 200 : origSize.width(); int h = frame->isCollapsed() ? 36 : origSize.height(); - QString str = "
id()) + "\" " - "style=\"left: " + QString::number(frame->x()) + - "px; top: " + QString::number(frame->y()) + "px; width: " + QString::number(w) + - "px; height: " + QString::number(h) + "px; " - "background-color: " + frame->backgroundColor().name() + "; " + - getWidgetBackgroundImage(frame) + - "border: 1px solid " + border.name() + ";\">\n"; + QString str = "
id()) + + "\" " + "style=\"left: " + + QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + + "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + + "px; " + "background-color: " + + frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + + border.name() + ";\">\n"; str += getChildrenHTML(frame, frame->totalPagesNumber(), frame->currentPage()); if (frame->isHeaderVisible()) { - str += "id()) + ");\">\n"; - str += "
foregroundColor().name() + ";\">
" + frame->caption() + "
\n"; + str += "
foregroundColor().name() + + ";\">
" + frame->caption() + "
\n"; m_JScode += "framesWidth[" + QString::number(frame->id()) + "] = " + QString::number(origSize.width()) + ";\n"; - m_JScode += "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; + m_JScode += + "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; if (frame->multipageMode()) { @@ -908,17 +930,19 @@ QString WebAccess::getFrameHTML(VCFrame *frame) str += "id()) + ");\">"; str += ""; - str += "
id()) + "Page\">"; - str += QString ("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; + str += "
id()) + + "Page\">"; + str += QString("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; str += "id()) + ");\">"; str += "\n"; str += "
\n"; - m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + "] = " + QString::number(frame->currentPage()) + ";\n"; - m_JScode += "framesTotalPages[" + QString::number(frame->id()) + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; - connect(frame, SIGNAL(pageChanged(int)), - this, SLOT(slotFramePageChanged(int))); + m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + + "] = " + QString::number(frame->currentPage()) + ";\n"; + m_JScode += "framesTotalPages[" + QString::number(frame->id()) + + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; + connect(frame, SIGNAL(pageChanged(int)), this, SLOT(slotFramePageChanged(int))); } } @@ -927,32 +951,36 @@ QString WebAccess::getFrameHTML(VCFrame *frame) return str; } -QString WebAccess::getSoloFrameHTML(VCSoloFrame *frame) +QString WebAccess::getSoloFrameHTML(VCSoloFrame* frame) { QColor border(255, 0, 0); QSize origSize = frame->originalSize(); int w = frame->isCollapsed() ? 200 : origSize.width(); int h = frame->isCollapsed() ? 36 : origSize.height(); - QString str = "
id()) + "\" " - "style=\"left: " + QString::number(frame->x()) + - "px; top: " + QString::number(frame->y()) + "px; width: " + QString::number(w) + - "px; height: " + QString::number(h) + "px; " - "background-color: " + frame->backgroundColor().name() + "; " + - getWidgetBackgroundImage(frame) + - "border: 1px solid " + border.name() + ";\">\n"; + QString str = "
id()) + + "\" " + "style=\"left: " + + QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + + "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + + "px; " + "background-color: " + + frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + + border.name() + ";\">\n"; str += getChildrenHTML(frame, frame->totalPagesNumber(), frame->currentPage()); if (frame->isHeaderVisible()) { - str += "id()) + ");\">\n"; - str += "
foregroundColor().name() + ";\">
" + frame->caption() + "
\n"; + str += "
foregroundColor().name() + + ";\">
" + frame->caption() + "
\n"; m_JScode += "framesWidth[" + QString::number(frame->id()) + "] = " + QString::number(origSize.width()) + ";\n"; - m_JScode += "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; + m_JScode += + "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; if (frame->multipageMode()) { @@ -961,17 +989,19 @@ QString WebAccess::getSoloFrameHTML(VCSoloFrame *frame) str += "id()) + ");\">"; str += ""; - str += "
id()) + "Page\">"; - str += QString ("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; + str += "
id()) + + "Page\">"; + str += QString("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; str += "id()) + ");\">"; str += "\n"; str += "
\n"; - m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + "] = " + QString::number(frame->currentPage()) + ";\n"; - m_JScode += "framesTotalPages[" + QString::number(frame->id()) + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; - connect(frame, SIGNAL(pageChanged(int)), - this, SLOT(slotFramePageChanged(int))); + m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + + "] = " + QString::number(frame->currentPage()) + ";\n"; + m_JScode += "framesTotalPages[" + QString::number(frame->id()) + + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; + connect(frame, SIGNAL(pageChanged(int)), this, SLOT(slotFramePageChanged(int))); } } @@ -982,7 +1012,7 @@ QString WebAccess::getSoloFrameHTML(VCSoloFrame *frame) void WebAccess::slotButtonStateChanged(int state) { - VCButton *btn = qobject_cast(sender()); + VCButton* btn = qobject_cast(sender()); if (btn == NULL) return; @@ -999,7 +1029,7 @@ void WebAccess::slotButtonStateChanged(int state) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getButtonHTML(VCButton *btn) +QString WebAccess::getButtonHTML(VCButton* btn) { QString onCSS = ""; if (btn->state() == VCButton::Active) @@ -1008,29 +1038,40 @@ QString WebAccess::getButtonHTML(VCButton *btn) onCSS = "border: 3px solid #FFAA00;"; QString str = "\n"; - - connect(btn, SIGNAL(stateChanged(int)), - this, SLOT(slotButtonStateChanged(int))); + "left: " + + QString::number(btn->x()) + + "px; " + "top: " + + QString::number(btn->y()) + "px;\">\n"; + str += "id()) + + "\" " + "href=\"javascript:void(0);\" " + "onmousedown=\"buttonPress(" + + QString::number(btn->id()) + + ");\" " + "onmouseup=\"buttonRelease(" + + QString::number(btn->id()) + + ");\" " + "style=\"" + "width: " + + QString::number(btn->width()) + + "px; " + "height: " + + QString::number(btn->height()) + + "px; " + "color: " + + btn->foregroundColor().name() + "; " + getWidgetBackgroundImage(btn) + + "background-color: " + btn->backgroundColor().name() + "; " + onCSS + "\">" + btn->caption() + + "\n
\n"; + + connect(btn, SIGNAL(stateChanged(int)), this, SLOT(slotButtonStateChanged(int))); return str; } void WebAccess::slotSliderValueChanged(QString val) { - VCSlider *slider = qobject_cast(sender()); + VCSlider* slider = qobject_cast(sender()); if (slider == NULL) return; @@ -1040,67 +1081,95 @@ void WebAccess::slotSliderValueChanged(QString val) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getSliderHTML(VCSlider *slider) +QString WebAccess::getSliderHTML(VCSlider* slider) { QString slID = QString::number(slider->id()); QString str = "
x()) + "px; " - "top: " + QString::number(slider->y()) + "px; " - "width: " + QString::number(slider->width()) + "px; " - "height: " + QString::number(slider->height()) + "px; " - "background-color: " + slider->backgroundColor().name() + ";" + - getWidgetBackgroundImage(slider) + "\">\n"; - - str += "
" + - slider->topLabelText() + "
\n"; - - str += "height() - 50) + "px; " - "margin-top: " + QString::number(slider->height() - 50) + "px; " - "margin-left: " + QString::number(slider->width() / 2) + "px;\" "; + "left: " + + QString::number(slider->x()) + + "px; " + "top: " + + QString::number(slider->y()) + + "px; " + "width: " + + QString::number(slider->width()) + + "px; " + "height: " + + QString::number(slider->height()) + + "px; " + "background-color: " + + slider->backgroundColor().name() + ";" + getWidgetBackgroundImage(slider) + "\">\n"; + + str += "
" + + slider->topLabelText() + "
\n"; + + str += "height() - 50) + + "px; " + "margin-top: " + + QString::number(slider->height() - 50) + + "px; " + "margin-left: " + + QString::number(slider->width() / 2) + "px;\" "; if (slider->sliderMode() == VCSlider::Level) str += "min=\"" + QString::number(slider->levelLowLimit()) + "\" max=\"" + - QString::number(slider->levelHighLimit()) + "\" "; + QString::number(slider->levelHighLimit()) + "\" "; else str += "min=\"0\" max=\"255\" "; str += "step=\"1\" value=\"" + QString::number(slider->sliderValue()) + "\">\n"; - str += "
" + - slider->caption() + "
\n" - "
\n"; + str += "
" + + slider->caption() + + "
\n" + "
\n"; - connect(slider, SIGNAL(valueChanged(QString)), - this, SLOT(slotSliderValueChanged(QString))); + connect(slider, SIGNAL(valueChanged(QString)), this, SLOT(slotSliderValueChanged(QString))); return str; } -QString WebAccess::getLabelHTML(VCLabel *label) +QString WebAccess::getLabelHTML(VCLabel* label) { QString str = "
x()) + "px; " - "top: " + QString::number(label->y()) + "px;\">\n"; - str += "
width()) + "px; " - "height: " + QString::number(label->height()) + "px; " - "color: " + label->foregroundColor().name() + "; " - "background-color: " + label->backgroundColor().name() + "; " + - getWidgetBackgroundImage(label) + "\">" + - label->caption() + "
\n
\n"; + "left: " + + QString::number(label->x()) + + "px; " + "top: " + + QString::number(label->y()) + "px;\">\n"; + str += "
width()) + + "px; " + "height: " + + QString::number(label->height()) + + "px; " + "color: " + + label->foregroundColor().name() + + "; " + "background-color: " + + label->backgroundColor().name() + "; " + getWidgetBackgroundImage(label) + "\">" + label->caption() + + "
\n\n"; return str; } void WebAccess::slotAudioTriggersToggled(bool toggle) { - VCAudioTriggers *triggers = qobject_cast(sender()); + VCAudioTriggers* triggers = qobject_cast(sender()); if (triggers == NULL) return; @@ -1111,36 +1180,41 @@ void WebAccess::slotAudioTriggersToggled(bool toggle) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getAudioTriggersHTML(VCAudioTriggers *triggers) +QString WebAccess::getAudioTriggersHTML(VCAudioTriggers* triggers) { QString str = "
x()) + - "px; top: " + QString::number(triggers->y()) + "px; width: " + - QString::number(triggers->width()) + - "px; height: " + QString::number(triggers->height()) + "px; " - "background-color: " + triggers->backgroundColor().name() + ";\">\n"; + "px; top: " + QString::number(triggers->y()) + "px; width: " + QString::number(triggers->width()) + + "px; height: " + QString::number(triggers->height()) + + "px; " + "background-color: " + + triggers->backgroundColor().name() + ";\">\n"; - str += "
foregroundColor().name() + "\">" + triggers->caption() + "
\n"; + str += "
foregroundColor().name() + "\">" + + triggers->caption() + "
\n"; str += "
\n"; - connect(triggers, SIGNAL(captureEnabled(bool)), - this, SLOT(slotAudioTriggersToggled(bool))); + connect(triggers, SIGNAL(captureEnabled(bool)), this, SLOT(slotAudioTriggersToggled(bool))); return str; } void WebAccess::slotCueIndexChanged(int idx) { - VCCueList *cue = qobject_cast(sender()); + VCCueList* cue = qobject_cast(sender()); if (cue == NULL) return; @@ -1149,14 +1223,16 @@ void WebAccess::slotCueIndexChanged(int idx) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getCueListHTML(VCCueList *cue) +QString WebAccess::getCueListHTML(VCCueList* cue) { - QString str = "
id()) + "\" " - "class=\"vccuelist\" style=\"left: " + QString::number(cue->x()) + - "px; top: " + QString::number(cue->y()) + "px; width: " + - QString::number(cue->width()) + - "px; height: " + QString::number(cue->height()) + "px; " - "background-color: " + cue->backgroundColor().name() + ";\">\n"; + QString str = "
id()) + + "\" " + "class=\"vccuelist\" style=\"left: " + + QString::number(cue->x()) + "px; top: " + QString::number(cue->y()) + + "px; width: " + QString::number(cue->width()) + "px; height: " + QString::number(cue->height()) + + "px; " + "background-color: " + + cue->backgroundColor().name() + ";\">\n"; str += "
height() - 34) + "px; overflow: scroll;\" >\n"; str += "\n"; @@ -1165,18 +1241,22 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; str += ""; str += "\n"; - Chaser *chaser = cue->chaser(); - Doc *doc = m_vc->getDoc(); + Chaser* chaser = cue->chaser(); + Doc* doc = m_vc->getDoc(); if (chaser != NULL) { for (int i = 0; i < chaser->stepsCount(); i++) { QString stepID = QString::number(cue->id()) + "_" + QString::number(i); - str += "id()) + ", " + QString::number(i) + ");\" " - "onmouseover=\"this.style.backgroundColor='#CCD9FF';\" " - "onmouseout=\"checkMouseOut(" + QString::number(cue->id()) + ", " + QString::number(i) + ");\">\n"; - ChaserStep *step = chaser->stepAt(i); + str += "id()) + ", " + QString::number(i) + + ");\" " + "onmouseover=\"this.style.backgroundColor='#CCD9FF';\" " + "onmouseout=\"checkMouseOut(" + + QString::number(cue->id()) + ", " + QString::number(i) + ");\">\n"; + ChaserStep* step = chaser->stepAt(i); str += ""; Function* function = doc->function(step->fid); if (function != NULL) @@ -1185,7 +1265,7 @@ QString WebAccess::getCueListHTML(VCCueList *cue) switch (chaser->fadeInMode()) { - case Chaser::Common: + case Chaser::Common: { if (chaser->fadeInSpeed() == Function::infiniteSpeed()) str += ""; @@ -1193,7 +1273,7 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - case Chaser::PerStep: + case Chaser::PerStep: { if (step->fadeIn == Function::infiniteSpeed()) str += ""; @@ -1201,18 +1281,18 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - default: - case Chaser::Default: - str += ""; + default: + case Chaser::Default: + str += ""; } - //if (step.hold != 0) - // str += ""; - //else str += ""; + // if (step.hold != 0) + // str += ""; + // else str += ""; switch (chaser->fadeOutMode()) { - case Chaser::Common: + case Chaser::Common: { if (chaser->fadeOutSpeed() == Function::infiniteSpeed()) str += ""; @@ -1220,7 +1300,7 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - case Chaser::PerStep: + case Chaser::PerStep: { if (step->fadeOut == Function::infiniteSpeed()) str += ""; @@ -1228,14 +1308,14 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - default: - case Chaser::Default: - str += ""; + default: + case Chaser::Default: + str += ""; } switch (chaser->durationMode()) { - case Chaser::Common: + case Chaser::Common: { if (chaser->duration() == Function::infiniteSpeed()) str += ""; @@ -1243,7 +1323,7 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - case Chaser::PerStep: + case Chaser::PerStep: { if (step->fadeOut == Function::infiniteSpeed()) str += ""; @@ -1251,9 +1331,9 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += ""; } break; - default: - case Chaser::Default: - str += ""; + default: + case Chaser::Default: + str += ""; } str += "\n"; @@ -1282,15 +1362,14 @@ QString WebAccess::getCueListHTML(VCCueList *cue) str += "\n"; - connect(cue, SIGNAL(stepChanged(int)), - this, SLOT(slotCueIndexChanged(int))); + connect(cue, SIGNAL(stepChanged(int)), this, SLOT(slotCueIndexChanged(int))); return str; } void WebAccess::slotClockTimeChanged(quint32 time) { - VCClock *clock = qobject_cast(sender()); + VCClock* clock = qobject_cast(sender()); if (clock == NULL) return; @@ -1298,33 +1377,39 @@ void WebAccess::slotClockTimeChanged(quint32 time) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getClockHTML(VCClock *clock) +QString WebAccess::getClockHTML(VCClock* clock) { QString str = "
x()) + "px; " - "top: " + QString::number(clock->y()) + "px;\">\n"; - str += "id()) + "\" class=\"vclabel "; - - if (clock->clockType() == VCClock::Stopwatch || - clock->clockType() == VCClock::Countdown) + "left: " + + QString::number(clock->x()) + + "px; " + "top: " + + QString::number(clock->y()) + "px;\">\n"; + str += "id()) + "\" class=\"vclabel "; + + if (clock->clockType() == VCClock::Stopwatch || clock->clockType() == VCClock::Countdown) { str += "vcclockcount\" href=\"javascript:controlWatch("; str += QString::number(clock->id()) + ", 'S')\" "; str += "oncontextmenu=\"javascript:controlWatch("; str += QString::number(clock->id()) + ", 'R'); return false;\""; - connect(clock, SIGNAL(timeChanged(quint32)), - this, SLOT(slotClockTimeChanged(quint32))); + connect(clock, SIGNAL(timeChanged(quint32)), this, SLOT(slotClockTimeChanged(quint32))); } else { str += "vcclock\" href=\"javascript:void(0)\""; } - str += "style=\"width: " + QString::number(clock->width()) + "px; " - "height: " + QString::number(clock->height()) + "px; " - "color: " + clock->foregroundColor().name() + "; " - "background-color: " + clock->backgroundColor().name() + ";" + - getWidgetBackgroundImage(clock) + "\">"; + str += "style=\"width: " + QString::number(clock->width()) + + "px; " + "height: " + + QString::number(clock->height()) + + "px; " + "color: " + + clock->foregroundColor().name() + + "; " + "background-color: " + + clock->backgroundColor().name() + ";" + getWidgetBackgroundImage(clock) + "\">"; if (clock->clockType() == VCClock::Stopwatch) @@ -1333,9 +1418,10 @@ QString WebAccess::getClockHTML(VCClock *clock) } else if (clock->clockType() == VCClock::Countdown) { - QString curTime = QString("%1:%2:%3").arg(clock->getHours(), 2, 10, QChar('0')) - .arg(clock->getMinutes(), 2, 10, QChar('0')) - .arg(clock->getSeconds(), 2, 10, QChar('0')); + QString curTime = QString("%1:%2:%3") + .arg(clock->getHours(), 2, 10, QChar('0')) + .arg(clock->getMinutes(), 2, 10, QChar('0')) + .arg(clock->getSeconds(), 2, 10, QChar('0')); str += curTime; } @@ -1345,14 +1431,14 @@ QString WebAccess::getClockHTML(VCClock *clock) return str; } -QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPageIdx) +QString WebAccess::getChildrenHTML(VCWidget* frame, int pagesNum, int currentPageIdx) { if (frame == NULL) return QString(); QString unifiedHTML; QStringList pagesHTML; - VCFrame *lframe = qobject_cast(frame); + VCFrame* lframe = qobject_cast(frame); if (lframe == NULL) return ""; @@ -1369,11 +1455,11 @@ QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPag } } - QList chList = frame->findChildren(); + QList chList = frame->findChildren(); - qDebug () << "getChildrenHTML: found " << chList.count() << " children"; + qDebug() << "getChildrenHTML: found " << chList.count() << " children"; - foreach (VCWidget *widget, chList) + foreach (VCWidget* widget, chList) { if (widget->parentWidget() != frame) continue; @@ -1389,32 +1475,32 @@ QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPag switch (widget->type()) { - case VCWidget::FrameWidget: - str = getFrameHTML(qobject_cast(widget)); + case VCWidget::FrameWidget: + str = getFrameHTML(qobject_cast(widget)); break; - case VCWidget::SoloFrameWidget: - str = getSoloFrameHTML(qobject_cast(widget)); + case VCWidget::SoloFrameWidget: + str = getSoloFrameHTML(qobject_cast(widget)); break; - case VCWidget::ButtonWidget: - str = getButtonHTML(qobject_cast(widget)); + case VCWidget::ButtonWidget: + str = getButtonHTML(qobject_cast(widget)); break; - case VCWidget::SliderWidget: - str = getSliderHTML(qobject_cast(widget)); + case VCWidget::SliderWidget: + str = getSliderHTML(qobject_cast(widget)); break; - case VCWidget::LabelWidget: - str = getLabelHTML(qobject_cast(widget)); + case VCWidget::LabelWidget: + str = getLabelHTML(qobject_cast(widget)); break; - case VCWidget::AudioTriggersWidget: - str = getAudioTriggersHTML(qobject_cast(widget)); + case VCWidget::AudioTriggersWidget: + str = getAudioTriggersHTML(qobject_cast(widget)); break; - case VCWidget::CueListWidget: - str = getCueListHTML(qobject_cast(widget)); + case VCWidget::CueListWidget: + str = getCueListHTML(qobject_cast(widget)); break; - case VCWidget::ClockWidget: - str = getClockHTML(qobject_cast(widget)); + case VCWidget::ClockWidget: + str = getClockHTML(qobject_cast(widget)); break; - default: - str = getWidgetHTML(widget); + default: + str = getWidgetHTML(widget); break; } if (lframe->multipageMode() == true && pagesNum > 0) @@ -1432,7 +1518,7 @@ QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPag if (pagesNum > 0) { - for(int i = 0; i < pagesHTML.count(); i++) + for (int i = 0; i < pagesHTML.count(); i++) { unifiedHTML += pagesHTML.at(i); unifiedHTML += "
\n"; @@ -1449,29 +1535,39 @@ QString WebAccess::getVCHTML() "\n" "\n"; m_JScode += "\n"; - QString m_CSScode = - "\n" - "\n"; + QString m_CSScode = "\n" + "\n"; QString extraButtons = ""; if (QLCFile::hasWindowManager() == false) @@ -329,21 +338,24 @@ QString WebAccessConfiguration::getHTML(Doc *doc, WebAccessAuth *auth) "" "
\n" - "" + tr("Back") + "\n" + - extraButtons + - "
" + QString(APPNAME) + " " + QString(APPVERSION) + "
" + "" + + tr("Back") + "\n" + extraButtons + "
" + QString(APPNAME) + " " + + QString(APPVERSION) + + "
" "
\n"; // ********************* IO mapping *********************** bodyHTML += "
\n"; - bodyHTML += "
"; + bodyHTML += + "
"; bodyHTML += tr("Universes configuration") + "

\n"; bodyHTML += getIOConfigHTML(doc); bodyHTML += "
"; // ********************* audio devices ******************** bodyHTML += "
\n"; - bodyHTML += "
"; + bodyHTML += + "
"; bodyHTML += tr("Audio configuration") + "

\n"; bodyHTML += getAudioConfigHTML(doc); bodyHTML += "
"; @@ -351,7 +363,8 @@ QString WebAccessConfiguration::getHTML(Doc *doc, WebAccessAuth *auth) // **************** User loaded fixtures ****************** bodyHTML += "
\n"; - bodyHTML += "
"; + bodyHTML += + "
"; bodyHTML += tr("User loaded fixtures") + "

\n"; bodyHTML += getUserFixturesConfigHTML(); bodyHTML += "
"; @@ -360,7 +373,8 @@ QString WebAccessConfiguration::getHTML(Doc *doc, WebAccessAuth *auth) if (auth) { bodyHTML += "
\n"; - bodyHTML += "
"; + bodyHTML += + "
"; bodyHTML += tr("Authorized users") + "

\n"; bodyHTML += getPasswordsConfigHTML(auth); bodyHTML += "
"; diff --git a/webaccess/src/webaccessconfiguration.h b/webaccess/src/webaccessconfiguration.h index 366dca2c92..bae31460dd 100644 --- a/webaccess/src/webaccessconfiguration.h +++ b/webaccess/src/webaccessconfiguration.h @@ -31,11 +31,11 @@ class WebAccessConfiguration : public QObject public: WebAccessConfiguration(); - static QString getIOConfigHTML(Doc *doc); - static QString getAudioConfigHTML(Doc *doc); + static QString getIOConfigHTML(Doc* doc); + static QString getAudioConfigHTML(Doc* doc); static QString getUserFixturesConfigHTML(); - static QString getPasswordsConfigHTML(WebAccessAuth *auth); - static QString getHTML(Doc *doc, WebAccessAuth *auth); + static QString getPasswordsConfigHTML(WebAccessAuth* auth); + static QString getHTML(Doc* doc, WebAccessAuth* auth); }; #endif // WEBACCESSCONFIGURATION_H diff --git a/webaccess/src/webaccessnetwork.cpp b/webaccess/src/webaccessnetwork.cpp index fdcb50d8b0..47746916bb 100644 --- a/webaccess/src/webaccessnetwork.cpp +++ b/webaccess/src/webaccessnetwork.cpp @@ -31,18 +31,18 @@ #define DHCPCD_CONF_FILE "/etc/dhcpcd.conf" #define WPA_SUPP_CONF_FILE "/etc/wpa_supplicant/wpa_supplicant.conf" -WebAccessNetwork::WebAccessNetwork(QObject *parent) : - QObject(parent) +WebAccessNetwork::WebAccessNetwork(QObject* parent) + : QObject(parent) { } -void WebAccessNetwork::resetInterface(InterfaceInfo *iface) +void WebAccessNetwork::resetInterface(InterfaceInfo* iface) { iface->name = ""; iface->isStatic = false; iface->isWireless = false; iface->address = ""; - iface->netmask = ""; + iface->netmask = ""; iface->gateway = ""; iface->enabled = false; iface->wpaConfFile = ""; @@ -89,7 +89,7 @@ void WebAccessNetwork::appendInterface(InterfaceInfo iface) m_interfaces.append(iface); } -QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo *iface) +QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo* iface) { QString dhcpChk = iface->isStatic ? QString() : QString("checked"); QString staticChk = iface->isStatic ? QString("checked") : QString(); @@ -103,27 +103,29 @@ QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo *iface) html += "
\n"; if (iface->isWireless) { - html += tr("Access point name (SSID): ") + "name + "SSID\" size=\"15\" value=\"" + iface->ssid + "\">
\n"; - html += tr("WPA-PSK Password: ") + "name + "WPAPSK\" size=\"15\" value=\"" + iface->wpaPass + "\">
\n"; + html += tr("Access point name (SSID): ") + "name + + "SSID\" size=\"15\" value=\"" + iface->ssid + "\">
\n"; + html += tr("WPA-PSK Password: ") + "name + + "WPAPSK\" size=\"15\" value=\"" + iface->wpaPass + "\">
\n"; } /** IP mode radio buttons */ - html += "name + "', false);\" value=\"dhcp\" " + dhcpChk + ">" + tr("Dynamic (DHCP)") + "
\n"; - html += "name + "', true);\" value=\"static\" " + staticChk + ">" + tr("Static") + "
\n"; + html += "name + + "', false);\" value=\"dhcp\" " + dhcpChk + ">" + tr("Dynamic (DHCP)") + "
\n"; + html += "name + + "', true);\" value=\"static\" " + staticChk + ">" + tr("Static") + "
\n"; /** Static IP fields */ - html += "
name + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; - html += tr("IP Address: ") + "name + "IPaddr\" size=\"15\" value=\"" + iface->address + "\">
\n"; - html += tr("Netmask: ") + "name + "Netmask\" size=\"15\" value=\"" + iface->netmask + "\">
\n"; - html += tr("Gateway: ") + "name + "Gateway\" value=\"" + iface->gateway + "\">
\n"; + html += + "
name + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; + html += tr("IP Address: ") + "name + "IPaddr\" size=\"15\" value=\"" + + iface->address + "\">
\n"; + html += tr("Netmask: ") + "name + "Netmask\" size=\"15\" value=\"" + + iface->netmask + "\">
\n"; + html += tr("Gateway: ") + "name + "Gateway\" value=\"" + + iface->gateway + "\">
\n"; html += "
\n"; - html += "name + "');\" >\n"; + html += "name + + "');\" >\n"; html += "
"; return html; @@ -149,7 +151,7 @@ QString WebAccessNetwork::getNetworkHTML() // 1- gather the active network interface names with Qt QStringList systemDevs; - foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces()) + foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) { qDebug() << "Qt detected interface:" << interface.name(); if (interface.name() != "lo") @@ -324,8 +326,12 @@ QString WebAccessNetwork::getHTML() "\n"; QString bodyHTML = "
\n" - "" + tr("Back") + "\n" - "
" + QString(APPNAME) + " " + QString(APPVERSION) + "
\n" + "" + + tr("Back") + + "\n" + "
" + + QString(APPNAME) + " " + QString(APPVERSION) + + "
\n" "
\n"; bodyHTML += "
\n"; - bodyHTML += "" + tr("Reboot") + "\n"; - bodyHTML += "" + tr("Shutdown") + "\n"; + bodyHTML += + "" + + tr("Reboot") + "\n"; + bodyHTML += + "" + + tr("Shutdown") + "\n"; bodyHTML += "
\n"; QString str = HTML_HEADER + m_JScode + m_CSScode + "\n\n" + bodyHTML + "\n"; @@ -379,7 +389,7 @@ bool WebAccessNetwork::updateNetworkFile(QStringList cmdList) return false; } -void WebAccessNetwork::parseWPAConfFile(InterfaceInfo *iface) +void WebAccessNetwork::parseWPAConfFile(InterfaceInfo* iface) { bool inNetwork = false; @@ -418,7 +428,7 @@ void WebAccessNetwork::parseWPAConfFile(InterfaceInfo *iface) QString param = tokens.at(0); QString value = tokens.at(1); - //qDebug() << "Tokens:"<< param << value; + // qDebug() << "Tokens:"<< param << value; if (param == "ssid") iface->ssid = value.remove(QChar('"')); @@ -426,7 +436,6 @@ void WebAccessNetwork::parseWPAConfFile(InterfaceInfo *iface) iface->wpaPass = value.remove(QChar('"')); } } - } wpaConfFile.close(); @@ -454,7 +463,7 @@ bool WebAccessNetwork::writeNetworkFile() { if (dhcpcdCacheWritten == false && m_dhcpcdConfCache.isEmpty() == false) { - foreach(QString line, m_dhcpcdConfCache) + foreach (QString line, m_dhcpcdConfCache) { dhcpcdFile.write(line.toLatin1()); dhcpcdFile.write("\n"); @@ -466,7 +475,9 @@ bool WebAccessNetwork::writeNetworkFile() qDebug() << "[writeNetworkFile] ERROR. No dhcpcd cache found!"; dhcpcdFile.write((QString("interface %1\n").arg(iface.name)).toLatin1()); - dhcpcdFile.write((QString("static ip_address=%1/%2\n").arg(iface.address).arg(stringToNetmask(iface.netmask))).toLatin1()); + dhcpcdFile.write( + (QString("static ip_address=%1/%2\n").arg(iface.address).arg(stringToNetmask(iface.netmask))) + .toLatin1()); dhcpcdFile.write((QString("static routers=%1\n").arg(iface.gateway)).toLatin1()); if (iface.dns1.isEmpty() == false) dhcpcdFile.write((QString("static domain_name_servers=%1\n\n").arg(iface.dns1)).toLatin1()); @@ -583,4 +594,3 @@ int WebAccessNetwork::stringToNetmask(QString mask) return nMask; } - diff --git a/webaccess/src/webaccessnetwork.h b/webaccess/src/webaccessnetwork.h index cc1883f879..240d03697f 100644 --- a/webaccess/src/webaccessnetwork.h +++ b/webaccess/src/webaccessnetwork.h @@ -38,27 +38,27 @@ typedef struct QString wpaPass; } InterfaceInfo; -class WebAccessNetwork: public QObject +class WebAccessNetwork : public QObject { public: - WebAccessNetwork(QObject *parent = 0); + WebAccessNetwork(QObject* parent = 0); - void resetInterface(InterfaceInfo *iface); + void resetInterface(InterfaceInfo* iface); void appendInterface(InterfaceInfo iface); - QString getInterfaceHTML(InterfaceInfo *iface); + QString getInterfaceHTML(InterfaceInfo* iface); QString getNetworkHTML(); QString getHTML(); bool updateNetworkFile(QStringList cmdList); protected: - void parseWPAConfFile(InterfaceInfo *iface); + void parseWPAConfFile(InterfaceInfo* iface); bool writeNetworkFile(); QString netmaskToString(int mask); int stringToNetmask(QString mask); protected: - QListm_interfaces; + QList m_interfaces; QStringList m_dhcpcdConfCache; }; diff --git a/webaccess/src/webaccesssimpledesk.cpp b/webaccess/src/webaccesssimpledesk.cpp index 53f0751f29..7ddc968e18 100644 --- a/webaccess/src/webaccesssimpledesk.cpp +++ b/webaccess/src/webaccesssimpledesk.cpp @@ -26,12 +26,12 @@ #include "qlcconfig.h" #include "doc.h" -WebAccessSimpleDesk::WebAccessSimpleDesk(QObject *parent) : - QObject(parent) +WebAccessSimpleDesk::WebAccessSimpleDesk(QObject* parent) + : QObject(parent) { } -QString WebAccessSimpleDesk::getHTML(Doc *doc, SimpleDesk *sd) +QString WebAccessSimpleDesk::getHTML(Doc* doc, SimpleDesk* sd) { int uni = sd->getCurrentUniverseIndex() + 1; int page = sd->getCurrentPage(); @@ -47,27 +47,36 @@ QString WebAccessSimpleDesk::getHTML(Doc *doc, SimpleDesk *sd) CSScode += "\n"; QString bodyHTML = "
\n" - "" + tr("Back") + "\n" + "" + + tr("Back") + + "\n" "DMX Keypad\n" - "
" + QString(APPNAME) + " " + QString(APPVERSION) + "
" + "
" + + QString(APPNAME) + " " + QString(APPVERSION) + + "
" "
\n"; bodyHTML += "
\n"; - bodyHTML += tr("Page") + " \n" - "\n"; + bodyHTML += tr("Page") + + " \n" + "\n"; bodyHTML += "
"; bodyHTML += "
" + - QString::number(page) + "
\n"; + QString::number(page) + "
\n"; bodyHTML += "\n" - "\n"; + "\n"; bodyHTML += "\n" - "\n"; + "\n"; - bodyHTML += "
" + tr("Universe") + "
\n" + bodyHTML += "
" + tr("Universe") + + "
\n" "
\n" "
"); if (mode != NULL) { @@ -178,8 +178,7 @@ QString ChannelsGroup::status(Doc* doc) const } else { - info += - chInfo.arg(fixture->name()).arg(value.channel + 1).arg(QString(tr("Channel %1")).arg(value.channel)); + info += chInfo.arg(fixture->name()).arg(value.channel + 1).arg(QString(tr("Channel %1")).arg(value.channel)); } } @@ -192,7 +191,7 @@ QString ChannelsGroup::status(Doc* doc) const /********************************************************************* * External input *********************************************************************/ -void ChannelsGroup::setInputSource(QSharedPointer const& source) +void ChannelsGroup::setInputSource(QSharedPointer const &source) { if (!m_input.isNull() && m_input->isValid()) disconnect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32, quint32, uchar)), this, @@ -206,7 +205,7 @@ void ChannelsGroup::setInputSource(QSharedPointer const& source) SLOT(slotInputValueChanged(quint32, quint32, uchar))); } -QSharedPointer const& ChannelsGroup::inputSource() const +QSharedPointer const &ChannelsGroup::inputSource() const { return m_input; } @@ -230,11 +229,11 @@ void ChannelsGroup::slotInputValueChanged(quint32 universe, quint32 channel, uch /***************************************************************************** * Load & Save *****************************************************************************/ -bool ChannelsGroup::loader(QXmlStreamReader& xmlDoc, Doc* doc) +bool ChannelsGroup::loader(QXmlStreamReader &xmlDoc, Doc *doc) { bool result = false; - ChannelsGroup* grp = new ChannelsGroup(doc); + ChannelsGroup *grp = new ChannelsGroup(doc); Q_ASSERT(grp != NULL); if (grp->loadXML(xmlDoc) == true) @@ -252,7 +251,7 @@ bool ChannelsGroup::loader(QXmlStreamReader& xmlDoc, Doc* doc) return result; } -bool ChannelsGroup::saveXML(QXmlStreamWriter* doc) +bool ChannelsGroup::saveXML(QXmlStreamWriter *doc) { Q_ASSERT(doc != NULL); @@ -283,7 +282,7 @@ bool ChannelsGroup::saveXML(QXmlStreamWriter* doc) return true; } -bool ChannelsGroup::loadXML(QXmlStreamReader& xmlDoc) +bool ChannelsGroup::loadXML(QXmlStreamReader &xmlDoc) { if (xmlDoc.name() != KXMLQLCChannelsGroup) { @@ -316,13 +315,13 @@ bool ChannelsGroup::loadXML(QXmlStreamReader& xmlDoc) for (int i = 0; i < varray.count(); i += 2) { SceneValue scv(QString(varray.at(i)).toUInt(), QString(varray.at(i + 1)).toUInt(), 0); - Fixture* fxi = m_doc->fixture(scv.fxi); + Fixture *fxi = m_doc->fixture(scv.fxi); if (fxi == NULL) { qWarning() << Q_FUNC_INFO << "Fixture not present:" << scv.fxi; continue; } - const QLCChannel* ch = fxi->channel(scv.channel); + const QLCChannel *ch = fxi->channel(scv.channel); if (ch == NULL) { qWarning() << Q_FUNC_INFO << "Fixture" << scv.fxi << "does not have channel" << scv.channel; @@ -332,8 +331,8 @@ bool ChannelsGroup::loadXML(QXmlStreamReader& xmlDoc) } } - if (attrs.hasAttribute(KXMLQLCChannelsGroupInputUniverse) == true && - attrs.hasAttribute(KXMLQLCChannelsGroupInputChannel) == true) + if (attrs.hasAttribute(KXMLQLCChannelsGroupInputUniverse) == true + && attrs.hasAttribute(KXMLQLCChannelsGroupInputChannel) == true) { quint32 uni = attrs.value(KXMLQLCChannelsGroupInputUniverse).toString().toInt(); quint32 ch = attrs.value(KXMLQLCChannelsGroupInputChannel).toString().toInt(); diff --git a/engine/src/channelsgroup.h b/engine/src/channelsgroup.h index 091c6c28aa..be65c6e32f 100644 --- a/engine/src/channelsgroup.h +++ b/engine/src/channelsgroup.h @@ -43,16 +43,16 @@ class ChannelsGroup : public QObject ************************************************************************/ public: /** Create a new ChannelsGroup with empty/invalid values */ - ChannelsGroup(Doc* doc); + ChannelsGroup(Doc *doc); /** Copy constructor */ - ChannelsGroup(Doc* doc, const ChannelsGroup* chg); + ChannelsGroup(Doc *doc, const ChannelsGroup *chg); /** destroy this ChannelsGroup */ ~ChannelsGroup(); protected: - Doc* m_doc; + Doc *m_doc; void init(); @@ -67,11 +67,11 @@ public slots: * Load & Save *********************************************************************/ public: - static bool loader(QXmlStreamReader& xmlDoc, Doc* doc); + static bool loader(QXmlStreamReader &xmlDoc, Doc *doc); - bool saveXML(QXmlStreamWriter* doc); + bool saveXML(QXmlStreamWriter *doc); - bool loadXML(QXmlStreamReader& xmlDoc); + bool loadXML(QXmlStreamReader &xmlDoc); /************************************************************************ * ID @@ -94,7 +94,7 @@ public slots: ************************************************************************/ public: /** Set the name of a channels group */ - void setName(const QString& name); + void setName(const QString &name); /** Get the name of a channels group */ QString name() const; @@ -120,7 +120,7 @@ public slots: * * @return A sort-of HTML-RTF-gibberish for Fixture Manager */ - QString status(Doc* doc) const; + QString status(Doc *doc) const; /********************************************************************* * External input @@ -131,14 +131,14 @@ public slots: * * @param source The input source to set */ - void setInputSource(QSharedPointer const& source); + void setInputSource(QSharedPointer const &source); /** * Get an assigned external input source * * @param id The id of the source to get */ - QSharedPointer const& inputSource() const; + QSharedPointer const &inputSource() const; protected slots: /** diff --git a/engine/src/chaser.cpp b/engine/src/chaser.cpp index 13dad79493..bfc7abfeff 100644 --- a/engine/src/chaser.cpp +++ b/engine/src/chaser.cpp @@ -48,7 +48,7 @@ * Initialization *****************************************************************************/ -Chaser::Chaser(Doc* doc) +Chaser::Chaser(Doc *doc) : Function(doc, Function::ChaserType) , m_legacyHoldBus(Bus::invalid()) , m_fadeInMode(Default) @@ -82,11 +82,11 @@ QIcon Chaser::getIcon() const * Copying *****************************************************************************/ -Function* Chaser::createCopy(Doc* doc, bool addToDoc) +Function *Chaser::createCopy(Doc *doc, bool addToDoc) { Q_ASSERT(doc != NULL); - Function* copy = new Chaser(doc); + Function *copy = new Chaser(doc); if (copy->copyFrom(this) == false) { delete copy; @@ -101,9 +101,9 @@ Function* Chaser::createCopy(Doc* doc, bool addToDoc) return copy; } -bool Chaser::copyFrom(const Function* function) +bool Chaser::copyFrom(const Function *function) { - const Chaser* chaser = qobject_cast(function); + const Chaser *chaser = qobject_cast(function); if (chaser == NULL) return false; @@ -121,7 +121,7 @@ bool Chaser::copyFrom(const Function* function) * Contents *****************************************************************************/ -bool Chaser::addStep(const ChaserStep& step, int index) +bool Chaser::addStep(const ChaserStep &step, int index) { if (step.fid != this->id()) { @@ -160,7 +160,7 @@ bool Chaser::removeStep(int index) } } -bool Chaser::replaceStep(const ChaserStep& step, int index) +bool Chaser::replaceStep(const ChaserStep &step, int index) { if (index >= 0 && index < m_steps.size()) { @@ -203,7 +203,7 @@ int Chaser::stepsCount() const return m_steps.count(); } -ChaserStep* Chaser::stepAt(int idx) +ChaserStep *Chaser::stepAt(int idx) { if (idx >= 0 && idx < m_steps.count()) return &(m_steps[idx]); @@ -318,7 +318,7 @@ QString Chaser::speedModeToString(Chaser::SpeedMode mode) return KXMLQLCChaserSpeedModeDefault; } -Chaser::SpeedMode Chaser::stringToSpeedMode(const QString& str) +Chaser::SpeedMode Chaser::stringToSpeedMode(const QString &str) { if (str == KXMLQLCChaserSpeedModeCommon) return Common; @@ -332,7 +332,7 @@ Chaser::SpeedMode Chaser::stringToSpeedMode(const QString& str) * Save & Load *****************************************************************************/ -bool Chaser::saveXML(QXmlStreamWriter* doc) +bool Chaser::saveXML(QXmlStreamWriter *doc) { Q_ASSERT(doc != NULL); @@ -368,7 +368,7 @@ bool Chaser::saveXML(QXmlStreamWriter* doc) return true; } -bool Chaser::loadXMLSpeedModes(QXmlStreamReader& root) +bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root) { QXmlStreamAttributes attrs = root.attributes(); QString str; @@ -386,7 +386,7 @@ bool Chaser::loadXMLSpeedModes(QXmlStreamReader& root) return true; } -bool Chaser::loadXML(QXmlStreamReader& root) +bool Chaser::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLQLCFunction) { @@ -463,14 +463,14 @@ void Chaser::postLoad() setDuration((value / MasterTimer::frequency()) * 1000); } - Doc* doc = this->doc(); + Doc *doc = this->doc(); Q_ASSERT(doc != NULL); QMutableListIterator it(m_steps); while (it.hasNext() == true) { ChaserStep step(it.next()); - Function* function = doc->function(step.fid); + Function *function = doc->function(step.fid); if (function == NULL) it.remove(); @@ -491,7 +491,7 @@ void Chaser::tap() m_runner->tap(); } -void Chaser::setAction(ChaserAction& action) +void Chaser::setAction(ChaserAction &action) { QMutexLocker runnerLocker(&m_runnerMutex); if (m_runner != NULL) @@ -513,9 +513,9 @@ int Chaser::currentStepIndex() const int ret = m_startupAction.m_stepIndex; { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #else - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #endif if (m_runner != NULL) ret = m_runner->currentStepIndex(); @@ -528,9 +528,9 @@ int Chaser::computeNextStep(int currentStepIndex) const int ret = m_startupAction.m_stepIndex; { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #else - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #endif if (m_runner != NULL) ret = m_runner->computeNextStep(currentStepIndex); @@ -543,9 +543,9 @@ int Chaser::runningStepsNumber() const int ret = 0; { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #else - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #endif if (m_runner != NULL) ret = m_runner->runningStepsNumber(); @@ -560,13 +560,13 @@ ChaserRunnerStep Chaser::currentRunningStep() const { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #else - QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); + QMutexLocker runnerLocker(const_cast(&m_runnerMutex)); #endif if (m_runner != NULL) { - ChaserRunnerStep* step = m_runner->currentRunningStep(); + ChaserRunnerStep *step = m_runner->currentRunningStep(); if (step != NULL) ret = *step; } @@ -576,12 +576,12 @@ ChaserRunnerStep Chaser::currentRunningStep() const bool Chaser::contains(quint32 functionId) { - Doc* doc = this->doc(); + Doc *doc = this->doc(); Q_ASSERT(doc != NULL); foreach (ChaserStep step, m_steps) { - Function* function = doc->function(step.fid); + Function *function = doc->function(step.fid); // contains() can be called during init, function may be NULL if (function == NULL) continue; @@ -623,7 +623,7 @@ void Chaser::createRunner(quint32 startTime) m_startupAction.m_action = ChaserNoAction; } -void Chaser::preRun(MasterTimer* timer) +void Chaser::preRun(MasterTimer *timer) { { QMutexLocker runnerLocker(&m_runnerMutex); @@ -647,7 +647,7 @@ void Chaser::setPause(bool enable) Function::setPause(enable); } -void Chaser::write(MasterTimer* timer, QList universes) +void Chaser::write(MasterTimer *timer, QList universes) { if (isPaused() && m_startupAction.m_action != ChaserPauseRequest) return; @@ -671,7 +671,7 @@ void Chaser::write(MasterTimer* timer, QList universes) incrementElapsed(); } -void Chaser::postRun(MasterTimer* timer, QList universes) +void Chaser::postRun(MasterTimer *timer, QList universes) { { QMutexLocker runnerLocker(&m_runnerMutex); diff --git a/engine/src/chaser.h b/engine/src/chaser.h index 2c688fca3c..caf7442be3 100644 --- a/engine/src/chaser.h +++ b/engine/src/chaser.h @@ -59,7 +59,7 @@ class Chaser : public Function * Initialization *********************************************************************/ public: - Chaser(Doc* doc); + Chaser(Doc *doc); virtual ~Chaser(); /** @reimp */ @@ -73,10 +73,10 @@ class Chaser : public Function *********************************************************************/ public: /** @reimp */ - Function* createCopy(Doc* doc, bool addToDoc = true); + Function *createCopy(Doc *doc, bool addToDoc = true); /** Copy the contents for this function from another function */ - bool copyFrom(const Function* function); + bool copyFrom(const Function *function); /********************************************************************* * Chaser contents @@ -92,7 +92,7 @@ class Chaser : public Function * @param step The step to add * @param index Insertion point. -1 to append. */ - bool addStep(const ChaserStep& step, int index = -1); + bool addStep(const ChaserStep &step, int index = -1); /** * Remove a function from the given step index. If the given index is @@ -110,7 +110,7 @@ class Chaser : public Function * @param index The index of the step to replace * @return true if successful, otherwise false (index out of bounds) */ - bool replaceStep(const ChaserStep& step, int index); + bool replaceStep(const ChaserStep &step, int index); /** * Move a step from $sourceIdx to $destIdx @@ -129,7 +129,7 @@ class Chaser : public Function * * @return The requested Chaser Step */ - ChaserStep* stepAt(int idx); + ChaserStep *stepAt(int idx); /** * Get the chaser's list of steps @@ -186,7 +186,7 @@ public slots: SpeedMode durationMode() const; static QString speedModeToString(SpeedMode mode); - static SpeedMode stringToSpeedMode(const QString& str); + static SpeedMode stringToSpeedMode(const QString &str); protected: SpeedMode m_fadeInMode; @@ -197,14 +197,14 @@ public slots: * Save & Load *********************************************************************/ protected: - bool loadXMLSpeedModes(QXmlStreamReader& root); + bool loadXMLSpeedModes(QXmlStreamReader &root); public: /** @reimpl */ - virtual bool saveXML(QXmlStreamWriter* doc); + virtual bool saveXML(QXmlStreamWriter *doc); /** @reimpl */ - virtual bool loadXML(QXmlStreamReader& root); + virtual bool loadXML(QXmlStreamReader &root); /** @reimp */ virtual void postLoad(); @@ -228,7 +228,7 @@ public slots: /** Set an action to be performed on steps. * Depending on the action type, it might be applied immediately * or deferred to the next write() call */ - void setAction(ChaserAction& action); + void setAction(ChaserAction &action); /** Get the current step number */ int currentStepIndex() const; @@ -268,16 +268,16 @@ public slots: public: /** @reimp */ - void preRun(MasterTimer* timer); + void preRun(MasterTimer *timer); /** @reimp */ void setPause(bool enable); /** @reimp */ - void write(MasterTimer* timer, QList universes); + void write(MasterTimer *timer, QList universes); /** @reimp */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer *timer, QList universes); signals: /** Tells that the current step number has changed. */ @@ -289,7 +289,7 @@ public slots: #else QRecursiveMutex m_runnerMutex; #endif - ChaserRunner* m_runner; + ChaserRunner *m_runner; /************************************************************************* * Intensity diff --git a/engine/src/chaserrunner.cpp b/engine/src/chaserrunner.cpp index 08d0c971dd..f30e7bd395 100644 --- a/engine/src/chaserrunner.cpp +++ b/engine/src/chaserrunner.cpp @@ -36,7 +36,7 @@ #include "scene.h" #include "doc.h" -ChaserRunner::ChaserRunner(const Doc* doc, const Chaser* chaser, quint32 startTime) +ChaserRunner::ChaserRunner(const Doc *doc, const Chaser *chaser, quint32 startTime) : QObject(NULL) , m_doc(doc) , m_chaser(chaser) @@ -98,8 +98,8 @@ void ChaserRunner::slotChaserChanged() { // Handle (possible) speed change on the next write() pass m_updateOverrideSpeeds = true; - QList delList; - foreach (ChaserRunnerStep* step, m_runnerSteps) + QList delList; + foreach (ChaserRunnerStep *step, m_runnerSteps) { if (!m_chaser->steps().contains(ChaserStep(step->m_function->id()))) { @@ -114,7 +114,7 @@ void ChaserRunner::slotChaserChanged() step->m_duration = stepDuration(step->m_index); } } - foreach (ChaserRunnerStep* step, delList) + foreach (ChaserRunnerStep *step, delList) { step->m_function->stop(functionParent()); delete step; @@ -231,7 +231,7 @@ uint ChaserRunner::stepDuration(int stepIdx) const * Step control ****************************************************************************/ -void ChaserRunner::setAction(ChaserAction& action) +void ChaserRunner::setAction(ChaserAction &action) { // apply the actions that can be applied immediately switch (action.m_action) @@ -245,7 +245,7 @@ void ChaserRunner::setAction(ChaserAction& action) { bool stopped = false; - foreach (ChaserRunnerStep* step, m_runnerSteps) + foreach (ChaserRunnerStep *step, m_runnerSteps) { if (action.m_stepIndex == step->m_index) { @@ -262,7 +262,7 @@ void ChaserRunner::setAction(ChaserAction& action) if (stopped && m_runnerSteps.size() == 1) { - ChaserRunnerStep* lastStep = m_runnerSteps.at(0); + ChaserRunnerStep *lastStep = m_runnerSteps.at(0); m_lastRunStepIdx = lastStep->m_index; emit currentStepChanged(m_lastRunStepIdx); } @@ -296,7 +296,7 @@ int ChaserRunner::runningStepsNumber() const return m_runnerSteps.count(); } -ChaserRunnerStep* ChaserRunner::currentRunningStep() const +ChaserRunnerStep *ChaserRunner::currentRunningStep() const { if (m_runnerSteps.count() > 0) return m_runnerSteps.at(0); @@ -380,7 +380,7 @@ int ChaserRunner::computeNextStep(int currentStep) const return nextStep; } -void ChaserRunner::shuffle(QVector& data) +void ChaserRunner::shuffle(QVector &data) { int n = data.size(); for (int i = n - 1; i > 0; --i) @@ -433,13 +433,13 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i m_pendingAction.m_masterIntensity = fraction; } - foreach (ChaserRunnerStep* step, m_runnerSteps) + foreach (ChaserRunnerStep *step, m_runnerSteps) { if (stepIndex == step->m_index && step->m_function != NULL) { if (requestedStepIndex == -1 && step->m_function->type() == Function::SceneType) { - Scene* scene = qobject_cast(step->m_function); + Scene *scene = qobject_cast(step->m_function); scene->adjustAttribute(fraction, step->m_pIntensityOverrideId); } else @@ -469,7 +469,7 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i void ChaserRunner::clearRunningList() { // empty the running queue - foreach (ChaserRunnerStep* step, m_runnerSteps) + foreach (ChaserRunnerStep *step, m_runnerSteps) { if (step->m_function) { @@ -484,7 +484,7 @@ void ChaserRunner::clearRunningList() m_runnerSteps.clear(); } -void ChaserRunner::startNewStep(int index, MasterTimer* timer, qreal mIntensity, qreal sIntensity, int fadeControl, +void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, int fadeControl, quint32 elapsed) { if (m_chaser == NULL || m_chaser->stepsCount() == 0) @@ -494,30 +494,29 @@ void ChaserRunner::startNewStep(int index, MasterTimer* timer, qreal mIntensity, index = 0; // fallback to the first step ChaserStep step(m_chaser->steps().at(index)); - Function* func = m_doc->function(step.fid); + Function *func = m_doc->function(step.fid); if (func == NULL) return; - ChaserRunnerStep* newStep = new ChaserRunnerStep(); + ChaserRunnerStep *newStep = new ChaserRunnerStep(); newStep->m_index = index; // check if blending between Scenes is needed if (m_lastFunctionID != Function::invalidId() && func->type() == Function::SceneType) { - Scene* scene = qobject_cast(func); + Scene *scene = qobject_cast(func); scene->setBlendFunctionID(m_lastFunctionID); } // this happens only during crossfades if (m_runnerSteps.count()) { - ChaserRunnerStep* lastStep = m_runnerSteps.last(); - if (lastStep->m_function && lastStep->m_function->type() == Function::SceneType && - func->type() == Function::SceneType) + ChaserRunnerStep *lastStep = m_runnerSteps.last(); + if (lastStep->m_function && lastStep->m_function->type() == Function::SceneType && func->type() == Function::SceneType) { - Scene* lastScene = qobject_cast(lastStep->m_function); + Scene *lastScene = qobject_cast(lastStep->m_function); lastScene->setBlendFunctionID(Function::invalidId()); - Scene* scene = qobject_cast(func); + Scene *scene = qobject_cast(func); scene->setBlendFunctionID(lastStep->m_function->id()); } } @@ -556,7 +555,7 @@ void ChaserRunner::startNewStep(int index, MasterTimer* timer, qreal mIntensity, if (m_chaser->type() == Function::SequenceType) { - Scene* s = qobject_cast(func); + Scene *s = qobject_cast(func); // blind == true is a workaround to reuse the same scene // without messing up the previous values for (int i = 0; i < step.values.count(); i++) @@ -570,7 +569,7 @@ void ChaserRunner::startNewStep(int index, MasterTimer* timer, qreal mIntensity, // might momentarily jump too high. if (func->type() == Function::SceneType) { - Scene* scene = qobject_cast(func); + Scene *scene = qobject_cast(func); newStep->m_intensityOverrideId = func->requestAttributeOverride(Function::Intensity, sIntensity); newStep->m_pIntensityOverrideId = scene->requestAttributeOverride(Scene::ParentIntensity, mIntensity); qDebug() << "[ChaserRunner] Set step intensity:" << sIntensity << ", master:" << mIntensity; @@ -704,7 +703,7 @@ int ChaserRunner::getNextStepIndex() return currentStepIndex; } -void ChaserRunner::setPause(bool enable, QList universes) +void ChaserRunner::setPause(bool enable, QList universes) { // Nothing to do if (m_chaser->stepsCount() == 0) @@ -712,15 +711,15 @@ void ChaserRunner::setPause(bool enable, QList universes) qDebug() << "[ChaserRunner] processing pause request:" << enable; - foreach (ChaserRunnerStep* step, m_runnerSteps) + foreach (ChaserRunnerStep *step, m_runnerSteps) step->m_function->setPause(enable); // there might be a Scene fading out, so request pause // to faders bound to the Scene ID running on universes - Function* f = m_doc->function(m_lastFunctionID); + Function *f = m_doc->function(m_lastFunctionID); if (f != NULL && f->type() == Function::SceneType) { - foreach (Universe* universe, universes) + foreach (Universe *universe, universes) universe->setFaderPause(m_lastFunctionID, enable); } } @@ -730,7 +729,7 @@ FunctionParent ChaserRunner::functionParent() const return FunctionParent(FunctionParent::Function, m_chaser->id()); } -bool ChaserRunner::write(MasterTimer* timer, QList universes) +bool ChaserRunner::write(MasterTimer *timer, QList universes) { // Nothing to do if (m_chaser->stepsCount() == 0) @@ -763,7 +762,7 @@ bool ChaserRunner::write(MasterTimer* timer, QList universes) quint32 prevStepRoundElapsed = 0; - foreach (ChaserRunnerStep* step, m_runnerSteps) + foreach (ChaserRunnerStep *step, m_runnerSteps) { if (m_chaser->tempoType() == Function::Beats && timer->isBeat()) { @@ -772,9 +771,9 @@ bool ChaserRunner::write(MasterTimer* timer, QList universes) << "beats:" << step->m_elapsedBeats; } - if (step->m_duration != Function::infiniteSpeed() && - ((m_chaser->tempoType() == Function::Time && step->m_elapsed >= step->m_duration) || - (m_chaser->tempoType() == Function::Beats && step->m_elapsedBeats >= step->m_duration))) + if (step->m_duration != Function::infiniteSpeed() + && ((m_chaser->tempoType() == Function::Time && step->m_elapsed >= step->m_duration) + || (m_chaser->tempoType() == Function::Beats && step->m_elapsedBeats >= step->m_duration))) { if (step->m_duration != 0) prevStepRoundElapsed = step->m_elapsed % step->m_duration; @@ -827,7 +826,7 @@ bool ChaserRunner::write(MasterTimer* timer, QList universes) return true; } -void ChaserRunner::postRun(MasterTimer* timer, QList universes) +void ChaserRunner::postRun(MasterTimer *timer, QList universes) { Q_UNUSED(universes); Q_UNUSED(timer); diff --git a/engine/src/chaserrunner.h b/engine/src/chaserrunner.h index 7c00f2c1c7..965e640982 100644 --- a/engine/src/chaserrunner.h +++ b/engine/src/chaserrunner.h @@ -43,7 +43,7 @@ class Doc; typedef struct { int m_index; //! Index of the step from the original Chaser - Function* m_function; //! Currently active function + Function *m_function; //! Currently active function quint32 m_elapsed; //! Elapsed milliseconds quint32 m_elapsedBeats; //! Elapsed beats uint m_fadeIn; //! Step fade in in ms @@ -59,15 +59,15 @@ class ChaserRunner : public QObject Q_OBJECT public: - ChaserRunner(const Doc* doc, const Chaser* chaser, quint32 startTime = 0); + ChaserRunner(const Doc *doc, const Chaser *chaser, quint32 startTime = 0); ~ChaserRunner(); private slots: void slotChaserChanged(); private: - const Doc* m_doc; - const Chaser* m_chaser; + const Doc *m_doc; + const Chaser *m_chaser; /************************************************************************ * Speed @@ -89,7 +89,7 @@ private slots: * Step control ************************************************************************/ public: - void setAction(ChaserAction& action); + void setAction(ChaserAction &action); /** * Produce a tap event to the runner, possibly producing a next() call. @@ -119,13 +119,13 @@ private slots: * Get the first step of the running list. * If none is running this returns NULL */ - ChaserRunnerStep* currentRunningStep() const; + ChaserRunnerStep *currentRunningStep() const; private: /** * Shuffle the current steps order */ - static void shuffle(QVector& data); + static void shuffle(QVector &data); /** * Retrieve the randomized index of a @@ -150,14 +150,14 @@ private slots: void currentStepChanged(int stepNumber); private: - Function::Direction m_direction; //! Run-time direction (reversed by ping-pong) - QList m_runnerSteps; //! Queue of the currently running steps - quint32 m_startOffset; //! Start step offset time in milliseconds - ChaserAction m_pendingAction; //! Action to be performed on steps at the next write call - int m_lastRunStepIdx; //! Index of the last step ran - quint32 m_lastFunctionID; //! ID of the last Function ran (Scene only) - QElapsedTimer* m_roundTime; //! Counts the time between steps - QVector m_order; //! Array of step indices in a randomized order + Function::Direction m_direction; //! Run-time direction (reversed by ping-pong) + QList m_runnerSteps; //! Queue of the currently running steps + quint32 m_startOffset; //! Start step offset time in milliseconds + ChaserAction m_pendingAction; //! Action to be performed on steps at the next write call + int m_lastRunStepIdx; //! Index of the last step ran + quint32 m_lastFunctionID; //! ID of the last Function ran (Scene only) + QElapsedTimer *m_roundTime; //! Counts the time between steps + QVector m_order; //! Array of step indices in a randomized order /************************************************************************ * Intensity @@ -181,12 +181,12 @@ private slots: * $fadeControl specifies how the step Function should fade, according to * the Chaser::FadeControlMode enumeration: * - Chaser::FromFunction will use the original Function fadeIn time - * - Chaser::Crossfade means that the user is manually overriding the Function intensity with a slider - * so the Function fadeIn time will be set to 0 + * - Chaser::Crossfade means that the user is manually overriding the Function intensity with a + * slider so the Function fadeIn time will be set to 0 * - Chaser::LinkedCrossfade is like Crossfade, and the Function will also be requested * to use the Universe::AdditiveBlend mode */ - void startNewStep(int index, MasterTimer* timer, qreal mIntensity, qreal sIntensity, int fadeControl, + void startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, int fadeControl, quint32 elapsed = 0); /** @@ -206,10 +206,10 @@ private slots: * @param universes DMX address space * @return true if the chaser should continue, otherwise false */ - bool write(MasterTimer* timer, QList universes); + bool write(MasterTimer *timer, QList universes); /** If running, pauses the runner and all the current running steps. */ - void setPause(bool enable, QList universes); + void setPause(bool enable, QList universes); /** * Perform postRun operations. Call this from the parent function's postRun(). @@ -217,7 +217,7 @@ private slots: * @param timer The MasterTimer that runs the show * @param universes DMX address space */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer *timer, QList universes); }; /** @} */ diff --git a/engine/src/chaserstep.cpp b/engine/src/chaserstep.cpp index 08170819b9..1dd8345fd2 100644 --- a/engine/src/chaserstep.cpp +++ b/engine/src/chaserstep.cpp @@ -39,7 +39,7 @@ ChaserStep::ChaserStep(quint32 aFid, uint aFadeIn, uint aHold, uint aFadeOut) duration = fadeIn + hold; } -ChaserStep::ChaserStep(const ChaserStep& cs) +ChaserStep::ChaserStep(const ChaserStep &cs) : fid(cs.fid) , fadeIn(cs.fadeIn) , hold(cs.hold) @@ -50,7 +50,7 @@ ChaserStep::ChaserStep(const ChaserStep& cs) { } -ChaserStep& ChaserStep::operator=(const ChaserStep& step) +ChaserStep &ChaserStep::operator=(const ChaserStep &step) { if (this != &step) { @@ -66,12 +66,12 @@ ChaserStep& ChaserStep::operator=(const ChaserStep& step) return *this; } -bool ChaserStep::operator==(const ChaserStep& cs) const +bool ChaserStep::operator==(const ChaserStep &cs) const { return (fid == cs.fid) ? true : false; } -Function* ChaserStep::resolveFunction(const Doc* doc) const +Function *ChaserStep::resolveFunction(const Doc *doc) const { if (doc == NULL) return NULL; @@ -79,7 +79,7 @@ Function* ChaserStep::resolveFunction(const Doc* doc) const return doc->function(fid); } -int ChaserStep::setValue(SceneValue value, int index, bool* created) +int ChaserStep::setValue(SceneValue value, int index, bool *created) { if (index == -1) { @@ -151,7 +151,7 @@ QVariant ChaserStep::toVariant() const return list; } -ChaserStep ChaserStep::fromVariant(const QVariant& var) +ChaserStep ChaserStep::fromVariant(const QVariant &var) { ChaserStep cs; QList list(var.toList()); @@ -167,7 +167,7 @@ ChaserStep ChaserStep::fromVariant(const QVariant& var) return cs; } -bool ChaserStep::loadXML(QXmlStreamReader& root, int& stepNumber, Doc* doc) +bool ChaserStep::loadXML(QXmlStreamReader &root, int &stepNumber, Doc *doc) { bool holdFound = false; if (root.name() != KXMLQLCFunctionStep) @@ -263,7 +263,7 @@ bool ChaserStep::loadXML(QXmlStreamReader& root, int& stepNumber, Doc* doc) return true; } -bool ChaserStep::saveXML(QXmlStreamWriter* doc, int stepNumber, bool isSequence) const +bool ChaserStep::saveXML(QXmlStreamWriter *doc, int stepNumber, bool isSequence) const { /* Step tag */ doc->writeStartElement(KXMLQLCFunctionStep); diff --git a/engine/src/chaserstep.h b/engine/src/chaserstep.h index 969f095f6d..fa3ede7dc0 100644 --- a/engine/src/chaserstep.h +++ b/engine/src/chaserstep.h @@ -46,17 +46,17 @@ class ChaserStep ChaserStep(quint32 aFid = Function::invalidId(), uint aFadeIn = 0, uint aHold = 0, uint aFadeOut = 0); /** Copy constructor */ - ChaserStep(const ChaserStep& cs); + ChaserStep(const ChaserStep &cs); - ChaserStep& operator=(const ChaserStep& step); + ChaserStep &operator=(const ChaserStep &step); /** Comparison operator (only function IDs are compared) */ - bool operator==(const ChaserStep& cs) const; + bool operator==(const ChaserStep &cs) const; /** Return the actual function pointer for $fid from $doc */ - Function* resolveFunction(const Doc* doc) const; + Function *resolveFunction(const Doc *doc) const; - int setValue(SceneValue value, int index = -1, bool* created = NULL); + int setValue(SceneValue value, int index = -1, bool *created = NULL); int unSetValue(SceneValue value, int index = -1); @@ -66,7 +66,7 @@ class ChaserStep public: #if 1 /** Construct a new ChaserStep from the given QVariant */ - static ChaserStep fromVariant(const QVariant& var); + static ChaserStep fromVariant(const QVariant &var); /** Construct a QVariant from a ChaserStep */ QVariant toVariant() const; @@ -77,10 +77,10 @@ class ChaserStep public: /** Load ChaserStep contents from $root and return step index in $stepNumber. * $doc is used to check fixture existance. If NULL the check is skipped */ - bool loadXML(QXmlStreamReader& root, int& stepNumber, Doc* doc); + bool loadXML(QXmlStreamReader &root, int &stepNumber, Doc *doc); /** Save ChaserStep contents to $doc, with $stepNumber */ - bool saveXML(QXmlStreamWriter* doc, int stepNumber, bool isSequence) const; + bool saveXML(QXmlStreamWriter *doc, int stepNumber, bool isSequence) const; public: quint32 fid; //! The function ID diff --git a/engine/src/collection.cpp b/engine/src/collection.cpp index 25e5a1c535..b4962c7a02 100644 --- a/engine/src/collection.cpp +++ b/engine/src/collection.cpp @@ -37,7 +37,7 @@ * Initialization *****************************************************************************/ -Collection::Collection(Doc* doc) +Collection::Collection(Doc *doc) : Function(doc, Function::CollectionType) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) , m_functionListMutex(QMutex::Recursive) @@ -62,7 +62,7 @@ quint32 Collection::totalDuration() foreach (QVariant fid, functions()) { - Function* function = doc()->function(fid.toUInt()); + Function *function = doc()->function(fid.toUInt()); totalDuration += function->totalDuration(); } @@ -73,11 +73,11 @@ quint32 Collection::totalDuration() * Copying *****************************************************************************/ -Function* Collection::createCopy(Doc* doc, bool addToDoc) +Function *Collection::createCopy(Doc *doc, bool addToDoc) { Q_ASSERT(doc != NULL); - Function* copy = new Collection(doc); + Function *copy = new Collection(doc); if (copy->copyFrom(this) == false) { delete copy; @@ -92,9 +92,9 @@ Function* Collection::createCopy(Doc* doc, bool addToDoc) return copy; } -bool Collection::copyFrom(const Function* function) +bool Collection::copyFrom(const Function *function) { - const Collection* coll = qobject_cast(function); + const Collection *coll = qobject_cast(function); if (coll == NULL) return false; @@ -165,7 +165,7 @@ void Collection::slotFunctionRemoved(quint32 fid) * Load & Save *****************************************************************************/ -bool Collection::saveXML(QXmlStreamWriter* doc) +bool Collection::saveXML(QXmlStreamWriter *doc) { int i = 0; @@ -198,7 +198,7 @@ bool Collection::saveXML(QXmlStreamWriter* doc) return true; } -bool Collection::loadXML(QXmlStreamReader& root) +bool Collection::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLQLCFunction) { @@ -229,7 +229,7 @@ bool Collection::loadXML(QXmlStreamReader& root) void Collection::postLoad() { - Doc* doc = qobject_cast(parent()); + Doc *doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); /* Check that all member functions exist (nonexistent functions can @@ -238,7 +238,7 @@ void Collection::postLoad() while (it.hasNext() == true) { /* Remove any nonexistent member functions */ - Function* function = doc->function(it.next()); + Function *function = doc->function(it.next()); if (function == NULL || function->contains(id())) // forbid self-containment it.remove(); @@ -247,12 +247,12 @@ void Collection::postLoad() bool Collection::contains(quint32 functionId) { - Doc* doc = qobject_cast(parent()); + Doc *doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); foreach (quint32 fid, m_functions) { - Function* function = doc->function(fid); + Function *function = doc->function(fid); // contains() can be called during init, function may be NULL if (function == NULL) continue; @@ -280,16 +280,16 @@ FunctionParent Collection::functionParent() const return FunctionParent(FunctionParent::Function, id()); } -void Collection::preRun(MasterTimer* timer) +void Collection::preRun(MasterTimer *timer) { - Doc* doc = this->doc(); + Doc *doc = this->doc(); Q_ASSERT(doc != NULL); { QMutexLocker locker(&m_functionListMutex); m_runningChildren.clear(); foreach (quint32 fid, m_functions) { - Function* function = doc->function(fid); + Function *function = doc->function(fid); Q_ASSERT(function != NULL); m_intensityOverrideIds << function->requestAttributeOverride(Function::Intensity, @@ -309,8 +309,7 @@ void Collection::preRun(MasterTimer* timer) connect(function, SIGNAL(running(quint32)), this, SLOT(slotChildStarted(quint32))); // function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity); - function->start(timer, functionParent(), 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), - overrideDuration()); + function->start(timer, functionParent(), 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration()); } m_tick = 1; } @@ -319,18 +318,18 @@ void Collection::preRun(MasterTimer* timer) void Collection::setPause(bool enable) { - Doc* doc = this->doc(); + Doc *doc = this->doc(); Q_ASSERT(doc != NULL); foreach (quint32 fid, m_runningChildren) { - Function* function = doc->function(fid); + Function *function = doc->function(fid); Q_ASSERT(function != NULL); function->setPause(enable); } Function::setPause(enable); } -void Collection::write(MasterTimer* timer, QList universes) +void Collection::write(MasterTimer *timer, QList universes) { Q_UNUSED(timer); Q_UNUSED(universes); @@ -344,13 +343,13 @@ void Collection::write(MasterTimer* timer, QList universes) else if (m_tick == 2) { m_tick = 0; - Doc* doc = this->doc(); + Doc *doc = this->doc(); Q_ASSERT(doc != NULL); QMutexLocker locker(&m_functionListMutex); foreach (quint32 fid, m_runningChildren) { - Function* function = doc->function(fid); + Function *function = doc->function(fid); Q_ASSERT(function != NULL); // First tick may correspond to this collection starting the function @@ -370,9 +369,9 @@ void Collection::write(MasterTimer* timer, QList universes) stop(functionParent()); } -void Collection::postRun(MasterTimer* timer, QList universes) +void Collection::postRun(MasterTimer *timer, QList universes) { - Doc* doc = qobject_cast(parent()); + Doc *doc = qobject_cast(parent()); Q_ASSERT(doc != NULL); { @@ -382,7 +381,7 @@ void Collection::postRun(MasterTimer* timer, QList universes) QSetIterator it(m_runningChildren); while (it.hasNext() == true) { - Function* function = doc->function(it.next()); + Function *function = doc->function(it.next()); Q_ASSERT(function != NULL); function->stop(functionParent()); } @@ -391,7 +390,7 @@ void Collection::postRun(MasterTimer* timer, QList universes) for (int i = 0; i < m_functions.count(); i++) { - Function* function = doc->function(m_functions.at(i)); + Function *function = doc->function(m_functions.at(i)); Q_ASSERT(function != NULL); disconnect(function, SIGNAL(stopped(quint32)), this, SLOT(slotChildStopped(quint32))); @@ -425,14 +424,14 @@ int Collection::adjustAttribute(qreal fraction, int attributeId) if (isRunning() && attrIndex == Intensity) { - Doc* document = doc(); + Doc *document = doc(); Q_ASSERT(document != NULL); QMutexLocker locker(&m_functionListMutex); for (int i = 0; i < m_functions.count(); i++) { - Function* function = document->function(m_functions.at(i)); + Function *function = document->function(m_functions.at(i)); Q_ASSERT(function != NULL); function->adjustAttribute(getAttributeValue(Function::Intensity), m_intensityOverrideIds.at(i)); } @@ -452,7 +451,7 @@ void Collection::setBlendMode(Universe::BlendMode mode) { for (int i = 0; i < m_functions.count(); i++) { - Function* function = doc()->function(m_functions.at(i)); + Function *function = doc()->function(m_functions.at(i)); Q_ASSERT(function != NULL); function->setBlendMode(mode); } diff --git a/engine/src/collection.h b/engine/src/collection.h index a285982a0e..c837eaff98 100644 --- a/engine/src/collection.h +++ b/engine/src/collection.h @@ -48,7 +48,7 @@ class Collection : public Function * Initialization *********************************************************************/ public: - Collection(Doc* doc); + Collection(Doc *doc); virtual ~Collection(); /** @reimp */ @@ -62,10 +62,10 @@ class Collection : public Function *********************************************************************/ public: /** @reimp */ - Function* createCopy(Doc* doc, bool addToDoc = true); + Function *createCopy(Doc *doc, bool addToDoc = true); /** Copy the contents for this function from another function */ - bool copyFrom(const Function* function); + bool copyFrom(const Function *function); /********************************************************************* * Contents @@ -120,10 +120,10 @@ public slots: *********************************************************************/ public: /** Save function's contents to an XML document */ - bool saveXML(QXmlStreamWriter* doc); + bool saveXML(QXmlStreamWriter *doc); /** Load function's contents from an XML document */ - bool loadXML(QXmlStreamReader& root); + bool loadXML(QXmlStreamReader &root); /** @reimp */ void postLoad(); @@ -143,16 +143,16 @@ public slots: public: /** @reimpl */ - void preRun(MasterTimer* timer); + void preRun(MasterTimer *timer); /** @reimpl */ void setPause(bool enable); /** @reimpl */ - void write(MasterTimer* timer, QList universes); + void write(MasterTimer *timer, QList universes); /** @reimpl */ - void postRun(MasterTimer* timer, QList universes); + void postRun(MasterTimer *timer, QList universes); protected slots: /** Called whenever one of this function's child functions stops */ diff --git a/engine/src/cue.cpp b/engine/src/cue.cpp index 6ffba0bf03..a5333e998b 100644 --- a/engine/src/cue.cpp +++ b/engine/src/cue.cpp @@ -24,7 +24,7 @@ #include "cue.h" -Cue::Cue(const QString& name) +Cue::Cue(const QString &name) : m_name(name) , m_fadeInSpeed(0) , m_fadeOutSpeed(0) @@ -41,7 +41,7 @@ Cue::Cue(const QHash values) { } -Cue::Cue(const Cue& cue) +Cue::Cue(const Cue &cue) : m_name(cue.name()) , m_values(cue.values()) , m_fadeInSpeed(cue.fadeInSpeed()) @@ -52,7 +52,7 @@ Cue::Cue(const Cue& cue) Cue::~Cue() {} -Cue& Cue::operator=(const Cue& cue) +Cue &Cue::operator=(const Cue &cue) { if (this != &cue) { @@ -70,7 +70,7 @@ Cue& Cue::operator=(const Cue& cue) * Name ****************************************************************************/ -void Cue::setName(const QString& str) +void Cue::setName(const QString &str) { m_name = str; } @@ -146,7 +146,7 @@ uint Cue::duration() const * Load & Save ****************************************************************************/ -bool Cue::loadXML(QXmlStreamReader& root) +bool Cue::loadXML(QXmlStreamReader &root) { qDebug() << Q_FUNC_INFO; @@ -181,7 +181,7 @@ bool Cue::loadXML(QXmlStreamReader& root) return true; } -bool Cue::saveXML(QXmlStreamWriter* doc) const +bool Cue::saveXML(QXmlStreamWriter *doc) const { qDebug() << Q_FUNC_INFO; Q_ASSERT(doc != NULL); @@ -207,7 +207,7 @@ bool Cue::saveXML(QXmlStreamWriter* doc) const return true; } -bool Cue::loadXMLSpeed(QXmlStreamReader& speedRoot) +bool Cue::loadXMLSpeed(QXmlStreamReader &speedRoot) { if (speedRoot.name() != KXMLQLCCueSpeed) return false; @@ -220,7 +220,7 @@ bool Cue::loadXMLSpeed(QXmlStreamReader& speedRoot) return true; } -bool Cue::saveXMLSpeed(QXmlStreamWriter* doc) const +bool Cue::saveXMLSpeed(QXmlStreamWriter *doc) const { doc->writeStartElement(KXMLQLCCueSpeed); doc->writeAttribute(KXMLQLCCueSpeedFadeIn, QString::number(fadeInSpeed())); diff --git a/engine/src/cue.h b/engine/src/cue.h index 0937838065..daf8e15116 100644 --- a/engine/src/cue.h +++ b/engine/src/cue.h @@ -46,18 +46,18 @@ class QXmlStreamWriter; class Cue { public: - Cue(const QString& name = QString()); + Cue(const QString &name = QString()); Cue(const QHash values); - Cue(const Cue& cue); + Cue(const Cue &cue); ~Cue(); - Cue& operator=(const Cue& cue); + Cue &operator=(const Cue &cue); /************************************************************************ * Name ************************************************************************/ public: - void setName(const QString& str); + void setName(const QString &str); QString name() const; private: @@ -98,12 +98,12 @@ class Cue * Load & Save ************************************************************************/ public: - bool loadXML(QXmlStreamReader& root); - bool saveXML(QXmlStreamWriter* doc) const; + bool loadXML(QXmlStreamReader &root); + bool saveXML(QXmlStreamWriter *doc) const; private: - bool loadXMLSpeed(QXmlStreamReader& speedRoot); - bool saveXMLSpeed(QXmlStreamWriter* doc) const; + bool loadXMLSpeed(QXmlStreamReader &speedRoot); + bool saveXMLSpeed(QXmlStreamWriter *doc) const; }; /** @} */ diff --git a/engine/src/cuestack.cpp b/engine/src/cuestack.cpp index 3449905a0a..3636664d4b 100644 --- a/engine/src/cuestack.cpp +++ b/engine/src/cuestack.cpp @@ -37,7 +37,7 @@ * Initialization ****************************************************************************/ -CueStack::CueStack(Doc* doc) +CueStack::CueStack(Doc *doc) : QObject(doc) , m_fadeInSpeed(0) , m_fadeOutSpeed(0) @@ -62,16 +62,16 @@ CueStack::~CueStack() m_cues.clear(); // Crashes without this, WTF?! } -Doc* CueStack::doc() const +Doc *CueStack::doc() const { - return qobject_cast(parent()); + return qobject_cast(parent()); } /**************************************************************************** * Name ****************************************************************************/ -void CueStack::setName(const QString& name, int index) +void CueStack::setName(const QString &name, int index) { if (index < 0) m_name = name; @@ -147,7 +147,7 @@ uint CueStack::duration(int index) const * Cues ****************************************************************************/ -void CueStack::appendCue(const Cue& cue) +void CueStack::appendCue(const Cue &cue) { qDebug() << Q_FUNC_INFO; @@ -161,7 +161,7 @@ void CueStack::appendCue(const Cue& cue) emit added(index); } -void CueStack::insertCue(int index, const Cue& cue) +void CueStack::insertCue(int index, const Cue &cue) { qDebug() << Q_FUNC_INFO; @@ -188,7 +188,7 @@ void CueStack::insertCue(int index, const Cue& cue) appendCue(cue); } -void CueStack::replaceCue(int index, const Cue& cue) +void CueStack::replaceCue(int index, const Cue &cue) { qDebug() << Q_FUNC_INFO; @@ -231,7 +231,7 @@ void CueStack::removeCue(int index) } } -void CueStack::removeCues(const QList& indexes) +void CueStack::removeCues(const QList &indexes) { qDebug() << Q_FUNC_INFO; @@ -300,7 +300,7 @@ void CueStack::nextCue() * Save & Load ****************************************************************************/ -uint CueStack::loadXMLID(QXmlStreamReader& root) +uint CueStack::loadXMLID(QXmlStreamReader &root) { qDebug() << Q_FUNC_INFO; @@ -318,7 +318,7 @@ uint CueStack::loadXMLID(QXmlStreamReader& root) return UINT_MAX; } -bool CueStack::loadXML(QXmlStreamReader& root) +bool CueStack::loadXML(QXmlStreamReader &root) { qDebug() << Q_FUNC_INFO; @@ -355,7 +355,7 @@ bool CueStack::loadXML(QXmlStreamReader& root) return true; } -bool CueStack::saveXML(QXmlStreamWriter* doc, uint id) const +bool CueStack::saveXML(QXmlStreamWriter *doc, uint id) const { qDebug() << Q_FUNC_INFO; Q_ASSERT(doc != NULL); @@ -435,7 +435,7 @@ bool CueStack::isFlashing() const return m_flashing; } -void CueStack::writeDMX(MasterTimer* timer, QList ua) +void CueStack::writeDMX(MasterTimer *timer, QList ua) { Q_UNUSED(timer); if (m_cues.isEmpty()) @@ -501,7 +501,7 @@ void CueStack::preRun() emit started(); } -void CueStack::write(QList ua) +void CueStack::write(QList ua) { if (m_cues.size() == 0 || isRunning() == false) return; @@ -540,7 +540,7 @@ void CueStack::write(QList ua) m_elapsed += MasterTimer::tick(); } -void CueStack::postRun(MasterTimer* timer, QList ua) +void CueStack::postRun(MasterTimer *timer, QList ua) { qDebug() << Q_FUNC_INFO; @@ -594,7 +594,7 @@ int CueStack::previous() return m_currentIndex; } -FadeChannel* CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) +FadeChannel *CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) { // get the universe Fader first. If doesn't exist, create it QSharedPointer fader = m_fadersMap.value(universeID, QSharedPointer()); @@ -608,7 +608,7 @@ FadeChannel* CueStack::getFader(QList universes, quint32 universeID, return fader->getChannelFader(doc(), universes[universeID], fixtureID, channel); } -void CueStack::updateFaderValues(FadeChannel* fc, uchar value, uint fadeTime) +void CueStack::updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime) { fc->setStart(fc->current()); fc->setTarget(value); @@ -632,7 +632,7 @@ int CueStack::next() return m_currentIndex; } -void CueStack::switchCue(int from, int to, const QList ua) +void CueStack::switchCue(int from, int to, const QList ua) { qDebug() << Q_FUNC_INFO; @@ -655,7 +655,7 @@ void CueStack::switchCue(int from, int to, const QList ua) oldit.next(); uint absChannel = oldit.key(); quint32 universe = (absChannel >> 9); - FadeChannel* fc = getFader(ua, universe, Fixture::invalidId(), absChannel); + FadeChannel *fc = getFader(ua, universe, Fixture::invalidId(), absChannel); if (fc->flags() & FadeChannel::Intensity) updateFaderValues(fc, 0, oldCue.fadeOutSpeed()); @@ -668,7 +668,7 @@ void CueStack::switchCue(int from, int to, const QList ua) newit.next(); uint absChannel = newit.key(); quint32 universe = (absChannel >> 9); - FadeChannel* fc = getFader(ua, universe, Fixture::invalidId(), absChannel); + FadeChannel *fc = getFader(ua, universe, Fixture::invalidId(), absChannel); updateFaderValues(fc, newit.value(), newCue.fadeInSpeed()); } } diff --git a/engine/src/cuestack.h b/engine/src/cuestack.h index 3508330845..d0c03040c2 100644 --- a/engine/src/cuestack.h +++ b/engine/src/cuestack.h @@ -56,11 +56,11 @@ class CueStack : public QObject, public DMXSource * Initialization ************************************************************************/ public: - CueStack(Doc* doc); + CueStack(Doc *doc); ~CueStack(); private: - Doc* doc() const; + Doc *doc() const; /************************************************************************ * Name @@ -74,7 +74,7 @@ class CueStack : public QObject, public DMXSource * @param index -1 to set the name of the CueStack, anything else to set * the name of a specific cue. */ - void setName(const QString& name, int index = -1); + void setName(const QString &name, int index = -1); /** * Get either the name of the CueStack itself ($index = -1) or a Cue at @@ -164,19 +164,19 @@ class CueStack : public QObject, public DMXSource ************************************************************************/ public: /** Append $cue at the end of the cue stack */ - void appendCue(const Cue& cue); + void appendCue(const Cue &cue); /** Insert $cue at the given $index */ - void insertCue(int index, const Cue& cue); + void insertCue(int index, const Cue &cue); /** Replace the cue at the given $index with $cue */ - void replaceCue(int index, const Cue& cue); + void replaceCue(int index, const Cue &cue); /** Remove the cue at the given $index */ void removeCue(int index); /** Remove cues from the given $indexes */ - void removeCues(const QList& indexes); + void removeCues(const QList &indexes); /** Get a list of all cues */ QList cues() const; @@ -194,9 +194,9 @@ class CueStack : public QObject, public DMXSource * Load & Save ************************************************************************/ public: - static uint loadXMLID(QXmlStreamReader& root); - bool loadXML(QXmlStreamReader& root); - bool saveXML(QXmlStreamWriter* doc, uint id) const; + static uint loadXMLID(QXmlStreamReader &root); + bool loadXML(QXmlStreamReader &root); + bool saveXML(QXmlStreamWriter *doc, uint id) const; /************************************************************************ * Running @@ -232,7 +232,7 @@ class CueStack : public QObject, public DMXSource void setFlashing(bool enable); bool isFlashing() const; - void writeDMX(MasterTimer* timer, QList ua); + void writeDMX(MasterTimer *timer, QList ua); private: bool m_flashing; @@ -244,15 +244,15 @@ class CueStack : public QObject, public DMXSource bool isStarted() const; void preRun(); - void write(QList ua); - void postRun(MasterTimer* timer, QList ua); + void write(QList ua); + void postRun(MasterTimer *timer, QList ua); private: int next(); int previous(); - FadeChannel* getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); - void updateFaderValues(FadeChannel* fc, uchar value, uint fadeTime); - void switchCue(int from, int to, const QList ua); + FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); + void updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime); + void switchCue(int from, int to, const QList ua); private: /** Map used to lookup a GenericFader instance for a Universe ID */ diff --git a/engine/src/dmxsource.h b/engine/src/dmxsource.h index 0fe9e47889..21c302e8fd 100644 --- a/engine/src/dmxsource.h +++ b/engine/src/dmxsource.h @@ -47,7 +47,7 @@ class DMXSource * @param timer The calling MasterTimer instance * @param universes Universe buffer to write to */ - virtual void writeDMX(MasterTimer* timer, QList universes) = 0; + virtual void writeDMX(MasterTimer *timer, QList universes) = 0; /** Get/Set if the DMX source has changed */ bool hasChanged() diff --git a/engine/src/doc.cpp b/engine/src/doc.cpp index a235d317b9..54ed5883ba 100644 --- a/engine/src/doc.cpp +++ b/engine/src/doc.cpp @@ -65,7 +65,7 @@ #include "audiocapture_qt6.h" #endif -Doc::Doc(QObject* parent, int universes) +Doc::Doc(QObject *parent, int universes) : QObject(parent) , m_wsPath("") , m_fixtureDefCache(new QLCFixtureDefCache) @@ -135,7 +135,7 @@ void Doc::clearContents() QListIterator funcit(m_functions.keys()); while (funcit.hasNext() == true) { - Function* func = m_functions.take(funcit.next()); + Function *func = m_functions.take(funcit.next()); if (func == NULL) continue; emit functionRemoved(func->id()); @@ -146,7 +146,7 @@ void Doc::clearContents() QListIterator palIt(m_palettes.keys()); while (palIt.hasNext() == true) { - QLCPalette* palette = m_palettes.take(palIt.next()); + QLCPalette *palette = m_palettes.take(palIt.next()); emit paletteRemoved(palette->id()); delete palette; } @@ -155,7 +155,7 @@ void Doc::clearContents() QListIterator grpchans(m_channelsGroups.keys()); while (grpchans.hasNext() == true) { - ChannelsGroup* grp = m_channelsGroups.take(grpchans.next()); + ChannelsGroup *grp = m_channelsGroups.take(grpchans.next()); emit channelsGroupRemoved(grp->id()); delete grp; } @@ -164,7 +164,7 @@ void Doc::clearContents() QListIterator grpit(m_fixtureGroups.keys()); while (grpit.hasNext() == true) { - FixtureGroup* grp = m_fixtureGroups.take(grpit.next()); + FixtureGroup *grp = m_fixtureGroups.take(grpit.next()); quint32 grpID = grp->id(); delete grp; emit fixtureGroupRemoved(grpID); @@ -174,7 +174,7 @@ void Doc::clearContents() QListIterator fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { - Fixture* fxi = m_fixtures.take(fxit.next()); + Fixture *fxi = m_fixtures.take(fxit.next()); quint32 fxID = fxi->id(); delete fxi; emit fixtureRemoved(fxID); @@ -204,7 +204,7 @@ QString Doc::getWorkspacePath() const return m_wsPath; } -QString Doc::normalizeComponentPath(const QString& filePath) const +QString Doc::normalizeComponentPath(const QString &filePath) const { if (filePath.isEmpty()) return filePath; @@ -221,7 +221,7 @@ QString Doc::normalizeComponentPath(const QString& filePath) const } } -QString Doc::denormalizeComponentPath(const QString& filePath) const +QString Doc::denormalizeComponentPath(const QString &filePath) const { if (filePath.isEmpty()) return filePath; @@ -233,42 +233,42 @@ QString Doc::denormalizeComponentPath(const QString& filePath) const * Engine components *****************************************************************************/ -QLCFixtureDefCache* Doc::fixtureDefCache() const +QLCFixtureDefCache *Doc::fixtureDefCache() const { return m_fixtureDefCache; } -void Doc::setFixtureDefinitionCache(QLCFixtureDefCache* cache) +void Doc::setFixtureDefinitionCache(QLCFixtureDefCache *cache) { m_fixtureDefCache = cache; } -QLCModifiersCache* Doc::modifiersCache() const +QLCModifiersCache *Doc::modifiersCache() const { return m_modifiersCache; } -RGBScriptsCache* Doc::rgbScriptsCache() const +RGBScriptsCache *Doc::rgbScriptsCache() const { return m_rgbScriptsCache; } -IOPluginCache* Doc::ioPluginCache() const +IOPluginCache *Doc::ioPluginCache() const { return m_ioPluginCache; } -AudioPluginCache* Doc::audioPluginCache() const +AudioPluginCache *Doc::audioPluginCache() const { return m_audioPluginCache; } -InputOutputMap* Doc::inputOutputMap() const +InputOutputMap *Doc::inputOutputMap() const { return m_ioMap; } -MasterTimer* Doc::masterTimer() const +MasterTimer *Doc::masterTimer() const { return m_masterTimer; } @@ -345,7 +345,7 @@ void Doc::setMode(Doc::Mode mode) // Run startup function if (m_mode == Operate && m_startupFunctionId != Function::invalidId()) { - Function* func = function(m_startupFunctionId); + Function *func = function(m_startupFunctionId); if (func != NULL) { qDebug() << Q_FUNC_INFO << "Starting startup function. (" << m_startupFunctionId << ")"; @@ -380,7 +380,7 @@ bool Doc::isKiosk() const * Clipboard *********************************************************************/ -QLCClipboard* Doc::clipboard() +QLCClipboard *Doc::clipboard() { return m_clipboard; } @@ -402,7 +402,7 @@ quint32 Doc::createFixtureId() return m_latestFixtureId; } -bool Doc::addFixture(Fixture* fixture, quint32 id) +bool Doc::addFixture(Fixture *fixture, quint32 id) { Q_ASSERT(fixture != NULL); @@ -451,7 +451,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) } // Add the fixture channels capabilities to the universe they belong - QList universes = inputOutputMap()->claimUniverses(); + QList universes = inputOutputMap()->claimUniverses(); QList forcedHTP = fixture->forcedHTPChannels(); QList forcedLTP = fixture->forcedLTPChannels(); @@ -459,7 +459,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) for (i = 0; i < fixture->channels(); i++) { - const QLCChannel* channel(fixture->channel(i)); + const QLCChannel *channel(fixture->channel(i)); // Inform Universe of any HTP/LTP forcing if (forcedHTP.contains(int(i))) @@ -473,7 +473,7 @@ bool Doc::addFixture(Fixture* fixture, quint32 id) universes.at(uni)->setChannelDefaultValue(fxAddress + i, channel->defaultValue()); // Apply a channel modifier, if defined - ChannelModifier* mod = fixture->channelModifier(i); + ChannelModifier *mod = fixture->channelModifier(i); universes.at(uni)->setChannelModifier(fxAddress + i, mod); } inputOutputMap()->releaseUniverses(true); @@ -488,7 +488,7 @@ bool Doc::deleteFixture(quint32 id) { if (m_fixtures.contains(id) == true) { - Fixture* fxi = m_fixtures.take(id); + Fixture *fxi = m_fixtures.take(id); Q_ASSERT(fxi != NULL); m_fixturesListCacheUpToDate = false; @@ -519,13 +519,13 @@ bool Doc::deleteFixture(quint32 id) } } -bool Doc::replaceFixtures(QList newFixturesList) +bool Doc::replaceFixtures(QList newFixturesList) { // Delete all fixture instances QListIterator fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { - Fixture* fxi = m_fixtures.take(fxit.next()); + Fixture *fxi = m_fixtures.take(fxit.next()); disconnect(fxi, SIGNAL(changed(quint32)), this, SLOT(slotFixtureChanged(quint32))); delete fxi; m_fixturesListCacheUpToDate = false; @@ -533,39 +533,41 @@ bool Doc::replaceFixtures(QList newFixturesList) m_latestFixtureId = 0; m_addresses.clear(); - foreach (Fixture* fixture, newFixturesList) + foreach (Fixture *fixture, newFixturesList) { quint32 id = fixture->id(); // create a copy of the original cause remapping will // destroy it later - Fixture* newFixture = new Fixture(this); + Fixture *newFixture = new Fixture(this); newFixture->setID(id); newFixture->setName(fixture->name()); newFixture->setAddress(fixture->address()); newFixture->setUniverse(fixture->universe()); - if (fixture->fixtureDef() == NULL || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && - fixture->fixtureDef()->model() == KXMLFixtureGeneric)) + if (fixture->fixtureDef() == NULL + || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric + && fixture->fixtureDef()->model() == KXMLFixtureGeneric)) { // Generic dimmers just need to know the number of channels newFixture->setChannels(fixture->channels()); } - else if (fixture->fixtureDef() == NULL || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric && - fixture->fixtureDef()->model() == KXMLFixtureRGBPanel)) + else if (fixture->fixtureDef() == NULL + || (fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric + && fixture->fixtureDef()->model() == KXMLFixtureRGBPanel)) { // RGB Panels definitions are not cached or shared, so // let's make a deep copy of them - QLCFixtureDef* fixtureDef = new QLCFixtureDef(); + QLCFixtureDef *fixtureDef = new QLCFixtureDef(); *fixtureDef = *fixture->fixtureDef(); - QLCFixtureMode* mode = new QLCFixtureMode(fixtureDef); + QLCFixtureMode *mode = new QLCFixtureMode(fixtureDef); *mode = *fixture->fixtureMode(); newFixture->setFixtureDefinition(fixtureDef, mode); } else { - QLCFixtureDef* def = + QLCFixtureDef *def = fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(), fixture->fixtureDef()->model()); - QLCFixtureMode* mode = NULL; + QLCFixtureMode *mode = NULL; if (def != NULL) mode = def->mode(fixture->fixtureMode()->name()); newFixture->setFixtureDefinition(def, mode); @@ -596,10 +598,10 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi if (m_fixtures.contains(id) == false) return false; - Fixture* fixture = m_fixtures[id]; + Fixture *fixture = m_fixtures[id]; // get exclusive access to the universes list - QList universes = inputOutputMap()->claimUniverses(); - Universe* universe = universes.at(fixture->universe()); + QList universes = inputOutputMap()->claimUniverses(); + Universe *universe = universes.at(fixture->universe()); quint32 fxAddress = fixture->address(); // Set forced HTP channels @@ -611,7 +613,7 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi // Update the Fixture Universe with the current channel states for (quint32 i = 0; i < fixture->channels(); i++) { - const QLCChannel* channel(fixture->channel(i)); + const QLCChannel *channel(fixture->channel(i)); // Inform Universe of any HTP/LTP forcing if (forcedHTP.contains(int(i))) @@ -625,7 +627,7 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi universe->setChannelDefaultValue(fxAddress + i, channel->defaultValue()); // Apply a channel modifier, if defined - ChannelModifier* mod = fixture->channelModifier(i); + ChannelModifier *mod = fixture->channelModifier(i); universe->setChannelModifier(fxAddress + i, mod); } @@ -634,25 +636,25 @@ bool Doc::updateFixtureChannelCapabilities(quint32 id, QList forcedHTP, QLi return true; } -QList const& Doc::fixtures() const +QList const &Doc::fixtures() const { if (!m_fixturesListCacheUpToDate) { // Sort fixtures by id - QMap fixturesMap; - QHashIterator hashIt(m_fixtures); + QMap fixturesMap; + QHashIterator hashIt(m_fixtures); while (hashIt.hasNext()) { hashIt.next(); fixturesMap.insert(hashIt.key(), hashIt.value()); } - const_cast&>(m_fixturesListCache) = fixturesMap.values(); - const_cast(m_fixturesListCacheUpToDate) = true; + const_cast &>(m_fixturesListCache) = fixturesMap.values(); + const_cast(m_fixturesListCacheUpToDate) = true; } return m_fixturesListCache; } -Fixture* Doc::fixture(quint32 id) const +Fixture *Doc::fixture(quint32 id) const { return m_fixtures.value(id, NULL); } @@ -662,17 +664,17 @@ quint32 Doc::fixtureForAddress(quint32 universeAddress) const return m_addresses.value(universeAddress, Fixture::invalidId()); } -int Doc::totalPowerConsumption(int& fuzzy) const +int Doc::totalPowerConsumption(int &fuzzy) const { int totalPowerConsumption = 0; // Make sure fuzzy starts from zero fuzzy = 0; - QListIterator fxit(fixtures()); + QListIterator fxit(fixtures()); while (fxit.hasNext() == true) { - Fixture* fxi(fxit.next()); + Fixture *fxi(fxit.next()); Q_ASSERT(fxi != NULL); if (fxi->fixtureMode() != NULL) @@ -695,7 +697,7 @@ int Doc::totalPowerConsumption(int& fuzzy) const void Doc::slotFixtureChanged(quint32 id) { /* Keep track of fixture addresses */ - Fixture* fxi = fixture(id); + Fixture *fxi = fixture(id); // remove it QMutableHashIterator it(m_addresses); @@ -728,7 +730,7 @@ void Doc::slotFixtureChanged(quint32 id) * Fixture groups *****************************************************************************/ -bool Doc::addFixtureGroup(FixtureGroup* grp, quint32 id) +bool Doc::addFixtureGroup(FixtureGroup *grp, quint32 id) { Q_ASSERT(grp != NULL); @@ -760,7 +762,7 @@ bool Doc::deleteFixtureGroup(quint32 id) { if (m_fixtureGroups.contains(id) == true) { - FixtureGroup* grp = m_fixtureGroups.take(id); + FixtureGroup *grp = m_fixtureGroups.take(id); Q_ASSERT(grp != NULL); emit fixtureGroupRemoved(id); @@ -776,7 +778,7 @@ bool Doc::deleteFixtureGroup(quint32 id) } } -FixtureGroup* Doc::fixtureGroup(quint32 id) const +FixtureGroup *Doc::fixtureGroup(quint32 id) const { if (m_fixtureGroups.contains(id) == true) return m_fixtureGroups[id]; @@ -784,7 +786,7 @@ FixtureGroup* Doc::fixtureGroup(quint32 id) const return NULL; } -QList Doc::fixtureGroups() const +QList Doc::fixtureGroups() const { return m_fixtureGroups.values(); } @@ -794,8 +796,7 @@ quint32 Doc::createFixtureGroupId() /* This results in an endless loop if there are UINT_MAX-1 fixture groups. That, however, seems a bit unlikely. Are there even 4294967295-1 fixtures in total in the whole world? */ - while (m_fixtureGroups.contains(m_latestFixtureGroupId) == true || - m_latestFixtureGroupId == FixtureGroup::invalidId()) + while (m_fixtureGroups.contains(m_latestFixtureGroupId) == true || m_latestFixtureGroupId == FixtureGroup::invalidId()) { m_latestFixtureGroupId++; } @@ -812,7 +813,7 @@ void Doc::slotFixtureGroupChanged(quint32 id) /********************************************************************* * Channels groups *********************************************************************/ -bool Doc::addChannelsGroup(ChannelsGroup* grp, quint32 id) +bool Doc::addChannelsGroup(ChannelsGroup *grp, quint32 id) { Q_ASSERT(grp != NULL); @@ -835,7 +836,7 @@ bool Doc::deleteChannelsGroup(quint32 id) { if (m_channelsGroups.contains(id) == true) { - ChannelsGroup* grp = m_channelsGroups.take(id); + ChannelsGroup *grp = m_channelsGroups.take(id); Q_ASSERT(grp != NULL); emit channelsGroupRemoved(id); @@ -874,7 +875,7 @@ bool Doc::moveChannelGroup(quint32 id, int direction) return true; } -ChannelsGroup* Doc::channelsGroup(quint32 id) const +ChannelsGroup *Doc::channelsGroup(quint32 id) const { if (m_channelsGroups.contains(id) == true) return m_channelsGroups[id]; @@ -882,9 +883,9 @@ ChannelsGroup* Doc::channelsGroup(quint32 id) const return NULL; } -QList Doc::channelsGroups() const +QList Doc::channelsGroups() const { - QList orderedList; + QList orderedList; for (int i = 0; i < m_orderedGroups.count(); i++) { @@ -895,8 +896,8 @@ QList Doc::channelsGroups() const quint32 Doc::createChannelsGroupId() { - while (m_channelsGroups.contains(m_latestChannelsGroupId) == true || - m_latestChannelsGroupId == ChannelsGroup::invalidId()) + while (m_channelsGroups.contains(m_latestChannelsGroupId) == true + || m_latestChannelsGroupId == ChannelsGroup::invalidId()) { m_latestChannelsGroupId++; } @@ -908,7 +909,7 @@ quint32 Doc::createChannelsGroupId() * Palettes *********************************************************************/ -bool Doc::addPalette(QLCPalette* palette, quint32 id) +bool Doc::addPalette(QLCPalette *palette, quint32 id) { Q_ASSERT(palette != NULL); @@ -937,7 +938,7 @@ bool Doc::deletePalette(quint32 id) { if (m_palettes.contains(id) == true) { - QLCPalette* palette = m_palettes.take(id); + QLCPalette *palette = m_palettes.take(id); Q_ASSERT(palette != NULL); emit paletteRemoved(id); @@ -953,7 +954,7 @@ bool Doc::deletePalette(quint32 id) } } -QLCPalette* Doc::palette(quint32 id) const +QLCPalette *Doc::palette(quint32 id) const { if (m_palettes.contains(id) == true) return m_palettes[id]; @@ -961,7 +962,7 @@ QLCPalette* Doc::palette(quint32 id) const return NULL; } -QList Doc::palettes() const +QList Doc::palettes() const { return m_palettes.values(); } @@ -993,7 +994,7 @@ quint32 Doc::createFunctionId() return m_latestFunctionId; } -bool Doc::addFunction(Function* func, quint32 id) +bool Doc::addFunction(Function *func, quint32 id) { Q_ASSERT(func != NULL); @@ -1026,15 +1027,15 @@ bool Doc::addFunction(Function* func, quint32 id) } } -QList Doc::functions() const +QList Doc::functions() const { return m_functions.values(); } -QList Doc::functionsByType(Function::Type type) const +QList Doc::functionsByType(Function::Type type) const { - QList list; - foreach (Function* f, m_functions) + QList list; + foreach (Function *f, m_functions) { if (f != NULL && f->type() == type) list.append(f); @@ -1042,9 +1043,9 @@ QList Doc::functionsByType(Function::Type type) const return list; } -Function* Doc::functionByName(QString name) +Function *Doc::functionByName(QString name) { - foreach (Function* f, m_functions) + foreach (Function *f, m_functions) { if (f != NULL && f->name() == name) return f; @@ -1056,7 +1057,7 @@ bool Doc::deleteFunction(quint32 id) { if (m_functions.contains(id) == true) { - Function* func = m_functions.take(id); + Function *func = m_functions.take(id); Q_ASSERT(func != NULL); if (m_startupFunctionId == id) @@ -1075,7 +1076,7 @@ bool Doc::deleteFunction(quint32 id) } } -Function* Doc::function(quint32 id) const +Function *Doc::function(quint32 id) const { if (m_functions.contains(id) == true) return m_functions[id]; @@ -1108,7 +1109,7 @@ QList Doc::getUsage(quint32 fid) { QList usageList; - foreach (Function* f, m_functions) + foreach (Function *f, m_functions) { if (f->id() == fid) continue; @@ -1117,7 +1118,7 @@ QList Doc::getUsage(quint32 fid) { case Function::CollectionType: { - Collection* c = qobject_cast(f); + Collection *c = qobject_cast(f); int pos = c->functions().indexOf(fid); if (pos != -1) { @@ -1129,10 +1130,10 @@ QList Doc::getUsage(quint32 fid) case Function::ChaserType: { - Chaser* c = qobject_cast(f); + Chaser *c = qobject_cast(f); for (int i = 0; i < c->stepsCount(); i++) { - ChaserStep* cs = c->stepAt(i); + ChaserStep *cs = c->stepAt(i); if (cs->fid == fid) { usageList.append(f->id()); @@ -1143,7 +1144,7 @@ QList Doc::getUsage(quint32 fid) break; case Function::SequenceType: { - Sequence* s = qobject_cast(f); + Sequence *s = qobject_cast(f); if (s->boundSceneID() == fid) { usageList.append(f->id()); @@ -1153,7 +1154,7 @@ QList Doc::getUsage(quint32 fid) break; case Function::ScriptType: { - Script* s = qobject_cast(f); + Script *s = qobject_cast" - "
" + - tr("Loading project...") + "
") - .toUtf8(); + QByteArray postReply = QString("\n\n" + "" + "
" + + tr("Loading project...") + "
") + .toUtf8(); resp->setHeader("Content-Type", "text/html"); resp->setHeader("Content-Length", QString::number(postReply.size())); @@ -201,15 +202,15 @@ void WebAccess::slotHandleRequest(QHttpRequest* req, QHttpResponse* resp) m_doc->fixtureDefCache()->storeFixtureDef(fxName, QString(fixtureXML).toUtf8()); - QByteArray postReply = - QString("\n\n" - "") - .toUtf8(); + QByteArray postReply = QString("\n\n" + "") + .toUtf8(); resp->setHeader("Content-Type", "text/html"); resp->setHeader("Content-Length", QString::number(postReply.size())); @@ -264,28 +265,28 @@ void WebAccess::slotHandleRequest(QHttpRequest* req, QHttpResponse* resp) else if (reqUrl.endsWith(".css")) { QString clUri = reqUrl.mid(1); - if (sendFile( - resp, - QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), - "text/css") == true) + if (sendFile(resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/css") + == true) return; } else if (reqUrl.endsWith(".js")) { QString clUri = reqUrl.mid(1); - if (sendFile( - resp, - QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), - "text/javascript") == true) + if (sendFile(resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/javascript") + == true) return; } else if (reqUrl.endsWith(".html")) { QString clUri = reqUrl.mid(1); - if (sendFile( - resp, - QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), - "text/html") == true) + if (sendFile(resp, + QString("%1%2%3").arg(QLCFile::systemDirectory(WEBFILESDIR).path()).arg(QDir::separator()).arg(clUri), + "text/html") + == true) return; } else if (reqUrl != "/") @@ -311,12 +312,12 @@ void WebAccess::slotHandleRequest(QHttpRequest* req, QHttpResponse* resp) return; } -void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) +void WebAccess::slotHandleWebSocketRequest(QHttpConnection *conn, QString data) { if (conn == NULL) return; - WebAccessUser* user = static_cast(conn->userData); + WebAccessUser *user = static_cast(conn->userData); qDebug() << "[websocketDataHandler]" << data; @@ -361,11 +362,10 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) } else if (cmdList[1] == "PROFILE") { - InputPatch* inPatch = m_doc->inputOutputMap()->inputPatch(universe); + InputPatch *inPatch = m_doc->inputOutputMap()->inputPatch(universe); if (inPatch != NULL) { - m_doc->inputOutputMap()->setInputPatch(universe, inPatch->pluginName(), "", inPatch->input(), - cmdList[3]); + m_doc->inputOutputMap()->setInputPatch(universe, inPatch->pluginName(), "", inPatch->input(), cmdList[3]); m_doc->inputOutputMap()->saveDefaults(); } } @@ -472,8 +472,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) { if (m_netConfig->updateNetworkFile(cmdList) == true) { - QString wsMessage = - QString("ALERT|" + tr("Network configuration changed. Reboot to apply the changes.")); + QString wsMessage = QString("ALERT|" + tr("Network configuration changed. Reboot to apply the changes.")); conn->webSocketWrite(QHttpConnection::TextFrame, wsMessage.toUtf8()); return; } @@ -498,12 +497,12 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) } else if (cmdList.at(1) == "REBOOT") { - QProcess* rebootProcess = new QProcess(); + QProcess *rebootProcess = new QProcess(); rebootProcess->start("reboot", QStringList()); } else if (cmdList.at(1) == "HALT") { - QProcess* haltProcess = new QProcess(); + QProcess *haltProcess = new QProcess(); haltProcess->start("halt", QStringList()); } } @@ -536,7 +535,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) } else if (apiCmd == "getFunctionsList") { - foreach (Function* f, m_doc->functions()) + foreach (Function *f, m_doc->functions()) wsAPIMessage.append(QString("%1|%2|").arg(f->id()).arg(f->name())); // remove trailing separator wsAPIMessage.truncate(wsAPIMessage.length() - 1); @@ -547,7 +546,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) return; quint32 fID = cmdList[2].toUInt(); - Function* f = m_doc->function(fID); + Function *f = m_doc->function(fID); if (f != NULL) wsAPIMessage.append(m_doc->function(fID)->typeString()); else @@ -559,7 +558,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) return; quint32 fID = cmdList[2].toUInt(); - Function* f = m_doc->function(fID); + Function *f = m_doc->function(fID); if (f != NULL) { if (f->isRunning()) @@ -577,7 +576,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) quint32 fID = cmdList[2].toUInt(); quint32 newStatus = cmdList[3].toUInt(); - Function* f = m_doc->function(fID); + Function *f = m_doc->function(fID); if (f != NULL) { @@ -590,14 +589,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) } else if (apiCmd == "getWidgetsNumber") { - VCFrame* mainFrame = m_vc->contents(); - QList chList = mainFrame->findChildren(); + VCFrame *mainFrame = m_vc->contents(); + QList chList = mainFrame->findChildren(); wsAPIMessage.append(QString::number(chList.count())); } else if (apiCmd == "getWidgetsList") { - VCFrame* mainFrame = m_vc->contents(); - foreach (VCWidget* widget, mainFrame->findChildren()) + VCFrame *mainFrame = m_vc->contents(); + foreach (VCWidget *widget, mainFrame->findChildren()) wsAPIMessage.append(QString("%1|%2|").arg(widget->id()).arg(widget->caption())); // remove trailing separator wsAPIMessage.truncate(wsAPIMessage.length() - 1); @@ -608,7 +607,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) return; quint32 wID = cmdList[2].toUInt(); - VCWidget* widget = m_vc->widget(wID); + VCWidget *widget = m_vc->widget(wID); if (widget != NULL) wsAPIMessage.append(widget->typeToString(widget->type())); else @@ -620,14 +619,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) return; quint32 wID = cmdList[2].toUInt(); - VCWidget* widget = m_vc->widget(wID); + VCWidget *widget = m_vc->widget(wID); if (widget != NULL) { switch (widget->type()) { case VCWidget::ButtonWidget: { - VCButton* button = qobject_cast(widget); + VCButton *button = qobject_cast(widget); if (button->state() == VCButton::Active) wsAPIMessage.append("255"); else if (button->state() == VCButton::Monitoring) @@ -638,15 +637,15 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) break; case VCWidget::SliderWidget: { - VCSlider* slider = qobject_cast(widget); + VCSlider *slider = qobject_cast(widget); wsAPIMessage.append(QString::number(slider->sliderValue())); } break; case VCWidget::CueListWidget: { - VCCueList* cue = qobject_cast(widget); + VCCueList *cue = qobject_cast(widget); quint32 chaserID = cue->chaserID(); - Function* f = m_doc->function(chaserID); + Function *f = m_doc->function(chaserID); if (f != NULL && f->isRunning()) wsAPIMessage.append(QString("PLAY|%2|").arg(cue->getCurrentIndex())); else @@ -730,7 +729,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) * followed by specific parameters */ quint32 widgetID = cmdList[0].toUInt(); - VCWidget* widget = m_vc->widget(widgetID); + VCWidget *widget = m_vc->widget(widgetID); uchar value = 0; if (cmdList.count() > 1) value = (uchar)cmdList[1].toInt(); @@ -741,7 +740,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) { case VCWidget::ButtonWidget: { - VCButton* button = qobject_cast(widget); + VCButton *button = qobject_cast(widget); if (value) button->pressFunction(); else @@ -750,14 +749,14 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) break; case VCWidget::SliderWidget: { - VCSlider* slider = qobject_cast(widget); + VCSlider *slider = qobject_cast(widget); slider->setSliderValue(value, false, true); slider->updateFeedback(); } break; case VCWidget::AudioTriggersWidget: { - VCAudioTriggers* triggers = qobject_cast(widget); + VCAudioTriggers *triggers = qobject_cast(widget); triggers->toggleEnableButton(value ? true : false); } break; @@ -766,7 +765,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) if (cmdList.count() < 2) return; - VCCueList* cue = qobject_cast(widget); + VCCueList *cue = qobject_cast(widget); if (cmdList[1] == "PLAY") cue->slotPlayback(); else if (cmdList[1] == "STOP") @@ -782,7 +781,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) case VCWidget::FrameWidget: case VCWidget::SoloFrameWidget: { - VCFrame* frame = qobject_cast(widget); + VCFrame *frame = qobject_cast(widget); if (cmdList[1] == "NEXT_PG") frame->slotNextPage(); else if (cmdList[1] == "PREV_PG") @@ -791,7 +790,7 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) break; case VCWidget::ClockWidget: { - VCClock* clock = qobject_cast(widget); + VCClock *clock = qobject_cast(widget); if (cmdList[1] == "S") clock->playPauseTimer(); else if (cmdList[1] == "R") @@ -804,11 +803,11 @@ void WebAccess::slotHandleWebSocketRequest(QHttpConnection* conn, QString data) } } -void WebAccess::slotHandleWebSocketClose(QHttpConnection* conn) +void WebAccess::slotHandleWebSocketClose(QHttpConnection *conn) { if (conn->userData) { - WebAccessUser* user = static_cast(conn->userData); + WebAccessUser *user = static_cast(conn->userData); delete user; conn->userData = 0; } @@ -816,7 +815,7 @@ void WebAccess::slotHandleWebSocketClose(QHttpConnection* conn) m_webSocketsList.removeOne(conn); } -bool WebAccess::sendFile(QHttpResponse* response, QString filename, QString contentType) +bool WebAccess::sendFile(QHttpResponse *response, QString filename, QString contentType) { QFile resFile(filename); if (resFile.open(QIODevice::ReadOnly)) @@ -840,11 +839,11 @@ bool WebAccess::sendFile(QHttpResponse* response, QString filename, QString cont void WebAccess::sendWebSocketMessage(QByteArray message) { - foreach (QHttpConnection* conn, m_webSocketsList) + foreach (QHttpConnection *conn, m_webSocketsList) conn->webSocketWrite(QHttpConnection::TextFrame, message); } -QString WebAccess::getWidgetBackgroundImage(VCWidget* widget) +QString WebAccess::getWidgetBackgroundImage(VCWidget *widget) { if (widget == NULL || widget->backgroundImage().isEmpty()) return QString(); @@ -857,23 +856,23 @@ QString WebAccess::getWidgetBackgroundImage(VCWidget* widget) return str; } -QString WebAccess::getWidgetHTML(VCWidget* widget) +QString WebAccess::getWidgetHTML(VCWidget *widget) { QString str = "
x()) + - "px; " - "top: " + - QString::number(widget->y()) + - "px; " - "width: " + - QString::number(widget->width()) + - "px; " - "height: " + - QString::number(widget->height()) + - "px; " - "background-color: " + - widget->backgroundColor().name() + ";" + getWidgetBackgroundImage(widget) + "\">\n"; + "left: " + + QString::number(widget->x()) + + "px; " + "top: " + + QString::number(widget->y()) + + "px; " + "width: " + + QString::number(widget->width()) + + "px; " + "height: " + + QString::number(widget->height()) + + "px; " + "background-color: " + + widget->backgroundColor().name() + ";" + getWidgetBackgroundImage(widget) + "\">\n"; str += tr("Widget not supported (yet) for web access") + "
\n"; @@ -882,7 +881,7 @@ QString WebAccess::getWidgetHTML(VCWidget* widget) void WebAccess::slotFramePageChanged(int pageNum) { - VCWidget* frame = qobject_cast(sender()); + VCWidget *frame = qobject_cast(sender()); if (frame == NULL) return; @@ -892,36 +891,35 @@ void WebAccess::slotFramePageChanged(int pageNum) sendWebSocketMessage(ba); } -QString WebAccess::getFrameHTML(VCFrame* frame) +QString WebAccess::getFrameHTML(VCFrame *frame) { QColor border(90, 90, 90); QSize origSize = frame->originalSize(); int w = frame->isCollapsed() ? 200 : origSize.width(); int h = frame->isCollapsed() ? 36 : origSize.height(); - QString str = "
id()) + - "\" " - "style=\"left: " + - QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + - "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + - "px; " - "background-color: " + - frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + - border.name() + ";\">\n"; + QString str = "
id()) + + "\" " + "style=\"left: " + + QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + + "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + + "px; " + "background-color: " + + frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + + border.name() + ";\">\n"; str += getChildrenHTML(frame, frame->totalPagesNumber(), frame->currentPage()); if (frame->isHeaderVisible()) { - str += - "id()) + ");\">\n"; - str += "
foregroundColor().name() + - ";\">
" + frame->caption() + "
\n"; + str += "
foregroundColor().name() + + ";\">
" + frame->caption() + "
\n"; m_JScode += "framesWidth[" + QString::number(frame->id()) + "] = " + QString::number(origSize.width()) + ";\n"; - m_JScode += - "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; + m_JScode += "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; if (frame->multipageMode()) { @@ -930,18 +928,18 @@ QString WebAccess::getFrameHTML(VCFrame* frame) str += "id()) + ");\">"; str += ""; - str += "
id()) + - "Page\">"; + str += "
id()) + + "Page\">"; str += QString("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; str += "id()) + ");\">"; str += "\n"; str += "
\n"; - m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + - "] = " + QString::number(frame->currentPage()) + ";\n"; - m_JScode += "framesTotalPages[" + QString::number(frame->id()) + - "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; + m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + + "] = " + QString::number(frame->currentPage()) + ";\n"; + m_JScode += "framesTotalPages[" + QString::number(frame->id()) + + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; connect(frame, SIGNAL(pageChanged(int)), this, SLOT(slotFramePageChanged(int))); } } @@ -951,36 +949,35 @@ QString WebAccess::getFrameHTML(VCFrame* frame) return str; } -QString WebAccess::getSoloFrameHTML(VCSoloFrame* frame) +QString WebAccess::getSoloFrameHTML(VCSoloFrame *frame) { QColor border(255, 0, 0); QSize origSize = frame->originalSize(); int w = frame->isCollapsed() ? 200 : origSize.width(); int h = frame->isCollapsed() ? 36 : origSize.height(); - QString str = "
id()) + - "\" " - "style=\"left: " + - QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + - "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + - "px; " - "background-color: " + - frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + - border.name() + ";\">\n"; + QString str = "
id()) + + "\" " + "style=\"left: " + + QString::number(frame->x()) + "px; top: " + QString::number(frame->y()) + + "px; width: " + QString::number(w) + "px; height: " + QString::number(h) + + "px; " + "background-color: " + + frame->backgroundColor().name() + "; " + getWidgetBackgroundImage(frame) + "border: 1px solid " + + border.name() + ";\">\n"; str += getChildrenHTML(frame, frame->totalPagesNumber(), frame->currentPage()); if (frame->isHeaderVisible()) { - str += - "id()) + ");\">\n"; - str += "
foregroundColor().name() + - ";\">
" + frame->caption() + "
\n"; + str += "
foregroundColor().name() + + ";\">
" + frame->caption() + "
\n"; m_JScode += "framesWidth[" + QString::number(frame->id()) + "] = " + QString::number(origSize.width()) + ";\n"; - m_JScode += - "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; + m_JScode += "framesHeight[" + QString::number(frame->id()) + "] = " + QString::number(origSize.height()) + ";\n"; if (frame->multipageMode()) { @@ -989,18 +986,18 @@ QString WebAccess::getSoloFrameHTML(VCSoloFrame* frame) str += "id()) + ");\">"; str += ""; - str += "
id()) + - "Page\">"; + str += "
id()) + + "Page\">"; str += QString("%1 %2").arg(tr("Page")).arg(frame->currentPage() + 1) + "
"; str += "id()) + ");\">"; str += "\n"; str += "
\n"; - m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + - "] = " + QString::number(frame->currentPage()) + ";\n"; - m_JScode += "framesTotalPages[" + QString::number(frame->id()) + - "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; + m_JScode += "framesCurrentPage[" + QString::number(frame->id()) + + "] = " + QString::number(frame->currentPage()) + ";\n"; + m_JScode += "framesTotalPages[" + QString::number(frame->id()) + + "] = " + QString::number(frame->totalPagesNumber()) + ";\n\n"; connect(frame, SIGNAL(pageChanged(int)), this, SLOT(slotFramePageChanged(int))); } } @@ -1012,7 +1009,7 @@ QString WebAccess::getSoloFrameHTML(VCSoloFrame* frame) void WebAccess::slotButtonStateChanged(int state) { - VCButton* btn = qobject_cast(sender()); + VCButton *btn = qobject_cast(sender()); if (btn == NULL) return; @@ -1029,7 +1026,7 @@ void WebAccess::slotButtonStateChanged(int state) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getButtonHTML(VCButton* btn) +QString WebAccess::getButtonHTML(VCButton *btn) { QString onCSS = ""; if (btn->state() == VCButton::Active) @@ -1038,31 +1035,30 @@ QString WebAccess::getButtonHTML(VCButton* btn) onCSS = "border: 3px solid #FFAA00;"; QString str = "\n"; + "left: " + + QString::number(btn->x()) + + "px; " + "top: " + + QString::number(btn->y()) + "px;\">\n"; + str += "id()) + + "\" " + "href=\"javascript:void(0);\" " + "onmousedown=\"buttonPress(" + + QString::number(btn->id()) + + ");\" " + "onmouseup=\"buttonRelease(" + + QString::number(btn->id()) + + ");\" " + "style=\"" + "width: " + + QString::number(btn->width()) + + "px; " + "height: " + + QString::number(btn->height()) + + "px; " + "color: " + + btn->foregroundColor().name() + "; " + getWidgetBackgroundImage(btn) + "background-color: " + + btn->backgroundColor().name() + "; " + onCSS + "\">" + btn->caption() + "\n
\n"; connect(btn, SIGNAL(stateChanged(int)), this, SLOT(slotButtonStateChanged(int))); @@ -1071,7 +1067,7 @@ QString WebAccess::getButtonHTML(VCButton* btn) void WebAccess::slotSliderValueChanged(QString val) { - VCSlider* slider = qobject_cast(sender()); + VCSlider *slider = qobject_cast(sender()); if (slider == NULL) return; @@ -1081,95 +1077,95 @@ void WebAccess::slotSliderValueChanged(QString val) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getSliderHTML(VCSlider* slider) +QString WebAccess::getSliderHTML(VCSlider *slider) { QString slID = QString::number(slider->id()); QString str = "
x()) + - "px; " - "top: " + - QString::number(slider->y()) + - "px; " - "width: " + - QString::number(slider->width()) + - "px; " - "height: " + - QString::number(slider->height()) + - "px; " - "background-color: " + - slider->backgroundColor().name() + ";" + getWidgetBackgroundImage(slider) + "\">\n"; - - str += "
" + - slider->topLabelText() + "
\n"; + "left: " + + QString::number(slider->x()) + + "px; " + "top: " + + QString::number(slider->y()) + + "px; " + "width: " + + QString::number(slider->width()) + + "px; " + "height: " + + QString::number(slider->height()) + + "px; " + "background-color: " + + slider->backgroundColor().name() + ";" + getWidgetBackgroundImage(slider) + "\">\n"; + + str += "
" + + slider->topLabelText() + "
\n"; str += "height() - 50) + - "px; " - "margin-top: " + - QString::number(slider->height() - 50) + - "px; " - "margin-left: " + - QString::number(slider->width() / 2) + "px;\" "; + "id=\"" + + slID + + "\" " + "oninput=\"slVchange(" + + slID + ");\" ontouchmove=\"slVchange(" + slID + + ");\" " + "style=\"" + "width: " + + QString::number(slider->height() - 50) + + "px; " + "margin-top: " + + QString::number(slider->height() - 50) + + "px; " + "margin-left: " + + QString::number(slider->width() / 2) + "px;\" "; if (slider->sliderMode() == VCSlider::Level) - str += "min=\"" + QString::number(slider->levelLowLimit()) + "\" max=\"" + - QString::number(slider->levelHighLimit()) + "\" "; + str += "min=\"" + QString::number(slider->levelLowLimit()) + "\" max=\"" + + QString::number(slider->levelHighLimit()) + "\" "; else str += "min=\"0\" max=\"255\" "; str += "step=\"1\" value=\"" + QString::number(slider->sliderValue()) + "\">\n"; - str += "
" + - slider->caption() + - "
\n" - "
\n"; + str += "
" + + slider->caption() + + "
\n" + "
\n"; connect(slider, SIGNAL(valueChanged(QString)), this, SLOT(slotSliderValueChanged(QString))); return str; } -QString WebAccess::getLabelHTML(VCLabel* label) +QString WebAccess::getLabelHTML(VCLabel *label) { QString str = "
x()) + - "px; " - "top: " + - QString::number(label->y()) + "px;\">\n"; + "left: " + + QString::number(label->x()) + + "px; " + "top: " + + QString::number(label->y()) + "px;\">\n"; str += "
width()) + - "px; " - "height: " + - QString::number(label->height()) + - "px; " - "color: " + - label->foregroundColor().name() + - "; " - "background-color: " + - label->backgroundColor().name() + "; " + getWidgetBackgroundImage(label) + "\">" + label->caption() + - "
\n
\n"; + "width: " + + QString::number(label->width()) + + "px; " + "height: " + + QString::number(label->height()) + + "px; " + "color: " + + label->foregroundColor().name() + + "; " + "background-color: " + + label->backgroundColor().name() + "; " + getWidgetBackgroundImage(label) + "\">" + label->caption() + + "
\n
\n"; return str; } void WebAccess::slotAudioTriggersToggled(bool toggle) { - VCAudioTriggers* triggers = qobject_cast(sender()); + VCAudioTriggers *triggers = qobject_cast(sender()); if (triggers == NULL) return; @@ -1180,30 +1176,30 @@ void WebAccess::slotAudioTriggersToggled(bool toggle) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getAudioTriggersHTML(VCAudioTriggers* triggers) +QString WebAccess::getAudioTriggersHTML(VCAudioTriggers *triggers) { - QString str = "
x()) + - "px; top: " + QString::number(triggers->y()) + "px; width: " + QString::number(triggers->width()) + - "px; height: " + QString::number(triggers->height()) + - "px; " - "background-color: " + - triggers->backgroundColor().name() + ";\">\n"; + QString str = "
x()) + + "px; top: " + QString::number(triggers->y()) + "px; width: " + QString::number(triggers->width()) + + "px; height: " + QString::number(triggers->height()) + + "px; " + "background-color: " + + triggers->backgroundColor().name() + ";\">\n"; - str += "
foregroundColor().name() + "\">" + - triggers->caption() + "
\n"; + str += "
foregroundColor().name() + "\">" + + triggers->caption() + "
\n"; str += "
\n"; @@ -1214,7 +1210,7 @@ QString WebAccess::getAudioTriggersHTML(VCAudioTriggers* triggers) void WebAccess::slotCueIndexChanged(int idx) { - VCCueList* cue = qobject_cast(sender()); + VCCueList *cue = qobject_cast(sender()); if (cue == NULL) return; @@ -1223,16 +1219,16 @@ void WebAccess::slotCueIndexChanged(int idx) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getCueListHTML(VCCueList* cue) +QString WebAccess::getCueListHTML(VCCueList *cue) { - QString str = "
id()) + - "\" " - "class=\"vccuelist\" style=\"left: " + - QString::number(cue->x()) + "px; top: " + QString::number(cue->y()) + - "px; width: " + QString::number(cue->width()) + "px; height: " + QString::number(cue->height()) + - "px; " - "background-color: " + - cue->backgroundColor().name() + ";\">\n"; + QString str = "
id()) + + "\" " + "class=\"vccuelist\" style=\"left: " + + QString::number(cue->x()) + "px; top: " + QString::number(cue->y()) + + "px; width: " + QString::number(cue->width()) + "px; height: " + QString::number(cue->height()) + + "px; " + "background-color: " + + cue->backgroundColor().name() + ";\">\n"; str += "
height() - 34) + "px; overflow: scroll;\" >\n"; str += "
" + tr("Fade Out") + "" + tr("Duration") + "" + tr("Notes") + "
" + QString::number(i + 1) + "" + Function::speedToString(chaser->fadeInSpeed()) + "" + Function::speedToString(step->fadeIn) + "" + Function::speedToString(step.hold) + "" + Function::speedToString(step.hold) + "" + Function::speedToString(chaser->fadeOutSpeed()) + "" + Function::speedToString(step->fadeOut) + "" + Function::speedToString(chaser->duration()) + "" + Function::speedToString(step->duration) + "" + step->note + "
%1%2%3
\n"; @@ -1241,24 +1237,24 @@ QString WebAccess::getCueListHTML(VCCueList* cue) str += ""; str += ""; str += "\n"; - Chaser* chaser = cue->chaser(); - Doc* doc = m_vc->getDoc(); + Chaser *chaser = cue->chaser(); + Doc *doc = m_vc->getDoc(); if (chaser != NULL) { for (int i = 0; i < chaser->stepsCount(); i++) { QString stepID = QString::number(cue->id()) + "_" + QString::number(i); - str += "id()) + ", " + QString::number(i) + - ");\" " - "onmouseover=\"this.style.backgroundColor='#CCD9FF';\" " - "onmouseout=\"checkMouseOut(" + - QString::number(cue->id()) + ", " + QString::number(i) + ");\">\n"; - ChaserStep* step = chaser->stepAt(i); + str += "id()) + ", " + QString::number(i) + + ");\" " + "onmouseover=\"this.style.backgroundColor='#CCD9FF';\" " + "onmouseout=\"checkMouseOut(" + + QString::number(cue->id()) + ", " + QString::number(i) + ");\">\n"; + ChaserStep *step = chaser->stepAt(i); str += ""; - Function* function = doc->function(step->fid); + Function *function = doc->function(step->fid); if (function != NULL) { str += ""; @@ -1369,7 +1365,7 @@ QString WebAccess::getCueListHTML(VCCueList* cue) void WebAccess::slotClockTimeChanged(quint32 time) { - VCClock* clock = qobject_cast(sender()); + VCClock *clock = qobject_cast(sender()); if (clock == NULL) return; @@ -1377,14 +1373,14 @@ void WebAccess::slotClockTimeChanged(quint32 time) sendWebSocketMessage(wsMessage.toUtf8()); } -QString WebAccess::getClockHTML(VCClock* clock) +QString WebAccess::getClockHTML(VCClock *clock) { QString str = "
x()) + - "px; " - "top: " + - QString::number(clock->y()) + "px;\">\n"; + "left: " + + QString::number(clock->x()) + + "px; " + "top: " + + QString::number(clock->y()) + "px;\">\n"; str += "id()) + "\" class=\"vclabel "; if (clock->clockType() == VCClock::Stopwatch || clock->clockType() == VCClock::Countdown) @@ -1400,16 +1396,16 @@ QString WebAccess::getClockHTML(VCClock* clock) str += "vcclock\" href=\"javascript:void(0)\""; } - str += "style=\"width: " + QString::number(clock->width()) + - "px; " - "height: " + - QString::number(clock->height()) + - "px; " - "color: " + - clock->foregroundColor().name() + - "; " - "background-color: " + - clock->backgroundColor().name() + ";" + getWidgetBackgroundImage(clock) + "\">"; + str += "style=\"width: " + QString::number(clock->width()) + + "px; " + "height: " + + QString::number(clock->height()) + + "px; " + "color: " + + clock->foregroundColor().name() + + "; " + "background-color: " + + clock->backgroundColor().name() + ";" + getWidgetBackgroundImage(clock) + "\">"; if (clock->clockType() == VCClock::Stopwatch) @@ -1431,14 +1427,14 @@ QString WebAccess::getClockHTML(VCClock* clock) return str; } -QString WebAccess::getChildrenHTML(VCWidget* frame, int pagesNum, int currentPageIdx) +QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPageIdx) { if (frame == NULL) return QString(); QString unifiedHTML; QStringList pagesHTML; - VCFrame* lframe = qobject_cast(frame); + VCFrame *lframe = qobject_cast(frame); if (lframe == NULL) return ""; @@ -1455,11 +1451,11 @@ QString WebAccess::getChildrenHTML(VCWidget* frame, int pagesNum, int currentPag } } - QList chList = frame->findChildren(); + QList chList = frame->findChildren(); qDebug() << "getChildrenHTML: found " << chList.count() << " children"; - foreach (VCWidget* widget, chList) + foreach (VCWidget *widget, chList) { if (widget->parentWidget() != frame) continue; @@ -1476,28 +1472,28 @@ QString WebAccess::getChildrenHTML(VCWidget* frame, int pagesNum, int currentPag switch (widget->type()) { case VCWidget::FrameWidget: - str = getFrameHTML(qobject_cast(widget)); + str = getFrameHTML(qobject_cast(widget)); break; case VCWidget::SoloFrameWidget: - str = getSoloFrameHTML(qobject_cast(widget)); + str = getSoloFrameHTML(qobject_cast(widget)); break; case VCWidget::ButtonWidget: - str = getButtonHTML(qobject_cast(widget)); + str = getButtonHTML(qobject_cast(widget)); break; case VCWidget::SliderWidget: - str = getSliderHTML(qobject_cast(widget)); + str = getSliderHTML(qobject_cast(widget)); break; case VCWidget::LabelWidget: - str = getLabelHTML(qobject_cast(widget)); + str = getLabelHTML(qobject_cast(widget)); break; case VCWidget::AudioTriggersWidget: - str = getAudioTriggersHTML(qobject_cast(widget)); + str = getAudioTriggersHTML(qobject_cast(widget)); break; case VCWidget::CueListWidget: - str = getCueListHTML(qobject_cast(widget)); + str = getCueListHTML(qobject_cast(widget)); break; case VCWidget::ClockWidget: - str = getClockHTML(qobject_cast(widget)); + str = getClockHTML(qobject_cast(widget)); break; default: str = getWidgetHTML(widget); @@ -1530,44 +1526,45 @@ QString WebAccess::getChildrenHTML(VCWidget* frame, int pagesNum, int currentPag QString WebAccess::getVCHTML() { m_CSScode = "\n"; - m_CSScode += "\n"; + m_CSScode += "\n"; m_JScode = "\n" "\n" "\n"; m_JScode += "\n"; @@ -338,24 +338,24 @@ QString WebAccessConfiguration::getHTML(Doc* doc, WebAccessAuth* auth) "" "
\n" - "" + - tr("Back") + "\n" + extraButtons + "
" + QString(APPNAME) + " " + - QString(APPVERSION) + - "
" - "
\n"; + "" + + tr("Back") + "\n" + extraButtons + "
" + QString(APPNAME) + " " + + QString(APPVERSION) + + "
" + "
\n"; // ********************* IO mapping *********************** bodyHTML += "
\n"; - bodyHTML += - "
"; + bodyHTML += "
"; bodyHTML += tr("Universes configuration") + "

\n"; bodyHTML += getIOConfigHTML(doc); bodyHTML += "
"; // ********************* audio devices ******************** bodyHTML += "
\n"; - bodyHTML += - "
"; + bodyHTML += "
"; bodyHTML += tr("Audio configuration") + "

\n"; bodyHTML += getAudioConfigHTML(doc); bodyHTML += "
"; @@ -363,8 +363,8 @@ QString WebAccessConfiguration::getHTML(Doc* doc, WebAccessAuth* auth) // **************** User loaded fixtures ****************** bodyHTML += "
\n"; - bodyHTML += - "
"; + bodyHTML += "
"; bodyHTML += tr("User loaded fixtures") + "

\n"; bodyHTML += getUserFixturesConfigHTML(); bodyHTML += "
"; @@ -373,8 +373,8 @@ QString WebAccessConfiguration::getHTML(Doc* doc, WebAccessAuth* auth) if (auth) { bodyHTML += "
\n"; - bodyHTML += - "
"; + bodyHTML += "
"; bodyHTML += tr("Authorized users") + "

\n"; bodyHTML += getPasswordsConfigHTML(auth); bodyHTML += "
"; diff --git a/webaccess/src/webaccessconfiguration.h b/webaccess/src/webaccessconfiguration.h index bae31460dd..366dca2c92 100644 --- a/webaccess/src/webaccessconfiguration.h +++ b/webaccess/src/webaccessconfiguration.h @@ -31,11 +31,11 @@ class WebAccessConfiguration : public QObject public: WebAccessConfiguration(); - static QString getIOConfigHTML(Doc* doc); - static QString getAudioConfigHTML(Doc* doc); + static QString getIOConfigHTML(Doc *doc); + static QString getAudioConfigHTML(Doc *doc); static QString getUserFixturesConfigHTML(); - static QString getPasswordsConfigHTML(WebAccessAuth* auth); - static QString getHTML(Doc* doc, WebAccessAuth* auth); + static QString getPasswordsConfigHTML(WebAccessAuth *auth); + static QString getHTML(Doc *doc, WebAccessAuth *auth); }; #endif // WEBACCESSCONFIGURATION_H diff --git a/webaccess/src/webaccessnetwork.cpp b/webaccess/src/webaccessnetwork.cpp index 47746916bb..7340ecc87c 100644 --- a/webaccess/src/webaccessnetwork.cpp +++ b/webaccess/src/webaccessnetwork.cpp @@ -31,12 +31,12 @@ #define DHCPCD_CONF_FILE "/etc/dhcpcd.conf" #define WPA_SUPP_CONF_FILE "/etc/wpa_supplicant/wpa_supplicant.conf" -WebAccessNetwork::WebAccessNetwork(QObject* parent) +WebAccessNetwork::WebAccessNetwork(QObject *parent) : QObject(parent) { } -void WebAccessNetwork::resetInterface(InterfaceInfo* iface) +void WebAccessNetwork::resetInterface(InterfaceInfo *iface) { iface->name = ""; iface->isStatic = false; @@ -89,7 +89,7 @@ void WebAccessNetwork::appendInterface(InterfaceInfo iface) m_interfaces.append(iface); } -QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo* iface) +QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo *iface) { QString dhcpChk = iface->isStatic ? QString() : QString("checked"); QString staticChk = iface->isStatic ? QString("checked") : QString(); @@ -103,29 +103,28 @@ QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo* iface) html += "
\n"; if (iface->isWireless) { - html += tr("Access point name (SSID): ") + "name + - "SSID\" size=\"15\" value=\"" + iface->ssid + "\">
\n"; - html += tr("WPA-PSK Password: ") + "name + - "WPAPSK\" size=\"15\" value=\"" + iface->wpaPass + "\">
\n"; + html += tr("Access point name (SSID): ") + "name + + "SSID\" size=\"15\" value=\"" + iface->ssid + "\">
\n"; + html += tr("WPA-PSK Password: ") + "name + "WPAPSK\" size=\"15\" value=\"" + + iface->wpaPass + "\">
\n"; } /** IP mode radio buttons */ - html += "name + - "', false);\" value=\"dhcp\" " + dhcpChk + ">" + tr("Dynamic (DHCP)") + "
\n"; - html += "name + - "', true);\" value=\"static\" " + staticChk + ">" + tr("Static") + "
\n"; + html += "name + + "', false);\" value=\"dhcp\" " + dhcpChk + ">" + tr("Dynamic (DHCP)") + "
\n"; + html += "name + + "', true);\" value=\"static\" " + staticChk + ">" + tr("Static") + "
\n"; /** Static IP fields */ - html += - "
name + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; - html += tr("IP Address: ") + "name + "IPaddr\" size=\"15\" value=\"" + - iface->address + "\">
\n"; - html += tr("Netmask: ") + "name + "Netmask\" size=\"15\" value=\"" + - iface->netmask + "\">
\n"; - html += tr("Gateway: ") + "name + "Gateway\" value=\"" + - iface->gateway + "\">
\n"; + html += "
name + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; + html += tr("IP Address: ") + "name + "IPaddr\" size=\"15\" value=\"" + + iface->address + "\">
\n"; + html += tr("Netmask: ") + "name + "Netmask\" size=\"15\" value=\"" + + iface->netmask + "\">
\n"; + html += tr("Gateway: ") + "name + "Gateway\" value=\"" + + iface->gateway + "\">
\n"; html += "
\n"; - html += "name + - "');\" >\n"; + html += "name + + "');\" >\n"; html += "
"; return html; @@ -326,13 +325,13 @@ QString WebAccessNetwork::getHTML() "\n"; QString bodyHTML = "
\n" - "" + - tr("Back") + - "\n" - "
" + - QString(APPNAME) + " " + QString(APPVERSION) + - "
\n" - "
\n"; + "" + + tr("Back") + + "\n" + "
" + + QString(APPNAME) + " " + QString(APPVERSION) + + "
\n" + "
\n"; bodyHTML += "
"; @@ -351,12 +350,12 @@ QString WebAccessNetwork::getHTML() bodyHTML += "
\n"; bodyHTML += "
\n"; - bodyHTML += - "" + - tr("Reboot") + "\n"; - bodyHTML += - "" + - tr("Shutdown") + "\n"; + bodyHTML += "" + + tr("Reboot") + "\n"; + bodyHTML += "" + + tr("Shutdown") + "\n"; bodyHTML += "
\n"; QString str = HTML_HEADER + m_JScode + m_CSScode + "\n\n" + bodyHTML + "\n"; @@ -389,7 +388,7 @@ bool WebAccessNetwork::updateNetworkFile(QStringList cmdList) return false; } -void WebAccessNetwork::parseWPAConfFile(InterfaceInfo* iface) +void WebAccessNetwork::parseWPAConfFile(InterfaceInfo *iface) { bool inNetwork = false; @@ -476,8 +475,7 @@ bool WebAccessNetwork::writeNetworkFile() dhcpcdFile.write((QString("interface %1\n").arg(iface.name)).toLatin1()); dhcpcdFile.write( - (QString("static ip_address=%1/%2\n").arg(iface.address).arg(stringToNetmask(iface.netmask))) - .toLatin1()); + (QString("static ip_address=%1/%2\n").arg(iface.address).arg(stringToNetmask(iface.netmask))).toLatin1()); dhcpcdFile.write((QString("static routers=%1\n").arg(iface.gateway)).toLatin1()); if (iface.dns1.isEmpty() == false) dhcpcdFile.write((QString("static domain_name_servers=%1\n\n").arg(iface.dns1)).toLatin1()); diff --git a/webaccess/src/webaccessnetwork.h b/webaccess/src/webaccessnetwork.h index 240d03697f..73346b6953 100644 --- a/webaccess/src/webaccessnetwork.h +++ b/webaccess/src/webaccessnetwork.h @@ -41,18 +41,18 @@ typedef struct class WebAccessNetwork : public QObject { public: - WebAccessNetwork(QObject* parent = 0); + WebAccessNetwork(QObject *parent = 0); - void resetInterface(InterfaceInfo* iface); + void resetInterface(InterfaceInfo *iface); void appendInterface(InterfaceInfo iface); - QString getInterfaceHTML(InterfaceInfo* iface); + QString getInterfaceHTML(InterfaceInfo *iface); QString getNetworkHTML(); QString getHTML(); bool updateNetworkFile(QStringList cmdList); protected: - void parseWPAConfFile(InterfaceInfo* iface); + void parseWPAConfFile(InterfaceInfo *iface); bool writeNetworkFile(); QString netmaskToString(int mask); int stringToNetmask(QString mask); diff --git a/webaccess/src/webaccesssimpledesk.cpp b/webaccess/src/webaccesssimpledesk.cpp index 7ddc968e18..370bd58216 100644 --- a/webaccess/src/webaccesssimpledesk.cpp +++ b/webaccess/src/webaccesssimpledesk.cpp @@ -26,12 +26,12 @@ #include "qlcconfig.h" #include "doc.h" -WebAccessSimpleDesk::WebAccessSimpleDesk(QObject* parent) +WebAccessSimpleDesk::WebAccessSimpleDesk(QObject *parent) : QObject(parent) { } -QString WebAccessSimpleDesk::getHTML(Doc* doc, SimpleDesk* sd) +QString WebAccessSimpleDesk::getHTML(Doc *doc, SimpleDesk *sd) { int uni = sd->getCurrentUniverseIndex() + 1; int page = sd->getCurrentPage(); @@ -47,38 +47,39 @@ QString WebAccessSimpleDesk::getHTML(Doc* doc, SimpleDesk* sd) CSScode += "\n"; QString bodyHTML = "
\n" - "" + - tr("Back") + - "\n" - "DMX Keypad\n" - "
" + - QString(APPNAME) + " " + QString(APPVERSION) + - "
" - "
\n"; - - bodyHTML += "
\n"; - bodyHTML += tr("Page") + - " \n" - "\n"; + "" + + tr("Back") + + "\n" + "DMX Keypad\n" + "
" + + QString(APPNAME) + " " + QString(APPVERSION) + + "
" + "
\n"; + + bodyHTML += "
\n"; + bodyHTML += tr("Page") + + " \n" + "\n"; bodyHTML += "
"; bodyHTML += "
" + - QString::number(page) + "
\n"; + "width: 50px; background-color: #888; border-radius: 6px;\">" + + QString::number(page) + "
\n"; bodyHTML += "\n" - "\n"; + "\n"; bodyHTML += "\n" - "\n"; + "\n"; - bodyHTML += "
" + tr("Universe") + - "
\n" - "
\n" - "\n"; QStringList uniList = doc->inputOutputMap()->universeNames(); for (int i = 0; i < uniList.count(); i++) @@ -95,7 +96,7 @@ QString WebAccessSimpleDesk::getHTML(Doc* doc, SimpleDesk* sd) return str; } -QString WebAccessSimpleDesk::getChannelsMessage(Doc* doc, SimpleDesk* sd, quint32 universe, int startAddr, int chNumber) +QString WebAccessSimpleDesk::getChannelsMessage(Doc *doc, SimpleDesk *sd, quint32 universe, int startAddr, int chNumber) { QString message; quint32 universeAddr = (universe << 9); @@ -105,10 +106,10 @@ QString WebAccessSimpleDesk::getChannelsMessage(Doc* doc, SimpleDesk* sd, quint3 { QString type = ""; uchar value = sd->getAbsoluteChannelValue(universeAddr + i); - Fixture* fxi = doc->fixture(doc->fixtureForAddress(universeAddr + i)); + Fixture *fxi = doc->fixture(doc->fixtureForAddress(universeAddr + i)); if (fxi != NULL) { - const QLCChannel* ch = fxi->channel(universeAddr + i - fxi->universeAddress()); + const QLCChannel *ch = fxi->channel(universeAddr + i - fxi->universeAddress()); if (ch != NULL) { if (ch->group() == QLCChannel::Intensity) diff --git a/webaccess/src/webaccesssimpledesk.h b/webaccess/src/webaccesssimpledesk.h index e733b9c743..f42e50cbff 100644 --- a/webaccess/src/webaccesssimpledesk.h +++ b/webaccess/src/webaccesssimpledesk.h @@ -29,10 +29,10 @@ class WebAccessSimpleDesk : public QObject { Q_OBJECT public: - explicit WebAccessSimpleDesk(QObject* parent = 0); + explicit WebAccessSimpleDesk(QObject *parent = 0); - static QString getHTML(Doc* doc, SimpleDesk* sd); - static QString getChannelsMessage(Doc* doc, SimpleDesk* sd, quint32 universe, int startAddr, int chNumber); + static QString getHTML(Doc *doc, SimpleDesk *sd); + static QString getChannelsMessage(Doc *doc, SimpleDesk *sd, quint32 universe, int startAddr, int chNumber); signals: From b165ce6efa47733f26863d0f2a773d0be5d19d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Fri, 2 Jun 2023 17:49:34 +0200 Subject: [PATCH 22/30] Indent the merged files from master. --- engine/src/fixture.cpp | 4 ++-- qmlui/contextmanager.cpp | 16 ++++++++-------- qmlui/fixturemanager.cpp | 5 ++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/engine/src/fixture.cpp b/engine/src/fixture.cpp index efaa262ad0..8f4e0881ac 100644 --- a/engine/src/fixture.cpp +++ b/engine/src/fixture.cpp @@ -415,7 +415,7 @@ QList Fixture::zoomToValues(float degrees, bool isRelative) float deltaDegrees = phy.lensDegreesMax() - phy.lensDegreesMin(); // delta : 0xFFFF = deg : x quint16 degToDmx = ((degrees - (isRelative ? 0 : float(phy.lensDegreesMin()))) * 65535.0) / deltaDegrees; - //qDebug() << "Degrees" << degrees << "DMX" << QString::number(degToDmx, 16); + // qDebug() << "Degrees" << degrees << "DMX" << QString::number(degToDmx, 16); for (quint32 i = 0; i < quint32(m_fixtureMode->channels().size()); i++) { @@ -435,7 +435,7 @@ QList Fixture::zoomToValues(float degrees, bool isRelative) qreal divider = ch->controlByte() == QLCChannel::MSB ? 256.0 : 65536.0; float chDegrees = float((phy.lensDegreesMax() - phy.lensDegreesMin()) / divider) * float(channelValueAt(i)); - //qDebug() << "Relative channel degrees:" << chDegrees << "MSB?" << ch->controlByte(); + // qDebug() << "Relative channel degrees:" << chDegrees << "MSB?" << ch->controlByte(); quint16 currDmxVal = (chDegrees * 65535.0) / deltaDegrees; degToDmx += currDmxVal; diff --git a/qmlui/contextmanager.cpp b/qmlui/contextmanager.cpp index d6f729f8f6..405fc91974 100644 --- a/qmlui/contextmanager.cpp +++ b/qmlui/contextmanager.cpp @@ -1118,16 +1118,16 @@ qreal ContextManager::getCurrentValue(int type, bool degrees) QLCPhysical phy = fxMode->physical(); switch (type) { - case QLCChannel::Pan: - chValue = (qreal(phy.focusPanMax()) / divider) * chValue; + case QLCChannel::Pan: + chValue = (qreal(phy.focusPanMax()) / divider) * chValue; break; - case QLCChannel::Tilt: - chValue = (qreal(phy.focusTiltMax()) / divider) * chValue; + case QLCChannel::Tilt: + chValue = (qreal(phy.focusTiltMax()) / divider) * chValue; break; - case QLCChannel::Beam: - chValue = qreal((phy.lensDegreesMax() - phy.lensDegreesMin()) / divider) * chValue; - if (ch->controlByte() == QLCChannel::MSB) - chValue += phy.lensDegreesMin(); + case QLCChannel::Beam: + chValue = qreal((phy.lensDegreesMax() - phy.lensDegreesMin()) / divider) * chValue; + if (ch->controlByte() == QLCChannel::MSB) + chValue += phy.lensDegreesMin(); break; } } diff --git a/qmlui/fixturemanager.cpp b/qmlui/fixturemanager.cpp index 7451cf24a1..2231ec812f 100644 --- a/qmlui/fixturemanager.cpp +++ b/qmlui/fixturemanager.cpp @@ -1873,9 +1873,8 @@ QMultiHash FixtureManager::getFixtureCapabilities(quint32 itemI break; case QLCChannel::Beam: { - if (channel->preset() != QLCChannel::BeamZoomBigSmall && - channel->preset() != QLCChannel::BeamZoomSmallBig && - channel->preset() != QLCChannel::BeamZoomFine) + if (channel->preset() != QLCChannel::BeamZoomBigSmall && channel->preset() != QLCChannel::BeamZoomSmallBig + && channel->preset() != QLCChannel::BeamZoomFine) break; hasBeam = true; From d530da295790f5ad4e5a3912dcbeaeb409b24a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Mon, 3 Jul 2023 16:22:20 +0200 Subject: [PATCH 23/30] Update switch-case indentation as per review comment. --- .clang-format | 4 +- engine/audio/plugins/mad/audiodecoder_mad.cpp | 18 +- .../plugins/sndfile/audiodecoder_sndfile.cpp | 30 +- engine/audio/src/audiocapture_wavein.cpp | 40 +- engine/audio/src/audioparameters.cpp | 16 +- engine/audio/src/audiorenderer_alsa.cpp | 30 +- engine/audio/src/audiorenderer_coreaudio.cpp | 30 +- engine/audio/src/audiorenderer_portaudio.cpp | 38 +- engine/audio/src/audiorenderer_qt5.cpp | 44 +- engine/audio/src/audiorenderer_qt6.cpp | 26 +- engine/audio/src/audiorenderer_waveout.cpp | 46 +- engine/src/avolitesd4parser.cpp | 124 +-- engine/src/chaserrunner.cpp | 182 ++-- engine/src/doc.cpp | 14 +- engine/src/efx.cpp | 182 ++-- engine/src/efxfixture.cpp | 38 +- engine/src/fixture.cpp | 56 +- engine/src/function.cpp | 120 +-- engine/src/grandmaster.cpp | 30 +- engine/src/inputoutputmap.cpp | 42 +- engine/src/keypadparser.cpp | 76 +- engine/src/mastertimer.cpp | 14 +- engine/src/monitorproperties.cpp | 30 +- engine/src/qlccapability.cpp | 100 +- engine/src/qlcchannel.cpp | 966 +++++++++--------- engine/src/qlcfile.cpp | 64 +- engine/src/qlcfixturedef.cpp | 56 +- engine/src/qlcinputchannel.cpp | 64 +- engine/src/qlcinputprofile.cpp | 28 +- engine/src/qlcpalette.cpp | 273 ++--- engine/src/rgbimage.cpp | 62 +- engine/src/rgbmatrix.cpp | 38 +- engine/src/rgbscript.cpp | 20 +- engine/src/rgbscriptv4.cpp | 20 +- engine/src/rgbtext.cpp | 14 +- engine/src/scene.cpp | 54 +- engine/src/showfunction.cpp | 24 +- engine/src/universe.cpp | 42 +- engine/src/video.cpp | 6 +- engine/test/rgbscript/rgbscript_test.cpp | 184 ++-- qmlui/chasereditor.cpp | 161 +-- qmlui/contextmanager.cpp | 134 +-- qmlui/efxeditor.cpp | 40 +- qmlui/fixtureeditor/editorview.cpp | 86 +- qmlui/fixturegroupeditor.cpp | 36 +- qmlui/fixturemanager.cpp | 210 ++-- qmlui/fixtureutils.cpp | 392 +++---- qmlui/functionmanager.cpp | 200 ++-- qmlui/importmanager.cpp | 76 +- qmlui/inputoutputmanager.cpp | 26 +- qmlui/mainview2d.cpp | 88 +- qmlui/mainview3d.cpp | 96 +- qmlui/palettemanager.cpp | 26 +- qmlui/rgbmatrixeditor.cpp | 10 +- qmlui/sceneeditor.cpp | 30 +- qmlui/showmanager.cpp | 12 +- qmlui/tardis/networkmanager.cpp | 56 +- qmlui/tardis/networkpacketizer.cpp | 60 +- qmlui/tardis/tardis.cpp | 320 +++--- qmlui/treemodel.cpp | 90 +- qmlui/videoprovider.cpp | 20 +- qmlui/virtualconsole/vcbutton.cpp | 12 +- qmlui/virtualconsole/vccuelist.cpp | 96 +- qmlui/virtualconsole/vcframe.cpp | 50 +- qmlui/virtualconsole/vcslider.cpp | 185 ++-- qmlui/virtualconsole/vcwidget.cpp | 100 +- qmlui/virtualconsole/virtualconsole.cpp | 78 +- ui/src/app.cpp | 56 +- ui/src/audiobar.cpp | 6 +- ui/src/chasereditor.cpp | 370 +++---- ui/src/clickandgowidget.cpp | 92 +- ui/src/consolechannel.cpp | 28 +- ui/src/ctkrangeslider.cpp | 6 +- ui/src/cuestackmodel.cpp | 48 +- ui/src/efxeditor.cpp | 34 +- ui/src/fixtureremap.cpp | 20 +- ui/src/functionliveeditdialog.cpp | 26 +- ui/src/functionwizard.cpp | 26 +- ui/src/grandmasterslider.cpp | 24 +- ui/src/inputchanneleditor.cpp | 156 +-- ui/src/monitor/monitorfixtureitem.cpp | 40 +- ui/src/palettegenerator.cpp | 206 ++-- ui/src/rdmmanager.cpp | 58 +- ui/src/rgbmatrixeditor.cpp | 44 +- ui/src/showmanager/headeritems.cpp | 32 +- ui/src/videoprovider.cpp | 56 +- ui/src/virtualconsole/addvcbuttonmatrix.cpp | 18 +- ui/src/virtualconsole/vcclockproperties.cpp | 16 +- ui/src/virtualconsole/vccuelist.cpp | 106 +- ui/src/virtualconsole/vcmatrixcontrol.cpp | 68 +- .../vcmatrixpresetselection.cpp | 10 +- ui/src/virtualconsole/vcmatrixproperties.cpp | 72 +- ui/src/virtualconsole/vcpropertieseditor.cpp | 42 +- ui/src/virtualconsole/vcslider.cpp | 42 +- ui/src/virtualconsole/vcsliderproperties.cpp | 86 +- ui/src/virtualconsole/vcwidget.cpp | 100 +- ui/src/virtualconsole/vcxypadpreset.cpp | 26 +- webaccess/src/webaccess.cpp | 108 +- 98 files changed, 3980 insertions(+), 3977 deletions(-) diff --git a/.clang-format b/.clang-format index 84cfd6c003..3e2c4e6619 100644 --- a/.clang-format +++ b/.clang-format @@ -141,8 +141,8 @@ IncludeCategories: IncludeIsMainRegex: '(Test)?$' IncludeIsMainSourceRegex: '' IndentAccessModifiers: false -IndentCaseLabels: false -IndentCaseBlocks: true +IndentCaseLabels: true +IndentCaseBlocks: false IndentGotoLabels: false IndentPPDirectives: BeforeHash IndentExternBlock: AfterExternBlock diff --git a/engine/audio/plugins/mad/audiodecoder_mad.cpp b/engine/audio/plugins/mad/audiodecoder_mad.cpp index 59d90ebc14..1d1dac064a 100644 --- a/engine/audio/plugins/mad/audiodecoder_mad.cpp +++ b/engine/audio/plugins/mad/audiodecoder_mad.cpp @@ -366,7 +366,7 @@ qint64 AudioDecoderMAD::read(char *data, qint64 size) { switch ((int)m_stream.error) { - case MAD_ERROR_LOSTSYNC: + case MAD_ERROR_LOSTSYNC: { // skip ID3v2 tag uint tagSize = findID3v2((uchar *)m_stream.this_frame, (ulong)(m_stream.bufend - m_stream.this_frame)); @@ -377,15 +377,15 @@ qint64 AudioDecoderMAD::read(char *data, qint64 size) } continue; } - case MAD_ERROR_BUFLEN: - if (m_eof) - return 0; - continue; - default: - if (!MAD_RECOVERABLE(m_stream.error)) - return 0; - else + case MAD_ERROR_BUFLEN: + if (m_eof) + return 0; continue; + default: + if (!MAD_RECOVERABLE(m_stream.error)) + return 0; + else + continue; } } if (m_skip_frames) diff --git a/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp b/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp index 98aeb6f8ec..2160512c01 100644 --- a/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp +++ b/engine/audio/plugins/sndfile/audiodecoder_sndfile.cpp @@ -87,21 +87,21 @@ bool AudioDecoderSndFile::initialize(const QString &path) AudioFormat pcmFormat = PCM_S16LE; switch (snd_info.format & SF_FORMAT_SUBMASK) { - case SF_FORMAT_PCM_S8: - pcmFormat = PCM_S8; - break; - case SF_FORMAT_PCM_16: - pcmFormat = PCM_S16LE; - break; - case SF_FORMAT_PCM_24: - pcmFormat = PCM_S24LE; - break; - case SF_FORMAT_PCM_32: - pcmFormat = PCM_S32LE; - break; - default: - pcmFormat = PCM_S16LE; - break; + case SF_FORMAT_PCM_S8: + pcmFormat = PCM_S8; + break; + case SF_FORMAT_PCM_16: + pcmFormat = PCM_S16LE; + break; + case SF_FORMAT_PCM_24: + pcmFormat = PCM_S24LE; + break; + case SF_FORMAT_PCM_32: + pcmFormat = PCM_S32LE; + break; + default: + pcmFormat = PCM_S16LE; + break; } configure(m_freq, chan, pcmFormat); diff --git a/engine/audio/src/audiocapture_wavein.cpp b/engine/audio/src/audiocapture_wavein.cpp index 2ed476203b..8d22bc1a05 100644 --- a/engine/audio/src/audiocapture_wavein.cpp +++ b/engine/audio/src/audiocapture_wavein.cpp @@ -53,26 +53,26 @@ bool AudioCaptureWaveIn::initialize() result = waveInOpen(&deviceHandle, WAVE_MAPPER, &format, 0L, 0L, CALLBACK_NULL | WAVE_FORMAT_DIRECT); switch (result) { - case MMSYSERR_ALLOCATED: - qWarning("AudioRendererWaveOut: Device is already open."); - return false; - case MMSYSERR_BADDEVICEID: - qWarning("AudioRendererWaveOut: The specified device is out of range."); - return false; - case MMSYSERR_NODRIVER: - qWarning("AudioRendererWaveOut: There is no audio driver in this system."); - return false; - case MMSYSERR_NOMEM: - qWarning("AudioRendererWaveOut: Unable to allocate sound memory."); - return false; - case WAVERR_BADFORMAT: - qWarning("AudioRendererWaveOut: This audio format is not supported."); - return false; - default: - qWarning("AudioRendererWaveOut: Unknown media error."); - return false; - case MMSYSERR_NOERROR: - break; + case MMSYSERR_ALLOCATED: + qWarning("AudioRendererWaveOut: Device is already open."); + return false; + case MMSYSERR_BADDEVICEID: + qWarning("AudioRendererWaveOut: The specified device is out of range."); + return false; + case MMSYSERR_NODRIVER: + qWarning("AudioRendererWaveOut: There is no audio driver in this system."); + return false; + case MMSYSERR_NOMEM: + qWarning("AudioRendererWaveOut: Unable to allocate sound memory."); + return false; + case WAVERR_BADFORMAT: + qWarning("AudioRendererWaveOut: This audio format is not supported."); + return false; + default: + qWarning("AudioRendererWaveOut: Unknown media error."); + return false; + case MMSYSERR_NOERROR: + break; } for (int i = 0; i < HEADERS_NUMBER; i++) diff --git a/engine/audio/src/audioparameters.cpp b/engine/audio/src/audioparameters.cpp index db2c3868f7..a0de9e4bfa 100644 --- a/engine/audio/src/audioparameters.cpp +++ b/engine/audio/src/audioparameters.cpp @@ -87,14 +87,14 @@ int AudioParameters::sampleSize(AudioFormat format) { switch (format) { - case PCM_S8: - return 1; - case PCM_S16LE: - case PCM_UNKNOWN: - return 2; - case PCM_S24LE: - case PCM_S32LE: - return 4; + case PCM_S8: + return 1; + case PCM_S16LE: + case PCM_UNKNOWN: + return 2; + case PCM_S24LE: + case PCM_S32LE: + return 4; } return 2; } diff --git a/engine/audio/src/audiorenderer_alsa.cpp b/engine/audio/src/audiorenderer_alsa.cpp index e395aa6087..4846abbc2b 100644 --- a/engine/audio/src/audiorenderer_alsa.cpp +++ b/engine/audio/src/audiorenderer_alsa.cpp @@ -117,21 +117,21 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) snd_pcm_format_t alsa_format = SND_PCM_FORMAT_UNKNOWN; switch (format) { - case PCM_S8: - alsa_format = SND_PCM_FORMAT_S8; - break; - case PCM_S16LE: - alsa_format = SND_PCM_FORMAT_S16_LE; - break; - case PCM_S24LE: - alsa_format = SND_PCM_FORMAT_S24_LE; - break; - case PCM_S32LE: - alsa_format = SND_PCM_FORMAT_S32_LE; - break; - default: - qWarning("OutputALSA: unsupported format detected"); - return false; + case PCM_S8: + alsa_format = SND_PCM_FORMAT_S8; + break; + case PCM_S16LE: + alsa_format = SND_PCM_FORMAT_S16_LE; + break; + case PCM_S24LE: + alsa_format = SND_PCM_FORMAT_S24_LE; + break; + case PCM_S32LE: + alsa_format = SND_PCM_FORMAT_S32_LE; + break; + default: + qWarning("OutputALSA: unsupported format detected"); + return false; } if ((err = snd_pcm_hw_params_set_format(pcm_handle, hwparams, alsa_format)) < 0) { diff --git a/engine/audio/src/audiorenderer_coreaudio.cpp b/engine/audio/src/audiorenderer_coreaudio.cpp index 58bc02b86e..513d7220e5 100644 --- a/engine/audio/src/audiorenderer_coreaudio.cpp +++ b/engine/audio/src/audiorenderer_coreaudio.cpp @@ -51,21 +51,21 @@ bool AudioRendererCoreAudio::initialize(quint32 freq, int chan, AudioFormat form fmt.mChannelsPerFrame = chan; switch (format) { - case PCM_S8: - fmt.mBitsPerChannel = 8; - break; - case PCM_S16LE: - fmt.mBitsPerChannel = 16; - break; - case PCM_S24LE: - fmt.mBitsPerChannel = 24; - break; - case PCM_S32LE: - fmt.mBitsPerChannel = 32; - break; - default: - qWarning("AudioRendererCoreAudio: unsupported format detected"); - return false; + case PCM_S8: + fmt.mBitsPerChannel = 8; + break; + case PCM_S16LE: + fmt.mBitsPerChannel = 16; + break; + case PCM_S24LE: + fmt.mBitsPerChannel = 24; + break; + case PCM_S32LE: + fmt.mBitsPerChannel = 32; + break; + default: + qWarning("AudioRendererCoreAudio: unsupported format detected"); + return false; } fmt.mBytesPerFrame = fmt.mChannelsPerFrame * fmt.mBitsPerChannel / 8; fmt.mBytesPerPacket = fmt.mBytesPerFrame * fmt.mFramesPerPacket; diff --git a/engine/audio/src/audiorenderer_portaudio.cpp b/engine/audio/src/audiorenderer_portaudio.cpp index 834f0c7dc4..0815b2db0b 100644 --- a/engine/audio/src/audiorenderer_portaudio.cpp +++ b/engine/audio/src/audiorenderer_portaudio.cpp @@ -107,25 +107,25 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form switch (format) { - case PCM_S8: - outputParameters.sampleFormat = paInt8; /* 8 bit signed output */ - m_frameSize = 1; - break; - case PCM_S16LE: - outputParameters.sampleFormat = paInt16; /* 16 bit signed output */ - m_frameSize = 2; - break; - case PCM_S24LE: - outputParameters.sampleFormat = paInt24; /* 24 bit signed output */ - m_frameSize = 3; - break; - case PCM_S32LE: - outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ - m_frameSize = 4; - break; - default: - qWarning("AudioRendererPortAudio: unsupported format detected"); - return false; + case PCM_S8: + outputParameters.sampleFormat = paInt8; /* 8 bit signed output */ + m_frameSize = 1; + break; + case PCM_S16LE: + outputParameters.sampleFormat = paInt16; /* 16 bit signed output */ + m_frameSize = 2; + break; + case PCM_S24LE: + outputParameters.sampleFormat = paInt24; /* 24 bit signed output */ + m_frameSize = 3; + break; + case PCM_S32LE: + outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ + m_frameSize = 4; + break; + default: + qWarning("AudioRendererPortAudio: unsupported format detected"); + return false; } err = Pa_OpenStream(&m_paStream, NULL, &outputParameters, freq, paFramesPerBufferUnspecified, flags, dataCallback, this); diff --git a/engine/audio/src/audiorenderer_qt5.cpp b/engine/audio/src/audiorenderer_qt5.cpp index e087794f39..098411f3b5 100644 --- a/engine/audio/src/audiorenderer_qt5.cpp +++ b/engine/audio/src/audiorenderer_qt5.cpp @@ -64,28 +64,28 @@ bool AudioRendererQt5::initialize(quint32 freq, int chan, AudioFormat format) switch (format) { - case PCM_S8: - m_format.setSampleSize(8); - m_format.setSampleType(QAudioFormat::SignedInt); - break; - case PCM_S16LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); - break; - case PCM_S24LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); - break; - case PCM_S32LE: - m_format.setSampleSize(16); - m_format.setSampleType(QAudioFormat::SignedInt); - m_format.setByteOrder(QAudioFormat::LittleEndian); - break; - default: - qWarning("AudioRendererQt5: unsupported format detected"); - return false; + case PCM_S8: + m_format.setSampleSize(8); + m_format.setSampleType(QAudioFormat::SignedInt); + break; + case PCM_S16LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); + break; + case PCM_S24LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); + break; + case PCM_S32LE: + m_format.setSampleSize(16); + m_format.setSampleType(QAudioFormat::SignedInt); + m_format.setByteOrder(QAudioFormat::LittleEndian); + break; + default: + qWarning("AudioRendererQt5: unsupported format detected"); + return false; } if (!m_deviceInfo.isFormatSupported(m_format)) diff --git a/engine/audio/src/audiorenderer_qt6.cpp b/engine/audio/src/audiorenderer_qt6.cpp index 76ce84e4cf..4497b15ba6 100644 --- a/engine/audio/src/audiorenderer_qt6.cpp +++ b/engine/audio/src/audiorenderer_qt6.cpp @@ -65,19 +65,19 @@ bool AudioRendererQt6::initialize(quint32 freq, int chan, AudioFormat format) switch (format) { - case PCM_S8: - m_format.setSampleFormat(QAudioFormat::UInt8); - break; - case PCM_S16LE: - case PCM_S24LE: - m_format.setSampleFormat(QAudioFormat::Int16); - break; - case PCM_S32LE: - m_format.setSampleFormat(QAudioFormat::Int32); - break; - default: - qWarning("AudioRendererQt6: unsupported format detected"); - return false; + case PCM_S8: + m_format.setSampleFormat(QAudioFormat::UInt8); + break; + case PCM_S16LE: + case PCM_S24LE: + m_format.setSampleFormat(QAudioFormat::Int16); + break; + case PCM_S32LE: + m_format.setSampleFormat(QAudioFormat::Int32); + break; + default: + qWarning("AudioRendererQt6: unsupported format detected"); + return false; } if (!m_deviceInfo.isFormatSupported(m_format)) diff --git a/engine/audio/src/audiorenderer_waveout.cpp b/engine/audio/src/audiorenderer_waveout.cpp index 2ea24d0f55..27a2955963 100644 --- a/engine/audio/src/audiorenderer_waveout.cpp +++ b/engine/audio/src/audiorenderer_waveout.cpp @@ -117,29 +117,29 @@ bool AudioRendererWaveOut::initialize(quint32 freq, int chan, AudioFormat format switch (waveOutOpen(&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION)) { - case MMSYSERR_ALLOCATED: - qWarning("AudioRendererWaveOut: Device is already open."); - return false; - case MMSYSERR_BADDEVICEID: - qWarning("AudioRendererWaveOut: The specified device is out of range."); - return false; - case MMSYSERR_NODRIVER: - qWarning("AudioRendererWaveOut: There is no audio driver in this system."); - return false; - case MMSYSERR_NOMEM: - qWarning("AudioRendererWaveOut: Unable to allocate sound memory."); - return false; - case WAVERR_BADFORMAT: - qWarning("AudioRendererWaveOut: This audio format is not supported."); - return false; - case WAVERR_SYNC: - qWarning("AudioRendererWaveOut: The device is synchronous."); - return false; - default: - qWarning("AudioRendererWaveOut: Unknown media error."); - return false; - case MMSYSERR_NOERROR: - break; + case MMSYSERR_ALLOCATED: + qWarning("AudioRendererWaveOut: Device is already open."); + return false; + case MMSYSERR_BADDEVICEID: + qWarning("AudioRendererWaveOut: The specified device is out of range."); + return false; + case MMSYSERR_NODRIVER: + qWarning("AudioRendererWaveOut: There is no audio driver in this system."); + return false; + case MMSYSERR_NOMEM: + qWarning("AudioRendererWaveOut: Unable to allocate sound memory."); + return false; + case WAVERR_BADFORMAT: + qWarning("AudioRendererWaveOut: This audio format is not supported."); + return false; + case WAVERR_SYNC: + qWarning("AudioRendererWaveOut: The device is synchronous."); + return false; + default: + qWarning("AudioRendererWaveOut: Unknown media error."); + return false; + case MMSYSERR_NOERROR: + break; } waveOutReset(dev); diff --git a/engine/src/avolitesd4parser.cpp b/engine/src/avolitesd4parser.cpp index 0b4dbf1f57..392f313b2e 100644 --- a/engine/src/avolitesd4parser.cpp +++ b/engine/src/avolitesd4parser.cpp @@ -210,69 +210,69 @@ QLCChannel::Group AvolitesD4Parser::getGroup(QString ID, QString name, QString g switch (stringToAttributeEnum(group)) { - case AvolitesD4Parser::SPECIAL: - if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) || name.contains(KD4TagSpeed, Qt::CaseInsensitive)) - return QLCChannel::Speed; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) || name.contains(KD4TagReserved, Qt::CaseInsensitive)) - return QLCChannel::NoGroup; - else - return QLCChannel::Maintenance; - break; + case AvolitesD4Parser::SPECIAL: + if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) || name.contains(KD4TagSpeed, Qt::CaseInsensitive)) + return QLCChannel::Speed; + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) || name.contains(KD4TagReserved, Qt::CaseInsensitive)) + return QLCChannel::NoGroup; + else + return QLCChannel::Maintenance; + break; - default: - case AvolitesD4Parser::INTENSITY: - if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) || name.contains(KD4TagShutter, Qt::CaseInsensitive)) - return QLCChannel::Shutter; - else - return QLCChannel::Intensity; - break; - - case AvolitesD4Parser::PANTILT: - if (ID.contains(KD4TagPan, Qt::CaseInsensitive) || name.contains(KD4TagPan, Qt::CaseInsensitive)) - return QLCChannel::Pan; - else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) || name.contains(KD4TagTilt, Qt::CaseInsensitive)) - return QLCChannel::Tilt; - else - return QLCChannel::NoGroup; - break; - - case AvolitesD4Parser::COLOUR: - if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) - return QLCChannel::Intensity; - else - return QLCChannel::Colour; - break; - - case AvolitesD4Parser::GOBO: - return QLCChannel::Gobo; - break; - - case AvolitesD4Parser::BEAM: - return QLCChannel::Beam; - break; - - case AvolitesD4Parser::EFFECT: - if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) || name.contains(KD4TagPrism, Qt::CaseInsensitive)) - return QLCChannel::Prism; - else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) || name.contains(KD4TagEffect, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) - return QLCChannel::Effect; - else - return QLCChannel::NoGroup; - break; + default: + case AvolitesD4Parser::INTENSITY: + if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) || name.contains(KD4TagShutter, Qt::CaseInsensitive)) + return QLCChannel::Shutter; + else + return QLCChannel::Intensity; + break; + + case AvolitesD4Parser::PANTILT: + if (ID.contains(KD4TagPan, Qt::CaseInsensitive) || name.contains(KD4TagPan, Qt::CaseInsensitive)) + return QLCChannel::Pan; + else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) || name.contains(KD4TagTilt, Qt::CaseInsensitive)) + return QLCChannel::Tilt; + else + return QLCChannel::NoGroup; + break; + + case AvolitesD4Parser::COLOUR: + if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) + return QLCChannel::Intensity; + else + return QLCChannel::Colour; + break; + + case AvolitesD4Parser::GOBO: + return QLCChannel::Gobo; + break; + + case AvolitesD4Parser::BEAM: + return QLCChannel::Beam; + break; + + case AvolitesD4Parser::EFFECT: + if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) || name.contains(KD4TagPrism, Qt::CaseInsensitive)) + return QLCChannel::Prism; + else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) || name.contains(KD4TagEffect, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + return QLCChannel::Effect; + else + return QLCChannel::NoGroup; + break; } return QLCChannel::NoGroup; diff --git a/engine/src/chaserrunner.cpp b/engine/src/chaserrunner.cpp index f30e7bd395..d3611f6d3d 100644 --- a/engine/src/chaserrunner.cpp +++ b/engine/src/chaserrunner.cpp @@ -136,22 +136,22 @@ uint ChaserRunner::stepFadeIn(int stepIdx) const { switch (m_chaser->fadeInMode()) { - case Chaser::Common: - // All steps' fade in speed is dictated by the chaser - speed = m_chaser->fadeInSpeed(); - break; - case Chaser::PerStep: - // Each step specifies its own fade in speed - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).fadeIn; - else + case Chaser::Common: + // All steps' fade in speed is dictated by the chaser + speed = m_chaser->fadeInSpeed(); + break; + case Chaser::PerStep: + // Each step specifies its own fade in speed + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).fadeIn; + else + speed = Function::defaultSpeed(); + break; + default: + case Chaser::Default: + // Don't touch members' fade in speed at all speed = Function::defaultSpeed(); - break; - default: - case Chaser::Default: - // Don't touch members' fade in speed at all - speed = Function::defaultSpeed(); - break; + break; } } @@ -172,22 +172,22 @@ uint ChaserRunner::stepFadeOut(int stepIdx) const { switch (m_chaser->fadeOutMode()) { - case Chaser::Common: - // All steps' fade out speed is dictated by the chaser - speed = m_chaser->fadeOutSpeed(); - break; - case Chaser::PerStep: - // Each step specifies its own fade out speed - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).fadeOut; - else + case Chaser::Common: + // All steps' fade out speed is dictated by the chaser + speed = m_chaser->fadeOutSpeed(); + break; + case Chaser::PerStep: + // Each step specifies its own fade out speed + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).fadeOut; + else + speed = Function::defaultSpeed(); + break; + default: + case Chaser::Default: + // Don't touch members' fade out speed at all speed = Function::defaultSpeed(); - break; - default: - case Chaser::Default: - // Don't touch members' fade out speed at all - speed = Function::defaultSpeed(); - break; + break; } } @@ -208,19 +208,19 @@ uint ChaserRunner::stepDuration(int stepIdx) const { switch (m_chaser->durationMode()) { - default: - case Chaser::Default: - case Chaser::Common: - // All steps' duration is dictated by the chaser - speed = m_chaser->duration(); - break; - case Chaser::PerStep: - // Each step specifies its own duration - if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) - speed = m_chaser->steps().at(stepIdx).duration; - else + default: + case Chaser::Default: + case Chaser::Common: + // All steps' duration is dictated by the chaser speed = m_chaser->duration(); - break; + break; + case Chaser::PerStep: + // Each step specifies its own duration + if (stepIdx >= 0 && stepIdx < m_chaser->stepsCount()) + speed = m_chaser->steps().at(stepIdx).duration; + else + speed = m_chaser->duration(); + break; } } @@ -236,12 +236,12 @@ void ChaserRunner::setAction(ChaserAction &action) // apply the actions that can be applied immediately switch (action.m_action) { - case ChaserNoAction: - m_pendingAction.m_masterIntensity = action.m_masterIntensity; - m_pendingAction.m_stepIntensity = action.m_stepIntensity; - break; + case ChaserNoAction: + m_pendingAction.m_masterIntensity = action.m_masterIntensity; + m_pendingAction.m_stepIntensity = action.m_stepIntensity; + break; - case ChaserStopStep: + case ChaserStopStep: { bool stopped = false; @@ -269,14 +269,14 @@ void ChaserRunner::setAction(ChaserAction &action) } break; - // copy to pending action. Will be processed at the next write call - default: - m_pendingAction.m_stepIndex = action.m_stepIndex; - m_pendingAction.m_masterIntensity = action.m_masterIntensity; - m_pendingAction.m_stepIntensity = action.m_stepIntensity; - m_pendingAction.m_fadeMode = action.m_fadeMode; - m_pendingAction.m_action = action.m_action; - break; + // copy to pending action. Will be processed at the next write call + default: + m_pendingAction.m_stepIndex = action.m_stepIndex; + m_pendingAction.m_masterIntensity = action.m_masterIntensity; + m_pendingAction.m_stepIntensity = action.m_stepIntensity; + m_pendingAction.m_fadeMode = action.m_fadeMode; + m_pendingAction.m_action = action.m_action; + break; } } @@ -523,22 +523,22 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, switch (fadeControl) { - case Chaser::FromFunction: - newStep->m_fadeIn = stepFadeIn(index); - newStep->m_fadeOut = stepFadeOut(index); - break; - case Chaser::Blended: - newStep->m_fadeIn = stepFadeIn(index); - newStep->m_fadeOut = stepFadeOut(index); - break; - case Chaser::Crossfade: - newStep->m_fadeIn = 0; - newStep->m_fadeOut = 0; - break; - case Chaser::BlendedCrossfade: - newStep->m_fadeIn = 0; - newStep->m_fadeOut = 0; - break; + case Chaser::FromFunction: + newStep->m_fadeIn = stepFadeIn(index); + newStep->m_fadeOut = stepFadeOut(index); + break; + case Chaser::Blended: + newStep->m_fadeIn = stepFadeIn(index); + newStep->m_fadeOut = stepFadeOut(index); + break; + case Chaser::Crossfade: + newStep->m_fadeIn = 0; + newStep->m_fadeOut = 0; + break; + case Chaser::BlendedCrossfade: + newStep->m_fadeIn = 0; + newStep->m_fadeOut = 0; + break; } newStep->m_duration = stepDuration(index); @@ -737,27 +737,27 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) switch (m_pendingAction.m_action) { - case ChaserNextStep: - case ChaserPreviousStep: - clearRunningList(); - // the actual action will be performed below, on startNewStep - break; - case ChaserSetStepIndex: - if (m_pendingAction.m_stepIndex != -1) - { + case ChaserNextStep: + case ChaserPreviousStep: clearRunningList(); - m_lastRunStepIdx = m_pendingAction.m_stepIndex; - qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" << m_startOffset; - startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, m_pendingAction.m_stepIntensity, - m_pendingAction.m_fadeMode); - emit currentStepChanged(m_lastRunStepIdx); - } - break; - case ChaserPauseRequest: - setPause(m_pendingAction.m_fadeMode ? true : false, universes); - break; - default: - break; + // the actual action will be performed below, on startNewStep + break; + case ChaserSetStepIndex: + if (m_pendingAction.m_stepIndex != -1) + { + clearRunningList(); + m_lastRunStepIdx = m_pendingAction.m_stepIndex; + qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" << m_startOffset; + startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, + m_pendingAction.m_stepIntensity, m_pendingAction.m_fadeMode); + emit currentStepChanged(m_lastRunStepIdx); + } + break; + case ChaserPauseRequest: + setPause(m_pendingAction.m_fadeMode ? true : false, universes); + break; + default: + break; } quint32 prevStepRoundElapsed = 0; diff --git a/engine/src/doc.cpp b/engine/src/doc.cpp index 54ed5883ba..d6f6902584 100644 --- a/engine/src/doc.cpp +++ b/engine/src/doc.cpp @@ -1116,7 +1116,7 @@ QList Doc::getUsage(quint32 fid) switch (f->type()) { - case Function::CollectionType: + case Function::CollectionType: { Collection *c = qobject_cast(f); int pos = c->functions().indexOf(fid); @@ -1127,7 +1127,7 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::ChaserType: + case Function::ChaserType: { Chaser *c = qobject_cast(f); @@ -1142,7 +1142,7 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::SequenceType: + case Function::SequenceType: { Sequence *s = qobject_cast(f); if (s->boundSceneID() == fid) @@ -1152,7 +1152,7 @@ QList Doc::getUsage(quint32 fid) } } break; - case Function::ScriptType: + case Function::ScriptType: { Script *s = qobject_cast\n" "\n"; @@ -104,9 +104,9 @@ QString WebAccessSimpleDesk::getChannelsMessage(Doc *doc, SimpleDesk *sd, quint3 for (int i = startAddr; i < startAddr + chNumber; i++) { - QString type = ""; - uchar value = sd->getAbsoluteChannelValue(universeAddr + i); - Fixture *fxi = doc->fixture(doc->fixtureForAddress(universeAddr + i)); + QString type = ""; + uchar value = sd->getAbsoluteChannelValue(universeAddr + i); + Fixture *fxi = doc->fixture(doc->fixtureForAddress(universeAddr + i)); if (fxi != NULL) { const QLCChannel *ch = fxi->channel(universeAddr + i - fxi->universeAddress()); From 9d5bf357ddc2c8c0ef357885140df03149fac24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Mon, 3 Jul 2023 17:34:55 +0200 Subject: [PATCH 25/30] Keep comment lines as formatted. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index fdcf47fcf7..ae6f749cc6 100644 --- a/.clang-format +++ b/.clang-format @@ -180,7 +180,7 @@ PenaltyIndentedWhitespace: 0 PointerAlignment: Right PPIndentWidth: 2 ReferenceAlignment: Pointer -ReflowComments: true +ReflowComments: false RemoveBracesLLVM: false SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 From 019be6559aeabf6ad0e365da0fbe86f40367b2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Mon, 3 Jul 2023 17:45:47 +0200 Subject: [PATCH 26/30] Apply style to merged files. --- engine/src/outputpatch.cpp | 2 +- engine/src/universe.cpp | 4 +-- engine/src/universe.h | 2 +- engine/test/iopluginstub/iopluginstub.h | 2 +- engine/test/outputpatch/outputpatch_test.cpp | 24 ++++++++-------- qmlui/contextmanager.cpp | 30 ++++++++------------ qmlui/virtualconsole/vcslider.cpp | 4 +-- ui/src/virtualconsole/vcslider.cpp | 4 +-- 8 files changed, 33 insertions(+), 39 deletions(-) diff --git a/engine/src/outputpatch.cpp b/engine/src/outputpatch.cpp index 152cdd70db..0258a0ef01 100644 --- a/engine/src/outputpatch.cpp +++ b/engine/src/outputpatch.cpp @@ -190,7 +190,7 @@ void OutputPatch::setBlackout(bool blackout) emit blackoutChanged(m_blackout); } -void OutputPatch::dump(quint32 universe, const QByteArray& data, bool dataChanged) +void OutputPatch::dump(quint32 universe, const QByteArray &data, bool dataChanged) { /* Don't do anything if there is no plugin and/or output line. */ if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine()) diff --git a/engine/src/universe.cpp b/engine/src/universe.cpp index 9fb9f2ddee..e1d191383d 100644 --- a/engine/src/universe.cpp +++ b/engine/src/universe.cpp @@ -321,8 +321,8 @@ void Universe::processFaders() fader->write(this); } - bool dataChanged = hasChanged(); - const QByteArray postGM = m_postGMValues->mid(0, m_usedChannels); + bool dataChanged = hasChanged(); + const QByteArray postGM = m_postGMValues->mid(0, m_usedChannels); dumpOutput(postGM, dataChanged); if (dataChanged) diff --git a/engine/src/universe.h b/engine/src/universe.h index 28a66a08bd..a376612c44 100644 --- a/engine/src/universe.h +++ b/engine/src/universe.h @@ -239,7 +239,7 @@ protected slots: * This is the actual function that writes data to an output patch * A flag indicates if data has changed since previous iteration */ - void dumpOutput(const QByteArray& data, bool dataChanged); + void dumpOutput(const QByteArray &data, bool dataChanged); void flushInput(); diff --git a/engine/test/iopluginstub/iopluginstub.h b/engine/test/iopluginstub/iopluginstub.h index 22ff37a362..d678db8b94 100644 --- a/engine/test/iopluginstub/iopluginstub.h +++ b/engine/test/iopluginstub/iopluginstub.h @@ -68,7 +68,7 @@ class IOPluginStub : public QLCIOPlugin QString outputInfo(quint32 output); /** @reimp */ - void writeUniverse(quint32 universe, quint32 output, const QByteArray& data, bool dataChanged); + void writeUniverse(quint32 universe, quint32 output, const QByteArray &data, bool dataChanged); public: /** List of outputs that have been opened */ diff --git a/engine/test/outputpatch/outputpatch_test.cpp b/engine/test/outputpatch/outputpatch_test.cpp index c700a2806b..94b34f1161 100644 --- a/engine/test/outputpatch/outputpatch_test.cpp +++ b/engine/test/outputpatch/outputpatch_test.cpp @@ -113,31 +113,31 @@ void OutputPatch_Test::dump() QVERIFY(stub->m_universe[511] == (char)0); op->dump(0, uni, true); - QVERIFY(stub->m_universe[0] == (char) 100); - QVERIFY(stub->m_universe[169] == (char) 50); - QVERIFY(stub->m_universe[511] == (char) 25); + QVERIFY(stub->m_universe[0] == (char)100); + QVERIFY(stub->m_universe[169] == (char)50); + QVERIFY(stub->m_universe[511] == (char)25); /* Test the pause state */ op->setPaused(true); op->dump(0, uni, true); - QVERIFY(stub->m_universe[0] == (char) 100); - QVERIFY(stub->m_universe[169] == (char) 50); - QVERIFY(stub->m_universe[511] == (char) 25); + QVERIFY(stub->m_universe[0] == (char)100); + QVERIFY(stub->m_universe[169] == (char)50); + QVERIFY(stub->m_universe[511] == (char)25); uni[0] = 1; uni[169] = 2; uni[511] = 3; op->dump(0, uni, true); - QVERIFY(stub->m_universe[0] == (char) 100); - QVERIFY(stub->m_universe[169] == (char) 50); - QVERIFY(stub->m_universe[511] == (char) 25); + QVERIFY(stub->m_universe[0] == (char)100); + QVERIFY(stub->m_universe[169] == (char)50); + QVERIFY(stub->m_universe[511] == (char)25); op->setPaused(false); op->dump(0, uni, true); - QVERIFY(stub->m_universe[0] == (char) 1); - QVERIFY(stub->m_universe[169] == (char) 2); - QVERIFY(stub->m_universe[511] == (char) 3); + QVERIFY(stub->m_universe[0] == (char)1); + QVERIFY(stub->m_universe[169] == (char)2); + QVERIFY(stub->m_universe[511] == (char)3); delete op; } diff --git a/qmlui/contextmanager.cpp b/qmlui/contextmanager.cpp index f6a80e6162..4bf9140c1a 100644 --- a/qmlui/contextmanager.cpp +++ b/qmlui/contextmanager.cpp @@ -1156,14 +1156,14 @@ qreal ContextManager::getCurrentValue(int type, bool degrees) void ContextManager::getCurrentColors(QQuickItem *item) { - int rgbDiffCount = 0; - int wauvDiffCount = 0; + int rgbDiffCount = 0; + int wauvDiffCount = 0; QColor rgbColor; QColor wauvColor; for (quint32 &itemID : m_selectedFixtures) { - quint32 fxID = FixtureUtils::itemFixtureID(itemID); + quint32 fxID = FixtureUtils::itemFixtureID(itemID); quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); Fixture *fixture = m_doc->fixture(fxID); @@ -1173,20 +1173,18 @@ void ContextManager::getCurrentColors(QQuickItem *item) QColor itemRgbColor; QColor itemWauvColor; - QVector rgbCh = fixture->rgbChannels(headIndex); + QVector rgbCh = fixture->rgbChannels(headIndex); if (rgbCh.size() == 3) { - itemRgbColor.setRgb(fixture->channelValueAt(rgbCh.at(0)), - fixture->channelValueAt(rgbCh.at(1)), - fixture->channelValueAt(rgbCh.at(2))); + itemRgbColor.setRgb(fixture->channelValueAt(rgbCh.at(0)), fixture->channelValueAt(rgbCh.at(1)), + fixture->channelValueAt(rgbCh.at(2))); } - QVector cmyCh = fixture->cmyChannels(headIndex); + QVector cmyCh = fixture->cmyChannels(headIndex); if (cmyCh.size() == 3) { - itemRgbColor.setCmyk(fixture->channelValueAt(cmyCh.at(0)), - fixture->channelValueAt(cmyCh.at(1)), - fixture->channelValueAt(cmyCh.at(2)), 0); + itemRgbColor.setCmyk(fixture->channelValueAt(cmyCh.at(0)), fixture->channelValueAt(cmyCh.at(1)), + fixture->channelValueAt(cmyCh.at(2)), 0); } if (rgbDiffCount == 0 || itemRgbColor == rgbColor) @@ -1196,7 +1194,7 @@ void ContextManager::getCurrentColors(QQuickItem *item) quint32 white = fixture->channelNumber(QLCChannel::White, QLCChannel::MSB, headIndex); quint32 amber = fixture->channelNumber(QLCChannel::Amber, QLCChannel::MSB, headIndex); - quint32 UV = fixture->channelNumber(QLCChannel::UV, QLCChannel::MSB, headIndex); + quint32 UV = fixture->channelNumber(QLCChannel::UV, QLCChannel::MSB, headIndex); if (white != QLCChannel::invalid()) itemWauvColor.setRed(fixture->channelValueAt(white)); @@ -1211,11 +1209,8 @@ void ContextManager::getCurrentColors(QQuickItem *item) wauvDiffCount++; } - QMetaObject::invokeMethod(item, "updateColors", - Q_ARG(QVariant, rgbDiffCount ? false : true), - Q_ARG(QVariant, rgbColor), - Q_ARG(QVariant, wauvDiffCount ? false : true), - Q_ARG(QVariant, wauvColor)); + QMetaObject::invokeMethod(item, "updateColors", Q_ARG(QVariant, rgbDiffCount ? false : true), Q_ARG(QVariant, rgbColor), + Q_ARG(QVariant, wauvDiffCount ? false : true), Q_ARG(QVariant, wauvColor)); } void ContextManager::createFixtureGroup() @@ -1680,4 +1675,3 @@ GenericDMXSource *ContextManager::dmxSource() const { return m_source; } - diff --git a/qmlui/virtualconsole/vcslider.cpp b/qmlui/virtualconsole/vcslider.cpp index 0abc75604c..32c21c8449 100644 --- a/qmlui/virtualconsole/vcslider.cpp +++ b/qmlui/virtualconsole/vcslider.cpp @@ -1233,8 +1233,8 @@ void VCSlider::writeDMXAdjust(MasterTimer *timer, QList ua) { if (function->stopped() == true) { -#if 0 // temporarily revert #699 until a better solution is found - // Since this function is started by a fader, its fade in time +#if 0 // temporarily revert #699 until a better solution is found \ + // Since this function is started by a fader, its fade in time \ // is decided by the fader movement. function->start(timer, functionParent(), 0, 0, Function::defaultSpeed(), Function::defaultSpeed()); diff --git a/ui/src/virtualconsole/vcslider.cpp b/ui/src/virtualconsole/vcslider.cpp index 4d4da27905..492b25410e 100644 --- a/ui/src/virtualconsole/vcslider.cpp +++ b/ui/src/virtualconsole/vcslider.cpp @@ -1194,8 +1194,8 @@ void VCSlider::writeDMXPlayback(MasterTimer *timer, QList ua) { if (function->stopped() == true) { -#if 0 // temporarily revert #699 until a better solution is found - // Since this function is started by a fader, its fade in time +#if 0 // temporarily revert #699 until a better solution is found \ + // Since this function is started by a fader, its fade in time \ // is decided by the fader movement. function->start(timer, functionParent(), 0, 0, Function::defaultSpeed(), Function::defaultSpeed()); From 411d829af995f55af5261e286f7a03d27661d084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans-J=C3=BCrgen=20Tappe?= Date: Tue, 4 Jul 2023 20:44:45 +0200 Subject: [PATCH 27/30] Reduce the column limit to 100. --- .clang-format | 4 +- engine/audio/plugins/mad/audiodecoder_mad.cpp | 18 +- engine/audio/plugins/mad/audiodecoder_mad.h | 4 +- engine/audio/src/audio.cpp | 3 +- engine/audio/src/audiocapture.cpp | 29 +-- engine/audio/src/audiocapture_alsa.cpp | 6 +- engine/audio/src/audiocapture_portaudio.cpp | 10 +- engine/audio/src/audiocapture_qt5.cpp | 3 +- engine/audio/src/audiocapture_wavein.cpp | 9 +- engine/audio/src/audiodecoder.h | 3 +- engine/audio/src/audiorenderer.cpp | 14 +- engine/audio/src/audiorenderer_alsa.cpp | 10 +- engine/audio/src/audiorenderer_portaudio.cpp | 16 +- engine/audio/src/audiorenderer_portaudio.h | 5 +- engine/audio/src/audiorenderer_waveout.cpp | 12 +- engine/src/avolitesd4parser.cpp | 92 +++++---- engine/src/avolitesd4parser.h | 3 +- engine/src/channelmodifier.cpp | 11 +- engine/src/channelsgroup.cpp | 21 ++- engine/src/chaser.cpp | 18 +- engine/src/chaser.h | 3 +- engine/src/chaserrunner.cpp | 63 ++++--- engine/src/chaserrunner.h | 20 +- engine/src/chaserstep.cpp | 3 +- engine/src/chaserstep.h | 3 +- engine/src/collection.cpp | 13 +- engine/src/cuestack.cpp | 22 ++- engine/src/cuestack.h | 3 +- engine/src/doc.cpp | 23 ++- engine/src/efx.cpp | 3 +- engine/src/efx.h | 3 +- engine/src/efxfixture.cpp | 41 +++-- engine/src/efxfixture.h | 6 +- engine/src/fadechannel.cpp | 5 +- engine/src/fixture.cpp | 57 ++++-- engine/src/fixture.h | 6 +- engine/src/fixturegroup.cpp | 3 +- engine/src/function.cpp | 34 ++-- engine/src/function.h | 15 +- engine/src/genericdmxsource.cpp | 6 +- engine/src/genericfader.cpp | 9 +- engine/src/grandmaster.cpp | 18 +- engine/src/inputoutputmap.cpp | 45 +++-- engine/src/inputoutputmap.h | 11 +- engine/src/inputpatch.cpp | 19 +- engine/src/inputpatch.h | 3 +- engine/src/ioplugincache.cpp | 6 +- engine/src/mastertimer-unix.cpp | 2 +- engine/src/mastertimer-win32.cpp | 4 +- engine/src/mastertimer.cpp | 3 +- engine/src/monitorproperties.cpp | 12 +- engine/src/monitorproperties.h | 3 +- engine/src/outputpatch.cpp | 6 +- engine/src/outputpatch.h | 2 +- engine/src/qlccapability.h | 3 +- engine/src/qlcfile.cpp | 3 +- engine/src/qlcfile.h | 3 +- engine/src/qlcfixturedef.cpp | 8 +- engine/src/qlcfixturedefcache.cpp | 9 +- engine/src/qlcfixturehead.cpp | 12 +- engine/src/qlcfixturemode.cpp | 20 +- engine/src/qlcinputchannel.cpp | 3 +- engine/src/qlcinputprofile.cpp | 5 +- engine/src/qlcpalette.cpp | 8 +- engine/src/qlcphysical.cpp | 26 +-- engine/src/rgbaudio.cpp | 3 +- engine/src/rgbimage.cpp | 6 +- engine/src/rgbmatrix.cpp | 12 +- engine/src/rgbmatrix.h | 6 +- engine/src/rgbscript.cpp | 7 +- engine/src/rgbscriptv4.cpp | 7 +- engine/src/scene.cpp | 10 +- engine/src/scene.h | 3 +- engine/src/scenevalue.h | 3 +- engine/src/script.cpp | 6 +- engine/src/script.h | 8 +- engine/src/scriptrunner.cpp | 16 +- engine/src/scriptv4.cpp | 9 +- engine/src/sequence.cpp | 3 +- engine/src/show.cpp | 6 +- engine/src/showrunner.cpp | 6 +- engine/src/universe.cpp | 66 ++++--- engine/src/universe.h | 8 +- engine/src/video.cpp | 3 +- engine/test/chaserrunner/chaserrunner_test.h | 14 +- engine/test/cuestack/cuestack_test.cpp | 3 +- engine/test/doc/doc_test.cpp | 9 +- engine/test/efx/efx_test.cpp | 5 +- engine/test/efxfixture/efxfixture_test.cpp | 3 +- engine/test/fixture/fixture_test.cpp | 4 +- .../test/fixturegroup/fixturegroup_test.cpp | 5 +- engine/test/function/function_test.cpp | 6 +- .../inputoutputmap/inputoutputmap_test.cpp | 6 +- engine/test/iopluginstub/iopluginstub.cpp | 3 +- engine/test/qlcfile/qlcfile_test.cpp | 9 +- .../qlcfixturehead/qlcfixturehead_test.cpp | 3 +- .../qlcfixturemode/qlcfixturemode_test.cpp | 2 +- .../qlcinputchannel/qlcinputchannel_test.cpp | 24 ++- engine/test/rgbscript/rgbscript_test.cpp | 27 ++- qmlui/app.cpp | 50 ++--- qmlui/audioeditor.cpp | 9 +- qmlui/chasereditor.cpp | 75 +++++--- qmlui/chasereditor.h | 3 +- qmlui/collectioneditor.cpp | 9 +- qmlui/colorfilters.cpp | 9 +- qmlui/colorfilters.h | 6 +- qmlui/contextmanager.cpp | 118 +++++++----- qmlui/contextmanager.h | 10 +- qmlui/efxeditor.cpp | 56 ++++-- qmlui/efxeditor.h | 9 +- qmlui/fixturebrowser.cpp | 12 +- qmlui/fixturebrowser.h | 3 +- qmlui/fixtureeditor/fixtureeditor.cpp | 12 +- qmlui/fixtureeditor/physicaledit.h | 3 +- qmlui/fixturegroupeditor.cpp | 13 +- qmlui/fixturemanager.cpp | 137 ++++++++------ qmlui/fixturemanager.h | 23 ++- qmlui/fixtureutils.cpp | 46 +++-- qmlui/functioneditor.cpp | 40 ++-- qmlui/functionmanager.cpp | 74 +++++--- qmlui/functionmanager.h | 9 +- qmlui/importmanager.cpp | 37 ++-- qmlui/importmanager.h | 6 +- qmlui/inputoutputmanager.cpp | 22 ++- qmlui/mainview2d.cpp | 68 ++++--- qmlui/mainview2d.h | 6 +- qmlui/mainview3d.cpp | 169 ++++++++++------- qmlui/mainview3d.h | 19 +- qmlui/palettemanager.cpp | 9 +- qmlui/previewcontext.cpp | 55 +++--- qmlui/rgbmatrixeditor.cpp | 99 +++++----- qmlui/sceneeditor.cpp | 16 +- qmlui/showmanager.cpp | 29 ++- qmlui/showmanager.h | 6 +- qmlui/simpledesk.cpp | 28 ++- qmlui/simpledesk.h | 3 +- qmlui/tardis/networkmanager.cpp | 24 ++- qmlui/tardis/networkpacketizer.cpp | 24 ++- qmlui/tardis/networkpacketizer.h | 2 +- qmlui/tardis/simplecrypt.h | 18 +- qmlui/tardis/tardis.cpp | 123 ++++++++----- qmlui/tardis/tardis.h | 6 +- qmlui/treemodel.cpp | 12 +- qmlui/treemodelitem.h | 3 +- qmlui/uimanager.cpp | 6 +- qmlui/videoeditor.cpp | 21 ++- qmlui/videoprovider.cpp | 28 ++- qmlui/virtualconsole/vcbutton.cpp | 18 +- qmlui/virtualconsole/vcbutton.h | 7 +- qmlui/virtualconsole/vcclock.cpp | 25 ++- qmlui/virtualconsole/vccuelist.cpp | 32 ++-- qmlui/virtualconsole/vccuelist.h | 3 +- qmlui/virtualconsole/vcframe.cpp | 104 +++++++---- qmlui/virtualconsole/vcframe.h | 7 +- qmlui/virtualconsole/vcpage.cpp | 32 ++-- qmlui/virtualconsole/vcpage.h | 16 +- qmlui/virtualconsole/vcslider.cpp | 58 +++--- qmlui/virtualconsole/vcslider.h | 16 +- qmlui/virtualconsole/vcsoloframe.cpp | 3 +- qmlui/virtualconsole/vcwidget.cpp | 28 +-- qmlui/virtualconsole/vcwidget.h | 6 +- qmlui/virtualconsole/virtualconsole.cpp | 55 +++--- qmlui/virtualconsole/virtualconsole.h | 6 +- ui/src/aboutbox.cpp | 3 +- ui/src/addchannelsgroup.cpp | 7 +- ui/src/addfixture.cpp | 19 +- ui/src/addfixture.h | 3 +- ui/src/addresstool.cpp | 6 +- ui/src/app.cpp | 54 ++++-- ui/src/apputil.cpp | 3 +- ui/src/apputil.h | 6 +- ui/src/assignhotkey.cpp | 4 +- ui/src/audiobar.cpp | 4 +- ui/src/audioeditor.cpp | 3 +- ui/src/audiotriggerwidget.cpp | 6 +- ui/src/channelmodifiereditor.cpp | 12 +- ui/src/channelmodifiergraphicsview.cpp | 58 +++--- ui/src/channelmodifiergraphicsview.h | 3 +- ui/src/channelsselection.cpp | 15 +- ui/src/chasereditor.cpp | 28 +-- ui/src/clickandgowidget.cpp | 15 +- ui/src/collectioneditor.cpp | 3 +- ui/src/consolechannel.cpp | 64 ++++--- ui/src/consolechannel.h | 3 +- ui/src/ctkrangeslider.cpp | 69 ++++--- ui/src/cuestackmodel.cpp | 3 +- ui/src/cuestackmodel.h | 3 +- ui/src/dmxdumpfactory.cpp | 21 ++- ui/src/efxeditor.cpp | 20 +- ui/src/fixtureconsole.cpp | 57 +++--- ui/src/fixturegroupeditor.cpp | 16 +- ui/src/fixturemanager.cpp | 89 +++++---- ui/src/fixtureremap.cpp | 75 +++++--- ui/src/fixtureremap.h | 3 +- ui/src/fixtureselection.cpp | 8 +- ui/src/fixturetreewidget.cpp | 10 +- ui/src/flowlayout.cpp | 6 +- ui/src/functionliveeditdialog.cpp | 3 +- ui/src/functionmanager.cpp | 39 ++-- ui/src/functionselection.cpp | 7 +- ui/src/functionstreewidget.cpp | 3 +- ui/src/functionwizard.cpp | 56 ++++-- ui/src/functionwizard.h | 3 +- ui/src/grandmasterslider.cpp | 55 +++--- ui/src/groupsconsole.cpp | 3 +- ui/src/inputchanneleditor.cpp | 10 +- ui/src/inputchanneleditor.h | 4 +- ui/src/inputoutputmanager.cpp | 17 +- ui/src/inputoutputpatcheditor.cpp | 123 ++++++++----- ui/src/inputprofileeditor.cpp | 24 ++- ui/src/inputselectionwidget.cpp | 20 +- ui/src/knobwidget.cpp | 8 +- ui/src/monitor/monitor.cpp | 18 +- ui/src/monitor/monitorbackgroundselection.cpp | 10 +- ui/src/monitor/monitorfixture.cpp | 8 +- ui/src/monitor/monitorfixtureitem.cpp | 38 ++-- .../monitorfixturepropertieseditor.cpp | 3 +- .../monitor/monitorfixturepropertieseditor.h | 4 +- ui/src/monitor/monitorgraphicsview.cpp | 14 +- ui/src/palettegenerator.cpp | 33 ++-- ui/src/palettegenerator.h | 7 +- ui/src/positiontool.cpp | 3 +- ui/src/rdmmanager.cpp | 80 +++++--- ui/src/rgbitem.cpp | 18 +- ui/src/rgbmatrixeditor.cpp | 48 +++-- ui/src/sceneeditor.cpp | 67 ++++--- ui/src/scripteditor.cpp | 29 ++- ui/src/selectinputchannel.cpp | 18 +- ui/src/showmanager/audioitem.cpp | 27 +-- ui/src/showmanager/multitrackview.cpp | 62 ++++--- ui/src/showmanager/rgbmatrixitem.cpp | 5 +- ui/src/showmanager/showeditor.cpp | 3 +- ui/src/showmanager/showitem.cpp | 3 +- ui/src/showmanager/showmanager.cpp | 88 +++++---- ui/src/showmanager/trackitem.cpp | 6 +- ui/src/simpledesk.cpp | 71 ++++--- ui/src/simpledeskengine.cpp | 20 +- ui/src/simpledeskengine.h | 3 +- ui/src/speeddial.cpp | 17 +- ui/src/speeddialwidget.cpp | 3 +- ui/src/speeddialwidget.h | 6 +- ui/src/universeitemwidget.cpp | 6 +- ui/src/videoeditor.cpp | 10 +- ui/src/videoprovider.cpp | 3 +- ui/src/virtualconsole/addvcbuttonmatrix.cpp | 3 +- ui/src/virtualconsole/vcaudiotriggers.cpp | 12 +- .../vcaudiotriggersproperties.cpp | 14 +- .../vcaudiotriggersproperties.h | 3 +- ui/src/virtualconsole/vcbutton.cpp | 34 ++-- ui/src/virtualconsole/vcclock.cpp | 16 +- ui/src/virtualconsole/vccuelist.cpp | 71 ++++--- ui/src/virtualconsole/vcframe.cpp | 31 ++-- ui/src/virtualconsole/vcframeproperties.cpp | 6 +- ui/src/virtualconsole/vclabel.cpp | 7 +- ui/src/virtualconsole/vcmatrix.cpp | 34 ++-- ui/src/virtualconsole/vcmatrixcontrol.cpp | 2 +- .../vcmatrixpresetselection.cpp | 3 +- ui/src/virtualconsole/vcmatrixproperties.cpp | 28 +-- ui/src/virtualconsole/vcproperties.cpp | 15 +- ui/src/virtualconsole/vcpropertieseditor.cpp | 10 +- ui/src/virtualconsole/vcslider.cpp | 48 +++-- ui/src/virtualconsole/vcsliderproperties.cpp | 21 ++- ui/src/virtualconsole/vcsoloframe.cpp | 3 +- ui/src/virtualconsole/vcspeeddial.cpp | 56 ++++-- ui/src/virtualconsole/vcspeeddialfunction.cpp | 17 +- ui/src/virtualconsole/vcspeeddialfunction.h | 4 +- ui/src/virtualconsole/vcspeeddialpreset.cpp | 7 +- .../virtualconsole/vcspeeddialproperties.cpp | 42 +++-- ui/src/virtualconsole/vcwidget.cpp | 35 ++-- ui/src/virtualconsole/vcwidget.h | 3 +- ui/src/virtualconsole/vcxypad.cpp | 105 ++++++----- ui/src/virtualconsole/vcxypad.h | 14 +- ui/src/virtualconsole/vcxypadarea.cpp | 21 ++- ui/src/virtualconsole/vcxypadfixture.cpp | 3 +- .../virtualconsole/vcxypadfixtureeditor.cpp | 8 +- ui/src/virtualconsole/vcxypadproperties.cpp | 52 ++++-- ui/src/virtualconsole/vcxypadproperties.h | 4 +- ui/src/virtualconsole/virtualconsole.cpp | 53 ++++-- ui/test/aboutbox/aboutbox_test.cpp | 6 +- .../monitorfixture/monitorfixture_test.cpp | 7 +- .../monitorfixtureitem_test.cpp | 14 +- ui/test/vcbutton/vcbutton_test.cpp | 22 ++- ui/test/vccuelist/vccuelist_test.cpp | 27 ++- ui/test/vcframe/vcframe_test.cpp | 13 +- ui/test/vcwidget/vcwidget_test.cpp | 29 +-- .../vcwidgetproperties_test.cpp | 5 +- ui/test/vcxypad/vcxypad_test.cpp | 34 ++-- ui/test/vcxypadarea/vcxypadarea_test.cpp | 8 +- .../vcxypadfixture/vcxypadfixture_test.cpp | 6 +- webaccess/src/qhttpserver/http_parser.h | 6 +- webaccess/src/qhttpserver/qhttpconnection.cpp | 27 ++- webaccess/src/qhttpserver/qhttprequest.cpp | 6 +- webaccess/src/qhttpserver/qhttpresponse.cpp | 10 +- webaccess/src/webaccess.cpp | 174 ++++++++++-------- webaccess/src/webaccess.h | 4 +- webaccess/src/webaccessauth.cpp | 38 ++-- webaccess/src/webaccessauth.h | 3 +- webaccess/src/webaccessconfiguration.cpp | 99 +++++----- webaccess/src/webaccessnetwork.cpp | 64 ++++--- webaccess/src/webaccesssimpledesk.cpp | 40 ++-- webaccess/src/webaccesssimpledesk.h | 3 +- 301 files changed, 3930 insertions(+), 2463 deletions(-) diff --git a/.clang-format b/.clang-format index ae6f749cc6..6eee8ee8f9 100644 --- a/.clang-format +++ b/.clang-format @@ -81,7 +81,7 @@ BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true # Column width is limited to 120 characters as used in the QLCplus code # https://wiki.qt.io/Qt_Coding_Style defines a limit of 100. -ColumnLimit: 120 +ColumnLimit: 100 # Disable reflow of some specific comments # qdoc comments: indentation rules are different. @@ -180,7 +180,7 @@ PenaltyIndentedWhitespace: 0 PointerAlignment: Right PPIndentWidth: 2 ReferenceAlignment: Pointer -ReflowComments: false +ReflowComments: true RemoveBracesLLVM: false SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 diff --git a/engine/audio/plugins/mad/audiodecoder_mad.cpp b/engine/audio/plugins/mad/audiodecoder_mad.cpp index 5065852fa9..a8ad5313c1 100644 --- a/engine/audio/plugins/mad/audiodecoder_mad.cpp +++ b/engine/audio/plugins/mad/audiodecoder_mad.cpp @@ -251,7 +251,8 @@ bool AudioDecoderMAD::findHeader() { if (m_stream.error == MAD_ERROR_LOSTSYNC) { - uint tagSize = findID3v2((uchar *)m_stream.this_frame, (ulong)(m_stream.bufend - m_stream.this_frame)); + uint tagSize = findID3v2((uchar *)m_stream.this_frame, + (ulong)(m_stream.bufend - m_stream.this_frame)); if (tagSize > 0) { mad_stream_skip(&m_stream, tagSize); @@ -273,13 +274,15 @@ bool AudioDecoderMAD::findHeader() result = true; count++; - // qDebug() << "Detecting header" << count << m_stream.error << m_stream.sync << header.bitrate << header.layer; + // qDebug() << "Detecting header" << count << m_stream.error << m_stream.sync << + // header.bitrate << header.layer; // try to detect xing header if (count == 1) { m_frame.header = header; - if (mad_frame_decode(&m_frame, &m_stream) != -1 && findXingHeader(m_stream.anc_ptr, m_stream.anc_bitlen)) + if (mad_frame_decode(&m_frame, &m_stream) != -1 + && findXingHeader(m_stream.anc_ptr, m_stream.anc_bitlen)) { is_vbr = true; @@ -369,7 +372,8 @@ qint64 AudioDecoderMAD::read(char *data, qint64 size) case MAD_ERROR_LOSTSYNC: { // skip ID3v2 tag - uint tagSize = findID3v2((uchar *)m_stream.this_frame, (ulong)(m_stream.bufend - m_stream.this_frame)); + uint tagSize = findID3v2((uchar *)m_stream.this_frame, + (ulong)(m_stream.bufend - m_stream.this_frame)); if (tagSize > 0) { mad_stream_skip(&m_stream, tagSize); @@ -452,7 +456,8 @@ uint AudioDecoderMAD::findID3v2(uchar *data, ulong size) // retuns ID3v2 tag siz if (((data[0] == 'I' && data[1] == 'D' && data[2] == '3') || // ID3v2 tag (data[0] == '3' && data[1] == 'D' && data[2] == 'I')) && // ID3v2 footer - data[3] < 0xff && data[4] < 0xff && data[6] < 0x80 && data[7] < 0x80 && data[8] < 0x80 && data[9] < 0x80) + data[3] < 0xff && data[4] < 0xff && data[6] < 0x80 && data[7] < 0x80 && data[8] < 0x80 + && data[9] < 0x80) { quint32 id3v2_size = (data[6] << 21) + (data[7] << 14) + (data[8] << 7) + data[9]; return id3v2_size; @@ -480,7 +485,8 @@ void AudioDecoderMAD::clip(mad_fixed_t *sample) *sample = MIN; } -long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither) +long AudioDecoderMAD::audio_linear_dither(unsigned int bits, mad_fixed_t sample, + struct audio_dither *dither) { unsigned int scalebits; mad_fixed_t output, mask, random; diff --git a/engine/audio/plugins/mad/audiodecoder_mad.h b/engine/audio/plugins/mad/audiodecoder_mad.h index dc6286e27a..ab5a69cc53 100644 --- a/engine/audio/plugins/mad/audiodecoder_mad.h +++ b/engine/audio/plugins/mad/audiodecoder_mad.h @@ -129,8 +129,8 @@ class AudioDecoderMAD : public AudioDecoder // converter functions unsigned long prng(unsigned long state); void clip(mad_fixed_t *sample); - long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither); - long audio_linear_round(unsigned int bits, mad_fixed_t sample); + long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither); + long audio_linear_round(unsigned int bits, mad_fixed_t sample); }; /** @} */ diff --git a/engine/audio/src/audio.cpp b/engine/audio/src/audio.cpp index 624f25311f..0dd8a70ce6 100644 --- a/engine/audio/src/audio.cpp +++ b/engine/audio/src/audio.cpp @@ -287,7 +287,8 @@ bool Audio::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::AudioType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not Audio"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not Audio"; return false; } diff --git a/engine/audio/src/audiocapture.cpp b/engine/audio/src/audiocapture.cpp index 8c8a01a30e..e5d72ffcb3 100644 --- a/engine/audio/src/audiocapture.cpp +++ b/engine/audio/src/audiocapture.cpp @@ -165,9 +165,10 @@ double AudioCapture::fillBandsData(int number) { if (i == bufferSize) break; - magnitudeSum += - qSqrt((((fftw_complex *)m_fftOutputBuffer)[i][0] * ((fftw_complex *)m_fftOutputBuffer)[i][0]) - + (((fftw_complex *)m_fftOutputBuffer)[i][1] * ((fftw_complex *)m_fftOutputBuffer)[i][1])); + magnitudeSum += qSqrt((((fftw_complex *)m_fftOutputBuffer)[i][0] + * ((fftw_complex *)m_fftOutputBuffer)[i][0]) + + (((fftw_complex *)m_fftOutputBuffer)[i][1] + * ((fftw_complex *)m_fftOutputBuffer)[i][1])); } double bandMagnitude = (magnitudeSum / (subBandWidth * M_2PI)); m_fftMagnitudeMap[number].m_fftMagnitudeBuffer[b] = bandMagnitude; @@ -189,7 +190,8 @@ void AudioCapture::processData() // 1 ********* Initialize FFTW fftw_plan plan_forward; - plan_forward = fftw_plan_dft_r2c_1d(bufferSize, m_fftInputBuffer, (fftw_complex *)m_fftOutputBuffer, 0); + plan_forward = + fftw_plan_dft_r2c_1d(bufferSize, m_fftInputBuffer, (fftw_complex *)m_fftOutputBuffer, 0); // 2 ********* Apply a window to audio data // *********** and convert it to doubles @@ -207,15 +209,17 @@ void AudioCapture::processData() for (i = 0; i < bufferSize; i++) { #ifdef USE_BLACKMAN - double a0 = (1 - 0.16) / 2; - double a1 = 0.5; - double a2 = 0.16 / 2; - m_fftInputBuffer[i] = - m_audioMixdown[i] - * (a0 - a1 * qCos((M_2PI * i) / (bufferSize - 1)) + a2 * qCos((2 * M_2PI * i) / (bufferSize - 1))) / 32768.; + double a0 = (1 - 0.16) / 2; + double a1 = 0.5; + double a2 = 0.16 / 2; + m_fftInputBuffer[i] = m_audioMixdown[i] + * (a0 - a1 * qCos((M_2PI * i) / (bufferSize - 1)) + + a2 * qCos((2 * M_2PI * i) / (bufferSize - 1))) + / 32768.; #endif #ifdef USE_HANNING - m_fftInputBuffer[i] = m_audioMixdown[i] * (0.5 * (1.00 - qCos((M_2PI * i) / (bufferSize - 1)))) / 32768.; + m_fftInputBuffer[i] = + m_audioMixdown[i] * (0.5 * (1.00 - qCos((M_2PI * i) / (bufferSize - 1)))) / 32768.; #endif #ifdef USE_NO_WINDOW m_fftInputBuffer[i] = (double)m_audioMixdown[i] / 32768.; @@ -247,7 +251,8 @@ void AudioCapture::processData() } m_signalPower = 32768 * pwrSum * qSqrt(M_2PI) / (double)barsNumber; emit dataProcessed(m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.data(), - m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.size(), maxMagnitude, m_signalPower); + m_fftMagnitudeMap[barsNumber].m_fftMagnitudeBuffer.size(), maxMagnitude, + m_signalPower); } #endif } diff --git a/engine/audio/src/audiocapture_alsa.cpp b/engine/audio/src/audiocapture_alsa.cpp index 218c964cad..f6645ac5cc 100644 --- a/engine/audio/src/audiocapture_alsa.cpp +++ b/engine/audio/src/audiocapture_alsa.cpp @@ -57,7 +57,8 @@ bool AudioCaptureAlsa::initialize() qWarning("cannot allocate hardware parameter structure (%s)\n", snd_strerror(err)); else if ((err = snd_pcm_hw_params_any(m_captureHandle, hw_params)) < 0) qWarning("cannot initialize hardware parameter structure (%s)\n", snd_strerror(err)); - else if ((err = snd_pcm_hw_params_set_access(m_captureHandle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) + else if ((err = snd_pcm_hw_params_set_access(m_captureHandle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) + < 0) qWarning("cannot set access type (%s)\n", snd_strerror(err)); else if ((err = snd_pcm_hw_params_set_format(m_captureHandle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) qWarning("cannot set sample format (%s)\n", snd_strerror(err)); @@ -113,7 +114,8 @@ bool AudioCaptureAlsa::readAudio(int maxSize) return false; } - // qDebug() << "Audio sample #0:" << m_audioBuffer[0] << ", #max:" << m_audioBuffer[m_captureSize - 1]; + // qDebug() << "Audio sample #0:" << m_audioBuffer[0] << ", #max:" << + // m_audioBuffer[m_captureSize - 1]; qDebug() << "[ALSA readAudio] " << maxSize << "bytes read"; return true; diff --git a/engine/audio/src/audiocapture_portaudio.cpp b/engine/audio/src/audiocapture_portaudio.cpp index 13a7317fe0..49422f9147 100644 --- a/engine/audio/src/audiocapture_portaudio.cpp +++ b/engine/audio/src/audiocapture_portaudio.cpp @@ -62,9 +62,9 @@ bool AudioCapturePortAudio::initialize() return false; } - inputParameters.channelCount = m_channels; - inputParameters.sampleFormat = paInt16; - inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency; + inputParameters.channelCount = m_channels; + inputParameters.sampleFormat = paInt16; + inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency; inputParameters.hostApiSpecificStreamInfo = NULL; // ensure initialize() has not been called multiple times @@ -73,8 +73,8 @@ bool AudioCapturePortAudio::initialize() /* -- setup stream -- */ err = Pa_OpenStream(&stream, &inputParameters, NULL, m_sampleRate, paFramesPerBufferUnspecified, paClipOff, /* we won't output out of range samples so don't bother clipping them */ - NULL, /* no callback, use blocking API */ - NULL); /* no callback, so no callback userData */ + NULL, /* no callback, use blocking API */ + NULL); /* no callback, so no callback userData */ if (err != paNoError) { qWarning("Cannot open audio input stream (%s)\n", Pa_GetErrorText(err)); diff --git a/engine/audio/src/audiocapture_qt5.cpp b/engine/audio/src/audiocapture_qt5.cpp index 1d3aa5b1c3..4dfa3107f2 100644 --- a/engine/audio/src/audiocapture_qt5.cpp +++ b/engine/audio/src/audiocapture_qt5.cpp @@ -46,7 +46,8 @@ bool AudioCaptureQt6::initialize() if (var.isValid() == true) { devName = var.toString(); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) + foreach (const QAudioDeviceInfo &deviceInfo, + QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) { if (deviceInfo.deviceName() == devName) { diff --git a/engine/audio/src/audiocapture_wavein.cpp b/engine/audio/src/audiocapture_wavein.cpp index 9fff2d6207..a3067d6e0d 100644 --- a/engine/audio/src/audiocapture_wavein.cpp +++ b/engine/audio/src/audiocapture_wavein.cpp @@ -50,7 +50,8 @@ bool AudioCaptureWaveIn::initialize() format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8; format.cbSize = 0; - result = waveInOpen(&deviceHandle, WAVE_MAPPER, &format, 0L, 0L, CALLBACK_NULL | WAVE_FORMAT_DIRECT); + result = + waveInOpen(&deviceHandle, WAVE_MAPPER, &format, 0L, 0L, CALLBACK_NULL | WAVE_FORMAT_DIRECT); switch (result) { case MMSYSERR_ALLOCATED: @@ -77,10 +78,10 @@ bool AudioCaptureWaveIn::initialize() for (int i = 0; i < HEADERS_NUMBER; i++) { - m_internalBuffers[i] = new char[m_captureSize * 2]; + m_internalBuffers[i] = new char[m_captureSize * 2]; // Set up and prepare header for input - waveHeaders[i].lpData = (LPSTR)m_internalBuffers[i]; - waveHeaders[i].dwBufferLength = m_captureSize * 2; // multiply by 2 cause they're 16bit samples + waveHeaders[i].lpData = (LPSTR)m_internalBuffers[i]; + waveHeaders[i].dwBufferLength = m_captureSize * 2; // multiply by 2 cause they're 16bit samples waveHeaders[i].dwBytesRecorded = 0; waveHeaders[i].dwUser = 0L; waveHeaders[i].dwFlags = 0L; diff --git a/engine/audio/src/audiodecoder.h b/engine/audio/src/audiodecoder.h index be3e319075..865396b50d 100644 --- a/engine/audio/src/audiodecoder.h +++ b/engine/audio/src/audiodecoder.h @@ -96,7 +96,8 @@ class AudioDecoder : public QObject protected: /*! - * Use this function inside initialize() reimplementation to tell other plugins about audio parameters. + * Use this function inside initialize() reimplementation to tell other plugins about audio + * parameters. * @param srate Sample rate. * @param chan Number of channels. * @param f Audio format. diff --git a/engine/audio/src/audiorenderer.cpp b/engine/audio/src/audiorenderer.cpp index c37e970bb9..67c6eae7c9 100644 --- a/engine/audio/src/audiorenderer.cpp +++ b/engine/audio/src/audiorenderer.cpp @@ -143,14 +143,15 @@ void AudioRenderer::run() /* else if (sampleSize == 3) { - long sample = ((long)audioData[i+2] << 16) + ((long)audioData[i+1] << 8) + - (short)audioData[i]; sample *= scaleFactor; audioData[i+2] = (sample >> 16) & 0x000000FF; - audioData[i+1] = (sample >> 8) & 0x000000FF; - audioData[i] = sample & 0x000000FF; + long sample = ((long)audioData[i+2] << 16) + ((long)audioData[i+1] << 8) + + (short)audioData[i]; sample *= scaleFactor; audioData[i+2] = (sample >> + 16) & 0x000000FF; audioData[i+1] = (sample >> 8) & 0x000000FF; audioData[i] + = sample & 0x000000FF; } else if (sampleSize == 4) { - long sample = ((long)audioData[i+3] << 24) + ((long)audioData[i+2] << 16) + + long sample = ((long)audioData[i+3] << 24) + ((long)audioData[i+2] << + 16) + ((long)audioData[i+1] << 8) + (short)audioData[i]; sample *= scaleFactor; audioData[i+3] = (sample >> 24) & 0x000000FF; @@ -174,7 +175,8 @@ void AudioRenderer::run() } else { - audioDataWritten = writeAudio(audioData + (audioDataRead - pendingAudioBytes), pendingAudioBytes); + audioDataWritten = + writeAudio(audioData + (audioDataRead - pendingAudioBytes), pendingAudioBytes); pendingAudioBytes -= audioDataWritten; if (audioDataWritten == 0) usleep(15000); diff --git a/engine/audio/src/audiorenderer_alsa.cpp b/engine/audio/src/audiorenderer_alsa.cpp index 80b245f453..a25368047f 100644 --- a/engine/audio/src/audiorenderer_alsa.cpp +++ b/engine/audio/src/audiorenderer_alsa.cpp @@ -99,7 +99,8 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) } if (m_use_mmap) { - if ((err = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) < 0) + if ((err = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_MMAP_INTERLEAVED)) + < 0) { qWarning("OutputALSA: Error setting mmap access: %s", snd_strerror(err)); m_use_mmap = false; @@ -188,7 +189,8 @@ bool AudioRendererAlsa::initialize(quint32 freq, int chan, AudioFormat format) // swparams snd_pcm_sw_params_alloca(&swparams); snd_pcm_sw_params_current(pcm_handle, swparams); - if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, buffer_size - period_size)) < 0) + if ((err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, buffer_size - period_size)) + < 0) qWarning("OutputALSA: Error setting threshold: %s", snd_strerror(err)); if ((err = snd_pcm_sw_params(pcm_handle, swparams)) < 0) { @@ -273,8 +275,8 @@ QList AudioRendererAlsa::getDevicesInfo() if (tmpCaps != 0) { AudioDeviceInfo info; - info.deviceName = - QString(snd_ctl_card_info_get_name(cardInfo)) + " - " + QString(snd_pcm_info_get_name(pcmInfo)); + info.deviceName = QString(snd_ctl_card_info_get_name(cardInfo)) + " - " + + QString(snd_pcm_info_get_name(pcmInfo)); info.privateName = QString(str); info.capabilities = tmpCaps; devList.append(info); diff --git a/engine/audio/src/audiorenderer_portaudio.cpp b/engine/audio/src/audiorenderer_portaudio.cpp index 44baed259d..50cd635393 100644 --- a/engine/audio/src/audiorenderer_portaudio.cpp +++ b/engine/audio/src/audiorenderer_portaudio.cpp @@ -45,8 +45,9 @@ AudioRendererPortAudio::~AudioRendererPortAudio() qDebug() << "PortAudio error: " << Pa_GetErrorText(err); } -int AudioRendererPortAudio::dataCallback(const void *, void *outputBuffer, unsigned long frameCount, - const PaStreamCallbackTimeInfo *, PaStreamCallbackFlags, void *userData) +int AudioRendererPortAudio::dataCallback(const void *, void *outputBuffer, unsigned long frameCount, + const PaStreamCallbackTimeInfo *, PaStreamCallbackFlags, + void *userData) { AudioRendererPortAudio *PAobj = (AudioRendererPortAudio *)userData; @@ -66,7 +67,8 @@ int AudioRendererPortAudio::dataCallback(const void *, void *outputBuffer, unsig memcpy(outputBuffer, PAobj->m_buffer.data(), requestedData); PAobj->m_buffer.remove(0, requestedData); - qDebug() << "PortAudio dataCallback. RequestedData: " << requestedData << "buffer size:" << PAobj->m_buffer.size(); + qDebug() << "PortAudio dataCallback. RequestedData: " << requestedData + << "buffer size:" << PAobj->m_buffer.size(); return paContinue; } @@ -101,8 +103,9 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form m_channels = chan; - outputParameters.channelCount = chan; /* stereo output */ - outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; + outputParameters.channelCount = chan; /* stereo output */ + outputParameters.suggestedLatency = + Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; switch (format) @@ -128,7 +131,8 @@ bool AudioRendererPortAudio::initialize(quint32 freq, int chan, AudioFormat form return false; } - err = Pa_OpenStream(&m_paStream, NULL, &outputParameters, freq, paFramesPerBufferUnspecified, flags, dataCallback, this); + err = Pa_OpenStream(&m_paStream, NULL, &outputParameters, freq, paFramesPerBufferUnspecified, + flags, dataCallback, this); if (err != paNoError) return false; diff --git a/engine/audio/src/audiorenderer_portaudio.h b/engine/audio/src/audiorenderer_portaudio.h index 48d1847e42..5597e941d1 100644 --- a/engine/audio/src/audiorenderer_portaudio.h +++ b/engine/audio/src/audiorenderer_portaudio.h @@ -63,8 +63,9 @@ class AudioRendererPortAudio : public AudioRenderer void resume(); private: - static int dataCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData); + static int dataCallback(const void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, + PaStreamCallbackFlags statusFlags, void *userData); PaStream *m_paStream; QMutex m_paMutex; diff --git a/engine/audio/src/audiorenderer_waveout.cpp b/engine/audio/src/audiorenderer_waveout.cpp index f386961378..ff852a957b 100644 --- a/engine/audio/src/audiorenderer_waveout.cpp +++ b/engine/audio/src/audiorenderer_waveout.cpp @@ -42,7 +42,8 @@ static int PlayedWaveHeadersCount = 0; // free index static WAVEHDR *PlayedWaveHeaders[MAX_WAVEBLOCKS]; -static void CALLBACK wave_callback(HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) +static void CALLBACK wave_callback(HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, + DWORD dwParam2) { Q_UNUSED(hWave) Q_UNUSED(dwInstance) @@ -215,7 +216,8 @@ qint64 AudioRendererWaveOut::writeAudio(unsigned char *data, qint64 len) while (PlayedWaveHeadersCount > 0) // free used blocks ... free_memory(); - if (ScheduledBlocks >= sizeof(PlayedWaveHeaders) / sizeof(*PlayedWaveHeaders)) // wait for a free block ... + if (ScheduledBlocks + >= sizeof(PlayedWaveHeaders) / sizeof(*PlayedWaveHeaders)) // wait for a free block ... { usleep(500); return 0; @@ -228,9 +230,11 @@ qint64 AudioRendererWaveOut::writeAudio(unsigned char *data, qint64 len) } allocptr = GlobalLock(hg2); - CopyMemory(allocptr, data, len); // Here we can call any modification output functions we want.... + CopyMemory(allocptr, data, + len); // Here we can call any modification output functions we want.... - if ((hg = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(WAVEHDR))) == NULL) // now make a header and WRITE IT! + if ((hg = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(WAVEHDR))) + == NULL) // now make a header and WRITE IT! return -1; wh = (wavehdr_tag *)GlobalLock(hg); diff --git a/engine/src/avolitesd4parser.cpp b/engine/src/avolitesd4parser.cpp index 2825c98550..cd6ed4e7d0 100644 --- a/engine/src/avolitesd4parser.cpp +++ b/engine/src/avolitesd4parser.cpp @@ -180,8 +180,9 @@ bool AvolitesD4Parser::loadXML(const QString &path, QLCFixtureDef *fixtureDef) // TODO TODO TODO // Maybe also import preset palettes and macros ?!?!?!?! /** - Can't be done for now, as qxf files don't have any information on preset palettes or macros - for fixtures, they are automatically generated on the main application maybe in future... **/ + Can't be done for now, as qxf files don't have any information on preset palettes or + macros for fixtures, they are automatically generated on the main application maybe + in future... **/ doc->skipCurrentElement(); } else @@ -211,11 +212,14 @@ QLCChannel::Group AvolitesD4Parser::getGroup(QString ID, QString name, QString g switch (stringToAttributeEnum(group)) { case AvolitesD4Parser::SPECIAL: - if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) || name.contains(KD4TagSpeed, Qt::CaseInsensitive)) + if (ID.contains(KD4TagSpeed, Qt::CaseInsensitive) + || name.contains(KD4TagSpeed, Qt::CaseInsensitive)) return QLCChannel::Speed; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) + || name.contains(KD4TagMacro, Qt::CaseInsensitive)) return QLCChannel::Effect; - else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) || name.contains(KD4TagReserved, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagReserved, Qt::CaseInsensitive) + || name.contains(KD4TagReserved, Qt::CaseInsensitive)) return QLCChannel::NoGroup; else return QLCChannel::Maintenance; @@ -223,33 +227,42 @@ QLCChannel::Group AvolitesD4Parser::getGroup(QString ID, QString name, QString g default: case AvolitesD4Parser::INTENSITY: - if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) || name.contains(KD4TagShutter, Qt::CaseInsensitive)) + if (ID.contains(KD4TagShutter, Qt::CaseInsensitive) + || name.contains(KD4TagShutter, Qt::CaseInsensitive)) return QLCChannel::Shutter; else return QLCChannel::Intensity; break; case AvolitesD4Parser::PANTILT: - if (ID.contains(KD4TagPan, Qt::CaseInsensitive) || name.contains(KD4TagPan, Qt::CaseInsensitive)) + if (ID.contains(KD4TagPan, Qt::CaseInsensitive) + || name.contains(KD4TagPan, Qt::CaseInsensitive)) return QLCChannel::Pan; - else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) || name.contains(KD4TagTilt, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagTilt, Qt::CaseInsensitive) + || name.contains(KD4TagTilt, Qt::CaseInsensitive)) return QLCChannel::Tilt; else return QLCChannel::NoGroup; break; case AvolitesD4Parser::COLOUR: - if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) + if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) + || name.contains(KD4TagCyan, Qt::CaseInsensitive)) return QLCChannel::Intensity; - else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) + || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) return QLCChannel::Intensity; - else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) + || name.contains(KD4TagYellow, Qt::CaseInsensitive)) return QLCChannel::Intensity; - else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) + || name.contains(KD4TagRed, Qt::CaseInsensitive)) return QLCChannel::Intensity; - else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) + || name.contains(KD4TagGreen, Qt::CaseInsensitive)) return QLCChannel::Intensity; - else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) + || name.contains(KD4TagBlue, Qt::CaseInsensitive)) return QLCChannel::Intensity; else return QLCChannel::Colour; @@ -264,11 +277,14 @@ QLCChannel::Group AvolitesD4Parser::getGroup(QString ID, QString name, QString g break; case AvolitesD4Parser::EFFECT: - if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) || name.contains(KD4TagPrism, Qt::CaseInsensitive)) + if (ID.contains(KD4TagPrism, Qt::CaseInsensitive) + || name.contains(KD4TagPrism, Qt::CaseInsensitive)) return QLCChannel::Prism; - else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) || name.contains(KD4TagEffect, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagEffect, Qt::CaseInsensitive) + || name.contains(KD4TagEffect, Qt::CaseInsensitive)) return QLCChannel::Effect; - else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) || name.contains(KD4TagMacro, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagMacro, Qt::CaseInsensitive) + || name.contains(KD4TagMacro, Qt::CaseInsensitive)) return QLCChannel::Effect; else return QLCChannel::NoGroup; @@ -285,15 +301,20 @@ QLCChannel::PrimaryColour AvolitesD4Parser::getColour(QString ID, QString name, if (ID.contains(KD4TagCyan, Qt::CaseInsensitive) || name.contains(KD4TagCyan, Qt::CaseInsensitive)) return QLCChannel::Cyan; - else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagMagenta, Qt::CaseInsensitive) + || name.contains(KD4TagMagenta, Qt::CaseInsensitive)) return QLCChannel::Magenta; - else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) || name.contains(KD4TagYellow, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagYellow, Qt::CaseInsensitive) + || name.contains(KD4TagYellow, Qt::CaseInsensitive)) return QLCChannel::Yellow; - else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) || name.contains(KD4TagRed, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagRed, Qt::CaseInsensitive) + || name.contains(KD4TagRed, Qt::CaseInsensitive)) return QLCChannel::Red; - else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) || name.contains(KD4TagGreen, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagGreen, Qt::CaseInsensitive) + || name.contains(KD4TagGreen, Qt::CaseInsensitive)) return QLCChannel::Green; - else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) || name.contains(KD4TagBlue, Qt::CaseInsensitive)) + else if (ID.contains(KD4TagBlue, Qt::CaseInsensitive) + || name.contains(KD4TagBlue, Qt::CaseInsensitive)) return QLCChannel::Blue; else return QLCChannel::NoColour; @@ -409,8 +430,8 @@ bool AvolitesD4Parser::parseChannel(QXmlStreamReader *doc, QLCFixtureDef *fixtur return true; } -bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCChannel *channel, QString ID, - QString group) +bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, + QLCChannel *channel, QString ID, QString group) { QXmlStreamAttributes attrs = doc->attributes(); QString name = attrs.value(KD4TagFunctionName).toString(); @@ -425,9 +446,10 @@ bool AvolitesD4Parser::parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtu if (cap != NULL) { - // We just ignore capability adding errors, because avolites often repeats attributes due to conditionals - // so we just add the first one we get, the repeating ones are ignored naturally and - // obviously further human verification is needed on the fixture definition to fix this issues + // We just ignore capability adding errors, because avolites often repeats attributes due to + // conditionals so we just add the first one we get, the repeating ones are ignored + // naturally and obviously further human verification is needed on the fixture definition to + // fix this issues channel->addCapability(cap); } @@ -538,17 +560,21 @@ bool AvolitesD4Parser::comparePhysical(const QLCPhysical &globalPhy, const QLCPh return true; if (globalPhy.bulbLumens() != modePhy.bulbLumens() - || globalPhy.bulbColourTemperature() != modePhy.bulbColourTemperature() || globalPhy.weight() != modePhy.weight() - || globalPhy.width() != modePhy.width() || globalPhy.height() != modePhy.height() - || globalPhy.depth() != modePhy.depth() || globalPhy.lensDegreesMin() != modePhy.lensDegreesMin() - || globalPhy.lensDegreesMax() != modePhy.lensDegreesMax() || globalPhy.focusPanMax() != modePhy.focusPanMax() - || globalPhy.focusTiltMax() != modePhy.focusTiltMax() || globalPhy.powerConsumption() != modePhy.powerConsumption()) + || globalPhy.bulbColourTemperature() != modePhy.bulbColourTemperature() + || globalPhy.weight() != modePhy.weight() || globalPhy.width() != modePhy.width() + || globalPhy.height() != modePhy.height() || globalPhy.depth() != modePhy.depth() + || globalPhy.lensDegreesMin() != modePhy.lensDegreesMin() + || globalPhy.lensDegreesMax() != modePhy.lensDegreesMax() + || globalPhy.focusPanMax() != modePhy.focusPanMax() + || globalPhy.focusTiltMax() != modePhy.focusTiltMax() + || globalPhy.powerConsumption() != modePhy.powerConsumption()) return false; return true; } -void AvolitesD4Parser::parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCFixtureMode *mode) +void AvolitesD4Parser::parsePhysical(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, + QLCFixtureMode *mode) { if (doc->name() != KD4TagPhysical) return; diff --git a/engine/src/avolitesd4parser.h b/engine/src/avolitesd4parser.h index f39db5e1c9..7a0c4629c6 100644 --- a/engine/src/avolitesd4parser.h +++ b/engine/src/avolitesd4parser.h @@ -95,7 +95,8 @@ class AvolitesD4Parser bool parseChannel(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef); /** Parse a Function tag defining a channel capability */ - bool parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCChannel *channel, QString ID, QString group); + bool parseFunction(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef, QLCChannel *channel, + QString ID, QString group); /** Parse the capabilities from one channel contained in $elem into $chan (must exist) */ bool parseAttribute(QXmlStreamReader *doc, QLCFixtureDef *fixtureDef); diff --git a/engine/src/channelmodifier.cpp b/engine/src/channelmodifier.cpp index 780463c681..857675924b 100644 --- a/engine/src/channelmodifier.cpp +++ b/engine/src/channelmodifier.cpp @@ -66,7 +66,8 @@ void ChannelModifier::setModifierMap(QList> map) // in a linear progression float dmxInc = 0; if (dmxPair.first - lastDMXPair.first > 0) - dmxInc = (float)(dmxPair.second - lastDMXPair.second) / (float)(dmxPair.first - lastDMXPair.first); + dmxInc = (float)(dmxPair.second - lastDMXPair.second) + / (float)(dmxPair.first - lastDMXPair.first); // use a float variable here to be as more accurate as possible float floatVal = lastDMXPair.second; @@ -82,10 +83,10 @@ void ChannelModifier::setModifierMap(QList> map) } // Enable the following to display the template full range of value /* - qDebug() << "Template:" << m_name; - for (int d = 0; d < m_values.count(); d++) - qDebug() << "Pos:" << d << "val:" << QString::number((uchar)m_values.at(d)); - */ + qDebug() << "Template:" << m_name; + for (int d = 0; d < m_values.count(); d++) + qDebug() << "Pos:" << d << "val:" << QString::number((uchar)m_values.at(d)); +*/ } QList> ChannelModifier::modifierMap() const diff --git a/engine/src/channelsgroup.cpp b/engine/src/channelsgroup.cpp index df32ac5f09..51ba5f660d 100644 --- a/engine/src/channelsgroup.cpp +++ b/engine/src/channelsgroup.cpp @@ -174,11 +174,15 @@ QString ChannelsGroup::status(Doc *doc) const QString chInfo("
"); if (mode != NULL) { - info += chInfo.arg(fixture->name()).arg(value.channel + 1).arg(mode->channels().at(value.channel)->name()); + info += chInfo.arg(fixture->name()) + .arg(value.channel + 1) + .arg(mode->channels().at(value.channel)->name()); } else { - info += chInfo.arg(fixture->name()).arg(value.channel + 1).arg(QString(tr("Channel %1")).arg(value.channel)); + info += chInfo.arg(fixture->name()) + .arg(value.channel + 1) + .arg(QString(tr("Channel %1")).arg(value.channel)); } } @@ -194,8 +198,8 @@ QString ChannelsGroup::status(Doc *doc) const void ChannelsGroup::setInputSource(QSharedPointer const &source) { if (!m_input.isNull() && m_input->isValid()) - disconnect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32, quint32, uchar)), this, - SLOT(slotInputValueChanged(quint32, quint32, uchar))); + disconnect(m_doc->inputOutputMap(), SIGNAL(inputValueChanged(quint32, quint32, uchar)), + this, SLOT(slotInputValueChanged(quint32, quint32, uchar))); m_input = source; @@ -218,9 +222,11 @@ void ChannelsGroup::slotInputValueChanged(quint32 universe, quint32 channel, uch if (m_doc->mode() == Doc::Operate) return; - // qDebug() << Q_FUNC_INFO << "universe: " << universe << ", channel: " << channel << ", value: " << value; + // qDebug() << Q_FUNC_INFO << "universe: " << universe << ", channel: " << channel << ", value: + // " << value; - if (inputSource() != NULL && inputSource()->universe() == universe && inputSource()->channel() == channel) + if (inputSource() != NULL && inputSource()->universe() == universe + && inputSource()->channel() == channel) { emit valueChanged(channel, value); } @@ -324,7 +330,8 @@ bool ChannelsGroup::loadXML(QXmlStreamReader &xmlDoc) const QLCChannel *ch = fxi->channel(scv.channel); if (ch == NULL) { - qWarning() << Q_FUNC_INFO << "Fixture" << scv.fxi << "does not have channel" << scv.channel; + qWarning() << Q_FUNC_INFO << "Fixture" << scv.fxi << "does not have channel" + << scv.channel; continue; } m_channels.append(scv); diff --git a/engine/src/chaser.cpp b/engine/src/chaser.cpp index 9431538160..d70f78afea 100644 --- a/engine/src/chaser.cpp +++ b/engine/src/chaser.cpp @@ -235,10 +235,12 @@ void Chaser::setTotalDuration(quint32 msec) uint origDuration = m_steps[i].duration; m_steps[i].duration = ((double)m_steps[i].duration * msec) / dtDuration; if (m_steps[i].hold) - m_steps[i].hold = ((double)m_steps[i].hold * (double)m_steps[i].duration) / (double)origDuration; + m_steps[i].hold = + ((double)m_steps[i].hold * (double)m_steps[i].duration) / (double)origDuration; m_steps[i].fadeIn = m_steps[i].duration - m_steps[i].hold; if (m_steps[i].fadeOut) - m_steps[i].fadeOut = ((double)m_steps[i].fadeOut * (double)m_steps[i].duration) / (double)origDuration; + m_steps[i].fadeOut = + ((double)m_steps[i].fadeOut * (double)m_steps[i].duration) / (double)origDuration; } } emit changed(this->id()); @@ -396,7 +398,8 @@ bool Chaser::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ChaserType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a Chaser"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not a Chaser"; return false; } @@ -439,10 +442,11 @@ bool Chaser::loadXML(QXmlStreamReader &root) } else if (root.name() == KXMLQLCChaserLegacySequence) { - doc()->appendToErrorLog(QString("Unsupported sequences found. Please convert your project " - "at http://www.qlcplus.org/" - "sequence_migration.php")); + doc()->appendToErrorLog( + QString("Unsupported sequences found. Please convert your project " + "at http://www.qlcplus.org/" + "sequence_migration.php")); root.skipCurrentElement(); } else diff --git a/engine/src/chaser.h b/engine/src/chaser.h index 1c534dc2ff..f5fb5cc1df 100644 --- a/engine/src/chaser.h +++ b/engine/src/chaser.h @@ -299,7 +299,8 @@ public slots: int adjustAttribute(qreal fraction, int attributeId); /** Adjust the intensities of chaser steps. */ - void adjustStepIntensity(qreal fraction, int stepIndex = -1, FadeControlMode fadeControl = FromFunction); + void adjustStepIntensity(qreal fraction, int stepIndex = -1, + FadeControlMode fadeControl = FromFunction); }; /** @} */ diff --git a/engine/src/chaserrunner.cpp b/engine/src/chaserrunner.cpp index e4ae8ed07b..dece5aa994 100644 --- a/engine/src/chaserrunner.cpp +++ b/engine/src/chaserrunner.cpp @@ -62,7 +62,8 @@ ChaserRunner::ChaserRunner(const Doc *doc, const Chaser *chaser, quint32 startTi quint32 stepsTime = 0; foreach (ChaserStep step, chaser->steps()) { - uint duration = m_chaser->durationMode() == Chaser::Common ? m_chaser->duration() : step.duration; + uint duration = + m_chaser->durationMode() == Chaser::Common ? m_chaser->duration() : step.duration; if (startTime < stepsTime + duration) { @@ -251,8 +252,9 @@ void ChaserRunner::setAction(ChaserAction &action) { qDebug() << "[ChaserRunner] Stopping step idx:" << action.m_stepIndex << "(running:" << m_runnerSteps.count() << ")"; - m_lastFunctionID = step->m_function->type() == Function::SceneType ? step->m_function->id() - : Function::invalidId(); + m_lastFunctionID = step->m_function->type() == Function::SceneType + ? step->m_function->id() + : Function::invalidId(); step->m_function->stop(functionParent()); m_runnerSteps.removeOne(step); delete step; @@ -423,7 +425,8 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i { fraction = CLAMP(fraction, qreal(0.0), qreal(1.0)); - // qDebug() << "Adjust intensity" << fraction << "step:" << requestedStepIndex << "fade:" << fadeControl; + // qDebug() << "Adjust intensity" << fraction << "step:" << requestedStepIndex << "fade:" << + // fadeControl; int stepIndex = requestedStepIndex; if (stepIndex == -1) @@ -459,7 +462,8 @@ void ChaserRunner::adjustStepIntensity(qreal fraction, int requestedStepIndex, i return; // not found ? It means we need to start a new step and crossfade kicks in ! - startNewStep(stepIndex, m_doc->masterTimer(), m_pendingAction.m_masterIntensity, fraction, fadeControl); + startNewStep(stepIndex, m_doc->masterTimer(), m_pendingAction.m_masterIntensity, fraction, + fadeControl); } /**************************************************************************** @@ -476,16 +480,17 @@ void ChaserRunner::clearRunningList() // restore the original Function fade out time step->m_function->setOverrideFadeOutSpeed(stepFadeOut(step->m_index)); step->m_function->stop(functionParent(), m_chaser->type() == Function::SequenceType); - m_lastFunctionID = - step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); + m_lastFunctionID = step->m_function->type() == Function::SceneType + ? step->m_function->id() + : Function::invalidId(); } delete step; } m_runnerSteps.clear(); } -void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, int fadeControl, - quint32 elapsed) +void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, + int fadeControl, quint32 elapsed) { if (m_chaser == NULL || m_chaser->stepsCount() == 0) return; @@ -512,7 +517,8 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, if (m_runnerSteps.count()) { ChaserRunnerStep *lastStep = m_runnerSteps.last(); - if (lastStep->m_function && lastStep->m_function->type() == Function::SceneType && func->type() == Function::SceneType) + if (lastStep->m_function && lastStep->m_function->type() == Function::SceneType + && func->type() == Function::SceneType) { Scene *lastScene = qobject_cast(lastStep->m_function); lastScene->setBlendFunctionID(Function::invalidId()); @@ -569,19 +575,22 @@ void ChaserRunner::startNewStep(int index, MasterTimer *timer, qreal mIntensity, // might momentarily jump too high. if (func->type() == Function::SceneType) { - Scene *scene = qobject_cast(func); - newStep->m_intensityOverrideId = func->requestAttributeOverride(Function::Intensity, sIntensity); - newStep->m_pIntensityOverrideId = scene->requestAttributeOverride(Scene::ParentIntensity, mIntensity); + Scene *scene = qobject_cast(func); + newStep->m_intensityOverrideId = + func->requestAttributeOverride(Function::Intensity, sIntensity); + newStep->m_pIntensityOverrideId = + scene->requestAttributeOverride(Scene::ParentIntensity, mIntensity); qDebug() << "[ChaserRunner] Set step intensity:" << sIntensity << ", master:" << mIntensity; } else { - newStep->m_intensityOverrideId = func->requestAttributeOverride(Function::Intensity, mIntensity * sIntensity); + newStep->m_intensityOverrideId = + func->requestAttributeOverride(Function::Intensity, mIntensity * sIntensity); } // Start the fire up ! - func->start(timer, functionParent(), 0, newStep->m_fadeIn, newStep->m_fadeOut, func->defaultSpeed(), - m_chaser->tempoType()); + func->start(timer, functionParent(), 0, newStep->m_fadeIn, newStep->m_fadeOut, + func->defaultSpeed(), m_chaser->tempoType()); m_runnerSteps.append(newStep); m_roundTime->restart(); } @@ -678,7 +687,8 @@ int ChaserRunner::getNextStepIndex() currentStepIndex = 0; } // Don't run the same function 2 times in a row - while (currentStepIndex < m_chaser->stepsCount() && randomStepIndex(currentStepIndex) == m_lastRunStepIdx) + while (currentStepIndex < m_chaser->stepsCount() + && randomStepIndex(currentStepIndex) == m_lastRunStepIdx) ++currentStepIndex; currentStepIndex = randomStepIndex(currentStepIndex); } @@ -747,7 +757,8 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) { clearRunningList(); m_lastRunStepIdx = m_pendingAction.m_stepIndex; - qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" << m_startOffset; + qDebug() << "[ChaserRunner] Starting from step" << m_lastRunStepIdx << "@ offset" + << m_startOffset; startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, m_pendingAction.m_stepIntensity, m_pendingAction.m_fadeMode); emit currentStepChanged(m_lastRunStepIdx); @@ -767,8 +778,8 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) if (m_chaser->tempoType() == Function::Beats && timer->isBeat()) { step->m_elapsedBeats += 1000; - qDebug() << "[ChaserRunner] Function" << step->m_function->name() << "duration:" << step->m_duration - << "beats:" << step->m_elapsedBeats; + qDebug() << "[ChaserRunner] Function" << step->m_function->name() + << "duration:" << step->m_duration << "beats:" << step->m_elapsedBeats; } if (step->m_duration != Function::infiniteSpeed() @@ -778,8 +789,9 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) if (step->m_duration != 0) prevStepRoundElapsed = step->m_elapsed % step->m_duration; - m_lastFunctionID = - step->m_function->type() == Function::SceneType ? step->m_function->id() : Function::invalidId(); + m_lastFunctionID = step->m_function->type() == Function::SceneType + ? step->m_function->id() + : Function::invalidId(); step->m_function->stop(functionParent(), m_chaser->type() == Function::SequenceType); m_runnerSteps.removeOne(step); delete step; @@ -809,10 +821,11 @@ bool ChaserRunner::write(MasterTimer *timer, QList universes) m_lastRunStepIdx = getNextStepIndex(); if (m_lastRunStepIdx != -1) { - int blend = m_pendingAction.m_action == ChaserNoAction ? Chaser::FromFunction : m_pendingAction.m_fadeMode; + int blend = m_pendingAction.m_action == ChaserNoAction ? Chaser::FromFunction + : m_pendingAction.m_fadeMode; - startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, m_pendingAction.m_stepIntensity, - blend, prevStepRoundElapsed); + startNewStep(m_lastRunStepIdx, timer, m_pendingAction.m_masterIntensity, + m_pendingAction.m_stepIntensity, blend, prevStepRoundElapsed); emit currentStepChanged(m_lastRunStepIdx); } else diff --git a/engine/src/chaserrunner.h b/engine/src/chaserrunner.h index f4f06e5fc0..ce237365f6 100644 --- a/engine/src/chaserrunner.h +++ b/engine/src/chaserrunner.h @@ -150,14 +150,14 @@ private slots: void currentStepChanged(int stepNumber); private: - Function::Direction m_direction; //! Run-time direction (reversed by ping-pong) - QList m_runnerSteps; //! Queue of the currently running steps - quint32 m_startOffset; //! Start step offset time in milliseconds - ChaserAction m_pendingAction; //! Action to be performed on steps at the next write call - int m_lastRunStepIdx; //! Index of the last step ran - quint32 m_lastFunctionID; //! ID of the last Function ran (Scene only) - QElapsedTimer *m_roundTime; //! Counts the time between steps - QVector m_order; //! Array of step indices in a randomized order + Function::Direction m_direction; //! Run-time direction (reversed by ping-pong) + QList m_runnerSteps; //! Queue of the currently running steps + quint32 m_startOffset; //! Start step offset time in milliseconds + ChaserAction m_pendingAction; //! Action to be performed on steps at the next write call + int m_lastRunStepIdx; //! Index of the last step ran + quint32 m_lastFunctionID; //! ID of the last Function ran (Scene only) + QElapsedTimer *m_roundTime; //! Counts the time between steps + QVector m_order; //! Array of step indices in a randomized order /************************************************************************ * Intensity @@ -186,8 +186,8 @@ private slots: * - Chaser::LinkedCrossfade is like Crossfade, and the Function will also be requested * to use the Universe::AdditiveBlend mode */ - void startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, int fadeControl, - quint32 elapsed = 0); + void startNewStep(int index, MasterTimer *timer, qreal mIntensity, qreal sIntensity, + int fadeControl, quint32 elapsed = 0); /** * Get the index of the next step that should be started, diff --git a/engine/src/chaserstep.cpp b/engine/src/chaserstep.cpp index 2ea4dca970..033e330521 100644 --- a/engine/src/chaserstep.cpp +++ b/engine/src/chaserstep.cpp @@ -220,7 +220,8 @@ bool ChaserStep::loadXML(QXmlStreamReader &root, int &stepNumber, Doc *doc) for (int i = 0; i < varray.count(); i += 2) { quint32 chIndex = QString(varray.at(i)).toUInt(); - SceneValue scv = SceneValue(fxID, chIndex, uchar(QString(varray.at(i + 1)).toInt())); + SceneValue scv = + SceneValue(fxID, chIndex, uchar(QString(varray.at(i + 1)).toInt())); while (sIdx < values.count()) { diff --git a/engine/src/chaserstep.h b/engine/src/chaserstep.h index 4be4c655b5..a3c130344a 100644 --- a/engine/src/chaserstep.h +++ b/engine/src/chaserstep.h @@ -43,7 +43,8 @@ class ChaserStep ***********************************************************************/ public: /** Construct a new ChaserStep with the given attributes */ - ChaserStep(quint32 aFid = Function::invalidId(), uint aFadeIn = 0, uint aHold = 0, uint aFadeOut = 0); + ChaserStep(quint32 aFid = Function::invalidId(), uint aFadeIn = 0, uint aHold = 0, + uint aFadeOut = 0); /** Copy constructor */ ChaserStep(const ChaserStep &cs); diff --git a/engine/src/collection.cpp b/engine/src/collection.cpp index 4732bddc63..6adc2fe59d 100644 --- a/engine/src/collection.cpp +++ b/engine/src/collection.cpp @@ -208,7 +208,8 @@ bool Collection::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::CollectionType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a collection"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not a collection"; return false; } @@ -292,8 +293,8 @@ void Collection::preRun(MasterTimer *timer) Function *function = doc->function(fid); Q_ASSERT(function != NULL); - m_intensityOverrideIds << function->requestAttributeOverride(Function::Intensity, - getAttributeValue(Function::Intensity)); + m_intensityOverrideIds << function->requestAttributeOverride( + Function::Intensity, getAttributeValue(Function::Intensity)); // Append the IDs of all functions started by this collection // to a set so that we can track which of them are still controlled @@ -309,7 +310,8 @@ void Collection::preRun(MasterTimer *timer) connect(function, SIGNAL(running(quint32)), this, SLOT(slotChildStarted(quint32))); // function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity); - function->start(timer, functionParent(), 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration()); + function->start(timer, functionParent(), 0, overrideFadeInSpeed(), + overrideFadeOutSpeed(), overrideDuration()); } m_tick = 1; } @@ -433,7 +435,8 @@ int Collection::adjustAttribute(qreal fraction, int attributeId) { Function *function = document->function(m_functions.at(i)); Q_ASSERT(function != NULL); - function->adjustAttribute(getAttributeValue(Function::Intensity), m_intensityOverrideIds.at(i)); + function->adjustAttribute(getAttributeValue(Function::Intensity), + m_intensityOverrideIds.at(i)); } } diff --git a/engine/src/cuestack.cpp b/engine/src/cuestack.cpp index e0c6fe56c1..59ab67aaad 100644 --- a/engine/src/cuestack.cpp +++ b/engine/src/cuestack.cpp @@ -454,7 +454,8 @@ void CueStack::writeDMX(MasterTimer *timer, QList ua) if (universe == Universe::invalid()) continue; - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (fader.isNull()) { fader = ua[universe]->requestFader(); @@ -527,14 +528,14 @@ void CueStack::write(QList ua) emit currentCueChanged(m_currentIndex); } /* - else if (m_elapsed >= duration()) - { - // Duration expired - m_elapsed = 0; - switchCue(next(), ua); - emit currentCueChanged(m_currentIndex); - } - */ + else if (m_elapsed >= duration()) + { + // Duration expired + m_elapsed = 0; + switchCue(next(), ua); + emit currentCueChanged(m_currentIndex); + } +*/ // m_fader->write(ua); m_elapsed += MasterTimer::tick(); @@ -594,7 +595,8 @@ int CueStack::previous() return m_currentIndex; } -FadeChannel *CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) +FadeChannel *CueStack::getFader(QList universes, quint32 universeID, quint32 fixtureID, + quint32 channel) { // get the universe Fader first. If doesn't exist, create it QSharedPointer fader = m_fadersMap.value(universeID, QSharedPointer()); diff --git a/engine/src/cuestack.h b/engine/src/cuestack.h index e0b7e76870..a3b19e60e8 100644 --- a/engine/src/cuestack.h +++ b/engine/src/cuestack.h @@ -250,7 +250,8 @@ class CueStack : public QObject, public DMXSource private: int next(); int previous(); - FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); + FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, + quint32 channel); void updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime); void switchCue(int from, int to, const QList ua); diff --git a/engine/src/doc.cpp b/engine/src/doc.cpp index d4a6c757d1..dc20283681 100644 --- a/engine/src/doc.cpp +++ b/engine/src/doc.cpp @@ -353,7 +353,8 @@ void Doc::setMode(Doc::Mode mode) } else { - qWarning() << Q_FUNC_INFO << "Startup function does not exist, erasing. (" << m_startupFunctionId << ")"; + qWarning() << Q_FUNC_INFO << "Startup function does not exist, erasing. (" + << m_startupFunctionId << ")"; m_startupFunctionId = Function::invalidId(); } } @@ -424,8 +425,8 @@ bool Doc::addFixture(Fixture *fixture, quint32 id) { if (m_addresses.contains(i)) { - qWarning() << Q_FUNC_INFO << "fixture" << id << "overlapping with fixture" << m_addresses[i] << "@ channel" - << i; + qWarning() << Q_FUNC_INFO << "fixture" << id << "overlapping with fixture" + << m_addresses[i] << "@ channel" << i; return false; } } @@ -565,8 +566,8 @@ bool Doc::replaceFixtures(QList newFixturesList) } else { - QLCFixtureDef *def = - fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(), fixture->fixtureDef()->model()); + QLCFixtureDef *def = fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(), + fixture->fixtureDef()->model()); QLCFixtureMode *mode = NULL; if (def != NULL) mode = def->mode(fixture->fixtureMode()->name()); @@ -584,7 +585,8 @@ bool Doc::replaceFixtures(QList newFixturesList) connect(newFixture, SIGNAL(changed(quint32)), this, SLOT(slotFixtureChanged(quint32))); /* Keep track of fixture addresses */ - for (uint i = newFixture->universeAddress(); i < newFixture->universeAddress() + newFixture->channels(); i++) + for (uint i = newFixture->universeAddress(); + i < newFixture->universeAddress() + newFixture->channels(); i++) { m_addresses[i] = id; } @@ -796,7 +798,8 @@ quint32 Doc::createFixtureGroupId() /* This results in an endless loop if there are UINT_MAX-1 fixture groups. That, however, seems a bit unlikely. Are there even 4294967295-1 fixtures in total in the whole world? */ - while (m_fixtureGroups.contains(m_latestFixtureGroupId) == true || m_latestFixtureGroupId == FixtureGroup::invalidId()) + while (m_fixtureGroups.contains(m_latestFixtureGroupId) == true + || m_latestFixtureGroupId == FixtureGroup::invalidId()) { m_latestFixtureGroupId++; } @@ -969,7 +972,8 @@ QList Doc::palettes() const quint32 Doc::createPaletteId() { - while (m_palettes.contains(m_latestPaletteId) == true || m_latestPaletteId == FixtureGroup::invalidId()) + while (m_palettes.contains(m_latestPaletteId) == true + || m_latestPaletteId == FixtureGroup::invalidId()) { m_latestPaletteId++; } @@ -986,7 +990,8 @@ quint32 Doc::createFunctionId() /* This results in an endless loop if there are UINT_MAX-1 functions. That, however, seems a bit unlikely. Are there even 4294967295-1 functions in total in the whole world? */ - while (m_functions.contains(m_latestFunctionId) == true || m_latestFunctionId == Fixture::invalidId()) + while (m_functions.contains(m_latestFunctionId) == true + || m_latestFunctionId == Fixture::invalidId()) { m_latestFunctionId++; } diff --git a/engine/src/efx.cpp b/engine/src/efx.cpp index 00f6bfa257..ce062ffdbc 100644 --- a/engine/src/efx.cpp +++ b/engine/src/efx.cpp @@ -274,7 +274,8 @@ void EFX::preview(QPolygonF &polygon, Function::Direction direction, int startOf } } -void EFX::calculatePoint(Function::Direction direction, int startOffset, float iterator, float *x, float *y) const +void EFX::calculatePoint(Function::Direction direction, int startOffset, float iterator, float *x, + float *y) const { iterator = calculateDirection(direction, iterator); iterator += convertOffset(startOffset + getAttributeValue(StartOffset)); diff --git a/engine/src/efx.h b/engine/src/efx.h index c6a6ec739c..cbe9d72d5a 100644 --- a/engine/src/efx.h +++ b/engine/src/efx.h @@ -181,7 +181,8 @@ class EFX : public Function * @param x Used to store the calculated X coordinate (output) * @param y Used to store the calculated Y coordinate (output) */ - void calculatePoint(Function::Direction direction, int startOffset, float iterator, float *x, float *y) const; + void calculatePoint(Function::Direction direction, int startOffset, float iterator, float *x, + float *y) const; private: void preview(QPolygonF &polygon, Function::Direction direction, int startOffset) const; diff --git a/engine/src/efxfixture.cpp b/engine/src/efxfixture.cpp index 8e2c19628c..4422d3dcba 100644 --- a/engine/src/efxfixture.cpp +++ b/engine/src/efxfixture.cpp @@ -101,7 +101,8 @@ void EFXFixture::setHead(GroupHead const &head) modes << PanTilt; if (fxi->masterIntensityChannel() != QLCChannel::invalid() - || fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head.head) != QLCChannel::invalid()) + || fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head.head) + != QLCChannel::invalid()) modes << Dimmer; if (fxi->rgbChannels(head.head).size() >= 3) @@ -163,12 +164,15 @@ bool EFXFixture::isValid() const return false; else if (head().head >= fxi->heads()) return false; - else if (m_mode == PanTilt && fxi->channelNumber(QLCChannel::Pan, QLCChannel::MSB, head().head) == QLCChannel::invalid() + else if (m_mode == PanTilt + && fxi->channelNumber(QLCChannel::Pan, QLCChannel::MSB, head().head) == QLCChannel::invalid() && // Maybe a device can pan OR tilt - fxi->channelNumber(QLCChannel::Tilt, QLCChannel::MSB, head().head) == QLCChannel::invalid()) // but not both + fxi->channelNumber(QLCChannel::Tilt, QLCChannel::MSB, head().head) + == QLCChannel::invalid()) // but not both return false; else if (m_mode == Dimmer && fxi->masterIntensityChannel() == QLCChannel::invalid() - && fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head().head) == QLCChannel::invalid()) + && fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head().head) + == QLCChannel::invalid()) return false; else if (m_mode == RGB && fxi->rgbChannels(head().head).size() == 0) return false; @@ -181,7 +185,8 @@ void EFXFixture::durationChanged() // To avoid jumps when changing duration, // the elapsed time is rescaled to the // new duration. - m_elapsed = SCALE(float(m_currentAngle), float(0), float(M_PI * 2), float(0), float(m_parent->loopDuration())); + m_elapsed = SCALE(float(m_currentAngle), float(0), float(M_PI * 2), float(0), + float(m_parent->loopDuration())); // Serial or Asymmetric propagation mode: // we must substract the offset from the current position @@ -205,7 +210,8 @@ QStringList EFXFixture::modeList() modes << KXMLQLCEFXFixtureModePanTilt; if (fxi->masterIntensityChannel() != QLCChannel::invalid() - || fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head().head) != QLCChannel::invalid()) + || fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head().head) + != QLCChannel::invalid()) modes << KXMLQLCEFXFixtureModeDimmer; if (fxi->rgbChannels(head().head).size() >= 3) @@ -429,8 +435,9 @@ void EFXFixture::nextStep(QList universes, QSharedPointerloopDuration(); - m_currentAngle = SCALE(float(pos), float(0), float(m_parent->loopDuration()), float(0), float(M_PI * 2)); + uint pos = (m_elapsed + timeOffset()) % m_parent->loopDuration(); + m_currentAngle = + SCALE(float(pos), float(0), float(m_parent->loopDuration()), float(0), float(M_PI * 2)); float valX = 0; float valY = 0; @@ -464,7 +471,8 @@ void EFXFixture::updateFaderValues(FadeChannel *fc, uchar value) fc->setFadeTime(0); } -void EFXFixture::setPointPanTilt(QList universes, QSharedPointer fader, float pan, float tilt) +void EFXFixture::setPointPanTilt(QList universes, QSharedPointer fader, + float pan, float tilt) { Fixture *fxi = doc()->fixture(head().fxi); Q_ASSERT(fxi != NULL); @@ -511,7 +519,8 @@ void EFXFixture::setPointPanTilt(QList universes, QSharedPointer universes, QSharedPointer fader, float dimmer) +void EFXFixture::setPointDimmer(QList universes, QSharedPointer fader, + float dimmer) { Fixture *fxi = doc()->fixture(head().fxi); Q_ASSERT(fxi != NULL); @@ -519,7 +528,8 @@ void EFXFixture::setPointDimmer(QList universes, QSharedPointerchannelNumber(QLCChannel::Intensity, QLCChannel::MSB, head().head); - /* Don't write dimmer data directly to universes but use FadeChannel to avoid steps at EFX loop restart */ + /* Don't write dimmer data directly to universes but use FadeChannel to avoid steps at EFX loop + * restart */ if (intChannel != QLCChannel::invalid()) { if (!fader.isNull()) @@ -532,13 +542,15 @@ void EFXFixture::setPointDimmer(QList universes, QSharedPointergetChannelFader(doc(), uni, fxi->id(), fxi->masterIntensityChannel()); + FadeChannel *fc = + fader->getChannelFader(doc(), uni, fxi->id(), fxi->masterIntensityChannel()); updateFaderValues(fc, dimmer); } } } -void EFXFixture::setPointRGB(QList universes, QSharedPointer fader, float x, float y) +void EFXFixture::setPointRGB(QList universes, QSharedPointer fader, + float x, float y) { Fixture *fxi = doc()->fixture(head().fxi); Q_ASSERT(fxi != NULL); @@ -546,7 +558,8 @@ void EFXFixture::setPointRGB(QList universes, QSharedPointer rgbChannels = fxi->rgbChannels(head().head); - /* Don't write dimmer data directly to universes but use FadeChannel to avoid steps at EFX loop restart */ + /* Don't write dimmer data directly to universes but use FadeChannel to avoid steps at EFX loop + * restart */ if (rgbChannels.size() >= 3 && !fader.isNull()) { QColor pixel = m_rgbGradient.pixel(x, y); diff --git a/engine/src/efxfixture.h b/engine/src/efxfixture.h index cdbcb13c3d..a70607c9a5 100644 --- a/engine/src/efxfixture.h +++ b/engine/src/efxfixture.h @@ -181,7 +181,8 @@ class EFXFixture /** Elapsed milliseconds since last reset() */ uint m_elapsed; - /** 0..M_PI*2, current position, recomputed on each timer tick; depends on elapsed() and parent->duration() */ + /** 0..M_PI*2, current position, recomputed on each timer tick; depends on elapsed() and + * parent->duration() */ float m_currentAngle; /************************************************************************* @@ -197,7 +198,8 @@ class EFXFixture void updateFaderValues(FadeChannel *fc, uchar value); /** Write this EFXFixture's channel data to universe faders */ - void setPointPanTilt(QList universes, QSharedPointer fader, float pan, float tilt); + void setPointPanTilt(QList universes, QSharedPointer fader, float pan, + float tilt); void setPointDimmer(QList universes, QSharedPointer fader, float dimmer); void setPointRGB(QList universes, QSharedPointer fader, float x, float y); diff --git a/engine/src/fadechannel.cpp b/engine/src/fadechannel.cpp index ce7dec0cdb..ed0b93e071 100644 --- a/engine/src/fadechannel.cpp +++ b/engine/src/fadechannel.cpp @@ -319,8 +319,9 @@ uchar FadeChannel::calculateCurrent(uint fadeTime, uint elapsedTime) { // 16 bit fading works as long as MSB and LSB channels // are targeting the same value. E.g. Red and Red Fine both at 158 - float val = (float(m_target - m_start) * (float(elapsedTime) / float(fadeTime))) + float(m_start); - long rval = lrintf(val * 256); + float val = + (float(m_target - m_start) * (float(elapsedTime) / float(fadeTime))) + float(m_start); + long rval = lrintf(val * 256); if (m_flags & Fine) m_current = rval & 0xff; else diff --git a/engine/src/fixture.cpp b/engine/src/fixture.cpp index 6a58f1ffcc..8ff81f5ac2 100644 --- a/engine/src/fixture.cpp +++ b/engine/src/fixture.cpp @@ -414,7 +414,8 @@ QList Fixture::zoomToValues(float degrees, bool isRelative) float deltaDegrees = phy.lensDegreesMax() - phy.lensDegreesMin(); // delta : 0xFFFF = deg : x - quint16 degToDmx = ((degrees - (isRelative ? 0 : float(phy.lensDegreesMin()))) * 65535.0) / deltaDegrees; + quint16 degToDmx = + ((degrees - (isRelative ? 0 : float(phy.lensDegreesMin()))) * 65535.0) / deltaDegrees; // qDebug() << "Degrees" << degrees << "DMX" << QString::number(degToDmx, 16); for (quint32 i = 0; i < quint32(m_fixtureMode->channels().size()); i++) @@ -433,7 +434,8 @@ QList Fixture::zoomToValues(float degrees, bool isRelative) // degrees is a relative value upon the current value. // Recalculate absolute degrees here qreal divider = ch->controlByte() == QLCChannel::MSB ? 256.0 : 65536.0; - float chDegrees = float((phy.lensDegreesMax() - phy.lensDegreesMin()) / divider) * float(channelValueAt(i)); + float chDegrees = float((phy.lensDegreesMax() - phy.lensDegreesMin()) / divider) + * float(channelValueAt(i)); // qDebug() << "Relative channel degrees:" << chDegrees << "MSB?" << ch->controlByte(); @@ -644,7 +646,8 @@ void Fixture::setFixtureDefinition(QLCFixtureDef *fixtureDef, QLCFixtureMode *fi { int i, chNum; - if (m_fixtureDef != NULL && m_fixtureDef != fixtureDef && m_fixtureDef->manufacturer() == KXMLFixtureGeneric + if (m_fixtureDef != NULL && m_fixtureDef != fixtureDef + && m_fixtureDef->manufacturer() == KXMLFixtureGeneric && m_fixtureDef->model() == KXMLFixtureGeneric) { delete m_fixtureDef; @@ -918,7 +921,8 @@ QLCFixtureDef *Fixture::genericRGBPanelDef(int columns, Components components) return def; } -QLCFixtureMode *Fixture::genericRGBPanelMode(QLCFixtureDef *def, Components components, quint32 width, quint32 height) +QLCFixtureMode *Fixture::genericRGBPanelMode(QLCFixtureDef *def, Components components, + quint32 width, quint32 height) { Q_ASSERT(def != NULL); QLCFixtureMode *mode = new QLCFixtureMode(def); @@ -1096,7 +1100,8 @@ bool Fixture::loadXML(QXmlStreamReader &xmlDoc, Doc *doc, QLCFixtureDefCache *fi else if (xmlDoc.name() == KXMLFixtureChannelModifier) { QXmlStreamAttributes attrs = xmlDoc.attributes(); - if (attrs.hasAttribute(KXMLFixtureChannelIndex) && attrs.hasAttribute(KXMLFixtureModifierName)) + if (attrs.hasAttribute(KXMLFixtureChannelIndex) + && attrs.hasAttribute(KXMLFixtureModifierName)) { quint32 chIdx = attrs.value(KXMLFixtureChannelIndex).toString().toUInt(); QString modName = attrs.value(KXMLFixtureModifierName).toString(); @@ -1140,8 +1145,9 @@ bool Fixture::loadXML(QXmlStreamReader &xmlDoc, Doc *doc, QLCFixtureDefCache *fi fixtureDef = fixtureDefCache->fixtureDef(manufacturer, model); if (fixtureDef == NULL) { - doc->appendToErrorLog( - QString("No fixture definition found for %1 %2").arg(manufacturer).arg(model)); + doc->appendToErrorLog(QString("No fixture definition found for %1 %2") + .arg(manufacturer) + .arg(model)); } } @@ -1152,7 +1158,10 @@ bool Fixture::loadXML(QXmlStreamReader &xmlDoc, Doc *doc, QLCFixtureDefCache *fi if (fixtureMode == NULL) { doc->appendToErrorLog( - QString("Fixture mode %1 not found for %2 %3").arg(modeName).arg(manufacturer).arg(model)); + QString("Fixture mode %1 not found for %2 %3") + .arg(modeName) + .arg(manufacturer) + .arg(model)); /* Set this also NULL so that a generic dimmer will be created instead as a backup. */ @@ -1164,8 +1173,9 @@ bool Fixture::loadXML(QXmlStreamReader &xmlDoc, Doc *doc, QLCFixtureDefCache *fi /* Number of channels */ if (channels <= 0) { - doc->appendToErrorLog( - QString("%1 channels of fixture %2 are our of bounds").arg(QString::number(channels)).arg(name)); + doc->appendToErrorLog(QString("%1 channels of fixture %2 are our of bounds") + .arg(QString::number(channels)) + .arg(name)); channels = 1; } @@ -1266,9 +1276,11 @@ bool Fixture::saveXML(QXmlStreamWriter *doc) const /* RGB Panel physical dimensions */ if (m_fixtureDef != NULL && m_fixtureDef->model() == KXMLFixtureRGBPanel && m_fixtureMode != NULL) { - doc->writeTextElement(KXMLQLCPhysicalDimensionsWeight, QString::number(m_fixtureMode->physical().width())); + doc->writeTextElement(KXMLQLCPhysicalDimensionsWeight, + QString::number(m_fixtureMode->physical().width())); - doc->writeTextElement(KXMLQLCPhysicalDimensionsHeight, QString::number(m_fixtureMode->physical().height())); + doc->writeTextElement(KXMLQLCPhysicalDimensionsHeight, + QString::number(m_fixtureMode->physical().height())); } /* ID */ @@ -1437,10 +1449,15 @@ QString Fixture::status() const QString mm("%1mm (%2\")"); QString kg("%1kg (%2 lbs)"); QString W("%1W"); - info += genInfo.arg(tr("Width")).arg(mm.arg(physical.width())).arg(physical.width() * mmInch, 0, 'g', 4); - info += genInfo.arg(tr("Height")).arg(mm.arg(physical.height())).arg(physical.height() * mmInch, 0, 'g', 4); - info += genInfo.arg(tr("Depth")).arg(mm.arg(physical.depth())).arg(physical.depth() * mmInch, 0, 'g', 4); - info += genInfo.arg(tr("Weight")).arg(kg.arg(physical.weight())).arg(physical.weight() * kgLbs, 0, 'g', 4); + info += + genInfo.arg(tr("Width")).arg(mm.arg(physical.width())).arg(physical.width() * mmInch, 0, 'g', 4); + info += genInfo.arg(tr("Height")) + .arg(mm.arg(physical.height())) + .arg(physical.height() * mmInch, 0, 'g', 4); + info += + genInfo.arg(tr("Depth")).arg(mm.arg(physical.depth())).arg(physical.depth() * mmInch, 0, 'g', 4); + info += + genInfo.arg(tr("Weight")).arg(kg.arg(physical.weight())).arg(physical.weight() * kgLbs, 0, 'g', 4); info += genInfo.arg(tr("Power consumption")).arg(W.arg(physical.powerConsumption())); info += genInfo.arg(tr("DMX Connector")).arg(physical.dmxConnector()); @@ -1465,8 +1482,8 @@ QString Fixture::status() const } else { - info += - genInfo.arg(tr("Beam Angle")).arg(angle2.arg(physical.lensDegreesMin()).arg(physical.lensDegreesMax())); + info += genInfo.arg(tr("Beam Angle")) + .arg(angle2.arg(physical.lensDegreesMin()).arg(physical.lensDegreesMax())); } // Focus @@ -1478,7 +1495,9 @@ QString Fixture::status() const if (physical.layoutSize() != QSize(1, 1)) { info += genInfo.arg(tr("Layout")) - .arg(QString("%1 x %2").arg(physical.layoutSize().width()).arg(physical.layoutSize().height())); + .arg(QString("%1 x %2") + .arg(physical.layoutSize().width()) + .arg(physical.layoutSize().height())); } } diff --git a/engine/src/fixture.h b/engine/src/fixture.h index ec0a63fe09..1c39a98540 100644 --- a/engine/src/fixture.h +++ b/engine/src/fixture.h @@ -258,7 +258,8 @@ class Fixture : public QObject * @param color Primary color to search for * @return A QSet containing the matching channel numbers */ - QSet channels(QLCChannel::Group group, QLCChannel::PrimaryColour color = QLCChannel::NoColour) const; + QSet channels(QLCChannel::Group group, + QLCChannel::PrimaryColour color = QLCChannel::NoColour) const; /** @see QLCFixtureHead */ quint32 channelNumber(int type, int controlByte, int head = 0) const; @@ -456,7 +457,8 @@ class Fixture : public QObject QLCFixtureDef *genericRGBPanelDef(int columns, Components components); /** Creates and returns a fixture mode for a generic RGB panel row */ - QLCFixtureMode *genericRGBPanelMode(QLCFixtureDef *def, Components components, quint32 width, quint32 height); + QLCFixtureMode *genericRGBPanelMode(QLCFixtureDef *def, Components components, quint32 width, + quint32 height); /********************************************************************* * Load & Save diff --git a/engine/src/fixturegroup.cpp b/engine/src/fixturegroup.cpp index 025ff5b50c..9cd172825b 100644 --- a/engine/src/fixturegroup.cpp +++ b/engine/src/fixturegroup.cpp @@ -310,7 +310,8 @@ bool FixtureGroup::loadXML(QXmlStreamReader &xmlDoc) quint32 id = xmlDoc.attributes().value(KXMLQLCFixtureGroupID).toString().toUInt(&ok); if (ok == false) { - qWarning() << "Invalid FixtureGroup ID:" << xmlDoc.attributes().value(KXMLQLCFixtureGroupID).toString(); + qWarning() << "Invalid FixtureGroup ID:" + << xmlDoc.attributes().value(KXMLQLCFixtureGroupID).toString(); return false; } diff --git a/engine/src/function.cpp b/engine/src/function.cpp index 1796f92585..e0d26878b5 100644 --- a/engine/src/function.cpp +++ b/engine/src/function.cpp @@ -509,7 +509,8 @@ void Function::setTempoType(const Function::TempoType &type) setFadeInSpeed(beatsToTime(fadeInSpeed(), beatTime)); setDuration(beatsToTime(duration(), beatTime)); setFadeOutSpeed(beatsToTime(fadeOutSpeed(), beatTime)); - disconnect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, SLOT(slotBPMChanged(int))); + disconnect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, + SLOT(slotBPMChanged(int))); break; /* Time -> Beats */ @@ -517,7 +518,8 @@ void Function::setTempoType(const Function::TempoType &type) setFadeInSpeed(timeToBeats(fadeInSpeed(), beatTime)); setDuration(timeToBeats(duration(), beatTime)); setFadeOutSpeed(timeToBeats(fadeOutSpeed(), beatTime)); - connect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, SLOT(slotBPMChanged(int))); + connect(doc()->masterTimer(), SIGNAL(bpmNumberChanged(int)), this, + SLOT(slotBPMChanged(int))); break; default: qDebug() << "Error. Unhandled tempo type" << type; @@ -1101,8 +1103,8 @@ void Function::roundElapsed(quint32 roundTime) void Function::start(MasterTimer *timer, FunctionParent source, quint32 startTime, uint overrideFadeIn, uint overrideFadeOut, uint overrideDuration, TempoType overrideTempoType) { - qDebug() << "Function start(). Name:" << m_name << "ID: " << m_id << "source:" << source.type() << source.id() - << ", startTime:" << startTime; + qDebug() << "Function start(). Name:" << m_name << "ID: " << m_id << "source:" << source.type() + << source.id() << ", startTime:" << startTime; Q_ASSERT(timer != NULL); @@ -1144,11 +1146,13 @@ void Function::setPause(bool enable) void Function::stop(FunctionParent source, bool preserveAttributes) { - qDebug() << "Function stop(). Name:" << m_name << "ID: " << m_id << "source:" << source.type() << source.id(); + qDebug() << "Function stop(). Name:" << m_name << "ID: " << m_id << "source:" << source.type() + << source.id(); QMutexLocker sourcesLocker(&m_sourcesMutex); - if ((source.id() == id() && source.type() == FunctionParent::Function) || (source.type() == FunctionParent::Master) + if ((source.id() == id() && source.type() == FunctionParent::Function) + || (source.type() == FunctionParent::Master) || (source.type() == FunctionParent::ManualVCWidget)) { m_sources.clear(); @@ -1268,8 +1272,8 @@ int Function::requestAttributeOverride(int attributeIndex, qreal value) attributeID = m_lastOverrideAttributeId; m_overrideMap[attributeID] = override; - qDebug() << name() << "Override requested for attribute" << attributeIndex << "value" << value << "new ID" - << attributeID; + qDebug() << name() << "Override requested for attribute" << attributeIndex << "value" + << value << "new ID" << attributeID; calculateOverrideValue(attributeIndex); @@ -1277,8 +1281,8 @@ int Function::requestAttributeOverride(int attributeIndex, qreal value) } else { - qDebug() << name() << "Override requested for attribute" << attributeIndex << "value" << value << "single ID" - << attributeID; + qDebug() << name() << "Override requested for attribute" << attributeIndex << "value" + << value << "single ID" << attributeID; } // actually apply the new override value @@ -1338,8 +1342,9 @@ int Function::adjustAttribute(qreal value, int attributeId) return -1; // Adjust the original value of an attribute. Only Function editors should do this ! - m_attributes[attributeId].m_value = CLAMP(value, m_attributes[attributeId].m_min, m_attributes[attributeId].m_max); - attrIndex = attributeId; + m_attributes[attributeId].m_value = + CLAMP(value, m_attributes[attributeId].m_min, m_attributes[attributeId].m_max); + attrIndex = attributeId; } else { @@ -1352,8 +1357,9 @@ int Function::adjustAttribute(qreal value, int attributeId) calculateOverrideValue(attrIndex); } - emit attributeChanged(attrIndex, m_attributes[attrIndex].m_isOverridden ? m_attributes[attrIndex].m_overrideValue - : m_attributes[attrIndex].m_value); + emit attributeChanged(attrIndex, m_attributes[attrIndex].m_isOverridden + ? m_attributes[attrIndex].m_overrideValue + : m_attributes[attrIndex].m_value); return attrIndex; } diff --git a/engine/src/function.h b/engine/src/function.h index f30ec40e41..5bdd257c5d 100644 --- a/engine/src/function.h +++ b/engine/src/function.h @@ -799,9 +799,9 @@ public slots: * @param overrideDuration Override the function's default duration * @param overrideTempoType Override the tempo type of the function */ - void start(MasterTimer *timer, FunctionParent parent, quint32 startTime = 0, uint overrideFadeIn = defaultSpeed(), - uint overrideFadeOut = defaultSpeed(), uint overrideDuration = defaultSpeed(), - TempoType overrideTempoType = Original); + void start(MasterTimer *timer, FunctionParent parent, quint32 startTime = 0, + uint overrideFadeIn = defaultSpeed(), uint overrideFadeOut = defaultSpeed(), + uint overrideDuration = defaultSpeed(), TempoType overrideTempoType = Original); /** * Pause a running Function. Subclasses should check the paused state @@ -877,8 +877,10 @@ public slots: public: enum OverrideFlags { - Multiply = (1 << 0), /** The original attribute value should be multiplied by the overridden values */ - LastWins = (1 << 1), /** The original attribute value is overridden by the last requested override value */ + Multiply = (1 << 0), /** The original attribute value should be multiplied by the overridden + values */ + LastWins = (1 << 1), /** The original attribute value is overridden by the last requested + override value */ Single = (1 << 2) /** Only one attribute override ID will be allowed */ }; @@ -893,7 +895,8 @@ public slots: * @param max The attribute maximum value * @param value The attribute initial value */ - int registerAttribute(QString name, int flags = Multiply, qreal min = 0.0, qreal max = 1.0, qreal value = 1.0); + int registerAttribute(QString name, int flags = Multiply, qreal min = 0.0, qreal max = 1.0, + qreal value = 1.0); /** * Request a new attribute override ID. A Function will always return a new ID, diff --git a/engine/src/genericdmxsource.cpp b/engine/src/genericdmxsource.cpp index 4c4256a18e..54ccd41086 100644 --- a/engine/src/genericdmxsource.cpp +++ b/engine/src/genericdmxsource.cpp @@ -118,14 +118,16 @@ void GenericDMXSource::writeDMX(MasterTimer *timer, QList ua) continue; quint32 universe = fixture->universe(); - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (fader.isNull()) { fader = ua[universe]->requestFader(); m_fadersMap[universe] = fader; } - FadeChannel *fc = fader->getChannelFader(m_doc, ua[universe], fixture->id(), it.key().second); + FadeChannel *fc = + fader->getChannelFader(m_doc, ua[universe], fixture->id(), it.key().second); fc->setCurrent(it.value()); fc->setTarget(it.value()); } diff --git a/engine/src/genericfader.cpp b/engine/src/genericfader.cpp index 50d8346b91..53b7c39ab6 100644 --- a/engine/src/genericfader.cpp +++ b/engine/src/genericfader.cpp @@ -125,7 +125,8 @@ void GenericFader::requestDelete() m_deleteRequest = true; } -FadeChannel *GenericFader::getChannelFader(const Doc *doc, Universe *universe, quint32 fixtureID, quint32 channel) +FadeChannel *GenericFader::getChannelFader(const Doc *doc, Universe *universe, quint32 fixtureID, + quint32 channel) { FadeChannel fc(doc, fixtureID, channel); quint32 hash = channelHash(fc.fixture(), fc.channel()); @@ -184,7 +185,8 @@ void GenericFader::write(Universe *universe) if ((flags & FadeChannel::CrossFade) && fc.fadeTime() == 0) { // morph start <-> target depending on intensities - value = uchar(((qreal(fc.target() - fc.start()) * intensity()) + fc.start()) * parentIntensity()); + value = uchar(((qreal(fc.target() - fc.start()) * intensity()) + fc.start()) + * parentIntensity()); } else if (flags & FadeChannel::Intensity) { @@ -208,7 +210,8 @@ void GenericFader::write(Universe *universe) universe->writeBlended(address, value, m_blendMode); } - if (((flags & FadeChannel::Intensity) && (flags & FadeChannel::HTP) && m_blendMode == Universe::NormalBlend) + if (((flags & FadeChannel::Intensity) && (flags & FadeChannel::HTP) + && m_blendMode == Universe::NormalBlend) || m_fadeOut) { // Remove all channels that reach their target _zero_ value. diff --git a/engine/src/grandmaster.cpp b/engine/src/grandmaster.cpp index 9c8143fb69..a8d6cbfdeb 100644 --- a/engine/src/grandmaster.cpp +++ b/engine/src/grandmaster.cpp @@ -122,17 +122,17 @@ void GrandMaster::setChannelMode(GrandMaster::ChannelMode mode) setValue(value()); } /* - if (gMChannelMode() == GMIntensity) + if (gMChannelMode() == GMIntensity) + { + QSetIterator it(m_gMNonIntensityChannels); + while (it.hasNext() == true) { - QSetIterator it(m_gMNonIntensityChannels); - while (it.hasNext() == true) - { - int channel(it.next()); - char chValue(m_preGMValues->data()[channel]); - write(channel, chValue, QLCChannel::NoGroup); - } + int channel(it.next()); + char chValue(m_preGMValues->data()[channel]); + write(channel, chValue, QLCChannel::NoGroup); } - */ + } +*/ } GrandMaster::ChannelMode GrandMaster::channelMode() const diff --git a/engine/src/inputoutputmap.cpp b/engine/src/inputoutputmap.cpp index 42cda6ebb7..24e2f06ca5 100644 --- a/engine/src/inputoutputmap.cpp +++ b/engine/src/inputoutputmap.cpp @@ -147,12 +147,13 @@ bool InputOutputMap::addUniverse(quint32 id) } else if (id > universesCount()) { - qDebug() << Q_FUNC_INFO << "Gap between universe" << (universesCount() - 1) << "and universe" << id - << ", filling the gap..."; + qDebug() << Q_FUNC_INFO << "Gap between universe" << (universesCount() - 1) + << "and universe" << id << ", filling the gap..."; while (id > universesCount()) { uni = new Universe(universesCount(), m_grandMaster); - connect(doc()->masterTimer(), SIGNAL(tickReady()), uni, SLOT(tick()), Qt::QueuedConnection); + connect(doc()->masterTimer(), SIGNAL(tickReady()), uni, SLOT(tick()), + Qt::QueuedConnection); connect(uni, SIGNAL(universeWritten(quint32, QByteArray)), this, SIGNAL(universeWritten(quint32, QByteArray))); m_universeArray.append(uni); @@ -161,7 +162,8 @@ bool InputOutputMap::addUniverse(quint32 id) uni = new Universe(id, m_grandMaster); connect(doc()->masterTimer(), SIGNAL(tickReady()), uni, SLOT(tick()), Qt::QueuedConnection); - connect(uni, SIGNAL(universeWritten(quint32, QByteArray)), this, SIGNAL(universeWritten(quint32, QByteArray))); + connect(uni, SIGNAL(universeWritten(quint32, QByteArray)), this, + SIGNAL(universeWritten(quint32, QByteArray))); m_universeArray.append(uni); } @@ -388,8 +390,8 @@ void InputOutputMap::flushInputs() universe->flushInput(); } -bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, const QString &inputUID, quint32 input, - const QString &profileName) +bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, + const QString &inputUID, quint32 input, const QString &profileName) { /* Check that the universe that we're doing mapping for is valid */ if (universe >= universesCount()) @@ -404,12 +406,12 @@ bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, if (currInPatch != NULL) { currProfile = currInPatch->profile(); - disconnect(currInPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &))); + disconnect(currInPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &))); if (currInPatch->pluginName() == "MIDI") { - disconnect(currInPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SLOT(slotMIDIBeat(quint32, quint32, uchar))); + disconnect(currInPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SLOT(slotMIDIBeat(quint32, quint32, uchar))); } } InputPatch *ip = NULL; @@ -421,12 +423,14 @@ bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, int lIdx = inputs.indexOf(inputUID); if (lIdx != -1) { - qDebug() << "[IOMAP] Found match on input by name on universe" << universe << "-" << input << "vs" << lIdx; + qDebug() << "[IOMAP] Found match on input by name on universe" << universe << "-" + << input << "vs" << lIdx; input = lIdx; } else { - qDebug() << "[IOMAP] !!No match found!! for input on universe" << universe << "-" << input << inputUID; + qDebug() << "[IOMAP] !!No match found!! for input on universe" << universe << "-" + << input << inputUID; qDebug() << plugin->inputs(); } } @@ -440,8 +444,8 @@ bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &))); if (ip->pluginName() == "MIDI") { - connect(ip, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SLOT(slotMIDIBeat(quint32, quint32, uchar))); + connect(ip, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SLOT(slotMIDIBeat(quint32, quint32, uchar))); } } } @@ -474,8 +478,8 @@ bool InputOutputMap::setInputProfile(quint32 universe, const QString &profileNam return true; } -bool InputOutputMap::setOutputPatch(quint32 universe, const QString &pluginName, const QString &outputUID, - quint32 output, bool isFeedback, int index) +bool InputOutputMap::setOutputPatch(quint32 universe, const QString &pluginName, + const QString &outputUID, quint32 output, bool isFeedback, int index) { /* Check that the universe that we're doing mapping for is valid */ if (universe >= universesCount()) @@ -493,12 +497,14 @@ bool InputOutputMap::setOutputPatch(quint32 universe, const QString &pluginName, int lIdx = inputs.indexOf(outputUID); if (lIdx != -1) { - qDebug() << "[IOMAP] Found match on output by name on universe" << universe << "-" << output << "vs" << lIdx; + qDebug() << "[IOMAP] Found match on output by name on universe" << universe << "-" + << output << "vs" << lIdx; output = lIdx; } else { - qDebug() << "[IOMAP] !!No match found!! for output on universe" << universe << "-" << output << outputUID; + qDebug() << "[IOMAP] !!No match found!! for output on universe" << universe << "-" + << output << outputUID; qDebug() << plugin->outputs(); } } @@ -957,7 +963,8 @@ bool InputOutputMap::inputSourceNames(const QLCInputSource *src, QString &uniNam return true; } -bool InputOutputMap::inputSourceNames(QSharedPointer const &src, QString &uniName, QString &chName) const +bool InputOutputMap::inputSourceNames(QSharedPointer const &src, QString &uniName, + QString &chName) const { return inputSourceNames(src.data(), uniName, chName); } diff --git a/engine/src/inputoutputmap.h b/engine/src/inputoutputmap.h index ebc206fffa..cd86032b91 100644 --- a/engine/src/inputoutputmap.h +++ b/engine/src/inputoutputmap.h @@ -332,8 +332,8 @@ class InputOutputMap : public QObject * @param profileName The name of an input profile * @return true if successful, otherwise false */ - bool setInputPatch(quint32 universe, const QString &pluginName, const QString &inputUID, quint32 input, - const QString &profileName = QString()); + bool setInputPatch(quint32 universe, const QString &pluginName, const QString &inputUID, + quint32 input, const QString &profileName = QString()); /** * Set an input profile to the given universe. If the universe doesn't @@ -357,8 +357,8 @@ class InputOutputMap : public QObject * * @return true if successful, otherwise false */ - bool setOutputPatch(quint32 universe, const QString &pluginName, const QString &outputUID, quint32 output = 0, - bool isFeedback = false, int index = 0); + bool setOutputPatch(quint32 universe, const QString &pluginName, const QString &outputUID, + quint32 output = 0, bool isFeedback = false, int index = 0); int outputPatchesCount(quint32 universe) const; @@ -545,7 +545,8 @@ private slots: * @return true if uniName & chName contain something, otherwise false */ bool inputSourceNames(const QLCInputSource *src, QString &uniName, QString &chName) const; - bool inputSourceNames(QSharedPointer const &src, QString &uniName, QString &chName) const; + bool inputSourceNames(QSharedPointer const &src, QString &uniName, + QString &chName) const; /** * Get the default system input profile directory that contains installed diff --git a/engine/src/inputpatch.cpp b/engine/src/inputpatch.cpp index ee88487f3f..57876ad20d 100644 --- a/engine/src/inputpatch.cpp +++ b/engine/src/inputpatch.cpp @@ -73,8 +73,8 @@ bool InputPatch::set(QLCIOPlugin *plugin, quint32 input, QLCInputProfile *profil { bool result = false; - qDebug() << "InputPatch::set - plugin:" << ((plugin == NULL) ? "None" : plugin->name()) << ", line:" << input - << ", profile:" << ((profile == NULL) ? "None" : profile->name()); + qDebug() << "InputPatch::set - plugin:" << ((plugin == NULL) ? "None" : plugin->name()) + << ", line:" << input << ", profile:" << ((profile == NULL) ? "None" : profile->name()); if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine()) { @@ -140,7 +140,8 @@ bool InputPatch::reconnect() foreach (QString par, m_parametersCache.keys()) { qDebug() << "[InputPatch] restoring parameter:" << par << m_parametersCache[par]; - m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Input, par, m_parametersCache[par]); + m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Input, par, + m_parametersCache[par]); } } return ret; @@ -168,7 +169,8 @@ quint32 InputPatch::input() const QString InputPatch::inputName() const { - if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine() && m_pluginLine < quint32(m_plugin->inputs().count())) + if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine() + && m_pluginLine < quint32(m_plugin->inputs().count())) return m_plugin->inputs()[m_pluginLine]; else return KInputNone; @@ -208,7 +210,8 @@ QMap InputPatch::getPluginParameters() return QMap(); } -void InputPatch::slotValueChanged(quint32 universe, quint32 input, quint32 channel, uchar value, const QString &key) +void InputPatch::slotValueChanged(quint32 universe, quint32 input, quint32 channel, uchar value, + const QString &key) { // In case we have several lines connected to the same plugin, emit only // such values that belong to this particular patch. @@ -252,7 +255,8 @@ void InputPatch::setProfilePageControls() while (it.hasNext() == true) { it.next(); - m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Input, it.key(), it.value()); + m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Input, it.key(), + it.value()); } } } @@ -279,7 +283,8 @@ void InputPatch::flush(quint32 universe) if (universe == UINT_MAX || universe == m_universe) { QMutexLocker inputBufferLocker(&m_inputBufferMutex); - for (QHash::const_iterator it = m_inputBuffer.begin(); it != m_inputBuffer.end(); ++it) + for (QHash::const_iterator it = m_inputBuffer.begin(); + it != m_inputBuffer.end(); ++it) { emit inputValueChanged(m_universe, it.key(), it.value().value, it.value().key); } diff --git a/engine/src/inputpatch.h b/engine/src/inputpatch.h index b71f00b37d..728885f8f7 100644 --- a/engine/src/inputpatch.h +++ b/engine/src/inputpatch.h @@ -131,7 +131,8 @@ class InputPatch : public QObject void profileNameChanged(); private slots: - void slotValueChanged(quint32 universe, quint32 input, quint32 channel, uchar value, const QString &key = 0); + void slotValueChanged(quint32 universe, quint32 input, quint32 channel, uchar value, + const QString &key = 0); private: /** The reference of the plugin associated by this Input patch */ diff --git a/engine/src/ioplugincache.cpp b/engine/src/ioplugincache.cpp index cac6005b59..91b187e829 100644 --- a/engine/src/ioplugincache.cpp +++ b/engine/src/ioplugincache.cpp @@ -90,13 +90,15 @@ void IOPluginCache::load(const QDir &dir) else { /* Duplicate plugin. Unload it. */ - qWarning() << Q_FUNC_INFO << "Discarded duplicate I/O plugin" << ptr->name() << "in" << path; + qWarning() << Q_FUNC_INFO << "Discarded duplicate I/O plugin" << ptr->name() << "in" + << path; loader.unload(); } } else { - qWarning() << Q_FUNC_INFO << fileName << "doesn't contain an I/O plugin:" << loader.errorString(); + qWarning() << Q_FUNC_INFO << fileName + << "doesn't contain an I/O plugin:" << loader.errorString(); loader.unload(); } } diff --git a/engine/src/mastertimer-unix.cpp b/engine/src/mastertimer-unix.cpp index b9704e4239..8d661ee353 100644 --- a/engine/src/mastertimer-unix.cpp +++ b/engine/src/mastertimer-unix.cpp @@ -104,7 +104,7 @@ void MasterTimerPrivate::run() struct timespec *finish = static_cast(malloc(sizeof(struct timespec))); struct timespec *current = static_cast(malloc(sizeof(struct timespec))); #endif - struct timespec *sleepTime = static_cast(malloc(sizeof(struct timespec))); + struct timespec *sleepTime = static_cast(malloc(sizeof(struct timespec))); struct timespec *remainingTime = static_cast(malloc(sizeof(struct timespec))); sleepTime->tv_sec = 0; diff --git a/engine/src/mastertimer-win32.cpp b/engine/src/mastertimer-win32.cpp index 35251518e8..78229bfadb 100644 --- a/engine/src/mastertimer-win32.cpp +++ b/engine/src/mastertimer-win32.cpp @@ -85,8 +85,8 @@ void MasterTimerPrivate::start() return; } - BOOL ok = CreateTimerQueueTimer(&m_phTimer, NULL, (WAITORTIMERCALLBACK)masterTimerWin32Callback, this, 0, - m_masterTimer->tick(), WT_EXECUTELONGFUNCTION); + BOOL ok = CreateTimerQueueTimer(&m_phTimer, NULL, (WAITORTIMERCALLBACK)masterTimerWin32Callback, + this, 0, m_masterTimer->tick(), WT_EXECUTELONGFUNCTION); if (!ok) { qWarning() << Q_FUNC_INFO << "Unable to create a timer:" << GetLastError(); diff --git a/engine/src/mastertimer.cpp b/engine/src/mastertimer.cpp index 7aa7c04332..25ffa66843 100644 --- a/engine/src/mastertimer.cpp +++ b/engine/src/mastertimer.cpp @@ -262,7 +262,8 @@ void MasterTimer::timerTickFunctions(QList universes) function->stop(FunctionParent::master()); /* Function should be stopped instead */ function->postRun(this, universes); - // qDebug() << "[MasterTimer] Add function (ID: " << function->id() << ") to remove list "; + // qDebug() << "[MasterTimer] Add function (ID: " << function->id() << ") to + // remove list "; removeList << i; // Don't remove the item from the list just yet. functionListHasChanged = true; stoppedAFunction = true; diff --git a/engine/src/monitorproperties.cpp b/engine/src/monitorproperties.cpp index 7832925057..157d7d8c8b 100644 --- a/engine/src/monitorproperties.cpp +++ b/engine/src/monitorproperties.cpp @@ -133,7 +133,8 @@ void MonitorProperties::setPointOfView(MonitorProperties::PointOfView pov) { foreach (quint32 subID, fixtureIDList(fid)) { - QVector3D pos = fixturePosition(fid, fixtureHeadIndex(subID), fixtureLinkedIndex(subID)); + QVector3D pos = + fixturePosition(fid, fixtureHeadIndex(subID), fixtureLinkedIndex(subID)); QVector3D newPos; switch (pov) @@ -527,7 +528,8 @@ bool MonitorProperties::loadXML(QXmlStreamReader &root, const Doc *mainDocument) if (tAttrs.hasAttribute(KXMLQLCMonitorItemID)) { quint32 fid = tAttrs.value(KXMLQLCMonitorItemID).toString().toUInt(); - setCustomBackgroundItem(fid, mainDocument->denormalizeComponentPath(root.readElementText())); + setCustomBackgroundItem( + fid, mainDocument->denormalizeComponentPath(root.readElementText())); } } else if (root.name() == KXMLQLCMonitorGrid) @@ -783,7 +785,8 @@ bool MonitorProperties::saveXML(QXmlStreamWriter *doc, const Doc *mainDocument) doc->writeAttribute(KXMLQLCMonitorItemZRotation, QString::number(item.m_rotation.z())); #else if (item.m_rotation != QVector3D(0, 0, 0)) - doc->writeAttribute(KXMLQLCMonitorFixtureRotation, QString::number(item.m_rotation.y())); + doc->writeAttribute(KXMLQLCMonitorFixtureRotation, + QString::number(item.m_rotation.y())); #endif if (item.m_color.isValid()) doc->writeAttribute(KXMLQLCMonitorFixtureGelColor, item.m_color.name()); @@ -853,7 +856,8 @@ bool MonitorProperties::saveXML(QXmlStreamWriter *doc, const Doc *mainDocument) #endif else { - doc->writeAttribute(KXMLQLCMonitorItemRes, mainDocument->normalizeComponentPath(item.m_resource)); + doc->writeAttribute(KXMLQLCMonitorItemRes, + mainDocument->normalizeComponentPath(item.m_resource)); } } diff --git a/engine/src/monitorproperties.h b/engine/src/monitorproperties.h index 35ac65a5f1..a34617b133 100644 --- a/engine/src/monitorproperties.h +++ b/engine/src/monitorproperties.h @@ -258,7 +258,8 @@ class MonitorProperties : public QObject void setFixtureRotation(quint32 fid, quint16 head, quint16 linked, QVector3D degrees); QVector3D fixtureRotation(quint32 fid, quint16 head, quint16 linked) const; - /** Get/Set the color of a gel used to render a Fixture with with the given $fid, $head and $linked index */ + /** Get/Set the color of a gel used to render a Fixture with with the given $fid, $head and + * $linked index */ void setFixtureGelColor(quint32 fid, quint16 head, quint16 linked, QColor col); QColor fixtureGelColor(quint32 fid, quint16 head, quint16 linked) const; diff --git a/engine/src/outputpatch.cpp b/engine/src/outputpatch.cpp index 0258a0ef01..0f7442cc7d 100644 --- a/engine/src/outputpatch.cpp +++ b/engine/src/outputpatch.cpp @@ -98,7 +98,8 @@ bool OutputPatch::reconnect() if (ret == true) { foreach (QString par, m_parametersCache.keys()) - m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Output, par, m_parametersCache[par]); + m_plugin->setParameter(m_universe, m_pluginLine, QLCIOPlugin::Output, par, + m_parametersCache[par]); } return ret; } @@ -120,7 +121,8 @@ QLCIOPlugin *OutputPatch::plugin() const QString OutputPatch::outputName() const { - if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine() && m_pluginLine < quint32(m_plugin->outputs().size())) + if (m_plugin != NULL && m_pluginLine != QLCIOPlugin::invalidLine() + && m_pluginLine < quint32(m_plugin->outputs().size())) { return m_plugin->outputs()[m_pluginLine]; } diff --git a/engine/src/outputpatch.h b/engine/src/outputpatch.h index 9f041d0338..e71377e4c6 100644 --- a/engine/src/outputpatch.h +++ b/engine/src/outputpatch.h @@ -117,7 +117,7 @@ class OutputPatch : public QObject void setBlackout(bool blackout); /** Write the contents of a 512 channel value buffer to the plugin. - * Called periodically by OutputMap. No need to call manually. */ + * Called periodically by OutputMap. No need to call manually. */ void dump(quint32 universe, const QByteArray &data, bool dataChanged); signals: diff --git a/engine/src/qlccapability.h b/engine/src/qlccapability.h index 80c2b65f16..8ec3484811 100644 --- a/engine/src/qlccapability.h +++ b/engine/src/qlccapability.h @@ -84,7 +84,8 @@ class QLCCapability : public QObject ********************************************************************/ public: /** Default constructor */ - QLCCapability(uchar min = 0, uchar max = UCHAR_MAX, const QString &name = QString(), QObject *parent = 0); + QLCCapability(uchar min = 0, uchar max = UCHAR_MAX, const QString &name = QString(), + QObject *parent = 0); QLCCapability *createCopy(); diff --git a/engine/src/qlcfile.cpp b/engine/src/qlcfile.cpp index 157c2e6354..b40c28699e 100644 --- a/engine/src/qlcfile.cpp +++ b/engine/src/qlcfile.cpp @@ -185,7 +185,8 @@ QDir QLCFile::systemDirectory(QString path, QString extension) #elif defined(__APPLE__) || defined(Q_OS_MAC) dir.setPath(QString("%1/../%2").arg(QCoreApplication::applicationDirPath()).arg(path)); #elif defined(WIN32) || defined(Q_OS_WIN) - dir.setPath(QString("%1%2%3").arg(QCoreApplication::applicationDirPath()).arg(QDir::separator()).arg(path)); + dir.setPath( + QString("%1%2%3").arg(QCoreApplication::applicationDirPath()).arg(QDir::separator()).arg(path)); #elif defined(Q_OS_ANDROID) dir.setPath(QString("assets:/%1").arg(path.remove(0, path.lastIndexOf("/") + 1))); #else diff --git a/engine/src/qlcfile.h b/engine/src/qlcfile.h index ce20f2b9a7..a3032fb199 100644 --- a/engine/src/qlcfile.h +++ b/engine/src/qlcfile.h @@ -92,7 +92,8 @@ class QLCFile * @param author The file's author (overridden by current user name if empty) * @return true on success, false on failure */ - static bool writeXMLHeader(QXmlStreamWriter *xml, const QString &content, const QString &author = QString()); + static bool writeXMLHeader(QXmlStreamWriter *xml, const QString &content, + const QString &author = QString()); /** * Get a string that gives a textual description for the given file diff --git a/engine/src/qlcfixturedef.cpp b/engine/src/qlcfixturedef.cpp index ea90670c25..a1c4566b31 100644 --- a/engine/src/qlcfixturedef.cpp +++ b/engine/src/qlcfixturedef.cpp @@ -225,7 +225,8 @@ void QLCFixtureDef::checkLoaded(QString mapPath) if (m_isLoaded == true) return; - if (manufacturer() == KXMLFixtureGeneric && (model() == KXMLFixtureGeneric || model() == KXMLFixtureRGBPanel)) + if (manufacturer() == KXMLFixtureGeneric + && (model() == KXMLFixtureGeneric || model() == KXMLFixtureRGBPanel)) { m_isLoaded = true; return; @@ -475,7 +476,10 @@ QFile::FileError QLCFixtureDef::loadXML(const QString &fileName) else { qWarning() << fileName - << QString("%1\nLine %2, column %3").arg(doc->errorString()).arg(doc->lineNumber()).arg(doc->columnNumber()); + << QString("%1\nLine %2, column %3") + .arg(doc->errorString()) + .arg(doc->lineNumber()) + .arg(doc->columnNumber()); error = QFile::ReadError; } } diff --git a/engine/src/qlcfixturedefcache.cpp b/engine/src/qlcfixturedefcache.cpp index 3fa1487d0e..86809c8a38 100644 --- a/engine/src/qlcfixturedefcache.cpp +++ b/engine/src/qlcfixturedefcache.cpp @@ -195,7 +195,8 @@ int QLCFixtureDefCache::loadMapManufacturer(QXmlStreamReader *doc, QString manuf if (doc->attributes().hasAttribute("m")) model = doc->attributes().value("m").toString(); - if (defFile.isEmpty() == false && spacedManufacturer.isEmpty() == false && model.isEmpty() == false) + if (defFile.isEmpty() == false && spacedManufacturer.isEmpty() == false + && model.isEmpty() == false) { QLCFixtureDef *fxi = new QLCFixtureDef(); Q_ASSERT(fxi != NULL); @@ -365,7 +366,8 @@ bool QLCFixtureDefCache::loadQXF(const QString &path, bool isUser) } else { - qWarning() << Q_FUNC_INFO << "Fixture definition loading from" << path << "failed:" << QLCFile::errorString(error); + qWarning() << Q_FUNC_INFO << "Fixture definition loading from" << path + << "failed:" << QLCFile::errorString(error); delete fxi; fxi = NULL; return false; @@ -379,7 +381,8 @@ bool QLCFixtureDefCache::loadD4(const QString &path) AvolitesD4Parser parser; if (parser.loadXML(path, fxi) == false) { - qWarning() << Q_FUNC_INFO << "Unable to load D4 fixture from" << path << ":" << parser.lastError(); + qWarning() << Q_FUNC_INFO << "Unable to load D4 fixture from" << path << ":" + << parser.lastError(); delete fxi; return false; } diff --git a/engine/src/qlcfixturehead.cpp b/engine/src/qlcfixturehead.cpp index a6995aad12..78fb406b76 100644 --- a/engine/src/qlcfixturehead.cpp +++ b/engine/src/qlcfixturehead.cpp @@ -216,13 +216,17 @@ void QLCFixtureHead::cacheChannels(const QLCFixtureMode *mode) // if this head doesn't include any Pan/Tilt channel // try to retrieve them from the fixture Mode if (channelNumber(QLCChannel::Pan, QLCChannel::MSB) == QLCChannel::invalid()) - setMapIndex(QLCChannel::Pan, QLCChannel::MSB, mode->channelNumber(QLCChannel::Pan, QLCChannel::MSB)); + setMapIndex(QLCChannel::Pan, QLCChannel::MSB, + mode->channelNumber(QLCChannel::Pan, QLCChannel::MSB)); if (channelNumber(QLCChannel::Pan, QLCChannel::LSB) == QLCChannel::invalid()) - setMapIndex(QLCChannel::Pan, QLCChannel::LSB, mode->channelNumber(QLCChannel::Pan, QLCChannel::LSB)); + setMapIndex(QLCChannel::Pan, QLCChannel::LSB, + mode->channelNumber(QLCChannel::Pan, QLCChannel::LSB)); if (channelNumber(QLCChannel::Tilt, QLCChannel::MSB) == QLCChannel::invalid()) - setMapIndex(QLCChannel::Tilt, QLCChannel::MSB, mode->channelNumber(QLCChannel::Tilt, QLCChannel::MSB)); + setMapIndex(QLCChannel::Tilt, QLCChannel::MSB, + mode->channelNumber(QLCChannel::Tilt, QLCChannel::MSB)); if (channelNumber(QLCChannel::Tilt, QLCChannel::LSB) == QLCChannel::invalid()) - setMapIndex(QLCChannel::Tilt, QLCChannel::LSB, mode->channelNumber(QLCChannel::Tilt, QLCChannel::LSB)); + setMapIndex(QLCChannel::Tilt, QLCChannel::LSB, + mode->channelNumber(QLCChannel::Tilt, QLCChannel::LSB)); std::sort(m_colorWheels.begin(), m_colorWheels.end()); std::sort(m_shutterChannels.begin(), m_shutterChannels.end()); diff --git a/engine/src/qlcfixturemode.cpp b/engine/src/qlcfixturemode.cpp index 8a17042dc8..707f68c04b 100644 --- a/engine/src/qlcfixturemode.cpp +++ b/engine/src/qlcfixturemode.cpp @@ -84,8 +84,8 @@ QLCFixtureMode &QLCFixtureMode::operator=(const QLCFixtureMode &mode) if (actual != NULL) insertChannel(actual, i++); else - qWarning() << Q_FUNC_INFO << "Unable to find channel" << ch->name() << "for mode" << m_name - << "from its fixture definition"; + qWarning() << Q_FUNC_INFO << "Unable to find channel" << ch->name() << "for mode" + << m_name << "from its fixture definition"; } } @@ -141,14 +141,15 @@ bool QLCFixtureMode::insertChannel(QLCChannel *channel, quint32 index) } else { - qWarning() << Q_FUNC_INFO << "Channel" << channel->name() << "is already a member of mode" << m_name; + qWarning() << Q_FUNC_INFO << "Channel" << channel->name() + << "is already a member of mode" << m_name; return false; } } else { - qWarning() << Q_FUNC_INFO << "Will not add channel" << channel->name() << "to mode" << m_name - << "because the channel does not belong to mode's" + qWarning() << Q_FUNC_INFO << "Will not add channel" << channel->name() << "to mode" + << m_name << "because the channel does not belong to mode's" << "parent fixture definition."; return false; } @@ -299,7 +300,8 @@ void QLCFixtureMode::cacheHeads() for (int i = 0; i < m_channels.size(); i++) { - if (m_channels.at(i)->group() == QLCChannel::Intensity && m_channels.at(i)->controlByte() == QLCChannel::MSB + if (m_channels.at(i)->group() == QLCChannel::Intensity + && m_channels.at(i)->controlByte() == QLCChannel::MSB && m_channels.at(i)->colour() == QLCChannel::NoColour && headForChannel(i) == -1) { m_masterIntensityChannel = i; @@ -415,7 +417,8 @@ bool QLCFixtureMode::loadXML(QXmlStreamReader &doc) if (m_channels.contains(channelSctsOnData.channel) && channelSctsOnData.actsOnIndex >= 0 && m_channels.size() > channelSctsOnData.actsOnIndex) { - m_actsOnChannelsList.insert(channelSctsOnData.channel, m_channels.at(channelSctsOnData.actsOnIndex)); + m_actsOnChannelsList.insert(channelSctsOnData.channel, + m_channels.at(channelSctsOnData.actsOnIndex)); } } @@ -452,7 +455,8 @@ bool QLCFixtureMode::saveXML(QXmlStreamWriter *doc) QLCChannel *ChannelActsOn = m_actsOnChannelsList.value(channel); if (ChannelActsOn != NULL) { - doc->writeAttribute(KXMLQLCFixtureModeChannelActsOn, QString::number(m_channels.indexOf(ChannelActsOn))); + doc->writeAttribute(KXMLQLCFixtureModeChannelActsOn, + QString::number(m_channels.indexOf(ChannelActsOn))); } } diff --git a/engine/src/qlcinputchannel.cpp b/engine/src/qlcinputchannel.cpp index 9bdc16a894..5ef37eabed 100644 --- a/engine/src/qlcinputchannel.cpp +++ b/engine/src/qlcinputchannel.cpp @@ -260,7 +260,8 @@ bool QLCInputChannel::loadXML(QXmlStreamReader &root) else if (root.name() == KXMLQLCInputChannelMovement) { if (root.attributes().hasAttribute(KXMLQLCInputChannelSensitivity)) - setMovementSensitivity(root.attributes().value(KXMLQLCInputChannelSensitivity).toString().toInt()); + setMovementSensitivity( + root.attributes().value(KXMLQLCInputChannelSensitivity).toString().toInt()); if (root.readElementText() == KXMLQLCInputChannelRelative) setMovementType(Relative); diff --git a/engine/src/qlcinputprofile.cpp b/engine/src/qlcinputprofile.cpp index 9feeecf800..3fbce902f7 100644 --- a/engine/src/qlcinputprofile.cpp +++ b/engine/src/qlcinputprofile.cpp @@ -301,7 +301,10 @@ QLCInputProfile *QLCInputProfile::loader(const QString &path) if (profile->loadXML(*doc) == false) { qWarning() << path - << QString("%1\nLine %2, column %3").arg(doc->errorString()).arg(doc->lineNumber()).arg(doc->columnNumber()); + << QString("%1\nLine %2, column %3") + .arg(doc->errorString()) + .arg(doc->lineNumber()) + .arg(doc->columnNumber()); delete profile; profile = NULL; diff --git a/engine/src/qlcpalette.cpp b/engine/src/qlcpalette.cpp index 26a40a8313..0ad0f9d4a7 100644 --- a/engine/src/qlcpalette.cpp +++ b/engine/src/qlcpalette.cpp @@ -303,7 +303,8 @@ QList QLCPalette::valuesFromFixtures(Doc *doc, QList fixtur case Dimmer: { int dValue = value().toInt(); - quint32 intCh = fixture->type() == QLCFixtureDef::Dimmer ? 0 : fixture->masterIntensityChannel(); + quint32 intCh = + fixture->type() == QLCFixtureDef::Dimmer ? 0 : fixture->masterIntensityChannel(); if (intCh != QLCChannel::invalid()) { @@ -797,8 +798,9 @@ bool QLCPalette::saveXML(QXmlStreamWriter *doc) doc->writeAttribute(KXMLQLCPaletteValue, value().toString()); break; case PanTilt: - doc->writeAttribute(KXMLQLCPaletteValue, - QString("%1,%2").arg(m_values.at(0).toInt()).arg(m_values.at(1).toInt())); + doc->writeAttribute( + KXMLQLCPaletteValue, + QString("%1,%2").arg(m_values.at(0).toInt()).arg(m_values.at(1).toInt())); break; case Shutter: break; diff --git a/engine/src/qlcphysical.cpp b/engine/src/qlcphysical.cpp index 82aaf2ccac..dab506838b 100644 --- a/engine/src/qlcphysical.cpp +++ b/engine/src/qlcphysical.cpp @@ -88,9 +88,9 @@ QLCPhysical &QLCPhysical::operator=(const QLCPhysical &physical) bool QLCPhysical::isEmpty() const { - if (m_bulbLumens == 0 && m_bulbColourTemperature == 0 && m_weight == 0 && m_width == 0 && m_height == 0 - && m_depth == 0 && m_lensDegreesMin == 0 && m_lensDegreesMax == 0 && m_focusPanMax == 0 && m_focusTiltMax == 0 - && m_powerConsumption == 0) + if (m_bulbLumens == 0 && m_bulbColourTemperature == 0 && m_weight == 0 && m_width == 0 + && m_height == 0 && m_depth == 0 && m_lensDegreesMin == 0 && m_lensDegreesMax == 0 + && m_focusPanMax == 0 && m_focusTiltMax == 0 && m_powerConsumption == 0) return true; return false; @@ -292,9 +292,10 @@ bool QLCPhysical::loadXML(QXmlStreamReader &doc) QXmlStreamAttributes attrs = doc.attributes(); if (doc.name() == KXMLQLCPhysicalBulb) { - m_bulbType = attrs.value(KXMLQLCPhysicalBulbType).toString(); - m_bulbLumens = attrs.value(KXMLQLCPhysicalBulbLumens).toString().toInt(); - m_bulbColourTemperature = attrs.value(KXMLQLCPhysicalBulbColourTemperature).toString().toInt(); + m_bulbType = attrs.value(KXMLQLCPhysicalBulbType).toString(); + m_bulbLumens = attrs.value(KXMLQLCPhysicalBulbLumens).toString().toInt(); + m_bulbColourTemperature = + attrs.value(KXMLQLCPhysicalBulbColourTemperature).toString().toInt(); } else if (doc.name() == KXMLQLCPhysicalDimensions) { @@ -305,9 +306,11 @@ bool QLCPhysical::loadXML(QXmlStreamReader &doc) } else if (doc.name() == KXMLQLCPhysicalLens) { - m_lensName = attrs.value(KXMLQLCPhysicalLensName).toString(); - m_lensDegreesMin = QLocale::c().toDouble(attrs.value(KXMLQLCPhysicalLensDegreesMin).toString()); - m_lensDegreesMax = QLocale::c().toDouble(attrs.value(KXMLQLCPhysicalLensDegreesMax).toString()); + m_lensName = attrs.value(KXMLQLCPhysicalLensName).toString(); + m_lensDegreesMin = + QLocale::c().toDouble(attrs.value(KXMLQLCPhysicalLensDegreesMin).toString()); + m_lensDegreesMax = + QLocale::c().toDouble(attrs.value(KXMLQLCPhysicalLensDegreesMax).toString()); } else if (doc.name() == KXMLQLCPhysicalFocus) { @@ -326,8 +329,9 @@ bool QLCPhysical::loadXML(QXmlStreamReader &doc) } else if (doc.name() == KXMLQLCPhysicalTechnical) { - m_powerConsumption = attrs.value(KXMLQLCPhysicalTechnicalPowerConsumption).toString().toInt(); - m_dmxConnector = attrs.value(KXMLQLCPhysicalTechnicalDmxConnector).toString(); + m_powerConsumption = + attrs.value(KXMLQLCPhysicalTechnicalPowerConsumption).toString().toInt(); + m_dmxConnector = attrs.value(KXMLQLCPhysicalTechnicalDmxConnector).toString(); } else { diff --git a/engine/src/rgbaudio.cpp b/engine/src/rgbaudio.cpp index 92bb5e9c77..a75b6a949e 100644 --- a/engine/src/rgbaudio.cpp +++ b/engine/src/rgbaudio.cpp @@ -101,7 +101,8 @@ void RGBAudio::calculateColors(int barsHeight) for (int i = 0; i < barsHeight; i++) { m_barColors.append(pixelColor.rgb()); - pixelColor = QColor(pixelColor.red() + crDelta, pixelColor.green() + cgDelta, pixelColor.blue() + cbDelta); + pixelColor = QColor(pixelColor.red() + crDelta, pixelColor.green() + cgDelta, + pixelColor.blue() + cbDelta); } } } diff --git a/engine/src/rgbimage.cpp b/engine/src/rgbimage.cpp index 2ef41f9b31..9eaf8ee4ec 100644 --- a/engine/src/rgbimage.cpp +++ b/engine/src/rgbimage.cpp @@ -93,7 +93,8 @@ void RGBImage::setImageData(int width, int height, const QByteArray &pixelData) { if (i + 3 > pixelData.length()) break; - QRgb pixel = qRgb((uchar)pixelData.at(i), (uchar)pixelData.at(i + 1), (uchar)pixelData.at(i + 2)); + QRgb pixel = + qRgb((uchar)pixelData.at(i), (uchar)pixelData.at(i + 1), (uchar)pixelData.at(i + 2)); newImg.setPixel(x, y, pixel); i += 3; } @@ -228,7 +229,8 @@ int RGBImage::rgbMapStepCount(const QSize &size) case Vertical: return m_image.height(); case Animation: - qDebug() << m_image.width() << " " << size.width() << " " << (m_image.width() / size.width()); + qDebug() << m_image.width() << " " << size.width() << " " + << (m_image.width() / size.width()); return MAX(1, m_image.width() / size.width()); } } diff --git a/engine/src/rgbmatrix.cpp b/engine/src/rgbmatrix.cpp index a4a8d019fd..751e902f41 100644 --- a/engine/src/rgbmatrix.cpp +++ b/engine/src/rgbmatrix.cpp @@ -618,7 +618,8 @@ void RGBMatrix::write(MasterTimer *timer, QList universes) resetElapsed(); } } - else if (elapsed() >= m_stepBeatDuration && (uint)timer->timeToNextBeat() > m_stepBeatDuration / 16) + else if (elapsed() >= m_stepBeatDuration + && (uint)timer->timeToNextBeat() > m_stepBeatDuration / 16) { qDebug() << "Elapsed exceeded"; roundCheck(); @@ -678,7 +679,8 @@ void RGBMatrix::roundCheck() roundElapsed(duration()); } -FadeChannel *RGBMatrix::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) +FadeChannel *RGBMatrix::getFader(QList universes, quint32 universeID, quint32 fixtureID, + quint32 channel) { // get the universe Fader first. If doesn't exist, create it QSharedPointer fader = m_fadersMap.value(universeID, QSharedPointer()); @@ -1027,7 +1029,8 @@ void RGBMatrixStep::updateStepColor(int stepIndex, QColor startColor, int stepsC // qDebug() << "RGBMatrix step" << stepIndex << ", color:" << QString::number(m_stepColor.rgb(), 16); } -void RGBMatrixStep::initializeDirection(Function::Direction direction, QColor startColor, QColor endColor, int stepsCount) +void RGBMatrixStep::initializeDirection(Function::Direction direction, QColor startColor, + QColor endColor, int stepsCount) { m_direction = direction; @@ -1049,7 +1052,8 @@ void RGBMatrixStep::initializeDirection(Function::Direction direction, QColor st calculateColorDelta(startColor, endColor); } -bool RGBMatrixStep::checkNextStep(Function::RunOrder order, QColor startColor, QColor endColor, int stepsNumber) +bool RGBMatrixStep::checkNextStep(Function::RunOrder order, QColor startColor, QColor endColor, + int stepsNumber) { if (order == Function::PingPong) { diff --git a/engine/src/rgbmatrix.h b/engine/src/rgbmatrix.h index f7313838a4..71359806c6 100644 --- a/engine/src/rgbmatrix.h +++ b/engine/src/rgbmatrix.h @@ -71,7 +71,8 @@ class RGBMatrixStep /** Initialize the playback direction and set the initial step index and * color based on $startColor and $endColor */ - void initializeDirection(Function::Direction direction, QColor startColor, QColor endColor, int stepsCount); + void initializeDirection(Function::Direction direction, QColor startColor, QColor endColor, + int stepsCount); /** Check the steps progression based on $order and the internal m_direction. * This method returns true if the RGBMatrix can continue to run, otherwise @@ -245,7 +246,8 @@ class RGBMatrix : public Function /** Check what should be done when elapsed() >= duration() */ void roundCheck(); - FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); + FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, + quint32 channel); void updateFaderValues(FadeChannel *fc, uchar value, uint fadeTime); /** Update FadeChannels when $map has changed since last time */ diff --git a/engine/src/rgbscript.cpp b/engine/src/rgbscript.cpp index ce007e2523..8f0b41cf40 100644 --- a/engine/src/rgbscript.cpp +++ b/engine/src/rgbscript.cpp @@ -512,7 +512,9 @@ bool RGBScript::loadProperties() { if (values.length() < 2) { - qWarning() << value << ": malformed property. A range should be defined as 'min,max'. Please fix it."; + qWarning() << value + << ": malformed property. A range should be defined as " + "'min,max'. Please fix it."; } else { @@ -524,8 +526,7 @@ bool RGBScript::loadProperties() default: qWarning() << value << ": values cannot be applied before the 'type' property or on " - "type:integer and " - "type:string"; + "type:integer and type:string"; break; } } diff --git a/engine/src/rgbscriptv4.cpp b/engine/src/rgbscriptv4.cpp index 3543afac99..b4b0fe358f 100644 --- a/engine/src/rgbscriptv4.cpp +++ b/engine/src/rgbscriptv4.cpp @@ -490,7 +490,9 @@ bool RGBScript::loadProperties() { if (values.length() < 2) { - qWarning() << value << ": malformed property. A range should be defined as 'min,max'. Please fix it."; + qWarning() << value + << ": malformed property. A range should be defined as " + "'min,max'. Please fix it."; } else { @@ -502,8 +504,7 @@ bool RGBScript::loadProperties() default: qWarning() << value << ": values cannot be applied before the 'type' property or on " - "type:integer and " - "type:string"; + "type:integer and type:string"; break; } } diff --git a/engine/src/scene.cpp b/engine/src/scene.cpp index 5946f7f944..8b1630bba2 100644 --- a/engine/src/scene.cpp +++ b/engine/src/scene.cpp @@ -270,7 +270,9 @@ QColor Scene::colorValue(quint32 fxi) else if (channel->group() == QLCChannel::Colour) { QLCCapability *cap = channel->searchCapability(scv.value); - if (cap && (cap->presetType() == QLCCapability::SingleColor || cap->presetType() == QLCCapability::DoubleColor)) + if (cap + && (cap->presetType() == QLCCapability::SingleColor + || cap->presetType() == QLCCapability::DoubleColor)) { QColor col = cap->resource(0).value(); rVal = col.red(); @@ -685,7 +687,8 @@ void Scene::writeDMX(MasterTimer *timer, QList ua) if (universe == Universe::invalid()) continue; - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (fader.isNull()) { fader = ua[universe]->requestFader(); @@ -755,7 +758,8 @@ void Scene::processValue(MasterTimer *timer, QList ua, uint fadeIn, } else { - qDebug() << "Scene" << name() << "add channel" << scv.channel << "from" << fc->current() << "to" << scv.value; + qDebug() << "Scene" << name() << "add channel" << scv.channel << "from" << fc->current() + << "to" << scv.value; } fc->setStart(fc->current()); diff --git a/engine/src/scene.h b/engine/src/scene.h index 0bc55b646d..68f6eeece3 100644 --- a/engine/src/scene.h +++ b/engine/src/scene.h @@ -238,7 +238,8 @@ public slots: void postLoad(); private: - static bool saveXMLFixtureValues(QXmlStreamWriter *doc, quint32 fixtureID, QStringList const &values); + static bool saveXMLFixtureValues(QXmlStreamWriter *doc, quint32 fixtureID, + QStringList const &values); /********************************************************************* * Flash diff --git a/engine/src/scenevalue.h b/engine/src/scenevalue.h index 243e6934dd..6a9f04a83e 100644 --- a/engine/src/scenevalue.h +++ b/engine/src/scenevalue.h @@ -58,7 +58,8 @@ class SceneValue { public: /** Normal constructor */ - SceneValue(quint32 fxi_id = Fixture::invalidId(), quint32 channel = QLCChannel::invalid(), uchar value = 0); + SceneValue(quint32 fxi_id = Fixture::invalidId(), quint32 channel = QLCChannel::invalid(), + uchar value = 0); /** Copy constructor */ SceneValue(const SceneValue &scv); diff --git a/engine/src/script.cpp b/engine/src/script.cpp index 11b03f2a11..35d6b4c57b 100644 --- a/engine/src/script.cpp +++ b/engine/src/script.cpp @@ -253,7 +253,8 @@ bool Script::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ScriptType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a script"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not a script"; return false; } @@ -663,7 +664,8 @@ QString Script::handleSetFixture(const QList &tokens, QListuniverse(); - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (fader.isNull()) { fader = universes[universe]->requestFader(); diff --git a/engine/src/script.h b/engine/src/script.h index 2c18055ae7..b15c950227 100644 --- a/engine/src/script.h +++ b/engine/src/script.h @@ -247,10 +247,10 @@ class Script : public Function static QList tokenizeLine(const QString &line, bool *ok = NULL); private: - int m_currentCommand; //! Current command line being handled - quint32 m_waitCount; //! Timer ticks to wait before executing the next line - QList> m_lines; //! Raw data parsed into lines of tokens - QMap m_labels; //! Labels and their line numbers + int m_currentCommand; //! Current command line being handled + quint32 m_waitCount; //! Timer ticks to wait before executing the next line + QList> m_lines; //! Raw data parsed into lines of tokens + QMap m_labels; //! Labels and their line numbers QList m_startedFunctions; //! Functions started by this script QList m_syntaxErrorLines; diff --git a/engine/src/scriptrunner.cpp b/engine/src/scriptrunner.cpp index 54e76e6a5a..b406f221c9 100644 --- a/engine/src/scriptrunner.cpp +++ b/engine/src/scriptrunner.cpp @@ -102,8 +102,9 @@ QStringList ScriptRunner::collectScriptData() QJSValue script = engine->evaluate("(function run() { " + m_content + " })"); if (script.isError()) { - QString msg = - QString("Uncaught exception at line %2. %3").arg(script.property("lineNumber").toInt()).arg(script.toString()); + QString msg = QString("Uncaught exception at line %2. %3") + .arg(script.property("lineNumber").toInt()) + .arg(script.toString()); qWarning() << msg; // qDebug() << "Stack: " << script.property("stack").toString(); syntaxErrorList << msg; @@ -122,8 +123,9 @@ QStringList ScriptRunner::collectScriptData() QJSValue ret = script.call(QJSValueList()); if (ret.isError()) { - QString msg = - QString("Uncaught exception at line %2. %3").arg(ret.property("lineNumber").toInt()).arg(ret.toString()); + QString msg = QString("Uncaught exception at line %2. %3") + .arg(ret.property("lineNumber").toInt()) + .arg(ret.toString()); qWarning() << msg; syntaxErrorList << msg; } @@ -150,7 +152,8 @@ bool ScriptRunner::write(MasterTimer *timer, QList universes) { FixtureValue val = m_fixtureValueQueue.dequeue(); - QSharedPointer fader = m_fadersMap.value(val.m_universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(val.m_universe, QSharedPointer()); if (fader.isNull()) { fader = universes[val.m_universe]->requestFader(); @@ -159,7 +162,8 @@ bool ScriptRunner::write(MasterTimer *timer, QList universes) m_fadersMap[val.m_universe] = fader; } - FadeChannel *fc = fader->getChannelFader(m_doc, universes[val.m_universe], val.m_fixtureID, val.m_channel); + FadeChannel *fc = fader->getChannelFader(m_doc, universes[val.m_universe], + val.m_fixtureID, val.m_channel); fc->setStart(fc->current()); fc->setTarget(val.m_value); diff --git a/engine/src/scriptv4.cpp b/engine/src/scriptv4.cpp index 9b09293e49..a206b3376b 100644 --- a/engine/src/scriptv4.cpp +++ b/engine/src/scriptv4.cpp @@ -241,7 +241,8 @@ bool Script::loadXML(QXmlStreamReader &root) if (attrs.value(KXMLQLCFunctionType).toString() != typeToString(Function::ScriptType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a script"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not a script"; return false; } @@ -268,9 +269,11 @@ bool Script::loadXML(QXmlStreamReader &root) else if (root.name() == KXMLQLCScriptCommand) { if (version == 1) - m_data.append(convertLine(QUrl::fromPercentEncoding(root.readElementText().toUtf8()) + QString("\n"))); + m_data.append(convertLine(QUrl::fromPercentEncoding(root.readElementText().toUtf8()) + + QString("\n"))); else - m_data.append(QUrl::fromPercentEncoding(root.readElementText().toUtf8()) + QString("\n")); + m_data.append(QUrl::fromPercentEncoding(root.readElementText().toUtf8()) + + QString("\n")); } else { diff --git a/engine/src/sequence.cpp b/engine/src/sequence.cpp index 711e0d2471..c8e8616716 100644 --- a/engine/src/sequence.cpp +++ b/engine/src/sequence.cpp @@ -149,7 +149,8 @@ bool Sequence::loadXML(QXmlStreamReader &root) if (funcAttrs.value(KXMLQLCFunctionType).toString() != typeToString(Function::SequenceType)) { - qWarning() << Q_FUNC_INFO << funcAttrs.value(KXMLQLCFunctionType).toString() << "is not a Sequence"; + qWarning() << Q_FUNC_INFO << funcAttrs.value(KXMLQLCFunctionType).toString() + << "is not a Sequence"; return false; } diff --git a/engine/src/show.cpp b/engine/src/show.cpp index d852a6f879..5deb8505eb 100644 --- a/engine/src/show.cpp +++ b/engine/src/show.cpp @@ -257,7 +257,8 @@ void Show::moveTrack(Track *track, int direction) swapID = signedID; } - qDebug() << Q_FUNC_INFO << "Direction:" << direction << ", trackID:" << trkID << ", swapID:" << swapID; + qDebug() << Q_FUNC_INFO << "Direction:" << direction << ", trackID:" << trkID + << ", swapID:" << swapID; if (swapID == trkID || (direction > 0 && trkID == maxID)) return; @@ -321,7 +322,8 @@ bool Show::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ShowType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not a show"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not a show"; return false; } diff --git a/engine/src/showrunner.cpp b/engine/src/showrunner.cpp index 7947676a2d..686048d930 100644 --- a/engine/src/showrunner.cpp +++ b/engine/src/showrunner.cpp @@ -87,7 +87,8 @@ ShowRunner::ShowRunner(const Doc *doc, quint32 showID, quint32 startTime) #if 1 qDebug() << "Ordered list of ShowFunctions:"; foreach (ShowFunction *sfunc, m_functions) - qDebug() << "ID:" << sfunc->functionID() << "st:" << sfunc->startTime() << "dur:" << sfunc->duration(m_doc); + qDebug() << "ID:" << sfunc->functionID() << "st:" << sfunc->startTime() + << "dur:" << sfunc->duration(m_doc); #endif m_runningQueue.clear(); @@ -160,7 +161,8 @@ void ShowRunner::write() { if (track->showFunctions().contains(sf)) { - int intOverrideId = f->requestAttributeOverride(Function::Intensity, m_intensityMap[track->id()]); + int intOverrideId = + f->requestAttributeOverride(Function::Intensity, m_intensityMap[track->id()]); // f->adjustAttribute(m_intensityMap[track->id()], Function::Intensity); sf->setIntensityOverrideId(intOverrideId); break; diff --git a/engine/src/universe.cpp b/engine/src/universe.cpp index e1d191383d..1660020ac2 100644 --- a/engine/src/universe.cpp +++ b/engine/src/universe.cpp @@ -129,7 +129,8 @@ ushort Universe::totalChannels() bool Universe::hasChanged() { - bool changed = memcmp(m_lastPostGMValues->constData(), m_postGMValues->constData(), m_usedChannels) != 0; + bool changed = + memcmp(m_lastPostGMValues->constData(), m_postGMValues->constData(), m_usedChannels) != 0; if (changed) memcpy(m_lastPostGMValues->data(), m_postGMValues->constData(), m_usedChannels); return changed; @@ -226,8 +227,8 @@ QSharedPointer Universe::requestFader(Universe::FaderPriority prio m_faders.insert(insertPos, fader); } - qDebug() << "Generic fader with priority" << fader->priority() << "registered at pos" << insertPos << ", count" - << m_faders.count(); + qDebug() << "Generic fader with priority" << fader->priority() << "registered at pos" + << insertPos << ", count" << m_faders.count(); return fader; } @@ -264,7 +265,8 @@ void Universe::requestFaderPriority(QSharedPointer fader, Universe if (newPos != pos) { m_faders.move(pos, newPos); - qDebug() << "Generic fader moved from" << pos << "to" << m_faders.indexOf(fader) << ". Count:" << m_faders.count(); + qDebug() << "Generic fader moved from" << pos << "to" << m_faders.indexOf(fader) + << ". Count:" << m_faders.count(); } } @@ -399,7 +401,8 @@ void Universe::applyPassthroughValues(int address, int range) for (int i = address; i < address + range && i < UNIVERSE_SIZE; i++) { - if (static_cast(m_postGMValues->at(i)) < static_cast(m_passthroughValues->at(i))) // HTP merge + if (static_cast(m_postGMValues->at(i)) + < static_cast(m_passthroughValues->at(i))) // HTP merge { (*m_postGMValues)[i] = (*m_passthroughValues)[i]; } @@ -571,8 +574,9 @@ bool Universe::isPatched() bool Universe::setInputPatch(QLCIOPlugin *plugin, quint32 input, QLCInputProfile *profile) { - qDebug() << "[Universe] setInputPatch - ID:" << m_id << ", plugin:" << ((plugin == NULL) ? "None" : plugin->name()) - << ", input:" << input << ", profile:" << ((profile == NULL) ? "None" : profile->name()); + qDebug() << "[Universe] setInputPatch - ID:" << m_id + << ", plugin:" << ((plugin == NULL) ? "None" : plugin->name()) << ", input:" << input + << ", profile:" << ((profile == NULL) ? "None" : profile->name()); if (m_inputPatch == NULL) { if (plugin == NULL || input == QLCIOPlugin::invalidLine()) @@ -608,8 +612,8 @@ bool Universe::setOutputPatch(QLCIOPlugin *plugin, quint32 output, int index) if (index < 0) return false; - qDebug() << "[Universe] setOutputPatch - ID:" << m_id << ", plugin:" << ((plugin == NULL) ? "None" : plugin->name()) - << ", output:" << output; + qDebug() << "[Universe] setOutputPatch - ID:" << m_id + << ", plugin:" << ((plugin == NULL) ? "None" : plugin->name()) << ", output:" << output; // replace or delete an existing patch if (index < m_outputPatchList.count()) @@ -757,11 +761,11 @@ void Universe::connectInputPatch() return; if (!m_passthrough) - connect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SIGNAL(inputValueChanged(quint32, quint32, uchar, QString))); + connect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SIGNAL(inputValueChanged(quint32, quint32, uchar, QString))); else - connect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SLOT(slotInputValueChanged(quint32, quint32, uchar, const QString &))); + connect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SLOT(slotInputValueChanged(quint32, quint32, uchar, const QString &))); } void Universe::disconnectInputPatch() @@ -770,11 +774,11 @@ void Universe::disconnectInputPatch() return; if (!m_passthrough) - disconnect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SIGNAL(inputValueChanged(quint32, quint32, uchar, QString))); + disconnect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SIGNAL(inputValueChanged(quint32, quint32, uchar, QString))); else - disconnect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), this, - SLOT(slotInputValueChanged(quint32, quint32, uchar, const QString &))); + disconnect(m_inputPatch, SIGNAL(inputValueChanged(quint32, quint32, uchar, const QString &)), + this, SLOT(slotInputValueChanged(quint32, quint32, uchar, const QString &))); } /************************************************************************ @@ -827,7 +831,8 @@ void Universe::setChannelCapability(ushort channel, QLCChannel::Group group, Cha } } - // qDebug() << Q_FUNC_INFO << "Channel:" << channel << "mask:" << QString::number(m_channelsMask->at(channel), 16); + // qDebug() << Q_FUNC_INFO << "Channel:" << channel << "mask:" << + // QString::number(m_channelsMask->at(channel), 16); if (channel >= m_totalChannels) { m_totalChannels = channel + 1; @@ -936,7 +941,8 @@ bool Universe::write(int channel, uchar value, bool forceLTP) if ((m_channelsMask->at(channel) & HTP) == false) (*m_blackoutValues)[channel] = char(value); - if (forceLTP == false && (m_channelsMask->at(channel) & HTP) && value < (uchar)m_preGMValues->at(channel)) + if (forceLTP == false && (m_channelsMask->at(channel) & HTP) + && value < (uchar)m_preGMValues->at(channel)) { qDebug() << "[Universe] HTP check not passed" << channel << value; return false; @@ -994,7 +1000,8 @@ bool Universe::writeBlended(int channel, uchar value, Universe::BlendMode blend) case AdditiveBlend: { uchar currVal = uchar(m_preGMValues->at(channel)); - // qDebug() << "Universe write additive channel" << channel << ", value:" << currVal << "+" << value; + // qDebug() << "Universe write additive channel" << channel << ", value:" << currVal << + // "+" << value; value = qMin(int(currVal) + value, 255); (*m_preGMValues)[channel] = char(value); } @@ -1203,18 +1210,20 @@ bool Universe::saveXML(QXmlStreamWriter *doc) const if (inputPatch() != NULL) { - savePatchXML(doc, KXMLQLCUniverseInputPatch, inputPatch()->pluginName(), inputPatch()->inputName(), - inputPatch()->input(), inputPatch()->profileName(), inputPatch()->getPluginParameters()); + savePatchXML(doc, KXMLQLCUniverseInputPatch, inputPatch()->pluginName(), + inputPatch()->inputName(), inputPatch()->input(), inputPatch()->profileName(), + inputPatch()->getPluginParameters()); } foreach (OutputPatch *op, m_outputPatchList) { - savePatchXML(doc, KXMLQLCUniverseOutputPatch, op->pluginName(), op->outputName(), op->output(), "", - op->getPluginParameters()); + savePatchXML(doc, KXMLQLCUniverseOutputPatch, op->pluginName(), op->outputName(), + op->output(), "", op->getPluginParameters()); } if (feedbackPatch() != NULL) { - savePatchXML(doc, KXMLQLCUniverseFeedbackPatch, feedbackPatch()->pluginName(), feedbackPatch()->outputName(), - feedbackPatch()->output(), "", feedbackPatch()->getPluginParameters()); + savePatchXML(doc, KXMLQLCUniverseFeedbackPatch, feedbackPatch()->pluginName(), + feedbackPatch()->outputName(), feedbackPatch()->output(), "", + feedbackPatch()->getPluginParameters()); } /* End the tag */ @@ -1223,8 +1232,9 @@ bool Universe::saveXML(QXmlStreamWriter *doc) const return true; } -void Universe::savePatchXML(QXmlStreamWriter *doc, const QString &tag, const QString &pluginName, const QString &lineName, - quint32 line, QString profileName, QMap parameters) const +void Universe::savePatchXML(QXmlStreamWriter *doc, const QString &tag, const QString &pluginName, + const QString &lineName, quint32 line, QString profileName, + QMap parameters) const { // sanity check: don't save invalid data if (pluginName.isEmpty() || pluginName == KInputNone || line == QLCIOPlugin::invalidLine()) diff --git a/engine/src/universe.h b/engine/src/universe.h index a376612c44..e56c726bd5 100644 --- a/engine/src/universe.h +++ b/engine/src/universe.h @@ -290,7 +290,8 @@ protected slots: * @param group The group this channel belongs to * @param isHTP Flag to force HTP/LTP behaviour */ - void setChannelCapability(ushort channel, QLCChannel::Group group, ChannelType forcedType = Undefined); + void setChannelCapability(ushort channel, QLCChannel::Group group, + ChannelType forcedType = Undefined); /** Retrieve the capability mask of the given channel index * @@ -600,8 +601,9 @@ public slots: * @param profileName * @param parameters */ - void savePatchXML(QXmlStreamWriter *doc, QString const &tag, QString const &pluginName, const QString &lineName, - quint32 line, QString profileName, QMap parameters) const; + void savePatchXML(QXmlStreamWriter *doc, QString const &tag, QString const &pluginName, + const QString &lineName, quint32 line, QString profileName, + QMap parameters) const; /** * Save a plugin custom parameters (if available) into a tag nested diff --git a/engine/src/video.cpp b/engine/src/video.cpp index e1a0725c9e..b8d3b30d3d 100644 --- a/engine/src/video.cpp +++ b/engine/src/video.cpp @@ -432,7 +432,8 @@ bool Video::loadXML(QXmlStreamReader &root) if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::VideoType)) { - qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() << "is not Video"; + qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString() + << "is not Video"; return false; } diff --git a/engine/test/chaserrunner/chaserrunner_test.h b/engine/test/chaserrunner/chaserrunner_test.h index 5b0aad4f1c..15cea16925 100644 --- a/engine/test/chaserrunner/chaserrunner_test.h +++ b/engine/test/chaserrunner/chaserrunner_test.h @@ -43,13 +43,13 @@ private slots: void currentFadeOut(); void currentDuration(); /* - void roundCheckSingleShotForward(); - void roundCheckSingleShotBackward(); - void roundCheckLoopForward(); - void roundCheckLoopBackward(); - void roundCheckPingPongForward(); - void roundCheckPingPongBackward(); - */ + void roundCheckSingleShotForward(); + void roundCheckSingleShotBackward(); + void roundCheckLoopForward(); + void roundCheckLoopBackward(); + void roundCheckPingPongForward(); + void roundCheckPingPongBackward(); +*/ void writeNoSteps(); void writeForwardLoopZero(); void writeBackwardLoopZero(); diff --git a/engine/test/cuestack/cuestack_test.cpp b/engine/test/cuestack/cuestack_test.cpp index 62cd81915f..ddf0a55ec0 100644 --- a/engine/test/cuestack/cuestack_test.cpp +++ b/engine/test/cuestack/cuestack_test.cpp @@ -398,7 +398,8 @@ void CueStack_Test::removeCues() cs.removeCues(QList() << 2 << 0); QCOMPARE(cs.cues().size(), 2); - QCOMPARE(cs.currentIndex(), 1); // currentIndex-- times two because two cue before it were removed + QCOMPARE(cs.currentIndex(), + 1); // currentIndex-- times two because two cue before it were removed QCOMPARE(cs.cues().at(0).name(), QString("Two")); QCOMPARE(cs.cues().at(1).name(), QString("Five")); diff --git a/engine/test/doc/doc_test.cpp b/engine/test/doc/doc_test.cpp index 5b569dd141..ebe765b2e8 100644 --- a/engine/test/doc/doc_test.cpp +++ b/engine/test/doc/doc_test.cpp @@ -88,8 +88,10 @@ void Doc_Test::normalizeComponentPath() QCOMPARE(m_doc->normalizeComponentPath(QString()), QString()); QCOMPARE(m_doc->normalizeComponentPath("qlcplus.png"), QFileInfo("qlcplus.png").absoluteFilePath()); - QCOMPARE(m_doc->normalizeComponentPath("../../../resources/icons/png/qlcplus.png"), QString("qlcplus.png")); - QCOMPARE(m_doc->normalizeComponentPath("../../../resources/icons/png/sub/qlcplus.png"), QString("sub/qlcplus.png")); + QCOMPARE(m_doc->normalizeComponentPath("../../../resources/icons/png/qlcplus.png"), + QString("qlcplus.png")); + QCOMPARE(m_doc->normalizeComponentPath("../../../resources/icons/png/sub/qlcplus.png"), + QString("sub/qlcplus.png")); QCOMPARE(m_doc->normalizeComponentPath("/home/user/test.png"), QString("/home/user/test.png")); } @@ -102,7 +104,8 @@ void Doc_Test::denormalizeComponentPath() QFileInfo("../../../resources/icons/png/qlcplus.png").absoluteFilePath()); QCOMPARE(m_doc->denormalizeComponentPath("sub/qlcplus.png"), QFileInfo("../../../resources/icons/png/sub/qlcplus.png").absoluteFilePath()); - QCOMPARE(m_doc->denormalizeComponentPath("/home/user/test.png"), QString("/home/user/test.png")); + QCOMPARE(m_doc->denormalizeComponentPath("/home/user/test.png"), + QString("/home/user/test.png")); } void Doc_Test::defaults() diff --git a/engine/test/efx/efx_test.cpp b/engine/test/efx/efx_test.cpp index 72fcb171e1..c974aa07c4 100644 --- a/engine/test/efx/efx_test.cpp +++ b/engine/test/efx/efx_test.cpp @@ -2944,8 +2944,9 @@ void EFX_Test::save() QVERIFY(xmlReader.attributes().value("Type").toString() == "EFX"); QVERIFY(xmlReader.attributes().value("Name").toString() == "First"); - bool dir = false, off = false, run = false, algo = false, w = false, h = false, rot = false, isRelative = false, - xoff = false, yoff = false, xfreq = false, yfreq = false, xpha = false, ypha = false, prop = false, speed = false; + bool dir = false, off = false, run = false, algo = false, w = false, h = false, rot = false, + isRelative = false, xoff = false, yoff = false, xfreq = false, yfreq = false, xpha = false, + ypha = false, prop = false, speed = false; int fixtureid = 0, fixturehead = 0, fixturedirection = 0, fixtureStartOffset = 0; QList fixtures; diff --git a/engine/test/efxfixture/efxfixture_test.cpp b/engine/test/efxfixture/efxfixture_test.cpp index 37328b75ae..bf4a225e37 100644 --- a/engine/test/efxfixture/efxfixture_test.cpp +++ b/engine/test/efxfixture/efxfixture_test.cpp @@ -103,7 +103,8 @@ void EFXFixture_Test::init() } { - QLCFixtureDef *def = m_doc->fixtureDefCache()->fixtureDef("American DJ", "Sweeper Beam Quad LED"); + QLCFixtureDef *def = + m_doc->fixtureDefCache()->fixtureDef("American DJ", "Sweeper Beam Quad LED"); QVERIFY(def != NULL); QLCFixtureMode *mode = def->modes().last(); // 39 Channel mode QVERIFY(mode != NULL); diff --git a/engine/test/fixture/fixture_test.cpp b/engine/test/fixture/fixture_test.cpp index e1f243c18f..1e0e40ce41 100644 --- a/engine/test/fixture/fixture_test.cpp +++ b/engine/test/fixture/fixture_test.cpp @@ -893,8 +893,8 @@ void Fixture_Test::save() xmlReader.readNextStartElement(); QVERIFY(xmlReader.name().toString() == "Fixture"); - bool manufacturer = false, model = false, mode = false, name = false, channels = false, universe = false, - address = false, id = false; + bool manufacturer = false, model = false, mode = false, name = false, channels = false, + universe = false, address = false, id = false; while (xmlReader.readNextStartElement()) { diff --git a/engine/test/fixturegroup/fixturegroup_test.cpp b/engine/test/fixturegroup/fixturegroup_test.cpp index 56efc87e44..9cad4767b4 100644 --- a/engine/test/fixturegroup/fixturegroup_test.cpp +++ b/engine/test/fixturegroup/fixturegroup_test.cpp @@ -896,7 +896,10 @@ void FixtureGroup_Test::save() } else { - QFAIL(QString("Unexpected tag in FixtureGroup: %1").arg(xmlReader.name().toString()).toUtf8().constData()); + QFAIL(QString("Unexpected tag in FixtureGroup: %1") + .arg(xmlReader.name().toString()) + .toUtf8() + .constData()); } } diff --git a/engine/test/function/function_test.cpp b/engine/test/function/function_test.cpp index 090b7a37d4..54a017d184 100644 --- a/engine/test/function/function_test.cpp +++ b/engine/test/function/function_test.cpp @@ -367,7 +367,8 @@ void Function_Test::speedToString() QString("99h59m59s990ms")); QCOMPARE(Function::speedToString(999 + 59 * 1000 + 59 * 1000 * 60 + 99 * 1000 * 60 * 60), QString("99h59m59s999ms")); - QCOMPARE(Function::speedToString(1 + 1 * 1000 + 1 * 1000 * 60 + 1 * 1000 * 60 * 60), QString("1h01m01s001ms")); + QCOMPARE(Function::speedToString(1 + 1 * 1000 + 1 * 1000 * 60 + 1 * 1000 * 60 * 60), + QString("1h01m01s001ms")); QCOMPARE(Function::speedToString(100), QString("100ms")); QCOMPARE(Function::speedToString(10), QString("10ms")); @@ -433,7 +434,8 @@ void Function_Test::speedOperations() QCOMPARE(Function::speedAdd(15, 15), uint(30)); QCOMPARE(Function::speedAdd(Function::infiniteSpeed(), 10), Function::infiniteSpeed()); QCOMPARE(Function::speedAdd(10, Function::infiniteSpeed()), Function::infiniteSpeed()); - QCOMPARE(Function::speedAdd(Function::infiniteSpeed(), Function::infiniteSpeed()), Function::infiniteSpeed()); + QCOMPARE(Function::speedAdd(Function::infiniteSpeed(), Function::infiniteSpeed()), + Function::infiniteSpeed()); QCOMPARE(Function::speedAdd(10, 0), uint(10)); QCOMPARE(Function::speedAdd(20, 0), uint(20)); QCOMPARE(Function::speedAdd(30, 0), uint(30)); diff --git a/engine/test/inputoutputmap/inputoutputmap_test.cpp b/engine/test/inputoutputmap/inputoutputmap_test.cpp index 452a5a1701..f7b6247188 100644 --- a/engine/test/inputoutputmap/inputoutputmap_test.cpp +++ b/engine/test/inputoutputmap/inputoutputmap_test.cpp @@ -140,7 +140,8 @@ void InputOutputMap_Test::inputPluginStatus() IOPluginStub *stub = static_cast(m_doc->ioPluginCache()->plugins().at(0)); QVERIFY(stub != NULL); - QVERIFY(im.inputPluginStatus(stub->name(), QLCIOPlugin::invalidLine()) == stub->inputInfo(QLCIOPlugin::invalidLine())); + QVERIFY(im.inputPluginStatus(stub->name(), QLCIOPlugin::invalidLine()) + == stub->inputInfo(QLCIOPlugin::invalidLine())); QVERIFY(im.inputPluginStatus(stub->name(), 0) == stub->inputInfo(0)); QVERIFY(im.inputPluginStatus(stub->name(), 1) == stub->inputInfo(1)); QVERIFY(im.inputPluginStatus(stub->name(), 2) == stub->inputInfo(2)); @@ -597,7 +598,8 @@ void InputOutputMap_Test::inputSourceNames() QCOMPARE(ch, tr("%1: ?").arg(1)); QVERIFY(im.inputSourceNames(new QLCInputSource(0, QLCInputSource::invalidChannel), uni, ch) == false); - QVERIFY(im.inputSourceNames(new QLCInputSource(InputOutputMap::invalidUniverse(), 0), uni, ch) == false); + QVERIFY(im.inputSourceNames(new QLCInputSource(InputOutputMap::invalidUniverse(), 0), uni, ch) + == false); QVERIFY(im.inputSourceNames(new QLCInputSource(), uni, ch) == false); } diff --git a/engine/test/iopluginstub/iopluginstub.cpp b/engine/test/iopluginstub/iopluginstub.cpp index c3e4b1c441..ba5b4ca0c1 100644 --- a/engine/test/iopluginstub/iopluginstub.cpp +++ b/engine/test/iopluginstub/iopluginstub.cpp @@ -84,7 +84,8 @@ QString IOPluginStub::outputInfo(quint32 output) return QString("This is a plugin stub for testing."); } -void IOPluginStub::writeUniverse(quint32 universe, quint32 output, const QByteArray &data, bool dataChanged) +void IOPluginStub::writeUniverse(quint32 universe, quint32 output, const QByteArray &data, + bool dataChanged) { Q_UNUSED(universe) Q_UNUSED(dataChanged) diff --git a/engine/test/qlcfile/qlcfile_test.cpp b/engine/test/qlcfile/qlcfile_test.cpp index 9698276e84..12191171ba 100644 --- a/engine/test/qlcfile/qlcfile_test.cpp +++ b/engine/test/qlcfile/qlcfile_test.cpp @@ -116,8 +116,10 @@ void QLCFile_Test::getXMLHeader() void QLCFile_Test::errorString() { QCOMPARE(QLCFile::errorString(QFile::NoError), tr("No error occurred.")); - QCOMPARE(QLCFile::errorString(QFile::ReadError), tr("An error occurred when reading from the file.")); - QCOMPARE(QLCFile::errorString(QFile::WriteError), tr("An error occurred when writing to the file.")); + QCOMPARE(QLCFile::errorString(QFile::ReadError), + tr("An error occurred when reading from the file.")); + QCOMPARE(QLCFile::errorString(QFile::WriteError), + tr("An error occurred when writing to the file.")); QCOMPARE(QLCFile::errorString(QFile::FatalError), tr("A fatal error occurred.")); QCOMPARE(QLCFile::errorString(QFile::ResourceError), tr("Resource error occurred.")); QCOMPARE(QLCFile::errorString(QFile::OpenError), tr("The file could not be opened.")); @@ -126,7 +128,8 @@ void QLCFile_Test::errorString() QCOMPARE(QLCFile::errorString(QFile::UnspecifiedError), tr("An unspecified error occurred.")); QCOMPARE(QLCFile::errorString(QFile::RemoveError), tr("The file could not be removed.")); QCOMPARE(QLCFile::errorString(QFile::RenameError), tr("The file could not be renamed.")); - QCOMPARE(QLCFile::errorString(QFile::PositionError), tr("The position in the file could not be changed.")); + QCOMPARE(QLCFile::errorString(QFile::PositionError), + tr("The position in the file could not be changed.")); QCOMPARE(QLCFile::errorString(QFile::ResizeError), tr("The file could not be resized.")); QCOMPARE(QLCFile::errorString(QFile::PermissionsError), tr("The file could not be accessed.")); QCOMPARE(QLCFile::errorString(QFile::CopyError), tr("The file could not be copied.")); diff --git a/engine/test/qlcfixturehead/qlcfixturehead_test.cpp b/engine/test/qlcfixturehead/qlcfixturehead_test.cpp index aaad83245f..ed4630d376 100644 --- a/engine/test/qlcfixturehead/qlcfixturehead_test.cpp +++ b/engine/test/qlcfixturehead/qlcfixturehead_test.cpp @@ -110,7 +110,8 @@ void QLCFixtureHead_Test::save() if (xmlReader.name().toString() == "Channel") { QString chNum = xmlReader.readElementText(); - QVERIFY(chNum.toInt() == 0 || chNum.toInt() == 1 || chNum.toInt() == 2 || chNum.toInt() == 3); + QVERIFY(chNum.toInt() == 0 || chNum.toInt() == 1 || chNum.toInt() == 2 + || chNum.toInt() == 3); ch++; } else diff --git a/engine/test/qlcfixturemode/qlcfixturemode_test.cpp b/engine/test/qlcfixturemode/qlcfixturemode_test.cpp index b12da13780..33b9bf6e24 100644 --- a/engine/test/qlcfixturemode/qlcfixturemode_test.cpp +++ b/engine/test/qlcfixturemode/qlcfixturemode_test.cpp @@ -640,7 +640,7 @@ void QLCFixtureMode_Test::save() { if (xmlReader.name() == KXMLQLCChannel) { - int num = xmlReader.attributes().value(KXMLQLCFixtureModeChannelNumber).toString().toInt(); + int num = xmlReader.attributes().value(KXMLQLCFixtureModeChannelNumber).toString().toInt(); channels[num] = xmlReader.readElementText(); } else if (xmlReader.name() == KXMLQLCFixtureHead) diff --git a/engine/test/qlcinputchannel/qlcinputchannel_test.cpp b/engine/test/qlcinputchannel/qlcinputchannel_test.cpp index ba8eb647cf..7b9e0ddabd 100644 --- a/engine/test/qlcinputchannel/qlcinputchannel_test.cpp +++ b/engine/test/qlcinputchannel/qlcinputchannel_test.cpp @@ -69,11 +69,15 @@ void QLCInputChannel_Test::typeToString() { QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Button), QString(KXMLQLCInputChannelButton)); QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Knob), QString(KXMLQLCInputChannelKnob)); - QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Encoder), QString(KXMLQLCInputChannelEncoder)); + QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Encoder), + QString(KXMLQLCInputChannelEncoder)); QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Slider), QString(KXMLQLCInputChannelSlider)); - QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::NextPage), QString(KXMLQLCInputChannelPageUp)); - QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::PrevPage), QString(KXMLQLCInputChannelPageDown)); - QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::PageSet), QString(KXMLQLCInputChannelPageSet)); + QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::NextPage), + QString(KXMLQLCInputChannelPageUp)); + QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::PrevPage), + QString(KXMLQLCInputChannelPageDown)); + QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::PageSet), + QString(KXMLQLCInputChannelPageSet)); QCOMPARE(QLCInputChannel::typeToString(QLCInputChannel::Type(42)), QString(KXMLQLCInputChannelNone)); } @@ -82,10 +86,14 @@ void QLCInputChannel_Test::stringToType() QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelButton)), QLCInputChannel::Button); QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelSlider)), QLCInputChannel::Slider); QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelKnob)), QLCInputChannel::Knob); - QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelEncoder)), QLCInputChannel::Encoder); - QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageUp)), QLCInputChannel::NextPage); - QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageDown)), QLCInputChannel::PrevPage); - QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageSet)), QLCInputChannel::PageSet); + QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelEncoder)), + QLCInputChannel::Encoder); + QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageUp)), + QLCInputChannel::NextPage); + QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageDown)), + QLCInputChannel::PrevPage); + QCOMPARE(QLCInputChannel::stringToType(QString(KXMLQLCInputChannelPageSet)), + QLCInputChannel::PageSet); QCOMPARE(QLCInputChannel::stringToType(QString("foobar")), QLCInputChannel::NoType); } diff --git a/engine/test/rgbscript/rgbscript_test.cpp b/engine/test/rgbscript/rgbscript_test.cpp index 4503526785..729ba01b50 100644 --- a/engine/test/rgbscript/rgbscript_test.cpp +++ b/engine/test/rgbscript/rgbscript_test.cpp @@ -240,8 +240,9 @@ void RGBScript_Test::rgbMap() void RGBScript_Test::runScripts() { - QSize mapSize = QSize(7, 11); // Use different numbers for x and y for the test - QSize mapSizePlus = QSize(12, 22); // Prepare a larger matrix to check behaviour on matrix change + QSize mapSize = QSize(7, 11); // Use different numbers for x and y for the test + QSize mapSizePlus = QSize(12, + 22); // Prepare a larger matrix to check behaviour on matrix change // QColor(Qt::red).rgb() is 0xffff0000 due to the alpha channel // This test also wants to test that there is no color space overrun. int red = 0xff0000; @@ -309,8 +310,8 @@ void RGBScript_Test::runScripts() // uint pxr = (map[y][x] >> 16 & 0x000000ff); // uint pxg = (map[y][x] >> 8 & 0x000000ff); // uint pxb = (map[y][x] & 0x000000ff); - // qDebug() << "C:" << Qt::hex << pxr << ":" << Qt::hex << pxg << ":" << Qt::hex << pxb << " (" - // << Qt::hex << map[y][x]<< ")"; + // qDebug() << "C:" << Qt::hex << pxr << ":" << Qt::hex << pxg << ":" << + // Qt::hex << pxb << " (" << Qt::hex << map[y][x]<< ")"; // } QVERIFY(rgbMap[y][x] <= 0xffffff); } @@ -321,7 +322,8 @@ void RGBScript_Test::runScripts() RGBMap rgbRefMap; if (1 < s.acceptColors() && 2 < steps && !randomScript) { - // When more than 2 colors are accepted, the steps shall be reproducible to allow back and forth color fade. + // When more than 2 colors are accepted, the steps shall be reproducible to allow back + // and forth color fade. s.rgbMap(mapSizePlus, red, 0, rgbRefMap); } // Switch to the larger map and step a few times. @@ -372,8 +374,10 @@ void RGBScript_Test::runScripts() QList properties = s.properties(); qDebug() << property.m_name; // Unknown, new and RGBScriptProperty::None are not valid - QVERIFY(property.m_type == RGBScriptProperty::List || property.m_type == RGBScriptProperty::Range - || property.m_type == RGBScriptProperty::Integer || property.m_type == RGBScriptProperty::String); + QVERIFY(property.m_type == RGBScriptProperty::List + || property.m_type == RGBScriptProperty::Range + || property.m_type == RGBScriptProperty::Integer + || property.m_type == RGBScriptProperty::String); // Check property specificities switch (property.m_type) { @@ -410,7 +414,8 @@ void RGBScript_Test::runScripts() QVERIFY(property.m_rangeMinValue < property.m_rangeMaxValue); // Verify the default value is in the valid range qDebug() << " Default: " << s.property(property.m_name).toInt() - << " Min: " << property.m_rangeMinValue << " Max: " << property.m_rangeMaxValue; + << " Min: " << property.m_rangeMinValue + << " Max: " << property.m_rangeMaxValue; QVERIFY(s.property(property.m_name).toInt() >= property.m_rangeMinValue); QVERIFY(s.property(property.m_name).toInt() <= property.m_rangeMaxValue); // test with min and max value from the list @@ -418,7 +423,8 @@ void RGBScript_Test::runScripts() s.setProperty(property.m_name, QString::number(property.m_rangeMinValue)); qDebug() << " Readback" << s.property(property.m_name); - QVERIFY(s.property(property.m_name) == QString::number(property.m_rangeMinValue)); + QVERIFY(s.property(property.m_name) + == QString::number(property.m_rangeMinValue)); for (int step = 0; step < realsteps; step++) { RGBMap map; @@ -436,7 +442,8 @@ void RGBScript_Test::runScripts() qDebug() << property.m_name << QString::number(property.m_rangeMaxValue); s.setProperty(property.m_name, QString::number(property.m_rangeMaxValue)); qDebug() << " Readback: " << s.property(property.m_name); - QVERIFY(s.property(property.m_name) == QString::number(property.m_rangeMaxValue)); + QVERIFY(s.property(property.m_name) + == QString::number(property.m_rangeMaxValue)); for (int step = 0; step < realsteps; step++) { RGBMap map; diff --git a/qmlui/app.cpp b/qmlui/app.cpp index 37bf0f7184..f306fedf1e 100644 --- a/qmlui/app.cpp +++ b/qmlui/app.cpp @@ -116,8 +116,10 @@ QString App::appVersion() const void App::startup() { qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "App", "Can't create an App!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "Fixture", "Can't create a Fixture!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCFunction", "Can't create a Function!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "Fixture", + "Can't create a Fixture!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCFunction", + "Can't create a Function!"); qmlRegisterType("org.qlcplus.classes", 1, 0, "ModelSelector"); setTitle(APPNAME); @@ -155,8 +157,8 @@ void App::startup() connect(m_networkManager, &NetworkManager::accessMaskChanged, this, &App::setAccessMask); connect(m_networkManager, &NetworkManager::requestProjectLoad, this, &App::slotLoadDocFromMemory); - m_tardis = new Tardis(this, m_doc, m_networkManager, m_fixtureManager, m_functionManager, m_contextManager, - m_simpleDesk, m_showManager, m_virtualConsole); + m_tardis = new Tardis(this, m_doc, m_networkManager, m_fixtureManager, m_functionManager, + m_contextManager, m_simpleDesk, m_showManager, m_virtualConsole); rootContext()->setContextProperty("tardis", m_tardis); m_contextManager->registerContext(m_virtualConsole); @@ -167,10 +169,12 @@ void App::startup() // register an uncreatable type just to use the enums in QML qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ContextManager", "Can't create a ContextManager!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ShowManager", "Can't create a ShowManager!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ShowManager", + "Can't create a ShowManager!"); qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "NetworkManager", "Can't create a NetworkManager!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "SimpleDesk", "Can't create a SimpleDesk!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "SimpleDesk", + "Can't create a SimpleDesk!"); // Start up in non-modified state m_doc->resetModified(); @@ -251,7 +255,8 @@ bool App::is3DSupported() const if (openglContext() == nullptr) return false; - int glVersion = (openglContext()->format().majorVersion() * 10) + openglContext()->format().minorVersion(); + int glVersion = + (openglContext()->format().majorVersion() * 10) + openglContext()->format().minorVersion(); return glVersion < 33 ? false : true; #else // TODO: Qt6 @@ -277,8 +282,8 @@ void App::setAccessMask(int mask) int App::defaultMask() const { - return AC_FixtureEditing | AC_FunctionEditing | AC_InputOutput | AC_ShowManager | AC_SimpleDesk | AC_VCControl - | AC_VCEditing; + return AC_FixtureEditing | AC_FunctionEditing | AC_InputOutput | AC_ShowManager | AC_SimpleDesk + | AC_VCControl | AC_VCEditing; } void App::keyPressEvent(QKeyEvent *e) @@ -317,7 +322,8 @@ void App::slotSceneGraphInitialized() if (openglContext() == nullptr) return; - qDebug() << "OpenGL version: " << openglContext()->format().majorVersion() << openglContext()->format().minorVersion(); + qDebug() << "OpenGL version: " << openglContext()->format().majorVersion() + << openglContext()->format().minorVersion(); #else // TODO: Qt6 #endif @@ -325,12 +331,12 @@ void App::slotSceneGraphInitialized() void App::slotScreenChanged(QScreen *screen) { - bool isLandscape = - (screen->orientation() == Qt::LandscapeOrientation || screen->orientation() == Qt::InvertedLandscapeOrientation) - ? true - : false; - qreal sSize = isLandscape ? screen->size().height() : screen->size().width(); - m_pixelDensity = qMax(screen->physicalDotsPerInch() * 0.039370, sSize / 220.0); + bool isLandscape = (screen->orientation() == Qt::LandscapeOrientation + || screen->orientation() == Qt::InvertedLandscapeOrientation) + ? true + : false; + qreal sSize = isLandscape ? screen->size().height() : screen->size().width(); + m_pixelDensity = qMax(screen->physicalDotsPerInch() * 0.039370, sSize / 220.0); qDebug() << "Screen changed to" << screen->name() << ", pixel density:" << m_pixelDensity << ", physical size:" << screen->physicalSize(); rootContext()->setContextProperty("screenPixelDensity", m_pixelDensity); @@ -379,7 +385,8 @@ void App::initDoc() m_doc = new Doc(this); connect(m_doc, SIGNAL(modified(bool)), this, SIGNAL(docModifiedChanged())); - connect(m_doc->masterTimer(), SIGNAL(functionListChanged()), this, SIGNAL(runningFunctionsCountChanged())); + connect(m_doc->masterTimer(), SIGNAL(functionListChanged()), this, + SIGNAL(runningFunctionsCountChanged())); /* Load user fixtures first so that they override system fixtures */ m_doc->fixtureDefCache()->load(QLCFixtureDefCache::userDefinitionDirectory()); @@ -506,7 +513,7 @@ void App::slotItemReadyForPrinting() // if the grabbed image is larger than the page, fit it to the page width if (pageRect.width() < imgSize.width()) { - img = m_printerImage->image().scaledToWidth(pageRect.width(), Qt::SmoothTransformation); + img = m_printerImage->image().scaledToWidth(pageRect.width(), Qt::SmoothTransformation); actualWidth = pageRect.width(); } @@ -628,13 +635,14 @@ bool App::loadWorkspace(const QString &fileName) Function *func = m_doc->function(m_doc->startupFunction()); if (func != nullptr) { - qDebug() << Q_FUNC_INFO << "Starting startup function. (" << m_doc->startupFunction() << ")"; + qDebug() << Q_FUNC_INFO << "Starting startup function. (" + << m_doc->startupFunction() << ")"; func->start(m_doc->masterTimer(), FunctionParent::master()); } else { - qWarning() << Q_FUNC_INFO << "Startup function does not exist, erasing. (" << m_doc->startupFunction() - << ")"; + qWarning() << Q_FUNC_INFO << "Startup function does not exist, erasing. (" + << m_doc->startupFunction() << ")"; m_doc->setStartupFunction(Function::invalidId()); } } diff --git a/qmlui/audioeditor.cpp b/qmlui/audioeditor.cpp index 3ec3573676..17e2c7a696 100644 --- a/qmlui/audioeditor.cpp +++ b/qmlui/audioeditor.cpp @@ -54,7 +54,8 @@ void AudioEditor::setSourceFileName(QString sourceFileName) if (m_audio == nullptr || m_audio->getSourceFileName() == sourceFileName) return; - Tardis::instance()->enqueueAction(Tardis::AudioSetSource, m_audio->id(), m_audio->getSourceFileName(), sourceFileName); + Tardis::instance()->enqueueAction(Tardis::AudioSetSource, m_audio->id(), + m_audio->getSourceFileName(), sourceFileName); m_audio->setSourceFileName(sourceFileName); emit sourceFileNameChanged(sourceFileName); emit mediaInfoChanged(); @@ -102,7 +103,8 @@ void AudioEditor::setLooped(bool looped) { if (m_audio != nullptr) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_audio->id(), m_audio->runOrder(), + Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_audio->id(), + m_audio->runOrder(), looped ? Audio::Loop : Audio::SingleShot); if (looped) @@ -127,7 +129,8 @@ void AudioEditor::setVolume(qreal volume) if (m_audio == nullptr) return; - Tardis::instance()->enqueueAction(Tardis::AudioSetVolume, m_audio->id(), m_audio->volume(), volume / 100.0); + Tardis::instance()->enqueueAction(Tardis::AudioSetVolume, m_audio->id(), m_audio->volume(), + volume / 100.0); m_audio->setVolume(volume / 100); diff --git a/qmlui/chasereditor.cpp b/qmlui/chasereditor.cpp index 179430ea42..97191179d6 100644 --- a/qmlui/chasereditor.cpp +++ b/qmlui/chasereditor.cpp @@ -100,9 +100,9 @@ bool ChaserEditor::addFunctions(QVariantList idsList, int insertIndex) } m_chaser->addStep(step, insertIndex++); - Tardis::instance()->enqueueAction( - Tardis::ChaserAddStep, m_chaser->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::ChaserAddStep, m_chaser->id(), insertIndex - 1)); + Tardis::instance()->enqueueAction(Tardis::ChaserAddStep, m_chaser->id(), QVariant(), + Tardis::instance()->actionToByteArray( + Tardis::ChaserAddStep, m_chaser->id(), insertIndex - 1)); } updateStepsList(m_doc, m_chaser, m_stepsList); @@ -212,8 +212,8 @@ bool ChaserEditor::moveSteps(QVariantList indicesList, int insertIndex) updateStepsList(m_doc, m_chaser, m_stepsList); emit stepsListChanged(); - QQuickItem *chaserWidget = - qobject_cast(m_view->rootObject()->findChild("chaserEditorWidget")); + QQuickItem *chaserWidget = qobject_cast( + m_view->rootObject()->findChild("chaserEditorWidget")); for (int i = 0; i < indicesList.length(); i++) { @@ -238,7 +238,8 @@ bool ChaserEditor::duplicateSteps(QVariantList indicesList) Tardis::instance()->enqueueAction( Tardis::ChaserAddStep, m_chaser->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::ChaserAddStep, m_chaser->id(), m_chaser->stepsCount() - 1)); + Tardis::instance()->actionToByteArray(Tardis::ChaserAddStep, m_chaser->id(), + m_chaser->stepsCount() - 1)); } updateStepsList(m_doc, m_chaser, m_stepsList); @@ -269,7 +270,8 @@ void ChaserEditor::setPlaybackIndex(int playbackIndex) if (m_playbackIndex == playbackIndex) return; - if (m_chaser != nullptr && m_previewEnabled == false && m_chaser->type() == Function::SequenceType && playbackIndex >= 0) + if (m_chaser != nullptr && m_previewEnabled == false + && m_chaser->type() == Function::SequenceType && playbackIndex >= 0) { Sequence *sequence = qobject_cast(m_chaser); Scene *currScene = qobject_cast(m_doc->function(sequence->boundSceneID())); @@ -326,7 +328,8 @@ void ChaserEditor::deleteItems(QVariantList list) if (m_chaser == nullptr) return; - std::sort(list.begin(), list.end(), [](QVariant a, QVariant b) { return a.toUInt() < b.toUInt(); }); + std::sort(list.begin(), list.end(), + [](QVariant a, QVariant b) { return a.toUInt() < b.toUInt(); }); qDebug() << "Chaser delete list" << list; @@ -334,7 +337,8 @@ void ChaserEditor::deleteItems(QVariantList list) { Tardis::instance()->enqueueAction( Tardis::ChaserRemoveStep, m_chaser->id(), - Tardis::instance()->actionToByteArray(Tardis::ChaserRemoveStep, m_chaser->id(), list.last().toUInt()), + Tardis::instance()->actionToByteArray(Tardis::ChaserRemoveStep, m_chaser->id(), + list.last().toUInt()), QVariant()); m_chaser->removeStep(list.last().toInt()); @@ -445,7 +449,8 @@ void ChaserEditor::addStepToListModel(Doc *doc, Chaser *chaser, ListModel *steps stepsList->addDataMap(stepMap); } -void ChaserEditor::updateStepInListModel(Doc *doc, Chaser *chaser, ListModel *stepsList, ChaserStep *step, int index) +void ChaserEditor::updateStepInListModel(Doc *doc, Chaser *chaser, ListModel *stepsList, + ChaserStep *step, int index) { QVariantMap stepMap = stepDataMap(doc, chaser, step); QModelIndex idx = stepsList->index(index, 0, QModelIndex()); @@ -486,8 +491,9 @@ void ChaserEditor::setSelectedValue(Function::PropType type, QString param, uint { m_stepsList->setDataWithRole(idx, param, int(value)); - ChaserStep step = m_chaser->steps().at(int(i)); - uint duration = m_chaser->durationMode() == Chaser::Common ? m_chaser->duration() : step.duration; + ChaserStep step = m_chaser->steps().at(int(i)); + uint duration = + m_chaser->durationMode() == Chaser::Common ? m_chaser->duration() : step.duration; /* Now update also the Chaser step */ switch (type) @@ -513,9 +519,10 @@ void ChaserEditor::setSelectedValue(Function::PropType type, QString param, uint { UIntPair oldDuration(i, step.duration); step.duration = Function::speedAdd(step.fadeIn, step.hold); - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepDuration, m_chaser->id(), - QVariant::fromValue(oldDuration), - QVariant::fromValue(UIntPair(i, step.duration))); + Tardis::instance()->enqueueAction( + Tardis::ChaserSetStepDuration, m_chaser->id(), + QVariant::fromValue(oldDuration), + QVariant::fromValue(UIntPair(i, step.duration))); m_stepsList->setDataWithRole(idx, "duration", int(step.duration)); } } @@ -532,18 +539,19 @@ void ChaserEditor::setSelectedValue(Function::PropType type, QString param, uint { UIntPair oldFadeIn(i, step.fadeIn); step.fadeIn = Function::speedSubtract(duration, step.hold); - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepFadeIn, m_chaser->id(), - QVariant::fromValue(oldFadeIn), - QVariant::fromValue(UIntPair(i, step.fadeIn))); + Tardis::instance()->enqueueAction( + Tardis::ChaserSetStepFadeIn, m_chaser->id(), QVariant::fromValue(oldFadeIn), + QVariant::fromValue(UIntPair(i, step.fadeIn))); m_stepsList->setDataWithRole(idx, "fadeIn", int(step.hold)); } else { UIntPair oldDuration(i, step.duration); step.duration = Function::speedAdd(step.fadeIn, step.hold); - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepDuration, m_chaser->id(), - QVariant::fromValue(oldDuration), - QVariant::fromValue(UIntPair(i, step.duration))); + Tardis::instance()->enqueueAction( + Tardis::ChaserSetStepDuration, m_chaser->id(), + QVariant::fromValue(oldDuration), + QVariant::fromValue(UIntPair(i, step.duration))); m_stepsList->setDataWithRole(idx, "duration", int(step.duration)); } } @@ -627,15 +635,19 @@ void ChaserEditor::setTempoType(int tempoType) step.fadeOut = Function::beatsToTime(step.fadeOut, beatDuration); } - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepFadeIn, m_chaser->id(), QVariant::fromValue(oldFadeIn), + Tardis::instance()->enqueueAction(Tardis::ChaserSetStepFadeIn, m_chaser->id(), + QVariant::fromValue(oldFadeIn), QVariant::fromValue(UIntPair(index, step.fadeIn))); - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepHold, m_chaser->id(), QVariant::fromValue(oldHold), + Tardis::instance()->enqueueAction(Tardis::ChaserSetStepHold, m_chaser->id(), + QVariant::fromValue(oldHold), QVariant::fromValue(UIntPair(index, step.hold))); - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepFadeOut, m_chaser->id(), QVariant::fromValue(oldFadeOut), + Tardis::instance()->enqueueAction(Tardis::ChaserSetStepFadeOut, m_chaser->id(), + QVariant::fromValue(oldFadeOut), QVariant::fromValue(UIntPair(index, step.fadeOut))); step.duration = step.fadeIn + step.hold; - Tardis::instance()->enqueueAction(Tardis::ChaserSetStepDuration, m_chaser->id(), QVariant::fromValue(oldDuration), + Tardis::instance()->enqueueAction(Tardis::ChaserSetStepDuration, m_chaser->id(), + QVariant::fromValue(oldDuration), QVariant::fromValue(UIntPair(index, step.duration))); m_chaser->replaceStep(step, int(index)); @@ -718,7 +730,8 @@ void ChaserEditor::setStepSpeed(int index, int value, int type) { if (m_chaser->fadeInMode() == Chaser::Common) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_chaser->id(), m_chaser->fadeInSpeed(), value); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_chaser->id(), + m_chaser->fadeInSpeed(), value); m_chaser->setFadeInSpeed(value); setSelectedValue(Function::FadeIn, "fadeIn", uint(value), false); } @@ -731,7 +744,8 @@ void ChaserEditor::setStepSpeed(int index, int value, int type) case Function::Hold: if (m_chaser->durationMode() == Chaser::Common) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_chaser->id(), m_chaser->duration(), value); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_chaser->id(), + m_chaser->duration(), value); m_chaser->setDuration(value); setSelectedValue(Function::Duration, "hold", uint(value), false); setSelectedValue(Function::Duration, "duration", uint(value), false); @@ -744,8 +758,8 @@ void ChaserEditor::setStepSpeed(int index, int value, int type) case Function::FadeOut: if (m_chaser->fadeOutMode() == Chaser::Common) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_chaser->id(), m_chaser->fadeOutSpeed(), - value); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_chaser->id(), + m_chaser->fadeOutSpeed(), value); m_chaser->setFadeOutSpeed(value); setSelectedValue(Function::FadeOut, "fadeOut", uint(value), false); } @@ -757,7 +771,8 @@ void ChaserEditor::setStepSpeed(int index, int value, int type) case Function::Duration: if (m_chaser->durationMode() == Chaser::Common) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_chaser->id(), m_chaser->duration(), value); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_chaser->id(), + m_chaser->duration(), value); m_chaser->setDuration(value); setSelectedValue(Function::Duration, "duration", uint(value), false); } diff --git a/qmlui/chasereditor.h b/qmlui/chasereditor.h index 86d3cf81c2..89f29f4563 100644 --- a/qmlui/chasereditor.h +++ b/qmlui/chasereditor.h @@ -52,7 +52,8 @@ class ChaserEditor : public FunctionEditor static void updateStepsList(Doc *doc, Chaser *chaser, ListModel *stepsList); /** Static method to update the data of a specific step */ - static void updateStepInListModel(Doc *doc, Chaser *chaser, ListModel *stepsList, ChaserStep *step, int index); + static void updateStepInListModel(Doc *doc, Chaser *chaser, ListModel *stepsList, + ChaserStep *step, int index); /** Return the Chaser step list formatted as explained in m_stepsList */ QVariant stepsList() const; diff --git a/qmlui/collectioneditor.cpp b/qmlui/collectioneditor.cpp index 426489b8ac..492290d9a3 100644 --- a/qmlui/collectioneditor.cpp +++ b/qmlui/collectioneditor.cpp @@ -54,7 +54,8 @@ bool CollectionEditor::addFunction(quint32 fid, int insertIndex) { if (m_collection->addFunction(fid, insertIndex) == true) { - Tardis::instance()->enqueueAction(Tardis::CollectionAddFunction, m_collection->id(), QVariant(), + Tardis::instance()->enqueueAction(Tardis::CollectionAddFunction, m_collection->id(), + QVariant(), QVariant::fromValue(UIntPair(fid, insertIndex))); updateFunctionsList(); return true; @@ -71,7 +72,8 @@ bool CollectionEditor::moveFunction(quint32 fid, int newIndex) QList funcList = m_collection->functions(); Tardis::instance()->enqueueAction(Tardis::CollectionRemoveFunction, m_collection->id(), - QVariant::fromValue(UIntPair(fid, funcList.indexOf(fid))), QVariant()); + QVariant::fromValue(UIntPair(fid, funcList.indexOf(fid))), + QVariant()); m_collection->removeFunction(fid); m_collection->addFunction(fid, newIndex); Tardis::instance()->enqueueAction(Tardis::CollectionAddFunction, m_collection->id(), QVariant(), @@ -95,7 +97,8 @@ void CollectionEditor::deleteItems(QVariantList list) continue; Tardis::instance()->enqueueAction(Tardis::CollectionRemoveFunction, m_collection->id(), - QVariant::fromValue(UIntPair(funcList.at(idx), idx)), QVariant()); + QVariant::fromValue(UIntPair(funcList.at(idx), idx)), + QVariant()); m_collection->removeFunction(funcList.at(idx)); } updateFunctionsList(); diff --git a/qmlui/colorfilters.cpp b/qmlui/colorfilters.cpp index f9a2413b21..6772b670dd 100644 --- a/qmlui/colorfilters.cpp +++ b/qmlui/colorfilters.cpp @@ -82,7 +82,8 @@ QVariantList ColorFilters::filtersList() return list; } -void ColorFilters::addFilter(QString name, quint8 red, quint8 green, quint8 blue, quint8 white, quint8 amber, quint8 uv) +void ColorFilters::addFilter(QString name, quint8 red, quint8 green, quint8 blue, quint8 white, + quint8 amber, quint8 uv) { ColorInfo cInfo; @@ -97,7 +98,8 @@ void ColorFilters::addFilter(QString name, quint8 red, quint8 green, quint8 blue emit filtersListChanged(); } -void ColorFilters::changeFilterAt(int index, quint8 red, quint8 green, quint8 blue, quint8 white, quint8 amber, quint8 uv) +void ColorFilters::changeFilterAt(int index, quint8 red, quint8 green, quint8 blue, quint8 white, + quint8 amber, quint8 uv) { if (index < 0 || index >= m_filterList.count()) return; @@ -221,7 +223,8 @@ QFileDevice::FileError ColorFilters::loadXML(const QString &fileName) if (attrs.hasAttribute(KXMLColorFiltersWAUV)) cInfo.m_wauv = QColor(attrs.value(KXMLColorFiltersWAUV).toString()); - if (cInfo.m_name.isEmpty() == false && (cInfo.m_rgb.isValid() || cInfo.m_wauv.isValid())) + if (cInfo.m_name.isEmpty() == false + && (cInfo.m_rgb.isValid() || cInfo.m_wauv.isValid())) m_filterList.append(cInfo); doc->skipCurrentElement(); diff --git a/qmlui/colorfilters.h b/qmlui/colorfilters.h index ed6113cd02..d5e2d2027d 100644 --- a/qmlui/colorfilters.h +++ b/qmlui/colorfilters.h @@ -71,10 +71,12 @@ class ColorFilters : public QObject ********************************************************************/ public: /** Add a new color filter with the given $name */ - Q_INVOKABLE void addFilter(QString name, quint8 red, quint8 green, quint8 blue, quint8 white, quint8 amber, quint8 uv); + Q_INVOKABLE void addFilter(QString name, quint8 red, quint8 green, quint8 blue, quint8 white, + quint8 amber, quint8 uv); /** Modify an existing filter at $index position */ - Q_INVOKABLE void changeFilterAt(int index, quint8 red, quint8 green, quint8 blue, quint8 white, quint8 amber, quint8 uv); + Q_INVOKABLE void changeFilterAt(int index, quint8 red, quint8 green, quint8 blue, quint8 white, + quint8 amber, quint8 uv); /** Remove an existing filter at $index position */ Q_INVOKABLE void removeFilterAt(int index); diff --git a/qmlui/contextmanager.cpp b/qmlui/contextmanager.cpp index 4bf9140c1a..40652c9219 100644 --- a/qmlui/contextmanager.cpp +++ b/qmlui/contextmanager.cpp @@ -36,7 +36,8 @@ #include "app.h" #include "doc.h" -ContextManager::ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr, FunctionManager *funcMgr, QObject *parent) +ContextManager::ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr, + FunctionManager *funcMgr, QObject *parent) : QObject(parent) , m_view(view) , m_doc(doc) @@ -76,20 +77,26 @@ ContextManager::ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr registerContext(m_3DView); m_view->rootContext()->setContextProperty("View3D", m_3DView); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCChannel", "Can't create a QLCChannel!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCChannel", + "Can't create a QLCChannel!"); qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "MonitorProperties", "Can't create MonitorProperties!"); - connect(m_fixtureManager, &FixtureManager::newFixtureCreated, this, &ContextManager::slotNewFixtureCreated); - connect(m_fixtureManager, &FixtureManager::fixtureDeleted, this, &ContextManager::slotFixtureDeleted); - connect(m_fixtureManager, &FixtureManager::fixtureFlagsChanged, this, &ContextManager::slotFixtureFlagsChanged); + connect(m_fixtureManager, &FixtureManager::newFixtureCreated, this, + &ContextManager::slotNewFixtureCreated); + connect(m_fixtureManager, &FixtureManager::fixtureDeleted, this, + &ContextManager::slotFixtureDeleted); + connect(m_fixtureManager, &FixtureManager::fixtureFlagsChanged, this, + &ContextManager::slotFixtureFlagsChanged); - connect(m_fixtureManager, &FixtureManager::channelValueChanged, this, &ContextManager::slotChannelValueChanged); + connect(m_fixtureManager, &FixtureManager::channelValueChanged, this, + &ContextManager::slotChannelValueChanged); connect(m_fixtureManager, &FixtureManager::presetChanged, this, &ContextManager::slotPresetChanged); connect(m_doc->inputOutputMap(), SIGNAL(universeWritten(quint32, QByteArray)), this, SLOT(slotUniverseWritten(quint32, QByteArray))); - connect(m_functionManager, &FunctionManager::isEditingChanged, this, &ContextManager::slotFunctionEditingChanged); + connect(m_functionManager, &FunctionManager::isEditingChanged, this, + &ContextManager::slotFunctionEditingChanged); } ContextManager::~ContextManager() @@ -168,22 +175,26 @@ void ContextManager::reattachContext(QString name) if (name == "DMX" || name == "2D" || name == "3D" || name == "UNIGRID") { - QQuickItem *viewObj = - qobject_cast(m_view->rootObject()->findChild("fixturesAndFunctions")); + QQuickItem *viewObj = qobject_cast( + m_view->rootObject()->findChild("fixturesAndFunctions")); if (viewObj == nullptr) return; - QMetaObject::invokeMethod(viewObj, "enableContext", Q_ARG(QVariant, name), Q_ARG(QVariant, false)); + QMetaObject::invokeMethod(viewObj, "enableContext", Q_ARG(QVariant, name), + Q_ARG(QVariant, false)); } else if (name.startsWith("PAGE-")) { - QQuickItem *viewObj = qobject_cast(m_view->rootObject()->findChild("virtualConsole")); + QQuickItem *viewObj = qobject_cast( + m_view->rootObject()->findChild("virtualConsole")); if (viewObj == nullptr) return; - QMetaObject::invokeMethod(viewObj, "enableContext", Q_ARG(QVariant, name), Q_ARG(QVariant, false)); + QMetaObject::invokeMethod(viewObj, "enableContext", Q_ARG(QVariant, name), + Q_ARG(QVariant, false)); } else { - QMetaObject::invokeMethod(m_view->rootObject(), "enableContext", Q_ARG(QVariant, name), Q_ARG(QVariant, false)); + QMetaObject::invokeMethod(m_view->rootObject(), "enableContext", Q_ARG(QVariant, name), + Q_ARG(QVariant, false)); } } @@ -233,7 +244,8 @@ void ContextManager::setEnvironmentSize(QVector3D environmentSize) if (environmentSize == m_monProps->gridSize()) return; - Tardis::instance()->enqueueAction(Tardis::EnvironmentSetSize, 0, m_monProps->gridSize(), environmentSize); + Tardis::instance()->enqueueAction(Tardis::EnvironmentSetSize, 0, m_monProps->gridSize(), + environmentSize); m_monProps->setGridSize(environmentSize); if (m_2DView->isEnabled()) @@ -246,8 +258,9 @@ void ContextManager::setEnvironmentSize(QVector3D environmentSize) { quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); - quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); - m_3DView->updateFixturePosition(itemID, m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex)); + quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); + m_3DView->updateFixturePosition( + itemID, m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex)); } } } @@ -288,7 +301,8 @@ void ContextManager::setPositionPickPoint(QVector3D point) if (positionPicking() == false) return; - point = QVector3D(point.x() + m_monProps->gridSize().x() / 2, point.y(), point.z() + m_monProps->gridSize().z() / 2); + point = QVector3D(point.x() + m_monProps->gridSize().x() / 2, point.y(), + point.z() + m_monProps->gridSize().z() / 2); for (quint32 &itemID : m_selectedFixtures) { @@ -597,7 +611,8 @@ void ContextManager::setFixtureSelection(quint32 itemID, int headIndex, bool ena m_3DView->updateFixtureSelection(itemID, enable); } - QMultiHash channels = m_fixtureManager->getFixtureCapabilities(itemID, headIndex, enable); + QMultiHash channels = + m_fixtureManager->getFixtureCapabilities(itemID, headIndex, enable); if (channels.keys().isEmpty()) return; @@ -652,7 +667,7 @@ void ContextManager::resetFixtureSelection() { quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); - quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); + quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); setFixtureSelection(itemID, -1, false); } } @@ -687,7 +702,7 @@ void ContextManager::toggleFixturesSelection() { quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); - quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); + quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); setFixtureSelection(itemID, -1, selectAll); } } @@ -724,7 +739,8 @@ QVariantList ContextManager::selectedFixtureAddress() addresses.append(startAddr + i); } - std::sort(addresses.begin(), addresses.end(), [](QVariant a, QVariant b) { return a.toUInt() < b.toUInt(); }); + std::sort(addresses.begin(), addresses.end(), + [](QVariant a, QVariant b) { return a.toUInt() < b.toUInt(); }); return addresses; } @@ -759,7 +775,8 @@ void ContextManager::setFixturePosition(quint32 itemID, qreal x, qreal y, qreal QVector3D currPos = m_monProps->fixturePosition(fxID, headIndex, linkedIndex); QVector3D newPos(x, y, z); - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), QVariant(newPos)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), + QVariant(newPos)); m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos); if (m_2DView->isEnabled()) @@ -794,7 +811,8 @@ void ContextManager::setFixturesOffset(qreal x, qreal y) break; } - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), QVariant(newPos)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), + QVariant(newPos)); m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos); if (m_2DView->isEnabled()) m_2DView->updateFixturePosition(itemID, newPos); @@ -829,7 +847,8 @@ void ContextManager::setFixturesPosition(QVector3D position) quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); QVector3D currPos = m_monProps->fixturePosition(fxID, headIndex, linkedIndex); - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), QVariant(position)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), + QVariant(position)); // absolute position change m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, position); @@ -846,7 +865,8 @@ void ContextManager::setFixturesPosition(QVector3D position) quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); QVector3D currPos = m_monProps->fixturePosition(fxID, headIndex, linkedIndex); QVector3D newPos = currPos + position; - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), QVariant(newPos)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(currPos), + QVariant(newPos)); m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos); if (m_3DView->isEnabled()) @@ -884,7 +904,7 @@ void ContextManager::setFixturesAlignment(int alignment) quint32 firstFxID = FixtureUtils::itemFixtureID(m_selectedFixtures.first()); quint16 firstHeadIndex = FixtureUtils::itemHeadIndex(m_selectedFixtures.first()); quint16 firstLinkedIndex = FixtureUtils::itemLinkedIndex(m_selectedFixtures.first()); - QVector3D firstPos = m_monProps->fixturePosition(firstFxID, firstHeadIndex, firstLinkedIndex); + QVector3D firstPos = m_monProps->fixturePosition(firstFxID, firstHeadIndex, firstLinkedIndex); for (quint32 &itemID : m_selectedFixtures) { @@ -926,12 +946,14 @@ void ContextManager::setFixturesDistribution(int direction) quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); Fixture *fixture = m_doc->fixture(fxID); - QPointF fxPos = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), - m_monProps->fixturePosition(fxID, headIndex, linkedIndex)); - QSizeF fxRect = FixtureUtils::item2DDimension(fixture->fixtureMode(), m_monProps->pointOfView()); - qreal pos = direction == Qt::Horizontal ? fxPos.x() : fxPos.y(); - qreal size = direction == Qt::Horizontal ? fxRect.width() : fxRect.height(); - int i = 0; + QPointF fxPos = + FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), + m_monProps->fixturePosition(fxID, headIndex, linkedIndex)); + QSizeF fxRect = + FixtureUtils::item2DDimension(fixture->fixtureMode(), m_monProps->pointOfView()); + qreal pos = direction == Qt::Horizontal ? fxPos.x() : fxPos.y(); + qreal size = direction == Qt::Horizontal ? fxRect.width() : fxRect.height(); + int i = 0; // 1 fixturesSize += size; @@ -968,14 +990,15 @@ void ContextManager::setFixturesDistribution(int direction) for (int idx = 0; idx < sortedIDs.count(); idx++) { - quint32 itemID = sortedIDs[idx]; - quint32 fxID = FixtureUtils::itemFixtureID(itemID); - quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); - quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); - Fixture *fixture = m_doc->fixture(fxID); - QSizeF fxRect = FixtureUtils::item2DDimension(fixture->fixtureMode(), m_monProps->pointOfView()); - qreal size = direction == Qt::Horizontal ? fxRect.width() : fxRect.height(); - QVector3D fxPos = m_monProps->fixturePosition(fxID, headIndex, linkedIndex); + quint32 itemID = sortedIDs[idx]; + quint32 fxID = FixtureUtils::itemFixtureID(itemID); + quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); + quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); + Fixture *fixture = m_doc->fixture(fxID); + QSizeF fxRect = + FixtureUtils::item2DDimension(fixture->fixtureMode(), m_monProps->pointOfView()); + qreal size = direction == Qt::Horizontal ? fxRect.width() : fxRect.height(); + QVector3D fxPos = m_monProps->fixturePosition(fxID, headIndex, linkedIndex); // the first and last fixture don't need any adjustment if (idx > 0 && idx < sortedIDs.count() - 1) @@ -1176,14 +1199,16 @@ void ContextManager::getCurrentColors(QQuickItem *item) QVector rgbCh = fixture->rgbChannels(headIndex); if (rgbCh.size() == 3) { - itemRgbColor.setRgb(fixture->channelValueAt(rgbCh.at(0)), fixture->channelValueAt(rgbCh.at(1)), + itemRgbColor.setRgb(fixture->channelValueAt(rgbCh.at(0)), + fixture->channelValueAt(rgbCh.at(1)), fixture->channelValueAt(rgbCh.at(2))); } QVector cmyCh = fixture->cmyChannels(headIndex); if (cmyCh.size() == 3) { - itemRgbColor.setCmyk(fixture->channelValueAt(cmyCh.at(0)), fixture->channelValueAt(cmyCh.at(1)), + itemRgbColor.setCmyk(fixture->channelValueAt(cmyCh.at(0)), + fixture->channelValueAt(cmyCh.at(1)), fixture->channelValueAt(cmyCh.at(2)), 0); } @@ -1209,8 +1234,9 @@ void ContextManager::getCurrentColors(QQuickItem *item) wauvDiffCount++; } - QMetaObject::invokeMethod(item, "updateColors", Q_ARG(QVariant, rgbDiffCount ? false : true), Q_ARG(QVariant, rgbColor), - Q_ARG(QVariant, wauvDiffCount ? false : true), Q_ARG(QVariant, wauvColor)); + QMetaObject::invokeMethod(item, "updateColors", Q_ARG(QVariant, rgbDiffCount ? false : true), + Q_ARG(QVariant, rgbColor), Q_ARG(QVariant, wauvDiffCount ? false : true), + Q_ARG(QVariant, wauvColor)); } void ContextManager::createFixtureGroup() @@ -1261,7 +1287,7 @@ void ContextManager::setFixturesRotation(QVector3D degrees) quint32 fxID = FixtureUtils::itemFixtureID(itemID); quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); - QVector3D newRot = m_monProps->fixtureRotation(fxID, headIndex, linkedIndex) + degrees; + QVector3D newRot = m_monProps->fixtureRotation(fxID, headIndex, linkedIndex) + degrees; // normalize back to a 0-359 range if (newRot.x() < 0) @@ -1302,7 +1328,7 @@ void ContextManager::setFixtureGroupSelection(quint32 id, bool enable, bool isUn { quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); - quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); + quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); setFixtureSelection(itemID, -1, enable); } } diff --git a/qmlui/contextmanager.h b/qmlui/contextmanager.h index 12d784ce4a..ddcfb1e6a0 100644 --- a/qmlui/contextmanager.h +++ b/qmlui/contextmanager.h @@ -54,8 +54,8 @@ class ContextManager : public QObject Q_PROPERTY(bool positionPicking READ positionPicking WRITE setPositionPicking NOTIFY positionPickingChanged) public: - explicit ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr, FunctionManager *funcMgr, - QObject *parent = 0); + explicit ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr, + FunctionManager *funcMgr, QObject *parent = 0); ~ContextManager(); /** Register/Unregister a context to the map of known contexts */ @@ -173,7 +173,8 @@ public slots: Q_INVOKABLE void toggleFixturesSelection(); /** Select the fixtures that intersects the provided rectangle coordinates in a 2D environment */ - Q_INVOKABLE void setRectangleSelection(qreal x, qreal y, qreal width, qreal height, int keyModifiers); + Q_INVOKABLE void setRectangleSelection(qreal x, qreal y, qreal width, qreal height, + int keyModifiers); /** Returns a list of the selected fixture addresses */ Q_INVOKABLE QVariantList selectedFixtureAddress(); @@ -228,7 +229,8 @@ public slots: /** Select/Deselect all the fixtures of the Group/Universe with the provided $id */ Q_INVOKABLE void setFixtureGroupSelection(quint32 id, bool enable, bool isUniverse); - Q_INVOKABLE void setChannelValueByType(int type, int value, bool isRelative = false, quint32 channel = UINT_MAX); + Q_INVOKABLE void setChannelValueByType(int type, int value, bool isRelative = false, + quint32 channel = UINT_MAX); Q_INVOKABLE void setColorValue(QColor col, QColor wauv); diff --git a/qmlui/efxeditor.cpp b/qmlui/efxeditor.cpp index 22c76f6476..b93adc792d 100644 --- a/qmlui/efxeditor.cpp +++ b/qmlui/efxeditor.cpp @@ -131,7 +131,8 @@ void EFXEditor::setAlgorithmIndex(int algoIndex) if (m_efx == nullptr || algoIndex == m_efx->algorithm()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetAlgorithmIndex, m_efx->id(), m_efx->algorithm(), algoIndex); + Tardis::instance()->enqueueAction(Tardis::EFXSetAlgorithmIndex, m_efx->id(), m_efx->algorithm(), + algoIndex); m_efx->setAlgorithm(EFX::Algorithm(algoIndex)); emit algorithmIndexChanged(); updateAlgorithmData(); @@ -150,7 +151,8 @@ void EFXEditor::setIsRelative(bool relative) if (m_efx == nullptr || relative == m_efx->isRelative()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetRelative, m_efx->id(), m_efx->isRelative(), relative); + Tardis::instance()->enqueueAction(Tardis::EFXSetRelative, m_efx->id(), m_efx->isRelative(), + relative); m_efx->setIsRelative(relative); if (relative) @@ -194,7 +196,8 @@ void EFXEditor::setAlgorithmHeight(int algorithmHeight) if (m_efx == nullptr || algorithmHeight == m_efx->height()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetHeight, m_efx->id(), m_efx->height(), algorithmHeight); + Tardis::instance()->enqueueAction(Tardis::EFXSetHeight, m_efx->id(), m_efx->height(), + algorithmHeight); m_efx->setHeight(algorithmHeight); emit algorithmHeightChanged(); updateAlgorithmData(); @@ -213,7 +216,8 @@ void EFXEditor::setAlgorithmXOffset(int algorithmXOffset) if (m_efx == nullptr || algorithmXOffset == m_efx->xOffset()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetXOffset, m_efx->id(), m_efx->xOffset(), algorithmXOffset); + Tardis::instance()->enqueueAction(Tardis::EFXSetXOffset, m_efx->id(), m_efx->xOffset(), + algorithmXOffset); m_efx->setXOffset(algorithmXOffset); emit algorithmXOffsetChanged(); updateAlgorithmData(); @@ -232,7 +236,8 @@ void EFXEditor::setAlgorithmYOffset(int algorithmYOffset) if (m_efx == nullptr || algorithmYOffset == m_efx->yOffset()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetYOffset, m_efx->id(), m_efx->yOffset(), algorithmYOffset); + Tardis::instance()->enqueueAction(Tardis::EFXSetYOffset, m_efx->id(), m_efx->yOffset(), + algorithmYOffset); m_efx->setYOffset(algorithmYOffset); emit algorithmYOffsetChanged(); updateAlgorithmData(); @@ -251,7 +256,8 @@ void EFXEditor::setAlgorithmRotation(int algorithmRotation) if (m_efx == nullptr || algorithmRotation == m_efx->rotation()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetRotation, m_efx->id(), m_efx->rotation(), algorithmRotation); + Tardis::instance()->enqueueAction(Tardis::EFXSetRotation, m_efx->id(), m_efx->rotation(), + algorithmRotation); m_efx->setRotation(algorithmRotation); emit algorithmRotationChanged(); updateAlgorithmData(); @@ -270,7 +276,8 @@ void EFXEditor::setAlgorithmStartOffset(int algorithmStartOffset) if (m_efx == nullptr || algorithmStartOffset == m_efx->startOffset()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetStartOffset, m_efx->id(), m_efx->startOffset(), algorithmStartOffset); + Tardis::instance()->enqueueAction(Tardis::EFXSetStartOffset, m_efx->id(), m_efx->startOffset(), + algorithmStartOffset); m_efx->setStartOffset(algorithmStartOffset); emit algorithmStartOffsetChanged(); updateAlgorithmData(); @@ -289,7 +296,8 @@ void EFXEditor::setAlgorithmXFrequency(int algorithmXFrequency) if (m_efx == nullptr || algorithmXFrequency == m_efx->xFrequency()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetXFrequency, m_efx->id(), m_efx->xFrequency(), algorithmXFrequency); + Tardis::instance()->enqueueAction(Tardis::EFXSetXFrequency, m_efx->id(), m_efx->xFrequency(), + algorithmXFrequency); m_efx->setXFrequency(algorithmXFrequency); emit algorithmXFrequencyChanged(); updateAlgorithmData(); @@ -308,7 +316,8 @@ void EFXEditor::setAlgorithmYFrequency(int algorithmYFrequency) if (m_efx == nullptr || algorithmYFrequency == m_efx->yFrequency()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetYFrequency, m_efx->id(), m_efx->yFrequency(), algorithmYFrequency); + Tardis::instance()->enqueueAction(Tardis::EFXSetYFrequency, m_efx->id(), m_efx->yFrequency(), + algorithmYFrequency); m_efx->setYFrequency(algorithmYFrequency); emit algorithmYFrequencyChanged(); updateAlgorithmData(); @@ -327,7 +336,8 @@ void EFXEditor::setAlgorithmXPhase(int algorithmXPhase) if (m_efx == nullptr || algorithmXPhase == m_efx->xPhase()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetXPhase, m_efx->id(), m_efx->xPhase(), algorithmXPhase); + Tardis::instance()->enqueueAction(Tardis::EFXSetXPhase, m_efx->id(), m_efx->xPhase(), + algorithmXPhase); m_efx->setXPhase(algorithmXPhase); emit algorithmXPhaseChanged(); updateAlgorithmData(); @@ -346,7 +356,8 @@ void EFXEditor::setAlgorithmYPhase(int algorithmYPhase) if (m_efx == nullptr || algorithmYPhase == m_efx->yPhase()) return; - Tardis::instance()->enqueueAction(Tardis::EFXSetYPhase, m_efx->id(), m_efx->yPhase(), algorithmYPhase); + Tardis::instance()->enqueueAction(Tardis::EFXSetYPhase, m_efx->id(), m_efx->yPhase(), + algorithmYPhase); m_efx->setYPhase(algorithmYPhase); emit algorithmYPhaseChanged(); updateAlgorithmData(); @@ -413,7 +424,7 @@ void EFXEditor::addGroup(QVariant reference) for (int headIdx = 0; headIdx < fixture->heads(); headIdx++) { - quint32 panCh = fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB, headIdx); + quint32 panCh = fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB, headIdx); quint32 tiltCh = fixture->channelNumber(QLCChannel::Tilt, QLCChannel::MSB, headIdx); if (panCh != QLCChannel::invalid() || tiltCh != QLCChannel::invalid()) @@ -444,7 +455,7 @@ void EFXEditor::addGroup(QVariant reference) if (fixture == nullptr) continue; - quint32 panCh = fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB, head.head); + quint32 panCh = fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB, head.head); quint32 tiltCh = fixture->channelNumber(QLCChannel::Tilt, QLCChannel::MSB, head.head); if (panCh != QLCChannel::invalid() || tiltCh != QLCChannel::invalid()) @@ -495,9 +506,10 @@ void EFXEditor::addFixture(QVariant reference) } else { - Tardis::instance()->enqueueAction(Tardis::EFXAddFixture, m_efx->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), - QVariant::fromValue((void *)ef))); + Tardis::instance()->enqueueAction( + Tardis::EFXAddFixture, m_efx->id(), QVariant(), + Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), + QVariant::fromValue((void *)ef))); count++; } } @@ -523,7 +535,8 @@ void EFXEditor::addHead(int fixtureID, int headIndex) { Tardis::instance()->enqueueAction( Tardis::EFXAddFixture, m_efx->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), QVariant::fromValue((void *)ef))); + Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), + QVariant::fromValue((void *)ef))); updateFixtureList(); } } @@ -547,7 +560,8 @@ void EFXEditor::removeHeads(QVariantList heads) Tardis::instance()->enqueueAction( Tardis::EFXRemoveFixture, m_efx->id(), - Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), QVariant::fromValue((void *)ef)), + Tardis::instance()->actionToByteArray(Tardis::EFXAddFixture, m_efx->id(), + QVariant::fromValue((void *)ef)), QVariant()); m_efx->removeFixture(ef); @@ -615,10 +629,12 @@ void EFXEditor::updateFixtureList() if (fixture == nullptr || head.isValid() == false) continue; - if (fixture->fixtureMode() != nullptr && fixture->fixtureMode()->physical().focusPanMax() > m_maxPanDegrees) + if (fixture->fixtureMode() != nullptr + && fixture->fixtureMode()->physical().focusPanMax() > m_maxPanDegrees) m_maxPanDegrees = fixture->fixtureMode()->physical().focusPanMax(); - if (fixture->fixtureMode() != nullptr && fixture->fixtureMode()->physical().focusTiltMax() > m_maxTiltDegrees) + if (fixture->fixtureMode() != nullptr + && fixture->fixtureMode()->physical().focusTiltMax() > m_maxTiltDegrees) m_maxTiltDegrees = fixture->fixtureMode()->physical().focusTiltMax(); if (fixture->heads() > 1) diff --git a/qmlui/efxeditor.h b/qmlui/efxeditor.h index 435661e86b..bbf7b6e8cb 100644 --- a/qmlui/efxeditor.h +++ b/qmlui/efxeditor.h @@ -42,9 +42,12 @@ class EFXEditor : public FunctionEditor Q_PROPERTY(int algorithmXOffset READ algorithmXOffset WRITE setAlgorithmXOffset NOTIFY algorithmXOffsetChanged) Q_PROPERTY(int algorithmYOffset READ algorithmYOffset WRITE setAlgorithmYOffset NOTIFY algorithmYOffsetChanged) Q_PROPERTY(int algorithmRotation READ algorithmRotation WRITE setAlgorithmRotation NOTIFY algorithmRotationChanged) - Q_PROPERTY(int algorithmStartOffset READ algorithmStartOffset WRITE setAlgorithmStartOffset NOTIFY algorithmStartOffsetChanged) - Q_PROPERTY(int algorithmXFrequency READ algorithmXFrequency WRITE setAlgorithmXFrequency NOTIFY algorithmXFrequencyChanged) - Q_PROPERTY(int algorithmYFrequency READ algorithmYFrequency WRITE setAlgorithmYFrequency NOTIFY algorithmYFrequencyChanged) + Q_PROPERTY(int algorithmStartOffset READ algorithmStartOffset WRITE setAlgorithmStartOffset + NOTIFY algorithmStartOffsetChanged) + Q_PROPERTY(int algorithmXFrequency READ algorithmXFrequency WRITE setAlgorithmXFrequency NOTIFY + algorithmXFrequencyChanged) + Q_PROPERTY(int algorithmYFrequency READ algorithmYFrequency WRITE setAlgorithmYFrequency NOTIFY + algorithmYFrequencyChanged) Q_PROPERTY(int algorithmXPhase READ algorithmXPhase WRITE setAlgorithmXPhase NOTIFY algorithmXPhaseChanged) Q_PROPERTY(int algorithmYPhase READ algorithmYPhase WRITE setAlgorithmYPhase NOTIFY algorithmYPhaseChanged) diff --git a/qmlui/fixturebrowser.cpp b/qmlui/fixturebrowser.cpp index 3855e1287c..e4dab4c9e0 100644 --- a/qmlui/fixturebrowser.cpp +++ b/qmlui/fixturebrowser.cpp @@ -175,7 +175,8 @@ QString FixtureBrowser::selectedMode() const void FixtureBrowser::setSelectedMode(QString selectedMode) { - qDebug() << "[FixtureBrowser] Select mode for" << m_selectedManufacturer << m_selectedModel << selectedMode; + qDebug() << "[FixtureBrowser] Select mode for" << m_selectedManufacturer << m_selectedModel + << selectedMode; if (m_selectedMode == selectedMode) return; @@ -249,7 +250,8 @@ void FixtureBrowser::setManufacturerIndex(int index) int FixtureBrowser::availableChannel(quint32 uniIdx, int channels, int quantity, int gap, int requested) { - qDebug() << "[FixtureBrowser] uniIdx:" << uniIdx << ", channels:" << channels << ", requested:" << requested; + qDebug() << "[FixtureBrowser] uniIdx:" << uniIdx << ", channels:" << channels + << ", requested:" << requested; bool isAvailable = true; quint32 uniFilter = uniIdx == Universe::invalid() ? 0 : uniIdx; quint32 absAddress = (requested & 0x01FF) | (uniFilter << 9); @@ -272,7 +274,8 @@ int FixtureBrowser::availableChannel(quint32 uniIdx, int channels, int quantity, } else { - qDebug() << "[FixtureBrowser] Requested channel" << requested << "not available in universe" << uniFilter; + qDebug() << "[FixtureBrowser] Requested channel" << requested << "not available in universe" + << uniFilter; int validAddr = 0; int freeCounter = 0; absAddress = uniFilter << 9; @@ -376,7 +379,8 @@ void FixtureBrowser::updateSearchTree() for (QString model : modelsList) { - if (manufacturer.toLower().contains(m_searchFilter) || model.toLower().contains(m_searchFilter)) + if (manufacturer.toLower().contains(m_searchFilter) + || model.toLower().contains(m_searchFilter)) { QVariantList params; TreeModelItem *item = m_searchTree->addItem(model, params, manufacturer); diff --git a/qmlui/fixturebrowser.h b/qmlui/fixturebrowser.h index ebabd620bc..b9698ecc8d 100644 --- a/qmlui/fixturebrowser.h +++ b/qmlui/fixturebrowser.h @@ -33,7 +33,8 @@ class FixtureBrowser : public QObject Q_PROPERTY(QStringList manufacturers READ manufacturers CONSTANT) Q_PROPERTY(int manufacturerIndex READ manufacturerIndex WRITE setManufacturerIndex NOTIFY manufacturerIndexChanged) - Q_PROPERTY(QString selectedManufacturer READ selectedManufacturer WRITE setSelectedManufacturer NOTIFY selectedManufacturerChanged) + Q_PROPERTY(QString selectedManufacturer READ selectedManufacturer WRITE setSelectedManufacturer + NOTIFY selectedManufacturerChanged) Q_PROPERTY(QStringList modelsList READ modelsList NOTIFY modelsListChanged) Q_PROPERTY(QString selectedModel READ selectedModel WRITE setSelectedModel NOTIFY selectedModelChanged) diff --git a/qmlui/fixtureeditor/fixtureeditor.cpp b/qmlui/fixtureeditor/fixtureeditor.cpp index a25350d821..6a3a8f5298 100644 --- a/qmlui/fixtureeditor/fixtureeditor.cpp +++ b/qmlui/fixtureeditor/fixtureeditor.cpp @@ -40,10 +40,14 @@ FixtureEditor::FixtureEditor(QQuickView *view, Doc *doc, QObject *parent) , m_lastId(0) { m_view->rootContext()->setContextProperty("fixtureEditor", this); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "EditorRef", "Can't create EditorView!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "PhysicalEdit", "Can't create PhysicalEdit!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ChannelEdit", "Can't create ChannelEdit!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ModeEdit", "Can't create ModeEdit!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "EditorRef", + "Can't create EditorView!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "PhysicalEdit", + "Can't create PhysicalEdit!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ChannelEdit", + "Can't create ChannelEdit!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ModeEdit", + "Can't create ModeEdit!"); QSettings settings; QVariant dir = settings.value(SETTINGS_DEF_WORKINGPATH); diff --git a/qmlui/fixtureeditor/physicaledit.h b/qmlui/fixtureeditor/physicaledit.h index 774c820e4d..33ee74e8d0 100644 --- a/qmlui/fixtureeditor/physicaledit.h +++ b/qmlui/fixtureeditor/physicaledit.h @@ -30,7 +30,8 @@ class PhysicalEdit : public QObject Q_PROPERTY(QString bulbType READ bulbType WRITE setBulbType NOTIFY bulbTypeChanged) Q_PROPERTY(int bulbLumens READ bulbLumens WRITE setBulbLumens NOTIFY bulbLumensChanged) - Q_PROPERTY(int bulbColorTemperature READ bulbColorTemperature WRITE setBulbColorTemperature NOTIFY bulbColorTemperatureChanged) + Q_PROPERTY(int bulbColorTemperature READ bulbColorTemperature WRITE setBulbColorTemperature + NOTIFY bulbColorTemperatureChanged) Q_PROPERTY(double weight READ weight WRITE setWeight NOTIFY weightChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) diff --git a/qmlui/fixturegroupeditor.cpp b/qmlui/fixturegroupeditor.cpp index b4596eb554..16de5ed99f 100644 --- a/qmlui/fixturegroupeditor.cpp +++ b/qmlui/fixturegroupeditor.cpp @@ -337,7 +337,8 @@ void FixtureGroupEditor::deleteSelection() Fixture *fixture = m_doc->fixture(gHead.fxi); if (fixture != nullptr && fixture->heads() == 1) { - QString fxPath = QString("%1%2%3").arg(m_editGroup->name()).arg(TreeModel::separator()).arg(fixture->name()); + QString fxPath = + QString("%1%2%3").arg(m_editGroup->name()).arg(TreeModel::separator()).arg(fixture->name()); quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), gHead.head, 0); m_fixtureManager->deleteFixtureInGroup(m_editGroup->id(), itemID, fxPath); } @@ -417,7 +418,8 @@ void FixtureGroupEditor::transformSelection(int transformation) { QPoint point = pointsList.at(i); matrix.setPixel(point.x() - minX, point.y() - minY, QRgb(i + 1)); - // qDebug() << "set pixel" << (point.x() - minX) << (point.y() - minY) << m_groupSelection.at(i).toUInt(); + // qDebug() << "set pixel" << (point.x() - minX) << (point.y() - minY) << + // m_groupSelection.at(i).toUInt(); } /** Perform the requested transformation ! */ @@ -519,8 +521,11 @@ void FixtureGroupEditor::updateGroupMap() m_groupMap.append(0); // isOdd m_groupMap.append(fx->type()); // item type - QString str = - QString("%1\nH:%2 A:%3 U:%4").arg(fx->name()).arg(head.head + 1).arg(fx->address() + 1).arg(fx->universe() + 1); + QString str = QString("%1\nH:%2 A:%3 U:%4") + .arg(fx->name()) + .arg(head.head + 1) + .arg(fx->address() + 1) + .arg(fx->universe() + 1); m_groupLabels.append(head.fxi); // item ID m_groupLabels.append((gridWidth * y) + x); // absolute index m_groupLabels.append(1); // width diff --git a/qmlui/fixturemanager.cpp b/qmlui/fixturemanager.cpp index 1d9732b42e..8ca27de0d3 100644 --- a/qmlui/fixturemanager.cpp +++ b/qmlui/fixturemanager.cpp @@ -66,8 +66,10 @@ FixtureManager::FixtureManager(QQuickView *view, Doc *doc, QObject *parent) m_view->rootContext()->setContextProperty("fixtureManager", this); qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "FixtureManager", "Can't create a FixtureManager!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCCapability", "Can't create a QLCCapability!"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ColorFilters", "Can't create a ColorFilters!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCCapability", + "Can't create a QLCCapability!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "ColorFilters", + "Can't create a ColorFilters!"); connect(m_doc, SIGNAL(loaded()), this, SLOT(slotDocLoaded())); connect(m_doc, SIGNAL(fixtureAdded(quint32)), this, SLOT(slotFixtureAdded(quint32))); @@ -154,8 +156,11 @@ QVariantList FixtureManager::universeInfo(quint32 id) fxMap.insert("classRef", QVariant::fromValue(fixture)); fxMap.insert("manuf", fixture->fixtureDef() ? fixture->fixtureDef()->manufacturer() : ""); fxMap.insert("fmodel", fixture->fixtureDef() ? fixture->fixtureDef()->model() : ""); - fxMap.insert("weight", fixture->fixtureMode() ? fixture->fixtureMode()->physical().weight() : 0); - fxMap.insert("power", fixture->fixtureMode() ? fixture->fixtureMode()->physical().powerConsumption() : 0); + fxMap.insert("weight", + fixture->fixtureMode() ? fixture->fixtureMode()->physical().weight() : 0); + fxMap.insert("power", fixture->fixtureMode() + ? fixture->fixtureMode()->physical().powerConsumption() + : 0); m_universeInfo.append(fxMap); } } @@ -255,8 +260,9 @@ quint32 FixtureManager::fixtureForAddress(quint32 universeAddress) return m_doc->fixtureForAddress(universeAddress); } -bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QString name, int uniIdx, int address, - int channels, int quantity, quint32 gap, qreal xPos, qreal yPos) +bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QString name, + int uniIdx, int address, int channels, int quantity, quint32 gap, + qreal xPos, qreal yPos) { qDebug() << "[addFixture]" << manuf << model << name << address << channels << quantity << gap; @@ -277,7 +283,8 @@ bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QStr if (fxAddress + channels >= UNIVERSE_SIZE) { uniIdx++; - if (m_doc->inputOutputMap()->getUniverseID(uniIdx) == m_doc->inputOutputMap()->invalidUniverse()) + if (m_doc->inputOutputMap()->getUniverseID(uniIdx) + == m_doc->inputOutputMap()->invalidUniverse()) { m_doc->inputOutputMap()->addUniverse(); m_doc->inputOutputMap()->startUniverses(); @@ -311,8 +318,9 @@ bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QStr if (m_doc->addFixture(fxi) == true) { - Tardis::instance()->enqueueAction(Tardis::FixtureCreate, fxi->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::FixtureCreate, fxi->id())); + Tardis::instance()->enqueueAction( + Tardis::FixtureCreate, fxi->id(), QVariant(), + Tardis::instance()->actionToByteArray(Tardis::FixtureCreate, fxi->id())); slotFixtureAdded(fxi->id(), QVector3D(xPos, yPos, 0)); } @@ -329,7 +337,8 @@ bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QStr bool FixtureManager::moveFixture(quint32 fixtureID, quint32 newAddress) { - qDebug() << "[FixtureManager] requested to move fixture with ID" << fixtureID << "to address" << newAddress; + qDebug() << "[FixtureManager] requested to move fixture with ID" << fixtureID << "to address" + << newAddress; Fixture *fixture = m_doc->fixture(fixtureID); if (fixture == nullptr) return false; @@ -353,11 +362,13 @@ bool FixtureManager::deleteFixtures(QVariantList IDList) quint16 headIndex = FixtureUtils::itemHeadIndex(itemID); quint16 linkedIndex = FixtureUtils::itemLinkedIndex(itemID); - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, - QVariant(m_monProps->fixturePosition(fxID, headIndex, linkedIndex)), QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FixtureSetPosition, itemID, + QVariant(m_monProps->fixturePosition(fxID, headIndex, linkedIndex)), QVariant()); m_monProps->removeFixture(fxID, headIndex, linkedIndex); - Tardis::instance()->enqueueAction(Tardis::FixtureDelete, itemID, - Tardis::instance()->actionToByteArray(Tardis::FixtureDelete, fxID), QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FixtureDelete, itemID, + Tardis::instance()->actionToByteArray(Tardis::FixtureDelete, fxID), QVariant()); m_doc->deleteFixture(fxID); emit fixtureDeleted(itemID); } @@ -444,7 +455,8 @@ void FixtureManager::setPropertyEditEnabled(bool enable) if (enable) { - m_treeShowFlags = ShowChannels | ShowLinked | ShowFlags | ShowCanFade | ShowPrecedence | ShowModifier; + m_treeShowFlags = + ShowChannels | ShowLinked | ShowFlags | ShowCanFade | ShowPrecedence | ShowModifier; treeColumns << "flags" << "canFade" << "precedence" @@ -533,7 +545,8 @@ void FixtureManager::setItemRoleData(int itemID, int index, QString role, QVaria if (index == -1) { // change happened on a fixture node - path = QString("%1%2%3").arg(uniNames.at(fixture->universe())).arg(TreeModel::separator()).arg(fxName); + path = + QString("%1%2%3").arg(uniNames.at(fixture->universe())).arg(TreeModel::separator()).arg(fxName); } else { @@ -555,8 +568,9 @@ bool FixtureManager::compareFixtures(Fixture *left, Fixture *right) return *left < *right; } -void FixtureManager::addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fixture, QString basePath, quint32 nodeSubID, - int &matchMask, QString searchFilter, int showFlags, QList checkedChannels) +void FixtureManager::addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fixture, QString basePath, + quint32 nodeSubID, int &matchMask, QString searchFilter, + int showFlags, QList checkedChannels) { if (doc == nullptr || treeModel == nullptr || fixture == nullptr) return; @@ -613,8 +627,9 @@ void FixtureManager::addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fix headParams.append(nodeSubID); // subid headParams.append(headIdx); // chIdx headParams.append(false); // inGroup - treeModel->addItem(QString("%1 %2").arg(tr("Head")).arg(headIdx + 1, 3, 10, QChar('0')), headParams, - fxPath); + treeModel->addItem( + QString("%1 %2").arg(tr("Head")).arg(headIdx + 1, 3, 10, QChar('0')), + headParams, fxPath); } } } @@ -701,8 +716,9 @@ void FixtureManager::addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fix } } -void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, FixtureGroup *group, QString searchFilter, - int showFlags, QList checkedChannels) +void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, FixtureGroup *group, + QString searchFilter, int showFlags, + QList checkedChannels) { int matchMask = 0; QList fixtureIDList; @@ -723,8 +739,8 @@ void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, Fix int fxMatchMask = 0; - addFixtureNode(doc, treeModel, fixture, group->name(), group->id(), fxMatchMask, searchFilter, showFlags, - checkedChannels); + addFixtureNode(doc, treeModel, fixture, group->name(), group->id(), fxMatchMask, + searchFilter, showFlags, checkedChannels); if (fxMatchMask) matchMask |= FixtureMatch; } @@ -737,10 +753,12 @@ void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, Fix if (fixture == nullptr) continue; - if (searchFilter.length() >= SEARCH_MIN_CHARS && fixture->name().toLower().contains(searchFilter) == false) + if (searchFilter.length() >= SEARCH_MIN_CHARS + && fixture->name().toLower().contains(searchFilter) == false) continue; - QString fxPath = QString("%1%2%3").arg(group->name()).arg(TreeModel::separator()).arg(fixture->name()); + QString fxPath = + QString("%1%2%3").arg(group->name()).arg(TreeModel::separator()).arg(fixture->name()); quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), head.head, 0); QVariantList headParams; @@ -750,7 +768,8 @@ void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, Fix headParams.append(group->id()); // subid headParams.append(head.head); // chIdx headParams.append(true); // inGroup - treeModel->addItem(QString("%1 %2").arg(tr("Head")).arg(head.head + 1, 3, 10, QChar('0')), headParams, fxPath); + treeModel->addItem(QString("%1 %2").arg(tr("Head")).arg(head.head + 1, 3, 10, QChar('0')), + headParams, fxPath); if (fixtureIDList.contains(head.fxi) == false) { @@ -783,8 +802,8 @@ void FixtureManager::addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, Fix } } -void FixtureManager::updateGroupsTree(Doc *doc, TreeModel *treeModel, QString searchFilter, int showFlags, - QList checkedChannels) +void FixtureManager::updateGroupsTree(Doc *doc, TreeModel *treeModel, QString searchFilter, + int showFlags, QList checkedChannels) { if (doc == nullptr || treeModel == nullptr) return; @@ -818,8 +837,8 @@ void FixtureManager::updateGroupsTree(Doc *doc, TreeModel *treeModel, QString se QString universeName = uniNames.at(fixture->universe()); int matchMask = 0; - addFixtureNode(doc, treeModel, fixture, universeName, fixture->universe(), matchMask, searchFilter, showFlags, - checkedChannels); + addFixtureNode(doc, treeModel, fixture, universeName, fixture->universe(), matchMask, + searchFilter, showFlags, checkedChannels); } for (Universe *universe : doc->inputOutputMap()->universes()) @@ -1077,8 +1096,9 @@ void FixtureManager::addFixturesToNewGroup(QList fxList) for (quint32 id : fxList) group->assignFixture(id); - Tardis::instance()->enqueueAction(Tardis::FixtureGroupCreate, group->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::FixtureGroupCreate, group->id())); + Tardis::instance()->enqueueAction( + Tardis::FixtureGroupCreate, group->id(), QVariant(), + Tardis::instance()->actionToByteArray(Tardis::FixtureGroupCreate, group->id())); addFixtureGroupTreeNode(m_doc, m_fixtureTree, group, m_searchFilter); } @@ -1105,7 +1125,8 @@ void FixtureManager::updateFixtureGroup(quint32 groupID, quint32 itemID, int hea headsList << i; } - QString fxPath = QString("%1%2%3").arg(group->name()).arg(TreeModel::separator()).arg(fixture->name()); + QString fxPath = + QString("%1%2%3").arg(group->name()).arg(TreeModel::separator()).arg(fixture->name()); TreeModelItem *fxItem = m_fixtureTree->itemAtPath(fxPath); if (fxItem == nullptr) @@ -1130,7 +1151,8 @@ void FixtureManager::updateFixtureGroup(quint32 groupID, quint32 itemID, int hea headParams.append(group->id()); // subid headParams.append(hIdx); // chIdx headParams.append(true); // inGroup - m_fixtureTree->addItem(QString("%1 %2").arg(tr("Head")).arg(hIdx + 1, 3, 10, QChar('0')), headParams, fxPath); + m_fixtureTree->addItem(QString("%1 %2").arg(tr("Head")).arg(hIdx + 1, 3, 10, QChar('0')), + headParams, fxPath); } // m_fixtureTree->printTree(); // enable for debug purposes @@ -1153,9 +1175,9 @@ bool FixtureManager::deleteFixtureGroups(QVariantList IDList) for (QVariant id : IDList) { quint32 groupID = id.toUInt(); - Tardis::instance()->enqueueAction(Tardis::FixtureGroupDelete, groupID, - Tardis::instance()->actionToByteArray(Tardis::FixtureGroupDelete, groupID), - QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FixtureGroupDelete, groupID, + Tardis::instance()->actionToByteArray(Tardis::FixtureGroupDelete, groupID), QVariant()); m_doc->deleteFixtureGroup(groupID); } updateGroupsTree(m_doc, m_fixtureTree, m_searchFilter); @@ -1180,7 +1202,8 @@ void FixtureManager::slotFixtureGroupAdded(quint32 id) bool FixtureManager::addRGBPanel(QString name, qreal xPos, qreal yPos) { - QQuickItem *propItem = qobject_cast(m_view->rootObject()->findChild("RGBPanelProps")); + QQuickItem *propItem = + qobject_cast(m_view->rootObject()->findChild("RGBPanelProps")); if (propItem == nullptr) return false; @@ -1192,9 +1215,9 @@ bool FixtureManager::addRGBPanel(QString name, qreal xPos, qreal yPos) int phyWidth = propItem->property("physicalWidth").toInt(); qreal phyHeight = propItem->property("physicalHeight").toReal() / (qreal)rows; - Fixture::Components components = Fixture::Components(propItem->property("components").toInt()); - PanelDirection direction = PanelDirection(propItem->property("direction").toInt()); - PanelOrientation orientation = PanelOrientation(propItem->property("startCorner").toInt()); + Fixture::Components components = Fixture::Components(propItem->property("components").toInt()); + PanelDirection direction = PanelDirection(propItem->property("direction").toInt()); + PanelOrientation orientation = PanelOrientation(propItem->property("startCorner").toInt()); PanelType displacement = PanelType(propItem->property("displacement").toInt()); FixtureGroup *grp = new FixtureGroup(m_doc); @@ -1268,7 +1291,8 @@ bool FixtureManager::addRGBPanel(QString name, qreal xPos, qreal yPos) if (address + fxi->channels() > 512) { uniIndex++; - if (m_doc->inputOutputMap()->getUniverseID(uniIndex) == m_doc->inputOutputMap()->invalidUniverse()) + if (m_doc->inputOutputMap()->getUniverseID(uniIndex) + == m_doc->inputOutputMap()->invalidUniverse()) { m_doc->inputOutputMap()->addUniverse(); m_doc->inputOutputMap()->startUniverses(); @@ -1673,7 +1697,8 @@ void FixtureManager::setChannelValue(quint32 fixtureID, quint32 channelIndex, qu void FixtureManager::setPresetValue(quint32 fixtureID, int chIndex, quint8 value) { - qDebug() << "[FixtureManager] setPresetValue - fixture:" << fixtureID << ", channel:" << chIndex << "value:" << value; + qDebug() << "[FixtureManager] setPresetValue - fixture:" << fixtureID << ", channel:" << chIndex + << "value:" << value; Fixture *fixture = m_doc->fixture(fixtureID); if (fixture == nullptr || fixture->fixtureMode() == nullptr) @@ -1688,7 +1713,8 @@ void FixtureManager::updateCapabilityCounter(bool update, QString capName, int d if (update == false) return; - QQuickItem *capItem = qobject_cast(m_view->rootObject()->findChild(capName)); + QQuickItem *capItem = + qobject_cast(m_view->rootObject()->findChild(capName)); if (capItem != nullptr) { int count = capItem->property("counter").toInt() + delta; @@ -1705,19 +1731,22 @@ void FixtureManager::updateCapabilityCounter(bool update, QString capName, int d else if (capName == "capBeam") { QMetaObject::invokeMethod(capItem, "setZoomRange", Q_ARG(QVariant, m_minBeamDegrees), - Q_ARG(QVariant, m_maxBeamDegrees), Q_ARG(QVariant, m_invertedZoom)); + Q_ARG(QVariant, m_maxBeamDegrees), + Q_ARG(QVariant, m_invertedZoom)); } } } void FixtureManager::setCapabilityCounter(QString capName, int value) { - QQuickItem *capItem = qobject_cast(m_view->rootObject()->findChild(capName)); + QQuickItem *capItem = + qobject_cast(m_view->rootObject()->findChild(capName)); if (capItem) capItem->setProperty("counter", value); } -QMultiHash FixtureManager::getFixtureCapabilities(quint32 itemID, int headIndex, bool enable) +QMultiHash FixtureManager::getFixtureCapabilities(quint32 itemID, int headIndex, + bool enable) { int capDelta = enable ? 1 : -1; bool hasDimmer = false, hasColor = false, hasPosition = false; @@ -1873,7 +1902,8 @@ QMultiHash FixtureManager::getFixtureCapabilities(quint32 itemI break; case QLCChannel::Beam: { - if (channel->preset() != QLCChannel::BeamZoomBigSmall && channel->preset() != QLCChannel::BeamZoomSmallBig + if (channel->preset() != QLCChannel::BeamZoomBigSmall + && channel->preset() != QLCChannel::BeamZoomSmallBig && channel->preset() != QLCChannel::BeamZoomFine) break; @@ -2047,7 +2077,8 @@ QVariantList FixtureManager::presetCapabilities(quint32 fixtureID, int chIndex) if (fixture == nullptr || fixture->fixtureMode() == nullptr) return var; - qDebug() << "[FixtureManager] Requesting presets for fixture" << fixtureID << ", channel:" << chIndex; + qDebug() << "[FixtureManager] Requesting presets for fixture" << fixtureID + << ", channel:" << chIndex; const QLCChannel *ch = fixture->fixtureMode()->channel(chIndex); @@ -2133,14 +2164,16 @@ void FixtureManager::showModifierEditor(quint32 itemID, quint32 channelIndex) ChannelModifier *cm = fixture->channelModifier(channelIndex); - QQuickItem *fgmItem = qobject_cast(m_view->rootObject()->findChild("fixtureGroupManager")); + QQuickItem *fgmItem = qobject_cast( + m_view->rootObject()->findChild("fixtureGroupManager")); if (fgmItem == nullptr) return; selectChannelModifier(cm == nullptr ? "" : cm->name()); QMetaObject::invokeMethod(fgmItem, "showChannelModifierEditor", Q_ARG(QVariant, itemID), - Q_ARG(QVariant, channelIndex), Q_ARG(QVariant, cm == nullptr ? "" : cm->name())); + Q_ARG(QVariant, channelIndex), + Q_ARG(QVariant, cm == nullptr ? "" : cm->name())); } QVariantList FixtureManager::channelModifierValues() const diff --git a/qmlui/fixturemanager.h b/qmlui/fixturemanager.h index 671ce80fa5..7ea8d25dcc 100644 --- a/qmlui/fixturemanager.h +++ b/qmlui/fixturemanager.h @@ -48,7 +48,8 @@ class FixtureManager : public QObject Q_PROPERTY(quint32 universeFilter READ universeFilter WRITE setUniverseFilter NOTIFY universeFilterChanged) Q_PROPERTY(QString searchFilter READ searchFilter WRITE setSearchFilter NOTIFY searchFilterChanged) Q_PROPERTY(quint32 itemID READ itemID WRITE setItemID NOTIFY itemIDChanged) - Q_PROPERTY(bool propertyEditEnabled READ propertyEditEnabled WRITE setPropertyEditEnabled NOTIFY propertyEditEnabledChanged) + Q_PROPERTY(bool propertyEditEnabled READ propertyEditEnabled WRITE setPropertyEditEnabled NOTIFY + propertyEditEnabledChanged) Q_PROPERTY(QVariantList goboChannels READ goboChannels NOTIFY goboChannelsChanged) Q_PROPERTY(QVariantList colorWheelChannels READ colorWheelChannels NOTIFY colorWheelChannelsChanged) @@ -56,7 +57,8 @@ class FixtureManager : public QObject Q_PROPERTY(int colorsMask READ colorsMask NOTIFY colorsMaskChanged) Q_PROPERTY(QStringList colorFiltersFileList READ colorFiltersFileList NOTIFY colorFiltersFileListChanged) - Q_PROPERTY(int colorFilterFileIndex READ colorFilterFileIndex WRITE setColorFilterFileIndex NOTIFY colorFilterFileIndexChanged) + Q_PROPERTY(int colorFilterFileIndex READ colorFilterFileIndex WRITE setColorFilterFileIndex + NOTIFY colorFilterFileIndexChanged) Q_PROPERTY(ColorFilters *selectedFilters READ selectedFilters NOTIFY selectedFiltersChanged) Q_PROPERTY(QStringList channelModifiersList READ channelModifiersList NOTIFY channelModifiersListChanged) @@ -157,8 +159,9 @@ public slots: /** Returns the Fixture ID at the provided $universeAddress */ Q_INVOKABLE quint32 fixtureForAddress(quint32 universeAddress); - Q_INVOKABLE bool addFixture(QString manuf, QString model, QString mode, QString name, int uniIdx, int address, - int channels, int quantity, quint32 gap, qreal xPos, qreal yPos); + Q_INVOKABLE bool addFixture(QString manuf, QString model, QString mode, QString name, + int uniIdx, int address, int channels, int quantity, quint32 gap, + qreal xPos, qreal yPos); /** Move the Fixture with the provided $fixtureID to the requested universe address. * Returns true on success, false on error */ @@ -184,19 +187,19 @@ public slots: Q_INVOKABLE void setItemRoleData(int itemID, int index, QString role, QVariant value); - static void addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fixture, QString basePath, quint32 nodeSubID, - int &matchMask, QString searchFilter = QString(), - int showFlags = ShowGroups | ShowLinked | ShowHeads, + static void addFixtureNode(Doc *doc, TreeModel *treeModel, Fixture *fixture, QString basePath, + quint32 nodeSubID, int &matchMask, QString searchFilter = QString(), + int showFlags = ShowGroups | ShowLinked | ShowHeads, QList checkedChannels = QList()); static void addFixtureGroupTreeNode(Doc *doc, TreeModel *treeModel, FixtureGroup *group, - QString searchFilter = QString(), - int showFlags = ShowGroups | ShowLinked | ShowHeads, + QString searchFilter = QString(), + int showFlags = ShowGroups | ShowLinked | ShowHeads, QList checkedChannels = QList()); /** Update the tree of groups/fixtures/channels */ static void updateGroupsTree(Doc *doc, TreeModel *treeModel, QString searchFilter = QString(), - int showFlags = ShowGroups | ShowLinked | ShowHeads, + int showFlags = ShowGroups | ShowLinked | ShowHeads, QList checkedChannels = QList()); /** Return the type as string of the Fixture with ID $fixtureID */ diff --git a/qmlui/fixtureutils.cpp b/qmlui/fixtureutils.cpp index 59d0ae50b7..ab8fb3532e 100644 --- a/qmlui/fixtureutils.cpp +++ b/qmlui/fixtureutils.cpp @@ -53,8 +53,8 @@ quint32 FixtureUtils::fixtureItemID(quint32 fid, quint16 headIndex, quint16 link Q_ASSERT(headIndex < MAX_HEADS_NUMBER); Q_ASSERT(linkedIndex < MAX_LINKED_NUMBER); - return (fid << (FIXTURE_HEAD_BITS + FIXTURE_LINKED_BITS)) | ((quint32)headIndex << FIXTURE_LINKED_BITS) - | (quint32)linkedIndex; + return (fid << (FIXTURE_HEAD_BITS + FIXTURE_LINKED_BITS)) + | ((quint32)headIndex << FIXTURE_LINKED_BITS) | (quint32)linkedIndex; } quint32 FixtureUtils::itemFixtureID(quint32 itemID) @@ -270,12 +270,14 @@ QPointF FixtureUtils::available2DPosition(Doc *doc, int pointOfView, QRectF fxRe quint16 headIndex = monProps->fixtureHeadIndex(subID); quint16 linkedIndex = monProps->fixtureLinkedIndex(subID); QPointF fxPoint = - item2DPosition(monProps, pointOfView, monProps->fixturePosition(fixture->id(), headIndex, linkedIndex)); - QSizeF fxSize = item2DDimension(fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, pointOfView); - qreal itemXPos = fxPoint.x(); - qreal itemYPos = fxPoint.y(); - qreal itemWidth = fxSize.width(); - qreal itemHeight = fxSize.height(); + item2DPosition(monProps, pointOfView, + monProps->fixturePosition(fixture->id(), headIndex, linkedIndex)); + QSizeF fxSize = item2DDimension( + fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, pointOfView); + qreal itemXPos = fxPoint.x(); + qreal itemYPos = fxPoint.y(); + qreal itemWidth = fxSize.width(); + qreal itemHeight = fxSize.height(); // store the next Y row in case we need to lower down if (itemYPos + itemHeight > maxYOffset) @@ -314,11 +316,11 @@ QColor FixtureUtils::blendColors(QColor a, QColor b, float mix) qreal mb = b.blueF() * mix + a.blueF() * (1 - mix); /* - // non linear blending - qreal mr = qSqrt((1 - mix) * qPow(a.redF(), 2) + mix * qPow(b.redF(), 2)); - qreal mg = qSqrt((1 - mix) * qPow(a.greenF(), 2) + mix * qPow(b.greenF(), 2)); - qreal mb = qSqrt((1 - mix) * qPow(a.blueF(), 2) + mix * qPow(b.blueF(), 2)); - */ + // non linear blending + qreal mr = qSqrt((1 - mix) * qPow(a.redF(), 2) + mix * qPow(b.redF(), 2)); + qreal mg = qSqrt((1 - mix) * qPow(a.greenF(), 2) + mix * qPow(b.greenF(), 2)); + qreal mb = qSqrt((1 - mix) * qPow(a.blueF(), 2) + mix * qPow(b.blueF(), 2)); +*/ return QColor(mr * 255.0, mg * 255.0, mb * 255.0); } @@ -350,16 +352,20 @@ QColor FixtureUtils::headColor(Fixture *fixture, int headIndex) finalColor = blendColors(finalColor, Qt::white, (float)fixture->channelValueAt(white) / 255.0); if (amber != QLCChannel::invalid() && fixture->channelValueAt(amber)) - finalColor = blendColors(finalColor, QColor(0xFFFF7E00), (float)fixture->channelValueAt(amber) / 255.0); + finalColor = blendColors(finalColor, QColor(0xFFFF7E00), + (float)fixture->channelValueAt(amber) / 255.0); if (UV != QLCChannel::invalid() && fixture->channelValueAt(UV)) - finalColor = blendColors(finalColor, QColor(0xFF9400D3), (float)fixture->channelValueAt(UV) / 255.0); + finalColor = + blendColors(finalColor, QColor(0xFF9400D3), (float)fixture->channelValueAt(UV) / 255.0); if (lime != QLCChannel::invalid() && fixture->channelValueAt(lime)) - finalColor = blendColors(finalColor, QColor(0xFFADFF2F), (float)fixture->channelValueAt(lime) / 255.0); + finalColor = + blendColors(finalColor, QColor(0xFFADFF2F), (float)fixture->channelValueAt(lime) / 255.0); if (indigo != QLCChannel::invalid() && fixture->channelValueAt(indigo)) - finalColor = blendColors(finalColor, QColor(0xFF4B0082), (float)fixture->channelValueAt(indigo) / 255.0); + finalColor = blendColors(finalColor, QColor(0xFF4B0082), + (float)fixture->channelValueAt(indigo) / 255.0); return finalColor; } @@ -382,7 +388,8 @@ void FixtureUtils::positionTimings(const QLCChannel *ch, uchar value, int &panDu panDuration = tiltDuration = SCALE(value, 0, 255, MIN_POSITION_SPEED, MAX_POSITION_SPEED); break; case QLCChannel::SpeedPanTiltSlowFast: - panDuration = tiltDuration = SCALE(255 - value, 0, 255, MIN_POSITION_SPEED, MAX_POSITION_SPEED); + panDuration = tiltDuration = + SCALE(255 - value, 0, 255, MIN_POSITION_SPEED, MAX_POSITION_SPEED); break; case QLCChannel::SpeedPanFastSlow: panDuration = SCALE(value, 0, 255, MIN_POSITION_SPEED, MAX_POSITION_SPEED); @@ -501,7 +508,8 @@ int FixtureUtils::shutterTimings(const QLCChannel *ch, uchar value, int &highTim case QLCCapability::PulseFreqRange: case QLCCapability::RampUpFreqRange: case QLCCapability::RampDownFreqRange: - freq = SCALE(value, cap->min(), cap->max(), cap->resource(0).toFloat(), cap->resource(1).toFloat()); + freq = SCALE(value, cap->min(), cap->max(), cap->resource(0).toFloat(), + cap->resource(1).toFloat()); break; default: // invalidate any other preset, to avoid messing up the preview diff --git a/qmlui/functioneditor.cpp b/qmlui/functioneditor.cpp index 201d466faa..03dfc2e5e1 100644 --- a/qmlui/functioneditor.cpp +++ b/qmlui/functioneditor.cpp @@ -105,7 +105,8 @@ void FunctionEditor::setFunctionName(QString functionName) if (m_function == nullptr || m_function->name() == functionName) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetName, m_function->id(), m_function->name(), functionName); + Tardis::instance()->enqueueAction(Tardis::FunctionSetName, m_function->id(), m_function->name(), + functionName); m_function->setName(functionName); emit functionNameChanged(functionName); @@ -143,7 +144,8 @@ void FunctionEditor::setTempoType(int tempoType) if (m_function == nullptr || m_function->tempoType() == Function::TempoType(tempoType)) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetTempoType, m_function->id(), m_function->tempoType(), tempoType); + Tardis::instance()->enqueueAction(Tardis::FunctionSetTempoType, m_function->id(), + m_function->tempoType(), tempoType); m_function->setTempoType(Function::TempoType(tempoType)); @@ -156,9 +158,12 @@ void FunctionEditor::setTempoType(int tempoType) uint fadeOut = Function::timeToBeats(m_function->fadeOutSpeed(), beatDuration); uint duration = Function::timeToBeats(m_function->duration(), beatDuration); - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), m_function->fadeInSpeed(), fadeIn); - Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), m_function->duration(), duration); - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), m_function->fadeOutSpeed(), fadeOut); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), + m_function->fadeInSpeed(), fadeIn); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), + m_function->duration(), duration); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), + m_function->fadeOutSpeed(), fadeOut); m_function->setFadeInSpeed(fadeIn); m_function->setDuration(duration); @@ -171,9 +176,12 @@ void FunctionEditor::setTempoType(int tempoType) uint fadeOut = Function::beatsToTime(m_function->fadeOutSpeed(), beatDuration); uint duration = Function::beatsToTime(m_function->duration(), beatDuration); - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), m_function->fadeInSpeed(), fadeIn); - Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), m_function->duration(), duration); - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), m_function->fadeOutSpeed(), fadeOut); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), + m_function->fadeInSpeed(), fadeIn); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), + m_function->duration(), duration); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), + m_function->fadeOutSpeed(), fadeOut); m_function->setFadeInSpeed(fadeIn); m_function->setDuration(duration); @@ -199,7 +207,8 @@ void FunctionEditor::setFadeInSpeed(int fadeInSpeed) if (m_function->fadeInSpeed() == (uint)fadeInSpeed) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), m_function->fadeInSpeed(), fadeInSpeed); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeIn, m_function->id(), + m_function->fadeInSpeed(), fadeInSpeed); m_function->setFadeInSpeed(fadeInSpeed); emit fadeInSpeedChanged(fadeInSpeed); } @@ -221,7 +230,8 @@ void FunctionEditor::setHoldSpeed(int holdSpeed) return; uint duration = Function::speedAdd(m_function->fadeInSpeed(), holdSpeed); - Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), m_function->duration(), duration); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDuration, m_function->id(), + m_function->duration(), duration); m_function->setDuration(duration); emit holdSpeedChanged(holdSpeed); @@ -244,8 +254,8 @@ void FunctionEditor::setFadeOutSpeed(int fadeOutSpeed) if (m_function->fadeOutSpeed() == (uint)fadeOutSpeed) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), m_function->fadeOutSpeed(), - fadeOutSpeed); + Tardis::instance()->enqueueAction(Tardis::FunctionSetFadeOut, m_function->id(), + m_function->fadeOutSpeed(), fadeOutSpeed); m_function->setFadeOutSpeed(fadeOutSpeed); emit fadeOutSpeedChanged(fadeOutSpeed); } @@ -275,7 +285,8 @@ void FunctionEditor::setRunOrder(int runOrder) if (m_function == nullptr || m_function->runOrder() == Function::RunOrder(runOrder)) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_function->id(), m_function->runOrder(), runOrder); + Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_function->id(), + m_function->runOrder(), runOrder); m_function->setRunOrder(Function::RunOrder(runOrder)); emit runOrderChanged(runOrder); @@ -294,7 +305,8 @@ void FunctionEditor::setDirection(int direction) if (m_function == nullptr || m_function->direction() == Function::Direction(direction)) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetDirection, m_function->id(), m_function->direction(), direction); + Tardis::instance()->enqueueAction(Tardis::FunctionSetDirection, m_function->id(), + m_function->direction(), direction); m_function->setDirection(Function::Direction(direction)); emit directionChanged(direction); diff --git a/qmlui/functionmanager.cpp b/qmlui/functionmanager.cpp index 7333f3575d..2d1d57a78d 100644 --- a/qmlui/functionmanager.cpp +++ b/qmlui/functionmanager.cpp @@ -66,9 +66,11 @@ FunctionManager::FunctionManager(QQuickView *view, Doc *doc, QObject *parent) m_sceneEditor = nullptr; m_view->rootContext()->setContextProperty("functionManager", this); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "Collection", "Can't create a Collection"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "Collection", + "Can't create a Collection"); qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "Chaser", "Can't create a Chaser"); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "RGBMatrix", "Can't create a RGBMatrix"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "RGBMatrix", + "Can't create a RGBMatrix"); qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "EFX", "Can't create an EFX"); // register SceneValue to perform QVariant comparisons @@ -226,8 +228,9 @@ quint32 FunctionManager::addFunctiontoDoc(Function *func, QString name, bool sel emit selectedFunctionCountChanged(m_selectedIDList.count()); } - Tardis::instance()->enqueueAction(Tardis::FunctionCreate, func->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::FunctionCreate, func->id())); + Tardis::instance()->enqueueAction( + Tardis::FunctionCreate, func->id(), QVariant(), + Tardis::instance()->actionToByteArray(Tardis::FunctionCreate, func->id())); return func->id(); } @@ -683,7 +686,8 @@ void FunctionManager::setEditorFunction(quint32 fID, bool requestUI, bool back) break; default: { - qDebug() << "Requested function type" << f->type() << "doesn't have a dedicated Function editor"; + qDebug() << "Requested function type" << f->type() + << "doesn't have a dedicated Function editor"; } break; } @@ -697,11 +701,12 @@ void FunctionManager::setEditorFunction(quint32 fID, bool requestUI, bool back) if (requestUI == true) { - QQuickItem *rightPanel = - qobject_cast(m_view->rootObject()->findChild("funcRightPanel")); + QQuickItem *rightPanel = qobject_cast( + m_view->rootObject()->findChild("funcRightPanel")); if (rightPanel != nullptr) { - QMetaObject::invokeMethod(rightPanel, "requestEditor", Q_ARG(QVariant, f->id()), Q_ARG(QVariant, f->type())); + QMetaObject::invokeMethod(rightPanel, "requestEditor", Q_ARG(QVariant, f->id()), + Q_ARG(QVariant, f->type())); } } @@ -730,8 +735,9 @@ void FunctionManager::deleteFunction(quint32 fid) if (f->isRunning()) f->stopAndWait(); - Tardis::instance()->enqueueAction(Tardis::FunctionDelete, f->id(), - Tardis::instance()->actionToByteArray(Tardis::FunctionDelete, f->id()), QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FunctionDelete, f->id(), + Tardis::instance()->actionToByteArray(Tardis::FunctionDelete, f->id()), QVariant()); QString fullPath = f->name(); QString funcPath = f->path(true); @@ -780,9 +786,11 @@ void FunctionManager::moveFunction(quint32 fID, QString newPath) } else { - QString ftPath = fPath; - QString itemPath = - QString("%1%2%3").arg(ftPath.replace("/", TreeModel::separator())).arg(TreeModel::separator()).arg(f->name()); + QString ftPath = fPath; + QString itemPath = QString("%1%2%3") + .arg(ftPath.replace("/", TreeModel::separator())) + .arg(TreeModel::separator()) + .arg(f->name()); m_functionTree->removeItem(itemPath); } @@ -905,14 +913,16 @@ void FunctionManager::renameSelectedItems(QString newName, bool numbering, int s if (numbering) { - QString fName = QString("%1 %2").arg(newName.simplified()).arg(currNumber, digits, 10, QChar('0')); + QString fName = + QString("%1 %2").arg(newName.simplified()).arg(currNumber, digits, 10, QChar('0')); Tardis::instance()->enqueueAction(Tardis::FunctionSetName, f->id(), f->name(), fName); f->setName(fName); currNumber++; } else { - Tardis::instance()->enqueueAction(Tardis::FunctionSetName, f->id(), f->name(), newName.simplified()); + Tardis::instance()->enqueueAction(Tardis::FunctionSetName, f->id(), f->name(), + newName.simplified()); f->setName(newName.simplified()); } } @@ -1023,7 +1033,8 @@ void FunctionManager::setFolderPath(QString oldAbsPath, QString newPath, bool is { if (isRelative) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetPath, f->id(), funcPath, newAbsPathSlashed); + Tardis::instance()->enqueueAction(Tardis::FunctionSetPath, f->id(), funcPath, + newAbsPathSlashed); f->setPath(newAbsPathSlashed); } else @@ -1147,8 +1158,8 @@ quint32 FunctionManager::getChannelTypeMask(quint32 fxID, quint32 channel) return chTypeBit; } -void FunctionManager::dumpOnNewScene(QList dumpValues, QList selectedFixtures, quint32 channelMask, - QString name) +void FunctionManager::dumpOnNewScene(QList dumpValues, QList selectedFixtures, + quint32 channelMask, QString name) { if (dumpValues.isEmpty() || channelMask == 0) return; @@ -1174,15 +1185,16 @@ void FunctionManager::dumpOnNewScene(QList dumpValues, QListaddFunction(newScene) == true) { setPreviewEnabled(false); - Tardis::instance()->enqueueAction(Tardis::FunctionCreate, newScene->id(), QVariant(), - Tardis::instance()->actionToByteArray(Tardis::FunctionCreate, newScene->id())); + Tardis::instance()->enqueueAction( + Tardis::FunctionCreate, newScene->id(), QVariant(), + Tardis::instance()->actionToByteArray(Tardis::FunctionCreate, newScene->id())); } else delete newScene; } -void FunctionManager::dumpOnScene(QList dumpValues, QList selectedFixtures, quint32 channelMask, - quint32 sceneID) +void FunctionManager::dumpOnScene(QList dumpValues, QList selectedFixtures, + quint32 channelMask, quint32 sceneID) { if (dumpValues.isEmpty() || channelMask == 0) return; @@ -1207,7 +1219,8 @@ void FunctionManager::dumpOnScene(QList dumpValues, QList s newVal.setValue(sv); if (currentVal != newVal || sv.value != currDmxValue) { - Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), currentVal, newVal); + Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), + currentVal, newVal); scene->setValue(sv); } } @@ -1240,7 +1253,8 @@ void FunctionManager::setChannelValue(quint32 fxID, quint32 channel, uchar value if (scene->checkValue(scv) == false) { - Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), QVariant(), newVal); + Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), QVariant(), + newVal); scene->setValue(fxID, channel, value); } else @@ -1250,7 +1264,8 @@ void FunctionManager::setChannelValue(quint32 fxID, quint32 channel, uchar value if (currentVal != newVal || value != currDmxValue) { - Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), currentVal, newVal); + Tardis::instance()->enqueueAction(Tardis::SceneSetChannelValue, scene->id(), + currentVal, newVal); scene->setValue(fxID, channel, value); } } @@ -1267,13 +1282,15 @@ void FunctionManager::addFunctionTreeItem(Function *func) QQmlEngine::setObjectOwnership(func, QQmlEngine::CppOwnership); if ((m_filter == 0 || m_filter & func->type()) - && (m_searchFilter.length() < SEARCH_MIN_CHARS || func->name().toLower().contains(m_searchFilter))) + && (m_searchFilter.length() < SEARCH_MIN_CHARS + || func->name().toLower().contains(m_searchFilter))) { QVariantList params; params.append(QVariant::fromValue(func)); // classRef params.append(App::FunctionDragItem); // type QString fPath = func->path(true).replace("/", TreeModel::separator()); - TreeModelItem *item = m_functionTree->addItem(func->name(), params, fPath, expandAll ? TreeModel::Expanded : 0); + TreeModelItem *item = + m_functionTree->addItem(func->name(), params, fPath, expandAll ? TreeModel::Expanded : 0); if (m_selectedIDList.contains(QVariant(func->id()))) item->setFlag(TreeModel::Selected, true); } @@ -1353,7 +1370,8 @@ void FunctionManager::updateFunctionsTree() tokens.takeLast(); basePath = tokens.join(TreeModel::separator()); } - m_functionTree->addItem(fName, folderParams, basePath, TreeModel::EmptyNode | TreeModel::Expanded); + m_functionTree->addItem(fName, folderParams, basePath, + TreeModel::EmptyNode | TreeModel::Expanded); } // m_functionTree->printTree(); // enable for debug purposes diff --git a/qmlui/functionmanager.h b/qmlui/functionmanager.h index e70e8af1f1..4530535971 100644 --- a/qmlui/functionmanager.h +++ b/qmlui/functionmanager.h @@ -44,7 +44,8 @@ class FunctionManager : public QObject { Q_OBJECT - Q_PROPERTY(quint32 startupFunctionID READ startupFunctionID WRITE setStartupFunctionID NOTIFY startupFunctionIDChanged) + Q_PROPERTY(quint32 startupFunctionID READ startupFunctionID WRITE setStartupFunctionID NOTIFY + startupFunctionIDChanged) Q_PROPERTY(QVariant functionsList READ functionsList NOTIFY functionsListChanged) Q_PROPERTY(int functionsFilter READ functionsFilter CONSTANT) @@ -321,11 +322,13 @@ public slots: /** Dump DMX values provided by $dumpValues, filtered by the provided $selectedFixtures * and the provided $channelMask. * The new Scene will be named with $name if not empty, otherwise with an autogenerated name */ - void dumpOnNewScene(QList dumpValues, QList selectedFixtures, quint32 channelMask, QString name); + void dumpOnNewScene(QList dumpValues, QList selectedFixtures, + quint32 channelMask, QString name); /** Dump DMX values provided by $dumpValues, filtered by the provided $selectedFixtures * and the provided $channelMask. Values are dumped on an existing Scene with $sceneID */ - void dumpOnScene(QList dumpValues, QList selectedFixtures, quint32 channelMask, quint32 sceneID); + void dumpOnScene(QList dumpValues, QList selectedFixtures, + quint32 channelMask, quint32 sceneID); Q_INVOKABLE void setChannelValue(quint32 fxID, quint32 channel, uchar value); diff --git a/qmlui/importmanager.cpp b/qmlui/importmanager.cpp index 85bbca4b0c..2de54917b5 100644 --- a/qmlui/importmanager.cpp +++ b/qmlui/importmanager.cpp @@ -167,11 +167,11 @@ bool ImportManager::loadXML(QXmlStreamReader &doc) m_importDoc->loadXML(doc, false); } /* - else if (doc.name() == KXMLQLCVirtualConsole) - { - m_virtualConsole->loadXML(doc); - } - */ + else if (doc.name() == KXMLQLCVirtualConsole) + { + m_virtualConsole->loadXML(doc); + } +*/ else { qDebug() << "Skipping tag:" << doc.name().toString(); @@ -227,8 +227,8 @@ void ImportManager::importFixtures() qDebug() << "Match found. Import ID:" << importID << docFixture->id(); if (docFixture->id() != importID) { - qDebug() << "Fixture" << importFixture->name() << "with ID" << importID << "will be remapped to ID" - << docFixture->id(); + qDebug() << "Fixture" << importFixture->name() << "with ID" << importID + << "will be remapped to ID" << docFixture->id(); } m_fixtureIDRemap[importID] = docFixture->id(); @@ -248,7 +248,8 @@ void ImportManager::importFixtures() QLCFixtureDef *importDef = importFixture->fixtureDef(); QLCFixtureMode *importMode = importFixture->fixtureMode(); - QLCFixtureDef *fxiDef = m_doc->fixtureDefCache()->fixtureDef(importDef->manufacturer(), importDef->model()); + QLCFixtureDef *fxiDef = + m_doc->fixtureDefCache()->fixtureDef(importDef->manufacturer(), importDef->model()); QLCFixtureMode *fxiMode = nullptr; if (fxiDef != nullptr && importMode != nullptr) @@ -284,8 +285,8 @@ void ImportManager::importFixtures() } else { - qWarning() << "ERROR: Failed to add fixture" << importFixture->name() << "to universe" << uniIdx - << "@address" << address; + qWarning() << "ERROR: Failed to add fixture" << importFixture->name() + << "to universe" << uniIdx << "@address" << address; delete fxi; } } @@ -302,7 +303,8 @@ void ImportManager::importFixtures() continue; QString name = importMonProps->fixtureName(fixtureID, headIndex, linkedIndex); - // quint32 remappedID = FixtureUtils::fixtureItemID(m_fixtureIDRemap[fixtureID], headIndex, linkedIndex); + // quint32 remappedID = FixtureUtils::fixtureItemID(m_fixtureIDRemap[fixtureID], headIndex, + // linkedIndex); monProps->setFixtureName(m_fixtureIDRemap[fixtureID], headIndex, linkedIndex, name); } @@ -379,8 +381,8 @@ void ImportManager::importPalettes() { if (docPalette->id() != paletteID) { - qDebug() << "Match found. Palette" << importPalette->name() << "with ID" << paletteID - << "will be remapped to ID" << docPalette->id(); + qDebug() << "Match found. Palette" << importPalette->name() << "with ID" + << paletteID << "will be remapped to ID" << docPalette->id(); } m_fixtureIDRemap[paletteID] = docPalette->id(); @@ -643,7 +645,8 @@ void ImportManager::slotFixtureTreeDataChanged(TreeModelItem *item, int role, co m_fixtureTreeUpdating = true; - qDebug() << "Fixture tree data changed" << value.toInt() << "data" << item->data() << "value" << value; + qDebug() << "Fixture tree data changed" << value.toInt() << "data" << item->data() << "value" + << value; if (item->hasChildren()) setChildrenChecked(item->children(), checked); @@ -767,7 +770,8 @@ void ImportManager::updateFunctionsTree() QQmlEngine::setObjectOwnership(func, QQmlEngine::CppOwnership); - if (m_functionSearchFilter.length() < SEARCH_MIN_CHARS || func->name().toLower().contains(m_functionSearchFilter)) + if (m_functionSearchFilter.length() < SEARCH_MIN_CHARS + || func->name().toLower().contains(m_functionSearchFilter)) { QVariantList params; params.append(QVariant::fromValue(func)); @@ -856,7 +860,8 @@ void ImportManager::slotFunctionTreeDataChanged(TreeModelItem *item, int role, c { m_functionIDList.append(func->id()); checkFunctionDependency(func->id()); - qDebug() << "Fixtures count:" << m_fixtureIDList.count() << "functions count:" << m_functionIDList.count(); + qDebug() << "Fixtures count:" << m_fixtureIDList.count() + << "functions count:" << m_functionIDList.count(); checkFunctionTree(m_functionTree); checkFixtureTree(m_fixtureTree); } diff --git a/qmlui/importmanager.h b/qmlui/importmanager.h index a04ce016bc..5f55eda18a 100644 --- a/qmlui/importmanager.h +++ b/qmlui/importmanager.h @@ -33,8 +33,10 @@ class ImportManager : public QObject Q_PROPERTY(QVariant groupsTreeModel READ groupsTreeModel NOTIFY groupsTreeModelChanged) Q_PROPERTY(QVariant functionsTreeModel READ functionsTreeModel NOTIFY functionsTreeModelChanged) - Q_PROPERTY(QString fixtureSearchFilter READ fixtureSearchFilter WRITE setFixtureSearchFilter NOTIFY fixtureSearchFilterChanged) - Q_PROPERTY(QString functionSearchFilter READ functionSearchFilter WRITE setFunctionSearchFilter NOTIFY functionSearchFilterChanged) + Q_PROPERTY(QString fixtureSearchFilter READ fixtureSearchFilter WRITE setFixtureSearchFilter + NOTIFY fixtureSearchFilterChanged) + Q_PROPERTY(QString functionSearchFilter READ functionSearchFilter WRITE setFunctionSearchFilter + NOTIFY functionSearchFilterChanged) public: ImportManager(QQuickView *view, Doc *doc, QObject *parent = 0); diff --git a/qmlui/inputoutputmanager.cpp b/qmlui/inputoutputmanager.cpp index 90b41bce53..5e3e6186d5 100644 --- a/qmlui/inputoutputmanager.cpp +++ b/qmlui/inputoutputmanager.cpp @@ -137,8 +137,9 @@ void InputOutputManager::addUniverse() m_ioMap->startUniverses(); quint32 uniID = m_ioMap->universes().last()->id(); - Tardis::instance()->enqueueAction(Tardis::IOAddUniverse, uniID, QVariant(), - Tardis::instance()->actionToByteArray(Tardis::IOAddUniverse, uniID)); + Tardis::instance()->enqueueAction( + Tardis::IOAddUniverse, uniID, QVariant(), + Tardis::instance()->actionToByteArray(Tardis::IOAddUniverse, uniID)); emit universesChanged(); emit universeNamesChanged(); @@ -178,20 +179,21 @@ void InputOutputManager::removeLastUniverse() quint16 linkedIndex = mProps->fixtureLinkedIndex(subID); // delete the fixture monitor properties - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, fixture->id(), - QVariant(mProps->fixturePosition(fixture->id(), headIndex, linkedIndex)), - QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FixtureSetPosition, fixture->id(), + QVariant(mProps->fixturePosition(fixture->id(), headIndex, linkedIndex)), QVariant()); } // delete the fixture - Tardis::instance()->enqueueAction(Tardis::FixtureDelete, fixture->id(), - Tardis::instance()->actionToByteArray(Tardis::FixtureDelete, fixture->id()), - QVariant()); + Tardis::instance()->enqueueAction( + Tardis::FixtureDelete, fixture->id(), + Tardis::instance()->actionToByteArray(Tardis::FixtureDelete, fixture->id()), QVariant()); m_doc->deleteFixture(fixture->id()); mProps->removeFixture(fixture->id()); } - Tardis::instance()->enqueueAction(Tardis::IORemoveUniverse, index, - Tardis::instance()->actionToByteArray(Tardis::IORemoveUniverse, index), QVariant()); + Tardis::instance()->enqueueAction( + Tardis::IORemoveUniverse, index, + Tardis::instance()->actionToByteArray(Tardis::IORemoveUniverse, index), QVariant()); m_ioMap->removeUniverse(index); diff --git a/qmlui/mainview2d.cpp b/qmlui/mainview2d.cpp index eecc859975..55a4836bd5 100644 --- a/qmlui/mainview2d.cpp +++ b/qmlui/mainview2d.cpp @@ -130,7 +130,8 @@ void MainView2D::createFixtureItems(quint32 fxID, QVector3D pos, bool mmCoords) } } -void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, bool mmCoords) +void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, + QVector3D pos, bool mmCoords) { if (isEnabled() == false) return; @@ -138,7 +139,8 @@ void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link if (m_gridItem == nullptr) initialize2DProperties(); - qDebug() << "[MainView2D] Creating fixture with ID" << fxID << headIndex << linkedIndex << "pos:" << pos; + qDebug() << "[MainView2D] Creating fixture with ID" << fxID << headIndex << linkedIndex + << "pos:" << pos; Fixture *fixture = m_doc->fixture(fxID); if (fixture == nullptr) @@ -183,8 +185,8 @@ void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link } QPointF itemPos; - QSizeF size = FixtureUtils::item2DDimension(fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, - m_monProps->pointOfView()); + QSizeF size = FixtureUtils::item2DDimension( + fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, m_monProps->pointOfView()); if (mmCoords == false && (pos.x() != 0 || pos.y() != 0)) { @@ -197,13 +199,15 @@ void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link { itemPos = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), pos); newFixtureItem->setProperty( - "rotation", FixtureUtils::item2DRotation(m_monProps->pointOfView(), - m_monProps->fixtureRotation(fxID, headIndex, linkedIndex))); + "rotation", + FixtureUtils::item2DRotation(m_monProps->pointOfView(), + m_monProps->fixtureRotation(fxID, headIndex, linkedIndex))); } else { - itemPos = FixtureUtils::available2DPosition(m_doc, m_monProps->pointOfView(), - QRectF(itemPos.x(), itemPos.y(), size.width(), size.height())); + itemPos = FixtureUtils::available2DPosition( + m_doc, m_monProps->pointOfView(), + QRectF(itemPos.x(), itemPos.y(), size.width(), size.height())); // add the new fixture to the Doc monitor properties QVector3D newPos = FixtureUtils::item3DPosition(m_monProps, itemPos, 1000.0); m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos); @@ -225,8 +229,8 @@ void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link break; } } - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(QVector3D(0, 0, 0)), - QVariant(newPos)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, + QVariant(QVector3D(0, 0, 0)), QVariant(newPos)); } newFixtureItem->setProperty("mmXPos", itemPos.x()); @@ -334,7 +338,8 @@ void MainView2D::slotRefreshView() quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); createFixtureItem(fixture->id(), headIndex, linkedIndex, - m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex), true); + m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex), + true); } } else @@ -357,7 +362,8 @@ void MainView2D::updateFixture(Fixture *fixture, QByteArray &previous) } } -void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, QByteArray &previous) +void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, + QByteArray &previous) { quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); QQuickItem *fxItem = m_itemsMap.value(itemID, nullptr); @@ -376,13 +382,15 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (fixture->type() == QLCFixtureDef::Dimmer) { qreal value = (qreal)fixture->channelValueAt(headIndex) / 255.0; - QMetaObject::invokeMethod(fxItem, "setHeadIntensity", Q_ARG(QVariant, 0), Q_ARG(QVariant, value)); + QMetaObject::invokeMethod(fxItem, "setHeadIntensity", Q_ARG(QVariant, 0), + Q_ARG(QVariant, value)); QColor gelColor = m_monProps->fixtureGelColor(fixture->id(), headIndex, linkedIndex); if (gelColor.isValid() == false) gelColor = Qt::white; - QMetaObject::invokeMethod(fxItem, "setHeadRGBColor", Q_ARG(QVariant, 0), Q_ARG(QVariant, gelColor)); + QMetaObject::invokeMethod(fxItem, "setHeadRGBColor", Q_ARG(QVariant, 0), + Q_ARG(QVariant, gelColor)); return; } @@ -392,7 +400,8 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 for (int headIdx = 0; headIdx < fixture->heads(); headIdx++) { - quint32 headDimmerChannel = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx); + quint32 headDimmerChannel = + fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx); if (headDimmerChannel == QLCChannel::invalid()) headDimmerChannel = fixture->masterIntensityChannel(); @@ -404,11 +413,13 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (headDimmerChannel != masterDimmerChannel) intensityValue *= masterDimmerValue; - QMetaObject::invokeMethod(fxItem, "setHeadIntensity", Q_ARG(QVariant, headIdx), Q_ARG(QVariant, intensityValue)); + QMetaObject::invokeMethod(fxItem, "setHeadIntensity", Q_ARG(QVariant, headIdx), + Q_ARG(QVariant, intensityValue)); color = FixtureUtils::headColor(fixture, headIdx); - QMetaObject::invokeMethod(fxItem, "setHeadRGBColor", Q_ARG(QVariant, headIdx), Q_ARG(QVariant, color)); + QMetaObject::invokeMethod(fxItem, "setHeadRGBColor", Q_ARG(QVariant, headIdx), + Q_ARG(QVariant, color)); colorSet = true; } // for heads @@ -449,7 +460,8 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 QLCCapability *cap = ch->searchCapability(value); if (cap == nullptr - || (cap->presetType() != QLCCapability::SingleColor && cap->presetType() != QLCCapability::DoubleColor)) + || (cap->presetType() != QLCCapability::SingleColor + && cap->presetType() != QLCCapability::DoubleColor)) break; QColor wheelColor1 = cap->resource(0).value(); @@ -462,7 +474,8 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 wheelColor1 = FixtureUtils::applyColorFilter(color, wheelColor1); wheelColor2 = FixtureUtils::applyColorFilter(color, wheelColor2); QMetaObject::invokeMethod(fxItem, "setWheelColor", Q_ARG(QVariant, 0), - Q_ARG(QVariant, wheelColor1), Q_ARG(QVariant, wheelColor2)); + Q_ARG(QVariant, wheelColor1), + Q_ARG(QVariant, wheelColor2)); } else { @@ -518,8 +531,8 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (capPreset != QLCCapability::Custom) { - QMetaObject::invokeMethod(fxItem, "setShutter", Q_ARG(QVariant, capPreset), Q_ARG(QVariant, low), - Q_ARG(QVariant, high)); + QMetaObject::invokeMethod(fxItem, "setShutter", Q_ARG(QVariant, capPreset), + Q_ARG(QVariant, low), Q_ARG(QVariant, high)); } } break; @@ -530,7 +543,8 @@ void MainView2D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (setPosition) { - QMetaObject::invokeMethod(fxItem, "setPosition", Q_ARG(QVariant, panDegrees), Q_ARG(QVariant, tiltDegrees)); + QMetaObject::invokeMethod(fxItem, "setPosition", Q_ARG(QVariant, panDegrees), + Q_ARG(QVariant, tiltDegrees)); } } @@ -543,8 +557,8 @@ void MainView2D::selectFixture(QQuickItem *fxItem, bool enable) if (enable) { - QQuickItem *dragArea = - qobject_cast(m_view->rootObject()->findChild("contentsDragArea")); + QQuickItem *dragArea = qobject_cast( + m_view->rootObject()->findChild("contentsDragArea")); if (dragArea) fxItem->setParentItem(dragArea); } @@ -615,7 +629,7 @@ void MainView2D::updateFixturePosition(quint32 itemID, QVector3D pos) else { QQuickItem *fxItem = m_itemsMap[itemID]; - QPointF point = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), pos); + QPointF point = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), pos); fxItem->setProperty("mmXPos", point.x()); fxItem->setProperty("mmYPos", point.y()); } @@ -630,8 +644,8 @@ void MainView2D::updateFixtureSize(quint32 itemID, Fixture *fixture) { QQuickItem *fxItem = m_itemsMap[itemID]; QLCFixtureMode *fxMode = fixture->fixtureMode(); - QSizeF size = FixtureUtils::item2DDimension(fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, - m_monProps->pointOfView()); + QSizeF size = FixtureUtils::item2DDimension( + fixture->type() == QLCFixtureDef::Dimmer ? nullptr : fxMode, m_monProps->pointOfView()); fxItem->setProperty("mmWidth", size.width()); fxItem->setProperty("mmHeight", size.height()); } diff --git a/qmlui/mainview2d.h b/qmlui/mainview2d.h index 6365be38b1..190796050c 100644 --- a/qmlui/mainview2d.h +++ b/qmlui/mainview2d.h @@ -55,7 +55,8 @@ class MainView2D : public PreviewContext void createFixtureItems(quint32 fxID, QVector3D pos, bool mmCoords = true); - void createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, bool mmCoords = true); + void createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, + bool mmCoords = true); /** Set/update the flags of a fixture item */ void setFixtureFlags(quint32 itemID, quint32 flags); @@ -70,7 +71,8 @@ class MainView2D : public PreviewContext void updateFixture(Fixture *fixture, QByteArray &previous); /** Update a single fixture item for a specific Fixture ID, head index and linked index */ - void updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, QByteArray &previous); + void updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, + QByteArray &previous); /** Update the selection status of a list of Fixture item IDs */ void updateFixtureSelection(QList fixtures); diff --git a/qmlui/mainview3d.cpp b/qmlui/mainview3d.cpp index de40cef6a7..c8699d0c92 100644 --- a/qmlui/mainview3d.cpp +++ b/qmlui/mainview3d.cpp @@ -79,7 +79,8 @@ MainView3D::MainView3D(QQuickView *view, Doc *doc, QObject *parent) setContextTitle(tr("3D View")); qRegisterMetaType(); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "MainView3D", "Can't create an MainView3D!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "MainView3D", + "Can't create an MainView3D!"); // the following two lists must always have the same items number and must respect // the order of StageType enum in MonitorProperties class @@ -142,7 +143,8 @@ void MainView3D::slotRefreshView() quint16 headIndex = m_monProps->fixtureHeadIndex(subID); quint16 linkedIndex = m_monProps->fixtureLinkedIndex(subID); createFixtureItem(fixture->id(), headIndex, linkedIndex, - m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex), true); + m_monProps->fixturePosition(fixture->id(), headIndex, linkedIndex), + true); } } else @@ -331,12 +333,14 @@ void MainView3D::initialize3DProperties() if (m_selectionComponent == nullptr) { - m_selectionComponent = new QQmlComponent(m_view->engine(), QUrl("qrc:/SelectionEntity.qml")); + m_selectionComponent = + new QQmlComponent(m_view->engine(), QUrl("qrc:/SelectionEntity.qml")); if (m_selectionComponent->isError()) qDebug() << m_selectionComponent->errors(); } - m_scene3D = qobject_cast(m_view->rootObject()->findChild("scene3DItem")); + m_scene3D = + qobject_cast(m_view->rootObject()->findChild("scene3DItem")); qDebug() << Q_FUNC_INFO << m_scene3D; @@ -464,7 +468,8 @@ void MainView3D::createFixtureItems(quint32 fxID, QVector3D pos, bool mmCoords) } } -void MainView3D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, bool mmCoords) +void MainView3D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, + QVector3D pos, bool mmCoords) { Q_UNUSED(mmCoords) @@ -497,7 +502,8 @@ void MainView3D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link { mesh->m_goboTexture = new GoboTextureImage(512, 512, openGobo); - QQmlComponent *lbComp = new QQmlComponent(m_view->engine(), QUrl("qrc:/MultiBeams3DItem.qml")); + QQmlComponent *lbComp = + new QQmlComponent(m_view->engine(), QUrl("qrc:/MultiBeams3DItem.qml")); if (lbComp->isError()) qDebug() << lbComp->errors(); @@ -513,7 +519,8 @@ void MainView3D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 link { mesh->m_goboTexture = nullptr; - QQmlComponent *lbComp = new QQmlComponent(m_view->engine(), QUrl("qrc:/PixelBar3DItem.qml")); // TODO + QQmlComponent *lbComp = new QQmlComponent(m_view->engine(), + QUrl("qrc:/PixelBar3DItem.qml")); // TODO if (lbComp->isError()) qDebug() << lbComp->errors(); @@ -585,10 +592,13 @@ void MainView3D::setFixtureFlags(quint32 itemID, quint32 flags) return; meshRef->m_rootItem->setProperty("enabled", (flags & MonitorProperties::HiddenFlag) ? false : true); - meshRef->m_selectionBox->setProperty("enabled", (flags & MonitorProperties::HiddenFlag) ? false : true); + meshRef->m_selectionBox->setProperty("enabled", + (flags & MonitorProperties::HiddenFlag) ? false : true); - meshRef->m_rootItem->setProperty("invertedPan", (flags & MonitorProperties::InvertedPanFlag) ? true : false); - meshRef->m_rootItem->setProperty("invertedTilt", (flags & MonitorProperties::InvertedTiltFlag) ? true : false); + meshRef->m_rootItem->setProperty("invertedPan", + (flags & MonitorProperties::InvertedPanFlag) ? true : false); + meshRef->m_rootItem->setProperty("invertedTilt", + (flags & MonitorProperties::InvertedTiltFlag) ? true : false); } Qt3DCore::QTransform *MainView3D::getTransform(QEntity *entity) @@ -679,9 +689,10 @@ void MainView3D::getMeshCorners(QGeometryRenderer *mesh, QVector3D &minCorner, Q #endif if (vPosAttribute) { - const float *bufferPtr = reinterpret_cast(vPosAttribute->buffer()->data().constData()); - uint stride = vPosAttribute->byteStride() / sizeof(float); - uint offset = vPosAttribute->byteOffset() / sizeof(float); + const float *bufferPtr = + reinterpret_cast(vPosAttribute->buffer()->data().constData()); + uint stride = vPosAttribute->byteStride() / sizeof(float); + uint offset = vPosAttribute->byteOffset() / sizeof(float); bufferPtr += offset; uint vertexCount = vPosAttribute->count(); uint dataCount = vPosAttribute->buffer()->data().size() / sizeof(float); @@ -745,15 +756,15 @@ void MainView3D::addVolumes(SceneItem *meshRef, QVector3D minCorner, QVector3D m // qDebug() << "vertices pos" << vminX << vminY << vminZ << vmaxX << vmaxY << vmaxZ; meshRef->m_volume.m_extents = QVector3D(vmaxX - vminX, vmaxY - vminY, vmaxZ - vminZ); - meshRef->m_volume.m_center = - QVector3D(vminX + meshRef->m_volume.m_extents.x() / 2.0f, vminY + meshRef->m_volume.m_extents.y() / 2.0f, - vminZ + meshRef->m_volume.m_extents.z() / 2.0f); + meshRef->m_volume.m_center = QVector3D(vminX + meshRef->m_volume.m_extents.x() / 2.0f, + vminY + meshRef->m_volume.m_extents.y() / 2.0f, + vminZ + meshRef->m_volume.m_extents.z() / 2.0f); // qDebug() << "-- extent" << meshRef->m_volume.m_extents << "-- center" << meshRef->m_volume.m_center; } -QEntity *MainView3D::inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer *layer, QEffect *effect, - bool calculateVolume, QVector3D translation) +QEntity *MainView3D::inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer *layer, + QEffect *effect, bool calculateVolume, QVector3D translation) { if (entity == nullptr) return nullptr; @@ -778,13 +789,15 @@ QEntity *MainView3D::inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer * // for (QParameter *par : material->parameters()) // qDebug() << "Material parameter:" << par->name() << par->value(); - Qt3DExtras::QPhongMaterial *pMaterial = qobject_cast(component); + Qt3DExtras::QPhongMaterial *pMaterial = + qobject_cast(component); if (pMaterial) { material->addParameter(new QParameter("diffuse", pMaterial->diffuse())); material->addParameter(new QParameter("specular", pMaterial->specular())); - material->addParameter(new QParameter("shininess", pMaterial->shininess() ? pMaterial->shininess() : 1.0)); + material->addParameter(new QParameter( + "shininess", pMaterial->shininess() ? pMaterial->shininess() : 1.0)); material->addParameter(new QParameter("bloom", 0)); } else @@ -806,8 +819,8 @@ QEntity *MainView3D::inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer * getMeshCorners(geom, minCorner, maxCorner); minCorner += translation; maxCorner += translation; - qDebug() << "Entity" << entity->objectName() << "translation:" << translation << ", min:" << minCorner - << ", max:" << maxCorner; + qDebug() << "Entity" << entity->objectName() << "translation:" << translation + << ", min:" << minCorner << ", max:" << maxCorner; addVolumes(meshRef, minCorner, maxCorner); } @@ -909,7 +922,7 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad } QLayer *sceneDeferredLayer = m_sceneRootEntity->property("deferredLayer").value(); - QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); + QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); qDebug() << sceneDeferredLayer << sceneEffect; @@ -935,7 +948,8 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad { // Walk through the scene tree and add each mesh to the deferred pipeline. // If needed, calculate also the bounding volume */ - baseItem = inspectEntity(root, meshRef, sceneDeferredLayer, sceneEffect, calculateVolume, translation); + baseItem = inspectEntity(root, meshRef, sceneDeferredLayer, sceneEffect, calculateVolume, + translation); } else { @@ -961,7 +975,8 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad Qt3DCore::QTransform *transform = getTransform(meshRef->m_armItem); if (transform != nullptr) QMetaObject::invokeMethod(meshRef->m_rootItem, "bindPanTransform", - Q_ARG(QVariant, QVariant::fromValue(transform)), Q_ARG(QVariant, panDeg)); + Q_ARG(QVariant, QVariant::fromValue(transform)), + Q_ARG(QVariant, panDeg)); } } @@ -979,7 +994,8 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad // this is either a moving head or a scanner if (transform != nullptr) QMetaObject::invokeMethod(meshRef->m_rootItem, "bindTiltTransform", - Q_ARG(QVariant, QVariant::fromValue(transform)), Q_ARG(QVariant, tiltDeg)); + Q_ARG(QVariant, QVariant::fromValue(transform)), + Q_ARG(QVariant, tiltDeg)); } } @@ -999,13 +1015,14 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad else { QSizeF size = FixtureUtils::item2DDimension(fxMode, MonitorProperties::TopView); - QPointF itemPos = FixtureUtils::available2DPosition(m_doc, MonitorProperties::TopView, - QRectF(0, 0, size.width(), size.height())); + QPointF itemPos = FixtureUtils::available2DPosition( + m_doc, MonitorProperties::TopView, QRectF(0, 0, size.width(), size.height())); // add the new fixture to the Doc monitor properties - fxPos = QVector3D(itemPos.x(), 1000.0, itemPos.y()); + fxPos = QVector3D(itemPos.x(), 1000.0, itemPos.y()); m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, fxPos); m_monProps->setFixtureFlags(fxID, headIndex, linkedIndex, 0); - Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(QVector3D(0, 0, 0)), QVariant(fxPos)); + Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, + QVariant(QVector3D(0, 0, 0)), QVariant(fxPos)); } // scaling is not needed for dynamic meshes @@ -1014,8 +1031,9 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad updateFixturePosition(itemID, fxPos); updateFixtureRotation(itemID, m_monProps->fixtureRotation(fxID, headIndex, linkedIndex)); - QLayer *selectionLayer = m_sceneRootEntity->property("selectionLayer").value(); - QGeometryRenderer *selectionMesh = m_sceneRootEntity->property("selectionMesh").value(); + QLayer *selectionLayer = m_sceneRootEntity->property("selectionLayer").value(); + QGeometryRenderer *selectionMesh = + m_sceneRootEntity->property("selectionMesh").value(); meshRef->m_selectionBox = qobject_cast(m_selectionComponent->create()); meshRef->m_selectionBox->setParent(m_sceneRootEntity); @@ -1074,7 +1092,8 @@ void MainView3D::updateFixture(Fixture *fixture, QByteArray &previous) } } -void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, QByteArray &previous) +void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, + QByteArray &previous) { quint32 itemID = FixtureUtils::fixtureItemID(fixture->id(), headIndex, linkedIndex); SceneItem *meshItem = m_entitiesMap.value(itemID, nullptr); @@ -1097,13 +1116,15 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (fixture->type() == QLCFixtureDef::Dimmer) { qreal value = qreal(fixture->channelValueAt(headIndex)) / 255.0; - QMetaObject::invokeMethod(fixtureItem, "setHeadIntensity", Q_ARG(QVariant, 0), Q_ARG(QVariant, value)); + QMetaObject::invokeMethod(fixtureItem, "setHeadIntensity", Q_ARG(QVariant, 0), + Q_ARG(QVariant, value)); QColor gelColor = m_monProps->fixtureGelColor(fixture->id(), headIndex, linkedIndex); if (gelColor.isValid() == false) gelColor = Qt::white; - QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, 0), Q_ARG(QVariant, gelColor)); + QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, 0), + Q_ARG(QVariant, gelColor)); return; } @@ -1113,7 +1134,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 for (int headIdx = 0; headIdx < fixture->heads(); headIdx++) { - quint32 headDimmerChannel = fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx); + quint32 headDimmerChannel = + fixture->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, headIdx); if (headDimmerChannel == QLCChannel::invalid()) headDimmerChannel = masterDimmerChannel; @@ -1124,14 +1146,16 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (headDimmerChannel != masterDimmerChannel) intensityValue *= masterDimmerValue; - // qDebug() << "Head" << headIdx << "dimmer channel:" << headDimmerIndex << "intensity" << intensityValue; + // qDebug() << "Head" << headIdx << "dimmer channel:" << headDimmerIndex << "intensity" << + // intensityValue; QMetaObject::invokeMethod(fixtureItem, "setHeadIntensity", Q_ARG(QVariant, headIdx), Q_ARG(QVariant, intensityValue)); color = FixtureUtils::headColor(fixture, headIdx); - QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, headIdx), Q_ARG(QVariant, color)); + QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, headIdx), + Q_ARG(QVariant, color)); colorSet = true; } // for heads @@ -1175,8 +1199,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 int panSpeed, tiltSpeed; FixtureUtils::positionTimings(ch, value, panSpeed, tiltSpeed); - QMetaObject::invokeMethod(fixtureItem, "setPositionSpeed", Q_ARG(QVariant, panSpeed), - Q_ARG(QVariant, tiltSpeed)); + QMetaObject::invokeMethod(fixtureItem, "setPositionSpeed", + Q_ARG(QVariant, panSpeed), Q_ARG(QVariant, tiltSpeed)); } break; case QLCChannel::Colour: @@ -1187,7 +1211,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 QLCCapability *cap = ch->searchCapability(value); if (cap == nullptr - || (cap->presetType() != QLCCapability::SingleColor && cap->presetType() != QLCCapability::DoubleColor)) + || (cap->presetType() != QLCCapability::SingleColor + && cap->presetType() != QLCCapability::DoubleColor)) break; QColor wheelColor1 = cap->resource(0).value(); @@ -1196,7 +1221,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (wheelColor1.isValid()) { color = FixtureUtils::applyColorFilter(color, wheelColor1); - QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, 0), Q_ARG(QVariant, color)); + QMetaObject::invokeMethod(fixtureItem, "setHeadRGBColor", Q_ARG(QVariant, 0), + Q_ARG(QVariant, color)); } } break; @@ -1255,8 +1281,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (speed == -1) break; - QMetaObject::invokeMethod(fixtureItem, "setGoboSpeed", Q_ARG(QVariant, clockwise), - Q_ARG(QVariant, speed)); + QMetaObject::invokeMethod(fixtureItem, "setGoboSpeed", + Q_ARG(QVariant, clockwise), Q_ARG(QVariant, speed)); } break; } @@ -1270,8 +1296,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 int high = 200, low = 800; int capPreset = FixtureUtils::shutterTimings(ch, value, high, low); - QMetaObject::invokeMethod(fixtureItem, "setShutter", Q_ARG(QVariant, capPreset), Q_ARG(QVariant, low), - Q_ARG(QVariant, high)); + QMetaObject::invokeMethod(fixtureItem, "setShutter", Q_ARG(QVariant, capPreset), + Q_ARG(QVariant, low), Q_ARG(QVariant, high)); } break; default: @@ -1281,7 +1307,8 @@ void MainView3D::updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 if (setPosition) { - QMetaObject::invokeMethod(fixtureItem, "setPosition", Q_ARG(QVariant, panValue), Q_ARG(QVariant, tiltValue)); + QMetaObject::invokeMethod(fixtureItem, "setPosition", Q_ARG(QVariant, panValue), + Q_ARG(QVariant, tiltValue)); } } @@ -1333,9 +1360,11 @@ void MainView3D::updateFixturePosition(quint32 itemID, QVector3D pos) // qDebug() << "Update 3D fixture position" << pos; - float x = (pos.x() / 1000.0) - (m_monProps->gridSize().x() / 2) + (mesh->m_volume.m_extents.x() / 2); + float x = + (pos.x() / 1000.0) - (m_monProps->gridSize().x() / 2) + (mesh->m_volume.m_extents.x() / 2); float y = (pos.y() / 1000.0) + (mesh->m_volume.m_extents.y() / 2); - float z = (pos.z() / 1000.0) - (m_monProps->gridSize().z() / 2) + (mesh->m_volume.m_extents.z() / 2); + float z = + (pos.z() / 1000.0) - (m_monProps->gridSize().z() / 2) + (mesh->m_volume.m_extents.z() / 2); /* move the root mesh first */ mesh->m_rootTransform->setTranslation(QVector3D(x, y, z)); @@ -1355,8 +1384,9 @@ void MainView3D::updateFixtureRotation(quint32 itemID, QVector3D degrees) qDebug() << Q_FUNC_INFO << degrees; QQuaternion qRotation; - qRotation = Qt3DCore::QTransform::fromAxesAndAngles(QVector3D(1, 0, 0), -degrees.x(), QVector3D(0, 1, 0), - -degrees.y(), QVector3D(0, 0, 1), -degrees.z()); + qRotation = Qt3DCore::QTransform::fromAxesAndAngles(QVector3D(1, 0, 0), -degrees.x(), + QVector3D(0, 1, 0), -degrees.y(), + QVector3D(0, 0, 1), -degrees.z()); mesh->m_rootTransform->setRotation(qRotation); updateLightMatrix(mesh); @@ -1392,14 +1422,16 @@ void MainView3D::updateLightMatrix(SceneItem *mesh) QVector3D ya = QVector3D(yb.x(), yb.y(), yb.z()).normalized(); QVector3D za = QVector3D(zb.x(), zb.y(), zb.z()).normalized(); - QMatrix4x4 lightMatrix = - QMatrix4x4(xa.x(), xa.y(), xa.z(), 0, ya.x(), ya.y(), ya.z(), 0, za.x(), za.y(), za.z(), 0, 0, 0, 0, 1).transposed(); + QMatrix4x4 lightMatrix = QMatrix4x4(xa.x(), xa.y(), xa.z(), 0, ya.x(), ya.y(), ya.z(), 0, + za.x(), za.y(), za.z(), 0, 0, 0, 0, 1) + .transposed(); QVector4D result = m * QVector4D(0, 0, 0, 1); - QMetaObject::invokeMethod(mesh->m_rootItem, "setHeadLightProps", Q_ARG(QVariant, 0), - Q_ARG(QVariant, QVariant::fromValue(QVector3D(result.x(), result.y(), result.z()))), - Q_ARG(QVariant, QVariant::fromValue(lightMatrix))); + QMetaObject::invokeMethod( + mesh->m_rootItem, "setHeadLightProps", Q_ARG(QVariant, 0), + Q_ARG(QVariant, QVariant::fromValue(QVector3D(result.x(), result.y(), result.z()))), + Q_ARG(QVariant, QVariant::fromValue(lightMatrix))); } void MainView3D::updateFixtureScale(quint32 itemID, QVector3D origSize) @@ -1491,7 +1523,8 @@ void MainView3D::createGenericItem(QString filename, int itemID) } else { - filename = QLCFile::fileUrlPrefix() + m_doc->getWorkspacePath() + QDir::separator() + filename; + filename = QLCFile::fileUrlPrefix() + m_doc->getWorkspacePath() + + QDir::separator() + filename; } } else @@ -1547,7 +1580,7 @@ void MainView3D::initializeItem(int itemID, QEntity *itemEntity, QSceneLoader *l qDebug() << "There are" << root->children().count() << "components in the loaded fixture"; QLayer *sceneDeferredLayer = m_sceneRootEntity->property("deferredLayer").value(); - QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); + QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); QVector3D translation; SceneItem *meshRef = m_genericMap.value(itemID); @@ -1564,14 +1597,16 @@ void MainView3D::initializeItem(int itemID, QEntity *itemEntity, QSceneLoader *l // If needed, calculate also the bounding volume */ inspectEntity(root, meshRef, sceneDeferredLayer, sceneEffect, calculateVolume, translation); - qDebug() << "Calculated volume:" << meshRef->m_volume.m_extents << ", center:" << meshRef->m_volume.m_center; + qDebug() << "Calculated volume:" << meshRef->m_volume.m_extents + << ", center:" << meshRef->m_volume.m_center; qDebug() << "Translation:" << translation; if (calculateVolume) m_boundingVolumesMap[loader->source()] = meshRef->m_volume; - QLayer *selectionLayer = m_sceneRootEntity->property("selectionLayer").value(); - QGeometryRenderer *selectionMesh = m_sceneRootEntity->property("selectionMesh").value(); + QLayer *selectionLayer = m_sceneRootEntity->property("selectionLayer").value(); + QGeometryRenderer *selectionMesh = + m_sceneRootEntity->property("selectionMesh").value(); meshRef->m_selectionBox = qobject_cast(m_selectionComponent->create()); meshRef->m_selectionBox->setParent(m_sceneRootEntity); @@ -1717,9 +1752,11 @@ void MainView3D::updateGenericItemPosition(quint32 itemID, QVector3D pos) if (item == nullptr || item->m_rootTransform == nullptr) return; - float x = (pos.x() / 1000.0) - (m_monProps->gridSize().x() / 2) + (item->m_volume.m_extents.x() / 2); + float x = + (pos.x() / 1000.0) - (m_monProps->gridSize().x() / 2) + (item->m_volume.m_extents.x() / 2); float y = (pos.y() / 1000.0) + (item->m_volume.m_extents.y() / 2); - float z = (pos.z() / 1000.0) - (m_monProps->gridSize().z() / 2) + (item->m_volume.m_extents.z() / 2); + float z = + (pos.z() / 1000.0) - (m_monProps->gridSize().z() / 2) + (item->m_volume.m_extents.z() / 2); item->m_rootTransform->setTranslation(QVector3D(x, y, z)); } @@ -1764,8 +1801,8 @@ void MainView3D::updateGenericItemRotation(quint32 itemID, QVector3D rot) return; QQuaternion qRotation; - qRotation = Qt3DCore::QTransform::fromAxesAndAngles(QVector3D(1, 0, 0), rot.x(), QVector3D(0, 1, 0), rot.y(), - QVector3D(0, 0, 1), rot.z()); + qRotation = Qt3DCore::QTransform::fromAxesAndAngles( + QVector3D(1, 0, 0), rot.x(), QVector3D(0, 1, 0), rot.y(), QVector3D(0, 0, 1), rot.z()); item->m_rootTransform->setRotation(qRotation); } @@ -1916,7 +1953,7 @@ void MainView3D::createStage() m_stageEntity->setParent(m_sceneRootEntity); QLayer *sceneDeferredLayer = m_sceneRootEntity->property("deferredLayer").value(); - QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); + QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value(); m_stageEntity->setProperty("sceneLayer", QVariant::fromValue(sceneDeferredLayer)); m_stageEntity->setProperty("effect", QVariant::fromValue(sceneEffect)); } diff --git a/qmlui/mainview3d.h b/qmlui/mainview3d.h index 9b4e89cd30..66fdc5582c 100644 --- a/qmlui/mainview3d.h +++ b/qmlui/mainview3d.h @@ -109,9 +109,12 @@ class MainView3D : public PreviewContext Q_PROPERTY(QVariant genericItemsList READ genericItemsList NOTIFY genericItemsListChanged) Q_PROPERTY(int genericSelectedCount READ genericSelectedCount NOTIFY genericSelectedCountChanged) - Q_PROPERTY(QVector3D genericItemsPosition READ genericItemsPosition WRITE setGenericItemsPosition NOTIFY genericItemsPositionChanged) - Q_PROPERTY(QVector3D genericItemsRotation READ genericItemsRotation WRITE setGenericItemsRotation NOTIFY genericItemsRotationChanged) - Q_PROPERTY(QVector3D genericItemsScale READ genericItemsScale WRITE setGenericItemsScale NOTIFY genericItemsScaleChanged) + Q_PROPERTY(QVector3D genericItemsPosition READ genericItemsPosition WRITE + setGenericItemsPosition NOTIFY genericItemsPositionChanged) + Q_PROPERTY(QVector3D genericItemsRotation READ genericItemsRotation WRITE + setGenericItemsRotation NOTIFY genericItemsRotationChanged) + Q_PROPERTY(QVector3D genericItemsScale READ genericItemsScale WRITE setGenericItemsScale NOTIFY + genericItemsScaleChanged) public: explicit MainView3D(QQuickView *view, Doc *doc, QObject *parent = 0); @@ -200,7 +203,8 @@ protected slots: void createFixtureItems(quint32 fxID, QVector3D pos, bool mmCoords = true); - void createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, bool mmCoords = true); + void createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex, QVector3D pos, + bool mmCoords = true); /** Set/update the flags of a fixture item */ void setFixtureFlags(quint32 itemID, quint32 flags); @@ -213,7 +217,8 @@ protected slots: void updateFixture(Fixture *fixture, QByteArray &previous); /** Update a single fixture item for a specific Fixture ID, head index and linked index */ - void updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, QByteArray &previous); + void updateFixtureItem(Fixture *fixture, quint16 headIndex, quint16 linkedIndex, + QByteArray &previous); /** Update the selection status of a list of Fixture item IDs */ void updateFixtureSelection(QList fixtures); @@ -248,8 +253,8 @@ protected slots: void addVolumes(SceneItem *meshRef, QVector3D minCorner, QVector3D maxCorner); /** Recursive method to get/set all the information of a scene */ - QEntity *inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer *layer, QEffect *effect, bool calculateVolume, - QVector3D translation); + QEntity *inspectEntity(QEntity *entity, SceneItem *meshRef, QLayer *layer, QEffect *effect, + bool calculateVolume, QVector3D translation); void walkNode(QNode *e, int depth); diff --git a/qmlui/palettemanager.cpp b/qmlui/palettemanager.cpp index c37a28ebd9..00ead1d425 100644 --- a/qmlui/palettemanager.cpp +++ b/qmlui/palettemanager.cpp @@ -35,7 +35,8 @@ PaletteManager::PaletteManager(QQuickView *view, Doc *doc, ContextManager *ctxMa , m_searchFilter(QString()) { m_view->rootContext()->setContextProperty("paletteManager", this); - qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCPalette", "Can't create a QLCPalette!"); + qmlRegisterUncreatableType("org.qlcplus.classes", 1, 0, "QLCPalette", + "Can't create a QLCPalette!"); m_paletteList = new ListModel(this); QStringList listRoles; @@ -123,7 +124,8 @@ void PaletteManager::previewPalette(QLCPalette *palette) if (palette == nullptr) return; - m_contextManager->setChannelValues(palette->valuesFromFixtures(m_doc, m_contextManager->selectedFixtureIDList())); + m_contextManager->setChannelValues( + palette->valuesFromFixtures(m_doc, m_contextManager->selectedFixtureIDList())); } void PaletteManager::updatePalette(QLCPalette *palette, QVariant value1) @@ -230,7 +232,8 @@ void PaletteManager::updatePaletteList() for (QLCPalette *palette : m_doc->palettes()) { if ((m_typeFilter == QLCPalette::Undefined || m_typeFilter & palette->type()) - && (m_searchFilter.length() < SEARCH_MIN_CHARS || palette->name().toLower().contains(m_searchFilter))) + && (m_searchFilter.length() < SEARCH_MIN_CHARS + || palette->name().toLower().contains(m_searchFilter))) { QVariantMap funcMap; funcMap.insert("paletteID", palette->id()); diff --git a/qmlui/previewcontext.cpp b/qmlui/previewcontext.cpp index 6afde54356..71bcde7452 100644 --- a/qmlui/previewcontext.cpp +++ b/qmlui/previewcontext.cpp @@ -145,30 +145,34 @@ void PreviewContext::setDetached(bool detached) /** Copy all the global properties of the main context into the detached one. * This is a bit ugly, but I guess it is a downside of the QML programming */ - m_view->rootContext()->setContextProperty("qlcplus", m_mainView->rootContext()->contextProperty("qlcplus")); - m_view->rootContext()->setContextProperty("screenPixelDensity", - m_mainView->rootContext()->contextProperty("screenPixelDensity")); - m_view->rootContext()->setContextProperty("ioManager", m_mainView->rootContext()->contextProperty("ioManager")); - m_view->rootContext()->setContextProperty("fixtureBrowser", - m_mainView->rootContext()->contextProperty("fixtureBrowser")); - m_view->rootContext()->setContextProperty("fixtureManager", - m_mainView->rootContext()->contextProperty("fixtureManager")); - m_view->rootContext()->setContextProperty("fixtureGroupEditor", - m_mainView->rootContext()->contextProperty("fixtureGroupEditor")); - m_view->rootContext()->setContextProperty("functionManager", - m_mainView->rootContext()->contextProperty("functionManager")); - m_view->rootContext()->setContextProperty("contextManager", - m_mainView->rootContext()->contextProperty("contextManager")); - m_view->rootContext()->setContextProperty("virtualConsole", - m_mainView->rootContext()->contextProperty("virtualConsole")); - m_view->rootContext()->setContextProperty("showManager", - m_mainView->rootContext()->contextProperty("showManager")); - m_view->rootContext()->setContextProperty("simpleDesk", - m_mainView->rootContext()->contextProperty("simpleDesk")); - m_view->rootContext()->setContextProperty("actionManager", - m_mainView->rootContext()->contextProperty("actionManager")); - m_view->rootContext()->setContextProperty("View2D", m_mainView->rootContext()->contextProperty("View2D")); - m_view->rootContext()->setContextProperty("View3D", m_mainView->rootContext()->contextProperty("View3D")); + m_view->rootContext()->setContextProperty( + "qlcplus", m_mainView->rootContext()->contextProperty("qlcplus")); + m_view->rootContext()->setContextProperty( + "screenPixelDensity", m_mainView->rootContext()->contextProperty("screenPixelDensity")); + m_view->rootContext()->setContextProperty( + "ioManager", m_mainView->rootContext()->contextProperty("ioManager")); + m_view->rootContext()->setContextProperty( + "fixtureBrowser", m_mainView->rootContext()->contextProperty("fixtureBrowser")); + m_view->rootContext()->setContextProperty( + "fixtureManager", m_mainView->rootContext()->contextProperty("fixtureManager")); + m_view->rootContext()->setContextProperty( + "fixtureGroupEditor", m_mainView->rootContext()->contextProperty("fixtureGroupEditor")); + m_view->rootContext()->setContextProperty( + "functionManager", m_mainView->rootContext()->contextProperty("functionManager")); + m_view->rootContext()->setContextProperty( + "contextManager", m_mainView->rootContext()->contextProperty("contextManager")); + m_view->rootContext()->setContextProperty( + "virtualConsole", m_mainView->rootContext()->contextProperty("virtualConsole")); + m_view->rootContext()->setContextProperty( + "showManager", m_mainView->rootContext()->contextProperty("showManager")); + m_view->rootContext()->setContextProperty( + "simpleDesk", m_mainView->rootContext()->contextProperty("simpleDesk")); + m_view->rootContext()->setContextProperty( + "actionManager", m_mainView->rootContext()->contextProperty("actionManager")); + m_view->rootContext()->setContextProperty( + "View2D", m_mainView->rootContext()->contextProperty("View2D")); + m_view->rootContext()->setContextProperty( + "View3D", m_mainView->rootContext()->contextProperty("View3D")); /** Set the fundamental properties to allow the detached context to properly load */ m_view->rootContext()->setContextProperty("viewSource", contextResource()); @@ -227,6 +231,7 @@ void ContextQuickView::keyReleaseEvent(QKeyEvent *e) void ContextQuickView::slotScreenChanged(QScreen *screen) { qDebug() << "Context screen changed"; - qreal pixelDensity = qMax(screen->physicalDotsPerInch() * 0.039370, (qreal)screen->size().height() / 220.0); + qreal pixelDensity = + qMax(screen->physicalDotsPerInch() * 0.039370, (qreal)screen->size().height() / 220.0); rootContext()->setContextProperty("screenPixelDensity", pixelDensity); } diff --git a/qmlui/rgbmatrixeditor.cpp b/qmlui/rgbmatrixeditor.cpp index b72bb92273..c1dc0e635a 100644 --- a/qmlui/rgbmatrixeditor.cpp +++ b/qmlui/rgbmatrixeditor.cpp @@ -96,8 +96,8 @@ void RGBMatrixEditor::setFixtureGroup(int fixtureGroup) QMutexLocker locker(&m_previewMutex); m_previewTimer->stop(); m_group = m_doc->fixtureGroup(fixtureGroup); - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetFixtureGroup, m_matrix->id(), m_matrix->fixtureGroup(), - fixtureGroup); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetFixtureGroup, m_matrix->id(), + m_matrix->fixtureGroup(), fixtureGroup); m_matrix->setFixtureGroup((quint32)fixtureGroup); emit fixtureGroupChanged(fixtureGroup); emit previewSizeChanged(); @@ -138,7 +138,8 @@ void RGBMatrixEditor::setAlgorithmIndex(int algoIndex) algo->setColors(m_matrix->startColor(), m_matrix->endColor()); } - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetAlgorithmIndex, m_matrix->id(), algorithmIndex(), algoIndex); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetAlgorithmIndex, m_matrix->id(), + algorithmIndex(), algoIndex); m_matrix->setAlgorithm(algo); initPreviewData(); @@ -168,8 +169,8 @@ void RGBMatrixEditor::setStartColor(QColor algoStartColor) if (m_matrix == nullptr || m_matrix->startColor() == algoStartColor) return; - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetStartColor, m_matrix->id(), m_matrix->startColor(), - algoStartColor); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetStartColor, m_matrix->id(), + m_matrix->startColor(), algoStartColor); m_matrix->setStartColor(algoStartColor); m_previewStepHandler->calculateColorDelta(m_matrix->startColor(), m_matrix->endColor()); @@ -189,7 +190,8 @@ void RGBMatrixEditor::setEndColor(QColor algoEndColor) if (m_matrix == nullptr || m_matrix->endColor() == algoEndColor) return; - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetEndColor, m_matrix->id(), m_matrix->endColor(), algoEndColor); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetEndColor, m_matrix->id(), + m_matrix->endColor(), algoEndColor); m_matrix->setEndColor(algoEndColor); m_previewStepHandler->calculateColorDelta(m_matrix->startColor(), m_matrix->endColor()); @@ -218,7 +220,8 @@ void RGBMatrixEditor::setHasEndColor(bool hasEndCol) QString RGBMatrixEditor::algoText() const { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Text) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Text) { RGBText *algo = static_cast(m_matrix->algorithm()); return algo->text(); @@ -229,7 +232,8 @@ QString RGBMatrixEditor::algoText() const void RGBMatrixEditor::setAlgoText(QString text) { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Text) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Text) { RGBText *algo = static_cast(m_matrix->algorithm()); if (algo->text() == text) @@ -244,7 +248,8 @@ void RGBMatrixEditor::setAlgoText(QString text) QFont RGBMatrixEditor::algoTextFont() const { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Text) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Text) { RGBText *algo = static_cast(m_matrix->algorithm()); return algo->font(); @@ -254,13 +259,15 @@ QFont RGBMatrixEditor::algoTextFont() const void RGBMatrixEditor::setAlgoTextFont(QFont algoTextFont) { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Text) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Text) { RGBText *algo = static_cast(m_matrix->algorithm()); if (algo->font() == algoTextFont) return; - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetTextFont, m_matrix->id(), algo->font(), algoTextFont); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetTextFont, m_matrix->id(), + algo->font(), algoTextFont); QMutexLocker algorithmLocker(&m_matrix->algorithmMutex()); algo->setFont(algoTextFont); emit algoTextFontChanged(algoTextFont); @@ -269,7 +276,8 @@ void RGBMatrixEditor::setAlgoTextFont(QFont algoTextFont) QString RGBMatrixEditor::algoImagePath() const { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Image) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Image) { RGBImage *algo = static_cast(m_matrix->algorithm()); return algo->filename(); @@ -280,7 +288,8 @@ QString RGBMatrixEditor::algoImagePath() const void RGBMatrixEditor::setAlgoImagePath(QString path) { - if (m_matrix != nullptr && m_matrix->algorithm() != nullptr && m_matrix->algorithm()->type() == RGBAlgorithm::Image) + if (m_matrix != nullptr && m_matrix->algorithm() != nullptr + && m_matrix->algorithm()->type() == RGBAlgorithm::Image) { RGBImage *algo = static_cast(m_matrix->algorithm()); @@ -290,7 +299,8 @@ void RGBMatrixEditor::setAlgoImagePath(QString path) if (algo->filename() == path) return; - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetImage, m_matrix->id(), algo->filename(), path); + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetImage, m_matrix->id(), + algo->filename(), path); QMutexLocker algorithmLocker(&m_matrix->algorithmMutex()); algo->setFilename(path); emit algoImagePathChanged(path); @@ -399,7 +409,8 @@ void RGBMatrixEditor::setAnimationStyle(int style) void RGBMatrixEditor::createScriptObjects(QQuickItem *parent) { - if (m_matrix == nullptr || m_matrix->algorithm() == nullptr || m_matrix->algorithm()->type() != RGBAlgorithm::Script) + if (m_matrix == nullptr || m_matrix->algorithm() == nullptr + || m_matrix->algorithm()->type() != RGBAlgorithm::Script) return; RGBScript *script = static_cast(m_matrix->algorithm()); @@ -432,7 +443,8 @@ void RGBMatrixEditor::createScriptObjects(QQuickItem *parent) } QMetaObject::invokeMethod(parent, "addComboBox", Q_ARG(QVariant, prop.m_name), - Q_ARG(QVariant, QVariant::fromValue(valList)), Q_ARG(QVariant, currIdx)); + Q_ARG(QVariant, QVariant::fromValue(valList)), + Q_ARG(QVariant, currIdx)); } break; case RGBScriptProperty::Range: @@ -440,7 +452,8 @@ void RGBMatrixEditor::createScriptObjects(QQuickItem *parent) QString pValue = m_matrix->property(prop.m_name); QMetaObject::invokeMethod(parent, "addSpinBox", Q_ARG(QVariant, prop.m_name), - Q_ARG(QVariant, prop.m_rangeMinValue), Q_ARG(QVariant, prop.m_rangeMaxValue), + Q_ARG(QVariant, prop.m_rangeMinValue), + Q_ARG(QVariant, prop.m_rangeMaxValue), Q_ARG(QVariant, pValue.toInt())); } break; @@ -453,26 +466,30 @@ void RGBMatrixEditor::createScriptObjects(QQuickItem *parent) void RGBMatrixEditor::setScriptStringProperty(QString paramName, QString value) { - if (m_matrix == nullptr || m_matrix->algorithm() == nullptr || m_matrix->algorithm()->type() != RGBAlgorithm::Script) + if (m_matrix == nullptr || m_matrix->algorithm() == nullptr + || m_matrix->algorithm()->type() != RGBAlgorithm::Script) return; qDebug() << "[setScriptStringProperty] param:" << paramName << ", value:" << value; StringStringPair oldValue(paramName, m_matrix->property(paramName)); - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetScriptStringValue, m_matrix->id(), QVariant::fromValue(oldValue), + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetScriptStringValue, m_matrix->id(), + QVariant::fromValue(oldValue), QVariant::fromValue(StringStringPair(paramName, value))); m_matrix->setProperty(paramName, value); } void RGBMatrixEditor::setScriptIntProperty(QString paramName, int value) { - if (m_matrix == nullptr || m_matrix->algorithm() == nullptr || m_matrix->algorithm()->type() != RGBAlgorithm::Script) + if (m_matrix == nullptr || m_matrix->algorithm() == nullptr + || m_matrix->algorithm()->type() != RGBAlgorithm::Script) return; qDebug() << "[setScriptIntProperty] param:" << paramName << ", value:" << value; StringIntPair oldValue(paramName, m_matrix->property(paramName).toInt()); - Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetScriptIntValue, m_matrix->id(), QVariant::fromValue(oldValue), + Tardis::instance()->enqueueAction(Tardis::RGBMatrixSetScriptIntValue, m_matrix->id(), + QVariant::fromValue(oldValue), QVariant::fromValue(StringIntPair(paramName, value))); m_matrix->setProperty(paramName, QString::number(value)); } @@ -557,8 +574,8 @@ void RGBMatrixEditor::slotPreviewTimeout() { QMutexLocker locker(&m_previewMutex); - m_previewStepHandler->checkNextStep(m_matrix->runOrder(), m_matrix->startColor(), m_matrix->endColor(), - m_matrix->stepsCount()); + m_previewStepHandler->checkNextStep(m_matrix->runOrder(), m_matrix->startColor(), + m_matrix->endColor(), m_matrix->stepsCount()); m_matrix->previewMap(m_previewStepHandler->currentStepIndex(), m_previewStepHandler); @@ -567,24 +584,24 @@ void RGBMatrixEditor::slotPreviewTimeout() m_previewElapsed = 0; /* - for (int y = 0; y < map.size(); y++) + for (int y = 0; y < map.size(); y++) + { + for (int x = 0; x < map[y].size(); x++) + { + QLCPoint pt(x, y); + if (m_group->head(pt).isValid()) { - for (int x = 0; x < map[y].size(); x++) - { - QLCPoint pt(x, y); - if (m_group->head(pt).isValid()) - { - if (shape->color() != QColor(map[y][x]).rgb()) - shape->setColor(map[y][x]); - - if (shape->color() == QColor(Qt::black).rgb()) - shape->draw(m_matrix->fadeOutSpeed()); - else - shape->draw(m_matrix->fadeInSpeed()); - } - } + if (shape->color() != QColor(map[y][x]).rgb()) + shape->setColor(map[y][x]); + + if (shape->color() == QColor(Qt::black).rgb()) + shape->draw(m_matrix->fadeOutSpeed()); + else + shape->draw(m_matrix->fadeInSpeed()); } - */ + } + } +*/ if (m_previewData.isEmpty() || m_previewStepHandler->m_map.isEmpty()) return; @@ -623,8 +640,8 @@ void RGBMatrixEditor::initPreviewData() if (m_matrix == nullptr) return; - m_previewStepHandler->initializeDirection(m_matrix->direction(), m_matrix->startColor(), m_matrix->endColor(), - m_matrix->stepsCount()); + m_previewStepHandler->initializeDirection(m_matrix->direction(), m_matrix->startColor(), + m_matrix->endColor(), m_matrix->stepsCount()); m_previewStepHandler->calculateColorDelta(m_matrix->startColor(), m_matrix->endColor()); m_previewTimer->start(MasterTimer::tick()); diff --git a/qmlui/sceneeditor.cpp b/qmlui/sceneeditor.cpp index 99f4247838..63a9611f70 100644 --- a/qmlui/sceneeditor.cpp +++ b/qmlui/sceneeditor.cpp @@ -53,7 +53,8 @@ SceneEditor::SceneEditor(QQuickView *view, Doc *doc, QObject *parent) SceneEditor::~SceneEditor() { m_view->rootContext()->setContextProperty("sceneEditor", nullptr); - QQuickItem *bottomPanel = qobject_cast(m_view->rootObject()->findChild("bottomPanelItem")); + QQuickItem *bottomPanel = + qobject_cast(m_view->rootObject()->findChild("bottomPanelItem")); if (bottomPanel != nullptr) bottomPanel->setProperty("visible", false); @@ -63,7 +64,8 @@ SceneEditor::~SceneEditor() void SceneEditor::setFunctionID(quint32 id) { - QQuickItem *bottomPanel = qobject_cast(m_view->rootObject()->findChild("bottomPanelItem")); + QQuickItem *bottomPanel = + qobject_cast(m_view->rootObject()->findChild("bottomPanelItem")); if (id == Function::invalidId()) { @@ -131,7 +133,8 @@ void SceneEditor::sceneConsoleLoaded(bool status) } else { - m_sceneConsole = qobject_cast(m_view->rootObject()->findChild("sceneFixtureConsole")); + m_sceneConsole = qobject_cast( + m_view->rootObject()->findChild("sceneFixtureConsole")); } } @@ -215,8 +218,8 @@ void SceneEditor::slotSceneValueChanged(SceneValue scv) { if (m_fxConsoleMap.contains(fxIndex)) { - QMetaObject::invokeMethod(m_fxConsoleMap[fxIndex], "setChannelValue", Q_ARG(QVariant, scv.channel), - Q_ARG(QVariant, scv.value)); + QMetaObject::invokeMethod(m_fxConsoleMap[fxIndex], "setChannelValue", + Q_ARG(QVariant, scv.channel), Q_ARG(QVariant, scv.value)); fixture->checkAlias(scv.channel, scv.value); } @@ -247,7 +250,8 @@ void SceneEditor::unsetChannel(quint32 fxID, quint32 channel) QVariant currentVal; uchar currDmxValue = m_scene->value(fxID, channel); currentVal.setValue(SceneValue(fxID, channel, currDmxValue)); - Tardis::instance()->enqueueAction(Tardis::SceneUnsetChannelValue, m_scene->id(), currentVal, QVariant()); + Tardis::instance()->enqueueAction(Tardis::SceneUnsetChannelValue, m_scene->id(), currentVal, + QVariant()); m_scene->unsetValue(fxID, channel); if (m_source->isOutputEnabled() == true) diff --git a/qmlui/showmanager.cpp b/qmlui/showmanager.cpp index 018deac019..c2b13cef1e 100644 --- a/qmlui/showmanager.cpp +++ b/qmlui/showmanager.cpp @@ -98,7 +98,8 @@ void ShowManager::setShowName(QString showName) if (m_currentShow == nullptr || m_currentShow->name() == showName) return; - Tardis::instance()->enqueueAction(Tardis::FunctionSetName, m_currentShow->id(), m_currentShow->name(), showName); + Tardis::instance()->enqueueAction(Tardis::FunctionSetName, m_currentShow->id(), + m_currentShow->name(), showName); m_currentShow->setName(showName); emit showNameChanged(showName); @@ -320,12 +321,14 @@ void ShowManager::deleteShowItems(QVariantList data) emit selectedItemsCountChanged(0); } -bool ShowManager::checkAndMoveItem(ShowFunction *sf, int originalTrackIdx, int newTrackIdx, int newStartTime) +bool ShowManager::checkAndMoveItem(ShowFunction *sf, int originalTrackIdx, int newTrackIdx, + int newStartTime) { if (m_currentShow == nullptr || sf == nullptr) return false; - // qDebug() << Q_FUNC_INFO << "origIdx:" << originalTrackIdx << "newIdx:" << newTrackIdx << "time:" << newStartTime; + // qDebug() << Q_FUNC_INFO << "origIdx:" << originalTrackIdx << "newIdx:" << newTrackIdx << + // "time:" << newStartTime; Track *dstTrack = nullptr; @@ -350,11 +353,13 @@ bool ShowManager::checkAndMoveItem(ShowFunction *sf, int originalTrackIdx, int n if (m_gridEnabled) { // calculate the X position from time and time scale - float xPos = ((float)newStartTime * m_tickSize) / (m_timeScale * 1000.0); // timescale * 1000 : tickSize = time : x + float xPos = ((float)newStartTime * m_tickSize) + / (m_timeScale * 1000.0); // timescale * 1000 : tickSize = time : x // round to the nearest snap position - xPos = qRound(xPos / m_tickSize) * m_tickSize; + xPos = qRound(xPos / m_tickSize) * m_tickSize; // recalculate the time from pixels - float time = xPos * (1000 * m_timeScale) / m_tickSize; // xPos : time = tickSize : timescale * 1000 + float time = + xPos * (1000 * m_timeScale) / m_tickSize; // xPos : time = tickSize : timescale * 1000 sf->setStartTime(time); } else @@ -434,7 +439,8 @@ void ShowManager::renderView(QQuickItem *parent) void ShowManager::enableFlicking(bool enable) { - QQuickItem *flickable = qobject_cast(m_view->rootObject()->findChild("showItemsArea")); + QQuickItem *flickable = + qobject_cast(m_view->rootObject()->findChild("showItemsArea")); flickable->setProperty("interactive", enable); } @@ -592,7 +598,8 @@ void ShowManager::slotTimeChanged(quint32 msec_time) emit currentTimeChanged(m_currentTime); } -bool ShowManager::checkOverlapping(Track *track, ShowFunction *sourceFunc, quint32 startTime, quint32 duration) +bool ShowManager::checkOverlapping(Track *track, ShowFunction *sourceFunc, quint32 startTime, + quint32 duration) { if (track == nullptr) return false; @@ -606,7 +613,8 @@ bool ShowManager::checkOverlapping(Track *track, ShowFunction *sourceFunc, quint if (func != nullptr) { quint32 fst = sf->startTime(); - if ((startTime >= fst && startTime <= fst + sf->duration()) || (fst >= startTime && fst <= startTime + duration)) + if ((startTime >= fst && startTime <= fst + sf->duration()) + || (fst >= startTime && fst <= startTime + duration)) { return true; } @@ -741,7 +749,8 @@ void ShowManager::pasteFromClipboard() m_doc->addFunction(copyFunc); - addItems(contextItem(), item.m_trackIndex, m_currentTime + item.m_showFunc->startTime() - lowerTime, + addItems(contextItem(), item.m_trackIndex, + m_currentTime + item.m_showFunc->startTime() - lowerTime, QVariantList() << copyFunc->id()); } } diff --git a/qmlui/showmanager.h b/qmlui/showmanager.h index fb17800b15..b25fcbf8d6 100644 --- a/qmlui/showmanager.h +++ b/qmlui/showmanager.h @@ -53,7 +53,8 @@ class ShowManager : public PreviewContext Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged) Q_PROPERTY(int showDuration READ showDuration NOTIFY showDurationChanged) Q_PROPERTY(QVariant tracks READ tracks NOTIFY tracksChanged) - Q_PROPERTY(int selectedTrackIndex READ selectedTrackIndex WRITE setSelectedTrackIndex NOTIFY selectedTrackIndexChanged) + Q_PROPERTY(int selectedTrackIndex READ selectedTrackIndex WRITE setSelectedTrackIndex NOTIFY + selectedTrackIndexChanged) Q_PROPERTY(int selectedItemsCount READ selectedItemsCount NOTIFY selectedItemsCountChanged) public: @@ -212,7 +213,8 @@ class ShowManager : public PreviewContext * If there is enough space, then the item is (in case) removed from the * $originalTrackIdx and moved into $newTrackIdx and true is returned. */ - Q_INVOKABLE bool checkAndMoveItem(ShowFunction *sf, int originalTrackIdx, int newTrackIdx, int newStartTime); + Q_INVOKABLE bool checkAndMoveItem(ShowFunction *sf, int originalTrackIdx, int newTrackIdx, + int newStartTime); /** Returns the number of the currently selected Show items */ int selectedItemsCount() const; diff --git a/qmlui/simpledesk.cpp b/qmlui/simpledesk.cpp index 95e087cb32..00a4ee9700 100644 --- a/qmlui/simpledesk.cpp +++ b/qmlui/simpledesk.cpp @@ -73,8 +73,10 @@ SimpleDesk::SimpleDesk(QQuickView *view, Doc *doc, FunctionManager *funcMgr, QOb connect(m_doc, SIGNAL(fixtureAdded(quint32)), this, SLOT(updateChannelList())); connect(m_doc, SIGNAL(fixtureRemoved(quint32)), this, SLOT(updateChannelList())); connect(m_doc, SIGNAL(fixtureChanged(quint32)), this, SLOT(updateChannelList())); - connect(m_doc->inputOutputMap(), SIGNAL(universeAdded(quint32)), this, SIGNAL(universesListModelChanged())); - connect(m_doc->inputOutputMap(), SIGNAL(universeRemoved(quint32)), this, SIGNAL(universesListModelChanged())); + connect(m_doc->inputOutputMap(), SIGNAL(universeAdded(quint32)), this, + SIGNAL(universesListModelChanged())); + connect(m_doc->inputOutputMap(), SIGNAL(universeRemoved(quint32)), this, + SIGNAL(universesListModelChanged())); connect(m_doc->inputOutputMap(), SIGNAL(universeWritten(quint32, QByteArray)), this, SLOT(slotUniverseWritten(quint32, QByteArray))); } @@ -198,7 +200,8 @@ void SimpleDesk::setValue(quint32 fixtureID, uint channel, uchar value) SceneValue currScv; Fixture *fixture = nullptr; - qDebug() << "[Simple Desk] set value for fixture" << fixtureID << "channel" << channel << "value" << value; + qDebug() << "[Simple Desk] set value for fixture" << fixtureID << "channel" << channel + << "value" << value; if (fixtureID != Fixture::invalidId()) { @@ -458,9 +461,11 @@ QStringList SimpleDesk::commandHistory() const * DMXSource ************************************************************************/ -FadeChannel *SimpleDesk::getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel) +FadeChannel *SimpleDesk::getFader(QList universes, quint32 universeID, + quint32 fixtureID, quint32 channel) { - qDebug() << "[Simple Desk] get fader for universe" << universeID << "fixture" << fixtureID << "channel" << channel; + qDebug() << "[Simple Desk] get fader for universe" << universeID << "fixture" << fixtureID + << "channel" << channel; // get the universe Fader first. If doesn't exist, create it QSharedPointer fader = m_fadersMap.value(universeID, QSharedPointer()); @@ -492,7 +497,8 @@ void SimpleDesk::writeDMX(MasterTimer *timer, QList ua) // ua[universe]->reset(0, 512); - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (!fader.isNull()) { // loop through all active fadechannels and restore default values @@ -510,7 +516,8 @@ void SimpleDesk::writeDMX(MasterTimer *timer, QList ua) { // qDebug() << "Restoring default value of fixture" << fixture->id() // << "channel" << chIndex << "value" << ch->defaultValue(); - ua[universe]->setChannelDefaultValue(fixture->address() + chIndex, ch->defaultValue()); + ua[universe]->setChannelDefaultValue(fixture->address() + chIndex, + ch->defaultValue()); } } else @@ -533,7 +540,8 @@ void SimpleDesk::writeDMX(MasterTimer *timer, QList ua) { quint32 channel = command.second; quint32 universe = channel >> 9; - QSharedPointer fader = m_fadersMap.value(universe, QSharedPointer()); + QSharedPointer fader = + m_fadersMap.value(universe, QSharedPointer()); if (!fader.isNull()) { FadeChannel fc(m_doc, Fixture::invalidId(), channel); @@ -546,8 +554,8 @@ void SimpleDesk::writeDMX(MasterTimer *timer, QList ua) const QLCChannel *ch = fixture->channel(chIndex); if (ch != NULL) { - qDebug() << "Restoring default value of fixture" << fixture->id() << "channel" << chIndex - << "value" << ch->defaultValue(); + qDebug() << "Restoring default value of fixture" << fixture->id() + << "channel" << chIndex << "value" << ch->defaultValue(); ua[universe]->setChannelDefaultValue(channel, ch->defaultValue()); } } diff --git a/qmlui/simpledesk.h b/qmlui/simpledesk.h index cc0250b4d8..b35c0d0ee9 100644 --- a/qmlui/simpledesk.h +++ b/qmlui/simpledesk.h @@ -189,7 +189,8 @@ protected slots: void writeDMX(MasterTimer *timer, QList ua); private: - FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, quint32 channel); + FadeChannel *getFader(QList universes, quint32 universeID, quint32 fixtureID, + quint32 channel); private: /** Map used to lookup a GenericFader instance for a Universe ID */ diff --git a/qmlui/tardis/networkmanager.cpp b/qmlui/tardis/networkmanager.cpp index 7d9d62b322..6c172694c9 100644 --- a/qmlui/tardis/networkmanager.cpp +++ b/qmlui/tardis/networkmanager.cpp @@ -217,7 +217,8 @@ bool NetworkManager::startServer() m_udpSocket = new QUdpSocket(this); - if (m_udpSocket->bind(DEFAULT_UDP_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) == false) + if (m_udpSocket->bind(DEFAULT_UDP_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) + == false) { qDebug() << Q_FUNC_INFO << "Error in binding UDP socket on" << DEFAULT_UDP_PORT; return false; @@ -248,7 +249,8 @@ bool NetworkManager::stopServer() return false; disconnect(m_udpSocket, &QUdpSocket::readyRead, this, &NetworkManager::slotProcessUDPPackets); - disconnect(m_tcpServer, &QTcpServer::newConnection, this, &NetworkManager::slotProcessNewTCPConnection); + disconnect(m_tcpServer, &QTcpServer::newConnection, this, + &NetworkManager::slotProcessNewTCPConnection); m_udpSocket->close(); m_tcpServer->close(); @@ -392,7 +394,8 @@ bool NetworkManager::initializeClient() m_udpSocket = new QUdpSocket(this); - if (m_udpSocket->bind(DEFAULT_UDP_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) == false) + if (m_udpSocket->bind(DEFAULT_UDP_PORT, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) + == false) { qDebug() << Q_FUNC_INFO << "Error in binding UDP socket on" << DEFAULT_UDP_PORT; return false; @@ -413,7 +416,8 @@ bool NetworkManager::initializeClient() { foreach (QNetworkAddressEntry entry, iface.addressEntries()) { - if (entry.ip().protocol() != QAbstractSocket::IPv6Protocol && entry.ip() != QHostAddress::LocalHost) + if (entry.ip().protocol() != QAbstractSocket::IPv6Protocol + && entry.ip() != QHostAddress::LocalHost) { qDebug() << "Sending announcement on" << iface.name(); m_udpSocket->writeDatagram(packet, entry.broadcast(), DEFAULT_UDP_PORT); @@ -536,7 +540,8 @@ void NetworkManager::slotProcessUDPPackets() case Tardis::NetAnnounceReply: { - if (m_hostType == ClientHostType && paramsList.count() == 2 && paramsList.at(0).toInt() == ServerHostType) + if (m_hostType == ClientHostType && paramsList.count() == 2 + && paramsList.at(0).toInt() == ServerHostType) { m_serverList[senderAddress] = paramsList.at(1).toString(); emit serverListChanged(); @@ -572,10 +577,10 @@ void NetworkManager::slotProcessTCPPackets() int actionCode = 0; QVariantList paramsList; QByteArray datagram = wholeData.mid(bytesProcessed); - int read = m_packetizer->decodePacket(datagram, actionCode, paramsList, m_crypt); + int read = m_packetizer->decodePacket(datagram, actionCode, paramsList, m_crypt); - qDebug() << "Bytes processed" << read << "action" << QString::number(actionCode, 16) << "params" - << paramsList.count(); + qDebug() << "Bytes processed" << read << "action" << QString::number(actionCode, 16) + << "params" << paramsList.count(); if (read < 0) { @@ -706,7 +711,8 @@ void NetworkManager::slotProcessNewTCPConnection() } else { - qDebug() << "[slotProcessNewTCPConnection] Adding a new host to map:" << senderAddress.toString(); + qDebug() << "[slotProcessNewTCPConnection] Adding a new host to map:" + << senderAddress.toString(); NetworkHost *newHost = new NetworkHost; newHost->isAuthenticated = false; newHost->tcpSocket = clientConnection; diff --git a/qmlui/tardis/networkpacketizer.cpp b/qmlui/tardis/networkpacketizer.cpp index 19579aec0a..16d6fd2082 100644 --- a/qmlui/tardis/networkpacketizer.cpp +++ b/qmlui/tardis/networkpacketizer.cpp @@ -209,7 +209,7 @@ void NetworkPacketizer::addSection(QByteArray &packet, QVariant value) QByteArray NetworkPacketizer::encryptPacket(QByteArray &packet, SimpleCrypt *crypter) { - QByteArray encPacket = packet.mid(0, HEADER_LENGTH); // copy the fixed size header + QByteArray encPacket = packet.mid(0, HEADER_LENGTH); // copy the fixed size header encPacket.append(crypter->encryptToByteArray(packet.mid(HEADER_LENGTH))); // encrypt the rest quint16 newLength = encPacket.length() - HEADER_LENGTH; @@ -219,7 +219,8 @@ QByteArray NetworkPacketizer::encryptPacket(QByteArray &packet, SimpleCrypt *cry return encPacket; } -int NetworkPacketizer::decodePacket(QByteArray &packet, int &opCode, QVariantList §ions, SimpleCrypt *decrypter) +int NetworkPacketizer::decodePacket(QByteArray &packet, int &opCode, QVariantList §ions, + SimpleCrypt *decrypter) { int bytes_read = 0; quint8 sections_number = 0; @@ -371,11 +372,13 @@ int NetworkPacketizer::decodePacket(QByteArray &packet, int &opCode, QVariantLis case UIntPairType: { UIntPair pairVal; - pairVal.first = ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) - + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); + pairVal.first = + ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) + + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); bytes_read += 4; - pairVal.second = ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) - + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); + pairVal.second = + ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) + + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); bytes_read += 4; QVariant var; var.setValue(pairVal); @@ -386,15 +389,16 @@ int NetworkPacketizer::decodePacket(QByteArray &packet, int &opCode, QVariantLis { StringIntPair pairVal; QString strVal; - quint16 sLength = ((quint16)ba.at(bytes_read) << 8) + (quint16)ba.at(bytes_read + 1); + quint16 sLength = ((quint16)ba.at(bytes_read) << 8) + (quint16)ba.at(bytes_read + 1); bytes_read += 2; strVal.append(ba.mid(bytes_read, sLength)); pairVal.first = strVal; bytes_read += sLength; - pairVal.second = ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) - + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); + pairVal.second = + ((quint8)ba.at(bytes_read) << 24) + ((quint8)ba.at(bytes_read + 1) << 16) + + ((quint8)ba.at(bytes_read + 2) << 8) + (quint8)ba.at(bytes_read + 3); bytes_read += 4; QVariant var; @@ -406,7 +410,7 @@ int NetworkPacketizer::decodePacket(QByteArray &packet, int &opCode, QVariantLis { StringStringPair pairVal; QString strVal; - quint16 sLength = ((quint16)ba.at(bytes_read) << 8) + (quint16)ba.at(bytes_read + 1); + quint16 sLength = ((quint16)ba.at(bytes_read) << 8) + (quint16)ba.at(bytes_read + 1); bytes_read += 2; strVal.append(ba.mid(bytes_read, sLength)); diff --git a/qmlui/tardis/networkpacketizer.h b/qmlui/tardis/networkpacketizer.h index 212aa22ce5..839889b801 100644 --- a/qmlui/tardis/networkpacketizer.h +++ b/qmlui/tardis/networkpacketizer.h @@ -54,7 +54,7 @@ class NetworkPacketizer void addSection(QByteArray &packet, QVariant value); QByteArray encryptPacket(QByteArray &packet, SimpleCrypt *crypter); - int decodePacket(QByteArray &packet, int &opCode, QVariantList §ions, SimpleCrypt *decrypter); + int decodePacket(QByteArray &packet, int &opCode, QVariantList §ions, SimpleCrypt *decrypter); private: }; diff --git a/qmlui/tardis/simplecrypt.h b/qmlui/tardis/simplecrypt.h index 0dd2c1ab10..70bc10a2a5 100644 --- a/qmlui/tardis/simplecrypt.h +++ b/qmlui/tardis/simplecrypt.h @@ -65,8 +65,7 @@ class SimpleCrypt enum CompressionMode { CompressionAuto, /*!< Only apply compression if that results in a shorter plaintext. */ - CompressionAlways, /*!< Always apply compression. Note that for short inputs, a compression may result in longer - data */ + CompressionAlways, /*!< Always apply compression. Note that for short inputs, a compression may result in longer data */ CompressionNever /*!< Never apply compression. */ }; /** @@ -79,21 +78,18 @@ class SimpleCrypt */ enum IntegrityProtectionMode { - ProtectionNone, /*!< The integerity of the encrypted data is not protected. It is not really possible to detect - a wrong key, for instance. */ - ProtectionChecksum, /*!< A simple checksum is used to verify that the data is in order. If not, an empty string - is returned. */ - ProtectionHash /*!< A cryptographic hash is used to verify the integrity of the data. This method produces a - much stronger, but longer check */ + ProtectionNone, /*!< The integerity of the encrypted data is not protected. It is not really possible to detect a wrong key, for instance. */ + ProtectionChecksum, /*!< A simple checksum is used to verify that the data is in order. If not, an empty string is returned. */ + ProtectionHash /*!< A cryptographic hash is used to verify the integrity of the data. This method produces a much stronger, but longer check */ }; /** Error describes the type of error that occured. */ enum Error { - ErrorNoError, /*!< No error occurred. */ - ErrorNoKeySet, /*!< No key was set. You can not encrypt or decrypt without a valid key. */ - ErrorUnknownVersion, /*!< The version of this data is unknown, or the data is otherwise not valid. */ + ErrorNoError, /*!< No error occurred. */ + ErrorNoKeySet, /*!< No key was set. You can not encrypt or decrypt without a valid key. */ + ErrorUnknownVersion, /*!< The version of this data is unknown, or the data is otherwise not valid. */ ErrorIntegrityFailed, /*!< The integrity check of the data failed. Perhaps the wrong key was used. */ }; diff --git a/qmlui/tardis/tardis.cpp b/qmlui/tardis/tardis.cpp index f63aed4f7a..cf741c7a2d 100644 --- a/qmlui/tardis/tardis.cpp +++ b/qmlui/tardis/tardis.cpp @@ -55,8 +55,9 @@ Tardis *Tardis::s_instance = nullptr; -Tardis::Tardis(QQuickView *view, Doc *doc, NetworkManager *netMgr, FixtureManager *fxMgr, FunctionManager *funcMgr, - ContextManager *ctxMgr, SimpleDesk *sDesk, ShowManager *showMgr, VirtualConsole *vc, QObject *parent) +Tardis::Tardis(QQuickView *view, Doc *doc, NetworkManager *netMgr, FixtureManager *fxMgr, + FunctionManager *funcMgr, ContextManager *ctxMgr, SimpleDesk *sDesk, + ShowManager *showMgr, VirtualConsole *vc, QObject *parent) : QThread(parent) , m_running(false) , m_view(view) @@ -100,7 +101,8 @@ Tardis *Tardis::instance() void Tardis::enqueueAction(int code, quint32 objID, QVariant oldVal, QVariant newVal) { - if (m_busy || m_doc->loadStatus() == Doc::Loading || m_virtualConsole->loadStatus() == VirtualConsole::Loading) + if (m_busy || m_doc->loadStatus() == Doc::Loading + || m_virtualConsole->loadStatus() == VirtualConsole::Loading) return; TardisAction action; @@ -183,7 +185,8 @@ void Tardis::redoAction() forwardActionToNetwork(code, action); /* Check if I am processing a batch of actions or a single one */ - if (m_historyIndex == m_history.count() - 1 || action.m_timestamp - refTimestamp > TARDIS_ACTION_INTERTIME) + if (m_historyIndex == m_history.count() - 1 + || action.m_timestamp - refTimestamp > TARDIS_ACTION_INTERTIME) { done = true; } @@ -206,8 +209,8 @@ void Tardis::forwardActionToNetwork(int code, TardisAction &action) { if (m_networkManager->connectionsCount()) { - QMetaObject::invokeMethod(m_networkManager, "sendAction", Qt::QueuedConnection, Q_ARG(int, code), - Q_ARG(TardisAction, action)); + QMetaObject::invokeMethod(m_networkManager, "sendAction", Qt::QueuedConnection, + Q_ARG(int, code), Q_ARG(TardisAction, action)); } } @@ -219,8 +222,8 @@ void Tardis::run() { if (m_queueSem.tryAcquire(1, 1000) == false) { - // qDebug() << "No actions to process, history length:" << m_historyCount << "(" << m_history.count() << - // ")"; + // qDebug() << "No actions to process, history length:" << m_historyCount << "(" << + // m_history.count() << ")"; continue; } @@ -282,7 +285,8 @@ void Tardis::run() } } - if (m_history.isEmpty() || action.m_timestamp - m_history.last().m_timestamp > TARDIS_ACTION_INTERTIME) + if (m_history.isEmpty() + || action.m_timestamp - m_history.last().m_timestamp > TARDIS_ACTION_INTERTIME) m_historyCount++; if (match == false) @@ -299,7 +303,8 @@ void Tardis::run() m_historyIndex = m_history.count() - 1; - qDebug("Got action: 0x%02X, history length: %d (%d)", action.m_action, m_historyCount, int(m_history.count())); + qDebug("Got action: 0x%02X, history length: %d (%d)", action.m_action, m_historyCount, + int(m_history.count())); /* If there are active network connections, send the action there too */ forwardActionToNetwork(action.m_action, action); @@ -354,7 +359,8 @@ QByteArray Tardis::actionToByteArray(int code, quint32 objID, QVariant data) { Chaser *chaser = qobject_cast(m_doc->function(objID)); ChaserStep *step = chaser->stepAt(data.toInt()); - step->saveXML(&xmlWriter, data.toInt(), chaser->type() == Function::SequenceType ? true : false); + step->saveXML(&xmlWriter, data.toInt(), + chaser->type() == Function::SequenceType ? true : false); } break; case EFXAddFixture: @@ -495,7 +501,8 @@ bool Tardis::processBufferedAction(int action, quint32 objID, QVariant &value) QXmlStreamAttributes attrs = xmlReader.attributes(); if (attrs.hasAttribute(KXMLQLCVCWidgetID)) - m_virtualConsole->deleteVCWidgets(QVariantList() << attrs.value(KXMLQLCVCWidgetID).toUInt()); + m_virtualConsole->deleteVCWidgets(QVariantList() + << attrs.value(KXMLQLCVCWidgetID).toUInt()); } break; @@ -539,20 +546,24 @@ int Tardis::processAction(TardisAction &action, bool undo) /* *********************** Input/Output manager actions ************************ */ case IOAddUniverse: - processBufferedAction(undo ? IORemoveUniverse : IOAddUniverse, action.m_objID, action.m_newValue); + processBufferedAction(undo ? IORemoveUniverse : IOAddUniverse, action.m_objID, + action.m_newValue); return undo ? IORemoveUniverse : IOAddUniverse; case IORemoveUniverse: - processBufferedAction(undo ? IOAddUniverse : IORemoveUniverse, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? IOAddUniverse : IORemoveUniverse, action.m_objID, + action.m_oldValue); return undo ? IOAddUniverse : IORemoveUniverse; /* *********************** Fixture editing actions ************************ */ case FixtureCreate: - processBufferedAction(undo ? FixtureDelete : FixtureCreate, action.m_objID, action.m_newValue); + processBufferedAction(undo ? FixtureDelete : FixtureCreate, action.m_objID, + action.m_newValue); return undo ? FixtureDelete : FixtureCreate; case FixtureDelete: - processBufferedAction(undo ? FixtureCreate : FixtureDelete, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? FixtureCreate : FixtureDelete, action.m_objID, + action.m_oldValue); return undo ? FixtureCreate : FixtureDelete; case FixtureMove: @@ -580,11 +591,13 @@ int Tardis::processAction(TardisAction &action, bool undo) /* *********************** Function editing actions *********************** */ case FunctionCreate: - processBufferedAction(undo ? FunctionDelete : FunctionCreate, action.m_objID, action.m_newValue); + processBufferedAction(undo ? FunctionDelete : FunctionCreate, action.m_objID, + action.m_newValue); return undo ? FunctionDelete : FunctionCreate; case FunctionDelete: - processBufferedAction(undo ? FunctionCreate : FunctionDelete, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? FunctionCreate : FunctionDelete, action.m_objID, + action.m_oldValue); return undo ? FunctionCreate : FunctionDelete; case FunctionSetName: @@ -602,19 +615,22 @@ int Tardis::processAction(TardisAction &action, bool undo) case FunctionSetTempoType: { auto member = std::mem_fn(&Function::setTempoType); - member(qobject_cast(m_doc->function(action.m_objID)), Function::TempoType(value->toInt())); + member(qobject_cast(m_doc->function(action.m_objID)), + Function::TempoType(value->toInt())); } break; case FunctionSetRunOrder: { auto member = std::mem_fn(&Function::setRunOrder); - member(qobject_cast(m_doc->function(action.m_objID)), Function::RunOrder(value->toInt())); + member(qobject_cast(m_doc->function(action.m_objID)), + Function::RunOrder(value->toInt())); } break; case FunctionSetDirection: { auto member = std::mem_fn(&Function::setDirection); - member(qobject_cast(m_doc->function(action.m_objID)), Function::Direction(value->toInt())); + member(qobject_cast(m_doc->function(action.m_objID)), + Function::Direction(value->toInt())); } break; case FunctionSetFadeIn: @@ -648,8 +664,8 @@ int Tardis::processAction(TardisAction &action, bool undo) { if (value->isNull()) { - SceneValue otherValue = - undo ? action.m_newValue.value() : action.m_oldValue.value(); + SceneValue otherValue = undo ? action.m_newValue.value() + : action.m_oldValue.value(); scene->unsetValue(otherValue.fxi, otherValue.channel); } else @@ -663,11 +679,13 @@ int Tardis::processAction(TardisAction &action, bool undo) /* *********************** Chaser editing actions *********************** */ case ChaserAddStep: - processBufferedAction(undo ? ChaserRemoveStep : ChaserAddStep, action.m_objID, action.m_newValue); + processBufferedAction(undo ? ChaserRemoveStep : ChaserAddStep, action.m_objID, + action.m_newValue); return undo ? ChaserRemoveStep : ChaserAddStep; case ChaserRemoveStep: - processBufferedAction(undo ? ChaserAddStep : ChaserRemoveStep, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? ChaserAddStep : ChaserRemoveStep, action.m_objID, + action.m_oldValue); return undo ? ChaserAddStep : ChaserRemoveStep; case ChaserSetStepFadeIn: @@ -710,17 +728,20 @@ int Tardis::processAction(TardisAction &action, bool undo) /* *********************** EFX editing actions *********************** */ case EFXAddFixture: - processBufferedAction(undo ? EFXRemoveFixture : EFXAddFixture, action.m_objID, action.m_newValue); + processBufferedAction(undo ? EFXRemoveFixture : EFXAddFixture, action.m_objID, + action.m_newValue); return undo ? EFXRemoveFixture : EFXAddFixture; case EFXRemoveFixture: - processBufferedAction(undo ? EFXAddFixture : EFXRemoveFixture, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? EFXAddFixture : EFXRemoveFixture, action.m_objID, + action.m_oldValue); return undo ? EFXAddFixture : EFXRemoveFixture; case EFXSetAlgorithmIndex: { auto member = std::mem_fn(&EFX::setAlgorithm); - member(qobject_cast(m_doc->function(action.m_objID)), EFX::Algorithm(value->toInt())); + member(qobject_cast(m_doc->function(action.m_objID)), + EFX::Algorithm(value->toInt())); } break; case EFXSetRelative: @@ -795,7 +816,8 @@ int Tardis::processAction(TardisAction &action, bool undo) case CollectionAddFunction: { Collection *collection = qobject_cast(m_doc->function(action.m_objID)); - UIntPair pairValue = value->value(); // Function ID on first, insert index on second + UIntPair pairValue = + value->value(); // Function ID on first, insert index on second if (undo) collection->removeFunction(pairValue.first); else @@ -805,7 +827,8 @@ int Tardis::processAction(TardisAction &action, bool undo) case CollectionRemoveFunction: { Collection *collection = qobject_cast(m_doc->function(action.m_objID)); - UIntPair pairValue = value->value(); // Function ID on first, insert index on second + UIntPair pairValue = + value->value(); // Function ID on first, insert index on second if (undo) collection->addFunction(pairValue.first, int(pairValue.second)); else @@ -843,15 +866,17 @@ int Tardis::processAction(TardisAction &action, bool undo) break; case RGBMatrixSetScriptIntValue: { - RGBMatrix *matrix = qobject_cast(m_doc->function(action.m_objID)); - StringIntPair pairValue = value->value(); // param name on first, value on second + RGBMatrix *matrix = qobject_cast(m_doc->function(action.m_objID)); + StringIntPair pairValue = + value->value(); // param name on first, value on second matrix->setProperty(pairValue.first, QString::number(pairValue.second)); } break; case RGBMatrixSetScriptStringValue: { - RGBMatrix *matrix = qobject_cast(m_doc->function(action.m_objID)); - StringStringPair pairValue = value->value(); // param name on first, value on second + RGBMatrix *matrix = qobject_cast(m_doc->function(action.m_objID)); + StringStringPair pairValue = + value->value(); // param name on first, value on second matrix->setProperty(pairValue.first, pairValue.second); } break; @@ -994,47 +1019,55 @@ int Tardis::processAction(TardisAction &action, bool undo) /* ******************* Virtual console editing actions ******************** */ case VCWidgetCreate: - processBufferedAction(undo ? VCWidgetDelete : VCWidgetCreate, action.m_objID, action.m_newValue); + processBufferedAction(undo ? VCWidgetDelete : VCWidgetCreate, action.m_objID, + action.m_newValue); return undo ? VCWidgetDelete : VCWidgetCreate; case VCWidgetDelete: - processBufferedAction(undo ? VCWidgetCreate : VCWidgetDelete, action.m_objID, action.m_oldValue); + processBufferedAction(undo ? VCWidgetCreate : VCWidgetDelete, action.m_objID, + action.m_oldValue); return undo ? VCWidgetCreate : VCWidgetDelete; case VCWidgetGeometry: { auto member = std::mem_fn(&VCWidget::setGeometry); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->toRectF()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->toRectF()); } break; case VCWidgetCaption: { auto member = std::mem_fn(&VCWidget::setCaption); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->toString()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->toString()); } break; case VCWidgetBackgroundColor: { auto member = std::mem_fn(&VCWidget::setBackgroundColor); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->value()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->value()); } break; case VCWidgetBackgroundImage: { auto member = std::mem_fn(&VCWidget::setBackgroundImage); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->toString()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->toString()); } break; case VCWidgetForegroundColor: { auto member = std::mem_fn(&VCWidget::setForegroundColor); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->value()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->value()); } break; case VCWidgetFont: { auto member = std::mem_fn(&VCWidget::setFont); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->value()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->value()); } break; @@ -1112,7 +1145,8 @@ int Tardis::processAction(TardisAction &action, bool undo) case VCCueListSetChaserID: { auto member = std::mem_fn(&VCCueList::setChaserID); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), value->toUInt()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + value->toUInt()); } break; @@ -1120,7 +1154,8 @@ int Tardis::processAction(TardisAction &action, bool undo) case VCButtonSetPressed: { auto member = std::mem_fn(&VCButton::requestStateChange); - member(qobject_cast(m_virtualConsole->widget(action.m_objID)), action.m_newValue.toBool()); + member(qobject_cast(m_virtualConsole->widget(action.m_objID)), + action.m_newValue.toBool()); } break; case VCSliderSetValue: diff --git a/qmlui/tardis/tardis.h b/qmlui/tardis/tardis.h index 7fa4aa85e9..1e4e2dd465 100644 --- a/qmlui/tardis/tardis.h +++ b/qmlui/tardis/tardis.h @@ -193,9 +193,9 @@ class Tardis : public QThread Q_ENUM(ActionCodes) - explicit Tardis(QQuickView *view, Doc *doc, NetworkManager *netMgr, FixtureManager *fxMgr, FunctionManager *funcMgr, - ContextManager *ctxMgr, SimpleDesk *sDesk, ShowManager *showMgr, VirtualConsole *vc, - QObject *parent = 0); + explicit Tardis(QQuickView *view, Doc *doc, NetworkManager *netMgr, FixtureManager *fxMgr, + FunctionManager *funcMgr, ContextManager *ctxMgr, SimpleDesk *sDesk, + ShowManager *showMgr, VirtualConsole *vc, QObject *parent = 0); ~Tardis(); diff --git a/qmlui/treemodel.cpp b/qmlui/treemodel.cpp index 89d2a38ba6..fed2f4ec8b 100644 --- a/qmlui/treemodel.cpp +++ b/qmlui/treemodel.cpp @@ -145,8 +145,8 @@ TreeModelItem *TreeModel::addItem(QString label, QVariantList data, QString path QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership); if (item->setChildrenColumns(m_roles) == true) { - connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant)), this, - SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); + connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant)), + this, SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); qDebug() << "Tree" << this << "connected to tree" << item->children(); } @@ -161,8 +161,8 @@ TreeModelItem *TreeModel::addItem(QString label, QVariantList data, QString path { if (item->addChild(label, data, m_sorting, "", flags) == true) { - connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant &)), this, - SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); + connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant &)), + this, SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); qDebug() << "Tree" << this << "connected to tree" << item->children(); } } @@ -171,8 +171,8 @@ TreeModelItem *TreeModel::addItem(QString label, QVariantList data, QString path QString newPath = path.mid(path.indexOf(TreeModel::separator()) + 1); if (item->addChild(label, data, m_sorting, newPath, flags) == true) { - connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant &)), this, - SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); + connect(item->children(), SIGNAL(roleChanged(TreeModelItem *, int, const QVariant &)), + this, SLOT(slotRoleChanged(TreeModelItem *, int, const QVariant &))); qDebug() << "Tree" << this << "connected to tree" << item->children(); } } diff --git a/qmlui/treemodelitem.h b/qmlui/treemodelitem.h index b06f5cc3a3..8e49cabb03 100644 --- a/qmlui/treemodelitem.h +++ b/qmlui/treemodelitem.h @@ -65,7 +65,8 @@ class TreeModelItem : public QObject bool setChildrenColumns(QStringList columns); /** Add a child to this item. Typically this means the item is a folder */ - bool addChild(QString label, QVariantList data, bool sorting = false, QString path = QString(), int flags = 0); + bool addChild(QString label, QVariantList data, bool sorting = false, QString path = QString(), + int flags = 0); /** Return if the item has children. Typically for folders */ bool hasChildren(); diff --git a/qmlui/uimanager.cpp b/qmlui/uimanager.cpp index f6ca359c9e..071cd663e4 100644 --- a/qmlui/uimanager.cpp +++ b/qmlui/uimanager.cpp @@ -97,7 +97,8 @@ void UiManager::initialize() if (parseError.error != QJsonParseError::NoError) { - qWarning() << "UI Style parse error at" << parseError.offset << ":" << parseError.errorString(); + qWarning() << "UI Style parse error at" << parseError.offset << ":" + << parseError.errorString(); } else { @@ -148,7 +149,8 @@ void UiManager::setModified(QString name, QVariant value) QString UiManager::userConfFilepath() { - QDir userConfDir = QLCFile::userDirectory(QString(USERQLCPLUSDIR), QString(USERQLCPLUSDIR), QStringList()); + QDir userConfDir = + QLCFile::userDirectory(QString(USERQLCPLUSDIR), QString(USERQLCPLUSDIR), QStringList()); return userConfDir.absolutePath() + QDir::separator() + UISTYLEFILE; } diff --git a/qmlui/videoeditor.cpp b/qmlui/videoeditor.cpp index 03539ccacf..1af6dee70b 100644 --- a/qmlui/videoeditor.cpp +++ b/qmlui/videoeditor.cpp @@ -36,7 +36,8 @@ VideoEditor::VideoEditor(QQuickView *view, Doc *doc, QObject *parent) m_mediaPlayer = new QMediaPlayer(this); #endif - connect(m_mediaPlayer, SIGNAL(metaDataChanged(QString, QVariant)), this, SLOT(slotMetaDataChanged(QString, QVariant))); + connect(m_mediaPlayer, SIGNAL(metaDataChanged(QString, QVariant)), this, + SLOT(slotMetaDataChanged(QString, QVariant))); connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(slotDurationChanged(qint64))); } @@ -87,7 +88,8 @@ void VideoEditor::setSourceFileName(QString sourceFileName) if (m_video == nullptr || m_video->sourceUrl() == sourceFileName) return; - Tardis::instance()->enqueueAction(Tardis::VideoSetSource, m_video->id(), m_video->sourceUrl(), sourceFileName); + Tardis::instance()->enqueueAction(Tardis::VideoSetSource, m_video->id(), m_video->sourceUrl(), + sourceFileName); m_video->setSourceUrl(sourceFileName); if (m_video->isPicture()) @@ -175,7 +177,8 @@ void VideoEditor::setScreenIndex(int screenIndex) if (m_video == nullptr || m_video->screen() == screenIndex) return; - Tardis::instance()->enqueueAction(Tardis::VideoSetScreenIndex, m_video->id(), m_video->screen(), screenIndex); + Tardis::instance()->enqueueAction(Tardis::VideoSetScreenIndex, m_video->id(), m_video->screen(), + screenIndex); m_video->setScreen(screenIndex); emit screenIndexChanged(screenIndex); } @@ -193,7 +196,8 @@ void VideoEditor::setFullscreen(bool fullscreen) if (m_video == nullptr || m_video->fullscreen() == fullscreen) return; - Tardis::instance()->enqueueAction(Tardis::VideoSetFullscreen, m_video->id(), m_video->fullscreen(), fullscreen); + Tardis::instance()->enqueueAction(Tardis::VideoSetFullscreen, m_video->id(), + m_video->fullscreen(), fullscreen); m_video->setFullscreen(fullscreen); emit fullscreenChanged(fullscreen); } @@ -210,7 +214,8 @@ void VideoEditor::setLooped(bool looped) { if (m_video != nullptr) { - Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_video->id(), m_video->runOrder(), + Tardis::instance()->enqueueAction(Tardis::FunctionSetRunOrder, m_video->id(), + m_video->runOrder(), looped ? Video::Loop : Video::SingleShot); if (looped) m_video->setRunOrder(Video::Loop); @@ -240,7 +245,8 @@ void VideoEditor::setCustomGeometry(QRect customGeometry) if (m_video == nullptr || m_video->customGeometry() == customGeometry) return; - Tardis::instance()->enqueueAction(Tardis::VideoSetGeometry, m_video->id(), m_video->customGeometry(), customGeometry); + Tardis::instance()->enqueueAction(Tardis::VideoSetGeometry, m_video->id(), + m_video->customGeometry(), customGeometry); m_video->setCustomGeometry(customGeometry); emit customGeometryChanged(customGeometry); } @@ -258,7 +264,8 @@ void VideoEditor::setRotation(QVector3D rotation) if (m_video == nullptr || m_video->rotation() == rotation) return; - Tardis::instance()->enqueueAction(Tardis::VideoSetRotation, m_video->id(), m_video->rotation(), rotation); + Tardis::instance()->enqueueAction(Tardis::VideoSetRotation, m_video->id(), m_video->rotation(), + rotation); m_video->setRotation(rotation); emit rotationChanged(rotation); } diff --git a/qmlui/videoprovider.cpp b/qmlui/videoprovider.cpp index 0fbfe65b00..68615f7a21 100644 --- a/qmlui/videoprovider.cpp +++ b/qmlui/videoprovider.cpp @@ -32,7 +32,8 @@ VideoProvider::VideoProvider(QQuickView *view, Doc *doc, QObject *parent) { Q_ASSERT(doc != nullptr); - qmlRegisterUncreatableType").arg(tr("Channels")).arg(channels); + m_fixtureInfo += + QString("").arg(tr("Channels")).arg(channels); } else if (key == "SLOT_LIST") { @@ -734,9 +745,11 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat m_requestList.append(var.value>()); // check if channels don't fit in a single reply - if (info.params.value("Response") == RDMProtocol::responseToString(RESPONSE_TYPE_ACK_OVERFLOW)) + if (info.params.value("Response") + == RDMProtocol::responseToString(RESPONSE_TYPE_ACK_OVERFLOW)) { - m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, QVariantList() << UID << PID_SLOT_INFO); + m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, + QVariantList() << UID << PID_SLOT_INFO); } else { @@ -750,10 +763,11 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat qDebug() << "SLOT label" << label; - m_fixtureInfo += QString("") - .arg(tr("Channel")) - .arg(slotId + 1) - .arg(label); + m_fixtureInfo += + QString("") + .arg(tr("Channel")) + .arg(slotId + 1) + .arg(label); } else if (key == "PID_LIST") { @@ -779,9 +793,10 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat if (pid < 0x8000 && pid != PID_PARAMETER_DESCRIPTION) { QString sPid = QString("%1").arg(pid, 4, 16, QChar('0')); - m_fixtureInfo += QString("") - .arg(sPid.toUpper()) - .arg(RDMProtocol::pidToString(pid)); + m_fixtureInfo += + QString("") + .arg(sPid.toUpper()) + .arg(RDMProtocol::pidToString(pid)); } } else if (m_requestState == StateReadSinglePid) @@ -795,9 +810,10 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat { quint16 pid = data.value("PID_INFO").toUInt(); QString sPid = QString("%1").arg(pid, 4, 16, QChar('0')); - m_fixtureInfo += QString("") - .arg(sPid.toUpper()) - .arg(it.value().toString()); + m_fixtureInfo += + QString("") + .arg(sPid.toUpper()) + .arg(it.value().toString()); } else if (m_requestState == StateReadSinglePid) { @@ -820,11 +836,13 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat { quint16 idx = m_requestList.takeFirst(); m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, - QVariantList() << UID << PID_DMX_PERSONALITY_DESCRIPTION << idx); + QVariantList() + << UID << PID_DMX_PERSONALITY_DESCRIPTION << idx); } else { - m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, QVariantList() << UID << PID_SLOT_INFO); + m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, + QVariantList() << UID << PID_SLOT_INFO); } } else if (m_requestState == StateSlots) @@ -837,7 +855,8 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat } else { - m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, QVariantList() << UID << PID_SUPPORTED_PARAMETERS); + m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, + QVariantList() << UID << PID_SUPPORTED_PARAMETERS); } } else if (m_requestState == StateSupportedPids) @@ -850,7 +869,8 @@ void RDMWorker::slotRDMDataReady(quint32 universe, quint32 line, QVariantMap dat m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, QVariantList() << UID << PID_PARAMETER_DESCRIPTION << pid); else - m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, QVariantList() << UID << pid); + m_plugin->sendRDMCommand(m_universe, m_line, GET_COMMAND, + QVariantList() << UID << pid); } else { diff --git a/ui/src/rgbitem.cpp b/ui/src/rgbitem.cpp index 14f712ab79..4ed0b6c634 100644 --- a/ui/src/rgbitem.cpp +++ b/ui/src/rgbitem.cpp @@ -55,21 +55,27 @@ void RGBItem::draw(uint elapsedMs, uint targetMs) { int red, green, blue; if (m_oldColor.red() < m_color.red()) - red = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.red()), qreal(m_color.red())); + red = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.red()), + qreal(m_color.red())); else - red = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.red()), qreal(m_oldColor.red())); + red = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.red()), + qreal(m_oldColor.red())); red = CLAMP(red, 0, 255); if (m_oldColor.green() < m_color.green()) - green = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.green()), qreal(m_color.green())); + green = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.green()), + qreal(m_color.green())); else - green = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.green()), qreal(m_oldColor.green())); + green = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.green()), + qreal(m_oldColor.green())); green = CLAMP(green, 0, 255); if (m_oldColor.blue() < m_color.blue()) - blue = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.blue()), qreal(m_color.blue())); + blue = SCALE(qreal(m_elapsed), qreal(0), qreal(targetMs), qreal(m_oldColor.blue()), + qreal(m_color.blue())); else - blue = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.blue()), qreal(m_oldColor.blue())); + blue = SCALE(qreal(m_elapsed), qreal(targetMs), qreal(0), qreal(m_color.blue()), + qreal(m_oldColor.blue())); blue = CLAMP(blue, 0, 255); m_graphicsItem->setBrush(QColor(red, green, blue)); diff --git a/ui/src/rgbmatrixeditor.cpp b/ui/src/rgbmatrixeditor.cpp index 77a434a5ba..7eca16d75e 100644 --- a/ui/src/rgbmatrixeditor.cpp +++ b/ui/src/rgbmatrixeditor.cpp @@ -186,20 +186,24 @@ void RGBMatrixEditor::init() updateExtraOptions(); updateSpeedDials(); - connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, SLOT(slotNameEdited(const QString &))); + connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, + SLOT(slotNameEdited(const QString &))); connect(m_speedDialButton, SIGNAL(toggled(bool)), this, SLOT(slotSpeedDialToggle(bool))); connect(m_saveToSequenceButton, SIGNAL(clicked()), this, SLOT(slotSaveToSequenceClicked())); connect(m_shapeButton, SIGNAL(toggled(bool)), this, SLOT(slotShapeToggle(bool))); - connect(m_patternCombo, SIGNAL(activated(const QString &)), this, SLOT(slotPatternActivated(const QString &))); + connect(m_patternCombo, SIGNAL(activated(const QString &)), this, + SLOT(slotPatternActivated(const QString &))); connect(m_fixtureGroupCombo, SIGNAL(activated(int)), this, SLOT(slotFixtureGroupActivated(int))); connect(m_blendModeCombo, SIGNAL(activated(int)), this, SLOT(slotBlendModeChanged(int))); connect(m_controlModeCombo, SIGNAL(activated(int)), this, SLOT(slotControlModeChanged(int))); connect(m_startColorButton, SIGNAL(clicked()), this, SLOT(slotStartColorButtonClicked())); connect(m_endColorButton, SIGNAL(clicked()), this, SLOT(slotEndColorButtonClicked())); connect(m_resetEndColorButton, SIGNAL(clicked()), this, SLOT(slotResetEndColorButtonClicked())); - connect(m_textEdit, SIGNAL(textEdited(const QString &)), this, SLOT(slotTextEdited(const QString &))); + connect(m_textEdit, SIGNAL(textEdited(const QString &)), this, + SLOT(slotTextEdited(const QString &))); connect(m_fontButton, SIGNAL(clicked()), this, SLOT(slotFontButtonClicked())); - connect(m_animationCombo, SIGNAL(activated(const QString &)), this, SLOT(slotAnimationActivated(const QString &))); + connect(m_animationCombo, SIGNAL(activated(const QString &)), this, + SLOT(slotAnimationActivated(const QString &))); connect(m_imageEdit, SIGNAL(editingFinished()), this, SLOT(slotImageEdited())); connect(m_imageButton, SIGNAL(clicked()), this, SLOT(slotImageButtonClicked())); connect(m_imageAnimationCombo, SIGNAL(activated(const QString &)), this, @@ -319,7 +323,8 @@ void RGBMatrixEditor::updateExtraOptions() Q_ASSERT(image != NULL); m_imageEdit->setText(image->filename()); - int index = m_imageAnimationCombo->findText(RGBImage::animationStyleToString(image->animationStyle())); + int index = + m_imageAnimationCombo->findText(RGBImage::animationStyleToString(image->animationStyle())); if (index != -1) m_imageAnimationCombo->setCurrentIndex(index); @@ -336,7 +341,8 @@ void RGBMatrixEditor::updateExtraOptions() Q_ASSERT(text != NULL); m_textEdit->setText(text->text()); - int index = m_animationCombo->findText(RGBText::animationStyleToString(text->animationStyle())); + int index = + m_animationCombo->findText(RGBText::animationStyleToString(text->animationStyle())); if (index != -1) m_animationCombo->setCurrentIndex(index); @@ -475,7 +481,8 @@ void RGBMatrixEditor::displayProperties(RGBScript *script) QComboBox *propCombo = new QComboBox(this); propCombo->addItems(prop.m_listValues); propCombo->setProperty("pName", prop.m_name); - connect(propCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotPropertyComboChanged(QString))); + connect(propCombo, SIGNAL(currentIndexChanged(QString)), this, + SLOT(slotPropertyComboChanged(QString))); m_propertiesLayout->addWidget(propCombo, gridRowIdx, 1); if (m_matrix != NULL) { @@ -541,8 +548,8 @@ bool RGBMatrixEditor::createPreviewItems() return false; } - m_previewHandler->initializeDirection(m_matrix->direction(), m_matrix->startColor(), m_matrix->endColor(), - m_matrix->stepsCount()); + m_previewHandler->initializeDirection(m_matrix->direction(), m_matrix->startColor(), + m_matrix->endColor(), m_matrix->stepsCount()); m_matrix->previewMap(m_previewHandler->currentStepIndex(), m_previewHandler); @@ -562,16 +569,16 @@ bool RGBMatrixEditor::createPreviewItems() { QGraphicsEllipseItem *circleItem = new QGraphicsEllipseItem(); circleItem->setRect(x * RECT_SIZE + RECT_PADDING + ITEM_PADDING, - y * RECT_SIZE + RECT_PADDING + ITEM_PADDING, ITEM_SIZE - (2 * ITEM_PADDING), - ITEM_SIZE - (2 * ITEM_PADDING)); + y * RECT_SIZE + RECT_PADDING + ITEM_PADDING, + ITEM_SIZE - (2 * ITEM_PADDING), ITEM_SIZE - (2 * ITEM_PADDING)); item = new RGBItem(circleItem); } else { QGraphicsRectItem *rectItem = new QGraphicsRectItem(); rectItem->setRect(x * RECT_SIZE + RECT_PADDING + ITEM_PADDING, - y * RECT_SIZE + RECT_PADDING + ITEM_PADDING, ITEM_SIZE - (2 * ITEM_PADDING), - ITEM_SIZE - (2 * ITEM_PADDING)); + y * RECT_SIZE + RECT_PADDING + ITEM_PADDING, + ITEM_SIZE - (2 * ITEM_PADDING), ITEM_SIZE - (2 * ITEM_PADDING)); item = new RGBItem(rectItem); } @@ -594,8 +601,8 @@ void RGBMatrixEditor::slotPreviewTimeout() uint elapsed = 0; while (m_previewIterator >= MAX(m_matrix->duration(), MasterTimer::tick())) { - m_previewHandler->checkNextStep(m_matrix->runOrder(), m_matrix->startColor(), m_matrix->endColor(), - m_matrix->stepsCount()); + m_previewHandler->checkNextStep(m_matrix->runOrder(), m_matrix->startColor(), + m_matrix->endColor(), m_matrix->stepsCount()); m_matrix->previewMap(m_previewHandler->currentStepIndex(), m_previewHandler); @@ -799,8 +806,9 @@ void RGBMatrixEditor::slotImageButtonClicked() Q_ASSERT(algo != NULL); QString path = algo->filename(); - path = QFileDialog::getOpenFileName(this, tr("Select image"), path, - QString("%1 (*.png *.bmp *.jpg *.jpeg *.gif)").arg(tr("Images"))); + path = QFileDialog::getOpenFileName( + this, tr("Select image"), path, + QString("%1 (*.png *.bmp *.jpg *.jpeg *.gif)").arg(tr("Images"))); if (path.isEmpty() == false) { { @@ -1147,7 +1155,8 @@ void RGBMatrixEditor::slotSaveToSequenceClicked() quint32 channel = fxi->masterIntensityChannel(); if (channel == QLCChannel::invalid()) - channel = fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head.head); + channel = + fxi->channelNumber(QLCChannel::Intensity, QLCChannel::MSB, head.head); if (channel != QLCChannel::invalid()) step.values.append(SceneValue(head.fxi, channel, RGBMatrix::rgbToGrey(col))); @@ -1185,7 +1194,8 @@ void RGBMatrixEditor::slotSaveToSequenceClicked() currentStep = totalSteps - 2; increment = -1; } - m_previewHandler->updateStepColor(currentStep, m_matrix->startColor(), m_matrix->stepsCount()); + m_previewHandler->updateStepColor(currentStep, m_matrix->startColor(), + m_matrix->stepsCount()); } m_doc->addFunction(sequence); diff --git a/ui/src/sceneeditor.cpp b/ui/src/sceneeditor.cpp index 8387b2805b..6bfa021a5a 100644 --- a/ui/src/sceneeditor.cpp +++ b/ui/src/sceneeditor.cpp @@ -181,18 +181,26 @@ void SceneEditor::init(bool applyValues) this->layout()->setContentsMargins(8, 3, 8, 3); /* Actions */ - m_enableCurrentAction = new QAction(QIcon(":/check.png"), tr("Enable all channels in current fixture"), this); - m_disableCurrentAction = new QAction(QIcon(":/uncheck.png"), tr("Disable all channels in current fixture"), this); - m_copyAction = new QAction(QIcon(":/editcopy.png"), tr("Copy current values to clipboard"), this); - m_pasteAction = new QAction(QIcon(":/editpaste.png"), tr("Paste clipboard values to current fixture"), this); - m_copyToAllAction = new QAction(QIcon(":/editcopyall.png"), tr("Copy current values to all fixtures"), this); - m_colorToolAction = new QAction(QIcon(":/color.png"), tr("Color tool for CMY/RGB-capable fixtures"), this); - m_positionToolAction = new QAction(QIcon(":/xypad.png"), tr("Position tool for moving heads/scanners"), this); - m_tabViewAction = new QAction(QIcon(":/tabview.png"), tr("Switch between tab view and all channels view"), this); + m_enableCurrentAction = + new QAction(QIcon(":/check.png"), tr("Enable all channels in current fixture"), this); + m_disableCurrentAction = + new QAction(QIcon(":/uncheck.png"), tr("Disable all channels in current fixture"), this); + m_copyAction = new QAction(QIcon(":/editcopy.png"), tr("Copy current values to clipboard"), this); + m_pasteAction = + new QAction(QIcon(":/editpaste.png"), tr("Paste clipboard values to current fixture"), this); + m_copyToAllAction = + new QAction(QIcon(":/editcopyall.png"), tr("Copy current values to all fixtures"), this); + m_colorToolAction = + new QAction(QIcon(":/color.png"), tr("Color tool for CMY/RGB-capable fixtures"), this); + m_positionToolAction = + new QAction(QIcon(":/xypad.png"), tr("Position tool for moving heads/scanners"), this); + m_tabViewAction = new QAction(QIcon(":/tabview.png"), + tr("Switch between tab view and all channels view"), this); m_blindAction = new QAction(QIcon(":/blind.png"), tr("Toggle blind mode"), this); m_speedDialAction = new QAction(QIcon(":/speed.png"), tr("Show/Hide speed dial window"), this); m_recordAction = - new QAction(QIcon(":/record.png"), tr("Clone this scene and append as a new step to the selected chaser"), this); + new QAction(QIcon(":/record.png"), + tr("Clone this scene and append as a new step to the selected chaser"), this); m_nextTabAction = new QAction(QIcon(":/forward.png"), tr("Go to next fixture tab"), this); m_nextTabAction->setShortcut(QKeySequence("Alt+Right")); @@ -285,7 +293,8 @@ void SceneEditor::init(bool applyValues) m_nameEdit->setText(m_scene->name()); m_nameEdit->setSelection(0, m_nameEdit->text().length()); - connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, SLOT(slotNameEdited(const QString &))); + connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, + SLOT(slotNameEdited(const QString &))); // Channels groups tab QList chGrpIds = m_scene->channelGroups(); @@ -552,7 +561,8 @@ void SceneEditor::slotColorTool() QColor color = slotColorSelectorChanged(QColor()); QColorDialog dialog(color, this); - connect(&dialog, SIGNAL(currentColorChanged(const QColor &)), this, SLOT(slotColorSelectorChanged(const QColor &))); + connect(&dialog, SIGNAL(currentColorChanged(const QColor &)), this, + SLOT(slotColorSelectorChanged(const QColor &))); int result = dialog.exec(); if (result == QDialog::Rejected) @@ -651,7 +661,8 @@ QColor SceneEditor::slotColorSelectorChanged(const QColor &color) if (!cyan.isEmpty() && !magenta.isEmpty() && !yellow.isEmpty()) { - returnColor.setCmyk(fc->value(*cyan.begin()), fc->value(*magenta.begin()), fc->value(*yellow.begin()), 0); + returnColor.setCmyk(fc->value(*cyan.begin()), fc->value(*magenta.begin()), + fc->value(*yellow.begin()), 0); if (color.isValid() == true) { foreach (quint32 ch, cyan) @@ -675,7 +686,8 @@ QColor SceneEditor::slotColorSelectorChanged(const QColor &color) } else if (!red.isEmpty() && !green.isEmpty() && !blue.isEmpty()) { - returnColor.setRgb(fc->value(*red.begin()), fc->value(*green.begin()), fc->value(*blue.begin()), 0); + returnColor.setRgb(fc->value(*red.begin()), fc->value(*green.begin()), + fc->value(*blue.begin()), 0); if (color.isValid() == true) { @@ -910,7 +922,8 @@ void SceneEditor::slotViewModeChanged(bool tabbed, bool applyValues) connect(console, SIGNAL(valueChanged(quint32, quint32, uchar)), this, SLOT(slotValueChanged(quint32, quint32, uchar))); - connect(console, SIGNAL(checked(quint32, quint32, bool)), this, SLOT(slotChecked(quint32, quint32, bool))); + connect(console, SIGNAL(checked(quint32, quint32, bool)), this, + SLOT(slotChecked(quint32, quint32, bool))); QListIterator it(m_scene->values()); while (it.hasNext() == true) @@ -952,7 +965,8 @@ void SceneEditor::slotViewModeChanged(bool tabbed, bool applyValues) } } - m_scene->setUiStateValue(UI_STATE_TAB_MODE, tabbed ? UI_STATE_TABBED_FIXTURES : UI_STATE_ALL_FIXTURES); + m_scene->setUiStateValue(UI_STATE_TAB_MODE, + tabbed ? UI_STATE_TABBED_FIXTURES : UI_STATE_ALL_FIXTURES); if (m_tab->count() == 0) { @@ -1000,8 +1014,9 @@ void SceneEditor::slotChaserComboActivated(int index) bool SceneEditor::isColorToolAvailable() { Fixture *fxi = NULL; - quint32 cyan = QLCChannel::invalid(), magenta = QLCChannel::invalid(), yellow = QLCChannel::invalid(); - quint32 red = QLCChannel::invalid(), green = QLCChannel::invalid(), blue = QLCChannel::invalid(); + quint32 cyan = QLCChannel::invalid(), magenta = QLCChannel::invalid(), + yellow = QLCChannel::invalid(); + quint32 red = QLCChannel::invalid(), green = QLCChannel::invalid(), blue = QLCChannel::invalid(); /* QObject cast fails unless the widget is a FixtureConsole */ FixtureConsole *fc = fixtureConsoleTab(m_currentTab); @@ -1045,11 +1060,13 @@ bool SceneEditor::isColorToolAvailable() } } - if (cyan != QLCChannel::invalid() && magenta != QLCChannel::invalid() && yellow != QLCChannel::invalid()) + if (cyan != QLCChannel::invalid() && magenta != QLCChannel::invalid() + && yellow != QLCChannel::invalid()) { return true; } - else if (red != QLCChannel::invalid() && green != QLCChannel::invalid() && blue != QLCChannel::invalid()) + else if (red != QLCChannel::invalid() && green != QLCChannel::invalid() + && blue != QLCChannel::invalid()) { return true; } @@ -1257,7 +1274,8 @@ void SceneEditor::slotAddFixtureClicked() void SceneEditor::slotRemoveFixtureClicked() { - int r = QMessageBox::question(this, tr("Remove fixtures"), tr("Do you want to remove the selected fixture(s)?"), + int r = QMessageBox::question(this, tr("Remove fixtures"), + tr("Do you want to remove the selected fixture(s)?"), QMessageBox::Yes, QMessageBox::No); if (r == QMessageBox::Yes) @@ -1417,7 +1435,8 @@ void SceneEditor::updateChannelsGroupsTab() m_channelGroupsTab = 1; m_fixtureFirstTabIndex = 2; - connect(console, SIGNAL(groupValueChanged(quint32, uchar)), this, SLOT(slotGroupValueChanged(quint32, uchar))); + connect(console, SIGNAL(groupValueChanged(quint32, uchar)), this, + SLOT(slotGroupValueChanged(quint32, uchar))); } GroupsConsole *SceneEditor::groupConsoleTab(int tab) @@ -1486,8 +1505,10 @@ void SceneEditor::addFixtureTab(Fixture *fixture, quint32 channel) /* Start off with all channels disabled */ console->setChecked(false); - connect(console, SIGNAL(valueChanged(quint32, quint32, uchar)), this, SLOT(slotValueChanged(quint32, quint32, uchar))); - connect(console, SIGNAL(checked(quint32, quint32, bool)), this, SLOT(slotChecked(quint32, quint32, bool))); + connect(console, SIGNAL(valueChanged(quint32, quint32, uchar)), this, + SLOT(slotValueChanged(quint32, quint32, uchar))); + connect(console, SIGNAL(checked(quint32, quint32, bool)), this, + SLOT(slotChecked(quint32, quint32, bool))); if (channel != QLCChannel::invalid()) console->setChecked(true, channel); diff --git a/ui/src/scripteditor.cpp b/ui/src/scripteditor.cpp index dcbf90efb9..a3cd841f9e 100644 --- a/ui/src/scripteditor.cpp +++ b/ui/src/scripteditor.cpp @@ -50,7 +50,8 @@ ScriptEditor::ScriptEditor(QWidget *parent, Script *script, Doc *doc) /* Name */ m_nameEdit->setText(m_script->name()); m_nameEdit->setSelection(0, m_nameEdit->text().length()); - connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, SLOT(slotNameEdited(const QString &))); + connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, + SLOT(slotNameEdited(const QString &))); /* Document */ m_document = new QTextDocument(m_script->data(), this); @@ -220,7 +221,8 @@ void ScriptEditor::slotAddStartFunction() { Function *function = m_doc->function(id); Q_ASSERT(function != NULL); - QString cmd = QString("%1:%2 // %3\n").arg(Script::startFunctionCmd).arg(id).arg(function->name()); + QString cmd = + QString("%1:%2 // %3\n").arg(Script::startFunctionCmd).arg(id).arg(function->name()); cursor.insertText(cmd); m_editor->moveCursor(QTextCursor::Down); } @@ -240,7 +242,8 @@ void ScriptEditor::slotAddStopFunction() { Function *function = m_doc->function(id); Q_ASSERT(function != NULL); - QString cmd = QString("%1:%2 // %3\n").arg(Script::stopFunctionCmd).arg(id).arg(function->name()); + QString cmd = + QString("%1:%2 // %3\n").arg(Script::stopFunctionCmd).arg(id).arg(function->name()); cursor.insertText(cmd); m_editor->moveCursor(QTextCursor::Down); } @@ -268,7 +271,9 @@ void ScriptEditor::slotAddBlackout() { m_editor->moveCursor(QTextCursor::StartOfLine); m_editor->textCursor().insertText( - QString("%1:%2\n").arg(Script::blackoutCmd).arg(cb->isChecked() ? Script::blackoutOn : Script::blackoutOff)); + QString("%1:%2\n") + .arg(Script::blackoutCmd) + .arg(cb->isChecked() ? Script::blackoutOn : Script::blackoutOff)); } } @@ -297,7 +302,8 @@ void ScriptEditor::slotAddWait() if (dialog.exec() == QDialog::Accepted) { m_editor->moveCursor(QTextCursor::StartOfLine); - m_editor->textCursor().insertText(QString("%1:%2\n").arg(Script::waitCmd).arg(Function::speedToString(sd->value()))); + m_editor->textCursor().insertText( + QString("%1:%2\n").arg(Script::waitCmd).arg(Function::speedToString(sd->value()))); } } @@ -367,8 +373,9 @@ void ScriptEditor::slotAddSystemCommand() #endif m_lastUsedPath = fInfo.absolutePath(); - QString args = QInputDialog::getText(this, tr("Enter the program arguments (leave empty if not required)"), "", - QLineEdit::Normal, QString()); + QString args = + QInputDialog::getText(this, tr("Enter the program arguments (leave empty if not required)"), + "", QLineEdit::Normal, QString()); QStringList argsList = args.split(" "); QString formattedArgs; @@ -378,13 +385,14 @@ void ScriptEditor::slotAddSystemCommand() } m_editor->moveCursor(QTextCursor::StartOfLine); - m_editor->textCursor().insertText(QString("%1:%2 %3\n").arg(Script::systemCmd).arg(fn).arg(formattedArgs)); + m_editor->textCursor().insertText( + QString("%1:%2 %3\n").arg(Script::systemCmd).arg(fn).arg(formattedArgs)); m_editor->moveCursor(QTextCursor::Down); } void ScriptEditor::slotAddComment() { - bool ok = false; + bool ok = false; QString str = QInputDialog::getText(this, tr("Add Comment"), "", QLineEdit::Normal, QString(), &ok); if (ok == true) { @@ -420,7 +428,8 @@ void ScriptEditor::slotAddRandom() if (dialog.exec() == QDialog::Accepted) { m_editor->moveCursor(QTextCursor::StartOfLine); - m_editor->textCursor().insertText(QString("random(%1,%2)").arg(minSB->value()).arg(maxSB->value())); + m_editor->textCursor().insertText( + QString("random(%1,%2)").arg(minSB->value()).arg(maxSB->value())); m_editor->moveCursor(QTextCursor::EndOfLine); } } diff --git a/ui/src/selectinputchannel.cpp b/ui/src/selectinputchannel.cpp index faad18ded4..9798a55392 100644 --- a/ui/src/selectinputchannel.cpp +++ b/ui/src/selectinputchannel.cpp @@ -67,7 +67,8 @@ SelectInputChannel::SelectInputChannel(QWidget *parent, InputOutputMap *ioMap) /* Listen to item changed signals so that we can catch user's manual input for <...> nodes. Connect AFTER filling the tree so all the initial item->setText()'s won't get caught here. */ - connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); + connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, + SLOT(slotItemChanged(QTreeWidgetItem *, int))); } SelectInputChannel::~SelectInputChannel() @@ -110,9 +111,11 @@ void SelectInputChannel::accept() void SelectInputChannel::slotUnpatchedClicked() { - disconnect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); + disconnect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, + SLOT(slotItemChanged(QTreeWidgetItem *, int))); fillTree(); - connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); + connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, + SLOT(slotItemChanged(QTreeWidgetItem *, int))); } /**************************************************************************** @@ -188,7 +191,8 @@ void SelectInputChannel::fillTree() } } -void SelectInputChannel::updateChannelItem(QTreeWidgetItem *item, quint32 universe, const QLCInputChannel *channel, +void SelectInputChannel::updateChannelItem(QTreeWidgetItem *item, quint32 universe, + const QLCInputChannel *channel, const QLCInputProfile *profile) { Q_ASSERT(item != NULL); @@ -203,7 +207,8 @@ void SelectInputChannel::updateChannelItem(QTreeWidgetItem *item, quint32 univer } else { - item->setText(KColumnName, QString("%1: %2").arg(profile->channelNumber(channel) + 1).arg(channel->name())); + item->setText(KColumnName, + QString("%1: %2").arg(profile->channelNumber(channel) + 1).arg(channel->name())); item->setText(KColumnChannel, QString("%1").arg(profile->channelNumber(channel))); /* Display nice icons to indicate channel type */ @@ -232,7 +237,8 @@ void SelectInputChannel::updateUniverseItem(QTreeWidgetItem *item, quint32 unive } else { - name = QString("%1: %2 / %3").arg(universe + 1).arg(patch->pluginName()).arg(patch->inputName()); + name = + QString("%1: %2 / %3").arg(universe + 1).arg(patch->pluginName()).arg(patch->inputName()); } } diff --git a/ui/src/showmanager/audioitem.cpp b/ui/src/showmanager/audioitem.cpp index 01edbcdbd4..2e40bf8112 100644 --- a/ui/src/showmanager/audioitem.cpp +++ b/ui/src/showmanager/audioitem.cpp @@ -230,13 +230,14 @@ qint32 PreviewThread::getSample(unsigned char *data, quint32 idx, int sampleSize void PreviewThread::run() { - bool left = m_item->m_previewLeftAction->isChecked() || m_item->m_previewStereoAction->isChecked(); - bool right = m_item->m_previewRightAction->isChecked() || m_item->m_previewStereoAction->isChecked(); + bool left = m_item->m_previewLeftAction->isChecked() || m_item->m_previewStereoAction->isChecked(); + bool right = + m_item->m_previewRightAction->isChecked() || m_item->m_previewStereoAction->isChecked(); if ((left || right) && m_item->m_audio->getAudioDecoder() != NULL) { - AudioDecoder *ad = - m_item->m_audio->doc()->audioPluginCache()->getDecoderForFile(m_item->m_audio->getSourceFileName()); + AudioDecoder *ad = m_item->m_audio->doc()->audioPluginCache()->getDecoderForFile( + m_item->m_audio->getSourceFileName()); AudioParameters ap = ad->audioParameters(); ad->seek(0); // 1- find out how many samples have to be represented on a single pixel on a 1:1 time scale @@ -262,15 +263,16 @@ void PreviewThread::run() qint64 dataRead = 1; unsigned char audioData[onePixelReadLen * 4]; quint32 audioDataOffset = 0; - QPixmap *preview = new QPixmap((50 * m_item->m_audio->totalDuration()) / 1000, 76); + QPixmap *preview = new QPixmap((50 * m_item->m_audio->totalDuration()) / 1000, 76); preview->fill(Qt::transparent); QPainter p(preview); int xpos = 0; - qDebug() << "Audio duration:" << m_item->m_audio->totalDuration() << ", channels:" << channels - << ", pixmap width:" << preview->width() << ", maxValue:" << maxValue << ", samples:" << sampleSize; - qDebug() << "Samples per second:" << oneSecondSamples << ", for one pixel:" << onePixelSamples - << ", onePixelReadLen:" << onePixelReadLen; + qDebug() << "Audio duration:" << m_item->m_audio->totalDuration() + << ", channels:" << channels << ", pixmap width:" << preview->width() + << ", maxValue:" << maxValue << ", samples:" << sampleSize; + qDebug() << "Samples per second:" << oneSecondSamples + << ", for one pixel:" << onePixelSamples << ", onePixelReadLen:" << onePixelReadLen; delete m_item->m_preview; m_item->m_preview = NULL; @@ -291,7 +293,8 @@ void PreviewThread::run() } else { - qDebug() << "Not enough data. Requested:" << onePixelReadLen << "got:" << dataRead; + qDebug() << "Not enough data. Requested:" << onePixelReadLen + << "got:" << dataRead; audioDataOffset = dataRead; continue; } @@ -370,8 +373,8 @@ void PreviewThread::run() p.drawLine(xpos, 38 - (lineHeight / 2), xpos, 38 + (lineHeight / 2)); else p.drawLine(xpos, 38, xpos + 1, 38); - // qDebug() << "Data read: " << dataRead << ", rms: " << rmsRight << ", line height: " << lineHeight - // << ", xpos = " << xpos; + // qDebug() << "Data read: " << dataRead << ", rms: " << rmsRight << ", line + // height: " << lineHeight << ", xpos = " << xpos; } xpos++; diff --git a/ui/src/showmanager/multitrackview.cpp b/ui/src/showmanager/multitrackview.cpp index 45c71e59ca..ceaf80862b 100644 --- a/ui/src/showmanager/multitrackview.cpp +++ b/ui/src/showmanager/multitrackview.cpp @@ -47,20 +47,21 @@ MultiTrackView::MultiTrackView(QWidget *parent) m_timeSlider->setSingleStep(1); m_timeSlider->setFixedSize(TRACK_WIDTH - 4, HEADER_HEIGHT); - m_timeSlider->setStyleSheet("QSlider { background-color: #969696; }" - "QSlider::groove:horizontal {" - "border: 1px solid #999999;" - "height: 10px;" - "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #b1b1b1, stop:1 #d4d4d4);" - "}" - "QSlider::handle:horizontal {" - "background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #c4c4c4, stop:1 #8f8f8f);" - "border: 1px solid #5c5c5c;" - "width: 20px;" - "margin: -2px 0; /* handle is placed by default on the contents rect of the groove. " - "Expand outside the groove */" - "border-radius: 4px;" - "}"); + m_timeSlider->setStyleSheet( + "QSlider { background-color: #969696; }" + "QSlider::groove:horizontal {" + "border: 1px solid #999999;" + "height: 10px;" + "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #b1b1b1, stop:1 #d4d4d4);" + "}" + "QSlider::handle:horizontal {" + "background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #c4c4c4, stop:1 #8f8f8f);" + "border: 1px solid #5c5c5c;" + "width: 20px;" + "margin: -2px 0; /* handle is placed by default on the contents rect of the groove. " + "Expand outside the groove */" + "border-radius: 4px;" + "}"); connect(m_timeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotTimeScaleChanged(int))); m_scene->addWidget(m_timeSlider); @@ -100,13 +101,15 @@ void MultiTrackView::updateTracksDividers() hDivNum = m_tracks.count(); for (int j = 0; j < hDivNum; j++) { - QGraphicsItem *item = m_scene->addRect(0, ypos + (j * TRACK_HEIGHT), m_scene->width(), 1, - QPen(QColor(150, 150, 150, 255)), QBrush(QColor(190, 190, 190, 255))); + QGraphicsItem *item = + m_scene->addRect(0, ypos + (j * TRACK_HEIGHT), m_scene->width(), 1, + QPen(QColor(150, 150, 150, 255)), QBrush(QColor(190, 190, 190, 255))); item->setZValue(-1); m_hdividers.append(item); } - m_vdivider = m_scene->addRect(TRACK_WIDTH - 3, 0, 3, m_scene->height(), QPen(QColor(150, 150, 150, 255)), - QBrush(QColor(190, 190, 190, 255))); + m_vdivider = + m_scene->addRect(TRACK_WIDTH - 3, 0, 3, m_scene->height(), QPen(QColor(150, 150, 150, 255)), + QBrush(QColor(190, 190, 190, 255))); } void MultiTrackView::setViewSize(int width, int height) @@ -175,7 +178,8 @@ void MultiTrackView::addTrack(Track *track) m_tracks.append(trackItem); activateTrack(track); connect(trackItem, SIGNAL(itemClicked(TrackItem *)), this, SLOT(slotTrackClicked(TrackItem *))); - connect(trackItem, SIGNAL(itemDoubleClicked(TrackItem *)), this, SLOT(slotTrackDoubleClicked(TrackItem *))); + connect(trackItem, SIGNAL(itemDoubleClicked(TrackItem *)), this, + SLOT(slotTrackDoubleClicked(TrackItem *))); connect(trackItem, SIGNAL(itemSoloFlagChanged(TrackItem *, bool)), this, SLOT(slotTrackSoloFlagChanged(TrackItem *, bool))); connect(trackItem, SIGNAL(itemMuteFlagChanged(TrackItem *, bool)), this, @@ -307,10 +311,12 @@ quint32 MultiTrackView::deleteSelectedItem() ShowItem *selectedItem = getSelectedItem(); if (selectedItem != NULL) { - QString msg = tr("Do you want to DELETE item:") + QString("\n\n") + selectedItem->functionName(); + QString msg = + tr("Do you want to DELETE item:") + QString("\n\n") + selectedItem->functionName(); // Ask for user's confirmation - if (QMessageBox::question(this, tr("Delete Functions"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::question(this, tr("Delete Functions"), msg, QMessageBox::Yes, QMessageBox::No) + == QMessageBox::Yes) { quint32 fID = selectedItem->functionID(); m_scene->removeItem(selectedItem); @@ -328,7 +334,7 @@ quint32 MultiTrackView::deleteSelectedItem() Track *track = item->getTrack(); quint32 trackID = track->id(); QList sfList = track->showFunctions(); - QString msg = tr("Do you want to DELETE track:") + QString("\n\n") + track->name(); + QString msg = tr("Do you want to DELETE track:") + QString("\n\n") + track->name(); if (sfList.count() > 0) { msg += QString("\n\n") + tr("This operation will also DELETE:") + QString("\n\n"); @@ -340,7 +346,8 @@ quint32 MultiTrackView::deleteSelectedItem() } // Ask for user's confirmation - if (QMessageBox::question(this, tr("Delete Track"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + if (QMessageBox::question(this, tr("Delete Track"), msg, QMessageBox::Yes, QMessageBox::No) + == QMessageBox::Yes) { m_scene->removeItem(item); m_tracks.removeOne(item); @@ -418,7 +425,8 @@ quint32 MultiTrackView::getPositionFromTime(quint32 time) { if (time == 0) return TRACK_WIDTH; - quint32 xPos = ((double)time / 500) * ((double)m_header->getHalfSecondWidth() / (double)m_header->getTimeScale()); + quint32 xPos = ((double)time / 500) + * ((double)m_header->getHalfSecondWidth() / (double)m_header->getTimeScale()); return TRACK_WIDTH + xPos; } @@ -426,7 +434,8 @@ int MultiTrackView::getTrackIndex(Track *trk) { for (int idx = 0; idx < m_tracks.count(); idx++) { - if ((trk == NULL && m_tracks.at(idx)->isActive()) || (trk != NULL && trk == m_tracks.at(idx)->getTrack())) + if ((trk == NULL && m_tracks.at(idx)->isActive()) + || (trk != NULL && trk == m_tracks.at(idx)->getTrack())) return idx; } @@ -546,7 +555,8 @@ void MultiTrackView::slotViewScrolled(int) void MultiTrackView::slotItemMoved(QGraphicsSceneMouseEvent *event, ShowItem *item) { - qDebug() << Q_FUNC_INFO << "event - <" << event->pos().toPoint().x() << "> - <" << event->pos().toPoint().y() << ">"; + qDebug() << Q_FUNC_INFO << "event - <" << event->pos().toPoint().x() << "> - <" + << event->pos().toPoint().y() << ">"; // align to the appropriate track bool moved = true; quint32 s_time = 0; diff --git a/ui/src/showmanager/rgbmatrixitem.cpp b/ui/src/showmanager/rgbmatrixitem.cpp index 7ddaac4acd..e2a1e8cd79 100644 --- a/ui/src/showmanager/rgbmatrixitem.cpp +++ b/ui/src/showmanager/rgbmatrixitem.cpp @@ -71,8 +71,9 @@ void RGBMatrixItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt if (matrixDuration) { - float xpos = 0; - int loopCount = m_function->duration() ? qFloor(m_function->duration() / m_matrix->totalDuration()) : 0; + float xpos = 0; + int loopCount = + m_function->duration() ? qFloor(m_function->duration() / m_matrix->totalDuration()) : 0; for (int i = 0; i < loopCount; i++) { diff --git a/ui/src/showmanager/showeditor.cpp b/ui/src/showmanager/showeditor.cpp index f9d62cbf36..cbca53b260 100644 --- a/ui/src/showmanager/showeditor.cpp +++ b/ui/src/showmanager/showeditor.cpp @@ -53,7 +53,8 @@ ShowEditor::ShowEditor(QWidget *parent, Show *show, Doc *doc) m_tree->setSelectionMode(QAbstractItemView::SingleSelection); m_tree->header()->setSectionResizeMode(QHeaderView::Interactive); - connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, SLOT(slotNameEdited(const QString &))); + connect(m_nameEdit, SIGNAL(textEdited(const QString &)), this, + SLOT(slotNameEdited(const QString &))); connect(m_add, SIGNAL(clicked()), this, SLOT(slotAdd())); connect(m_remove, SIGNAL(clicked()), this, SLOT(slotRemove())); diff --git a/ui/src/showmanager/showitem.cpp b/ui/src/showmanager/showitem.cpp index ba93a4229c..e7900a995e 100644 --- a/ui/src/showmanager/showitem.cpp +++ b/ui/src/showmanager/showitem.cpp @@ -304,7 +304,8 @@ void ShowItem::postPaint(QPainter *painter) { quint32 s_time = 0; if (x() > TRACK_WIDTH) - s_time = (double)(x() - TRACK_WIDTH - 2) * (m_timeScale * 500) / (double)(HALF_SECOND_WIDTH); + s_time = + (double)(x() - TRACK_WIDTH - 2) * (m_timeScale * 500) / (double)(HALF_SECOND_WIDTH); painter->drawText(3, TRACK_HEIGHT - 10, Function::speedToString(s_time)); } } diff --git a/ui/src/showmanager/showmanager.cpp b/ui/src/showmanager/showmanager.cpp index b89288a6d2..ed76eb3512 100644 --- a/ui/src/showmanager/showmanager.cpp +++ b/ui/src/showmanager/showmanager.cpp @@ -115,7 +115,8 @@ ShowManager::ShowManager(QWidget *parent, Doc *doc) SLOT(slotShowItemMoved(ShowItem *, quint32, bool))); connect(m_showview, SIGNAL(timeChanged(quint32)), this, SLOT(slotUpdateTime(quint32))); connect(m_showview, SIGNAL(trackClicked(Track *)), this, SLOT(slotTrackClicked(Track *))); - connect(m_showview, SIGNAL(trackDoubleClicked(Track *)), this, SLOT(slotTrackDoubleClicked(Track *))); + connect(m_showview, SIGNAL(trackDoubleClicked(Track *)), this, + SLOT(slotTrackDoubleClicked(Track *))); connect(m_showview, SIGNAL(trackMoved(Track *, int)), this, SLOT(slotTrackMoved(Track *, int))); connect(m_showview, SIGNAL(trackDelete(Track *)), this, SLOT(slotTrackDelete(Track *))); @@ -192,7 +193,8 @@ void ShowManager::initActions() m_addShowAction->setShortcut(QKeySequence("CTRL+H")); connect(m_addShowAction, SIGNAL(triggered(bool)), this, SLOT(slotAddShow())); - m_addTrackAction = new QAction(QIcon(":/edit_add.png"), tr("Add a &track or an existing function"), this); + m_addTrackAction = + new QAction(QIcon(":/edit_add.png"), tr("Add a &track or an existing function"), this); m_addTrackAction->setShortcut(QKeySequence("CTRL+N")); connect(m_addTrackAction, SIGNAL(triggered(bool)), this, SLOT(slotAddItem())); @@ -315,7 +317,8 @@ void ShowManager::initToolbar() m_timeDivisionCombo->addItem("BPM 3/4", ShowHeaderItem::BPM_3_4); m_timeDivisionCombo->addItem("BPM 2/4", ShowHeaderItem::BPM_2_4); m_toolbar->addWidget(m_timeDivisionCombo); - connect(m_timeDivisionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTimeDivisionTypeChanged(int))); + connect(m_timeDivisionCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(slotTimeDivisionTypeChanged(int))); m_bpmField = new QSpinBox(); m_bpmField->setFixedWidth(70); @@ -424,7 +427,8 @@ void ShowManager::showSceneEditor(Scene *scene) m_splitter->widget(1)->layout()->addWidget(m_sceneEditor); m_splitter->widget(1)->show(); - connect(this, SIGNAL(functionManagerActive(bool)), m_sceneEditor, SLOT(slotFunctionManagerActive(bool))); + connect(this, SIGNAL(functionManagerActive(bool)), m_sceneEditor, + SLOT(slotFunctionManagerActive(bool))); } } } @@ -457,7 +461,8 @@ void ShowManager::showRightEditor(Function *function) m_currentEditor = new ChaserEditor(m_vsplitter->widget(1), chaser, m_doc); if (m_currentEditor != NULL) { - connect(m_currentEditor, SIGNAL(stepSelectionChanged(int)), this, SLOT(slotStepSelectionChanged(int))); + connect(m_currentEditor, SIGNAL(stepSelectionChanged(int)), this, + SLOT(slotStepSelectionChanged(int))); } } else if (function->type() == Function::SequenceType) @@ -480,16 +485,19 @@ void ShowManager::showRightEditor(Function *function) connect(m_sceneEditor, SIGNAL(fixtureValueChanged(SceneValue, bool)), m_currentEditor, SLOT(slotUpdateCurrentStep(SceneValue, bool))); - connect(m_currentEditor, SIGNAL(stepSelectionChanged(int)), this, SLOT(slotStepSelectionChanged(int))); + connect(m_currentEditor, SIGNAL(stepSelectionChanged(int)), this, + SLOT(slotStepSelectionChanged(int))); } } else if (function->type() == Function::AudioType) { - m_currentEditor = new AudioEditor(m_vsplitter->widget(1), qobject_cast
" + tr("Fade Out") + "" + tr("Duration") + "" + tr("Notes") + "
" + QString::number(i + 1) + "" + function->name() + "
%1%2%3
%1%2
%1%2
%1 %2%3
%1 %2%3
PID: 0x%1 (%2)
PID: 0x%1 (%2)
PID: 0x%1 (%2)
PID: 0x%1 (%2)
\n"; str += ""; str += ""; @@ -1525,52 +1548,55 @@ QString WebAccess::getChildrenHTML(VCWidget *frame, int pagesNum, int currentPag QString WebAccess::getVCHTML() { - m_CSScode = "\n"; + m_CSScode = + "\n"; m_CSScode += "\n"; m_JScode = "\n" "\n" "\n"; - QString str = HTML_HEADER + m_CSScode + m_JScode + "\n\n" + widgetsHTML + "\n\n"; + QString str = HTML_HEADER + m_CSScode + m_JScode + "\n\n" + widgetsHTML + + "\n\n"; return str; } diff --git a/webaccess/src/webaccess.h b/webaccess/src/webaccess.h index d4981638e5..97168b2a88 100644 --- a/webaccess/src/webaccess.h +++ b/webaccess/src/webaccess.h @@ -50,8 +50,8 @@ class WebAccess : public QObject { Q_OBJECT public: - explicit WebAccess(Doc *doc, VirtualConsole *vcInstance, SimpleDesk *sdInstance, int portNumber, bool enableAuth, - QString passwdFile = QString(), QObject *parent = 0); + explicit WebAccess(Doc *doc, VirtualConsole *vcInstance, SimpleDesk *sdInstance, int portNumber, + bool enableAuth, QString passwdFile = QString(), QObject *parent = 0); /** Destructor */ ~WebAccess(); diff --git a/webaccess/src/webaccessauth.cpp b/webaccess/src/webaccessauth.cpp index 12262870b0..d1f362c7b4 100644 --- a/webaccess/src/webaccessauth.cpp +++ b/webaccess/src/webaccessauth.cpp @@ -40,7 +40,8 @@ WebAccessAuth::WebAccessAuth(const QString &realm) : m_passwords() , m_realm(realm) { - m_passwordsFile = QString("%1/%2/%3").arg(getenv("HOME")).arg(USERQLCPLUSDIR).arg(DEFAULT_PASSWORD_FILE); + m_passwordsFile = + QString("%1/%2/%3").arg(getenv("HOME")).arg(USERQLCPLUSDIR).arg(DEFAULT_PASSWORD_FILE); } bool WebAccessAuth::loadPasswordsFile(const QString &filePath) @@ -99,7 +100,8 @@ bool WebAccessAuth::savePasswordsFile() const foreach (QString username, m_passwords.keys()) { WebAccessUser user = m_passwords.value(username); - stream << user.username << ':' << user.passwordHash << ':' << (int)user.level << ':' << user.hashType << ':' + stream << user.username << ':' << user.passwordHash << ':' << (int)user.level << ':' + << user.hashType << ':' #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) << user.passwordSalt << Qt::endl; #else @@ -144,8 +146,8 @@ WebAccessUser WebAccessAuth::authenticateRequest(const QHttpRequest *req, QHttpR void WebAccessAuth::addUser(const QString &username, const QString &password, WebAccessUserLevel level) { QString salt = this->generateSalt(); - WebAccessUser user(username, this->hashPassword(DEFAULT_PASSWORD_HASH_TYPE, password, salt), level, - DEFAULT_PASSWORD_HASH_TYPE, salt); + WebAccessUser user(username, this->hashPassword(DEFAULT_PASSWORD_HASH_TYPE, password, salt), + level, DEFAULT_PASSWORD_HASH_TYPE, salt); m_passwords.insert(username, user); } @@ -173,18 +175,19 @@ QList WebAccessAuth::getUsers() const void WebAccessAuth::sendUnauthorizedResponse(QHttpResponse *res) const { // TODO: Allow for localization of this - const static QByteArray text = QString("" - "" - "" - "Unauthorized" - "" - "" - "

401 Unauthorized

" - "

Access to this resource requires proper authorization" - " and you have failed to authenticate.

" - "" - "") - .toUtf8(); + const static QByteArray text = + QString("" + "" + "" + "Unauthorized" + "" + "" + "

401 Unauthorized

" + "

Access to this resource requires proper authorization" + " and you have failed to authenticate.

" + "" + "") + .toUtf8(); res->setHeader("Content-Type", "text/html"); res->setHeader("Content-Length", QString::number(text.size())); @@ -210,7 +213,8 @@ QString WebAccessAuth::generateSalt() const return salt; } -QString WebAccessAuth::hashPassword(const QString &hashType, const QString &password, const QString &passwordSalt) const +QString WebAccessAuth::hashPassword(const QString &hashType, const QString &password, + const QString &passwordSalt) const { QString passwordWithSalt = password + passwordSalt; QCryptographicHash::Algorithm algorithm = QCryptographicHash::Sha1; diff --git a/webaccess/src/webaccessauth.h b/webaccess/src/webaccessauth.h index 54626a3fd7..13b48e0f9f 100644 --- a/webaccess/src/webaccessauth.h +++ b/webaccess/src/webaccessauth.h @@ -139,7 +139,8 @@ class WebAccessAuth private: QString generateSalt() const; - QString hashPassword(const QString &hashType, const QString &password, const QString &passwordSalt) const; + QString hashPassword(const QString &hashType, const QString &password, + const QString &passwordSalt) const; bool verifyPassword(const QString &password, const WebAccessUser &user) const; bool hasAtLeastOneAdmin() const; diff --git a/webaccess/src/webaccessconfiguration.cpp b/webaccess/src/webaccessconfiguration.cpp index f216caf935..986aa435f3 100644 --- a/webaccess/src/webaccessconfiguration.cpp +++ b/webaccess/src/webaccessconfiguration.cpp @@ -93,18 +93,21 @@ QString WebAccessConfiguration::getIOConfigHTML(Doc *doc) QString selected = ""; if (currentInputPluginName == strList.at(0) && currentInput == strList.at(2).toUInt()) selected = "selected"; - html += "\n"; } html += "\n"; - html += "
\n"; @@ -115,17 +118,20 @@ QString WebAccessConfiguration::getIOConfigHTML(Doc *doc) QString selected = ""; if (currentFeedbackPluginName == strList.at(0) && currentFeedback == strList.at(2).toUInt()) selected = "selected"; - html += "\n"; } html += "\n"; - html += "\n"; html += "\n"; audioOutSelect += "\n"; @@ -262,22 +269,28 @@ QString WebAccessConfiguration::getPasswordsConfigHTML(WebAccessAuth *auth) html += ""; html += ""; html += ""; html += ""; } html += ""; - html += ""; - html += ""; + html += ""; + html += ""; html += ""; @@ -311,38 +324,41 @@ QString WebAccessConfiguration::getHTML(Doc *doc, WebAccessAuth *auth) QString m_JScode = "\n"; m_JScode += "\n"; - QString m_CSScode = "\n" - "\n"; + QString m_CSScode = + "\n" + "\n"; QString extraButtons = ""; if (QLCFile::hasWindowManager() == false) { - extraButtons = "" + tr("System") + "\n"; + extraButtons = "" + tr("System") + + "\n"; } - QString bodyHTML = "\n" - "\n" - "" + QString bodyHTML = + "\n" + "\n" + "" - "
\n" - "" - + tr("Back") + "\n" + extraButtons + "
" + QString(APPNAME) + " " - + QString(APPVERSION) - + "
" - "
\n"; + "
\n" + "" + + tr("Back") + "\n" + extraButtons + "
" + QString(APPNAME) + + " " + QString(APPVERSION) + + "
" + "
\n"; // ********************* IO mapping *********************** bodyHTML += "
\n"; @@ -380,7 +396,8 @@ QString WebAccessConfiguration::getHTML(Doc *doc, WebAccessAuth *auth) bodyHTML += "
"; } - QString str = HTML_HEADER + m_JScode + m_CSScode + "\n\n" + bodyHTML + "\n"; + QString str = + HTML_HEADER + m_JScode + m_CSScode + "\n\n" + bodyHTML + "\n"; return str; } diff --git a/webaccess/src/webaccessnetwork.cpp b/webaccess/src/webaccessnetwork.cpp index bdb08fafea..badd025ab6 100644 --- a/webaccess/src/webaccessnetwork.cpp +++ b/webaccess/src/webaccessnetwork.cpp @@ -105,8 +105,8 @@ QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo *iface) { html += tr("Access point name (SSID): ") + "name + "SSID\" size=\"15\" value=\"" + iface->ssid + "\">
\n"; - html += tr("WPA-PSK Password: ") + "name + "WPAPSK\" size=\"15\" value=\"" - + iface->wpaPass + "\">
\n"; + html += tr("WPA-PSK Password: ") + "name + + "WPAPSK\" size=\"15\" value=\"" + iface->wpaPass + "\">
\n"; } /** IP mode radio buttons */ html += "name @@ -115,16 +115,17 @@ QString WebAccessNetwork::getInterfaceHTML(InterfaceInfo *iface) + "', true);\" value=\"static\" " + staticChk + ">" + tr("Static") + "
\n"; /** Static IP fields */ - html += "
name + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; - html += tr("IP Address: ") + "name + "IPaddr\" size=\"15\" value=\"" - + iface->address + "\">
\n"; - html += tr("Netmask: ") + "name + "Netmask\" size=\"15\" value=\"" - + iface->netmask + "\">
\n"; - html += tr("Gateway: ") + "name + "Gateway\" value=\"" - + iface->gateway + "\">
\n"; + html += "
name + + "StaticFields\" style=\"padding: 5px 30px; visibility:" + visibility + ";\">\n"; + html += tr("IP Address: ") + "name + + "IPaddr\" size=\"15\" value=\"" + iface->address + "\">
\n"; + html += tr("Netmask: ") + "name + + "Netmask\" size=\"15\" value=\"" + iface->netmask + "\">
\n"; + html += tr("Gateway: ") + "name + + "Gateway\" value=\"" + iface->gateway + "\">
\n"; html += "
\n"; - html += "name - + "');\" >\n"; + html += "name + "');\" >\n"; html += "
"; return html; @@ -302,8 +303,9 @@ QString WebAccessNetwork::getNetworkHTML() { if (info.enabled) html += getInterfaceHTML(&info); - qDebug() << "Interface:" << info.name << "isstatic:" << info.isStatic << "address:" << info.address - << "netmask:" << info.netmask << "gateway:" << info.gateway; + qDebug() << "Interface:" << info.name << "isstatic:" << info.isStatic + << "address:" << info.address << "netmask:" << info.netmask + << "gateway:" << info.gateway; } return html; @@ -314,7 +316,8 @@ QString WebAccessNetwork::getHTML() QString m_JScode = "\n"; m_JScode += "\n"; - QString m_CSScode = "\n"; + QString m_CSScode = + "\n"; m_CSScode += "
#" + tr("Name") + "" + tr("Fade In") + ""; - html += ""; - html += ""; + html += ""; + html += ""; html += "
"; html += ""; html += "