- 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);
|
||||
ui.setupUi(this);
|
||||
|
||||
// Lee la configuración por defecto
|
||||
Settings::getInstance()->readFile();
|
||||
|
||||
// Inicia la lectura de dmx a través de ola
|
||||
ola = new olaThread();
|
||||
Q_CHECK_PTR(ola);
|
||||
|
@ -148,7 +151,7 @@ void libreMediaServerAudio::ChangeMediaPath()
|
|||
fileNames = dialog.selectedFiles();
|
||||
QString file = fileNames.at(0);
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,6 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
QString m_pathmedia; // Path to Medias
|
||||
|
||||
private:
|
||||
|
||||
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
||||
|
|
|
@ -25,6 +25,7 @@ MediaLibrary::MediaLibrary(QObject *parent) :
|
|||
*/
|
||||
|
||||
void MediaLibrary::initMediaLibrary() {
|
||||
qDebug("starting the media library");
|
||||
QDir dir;
|
||||
if (!dir.cd(Settings::getInstance()->getPathMedia())) {
|
||||
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.
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
m_dmx[i.layer][j] = value;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,10 +61,10 @@ private:
|
|||
*/
|
||||
inline void RegisterComplete(const ola::client::Result &error) {
|
||||
if (error.Success()) {
|
||||
// qDebug("Register Universe success");
|
||||
qDebug("Register Universe success");
|
||||
emit toTerminal("Register Universe success");
|
||||
} 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()));
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,11 @@ public slots:
|
|||
* @param 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() {
|
||||
for (int universe = 0; universe < Settings::getInstance()->getUniverseNumber(); universe++) {
|
||||
QSet<int> unis = Settings::getInstance()->getUniverses();
|
||||
foreach (const int &universe, unis) {
|
||||
registerUniverse(universe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,19 +11,16 @@ Settings *Settings::getInstance() {
|
|||
return _instance;
|
||||
}
|
||||
|
||||
Settings::Settings(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
m_layersNumber = 0;
|
||||
}
|
||||
|
||||
void Settings::setPathMedia(QString path)
|
||||
{
|
||||
m_pathmedia = path;
|
||||
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:
|
||||
|
|
|
@ -57,6 +57,11 @@ public:
|
|||
|
||||
inline int getUniverseNumber() { return m_universe.size(); }
|
||||
|
||||
/**
|
||||
* @brief readDefaultFile
|
||||
*/
|
||||
void readFile();
|
||||
|
||||
private:
|
||||
|
||||
static Settings *_instance;
|
||||
|
@ -95,11 +100,6 @@ private:
|
|||
*/
|
||||
void readFromFile(QString file);
|
||||
|
||||
/**
|
||||
* @brief readDefaultFile
|
||||
*/
|
||||
void readFile();
|
||||
|
||||
/**
|
||||
* @brief writeFile
|
||||
* @param filename
|
||||
|
|
Loading…
Add table
Reference in a new issue