Skip to content

Commit

Permalink
Merge branch 'master' into pendulum.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 13, 2020
2 parents 4737466 + 7c9fe2c commit bd73f05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/plugins/test/ZincWindow/src/zincwindowwindow.cpp
Expand Up @@ -60,6 +60,12 @@ ZincWindowWindow::ZincWindowWindow(QWidget *pParent) :

mGui->setupUi(this);

// Create a temporary copy of our .exfile file

mExFile = Core::canonicalFileName(QDir::tempPath()+"/ZincWindow/trilinearCube.exfile");

Core::writeResourceToFile(mExFile, ":/ZincWindow/trilinearCube.exfile");

// Create and add a Zinc widget

mZincWidget = new ZincWidget::ZincWidget(this);
Expand Down Expand Up @@ -87,10 +93,16 @@ ZincWindowWindow::ZincWindowWindow(QWidget *pParent) :

ZincWindowWindow::~ZincWindowWindow()
{
// Delete the temporary copy of our .exfile file

QFile::remove(mExFile);

// Delete some internal objects

delete mZincContext;

mZincWidget = nullptr;

// Delete the GUI

delete mGui;
Expand All @@ -109,6 +121,13 @@ void ZincWindowWindow::retranslateUi()

void ZincWindowWindow::createAndSetZincContext()
{
// Make sure that we still have a Zinc widget (i.e. skip the case where we
// are coming here as a result of closing OpenCOR)

if (mZincWidget == nullptr) {
return;
}

// Keep track of our current scene viewer's description

mZincSceneViewerDescription = mZincWidget->sceneViewer().writeDescription();
Expand All @@ -127,15 +146,9 @@ void ZincWindowWindow::createAndSetZincContext()
// Load our .exfile to our default region using a temporary copy of our
// .exfile file

QString exFile = Core::canonicalFileName(QDir::tempPath()+"/ZincWindow/trilinearCube.exfile");

Core::writeResourceToFile(exFile, ":/ZincWindow/trilinearCube.exfile");

OpenCMISS::Zinc::Region region = mZincContext->getDefaultRegion();

region.readFile(exFile.toUtf8().constData());

QFile::remove(exFile);
region.readFile(mExFile.toUtf8().constData());

// Create a field magnitude for our default region

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/test/ZincWindow/src/zincwindowwindow.h
Expand Up @@ -77,6 +77,8 @@ class ZincWindowWindow : public Core::WindowWidget

int mAxesFontPointSize = 0;

QString mExFile;

private slots:
void createAndSetZincContext();
void graphicsInitialized();
Expand Down

0 comments on commit bd73f05

Please sign in to comment.