mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2025-02-03 20:42:20 +00:00
Code cleanup
Use GNU formatter from Eclipse.
This commit is contained in:
parent
606b1bb3eb
commit
2d75a32dd0
21 changed files with 2718 additions and 2812 deletions
|
@ -1,13 +1,15 @@
|
||||||
#include "CustomMenuAction.h"
|
#include "CustomMenuAction.h"
|
||||||
|
|
||||||
CustomMenuAction::CustomMenuAction(const QString& displayName, QObject * parent)
|
CustomMenuAction::CustomMenuAction (const QString& displayName,
|
||||||
:QAction(displayName, parent)
|
QObject * parent)
|
||||||
, m_name(displayName)
|
: QAction (displayName, parent),
|
||||||
|
m_name (displayName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenuAction::CustomMenuAction(const QString& displayName, const QString& name, QObject * parent)
|
CustomMenuAction::CustomMenuAction (const QString& displayName,
|
||||||
:QAction(displayName, parent)
|
const QString& name, QObject * parent)
|
||||||
, m_name(name)
|
: QAction (displayName, parent),
|
||||||
|
m_name (name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
#ifndef CUSTOM_MENU_ACTION_H_
|
#ifndef CUSTOM_MENU_ACTION_H_
|
||||||
#define CUSTOM_MENU_ACTION_H_
|
#define CUSTOM_MENU_ACTION_H_
|
||||||
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
class CustomMenuAction: public QAction
|
class CustomMenuAction: public QAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CustomMenuAction(const QString& displayName, QObject * parent);
|
CustomMenuAction(const QString& displayName, QObject * parent);
|
||||||
|
CustomMenuAction(const QString& displayName, const QString& name, QObject * parent);
|
||||||
|
|
||||||
CustomMenuAction(const QString& displayName, const QString& name, QObject * parent);
|
QString getName() {return m_name;}
|
||||||
|
|
||||||
QString getName() { return m_name;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //CUSTOM_MENU_ACTION_H_
|
#endif //CUSTOM_MENU_ACTION_H_
|
||||||
|
|
|
@ -5,34 +5,35 @@
|
||||||
#define COMPANY_NAME "virinext"
|
#define COMPANY_NAME "virinext"
|
||||||
#define APPLICATION_NAME "pipeviz"
|
#define APPLICATION_NAME "pipeviz"
|
||||||
|
|
||||||
void CustomSettings::saveLastIODirectory(const QString &name)
|
void
|
||||||
|
CustomSettings::saveLastIODirectory (const QString &name)
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
settings.setValue("last_directory", name);
|
settings.setValue ("last_directory", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
QString CustomSettings::lastIODirectory()
|
CustomSettings::lastIODirectory ()
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
QString res = settings.value("last_directory").toString();
|
QString res = settings.value ("last_directory").toString ();
|
||||||
|
|
||||||
if(res.isEmpty())
|
if (res.isEmpty ())
|
||||||
res = "./";
|
res = "./";
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void CustomSettings::saveMainWindowGeometry(const QByteArray &geometry)
|
CustomSettings::saveMainWindowGeometry (const QByteArray &geometry)
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
settings.setValue("geometry", geometry);
|
settings.setValue ("geometry", geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray
|
||||||
QByteArray CustomSettings::mainWindowGeometry()
|
CustomSettings::mainWindowGeometry ()
|
||||||
{
|
{
|
||||||
QSettings settings(COMPANY_NAME, APPLICATION_NAME);
|
QSettings settings (COMPANY_NAME, APPLICATION_NAME);
|
||||||
return settings.value("geometry").toByteArray();
|
return settings.value ("geometry").toByteArray ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,13 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
|
|
||||||
namespace CustomSettings
|
namespace CustomSettings
|
||||||
{
|
{
|
||||||
void saveLastIODirectory(const QString &name);
|
void saveLastIODirectory(const QString &name);
|
||||||
QString lastIODirectory();
|
QString lastIODirectory();
|
||||||
|
|
||||||
void saveMainWindowGeometry(const QByteArray &geometry);
|
void saveMainWindowGeometry(const QByteArray &geometry);
|
||||||
QByteArray mainWindowGeometry();
|
QByteArray mainWindowGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,428 +11,387 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
ElementProperties::ElementProperties(QSharedPointer<GraphManager> pGraph, const char *name,
|
ElementProperties::ElementProperties (QSharedPointer<GraphManager> pGraph,
|
||||||
QWidget *parent, Qt::WindowFlags flags):
|
const char *name, QWidget *parent,
|
||||||
QWidget(parent, flags),
|
Qt::WindowFlags flags)
|
||||||
m_pGraphManager(pGraph),
|
: QWidget (parent, flags),
|
||||||
m_name(name)
|
m_pGraphManager (pGraph),
|
||||||
|
m_name (name)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString(name) + " properties");
|
setWindowTitle (QString (name) + " properties");
|
||||||
|
|
||||||
create();
|
create ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::addParamEnum(GParamSpec *param, GstElement *element, QGridLayout *play)
|
ElementProperties::addParamEnum (GParamSpec *param, GstElement *element,
|
||||||
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
if (param->flags & G_PARAM_READABLE)
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
else
|
else {
|
||||||
{
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
g_value_copy (valueDef, &value);
|
||||||
g_value_copy(valueDef, &value);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
|
int propertyValue;
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
propertyValue = g_value_get_enum (&value);
|
||||||
int propertyValue;
|
|
||||||
|
|
||||||
propertyValue = g_value_get_enum(&value);
|
GParamSpecEnum *penumSpec = G_PARAM_SPEC_ENUM (param);
|
||||||
|
|
||||||
GParamSpecEnum *penumSpec = G_PARAM_SPEC_ENUM(param);
|
if (!penumSpec)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!penumSpec)
|
QComboBox *pcomBox = new QComboBox;
|
||||||
return;
|
|
||||||
|
|
||||||
QComboBox *pcomBox = new QComboBox;
|
for (std::size_t i = 0; i < penumSpec->enum_class->n_values; i++) {
|
||||||
|
QVariant var (penumSpec->enum_class->values[i].value);
|
||||||
|
QString valueName = penumSpec->enum_class->values[i].value_name;
|
||||||
|
|
||||||
for(std::size_t i=0; i<penumSpec -> enum_class -> n_values; i++)
|
pcomBox->addItem (valueName, var);
|
||||||
{
|
|
||||||
QVariant var(penumSpec -> enum_class -> values[i].value);
|
|
||||||
QString valueName = penumSpec -> enum_class -> values[i].value_name;
|
|
||||||
|
|
||||||
pcomBox -> addItem(valueName, var);
|
if (penumSpec->enum_class->values[i].value == propertyValue)
|
||||||
|
pcomBox->setCurrentIndex (i);
|
||||||
|
}
|
||||||
|
|
||||||
if(penumSpec -> enum_class -> values[i].value == propertyValue)
|
int row = play->rowCount ();
|
||||||
pcomBox -> setCurrentIndex(i);
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
}
|
play->addWidget (pcomBox, row, 1);
|
||||||
|
m_values.insert (propertyName, pcomBox);
|
||||||
|
|
||||||
int row = play -> rowCount();
|
|
||||||
|
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
|
||||||
|
|
||||||
play -> addWidget(pcomBox, row, 1);
|
|
||||||
|
|
||||||
m_values.insert(propertyName, pcomBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::addParamFlags(GParamSpec *param, GstElement *element, QGridLayout *play)
|
ElementProperties::addParamFlags (GParamSpec *param, GstElement *element,
|
||||||
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
g_value_init (&value, param->value_type);
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
if (param->flags & G_PARAM_READABLE)
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
else
|
else {
|
||||||
{
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
g_value_copy (valueDef, &value);
|
||||||
g_value_copy(valueDef, &value);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
|
int propertyValue;
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
propertyValue = g_value_get_flags (&value);
|
||||||
int propertyValue;
|
|
||||||
|
|
||||||
propertyValue = g_value_get_flags(&value);
|
GParamSpecFlags *pflagsSpec = G_PARAM_SPEC_FLAGS (param);
|
||||||
|
|
||||||
GParamSpecFlags *pflagsSpec = G_PARAM_SPEC_FLAGS(param);
|
if (!pflagsSpec)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!pflagsSpec)
|
QComboBox *pcomBox = new QComboBox;
|
||||||
return;
|
|
||||||
|
|
||||||
QComboBox *pcomBox = new QComboBox;
|
for (std::size_t i = 0; i < pflagsSpec->flags_class->n_values; i++) {
|
||||||
|
QVariant var (pflagsSpec->flags_class->values[i].value);
|
||||||
|
QString valueName = pflagsSpec->flags_class->values[i].value_name;
|
||||||
|
|
||||||
for(std::size_t i=0; i<pflagsSpec -> flags_class -> n_values; i++)
|
pcomBox->addItem (valueName, var);
|
||||||
{
|
|
||||||
QVariant var(pflagsSpec -> flags_class -> values[i].value);
|
|
||||||
QString valueName = pflagsSpec -> flags_class -> values[i].value_name;
|
|
||||||
|
|
||||||
pcomBox -> addItem(valueName, var);
|
if (pflagsSpec->flags_class->values[i].value == propertyValue)
|
||||||
|
pcomBox->setCurrentIndex (i);
|
||||||
|
}
|
||||||
|
|
||||||
if(pflagsSpec -> flags_class -> values[i].value == propertyValue)
|
int row = play->rowCount ();
|
||||||
pcomBox -> setCurrentIndex(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int row = play -> rowCount();
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
|
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
play->addWidget (pcomBox, row, 1);
|
||||||
|
|
||||||
play -> addWidget(pcomBox, row, 1);
|
m_values.insert (propertyName, pcomBox);
|
||||||
|
|
||||||
m_values.insert(propertyName, pcomBox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ElementProperties::addParamSimple (GParamSpec *param, GstElement *element,
|
||||||
void ElementProperties::addParamSimple(GParamSpec *param, GstElement *element, QGridLayout *play)
|
QGridLayout *play)
|
||||||
{
|
{
|
||||||
bool readOnly = true;
|
bool readOnly = true;
|
||||||
|
|
||||||
if(param->flags & G_PARAM_WRITABLE)
|
if (param->flags & G_PARAM_WRITABLE)
|
||||||
readOnly = false;
|
readOnly = false;
|
||||||
|
|
||||||
GValue value = { 0 };
|
|
||||||
|
|
||||||
g_value_init (&value, param -> value_type);
|
GValue value = { 0 };
|
||||||
if(param -> flags & G_PARAM_READABLE)
|
|
||||||
g_object_get_property (G_OBJECT(element), param -> name, &value);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const GValue *valueDef = g_param_spec_get_default_value(param);
|
|
||||||
g_value_copy(valueDef, &value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
g_value_init (&value, param->value_type);
|
||||||
|
if (param->flags & G_PARAM_READABLE)
|
||||||
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
|
else {
|
||||||
|
const GValue *valueDef = g_param_spec_get_default_value (param);
|
||||||
|
g_value_copy (valueDef, &value);
|
||||||
|
}
|
||||||
|
|
||||||
QString propertyName = g_param_spec_get_name (param);
|
QString propertyName = g_param_spec_get_name (param);
|
||||||
QString propertyValue;
|
QString propertyValue;
|
||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
switch (G_VALUE_TYPE (&value))
|
switch (G_VALUE_TYPE (&value)) {
|
||||||
{
|
case G_TYPE_STRING: {
|
||||||
case G_TYPE_STRING:
|
const char *string_val = g_value_get_string (&value);
|
||||||
{
|
propertyValue = string_val;
|
||||||
const char *string_val = g_value_get_string (&value);
|
break;
|
||||||
propertyValue = string_val;
|
}
|
||||||
break;
|
case G_TYPE_BOOLEAN: {
|
||||||
}
|
gboolean bool_val = g_value_get_boolean (&value);
|
||||||
case G_TYPE_BOOLEAN:
|
propertyValue = QString::number (bool_val);
|
||||||
{
|
break;
|
||||||
gboolean bool_val = g_value_get_boolean (&value);
|
}
|
||||||
propertyValue = QString::number(bool_val);
|
case G_TYPE_ULONG: {
|
||||||
break;
|
propertyValue = QString::number (g_value_get_ulong (&value));
|
||||||
}
|
break;
|
||||||
case G_TYPE_ULONG:
|
}
|
||||||
{
|
case G_TYPE_LONG: {
|
||||||
propertyValue = QString::number(g_value_get_ulong(&value));
|
propertyValue = QString::number (g_value_get_long (&value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_UINT: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_uint (&value));
|
||||||
propertyValue = QString::number(g_value_get_long(&value));
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case G_TYPE_INT: {
|
||||||
case G_TYPE_UINT:
|
propertyValue = QString::number (g_value_get_int (&value));
|
||||||
{
|
break;
|
||||||
propertyValue = QString::number(g_value_get_uint(&value));
|
}
|
||||||
break;
|
case G_TYPE_UINT64: {
|
||||||
}
|
propertyValue = QString::number (g_value_get_uint64 (&value));
|
||||||
case G_TYPE_INT:
|
break;
|
||||||
{
|
}
|
||||||
propertyValue = QString::number(g_value_get_int(&value));
|
case G_TYPE_INT64: {
|
||||||
break;
|
propertyValue = QString::number (g_value_get_int64 (&value));
|
||||||
}
|
break;
|
||||||
case G_TYPE_UINT64:
|
}
|
||||||
{
|
case G_TYPE_FLOAT: {
|
||||||
propertyValue = QString::number(g_value_get_uint64(&value));
|
propertyValue = QString::number (g_value_get_float (&value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
propertyValue = QString::number (g_value_get_double (&value));
|
||||||
propertyValue = QString::number(g_value_get_int64(&value));
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case G_TYPE_CHAR: {
|
||||||
case G_TYPE_FLOAT:
|
propertyValue = QString::number (g_value_get_char (&value));
|
||||||
{
|
break;
|
||||||
propertyValue = QString::number(g_value_get_float(&value));
|
}
|
||||||
break;
|
case G_TYPE_UCHAR: {
|
||||||
}
|
propertyValue = QString::number (g_value_get_uchar (&value));
|
||||||
case G_TYPE_DOUBLE:
|
break;
|
||||||
{
|
}
|
||||||
propertyValue = QString::number(g_value_get_double(&value));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case G_TYPE_CHAR:
|
|
||||||
{
|
|
||||||
propertyValue = QString::number(g_value_get_char(&value));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case G_TYPE_UCHAR:
|
|
||||||
{
|
|
||||||
propertyValue = QString::number(g_value_get_uchar(&value));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default: {
|
||||||
{
|
skip = true;
|
||||||
skip = true;
|
qDebug () << "property " << propertyName << " not supported";
|
||||||
qDebug() << "property " << propertyName << " not supported";
|
break;
|
||||||
break;
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
int row = play -> rowCount();
|
int row = play->rowCount ();
|
||||||
|
|
||||||
play -> addWidget(new QLabel(propertyName), row, 0);
|
play->addWidget (new QLabel (propertyName), row, 0);
|
||||||
|
|
||||||
QLineEdit *ple = new QLineEdit(propertyValue);
|
QLineEdit *ple = new QLineEdit (propertyValue);
|
||||||
ple -> setReadOnly(readOnly);
|
ple->setReadOnly (readOnly);
|
||||||
play -> addWidget(ple, row, 1);
|
play->addWidget (ple, row, 1);
|
||||||
if(!skip)
|
if (!skip)
|
||||||
m_values.insert(propertyName, ple);
|
m_values.insert (propertyName, ple);
|
||||||
else
|
else
|
||||||
ple -> setReadOnly(true);
|
ple->setReadOnly (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void ElementProperties::create()
|
ElementProperties::create ()
|
||||||
{
|
{
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraphManager -> m_pGraph), m_name.toStdString().c_str());
|
GstElement *element = gst_bin_get_by_name (
|
||||||
|
GST_BIN (m_pGraphManager->m_pGraph), m_name.toStdString ().c_str ());
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QGridLayout *play = new QGridLayout;
|
QGridLayout *play = new QGridLayout;
|
||||||
|
|
||||||
GParamSpec **prop_specs;
|
GParamSpec **prop_specs;
|
||||||
guint num_props;
|
guint num_props;
|
||||||
|
|
||||||
prop_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element),
|
prop_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
|
||||||
&num_props);
|
&num_props);
|
||||||
|
|
||||||
for(std::size_t i = 0; i<num_props; i++)
|
for (std::size_t i = 0; i < num_props; i++) {
|
||||||
{
|
GParamSpec *param = prop_specs[i];
|
||||||
GParamSpec *param = prop_specs[i];
|
|
||||||
|
|
||||||
if(G_IS_PARAM_SPEC_ENUM(param))
|
if (G_IS_PARAM_SPEC_ENUM (param))
|
||||||
addParamEnum(param, element, play);
|
addParamEnum (param, element, play);
|
||||||
else if(G_IS_PARAM_SPEC_FLAGS(param))
|
else if (G_IS_PARAM_SPEC_FLAGS (param))
|
||||||
addParamFlags(param, element, play);
|
addParamFlags (param, element, play);
|
||||||
else
|
else
|
||||||
addParamSimple(param, element, play);
|
addParamSimple (param, element, play);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
QWidget *pwgt = new QWidget(this);
|
QWidget *pwgt = new QWidget (this);
|
||||||
pwgt -> setLayout(play);
|
pwgt->setLayout (play);
|
||||||
QScrollArea *pscroll = new QScrollArea(this);
|
QScrollArea *pscroll = new QScrollArea (this);
|
||||||
pscroll -> setWidget(pwgt);
|
pscroll->setWidget (pwgt);
|
||||||
|
|
||||||
pvblay -> addWidget(pscroll);
|
pvblay->addWidget (pscroll);
|
||||||
|
|
||||||
QHBoxLayout *phblay = new QHBoxLayout;
|
QHBoxLayout *phblay = new QHBoxLayout;
|
||||||
|
|
||||||
QPushButton *pcmdApply = new QPushButton("Apply");
|
QPushButton *pcmdApply = new QPushButton ("Apply");
|
||||||
QPushButton *pcmdOk = new QPushButton("OK");
|
QPushButton *pcmdOk = new QPushButton ("OK");
|
||||||
QPushButton *pcmdCancel = new QPushButton("Cancel");
|
QPushButton *pcmdCancel = new QPushButton ("Cancel");
|
||||||
|
|
||||||
|
phblay->addStretch (1);
|
||||||
|
phblay->addWidget (pcmdApply);
|
||||||
|
phblay->addWidget (pcmdCancel);
|
||||||
|
phblay->addWidget (pcmdOk);
|
||||||
|
|
||||||
phblay -> addStretch(1);
|
pvblay->addLayout (phblay);
|
||||||
phblay -> addWidget(pcmdApply);
|
|
||||||
phblay -> addWidget(pcmdCancel);
|
|
||||||
phblay -> addWidget(pcmdOk);
|
|
||||||
|
|
||||||
pvblay -> addLayout(phblay);
|
QObject::connect (pcmdApply, SIGNAL (clicked ()), this,
|
||||||
|
SLOT (applyClicked ()));
|
||||||
|
QObject::connect (pcmdCancel, SIGNAL (clicked ()), this, SLOT (close ()));
|
||||||
|
QObject::connect (pcmdOk, SIGNAL (clicked ()), this, SLOT (okClicked ()));
|
||||||
|
|
||||||
QObject::connect(pcmdApply, SIGNAL(clicked()), this, SLOT(applyClicked()));
|
setLayout (pvblay);
|
||||||
QObject::connect(pcmdCancel, SIGNAL(clicked()), this, SLOT(close()));
|
|
||||||
QObject::connect(pcmdOk, SIGNAL(clicked()), this, SLOT(okClicked()));
|
|
||||||
|
|
||||||
setLayout(pvblay);
|
g_free (prop_specs);
|
||||||
|
gst_object_unref (element);
|
||||||
g_free(prop_specs);
|
|
||||||
gst_object_unref(element);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementProperties::applyClicked()
|
void
|
||||||
|
ElementProperties::applyClicked ()
|
||||||
{
|
{
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(m_pGraphManager -> m_pGraph),
|
GstElement *element = gst_bin_get_by_name (
|
||||||
m_name.toStdString().c_str());
|
GST_BIN (m_pGraphManager->m_pGraph), m_name.toStdString ().c_str ());
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMap<QString, QWidget *>::iterator itr = m_values.begin();
|
QMap<QString, QWidget *>::iterator itr = m_values.begin ();
|
||||||
|
|
||||||
for(;itr != m_values.end(); itr++)
|
for (; itr != m_values.end (); itr++) {
|
||||||
{
|
GParamSpec *param = g_object_class_find_property (
|
||||||
GParamSpec *param = g_object_class_find_property(G_OBJECT_GET_CLASS (element),
|
G_OBJECT_GET_CLASS (element), itr.key ().toStdString ().c_str ());
|
||||||
itr.key().toStdString().c_str());
|
|
||||||
|
|
||||||
if(!param)
|
if (!param) {
|
||||||
{
|
qDebug () << "problem with setting " << itr.key () << " property";
|
||||||
qDebug() << "problem with setting " << itr.key() << " property";
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!(param -> flags & G_PARAM_WRITABLE))
|
if (!(param->flags & G_PARAM_WRITABLE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString valStr;
|
QString valStr;
|
||||||
|
|
||||||
if(dynamic_cast<QLineEdit *>(itr.value()))
|
if (dynamic_cast<QLineEdit *> (itr.value ()))
|
||||||
valStr = ((QLineEdit *) itr.value()) -> text();
|
valStr = ((QLineEdit *) itr.value ())->text ();
|
||||||
else if(dynamic_cast<QComboBox *>(itr.value()))
|
else if (dynamic_cast<QComboBox *> (itr.value ())) {
|
||||||
{
|
QComboBox *pcomBox = (QComboBox *) itr.value ();
|
||||||
QComboBox *pcomBox = (QComboBox *) itr.value();
|
int val = pcomBox->itemData (pcomBox->currentIndex ()).toInt ();
|
||||||
int val = pcomBox -> itemData(pcomBox -> currentIndex()).toInt();
|
valStr = QString::number (val);
|
||||||
valStr = QString::number(val);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::string tmpStr = itr.key().toStdString();
|
std::string tmpStr = itr.key ().toStdString ();
|
||||||
const char *propName = tmpStr.c_str();
|
const char *propName = tmpStr.c_str ();
|
||||||
|
|
||||||
if(G_IS_PARAM_SPEC_ENUM(param) || G_IS_PARAM_SPEC_FLAGS(param))
|
if (G_IS_PARAM_SPEC_ENUM (param) || G_IS_PARAM_SPEC_FLAGS (param)) {
|
||||||
{
|
if (dynamic_cast<QComboBox *> (itr.value ())) {
|
||||||
if(dynamic_cast<QComboBox *>(itr.value()))
|
QComboBox *pcomBox = (QComboBox *) itr.value ();
|
||||||
{
|
int val = pcomBox->itemData (pcomBox->currentIndex ()).toInt ();
|
||||||
QComboBox *pcomBox = (QComboBox *) itr.value();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
int val = pcomBox -> itemData(pcomBox -> currentIndex()).toInt();
|
}
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
}
|
||||||
}
|
else {
|
||||||
}
|
switch (param->value_type) {
|
||||||
else
|
case G_TYPE_STRING: {
|
||||||
{
|
g_object_set (G_OBJECT (element), propName,
|
||||||
switch (param -> value_type)
|
valStr.toStdString ().c_str (), NULL);
|
||||||
{
|
break;
|
||||||
case G_TYPE_STRING:
|
}
|
||||||
{
|
case G_TYPE_BOOLEAN: {
|
||||||
g_object_set(G_OBJECT(element), propName, valStr.toStdString().c_str(), NULL);
|
gboolean val = valStr.toInt ();
|
||||||
break;
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
}
|
break;
|
||||||
case G_TYPE_BOOLEAN:
|
}
|
||||||
{
|
case G_TYPE_ULONG: {
|
||||||
gboolean val = valStr.toInt();
|
gulong val = valStr.toULong ();
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_LONG: {
|
||||||
{
|
glong val = valStr.toLong ();
|
||||||
gulong val = valStr.toULong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case G_TYPE_UINT: {
|
||||||
case G_TYPE_LONG:
|
guint val = valStr.toUInt ();
|
||||||
{
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
glong val = valStr.toLong();
|
break;
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
}
|
||||||
break;
|
case G_TYPE_INT: {
|
||||||
}
|
gint val = valStr.toInt ();
|
||||||
case G_TYPE_UINT:
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
{
|
break;
|
||||||
guint val = valStr.toUInt();
|
}
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
case G_TYPE_UINT64: {
|
||||||
break;
|
guint64 val = valStr.toULongLong ();
|
||||||
}
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
case G_TYPE_INT:
|
break;
|
||||||
{
|
}
|
||||||
gint val = valStr.toInt();
|
case G_TYPE_INT64: {
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
gint64 val = valStr.toLongLong ();
|
||||||
break;
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
}
|
break;
|
||||||
case G_TYPE_UINT64:
|
}
|
||||||
{
|
case G_TYPE_FLOAT: {
|
||||||
guint64 val = valStr.toULongLong();
|
gfloat val = valStr.toFloat ();
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_DOUBLE: {
|
||||||
{
|
gdouble val = valStr.toDouble ();
|
||||||
gint64 val = valStr.toLongLong();
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case G_TYPE_CHAR: {
|
||||||
case G_TYPE_FLOAT:
|
gchar val = valStr.toInt ();
|
||||||
{
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
gfloat val = valStr.toFloat();
|
break;
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
}
|
||||||
break;
|
case G_TYPE_UCHAR: {
|
||||||
}
|
guchar val = valStr.toUInt ();
|
||||||
case G_TYPE_DOUBLE:
|
g_object_set (G_OBJECT (element), propName, val, NULL);
|
||||||
{
|
break;
|
||||||
gdouble val = valStr.toDouble();
|
}
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
default: {
|
||||||
break;
|
qDebug () << "property " << itr.key () << " not supported";
|
||||||
}
|
break;
|
||||||
case G_TYPE_CHAR:
|
}
|
||||||
{
|
};
|
||||||
gchar val = valStr.toInt();
|
}
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
case G_TYPE_UCHAR:
|
|
||||||
{
|
|
||||||
guchar val = valStr.toUInt();
|
|
||||||
g_object_set(G_OBJECT(element), propName, val, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
qDebug() << "property " << itr.key() << " not supported";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
|
|
||||||
delete layout();
|
delete layout ();
|
||||||
qDeleteAll(children());
|
qDeleteAll (
|
||||||
|
children ());
|
||||||
|
|
||||||
|
create ();
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementProperties::okClicked()
|
void
|
||||||
|
ElementProperties::okClicked ()
|
||||||
{
|
{
|
||||||
applyClicked();
|
applyClicked ();
|
||||||
close();
|
close ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,26 +12,24 @@
|
||||||
|
|
||||||
class ElementProperties: public QWidget
|
class ElementProperties: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ElementProperties(QSharedPointer<GraphManager> pGraphManager, const char *name,
|
ElementProperties(QSharedPointer<GraphManager> pGraphManager, const char *name,
|
||||||
QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void applyClicked();
|
void applyClicked();
|
||||||
void okClicked();
|
void okClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<GraphManager> m_pGraphManager;
|
QSharedPointer<GraphManager> m_pGraphManager;
|
||||||
QMap<QString, QWidget *> m_values;
|
QMap<QString, QWidget *> m_values;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
void addParamSimple(GParamSpec *value, GstElement *element, QGridLayout *play);
|
void addParamSimple(GParamSpec *value, GstElement *element, QGridLayout *play);
|
||||||
void addParamEnum(GParamSpec *value, GstElement *element, QGridLayout *play);
|
void addParamEnum(GParamSpec *value, GstElement *element, QGridLayout *play);
|
||||||
void addParamFlags(GParamSpec *value, GstElement *element, QGridLayout *play);
|
void addParamFlags(GParamSpec *value, GstElement *element, QGridLayout *play);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1524
src/GraphDisplay.cpp
1524
src/GraphDisplay.cpp
File diff suppressed because it is too large
Load diff
|
@ -7,88 +7,81 @@
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
|
|
||||||
#include "GraphManager.h"
|
#include "GraphManager.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GraphDisplay: public QWidget
|
class GraphDisplay: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphDisplay(QWidget *parent=0, Qt::WindowFlags f=0);
|
GraphDisplay(QWidget *parent=0, Qt::WindowFlags f=0);
|
||||||
void update(const std::vector <ElementInfo> &info);
|
void update(const std::vector <ElementInfo> &info);
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
|
||||||
|
QSharedPointer<GraphManager> m_pGraph;
|
||||||
QSharedPointer<GraphManager> m_pGraph;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addRequestPad(int row, int collumn);
|
void addRequestPad(int row, int collumn);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum MoveAction
|
enum MoveAction
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
MoveComponent,
|
MoveComponent,
|
||||||
MakeConnect,
|
MakeConnect,
|
||||||
Select
|
Select
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MoveInfo
|
struct MoveInfo
|
||||||
{
|
{
|
||||||
MoveInfo(): m_action(None)
|
MoveInfo(): m_action(None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveAction m_action;
|
MoveAction m_action;
|
||||||
size_t m_elementId;
|
size_t m_elementId;
|
||||||
size_t m_padId;
|
size_t m_padId;
|
||||||
QPoint m_position;
|
QPoint m_position;
|
||||||
QPoint m_startPosition;
|
QPoint m_startPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElementDisplayInfo
|
||||||
|
{
|
||||||
|
QRect m_rect;
|
||||||
|
size_t m_id;
|
||||||
|
std::string m_name;
|
||||||
|
bool m_isSelected;
|
||||||
|
};
|
||||||
|
|
||||||
struct ElementDisplayInfo
|
void calculatePositions();
|
||||||
{
|
void updateDisplayInfoIds();
|
||||||
QRect m_rect;
|
ElementDisplayInfo calculateOnePosition(const ElementInfo &info);
|
||||||
size_t m_id;
|
void showContextMenu(QMouseEvent *event);
|
||||||
std::string m_name;
|
void showElementProperties(std::size_t id);
|
||||||
bool m_isSelected;
|
void showPadProperties(std::size_t elementId, std::size_t padId);
|
||||||
};
|
void renderPad(std::size_t elementId, std::size_t padId, bool capsAny);
|
||||||
|
void removePlugin(std::size_t id);
|
||||||
|
void removeSelected();
|
||||||
|
void getIdByPosition(const QPoint &pos, std::size_t &elementId, std::size_t &padId);
|
||||||
|
QPoint getPadPosition(std::size_t elementId, std::size_t padId);
|
||||||
|
void disconnect(std::size_t elementId, std::size_t padId);
|
||||||
|
void requestPad(std::size_t elementId);
|
||||||
|
void connectPlugin(std::size_t elementId, const QString& destElementName);
|
||||||
|
|
||||||
void calculatePositions();
|
ElementInfo* getElement(std::size_t elementId);
|
||||||
void updateDisplayInfoIds();
|
PadInfo* getPad(std::size_t elementId, std::size_t padId);
|
||||||
ElementDisplayInfo calculateOnePosition(const ElementInfo &info);
|
|
||||||
void showContextMenu(QMouseEvent *event);
|
|
||||||
void showElementProperties(std::size_t id);
|
|
||||||
void showPadProperties(std::size_t elementId, std::size_t padId);
|
|
||||||
void renderPad(std::size_t elementId, std::size_t padId, bool capsAny);
|
|
||||||
void removePlugin(std::size_t id);
|
|
||||||
void removeSelected();
|
|
||||||
void getIdByPosition(const QPoint &pos, std::size_t &elementId, std::size_t &padId);
|
|
||||||
QPoint getPadPosition(std::size_t elementId, std::size_t padId);
|
|
||||||
void disconnect(std::size_t elementId, std::size_t padId);
|
|
||||||
void requestPad(std::size_t elementId);
|
|
||||||
void connectPlugin(std::size_t elementId, const QString& destElementName);
|
|
||||||
|
|
||||||
ElementInfo* getElement(std::size_t elementId);
|
std::vector <ElementInfo> m_info;
|
||||||
PadInfo* getPad(std::size_t elementId, std::size_t padId);
|
std::vector <ElementDisplayInfo> m_displayInfo;
|
||||||
|
|
||||||
std::vector <ElementInfo> m_info;
|
MoveInfo m_moveInfo;
|
||||||
std::vector <ElementDisplayInfo> m_displayInfo;
|
|
||||||
|
|
||||||
MoveInfo m_moveInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -81,6 +81,7 @@ struct ElementInfo
|
||||||
|
|
||||||
class GraphManager
|
class GraphManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphManager();
|
GraphManager();
|
||||||
~GraphManager();
|
~GraphManager();
|
||||||
|
@ -111,8 +112,6 @@ public:
|
||||||
|
|
||||||
GstElement *m_pGraph;
|
GstElement *m_pGraph;
|
||||||
PluginsList *m_pluginsList;
|
PluginsList *m_pluginsList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,345 +33,356 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags):
|
MainWindow::MainWindow (QWidget *parent, Qt::WindowFlags flags)
|
||||||
QMainWindow(parent, flags)
|
: QMainWindow (parent, flags),
|
||||||
,m_pGraph(new GraphManager)
|
m_pGraph (new GraphManager)
|
||||||
{
|
{
|
||||||
QToolBar *ptb = addToolBar("Menu");
|
QToolBar *ptb = addToolBar ("Menu");
|
||||||
|
|
||||||
QAction *pactAdd = ptb -> addAction("Add...");
|
QAction *pactAdd = ptb->addAction ("Add...");
|
||||||
pactAdd -> setShortcut(QKeySequence("Ctrl+F"));
|
pactAdd->setShortcut (QKeySequence ("Ctrl+F"));
|
||||||
connect(pactAdd, SIGNAL(triggered()), SLOT(AddPlugin()));
|
connect (pactAdd, SIGNAL (triggered ()), SLOT (AddPlugin ()));
|
||||||
|
|
||||||
|
QAction *pactOpenFile = ptb->addAction ("Open Media File...");
|
||||||
|
connect (pactOpenFile, SIGNAL (triggered ()), SLOT (OpenMediaFile ()));
|
||||||
|
|
||||||
QAction *pactOpenFile = ptb -> addAction("Open Media File...");
|
ptb->addSeparator ();
|
||||||
connect(pactOpenFile, SIGNAL(triggered()), SLOT(OpenMediaFile()));
|
|
||||||
|
|
||||||
ptb -> addSeparator();
|
QPixmap pxPlay (24, 24);
|
||||||
|
pxPlay.fill (QColor (0, 0, 0, 0));
|
||||||
|
QPainter pntrPlay (&pxPlay);
|
||||||
|
pntrPlay.setPen (Qt::darkGreen);
|
||||||
|
pntrPlay.setBrush (QBrush (Qt::darkGreen));
|
||||||
|
|
||||||
QPixmap pxPlay(24, 24);
|
QPolygon polygon (3);
|
||||||
pxPlay.fill(QColor(0, 0, 0, 0));
|
polygon.setPoint (0, 4, 4);
|
||||||
QPainter pntrPlay(&pxPlay);
|
polygon.setPoint (1, 4, 20);
|
||||||
pntrPlay.setPen(Qt::darkGreen);
|
polygon.setPoint (2, 20, 12);
|
||||||
pntrPlay.setBrush(QBrush(Qt::darkGreen));
|
|
||||||
|
|
||||||
QPolygon polygon(3);
|
pntrPlay.drawPolygon (polygon, Qt::WindingFill);
|
||||||
polygon.setPoint(0, 4, 4);
|
|
||||||
polygon.setPoint(1, 4, 20);
|
|
||||||
polygon.setPoint(2, 20, 12);
|
|
||||||
|
|
||||||
pntrPlay.drawPolygon(polygon, Qt::WindingFill);
|
QAction *pactPlay = ptb->addAction (QIcon (pxPlay), "Play");
|
||||||
|
connect (pactPlay, SIGNAL (triggered ()), SLOT (Play ()));
|
||||||
QAction *pactPlay = ptb -> addAction(QIcon(pxPlay), "Play");
|
|
||||||
connect(pactPlay, SIGNAL(triggered()), SLOT(Play()));
|
|
||||||
|
|
||||||
QPixmap pxPause(24, 24);
|
QPixmap pxPause (24, 24);
|
||||||
pxPause.fill(QColor(0, 0, 0, 0));
|
pxPause.fill (QColor (0, 0, 0, 0));
|
||||||
QPainter pntrPause(&pxPause);
|
QPainter pntrPause (&pxPause);
|
||||||
pntrPause.setPen(Qt::darkGray);
|
pntrPause.setPen (Qt::darkGray);
|
||||||
pntrPause.setBrush(QBrush(Qt::darkGray));
|
pntrPause.setBrush (QBrush (Qt::darkGray));
|
||||||
|
|
||||||
pntrPause.drawRect(8, 4, 3, 16);
|
pntrPause.drawRect (8, 4, 3, 16);
|
||||||
pntrPause.drawRect(13, 4, 3, 16);
|
pntrPause.drawRect (13, 4, 3, 16);
|
||||||
|
|
||||||
QAction *pactPause = ptb -> addAction(QIcon(pxPause), "Pause");
|
QAction *pactPause = ptb->addAction (QIcon (pxPause), "Pause");
|
||||||
connect(pactPause, SIGNAL(triggered()), SLOT(Pause()));
|
connect (pactPause, SIGNAL (triggered ()), SLOT (Pause ()));
|
||||||
|
|
||||||
QPixmap pxStop(24, 24);
|
QPixmap pxStop (24, 24);
|
||||||
pxStop.fill(QColor(0, 0, 0, 0));
|
pxStop.fill (QColor (0, 0, 0, 0));
|
||||||
QPainter pntrStop(&pxStop);
|
QPainter pntrStop (&pxStop);
|
||||||
pntrStop.setPen(Qt::darkRed);
|
pntrStop.setPen (Qt::darkRed);
|
||||||
pntrStop.setBrush(QBrush(Qt::darkRed));
|
pntrStop.setBrush (QBrush (Qt::darkRed));
|
||||||
|
|
||||||
pntrStop.drawRect(6, 6, 12, 12);
|
pntrStop.drawRect (6, 6, 12, 12);
|
||||||
|
|
||||||
QAction *pactStop = ptb -> addAction(QIcon(pxStop), "Stop");
|
QAction *pactStop = ptb->addAction (QIcon (pxStop), "Stop");
|
||||||
connect(pactStop, SIGNAL(triggered()), SLOT(Stop()));
|
connect (pactStop, SIGNAL (triggered ()), SLOT (Stop ()));
|
||||||
|
|
||||||
QPixmap pxFulsh(24, 24);
|
QPixmap pxFulsh (24, 24);
|
||||||
pxFulsh.fill(QColor(0, 0, 0, 0));
|
pxFulsh.fill (QColor (0, 0, 0, 0));
|
||||||
QPainter pntrFlush(&pxFulsh);
|
QPainter pntrFlush (&pxFulsh);
|
||||||
pntrFlush.setPen(Qt::darkGreen);
|
pntrFlush.setPen (Qt::darkGreen);
|
||||||
pntrFlush.setBrush(QBrush(Qt::darkGreen));
|
pntrFlush.setBrush (QBrush (Qt::darkGreen));
|
||||||
|
|
||||||
pntrFlush.drawRect(3, 4, 3, 16);
|
pntrFlush.drawRect (3, 4, 3, 16);
|
||||||
|
|
||||||
polygon = QPolygon(3);
|
polygon = QPolygon (3);
|
||||||
polygon.setPoint(0, 9, 4);
|
polygon.setPoint (0, 9, 4);
|
||||||
polygon.setPoint(1, 9, 20);
|
polygon.setPoint (1, 9, 20);
|
||||||
polygon.setPoint(2, 21, 12);
|
polygon.setPoint (2, 21, 12);
|
||||||
|
|
||||||
pntrFlush.drawPolygon(polygon, Qt::WindingFill);
|
pntrFlush.drawPolygon (polygon, Qt::WindingFill);
|
||||||
|
|
||||||
QAction *pactFlush = ptb -> addAction(QIcon(pxFulsh), "Flush");
|
QAction *pactFlush = ptb->addAction (QIcon (pxFulsh), "Flush");
|
||||||
connect(pactFlush, SIGNAL(triggered()), SLOT(Flush()));
|
connect (pactFlush, SIGNAL (triggered ()), SLOT (Flush ()));
|
||||||
|
|
||||||
QAction *pactClear = ptb -> addAction("Clear");
|
QAction *pactClear = ptb->addAction ("Clear");
|
||||||
connect(pactClear, SIGNAL(triggered()), SLOT(ClearGraph()));
|
connect (pactClear, SIGNAL (triggered ()), SLOT (ClearGraph ()));
|
||||||
ptb -> addSeparator();
|
ptb->addSeparator ();
|
||||||
|
|
||||||
m_pslider = new SeekSlider();
|
m_pslider = new SeekSlider ();
|
||||||
m_pslider -> setOrientation(Qt::Horizontal);
|
m_pslider->setOrientation (Qt::Horizontal);
|
||||||
m_pslider -> setRange(0, 10000);
|
m_pslider->setRange (0, 10000);
|
||||||
m_pslider -> setTracking(false);
|
m_pslider->setTracking (false);
|
||||||
|
|
||||||
connect(m_pslider, SIGNAL(valueChanged(int)), SLOT(Seek(int)));
|
connect(m_pslider, SIGNAL(valueChanged(int)), SLOT(Seek(int)));
|
||||||
ptb -> addWidget(m_pslider);
|
ptb->addWidget (m_pslider);
|
||||||
|
|
||||||
QMenu *pmenu = menuBar() -> addMenu("&File");
|
QMenu *pmenu = menuBar ()->addMenu ("&File");
|
||||||
|
|
||||||
QAction *pactOpen = pmenu -> addAction ("Open...", this, SLOT(Open()), QKeySequence::Open);
|
QAction *pactOpen = pmenu->addAction ("Open...", this, SLOT (Open ()),
|
||||||
addAction (pactOpen);
|
QKeySequence::Open);
|
||||||
|
addAction (pactOpen);
|
||||||
QAction *pactOpenMediaFile = pmenu -> addAction ("Open Media File...", this, SLOT(OpenMediaFile()), QKeySequence::Open);
|
|
||||||
addAction (pactOpenMediaFile);
|
|
||||||
|
|
||||||
QAction *pactSave = pmenu -> addAction ("Save", this, SLOT(Save()), QKeySequence::Save);
|
QAction *pactOpenMediaFile = pmenu->addAction ("Open Media File...", this,
|
||||||
addAction (pactSave);
|
SLOT (OpenMediaFile ()),
|
||||||
|
QKeySequence::Open);
|
||||||
|
addAction (pactOpenMediaFile);
|
||||||
|
|
||||||
QAction *pactSaveAs = pmenu -> addAction ("Save As...", this, SLOT(SaveAs()), QKeySequence::SaveAs);
|
QAction *pactSave = pmenu->addAction ("Save", this, SLOT (Save ()),
|
||||||
addAction (pactSaveAs);
|
QKeySequence::Save);
|
||||||
|
addAction (pactSave);
|
||||||
|
|
||||||
pmenu -> addSeparator();
|
QAction *pactSaveAs = pmenu->addAction ("Save As...", this, SLOT (SaveAs ()),
|
||||||
pmenu -> addAction("Exit", this, SLOT(close()));
|
QKeySequence::SaveAs);
|
||||||
|
addAction (pactSaveAs);
|
||||||
|
|
||||||
|
pmenu->addSeparator ();
|
||||||
|
pmenu->addAction ("Exit", this, SLOT (close ()));
|
||||||
|
|
||||||
pmenu = menuBar() -> addMenu("&Graph");
|
pmenu = menuBar ()->addMenu ("&Graph");
|
||||||
|
|
||||||
pmenu -> addAction(pactAdd);
|
pmenu->addAction (pactAdd);
|
||||||
pmenu -> addAction(pactOpenMediaFile);
|
pmenu->addAction (pactOpenMediaFile);
|
||||||
pmenu -> addAction ("Open Media Uri...", this, SLOT(OpenMediaUri()));
|
pmenu->addAction ("Open Media Uri...", this, SLOT (OpenMediaUri ()));
|
||||||
pmenu -> addSeparator();
|
pmenu->addSeparator ();
|
||||||
pmenu -> addAction(pactPlay);
|
pmenu->addAction (pactPlay);
|
||||||
pmenu -> addAction(pactPause);
|
pmenu->addAction (pactPause);
|
||||||
pmenu -> addAction(pactStop);
|
pmenu->addAction (pactStop);
|
||||||
pmenu -> addAction(pactFlush);
|
pmenu->addAction (pactFlush);
|
||||||
pmenu -> addSeparator();
|
pmenu->addSeparator ();
|
||||||
pmenu -> addAction(pactClear);
|
pmenu->addAction (pactClear);
|
||||||
|
|
||||||
|
pmenu = menuBar ()->addMenu ("&Help");
|
||||||
|
|
||||||
pmenu = menuBar() -> addMenu("&Help");
|
pmenu->addAction ("About pipeviz...", this, SLOT (About ()));
|
||||||
|
|
||||||
pmenu -> addAction ("About pipeviz...", this, SLOT(About()));
|
m_pGraphDisplay = new GraphDisplay;
|
||||||
|
|
||||||
|
QScrollArea *pscroll = new QScrollArea;
|
||||||
m_pGraphDisplay = new GraphDisplay;
|
pscroll->setWidget (m_pGraphDisplay);
|
||||||
|
pscroll->setWidgetResizable (false);
|
||||||
QScrollArea *pscroll = new QScrollArea;
|
m_pGraphDisplay->resize (10000, 10000);
|
||||||
pscroll -> setWidget(m_pGraphDisplay);
|
m_pGraphDisplay->m_pGraph = m_pGraph;
|
||||||
pscroll -> setWidgetResizable(false);
|
setCentralWidget (pscroll);
|
||||||
m_pGraphDisplay -> resize(10000, 10000);
|
m_pstatusBar = new QStatusBar;
|
||||||
m_pGraphDisplay -> m_pGraph = m_pGraph;
|
setStatusBar (m_pstatusBar);
|
||||||
setCentralWidget(pscroll);
|
m_pluginListDlg = new PluginsListDialog (m_pGraph->getPluginsList (), this);
|
||||||
m_pstatusBar = new QStatusBar;
|
m_pluginListDlg->setModal (false);
|
||||||
setStatusBar(m_pstatusBar);
|
restoreGeometry (CustomSettings::mainWindowGeometry ());
|
||||||
m_pluginListDlg = new PluginsListDialog(m_pGraph->getPluginsList(), this);
|
startTimer (100);
|
||||||
m_pluginListDlg->setModal(false);
|
|
||||||
restoreGeometry(CustomSettings::mainWindowGeometry());
|
|
||||||
startTimer(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow ()
|
||||||
{
|
{
|
||||||
CustomSettings::saveMainWindowGeometry(saveGeometry());
|
CustomSettings::saveMainWindowGeometry (saveGeometry ());
|
||||||
delete m_pluginListDlg;
|
delete m_pluginListDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddPlugin()
|
void
|
||||||
|
MainWindow::AddPlugin ()
|
||||||
{
|
{
|
||||||
m_pluginListDlg->setGraph(m_pGraph.data());
|
m_pluginListDlg->setGraph (m_pGraph.data ());
|
||||||
m_pluginListDlg->show();
|
m_pluginListDlg->show ();
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenMediaFile()
|
void
|
||||||
|
MainWindow::OpenMediaFile ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Open File...", dir);
|
QString path = QFileDialog::getOpenFileName (this, "Open File...", dir);
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
gchar *uri = gst_filename_to_uri (path.toStdString ().c_str (), NULL);
|
||||||
gchar *uri = gst_filename_to_uri(path.toStdString().c_str(), NULL);
|
if (uri) {
|
||||||
if(uri)
|
qDebug () << "Open Source file: " << path;
|
||||||
{
|
|
||||||
qDebug() << "Open Source file: " << path;
|
|
||||||
|
|
||||||
m_pGraph -> OpenUri(uri, NULL);
|
m_pGraph->OpenUri (uri, NULL);
|
||||||
g_free(uri);
|
g_free (uri);
|
||||||
|
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void MainWindow::OpenMediaUri()
|
MainWindow::OpenMediaUri ()
|
||||||
{
|
{
|
||||||
QString uri = QInputDialog::getText(this, "Open Uri...", "Uri:");
|
QString uri = QInputDialog::getText (this, "Open Uri...", "Uri:");
|
||||||
|
|
||||||
if(!uri.isEmpty())
|
if (!uri.isEmpty ()) {
|
||||||
{
|
qDebug () << "Open uri: " << uri;
|
||||||
qDebug() << "Open uri: " << uri;
|
m_pGraph->OpenUri (uri.toStdString ().c_str (), NULL);
|
||||||
m_pGraph -> OpenUri(uri.toStdString().c_str(), NULL);
|
|
||||||
|
|
||||||
std::vector<ElementInfo> info = m_pGraph -> GetInfo();
|
std::vector<ElementInfo> info = m_pGraph->GetInfo ();
|
||||||
m_pGraphDisplay -> update(info);
|
m_pGraphDisplay->update (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Play()
|
void
|
||||||
|
MainWindow::Play ()
|
||||||
{
|
{
|
||||||
qDebug() << "Play";
|
qDebug () << "Play";
|
||||||
m_pGraph -> Play();
|
m_pGraph->Play ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Pause()
|
void
|
||||||
|
MainWindow::Pause ()
|
||||||
{
|
{
|
||||||
qDebug() << "Pause";
|
qDebug () << "Pause";
|
||||||
m_pGraph -> Pause();
|
m_pGraph->Pause ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Stop()
|
void
|
||||||
|
MainWindow::Stop ()
|
||||||
{
|
{
|
||||||
qDebug() << "Stop";
|
qDebug () << "Stop";
|
||||||
m_pGraph -> Stop();
|
m_pGraph->Stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Flush()
|
void
|
||||||
|
MainWindow::Flush ()
|
||||||
{
|
{
|
||||||
qDebug() << "Flush";
|
qDebug () << "Flush";
|
||||||
|
|
||||||
if(m_pGraph -> m_pGraph)
|
if (m_pGraph->m_pGraph) {
|
||||||
{
|
gst_element_send_event (GST_ELEMENT (m_pGraph->m_pGraph),
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_start());
|
gst_event_new_flush_start ());
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop(true));
|
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop(true));
|
||||||
#else
|
#else
|
||||||
gst_element_send_event(GST_ELEMENT(m_pGraph -> m_pGraph), gst_event_new_flush_stop());
|
gst_element_send_event (GST_ELEMENT (m_pGraph->m_pGraph),
|
||||||
|
gst_event_new_flush_stop ());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ClearGraph()
|
void
|
||||||
|
MainWindow::ClearGraph ()
|
||||||
{
|
{
|
||||||
qDebug() << "ClearGraph";
|
qDebug () << "ClearGraph";
|
||||||
PipelineIE::Clear(m_pGraph);
|
PipelineIE::Clear (m_pGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Seek(int val)
|
void
|
||||||
|
MainWindow::Seek (int val)
|
||||||
{
|
{
|
||||||
if(m_pGraph -> SetPosition((double)(val) / m_pslider -> maximum()))
|
if (m_pGraph->SetPosition ((double) (val) / m_pslider->maximum ()))
|
||||||
qDebug() << "Seek to" << val;
|
qDebug () << "Seek to" << val;
|
||||||
else
|
else
|
||||||
qDebug() << "Seek to" << val << "was FAILED";
|
qDebug () << "Seek to" << val << "was FAILED";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::timerEvent(QTimerEvent *)
|
void
|
||||||
|
MainWindow::timerEvent (QTimerEvent *)
|
||||||
{
|
{
|
||||||
GstState state;
|
GstState state;
|
||||||
GstStateChangeReturn res = gst_element_get_state (m_pGraph -> m_pGraph, &state, NULL, GST_MSECOND);
|
GstStateChangeReturn res = gst_element_get_state (m_pGraph->m_pGraph, &state,
|
||||||
|
NULL,
|
||||||
|
GST_MSECOND);
|
||||||
|
|
||||||
if(res == GST_STATE_CHANGE_SUCCESS)
|
if (res == GST_STATE_CHANGE_SUCCESS) {
|
||||||
{
|
QString str;
|
||||||
QString str;
|
switch (state) {
|
||||||
switch(state)
|
case GST_STATE_VOID_PENDING:
|
||||||
{
|
str = "Pending";
|
||||||
case GST_STATE_VOID_PENDING:
|
break;
|
||||||
str = "Pending";
|
case GST_STATE_NULL:
|
||||||
break;
|
str = "Null";
|
||||||
case GST_STATE_NULL:
|
break;
|
||||||
str = "Null";
|
case GST_STATE_READY:
|
||||||
break;
|
str = "Ready";
|
||||||
case GST_STATE_READY:
|
break;
|
||||||
str = "Ready";
|
case GST_STATE_PAUSED:
|
||||||
break;
|
str = "Paused";
|
||||||
case GST_STATE_PAUSED:
|
break;
|
||||||
str = "Paused";
|
case GST_STATE_PLAYING:
|
||||||
break;
|
str = "Playing";
|
||||||
case GST_STATE_PLAYING:
|
break;
|
||||||
str = "Playing";
|
};
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
m_pstatusBar -> showMessage(str);
|
m_pstatusBar->showMessage (str);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
m_pstatusBar->showMessage (
|
||||||
m_pstatusBar -> showMessage(QString(gst_element_state_change_return_get_name(res)));
|
QString (gst_element_state_change_return_get_name (res)));
|
||||||
}
|
}
|
||||||
|
|
||||||
double pos = m_pGraph -> GetPosition();
|
double pos = m_pGraph->GetPosition ();
|
||||||
|
|
||||||
if(m_pslider -> value() != (int)(m_pslider -> maximum() * pos))
|
if (m_pslider->value () != (int) (m_pslider->maximum () * pos))
|
||||||
m_pslider -> setSliderPosition(m_pslider -> maximum() * pos);
|
m_pslider->setSliderPosition (m_pslider->maximum () * pos);
|
||||||
|
|
||||||
|
m_pGraphDisplay->update (m_pGraph->GetInfo ());
|
||||||
m_pGraphDisplay -> update(m_pGraph -> GetInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Save()
|
void
|
||||||
|
MainWindow::Save ()
|
||||||
{
|
{
|
||||||
if(m_fileName.isEmpty())
|
if (m_fileName.isEmpty ())
|
||||||
SaveAs();
|
SaveAs ();
|
||||||
else {
|
else {
|
||||||
QFileInfo fileInfo(m_fileName);
|
QFileInfo fileInfo (m_fileName);
|
||||||
if (fileInfo.completeSuffix().isEmpty() || fileInfo.completeSuffix() != "gpi")
|
if (fileInfo.completeSuffix ().isEmpty ()
|
||||||
m_fileName = m_fileName + ".gpi";
|
|| fileInfo.completeSuffix () != "gpi")
|
||||||
|
m_fileName = m_fileName + ".gpi";
|
||||||
|
|
||||||
|
PipelineIE::Export (m_pGraph, m_fileName);
|
||||||
|
|
||||||
PipelineIE::Export(m_pGraph, m_fileName);
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SaveAs()
|
void
|
||||||
|
MainWindow::SaveAs ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getSaveFileName(this, "Save As...", dir, tr("*.gpi"));
|
QString path = QFileDialog::getSaveFileName (this, "Save As...", dir,
|
||||||
|
tr ("*.gpi"));
|
||||||
|
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
m_fileName = path;
|
||||||
m_fileName = path;
|
Save ();
|
||||||
Save();
|
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Open()
|
void
|
||||||
|
MainWindow::Open ()
|
||||||
{
|
{
|
||||||
QString dir = CustomSettings::lastIODirectory();
|
QString dir = CustomSettings::lastIODirectory ();
|
||||||
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Open...", dir, tr("GPI (*.gpi *.xpm);;All files (*.*)"));
|
QString path = QFileDialog::getOpenFileName (
|
||||||
|
this, "Open...", dir, tr ("GPI (*.gpi *.xpm);;All files (*.*)"));
|
||||||
|
|
||||||
if(!path.isEmpty())
|
if (!path.isEmpty ()) {
|
||||||
{
|
if (PipelineIE::Import (m_pGraph, path))
|
||||||
if(PipelineIE::Import(m_pGraph, path))
|
m_fileName = path;
|
||||||
m_fileName = path;
|
|
||||||
|
|
||||||
QString dir = QFileInfo(path).absoluteDir().absolutePath();
|
QString dir = QFileInfo (path).absoluteDir ().absolutePath ();
|
||||||
CustomSettings::saveLastIODirectory(dir);
|
CustomSettings::saveLastIODirectory (dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::About()
|
void
|
||||||
|
MainWindow::About ()
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
message = "<center><b>pipeviz</b></center><br>";
|
message = "<center><b>pipeviz</b></center><br>";
|
||||||
message = "<center>virinext@gmail.com</center><br>";
|
message = "<center>virinext@gmail.com</center><br>";
|
||||||
message += QString("<center>Version: ") + VERSION_STR + "</center><br>";
|
message += QString ("<center>Version: ") + VERSION_STR + "</center><br>";
|
||||||
message += "<center>GUI Based on Qt</center>";
|
message += "<center>GUI Based on Qt</center>";
|
||||||
message += "<center>using ";
|
message += "<center>using ";
|
||||||
message += gst_version_string();
|
message += gst_version_string ();
|
||||||
message += "</center>";
|
message += "</center>";
|
||||||
|
|
||||||
QMessageBox::about(this, "About", message);
|
QMessageBox::about (this, "About", message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,41 +19,40 @@ class PluginsListDialog;
|
||||||
|
|
||||||
class MainWindow: public QMainWindow
|
class MainWindow: public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *);
|
void timerEvent(QTimerEvent *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void AddPlugin();
|
void AddPlugin();
|
||||||
void OpenMediaFile();
|
void OpenMediaFile();
|
||||||
void OpenMediaUri();
|
void OpenMediaUri();
|
||||||
void Play();
|
void Play();
|
||||||
void Pause();
|
void Pause();
|
||||||
void Stop();
|
void Stop();
|
||||||
void Flush();
|
void Flush();
|
||||||
void Seek(int);
|
void Seek(int);
|
||||||
|
|
||||||
void Save();
|
void Save();
|
||||||
void SaveAs();
|
void SaveAs();
|
||||||
void Open();
|
void Open();
|
||||||
|
|
||||||
void ClearGraph();
|
void ClearGraph();
|
||||||
void About();
|
void About();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<GraphManager> m_pGraph;
|
QSharedPointer<GraphManager> m_pGraph;
|
||||||
GraphDisplay *m_pGraphDisplay;
|
GraphDisplay *m_pGraphDisplay;
|
||||||
|
|
||||||
QStatusBar *m_pstatusBar;
|
QStatusBar *m_pstatusBar;
|
||||||
QSlider *m_pslider;
|
QSlider *m_pslider;
|
||||||
|
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
PluginsListDialog *m_pluginListDlg;
|
PluginsListDialog *m_pluginListDlg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,96 +8,99 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
PadProperties::PadProperties(QSharedPointer<GraphManager> pGraphManager, const char *elementName, const char *padName,
|
PadProperties::PadProperties (QSharedPointer<GraphManager> pGraphManager,
|
||||||
QWidget *parent, Qt::WindowFlags flags):
|
const char *elementName, const char *padName,
|
||||||
QWidget(parent, flags)
|
QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
: QWidget (parent, flags)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString(elementName) + "::" + padName + " properties");
|
setWindowTitle (QString (elementName) + "::" + padName + " properties");
|
||||||
GstElement *element = gst_bin_get_by_name (GST_BIN(pGraphManager -> m_pGraph), elementName);
|
GstElement *element = gst_bin_get_by_name (GST_BIN (pGraphManager->m_pGraph),
|
||||||
|
elementName);
|
||||||
|
|
||||||
if(!element)
|
if (!element)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(element), padName);
|
GstPad *pad = gst_element_get_static_pad (GST_ELEMENT (element), padName);
|
||||||
|
|
||||||
QGridLayout *play = new QGridLayout;
|
QGridLayout *play = new QGridLayout;
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Name"), 0, 0);
|
play->addWidget (new QLabel ("Name"), 0, 0);
|
||||||
|
|
||||||
QLabel *plbl = new QLabel(padName);
|
QLabel *plbl = new QLabel (padName);
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 0, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
|
play->addWidget (plbl, 0, 1);
|
||||||
|
|
||||||
play -> addWidget(new QLabel("All caps:"), 1, 0);
|
play->addWidget (new QLabel ("All caps:"), 1, 0);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GstCaps *caps = gst_pad_query_caps(pad, NULL);
|
GstCaps *caps = gst_pad_query_caps(pad, NULL);
|
||||||
#else
|
#else
|
||||||
GstCaps *caps = gst_pad_get_caps(pad);
|
GstCaps *caps = gst_pad_get_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
gchar *str;
|
gchar *str;
|
||||||
gchar *noSpecified = (gchar *)"not specified";
|
gchar *noSpecified = (gchar *) "not specified";
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 1, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 1, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Allowed caps:"), 2, 0);
|
play->addWidget (new QLabel ("Allowed caps:"), 2, 0);
|
||||||
caps = gst_pad_get_allowed_caps(pad);
|
caps = gst_pad_get_allowed_caps (pad);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 2, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 2, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
play -> addWidget(new QLabel("Current caps"), 3, 0);
|
play->addWidget (new QLabel ("Current caps"), 3, 0);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
caps = gst_pad_get_current_caps(pad);
|
caps = gst_pad_get_current_caps(pad);
|
||||||
#else
|
#else
|
||||||
caps = gst_pad_get_negotiated_caps(pad);
|
caps = gst_pad_get_negotiated_caps (pad);
|
||||||
#endif
|
#endif
|
||||||
str = NULL;
|
str = NULL;
|
||||||
if(caps)
|
if (caps)
|
||||||
str = gst_caps_to_string(caps);
|
str = gst_caps_to_string (caps);
|
||||||
else
|
else
|
||||||
str = noSpecified;
|
str = noSpecified;
|
||||||
|
|
||||||
plbl = new QLabel(QString(str));
|
plbl = new QLabel (QString (str));
|
||||||
plbl -> setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
plbl->setTextInteractionFlags (
|
||||||
play -> addWidget(plbl, 3, 1);
|
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||||
if(caps)
|
play->addWidget (plbl, 3, 1);
|
||||||
{
|
if (caps) {
|
||||||
g_free(str);
|
g_free (str);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref(element);
|
gst_object_unref (element);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
QWidget *pwgt = new QWidget(this);
|
QWidget *pwgt = new QWidget (this);
|
||||||
pwgt -> setLayout(play);
|
pwgt->setLayout (play);
|
||||||
QScrollArea *pscroll = new QScrollArea(this);
|
QScrollArea *pscroll = new QScrollArea (this);
|
||||||
pscroll -> setWidget(pwgt);
|
pscroll->setWidget (pwgt);
|
||||||
|
|
||||||
pvblay -> addWidget(pscroll);
|
pvblay->addWidget (pscroll);
|
||||||
|
|
||||||
setLayout(pvblay);
|
setLayout (pvblay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
class PadProperties: public QWidget
|
class PadProperties: public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PadProperties(QSharedPointer<GraphManager> pGraphManager, const char *element, const char *pad
|
PadProperties(QSharedPointer<GraphManager> pGraphManager, const char *element, const char *pad
|
||||||
, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
, QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
namespace PipelineIE
|
namespace PipelineIE
|
||||||
{
|
{
|
||||||
bool Export(QSharedPointer<GraphManager> pgraph, const QString &fileName);
|
bool Export(QSharedPointer<GraphManager> pgraph, const QString &fileName);
|
||||||
bool Import(QSharedPointer<GraphManager> pgraph, const QString &fileName);
|
bool Import(QSharedPointer<GraphManager> pgraph, const QString &fileName);
|
||||||
bool Clear(QSharedPointer<GraphManager> pgraph);
|
bool Clear(QSharedPointer<GraphManager> pgraph);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,31 +14,34 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
static gint plugins_sort_cb (gconstpointer a, gconstpointer b)
|
static gint
|
||||||
|
plugins_sort_cb (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
Plugin* p1 = (Plugin*)a;
|
Plugin* p1 = (Plugin*) a;
|
||||||
Plugin* p2 = (Plugin*)b;
|
Plugin* p2 = (Plugin*) b;
|
||||||
qDebug() << "Sort p1: " << p1 -> getName() << " and p2: " << p2 -> getName();
|
qDebug () << "Sort p1: " << p1->getName () << " and p2: " << p2->getName ();
|
||||||
if (p1->getRank() > p2->getRank())
|
if (p1->getRank () > p2->getRank ())
|
||||||
return 1;
|
return 1;
|
||||||
else if (p1->getRank() == p2->getRank()) {
|
else if (p1->getRank () == p2->getRank ()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
return -1;
|
else {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsList::PluginsList()
|
PluginsList::PluginsList ()
|
||||||
{
|
{
|
||||||
init();
|
init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsList::~PluginsList()
|
PluginsList::~PluginsList ()
|
||||||
{
|
{
|
||||||
//g_list_free(m_pluginsList);
|
//g_list_free(m_pluginsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsList::init()
|
void
|
||||||
|
PluginsList::init ()
|
||||||
{
|
{
|
||||||
std::size_t num = 0;
|
std::size_t num = 0;
|
||||||
GList *plugins;
|
GList *plugins;
|
||||||
|
@ -47,33 +50,30 @@ void PluginsList::init()
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
plugins = gst_registry_get_plugin_list(registry);
|
plugins = gst_registry_get_plugin_list (registry);
|
||||||
while(plugins)
|
while (plugins) {
|
||||||
{
|
|
||||||
GstPlugin *plugin;
|
GstPlugin *plugin;
|
||||||
plugin = (GstPlugin *) (plugins->data);
|
plugin = (GstPlugin *) (plugins->data);
|
||||||
plugins = g_list_next (plugins);
|
plugins = g_list_next (plugins);
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
GList *features = gst_registry_get_feature_list_by_plugin (registry,
|
GList *features = gst_registry_get_feature_list_by_plugin (
|
||||||
gst_plugin_get_name (plugin));
|
registry, gst_plugin_get_name (plugin));
|
||||||
|
|
||||||
while(features)
|
while (features) {
|
||||||
{
|
|
||||||
GstPluginFeature *feature;
|
GstPluginFeature *feature;
|
||||||
feature = GST_PLUGIN_FEATURE (features->data);
|
feature = GST_PLUGIN_FEATURE (features->data);
|
||||||
if(GST_IS_ELEMENT_FACTORY (feature))
|
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||||
{
|
|
||||||
GstElementFactory *factory;
|
GstElementFactory *factory;
|
||||||
factory = GST_ELEMENT_FACTORY (feature);
|
factory = GST_ELEMENT_FACTORY (feature);
|
||||||
int rank = gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory));
|
int rank = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory));
|
||||||
Plugin* p = new Plugin(GST_OBJECT_NAME (factory), rank);
|
Plugin* p = new Plugin (GST_OBJECT_NAME (factory), rank);
|
||||||
m_pluginsList = g_list_append(m_pluginsList, p);
|
m_pluginsList = g_list_append (m_pluginsList, p);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,220 +82,238 @@ void PluginsList::init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GList* PluginsList::getSortedByRank()
|
GList*
|
||||||
|
PluginsList::getSortedByRank ()
|
||||||
{
|
{
|
||||||
GList* sorted_list = g_list_sort(m_pluginsList, plugins_sort_cb);
|
GList* sorted_list = g_list_sort (m_pluginsList, plugins_sort_cb);
|
||||||
return sorted_list;
|
return sorted_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList* PluginsList::getPluginListByCaps(GstPadDirection direction, GstCaps* caps)
|
GList*
|
||||||
|
PluginsList::getPluginListByCaps (GstPadDirection direction, GstCaps* caps)
|
||||||
{
|
{
|
||||||
GList * caps_plugins_list = NULL;
|
GList * caps_plugins_list = NULL;
|
||||||
GList *l,*p;
|
GList *l, *p;
|
||||||
|
|
||||||
for (l = m_pluginsList; l != NULL; l = l->next) {
|
for (l = m_pluginsList; l != NULL; l = l->next) {
|
||||||
Plugin* plugin = (Plugin*)(l->data);
|
Plugin* plugin = (Plugin*) (l->data);
|
||||||
GstElementFactory* factory = gst_element_factory_find(plugin->getName().toStdString().c_str());
|
GstElementFactory* factory = gst_element_factory_find (
|
||||||
if (factory) {
|
plugin->getName ().toStdString ().c_str ());
|
||||||
const GList* pads = gst_element_factory_get_static_pad_templates(factory);
|
if (factory) {
|
||||||
for (p = (GList*)pads; p != NULL; p = p->next) {
|
const GList* pads = gst_element_factory_get_static_pad_templates (
|
||||||
GstStaticPadTemplate* padTemplate = (GstStaticPadTemplate*)(p->data);
|
factory);
|
||||||
if (padTemplate->direction == direction && gst_caps_can_intersect(caps, padTemplate->static_caps.caps))
|
for (p = (GList*) pads; p != NULL; p = p->next) {
|
||||||
caps_plugins_list = g_list_append(caps_plugins_list, plugin);
|
GstStaticPadTemplate* padTemplate = (GstStaticPadTemplate*) (p->data);
|
||||||
}
|
if (padTemplate->direction == direction
|
||||||
|
&& gst_caps_can_intersect (caps, padTemplate->static_caps.caps))
|
||||||
|
caps_plugins_list = g_list_append (caps_plugins_list, plugin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return caps_plugins_list;
|
return caps_plugins_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsListDialog::PluginsListDialog(PluginsList* pluginList, QWidget *pwgt, Qt::WindowFlags f):
|
PluginsListDialog::PluginsListDialog (PluginsList* pluginList, QWidget *pwgt,
|
||||||
QDialog(pwgt, f)
|
Qt::WindowFlags f)
|
||||||
, m_pPluginsList(pluginList)
|
: QDialog (pwgt, f),
|
||||||
, m_pGraph(NULL)
|
m_pPluginsList (pluginList),
|
||||||
|
m_pGraph (NULL)
|
||||||
{
|
{
|
||||||
m_pPlugins = new QListWidget;
|
m_pPlugins = new QListWidget;
|
||||||
m_pPlugins->setSortingEnabled(true);
|
m_pPlugins->setSortingEnabled (true);
|
||||||
m_plblInfo = new QLabel;
|
m_plblInfo = new QLabel;
|
||||||
|
|
||||||
m_plblInfo -> setTextInteractionFlags(Qt::TextSelectableByMouse);
|
m_plblInfo->setTextInteractionFlags (Qt::TextSelectableByMouse);
|
||||||
m_plblInfo -> setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
m_plblInfo->setAlignment (Qt::AlignLeft | Qt::AlignTop);
|
||||||
QScrollArea *pscroll = new QScrollArea;
|
QScrollArea *pscroll = new QScrollArea;
|
||||||
pscroll -> setWidget(m_plblInfo);
|
pscroll->setWidget (m_plblInfo);
|
||||||
m_plblInfo -> resize(pscroll -> size());
|
m_plblInfo->resize (pscroll->size ());
|
||||||
|
|
||||||
QHBoxLayout *phblay = new QHBoxLayout;
|
QHBoxLayout *phblay = new QHBoxLayout;
|
||||||
|
|
||||||
phblay -> addWidget(m_pPlugins, 1);
|
phblay->addWidget (m_pPlugins, 1);
|
||||||
phblay -> addWidget(pscroll, 2);
|
phblay->addWidget (pscroll, 2);
|
||||||
|
|
||||||
InitPluginsList();
|
InitPluginsList ();
|
||||||
|
|
||||||
QHBoxLayout *phblayFind = new QHBoxLayout;
|
QHBoxLayout *phblayFind = new QHBoxLayout;
|
||||||
|
|
||||||
QLineEdit *ple = new QLineEdit;
|
QLineEdit *ple = new QLineEdit;
|
||||||
phblayFind -> addWidget(ple);
|
phblayFind->addWidget (ple);
|
||||||
phblayFind -> addStretch(1);
|
phblayFind->addStretch (1);
|
||||||
|
|
||||||
ple -> setPlaceholderText("Search...");
|
ple->setPlaceholderText ("Search...");
|
||||||
|
|
||||||
QVBoxLayout *pvblay = new QVBoxLayout;
|
QVBoxLayout *pvblay = new QVBoxLayout;
|
||||||
pvblay -> addLayout(phblayFind);
|
pvblay->addLayout (phblayFind);
|
||||||
pvblay -> addLayout(phblay);
|
pvblay->addLayout (phblay);
|
||||||
|
|
||||||
setLayout(pvblay);
|
setLayout (pvblay);
|
||||||
|
|
||||||
setWindowTitle("Add plugin");
|
setWindowTitle ("Add plugin");
|
||||||
|
|
||||||
QObject::connect(m_pPlugins, SIGNAL(currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
|
QObject::connect(m_pPlugins, SIGNAL(currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
|
||||||
this, SLOT(showInfo(QListWidgetItem *, QListWidgetItem *)));
|
this, SLOT(showInfo(QListWidgetItem *, QListWidgetItem *)));
|
||||||
|
|
||||||
QObject::connect(m_pPlugins, SIGNAL(itemDoubleClicked (QListWidgetItem *)),
|
QObject::connect(m_pPlugins, SIGNAL(itemDoubleClicked (QListWidgetItem *)),
|
||||||
this, SLOT(insert(QListWidgetItem *)));
|
this, SLOT(insert(QListWidgetItem *)));
|
||||||
|
|
||||||
QObject::connect(ple, SIGNAL(textChanged(const QString &)), this, SLOT(filterPlagins(const QString &)));
|
QObject::connect(ple, SIGNAL(textChanged(const QString &)), this, SLOT(filterPlagins(const QString &)));
|
||||||
|
|
||||||
installEventFilter(this);
|
installEventFilter (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsListDialog::~PluginsListDialog()
|
PluginsListDialog::~PluginsListDialog ()
|
||||||
{
|
{
|
||||||
if (m_pPluginsList)
|
if (m_pPluginsList)
|
||||||
delete m_pPluginsList;
|
delete m_pPluginsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::showInfo(QListWidgetItem *pitem, QListWidgetItem *previous)
|
void
|
||||||
|
PluginsListDialog::showInfo (QListWidgetItem *pitem, QListWidgetItem *previous)
|
||||||
{
|
{
|
||||||
qDebug() << "Show Info: " << pitem -> text();
|
qDebug () << "Show Info: " << pitem->text ();
|
||||||
m_plblInfo -> clear();
|
m_plblInfo->clear ();
|
||||||
QString descr;
|
QString descr;
|
||||||
descr += "<b>Plugin details</b><hr>";
|
descr += "<b>Plugin details</b><hr>";
|
||||||
|
|
||||||
GstElementFactory *factory = gst_element_factory_find(pitem -> text().toStdString().c_str());
|
GstElementFactory *factory = gst_element_factory_find (
|
||||||
if(!factory)
|
pitem->text ().toStdString ().c_str ());
|
||||||
{
|
if (!factory) {
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE(factory)));
|
factory = GST_ELEMENT_FACTORY (
|
||||||
if(!factory)
|
gst_plugin_feature_load (GST_PLUGIN_FEATURE (factory)));
|
||||||
{
|
if (!factory) {
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
GstPlugin *plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
GstPlugin *plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
||||||
#else
|
#else
|
||||||
const gchar* plugin_name = GST_PLUGIN_FEATURE(factory)->plugin_name;
|
const gchar* plugin_name = GST_PLUGIN_FEATURE (factory)->plugin_name;
|
||||||
if (!plugin_name) {
|
if (!plugin_name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GstPlugin* plugin = gst_default_registry_find_plugin(plugin_name);
|
GstPlugin* plugin = gst_default_registry_find_plugin (plugin_name);
|
||||||
#endif
|
#endif
|
||||||
if(!plugin)
|
if (!plugin) {
|
||||||
{
|
qDebug () << "warning: " << pitem->text () << " Not Found";
|
||||||
qDebug() << "warning: " << pitem -> text() << " Not Found";
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
const gchar *release_date = gst_plugin_get_release_date_string (plugin);
|
const gchar *release_date = gst_plugin_get_release_date_string (plugin);
|
||||||
#else
|
#else
|
||||||
const gchar *release_date = (plugin->desc.release_datetime) ? plugin->desc.release_datetime : "";
|
const gchar *release_date =
|
||||||
|
(plugin->desc.release_datetime) ? plugin->desc.release_datetime : "";
|
||||||
#endif
|
#endif
|
||||||
const gchar *filename = gst_plugin_get_filename(plugin);
|
const gchar *filename = gst_plugin_get_filename (plugin);
|
||||||
|
|
||||||
descr += "<b>Name</b>: " + QString(gst_plugin_get_name(plugin)) + "<br>";
|
descr += "<b>Name</b>: " + QString (gst_plugin_get_name (plugin)) + "<br>";
|
||||||
descr += "<b>Description</b>: " + QString(gst_plugin_get_description(plugin)) + "<br>";
|
descr += "<b>Description</b>: "
|
||||||
descr += "<b>Filename</b>: " + QString((filename != NULL) ? filename : "(null)") + "<br>";
|
+ QString (gst_plugin_get_description (plugin)) + "<br>";
|
||||||
descr += "<b>Version</b>: " + QString(gst_plugin_get_version (plugin)) + "<br>";
|
descr += "<b>Filename</b>: "
|
||||||
descr += "<b>License</b>: " + QString(gst_plugin_get_license (plugin)) + "<br>";
|
+ QString ((filename != NULL) ? filename : "(null)") + "<br>";
|
||||||
descr += "<b>Source module</b>: " + QString(gst_plugin_get_source (plugin)) + "<br>";
|
descr += "<b>Version</b>: " + QString (gst_plugin_get_version (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
descr += "<b>License</b>: " + QString (gst_plugin_get_license (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
descr += "<b>Source module</b>: " + QString (gst_plugin_get_source (plugin))
|
||||||
|
+ "<br>";
|
||||||
|
|
||||||
if (release_date != NULL)
|
if (release_date != NULL) {
|
||||||
{
|
const gchar *tz = "(UTC)";
|
||||||
const gchar *tz = "(UTC)";
|
gchar *str, *sep;
|
||||||
gchar *str, *sep;
|
|
||||||
|
|
||||||
str = g_strdup (release_date);
|
str = g_strdup (release_date);
|
||||||
sep = strstr (str, "T");
|
sep = strstr (str, "T");
|
||||||
if (sep != NULL)
|
if (sep != NULL) {
|
||||||
{
|
*sep = ' ';
|
||||||
*sep = ' ';
|
sep = strstr (sep + 1, "Z");
|
||||||
sep = strstr (sep + 1, "Z");
|
if (sep != NULL)
|
||||||
if (sep != NULL)
|
*sep = ' ';
|
||||||
*sep = ' ';
|
}
|
||||||
}
|
else {
|
||||||
else
|
tz = "";
|
||||||
{
|
}
|
||||||
tz = "";
|
descr += "<b>Source release date</b>: " + QString (str) + " " + QString (tz)
|
||||||
}
|
+ "<br>";
|
||||||
descr += "<b>Source release date</b>: " + QString(str) + " " + QString(tz) + "<br>";
|
g_free (str);
|
||||||
g_free (str);
|
}
|
||||||
}
|
descr += "<b>Binary package</b>: " + QString (gst_plugin_get_package (plugin))
|
||||||
descr += "<b>Binary package</b>: " + QString(gst_plugin_get_package (plugin)) + "<br>";
|
+ "<br>";
|
||||||
descr += "<b>Origin URL</b>: " + QString(gst_plugin_get_origin (plugin)) + "<br>";
|
descr += "<b>Origin URL</b>: " + QString (gst_plugin_get_origin (plugin))
|
||||||
descr += "<b>Rank</b>: " + QString::number(gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory)));
|
+ "<br>";
|
||||||
m_plblInfo -> setText(descr);
|
descr += "<b>Rank</b>: "
|
||||||
|
+ QString::number (
|
||||||
|
gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)));
|
||||||
|
m_plblInfo->setText (descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::insert(QListWidgetItem *pitem)
|
void
|
||||||
|
PluginsListDialog::insert (QListWidgetItem *pitem)
|
||||||
{
|
{
|
||||||
if(!pitem) {
|
if (!pitem) {
|
||||||
qDebug() << "Do not insert null item";
|
qDebug () << "Do not insert null item";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "Insert: " << pitem -> text();
|
qDebug () << "Insert: " << pitem->text ();
|
||||||
|
|
||||||
if(!m_pGraph || !m_pGraph -> AddPlugin(pitem -> text().toStdString().c_str(), NULL))
|
if (!m_pGraph
|
||||||
{
|
|| !m_pGraph->AddPlugin (pitem->text ().toStdString ().c_str (), NULL)) {
|
||||||
QMessageBox::warning(this, "Plugin addition problem", "Plugin `" + pitem -> text() + "` insertion was FAILED");
|
QMessageBox::warning (
|
||||||
qDebug() << "Plugin `" << pitem -> text() << "` insertion FAILED";
|
this, "Plugin addition problem",
|
||||||
return;
|
"Plugin `" + pitem->text () + "` insertion was FAILED");
|
||||||
}
|
qDebug () << "Plugin `" << pitem->text () << "` insertion FAILED";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PluginsListDialog::eventFilter(QObject *obj, QEvent *event)
|
bool
|
||||||
|
PluginsListDialog::eventFilter (QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event -> type() == QEvent::KeyPress)
|
if (event->type () == QEvent::KeyPress) {
|
||||||
{
|
QKeyEvent *key = static_cast<QKeyEvent*> (event);
|
||||||
QKeyEvent *key = static_cast<QKeyEvent*>(event);
|
|
||||||
|
|
||||||
if((key -> key() == Qt::Key_Enter) || (key -> key() == Qt::Key_Return) && m_pPlugins -> currentItem())
|
if ((key->key () == Qt::Key_Enter)
|
||||||
{
|
|| (key->key () == Qt::Key_Return) && m_pPlugins->currentItem ()) {
|
||||||
insert(m_pPlugins -> currentItem());
|
insert (m_pPlugins->currentItem ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QDialog::eventFilter(obj, event);
|
return QDialog::eventFilter (obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::filterPlagins(const QString &text)
|
void
|
||||||
|
PluginsListDialog::filterPlagins (const QString &text)
|
||||||
{
|
{
|
||||||
for(std::size_t i=0; i<m_pPlugins -> count(); i++)
|
for (std::size_t i = 0; i < m_pPlugins->count (); i++) {
|
||||||
{
|
QListWidgetItem *pitem = m_pPlugins->item (i);
|
||||||
QListWidgetItem *pitem = m_pPlugins -> item(i);
|
|
||||||
|
|
||||||
if(pitem -> text().contains(text))
|
if (pitem->text ().contains (text))
|
||||||
pitem -> setHidden(false);
|
pitem->setHidden (false);
|
||||||
else
|
else
|
||||||
pitem -> setHidden(true);
|
pitem->setHidden (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsListDialog::InitPluginsList()
|
void
|
||||||
|
PluginsListDialog::InitPluginsList ()
|
||||||
{
|
{
|
||||||
if (!m_pPluginsList)
|
if (!m_pPluginsList)
|
||||||
m_pPluginsList = new PluginsList ();
|
m_pPluginsList = new PluginsList ();
|
||||||
|
|
||||||
GList* plugins_list = m_pPluginsList->getList();
|
GList* plugins_list = m_pPluginsList->getList ();
|
||||||
GList* l;
|
GList* l;
|
||||||
std::size_t num = 0;
|
std::size_t num = 0;
|
||||||
|
|
||||||
for (l = plugins_list; l != NULL; l = l->next) {
|
for (l = plugins_list; l != NULL; l = l->next) {
|
||||||
Plugin* plugin = (Plugin*)(l->data);
|
Plugin* plugin = (Plugin*) (l->data);
|
||||||
m_pPlugins->addItem(plugin->getName());
|
m_pPlugins->addItem (plugin->getName ());
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,24 +5,22 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
|
||||||
#include "GraphManager.h"
|
#include "GraphManager.h"
|
||||||
|
|
||||||
|
|
||||||
class Plugin
|
class Plugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Plugin(const QString& name, int rank):
|
Plugin(const QString& name, int rank):
|
||||||
m_name(name),
|
m_name(name),
|
||||||
m_rank(rank)
|
m_rank(rank)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
const QString getName() { return m_name;}
|
const QString getName() {return m_name;}
|
||||||
int getRank() { return m_rank;}
|
int getRank() {return m_rank;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_name;
|
const QString m_name;
|
||||||
int m_rank;
|
int m_rank;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,47 +30,43 @@ public:
|
||||||
PluginsList();
|
PluginsList();
|
||||||
~PluginsList();
|
~PluginsList();
|
||||||
|
|
||||||
GList* getList() { return m_pluginsList;}
|
GList* getList() {return m_pluginsList;}
|
||||||
GList* getSortedByRank();
|
GList* getSortedByRank();
|
||||||
GList* getPluginListByCaps(GstPadDirection direction, GstCaps* caps);
|
GList* getPluginListByCaps(GstPadDirection direction, GstCaps* caps);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
GList* m_pluginsList;
|
GList* m_pluginsList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PluginsListDialog: public QDialog
|
class PluginsListDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PluginsListDialog(PluginsList* pluginList, QWidget *pwgt = NULL, Qt::WindowFlags f = Qt::Window);
|
PluginsListDialog(PluginsList* pluginList, QWidget *pwgt = NULL, Qt::WindowFlags f = Qt::Window);
|
||||||
~PluginsListDialog();
|
~PluginsListDialog();
|
||||||
|
|
||||||
void setGraph(GraphManager* graph) { m_pGraph = graph;}
|
void setGraph(GraphManager* graph) {m_pGraph = graph;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitPluginsList();
|
void InitPluginsList();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showInfo(QListWidgetItem *current, QListWidgetItem *previous);
|
void showInfo(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void insert(QListWidgetItem *);
|
void insert(QListWidgetItem *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void filterPlagins(const QString &text);
|
void filterPlagins(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *m_plblInfo;
|
QLabel *m_plblInfo;
|
||||||
QListWidget *m_pPlugins;
|
QListWidget *m_pPlugins;
|
||||||
PluginsList *m_pPluginsList;
|
PluginsList *m_pPluginsList;
|
||||||
GraphManager *m_pGraph;
|
GraphManager *m_pGraph;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
#include "SeekSlider.h"
|
#include "SeekSlider.h"
|
||||||
|
|
||||||
void SeekSlider::mousePressEvent(QMouseEvent *event)
|
void
|
||||||
|
SeekSlider::mousePressEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(event->button() == Qt::LeftButton)
|
if (event->button () == Qt::LeftButton) {
|
||||||
{
|
if (orientation () == Qt::Vertical)
|
||||||
if(orientation() == Qt::Vertical)
|
setValue (minimum ()
|
||||||
setValue(minimum() + ((maximum()-minimum()) * (height()-event->y())) / height() ) ;
|
+ ((maximum () - minimum ()) * (height () - event->y ())) / height ());
|
||||||
else
|
else
|
||||||
setValue(minimum() + ((maximum()-minimum()) * event->x()) / width() ) ;
|
setValue (minimum ()
|
||||||
|
+ ((maximum () - minimum ()) * event->x ()) / width ());
|
||||||
|
|
||||||
event->accept();
|
event->accept ();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSlider::mousePressEvent(event);
|
QSlider::mousePressEvent (event);
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
#ifndef SEEK_SLIDER_H_
|
#ifndef SEEK_SLIDER_H_
|
||||||
#define SEEK_SLIDER_H_
|
#define SEEK_SLIDER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
class SeekSlider: public QSlider
|
class SeekSlider: public QSlider
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *);
|
void mousePressEvent(QMouseEvent *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -3,22 +3,23 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
GstRegistry *registry;
|
GstRegistry *registry;
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
registry = gst_registry_get();
|
registry = gst_registry_get();
|
||||||
#else
|
#else
|
||||||
registry = gst_registry_get_default();
|
registry = gst_registry_get_default ();
|
||||||
#endif
|
#endif
|
||||||
gst_registry_scan_path(registry, "./plugins");
|
gst_registry_scan_path (registry, "./plugins");
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app (argc, argv);
|
||||||
|
|
||||||
MainWindow wgt;
|
MainWindow wgt;
|
||||||
wgt.show();
|
wgt.show ();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue