Skip to content

Commit

Permalink
Merge pull request #254 from docsteer/2.1-dev
Browse files Browse the repository at this point in the history
Merge 2.1 Dev into master
  • Loading branch information
docsteer authored Jan 30, 2022
2 parents b094563 + c65880b commit d3d031b
Show file tree
Hide file tree
Showing 18 changed files with 272 additions and 197 deletions.
2 changes: 1 addition & 1 deletion libs/breakpad
Submodule breakpad updated 420 files
6 changes: 5 additions & 1 deletion sACNView.pro
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ include(libs.pri)

## Project includes

INCLUDEPATH += src src/sacn src/sacn/ACNShare
INCLUDEPATH += src \
src/sacn src/sacn/ACNShare \
src/widgets

## Sources

SOURCES += src/main.cpp\
src/widgets/monitorspinbox.cpp \
src/mdimainwindow.cpp \
src/scopewindow.cpp \
src/universeview.cpp \
Expand Down Expand Up @@ -126,6 +129,7 @@ SOURCES += src/main.cpp\
src/grideditwidget.cpp

HEADERS += src/mdimainwindow.h \
src/widgets/monitorspinbox.h \
src/scopewindow.h \
src/universeview.h \
src/sacn/ACNShare/CID.h \
Expand Down
173 changes: 47 additions & 126 deletions src/bigdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,48 @@

BigDisplay::BigDisplay(int universe, quint16 address, QWidget *parent) :
QWidget(parent),
ui(new Ui::BigDisplay),
m_universe(universe)
ui(new Ui::BigDisplay)
{
ui->setupUi(this);

// Make address human readable
address++;

// 8bit controls
ui->spinBox_8->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_8->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_8->setValue(address);
ui->spinBox_8->setWrapping(true);
ui->spinBox_8->setAddress(universe, address);
connect(ui->spinBox_8, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);

// 16bit controls
ui->spinBox_16_Coarse->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_16_Coarse->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_16_Coarse->setValue(address);
ui->spinBox_16_Coarse->setWrapping(true);
ui->spinBox_16_Coarse->setAddress(universe, address);
connect(ui->spinBox_16_Coarse, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);
//--
ui->spinBox_16_Fine->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_16_Fine->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_16_Fine->setValue(address + 1);
ui->spinBox_16_Fine->setWrapping(true);
ui->spinBox_16_Fine->setAddress(universe, address + 1);
connect(ui->spinBox_16_Fine, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);

// Colour controls
ui->spinBox_RGB_1->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_RGB_1->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_RGB_1->setValue(address);
ui->spinBox_RGB_1->setWrapping(true);
ui->spinBox_RGB_1->setAddress(universe, address);
connect(ui->spinBox_RGB_1, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);
//--
ui->spinBox_RGB_2->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_RGB_2->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_RGB_2->setValue(address + 1);
ui->spinBox_RGB_2->setWrapping(true);
ui->spinBox_RGB_2->setAddress(universe, address + 1);
connect(ui->spinBox_RGB_2, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);
//--
ui->spinBox_RGB_3->setMinimum(MIN_DMX_ADDRESS);
ui->spinBox_RGB_3->setMaximum(MAX_DMX_ADDRESS);
ui->spinBox_RGB_3->setValue(address + 2);
ui->spinBox_RGB_3->setWrapping(true);
ui->spinBox_RGB_3->setAddress(universe, address + 2);
connect(ui->spinBox_RGB_3, &monitorspinbox::dataReady, this, &BigDisplay::dataReady);

// Window
this->setWindowTitle(tr("Big Display Universe %1").arg(m_universe));
this->setWindowTitle(tr("Big Display Universe %1").arg(universe));
this->setWindowIcon(parent->windowIcon());

// Listen to universe
m_listener = sACNManager::getInstance()->getListener(m_universe);
connect(m_listener.data(), SIGNAL(dataReady(int, QPointF)), this, SLOT(dataReady(int, QPointF)));

m_data = 0;

setupAddressMonitors();
m_level = 0;
displayLevel();
}

BigDisplay::~BigDisplay()
{
delete ui;
}

void BigDisplay::setupAddressMonitors()
{
m_listener->monitorAddress(ui->spinBox_8->value() - 1);

m_listener->monitorAddress(ui->spinBox_16_Coarse->value() - 1);
m_listener->monitorAddress(ui->spinBox_16_Fine->value() - 1);

m_listener->monitorAddress(ui->spinBox_RGB_1->value() - 1);
m_listener->monitorAddress(ui->spinBox_RGB_2->value() - 1);
m_listener->monitorAddress(ui->spinBox_RGB_3->value() - 1);
}

void BigDisplay::displayData()
void BigDisplay::displayLevel()
{
QPalette palette = ui->lcdNumber->palette();
QColor colour(m_data | 0xFF000000);
QColor colour(m_level | 0xFF000000);

// Display format
if((ui->tabWidget->currentIndex() == tabModes_bit8) |
Expand All @@ -94,13 +61,13 @@ void BigDisplay::displayData()
case Preferences::DECIMAL:
{
ui->lcdNumber->setMode(QLCDNumber::Dec);
ui->lcdNumber->display((int)m_data);
ui->lcdNumber->display((int)m_level);
break;
}
case Preferences::HEXADECIMAL:
{
ui->lcdNumber->setMode(QLCDNumber::Hex);
ui->lcdNumber->display((int)m_data);
ui->lcdNumber->display((int)m_level);
break;
}
case Preferences::PERCENT:
Expand All @@ -109,12 +76,12 @@ void BigDisplay::displayData()
// Display percent with an optional fraction
if(ui->tabWidget->currentIndex() == tabModes_bit8)
{
ui->lcdNumber->display(HTOPT[m_data & 0xFF]);
ui->lcdNumber->display(HTOPT[m_level & 0xFF]);
}
else
{
int percent = HTOPT[(m_data & 0xFF00) >> 8];
int fraction = m_data & 0xFF;
int percent = HTOPT[(m_level & 0xFF00) >> 8];
int fraction = m_level & 0xFF;
double value = percent + fraction/255.0;
ui->lcdNumber->display(value);
}
Expand All @@ -131,100 +98,54 @@ void BigDisplay::displayData()
ui->lcdNumber->setPalette(palette);
ui->lcdNumber->setDigitCount(6);
ui->lcdNumber->setMode(QLCDNumber::Hex);
ui->lcdNumber->display((int)m_data);
ui->lcdNumber->display((int)m_level);
}



}

void BigDisplay::dataReady(int address, QPointF data)
void BigDisplay::dataReady(int universe, quint16 address, QPointF data)
{
bool required = false;
address++;
quint32 value = data.y();

quint8 level = data.y() > 0 ? data.y() : 0;

switch (ui->tabWidget->currentIndex())
{
case tabModes_bit8:
if (address == ui->spinBox_8->value()) {
required = true;
m_data = data.y();
}
if (address == ui->spinBox_8->address() && universe == ui->spinBox_8->universe())
m_level = level;

break;

case tabModes_bit16:
if (address == ui->spinBox_16_Coarse->value()) {
required = true;
m_data = (m_data & 0x00FF) | (0xFF00 & (value << 8));
}
if (address == ui->spinBox_16_Coarse->address() && universe == ui->spinBox_16_Coarse->universe())
m_level = (m_level & 0x00FF) | (0xFF00 & (level << 8));

if (address == ui->spinBox_16_Fine->value()) {
required = true;
m_data = (m_data & 0xFF00) | (0x00FF & value);
}
if (address == ui->spinBox_16_Fine->address() && universe == ui->spinBox_16_Fine->universe())
m_level = (m_level & 0xFF00) | (0x00FF & level);

break;

case tabModes_rgb:
if (address == ui->spinBox_RGB_1->value()) {
required = true;
m_data = (m_data & 0x00FFFFu) | (0xFF0000u & ((quint32)value << 16));
}
if (address == ui->spinBox_RGB_1->address() && universe == ui->spinBox_RGB_1->universe())
m_level = (m_level & 0x00FFFFu) | (0xFF0000u & ((quint32)level << 16));

if (address == ui->spinBox_RGB_2->value()) {
required = true;
m_data = (m_data & 0xFF00FFu) | (0x00FF00u & ((quint32)value << 8));
}
if (address == ui->spinBox_RGB_2->address() && universe == ui->spinBox_RGB_2->universe())
m_level = (m_level & 0xFF00FFu) | (0x00FF00u & ((quint32)level << 8));

if (address == ui->spinBox_RGB_3->value()) {
required = true;
m_data = (m_data & 0xFFFF00u) | (0x0000FFu & value);
}
break;
if (address == ui->spinBox_RGB_3->address() && universe == ui->spinBox_RGB_3->universe())
m_level = (m_level & 0xFFFF00u) | (0x0000FFu & level);

default:
m_data = -1;
break;
}

// Unrequired address?
if (!required)
{
m_listener->unMonitorAddress(address);
setupAddressMonitors();
default:
m_level = -1;
break;
}

displayData();
}

void BigDisplay::on_spinBox_8_editingFinished()
{
setupAddressMonitors();
}

void BigDisplay::on_spinBox_16_Coarse_editingFinished()
{
setupAddressMonitors();
}

void BigDisplay::on_spinBox_16_Fine_editingFinished()
{
setupAddressMonitors();
}

void BigDisplay::on_spinBox_RGB_1_editingFinished()
{
setupAddressMonitors();
}

void BigDisplay::on_spinBox_RGB_2_editingFinished()
{
setupAddressMonitors();
displayLevel();
}

void BigDisplay::on_spinBox_RGB_3_editingFinished()
void BigDisplay::on_tabWidget_currentChanged(int index)
{
setupAddressMonitors();
Q_UNUSED(index);
m_level = 0;
displayLevel();
}
18 changes: 4 additions & 14 deletions src/bigdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <QWidget>
#include "consts.h"
#include "sacnlistener.h"

namespace Ui {
class BigDisplay;
Expand All @@ -19,8 +18,6 @@ class BigDisplay : public QWidget

private:
Ui::BigDisplay *ui;
int m_universe;
sACNManager::tListener m_listener;

enum tabModes
{
Expand All @@ -29,22 +26,15 @@ class BigDisplay : public QWidget
tabModes_rgb
};

void setupAddressMonitors();

private slots:
void dataReady(int address, QPointF data);
void dataReady(int universe, quint16 address, QPointF data);

void on_spinBox_8_editingFinished();
void on_spinBox_16_Coarse_editingFinished();
void on_spinBox_16_Fine_editingFinished();
void on_spinBox_RGB_1_editingFinished();
void on_spinBox_RGB_2_editingFinished();
void on_spinBox_RGB_3_editingFinished();
void on_tabWidget_currentChanged(int index);

private:
void displayData();
void displayLevel();

quint32 m_data;
quint32 m_level;
};

#endif // BIGDISPLAY_H
6 changes: 0 additions & 6 deletions src/pcapplaybacksender.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#include "pcapplaybacksender.h"
#ifdef Q_OS_LINUX
#include <linux/socket.h>
#include <linux/in.h>
#endif
#ifdef Q_OS_UNIX
#include <sys/socket.h>
#endif
#ifdef Q_OS_MACOS
#include <netinet/in.h>
#endif
#include <pcap.h>
Expand Down
Loading

0 comments on commit d3d031b

Please sign in to comment.