- Namespaced QBittorrentSession and QTorrentHandle to avoid possible future conflicts
[qtrapids] / src / engine / QTorrentHandle.h
index c102086..855f0ca 100644 (file)
 
 typedef libtorrent::torrent_status TorrentStatus;
 typedef libtorrent::torrent_info TorrentInfo;
+typedef libtorrent::torrent_handle TorrentHandle;
+
 
 /**
        @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
 */
-class QTorrentHandle 
-{
+
+namespace qtrapids {
        
-       public:
-               QTorrentHandle(libtorrent::torrent_handle handle);
-    ~QTorrentHandle();
-               
+       class QTorrentHandle 
+       {
+               public:
+                       
+                       enum State {
+                               QUEUED_FOR_CHECKING = TorrentStatus::queued_for_checking,
+                               CHECKING_FILES,
+                               DOWNLOADING_METADATA,
+                               DOWNLOADING,
+                               FINISHED,
+                               SEEDING,
+                               ALLOCATING,
+                               UNSPECIFIED
+                       };
+                       
+                       QTorrentHandle(libtorrent::torrent_handle handle);
+                       ~QTorrentHandle();
+                       
 
-               TorrentStatus status() const;
-               
-               TorrentInfo const& getTorrentInfo() const;
-               
-               bool isValid() const;
+                       
+                       TorrentInfo const& getTorrentInfo() const;
+                       
+                       bool isValid() const;
 
-               QString name() const;
-               size_t getTotalSize() const;
-               QString state() const;
-               float progress() const;
-               float uploadRate() const;
-               float downloadRate() const;
-               qint32 numSeeds() const;
-               qint32 numLeeches() const;
-               qint32 ratio() const;
+                       QString name() const;
+                       size_t getTotalSize() const;
+                       QTorrentHandle::State state() const;
+                       float progress() const;
+                       float uploadRate() const;
+                       float downloadRate() const;
+                       qint32 numSeeds() const;
+                       qint32 numLeeches() const;
+                       qint32 ratio() const;
+                       
+                       TorrentHandle getHandle() const;
+                       
+                       bool operator==(QTorrentHandle const& h) const; 
+                       bool operator<(QTorrentHandle const& h) const;
+                       
+               private:
+                       QTorrentHandle(); // Prevent default construct.
+                       TorrentHandle torrentHandle_;
                
+                       TorrentStatus status() const;
 
-               bool operator==(QTorrentHandle const& h); 
-               bool operator<(QTorrentHandle const& h);
-               
-       private:
-               QTorrentHandle(); // Prevent default construct.
-               libtorrent::torrent_handle torrentHandle_;
-               
-               // Private functions.
-               QString GetStatusString(TorrentStatus const& status) const;
-};
+       };
 
+} // namespace qtrapids
 #endif