Engauge Digitizer 2
Loading...
Searching...
No Matches
MimePoints.cpp
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 "MimePoints.h"
8
9const QString FORMAT_CSV ("text/csv");
10const QString FORMAT_CSV_INTERNAL ("text/engauge-points-csv"); // Custom mime type keeps points coordinates internal to engauge
11const QString FORMAT_HTML ("text/html");
12const QString FORMAT_PLAIN ("text/plain");
13
17
18MimePoints::MimePoints(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
26MimePoints::MimePoints (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
45
46QString MimePoints::csvGraph () const
47{
48 return m_csvGraph;
49}
50
51QString MimePoints::csvPoints () const
52{
53 return m_csvPoints;
54}
55
56QStringList MimePoints::formats() const
57{
58 return m_formats;
59}
60
61QString MimePoints::htmlGraph () const
62{
63 return m_htmlGraph;
64}
65
66QVariant MimePoints::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}
Custom mime type for separate treatment of graph coordinates and, when there is no transform,...
Definition MimePoints.h:14
virtual QStringList formats() const
Available formats, which depend on whether or not the transform is defined.
MimePoints()
Default constructor. Initial contents are overwritten by other constructors.
MimePoints & operator=(const MimePoints &other)
Assignment operator.
QString csvPoints() const
Get method for csvPoints.
virtual QVariant retrieveData(const QString &format, QVariant::Type preferredType) const
Returns a variant with the data for the specified format.
QString csvGraph() const
Get method for csvGraph.
virtual ~MimePoints()
Destructor.
QString htmlGraph() const
Get methjod for htmlGraph.