Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wol101 committed Apr 28, 2018
0 parents commit 71da20e
Show file tree
Hide file tree
Showing 1,831 changed files with 615,735 additions and 0 deletions.
79 changes: 79 additions & 0 deletions GaitSymQt/AVIWriter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "AVIWriter.h"

#include "gwavi.h"

#include <QDebug>
#include <QImage>
#include <QByteArray>
#include <QBuffer>

AVIWriter::AVIWriter()
{
m_gwavi = 0;
m_width = 0;
m_height = 0;
m_fps = 0;
}

AVIWriter::~AVIWriter()
{
if (m_gwavi) CloseFile();
}

int AVIWriter::InitialiseFile(const QString &aviFilename, unsigned int width, unsigned int height, unsigned int fps)
{
m_width = width;
m_height = height;
m_fps = fps;
m_aviFilename = aviFilename;

const char *fourcc = "MJPG"; /* set fourcc used */

#ifdef Q_OS_WIN
m_gwavi = gwavi_open(aviFilename.toStdWString().c_str(), m_width, m_height, fourcc, m_fps, 0);
#else
m_gwavi = gwavi_open(aviFilename.toUtf8().constData(), m_width, m_height, fourcc, m_fps, 0);
#endif

if (!m_gwavi)
{
qDebug("Error: call to gwavi_open(%s) failed!\n", qPrintable(m_aviFilename));
return __LINE__;
}
return 0;
}

int AVIWriter::WriteAVI(unsigned int width, unsigned int height, const unsigned char *rgb, int quality)
{
if (width != m_width || height != m_height)
{
qDebug("Error: width or height has changed since starting video %s\n", qPrintable(m_aviFilename));
return __LINE__;
}
QImage image(rgb, m_width, m_height, m_width * 3, QImage::Format_RGB888);
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "JPG", quality); // this saves the JPG file data to a QByteArray

if (gwavi_add_frame(m_gwavi, reinterpret_cast<const unsigned char *>(buffer.data().data()), buffer.size()) == -1)
{
qDebug("Error: cannot add frame to video %s\n", qPrintable(m_aviFilename));
return __LINE__;
}
return 0;
}

int AVIWriter::CloseFile()
{
if (gwavi_close(m_gwavi) == -1)
{
qDebug("Error: call to gwavi_close() failed! %s\n", qPrintable(m_aviFilename));
return __LINE__;
}
m_gwavi = 0;
return 0;
}



24 changes: 24 additions & 0 deletions GaitSymQt/AVIWriter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef AVIWRITER_H
#define AVIWRITER_H

#include <QString>

class AVIWriter
{
public:
AVIWriter();
~AVIWriter();
int InitialiseFile(const QString &aviFilename, unsigned int width, unsigned int height, unsigned int fps);
int WriteAVI(unsigned int width, unsigned int height, const unsigned char *rgb, int quality);

protected:
int CloseFile();

struct gwavi_t *m_gwavi;
unsigned int m_width;
unsigned int m_height;
unsigned int m_fps;
QString m_aviFilename;
};

#endif // AVIWRITER_H
14 changes: 14 additions & 0 deletions GaitSymQt/AboutDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "AboutDialog.h"
#include "ui_AboutDialog.h"

AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
}

AboutDialog::~AboutDialog()
{
delete ui;
}
22 changes: 22 additions & 0 deletions GaitSymQt/AboutDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <QDialog>

namespace Ui {
class AboutDialog;
}

class AboutDialog : public QDialog
{
Q_OBJECT

public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();

private:
Ui::AboutDialog *ui;
};

#endif // ABOUTDIALOG_H
135 changes: 135 additions & 0 deletions GaitSymQt/AboutDialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>572</width>
<height>364</height>
</rect>
</property>
<property name="windowTitle">
<string>About Cloud Digitiser</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt; font-weight:600;&quot;&gt;GaitSym 2017a&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;Written by Bill Sellers ©2005-2017.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;The latest version as well as source code and sample models can be found at:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://www.animalsimulation.org&quot;&gt;&lt;span style=&quot; font-family:'.Lucida Grande UI'; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.animalsimulation.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;Program is written using Qt (www.qt-project.org) and the Open Dynamic Engine (www.ode.org), and the source code is released under the GNU Copyleft Licence.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;Development has been funded by The Leverhulme Trust, NERC, BBSRC and EPSRC.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="Resources.qrc">:/images/Desktop Icon/Icon.iconset/icon_256x256.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonOK">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="Resources.qrc"/>
<include location="resources.qrc"/>
</resources>
<connections>
<connection>
<sender>pushButtonOK</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>328</x>
<y>315</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>334</y>
</hint>
</hints>
</connection>
</connections>
<designerdata>
<property name="gridDeltaX">
<number>10</number>
</property>
<property name="gridDeltaY">
<number>10</number>
</property>
<property name="gridSnapX">
<bool>true</bool>
</property>
<property name="gridSnapY">
<bool>true</bool>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
</designerdata>
</ui>
Loading

0 comments on commit 71da20e

Please sign in to comment.