- Added -log option to command line

- Added COPYRIGHT VERSION LICENSE marocs in libremediaserver.h
This commit is contained in:
Santi Noreña 2013-03-02 14:26:06 +01:00
parent b877185c0d
commit 794552bdea
6 changed files with 54 additions and 25 deletions

View file

@ -19,8 +19,6 @@
#include <QApplication>
#include "libremediaserver.h"
#define VERSION "0.03-1";
// Handler for pipe the stderr to a log file
bool initMessageHandler = 0;
@ -43,6 +41,7 @@ void MessageHandler(QtMsgType type, const char *msg)
txt = QString("Fatal: %1").arg(msg);
abort();
}
// Create the log dir and log file
if (!initMessageHandler)
{
QDir dir;
@ -76,25 +75,42 @@ 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)
{
qDebug() << "LibreMediaServer Version" << VERSION;
app.exit();
qDebug() << VERSION;
qDebug() << COPYRIGHT;
qDebug() << LICENSE;
return 0;
}
if (args.contains("-h") > 0)
{
qDebug() << "LibreMediaServer Version" << VERSION;
qDebug() << "Help";
qDebug() << "-v Show the version and exits";
qDebug() << "-gui show the Pure Data GUI's.";
app.exit();
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 -h for help in command line arguments";
return 0;
}
}
qInstallMsgHandler(MessageHandler);
libreMediaServer libreMediaServer(args);
libreMediaServer.show();
return app.exec();