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
|
||||
ui.setupUi(this);
|
||||
this->setWindowTitle(VERSION);
|
||||
|
||||
// Inicia el widget Terminal
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->append(QString::fromAscii(VERSION));
|
||||
|
@ -46,12 +47,10 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
|
||||
|
||||
// Inicia el widget central de audio
|
||||
|
||||
aw = new AudioWidget(this);
|
||||
setCentralWidget(aw);
|
||||
|
||||
// Inicia el widget Master. No implementado todavía
|
||||
|
||||
// Inicia el widget Master.
|
||||
amw = new AudioMasterWidget(this);
|
||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||
|
@ -71,7 +70,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
|
||||
if (args.contains("-log"))
|
||||
{
|
||||
textEdit->append("Log to file");
|
||||
textEdit->append("Logging to file");
|
||||
}
|
||||
|
||||
// Conectamos los menus
|
||||
|
@ -97,8 +96,10 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
ola, SLOT( setDMXConf(dmxSetting) ) );
|
||||
|
||||
// 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
|
||||
AudioMotor::getInstance()->init();
|
||||
|
||||
|
|
|
@ -72,17 +72,20 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
|||
return mediaList;
|
||||
}
|
||||
|
||||
/** Selects one media name
|
||||
/** Selects one media path from the library
|
||||
*
|
||||
*/
|
||||
|
||||
QString MediaLibrary::requestNewFile(int folder, int file){
|
||||
// Select one mediafile from the media library
|
||||
QString newfile;
|
||||
if (m_pathmedia.isNull()) {
|
||||
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 (file < m_media->at(folder).m_MediaInformation.size()) {
|
||||
newfile = m_media->at(folder).m_MediaInformation.at(file).MediaName;
|
||||
|
|
|
@ -13,14 +13,14 @@ Settings::Settings(QObject *parent) :
|
|||
// - The universe to bind in OLA
|
||||
// All this is being moved to settingsDialog Class
|
||||
|
||||
void Settings::readFromFile(QString file) {
|
||||
bool Settings::readFromFile(QString file) {
|
||||
|
||||
QFile* xmlFile = new QFile(file);
|
||||
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
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);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile);
|
||||
int counter = 0;
|
||||
|
@ -64,6 +64,8 @@ void Settings::readFromFile(QString file) {
|
|||
}
|
||||
if(xmlReader->hasError()) {
|
||||
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
|
||||
xmlReader->clear();
|
||||
|
@ -71,11 +73,16 @@ void Settings::readFromFile(QString file) {
|
|||
|
||||
delete xmlReader;
|
||||
delete xmlFile;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Read the default file
|
||||
*
|
||||
*/
|
||||
void Settings::readDefaultFile() {
|
||||
readFromFile(DEFAULT_FILE);
|
||||
bool Settings::readDefaultFile() {
|
||||
if (readFromFile(DEFAULT_FILE)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ class Settings : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit Settings(QObject *parent = 0);
|
||||
void readFromFile(QString file);
|
||||
void readDefaultFile();
|
||||
bool readFromFile(QString file);
|
||||
bool readDefaultFile();
|
||||
|
||||
signals:
|
||||
void pathChanged(QString path);
|
||||
|
|
Loading…
Add table
Reference in a new issue