summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/import.cc6
-rw-r--r--src/importnode.h3
-rw-r--r--src/linearextrude.cc1
-rw-r--r--src/linearextrudenode.h4
-rw-r--r--src/printutils.cc5
-rw-r--r--src/rotateextrude.cc1
-rw-r--r--src/rotateextrudenode.h4
-rw-r--r--src/surface.cc2
-rw-r--r--src/value.cc7
-rw-r--r--src/value.h8
10 files changed, 24 insertions, 17 deletions
diff --git a/src/import.cc b/src/import.cc
index 880823d..230cab2 100644
--- a/src/import.cc
+++ b/src/import.cc
@@ -43,7 +43,6 @@
#include <QRegExp>
#include <QStringList>
#include <sys/types.h>
-#include <sys/stat.h>
#include <fstream>
#include <sstream>
#include <assert.h>
@@ -228,13 +227,8 @@ std::string ImportNode::toString() const
{
std::stringstream stream;
- struct stat st;
- memset(&st, 0, sizeof(struct stat));
- stat(this->filename.c_str(), &st);
-
stream << this->name();
stream << "(file = \"" << this->filename << "\", "
- "cache = \"" << std::hex << (int)st.st_mtime << "." << (int)st.st_size << "\", "
"layer = \"" << this->layername << "\", "
"origin = [" << std::dec << this->origin_x << ", " << this->origin_y << "], "
"scale = " << this->scale << ", "
diff --git a/src/importnode.h b/src/importnode.h
index c08ecc9..bcb229f 100644
--- a/src/importnode.h
+++ b/src/importnode.h
@@ -3,6 +3,7 @@
#include "node.h"
#include "visitor.h"
+#include "value.h"
enum import_type_e {
TYPE_UNKNOWN,
@@ -22,7 +23,7 @@ public:
virtual std::string name() const;
import_type_e type;
- std::string filename;
+ Filename filename;
std::string layername;
int convexity;
double fn, fs, fa;
diff --git a/src/linearextrude.cc b/src/linearextrude.cc
index d1d2841..3d91ac4 100644
--- a/src/linearextrude.cc
+++ b/src/linearextrude.cc
@@ -138,7 +138,6 @@ std::string LinearExtrudeNode::toString() const
if (!this->filename.empty()) { // Ignore deprecated parameters if empty
stream <<
"file = \"" << this->filename << "\", "
- "cache = \"" << QFileInfo(QString::fromStdString(this->filename)) << "\", "
"layer = \"" << this->layername << "\", "
"origin = [" << this->origin_x << ", " << this->origin_y << "], "
"scale = " << this->scale << ", ";
diff --git a/src/linearextrudenode.h b/src/linearextrudenode.h
index 503f1bd..112eccc 100644
--- a/src/linearextrudenode.h
+++ b/src/linearextrudenode.h
@@ -3,6 +3,7 @@
#include "node.h"
#include "visitor.h"
+#include "value.h"
class LinearExtrudeNode : public AbstractPolyNode
{
@@ -23,7 +24,8 @@ public:
double fn, fs, fa, height, twist;
double origin_x, origin_y, scale;
bool center, has_twist;
- std::string filename, layername;
+ Filename filename;
+ std::string layername;
virtual PolySet *evaluate_polyset(class PolySetEvaluator *) const;
};
diff --git a/src/printutils.cc b/src/printutils.cc
index ec41765..0749587 100644
--- a/src/printutils.cc
+++ b/src/printutils.cc
@@ -50,8 +50,3 @@ void PRINT_NOCACHE(const std::string &msg)
outputhandler(msg, outputhandler_data);
}
}
-
-std::ostream &operator<<(std::ostream &os, const QFileInfo &fi) {
- os << std::hex << (fi.exists()?fi.lastModified().toTime_t():0) << "." << fi.size();
- return os;
-}
diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc
index ae8793d..e64f6f1 100644
--- a/src/rotateextrude.cc
+++ b/src/rotateextrude.cc
@@ -116,7 +116,6 @@ std::string RotateExtrudeNode::toString() const
if (!this->filename.empty()) { // Ignore deprecated parameters if empty
stream <<
"file = \"" << this->filename << "\", "
- "cache = \"" << QFileInfo(QString::fromStdString(this->filename)) << "\", "
"layer = \"" << this->layername << "\", "
"origin = [" << std::dec << this->origin_x << ", " << this->origin_y << "], "
"scale = " << this->scale << ", ";
diff --git a/src/rotateextrudenode.h b/src/rotateextrudenode.h
index 613d44b..86da356 100644
--- a/src/rotateextrudenode.h
+++ b/src/rotateextrudenode.h
@@ -3,6 +3,7 @@
#include "node.h"
#include "visitor.h"
+#include "value.h"
class RotateExtrudeNode : public AbstractPolyNode
{
@@ -21,7 +22,8 @@ public:
int convexity;
double fn, fs, fa;
double origin_x, origin_y, scale;
- std::string filename, layername;
+ Filename filename;
+ std::string layername;
virtual PolySet *evaluate_polyset(class PolySetEvaluator *) const;
};
diff --git a/src/surface.cc b/src/surface.cc
index cdac4ec..ec5d790 100644
--- a/src/surface.cc
+++ b/src/surface.cc
@@ -58,7 +58,7 @@ public:
virtual std::string toString() const;
virtual std::string name() const { return "surface"; }
- std::string filename;
+ Filename filename;
bool center;
int convexity;
virtual PolySet *evaluate_polyset(class PolySetEvaluator *) const;
diff --git a/src/value.cc b/src/value.cc
index 6685594..0b7cd9b 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -28,6 +28,7 @@
#include "mathc99.h"
#include <assert.h>
#include <sstream>
+#include <QDir>
Value::Value()
{
@@ -413,3 +414,9 @@ std::ostream &operator<<(std::ostream &stream, const Value &value)
return stream;
}
+std::ostream &operator<<(std::ostream &stream, const Filename &filename)
+{
+ stream << QDir::current().relativeFilePath(QString::fromStdString(filename)).toStdString();
+ return stream;
+}
+
diff --git a/src/value.h b/src/value.h
index fb6500c..f81d28e 100644
--- a/src/value.h
+++ b/src/value.h
@@ -4,6 +4,13 @@
#include <vector>
#include <string>
+class Filename : public std::string
+{
+public:
+ Filename() : std::string() {}
+ Filename(const std::string &f) : std::string(f) {}
+};
+
class Value
{
public:
@@ -70,5 +77,6 @@ private:
};
std::ostream &operator<<(std::ostream &stream, const Value &value);
+std::ostream &operator<<(std::ostream &stream, const Filename &filename);
#endif
contact: Jan Huwald // Impressum