Add .clang-format

master
Fabien Freling 2019-07-16 13:31:07 +02:00
parent 90526946e6
commit 20041deef5
6 changed files with 158 additions and 143 deletions

6
src/qt/.clang-format Normal file
View File

@ -0,0 +1,6 @@
---
BasedOnStyle: Mozilla
IndentWidth: 4
TabWidth: 4
ColumnLimit: 100
UseTab: ForIndentation

View File

@ -8,7 +8,8 @@
#include <caml/callback.h>
int main(int argc, char *argv[])
int
main(int argc, char* argv[])
{
QCoreApplication::setApplicationName("OBoy");
QCoreApplication::setOrganizationName("ffreling");

View File

@ -4,15 +4,16 @@
#include <QUrl>
#include <QtGlobal>
#include <caml/mlvalues.h>
#include <caml/callback.h>
#include <caml/alloc.h>
#include <caml/bigarray.h>
#include <caml/callback.h>
#include <caml/memory.h>
#include <caml/misc.h>
#include <caml/mlvalues.h>
#include <caml/osdeps.h>
OBoy::OBoy(QObject *parent) : QObject(parent)
OBoy::OBoy(QObject* parent)
: QObject(parent)
{
const QStringList args = QCoreApplication::arguments();
if (args.size() > 1) {
@ -21,7 +22,9 @@ OBoy::OBoy(QObject *parent) : QObject(parent)
}
}
value *fetch_caml_callback(const char *name) {
value*
fetch_caml_callback(const char* name)
{
value* closure_f = caml_named_value(name);
if (closure_f == nullptr) {
qFatal("Cannot find OCaml function: %s", name);
@ -32,7 +35,8 @@ value *fetch_caml_callback(const char *name) {
// https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
// http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/calling_ocaml.html
QString OBoy::name() const
QString
OBoy::name() const
{
CAMLparam0();
@ -47,7 +51,8 @@ QString OBoy::name() const
return QString(str);
}
QString OBoy::version() const
QString
OBoy::version() const
{
CAMLparam0();
@ -62,7 +67,9 @@ QString OBoy::version() const
return QString(str);
}
bool OBoy::load(const QUrl &path) {
bool
OBoy::load(const QUrl& path)
{
CAMLparam0();
CAMLlocal1(ocaml_path);
@ -83,12 +90,14 @@ bool OBoy::load(const QUrl &path) {
return _loaded;
}
bool OBoy::loaded() const
bool
OBoy::loaded() const
{
return _loaded;
}
QImage OBoy::backgroundMap(int index) const
QImage
OBoy::backgroundMap(int index) const
{
CAMLparam0();
CAMLlocal1(ocaml_index);

View File

@ -1,7 +1,7 @@
#pragma once
#include <QObject>
#include <QImage>
#include <QObject>
#include <QString>
class OBoy : public QObject

View File

@ -4,11 +4,10 @@
OImageProvider::OImageProvider(QQmlApplicationEngine& engine)
: QQuickImageProvider(QQuickImageProvider::Image)
, _engine(engine)
{
{}
}
QImage OImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
QImage
OImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize)
{
QList<QObject*> roots = _engine.rootObjects();
OBoy* oboy = roots[0]->findChild<OBoy*>("qml_oboy");