Skip to content

Commit

Permalink
* new: finally a first version of compiling #23 from master branch in…
Browse files Browse the repository at this point in the history
…tegration
  • Loading branch information
lamogui committed Oct 23, 2019
1 parent 36ed15a commit 6460098
Show file tree
Hide file tree
Showing 24 changed files with 370 additions and 443 deletions.
16 changes: 8 additions & 8 deletions studio/demotimeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ qint64 DemoTimeline::maxSequenceLengthBeforeOverlap(Sequence* seq) const
}


void DemoTimeline::renderImage(const QSize& resolution, QImage* target)
void DemoTimeline::renderImage(const QSize& _resolution, QImage* _target)
{
Q_ASSERT(target);
passert( Log::Code, _target );

updateTime();
//Cast because of compiler bug in debug...
((Renderer*)m_renderer)->glRender((size_t)resolution.width(),(size_t)resolution.height());
*target = m_renderer->getImage();
((Renderer*)m_renderer)->glRender((size_t)_resolution.width(),(size_t)_resolution.height());
*_target = m_renderer->getImage();
}


Expand Down Expand Up @@ -366,19 +366,19 @@ void DemoTimeline::exportSources(const QDir &dir) const


//Camera preprocessor
cameras_source_code << ShaderMinifier::generatedSourceString();
//cameras_source_code << ShaderMinifier::generatedSourceString(); // TODO: HEADER GENERATED BY PROUT STUDIO NANANANANANANA
cameras_source_code << "#include \"cameras.hpp\"\n\n";

cameras_header_code << ShaderMinifier::generatedHeaderString();
//cameras_header_code << ShaderMinifier::generatedHeaderString();
cameras_header_code << "#ifndef CAMERAS_H\n";
cameras_header_code << "#define CAMERAS_H\n\n";
cameras_header_code << "#define " << cam_keyframe_count_str <<" " << QString::number(framerate()) + "\n\n";

//sequences preprocessor
sequences_source_code << ShaderMinifier::generatedSourceString();
//sequences_source_code << ShaderMinifier::generatedSourceString();
sequences_source_code << "#include \"sequences.hpp\"\n\n";

sequences_header_code << ShaderMinifier::generatedHeaderString();
//sequences_header_code << ShaderMinifier::generatedHeaderString();
sequences_header_code << "#ifndef SEQUENCES_H\n";
sequences_header_code << "#define SEQUENCES_H\n\n";
sequences_header_code << "#include \"cameras.hpp\"\n";
Expand Down
2 changes: 1 addition & 1 deletion studio/demotimeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public slots:
void deleteItems(const QList<QGraphicsItem*> items);
void deleteSequence(Sequence* seq);

void renderImage(const QSize& resolution, QImage* target);
void renderImage(const QSize& _resolution, QImage* _target);

void exportSources(const QDir& dir) const;

Expand Down
4 changes: 2 additions & 2 deletions studio/editorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ void EditorWidget::on_tab_currentChanged(int _index)
}

TextEditor* te = dynamic_cast<TextEditor*>(m_ui.tab->widget(_index));
Q_ASSERT(te != nullptr);
passert( Log::Code, te != nullptr );
//te->refresh();
m_ui.buildButton->setEnabled(te->textObject()->buildable());
emit rendererChanged(te->textObject()->getRenderer());
}

void EditorWidget::appendTextEditable(TextEditable *te)
{
Q_ASSERT(te);
passert( Log::Code, te );
bool newWidget = true;
for (int i = 0; i < m_ui.tab->count(); i++)
{
Expand Down
12 changes: 6 additions & 6 deletions studio/ffmpegencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ void FFmpegEncoder::run()


Music* music = m_timeline->music();
Q_ASSERT(music);
passert( Log::FFMpeg, music );

qint64 startFrame = 0;
qint64 endFrame = m_timeline->length();

Q_ASSERT(startFrame < endFrame);
passert( Log::FFMpeg, startFrame < endFrame );

music->pause();

Expand Down Expand Up @@ -176,8 +176,8 @@ void FFmpegEncoder::run()
image = image.convertToFormat(QImage::Format_RGB888);
//image.save("0.png");

Q_ASSERT(image.size() == m_resolution);
Q_ASSERT(image.byteCount() == videoBufferSize);
passert( Log::FFMpeg, image.size() == m_resolution );
passert( Log::FFMpeg, image.byteCount() == videoBufferSize );

qint64 writted = 0;
size_t tot_writted = 0;
Expand Down Expand Up @@ -246,8 +246,8 @@ void FFmpegEncoder::run()
image = image.convertToFormat(QImage::Format_RGB888);
//image.save(QString::number(i) + ".png");

Q_ASSERT(image.size() == m_resolution);
Q_ASSERT(image.byteCount() == videoBufferSize);
passert( Log::FFMpeg, nullptr, image.size() == m_resolution );
passert( Log::FFMpeg, image.byteCount() == videoBufferSize);

qint64 writted = 0;
size_t tot_writted = 0;
Expand Down
4 changes: 2 additions & 2 deletions studio/framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
class Framework : public FragmentShaderCode
{
public:
Framework(const QString& filename, QDomNode node, LogWidget& log,QObject* parent):
FragmentShaderCode(filename,node,log,parent)
Framework(const QString& _filename, QDomNode _node, QObject* _parent):
FragmentShaderCode(_filename, _node, _parent)
{
load();
}
Expand Down
6 changes: 3 additions & 3 deletions studio/keyframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "project.hpp"
#include "sequence.hpp"

#include "logmanager.hpp"

Keyframe::Keyframe(Project &project, Sequence* seq, QDomElement &node):
QObject(nullptr), //lol
Expand Down Expand Up @@ -133,7 +133,7 @@ qint64 Keyframe::checkFrameAvailable(qint64 rel_frame)
}
else
{
Q_ASSERT(0 && "Not supported yet");
ptodo( "not supported yet" );
return rel_frame;
}
}
Expand Down Expand Up @@ -167,7 +167,7 @@ void Keyframe::positionChanged(qint64 previous)
}
else
{
Q_ASSERT(0 && "Not supported yet");
ptodo( "not supported yet" );
}

}
Expand Down
20 changes: 10 additions & 10 deletions studio/logmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Log::Entry::Entry( Type _type, Category _category, const QObject* _sender, QStri
{
}

Log::Entry Log::Entry::Assertion( Category _category, const QObject* _sender, QString _what, const CppCodeOrigin& _cppOrigin ){
return Log::Entry( Log::Type::Assertion, _category, _sender, _what, static_cast<qint64>(-1), _cppOrigin );
Log::Entry Log::Entry::Assertion( Category _category, QString _what, const CppCodeOrigin& _cppOrigin ){
return Log::Entry( Log::Type::Assertion, _category, nullptr, _what, static_cast<qint64>(-1), _cppOrigin );
}
Log::Entry Log::Entry::Error( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin ) {
return Log::Entry( Log::Type::Error, _category, _sender, _what, _param, _cppOrigin );
Expand All @@ -86,26 +86,26 @@ Log::Entry Log::Entry::Info( Category _category, const QObject* _sender, QString
* Manager
*/

Log::Manager g_logManager;
std::unique_ptr< Log::Manager > g_logManager = nullptr;

Log::Manager::Manager() {
connect( this, &Log::Manager::newEntry, this, &Log::Manager::handleNewEntry );
}

void Log::Manager::Assertion( Category _category, const QObject* _sender, QString _what, const CppCodeOrigin& _cppOrigin ) {
emit g_logManager.newEntry( Log::Entry::Assertion(_category, _sender, _what, _cppOrigin) );
void Log::Manager::Assertion(Category _category, QString _what, const CppCodeOrigin& _cppOrigin ) {
emit g_logManager->newEntry( Log::Entry::Assertion(_category, _what, _cppOrigin) );
}

void Log::Manager::Error( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin ) {
emit g_logManager.newEntry( Log::Entry::Error(_category, _sender, _what, _param, _cppOrigin) );
emit g_logManager->newEntry( Log::Entry::Error(_category, _sender, _what, _param, _cppOrigin) );
}

void Log::Manager::Warning( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin ) {
emit g_logManager.newEntry( Log::Entry::Warning(_category, _sender, _what, _param, _cppOrigin) );
emit g_logManager->newEntry( Log::Entry::Warning(_category, _sender, _what, _param, _cppOrigin) );
}

void Log::Manager::Info( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin ) {
emit g_logManager.newEntry( Log::Entry::Info(_category, _sender, _what, _param, _cppOrigin) );
emit g_logManager->newEntry( Log::Entry::Info(_category, _sender, _what, _param, _cppOrigin) );
}

void Log::Manager::handleOpengGLLoggedMessage(const QOpenGLDebugMessage& debugMessage)
Expand Down Expand Up @@ -171,13 +171,13 @@ void Log::Manager::handleNewEntry( Entry _entry )
qDebug() << type << category << name << _entry.m_what;
}

bool pVerify( Log::Category _category, const QObject* _sender, bool _cond, const char* _condStr, const Log::CppCodeOrigin& _cppOrigin )
bool pVerify( Log::Category _category, bool _cond, const char* _condStr, const Log::CppCodeOrigin& _cppOrigin )
{
if ( !_cond ) {
if ( PROUT_IS_DEBUGGER_PRESENT ) {
PROUT_DEBUG_BREAK;
}
Log::Manager::Assertion( _category, _sender, QString("VERIFY FAILED !") + " (" + QString(_condStr) + ")", _cppOrigin );
Log::Manager::Assertion( _category, QString("VERIFY FAILED !") + " (" + QString(_condStr) + ")", _cppOrigin );
}
return _cond;
}
Expand Down
21 changes: 11 additions & 10 deletions studio/logmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QPointer>
#include <QString>
#include <QVector>
#include <memory>

#define PROUT_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
#ifdef _MSC_VER
Expand Down Expand Up @@ -66,7 +67,7 @@ namespace Log {
qint64 m_param; // line number for shader codes / text medias
CppCodeOrigin m_cppOrigin;

static Entry Assertion( Category _category, const QObject* _sender, QString _what, const CppCodeOrigin& _cppOrigin );
static Entry Assertion( Category _category, QString _what, const CppCodeOrigin& _cppOrigin );
static Entry Error( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
static Entry Warning( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
static Entry Info( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
Expand All @@ -86,7 +87,7 @@ namespace Log {
public:
Manager();

static void Assertion( Category _category, const QObject* _sender, QString _what, const CppCodeOrigin& _cppOrigin );
static void Assertion( Category _category, QString _what, const CppCodeOrigin& _cppOrigin );
static void Error( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
static void Warning( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
static void Info( Category _category, const QObject* _sender, QString _what, qint64 _param, const CppCodeOrigin& _cppOrigin );
Expand All @@ -103,25 +104,25 @@ namespace Log {
};
}

extern Log::Manager g_logManager; // global instance
extern std::unique_ptr< Log::Manager > g_logManager; // global instance

#define PROUT_MAKE_CPP_ORIGIN() Log::CppCodeOrigin( __FILE__, __LINE__ )

// Asserts
#define passertmsg( _category, _sender, _cond, _what) \
#define passertmsg( _category, _cond, _what) \
PROUT_BLOCK_WITH_FORCED_SEMICOLON( \
if ( !(_cond) ) { \
if (PROUT_IS_DEBUGGER_PRESENT) { \
PROUT_DEBUG_BREAK;\
} \
Log::Manager::Assertion( _category, _sender, QString( _what ) + " (" + QString(#_cond) + ")", PROUT_MAKE_CPP_ORIGIN()); \
Log::Manager::Assertion( _category, QString( _what ) + " (" + QString(#_cond) + ")", PROUT_MAKE_CPP_ORIGIN()); \
} )
#define passertmsgf( _category, _sender, _cond, _what, ... ) passertmsg( _category, _sender, _cond, QString::asprinf( _what, __VA_ARGS__ ) )
#define passert( _category, _sender, _cond ) passertmsg( _category, _sender, _cond, tr("ASSERTION FAILED !") )
#define ptodo( _what ) passertmsg( Log::Code, nullptr, false, tr("TODO: ") + _what )
#define passertmsgf( _category, _cond, _what, ... ) passertmsg( _category, _cond, QString::asprinf( _what, __VA_ARGS__ ) )
#define passert( _category, _cond ) passertmsg( _category, _cond, QObject::tr("ASSERTION FAILED !") );
#define ptodo( _what ) passertmsg( Log::Code, false, QObject::tr("TODO: ") + _what )

bool pVerify( Log::Category _category, const QObject* _sender, bool _cond, const char* _condStr, const Log::CppCodeOrigin& _cppOrigin );
#define pverify( _category, _sender, _cond ) pVerify( _category, _sender, _cond, #_cond, PROUT_MAKE_CPP_ORIGIN() )
bool pVerify( Log::Category _category, bool _cond, const char* _condStr, const Log::CppCodeOrigin& _cppOrigin );
#define pverify( _category, _cond ) pVerify( _category, _cond, #_cond, PROUT_MAKE_CPP_ORIGIN() )

// Errors
#define perrorp( _category, _sender, _param, _what ) PROUT_BLOCK_WITH_FORCED_SEMICOLON( Log::Manager::Error( _category, _sender, QString( _what ), _param, PROUT_MAKE_CPP_ORIGIN()); )
Expand Down
18 changes: 10 additions & 8 deletions studio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
#include <QtXml>
#include <QFile>
#include <QMessageBox>
#include "logmanager.hpp"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFile f(":qdarkstyle/style.qss");
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
a.setStyleSheet(ts.readAll());
g_logManager = std::move( std::unique_ptr< Log::Manager >( new Log::Manager() ) );
QApplication a(argc, argv);
QFile f(":qdarkstyle/style.qss");
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
a.setStyleSheet(ts.readAll());

MainWindow w;
w.showMaximized();
return a.exec();
MainWindow w;
w.showMaximized();
return a.exec();
}
4 changes: 2 additions & 2 deletions studio/music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Music::~Music()
int Music::rtAudioCallback(void *_outputBuffer, void *_inputBuffer, unsigned int _nBufferFrames, double _streamTime, RtAudioStreamStatus _status, void *_userData)
{
(void) _inputBuffer;
Music* music = static_cast< Music* >( _userData );
passert( Log::Audio, music, _userData && _outputBuffer);
passert( Log::Audio, _userData && _outputBuffer);

Music* music = static_cast< Music* >( _userData );
if (music->m_playing)
{
music->processAudio(_outputBuffer,_nBufferFrames,_streamTime,_status);
Expand Down
5 changes: 0 additions & 5 deletions studio/nodefile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <QDomNode>
#include <QFile>

class LogWidget;

class NodeFile : public QFile
{
Q_OBJECT
Expand All @@ -14,9 +12,6 @@ class NodeFile : public QFile
NodeFile(const QString& _filename, QDomNode _node, QObject* _parent);
inline QDomNode getNode() const { return m_node; }

//Do the connections to log
virtual void connectLog(LogWidget& log);

protected:
QDomNode m_node;
};
Expand Down
Loading

0 comments on commit 6460098

Please sign in to comment.