cambios desconocidos
This commit is contained in:
parent
5f27d17d8a
commit
0b958b5fd8
18 changed files with 289 additions and 94 deletions
49
src/layersettingswidget.cpp
Normal file
49
src/layersettingswidget.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
#include "layersettingswidget.h"
|
||||
#include "ui_layersettingswidget.h"
|
||||
|
||||
LayerSettingsWidget::LayerSettingsWidget(QWidget *parent, int layer) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::LayerSettingsWidget),
|
||||
m_layer(layer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->address, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(addressChanged(int)));
|
||||
connect(ui->universe, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(universeChanged(int)));
|
||||
}
|
||||
|
||||
LayerSettingsWidget::~LayerSettingsWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LayerSettingsWidget::setAddress(int add)
|
||||
{
|
||||
ui->address->setValue(add);
|
||||
}
|
||||
|
||||
int LayerSettingsWidget::getAddress()
|
||||
{
|
||||
return ui->address->value();
|
||||
}
|
||||
|
||||
void LayerSettingsWidget::setUniverse(int uni)
|
||||
{
|
||||
ui->universe->setValue(uni);
|
||||
}
|
||||
|
||||
int LayerSettingsWidget::getUniverse()
|
||||
{
|
||||
return ui->universe->value();
|
||||
}
|
||||
|
||||
void LayerSettingsWidget::universeChanged(int val)
|
||||
{
|
||||
Settings::getInstance()->changeLayerSetup(m_layer, val, ui->address->value());
|
||||
}
|
||||
|
||||
void LayerSettingsWidget::addressChanged(int val)
|
||||
{
|
||||
Settings::getInstance()->changeLayerSetup(m_layer, ui->universe->value(), val);
|
||||
}
|
32
src/layersettingswidget.h
Normal file
32
src/layersettingswidget.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef LAYERSETTINGSWIDGET_H
|
||||
#define LAYERSETTINGSWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
namespace Ui {
|
||||
class LayerSettingsWidget;
|
||||
}
|
||||
|
||||
class LayerSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LayerSettingsWidget(QWidget *parent, int layer);
|
||||
~LayerSettingsWidget();
|
||||
void setAddress(int add);
|
||||
int getAddress();
|
||||
void setUniverse(int uni);
|
||||
int getUniverse();
|
||||
private:
|
||||
Ui::LayerSettingsWidget *ui;
|
||||
int m_layer;
|
||||
|
||||
private slots:
|
||||
void addressChanged(int val);
|
||||
void universeChanged(int val);
|
||||
};
|
||||
|
||||
#endif // LAYERSETTINGSWIDGET_H
|
42
src/layersettingswidget.ui
Normal file
42
src/layersettingswidget.ui
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LayerSettingsWidget</class>
|
||||
<widget class="QWidget" name="LayerSettingsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>194</width>
|
||||
<height>59</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QSpinBox" name="universe">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>52</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="address">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<width>52</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="accessibleDescription">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
4
src/libremediaserver-audio.cpp
Executable file → Normal file
4
src/libremediaserver-audio.cpp
Executable file → Normal file
|
@ -134,8 +134,8 @@ void libreMediaServerAudio::saveFile()
|
|||
|
||||
void libreMediaServerAudio::settings()
|
||||
{
|
||||
SettingsDialog sd = new SettingsDialog();
|
||||
sd.show();
|
||||
SettingsDialog *sd = new SettingsDialog();
|
||||
sd->show();
|
||||
}
|
||||
|
||||
|
||||
|
|
2
src/libremediaserver-audio.h
Executable file → Normal file
2
src/libremediaserver-audio.h
Executable file → Normal file
|
@ -25,7 +25,7 @@
|
|||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
//#include <QWebView>
|
||||
#include <QWebView>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QTextEdit>
|
||||
|
|
9
src/libremediaserver-audio.pro
Executable file → Normal file
9
src/libremediaserver-audio.pro
Executable file → Normal file
|
@ -15,7 +15,8 @@ HEADERS += libremediaserver-audio.h \
|
|||
audiomasterwidget.h \
|
||||
defines.h \
|
||||
settings.h \
|
||||
settingsdialog.h
|
||||
settingsdialog.h \
|
||||
layersettingswidget.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
libremediaserver-audio.cpp \
|
||||
|
@ -25,11 +26,13 @@ SOURCES += main.cpp \
|
|||
audiowidget.cpp \
|
||||
audiomasterwidget.cpp \
|
||||
settings.cpp \
|
||||
settingsdialog.cpp
|
||||
settingsdialog.cpp \
|
||||
layersettingswidget.cpp
|
||||
|
||||
FORMS += \
|
||||
libremediaserver-audio.ui \
|
||||
settingsdialog.ui
|
||||
settingsdialog.ui \
|
||||
layersettingswidget.ui
|
||||
|
||||
#INCLUDEPATH += ./
|
||||
|
||||
|
|
0
src/libremediaserver-audio.ui
Executable file → Normal file
0
src/libremediaserver-audio.ui
Executable file → Normal file
0
src/main.cpp
Executable file → Normal file
0
src/main.cpp
Executable file → Normal file
|
@ -96,6 +96,34 @@ void Settings::readFromFile(QString file) {
|
|||
void Settings::readFile() {
|
||||
readFromFile(DEFAULT_FILE);
|
||||
}
|
||||
|
||||
void Settings::changeLayerSetup(int layer, int universe, int address)
|
||||
{
|
||||
dmxSetting temp;
|
||||
temp.address = address;
|
||||
temp.universe = universe;
|
||||
temp.layer = layer;
|
||||
m_settings.replace(layer, temp);
|
||||
if (!m_universe.contains(temp.universe)) {
|
||||
m_universe.insert(temp.universe);
|
||||
// emit registerUniverse(temp.universe);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::addLayer()
|
||||
{
|
||||
dmxSetting temp;
|
||||
temp.address = -1;
|
||||
temp.universe = -1;
|
||||
temp.layer = -1;
|
||||
m_settings.append(temp);
|
||||
}
|
||||
|
||||
void Settings::removeLayer(int layer)
|
||||
{
|
||||
m_settings.removeAt(layer);
|
||||
}
|
||||
|
||||
/*
|
||||
void Settings::writeFile(QString filename)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QSet>
|
||||
|
||||
//#include "olathread.h"
|
||||
#include "medialibrary.h"
|
||||
#include "defines.h"
|
||||
|
||||
|
@ -66,18 +65,24 @@ public:
|
|||
*/
|
||||
void readFile();
|
||||
|
||||
private:
|
||||
|
||||
static Settings *_instance;
|
||||
|
||||
/** Constructor
|
||||
*
|
||||
/**
|
||||
* @brief changeLayerSetup
|
||||
* @param layer
|
||||
* @param universe
|
||||
* @param address
|
||||
*/
|
||||
explicit Settings(QObject *parent = 0);
|
||||
void changeLayerSetup(int layer, int universe, int address);
|
||||
|
||||
QSet<int> m_universe; // Registered universes.
|
||||
/**
|
||||
* @brief removeLayer
|
||||
* @param layer
|
||||
*/
|
||||
void removeLayer(int layer);
|
||||
|
||||
int m_layersNumber; // Number of layers in wich divide the dmx frame. Each layer, one source.
|
||||
/**
|
||||
* @brief addLayer
|
||||
*/
|
||||
void addLayer();
|
||||
|
||||
/**
|
||||
* @brief olaThread::setLayersNumber
|
||||
|
@ -91,12 +96,24 @@ private:
|
|||
else
|
||||
m_layersNumber = LAYERS_NUMBER;
|
||||
}
|
||||
private:
|
||||
|
||||
// The list where we store the settings by layer
|
||||
QList<dmxSetting> m_settings;
|
||||
static Settings *_instance;
|
||||
|
||||
// The path to media library
|
||||
QString m_pathmedia;
|
||||
// The list where we store the settings by layer
|
||||
QList<dmxSetting> m_settings;
|
||||
|
||||
// The path to media library
|
||||
QString m_pathmedia;
|
||||
|
||||
/** Constructor
|
||||
*
|
||||
*/
|
||||
explicit Settings(QObject *parent = 0);
|
||||
|
||||
QSet<int> m_universe; // Registered universes.
|
||||
|
||||
int m_layersNumber; // Number of layers in wich divide the dmx frame. Each layer, one source.
|
||||
|
||||
/**
|
||||
* @brief readFromFile
|
||||
|
|
|
@ -6,32 +6,23 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
|||
ui(new Ui::SettingsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->layersNumber = Settings::getInstance()->getLayersNumber();
|
||||
QString path;
|
||||
path << "Path to root folder of the media tree: " << std::endl << Settings::getInstance()->getPathMedia();
|
||||
this->setWindowTitle("Settings");
|
||||
ui->layersNumber->setValue(Settings::getInstance()->getLayersNumber());
|
||||
QString path("Path to root folder of the media tree: /n");
|
||||
path.append(Settings::getInstance()->getPathMedia());
|
||||
ui->mediaPath->setText(path);
|
||||
|
||||
connect(ui->mediaPatchButton, SIGNAL(clicked()),
|
||||
this, SLOT(changeMediaPath()));
|
||||
// ToDo: Conectarlo todoooo
|
||||
|
||||
QList<dmxSetting> dmx = Settings::getInstance()->getDmxSettings();
|
||||
foreach (it, dmx) {
|
||||
QHBoxLayout *layer = new QHBoxLayout;
|
||||
QSpinBox *universe = new QSpinBox();
|
||||
universe->setValue(it.universe);
|
||||
layer->addWidget(universe);
|
||||
|
||||
QSpinBox *address = new QSpinBox();
|
||||
address->setValue(it.address);
|
||||
layer->addWidget(address);
|
||||
|
||||
ui->layersLayout->addLayout(address);
|
||||
|
||||
connect(universe, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(universeChanged(int)));
|
||||
connect(address, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(addressChnged(int)));
|
||||
connect(ui->layersNumber, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(layersChanged(int)));
|
||||
int layer = 0;
|
||||
foreach (const dmxSetting &it, Settings::getInstance()->getDmxSettings()) {
|
||||
LayerSettingsWidget *temp = new LayerSettingsWidget(this, layer);
|
||||
temp->setUniverse(it.universe);
|
||||
temp->setAddress(it.address);
|
||||
ui->layersLayout->insertWidget(layer, temp);
|
||||
layer++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,17 +31,7 @@ SettingsDialog::~SettingsDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
SettingsDialog::universeChanged(int uni)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SettingsDialog::addressChanged(int add)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SettingsDialog::ChangeMediaPath()
|
||||
void SettingsDialog::changeMediaPath()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::Directory);
|
||||
|
@ -59,7 +40,30 @@ void SettingsDialog::ChangeMediaPath()
|
|||
return;
|
||||
fileNames = dialog.selectedFiles();
|
||||
QString file = fileNames.at(0);
|
||||
// MediaLibrary::getInstance()->setPath(file);
|
||||
Settings::getInstance()->setPathMedia(file);
|
||||
QString desc = tr("Media Path Changed to: %1").arg(file);
|
||||
qDebug(desc.toLatin1().constData());
|
||||
}
|
||||
|
||||
void SettingsDialog::layersChanged(int val)
|
||||
{
|
||||
int layers = Settings::getInstance()->getLayersNumber();
|
||||
if (val > layers)
|
||||
{
|
||||
while (val != layers)
|
||||
{
|
||||
ui->layersLayout->addWidget(new LayerSettingsWidget(this, val));
|
||||
layers++;
|
||||
}
|
||||
} else if (val < layers)
|
||||
{
|
||||
while (val != layers)
|
||||
{
|
||||
Settings::getInstance()->removeLayer(val);
|
||||
QLayoutItem * const item = ui->layersLayout->itemAt(layers);
|
||||
ui->layersLayout->removeItem(item);
|
||||
layers--;
|
||||
}
|
||||
}
|
||||
Settings::getInstance()->setLayersNumber(layers);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
#define SETTINGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include "settings.h"
|
||||
#include "layersettingswidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class SettingsDialog;
|
||||
|
@ -17,11 +20,12 @@ public:
|
|||
~SettingsDialog();
|
||||
|
||||
private slots:
|
||||
universeChanged(int uni);
|
||||
addressChanged(int add);
|
||||
void ChangeMediaPath();
|
||||
void changeMediaPath();
|
||||
private:
|
||||
Ui::SettingsDialog *ui;
|
||||
|
||||
private slots:
|
||||
void layersChanged(int val);
|
||||
};
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue