add OuputDevice as singleton to manage output to statusbar,
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "..\Header\MshFile.h"
|
||||
#include "..\Header\tga.h"
|
||||
#include "..\Header\OutputDevice.h"
|
||||
#include <QColor>
|
||||
|
||||
// helper function to save data from file to any variable type
|
||||
@@ -9,8 +10,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// public constructor/destructor
|
||||
|
||||
MshFile::MshFile(QString path, QObject * parent)
|
||||
: FileInterface(path, parent)
|
||||
MshFile::MshFile(QString path)
|
||||
: FileInterface(path)
|
||||
{
|
||||
import();
|
||||
}
|
||||
@@ -89,7 +90,7 @@ void MshFile::loadChunks(std::list<ChunkHeader*>& destination, std::streampos st
|
||||
// out of file. Maybe a size information is corrupted
|
||||
if (!m_file.good())
|
||||
{
|
||||
emit sendMessage("WARNING: corrupted file. Trying to continue..", 1);
|
||||
OutputDevice::getInstance()->print("WARNING: corrupted file. Trying to continue..", 1);
|
||||
m_file.clear();
|
||||
break;
|
||||
}
|
||||
@@ -506,7 +507,7 @@ void MshFile::analyseSegmChunks(Model * dataDestination, std::list<ChunkHeader*>
|
||||
|
||||
if (tmp_size < (unsigned) new_segment->vertices.size())
|
||||
{
|
||||
emit sendMessage("WARNING: too less normals " + QString::number(tmp_size) + " < " + QString::number(new_segment->vertices.size()), 1);
|
||||
OutputDevice::getInstance()->print("WARNING: too less normals " + QString::number(tmp_size) + " < " + QString::number(new_segment->vertices.size()), 1);
|
||||
|
||||
for (unsigned int i = new_segment->vertices.size(); i != tmp_size; i--)
|
||||
for (unsigned int j = 0; j < 3; j++)
|
||||
@@ -514,7 +515,7 @@ void MshFile::analyseSegmChunks(Model * dataDestination, std::list<ChunkHeader*>
|
||||
}
|
||||
else if (tmp_size > (unsigned) new_segment->vertices.size())
|
||||
{
|
||||
emit sendMessage("WARNING: too many normals " + QString::number(tmp_size) + " > " + QString::number(new_segment->vertices.size()), 1);
|
||||
OutputDevice::getInstance()->print("WARNING: too many normals " + QString::number(tmp_size) + " > " + QString::number(new_segment->vertices.size()), 1);
|
||||
tmp_size = new_segment->vertices.size();
|
||||
}
|
||||
|
||||
@@ -698,7 +699,7 @@ void MshFile::readUV(Segment * dataDestination, std::streampos position)
|
||||
|
||||
if (tmp_size < (unsigned) dataDestination->vertices.size())
|
||||
{
|
||||
emit sendMessage("WARNING: too less UVs " + QString::number(tmp_size) + " < " + QString::number(dataDestination->vertices.size()),1);
|
||||
OutputDevice::getInstance()->print("WARNING: too less UVs " + QString::number(tmp_size) + " < " + QString::number(dataDestination->vertices.size()),1);
|
||||
|
||||
for (unsigned int i = dataDestination->vertices.size(); i != tmp_size; i--)
|
||||
for (unsigned int j = 0; j < 2; j++)
|
||||
@@ -706,7 +707,7 @@ void MshFile::readUV(Segment * dataDestination, std::streampos position)
|
||||
}
|
||||
else if (tmp_size > (unsigned) dataDestination->vertices.size())
|
||||
{
|
||||
emit sendMessage("WARNING: too many UVs " + QString::number(tmp_size) + " > " + QString::number(dataDestination->vertices.size()), 1);
|
||||
OutputDevice::getInstance()->print("WARNING: too many UVs " + QString::number(tmp_size) + " > " + QString::number(dataDestination->vertices.size()), 1);
|
||||
tmp_size = dataDestination->vertices.size();
|
||||
}
|
||||
|
||||
@@ -722,7 +723,7 @@ void MshFile::loadTexture(QOpenGLTexture *& destination, QString filepath, QStri
|
||||
|
||||
if (!loadSuccess)
|
||||
{
|
||||
emit sendMessage("WARNING: texture not found or corrupted: " + filename, 1);
|
||||
OutputDevice::getInstance()->print("WARNING: texture not found or corrupted: " + filename, 1);
|
||||
|
||||
img = QImage(1, 1, QImage::Format_RGB32);
|
||||
img.fill(QColor(m_materials->back().diffuseColor[0] * 255, m_materials->back().diffuseColor[1] * 255, m_materials->back().diffuseColor[2] * 255));
|
||||
|
||||
Reference in New Issue
Block a user