Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/core/resource.h
Go to the documentation of this file.
00001 
00008 #ifndef RESOURCE_H_
00009 #define RESOURCE_H_
00010 
00011 #include <QUrl>
00012 
00013 class CADocument;
00014 
00015 class CAResource {
00016 public:
00017         enum CAResourceType {
00018                 Undefined=-1, // error
00019                 Image,        // vector or bitmap image or an icon
00020                 Sound,        // sound sample, midi etc.
00021                 Movie,        // movie clip
00022                 Document,     // Canorus, pdf or other score document
00023                 Other         // other resources
00024         };
00025 
00026         CAResource( QUrl fileName, QString name, bool linked=false, CAResourceType t=Other, CADocument *c=0 );
00027         virtual ~CAResource();
00028 
00029         inline void setName( const QString n ) { _name = n; }
00030         inline const QString name() { return _name; }
00031 
00032         inline void setDescription( const QString n ) { _description = n; }
00033         inline const QString description() { return _description; }
00034 
00035         inline void setUrl( const QUrl url ) { _url = url; }
00036         inline const QUrl url() { return _url; }
00037 
00038         inline void setResourceType( const CAResourceType t ) { _resType = t; }
00039         inline const CAResourceType resourceType() { return _resType; }
00040 
00041         inline void setLinked( bool l ) { _linked = l; }
00042         inline bool isLinked() { return _linked; }
00043 
00044         inline void setDocument( CADocument *d ) { _document = d; }
00045         inline CADocument *document() { return _document; }
00046 
00047         bool copy( QString fileName );
00048 
00049         static QString resourceTypeToString( CAResourceType type );
00050         static CAResourceType resourceTypeFromString( QString type );
00051 
00052 private:
00053         QString _name;
00054         QString _description;
00055         QUrl _url;               // Absolute path to resource. Becomes relative if "file://" scheme when saved.
00056         CAResourceType _resType;
00057         bool _linked;
00058         CADocument *_document;
00059 };
00060 
00061 #endif /* RESOURCE_H_ */