- Fixed a bug in order of initialization and registering universes in
ola
This commit is contained in:
parent
1b7664edaf
commit
eecc123e98
7 changed files with 25 additions and 22 deletions
|
@ -30,6 +30,9 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
Q_UNUSED(args);
|
Q_UNUSED(args);
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
// Lee la configuración por defecto
|
||||||
|
Settings::getInstance()->readFile();
|
||||||
|
|
||||||
// Inicia la lectura de dmx a través de ola
|
// Inicia la lectura de dmx a través de ola
|
||||||
ola = new olaThread();
|
ola = new olaThread();
|
||||||
Q_CHECK_PTR(ola);
|
Q_CHECK_PTR(ola);
|
||||||
|
@ -148,7 +151,7 @@ void libreMediaServerAudio::ChangeMediaPath()
|
||||||
fileNames = dialog.selectedFiles();
|
fileNames = dialog.selectedFiles();
|
||||||
QString file = fileNames.at(0);
|
QString file = fileNames.at(0);
|
||||||
Settings::getInstance()->setPathMedia(file);
|
Settings::getInstance()->setPathMedia(file);
|
||||||
QString desc = tr("Media Path Changed to: %1").arg(m_pathmedia);
|
QString desc = tr("Media Path Changed to: %1").arg(file);
|
||||||
qDebug(desc.toLatin1().constData());
|
qDebug(desc.toLatin1().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
QString m_pathmedia; // Path to Medias
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
||||||
|
|
|
@ -25,6 +25,7 @@ MediaLibrary::MediaLibrary(QObject *parent) :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void MediaLibrary::initMediaLibrary() {
|
void MediaLibrary::initMediaLibrary() {
|
||||||
|
qDebug("starting the media library");
|
||||||
QDir dir;
|
QDir dir;
|
||||||
if (!dir.cd(Settings::getInstance()->getPathMedia())) {
|
if (!dir.cd(Settings::getInstance()->getPathMedia())) {
|
||||||
qWarning("Can not cd to the path: %s", Settings::getInstance()->getPathMedia().toLatin1().constData());
|
qWarning("Can not cd to the path: %s", Settings::getInstance()->getPathMedia().toLatin1().constData());
|
||||||
|
|
|
@ -74,7 +74,6 @@ void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
||||||
if (m_dmx[i.layer][j] != value) { // Compare the new value with the old value.
|
if (m_dmx[i.layer][j] != value) { // Compare the new value with the old value.
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
m_dmx[i.layer][j] = value;
|
m_dmx[i.layer][j] = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ private:
|
||||||
*/
|
*/
|
||||||
inline void RegisterComplete(const ola::client::Result &error) {
|
inline void RegisterComplete(const ola::client::Result &error) {
|
||||||
if (error.Success()) {
|
if (error.Success()) {
|
||||||
// qDebug("Register Universe success");
|
qDebug("Register Universe success");
|
||||||
emit toTerminal("Register Universe success");
|
emit toTerminal("Register Universe success");
|
||||||
} else {
|
} else {
|
||||||
// qWarning("Register command failed: %s", error.Error().c_str());
|
qWarning("Register command failed: %s", error.Error().c_str());
|
||||||
emit toTerminal("olaThread| Register command failed " + QString::fromStdString(error.Error()));
|
emit toTerminal("olaThread| Register command failed " + QString::fromStdString(error.Error()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,11 @@ public slots:
|
||||||
* @param universe
|
* @param universe
|
||||||
*/
|
*/
|
||||||
inline void registerUniverse(int universe) {
|
inline void registerUniverse(int universe) {
|
||||||
m_client->RegisterUniverse(universe, ola::client::REGISTER,ola::NewSingleCallback(this, &olaThread::RegisterComplete));
|
qDebug("Registering universe %d", universe);
|
||||||
|
m_client->RegisterUniverse(universe,
|
||||||
|
ola::client::REGISTER,
|
||||||
|
ola::NewSingleCallback
|
||||||
|
(this, &olaThread::RegisterComplete));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +121,8 @@ public slots:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline void registerUniverse() {
|
inline void registerUniverse() {
|
||||||
for (int universe = 0; universe < Settings::getInstance()->getUniverseNumber(); universe++) {
|
QSet<int> unis = Settings::getInstance()->getUniverses();
|
||||||
|
foreach (const int &universe, unis) {
|
||||||
registerUniverse(universe);
|
registerUniverse(universe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,19 +11,16 @@ Settings *Settings::getInstance() {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Settings::Settings(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
m_layersNumber = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::setPathMedia(QString path)
|
void Settings::setPathMedia(QString path)
|
||||||
{
|
{
|
||||||
m_pathmedia = path;
|
m_pathmedia = path;
|
||||||
MediaLibrary::getInstance()->rescanMediaLibrary();
|
MediaLibrary::getInstance()->rescanMediaLibrary();
|
||||||
m_layersNumber = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings::Settings(QObject *parent) :
|
|
||||||
QObject(parent)
|
|
||||||
{
|
|
||||||
// m_universe = new QSet<int>();
|
|
||||||
// m_settings = new QList<dmxSetting>();
|
|
||||||
readFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the dmx settings for dmx.xml At the moment we need:
|
// Read the dmx settings for dmx.xml At the moment we need:
|
||||||
|
|
|
@ -57,6 +57,11 @@ public:
|
||||||
|
|
||||||
inline int getUniverseNumber() { return m_universe.size(); }
|
inline int getUniverseNumber() { return m_universe.size(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief readDefaultFile
|
||||||
|
*/
|
||||||
|
void readFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static Settings *_instance;
|
static Settings *_instance;
|
||||||
|
@ -95,11 +100,6 @@ private:
|
||||||
*/
|
*/
|
||||||
void readFromFile(QString file);
|
void readFromFile(QString file);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief readDefaultFile
|
|
||||||
*/
|
|
||||||
void readFile();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief writeFile
|
* @brief writeFile
|
||||||
* @param filename
|
* @param filename
|
||||||
|
|
Loading…
Add table
Reference in a new issue