- Added option -gui in comamd line to show the Pure Data GUI's

- Bugfix in initiatializinng the text subpatch
This commit is contained in:
Santi Noreña 2013-03-01 21:06:35 +01:00
parent d1c4295692
commit b877185c0d
8 changed files with 97 additions and 50 deletions

View file

@ -93,7 +93,7 @@ bool audioCheck;
libreMediaServer::libreMediaServer(QWidget *parent)
libreMediaServer::libreMediaServer(QStringList args, QWidget *parent)
: QMainWindow(parent),
m_startvideo(0),
m_startaudio(0),
@ -102,10 +102,17 @@ libreMediaServer::libreMediaServer(QWidget *parent)
m_pd_write_video(NULL),
m_pd_write_audio(NULL),
m_pd_read_audio(NULL),
m_tcpsocket_audio(NULL)
m_tcpsocket_audio(NULL),
m_gui(FALSE)
{
qDebug() << "******************************************************************************************************";
qDebug() << QDate::currentDate() << QTime::currentTime();
qDebug() << "Parsing the command line";
if (args.contains("-gui"))
{
qDebug()<< "libremediaserver Constructor option GUI detected";
m_gui = true;
}
// Iniciamos el User Interface
ui.setupUi(this);
// Unix Local Sockets
@ -844,7 +851,11 @@ void libreMediaServer::pdstart()
Q_CHECK_PTR(m_pd_write_video);
connect(m_pd_write_video, SIGNAL(connected()),this, SLOT(newconexion()));
// Arrancamos el proceso Pure Data
m_pd_video->start("./pd -noaudio -lib Gem -stderr -nostdpath -path ./externals/ ./patches/lms-video.pd");
QString arguments;
arguments.append("./pd -noaudio -lib Gem -stderr -nostdpath -path ./externals/ -open ./patches/lms-video.pd ");
if (!m_gui)
arguments.append("-nogui");
m_pd_video->start(arguments);
if (m_pd_video->waitForStarted(3000)){
ui.textEdit->appendPlainText("Video Engine started.");
}
@ -869,7 +880,7 @@ void libreMediaServer::pdrestart()
}
save_finish();
qDebug()<<"**************************************************************************";
qDebug()<<"Starting PD Video:" << ++m_startvideo;
qDebug()<<"PD Video Restarts:" << ++m_startvideo;
ui.textEdit->appendPlainText("PD Video Restarting.");
disconnect(m_pd_video, SIGNAL(finished(int)), this, SLOT(pdrestart()));
pdstart();
@ -1363,7 +1374,11 @@ void libreMediaServer::pdstart_audio()
qDebug()<<"error listening tcpServer";
}
// Arrancamos el proceso Pure Data
m_pd_audio->start("./pd -alsa -channels 2 -audiodev 1 -stderr -nostdpath -path ./externals/ ./patches/lms-audio.pd");
QString arguments;
arguments.append("./pd -alsa -channels 2 -audiodev 1 -stderr -nostdpath -path ./externals/ ./patches/lms-audio.pd ");
if (!m_gui)
arguments.append("-nogui");
m_pd_audio->start(arguments);
if (m_pd_audio->waitForStarted(3000)){
ui.textEdit->appendPlainText("PD Audio started.");
}

View file

@ -47,7 +47,7 @@ class libreMediaServer : public QMainWindow
public:
libreMediaServer (QWidget *parent = 0);
libreMediaServer (QStringList args, QWidget *parent = 0);
virtual ~libreMediaServer();
Ui::LibreMediaServer ui;
@ -72,6 +72,7 @@ protected:
QTimer *m_preview; // Timer for the preview screen
int m_startvideo; // Counter starts video engine. Debugging purpose
int m_startaudio; // Counter starts audio engine. Debugging purpose
bool m_gui;
private:
@ -85,7 +86,7 @@ private:
void save_finish();
void open(QFile *file);
void save(QFile *file);
// void MessageHandler(QtMsgType type, const char *msg);
// void MessageHandler(QtMsgType type, const char *msg);
public slots:

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.5.0, 2013-03-01T18:09:52. -->
<!-- Written by Qt Creator 2.5.0, 2013-03-01T20:59:13. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -213,7 +213,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments">-gui</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">libremediaserver.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>

View file

@ -19,6 +19,8 @@
#include <QApplication>
#include "libremediaserver.h"
#define VERSION "0.03-1";
// Handler for pipe the stderr to a log file
bool initMessageHandler = 0;
@ -73,8 +75,27 @@ void MessageHandler(QtMsgType type, const char *msg)
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStringList args = app.arguments();
if (args.size() > 1)
{
if (args.contains("-v") > 0)
{
qDebug() << "LibreMediaServer Version" << VERSION;
app.exit();
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();
return 0;
}
}
qInstallMsgHandler(MessageHandler);
libreMediaServer libreMediaServer;
libreMediaServer libreMediaServer(args);
libreMediaServer.show();
return app.exec();
}