-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71da20e
Showing
1,831 changed files
with
615,735 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> | ||
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
p, li { white-space: pre-wrap; } | ||
</style></head><body style=" font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;"> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:12pt; font-weight:600;">GaitSym 2017a</span></p> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:12pt;">Written by Bill Sellers ©2005-2017.</span></p> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:12pt;">The latest version as well as source code and sample models can be found at:</span></p> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.animalsimulation.org"><span style=" font-family:'.Lucida Grande UI'; text-decoration: underline; color:#0000ff;">http://www.animalsimulation.org</span></a></p> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:12pt;">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.</span></p> | ||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:12pt;">Development has been funded by The Leverhulme Trust, NERC, BBSRC and EPSRC.</span></p></body></html></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> |
Oops, something went wrong.