Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
MimePoints.cpp
1 #include "MimePoints.h"
2 
3 const QString FORMAT_CSV ("text/csv");
4 const QString FORMAT_CSV_INTERNAL ("text/engauge-points-csv"); // Custom mime type keeps points coordinates internal to engauge
5 const QString FORMAT_HTML ("text/html");
6 const QString FORMAT_PLAIN ("text/plain");
7 
9 {
10 }
11 
12 MimePoints::MimePoints(const QString &csvGraph,
13  const QString &htmlGraph) :
14  m_csvGraph (csvGraph),
15  m_htmlGraph (htmlGraph)
16 {
17  m_formats << FORMAT_CSV << FORMAT_HTML << FORMAT_PLAIN;
18 }
19 
20 MimePoints::MimePoints (const QString &csvPoints) :
21  m_csvPoints (csvPoints)
22 {
23  m_formats << FORMAT_CSV_INTERNAL;
24 }
25 
27 {
28  m_csvGraph = other.csvGraph();
29  m_csvPoints = other.csvPoints();
30  m_htmlGraph = other.htmlGraph();
31  m_formats = other.formats();
32 
33  return *this;
34 }
35 
37 {
38 }
39 
40 QString MimePoints::csvGraph () const
41 {
42  return m_csvGraph;
43 }
44 
45 QString MimePoints::csvPoints () const
46 {
47  return m_csvPoints;
48 }
49 
50 QStringList MimePoints::formats() const
51 {
52  return m_formats;
53 }
54 
55 QString MimePoints::htmlGraph () const
56 {
57  return m_htmlGraph;
58 }
59 
60 QVariant MimePoints::retrieveData (const QString &format,
61  QVariant::Type /* preferredType */) const
62 {
63  if (format == FORMAT_CSV) {
64  return m_csvGraph;
65  } else if (format == FORMAT_CSV_INTERNAL) {
66  return m_csvPoints;
67  } else if (format == FORMAT_HTML) {
68  return m_htmlGraph;
69  } else if (format == FORMAT_PLAIN) {
70  return m_csvGraph;
71  } else {
72  QVariant null;
73  return null;
74  }
75 }
MimePoints()
Default constructor. Initial contents are overwritten by other constructors.
Definition: MimePoints.cpp:8
virtual QStringList formats() const
Available formats, which depend on whether or not the transform is defined.
Definition: MimePoints.cpp:50
Custom mime type for separate treatment of graph coordinates and, when there is no transform...
Definition: MimePoints.h:7
virtual ~MimePoints()
Destructor.
Definition: MimePoints.cpp:36
QString htmlGraph() const
Get methjod for htmlGraph.
Definition: MimePoints.cpp:55
QString csvGraph() const
Get method for csvGraph.
Definition: MimePoints.cpp:40
virtual QVariant retrieveData(const QString &format, QVariant::Type preferredType) const
Returns a variant with the data for the specified format.
Definition: MimePoints.cpp:60
QString csvPoints() const
Get method for csvPoints.
Definition: MimePoints.cpp:45
MimePoints & operator=(const MimePoints &other)
Assignment operator.
Definition: MimePoints.cpp:26