Engauge Digitizer  2
MimePointsExport.cpp
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "MimePointsExport.h"
8 
9 const QString FORMAT_CSV ("text/csv");
10 const QString FORMAT_CSV_INTERNAL ("text/engauge-points-csv"); // Custom mime type keeps points coordinates internal to engauge
11 const QString FORMAT_HTML ("text/html");
12 const QString FORMAT_PLAIN ("text/plain");
13 
15 {
16 }
17 
18 MimePointsExport::MimePointsExport(const QString &csvGraph,
19  const QString &htmlGraph) :
20  m_csvGraph (csvGraph),
21  m_htmlGraph (htmlGraph)
22 {
23  m_formats << FORMAT_CSV << FORMAT_HTML << FORMAT_PLAIN;
24 }
25 
26 MimePointsExport::MimePointsExport (const QString &csvPoints) :
27  m_csvPoints (csvPoints)
28 {
29  m_formats << FORMAT_CSV_INTERNAL;
30 }
31 
33 {
34  m_csvGraph = other.csvGraph();
35  m_csvPoints = other.csvPoints();
36  m_htmlGraph = other.htmlGraph();
37  m_formats = other.formats();
38 
39  return *this;
40 }
41 
43 {
44 }
45 
47 {
48  return m_csvGraph;
49 }
50 
52 {
53  return m_csvPoints;
54 }
55 
56 QStringList MimePointsExport::formats() const
57 {
58  return m_formats;
59 }
60 
62 {
63  return m_htmlGraph;
64 }
65 
66 QVariant MimePointsExport::retrieveData (const QString &format,
67  QVariant::Type /* preferredType */) const
68 {
69  if (format == FORMAT_CSV) {
70  return m_csvGraph;
71  } else if (format == FORMAT_CSV_INTERNAL) {
72  return m_csvPoints;
73  } else if (format == FORMAT_HTML) {
74  return m_htmlGraph;
75  } else if (format == FORMAT_PLAIN) {
76  return m_csvGraph;
77  } else {
78  QVariant null;
79  return null;
80  }
81 }
MimePointsExport.h
MimePointsExport::csvPoints
QString csvPoints() const
Get method for csvPoints.
Definition: MimePointsExport.cpp:51
MimePointsExport::formats
virtual QStringList formats() const
Available formats, which depend on whether or not the transform is defined.
Definition: MimePointsExport.cpp:56
FORMAT_CSV
const QString FORMAT_CSV("text/csv")
MimePointsExport::~MimePointsExport
virtual ~MimePointsExport()
Destructor.
Definition: MimePointsExport.cpp:42
FORMAT_HTML
const QString FORMAT_HTML("text/html")
MimePointsExport::operator=
MimePointsExport & operator=(const MimePointsExport &other)
Assignment operator.
Definition: MimePointsExport.cpp:32
FORMAT_PLAIN
const QString FORMAT_PLAIN("text/plain")
MimePointsExport::retrieveData
virtual QVariant retrieveData(const QString &format, QVariant::Type preferredType) const
Returns a variant with the data for the specified format.
Definition: MimePointsExport.cpp:66
MimePointsExport::htmlGraph
QString htmlGraph() const
Get methjod for htmlGraph.
Definition: MimePointsExport.cpp:61
MimePointsExport::csvGraph
QString csvGraph() const
Get method for csvGraph.
Definition: MimePointsExport.cpp:46
FORMAT_CSV_INTERNAL
const QString FORMAT_CSV_INTERNAL("text/engauge-points-csv")
MimePointsExport
Custom mime type for separate treatment of graph coordinates and, when there is no transform,...
Definition: MimePointsExport.h:15
MimePointsExport::MimePointsExport
MimePointsExport()
Default constructor. Initial contents are overwritten by other constructors.
Definition: MimePointsExport.cpp:14