Empezando la configuración mediante el GUI
This commit is contained in:
parent
02fa9827c2
commit
5f27d17d8a
8 changed files with 256 additions and 84 deletions
|
@ -73,7 +73,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
// Conectamos los menus
|
// Conectamos los menus
|
||||||
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||||
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
||||||
connect(ui.actionChange_Media_Path, SIGNAL(triggered()), this, SLOT(ChangeMediaPath()));
|
connect(ui.action_Settings, SIGNAL(triggered()), this, SLOT(settings()));
|
||||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||||
|
|
||||||
connect(Settings::getInstance(), SIGNAL( registerUniverse(int) ),
|
connect(Settings::getInstance(), SIGNAL( registerUniverse(int) ),
|
||||||
|
@ -132,19 +132,10 @@ void libreMediaServerAudio::saveFile()
|
||||||
// save(&file);
|
// save(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change Media path
|
void libreMediaServerAudio::settings()
|
||||||
void libreMediaServerAudio::ChangeMediaPath()
|
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this);
|
SettingsDialog sd = new SettingsDialog();
|
||||||
dialog.setFileMode(QFileDialog::Directory);
|
sd.show();
|
||||||
QStringList fileNames;
|
|
||||||
if (!dialog.exec())
|
|
||||||
return;
|
|
||||||
fileNames = dialog.selectedFiles();
|
|
||||||
QString file = fileNames.at(0);
|
|
||||||
Settings::getInstance()->setPathMedia(file);
|
|
||||||
QString desc = tr("Media Path Changed to: %1").arg(file);
|
|
||||||
qDebug(desc.toLatin1().constData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,9 +150,6 @@ void libreMediaServerAudio::olasetup()
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the dmx information
|
|
||||||
*/
|
|
||||||
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
{
|
{
|
||||||
// This qDebug slows all the program. Uncomment only for debugging purpouse and comment again in normal use
|
// This qDebug slows all the program. Uncomment only for debugging purpouse and comment again in normal use
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QWebView>
|
//#include <QWebView>
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include "olathread.h"
|
#include "olathread.h"
|
||||||
#include "audiomasterwidget.h"
|
#include "audiomasterwidget.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "settingsdialog.h"
|
||||||
|
|
||||||
#include "ui_libremediaserver-audio.h"
|
#include "ui_libremediaserver-audio.h"
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
||||||
AudioMasterWidget *amw;
|
AudioMasterWidget *amw;
|
||||||
|
|
||||||
olaThread *ola;
|
olaThread *ola;
|
||||||
|
@ -73,14 +74,32 @@ public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shows the OLA web setup page
|
||||||
|
*/
|
||||||
void olasetup();
|
void olasetup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parser for new dmx data arriving
|
||||||
|
* @param layer
|
||||||
|
* @param channel
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
void dmxInput(int layer, int channel, int value);
|
void dmxInput(int layer, int channel, int value);
|
||||||
|
|
||||||
// Menu File
|
// Menu File
|
||||||
|
/**
|
||||||
|
* @brief REad from dis a configuration file
|
||||||
|
*/
|
||||||
void openFile();
|
void openFile();
|
||||||
|
/**
|
||||||
|
* @brief Write to disk a configuration file
|
||||||
|
*/
|
||||||
void saveFile();
|
void saveFile();
|
||||||
void ChangeMediaPath();// Change the path to medias
|
/**
|
||||||
|
* @brief OPen the settings dialog
|
||||||
|
*/
|
||||||
|
void settings();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIBREMEDIASERVERAUDIO_H
|
#endif // LIBREMEDIASERVERAUDIO_H
|
||||||
|
|
|
@ -3,8 +3,8 @@ TARGET = libremediaserver-audio
|
||||||
|
|
||||||
QT += webkitwidgets widgets
|
QT += webkitwidgets widgets
|
||||||
|
|
||||||
CONFIG += release
|
CONFIG += debug
|
||||||
DESTDIR = ./release
|
DESTDIR = ./debug
|
||||||
|
|
||||||
HEADERS += libremediaserver-audio.h \
|
HEADERS += libremediaserver-audio.h \
|
||||||
medialibrary.h \
|
medialibrary.h \
|
||||||
|
@ -28,7 +28,8 @@ SOURCES += main.cpp \
|
||||||
settingsdialog.cpp
|
settingsdialog.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
libremediaserver-audio.ui
|
libremediaserver-audio.ui \
|
||||||
|
settingsdialog.ui
|
||||||
|
|
||||||
#INCLUDEPATH += ./
|
#INCLUDEPATH += ./
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionOpen_conf"/>
|
<addaction name="actionOpen_conf"/>
|
||||||
<addaction name="actionSave_conf"/>
|
<addaction name="actionSave_conf"/>
|
||||||
<addaction name="actionChange_Media_Path"/>
|
<addaction name="action_Settings"/>
|
||||||
<addaction name="actionLaunch_OLA_Setup"/>
|
<addaction name="actionLaunch_OLA_Setup"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
|
@ -42,17 +42,17 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOpen_conf">
|
<action name="actionOpen_conf">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open Configuration</string>
|
<string>Open Configuration...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSave_conf">
|
<action name="actionSave_conf">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save Configuration</string>
|
<string>Save Configuration...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionChange_Media_Path">
|
<action name="action_Settings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Change Media Path</string>
|
<string>Settings...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionInitMSEX">
|
<action name="actionInitMSEX">
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLaunch_OLA_Setup">
|
<action name="actionLaunch_OLA_Setup">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>OLA Setup</string>
|
<string>OLA Setup...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -50,15 +50,19 @@ public:
|
||||||
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getlayersNumber
|
* @brief Get the number of layer currently used
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
inline int getLayersNumber() { return m_layersNumber; }
|
inline int getLayersNumber() { return m_layersNumber; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the number of universes registered
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
inline int getUniverseNumber() { return m_universe.size(); }
|
inline int getUniverseNumber() { return m_universe.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief readDefaultFile
|
* @brief Read the default xml configuration file at startup
|
||||||
*/
|
*/
|
||||||
void readFile();
|
void readFile();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,55 @@
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
|
#include "ui_settingsdialog.h"
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget *parent) :
|
SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||||
QWidget(parent)
|
QDialog(parent),
|
||||||
|
ui(new Ui::SettingsDialog)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout();
|
ui->setupUi(this);
|
||||||
for (int i= 0; i < LAYERS_NUMBER; i++ ) {
|
ui->layersNumber = Settings::getInstance()->getLayersNumber();
|
||||||
layout->insertWidget(i, new SettingsLayerWidget(this, tr("Layer %1").arg(i)));
|
QString path;
|
||||||
}
|
path << "Path to root folder of the media tree: " << std::endl << Settings::getInstance()->getPathMedia();
|
||||||
setLayout(layout);
|
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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsDialog::~SettingsDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsDialog::universeChanged(int uni)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsDialog::addressChanged(int add)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change Media path
|
|
||||||
void SettingsDialog::ChangeMediaPath()
|
void SettingsDialog::ChangeMediaPath()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
|
@ -24,18 +63,3 @@ void SettingsDialog::ChangeMediaPath()
|
||||||
QString desc = tr("Media Path Changed to: %1").arg(file);
|
QString desc = tr("Media Path Changed to: %1").arg(file);
|
||||||
qDebug(desc.toLatin1().constData());
|
qDebug(desc.toLatin1().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::olasetup()
|
|
||||||
{
|
|
||||||
QWebView *view = new QWebView();
|
|
||||||
view->load(QUrl("http://localhost:9090/ola.html"));
|
|
||||||
view->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SettingsLayerWidget::SettingsLayerWidget(QWidget *parent, QString title)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,27 @@
|
||||||
#ifndef SETTINGSDIALOG_H
|
#ifndef SETTINGSDIALOG_H
|
||||||
#define SETTINGSDIALOG_H
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QDialog>
|
||||||
#include "defines.h"
|
#include "settings.h"
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QWebView>
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include "medialibrary.h"
|
namespace Ui {
|
||||||
|
class SettingsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
class SettingsDialog : public QWidget
|
class SettingsDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SettingsDialog(QWidget *parent = 0);
|
explicit SettingsDialog(QWidget *parent = 0);
|
||||||
|
~SettingsDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
universeChanged(int uni);
|
||||||
|
addressChanged(int add);
|
||||||
void ChangeMediaPath();
|
void ChangeMediaPath();
|
||||||
void olasetup();
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel m_path;
|
Ui::SettingsDialog *ui;
|
||||||
QPushButton m_changePathToMedias;
|
|
||||||
QPushButton m_olaSetup;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SettingsLayerWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit SettingsLayerWidget(QWidget *parent = 0, QString title = "layer");
|
|
||||||
|
|
||||||
private:
|
|
||||||
QComboBox m_universe;
|
|
||||||
QComboBox m_address;
|
|
||||||
signals:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
|
155
src/settingsdialog.ui
Normal file
155
src/settingsdialog.ui
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SettingsDialog</class>
|
||||||
|
<widget class="QDialog" name="SettingsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>429</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>290</x>
|
||||||
|
<y>390</y>
|
||||||
|
<width>101</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="layersNumber">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>52</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string>Layers Number</string>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleName">
|
||||||
|
<string>Layers Number</string>
|
||||||
|
</property>
|
||||||
|
<property name="accessibleDescription">
|
||||||
|
<string>Layers Number</string>
|
||||||
|
</property>
|
||||||
|
<property name="wrapping">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="showGroupSeparator" stdset="0">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="prefix">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="layersNumber_label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>60</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Layers Number</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mediaPath">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mediaPatchButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>191</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Change Path to Media</string>
|
||||||
|
</property>
|
||||||
|
<property name="default">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>9</x>
|
||||||
|
<y>99</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>281</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="layersLayout"/>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>SettingsDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>SettingsDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
Loading…
Add table
Reference in a new issue