code format
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "loader_qgl.h"
|
||||
|
||||
#include "chunkstream.h"
|
||||
|
||||
|
||||
@@ -36,8 +37,8 @@ GLObjectBase * loadFromQGLFile(const QString & filepath) {
|
||||
return 0;
|
||||
}
|
||||
GLObjectBase * root = 0;
|
||||
ushort version = 0xFFFF;
|
||||
f.peek((char*)&version, 2);
|
||||
ushort version = 0xFFFF;
|
||||
f.peek((char *)&version, 2);
|
||||
if (version == 1) {
|
||||
s.skipRawData(2);
|
||||
s >> root;
|
||||
@@ -46,8 +47,7 @@ GLObjectBase * loadFromQGLFile(const QString & filepath) {
|
||||
return 0;
|
||||
}
|
||||
root->buildTransform();
|
||||
if (root->name().isEmpty())
|
||||
root->setName(QFileInfo(f).baseName());
|
||||
if (root->name().isEmpty()) root->setName(QFileInfo(f).baseName());
|
||||
qDebug() << "[Loader QGL] Loaded" << root->childCount() << "objects from" << filepath;
|
||||
return root;
|
||||
}
|
||||
@@ -55,15 +55,14 @@ GLObjectBase * loadFromQGLFile(const QString & filepath) {
|
||||
|
||||
bool saveToQGLFile(const QString & filepath, const GLObjectBase * o) {
|
||||
QFile f(filepath);
|
||||
if (!f.open(QIODevice::ReadWrite))
|
||||
return false;
|
||||
if (!f.open(QIODevice::ReadWrite)) return false;
|
||||
f.resize(0);
|
||||
QDataStream s(&f);
|
||||
s.setVersion(QDataStream::Qt_4_8);
|
||||
char sign[4] = {'Q', 'G', 'L', 'F'};
|
||||
char sign[4] = {'Q', 'G', 'L', 'F'};
|
||||
ushort version = 1;
|
||||
s.writeRawData(sign, 4);
|
||||
s.writeRawData((char*)&version, 2);
|
||||
s.writeRawData((char *)&version, 2);
|
||||
s << o;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user