Fixed sigsev on init. Added AudioMasterWidget only with receiving dmx
checkbox. Protected requestNewFile for NULL on m_media Settings::readtFile returns bool now.
This commit is contained in:
parent
87e1a22e47
commit
061f58aee4
4 changed files with 28 additions and 17 deletions
|
@ -34,6 +34,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
// Inicia el User Interface
|
// Inicia el User Interface
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
this->setWindowTitle(VERSION);
|
this->setWindowTitle(VERSION);
|
||||||
|
|
||||||
// Inicia el widget Terminal
|
// Inicia el widget Terminal
|
||||||
textEdit = new QTextEdit(this);
|
textEdit = new QTextEdit(this);
|
||||||
textEdit->append(QString::fromAscii(VERSION));
|
textEdit->append(QString::fromAscii(VERSION));
|
||||||
|
@ -46,12 +47,10 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
|
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
|
||||||
|
|
||||||
// Inicia el widget central de audio
|
// Inicia el widget central de audio
|
||||||
|
|
||||||
aw = new AudioWidget(this);
|
aw = new AudioWidget(this);
|
||||||
setCentralWidget(aw);
|
setCentralWidget(aw);
|
||||||
|
|
||||||
// Inicia el widget Master. No implementado todavía
|
// Inicia el widget Master.
|
||||||
|
|
||||||
amw = new AudioMasterWidget(this);
|
amw = new AudioMasterWidget(this);
|
||||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||||
|
@ -71,7 +70,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
|
|
||||||
if (args.contains("-log"))
|
if (args.contains("-log"))
|
||||||
{
|
{
|
||||||
textEdit->append("Log to file");
|
textEdit->append("Logging to file");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conectamos los menus
|
// Conectamos los menus
|
||||||
|
@ -97,8 +96,10 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
ola, SLOT( setDMXConf(dmxSetting) ) );
|
ola, SLOT( setDMXConf(dmxSetting) ) );
|
||||||
|
|
||||||
// Lee la configuración por defecto
|
// Lee la configuración por defecto
|
||||||
set->readDefaultFile();
|
while (!set->readDefaultFile()) {
|
||||||
|
// Dar la oportunidad de cargar otro fichero de configuración
|
||||||
|
// Crear el fichero por defecto.
|
||||||
|
}
|
||||||
// Iniciamos Pure Data
|
// Iniciamos Pure Data
|
||||||
AudioMotor::getInstance()->init();
|
AudioMotor::getInstance()->init();
|
||||||
|
|
||||||
|
|
|
@ -72,17 +72,20 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||||
return mediaList;
|
return mediaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Selects one media name
|
/** Selects one media path from the library
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString MediaLibrary::requestNewFile(int folder, int file){
|
QString MediaLibrary::requestNewFile(int folder, int file){
|
||||||
// Select one mediafile from the media library
|
QString newfile;
|
||||||
if (m_pathmedia.isNull()) {
|
if (m_pathmedia.isNull()) {
|
||||||
qWarning("Path not set yet");
|
qWarning("Path not set yet");
|
||||||
return NULL;
|
return newfile;
|
||||||
|
}
|
||||||
|
if (m_media == NULL) {
|
||||||
|
qWarning("media not setup");
|
||||||
|
return newfile;
|
||||||
}
|
}
|
||||||
QString newfile;
|
|
||||||
if (folder < m_media->size()) {
|
if (folder < m_media->size()) {
|
||||||
if (file < m_media->at(folder).m_MediaInformation.size()) {
|
if (file < m_media->at(folder).m_MediaInformation.size()) {
|
||||||
newfile = m_media->at(folder).m_MediaInformation.at(file).MediaName;
|
newfile = m_media->at(folder).m_MediaInformation.at(file).MediaName;
|
||||||
|
|
|
@ -13,14 +13,14 @@ Settings::Settings(QObject *parent) :
|
||||||
// - The universe to bind in OLA
|
// - The universe to bind in OLA
|
||||||
// All this is being moved to settingsDialog Class
|
// All this is being moved to settingsDialog Class
|
||||||
|
|
||||||
void Settings::readFromFile(QString file) {
|
bool Settings::readFromFile(QString file) {
|
||||||
|
|
||||||
QFile* xmlFile = new QFile(file);
|
QFile* xmlFile = new QFile(file);
|
||||||
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
QMessageBox::critical(NULL,"Load XML File Problem",
|
QMessageBox::critical(NULL,"Load XML File Problem",
|
||||||
QString("Couldn't open %1 to load settings for olaInterface").arg(file),
|
QString("Couldn't open %1 to load settings").arg(file),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile);
|
QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -64,6 +64,8 @@ void Settings::readFromFile(QString file) {
|
||||||
}
|
}
|
||||||
if(xmlReader->hasError()) {
|
if(xmlReader->hasError()) {
|
||||||
QMessageBox::critical(NULL,"File xml Parse Error ", xmlReader->errorString(), QMessageBox::Ok);
|
QMessageBox::critical(NULL,"File xml Parse Error ", xmlReader->errorString(), QMessageBox::Ok);
|
||||||
|
qWarning("File xml Parse Error %s", xmlReader->errorString().toLatin1().constData());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
//close reader and flush file
|
//close reader and flush file
|
||||||
xmlReader->clear();
|
xmlReader->clear();
|
||||||
|
@ -71,11 +73,16 @@ void Settings::readFromFile(QString file) {
|
||||||
|
|
||||||
delete xmlReader;
|
delete xmlReader;
|
||||||
delete xmlFile;
|
delete xmlFile;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read the default file
|
/** Read the default file
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Settings::readDefaultFile() {
|
bool Settings::readDefaultFile() {
|
||||||
readFromFile(DEFAULT_FILE);
|
if (readFromFile(DEFAULT_FILE)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ class Settings : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Settings(QObject *parent = 0);
|
explicit Settings(QObject *parent = 0);
|
||||||
void readFromFile(QString file);
|
bool readFromFile(QString file);
|
||||||
void readDefaultFile();
|
bool readDefaultFile();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pathChanged(QString path);
|
void pathChanged(QString path);
|
||||||
|
|
Loading…
Add table
Reference in a new issue