home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bvcddoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  4.6 KB  |  193 lines

  1. /*
  2. *
  3. * $Id: k3bvcddoc.h 619556 2007-01-03 17:38:12Z trueg $
  4. * Copyright (C) 2003-2004 Christian Kvasny <chris@k3b.org>
  5. *
  6. * This file is part of the K3b project.
  7. * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. * See the file "COPYING" for the exact licensing terms.
  14. */
  15.  
  16. #ifndef K3BVCDDOC_H
  17. #define K3BVCDDOC_H
  18.  
  19. // Qt Includes
  20. #include <qptrqueue.h>
  21. #include <qfile.h>
  22. #include <qstring.h>
  23. #include <qstringlist.h>
  24. #include <qdatetime.h>
  25. #include <qtextstream.h>
  26. #include <qimage.h>
  27.  
  28. // Kde Includes
  29. #include <kurl.h>
  30.  
  31. // K3b Includes
  32. #include "k3bvcdoptions.h"
  33. #include "mpeginfo/k3bmpeginfo.h"
  34. #include <k3bdoc.h>
  35. #include "k3b_export.h"
  36. class K3bApp;
  37. class K3bVcdTrack;
  38. class K3bVcdJob;
  39. //class K3bView;
  40. class QWidget;
  41. class QTimer;
  42. class QDomDocument;
  43. class QDomElement;
  44. class KConfig;
  45.  
  46.  
  47.  
  48. class LIBK3B_EXPORT K3bVcdDoc : public K3bDoc
  49. {
  50.         Q_OBJECT
  51.  
  52.     public:
  53.         K3bVcdDoc( QObject* );
  54.         ~K3bVcdDoc();
  55.  
  56.     int type() const { return VCD; }
  57.  
  58.     QString name() const;
  59.  
  60.         enum vcdTypes { VCD11, VCD20, SVCD10, HQVCD, NONE};
  61.  
  62.         bool newDocument();
  63.         int numOfTracks() const
  64.         {
  65.             return m_tracks->count();
  66.         }
  67.  
  68.         const QString& vcdImage() const
  69.         {
  70.             return m_vcdImage;
  71.         }
  72.         void setVcdImage( const QString& s )
  73.         {
  74.             m_vcdImage = s;
  75.         }
  76.  
  77.         K3bVcdTrack* first()
  78.         {
  79.             return m_tracks->first();
  80.         }
  81.         K3bVcdTrack* current() const
  82.         {
  83.             return m_tracks->current();
  84.         }
  85.         K3bVcdTrack* next()
  86.         {
  87.             return m_tracks->next();
  88.         }
  89.         K3bVcdTrack* prev()
  90.         {
  91.             return m_tracks->prev();
  92.         }
  93.         K3bVcdTrack* at( uint i )
  94.         {
  95.             return m_tracks->at( i );
  96.         }
  97.         K3bVcdTrack* take( uint i )
  98.         {
  99.             return m_tracks->take( i );
  100.         }
  101.  
  102.         const QPtrList<K3bVcdTrack>* tracks() const
  103.         {
  104.             return m_tracks;
  105.         }
  106.  
  107.         /** get the current size of the project */
  108.         KIO::filesize_t size() const;
  109.         K3b::Msf length() const;
  110.  
  111.         K3bBurnJob* newBurnJob( K3bJobHandler* hdl, QObject* parent );
  112.         K3bVcdOptions* vcdOptions() const
  113.         {
  114.             return m_vcdOptions;
  115.         }
  116.  
  117.         int vcdType() const
  118.         {
  119.             return m_vcdType;
  120.         }
  121.         void setVcdType( int type );
  122.         void setPbcTracks();
  123.  
  124.     public slots:
  125.         /**
  126.          * will test the file and add it to the project.
  127.          * connect to at least result() to know when
  128.          * the process is finished and check error()
  129.          * to know about the result.
  130.          **/
  131.         void addUrls( const KURL::List& );
  132.         void addTrack( const KURL&, uint );
  133.         void addTracks( const KURL::List&, uint );
  134.         /** adds a track without any testing */
  135.         void addTrack( K3bVcdTrack* track, uint position = 0 );
  136.  
  137.         // --- TODO: this should read: removeTrack( K3bVcdTrack* )
  138.         void removeTrack( K3bVcdTrack* );
  139.         void moveTrack( const K3bVcdTrack* track, const K3bVcdTrack* after );
  140.  
  141.     protected slots:
  142.         /** processes queue "urlsToAdd" **/
  143.         void slotWorkUrlQueue();
  144.  
  145.     signals:
  146.         void newTracks();
  147.  
  148.         void trackRemoved( K3bVcdTrack* );
  149.  
  150.     protected:
  151.         /** reimplemented from K3bDoc */
  152.         bool loadDocumentData( QDomElement* root );
  153.         /** reimplemented from K3bDoc */
  154.         bool saveDocumentData( QDomElement* );
  155.  
  156.         QString typeString() const;
  157.  
  158.     private:
  159.         K3bVcdTrack* createTrack( const KURL& url );
  160.         void informAboutNotFoundFiles();
  161.  
  162.         QStringList m_notFoundFiles;
  163.         QString m_vcdImage;
  164.  
  165.         class PrivateUrlToAdd
  166.         {
  167.             public:
  168.                 PrivateUrlToAdd( const KURL& u, int _pos )
  169.                         : url( u ), position( _pos )
  170.                 {}
  171.                 KURL url;
  172.                 int position;
  173.         };
  174.  
  175.         /** Holds all the urls that have to be added to the list of tracks. **/
  176.         QPtrQueue<PrivateUrlToAdd> urlsToAdd;
  177.         QTimer* m_urlAddingTimer;
  178.  
  179.         QPtrList<K3bVcdTrack>* m_tracks;
  180.         KIO::filesize_t calcTotalSize() const;
  181.         KIO::filesize_t ISOsize() const;
  182.  
  183.         bool isImage( const KURL& url );
  184.  
  185.         K3bVcdTrack* m_lastAddedTrack;
  186.         K3bVcdOptions* m_vcdOptions;
  187.  
  188.         int m_vcdType;
  189.         uint lastAddedPosition;
  190. };
  191.  
  192. #endif
  193.