SymbolEditor  1.3.0
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
SymbolLibrary.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2011 by Stephen Allewell *
3  * sallewell@users.sourceforge.net *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  ********************************************************************************/
10 
11 
18 #ifndef SymbolLibrary_H
19 #define SymbolLibrary_H
20 
21 
22 #include <QMap>
23 #include <QPainterPath>
24 #include <QUndoStack>
25 
26 #include <KUrl>
27 
28 #include "Symbol.h"
29 
30 
31 class QDataStream;
32 class QListWidgetItem;
33 
34 class SymbolListWidget;
35 
36 
47 {
48 public:
49  explicit SymbolLibrary(SymbolListWidget *listWidget = 0);
51 
52  void clear();
53 
54  Symbol symbol(qint16 index);
55  Symbol takeSymbol(qint16 index);
56  qint16 setSymbol(qint16 index, const Symbol &symbol);
57 
58  QString name() const;
59  void setName(const QString &name);
60 
61  QList<qint16> indexes() const;
62 
63  QUndoStack *undoStack();
64 
65  friend QDataStream &operator<<(QDataStream &stream, const SymbolLibrary &library);
66  friend QDataStream &operator>>(QDataStream &stream, SymbolLibrary &library);
67 
68 private:
69  void generateItems();
70 
71  static const qint32 version = 101;
73  QUndoStack m_undoStack;
75  QString m_name;
79  qint16 m_nextIndex;
80  QMap<qint16, Symbol> m_symbols;
81 };
82 
83 
84 QDataStream &operator<<(QDataStream &stream, const SymbolLibrary &library);
85 QDataStream &operator>>(QDataStream &stream, SymbolLibrary &library);
86 
87 
88 #endif
89