Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
resource.h
Go to the documentation of this file.
1 
8 #ifndef RESOURCE_H_
9 #define RESOURCE_H_
10 
11 #include <QUrl>
12 
13 class CADocument;
14 
15 class CAResource {
16 public:
18  Undefined=-1, // error
19  Image, // vector or bitmap image or an icon
20  Sound, // sound sample, midi etc.
21  Movie, // movie clip
22  Document, // Canorus, pdf or other score document
23  Other // other resources
24  };
25 
26  CAResource( QUrl fileName, QString name, bool linked=false, CAResourceType t=Other, CADocument *c=0 );
27  virtual ~CAResource();
28 
29  inline void setName( const QString n ) { _name = n; }
30  inline const QString name() { return _name; }
31 
32  inline void setDescription( const QString n ) { _description = n; }
33  inline const QString description() { return _description; }
34 
35  inline void setUrl( const QUrl url ) { _url = url; }
36  inline const QUrl url() { return _url; }
37 
38  inline void setResourceType( const CAResourceType t ) { _resType = t; }
39  inline const CAResourceType resourceType() { return _resType; }
40 
41  inline void setLinked( bool l ) { _linked = l; }
42  inline bool isLinked() { return _linked; }
43 
44  inline void setDocument( CADocument *d ) { _document = d; }
45  inline CADocument *document() { return _document; }
46 
47  bool copy( QString fileName );
48 
49  static QString resourceTypeToString( CAResourceType type );
50  static CAResourceType resourceTypeFromString( QString type );
51 
52 private:
53  QString _name;
54  QString _description;
55  QUrl _url; // Absolute path to resource. Becomes relative if "file://" scheme when saved.
57  bool _linked;
59 };
60 
61 #endif /* RESOURCE_H_ */