sendMessage via signal plot from file to window,

add severity to messages (black, yellow, red),
add about text,
removed unused texture from resource
This commit is contained in:
Anakin
2017-01-04 14:35:27 +01:00
parent a221ed4957
commit a2f5324a3c
12 changed files with 133 additions and 37 deletions

View File

@@ -6,6 +6,8 @@
#include <QMatrix4x4>
#include <QQuaternion>
#include <QOpenGLFunctions>
#include <QObject>
#include <..\Header\MainWindow.h>
struct BoundingBox {
@@ -34,18 +36,27 @@ struct Model {
std::vector<Segment*> segmList;
};
class FileInterface
class FileInterface : public QObject
{
Q_OBJECT
public:
explicit FileInterface(const char* path)
: m_models(new QVector<Model*>)
explicit FileInterface(const char* path, QObject *parent)
: QObject(parent)
, m_models(new QVector<Model*>)
, m_textureNames(new QVector<std::string>)
{
//open file
m_file.open(path, std::ios::in | std::ios::binary);
if (!m_file.is_open())
throw std::invalid_argument(std::string("file not found: ") += path);
throw std::invalid_argument(std::string("ERROR: file not found: ") += path);
MainWindow* tmp = dynamic_cast<MainWindow*>(parent->parent()->parent());
if(tmp != NULL)
connect(this, SIGNAL(sendMessage(QString, int)), tmp, SLOT(showMessage(QString, int)));
};
virtual ~FileInterface()
@@ -85,4 +96,7 @@ public:
virtual QVector<Model*>* getModels() const { return m_models; };
virtual QVector<std::string>* getTextureNames() const { return m_textureNames; };
virtual BoundingBox getBoundingBox() const { return m_sceneBbox; };
signals:
void sendMessage(QString msg, int severity);
};

View File

@@ -19,7 +19,7 @@ class GeometryEngine : public QObject, protected QOpenGLFunctions
Q_OBJECT
public:
GeometryEngine();
GeometryEngine(QObject *parent = Q_NULLPTR);
virtual ~GeometryEngine();
private:
@@ -38,6 +38,7 @@ public slots:
signals:
void requestResetView();
void sendMessage(QString message, int severity);
void requestUpdate();
};

View File

@@ -13,12 +13,16 @@ public:
private:
Ui::MainWindowClass* ui;
int m_curSeverity;
private slots:
void openFile();
void aboutFile();
void aboutTool();
public slots:
void showMessage(QString message, int severity);
signals:
void loadFile(const char*);
};

View File

@@ -20,7 +20,7 @@ enum ModelTyp {
class MshFile : public FileInterface
{
public:
explicit MshFile(const char* path);
explicit MshFile(const char* path, QObject *parent = Q_NULLPTR);
virtual ~MshFile();
private:

View File

@@ -53,6 +53,7 @@ protected:
private:
void initShaders();
void setConnections();
private slots:
void resetView();