Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/audio/src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HEADERS += audio.h \
audioplugincache.h

lessThan(QT_MAJOR_VERSION, 5) {
unix:!macx:HEADERS += audiorenderer_alsa.h audiocapture_alsa.h
unix:!macx:!android:HEADERS += audiorenderer_alsa.h audiocapture_alsa.h
win32:HEADERS += audiorenderer_waveout.h audiocapture_wavein.h
}
lessThan(QT_MAJOR_VERSION, 6) {
Expand All @@ -39,7 +39,7 @@ SOURCES += audio.cpp \
audioplugincache.cpp

lessThan(QT_MAJOR_VERSION, 5) {
unix:!macx:SOURCES += audiorenderer_alsa.cpp audiocapture_alsa.cpp
unix:!macx:!android:SOURCES += audiorenderer_alsa.cpp audiocapture_alsa.cpp
win32:SOURCES += audiorenderer_waveout.cpp audiocapture_wavein.cpp

macx {
Expand Down
2 changes: 1 addition & 1 deletion engine/src/qlcinputchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ QLCInputChannel::QLCInputChannel()
, m_movementSensitivity(20)
, m_sendExtraPress(false)
, m_lowerValue(0)
, m_upperValue(UCHAR_MAX)
, m_upperValue(0)
, m_lowerChannel(-1)
{
}
Expand Down
8 changes: 4 additions & 4 deletions engine/src/qlcinputsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ QLCInputSource::QLCInputSource(QThread *parent)
m_lower.setType(QLCInputFeedback::LowerValue);
m_lower.setValue(0);
m_upper.setType(QLCInputFeedback::UpperValue);
m_upper.setValue(UCHAR_MAX);
m_upper.setValue(0);
m_monitor.setType(QLCInputFeedback::MonitorValue);
m_monitor.setValue(UCHAR_MAX);
m_monitor.setValue(0);
}

QLCInputSource::QLCInputSource(quint32 universe, quint32 channel, QThread *parent)
Expand All @@ -65,9 +65,9 @@ QLCInputSource::QLCInputSource(quint32 universe, quint32 channel, QThread *paren
m_lower.setType(QLCInputFeedback::LowerValue);
m_lower.setValue(0);
m_upper.setType(QLCInputFeedback::UpperValue);
m_upper.setValue(UCHAR_MAX);
m_upper.setValue(0);
m_monitor.setType(QLCInputFeedback::MonitorValue);
m_monitor.setValue(UCHAR_MAX);
m_monitor.setValue(0);
}

QLCInputSource::~QLCInputSource()
Expand Down
8 changes: 7 additions & 1 deletion engine/src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ INCLUDEPATH += ../../hotplugmonitor/src
LIBS += -L../../hotplugmonitor/src -lhotplugmonitor
}

LIBS += -L../audio/src -lqlcplusaudio
LIBS += -L../audio/src

android {
LIBS += -lqlcplusaudio_$${QT_ARCH}
} else {
LIBS += -lqlcplusaudio
}

#############################################################################
# Sources
Expand Down
14 changes: 7 additions & 7 deletions platforms/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
limitations under the License.
-->
<manifest package="org.qlcplus" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="5.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<!-- <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> -->
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
Expand All @@ -38,8 +38,8 @@
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<!-- <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> -->
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->

Expand All @@ -55,11 +55,11 @@
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
<!-- <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> -->
<!-- Background running -->
</activity>
</application>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="25"/>
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
7 changes: 4 additions & 3 deletions platforms/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.android.tools.build:gradle:8.0.0'
}
}

repositories {
google()
jcenter()
mavenCentral()
}

apply plugin: 'com.android.application'
Expand All @@ -33,6 +33,7 @@ android {
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
namespace "org.qlcplus"

compileSdkVersion androidCompileSdkVersion.toInteger()

Expand Down
1 change: 1 addition & 0 deletions platforms/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ org.gradle.jvmargs=-Xmx2048m
# build with the same inputs. However, over time, the cache size will
# grow. Uncomment the following line to enable it.
#org.gradle.caching=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion platforms/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 12 additions & 0 deletions ui/src/customfeedbackdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,15 @@ void CustomFeedbackDialog::slotColorSelected(QTreeWidgetItem *item)
m_profileColorsTree->setVisible(false);
m_selectedFeedback = None;
}

void CustomFeedbackDialog::setSyncStatus(bool enable)
{
m_syncStatus = enable;
if (m_syncStatus)
{
m_lowerSpin->setEnabled(false);
m_upperSpin->setEnabled(false);
m_lowerColor->setEnabled(false);
m_upperColor->setEnabled(false);
}
}
3 changes: 3 additions & 0 deletions ui/src/customfeedbackdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class CustomFeedbackDialog : public QDialog, public Ui_CustomFeedbackDialog

void setMonitoringVisibility(bool visible);

void setSyncStatus(bool enable);

/** @reimp */
void accept();

Expand All @@ -57,6 +59,7 @@ protected slots:
QLCInputProfile *m_profile;
QSharedPointer<QLCInputSource> m_inputSource;
SelectedFeedback m_selectedFeedback;
bool m_syncStatus;
};

#endif // CUSTOMFEEDBACKDIALOG_H
18 changes: 12 additions & 6 deletions ui/src/customfeedbackdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>595</width>
<height>535</height>
<width>648</width>
<height>576</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -62,13 +62,19 @@
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="m_lowerSpin">
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
</item>
<item row="2" column="0">
Expand Down Expand Up @@ -104,7 +110,7 @@
<number>255</number>
</property>
<property name="value">
<number>255</number>
<number>32</number>
</property>
</widget>
</item>
Expand Down Expand Up @@ -144,7 +150,7 @@
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -157,10 +163,10 @@
<item row="3" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
Expand Down
100 changes: 100 additions & 0 deletions ui/src/inputselectionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <QDebug>
#include <qmath.h>

#include "customfeedbackdialog.h"
#include "inputselectionwidget.h"
Expand Down Expand Up @@ -51,6 +52,9 @@ InputSelectionWidget::InputSelectionWidget(Doc *doc, QWidget *parent)

connect(m_customFbButton, SIGNAL(clicked(bool)),
this, SLOT(slotCustomFeedbackClicked()));

connect(m_syncColour, SIGNAL(clicked(bool)),
this, SLOT(slotSyncStatusChanged()));
}

InputSelectionWidget::~InputSelectionWidget()
Expand Down Expand Up @@ -120,6 +124,90 @@ QSharedPointer<QLCInputSource> InputSelectionWidget::inputSource() const
return m_inputSource;
}

void InputSelectionWidget::updateFeedback()
{
if (m_inputSource.isNull())
return;

InputPatch *ip = m_doc->inputOutputMap()->inputPatch(m_inputSource->universe());
if (ip != NULL && ip->profile() != NULL)
{
QLCInputProfile *m_profile = ip->profile();

if (m_profile->hasColorTable())
{
QMapIterator <uchar, QPair<QString, QColor>> it(m_profile->colorTable());

int currentDistanceWithRed = 255 * 255 * 3;
int currentDistanceWithGreen = 255 * 255 * 3;
int currentDistanceWithYellow = 255 * 255 * 3;

uchar redValue = 0;
uchar greenValue = 0;
uchar yellowValue = 0;
while (it.hasNext() == true)
{
it.next();
QPair<QString, QColor> lc = it.value();
QColor colorValue = lc.second;
int distanceWithRed = getColorDistance(colorValue, QColor(Qt::red));
int distanceWithGreen = getColorDistance(colorValue, QColor(Qt::green));
int distanceWithYellow = getColorDistance(colorValue, QColor(Qt::yellow));
if (distanceWithRed < currentDistanceWithRed)
{
currentDistanceWithRed = distanceWithRed;
redValue = it.key();
}
if (distanceWithGreen < currentDistanceWithGreen)
{
currentDistanceWithGreen = distanceWithGreen;
greenValue = it.key();
}
if (distanceWithYellow < currentDistanceWithYellow)
{
currentDistanceWithYellow = distanceWithYellow;
yellowValue = it.key();
}
}
m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, redValue);
m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, greenValue);
m_inputSource->setFeedbackValue(QLCInputFeedback::MonitorValue, yellowValue);
}

QLCInputChannel *m_channel = m_profile->channel(m_inputSource->channel());
if (isSyncColor() && m_channel != NULL)
{
if (m_channel->lowerValue() > 0)
{
if (m_channel->lowerValue() == UCHAR_MAX)
m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, UCHAR_MAX);
else
m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, (m_channel->lowerValue() + 1) / 2 * 2);
}

if (m_channel->upperValue() > 0)
{
if (m_channel->upperValue() == UCHAR_MAX)
m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, UCHAR_MAX);
else
m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, (m_channel->upperValue() + 1) / 2 * 2);
}
}
}
}

int InputSelectionWidget::getColorDistance(const QColor &color1, const QColor &color2)
{
return qSqrt(qPow(color1.red() - color2.red(), 2) +
qPow(color1.green() - color2.green(), 2) +
qPow(color1.blue() - color2.blue(), 2));
}

void InputSelectionWidget::slotSyncStatusChanged()
{
updateFeedback();
}

void InputSelectionWidget::slotAttachKey()
{
AssignHotKey ahk(this, m_keySequence);
Expand Down Expand Up @@ -185,6 +273,7 @@ void InputSelectionWidget::slotCustomFeedbackClicked()
{
CustomFeedbackDialog cfDialog(m_doc, m_inputSource, this);
cfDialog.setMonitoringVisibility(m_supportMonitoring);
cfDialog.setSyncStatus(m_syncColour->isChecked());
cfDialog.exec();
}

Expand All @@ -201,4 +290,15 @@ void InputSelectionWidget::updateInputSource()

m_inputUniverseEdit->setText(uniName);
m_inputChannelEdit->setText(chName);
updateFeedback();
}

bool InputSelectionWidget::isSyncColor()
{
return m_syncColour->isChecked();
}

void InputSelectionWidget::setSyncStatus(bool enable)
{
m_syncColour->setChecked(enable);
}
5 changes: 5 additions & 0 deletions ui/src/inputselectionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class InputSelectionWidget : public QWidget, public Ui_InputSelectionWidget
bool isAutoDetecting();
void stopAutoDetection();
void emitOddValues(bool enable);
bool isSyncColor();
void setSyncStatus(bool enable);
void updateFeedback();
int getColorDistance(const QColor &color1, const QColor &color2);

void setKeySequence(const QKeySequence& keySequence);
QKeySequence keySequence() const;
Expand All @@ -58,6 +62,7 @@ protected slots:
void slotAutoDetectInputToggled(bool checked);
void slotInputValueChanged(quint32 universe, quint32 channel);
void slotChooseInputClicked();
void slotSyncStatusChanged();

void slotCustomFeedbackClicked();

Expand Down
Loading
Loading