COPASI API  4.16.103
CQNotes.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef COPASI_CQNotes
7 #define COPASI_CQNotes
8 
9 #include <QtGui/QWidget>
10 #include <QtCore/QVariant>
11 #include <QtXml/QXmlDefaultHandler>
12 
13 #include "copasi/UI/ui_CQNotes.h"
14 #include "copasi/UI/CQValidator.h"
15 
16 class CQValidatorXML : public CQValidator< QPlainTextEdit >
17 {
18  // Operations
19 public:
20  CQValidatorXML(QPlainTextEdit * parent, const char * name = 0);
21 
22  virtual State validate(QString & input, int & pos) const;
23 
24  const bool & isFreeText() const;
25 
26  const bool & needsWrap() const;
27 
28 private:
29  // Attributes
30  mutable bool mIsFreeText;
31 
32  mutable bool mNeedsWrap;
33 };
34 
35 class CQNotesContentHandler : public QXmlDefaultHandler
36 {
37 public:
38  // Operations
40 
42 
43  virtual bool startDocument();
44 
45  virtual bool startElement(const QString & namespaceURI,
46  const QString & localName,
47  const QString & qName,
48  const QXmlAttributes & atts);
49 
50  virtual bool endElement(const QString & namespaceURI,
51  const QString & localName,
52  const QString & qName);
53 
54  const bool & isFreeText() const;
55 
56  bool needsWrap() const;
57 
58 private:
59  // Attributes
61 
62  bool mNeedsWrap;
63 
64  size_t mLevel;
65 };
66 
67 class CQNotes : public CopasiWidget, public Ui::CQNotes
68 {
69  Q_OBJECT
70 
71 public:
72  CQNotes(QWidget* parent = 0, const char* name = 0);
73  ~CQNotes();
74 
75  virtual bool update(ListViews::ObjectType objectType, ListViews::Action action, const std::string & key);
76  virtual bool leave();
77 
78 protected slots:
79  void slotToggleMode();
80  void slotOpenUrl(const QUrl & url);
81  void slotValidateXML();
82  void slotBtnCopy();
83 
84 protected:
85  virtual bool enterProtected();
86 
87 private:
88  void load();
89  void save();
90 
91  bool mEditMode;
92  bool mChanged;
94  QValidator::State mValidity;
95 
96  std::string mKeyToCopy;
97 };
98 
99 #endif // COPASI_CQNotes
objectType
const bool & isFreeText() const
Definition: CQNotes.cpp:63
bool needsWrap() const
Definition: CQNotes.cpp:127
virtual bool leave()
Definition: CQNotes.cpp:199
CQValidatorXML(QPlainTextEdit *parent, const char *name=0)
Definition: CQNotes.cpp:32
bool mChanged
Definition: CQNotes.h:92
void save()
Definition: CQNotes.cpp:327
virtual bool update(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
Definition: CQNotes.cpp:162
bool mIsFreeText
Definition: CQNotes.h:30
void slotOpenUrl(const QUrl &url)
Definition: CQNotes.cpp:383
CQValidatorXML * mpValidatorXML
Definition: CQNotes.h:93
bool mEditMode
Definition: CQNotes.h:91
const bool & needsWrap() const
Definition: CQNotes.cpp:68
const bool & isFreeText() const
Definition: CQNotes.cpp:122
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Definition: CQNotes.cpp:113
void slotToggleMode()
Definition: CQNotes.cpp:237
virtual bool enterProtected()
Definition: CQNotes.cpp:219
void load()
Definition: CQNotes.cpp:289
~CQNotes()
Definition: CQNotes.cpp:153
CQNotes(QWidget *parent=0, const char *name=0)
Definition: CQNotes.cpp:132
virtual State validate(QString &input, int &pos) const
Definition: CQNotes.cpp:39
virtual bool startDocument()
Definition: CQNotes.cpp:84
void slotValidateXML()
Definition: CQNotes.cpp:258
std::string mKeyToCopy
Definition: CQNotes.h:96
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Definition: CQNotes.cpp:93
void slotBtnCopy()
Definition: CQNotes.cpp:156
QValidator::State mValidity
Definition: CQNotes.h:94
bool mNeedsWrap
Definition: CQNotes.h:32