Qt5 upgrade and new audio engine based in QtMultimedia.

New GUI.
This commit is contained in:
santi 2014-07-10 01:51:29 +02:00
parent 6e268323d2
commit cccd987bdd
23 changed files with 724 additions and 983 deletions

View file

@ -22,35 +22,36 @@
#include "libremediaserver-audio.h"
// Handler for pipe the stderr to a log file
bool initMessageHandler = false;
QFile outFile;
void MessageHandler(QtMsgType type, const char *msg)
void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg)
{
Q_UNUSED(logcontext);
QString txt;
switch (type) {
case QtDebugMsg:
txt = QString("Debug: %1").arg(msg);
txt.append("Debug: ");
txt.append(msg);
break;
case QtWarningMsg:
txt = QString("Warning: %1").arg(msg);
txt.append("Warning: ");
txt.append(msg);
break;
case QtCriticalMsg:
txt = QString("Critical: %1").arg(msg);
txt.append("Critical: ");
txt.append(msg);
break;
case QtFatalMsg:
txt = QString("Fatal: %1").arg(msg);
txt.append("Fatal: ");
txt.append(msg);
abort();
}
// Create the log dir and log file
if (!initMessageHandler)
{
if (!initMessageHandler) {
QDir dir;
if (!dir.exists("log"))
{
if (!dir.mkdir("log"))
{
if (!dir.exists("log")) {
if (!dir.mkdir("log")) {
qDebug()<<"MessageHandler: Can not create log folder";
return;
}
@ -62,9 +63,8 @@ void MessageHandler(QtMsgType type, const char *msg)
filename.append(date.toString("ddMMyy-"));
filename.append(time.toString("hhmmss.txt"));
outFile.setFileName(filename);
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append))
{
qDebug()<<"main/MessageHandler/Qfile::open: can not open log file";
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
qWarning("main/MessageHandler/Qfile::open: can not open log file");
return;
}
initMessageHandler = true;
@ -76,42 +76,31 @@ void MessageHandler(QtMsgType type, const char *msg)
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStringList args = app.arguments();
// parse the command line
if (args.size() > 1)
{
if (args.contains("-v") > 0)
if (args.contains("-v"))
{
qDebug() << VERSION;
qDebug() << COPYRIGHT;
qDebug() << LICENSE;
return 0;
}
if (args.contains("-h") > 0)
if (args.contains("-h"))
{
qDebug() << VERSION;
qDebug() << COPYRIGHT;
qDebug() << LICENSE;
qDebug() << "Help for command line options:";
qDebug() << "-v show the version and exits";
qDebug() << "-gui show the Pure Data GUI's";
qDebug() << "-log write the debug information to a log file instead stderr";
qDebug() << "-h this help";
return 0;
}
if (args.contains("-log"))
{
qInstallMsgHandler(MessageHandler);
}
if (!args.contains("-gui"))
{
for (int i=1; i<args.size();i++)
{
qDebug() << "Option not known: " << args.at(i);
}
qDebug() <<"Write ./libremediaserver-audio -h for help in command line arguments";
return 0;
qInstallMessageHandler(MessageHandler);
}
}
libreMediaServerAudio libreMediaServerAudio(args);