diff --git a/src/libremediaserver-audio.cpp b/src/libremediaserver-audio.cpp index 4f372a4..c640399 100755 --- a/src/libremediaserver-audio.cpp +++ b/src/libremediaserver-audio.cpp @@ -73,7 +73,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent) // Conectamos los menus connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile())); 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(Settings::getInstance(), SIGNAL( registerUniverse(int) ), @@ -132,19 +132,10 @@ void libreMediaServerAudio::saveFile() // save(&file); } -// Change Media path -void libreMediaServerAudio::ChangeMediaPath() +void libreMediaServerAudio::settings() { - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::Directory); - 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()); + SettingsDialog sd = new SettingsDialog(); + sd.show(); } @@ -159,9 +150,6 @@ void libreMediaServerAudio::olasetup() view->show(); } -/** - * Parse the dmx information - */ 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 diff --git a/src/libremediaserver-audio.h b/src/libremediaserver-audio.h index d24ac19..ab75743 100755 --- a/src/libremediaserver-audio.h +++ b/src/libremediaserver-audio.h @@ -25,7 +25,7 @@ #include #include #include -#include +//#include #include #include @@ -36,6 +36,7 @@ #include "olathread.h" #include "audiomasterwidget.h" #include "defines.h" +#include "settingsdialog.h" #include "ui_libremediaserver-audio.h" @@ -58,7 +59,7 @@ protected: private: - // void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg); +// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg); AudioMasterWidget *amw; olaThread *ola; @@ -73,14 +74,32 @@ public slots: private slots: - + /** + * @brief Shows the OLA web setup page + */ void olasetup(); + + /** + * @brief Parser for new dmx data arriving + * @param layer + * @param channel + * @param value + */ void dmxInput(int layer, int channel, int value); // Menu File + /** + * @brief REad from dis a configuration file + */ void openFile(); + /** + * @brief Write to disk a configuration file + */ void saveFile(); - void ChangeMediaPath();// Change the path to medias + /** + * @brief OPen the settings dialog + */ + void settings(); }; #endif // LIBREMEDIASERVERAUDIO_H diff --git a/src/libremediaserver-audio.pro b/src/libremediaserver-audio.pro index c6b3dec..a828af7 100755 --- a/src/libremediaserver-audio.pro +++ b/src/libremediaserver-audio.pro @@ -3,8 +3,8 @@ TARGET = libremediaserver-audio QT += webkitwidgets widgets -CONFIG += release -DESTDIR = ./release +CONFIG += debug +DESTDIR = ./debug HEADERS += libremediaserver-audio.h \ medialibrary.h \ @@ -28,7 +28,8 @@ SOURCES += main.cpp \ settingsdialog.cpp FORMS += \ - libremediaserver-audio.ui + libremediaserver-audio.ui \ + settingsdialog.ui #INCLUDEPATH += ./ diff --git a/src/libremediaserver-audio.ui b/src/libremediaserver-audio.ui index 188a656..b4cec80 100755 --- a/src/libremediaserver-audio.ui +++ b/src/libremediaserver-audio.ui @@ -30,7 +30,7 @@ - + @@ -42,17 +42,17 @@ - Open Configuration + Open Configuration... - Save Configuration + Save Configuration... - + - Change Media Path + Settings... @@ -75,7 +75,7 @@ - OLA Setup + OLA Setup... diff --git a/src/settings.h b/src/settings.h index 8c36cc3..b843ba6 100644 --- a/src/settings.h +++ b/src/settings.h @@ -50,15 +50,19 @@ public: inline QList getDmxSettings() { return m_settings; } /** - * @brief getlayersNumber + * @brief Get the number of layer currently used * @return */ inline int getLayersNumber() { return m_layersNumber; } + /** + * @brief Get the number of universes registered + * @return + */ inline int getUniverseNumber() { return m_universe.size(); } /** - * @brief readDefaultFile + * @brief Read the default xml configuration file at startup */ void readFile(); diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 95e69f6..68670d0 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -1,16 +1,55 @@ #include "settingsdialog.h" +#include "ui_settingsdialog.h" SettingsDialog::SettingsDialog(QWidget *parent) : - QWidget(parent) + QDialog(parent), + ui(new Ui::SettingsDialog) { - QHBoxLayout *layout = new QHBoxLayout(); - for (int i= 0; i < LAYERS_NUMBER; i++ ) { - layout->insertWidget(i, new SettingsLayerWidget(this, tr("Layer %1").arg(i))); - } - setLayout(layout); + ui->setupUi(this); + ui->layersNumber = Settings::getInstance()->getLayersNumber(); + QString path; + path << "Path to root folder of the media tree: " << std::endl << Settings::getInstance()->getPathMedia(); + ui->mediaPath->setText(path); + + connect(ui->mediaPatchButton, SIGNAL(clicked()), + this, SLOT(changeMediaPath())); + // ToDo: Conectarlo todoooo + + QList 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() { QFileDialog dialog(this); @@ -24,18 +63,3 @@ void SettingsDialog::ChangeMediaPath() QString desc = tr("Media Path Changed to: %1").arg(file); 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) -{ - - -} - diff --git a/src/settingsdialog.h b/src/settingsdialog.h index bacca6c..bbc3bd2 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -1,46 +1,27 @@ #ifndef SETTINGSDIALOG_H #define SETTINGSDIALOG_H -#include -#include "defines.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include "settings.h" -#include "medialibrary.h" +namespace Ui { +class SettingsDialog; +} -class SettingsDialog : public QWidget +class SettingsDialog : public QDialog { Q_OBJECT + public: explicit SettingsDialog(QWidget *parent = 0); + ~SettingsDialog(); +private slots: + universeChanged(int uni); + addressChanged(int add); void ChangeMediaPath(); - void olasetup(); -signals: - -public slots: - private: - QLabel m_path; - 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: + Ui::SettingsDialog *ui; }; #endif // SETTINGSDIALOG_H diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui new file mode 100644 index 0000000..6b5aaa2 --- /dev/null +++ b/src/settingsdialog.ui @@ -0,0 +1,155 @@ + + + SettingsDialog + + + + 0 + 0 + 400 + 429 + + + + Dialog + + + + + 290 + 390 + 101 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + 10 + 40 + 52 + 31 + + + + Layers Number + + + Layers Number + + + Layers Number + + + false + + + + + + true + + + + + + + + + 60 + 40 + 111 + 21 + + + + Layers Number + + + + + + 10 + 10 + 371 + 21 + + + + TextLabel + + + + + + 200 + 40 + 191 + 31 + + + + Change Path to Media + + + false + + + false + + + + + + 9 + 99 + 381 + 281 + + + + + + + + + buttonBox + accepted() + SettingsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +