blob: 633bbc857cfa715972598faf2b08086e2fe22a85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
/*
**************************************************************************
description
--------------------
copyright : (C) 2002 by Luis Carvalho
email : [email protected]
**************************************************************************
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef PMLIBRARYOBJECT_H
#define PMLIBRARYOBJECT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tqstring.h>
#include <tqmap.h>
#include <tqvaluelist.h>
#include <kstaticdeleter.h>
#include <tqstringlist.h>
class KURL;
class KArchive;
class KTar;
class TQImage;
/**
* This class implements a library object.
*
* A library object has a name, a textual description, a graphical
* preview and the object data, of course. It also contains a collection of
* keywords.
*
* When an instance of PMLibraryObject is created, the objects description is
* loaded.
*
* The graphical preview and the objects data are loaded only if needed.
*
*/
class PMLibraryObject
{
public:
/**
* Constructor for the library object. Creates an empty library object.
*/
PMLibraryObject( );
/**
* Constructor for the library object.
* Loads the object data from the specified library object file.
*/
PMLibraryObject( KURL u );
/**
* Destructor
*/
~PMLibraryObject( );
/**
* Name of the library object.
*/
TQString name( ) const { return m_name; }
/**
* Textual description of the library object.
*/
TQString description( ) const { return m_description; }
/**
* List of keywords for search of the library object.
*/
TQString keywords( ) const { return m_keywords; }
/**
* Graphical Preview.
*/
TQImage* preview( );
/**
* True is the preview has been loaded.
*/
bool isPreviewLoaded( ) const { return m_previewLoaded; }
/**
* Objects for the scene
*/
TQByteArray* objects( );
bool areObjectsLoaded( ) const { return m_objectsLoaded; }
/**
* Set the library object name
*/
void setName( const TQString& str );
/**
* Set the library object description
*/
void setDescription( const TQString& str );
/**
* Set the library object keywords
*/
void setKeywords( const TQString& str );
/**
* Set the preview image
*/
void setPreview( const TQImage& img );
/**
* Set the object data
*/
void setObjects( const TQByteArray& obj );
/**
* Save the library object to a file
*/
void save( const TQString& fileName );
private:
void loadLibraryInfo( );
void saveLibraryInfo( );
void savePreview( );
void saveObjects( );
bool m_previewLoaded;
bool m_objectsLoaded;
TQString m_name;
TQString m_description;
TQString m_keywords;
KTar* m_data;
TQImage* m_preview;
TQByteArray* m_objects;
TQStringList m_extraFiles;
};
#endif
|