Skip to content

Commit

Permalink
fixed relative paths, resources etc. so that the MD viz should work o…
Browse files Browse the repository at this point in the history
…ut of the box.
  • Loading branch information
jorgehog committed Oct 22, 2013
1 parent 5a2b046 commit 17491c6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
3 changes: 3 additions & 0 deletions GUI/cppMDGUI/resources.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<RCC>
<qresource prefix="/">
<file>viz/images/defaultpicture.png</file>
<file>viz/images/ball.png</file>
<file>viz/images/LithiumAtom.png</file>
<file>viz/images/Stylised_Lithium_Atom.png</file>
</qresource>
</RCC>
20 changes: 15 additions & 5 deletions GUI/cppMDGUI/viz/qtplatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ QtPlatform::QtPlatform(int argc, char* argv[], MainWindow *mainWindow) :
mainWindow(mainWindow)
{

std::string superPath;
if (argc > 1) {
superPath = std::string(argv[1]);
} else {
superPath = "./";
}

if (mainWindow != NULL){
mainWindow->setPlatform(this);

Expand All @@ -30,15 +37,18 @@ QtPlatform::QtPlatform(int argc, char* argv[], MainWindow *mainWindow) :
//This is the magic which makes a game possible I guess?
connect(timer, SIGNAL(timeout()), SLOT(advanceTimeout()));


colors.push_back(Qt::black);
colors.push_back(Qt::blue);
colors.push_back(Qt::red);

//images.push_back("/home/jorgehog/cppMD/GUI/cppMDGUI/viz/images/LithiumAtom.png");
//images.push_back("/home/jorgehog/cppMD/GUI/cppMDGUI/viz/images/Stylised_Lithium_Atom.png");
images.push_back("/home/jorgehog/cppMD/GUI/cppMDGUI/viz/images/ball.png");
images.push_back("/home/jorgehog/cppMD/GUI/cppMDGUI/viz/images/defaultpicture.png");
std::string imagePath = superPath + "GUI/cppMDGUI/viz/images/";

// images.push_back(imagePath + "LithiumAtom.png");
// images.push_back(imagePath + "Stylised_Lithium_Atom.png");
// sizeFac = 1;

images.push_back(imagePath + "ball.png");
images.push_back(imagePath + "defaultpicture.png");

}

Expand Down
6 changes: 2 additions & 4 deletions MD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ GUI {
GUI/cppMDGUI/viz/sprite.cpp \
GUI/cppMDGUI/mainwindow.cpp

OTHER_FILES += \
GUI/cppMDGUI/viz/images/Stylised_Lithium_Atom.png \
GUI/cppMDGUI/viz/images/LithiumAtom.png

RESOURCES += \
GUI/cppMDGUI/resources.qrc
}

QMAKE_CXXFLAGS += $$COMMON_CXXFLAGS
Expand Down
6 changes: 6 additions & 0 deletions cppMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@

#include "src/MD/forces/forces.h"

#ifdef NO_DCVIZ
#include <QApplication>
#include "GUI/cppMDGUI/viz/qtplatform.h"
#include "GUI/cppMDGUI/mainwindow.h"
#endif

#endif // CPPMD_H
17 changes: 10 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ using namespace libconfig;
#include <mpi.h>
#include "cppMD.h"

#ifdef NO_DCVIZ
#include <QApplication>
#include "/home/jorgehog/cppMD/GUI/cppMDGUI/viz/qtplatform.h"
#include "/home/jorgehog/cppMD/GUI/cppMDGUI/mainwindow.h"
#endif

int main(int argc, char* argv[])
{

srand(time(NULL));
wall_clock timer;

Config cfg;
cfg.readFile("/home/jorgehog/cppMD/configMD.cfg");

std::string superPath;
if (argc > 1) {
superPath = std::string(argv[1]);
} else {
superPath = "./";
}

std::string configPath = superPath + "configMD.cfg";
cfg.readFile(configPath.c_str());

const Setting & root = cfg.getRoot();

Expand Down

0 comments on commit 17491c6

Please sign in to comment.